function reg_check(form)
{
	 if ((!IsValidString(form.username.value))||(form.username.value.length<4))         
	  {        
		$("un").innerHTML="<img src=/images/check_error.gif align=absmiddle border=0> <FONT COLOR=red>帐号由4-20个字母或数字组成。</font>";
		form.username.focus();        
		return (false);        
	  }	  
	 if (form.password.value.length<4)       
	  {        
		alert("密码4-20个字。");        
		form.password.focus();        
		return (false);        
	  }
	 if (form.repassword.value.length<4)        
	  {        
		alert("确认密码4-20个字。");        
		form.repassword.focus();        
		return (false);        
	  }	  
    if (form.password.value!=form.repassword.value)
      {
         alert("两次密码输入不一样！");   
         form.repassword.focus();
      return (false);
      }	
	  
	  
	 if (form.name.value.length<2)        
	  {        
		alert("请输入姓名2到10个字！");        
		form.name.focus();        
		return (false);        
	  }		  
	 //if (form.ask.value == "")        
	  //{        
	//	alert("请选择密码提示问题！");        
	//	form.ask.focus();        
	//	return (false);        
	 // }	
	 if (form.ask.value!=""){     
	 if (form.ans.value == "")        
	  {        
		alert("请输入问题答案！");        
		form.ans.focus();        
		return (false);        
	  }	  }
    if (form.email.value!=""){    
	if ((!isEmail(form.email.value)))   
	{        
		alert("请正确填写电子信箱！");        
		form.email.focus();      
		return (false);        
	}	 }
	//var   b=0;   
	//var   a=$("IsTrue");   
	//for(i=0;i<a.length;i++){   
	//	if(a[i].checked==true){   
	//		  b++;   
	//	}   
     // }   
      //if(b==0){alert("请阅读并接受服务条款!");
	  //return false;}  

    return (true);
	  
}

function reg_checks(tp){
switch(parseInt(tp)){
	case 1:
	indiv('/user/check_user.asp?cz=1&fd='+$("username").value,'un');
	break;
	case 2:
	indiv('/user/check_user.asp?cz=2&fd='+$("password").value,'ps');
	break;
	case 3:
	indiv('/user/check_user.asp?cz=3&fd='+$("repassword").value+'&fd2='+$("password").value,'rps');
	break;
	case 4:
	indiv('/user/check_user.asp?cz=4&fd='+$("name").value,'names');
	break;	
	
	}
}

function reg_checks2(tp){
switch(parseInt(tp)){
	case 1:
	var URL='/user/check_user.asp?cz=1&fd='+$("username").value;
	var xmlhttp = createXMLHttps();
	xmlhttp.open("GET",URL,true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			info = xmlhttp.responseText;
            if (info.substr(0,1)=='1'||info.substr(0,1)=='2') 
			{$("un").innerHTML = info.substr(2);
			$("username").focus();}
			else if (info.substr(0,1)=='0') 
			{$("un").innerHTML = info.substr(2);}
		}
		else{
			$("un").innerHTML=="<img src=/images/loading.gif border=0>loading...";	
		}		
	}
	xmlhttp.send(null);
	break;	
	case 2:
	var URL='/user/check_user.asp?cz=2&fd='+$("password").value;
	var xmlhttp = createXMLHttps();
	xmlhttp.open("GET",URL,true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			info = xmlhttp.responseText;
            if (info.substr(0,1)=='1') 
			{$("ps").innerHTML = info.substr(2);
			$("password").focus();}
			else if (info.substr(0,1)=='0') 
			{$("ps").innerHTML = info.substr(2);}
		}
		else{
			$("un").innerHTML=="<img src=/images/loading.gif border=0>loading...";	
		}		
	}
	xmlhttp.send(null);	
	break;
	case 3:
	var URL='/user/check_user.asp?cz=3&fd='+$("repassword").value+'&fd2='+$("password").value;
	var xmlhttp = createXMLHttps();
	xmlhttp.open("GET",URL,true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			info = xmlhttp.responseText;
            if (info.substr(0,1)=='1'||info.substr(0,1)=='2') 
			{$("rps").innerHTML = info.substr(2);}
			else if (info.substr(0,1)=='0') 
			{$("rps").innerHTML = info.substr(2);}
		}
		else{
			$("un").innerHTML=="<img src=/images/loading.gif border=0>loading...";	
		}		
	}
	xmlhttp.send(null);	
	break;
	case 4:
	var URL='/user/check_user.asp?cz=4&fd='+$("name").value;
	var xmlhttp = createXMLHttps();
	xmlhttp.open("GET",URL,true);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			info = xmlhttp.responseText;
            if (info.substr(0,1)=='1'||info.substr(0,1)=='2') 
			{$("names").innerHTML = info.substr(2);
			$("name").focus();}
			else if (info.substr(0,1)=='0') 
			{$("names").innerHTML = info.substr(2);}
		}
		else{
			$("names").innerHTML=="<img src=/images/loading.gif border=0>loading...";	
		}		
	}
	xmlhttp.send(null);		
	break;	

	
	}
}

function mod_check(form)
{
	// if (form.name.value.length<2)        
	 // {        
	//	alert("请输入呢称2到10个字！");        
	//	form.name.focus();        
	//	return (false);        
	 // }		  

    if (form.email.value!=""){    
	if ((!isEmail(form.email.value)))   
	{        
		alert("请正确填写电子信箱！");        
		form.email.focus();      
		return (false);        
	}	 }

    return (true);
	  
}


function show(i){
if (i.style.display == "none") {
		i.style.display = "";
	}else{
		i.style.display = "none";
	}
}