window.addEvent("domready",function(){$$("form.validar").each(function(a){a.addEvent("submit",function(){$$(".error-message, .message").each(function(d){d.destroy()});var b=true;var c=0;a.getElements(".required").each(function(d){if(d.value==""||(d.value=="*novoRegistro*"&&d.match("select"))){b=false;addErro(d);if(c==0){d.focus();c=1}}});if(b==false){showMsgErro(a,true)}return b})});$$(".limited").each(function(a){var b=a.getProperty("limite");a.addEvent("keyup",function(){if(this.value.length>=b){this.value=this.value.substr(0,b)}})})});function validarForm(b){$$(".error-message, .message").each(function(d){d.destroy()});var a=true;var c=0;b.getElements(".required").each(function(d){if(d.value==""||(d.value=="*novoRegistro*"&&d.match("select"))){a=false;addErro(d);if(c==0){d.focus();c=1}}});if(a==false){showMsgErro(b,false)}return a}function validarFormNews(c){$$(".error-message, .message").each(function(e){e.destroy()});var b=true;var d=0;var a=new RegExp(".+?@.+?[.].+?");c.getElements(".required").each(function(e){if(e.value==""){b=false;addErro(e);if(d==0){e.focus();d=1}}else{if(!a.test(e)){b=false;addErro(e,"E-mail invÃ¡lido",2);if(d==0){e.focus();d=1}}}});if(b==false){showMsgErro(c,false)}return b}function addErro(b,c,a){if(a==2){a=b.getPrevious()}else{a=b}if(c==null){c="Preenchimento obrigatÃ³rio"}new Element("div",{"class":"error-message",html:c}).inject(a,"after")}function addErro2(b,c,a){if(a==2){a=b.getPrevious()}else{a=b}if(c==null){c="Preenchimento obrigatÃ³rio"}new Element("div",{"class":"error-message",html:c,styles:{clear:"both","margin-top":"51px",width:"140px"}}).inject(a,"after")}function showMsgErro(a,b){msg="NÃ£o foi possÃvel enviar os dados.";new Element("div",{"class":"message",id:"mensagemErro",html:msg+" Preencha todos os campos obrigatÃ³rios"}).inject(a,"top")}function validarFormUsuario(b){$$(".error-message, .message").each(function(d){d.destroy()});var a=true;var c=0;b.getElements(".required").each(function(d){if(d.value==""||(d.value=="*novoRegistro*"&&d.match("select"))){a=false;addErro2(d);if(c==0){d.focus();c=1}}});if($("UsuarioPassword").value.length<5&&$("UsuarioPassword").value!=""){addErro2($("UsuarioPassword"),"Senha mÃnima de 5 caracteres");if(c==0){elem.focus();c=1}}if($("UsuarioPassword").value!=$("UsuarioPassword2").value&&$("UsuarioPassword").value!=""&&$("UsuarioPassword2").value!=""){a=false;addErro2($("UsuarioPassword2"),"As senhas sÃ£o diferentes");if(c==0){elem.focus();c=1}}if(a==false){showMsgErro(b,false)}return a};