

/*
-- ------ Zone ------ --
*/
function User(){}
//-- ------ #Parameters ------ --

User.prototype.sAjax_0=new netsSingleAjax();
User.prototype.sName="mainZone";
User.prototype.sCheckRepeateURL="Plus/Common/User/Register.php";



//-- ------ #Methods ------ --
//-- #Tab --
User.prototype.sReg_TabCount=2;
User.prototype.OnReg_Tab=function(pType){
	var Coun0=0;
	if(pType==0){
		//-- #Email --
		document.getElementById("uitEmailTxt_RowBox").className="";
		document.getElementById("uitMobileTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("mainReg_0_Button").className="UReg_RButtonB";
		document.getElementById("mainReg_1_Button").className="UReg_RButtonA";
		document.getElementById("uitRegisterTypeTxt").value=0;
	}else{
		//-- #Mobile --
		document.getElementById("uitEmailTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("uitMobileTxt_RowBox").className="";
		document.getElementById("mainReg_0_Button").className="UReg_RButtonA";
		document.getElementById("mainReg_1_Button").className="UReg_RButtonB";
		document.getElementById("uitRegisterTypeTxt").value=1;
	}
	
	
	return 0;
}
//-- #Login Check --
User.prototype.OnReg_EMessage="";
User.prototype.OnReg_Name=function(pControlName){
	tmpControlName="uitEmail";
	tmpRegisterType=document.getElementById("uitRegisterTypeTxt").value;
	if(tmpRegisterType==1){
		tmpControlName="uitMobile";
	}
	var tmpChecker=new netsChecker();
	var tmpElement_0=document.getElementById(tmpControlName+"Txt");
	var tmpElement_1=document.getElementById(tmpControlName+"Txt_Messagebox");
	
	if(tmpRegisterType==0){
		//-- ------ #Email ------ --
		tmpElement_0.value=tmpChecker.Filter(tmpElement_0.value,0);
		this.OnReg_EMessage="对不起，电邮地址不正确；格式需为如：usermail@unionnets.com。";
		if(tmpElement_0.value.length<5 || !tmpChecker.Rule(tmpElement_0.value,5)){
			tmpElement_1.className="EMessage_0";
			tmpElement_1.innerHTML=this.OnReg_EMessage;
			return 1;
		}
		tmpElement_1.className="ControlLoading";
		tmpElement_1.innerHTML="正在验证电子邮件地址";
		this.sAjax_0.sFlag="Message";
		this.sAjax_0.sPanel=tmpElement_1.id;
		var tmpURL=tmpCommon.sysHome+this.sCheckRepeateURL+"?ActionType=DCheckRepeate&DCheckRepeate="+tmpElement_0.value+tmpCommon.sysSPLIT1+0;
		this.sAjax_0.sendRequestSp(tmpURL,"reg_CheckRepeate_callback()");
		//window.open(tmpURL,"_blank");

	}else{
		//-- ------ #Mobile ------ --
		tmpElement_0.value=tmpChecker.Filter(tmpElement_0.value,0);
		this.OnReg_EMessage="手机号码必需为11位数字；必需输入格式为如：13900000000。";
		if(tmpElement_0.value.length<=8){
			tmpElement_1.className="EMessage_0";
			tmpElement_1.innerHTML=this.OnReg_EMessage;
			return 1;
		}
		if(this.OnReg_CheckMobile(tmpElement_0.value)==1){
			tmpElement_1.className="EMessage_0";
			tmpElement_1.innerHTML=this.OnReg_EMessage;
			return 1;
		}
		tmpElement_1.className="ControlLoading";
		tmpElement_1.innerHTML="正在验证手机号";
		this.sAjax_0.sFlag="Message";
		this.sAjax_0.sPanel=tmpElement_1.id;
		var tmpURL=tmpCommon.sysHome+this.sCheckRepeateURL+"?ActionType=DCheckRepeate&DCheckRepeate="+tmpElement_0.value+tmpCommon.sysSPLIT1+1;
		this.sAjax_0.sendRequestSp(tmpURL,"reg_CheckRepeate_callback()");
		//window.open(tmpURL,"_blank");

	}
	return 0;
}
User.prototype.OnReg_CheckMobile=function(pSTR){
	if(!(/^1[3|4|5|8]\d{9,9}$/.test(pSTR))){
		return 1;
	}
	
	return 0;
}
function reg_CheckRepeate_callback(){
	var tmpFlag=tmpUser.sAjax_0.sFlag;
	var tmpPanel=document.getElementById(tmpUser.sAjax_0.sPanel);
	var tmpURL=tmpUser.sAjax_0.sURL;
	var tmpHttpRequests=tmpUser.sAjax_0.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			var tmpAR0=tmpData.split(tmpCommon.sysSPLIT1);
			if(tmpAR0.length!=2){
				tmpPanel.className="EMessage_0";
				tmpPanel.innerHTML="验证错误，请稍后再试";
			}else{
				if(tmpAR0[0]=="ERROR"){
					tmpPanel.className="EMessage_0";
					tmpPanel.innerHTML=tmpAR0[1];
				}else{
					tmpPanel.className="ControlIntroduct";
					tmpPanel.innerHTML=tmpAR0[1];
				}
			}
	    	tmpFrames.showLoading(1);
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    	tmpFrames.showLoading(1);
	    }
	}else{
		tmpFrames.showLoading(0);
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
	
}
User.prototype.OnReg_CheckPxd=function(pControlName){
	var tmpChecker=new netsChecker();
	var tmpElement_0=document.getElementById(pControlName+"Txt");
	var tmpElement_1=document.getElementById(pControlName+"Txt_Messagebox");
	//-- ### --
	tmpElement_0.value=tmpChecker.Filter(tmpElement_0.value,0);
	if(tmpElement_0.value.length<5){
		tmpElement_1.className="EMessage_0";
		this.OnReg_EMessage="对不起，为了您的帐户安全，您的密码必须大于5位。";
		tmpElement_1.innerHTML=this.OnReg_EMessage;
		
		return 1;
	}
	//-- ### --
	tmpINT=tmpChecker.PxdSecurity(tmpElement_0.value);
	if(tmpINT==1){
		tmpElement_1.innerHTML="不安全";
		tmpElement_1.className="UError_S_1";
	}else if(tmpINT==2){
		tmpElement_1.innerHTML="不够安全";
		tmpElement_1.className="UError_S_2";
	}else if(tmpINT==3){
		tmpElement_1.innerHTML="较安全";
		tmpElement_1.className="UError_S_3";
	}else if(tmpINT==4){
		tmpElement_1.innerHTML="非常安全";
		tmpElement_1.className="UError_S_4";
	}else if(tmpINT==5){
		tmpElement_1.innerHTML="非常安全";
		tmpElement_1.className="UError_S_4";
	}
	return 0;
}
User.prototype.OnReg_CheckPxdConfirm=function(pControlName){
	var tmpChecker=new netsChecker();
	var tmpElement_A=document.getElementById("uitPxdTxt");
	var tmpElement_0=document.getElementById(pControlName+"Txt");
	var tmpElement_1=document.getElementById(pControlName+"Txt_Messagebox");

	tmpElement_A.value=tmpChecker.Filter(tmpElement_A.value,0);
	tmpElement_0.value=tmpChecker.Filter(tmpElement_0.value,0);
	if(tmpElement_A.value!=tmpElement_0.value){
		tmpElement_1.className="EMessage_0";
		this.OnReg_EMessage="对不起，您两次输入的密码不一致。";
		tmpElement_1.innerHTML=this.OnReg_EMessage;
		return 1;
	}else if(tmpElement_0.value.length<5){
		tmpElement_1.className="EMessage_0";
		this.OnReg_EMessage="对不起，为了您的帐户安全，您的密码必须大于5位。";
		tmpElement_1.innerHTML=this.OnReg_EMessage;
		return 1;
	}
	
	tmpElement_1.className="ControlIntroduct";
	tmpElement_1.innerHTML="您的输入正确。";
	return 0;
}


