﻿function checkform(a){
with(a){
	if (title.value=="") {
	alert("留言主题不能为空！");
	title.focus();
	return false;
	}
	  if (username.value=="") {
	alert("请输入你的姓名，以便我们及时与你们联系！");
	username.focus();
	return false;
	}
	if (com.value=="") {
	alert("公司名称不能为空！");
	com.focus();
	return false;
	}
	if (tel.value=="") {
	alert("请输入你的联系电话！");
	tel.focus();
	return false;
	}
  if(email.value!=""){
	var myemail = email.value; 
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
	flag = pattern.test(myemail); 
	if(!flag){ 
		alert("你输入的邮箱格式不对!"); 
		email.focus(); 
		return false; 
	}
	}
	if (checkcode.value=="") {
	alert("附加码不能为空！");
	checkcode.focus();
	return false;
	}
	if (content.value=="") {
	alert("留言内容不能为空吧！");
	content.focus();
	return false;
	}
}
}

function checkformen(a){
with(a){
	if (title.value=="") {
	alert("Subject can not be empty!");
	title.focus();
	return false;
	}
	  if (username.value=="") {
	alert("Please enter your name, so that we can promptly contact with you!");
	username.focus();
	return false;
	}
	if (com.value=="") {
	alert("Company name can not be empty!");
	com.focus();
	return false;
	}
	if (tel.value=="") {
	alert("  Please enter your contact phone! ");
	tel.focus();
	return false;
	}
  if(email.value!=""){
	var myemail = email.value; 
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
	flag = pattern.test(myemail); 
	if(!flag){ 
		alert("Enter your e-mail format wrong!"); 
		email.focus(); 
		return false; 
	}
	}
	if (checkcode.value=="") {
	alert("VerifyCode can not be empty!");
	checkcode.focus();
	return false;
	}
	if (content.value=="") {
	alert("Content can not be empty!");
	content.focus();
	return false;
	}
}
}

function checkorder(a){
with(a){
	if (proname.value=="") {
	alert("产品名称不能为空！");
	proname.focus();
	return false;
	}
	if (nums.value=="") {
	alert("请选择你要购买的数量！");
	nums.focus();
	return false;
	}
	if(isNaN(nums.value)) {
	alert("你填写的购买数量有误，请重新输入！")
	nums.focus();
	return false;
	}
	if (username.value=="") {
	alert("请输入你的姓名！");
	username.focus();
	return false;
	}
	if (com.value=="") {
	alert("公司名称不能为空，个人请填姓名！");
	com.focus();
	return false;
	}
	if (tel.value=="") {
	alert("请输入你的联系电话！");
	tel.focus();
	return false;
	}
	if (checkcode.value=="") {
	alert("附加码不能为空！");
	checkcode.focus();
	return false;
	}
}
}

function checkNum(obj){
	var checkOK = "0123456789";
	var checkStr = obj.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
	}
	if (!allValid){
		alert("只能由数字组成！");
		obj.value="";
		obj.select();
		return (false);
	}
	return (true);	
}

function checkNumen(obj){
	var checkOK = "0123456789. ";
	var checkStr = obj.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length){
			allValid = false;
			break;
		}
	}
	if (!allValid){
		alert("Only by the numbers!");
		obj.value="";
		obj.select();
		return (false);
	}
	return (true);	
}

function checkorderen(a){
with(a){
	if (proname.value=="") {
	alert("Product name can not be empty!");
	proname.focus();
	return false;
	}
	if (username.value=="") {
	alert("Please enter your name, so we have timely contact with you!");
	username.focus();
	return false;
	}
	if (com.value=="") {
	alert("Company name can not be empty!");
	com.focus();
	return false;
	}
	if (tel.value=="") {
	alert("Please enter your contact phone!");
	tel.focus();
	return false;
	}
	if (checkcode.value=="") {
	alert("VerifyCode can not be empty!");
	checkcode.focus();
	return false;
	}
  if(email.value!=""){
	var myemail = email.value; 
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
	flag = pattern.test(myemail); 
	if(!flag){ 
		alert("E-mail your input format wrong!"); 
		email.focus(); 
		return false; 
	}
	}
	if (checkcode.value=="") {
	alert("VerifyCode can not be empty!");
	checkcode.focus();
	return false;
	}
}
}
//-->