	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|com|gov|info|biz|mil|org|edu|int|NET|COM|GOV|INFO|BIZ|MIL|ORG|EDU|INT)$";
	var re = new RegExp(regu);
function check(path){
	var submitSign = "";
	var username = theform.username;
	if(!checkUserName(path,username)){
		username.focus();
		return false;
	}

	if(!checkLoginName(path)){
		theform.username.select();
		return false;
	}	
	var password = theform.password;
	if(!checkPassword(path,password)){
		password.focus();
		return false;
	}
	var repassword = theform.repassword;
	if(!checkRepassword(path,repassword)){
		repassword.focus();
		return false;
	}
	var email = theform.email;
	if(!checkEmail(path,email)){
		email.focus();
		return false;		
	}	
	if(theform.question.value=="0"){
		showErrMsg(path,'question_error','<span class="TextPresent_red">请输入提示问题!</span>');
		theform.question.focus();
		return false;			
	}
	showRightMsg(path,'question_error');	
	var answer = theform.answer;
	if(!checkAnswer(path,answer)){
		answer.focus();
		return false;				
	}
	var idtype = document.getElementsByName("leaguerType");
	var k = 0;
	for(i=0;i<idtype.length;i++){
		if(idtype[i].checked==true){
			k=k+1;
		}
	}
	if(k==0)
	{
		showErrMsg(path,'leaguerType_error','<span class="TextPresent_red">请选择会员类型!</span>');
		idtype(0).focus();
		return false;
	}
	if(idtype(2).checked){
		if(theform.train_status.value==""||theform.train_status.value=="0"){
			showErrMsg(path,'leaguerType_error','<span class="TextPresent_red">请选择学校性质!</span>');
			theform.train_status.focus();
			return false;
		}
	}
	showRightMsg(path,'leaguerType_error');	
	var readRule = document.getElementById("readRule");
	if(!readRule.checked){
		alert("请先阅读会员协议后,再进行注册!");
		return false;
	}	
}	
function checkUserName(path,userName){
	if(userName.value==""){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">请输入会员名!</span>');
		return false;		
	}
	if(userName.value.length<6||userName.value.length>20){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">会员名应在6-20个字符之间!</span>');
		return false;				
	}
	if(!isvalid(userName.value)){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">会员名含有非法字符!</span>');
		return false;			
	}
	if(!checkLoginName(path)){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">该会员已注册,请重新输入!</span>');
		return false;
	}
	/*
	else{
		window.open("http://localhost:7777/ytjob/reg/checkuser.jsp?username="+document.theform.username.value,"","width=350,height=180,scrollbars=no");
		return false;
	}
	*/
	showRightMsg(path,'userName_error');	
		return true;
}
function checkPassword(path,password){
	if(password.value==""){
		showErrMsg(path,'password_error','<span class="TextPresent_red">请输入密码!</span>');
		return false;				
	}
	if(password.value.length<6||password.value.length>20){
		showErrMsg(path,'password_error','<span class="TextPresent_red">密码应在6-20位之间!</span>');
		return false;			
	}
	if ((password.value=='123456')||(password.value=='1234567')||(password.value=='1234567')||(password.value=='12345678')||(password.value=='123456789')||(password.value=='111111')||(password.value=='11111111')||(password.value=='11111111')||(password.value=='111111111')||(password.value=='000000')||(password.value=='0000000')||(password.value=='00000000')||(password.value=='000000000')||(password.value=='666666')||(password.value=='6666666')||(password.value=='66666666')||(password.value=='666666666')||(password.value=='654321')||(password.value=='7654321')||(password.value=='87654321')||(password.value=='987654321')||(password.value=='888888')||(password.value=='8888888')||(password.value=='88888888')||(password.value=='888888888')){
		showErrMsg(path,'password_error','<span class="TextPresent_red">密码过于简单,容易泄密！</span>');
		return false;			 
	}
	if(!isvalid(password.value)){
		showErrMsg(path,'password_error','<span class="TextPresent_red">密码含有非法字符!</span>');
		return false;			
	}
	if(password.value==theform.username.value){
		showErrMsg(path,'password_error','<span class="TextPresent_red">为了安全起见,密码与会员名不能相同!</span>');
		return false;		
	}
	showRightMsg(path,'password_error');
	return true;	
}
function checkRepassword(path,repassword){
	if(repassword.value==""){
		showErrMsg(path,'repassword_error','<span class="TextPresent_red">请再一次输入密码!</span>');
		return false;				
	}
	if(theform.password.value!=repassword.value){
		showErrMsg(path,'repassword_error','<span class="TextPresent_red">确认密码与密码不一致!</span>');
		return false;				
	}
	showRightMsg(path,'repassword_error');
	return true;	
}
function checkEmail(path,email){
	if(email.value=="")	{
		showErrMsg(path,'email_error','<span class="TextPresent_red">请输入E_mail!</span>');
		return false;			
	}
	if(email.value.search(re) == -1){
		showErrMsg(path,'email_error','<span class="TextPresent_red">请输入合法有效的E_mail！</span>');
		return false;				
	}
	if(!checkLoginMail(path,email)){
		showErrMsg(path,'email_error','<span class="TextPresent_red">该email已注册,请重新输入！</span>');
		return false;	
	}
	showRightMsg(path,'email_error');	
	return true;	
}
function checkAnswer(path,answer){
	if(answer.value==""){
		showErrMsg(path,'answer_error','<span class="TextPresent_red">请输入问题答案!</span>');
		return false;			
	}
	if(answer.value.length<5||answer.value.length>20){
		showErrMsg(path,'answer_error','<span class="TextPresent_red">答案长度应在5-20之间!</span');
		return false;			
	}
	showRightMsg(path,'answer_error');	
	return true;
}
function isvalid(s)
{
	var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))$"
	var re = new RegExp(regu);
	if (s.search(re) != -1) {
	    return true;
	} else {
		return false;
	}
}
function checkAjaxUserName(path,userName){
	if(userName.value==""){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">请输入会员名!</span>');
		return false;		
	}
	if(userName.value.length<6||userName.value.length>20){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">会员名应在6-12个字符之间!</span>');
		return false;				
	}
	if(!isvalid(userName.value)){
		showErrMsg(path,'userName_error','<span class="TextPresent_red">会员名含有非法字符!</span>');
		return false;			
	}
	else{
		window.open("http://localhost:7777/ytjob/reg/checkuser.jsp?username="+document.theform.username.value,"","width=350,height=180,scrollbars=no");
		return false;
	}
	showRightMsg(path,'userName_error');	
	return true;
}
function checkLoginName(path){
	var lurl = path+"xmlAjax.do";
	var aa = "";
	aa = addPostParam(aa,"userName",escape(escape(theform.username.value)));
	aa = addPostParam(aa,"actionId","checkUserName");
	var value = fun_returnValue(aa,lurl);
	if(value=="999"){
		//showErrMsg(path,'userName_error','该用户已注册,请重新选择用户名!');
		return false;
	}

	return true;
}
function checkLoginMail(path,email){
	var lurl = path+"xmlAjax.do";
	var aa = "";
	aa = addPostParam(aa,"email",email.value);
	aa = addPostParam(aa,"actionId","checkMail");
	var value = fun_returnValue(aa,lurl);
	if(value=="999"){
		return false;
	}
	return true;
}
function checkQuestion(path,question){
	if(question.value=="0"){
		showErrMsg(path,'question_error','<span class="TextPresent_red">请选择提示问题!</span>');
		return false;			
	}	
	showRightMsg(path,'question_error');	
	return true;
}
function checkSafePassword(path,password){
	if(password.value.length<5){
		showErrMsg(path,'password_two_error','<span class="TextPresent_red">请选择提示问题!</span>');
	}
}
