
function countChar(caracteres,textarea,qtd_carac){var txt_area=document.getElementById(textarea).value;if(txt_area.length>=caracteres){document.getElementById(textarea).value=txt_area.substring(0,caracteres);document.getElementById(qtd_carac).style.color="#FF0000";}else{document.getElementById(qtd_carac).style.color="#000000";}
var qtde=document.getElementById(textarea).value.length;if(qtd_carac!=undefined){document.getElementById(qtd_carac).innerHTML=qtde;}}
function testaSenha(campo,evento){var nivel=0;var senha=campo.value;var medidor=document.getElementById('cor_senha');if(!senha.length||senha.length==0){nivel=0;}
if(senha.length<=7){nivel=1;}
else{nivel=1;if(senha.match(/[A-Z_]/)){nivel++;}
if(senha.match(/[0-9]/)){nivel++;}
if(senha.match(/\W/)){nivel++;}
if(senha.length>=15){nivel++;}}
switch(nivel){case 1:medidor.style.backgroundColor='#ff0000';medidor.innerHTML='MUITO BAIXA';if(evento==2){alert('O nível de segurança da sua senha é muito baixo.\nPor favor, cadastre-a novamente.');campo.value='';}
break;case 2:medidor.style.backgroundColor='#ffcc00';medidor.innerHTML='BAIXA';if(evento==2){alert('O nível de segurança da sua senha é muito baixo.\nPor favor, cadastre-a novamente.');campo.value='';}
break;case 3:medidor.style.backgroundColor='#37ff45';medidor.innerHTML='BOM';if(evento==2){alert('O nível de segurança da sua senha é muito baixo.\nPor favor, cadastre-a novamente.');campo.value='';}
break;case 4:medidor.style.backgroundColor='#0e9617';medidor.innerHTML='MUITO BOM';break;case 5:medidor.style.backgroundColor='#006cff';medidor.innerHTML='EXCELENTE';break;default:medidor.style.backgroundColor='#ff0000';medidor.innerHTML='MUITO BAIXA';if(evento==2){alert('O nível de segurança da sua senha é muito baixo.\nPor favor, cadastre-a novamente.');campo.value='';}
break;}}
function colore_estrelas_recomendar(num,hover){for(var i=1;i<num+1;i++){var link=document.getElementById('st1_'+i);if(link){if(hover){link.className='estrela_hover';}
else{link.className='';}}}}
function respostas(name,num,id,input){var x=0;var resposta
var num=document.getElementById(num).value;document.getElementById(id).innerHTML="";while(x<num){x=x+1;resposta="<p><label class='name' style='float: left; width: 15%; margin-right: 0.5em; padding-top: 0.2em; text-align: right; font-weight: bold;'>"+x+"&deg; "+name+"</label> <input type='text' class='required_form' size='120' name='"+input+"[]'></p>";document.getElementById(id).innerHTML+=resposta;}}
function CheckAll(){for(var i=0;i<document.form_lista.elements.length;i++){var x=document.form_lista.elements[i];if(x.name=='check[]'){x.checked=document.form_lista.todos.checked;}}}
function closeGalery(id,id_galeria){if(document.getElementById(id)){if(document.getElementById(id).checked==true){document.getElementById(id).checked=false;}}
document.getElementById(id_galeria).innerHTML='';}
function checkAjax(value,id,id_galeria,galeria){if(document.getElementById(id).checked==true){document.getElementById(id_galeria).innerHTML='<a href="javascript:closeGalery(\''+id+'\',\''+id_galeria+'\');"><img src="./img/fechar.gif" alt="Fechar" title="Clique para desmarcar esta op&ccedil;&atilde;o" /></a> <input type="hidden" name="galeria[]" value="'+value+'" /> '+galeria+'';}
else{document.getElementById(id_galeria).innerHTML='';}}
function checkAjax2(value,id,id_galeria,galeria){if(document.getElementById(id).checked==true){document.getElementById(id_galeria).innerHTML='<a href="javascript:closeGalery(\''+id+'\',\''+id_galeria+'\');"><img src="./img/fechar.gif" alt="Fechar" title="Clique para desmarcar esta op&ccedil;&atilde;o" /></a> <input type="hidden" name="relacionadas[]" value="'+value+'" /> '+galeria+'';}
else{document.getElementById(id_galeria).innerHTML='';}}
function goToURL(URL)
{if(URL!="")
{document.location.href=URL;}}
function TamFonte(tipo,classDiv){var ObjClass=document.body.getElementsByTagName('*');for(var i=0;i<ObjClass.length;i++){if(ObjClass[i].className==classDiv){var findClass=ObjClass[i].style.fontSize;if(findClass==''){var tamanho=13;}
else{var tamanho=findClass.substr(0,2);}
switch(tipo){case'menos':if(tamanho>11){var novoTamanho=parseInt(tamanho)-2;ObjClass[i].style.fontSize=novoTamanho+'px';}
break;case'mais':if(tamanho<18){var novoTamanho=parseInt(tamanho)+2;ObjClass[i].style.fontSize=novoTamanho+'px';}
break;}}}}
function centerpopup(url,nome,altura,largura){var minimo=screen.width/4;var maximo=screen.height-100;var w=((((largura>minimo)?largura:minimo)<maximo)?largura:maximo);var h=((((altura>minimo)?altura:minimo)<maximo)?altura:maximo);var l=(screen.width/2)-w/2;var t=(screen.height/2)-h/2;var argumentos='copyhistory=yes,width='+w+',height='+h+',left='+l+',top='+t+',screenX='+l+',screenY='+t;var novajan=window.open(url,nome,argumentos);}
function carregaFlash(caminho,largura,altura,id,urlclick){var docwr='<object id="'+id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,16,0" width="'+largura+'" height="'+altura+'" align="top">';if(typeof(urlclick)!="undefined"&&urlclick.length>5){docwr='<object id="'+id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,16,0" width="'+largura+'" height="'+altura+'" align="top" onclick="'+urlclick+'">';}
document.write(docwr);document.write('<param name="movie" value="'+caminho+'" />');document.write('<param name="allowScriptAccess" value="sameDomain" />');document.write('<param name="wmode" value="transparent" />');document.write('<param name="quality" value="high" />');document.write('<param name="menu" value="false" />');document.write('<param name="salign" value="lt" />');document.write('<embed src="'+caminho+'" wmode="transparent" quality="high" allowScriptAccess="sameDomain" salign="lt" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" align="top"></embed>');document.write('</object>');}
function playerRadios(link,largura,altura,standy){document.write('<object id="mediaPlayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="'+altura+'" standby="'+standy+' . Loading Microsoft Windows Media Player components..." width="'+largura+'" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">');document.write('<param NAME="URL" value="'+link+'">');document.write('<param NAME="rate" value="1">');document.write('<param NAME="balance" value="0">');document.write('<param NAME="currentPosition" value="0">');document.write('<param NAME="defaultFrame" value>');document.write('<param NAME="playCount" value="1">');document.write('<param NAME="autoStart" value="-1">');document.write('<param NAME="currentMarker" value="0">');document.write('<param NAME="invokeURLs" value="-1">');document.write('<param NAME="baseURL" value>');document.write('<param NAME="volume" value="40">');document.write('<param NAME="mute" value="0">');document.write('<param NAME="uiMode" value="full">');document.write('<param NAME="stretchToFit" value="0">');document.write('<param NAME="windowlessVideo" value="0">');document.write('<param NAME="enabled" value="-1">');document.write('<param NAME="enableContextMenu" value="-1">');document.write('<param NAME="fullScreen" value="0">');document.write('<param NAME="SAMIStyle" value>');document.write('<param NAME="SAMILang" value>');document.write('<param NAME="SAMIFilename" value>');document.write('<param NAME="captioningID" value>');document.write('<param NAME="enableErrorDialogs" value="0">');document.write('<param NAME="_cx" value="7938">');document.write('<param NAME="_cy" value="1852">');document.write('<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" src="'+link+'" width="'+largura+'" height="'+altura+'" autostart="1" displaysize="4" autosize="0" showcontrols="1" showtracker="1" ShowStatusBar="1" showdisplay="0" videoborder3d="0" volume="30" standby="'+standy+'" loop="1" autorewind="1"></embed>');document.write('</object>');}
function playerAudioTempo(link,largura,altura,standy){document.write('<object id="mediaPlayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="'+altura+'" standby="'+standy+' . Loading Microsoft Windows Media Player components..." width="'+largura+'" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">');document.write('<param NAME="URL" value="'+link+'">');document.write('<param NAME="rate" value="1">');document.write('<param NAME="balance" value="0">');document.write('<param NAME="currentPosition" value="0">');document.write('<param NAME="defaultFrame" value>');document.write('<param NAME="playCount" value="1">');document.write('<param NAME="autoStart" value="0">');document.write('<param NAME="currentMarker" value="0">');document.write('<param NAME="invokeURLs" value="-1">');document.write('<param NAME="baseURL" value>');document.write('<param NAME="volume" value="40">');document.write('<param NAME="mute" value="0">');document.write('<param NAME="uiMode" value="full">');document.write('<param NAME="stretchToFit" value="0">');document.write('<param NAME="windowlessVideo" value="0">');document.write('<param NAME="enabled" value="-1">');document.write('<param NAME="enableContextMenu" value="-1">');document.write('<param NAME="fullScreen" value="0">');document.write('<param NAME="SAMIStyle" value>');document.write('<param NAME="SAMILang" value>');document.write('<param NAME="SAMIFilename" value>');document.write('<param NAME="captioningID" value>');document.write('<param NAME="enableErrorDialogs" value="0">');document.write('<param NAME="_cx" value="7938">');document.write('<param NAME="_cy" value="1852">');document.write('<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" src="'+link+'" width="'+largura+'" height="'+altura+'" autostart="0" displaysize="4" autosize="0" showcontrols="1" showtracker="1" ShowStatusBar="1" showdisplay="0" videoborder3d="0" volume="30" standby="'+standy+'" loop="1" autorewind="1"></embed>');document.write('</object>');}
function resizeBanner(){var id='publicidade728x90_topo';if(document.getElementById(id).style.height=="90px"){document.getElementById(id).style.height="350px";}
else{document.getElementById(id).style.height="90px";}}
function openDiv(id){if(document.getElementById(id).style.display=="none"){document.getElementById(id).style.display="block";}
else{document.getElementById(id).style.display="none";}}
function showInput(id_campo,id){if(document.getElementById(id_campo).checked==true){document.getElementById(id).style.display="block";}
else{document.getElementById(id).style.display="none";}}
function habilitar(id_campo,id){if(document.getElementById(id_campo).checked==true){document.getElementById(id).style.display="block";}}
function desabilitar(id_campo,id){if(document.getElementById(id_campo).checked==true){document.getElementById(id).style.display="none";}}
function desabilita_file(id,id2){if(document.getElementById(id).checked==true){document.getElementById(id2).disabled=true}
else{document.getElementById(id2).disabled=false}}
function habilita_file(id,id2){if(document.getElementById(id).checked==false){document.getElementById(id2).disabled=true}
else{document.getElementById(id2).disabled=false}}
function plusCampo(local,nomeCampo,qtde){var x=document.createElement('input');var pula=document.createElement('br');if(local=='fotos'){var total=document.getElementsByName('foto[]').length;var soma=(eval(qtde)+eval(total));if(total>=3||soma>=3){document.getElementById('link_fotos').style.display='none';return false;}}
x.setAttribute('type','file');x.setAttribute('name',nomeCampo+'[]');x.setAttribute('id','simpled');x.setAttribute('class','simpled');x.setAttribute('size','30');x.setAttribute('style','margin-top:3px');document.getElementById(local).appendChild(pula);document.getElementById(local).appendChild(x);}
function plusCampoVideo(local){var labelTitulo=document.createElement('label');var labelDescricao=document.createElement('label');var labelCodigo=document.createElement('label');var linha=document.createElement('hr');labelTitulo.innerHTML='<p><label class="name" style="margin-left:62px;">T&iacute;tulo: </label><input name="nome_videos[]" class="simpled" size="100" type="text" style="margin-left:23px;" /></p>';labelDescricao.innerHTML='<p><label class="name" style="margin-left:62px;">Descri&ccedil;&atilde;o: </label><textarea name="descr_videos[]" class="simpled" cols="100"></textarea></p>';labelCodigo.innerHTML='<p><label class="name" style="margin-left:62px;">C&oacute;digo: </label><textarea name="codigo_videos[]" type="text" class="simpled" cols="100" style="margin-left:18px;"></textarea></p>';document.getElementById(local).appendChild(linha);document.getElementById(local).appendChild(labelTitulo);document.getElementById(local).appendChild(labelDescricao);document.getElementById(local).appendChild(labelCodigo);}
function hab_desab(id,Array){i=0;if(Array!=null){for(i in Array){document.getElementById(Array[i]).style.display="none";}}
if(document.getElementById(id).style.display=="none"){document.getElementById(id).style.display="block";}
else{document.getElementById(id).style.display="none";}}
function autoCampo(formulario,campo,id){var valor=document.frmfuncionariosaw.email.value;document.getElementById("login").value=valor;}
function marcaHora(id,secondId,thirdId){if(document.getElementById(id).checked==true){document.getElementById(secondId).className='required validate-hour';document.getElementById(thirdId).className='required validate-hour';}else{document.getElementById(secondId).className='validate-hour';document.getElementById(thirdId).className='validate-hour';}}
function form_mascaras(valor,id,mascara,evento)
{var valorFinal="";var tecla=evento.keyCode;var valorOriginal=valor;var arrNaoPermitidos=new Array("-",".","/","\\","|","(",")",":"," ");for(i1=0;i1<valor.length;i1++)
{for(i2=0;i2<arrNaoPermitidos.length;i2++)
{if(valor.charAt(i1)==arrNaoPermitidos[i2])
{valor=valor.toString().replace(arrNaoPermitidos[i2],"");}}}
if(tecla!=8)
{if(mascara.length>=valorOriginal.length)
{jaTemMascara=false;for(i=0;i<valor.length;i++)
{if(jaTemMascara==false)
{if(mascara.charAt(i)=="#")
{if(((tecla>95)&&(tecla<106))||((tecla>47)&&(tecla<58)))
{valorFinal=valorFinal+valor.charAt(i);}
else
{valorFinal=valorOriginal.substring(0,valorOriginal.length-1);}}
else if(mascara.charAt(i)=="@")
{valorFinal=valorFinal+valor.charAt(i);}
else
{if(mascara.charAt(i+1)=="#")
{if(((tecla>95)&&(tecla<106))||((tecla>47)&&(tecla<58)))
{valorFinal=valorFinal+mascara.charAt(i+jaTemMascara)+valor.charAt(i);jaTemMascara=jaTemMascara+1;}
else
{valorFinal=valorOriginal.substring(0,valorOriginal.length-1);}}
else
{valorFinal=valorFinal+mascara.charAt(i+jaTemMascara)+valor.charAt(i);jaTemMascara=jaTemMascara+1;}}}
else
{if(mascara.charAt(i+jaTemMascara)=="#")
{if(((tecla>95)&&(tecla<106))||((tecla>47)&&(tecla<58)))
{valorFinal=valorFinal+valor.charAt(i);}
else
{valorFinal=valorOriginal.substring(0,valorOriginal.length-1);}}
else if(mascara.charAt(i+jaTemMascara)=="@")
{valorFinal=valorFinal+valor.charAt(i);}
else
{if(mascara.charAt(i+jaTemMascara+1)=="#")
{if(((tecla>95)&&(tecla<106))||((tecla>47)&&(tecla<58)))
{valorFinal=valorFinal+mascara.charAt(i+jaTemMascara)+valor.charAt(i);jaTemMascara=jaTemMascara+1;}
else
{valorFinal=valorOriginal.substring(0,valorOriginal.length-1);}}
else
{valorFinal=valorFinal+mascara.charAt(i+jaTemMascara)+valor.charAt(i);jaTemMascara=jaTemMascara+1;}}}}}
else
{valorFinal=valorOriginal.substring(0,mascara.length);}}
else
{valorFinal=valorOriginal.substring(0,valorOriginal.length);}
document.getElementById(id).value=valorFinal;}
function SetAllCheckBoxes(FormName,FieldName,CheckValue)
{if(!document.forms[FormName])
return;var objCheckBoxes=document.forms[FormName].elements[FieldName];if(!objCheckBoxes)
return;var countCheckBoxes=objCheckBoxes.length;if(!countCheckBoxes)
objCheckBoxes.checked=CheckValue;else
for(var i=0;i<countCheckBoxes;i++)
objCheckBoxes[i].checked=CheckValue;}
function changeWord(palavra){var word=palavra.replace(/_/g," ");word=word.replace(/\+/g," ");word=word.split(/\s+/g);for(var i=0;i<word.length;i++){var parts=word[i].match(/(\w)(\w*)/);if(i==0){word[i]=parts[1].toUpperCase()+parts[2].toLowerCase();}else{word[i]=parts[1].toLowerCase()+parts[2].toLowerCase();}}
return word.join(' ');};function validaForm(object,validate_checkbox){var last_name="",atual_name="",result_verify="",atual_obj="",name_field="";if(typeof validate_checkbox=="undefined"){validate_checkbox=new Array();}
var required=/required/;for(x=0;x<object.length;x++){atual_obj=object[x];if(typeof atual_obj.value=="undefined"){atual_obj.value="";}
if((inArray(atual_obj.name,validate_checkbox)||required.test(atual_obj.className))&&(atual_obj.type=='checkbox'||atual_obj.type=='radio')){atual_name=atual_obj.name;if(last_name!=atual_name){last_name=atual_name;result_verify=validar_checkbox(last_name);if(result_verify.length>1){alert('O campo "'+result_verify+'" precisa ser marcado');return false;}}}
else if((atual_obj.value.length<1||inArray(atual_obj.value.toUpperCase(),Array("NULL",""," ")))&&required.test(atual_obj.className)){atual_obj.focus();atual_obj.style.borderColor='#FF0000';name_field=(atual_obj.title.length<1)?atual_obj.name:atual_obj.title;alert('O campo "'+name_field+'" precisa ser preenchido');return false;}}
return true;};function validar_checkbox(name_elm){var elements=document.getElementsByName(name_elm);var titulo_check="";for(y=0;y<elements.length;y++){if(elements[y].checked==true){return"";}
if(elements[y].title.length>1&&titulo_check.length<1){titulo_check=elements[y].title;}}
return(titulo_check.length>1)?titulo_check:name_elm;};function inArray(value,Array){for(var i=0;i<Array.length;i++){if(Array[i]===value){return true;}}
return false;};