var Login=Class.create(AppFramework.prototype,{appid:"Login",wait:null,initialize:function(){AppFramework.beforeHideLightBox=function(){if($("bAdTopRight")!=null){$("bAdTopRight").show()}}},loginStart:function(a){$("busyIndicator").show();if($("bLogin")!=null){this.wait=new Wait("bLogin")}else{if($("loginLightbox")){this.wait=new Wait("loginLightbox")}}if(this.wait){this.wait.show()}a.submit();setTimeout(function(){try{Form.disable(a)}catch(b){}},10);return true},loginFinished:function(c,b){if(typeof b=="undefined"){b=false}var a=this.getIFramePage(c);if(a){if(a.loginOk!=true){this.wait.hide();$(b?"loginErrorLightbox":"loginError").show();$(b?"passwordIdLightbox":"passwordId").value="";$(b?"loginIdLightbox":"loginId").addClassName("error");$(b?"passwordIdLightbox":"passwordId").addClassName("error");if(a.countIncorrect>=3){this.handleCountIncorrect(b?"countErrorLightbox":"countError")}Form.enable(b?"loginFormLightbox":"loginForm")}else{$(b?"loginErrorLightbox":"loginError").hide();$(b?"countErrorLightbox":"countError").hide();if(b&&!a.requestProfileUpdate){window.location.reload(true)}else{window.location.replace(a.redirect)}}}$("busyIndicator").hide()},doLogout:function(){this.sendRequest("doLogout",{},function(a){window.location=window.location}.bind(this))},handleCountIncorrect:function(a){return true},showLoginLightbox:function(){this.showLightBox("loginLightbox","viewLoginLightbox",{},{width:300,height:210},function(){if($("bAdTopRight")!=null){$("bAdTopRight").hide()}$("loginIdLightbox").focus()});return false},hideLoginLightbox:function(){AppFramework.hideLightBox("loginLightbox")}});Event.onDOMReady(function(){login=new Login()});Object.extend(Login.prototype,{captchaDiv:"captchaBox",redirectTimerDiv:"redirectTimer",updateCaptcha:function(){var a=new Wait(this.captchaDiv);a.show();$$('input[name="captchaValue"]')[0].value="";this.sendRequest("showRegisterCaptchaPage",{},function(b){if(typeof b.error=="undefined"){$(this.captchaDiv).update(b.html)}else{this.showLightBoxStatic("surveyAlert",'<div class="alert">'+b.errorMsg+"</div>"+this.getWinCloseButton("surveyAlert"),{width:340,height:110})}a.destroy()}.bind(this));return false},afterRegisterRedirect:function(b,a){if(a<=0){window.location=b;return}$(this.redirectTimerDiv).innerHTML=--a;setTimeout("login.afterRegisterRedirect('"+b+"','"+a+"');",1000)}});