function checkreg(form)
	{
       if(form.username.value.length<3){
		    alert("用户名不能小于三位！")
			form.username.focus()
			return false;
	    }
       if(form.UserPassword.value.length<6){
		    alert("密码不能小于六位！")
			form.UserPassword.focus()
			return false;
	    }
       if(form.UserPassword.value!=form.reUserPassword.value){
		    alert("两次输入的密码不一致 ！")
			form.reUserPassword.focus()
			return false;
	    }
     /*  if(form.realname.value.length<1){
		    alert("请填写昵称！")
			form.realname.focus()
			return false;
	    }
       if(form.question.value.length<1){
		    alert("请填写密码问题！")
			form.question.focus()
			return false;
	    }
       if(form.answer.value.length<1){
		    alert("请填写密码答案！")
			form.answer.focus()
			return false;
	    }
       if(form.phone.value.length<1){
		    alert("请填写联系电话！")
			form.phone.focus()
			return false;
	    }
       if(form.address.value.length<1){
		    alert("请填写联系地址！")
			form.address.focus()
			return false;
	    }*/
		if(!isEmail(form.email.value)){
		  alert("请填写正确的Email地址！")
		  form.email.focus()
		  return false;
		}
}  
function checkedit(form)
	{
       if(form.realname.value.length<1){
		    alert("请填写昵称！")
			form.realname.focus()
			return false;
	    }
       if(form.question.value.length<1){
		    alert("请填写密码问题！")
			form.question.focus()
			return false;
	    }
       if(form.answer.value.length<1){
		    alert("请填写密码答案！")
			form.answer.focus()
			return false;
	    }
       if(form.phone.value.length<1){
		    alert("请填写联系电话！")
			form.phone.focus()
			return false;
	    }
       if(form.address.value.length<1){
		    alert("请填写联系地址！")
			form.address.focus()
			return false;
	    }
		if(!isEmail(form.email.value)){
		  alert("请填写正确的Email地址！")
		  form.email.focus()
		  return false;
		}
}  
function checklogin(form)
	{
       if(form.username.value.length<3){
		    alert("用户名不能小于三位！")
			form.username.focus()
			return false;
	    }
       if(form.userpassword.value.length<6){
		    alert("密码不能小于六位！")
			form.userpassword.focus()
			return false;
	    }
       if(form.chkcode.value.length!=4){
		    alert("请填写验证码！")
			form.chkcode.focus()
			return false;
	    }
}  
function isEmail(s)
{
        if (s.length > 100)
                return false;
         var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[_.0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT|INFO|info|tom|TOM)$";
         var re = new RegExp(regu);
         if (s.search(re) != -1)
              return true;
          else 
             return false;
}

function isDigital(checkStr)
{
var checkOK = "0123456789";
var allValid = true;
if (checkStr.length<1)
 allValid=false;
  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;
    }
  }
  return allValid;
}

