function Navegador(){var e,t,a;return this.isIE=!1,this.isNS=!1,this.version=null,e=navigator.userAgent,t="MSIE",(a=e.indexOf(t))>=0?(this.isIE=!0,void(this.version=parseFloat(e.substr(a+t.length)))):(t="Netscape6/",(a=e.indexOf(t))>=0?(this.isNS=!0,void(this.version=parseFloat(e.substr(a+t.length)))):(t="Gecko",(a=e.indexOf(t))>=0?(this.isNS=!0,void(this.version=6.1)):void 0))}function _initSize(){var e=document.getElementById("_divSize");e&&"100%"==e.style.width&&(e.style.height=getInnerHeight()-10);for(var t=document.getElementsByTagName("textarea"),a=0;as)return!0;var c=d.length;if(c>=a.length)return!1;for(var u=a.substr(c,1);-1!=l.indexOf(u);){if(d+=u,c=d.length,c>=a.length)return!1;u=a.substr(c,1)}switch(u){case"#":if(-1==i.indexOf(tecla))return!1;break;case"A":if(-1==r.indexOf(tecla))return!1;break;case"a":if(-1==n.indexOf(tecla))return!1;break;case"Z":if(-1==o.indexOf(tecla))return!1;break;case"*":return e.value=d,!0;default:return!1}}return e.value=d,!0}function mascara_data(e,t,a){return mascara(a,e,"##/##/#### ##:##:##.###")}function mascara_decimal(e){return mascara_inteiro(e,".")}function mascara_inteiro(e,t){var a=null;a=document.all?event.keyCode:e.charCode;var r=String.fromCharCode(a);return 20>a||a>47&&58>a||t.indexOf(r)>-1?!0:!1}function mascaraDinamica(e,t,a){return mascara(e,t,a)}function setMascara(e,t){return obj=document.getElementById(e),obj?(obj.onkeypress=function(e){return mascaraDinamica(obj,e,t)},void(obj.onblur=function(){validar_mascara(obj,t)})):!1}function validar_mascara(e,t){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZÇÃÕÂÊÔÁÉÍÓÚÀÜ",r="abcdefghijklmnopqrstuvwxyzçãõâêôáéíóàü",n="ABCDEFGHIJKLMNOPQRSTUVWXYZÇÃÕÂÊÔÁÉÍÓÚÀÜabcdefghijklmnopqrstuvwxyzçãõâêôáéíóàüçãõâêôáéíóàü",o="0123456789",i="().-:/ ",l=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZÇÃÕÂÊÔÁÉÍÓÚÀÜÇÃÕÂÊÔÁÉÍÓÚÀÜ[]^_/`abcdefghijklmnopqrstuvwxyzçãõâêôáéíóàü{|}~",d=!0,s=e.value,c=s.length;if(0!=c&&c!=t.length)d=!1;else for(var u=0;c>u;u++){var m=t.charAt(u),f=s.charAt(u);switch(m){case"#":-1==o.indexOf(f)&&(d=!1);break;case"A":-1==a.indexOf(f)&&(d=!1);break;case"a":-1==r.indexOf(f)&&(d=!1);break;case"Z":-1==n.indexOf(f)&&(d=!1);break;case"*":-1==l.indexOf(f)&&(d=!1);break;default:-1==i.indexOf(f)&&(d=!1)}}d?_contadorErro=0:(_contadorErro++,_contadorErro>3&&(e.value=""),alert("Valor do campo inválido! Formato: "+t),e.select())}function validar_data(e){var t="",a=/^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/,r=/^(([0-1]\d|2[0-3])(:[0-5]\d:[0-5]\d.\d{3}|:[0-5]\d:[0-5]\d|:[0-5]\d)?)?$/,n=e.value;if(""!=n)try{var o=n.substring(0,10),i=n.substring(11);a.test(o)?r.test(i)||(t="Horario inválido! formato HH:mm:ss.SSS (24H)"):t="Data inválida! formato dd/MM/yyyy"}catch(l){t="Data inválida! formato dd/MM/yyyy"}""!=t?(_contadorErro++,_contadorErro>3&&(e.value=""),alert(t),e.select()):_contadorErro=0}function validar_decimal(e){var t=/^[+-]?((\d+|\d{1,3}(\,\d{3})+)(\.\d*)?|\.\d+)$/;""!=e.value&&(t.test(e.value)?-1==e.value.indexOf(".")?(e.value+=".00",_contadorErro=0):_contadorErro=0:(_contadorErro++,_contadorErro>3&&(e.value=""),alert("Valor numérico inválido! formato 9999.99"),e.select()))}function validar_inteiro(e){var t=/^\d+$/;""==e.value||t.test(e.value)?_contadorErro++:(_contadorErro++,_contadorErro>3&&(e.value=""),alert("Valor inteiro inválido! formato 999999"),e.select())}function isNumber(e){var t=!1;for(i=0;i\n
\n"+r.getAttribute("alt")+"\n
\n",o=document.getElementById("_alt");o.innerHTML=n,t+=20,t+o.offsetHeight>getMaxTop()&&(t=t-22-o.offsetHeight),a+o.offsetWidth>getMaxLeft()&&(a-=a+o.offsetWidth-getMaxLeft()),o.style.left=a,o.style.top=t,o.style.visibility="visible"}}function hideAlt(){tempo&&clearTimeout(tempo),document.getElementById("_alt").style.visibility="hidden",document.getElementById("_alt").innerHTML=""}function showLoad(e){if(null!=e){var t=_aCountLoad[e];(!t||isNaN(t))&&(t=0),_aCountLoad[e]=++t;var a="";if(t>1&&(a="X"+t+""),"geral"==e){var r=document.getElementById("_load");if(r){document.getElementById("_tdLoadLabel").innerHTML=a,r.style.top="50%",r.style.left="50%";var n=r.offsetLeft-r.offsetWidth/2,o=r.offsetTop-r.offsetHeight/2;r.style.top=o,r.style.left=n,r.style.visibility="visible"}}else{var r=document.getElementById("_"+e+"Loader");r&&r.parentNode.removeChild(r),a=""==a?"...":" "+a;var i=document.createElement("span");i.id="_"+e+"Loader",i.innerHTML="Carregando"+a,i.className="subLoader",i.style.cssText="position:absolute; top:0px; left:0px;",document.getElementById(e).appendChild(i)}}}function hideLoad(e){if(null!=e){var t=_aCountLoad[e];if(_aCountLoad[e]=--t,"geral"==e){if(_aCountLoad[e]=--t,showLoad(e),0==_aCountLoad[e]){var a=document.getElementById("_load");a&&(a.style.visibility="hidden")}}else if(_aCountLoad[e]=--t,showLoad(e),0==_aCountLoad[e]){var a=document.getElementById("_"+e+"Loader");a.parentNode.removeChild(a)}}}function showCombos(){for(var e=0;el&&(i=Math.max(0,Math.min(i,l))),o>d&&(o=Math.max(0,o-e.offsetHeight-n)),a._currentSearch="_iSearch"+a._qtdFrames++;var s=a.document.createElement("iframe");s.setAttribute("id",a._currentSearch),s.setAttribute("name",a._currentSearch),s.frameBorder="0",s.style.cssText="background-color:#ffffff; width:"+(r-3)+"px; height:"+(n-3)+"px; position:relative; bottom:3px; right:3px;";var c=getShadow(s);c.style.top=o+"px",c.style.left=i+"px",c.style.zIndex=90*a._qtdFrames,a.getBody().appendChild(c);{a.document.getElementById("form")}jSubmit=a.frames[a._currentSearch],jSubmit.document.write("
"),jSubmit.document.write("");for(var u=getObjetos(null),m=0;m"+f[1]+"")}jSubmit.document.write(""),_navegador.isNS&&jSubmit.document.close();var g=jSubmit.document.getElementById("form");g.submit()}}function closeSearch(){var e=getPrincipal(),t=e.document.getElementById(e._currentSearch).parentNode;t.parentNode.removeChild(t)}function formToURL(){for(var e="",t=document.getElementsByTagName("input"),a=0;a0){var a=e._aFrame[e._aFrame.length-1][0];t=e.frames[a].frames.inferior}return t}function getOpener(){var e=getPrincipal(),t=e;return e._aFrame.length>0&&(t=e._aFrame[e._aFrame.length-1][1]),t}function setFocusTo(e){e=e.toLowerCase();var t=document.getElementsByName(e);t[0]&&t[0].select()}function DecHex(e){var t="0123456789ABCDEF",a=t.charAt(Math.floor(e/16)),r=t.charAt(e%16);return a+r}function toURL(e){return encodeURIComponent(e)}function validaForm(){for(var e=0;e<_aNotNull.length;e++)isEmpty(document.getElementsByName(_aNotNull[e][0])[0].value)&&erro.put(_aNotNull[e][0],_aNotNull[e][1])}function trim(e){return e.replace(/^\s*|\s*$/g,"")}function replaceAll(e,t,a){for(;e.indexOf(t)>-1;)e=e.replace(t,a);return e}function getAction(){return"/smarrh/servlet/controle"}function getValue(e){var t=null,a=document.getElementById(e);if(a)if("radio"==a.getAttribute("tipo"))for(var r=document.getElementsByName(e),n=0;n0&&(e+="
"),e+=""+this.aErro[t][1]+"\n";document.getElementById("_errText").innerHTML=e,document.getElementById("_errMess").style.display="",this.aErro=new Array}};var erro=new Erro;