function Login(){
	if (document.login.username.value.length < 4 ){		
		alert("用户名输入错误，最少4个字符！");
	    document.login.username.focus();
		return false;
		}
	else if (document.login.password.value.length < 6 ){		
		alert("密码输入错误，最少6个字符！");
		document.login.password.value = ""
	    document.login.password.focus();
		return false;
		}
	return true;
}
function Userclass(){
	if (document.userclass.username.value.length < 4 ){		
		alert("用户名不能小于4个字符！");
	    document.userclass.username.focus();
		return false;
		}
}
function Registration(){
	if (document.registration.username.value.length < 4 ){		
		alert("用户名不能小于4个字符！");
	    document.registration.username.focus();
		return false;
		}
	else if (document.registration.password.value.length < 6 ||document.registration.repassword.value.length < 6 ){
		alert("密码不能小于6个字符！");
		document.registration.password.value = ""
		document.registration.repassword.value = ""
	    document.registration.password.focus();
		return false;
		}
	else if(document.registration.password.value.length != document.registration.repassword.value.length ){
		alert("两次输入的密码不一致！");
		document.registration.password.value = ""
		document.registration.repassword.value = ""
	    document.registration.password.focus();
		return false;		
		}
	else if(document.registration.question.value.length == 0){
		alert("安全问题不能为空！");
	    document.registration.question.focus();
		return false;		
		}
	else if(document.registration.answer.value.length == 0){
		alert("问题答案不能为空！");
	    document.registration.answer.focus();
		return false;		
		}
	else if(document.registration.email.value.length == 0){
		alert("E-mail不能为空！");
	    document.registration.email.focus();
		return false;		
		}	
	else if (document.registration.email.value.charAt(0)=="." ||
		document.registration.email.value.charAt(0)=="@" ||
		document.registration.email.value.indexOf('@', 0) == -1 ||
		document.registration.email.value.indexOf('.', 0) == -1 ||
		document.registration.email.value.lastIndexOf("@")==document.registration.email.value.length-1 ||
		document.registration.email.value.lastIndexOf(".")==document.registration.email.value.length-1){
		alert("email格式不正确！");
		document.registration.email.focus();
		return false;
	}
	else if(document.registration.classid.value == 1){
		if (document.registration.names.value.length == 0){
			alert("真实姓名不能为空！");
	   		document.registration.names.focus();
			return false;			
			}
		else if (document.registration.qualifications.value.length == 0){
			alert("学历不能为空！");
	   		document.registration.qualifications.focus();
			return false;			
			}
		else if (document.registration.professional.value.length == 0){
			alert("专业不能为空！");
	   		document.registration.professional.focus();
			return false;			
			}
		else if (document.registration.graduates.value.length == 0){
			alert("毕业院校不能为空！");
	   		document.registration.graduates.focus();
			return false;			
			}
		}
	return true;
}

function Personal(){
	if(document.personal.email.value.length == 0){
		alert("E-mail不能为空！");
	    document.personal.email.focus();
		return false;		
		}		
	else if (document.personal.email.value.charAt(0)=="." ||
		document.personal.email.value.charAt(0)=="@" ||
		document.personal.email.value.indexOf('@', 0) == -1 ||
		document.personal.email.value.indexOf('.', 0) == -1 ||
		document.personal.email.value.lastIndexOf("@")==document.personal.email.value.length-1 ||
		document.personal.email.value.lastIndexOf(".")==document.personal.email.value.length-1){
		alert("email格式不正确！");
		document.personal.email.focus();
		return false;
	}
	else if(document.personal.classid.value == 1){
		if (document.personal.names.value.length == 0){
			alert("真实姓名不能为空！");
	   		document.personal.names.focus();
			return false;			
			}
		else if (document.personal.qualifications.value.length == 0){
			alert("学历不能为空！");
	   		document.personal.qualifications.focus();
			return false;			
			}
		else if (document.personal.professional.value.length == 0){
			alert("专业不能为空！");
	   		document.personal.professional.focus();
			return false;			
			}
		else if (document.personal.graduates.value.length == 0){
			alert("毕业院校不能为空！");
	   		document.personal.graduates.focus();
			return false;			
			}
		}
	return true;
}

function Changepwd(){
	if(document.changepwd.password.value.length < 6 ||document.changepwd.newpassword.value.length < 6 ||document.changepwd.repassword.value.length < 6 ){
		alert("密码不能小于6个字符！");
		document.changepwd.password.value = ""
		document.changepwd.newpassword.value = ""
		document.changepwd.repassword.value = ""
	    document.changepwd.password.focus();
		return false;
		}
	else if(document.changepwd.newpassword.value != document.changepwd.repassword.value){
		alert("两次输入的密码不一致！");
		document.changepwd.password.value = ""
		document.changepwd.newpassword.value = ""
		document.changepwd.repassword.value = ""
	    document.changepwd.password.focus();
		return false;		
		}
	return true;
}
	
function Backpwd(){
	if(document.backpwd.username.value.length < 4 ){
		alert("用户名不能小于4个字符！");
	    document.backpwd.username.focus();
		return false;
		}
	else if(document.backpwd.newpassword.value.length < 6 ||document.backpwd.repassword.value.length < 6 ){
		alert("密码不能小于6个字符！");
		document.backpwd.newpassword.value = ""
		document.backpwd.repassword.value = ""
	    document.backpwd.newpassword.focus();
		return false;
		}
	else if(document.backpwd.newpassword.value != document.backpwd.repassword.value){
		alert("两次输入的密码不一致！");
		document.backpwd.newpassword.value = ""
		document.backpwd.repassword.value = ""
	    document.backpwd.password.focus();
		return false;		
		}
	else if(document.backpwd.question.value.length == 0){
		alert("安全问题不能为空！");
	    document.backpwd.question.focus();
		return false;		
		}
	else if(document.backpwd.answer.value.length == 0){
		alert("问题答案不能为空！");
	    document.backpwd.answer.focus();
		return false;		
		}		
	return true;
}

function Gbooks(){
	if(document.gbooks.username.value.length < 4 ){
		alert("用户名不能小于4个字符！");
	    document.gbooks.username.focus();
		return false;
		}
	else if(document.gbooks.email.value == 0){
		alert("email不能为空！");
	    document.gbooks.email.focus();
		return false;		
		}
	else if (document.gbooks.email.value.charAt(0)=="." ||
		document.gbooks.email.value.charAt(0)=="@" ||
		document.gbooks.email.value.indexOf('@', 0) == -1 ||
		document.gbooks.email.value.indexOf('.', 0) == -1 ||
		document.gbooks.email.value.lastIndexOf("@")==document.gbooks.email.value.length-1 ||
		document.gbooks.email.value.lastIndexOf(".")==document.gbooks.email.value.length-1){
		alert("email格式不正确！");
		document.gbooks.email.focus();
		return false;
	}
	else if(document.gbooks.subject.value.length == 0){
		alert("留言标题不能小于5个字符！");
	    document.gbooks.subject.focus();
		return false;		
		}
	else if(document.gbooks.content.value.length == 0){
		alert("留言内容不能小于10个字符！");
	    document.gbooks.content.focus();
		return false;		
		}		
	return true;
}

function Feedback(){
	if(document.feedback.subject.value.length == 0){
		alert("留言标题不能小于5个字符！");
	    document.feedback.subject.focus();
		return false;		
		}
	else if(document.feedback.content.value.length == 0){
		alert("留言内容不能小于10个字符！");
	    document.feedback.content.focus();
		return false;		
		}		
	return true;
}


function Addorder(){
	if(document.addorder.ordernum.value.length == 0){
		alert("订购数量必需填写！");
	    document.addorder.ordernum.focus();
		return false;		
		}
	return true;
}