function checkform(theForm)
{
	if (theForm.name.value=="" || checkspace(theForm.name.value)==1)
	{
		theForm.name.value="";
		theForm.name.focus();
		alert("请填写姓名！");
		return false;
	}
	if (theForm.idnumber.value=="" || checkspace(theForm.idnumber.value)==1)
	{
		theForm.idnumber.value="";
		theForm.idnumber.focus();
		alert("请填写身份证号！");
		return false;
	}
	if (checknumber(theForm.idnumber.value)==1 || checklong(theForm.idnumber.value,15)==1 && checklong(theForm.idnumber.value,18)==1)
	{
		theForm.idnumber.focus();
		alert("身份证号格式错误，请重新填写！");
		return false;
	}
	if ((theForm.city.value=="") || (theForm.city.value=="-1"))
	{
		alert("请选择所在城市！");
		return false;
	}
	if (theForm.address.value=="" || checkspace(theForm.address.value)==1)
	{
		theForm.address.value="";
		theForm.address.focus();
		alert("请填写邮政地址！");
		return false;
	}
	if (theForm.postcode.value=="" || checkspace(theForm.postcode.value)==1)
	{
		theForm.postcode.value="";
		theForm.postcode.focus();
		alert("请填写邮政编码！");
		return false;
	}
	if (checknumber(theForm.postcode.value)==1 || checklong(theForm.postcode.value,6)==1)
	{
		theForm.postcode.focus();
		alert("邮政编码格式错误，请重新填写！");
		return false;
	}
	if (theForm.tel.value=="" || checkspace(theForm.tel.value)==1)
	{
		theForm.tel.value="";
		theForm.tel.focus();
		alert("请填写联系电话！");
		return false;
	}
	if (!checkemail(theForm.email.value))
	{
		theForm.email.value="";
		theForm.email.focus();
		alert("请填写邮件地址！");
		return false;
	}
	if (checkspace(theForm.prov.value)==1)
	{
		theForm.prov.value="";
	}
	if (checkspace(theForm.fax.value)==1)
	{
		theForm.fax.value="";
	}
	return true;
}
function checkspace(str)
{
	var i;
	
	i=0;
	while (i<str.length)
	{
		if (str.charAt(i)!=' ')
			return 0;
		i++;
	}
	return 1;
}
function checknumber(str)
{
	var i=0;
	
	while (i<str.length)
	{
		if (str.charAt(i)<'0' || str.charAt(i)>'9')
		{
			return 1;
		}
		i++;
	}
	return 0;
}
function checklong(str,len)
{
	if (str.length!=parseInt(len))
	{
		return 1;
	}
	return 0;
}
function checkemail(str){
	if(str.indexOf("@")==-1){
		alert("您填写了无效的Email地址\n为了确保您能收到我们的商品\n请填写以下形式的Email:yourname@domainname");
		return false;
	}
	if(str.substring(str.indexOf("@")+1,str.length).indexOf("@")!=-1){
		alert("您填写了无效的Email地址\n为了确保您能收到我们的商品\n请填写以下形式的Email:yourname@domainname");
		return false;
	}
	if(str.indexOf(".")==-1){
		alert("您填写的Email是无效的\n为了确保您能收到我们的商品\n请填写形如youname@domainname.com的Email地址");
		return false;
	}
	if(str.length<7){
		alert("您填写的Email是无效的\n为了确保您能收到我们的商品\n请填写形如youname@domainname.com的Email地址");
		return false;
	}
	if(str.indexOf("!")!=-1 || str.indexOf("\"")!=-1 || str.indexOf("#")!=-1 && str.indexOf("$")!=-1 || str.indexOf("%")!=-1 || str.indexOf("'")!=-1 || str.indexOf("(")!=-1 || str.indexOf(")")!=-1 || str.indexOf("*")!=-1 || str.indexOf("+")!=-1){
		alert("您填写的Email是无效的\n为了确保您能收到我们的商品\n请填写形如youname@domainname.com的Email地址");
		return false;
	}

	return true;

}