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.length < 4 || document.Adduser.userid.value.length >16) {
		alert("提示：请输入用户名，有效长度为4-16位");
		document.Adduser.userid.focus();
		return false;
	}
	if (document.Adduser.pwd1.value.length <6 || document.Adduser.pwd1.value.length >16) {
		alert("提示：请输入密码，最少6位，最长16位。");
		document.Adduser.pwd1.focus();
		return false;
	}
	if (!fucPWDchk(document.Adduser.pwd1.value)){
		alert("提示：只能使用纯数字和大、小写字母作为密码");
		document.Adduser.pwd1.focus();
		return false;
		}
	if (document.Adduser.pwd1.value != document.Adduser.pwd2.value) {
		alert("提示：您两次输入的密码不一样，请检查后重新输入");
		document.Adduser.pwd2.focus();
		return false;
	}
	if (document.Adduser.mail.value.length <10 || document.Adduser.mail.value.length >=100) {
		alert("提示：请输入有效的电子邮箱");
		document.Adduser.mail.focus();
		return false;
	}
	if (document.Adduser.mail.value.length > 0 && !document.Adduser.mail.value.match( /^.+@.+$/ ) ) {
	    alert("提示：请输入有效的电子信箱");
		document.Adduser.mail.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.tel.value.length <6 || document.Adduser.tel.value.length >18) {
		alert("提示：请输入有效的电话号码");
		document.Adduser.tel.focus();
		return false;
	}
}
