function marcar_checkbox_arquivo(){
   for (i=0;i<document.arquivo.elements.length;i++) 
      if(document.arquivo.elements[i].type == "checkbox")	
         document.arquivo.elements[i].checked=1 
} 
function desmarcar_checkbox_arquivo(){
   for (i=0;i<document.arquivo.elements.length;i++) 
      if(document.arquivo.elements[i].type == "checkbox")	
         document.arquivo.elements[i].checked=0
}
function exibe_oculta_div(id ) {
        var obj = document.getElementById(id);
    if(obj.style.display == 'none')
    {
        obj.style.display = 'block';
    }
    else
        obj.style.display = 'none';
}	
function div_enquete(nome,id,j) {		
		for(n=1;n<=4;n++){
			if (id != j+n){				
				var obj = document.getElementById(nome+j+n)
				obj.style.display = 'none';
			}
			else{
				var obj = document.getElementById(nome+j+n);
				if (obj.style.display === 'none')
					obj.style.display = 'block';
				else
					obj.style.display = 'none';
			}
		}
		
}	
//mascara do cpf
function mascara_cpf(CAMPO) {
	valor = CAMPO.value.length;
	if (valor === 3 || valor === 7) { CAMPO.value += '.'; }
	if (valor === 11) { CAMPO.value += '-'; }
}
//mascara do cpf
function mascara_carteirinha(CAMPO) {
	valor = CAMPO.value.length;
	if (valor === 3 || valor === 8 || valor === 15) { CAMPO.value += '.'; }
	if (valor === 18) { CAMPO.value += '-'; }
}
function calcula_idade(ano,mes,dia)
{  
   var data = new Date();
   var mes_atual = data.getMonth()+1;   	
   var dia_atual = data.getDate();
   var ano_atual = data.getFullYear();
   var idade = ano_atual - ano;
	
   if (mes_atual<=mes)
   {
	   if (mes===mes_atual)
	   {
		   if (dia>dia_atual)
			   idade--;
	   }
	   else
		   idade--;
   }
   if (idade<10) idade='0'+idade;
	
   return idade;
}
function horas(){
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	if (hours <=9)
		hours='0'+hours;
	if (minutes<=9)
		minutes='0'+minutes;
	if (seconds<=9)
		seconds='0'+seconds;
	var cdate='<font color=#ffffff face=verdane size=1 type=bold>'+hours+':'+minutes+' '+'</font>' 
	clock.innerHTML= cdate;
	setTimeout('horas()',1000);
}
function verifica_consulta(){	 
	if (document.consulta.usuario.value!='' && document.consulta.senha.value!='')
		return true;
	if (document.consulta.usuario.value==='' || document.consulta.senha.value===''){
		alert('Favor preencher todos os campos');	
		document.consulta.usuario.focus();				
		return false;
	}		
}	
function verifica_contato(){   
	if (document.contato.nome.value!='' && document.contato.email.value!='' && document.contato.mensagem.value!='')		
		return true;
	if (document.contato.nome.value==='' || document.contato.email.value==='' || document.contato.mensagem.value===''){	
		alert('Favor preencher todos os campos');	
		document.contato.nome.focus();				
		return false;
	}		
}
function verifica_usuario(){
	if (document.usuario.usuario.value!='' && document.usuario.senha.value!='' && document.usuario.nome.value!='')		
		return true;
	if (document.usuario.usuario.value==='' || document.usuario.senha.value==='' || document.usuario.nome.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.usuario.usuario.focus();				
		return false;
	}		
}
function verifica_farmacia(){
	if (document.farmacia.nome.value!='' && document.farmacia.identificacao.value!='' && document.farmacia.medicamento.value!='' && document.farmacia.email.value!='' && document.farmacia.telefone.value!='')
		return true;
	if (document.farmacia.nome.value==='' || document.farmacia.identificacao.value==='' || document.farmacia.medicamento.value==='' || document.farmacia.email.value==='' || document.farmacia.telefone.value===''){	
		alert('Favor preencher todos os campos!');	
		document.farmacia.nome.focus();				
		return false;
	}		
}
function verifica_aniversario(){
	if (document.aniversario.mensagem.value!='')
		return true;
	if (document.aniversario.mensagem.value===''){	
		alert('Favor preencher a mensagem');	
		document.aniversario.mensagem.focus();				
		return false;
	}		
}
function verifica_processo(){
	if (document.processo.numero.value!='' && document.processo.vara.value!='' && document.processo.acao.value!='' && document.processo.autor.value!='' && document.processo.reu.value!='' && document.processo.valor.value!='')
		return true;
	if (document.processo.numero.value==='' || document.processo.vara.value==='' || document.processo.acao.value==='' || document.processo.autor.value==='' || document.processo.reu.value==='' || document.processo.valor.value===''){
		alert('Favor preencher os campos* obrigatórios');	
		document.processo.numero.focus();				
		return false;
	}		
}
function verifica_agenda(){
	if (document.agenda.compromisso.value!='')
		return true;
	if (document.agenda.compromisso.value===''){	
		alert('Favor preencher o compromisso');	
		document.agenda.compromisso.focus();				
		return false;
	}		
}
function verifica_pendencia(){
	if (document.pendencia.pendencia.value!='')
		return true;
	if (document.pendencia.pendencia.value===''){	
		alert('Favor preencher a pendência');	
		document.pendencia.pendencia.focus();				
		return false;
	}		
}
function verifica_noticias(){	
	if (document.noticias.titulo.value!='' && document.noticias.noticias.value!='' && document.noticias.foto0.value!='')
		return true;
	if (document.noticias.titulo.value==='' || document.noticias.noticias.value==='' || document.noticias.foto0.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.noticias.titulo.focus();				
		return false;
	}		
}
function verifica_comunicado(){
	if (document.comunicado.titulo.value!='' && document.comunicado.texto.value!='')
		return true;
	if (document.comunicado.titulo.value==='' || document.comunicado.texto.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.comunicado.titulo.focus();				
		return false;
	}		
}
function verifica_arquivo(){
	if (document.arquivo.nome.value!='')
		return true;
	if (document.arquivo.nome.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.arquivo.nome.focus();				
		return false;
	}		
}
function verifica_aviso(){
	if (document.aviso.titulo.value!='' && document.aviso.texto.value!='')
		return true;
	if (document.aviso.titulo.value==='' || document.aviso.texto.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.aviso.titulo.focus();				
		return false;
	}		
}
function verifica_evento(){
	if (document.evento.nome.value!='' && document.evento.evento_descricao.value!='' && document.evento.foto0.value!='')
		return true;
	if (document.evento.nome.value==='' || document.evento.evento_descricao.value==='' || document.evento.foto0.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.evento.nome.focus();				
		return false;
	}		
}
function verifica_jornal_conexao(){
	if (document.jornal_conexao.foto.value!='' && document.jornal_conexao.arquivo.value!='' && document.jornal_conexao.descricao.value!='')
		return true;
	if (document.jornal_conexao.foto.value==='' || document.jornal_conexao.arquivo.value==='' || document.jornal_conexao.descricao.value===''){
		alert('Favor preencher todos os campos');	
		document.jornal_conexao.descricao.focus();				
		return false;
	}		
}
function verifica_servico(){
	if (document.vantagem.nome.value!='' && document.vantagem.foto.value!='' && document.vantagem.texto.value!='' && document.conteudo.ano.value!='')
		return true;
	if (document.vantagem.nome.value==='' || document.vantagem.foto.value==='' || document.vantagem.texto.value==='' || document.vantagem.conteudo.value==='' || document.vantagem.hora.value==='' || document.vantagem.minuto.value==='' || document.vantagem.foto.value==='' || document.vantagem.descricao.value===''){
		alert('Favor preencher todos os campos');	
		document.vantagem.nome.focus();				
		return false;
	}		
}
function verifica_maternidade(){
	if (document.maternidade.nome.value!='' && document.maternidade.foto.value!='' && document.maternidade.pai.value!='' && document.maternidade.mãe.value!='')
		return true;
	if (document.maternidade.nome.value==='' || document.maternidade.foto.value==='' || document.maternidade.pai.value==='' || document.maternidade.mãe.value===''){
		alert('Favor preencher todos os campos');	
		document.maternidade.nome.focus();				
		return false;
	}		
}
function verifica_newsletter(){
	if (document.newsletter.nome.value!='' && document.newsletter.email.value!='')
		return true;
	if (document.newsletter.nome.value==='' || document.newsletter.email.value===''){	
		alert('Favor preencher todos os campos');	
		document.newsletter.nome.focus();				
		return false;
	}		
}
function verifica_medico_especialidade(){
	if (document.medico_especialidade.especialidade.value!='')
		return true;
	if (document.medico_especialidade.especialidade.value===''){	
		alert('Favor preencher a especialidade');	
		document.medico_especialidade.especialidade.focus();				
		return false;
	}		
}
function verifica_medico(){
	if (document.medico.nome.value!='' && document.medico.crm.value!='' && document.medico.esp1.value!=''  && document.medico.cidade.value!='' && document.medico.estado.value!='')
		return true;
	if (document.medico.nome.value==='' && document.medico.crm.value==='' || document.medico.esp1.value===''  || document.medico.cidade.value==='' || document.medico.estado.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.medico.nome.focus();				
		return false;
	}		
}
function verifica_rede(){
	if (document.rede.nome.value!='' && document.rede.endereco.value!='' && document.rede.bairro.value!='' && document.rede.cep.value!='' && document.rede.cidade.value!='' && document.rede.estado.value!=''  && document.rede.tipo.value!='' && document.rede.especialidade1.value!='' && document.rede.telefone1.value!='')
		return true;
	if (document.rede.nome.value==='' || document.rede.endereco.value==='' || document.rede.bairro.value==='' || document.rede.cep.value==='' || document.rede.cidade.value==='' || document.rede.estado.value===''  || document.rede.tipo.value==='' || document.rede.especialidade1.value==='' || document.rede.telefone1.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.rede.nome.focus();				
		return false;
	}		
}
function verifica_rede_especialidade(){
	if (document.rede_especialidade.tipo.value!='' && document.rede_especialidade.especialidade.value!='')
		return true;
	if (document.rede_especialidade.tipo.value==='' || document.rede_especialidade.especialidade.value===''){	
		alert('Favor preencher todos os campos');	
		document.rede_especialidade.especialidade.focus();				
		return false;
	}		
}
function verifica_form_ouvidoria(){		
	if (document.ouvidoria.nome.value!='' && document.ouvidoria.email.value!='' && document.ouvidoria.telefone.value!='' && document.ouvidoria.mensagem.value!='')
		return true;
	if (document.ouvidoria.nome.value==='' || document.ouvidoria.email.value==='' || document.ouvidoria.telefone.value==='' || document.ouvidoria.mensagem.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.ouvidoria.nome.focus();				
		return false;
	}		
}
function verifica_form_plano(){	
	if (document.plano.nome.value!='' && document.plano.email.value!='' && document.plano.telefone.value!='' && document.plano.mensagem.value!='')
		return true;
	if (document.plano.nome.value==='' || document.plano.email.value==='' || document.plano.telefone.value==='' || document.plano.mensagem.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.plano.nome.focus();				
		return false;
	}		
}
function verifica_form_rh(){
	if (document.rh.dp_nome.value!='' && document.rh.dp_nascimento_dia.value!='' && document.rh.dp_nascimento_mes.value!='' && document.rh.dp_nascimento_ano.value!='' && document.rh.dp_endereco.value!='' && document.rh.dp_bairro.value!='' && document.rh.dp_cep.value!='' && document.rh.dp_cidade.value!='' && document.rh.dp_telefone.value!='' && document.rh.dp_email.value!='' && document.rh.objetivo_area_atuacao.value!='' && document.rh.formacao_ultima_insitituicao.value!='' && document.rh.formacao_tipo.value!='' && document.rh.formacao_inicio_mes.value!='' && document.rh.formacao_inicio_ano.value!='' && document.rh.formacao_conclusao_ano.value!='' && document.rh.carreira1_instituicao.value!='' && document.rh.careira1_cidade.value!='' && document.rh.careira1_cargo.value!='' && document.rh.carreira1_inicio_dia.value!='' && document.rh.carreira1_inicio_mes.value!='' && document.rh.carreira1_inicio_ano.value!='' && document.rh.carreira1_fim_dia.value!='' && document.rh.carreira1_fim_mes.value!='' && document.rh.carreira1_fim_ano.value!='')
		return true;
	if (document.rh.dp_nome.value==='' || document.rh.dp_nascimento_dia.value==='' || document.rh.dp_nascimento_mes.value==='' || document.rh.dp_nascimento_ano.value==='' || document.rh.dp_endereco.value==='' || document.rh.dp_bairro.value==='' || document.rh.dp_cep.value==='' || document.rh.dp_cidade.value==='' || document.rh.dp_telefone.value==='' || document.rh.dp_email.value==='' || document.rh.objetivo_area_atuacao.value==='' || document.rh.formacao_ultima_insitituicao.value==='' || document.rh.formacao_tipo.value==='' || document.rh.formacao_inicio_mes.value==='' || document.rh.formacao_inicio_ano.value==='' || document.rh.formacao_conclusao_ano.value==='' || document.rh.carreira1_instituicao.value==='' || document.rh.careira1_cidade.value==='' || document.rh.careira1_cargo.value==='' || document.rh.carreira1_inicio_dia.value==='' || document.rh.carreira1_inicio_mes.value==='' || document.rh.carreira1_inicio_ano.value==='' || document.rh.carreira1_fim_dia.value==='' || document.rh.carreira1_fim_mes.value==='' || document.rh.carreira1_fim_ano.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.rh.dp_nome.focus();				
		return false;
	}		
}
function verifica_form_sugestoes(){
	if (document.sugestoes.nome.value!='' && document.sugestoes.email.value!='' && document.sugestoes.sugestao.value!='')
		return true;
	if (document.sugestoes.nome.value==='' || document.sugestoes.email.value==='' || document.sugestoes.sugestao.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.sugestoes.nome.focus();				
		return false;
	}		
}
function verifica_form_ortopedia(){
	if (document.ortopedia.nome.value!='' && document.ortopedia.email.value!='' && document.ortopedia.cidade.value!='' && document.ortopedia.mensagem.value!='')
		return true;
	if (document.ortopedia.nome.value==='' || document.ortopedia.email.value==='' || document.ortopedia.cidade.value==='' || document.ortopedia.mensagem.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.ortopedia.nome.focus();				
		return false;
	}		
}
function verifica_form_radiologia(){
	if (document.radiologia.nome.value!='' && document.radiologia.email.value!='' && document.radiologia.duvida.value!='')
		return true;
	if (document.radiologia.nome.value==='' || document.radiologia.email.value==='' || document.radiologia.duvida.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.radiologia.nome.focus();				
		return false;
	}		
}
function verifica_form_visita(){
	if (document.visita.empresa.value!='' && document.visita.contato.value!='' && document.visita.endereco.value!='' && document.visita.email.value!='' && document.visita.telefone.value!='' && document.visita.n_funcionarios.value!='' && document.visita.n_dependentes.value!='' && document.visita.fornecedor_plano.value!='' && document.visita.fornecedor_medicina.value!='')
		return true;
	if (document.visita.empresa.value==='' || document.visita.contato.value==='' || document.visita.endereco.value==='' || document.visita.email.value==='' || document.visita.telefone.value==='' || document.visita.n_funcionarios.value==='' || document.visita.n_dependentes.value==='' || document.visita.fornecedor_plano.value==='' || document.visita.fornecedor_medicina.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.visita.empresa.focus();				
		return false;
	}		
}
function verifica_informativo_medicina_preventiva(){
	if (document.informativo_medicina_preventiva.tema.value!='' && document.informativo_medicina_preventiva.foto.value!='' && document.informativo_medicina_preventiva.arquivo.value!='')
		return true;
	if (document.informativo_medicina_preventiva.tema.value==='' || document.informativo_medicina_preventiva.foto.value==='' || document.informativo_medicina_preventiva.arquivo.value===''){	
		alert('Favor preencher os campos* obrigatórios');	
		document.informativo_medicina_preventiva.tema.focus();				
		return false;
	}		
}
function verifica_enviar_noticia(){
	if (document.enviar_noticia.remetente.value!='' && document.enviar_noticia.remetente_email.value!='' && document.enviar_noticia.destinatario.value!='' && document.enviar_noticia.destinatario_email.value!='')
		return true;
	if (document.enviar_noticia.remetente.value==='' || document.enviar_noticia.remetente_email.value==='' || document.enviar_noticia.destinatario.value==='' || document.enviar_noticia.destinatario_email.value===''){	
		alert('Favor preencher todos os campos');	
		document.enviar_noticia.remetente.focus();				
		return false;
	}		
}
function verifica_enviar_entrevista(){
	if (document.enviar_entrevista.remetente.value!='' && document.enviar_entrevista.remetente_email.value!='' && document.enviar_entrevista.destinatario.value!='' && document.enviar_entrevista.destinatario_email.value!='')
		return true;
	if (document.enviar_entrevista.remetente.value==='' || document.enviar_entrevista.remetente_email.value==='' || document.enviar_entrevista.destinatario.value==='' || document.enviar_entrevista.destinatario_email.value===''){	
		alert('Favor preencher todos os campos');	
		document.enviar_entrevista.remetente.focus();				
		return false;
	}		
}
function verifica_enviar_materia(){
	if (document.enviar_materia.remetente.value!='' && document.enviar_materia.remetente_email.value!='' && document.enviar_materia.destinatario.value!='' && document.enviar_materia.destinatario_email.value!='')
		return true;
	if (document.enviar_materia.remetente.value==='' || document.enviar_materia.remetente_email.value==='' || document.enviar_materia.destinatario.value==='' || document.enviar_materia.destinatario_email.value===''){	
		alert('Favor preencher todos os campos');	
		document.enviar_materia.remetente.focus();				
		return false;
	}		
}
function verifica_comentar_noticia(){
	if (document.comentar_noticia.nome.value!='' && document.comentar_noticia.email.value!='' && document.comentar_noticia.comentario.value!='')
		return true;
	if (document.comentar_noticia.nome.value==='' || document.comentar_noticia.email.value==='' || document.comentar_noticia.comentario.value===''){	
		alert('Favor preencher todos os campos');	
		document.comentar_noticia.nome.focus();				
		return false;
	}		
}
function verifica_comentar_entrevista(){
	if (document.comentar_entrevista.nome.value!='' && document.comentar_entrevista.email.value!='' && document.comentar_entrevista.comentario.value!='')
		return true;
	if (document.comentar_entrevista.nome.value==='' || document.comentar_entrevista.email.value==='' || document.comentar_entrevista.comentario.value===''){	
		alert('Favor preencher todos os campos');	
		document.comentar_entrevista.nome.focus();				
		return false;
	}		
}
function  menu(foco) {		
	if (document.all&&document.getElementById) {	
		for(j=1; j<=19; j++){				
			navRoot = document.getElementById(j);							
			if (navRoot!=null){								
				for (i=0; i<navRoot.childNodes.length; i++) {
					node = navRoot.childNodes["i"];										
					if (node.nodeName==="DIV"){
						for (x=0; x<node.childNodes.length; x++) {	
							subnode = node.childNodes["x"];
							if (subnode.nodeName==="LI") {													
								subnode.onmouseover=function() {									
									this.className+=" over";
								}
								subnode.onmouseout=function() {
									this.className=this.className.replace(" over", "");
								}							
								for (y=0; y<subnode.childNodes.length; y++) {	
									subsubnode = subnode.childNodes["y"];									
									if (subsubnode.nodeName==="UL") {										
										for (z=0; z<subnode.childNodes.length; z++) {	
											subsubsubnode = subsubnode.childNodes["z"];												
											if (subsubsubnode.nodeName==="LI") {	
												subsubsubnode.onmouseover=function() {									
													this.className+=" over";
												}
												subsubsubnode.onmouseout=function() {
													this.className=this.className.replace(" over", "");
												}									
											}										
										}	
									}
								}
							}
						}	
					}	
				}
			}	
		}
		
	}	
}
function imprime_noticia(id) {
	window.parent.noticia.focus();
	window.print();
	window.location.href='noticia.php?id='+id;
}
function imprime_evento(id) {
	window.parent.evento.focus();
	window.print();
	window.location.href='evento.php?id='+id;
}
function imprime_entrevista(id) {
	window.parent.entrevista.focus();
	window.print();
	window.location.href='entrevista.php?id='+id;
}
function imprime_materia(id) {
	window.parent.principal.focus();
	window.print();
	window.location.href='materia.php?id='+id;
}
function verifica_entrevista(){
	if (document.entrevista.entrevistado_nome.value!='' && document.entrevista.entrevistado_email.value!='' && document.entrevista.entrevistado_foto.value!='' && document.entrevista.entrevistado_perfil.value!='' && document.entrevista.entrevista_tema.value!='' && document.entrevista.entrevista_descricao.value!='' && document.entrevista.entrevista_frase.value!='' && document.entrevista.entrevista.value!='')
		return true;
	if (document.entrevista.entrevistado_nome.value==='' || document.entrevista.entrevistado_email.value==='' || document.entrevista.entrevistado_foto.value==='' || document.entrevista.entrevistado_perfil.value==='' || document.entrevista.entrevista_tema.value==='' || document.entrevista.entrevista_descricao.value==='' || document.entrevista.entrevista_frase.value==='' || document.entrevista.entrevista.value===''){
		alert('Favor preencher os campos* obrigatórios');	
		document.entrevista.entrevistado_nome.focus();				
		return false;
	}		
}
function popup(Site)
{
window.open(Site,'PopupName','toolbar=no,statusbar=no,location=no,scrollbars=yes,resizable=yes,width=275,height=200')
}
function rte() {
	//make sure hidden and iframe values are in sync before submitting form
	//to sync only 1 rte, use updateRTE(rte)
	//to sync all rtes, use updateRTEs
	updateRTEs();		
	//change the following line to true to submit form
	return true;
}
