function trim(str, chars){return ltrim(rtrim(str, chars), chars);} function ltrim(str, chars){chars = chars || "\\s";return str.replace(new RegExp("^["+chars+ "]+","g"),"");} function rtrim(str, chars){chars = chars || "\\s";return str.replace(new RegExp("["+chars+ "]+$","g"),"");} function setHTML(id,html){document.getElementById(id).innerHTML=html;} function setDisplay(id,type){if(type==""){var box=document.getElementById(id);if(box.style.display=="none"){box.style.display="block";}else{box.style.display="none";}}else{document.getElementById(id).style.display=type;}} function setVisible(id){var box=document.getElementById(id);if(box.style.visibility=="hidden"){box.style.visibility="visible";}else{box.style.visibility="hidden";}} function changeBGColor(id,cor){if(document.getElementById(id).style.backgroundColor!=cor){document.getElementById(id).style.backgroundColor=cor;}} function changeClass(id,classe){if(document.getElementById(id).className!=classe){document.getElementById(id).className=classe;}} function flashbang(id){$(document).ready(function(){$(id).fadeTo("slow",0.4);$(id).fadeTo("slow",1);});} function abrirPopup(URL,w,h){window.open(URL,'Endereço','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width='+w+',height='+h);} function letraMaiuscula(id){document.getElementById(id).value=document.getElementById(id).value.toUpperCase();} function letraMinuscula(id){document.getElementById(id).value=document.getElementById(id).value.toLowerCase();} function imprimir(){window.print();} function textCounter(id,contcampo,maxlimite){if(document.getElementById(id).value.length>maxlimite){document.getElementById(id).value=document.getElementById(id).value.substring(0,maxlimite);}else{document.getElementById(contcampo).value=maxlimite-document.getElementById(id).value.length;}} function permiteNumeros(e){var tecla=(window.event)?event.keyCode:e.which;var keychar=String.fromCharCode(tecla);if(tecla!=8){var numcheck=/\d/;return numcheck.test(keychar);}else{return true;}} function permiteNulo(valor){if((valor=="")||(valor==null)){return true;}else{return false;}} function botaoDireito(){document.oncontextmenu=new Function("return false;");oncontextmenu='return false';} function desbloquearBotaoDireito(){document.oncontextmenu=new Function("return true;");oncontextmenu='return true';} function bloquearCopiar(e){var tecla=(window.event)?e.keyCode:e.which;if((e.ctrlKey==1)||(e.ctrlKey==1)&&(tecla==67)){e.returnValue=false;return false;}else{return true;}} function bloquearColar(e){var tecla=(window.event)?e.keyCode:e.which;if((e.ctrlKey==1)||(e.ctrlKey==1)&&(tecla==86)){e.returnValue=false;return false;}else{return true;}} function addToFavorites(url){var title="Paramédica - A Maior Cooperativa de Trabalho na Área da Saúde";if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(window.opera&&window.print){var mbm=document.createElement('a');mbm.setAttribute('rel','sidebar');mbm.setAttribute('href',url);mbm.setAttribute('title',title);mbm.click();}else if(document.all){window.external.AddFavorite(url,title);}} function getRadioValue(nameRadio){var resposta=null;radio=document.getElementsByTagName("input");for(i=0;i="){if(d1>=d2){return true;}else{return false;}}else if(type=="<="){if(d1<=d2){return true;}else{return false;}}else if(type=="<"){if(d1>d2){return true;}else{return false;}}else if(type==">"){if(d1="){if((d1>=d2)&&(d1>=today)){return true;}else{return false;}}else if(type=="<="){if((d1<=d2)&&(d1<=today)){return true;}else{return false;}}else if(type=="=="){if((d1==today)){return true;}else{return false;}}}} function fieldsToCompare(campos,type,id){var check=campos.split(";");if(check.length>1){valor=trim(document.getElementById(check[0]).value);document.getElementById(check[0]).value=valor;for(j=1;j"){if(valor==next_valor){setDisplay(id,"block");}else{setDisplay(id,"none");}}}}} function minFieldLen(campos,len,id){var check=campos.split(";");for(j=0;j=document.getElementById(compare[l]).value){if(id!=""&&id!=null){setDisplay(id,"none");} return true;}else{if((id=="")||(id==null)){if((msg!="")&&(msg!=null)){alert(msg);}}else{setDisplay(id,"block");} return false;}}} function menorIgual(field,valor){compare=document.getElementById(field).getAttribute("menorIgual").split(";");msg=document.getElementById(field).getAttribute("MSG_menorIgual");id=document.getElementById(field).getAttribute("menorIgualDisplay");for(l=0;l=")){if((id=="")||(id==null)){if((msg!="")&&(msg!=null)){alert(msg);}}else{setDisplay(id,"block");} return false;}else{if(id!=""&&id!=null){setDisplay(id,"none");} return true;}}} function dataMenorIgualHoje(field,valor){compare=document.getElementById(field).getAttribute("dataMenorIgualHoje").split(";");msg=document.getElementById(field).getAttribute("MSG_dataMenorIgualHoje");id=document.getElementById(field).getAttribute("dataMenorIgualHojeDisplay");for(l=0;l=")){if((id=="")||(id==null)){if((msg!="")&&(msg!=null)){alert(msg);}}else{setDisplay(id,"block");} return false;}else{if(id!=""&&id!=null){setDisplay(id,"none");} return true;}}} function dataMenorIgual(field,valor){compare=document.getElementById(field).getAttribute("dataMenorIgual").split(";");msg=document.getElementById(field).getAttribute("MSG_dataMenorIgual");id=document.getElementById(field).getAttribute("dataMenorIgualDisplay");for(l=0;l")){if((id=="")||(id==null)){if((msg!="")&&(msg!=null)){alert(msg);}}else{setDisplay(id,"block");} return false;}else{if(id!=""&&id!=null){setDisplay(id,"none");} return true;}}} function dataMenor(field,valor){compare=document.getElementById(field).getAttribute("dataMenor").split(";");msg=document.getElementById(field).getAttribute("MSG_dataMenor");id=document.getElementById(field).getAttribute("dataMenorDisplay");for(l=0;l1){var orCondicional=false;var msg="";var orDisplay="";for(j=0;j1){andCondicional=true;for(k=0;k0){alert(erro);return false;} return true;} function validaCpf(campo){var i;s=campo;s=s.replace(".","");s=s.replace(".","");s=s.replace("-","");var c=s.substr(0,9);var dv=s.substr(9,2);var d1=0;for(i=0;i<9;i++){d1+=c.charAt(i)*(10-i);} if((s==11111111111)||(s==22222222222)||(s==33333333333)||(s==44444444444)||(s==55555555555)||(s==66666666666)||(s==77777777777)||(s==88888888888)||(s==99999999999)||(s==00000000000)){alert("CPF inválido!");return false;} if(d1==0){alert("CPF Invalido!");return false;} d1=11-(d1%11);if(d1>9)d1=0;if(dv.charAt(0)!=d1){alert("CPF Invalido!");return false;} d1*=2;for(i=0;i<9;i++){d1+=c.charAt(i)*(11-i);} d1=11-(d1%11);if(d1>9)d1=0;if(dv.charAt(1)!=d1){alert("CPF Invalido!");return false;} return true;} var reDate5=/^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/([1][9][0-9][0-9]|[2][0][0-9][0-9])$/;var data=2;function validaData(valor){eval("reDate = reDate"+5);if(reDate.test(valor)){return true;}else if(valor!=null&&valor!=""){alert(valor+" NÃO é uma data válida!\n\nA data deve ter 10 digitos ex: XX/XX/XXXX\n\nA data não pode ser menor que 01/01/1900.");return false;}} function validaHora(valor){var mask=/^([0-1][0-9]|[2][0-3]):[0-5][0-9]$/;if(mask.test(valor)){return true;}else{if(valor!=""&&valor!=null){alert(valor+" não é um horário válido!");} return false;}} var reEmail1=/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;var reEmail2=/^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;var reEmail3=/^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;var reEmail=reEmail3;function validaEmail(valor){if(reEmail.test(valor)){return true;}else if(valor!=null&&valor!=""){alert(valor+" não é um endereço de e-mail válido.");return false;}} function validaMaskTelefone(valor){var mask=/^\(\d{2}\)\d{4}-\d{4}$/;if(mask.test(valor)){return true;}else{alert(valor+" não é um telefone válido.\n\nExemplo de preenchimento: xxxx-xxxx");return false;}} function validaMaskTelefoneSimples(valor){var mask=/^\d{4}-\d{4}$/;if(mask.test(valor)){return true;}else{alert(valor+" não é um telefone válido.\n\nExemplo de preenchimento: xxxx-xxxx");return false;}} function validaMoney(valor){var mask=/^\d{1,3}(\.\d{3})*\,\d{2}$/;if(mask.test(valor)){return true;}else{alert(valor+" não é um valor monetário válido");return false;}} function mascaraCNPJ(campo){campo=document.getElementById(campo);separador='.';separador1='/';separador2='-';conjunto=2;conjunto1=6;conjunto2=10;conjunto3=15;if(campo.value.length==conjunto){campo.value=campo.value+separador;} if(campo.value.length==conjunto1){campo.value=campo.value+separador;} if(campo.value.length==conjunto2){campo.value=campo.value+separador1;} if(campo.value.length==conjunto3){campo.value=campo.value+separador2;}} function mascaraCPF(campo){campo=document.getElementById(campo);separador='.';separador1='-';if(campo.value.length==3){campo.value=campo.value+separador;} if(campo.value.length==7){campo.value=campo.value+separador;} if(campo.value.length==11){campo.value=campo.value+separador1;}} function mascaraMoney(campo,tammax){box=document.getElementById(campo);vr=box.value;vr=vr.toString().replace(",","");vr=vr.toString().replace(".","");tam=vr.length;if((tam>2)&&(tam<=5)){box.value=vr.substr(0,tam-2)+','+vr.substr(tam-2,tam);} if((tam>=6)&&(tam<=8)){box.value=vr.substr(0,tam-5)+'.'+vr.substr(tam-5,3)+','+vr.substr(tam-2,tam);} if((tam>=9)&&(tam<=11)){box.value=vr.substr(0,tam-8)+'.'+vr.substr(tam-8,3)+'.'+vr.substr(tam-5,3)+','+vr.substr(tam-2,tam);} if((tam>=12)&&(tam<=14)){box.value=vr.substr(0,tam-11)+'.'+vr.substr(tam-11,3)+'.'+vr.substr(tam-8,3)+'.'+vr.substr(tam-5,3)+','+vr.substr(tam-2,tam);} if((tam>=15)&&(tam<=17)){box.value=vr.substr(0,tam-14)+'.'+vr.substr(tam-14,3)+'.'+vr.substr(tam-11,3)+'.'+vr.substr(tam-8,3)+'.'+vr.substr(tam-5,3)+','+vr.substr(tam-2,tam);}} function mascaraFone(campo){campo=document.getElementById(campo);separador1='(';separador2=')';separador3='-';if(campo.value.length==1){campo.value=separador1+campo.value;} if(campo.value.length==3){campo.value=campo.value+separador2;} if(campo.value.length==8){campo.value=campo.value+separador3;}} function mascaraFoneSimples(campo){campo=document.getElementById(campo);separador='-';if(campo.value.length==4){campo.value=campo.value+separador;}} function mascaraHora(campo){campo=document.getElementById(campo);separador=':';conjunto=2;if(campo.value.length==conjunto){campo.value=campo.value+separador;}} function mascaraData(campo){campo=document.getElementById(campo);separador='/';if(campo.value.length==2){campo.value=campo.value+separador;} if(campo.value.length==5){campo.value=campo.value+separador;}} function mascaraCEP(campo){campo=document.getElementById(campo);separador='-';conjunto=5;if(campo.value.length==conjunto){campo.value=campo.value+separador;}} function move(MenuOrigem,MenuDestino){var arrMenuOrigem=new Array();var arrMenuDestino=new Array();var arrLookup=new Array();var i;for(i=0;i')} setHTML(retorno,goAjax(url,metodo,false,parametros,''));feedback=feedback.indexOf("sucesso");if(feedback>-1){setDisplay(excluir,'none');} setDisplay(retorno,'block');setTimeout("setDisplay('"+retorno+"', 'none')",15000);return true;}else{return false;}} function ajaxAlteraStatus(url,metodo,parametros,retorno,id1,id2){if(confirm("Tem certeza que deseja alterar o status deste registro?")){setHTML(retorno,goAjax(url,metodo,false,parametros,''));if(document.getElementById(id1).style.display=="none"){setDisplay(id2,'none');setDisplay(id1,'block');}else{setDisplay(id2,'block');setDisplay(id1,'none');} setDisplay(retorno,'block');setTimeout("setDisplay('"+retorno+"', 'none')",15000);return true;}else{return false;}} function ajaxToolTip(url,metodo,parametros,carregar,elemento,retorno){if(carregar!=""){document.getElementById(carregar).innerHTML='
';} document.getElementById(elemento).setAttribute("tptitle",unescape(""+goAjax(url,metodo,modo,parametros,retorno)));document.getElementById(retorno).innerHTML='
';} var id="minhaTooltip";var background="#F2F4FF";var border="1px solid #999999";var display="none";var font="10px Verdana, Arial, Sans-serif";var color="#225DCE";var marginX=-30;var marginY=20;var opacity=90;var padding="2px 5px";var position="absolute";var _x=-10;var _y=-10;function setPos(event){if(document.all){_x=(document.documentElement&&document.documentElement.scrollLeft)?document.documentElement.scrollLeft:document.body.scrollLeft;_y=(document.documentElement&&document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop;_x+=(window.event.clientX+marginX);_y+=(window.event.clientY+marginY);}else{_x=(event.pageX+marginX);_y=(event.pageY+marginY);}} function showTip(text){var t=document.getElementById(id);t.style.display="block";document.onmousemove=function(event){setPos(event);t.innerHTML=text;t.style.left=_x+"px";t.style.top=_y+"px";}} function hideTip(){var t=document.getElementById(id).style;t.display="none";} function tooltip(tag){if((document.readyState=="complete")||(!document.all)){var body=document.getElementsByTagName("body");body=body[0];body.innerHTML+="
";var t=document.getElementById(id).style;t.background=background;t.border=border;t.display=display;t.font=font;t.fontWeight="bolder";t.color=color;t.opacity=opacity/100;t.filter="alpha(opacity="+opacity+")";t.padding=padding;t.position=position;title="" var tagName=document.getElementsByTagName(tag);for(i=0;i");if((month==emonth)&&(date==edate))document.write("Domigo de Páscoa");if((month==0)&&(date==1))document.write("Ano Novo");if((month==0)&&(day==1)&&(date>14)&&(date<22))document.write("");if((month==3)&&(date==1))document.write("Dia da Mentira");if((month==3)&&(date==21))document.write("Tiradentes");if((month==4)&&(date==1))document.write("Dia do Trabalho");if((month==4)&&(date==12))document.write("Dia da Enfermagem");if((month==5)&&(date==12))document.write("Dia dos Namorados");if((month==6)&&(date==4))document.write("Dia Internacional do Cooperativismo");if((month==7)&&(date==15))document.write("Dia da Informática");if((month==8)&&(date==7))document.write("Dia da Independência do Brasil");if((month==9)&&(date==12))document.write("Dia das Crianças");if((month==9)&&(date==19))document.write("Dia do Profissional da Informática");if((month==9)&&(date==31))document.write("Halloween");if((month==10)&&(date==2))document.write("Dia de Finados");if((month==10)&&(date==15))document.write("Proclamação da República");if((month==10)&&(date==20))document.write("Dia Nacional da Consciência Negra");if((month==11)&&(date==24))document.write("Véspera de Natal");if((month==11)&&(date==25))document.write("Natal");if((month==11)&&(date==31))document.write("Véspera de Ano Novo");document.write("");} var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function encode64(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;} output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+ keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);} if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i