function check_signin()
{
	if(document.Form1.username.value.length<4||document.Form1.username.value.length>12)
	{
	  alert("用户名长度应大于4个字符，小于12个字符！");
	  document.Form1.username.select();
	  return false;
	 }
  if(document.Form1.pwd.value.length<4||document.Form1.pwd.value.length>12)
	{
	  alert("密码长度应大于4个字符，小于12个字符！");
	  document.Form1.pwd.select();
	  return false;
	}
	return true;	

}

function check_addcustomer()
{
	 if(document.Form1.companyname.value=="")
	  {
		 alert("请输入公司名称.");
		 document.Form1.companyname.select();
		 return false;
	  }
	  if(document.Form1.contactperson.value=="")
	  {
		 alert("请输入联系人姓名.");
		 document.Form1.contactperson.select();
		 return false;
	  }
	  if(document.Form1.contacttel.value=="")
	  {
		 alert("请输入电话.");
		 document.Form1.contacttel.select();
		 return false;
	  }
	  if(document.Form1.contactemail.value=="")
	  {
		 alert("请输入E-mail.");
		 document.Form1.contactemail.select();
		 return false;
	  }
	  if(document.Form1.username.value=="")
	  {
		 alert("请输入帐户名称.");
		 document.Form1.username.select();
		 return false;
	  }
	  if(document.Form1.pwd.value=="")
	  {
		 alert("请输入密码.");
		 document.Form1.pwd.select();
		 return false;
	  }
	  return true;
}
function check_updatecontact()
{
	 if(document.Form1.companyname.value=="")
	  {
		 alert("请输入公司名称.");
		 document.Form1.companyname.select();
		 return false;
	  }
	  if(document.Form1.contactperson.value=="")
	  {
		 alert("请输入联系人姓名.");
		 document.Form1.contactperson.select();
		 return false;
	  }
	  if(document.Form1.contacttel.value=="")
	  {
		 alert("请输入电话.");
		 document.Form1.contacttel.select();
		 return false;
	  }
	  if(document.Form1.contactemail.value=="")
	  {
		 alert("请输入E-mail.");
		 document.Form1.contactemail.select();
		 return false;
	  }
	  if(document.Form1.contactadd.value=="")
	  {
		 alert("请输入公司地址.");
		 document.Form1.contactadd.select();
		 return false;
	  }
	  if(document.Form1.contacturl.value=="")
	  {
		 alert("请输入公司网址.");
		 document.Form1.contacturl.select();
		 return false;
	  }
	  return true;
	  
}


function check_catalog1()
	{
	  if(document.Form1.CatalogName.value=="")
	  {
		 alert("请输入产品目录.");
		 document.Form1.CatalogName.select();
		 return false;
	  }
	  if(document.Form1.catalognamesort1.value=="")
	  {
		 alert("请输入排序数字 1-300.");
		 document.Form1.catalognamesort1.select();
		 return false;
	  }
	 if(document.Form1.catalognamesort1.value.match(/^[1-9]\d*$/)==null)
	 { 
		alert("请输入排序数字 1-300."); 
		document.Form1.catalognamesort1.select();
		 return false;
	  }
	  return true;
	}
	
	
	function check_catalog2()
	{
	  if(document.Form1.SubCatalogName.value=="")
	  {
		 alert("请输入产品目录.");
		 document.Form1.SubCatalogName.select();
		 return false;
	  }
	  if(document.Form1.catalognamesort2.value=="")
	  {
		 alert("请输入排序数字 1-300.");
		 document.Form1.catalognamesort2.select();
		 return false;
	  }
	 if(document.Form1.catalognamesort2.value.match(/^[1-9]\d*$/)==null)
	 { 
		alert("请输入排序数字 1-300."); 
		document.Form1.catalognamesort2.select();
		 return false;
	  }
	  return true;
	}
	
	function check_products()
	{
	  if(document.Form1.productname.value=="")
	  {
		 alert("请输入产品名称.");
		 document.Form1.productname.select();
		 return false;
	  }
	  if(document.Form1.productno.value=="")
	  {
		 alert("请输入产品编号.");
		 document.Form1.productno.select();
		 return false;
	  }
	  if(document.Form1.productsort.value=="")
	  {
		 alert("请输入排序数字 1-300.");
		 document.Form1.productsort.select();
		 return false;
	  }
	 if(document.Form1.productsort.value.match(/^[1-9]\d*$/)==null)
	 { 
		alert("请输入排序数字 1-300."); 
		document.Form1.productsort.select();
		return false;
	  }
	  return true;
	}

function check_inquirecontact()
{
	 if(document.Form1.ContactName.value=="")
	  {
		 alert("请输入业务员姓名.");
		 document.Form1.ContactName.select();
		 return false;
	  }
	  if(document.Form1.ContactEmail.value=="")
	  {
		 alert("请输入Email.");
		 document.Form1.ContactEmail.select();
		 return false;
	  }
	  if(document.Form1.ContactEmail.value.length !=0){
		  if(/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.exec(document.Form1.ContactEmail.value)==null){
		  alert("Email格式不正确!");
		  document.Form1.ContactEmail.select();
		  return false;
      } 
	  }
	  return true;
}

function check_updateemail()
{
	
	  if(document.Form1.ContactEmailAdmin.value=="")
	  {
		 alert("请输入Email.");
		 document.Form1.ContactEmailAdmin.select();
		 return false;
	  }
	  if(document.Form1.ContactEmailAdmin.value.length !=0){
		  if(/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.exec(document.Form1.ContactEmailAdmin.value)==null){
		  alert("Email格式不正确!");
		  document.Form1.ContactEmailAdmin.select();
		  return false;
       } 
	  }
	  return true;
}

function check_factorypic()
{
	
	  if(document.Form1.PicName.value=="")
	  {
		 alert("请输入图片名称.");
		 document.Form1.PicName.select();
		 return false;
	  }
	  
	  if(document.Form1.PicSort.value=="")
	  {
			alert("请输入排序数字!");
			document.Form1.PicSort.select();
			return false;
		}
	  else
		{
			str=document.Form1.PicSort.value;
			exp=/[^0-9()-]/g;
			if(str.search(exp)   !=   -1)
			{
			alert("请用数字填写!");
			return false;
			}
		 }
	return  true;
}
function check_cart()
{
	 
	  if(document.Form1.contactemail.value=="")
	  {
		 alert("Please enter Email.");
		 document.Form1.contactemail.select();
		 return false;
	  }
	  if(document.Form1.contactemail.value.length !=0){
		  if(/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.exec(document.Form1.contactemail.value)==null){
		  alert(" Email Error!");
		  document.Form1.contactemail.select();
		  return false;
      } 
	  }
	  if(document.Form1.tecountrycode.value=="")
	  {
	      alert("Please enter country code.");
		 document.Form1.tecountrycode.select();
		 return false;
	  }
	   if(document.Form1.teareacode.value=="")
	  {
	      alert("Please enter area code.");
		 document.Form1.teareacode.select();
		 return false;
	  }
	   if(document.Form1.tetelnumber.value=="")
	  {
	      alert("Please enter phone.");
		 document.Form1.tetelnumber.select();
		 return false;
	  }
	  return true;
	  
	  
}

