function onloadmanager(){salida=true;if(isDefined("login_form"))document.getElementById("login_form").onsubmit=checkform1;if(isDefined("formb")){document.getElementById("formb").onsubmit=function(){return checkform2()};document.getElementById("email1").onchange=function(){return checkMail(1,document.getElementById("email1"),"error_mail1")};document.getElementById("email2").onchange=function(){return checkMail(1,document.getElementById("email2"),"error_mail2")};document.getElementById("email3").onchange=
function(){return checkMail(1,document.getElementById("email3"),"error_mail3")};document.getElementById("email4").onchange=function(){return checkMail(1,document.getElementById("email4"),"error_mail4")};document.getElementById("controla_area").onclick=function(){return managePersonalMessage()}}}
function checkform1(){if(document.getElementById("username").value==""||document.getElementById("password").value==""){layerdisplay("valida_user3","none");layerdisplay("valida_user2","none");layerdisplay("valida_user4","none");layerdisplay("valida_user1","inline");return salida=false}}
function checkform2(){if($("#ctrl").val()==1){layerdisplay("valida_user4","inline");return false}else if(document.getElementById("email1").value==""&&document.getElementById("email2").value==""&&document.getElementById("email3").value==""&&document.getElementById("email4").value==""){layerdisplay("error_mail1","inline");return salida=false}else{checkMail(0,document.getElementById("email1"),"error_mail1");checkMail(0,document.getElementById("email2"),"error_mail2");checkMail(0,document.getElementById("email3"),
"error_mail3");checkMail(0,document.getElementById("email4"),"error_mail4");if(salida)return true;else{salida=true;return false}}}function checkMail(c,a,b){if(!isEmail(a.value)&&a.value!=""){layerdisplay(b,"inline");a.focus();return salida=false}else if(a.value!=""&&c==1){url="/rpc/hasMxRecord.php";pars="i="+a.value+"&div="+b;execAjax(url+"?"+pars,"onbluremail_hasmx")}else layerdisplay(b,"none")}
function onbluremail_hasmx(c){try{var a=c.split("|");if(parseInt(a[1].replace(",",""))==0){layerdisplay(a[2],"inline");return false}else layerdisplay(a[2],"none")}catch(b){}}function managePersonalMessage(){if(document.getElementById("textolibre").style.display=="none")document.getElementById("textolibre").style.display="inline";else{document.getElementById("textolibre").style.display="none";document.getElementById("mensaje").value=""}return false};

