function LoginFrm(){
	this.formDiv=null;	 		//
	this.cover=null;
	this.result=new Array();
	this.theForm=null;
	//初始化共享变量
	if(typeof LoginFrm._initShareVar == "undefined"){
		LoginFrm.prototype.instanceCount=0; //初始化实例数
		LoginFrm.prototype.instanceArray=new Array(); //保存实例数组
		LoginFrm._initShareVar=true;
	}
	LoginFrm.prototype.instanceCount++;
	this.hwnd=LoginFrm.prototype.instanceCount; //窗口句柄用于窗口代码回调使用
	LoginFrm.prototype.instanceArray[this.hwnd]=this; //保存实例引用
	//变量初始化完毕
	
	//初始化共享方法用于减少内存使用
	if(typeof LoginFrm._initialized == "undefined"){
		LoginFrm.prototype.show=function(){ //显示窗口
		if(this.formDiv==null){
				this.cover=new Cover();
				this.formDiv=document.createElement("div");
				this.formDiv.style.left=((top.document.body.scrollWidth)-400)/2; //window.event.clientX;
				this.formDiv.style.top=((top.document.body.scrollTop+500)-260)/2;  //window.event.clientX;
				this.formDiv.style.width=400;
				this.formDiv.style.height=260;
				this.formDiv.style.position="absolute";
				this.formDiv.style.border="3px solid #A6C9E1";
				this.formDiv.style.background="#ffffff";
				this.formDiv.style.zIndex="9999";
				document.body.appendChild(this.formDiv);
			}else{
				this.formDiv.style.display="";
			}
			this.cover.show();
			
			var formHtml;
			formHtml="<div>";
			formHtml+="<div class='titlebar'><div class='TitleLeft'>用户登录</div>";
			formHtml+="<div class='TitleRight'><img src='/images/shutdown2.jpg' style='cursor:hand;' onclick=\"LoginFrm.CallFunc("+this.hwnd+",'hide')\"></div>";
			formHtml+="<div class='clear'></div></div>";
			formHtml+="<div>";
			formHtml+="<form onsubmit=\"LoginFrm.CallFunc("+this.hwnd+",'login',this);return false;\">";
			formHtml+="<div style='margin-top:40px;margin-left:30px;'>";
			formHtml+="户户通帐号：<input name='hht_login_name' type='text' maxlength='20' style='border:1px solid #A6c9E1;height:25px;width:180px;font-size:15px'>&nbsp;<a href='/member/register.jsp'>立即注册！</a>";
			formHtml+="</div>";
			formHtml+="<div style='margin-top:10px;margin-left:30px;'>";
			formHtml+="<span style='margin-bottom:20px;'>户户通密码：</span><input type='password' name='hht_login_password' maxlength='20' style='border:1px solid #A6c9E1;height:25px;width:180px;font-size:15px'>&nbsp;<a href='/member/ForgetPassword.jsp'>忘记密码？</a>";
			formHtml+="</div>";
			formHtml+="<div style='margin-top:10px;margin-left:30px;height:30px;border:0px solid yellow;'>";
			formHtml+="登录验证码：<input type='text' name='hht_login_vcode' maxlength='4' style='border:1px solid #A6c9E1;height:25px;width:90px;font-size:15px;'>";
			formHtml+="<img name='hht_login_img' src=\"/images/Img.jsp?funcName=loginVCode\" ondblclick=\"this.src='/images/Img.jsp?funcName=loginVCode&rndcode='+Math.floor(Math.random()*10+1);\" style=\"cursor:hand;height:20px;margin-left:25px;margin-top:0px;border:1px solid black;\" alt=\"看不清，请双击换图!\"></img>&nbsp双击换图";
			formHtml+="</div>";
			formHtml+="<div style='margin-top:20px;text-align:center'>";
			formHtml+="<input type='submit' value='   登录   ' style='width:100px;height:30px;font-size:15px;'>";
			formHtml+="</div>";
			formHtml+="</form>";
			formHtml+="</div>";
			formHtml+="</div>";
			this.formDiv.innerHTML=formHtml;
		}
		
		LoginFrm.prototype.hide=function(){ //隐藏窗口
			this.cover.hide();
			this.formDiv.style.display="none";
		}
		
		LoginFrm.prototype.login=function(theForm){ //隐藏窗口
			this.theForm=theForm;
			if(!isAlphaOrNum(theForm.hht_login_name.value||theForm.hht_login_name=="")){
				alert("请正确添写户户帐号，只能是字母或数据!");
				theForm.hht_login_name.focus();
				return false;
			}
			if(!isAlphaOrNum(theForm.hht_login_password.value||theForm.hht_login_password=="")){
				alert("请正确添写户户密码!");
				theForm.hht_login_password.focus();
				return false;
			}
			if(theForm.hht_login_vcode.value==""){
				alert("请正确添写验证码!");
				theForm.hht_login_vcode.focus();
				return false;
			}
			
			var encodepwd=MD5(theForm.hht_login_vcode.value+theForm.hht_login_password.value);
			
			var url1="/login/WebLoginXML.jsp?hht_alias_name="
							 +theForm.hht_login_name.value+"&hht_password="
							 +encodepwd+"&vcode="+theForm.hht_login_vcode.value;
			var temp=this;
			xmlQuery(url1,function(){temp.callback();},this.result);
			return false;
		}
		
		LoginFrm.prototype.callback=function(){ //隐藏窗口
			if(this.result[0][0]=="true"){
				document.location.reload();
			}else{
				alert(this.result[0][1]);	
				if(this.theForm!=null){
					this.theForm.hht_login_img.src="/images/Img.jsp?funcName=loginVCode&rndcode="+Math.floor(Math.random()*100+1);;
				}
			}
		}
		
		//静态方法调用函数
		LoginFrm.CallFunc=function(pHwnd,pFuncName,pPara){
			if(pFuncName=="show"){
				LoginFrm.prototype.instanceArray[pHwnd].show();
			}else if(pFuncName=="hide"){
				LoginFrm.prototype.instanceArray[pHwnd].hide();
			}else if(pFuncName=="login"){
				LoginFrm.prototype.instanceArray[pHwnd].login(pPara);
			}
		};
		LoginFrm._initialized = true; 
	}	
}
