function handleEnterEvent(e,script){var key;if(window.event){key=window.event.keyCode}else{key=e.which}if(key==13){eval(script)}}function url_encode(G){var A="0123456789ABCDEF";var D=/^([a-zA-Z0-9\_\-\.])$/;var H,F,C,B,E="";for(H=0;H<G.length;H++){if(D.test(G.charAt(H))){E+=G.charAt(H)}else{F=G.charCodeAt(H);C=A.charAt(Math.floor(F/16));B=A.charAt(F%16);E+="%"+(C+B)}}return E}function url_decode(C){var D,B,A="";for(D=0;D<C.length;D++){if(C.charAt(D)=="%"){B=C.charAt(D+1)+C.charAt(D+2);A+=String.fromCharCode(parseInt(B,16));D+=2}else{A+=C.charAt(D)}}return A}function f_scrollTop(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0)}function f_filterResults(D,B,A){var C=D?D:0;if(B&&(!C||(C>B))){C=B}return A&&(!C||(C>A))?A:C}function colorFade(B,H,C,F,M,E){var I,A,O,G,K,D,N,L,P,D;var J=document.getElementById(B);M=M||20;E=E||100;clearInterval(J.timer);A=colorConv(F);O=A[0];G=A[1];K=A[2];I=colorConv(C);r=I[0];g=I[1];b=I[2];J.r=r;J.g=g;J.b=b;N=Math.round(Math.abs(J.r-O)/M);L=Math.round(Math.abs(J.g-G)/M);P=Math.round(Math.abs(J.b-K)/M);if(N==0){N=1}if(L==0){L=1}if(P==0){P=1}J.step=1;J.timer=setInterval(function(){animateColor(B,H,M,O,G,K,N,L,P)},E)}function animateColor(B,E,K,M,D,H,L,I,N){var G=document.getElementById(B);var C;if(G.step<=K){var A=G.r;var F=G.g;var J=G.b;if(A>=M){A=A-L}else{A=parseInt(A)+parseInt(L)}if(F>=D){F=F-I}else{F=parseInt(F)+parseInt(I)}if(J>=H){J=J-N}else{J=parseInt(J)+parseInt(N)}C="rgb("+A+","+F+","+J+")";if(E=="background"){G.style.backgroundColor=C}else{if(E=="border"){G.style.borderColor=C}else{G.style.color=C}}G.r=A;G.g=F;G.b=J;G.step=G.step+1}else{clearInterval(G.timer);C="rgb("+M+","+D+","+H+")";if(E=="background"){G.style.backgroundColor=C}else{if(E=="border"){G.style.borderColor=C}else{G.style.color=C}}}}function colorConv(A){var B=[parseInt(A.substring(0,2),16),parseInt(A.substring(2,4),16),parseInt(A.substring(4,6),16)];return B}function RetiraAcentos(G){var C="áàãââÁÀÃÂéêÉÊíÍóõôÓÔÕúüÚÜçÇabcdefghijklmnopqrstuvxwyz";var F="AAAAAAAAAEEEEIIOOOOOOUUUUCCABCDEFGHIJKLMNOPQRSTUVXWYZ";var D,A;var E="";for(var B=0;B<G.length;B++){A=G.charAt(B);D=C.indexOf(A);if(D>-1){E+=F.charAt(D)}else{E+=G.charAt(B)}}G=E;return G}function trim(B){var A=0;var C=B.length-1;while(A<B.length&&B[A]==" "){A++}while(C>A&&B[C]==" "){C-=1}return B.substring(A,C+1)}function alphanumeric(D){var C=D;for(var A=0;A<C.length;A++){var E=C.charAt(A);var B=E.charCodeAt(0);if((B>47&&B<58)||(B>64&&B<91)||(B>96&&B<123)){}else{return false}}return true}function findPos(A){var B=curtop=0;if(A.offsetParent){do{B+=A.offsetLeft;curtop+=A.offsetTop}while(A=A.offsetParent)}return[B,curtop]}function wordbreak(D,B){var C=D.split(" ");var A="<wbr>";for(i=0;i<C.length;i++){C[i]=chunk_split(C[i],B,A)}return implode(" ",C)}function chunk_split(B,E,D){var A="",C=D||"\r\n";if(E<1){return false}while(B.length>E){A+=B.substring(0,E)+C;B=B.substring(E)}return A+B+C}function implode(B,A){return((A instanceof Array)?A.join(B):A)}function initFileUpload(G,F){var A=(document.createElement&&document.getElementsByTagName);if(!A){return }var B=document.getElementById(G);var C=document.createElement("div");C.className="fakefile";fakeInput=document.createElement("input");fakeInput.className="fakeInput";fakeInput.id="fakeInput";C.appendChild(fakeInput);var D=document.createElement("img");D.src="/img/chooseFile.png";D.className="fakeInputBtn";C.appendChild(D);B.className="file hidden";var E=C.cloneNode(true);B.parentNode.appendChild(E);B.relatedElement=E.getElementsByTagName("input")[0];B.onchange=function(){this.relatedElement.value=this.value;if(F){F()}}}function displayLoading(A){var B=document.getElementById("loadingImg");if(A){B.style.display="block"}else{B.style.display="none"}}var callFunction=null;function checkLogin(B){this.callFunction=B;var A="/users/isLogged/"+Math.ceil(Math.random()*100000);CDownloadUrl("get",A,processCheckLogin);displayLoading(true)}function processCheckLogin(data){displayLoading(false);if(data.indexOf("@@LoggedIn@@")>-1&&this.callFunction!=null){displayLoading(true);eval(this.callFunction)}else{if(data.indexOf("@@NOTLoggedIn@@")>-1){window.location.reload()}}}function StdPopup(){this.popupId=null;this.instructId=null;this.txtCaptchaId=null;this.captchaId=null;this.msg=null;this.txtEmailId=null;this.errorCdId=null;this.txtReportErrorDescId=null;this.btnId=null;this.feedbackId="loadingFeedBack";this.ie6Hack="ie6LayerHack";this.setVisible=function(A){for(i=0;i<StdPopup.popups.length;i++){document.getElementById(StdPopup.popups[i].popupId).style.display="none";document.getElementById(StdPopup.popups[i].captchaId).src="/img/loading.gif"}var B=document.getElementById(this.popupId);if(A){this.resetPopup();B.style.display="block"}};this.ie6LayerHack=function(){var A=document.getElementById("ie6LayerHack");var B=document.getElementById(this.popupId);B.style.visibility="visible";A.style.width=B.offsetWidth+"px";A.style.height=B.offsetHeight+"px";A.style.top=(B.offsetTop+35)+"px";A.style.height=(B.offsetHeight-35)+"px"};this.fadeInstructBackground=function(){colorFade(this.instructId,"background","FF9900","FFFFCC")};this.setCaptchaFocus=function(A){var B=document.getElementById(this.txtCaptchaId);if(A){B.value=""}B.focus()};this.setFocus=function(B,A){var C=null;switch(B){case"captcha":C=document.getElementById(this.txtCaptchaId);break;case"email":C=document.getElementById(this.txtEmailId);break;case"errorCd":C=document.getElementById(this.errorCdId);break}if(A){C.value=""}C.focus()};this.showInstruct=function(B){var A=document.getElementById(this.instructId);if(B!=null){A.innerHTML=B}else{A.innerHTML=this.msg}this.fadeInstructBackground()};this.changeCaptchaImg=function(B){var A=document.getElementById(this.captchaId);A.value="";if(B){changeImg(this.captchaId,1);A.style.visibility="visible"}else{A.src="/img/loading.gif";A.style.visibility="hidden"}};this.displayFeedback=function(A,E,D){var C=document.getElementById(this.feedbackId);var B=document.getElementById(this.popupId);if(A){C.style.display="block";if(E){C.style.top=E;if(D){C.style.left=D}}else{pos=findPos(B);C.style.top=(pos[1]+B.offsetHeight/2-11)+"px";C.style.left=(pos[0]+B.offsetWidth/2-63)+"px"}}else{C.style.display="none"}};this.validateCaptcha=function(){var A=document.getElementById(this.txtCaptchaId).value;if(A==null||A==""){this.showInstruct("Digite o conteúdo da imagem abaixo.");return false}return true};this.validateEmail=function(C){var B=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var A=document.getElementById(this.txtEmailId).value;if(C&&A==""){this.showInstruct("Forneça um e-mail válido.");return false}if(A!=""){if(B.test(A)==false){this.showInstruct("Forneça um e-mail válido.");return false}}return true};this.validateSelectedError=function(){var A=document.getElementById(this.errorCdId);if(A.selectedIndex==0){this.showInstruct("Selecione um tipo de erro.");return false}return true};this.getCaptchaTxtValue=function(){return document.getElementById(this.txtCaptchaId).value};this.getEmailTxtValue=function(){return document.getElementById(this.txtEmailId).value};this.getErrorCdValue=function(){return document.getElementById(this.errorCdId).value};this.getReportErrorDesc=function(){return document.getElementById(this.txtReportErrorDescId).value};this.disableBtn=function(A){document.getElementById(this.btnId).disabled=A};this.setPopupTop=function(A){if(this.popupId){if(A){document.getElementById(this.popupId).style.top=A+"px"}else{document.getElementById(this.popupId).style.top=(yMousePos-300)+"px"}}};this.resetPopup=function(){if(this.errorCdId){document.getElementById(this.errorCdId).selectedIndex=0}if(this.txtReportErrorDescId){document.getElementById(this.txtReportErrorDescId).value=""}if(this.btnSendReportId){document.getElementById(this.btnId).disabled=false}if(this.txtEmailId){document.getElementById(this.txtEmailId).value=""}if(this.txtCaptchaId){document.getElementById(this.txtCaptchaId).value=""}if(this.btnSendReportId){this.disableBtn(false)}if(this.captchaId){this.changeCaptchaImg(1)}if(this.instructId&&this.msg){this.showInstruct(this.msg)}}};
