/**
 * @namespace com.thesis.control.TMemberControl
 * @author 钟军锐 August.R@263.net
 */

/** @id TMemberControl */
function TMemberControl(){
	this.mapping = {
		btnSignIn:"btnTMemberSignIn",
		btnSignInCancel:"btnCancelSignInDialog",
		btnSignUp:"btnTMemberSignUp",
		btnSignOut:"TSignOut",
		btnSignInDialog:"btnShowSignInDialog",
		btnAltPswDialog:"btnShowChangePWD",
		
		btnAltLinkInfo:"btnTMInfoAlter",
		btnAltSupTEntInfo:"btnSupTEntInfoAlter",
		btnAddLinkTEnt:"btnTEntLinkAdd",
		
		btnDiaTMLOK:"btnDiaTMLOK",
		btnDiaTMLCancel:"btnDiaTMLCancel",
		btnDiaAdd:"btnDiaTEntAdd",
		btnDiaAddCancel:"btnDiaTEntAddCancel",
		btnDiaAlter:"btnDiaTEntAlter",
		btnDiaUpdate:"btnDiaTEntUpdate",
		btnDiaUpdateCancel:"btnDiaTEntUpdateCancel",
		btnDiaBack:"btnDiaTEntBack",
		btnPswAlt:"btnPswAlter",
		btnPswAltCancel:"btnPswAlterCancel",
		btnRemTEntYes:"btnRemoveTEntYes",
		btnRemTEntNo:"btnRemoveTEntNo",
		
		chk1:"chkVariety1",
		chk2:"chkVariety2",
		chk3:"chkVariety3",
		chk4:"chkVariety4",
		chk5:"chkVariety5",
		chk6:"chkVariety6",
		chk7:"chkVariety7",
		chk8:"chkVariety8",
		chk9:"chkVariety9",
		chkA:"chkVarietyA",
		chkB:"chkVarietyB",
		chkC:"chkVarietyC",
		chkD:"chkVarietyD",
		chkE:"chkVarietyE",
		chkF:"chkVarietyF",
		
		divSignInDialog:"SignInDialog",
		divSignUpDialog:"SignUpDialog",
		divMenuR:"SignInRst",
		divMenuD:"SignIned",
		divTMemberInfo:"TMemberInfo",
		
		divAltLinkInfoDialog:"divAlterLinkInfoDialog",
		divTEntDialog:"divTEnterpriseInfoDialog",
		divDiaTEntIntroduce:"divDiaTEnterpriseIntroduce",
		divDiaVariety:"divDiaTEnterpriseVariety",
		divAltPsw:"divAlterSignInPsw",
		divRemoveTEntDialog:"divRemoveTEntDialog",
		
		hiddenTEntID:"hiddenDiaTEnterpriseID",
		hiddenTEntVariety:"hiddenDiaVariety",
		
		imgSignInVC:"imgTMemberLoginVC",
		
		spanLinkMan:"spanTLinkMan",
		spanLinkPhone:"spanTLinkPhone",
		spanEmail:"spanTMemberEmail",
		spanSTEntName:"spanTEnterpriseName",
		spanSTEntShortName:"spanTEnterpriseShortName",
		spanSTEntType:"spanTEnterpriseType",
		spanSTEntSignUpDate:"spanTEnterpriseSignUpDate",
		spanSTEntAudDate:"spanTEnterpriseAuditedDate",
		spanSTEntAudCondition:"spanTEnterpriseAuditingCondition",
		spanSTEntAudEmp:"spanTEnterpriseAuditingEmp",
		spanSTEntJuridical:"spanTEnterpriseJuridical",
		spanSTEntCode:"spanTEnterpriseCode",
		spanSTEntLicenceID:"spanTEnterpriseLicenceID",
		spanSTEntTaxNum:"spanTEnterpriseTaxNum",
		spanSTEntPhone:"spanTEnterprisePhone",
		spanSTEntFax:"spanTEnterpriseFax",
		spanSTEntZip:"spanTEnterpriseZip",
		spanSTEntBankName:"spanTEnterpriseBankName",
		spanSTEntBankAccountNum:"spanTEnterpriseBankAccountNum",
		spanSTEntVariety:"spanTEnterpriseVariety",
		spanSTEntAddress:"spanTEnterpriseAddress",
		spanSTEntWebLink:"spanTEnterpriseWebLink",
		spanSTEntIntroduce:"spanTEnterpriseIntroduce",
		spanSTEntTitReason:"spanTitRejectReason",
		spanSTEntReason:"spanMsgRejectReason",
		
		spanDiaSignUpDate:"spanDiaSignUpDate",
		spanDiaAudDate:"spanDiaAuditedDate",
		spanDiaName:"spanDiaTEnterpriseName",
		spanDiaShortName:"spanDiaTEnterpriseShortName",
		spanDiaType:"spanDiaTEnterpriseType",
		spanDiaPhone:"spanDiaTEnterprisePhone",
		spanDiaFax:"spanDiaTEnterpriseFax",
		spanDiaZip:"spanDiaTEnterpriseZip",
		spanDiaVariety:"spanDiaTEnterpriseVariety",
		spanDiaAudCondition:"spanDiaAuditingCondition",
		spanDiaAudEmp:"spanDiaAuditedEmp",
		spanDiaLicenceID:"spanDiaTEnterpriseLicenceID",
		spanDiaTaxNum:"spanDiaTEnterpriseTaxNum",
		spanDiaCode:"spanDiaTEnterpriseCode",
		spanDiaJuridical:"spanDiaTEnterpriseJuridical",
		spanDiaBankName:"spanDiaTEnterpriseBankName",
		spanDiaBankAccountNum:"spanDiaTEnterpriseBankAccountNum",
		spanDiaWebLink:"spanDiaTEnterpriseWebLink",
		spanDiaAddress:"spanDiaTEnterpriseAddress",
		spanDiaIntroduce:"spanDiaTEnterpriseIntrodece",
		spanDiaTitReason:"spanDiaTitRejectReason",
		spanDiaReason:"spanDiaMsgRejectReason",
		spanDiaRemoveTEntName:"spanDiaRemoveTEntName",
		
		selDiaType:"selDiaTEnterpriseType",
		
		tbodyTEnt:"tbodyTEntLinkInfoRow",
		
		txtSignInID:"txtTMemberLoginID",
		txtSignInPWD:"txtTMemberLoginPWD",
		txtSignInVC:"txtTMemberLoginVC",
		
		txtDiaName:"txtDiaTEnterpriseName",
		txtDiaShortName:"txtDiaTEnterpriseShortName",
		txtDiaPhone:"txtDiaTEnterprisePhone",
		txtDiaFax:"txtDiaTEnterpriseFax",
		txtDiaZip:"txtDiaTEnterpriseZip",
		txtDiaLicenceID:"txtDiaTEnterpriseLicenceID",
		txtDiaTaxNum:"txtDiaTEnterpriseTaxNum",
		txtDiaCode:"txtDiaTEnterpriseCode",
		txtDiaJuridical:"txtDiaTEnterpriseJuridical",
		txtDiaBankName:"txtDiaTEnterpriseBankName",
		txtDiaBankAccountNum:"txtDiaTEnterpriseBankAccountNum",
		txtDiaWebLink:"txtDiaTEnterpriseWebLink",
		txtDiaAddress:"txtDiaTEnterpriseAddress",
		txtDiaIntroduce:"txtDiaTEnterpriseIntroduce",
		txtAltLinkMan:"txtDiaTMemberLinkMan",
		txtAltLinkPhone:"txtdiaTMemberLinkPhone",
		
		txtPswOrigin:"txtOriginPsw",
		txtPswNew:"txtNewPsw",
		txtPswRe:"txtRePsw"
	};
	
	this.VC = new ValidateCode(this.mapping.imgSignInVC,"/service/vc.s","btnChangeVCImage");
	M$(this.mapping);
	
	this.Box = {};
	this.Box.Info = {};
	this.Box.Info.Frame = this.mapping.divTMemberInfo;
	this.Box.TEntList = this.mapping.tbodyTEnt;
	
	this.Box.Info.Ent = {};
	this.Box.Info.Ent.Name = this.mapping.spanSTEntName;
	this.Box.Info.Ent.ShortName = this.mapping.spanSTEntShortName;
	this.Box.Info.Ent.Type = this.mapping.spanSTEntType;
	this.Box.Info.Ent.SignUpDate = this.mapping.spanSTEntSignUpDate;
	this.Box.Info.Ent.AudDate = this.mapping.spanSTEntAudDate;
	this.Box.Info.Ent.AudCondition = this.mapping.spanSTEntAudCondition;
	this.Box.Info.Ent.AudEmp = this.mapping.spanSTEntAudEmp;
	this.Box.Info.Ent.Juridical = this.mapping.spanSTEntJuridical;
	this.Box.Info.Ent.Code = this.mapping.spanSTEntCode;
	this.Box.Info.Ent.LicenceID = this.mapping.spanSTEntLicenceID;
	this.Box.Info.Ent.TaxNum = this.mapping.spanSTEntTaxNum;
	this.Box.Info.Ent.Phone = this.mapping.spanSTEntPhone;
	this.Box.Info.Ent.Fax = this.mapping.spanSTEntFax;
	this.Box.Info.Ent.Zip = this.mapping.spanSTEntZip;
	this.Box.Info.Ent.BankName = this.mapping.spanSTEntBankName;
	this.Box.Info.Ent.BankAccountNum = this.mapping.spanSTEntBankAccountNum;
	this.Box.Info.Ent.Variety = this.mapping.spanSTEntVariety;
	this.Box.Info.Ent.Address = this.mapping.spanSTEntAddress;
	this.Box.Info.Ent.WebLink = this.mapping.spanSTEntWebLink;
	this.Box.Info.Ent.Introduce = this.mapping.spanSTEntIntroduce;
	this.Box.Info.Ent.Reason = this.mapping.spanSTEntReason;
	this.Box.Info.Ent.TitReason = this.mapping.spanSTEntTitReason;
	
	this.Box.Info.Member = {};
	this.Box.Info.Member.LinkMan = this.mapping.spanLinkMan;
	this.Box.Info.Member.LinkPhone = this.mapping.spanLinkPhone;
	this.Box.Info.Member.Email = this.mapping.spanEmail;
	
	this.Exe = {};
	this.Exe.btnSignIn = this.mapping.btnSignIn;
	this.Exe.btnSignInCancel = this.mapping.btnSignInCancel;
	this.Exe.btnSignUp = this.mapping.btnSignUp;
	this.Exe.btnSignOut = this.mapping.btnSignOut;
	this.Exe.btnSignInDialog = this.mapping.btnSignInDialog;
	this.Exe.btnAltPswDialog = this.mapping.btnAltPswDialog;
	this.Exe.btnAltLinkInfo = this.mapping.btnAltLinkInfo;
	this.Exe.btnAltSupTEnt = this.mapping.btnAltSupTEntInfo;
	this.Exe.btnAddLinkTEnt = this.mapping.btnAddLinkTEnt;
	this.Exe.btnATMLOK = this.mapping.btnDiaTMLOK;
	this.Exe.btnATMLCancel = this.mapping.btnDiaTMLCancel;
	this.Exe.btnTEntAdd = this.mapping.btnDiaAdd;
	this.Exe.btnTEntAddCancel = this.mapping.btnDiaAddCancel;
	this.Exe.btnTEntAlter = this.mapping.btnDiaAlter;
	this.Exe.btnTEntUpdate = this.mapping.btnDiaUpdate;
	this.Exe.btnTEntUpdateCancel = this.mapping.btnDiaUpdateCancel;
	this.Exe.btnTEntBack = this.mapping.btnDiaBack;
	this.Exe.btnTEntRemove = this.mapping.btnRemTEntYes;
	this.Exe.btnTEntRemoveCancel = this.mapping.btnRemTEntNo;
	this.Exe.btnAltPsw = this.mapping.btnPswAlt;
	this.Exe.btnAltPswCancel = this.mapping.btnPswAltCancel;
	
	this.Menu = {};
	this.Menu.R = this.mapping.divMenuR;
	this.Menu.D = this.mapping.divMenuD;
	
	this.Dialog = {};
	this.Dialog.SignIn = {};
	this.Dialog.SignIn.Form = new CommonDialog("登录", this.mapping.divSignInDialog, true, true);
	this.Dialog.SignIn.UID = this.mapping.txtSignInID;
	this.Dialog.SignIn.PWD = this.mapping.txtSignInPWD;
	this.Dialog.SignIn.VC = this.mapping.txtSignInVC;
	
	this.Dialog.AlterLikeInfo = {};
	this.Dialog.AlterLikeInfo.Form = new CommonDialog("修改联系资料", this.mapping.divAltLinkInfoDialog, true, true);
	this.Dialog.AlterLikeInfo.Name = this.mapping.txtAltLinkMan;
	this.Dialog.AlterLikeInfo.Phone = this.mapping.txtAltLinkPhone;
	
	this.Dialog.AltPsw = {};
	this.Dialog.AltPsw.Form = new CommonDialog("修改登录密码", this.mapping.divAltPsw, true, true);
	this.Dialog.AltPsw.Origin = this.mapping.txtPswOrigin;
	this.Dialog.AltPsw.New = this.mapping.txtPswNew;
	this.Dialog.AltPsw.Re = this.mapping.txtPswRe;
	
	this.Dialog.Ent = {};
	this.Dialog.Ent.Form = new CommonDialog("企业资料", this.mapping.divTEntDialog, true, false);
	this.Dialog.Ent.TitReason = this.mapping.spanDiaTitReason;
	this.Dialog.Ent.TEO = null;
	this.Dialog.Ent.Out = {};
	this.Dialog.Ent.Out.Name = this.mapping.spanDiaName;
	this.Dialog.Ent.Out.ShortName = this.mapping.spanDiaShortName;
	this.Dialog.Ent.Out.Address = this.mapping.spanDiaAddress;
	this.Dialog.Ent.Out.Zip = this.mapping.spanDiaZip;
	this.Dialog.Ent.Out.Phone = this.mapping.spanDiaPhone;
	this.Dialog.Ent.Out.Fax = this.mapping.spanDiaFax;
	this.Dialog.Ent.Out.Juridical = this.mapping.spanDiaJuridical;
	this.Dialog.Ent.Out.TaxNum = this.mapping.spanDiaTaxNum;
	this.Dialog.Ent.Out.AudCondition = this.mapping.spanDiaAudCondition;
	this.Dialog.Ent.Out.AudEmp = this.mapping.spanDiaAudEmp;
	this.Dialog.Ent.Out.LicenceID = this.mapping.spanDiaLicenceID;
	this.Dialog.Ent.Out.Code = this.mapping.spanDiaCode;
	this.Dialog.Ent.Out.Variety = this.mapping.spanDiaVariety;
	this.Dialog.Ent.Out.TypeDesc = this.mapping.spanDiaType;
	this.Dialog.Ent.Out.Introduce = this.mapping.spanDiaIntroduce;
	this.Dialog.Ent.Out.WebLink = this.mapping.spanDiaWebLink;
	this.Dialog.Ent.Out.SignUpDate = this.mapping.spanDiaSignUpDate;
	this.Dialog.Ent.Out.AudDate = this.mapping.spanDiaAudDate;
	this.Dialog.Ent.Out.BankName = this.mapping.spanDiaBankName;
	this.Dialog.Ent.Out.BankAccountNum = this.mapping.spanDiaBankAccountNum;
	this.Dialog.Ent.Out.Reason = this.mapping.spanDiaReason;
	this.Dialog.Ent.In = {};
	this.Dialog.Ent.In.ID = this.mapping.hiddenTEntID;
	this.Dialog.Ent.In.Name = this.mapping.txtDiaName;
	this.Dialog.Ent.In.ShortName = this.mapping.txtDiaShortName;
	this.Dialog.Ent.In.Address = this.mapping.txtDiaAddress;
	this.Dialog.Ent.In.Zip = this.mapping.txtDiaZip;
	this.Dialog.Ent.In.Phone = this.mapping.txtDiaPhone;
	this.Dialog.Ent.In.Fax = this.mapping.txtDiaFax;
	this.Dialog.Ent.In.Juridical = this.mapping.txtDiaJuridical;
	this.Dialog.Ent.In.TaxNum = this.mapping.txtDiaTaxNum;
	this.Dialog.Ent.In.LicenceID = this.mapping.txtDiaLicenceID;
	this.Dialog.Ent.In.Code = this.mapping.txtDiaCode;
	this.Dialog.Ent.In.Variety = this.mapping.hiddenTEntVariety;
	this.Dialog.Ent.In.TypeID = this.mapping.selDiaType;
	this.Dialog.Ent.In.Introduce = this.mapping.txtDiaIntroduce;
	this.Dialog.Ent.In.WebLink = this.mapping.txtDiaWebLink;
	this.Dialog.Ent.In.BankName = this.mapping.txtDiaBankName;
	this.Dialog.Ent.In.BankAccountNum = this.mapping.txtDiaBankAccountNum;
	
	this.Dialog.RemoveEnt = {};
	this.Dialog.RemoveEnt.Form = new CommonDialog("删除联系会员", this.mapping.divRemoveTEntDialog, true, true);
	this.Dialog.RemoveEnt.TEntName = this.mapping.spanDiaRemoveTEntName;
	
	this.CheckBox = {};
	this.CheckBox.divVariety = this.mapping.divDiaVariety;
	this.CheckBox.Variety = {};
	this.CheckBox.Variety.chk1 = this.mapping.chk1;
	this.CheckBox.Variety.chk2 = this.mapping.chk2;
	this.CheckBox.Variety.chk3 = this.mapping.chk3;
	this.CheckBox.Variety.chk4 = this.mapping.chk4;
	this.CheckBox.Variety.chk5 = this.mapping.chk5;
	this.CheckBox.Variety.chk6 = this.mapping.chk6;
	this.CheckBox.Variety.chk7 = this.mapping.chk7;
	this.CheckBox.Variety.chk8 = this.mapping.chk8;
	this.CheckBox.Variety.chk9 = this.mapping.chk9;
	this.CheckBox.Variety.chkA = this.mapping.chkA;
	this.CheckBox.Variety.chkB = this.mapping.chkB;
	this.CheckBox.Variety.chkC = this.mapping.chkC;
	this.CheckBox.Variety.chkD = this.mapping.chkD;
	this.CheckBox.Variety.chkE = this.mapping.chkE;
	this.CheckBox.Variety.chkF = this.mapping.chkF;
	
	this.Form = {};
	this.Form.SignIn = {};
	this.Form.SignIn.sURL = "/service/TMemberService.asmx/signIn";
	this.Form.SignIn.oParams = {};
	this.Form.SignIn.oParams.UserName = this.Dialog.SignIn.UID;
	this.Form.SignIn.oParams.PWD = this.Dialog.SignIn.PWD;
	this.Form.SignIn.oParams.vc = this.Dialog.SignIn.VC;
	
	this.Form.SignOut = {};
	this.Form.SignOut.sURL = "/service/TMemberService.asmx/signOut";
	
	this.Form.getInfo = {};
	this.Form.getInfo.sURL = "/service/TMemberService.asmx/getInfo";
	
	this.Form.SupEnt = {};
	this.Form.SupEnt.sURL = "/service/TMemberService.asmx/getSupEntInfo";
	
	this.Form.ListEnt = {};
	this.Form.ListEnt.sURL = "/service/TMemberService.asmx/listEnterprise";
	
	this.Form.AddEnt = {};
	this.Form.AddEnt.sURL = "/service/TMemberService.asmx/addEnterprise";
	this.Form.AddEnt.oParams = {};
	this.Form.AddEnt.oParams.TEntName = this.Dialog.Ent.In.Name;
	this.Form.AddEnt.oParams.TEntShortName = this.Dialog.Ent.In.ShortName;
	this.Form.AddEnt.oParams.TEntAddress = this.Dialog.Ent.In.Address;
	this.Form.AddEnt.oParams.TEntPostCode = this.Dialog.Ent.In.Zip;
	this.Form.AddEnt.oParams.TEntPhone = this.Dialog.Ent.In.Phone;
	this.Form.AddEnt.oParams.TEntFax = this.Dialog.Ent.In.Fax;
	this.Form.AddEnt.oParams.TEntJuridicalPerson = this.Dialog.Ent.In.Juridical;
	this.Form.AddEnt.oParams.TEntTaxNum = this.Dialog.Ent.In.TaxNum;
	this.Form.AddEnt.oParams.TEntLicenceID = this.Dialog.Ent.In.LicenceID;
	this.Form.AddEnt.oParams.TEntCode = this.Dialog.Ent.In.Code;
	this.Form.AddEnt.oParams.TEntVariety = this.Dialog.Ent.In.Variety;
	this.Form.AddEnt.oParams.TEntTypeID = this.Dialog.Ent.In.TypeID;
	this.Form.AddEnt.oParams.TEntIntroduce = this.Dialog.Ent.In.Introduce;
	this.Form.AddEnt.oParams.TEntWebLink = this.Dialog.Ent.In.WebLink;
	this.Form.AddEnt.oParams.BankName = this.Dialog.Ent.In.BankName;
	this.Form.AddEnt.oParams.BankAccountNum = this.Dialog.Ent.In.BankAccountNum;
	
	this.Form.AltEnt = {};
	this.Form.AltEnt.sURL = "/service/TMemberService.asmx/alterEnterprise";
	this.Form.AltEnt.oParams = {};
	this.Form.AltEnt.oParams.TEnterpriseID = this.Dialog.Ent.In.ID;
	this.Form.AltEnt.oParams.TEntName = this.Dialog.Ent.In.Name;
	this.Form.AltEnt.oParams.TEntShortName = this.Dialog.Ent.In.ShortName;
	this.Form.AltEnt.oParams.TEntAddress = this.Dialog.Ent.In.Address;
	this.Form.AltEnt.oParams.TEntPostCode = this.Dialog.Ent.In.Zip;
	this.Form.AltEnt.oParams.TEntPhone = this.Dialog.Ent.In.Phone;
	this.Form.AltEnt.oParams.TEntFax = this.Dialog.Ent.In.Fax;
	this.Form.AltEnt.oParams.TEntJuridicalPerson = this.Dialog.Ent.In.Juridical;
	this.Form.AltEnt.oParams.TEntTaxNum = this.Dialog.Ent.In.TaxNum;
	this.Form.AltEnt.oParams.TEntLicenceID = this.Dialog.Ent.In.LicenceID;
	this.Form.AltEnt.oParams.TEntCode = this.Dialog.Ent.In.Code;
	this.Form.AltEnt.oParams.TEntVariety = this.Dialog.Ent.In.Variety;
	this.Form.AltEnt.oParams.TEntTypeID = this.Dialog.Ent.In.TypeID;
	this.Form.AltEnt.oParams.TEntIntroduce = this.Dialog.Ent.In.Introduce;
	this.Form.AltEnt.oParams.TEntWebLink = this.Dialog.Ent.In.WebLink;
	this.Form.AltEnt.oParams.BankName = this.Dialog.Ent.In.BankName;
	this.Form.AltEnt.oParams.BankAccountNum = this.Dialog.Ent.In.BankAccountNum;
	
	this.Form.RemoveEnt = {};
	this.Form.RemoveEnt.sURL = "/service/TMemberService.asmx/removeEnterprise";
	this.Form.RemoveEnt.oParams = {};
	this.Form.RemoveEnt.oParams.TEnterpriseID = "";
	
	this.Form.AltLinkInfo = {};
	this.Form.AltLinkInfo.sURL = "/service/TMemberService.asmx/alterLinkInfo";
	this.Form.AltLinkInfo.oParams = {};
	this.Form.AltLinkInfo.oParams.LinkMan = this.Dialog.AlterLikeInfo.Name;
	this.Form.AltLinkInfo.oParams.LinkPhone = this.Dialog.AlterLikeInfo.Phone;
	
	this.Form.AltPsw = {};
	this.Form.AltPsw.sURL = "/service/TMemberService.asmx/changePassword";
	this.Form.AltPsw.oParams = {};
	this.Form.AltPsw.oParams.oripwd = this.Dialog.AltPsw.Origin;
	this.Form.AltPsw.oParams.pwd = this.Dialog.AltPsw.New;
	this.Form.AltPsw.oParams.repwd = this.Dialog.AltPsw.Re;
	
	this.BO = {};
	this.BO.SignIn = new BaseBO(SystemMessage, this.Form.SignIn);
	this.BO.SignOut = new BaseBO(SystemMessage, this.Form.SignOut);
	this.BO.GetInfo = new BaseBO(TMemberObject, this.Form.getInfo);
	this.BO.SupEnt = new BaseBO(TEnterpriseObject, this.Form.SupEnt);
	this.BO.ListEnt = new BaseBO(TEnterpriseObject, this.Form.ListEnt);
	this.BO.AddEnt = new BaseBO(SystemMessage, this.Form.AddEnt);
	this.BO.AltEnt = new BaseBO(SystemMessage, this.Form.AltEnt);
	this.BO.RemoveEnt = new BaseBO(SystemMessage, this.Form.RemoveEnt, true);
	this.BO.AltLinkInfo = new BaseBO(SystemMessage, this.Form.AltLinkInfo);
	this.BO.AltPsw = new BaseBO(SystemMessage, this.Form.AltPsw);
	this.BO.Current = null;
	
	this.SupTEnt = null;
	this.IsSignedIn = false;
	
	if(typeof TMemberControl._initialized == "undefined"){
		TMemberControl._initialized == true;
		
		/** @id show */
		TMemberControl.prototype.show = function(){
			this.Box.Info.Frame.style.display = "block";
		};
		
		/** @id hide */
		TMemberControl.prototype.hide = function(){
			this.Box.Info.Frame.style.display = "none";
		};
		
		/** @id clearTEntList */
		TMemberControl.prototype.clearTEntList = function(){
			Clear$(this.Box.TEntList);
		};
		
		/** @id clearSelection */
		TMemberControl.prototype.clearSelection = function(){
			var t = this.Box.TEntList;
			for(var i=0; i<t.childNodes.length; i++){
				if(i%2!=0){
					t.childNodes[i].className = "tr_style1";
				}
				else{
					t.childNodes[i].className = "tr_style2";
				}
			}
		};
		
		/** @id clearSupTEnt */
		TMemberControl.prototype.clearSupTEnt = function(){
			for(var i in this.Box.Info.Ent)
				if(i != "TitReason")
					this.Box.Info.Ent[i].innerHTML = "&nbsp";
			this.Box.Info.Ent.TitReason.style.display = "none";
			this.Exe.btnAltSupTEnt.style.display = "none";
		};
		
		/** @id loadTEntDialog */
		TMemberControl.prototype.loadTEntDialog = function(){
			for(var i in this.Dialog.Ent.Out)
				if((this.Dialog.Ent.TEO) && (this.Dialog.Ent.TEO[i]))
					this.Dialog.Ent.Out[i].innerHTML = this.Dialog.Ent.TEO[i];
				else
					this.Dialog.Ent.Out[i].innerHTML = "";
			for(var i in this.Dialog.Ent.In)
				if((this.Dialog.Ent.TEO) && (this.Dialog.Ent.TEO[i]))
					this.Dialog.Ent.In[i].value = this.Dialog.Ent.TEO[i];
				else
					this.Dialog.Ent.In[i].value = "";
			this.Dialog.Ent.TitReason.style.display = ((this.Dialog.Ent.TEO) && (this.Dialog.Ent.TEO.AudConditionID!=2) && (this.Dialog.Ent.TEO.Reason))? "":"none";
			this.Dialog.Ent.Out.Reason.style.display = this.Dialog.Ent.TitReason.style.display;
			for(var i in this.CheckBox.Variety)
				if(this.Dialog.Ent.In.Variety.value.indexOf(this.CheckBox.Variety[i].value)>=0)
					this.CheckBox.Variety[i].checked = true;
				else
					this.CheckBox.Variety[i].checked = false;
		};
		
		/** @id allowTEntDialogEdit */
		TMemberControl.prototype.allowTEntDialogEdit = function(bAllow){
			for(var i in this.Dialog.Ent.Out)
				this.Dialog.Ent.Out[i].style.display = bAllow? "none":"block";
			for(var i in this.Dialog.Ent.In)
				this.Dialog.Ent.In[i].style.display = bAllow? "block":"none";
			this.Dialog.Ent.Out.AudCondition.style.display = "";
			this.Dialog.Ent.Out.AudDate.style.display = "";
			this.Dialog.Ent.Out.AudEmp.style.display = "";
			this.Dialog.Ent.Out.Reason.style.display = this.Dialog.Ent.TitReason.style.display;
			this.CheckBox.divVariety.style.display = bAllow? "":"none";
		};
		
		/** @id showTEntAddDialog */
		TMemberControl.prototype.showTEntAddDialog = function(){
			this.Dialog.Ent.TEO = null;
			this.loadTEntDialog();
			this.allowTEntDialogEdit(true);
			this.Exe.btnTEntAdd.style.display = "";
			this.Exe.btnTEntAddCancel.style.display = "";
			this.Exe.btnTEntAlter.style.display = "none";
			this.Exe.btnTEntBack.style.display = "none";
			this.Exe.btnTEntUpdate.style.display = "none";
			this.Exe.btnTEntUpdateCancel.style.display = "none";
			this.Dialog.Ent.Form.ask();
		};
		
		/** @id showTEntInfoDialog */
		TMemberControl.prototype.showTEntInfoDialog = function(teo){
			this.Dialog.Ent.TEO = teo;
			this.loadTEntDialog();
			this.allowTEntDialogEdit(false);
			this.Exe.btnTEntAdd.style.display = "none";
			this.Exe.btnTEntAddCancel.style.display = "none";
			this.Exe.btnTEntAlter.style.display = "";
			this.Exe.btnTEntBack.style.display = "";
			this.Exe.btnTEntUpdate.style.display = "none";
			this.Exe.btnTEntUpdateCancel.style.display = "none";
			this.Dialog.Ent.Form.ask();
		};
		
		/** @id showTEntAlterDialog */
		TMemberControl.prototype.showTEntAlterDialog = function(teo){
			this.Dialog.Ent.TEO = teo;
			this.loadTEntDialog();
			this.allowTEntDialogEdit(true);
			this.Exe.btnTEntAdd.style.display = "none";
			this.Exe.btnTEntAddCancel.style.display = "none";
			this.Exe.btnTEntAlter.style.display = "none";
			this.Exe.btnTEntBack.style.display = "none";
			this.Exe.btnTEntUpdate.style.display = "";
			this.Exe.btnTEntUpdateCancel.style.display = "";
			this.Dialog.Ent.Form.ask();
		};
		
		/** @id closingTEntDialog */
		TMemberControl.prototype.closingTEntDialog = function(){
			this.Dialog.Ent.TEO = null;
		};
		
		/** @id initSignIn */
		TMemberControl.prototype.initSignIn = function(bSilence){
			this.Menu.R.className = "sm_col s";
			this.Menu.D.className = "sm_col";
			this.Dialog.AlterLikeInfo.Form.hide();
			this.Dialog.AltPsw.Form.hide();
			this.Dialog.Ent.Form.hide();
			this.Dialog.RemoveEnt.Form.hide();
			this.IsSignedIn = false;
			if(bSilence){
				this.Dialog.SignIn.Form.hide();
				uEvent.Listener.notify(this,"SignedOut");
				return;
			}
			this.Dialog.SignIn.Form.ask();
		};
		
		/** @id showTMemberInfo */
		TMemberControl.prototype.showTMemberInfo = function(tmo){
			if(typeof tmo == "undefined"){
				this.IsSignedIn = false;
				this.Dialog.SignIn.Form.exception("网络连接出错");
				return;
			}
			this.Menu.R.className = "sm_col";
			this.Menu.D.className = "sm_col s";
			this.Box.Info.Member.LinkMan.innerHTML = tmo.LinkMan;
			this.Box.Info.Member.LinkPhone.innerHTML = tmo.LinkPhone;
			this.Box.Info.Member.Email.innerHTML = tmo.Email;
			this.Dialog.SignIn.Form.hide();
			if(!this.IsSignedIn){
				this.IsSignedIn = true;
				this.listTEnt();
			}
		};
		
		/** @id showSupTEnt */
		TMemberControl.prototype.showSupTEnt = function(teo){
			this.clearSupTEnt();
			this.SupTEnt = teo;
			if(!teo) return;
			for(var i in this.Box.Info.Ent)
				if(teo[i]) this.Box.Info.Ent[i].innerHTML = teo[i];
			if(teo.Reason)
				this.Box.Info.Ent.TitReason.style.display = "";
			this.Box.Info.Ent.TitReason.style.display = (teo && teo.Reason && teo.AudConditionID!=2)? "":"none";
			this.Box.Info.Ent.Reason.style.display = this.Box.Info.Ent.TitReason.style.display;
			this.Exe.btnAltSupTEnt.style.display = (teo.AudConditionID == 1 || teo.AudConditionID==3)? "":"none";
		};
		
		/** @id registerTEnt */
		TMemberControl.prototype.registerTEnt = function(teo, btnD, btnR){
			var Root = this;
			
			if(btnD)
			uEvent.addBrowserHandler(btnD, "click", function(){
				btnD.parentNode.parentNode.className = "tr_style3";
				Root.showTEntInfoDialog(teo);
			});
			if(btnR)
			uEvent.addBrowserHandler(btnR, "click", function(){
				btnR.parentNode.parentNode.className = "tr_style3";
				Root.Dialog.RemoveEnt.TEntName.innerHTML = teo.Name;
				Root.Form.RemoveEnt.oParams.TEnterpriseID = teo.ID;
				Root.Dialog.RemoveEnt.Form.ask();
			});
		};
		
		/** @id handleTEntList */
		TMemberControl.prototype.handleTEntList = function(lst){
			this.clearTEntList();
			var Columns =["Name","ShortName","TypeDesc","TaxNum","AudCondition"];
			this.showSupTEnt(lst[0]);
			for (var i = 1; i < lst.length; i++) {
				var tr = C$("tr");
				if (i % 2 != 0) 
					tr.className = "tr_style1";
				else 
					tr.className = "tr_style2";
				var t = lst[i];
				var td = null;
				for (var j in Columns) {
					td = C$("td");
					if (typeof t[Columns[j]] != "undefined") 
						td.appendChild(T$(t[Columns[j]]));
					tr.appendChild(td);
				}
				td = C$("td");
				var btnD = null;
				var btnR = null;
				btnD = C$("Input");
				btnD.type = "Button";
				btnD.value = "查看";
				td.appendChild(btnD);
				btnR = C$("Input");
				btnR.type = "Button";
				btnR.value = "移除";
				td.appendChild(btnR);
				this.registerTEnt(t, btnD, btnR);
				tr.appendChild(td);
				this.Box.TEntList.appendChild(tr);
			}
			this.Dialog.Ent.Form.hide();
		};
		
		/** @id handleMessage */
		TMemberControl.prototype.handleMessage = function(msg){
			if(msg.code == Configuration.Symbol.TEntAdded ||
				msg.code == Configuration.Symbol.TEntAltered){
				this.listTEnt();
			}
			else if(msg.code == Configuration.Symbol.TEntRemoved){
				this.Dialog.RemoveEnt.Form.hide();
				this.listTEnt();
			}
			else if (msg.code == Configuration.Symbol.TMemberLinkUpdated){
				this.Dialog.AlterLikeInfo.Form.hide();
				this.getTMemberInfo();
			}
			else if(msg.code == Configuration.Symbol.SignInPWDChanged){
				this.Dialog.AltPsw.Form.hide();
			}
			else if(msg.code == Configuration.Symbol.SignedIn){
				this.getTMemberInfo();
			}
			else if(msg.code == Configuration.Symbol.SignedOut){
				this.initSignIn(true);
			}
			else {
				this.Dialog.AlterLikeInfo.Form.hide();
				this.Dialog.AltPsw.Form.hide();
				this.Dialog.RemoveEnt.Form.hide();
				this.Dialog.SignIn.Form.hide();
				this.Dialog.Ent.Form.message(msg);
			}
		};
		
		/** @id handleException */
		TMemberControl.prototype.handleException = function(ex, sender){
			if(ex.ErrorCode == Configuration.Symbol.SignInRequest){
				this.initSignIn();
			}
			else if(sender=="AddEnt" || sender=="AltEnt" ){
				this.Dialog.Ent.Form.exception(ex);
			}
			else if(sender=="AltLinkInfo"){
				this.Dialog.AlterLikeInfo.Form.exception(ex);
			}
			else if(sender=="AltPsw"){
				this.Dialog.AltPsw.Form.exception(ex);
			}
			else if(sender=="GetInfo"){
				this.Dialog.SignIn.Form.exception(ex, true);
			}
			else if(sender=="ListEnt"){
				this.Dialog.Ent.Form.exception(ex, true);
			}
			else if(sender=="RemoveEnt"){
				this.Dialog.RemoveEnt.Form.exception(ex, true);
			}
			else if(sender=="SignIn"){
				this.Dialog.SignIn.Form.exception(ex);
			}
			else if(sender=="SignOut"){
				this.Dialog.SignIn.Form.exception(ex, true);
			}
			else{
				this.Dialog.AlterLikeInfo.Form.hide();
				this.Dialog.AltPsw.Form.hide();
				this.Dialog.RemoveEnt.Form.hide();
				this.Dialog.Ent.Form.hide();
				this.Dialog.SignIn.Form.exception(ex, true);
			}
		};
		
		/** @id signIn */
		TMemberControl.prototype.signIn = function(){
			this.Dialog.SignIn.Form.busy("登录中. . .");
			this.BO.SignIn.execute();
		};
		
		/** @id signOut */
		TMemberControl.prototype.signOut = function(){
			this.Dialog.SignIn.Form.busy("退出. . .");
			this.BO.SignOut.execute();
		};
		
		/** @id getTMemberInfo */
		TMemberControl.prototype.getTMemberInfo = function(){
			this.Dialog.SignIn.Form.busy("获取数据. . .");
			this.BO.GetInfo.execute();
		};
		
		/** @id listTEnt */
		TMemberControl.prototype.listTEnt = function(){
			this.Dialog.Ent.Form.busy("获取企业信息. . .");
			this.BO.ListEnt.execute();
		};
		
		/** @id addTEnt */
		TMemberControl.prototype.addTEnt = function(){
			var sb = new StringBuffer();
			var flag = false;
			for(var i in this.CheckBox.Variety)
				if(this.CheckBox.Variety[i].checked == true){
					sb.append((!flag)?"":"、");
					sb.append(this.CheckBox.Variety[i].value);
					flag = true;
				}
			this.Dialog.Ent.In.Variety.value = sb.toString();
			this.Dialog.Ent.Form.busy("正在添加联系会员. . .");
			this.BO.AddEnt.execute();
		};
		
		/** @id alterTEnt */
		TMemberControl.prototype.alterTEnt = function(){
			var sb = new StringBuffer();
			var flag = false;
			for(var i in this.CheckBox.Variety)
				if(this.CheckBox.Variety[i].checked == true){
					sb.append((!flag)?"":"、");
					sb.append(this.CheckBox.Variety[i].value);
					flag = true;
				}
			this.Dialog.Ent.In.Variety.value = sb.toString();
			this.Dialog.Ent.Form.busy("正在更新企业信息. . .");
			this.BO.AltEnt.execute();
		};
		
		/** @id alterPsw */
		TMemberControl.prototype.alterPsw = function(){
			this.Dialog.AltPsw.Form.busy("正在变更登录密码. . .");
			this.BO.AltPsw.execute();
		};
		
		/** @id removeTEnt */
		TMemberControl.prototype.removeTEnt = function(){
			this.Dialog.RemoveEnt.Form.busy("正在删除联系会员. . .");
			this.BO.RemoveEnt.execute();
		};
		
		/** @id initialize */
		TMemberControl.prototype.initialize = function(Root){
			this.hide();
			
			uEvent.addBrowserHandler(this.Exe.btnAddLinkTEnt, "click", function(){
				Root.showTEntAddDialog();
			});
			uEvent.addBrowserHandler(this.Exe.btnAltLinkInfo, "click", function(){
				Root.Dialog.AlterLikeInfo.Form.ask();
			});
			uEvent.addBrowserHandler(this.Exe.btnAltPsw, "click", function(){
				Root.alterPsw();
			});
			uEvent.addBrowserHandler(this.Exe.btnAltPswCancel, "click", function(){
				Root.Dialog.AltPsw.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnAltSupTEnt, "click", function(){
				Root.showTEntAlterDialog(Root.SupTEnt);
			});
			uEvent.addBrowserHandler(this.Exe.btnATMLCancel, "click", function(){
				Root.Dialog.AlterLikeInfo.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnATMLOK, "click", function(){
				Root.Dialog.AlterLikeInfo.Form.busy("正在更新联系资料. . .");
				Root.BO.AltLinkInfo.execute();
			});
			uEvent.addBrowserHandler(this.Exe.btnSignIn, "click", function(){
				Root.signIn();
			});
			uEvent.addBrowserHandler(this.Exe.btnSignInCancel, "click", function(){
				Root.Dialog.SignIn.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnSignInDialog, "click", function(){
				Root.initSignIn();
				uEvent.getBrowserEvent().preventDefault();
			});
			uEvent.addBrowserHandler(this.Exe.btnAltPswDialog, "click", function(){
				Root.Dialog.AltPsw.Form.ask();
			});
			uEvent.addBrowserHandler(this.Exe.btnSignOut, "click", function(){
				Root.signOut();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntAdd, "click", function(){
				Root.addTEnt();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntAddCancel, "click", function(){
				Root.Dialog.Ent.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntAlter, "click", function(){
				Root.showTEntAlterDialog(Root.Dialog.Ent.TEO);
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntBack, "click", function(){
				Root.Dialog.Ent.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntRemove, "click", function(){
				Root.removeTEnt();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntRemoveCancel, "click", function(){
				Root.Dialog.RemoveEnt.Form.hide();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntUpdate, "click", function(){
				Root.alterTEnt();
			});
			uEvent.addBrowserHandler(this.Exe.btnTEntUpdateCancel, "click", function(){
				if(Root.Dialog.Ent.TEO.Superintendent == "True")
					Root.Dialog.Ent.Form.hide();
				else
					Root.showTEntInfoDialog(Root.Dialog.Ent.TEO);
			});
			
			uEvent.Listener.add(this.Dialog.SignIn.Form, "asking", function(){
				Root.Dialog.SignIn.PWD.value = "";
				Root.Dialog.SignIn.VC.value = "";
				Root.Exe.btnSignIn.disable = false;
				Root.VC.changeImage();
			});
			uEvent.Listener.add(this.Dialog.AlterLikeInfo.Form, "asking", function(){
				Root.Dialog.AlterLikeInfo.Name.value = "";
				Root.Dialog.AlterLikeInfo.Phone.value = "";
			});
			uEvent.Listener.add(this.Dialog.AltPsw.Form, "asking", function(){
				Root.Dialog.AltPsw.Origin.value = "";
				Root.Dialog.AltPsw.New.value = "";
				Root.Dialog.AltPsw.Re.value = "";
			});
			uEvent.Listener.add("TradeMember", "SignInRequest", function(){
				Root.initSignIn(true);
			});
			
			uEvent.Listener.add(this.BO.AddEnt, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.AltEnt, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.AltLinkInfo, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.AltPsw, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.RemoveEnt, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.SignIn, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.SignOut, "Message", function(msg){
				Root.handleMessage(msg);
			});
			uEvent.Listener.add(this.BO.AddEnt, "Exception", function(ex){
				Root.handleException(ex, "AddEnt");
			});
			uEvent.Listener.add(this.BO.AltEnt, "Exception", function(ex){
				Root.handleException(ex, "AltEnt");
			});
			uEvent.Listener.add(this.BO.AltLinkInfo, "Exception", function(ex){
				Root.handleException(ex, "AltLinkInfo");
			});
			uEvent.Listener.add(this.BO.AltPsw, "Exception", function(ex){
				Root.handleException(ex, "AltPsw");
			});
			uEvent.Listener.add(this.BO.GetInfo, "Exception", function(ex){
				Root.handleException(ex, "GetInfo");
			});
			uEvent.Listener.add(this.BO.ListEnt, "Exception", function(ex){
				Root.handleException(ex, "ListEnt");
			});
			uEvent.Listener.add(this.BO.RemoveEnt, "Exception", function(ex){
				Root.handleException(ex, "RemoveEnt");
			});
			uEvent.Listener.add(this.BO.SignIn, "Exception", function(ex){
				Root.handleException(ex, "SignIn");
			});
			uEvent.Listener.add(this.BO.SignOut, "Exception", function(ex){
				Root.handleException(ex, "SignOut");
			});
			uEvent.Listener.add(this.BO.GetInfo, "Executed", function(lst){
				Root.showTMemberInfo(lst[0]);
			});
			uEvent.Listener.add(this.BO.ListEnt, "Executed", function(lst){
				Root.handleTEntList(lst);
				uEvent.Listener.notify(Root, "ListedTradeEnterprise", lst);
			});
			
			uEvent.Listener.add(this.Dialog.RemoveEnt.Form, "hide", function(){
				Root.clearSelection();
			});
			uEvent.Listener.add(this.Dialog.Ent.Form, "hide", function(){
				Root.clearSelection();
			});
			
			this.getTMemberInfo();
		};
	}
	
	this.initialize(this);
}


