function checkpw(pw){
	if(pw.length!=0){
		if(pw.length<6){
			document.getElementById('right4').innerHTML="<font color=red>长度不足6位</font>";	
		}else{
			document.getElementById('right4').innerHTML="<font color=green>正确</font>";	
		}
	}else{
		document.getElementById('right4').innerHTML="<font color=black>请输入正确的密码,输入的密码必须大于6位，小于20位.<font>";	
	}
	recheckpw(document.forms[1].user_passwd2.value);
}
function recheckpw(pw){
	if(pw.length!=0){
		if(pw!=document.forms[1].user_passwd.value){
			document.getElementById('right5').innerHTML="<font color=red>两次密码不一致</font>";	
		}else{
			document.getElementById('right5').innerHTML="<font color=green>正确</font>";	
		}
	}else{
		document.getElementById('right5').innerHTML="<font color=black>再输入一遍您的密码以确认<font>";	
	}
}
function checkmail(mailId){
        var email_re=/(\w)+@(\w)+\.(com|net|cn|org)/;
	if(mailId.length!=0){
		if(! email_re.test(mailId)){
		    document.getElementById('right3').innerHTML="<font color=red>邮箱格式不正确</font>";	
		}else{
		    document.getElementById('right3').innerHTML="<font color=green>正确</font>";	
		}
	}else{
		document.getElementById('right3').innerHTML="<font color=black>请输入您的邮箱</font>";
	}
}
function checkusername(){
var strFullPath=window.document.location.href;
var strPath=window.document.location.pathname;
var pos=strFullPath.indexOf(strPath);
var prePath=strFullPath.substring(0,pos);
var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1);
var rooturl=prePath+postPath;
	
	if(window.XMLHttpRequest){
           req = new XMLHttpRequest ;
       }else if(window.ActiveXObject){
           req = new ActiveXObject("Microsoft.XMLHttp") ;
       }
      document.getElementById('right1').innerHTML="<font color=black>正在查询请稍后......</font>";
       //req.onreadystatechange = changMess ;
       req.open("GET",rooturl+"/include/checkusername.php?user_name="+document.forms[1].user_name.value,true) ;
	 req.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 	
       req.send(null);
	req.onreadystatechange=function(){
      if (4==req.readyState){
      	if (200==req.status){
                    //alert(req.responseText);
            }else{
                    //alert("发生错误!");
                }
            }
        
	//alert(req.responseText)
	document.getElementById('right1').innerHTML=req.responseText;
	}
	 //alert(req.responseText)
}
function checksubmit(){
	if(document.forms[1].user_name.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：用户名不能为空!</font></table>";
		document.forms[1].user_name.focus();
		return;
	} 
	if(document.forms[1].user_nick.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：昵称不能为空!</font></table>";
		document.forms[1].user_nick.focus();
		return;
	} 
	if(document.forms[1].user_email.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：电子邮箱不能为空!</font></table>";
		document.forms[1].user_email.focus();
		return;
	} 
	if(document.forms[1].user_passwd.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：密码不能为空!</font></table>";
		document.forms[1].user_passwd.focus();
		return;
	} 
	if(document.forms[1].user_passwd2.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：确认密码不能为空!</font></table>";
		document.forms[1].user_passwd2.focus();
		return;
	} 
	if(document.forms[1].authinput.value.length==0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：验证码不能为空!</font></table>";
		document.forms[1].authinput.focus();
		return;
	} 
	if(document.getElementById('right1').innerHTML.indexOf('用户名已存在')>0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：用户名已存在!</font></table>";
		document.forms[1].user_name.focus();
		return;
	} 
	if(document.getElementById('right3').innerHTML.indexOf('邮箱格式不正确')>0){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：邮箱格式不正确!</font></table>";
		document.forms[1].user_email.focus();
		return;
	} 
	if(document.forms[1].user_passwd.value.length<6){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：密码长度不足6位!</font></table>";
		document.forms[1].user_passwd.focus();
		return;
	} 
	if(document.forms[1].user_passwd2.value.length<6){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：确认密码长度不足6位!</font></table>";
		document.forms[1].user_passwd2.focus();
		return;
	} 
	if(document.forms[1].user_passwd2.value!=document.forms[1].user_passwd.value){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：两次密码不一致!</font></table>";
		document.forms[1].user_passwd2.focus();
		return;
	} 
	if(document.forms[1].user_passwd2.value!=document.forms[1].user_passwd.value){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：两次密码不一致!</font></table>";
		document.forms[1].user_passwd2.focus();
		return;
	} 
	if(document.forms[1].authnum.value!=document.forms[1].authinput.value){
		document.getElementById('input8').innerHTML="<table border='1' bordercolor='#cccccc' width='50%' align='center'><font color=red>错误提示：验证码不正确!</font></table>";
		document.forms[1].authinput.focus();
		return;
	} 
	//alert(document.getElementById("img1").src)
	document.forms[1].submit();	
}
