var Login=new function(){
this.ajax=null;
this.form=null;
this.promptDiv=null;
this.dotSpan=null;
this.button=null;
this.enabled=true;
this.dots="";
this.promptInterval=null;
this.cleanup=function(){
var _1=Login;
_1.form=null;
_1.promptDiv=null;
_1.dotSpan=null;
_1.button=null;
};
this.init=function(){
var _2=Login;
_2.ajax=new Ajax();
_2.form=document.getElementById("frmAuth");
_2.promptDiv=document.getElementById("err");
_2.dotSpan=document.getElementById("msg2");
_2.button=document.getElementById("submitButton");
_2.setPrompt("base","");
_2.form.usuario.focus();
_2.toggleEnabled(false);
_2.form.onsubmit=function(){
return false;
};
_2.clearCookie("ses");
};
this.clearCookie=function(_3){
var _4=new Date(0);
document.cookie=_3+"=; expires="+_4.toGMTString()+"; path=/";
};
this.setPrompt=function(_5,_6){
var _7=Login;
var _8=_7.promptDiv;
var _9=document.getElementById("msg1");
var _a="";
_8.className=_5;
if(_9.firstChild){
_9.removeChild(_9.firstChild);
}
_9.appendChild(document.createTextNode(_6));
};
this.keyup=function(e){
var _c=Login;
if(!e){
e=window.event;
}
if(e.keyCode!=13){
_c.evalFormFieldState();
}else{
if(_c.enabled){
_c.submitData();
}
}
};
this.evalFormFieldState=function(){
var _d=Login;
if(_d.form.usuario.value.length>0&&_d.form.pass.value.length>0){
_d.toggleEnabled(true);
}else{
_d.toggleEnabled(false);
}
};
this.toggleEnabled=function(_e){
var _f=Login;
if(_e){
_f.button.onclick=_f.submitData;
_f.button.disabled=false;
_f.button.className="buttonfield";
_f.enabled=true;
}else{
_f.button.onclick=null;
_f.button.disabled=true;
_f.button.className="buttonfieldinactive";
_f.enabled=false;
}
};
this.submitData=function(){
var _10=Login;
var _11="";
_11=formData2QueryString(_10.form);
_10.ajax.doPost("validar.php?action=login",_11,_10.handleLoginResp);
_10.showStatusPrompt();
_10.toggleEnabled(false);
};
this.showStatusPrompt=function(){
var _12=Login;
_12.setPrompt("proc","Procesando");
_12.promptInterval=setInterval(_12.showStatusDots,200);
};
this.showStatusDots=function(){
var _13=Login;
var _14=_13.dotSpan;
_13.dots+=".";
if(_13.dots.length>4){
_13.dots="";
}
if(_14.firstChild){
_14.removeChild(_14.firstChild);
}
_14.appendChild(document.createTextNode(" "+_13.dots));
};
this.handleLoginResp=function(str){
var _16=Login;
var _17=str.split(",");
var _18=_17[0].toLowerCase();
var _19=_17[1];
var _1a=_17[2];
if(_18=="success"){
location=_19+"?"+_1a;
}else{
_16.showErrorPrompt(_19);
}
};
this.showErrorPrompt=function(str){
var _1c=Login;
var _1d=_1c.dotSpan;
clearInterval(_1c.promptInterval);
if(_1d.firstChild){
_1d.removeChild(_1d.firstChild);
}
_1c.setPrompt("err",str);
_1c.form.pass.value="";
};
this.enableScreenReaderFeatures=function(){
var _1e=Login;
var _1f=document.getElementById("fieldDiv");
var _20=null;
var _21=null;
var _22=null;
var _23=null;
var msg="This web page uses dynamic content. Page content"+" may change without a page refresh. Check the following"+" checkbox if you would like an alert dialog to inform"+" you of page content changes.";
_20=document.createElement("div");
_20.className="readerText";
_20.appendChild(document.createTextNode(msg));
_1e.form.insertBefore(_20,_1f);
_21=document.createElement("div");
_21.className="readerText";
_22=document.createElement("label");
_22.appendChild(document.createTextNode("Content Change Alert"));
_23=document.createElement("input");
_23.type="checkbox";
_23.id="ChangeAlert";
_23.name="ChangeAlert";
_23.value="true";
_23.title="Content Change Alert";
_22.appendChild(_23);
_21.appendChild(_22);
_1e.form.insertBefore(_21,_1f);
_1e.form.pass.onchange=_1e.evalFormFieldState;
_1e.form.pass.title="Ingresa la clave para activar el boton de Ingreso.";
};
};
window.onunload=Login.cleanup;
window.onload=Login.init;
document.onkeyup=Login.keyup;


