// JavaScript Document

function JM_sh(ob){
if (ob.style.display=="none"){ob.style.display=""}else{ob.style.display="none"};
}

function fucPWDchk(str) 
{ 
var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
var ch; 
var i; 
var temp; 

for (i=0;i<=(str.length-1);i++) 
{ 

ch = str.charAt(i); 
temp = strSource.indexOf(ch); 
if (temp==-1) 
{ 
return 0; 
} 
} 
if (strSource.indexOf(ch)==-1) 
{ 
return 0; 
} 
else 
{ 
return 1; 
} 
} 
function jtrim(str) 
{ while (str.charAt(0)==" ") 
{str=str.substr(1);} 
while (str.charAt(str.length-1)==" ") 
{str=str.substr(0,str.length-1);} 
return(str); 
} 
//判断表单输入正误
function Checkreg()
{
	if (document.ADDUser.UserId.value=="" || document.ADDUser.UserId.value.length >16) {
		alert("提示：请输入用户名");
		document.ADDUser.UserId.focus();
		return false;
	}
	if (document.ADDUser.pw1.value.length <6 || document.ADDUser.pw1.value.length >16) {
		alert("提示：请输入密码，最少6位，最长16位。");
		document.ADDUser.pw1.focus();
		return false;
	}
	if (!fucPWDchk(document.ADDUser.pw1.value)){
		alert("提示：只能使用纯数字和大、小写字母作为密码");
		document.ADDUser.pw1.focus();
		return false;
		}
	if (document.ADDUser.pw1.value != document.ADDUser.pw2.value) {
		alert("提示：您两次输入的密码不一样，请检查后重新输入");
		document.ADDUser.pw2.focus();
		return false;
	}
	if (document.ADDUser.Usermail.value.length <10 || document.ADDUser.Usermail.value.length >=100) {
		alert("提示：请输入有效的电子邮箱");
		document.ADDUser.Usermail.focus();
		return false;
	}
	if (document.ADDUser.Usermail.value.length > 0 && !document.ADDUser.Usermail.value.match( /^.+@.+$/ ) ) {
	    alert("提示：请输入有效的电子信箱");
		document.ADDUser.Usermail.focus();
		return false;
	}
	if (document.ADDUser.Username.value.length < 2 || document.ADDUser.Username.value.length >16) {
		alert("提示：请检查您填写的真实姓名");
		document.ADDUser.Username.focus();
		return false;
	}
	/*if (document.ADDUser.Banji.value.length <3 || document.ADDUser.Banji.value.length >=100) {
		alert("提示：请输入有效的班级");
		document.ADDUser.Banji.focus();
		return false;
	}
	if (document.ADDUser.Zhuanye.value.length <2 || document.ADDUser.Zhuanye.value.length >20) {
		alert("提示：请输入正确的专业");
		document.ADDUser.Zhuanye.focus();
		return false;
	}*/
	if (document.ADDUser.HomePhone.value.length <6 || document.ADDUser.HomePhone.value.length >18) {
		alert("提示：请输入有效的电话号码");
		document.ADDUser.HomePhone.focus();
		return false;
	}
		

       /* if (document.ADDUser.Birthday.value.length <3 || document.ADDUser.Birthday.value.length >12) {
		alert("提示：请输入有效的出生年月");
		document.ADDUser.Birthday.focus();
		return false;
	}*/
}
