// Compressed JavaScript by ZyNet (www.zynet.net) and others. Please ask for more information: zynet@zynet.net
//
function LoginHandler(){
var h={redirect:function(_2,_3){
var _4,i;
i=_2.indexOf("?");
if(i>=0){
var t=_2.substr(i+1);
_2=_2.substr(0,i);
_3=_3?t+"&"+_3:t;
}
_4="http://"+window.location.host;
if(_2.substr(0,1)!="/"){
_4+="/";
}
_4+=_2;
if(_3){
_4+="?"+_3;
}
this.dispnode("login_pleasewait","");
window.location.href=_4;
},dispnode:function(id,_8){
var _9;
_9=document.getElementById(id);
if(_9){
_9.style.display=_8;
}
},onload:function(){
this.dispnode("login_jswarning","none");
this.dispnode("login_loginformcontainer","");
this.loginfocus();
return (false);
},loginfocus:function(){
var _a=document.forms["login_loginform"];
if(_a){
_a=_a.elements&&_a.elements["u"];
}
if(_a&&_a.value){
_a=document.forms["login_loginform"].elements["p"];
}
if(_a){
_a.focus();
}
},loginreportclear:function(){
this.dispnode("login_error_badpass","none");
this.dispnode("login_error_failure","none");
this.dispnode("login_error_unvailable","none");
this.dispnode("login_error_cookies","none");
},loginerrorreport:function(_b){
this.loginreportclear();
this.dispnode("login_error_"+_b,"");
this.loginfocus();
},handlelogin:function(_c){
if(_c.status=="ok"){
var u="cp";
if(typeof requestedAction!="undefined"&&requestedAction){
u=requestedAction;
}
this.redirect("/"+u);
}else{
this.loginerrorreport(_c.status);
}
},login:function(_e){
var _f=this;
while(_e.tagName!="FORM"&&_e.parentNode){
_e=_e.parentNode;
}
if(_e.tagName=="FORM"){
var f={};
if(_e.elements["u"]){
f["u"]=_e.elements["u"].value;
}
if(_e.elements["p"]){
f["p"]=_e.elements["p"].value;
}
if(_e.elements["ref"]){
f["ref"]=_e.elements["ref"].value;
}
this.loginreportclear();
this.xhrpost("/login",f,_f.handlelogin);
}
return (false);
},keypress:function(_11,ev){
ev=ev||window.event;
var k=ev.keyCode||ev.which;
if(k==13){
this.login(_11);
}
return (false);
},xhrhandler:function(obj,_15,_16){
if(this.xhttpobj.readyState==4){
this.dispnode("login_pleasewait","none");
if(_15!=null&&this.xhttpobj.status==200){
var res;
try{
eval("res = "+this.xhttpobj.responseText);
}
catch(err){
res={};
}
_15.call(obj,res);
}else{
if(_16!=null){
_16.call(obj);
}
}
}
},xhrpost:function(url,_19,_1a,_1b){
var _1c=this;
var _1d="_app=1&";
for(var i in _19){
_1d+=encodeURIComponent(i)+"="+encodeURIComponent(_19[i])+"&";
}
this.xhttpobj.open("POST",url,true);
this.xhttpobj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
this.xhttpobj.onreadystatechange=function(){
_1c.xhrhandler(_1c,_1a,_1b);
};
this.xhttpobj.send(_1d);
this.dispnode("login_pleasewait","");
},gethint:function(_1f){
while(_1f.tagName!="FORM"&&_1f.parentNode){
_1f=_1f.parentNode;
}
if(_1f.tagName=="FORM"){
var f={};
if(_1f.elements["u"]){
f["u"]=_1f.elements["u"].value;
}
if(_1f.elements["ref"]){
f["ref"]=_1f.elements["ref"].value;
}
if(f["u"]){
this.xhrpost("/sendhint",f);
}
}
this.hideforgotten();
return (false);
},forgottenkeypress:function(_21,ev){
ev=ev||window.event;
var k=ev.keyCode||ev.which;
if(k==13){
this.gethint(_21);
}
if(k==27){
this.hideforgotten();
}
return (false);
},hideforgotten:function(){
this.dispnode("login_forgottencontainer","none");
this.loginfocus();
return (false);
},showforgotten:function(){
this.dispnode("login_forgottencontainer","");
var _24=document.forms["login_forgotten"];
if(_24){
_24=_24.elements&&_24.elements["u"];
}
if(_24){
_24.value="";
_24.focus();
}
return (false);
}};
var r;
try{
r=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
r=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
r=new XMLHttpRequest();
}
catch(e){
r=false;
}
}
}
h.xhttpobj=r;
return (h);
}

