function isspace(theelement)
	{ //为空格符则返回true
	   var strnum=0;
	   for(i=0;i<=theelement.length-1;i++)
	   {
		  char1=theelement.charAt(i);
		  strs=char1.replace(" ","");
		  if(strs!="")
			  strnum++;
	   }
	   if(strnum>0)
		   return false;
	   else
		   return true;
	}
function NoExceptionChar(str)
	{ 
	 var reg=/^[^\\wW\d+\\_]\w{3,35}[^\\_]$/;
	 if(reg.test(str))
	  {
	   return true;
	  }
	  return false;
	}
function havenoNumber(theelement)
{//含有非数字字符 返回 true
   text="1234567890-+ .";
   for(i=0;i<=theelement.length-1;i++)
   {
	  char1=theelement.charAt(i);
	  index=text.indexOf(char1);
	  if(index==-1)
	  {return true; }
   }
   return false;
}
function isNoEnglish(s){
	var reg = /^[\u4E00-\u9FFF]+$/;
	if (!reg.test(s)){
		return false;
	}
	return true;
}
function NoException(s)
{
	var reg = /[^<>$%?',]{2,35}/;
	if (reg.test(s))
	{
		return true;
	}
	return false;
}
function Exception(str)
	{ 
	if(str.length<1)
	{
	return true;
	}
	 var reg=/[+]86.\d{5,12}/;
	 if(reg.test(str))
	  {
	   return true;
	  }
	  return false;
	}
	function checkmobile(str)
	{ 
	if(str.length<1)
	{
	return true;
	}
	 var reg=/^\d{7,15}$/;
	 if(reg.test(str))
	  {
	   return true;
	  }
	  return false;
	}
function isNoChinese(s)
{
	
//如果含有中文字符返回 true
   text="abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
   for(i=0;i<=s.length-1;i++)
   {
      char1=s.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      { return true;//有中文
      }  
     //没有中文
    }
	return false;
}
function checkName(s)
{
	
//如果含有中文字符返回 true
   text="abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ_ ";
   for(i=0;i<=s.length-1;i++)
   {
      char1=s.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      { return true;//有中文
      }  
     //没有中文
    }
	return false;
}
function checkEmail(email){
	if(/^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/.test(email)==false) return false;
    else return true;
}
function checkTel(tel){
	if(/^\+{1,1}[0-9]{1,3}\.{1,1}[0-9]{5,12}$/.test(tel)==false) return false;
    else return true;
}
function checkRegForm(frm,mod){
  if(mod<1) {
	if(frm.UserName.value==""){
		alert("请输入您的用户名!");
		frm.UserName.focus();
		return false;
        }
    if(isNoChinese(frm.UserName.value)){
		alert('用户名不能输入中文及全角符号,只能用字母和数字');
		frm.UserName.focus();
		return false;
	}
	if(!NoExceptionChar(frm.UserName.value)){
		alert('输入不正确，请检查');
		frm.UserName.focus();
		return false;
	}

	if(frm.Password.value==""){
		alert("请输入您的密码!");
		frm.Password.focus();
		return false;
	}
	if(frm.Password.value.length<6){
		alert("密码不能小于6位数!");
		frm.Password.focus();
		return false;
	}
	if(frm.Password2.value==""){
		alert("请输入确认密码!");
		frm.Password2.focus();
		return false;
	}
	if(frm.Password.value != frm.Password2.value){
		alert("两次输入的密码不一致!");
		frm.Password.focus();
		return false;
	}
	if(frm.question.value==""){
		alert("请输入密码提示问题1!");
		frm.question.focus();
		return false;
	}
	if(frm.answer.value==""){
		alert("请输入密码提示答案1!");
		frm.answer.focus();
		return false;
	}
	if(frm.answer.value.length<6){
		alert("密码提示答案1不能小于6位数!");
		frm.answer.focus();
		return false;
	}
		if(frm.answer2.value==""){
		alert("请输入密码提示答案2!");
		frm.answer2.focus();
		return false;
	}
	if(frm.answer2.value.length<6){
		alert("密码提示答案2不能小于6位数!");
		frm.answer2.focus();
		return false;
	}


  }
  if(frm.Name_GB.value=="")
	{
		alert('姓名(中文)不能为空');
		frm.Name_GB.focus();
		return false;
	}
if(!isNoEnglish(frm.Name_GB.value.replace(/(^[\s]*)|([\s]*$)/g, ""))){
		alert('姓名(中文)不能输入英文，请改正');
		frm.Name_GB.focus();
		return false;
	}
	if(frm.Tel.value==""){
		alert("请输入您的电话号码!");
		frm.Tel.focus();
		return false;
	}
	if(!checkTel(frm.Tel.value)){
		alert("电话格式不正确");
		frm.Tel.focus();
		return false; 
	}
	if(!Exception(frm.Fax.value))
		{
			alert("请填写正确的传真，如没有可不填！");
			frm.Fax.focus();
			return false ;
		}
		if(!checkmobile(frm.Mobile.value))
		{
			alert("请填写正确的手机号，如没有可不填！");
			frm.Mobile.focus();
			return false ;
		}
		if(frm.SP.value==""){
		alert("请输入省份!");
		frm.SP.focus();
		return false;
	}
	if(!NoException(frm.SP.value))
	{
		alert("你的省份里有特殊字符!");
		frm.SP.focus();
		return false;
	}
	if(frm.City.value==""){
		alert("请输入城市!");
		frm.City.focus();
		return false;
	}
	if(!NoException(frm.City.value))
	{
		alert("你的城市里有特殊字符!");
		frm.City.focus();
		return false;
	}
    if(frm.Address.value=="" || isspace(frm.Address.value)){
		alert("请输入地址!");
		frm.Address.focus();
		return false;
	}
	if(!NoException(frm.Address.value))
	{
		alert("你的地址里有特殊字符!");
		frm.Address.focus();
		return false;
	}
	
	
	if(/^[0-9]{6,6}$/.test(frm.PC.value)==false){
		alert("请填写正确的邮编");
		frm.PC.focus();
		return false; 
	}
    if(!checkEmail(frm.Email.value))
	{
	   alert("请输入正确的邮件地址");
	   frm.Email.focus();
	   return false;
	}
	
	
		if(frm.intNum.value==""){
			alert("请输入验证码!");
			frm.intNum.focus();
			return false;
		}

	return true;
}
