   function is_zw(str)
  {
	exp=/[0-9a-zA-Z_]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
  }
function is_number(str)
{
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}
function checkaccount(username)
    {
      var re, r;
    
      re = /\S/;
      r = username.match(re);
      if (!r)
      {
        alert("请输入用户名！");
        return false;
      }
      else
      {
        window.open("Accountcheck.asp?action=cusername&value="+username,"")
      }
    }
   function checkuseremail(username)
    {
      var re, r;
    
      re = /\S/;
      r = username.match(re);
      if (!r)
      {
        alert("请邮箱地址！");
        return false;
      }
      else
      {
        window.open("Accountcheck.asp?action=cuseremail&value="+username,"")
      }
    }

   function is_zw(str)
  {
	exp=/[0-9a-zA-Z_]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
  }

 function check_reg(){
 if (document.reg.username.value==""){
 alert("用户名不能为空！请继续注册...");
 document.reg.username.focus();
 return false;
 }
  if (document.reg.username.value.length<4 || document.reg.username.value.length>20){
 alert("用户名必须是4-20位的字符！请继续注册...");
 document.reg.username.focus();
 return false;
 }
 if (!isStr(document.reg.username.value))
    {
        msg="对不起，用户名必须为4个以上的英文字母或数字！\n注意：您不能使用汉字、汉字字符以及非法字符（包括：空格、#、%等）当作用户名！";
        alert(msg);
        document.reg.username.focus();
        return false;
    }
	
 if (document.reg.password.value==""){
 alert("密码不能是空值！请继续注册...");
 document.reg.password.focus();
 return false;
 }
 if (document.reg.password.value==document.reg.username.value ){
 alert("密码不能与用户名相同！请继续注册...");
 document.reg.password.focus();
 return false;
 } 
 if (document.reg.password.value.length<6 ){
 alert("密码不能低于6位的符号！请继续注册...");
 document.reg.password.focus();
 return false;
 }
 if (document.reg.password2.value==""){
 alert("确认密码不能是空值！请继续注册...");
 document.reg.password2.focus();
 return false;
 }
 if (document.reg.password2.value!=document.reg.password.value){
 alert("确认密码与密码不相同！请继续注册...");
 document.reg.password2.focus();
 return false;
 }
 if (document.reg.useremail.value==""){
 alert("用户的邮箱必须输入！请继续注册...");
 document.reg.useremail.focus();
 return false;
 }
 if(document.reg.useremail.value.indexOf("@")==-1 || document.reg.useremail.value.indexOf(".")==-1){ 
 alert("用户的邮箱格式不正确！请继续注册...");
 document.reg.useremail.focus();
 return false;
	}
	 if (js_trim(document.reg.realname.value)==""){
 alert("用户真实姓名不能为空值！请继续注册...");
 document.reg.realname.focus();
 return false;
 }
  if (js_trim(document.reg.question.value)==""){
 alert("密码问题不能为空！请继续注册...");
 document.reg.question.focus();
 return false;
 }
  if (js_trim(document.reg.answer.value)==""){
 alert("密码答案不能为空！请继续注册...");
 document.reg.answer.focus();
 return false;
 }

 if (!is_zw(document.reg.realname.value)){
 alert("用户真实姓名必须是中文文字！请继续注册...");
 document.reg.realname.focus();
 return false;
 }
  if (document.reg.realname.value.length<2 || document.reg.realname.value.length>10){
 alert("用户真实姓名必须是2-10个中文文字组成！请继续注册...");
 document.reg.realname.focus();
 return false;
 }
  if (document.reg.Personphone.value==""){
 alert("您的联系电话不能为空值！请继续注册...");
 document.reg.Personphone.focus();
 return false;
 }
 if (!is_number(document.reg.Personphone.value)){
 alert("联系电话只能含有0-9和-！请继续注册...");
 document.reg.Personphone.focus();
 return false;
 } 
 }
function js_flag(idx)
{
    var chk = document.reg.degreeCheck[idx];
}
function js_trim(str)
{   
    str += "";
    while( (str.charAt(0)==' ')||(str.charAt(0)=='　')||(escape(str.charAt(0))=='%u3000') )     
         str=str.substring(1,str.length);
    while( (str.charAt(str.length-1)==' ')||(str.charAt(str.length-1)=='　')||(escape(str.charAt(str.length-1))=='%u3000') )  
        str=str.substring(0,str.length-1);
    return str;
}
function isStr(s) {
	if (s.length == 0) return false;
	var regu = "^[0-9A-Za-z_]*$";
	var re   = new RegExp(regu);
    //alert("ssss---s.search(re):"+s.search(re));
    s = s.replace('@', '');
    s = s.replace('.', '');
	if (s.search(re) != -1)
		return true;
 }