	var ischeckid = 0;
	var ischeckemail = 0;
	var ischeckid_tab = 0;
	function show_idfocusmsg()
	{		
		showid('ustr',false);		
		showid('ustr111',true);
	}

	function showIDsta() {
		$('ustr111').style.display = 'block';	
		if($('userid').value.trim() != '') {
			$('ustr').style.display = 'none';	
		}
		alert("dd");
	}
	
	function check_protocol(){
		var chk_protol = getid('Input').checked;
		if (chk_protol){
			getid('Submit').disabled = false;
			enable_id('Submit',true);
		}else{
			getid('Submit').disabled = true;
			enable_id('Submit',false);
		}
	}
	function checkUserID() {		
		var userid = getid('userid').value.trim();
		var patrm = new RegExp(/^[a-zA-Z1-9_]{1}[a-zA-Z0-9_]{5,15}$/g);
		if(ischeckid == 0) {
			if(userid) {
				if(userid.indexOf(0) == 0) {
					showid('ustr',true);
					showmsg('ustr','帐号不以0开头');
					getid('ustr').className ='b';
					showid('ustr111',false);	
					return false;
				}else if(userid.length<6) {
					showid('ustr',true);
					showmsg('ustr','帐号长度不能小于6个字符');
					getid('ustr').className ='b';
					showid('ustr111',false);
					return false;
				}else if(userid.length>12) {
					showid('ustr',true);	
					showmsg('ustr','帐号长度不能大于12个字符');
					getid('ustr').className ='b';
					showid('ustr111',false);
					return false;
				}else if(!patrm.exec(userid)) {
					showid('ustr',true);	
					showmsg('ustr','帐号只能以数字和字母组成');
					getid('ustr').className ='b';
					showid('ustr111',false);
					return false;
				}else {
					showid('ustr',true);					
					showmsg('ustr','正在检测....');
					getid('ustr').className ='e';
					showid('ustr111',false);
					ajax_get('../ajax/checkreg.php?userid='+userid+'&ac=id',checkID);
				}
				return true;
			}
		}else {
			showid('ustr111',false);	
			showid('ustr',true);
		}
	}
	function checkID(str) {
		if(str == 'exist') {
			showid('ustr',true);	
			getid('ustr').innerHTML = '当前帐号已经存在';
			getid('ustr').className ='b';
			showid('ustr111',false);
			return false;
		}else if(str == 'success') {
			showid('ustr',true);	
			getid('ustr').innerHTML = '恭喜您,当前帐号可以使用';
			getid('ustr').className ='c';
			showid('ustr111',false);
			ischeckid = 1;
		}else {
			showid('ustr',true);	
			getid('ustr').innerHTML = '很抱歉,当前不能注册,请刷新重试!';
			getid('ustr').className ='b';
			showid('ustr111',false);
		}
	}
	function changeid () {
		ischeckid = 0;		 		
	}
	function changeemail() {
		ischeckemail = 0;
	}
	function show_emailfucus() {
		showid('ustr222',true);	
		showid('ustr2',false);
	}
	function checkUserEmail() {
		var email = getid('useremail').value.trim();
		var patrm = new RegExp(/^[a-zA-Z1-9_-]{1}[a-zA-Z0-9_-]+@([a-zA-Z0-9_-])+.[a-zA-Z0-9_-]{2,3}$/);
		var length = email.substring(0,email.lastIndexOf('@')).length;
		if(ischeckemail == 0) {
			if(email) {
				if(email.substring(0,1) == '0') {
					showid('ustr2',true);	
					showmsg('ustr2','邮箱用户名不能以0开头!');
					getid('ustr2').className ='b';
					showid('ustr222',false);	
					return false;
				}else if(!patrm.exec(email)) {
					showid('ustr2',true);	
					showmsg('ustr2','邮箱格式错误!');		
					getid('ustr2').className ='b';			
					showid('ustr222',false);	
					return false;
				}else if(length <4 || length >18) {
					showid('ustr2',true);	
					showmsg('ustr2','邮箱用户名长度必须是4-18位!');
					getid('ustr2').className ='b';
					showid('ustr222',false);	
					return false;
				}else {
					showid('ustr2',true);
					showmsg('ustr2','正在检测....');
					getid('ustr2').className ='e';
					showid('ustr222',false);	
					ajax_get('../ajax/checkreg.php?email='+email+'&ac=em',checkEM);
				}
				return true;
			}
		}else {
			showid('ustr222',false);	
			showid('ustr2',true);
		}
	}
	function checkEM(str) {
		if(str == 'exist') {
			showid('ustr2',true);	
			getid('ustr2').innerHTML = '当前邮箱帐号已经存在';
			getid('ustr2').className ='b';
			showid('ustr222',false);	
			return false;
		}else if(str == 'success') {
			showid('ustr2',true);	
			getid('ustr2').innerHTML = '恭喜您,当前邮箱帐号可以使用';
			getid('ustr2').className ='c';
			showid('ustr222',false);			
			ischeckemail = 1;
		}else if(str == 'false2') {
			showid('ustr2',true);	
			getid('ustr2').innerHTML = '格式错误,请重新输入!';
			getid('ustr2').className ='b';
			showid('ustr222',false);
			//$('ustr2').className = 'yes';
		}else {
			showid('ustr2',true);	
			getid('ustr2').innerHTML = '很抱歉,当前不能注册,请刷新重试!';
			getid('ustr2').className ='b';
			showid('ustr222',false);	
			//$('ustr2').className = 'no';
		}
	}
	function checkPw() {
		var pw = getid('userpwd1').value;
		if(pw.length>5) {
			showid('pwstr111',false);						
			showid('pwstr',true);
			showmsg('pwstr','密码格式正确');
			getid('pwstr').className='c';
			switch(checkStrong(pw)) {
				case 1:{
					//showmsg('sta1','弱');
					getid('sta1').style.background = '#CD050E';
					getid('sta2').style.background = '#CCCCCC';
					getid('sta3').style.background = '#CCCCCC';
					break;
				}
				case 2: 
					//showmsg('sta1','中');
					getid('sta1').style.background = '#CD050E';
					getid('sta2').style.background = '#CD050E';
					getid('sta3').style.background = '#CCCCCC';
					break;
				case 3: 
					//showmsg('sta1','强');
					getid('sta1').style.background = '#CD050E';
					getid('sta2').style.background = '#CD050E';
					getid('sta3').style.background = '#CD050E';
					break;
			}
		}else {
			showid('pwstr',true);
			showid('pwstr111',false);
			showmsg('pwstr','密码长度太短');
			//showmsg('sta1','');
			getid('sta1').style.background = '#CD050E';
			getid('sta2').style.background = '#CCCCCC';
			getid('sta3').style.background = '#CCCCCC';
		}
	}
	function show_pwdfocus() {
		showid('pwstr',false);
		showid('pwstr111',true);
	}
	function checkPw2() {
		var pw = getid('userpwd1').value;
		var pw2 = getid('userpwd2').value;
		if(pw !='' && pw2 !='') {
			if(pw2 != pw) {
				getid('pw2').innerHTML = '两次密码输入不一致';
				getid('pw2').className = 'b';
				showid('pw223',false);
				showid('pw2',true);				
				return false;
			}else {
				getid('pw223').innerHTML = '两次密码一致';
				getid('pw223').className='c';
				showid('pw2',false);
				getid('pw2').className = 'c';
				showid('pw223',true);
			}
		}
	}
	function checkcard() {
		var cardID = $('cardID').value.trim();
		var patrm = new RegExp(/^[0-9xX]+$/);
		if(cardID) {
			if(!patrm.exec(cardID)) {
				$('ustr3').innerHTML = '身份证号必须全是数字!';
				$('ustr3').className = 'no';
				$('ustr33').style.display = 'none';
				return false;
			}
			if(cardID.length == 15 || cardID.length == 18) {
				$('ustr3').innerHTML = '&nbsp;';
				$('ustr3').className = 'yes';
			}else {
				$('ustr3').innerHTML = '身份证号长度必须是15或18位';
				$('ustr3').className = 'no';
				$('ustr33').style.display = 'none';
				return false;
			}
		}
	}
	function myreset() {
		document.myform.reset();
		$('ustr222').style.display = 'block';
		$('ustr2').style.display = 'none';
		$('ustr').style.display = 'none';
		$('ustr111').style.display = 'block';
		$('sub').src='images/10.gif';	
		$('pw2').innerTHML = '';
		$('pw2').className = '';
		$('ustr3').innerHTML = '';
		$('ustr3').className = '';
		$('sub').disabled = true;
		$('sta1').style.background = '';
		$('sta2').style.background = '';
		$('sta3').style.background = '';
		$('sta1').innerHTML = '';
		$('pwstr111').style.display = 'none';
		$('pwstr').style.display = 'block';
		return false;
	}
	function charMode(iN){ 
		if (iN>=48 && iN <=57)  
		return 1; 
		if (iN>=65 && iN <=90) 
		return 2; 
		if (iN>=97 && iN <=122) 
		return 4; 
		else 
		return 8; 
	} 
	function bitTotal(num){ 
		modes=0; 
		for (i=0;i<4;i++){ 
			if (num & 1) modes++; 
			num>>>=1; 
		} 
		return modes; 
	} 

	function checkStrong(pwd){ 
		modes=0; 
		for (i=0;i<pwd.length;i++){ 
			modes|=charMode(pwd.charCodeAt(i)); 
		} 
		return bitTotal(modes);
	}
	function checkxy2() {
		if($('checkxy').checked == true) {
			$('sub').src='../images/zc_01.gif';
			$('sub').disabled = false;
		}else {
			$('sub').src='../images/zc_001.gif';	
			$('sub').disabled = true;
		}
	}
	
	
	function check(obj) {
		if(obj.userid.value==""){
			alert("请输入用户名!");
			obj.userid.focus();
			return false;	
		}
		
		if(obj.useremail.value==""){
			alert("请输入邮箱!");
			obj.useremail.focus();
			return false;	
		}
		
		if(obj.pass.value==""){
			alert("请输入密码!");
			obj.pass.focus();
			return false;	
		}
		
		if(obj.password2.value==""){
			alert("请重新输入密码!");
			obj.password2.focus();
			return false;	
		}
		
		if(obj.cardID.value==""){
			alert("请输入身份证号!");
			obj.cardID.focus();
			return false;	
		}	
		
		login.style.display="none";
		logining.style.display="";		
	}
	

