/////////////////////////////////////////////////////////////////////////////////////////////////
/**
* @author Tiago Carvalho projetos@logicadigital.com.br
* @copyright (c) 2006 Lógica Digital
* Descrição: Script para comparar se dois campos são iguais
*/

function jVerificaCampos ( campo , campo_confirmacao , imagem_ok , imagem_erro , nome_campo)
{
	if ( campo.length > 0 && campo_confirmacao.length > 0)
	{
		if ( campo == campo_confirmacao )
		{
			document.getElementById(imagem_erro).style.display = 'none' ;
			document.getElementById(imagem_ok).style.display = '' ;
			document.getElementById(nome_campo).className = 'formularioinput';
		}
		else
		{
			document.getElementById(imagem_erro).style.display = '' ;
			document.getElementById(imagem_ok).style.display = 'none' ;
			document.getElementById(nome_campo).className = 'formularioinput_erro';
		}
	}
	else
	{
		document.getElementById(imagem_erro).style.display = 'none' ;
		document.getElementById(imagem_ok).style.display = 'none' ;
		document.getElementById(nome_campo).className = 'formularioinput';
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
/**
* @author André Ferraro projetos@logicadigital.com.br
* @copyright (c) 2005 Lógica Digital
* Descrição: Script para validar se campo foi preenchido
*/

//valida o formulário trabalhe_conosco
function validaform_trabalhe_conosco()
{
	
		if (trabalhe_conosco.trab_nome.value == '' )
	{
		alert("Atenção! O campo NOME deve ser preenchido.");
		trabalhe_conosco.trab_nome.focus();
		return false;	
	}
	
	if (trabalhe_conosco.trab_rg.value == '' )
	{
		alert("Atenção! O campo RG deve ser preenchido.");
		trabalhe_conosco.trab_rg.focus();
		return false;	
	}

	if (trabalhe_conosco.trab_cpf.value == '' )
	{
		alert("Atenção! O campo CPF deve ser preenchido.");
		trabalhe_conosco.trab_cpf.focus();
		return false;	
	}

	if (trabalhe_conosco.trab_telefone.value.length<=9)
	{
		alert("Atenção! O campo Telefone deve ser preenchido.");
		trabalhe_conosco.trab_telefone.focus();
		return false;	
	}
}

//valida o formulário trabalhe_conosco_eng
function validaform_trabalhe_conosco_eng(trabalhe_conosco_eng)
{
	
		if (trabalhe_conosco_eng.trab_nome.value == '' )
	{
		alert("Attention! The field must be completed NAME.");
		trabalhe_conosco_eng.trab_nome.focus();
		return false;	
	}
	
	if (trabalhe_conosco_eng.trab_rg.value == '' )
	{
		alert("Attention! The field RG must be completed.");
		trabalhe_conosco_eng.trab_rg.focus();
		return false;	
	}

	if (trabalhe_conosco_eng.trab_cpf.value == '' )
	{
		alert("Attention! The field must be completed CPF.");
		trabalhe_conosco_eng.trab_cpf.focus();
		return false;	
	}

	if (trabalhe_conosco_eng.trab_telefone.value.length<=9)
	{
		alert("Attention! The Phone field must be completed.");
		trabalhe_conosco_eng.trab_telefone.focus();
		return false;	
	}
}
   
//valida o formulário de Entre em Contato
function validaform_entre_contato(entre_contato)
{
  if(entre_contato.escreva_para.value == 'Selecione')
  {
   alert("Escreva para, deve ser preenchido corretamente.");
   entre_contato.escreva_para.focus();
   return false;
   }
  
  if(entre_contato.contato_nome.value.length<=1)
  {
   alert("O campo Nome, deve ser preenchido corretamente.");
   entre_contato.contato_nome.focus();
   return false;
   }
   
    var str_email = entre_contato.contato_email.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' ))
	{
    	alert("O campo E-mail, deve ser preenchido corretamente");
    	entre_contato.contato_email.focus();
    	return false;
	}
	
	var str_confirma_email = entre_contato.contato_confirma_email.value ;
    if (( str_confirma_email != str_email ))
	{
    	alert("O campo Confirma E-mail para segurança, deve ser preenchido corretamente");
    	entre_contato.contato_confirma_email.focus();
    	return false;
	}
	
	var str_comentario = entre_contato.mensagem.value ;
    if ( str_comentario == "" )
	{
    	alert("O campo Comentários, deve ser preenchido corretamente");
    	entre_contato.mensagem.focus();
    	return false;
	}
}
   
//valida o formulário de Entre em Contato_eng
function validaform_entre_contato_eng(entre_contato_eng)
{
  if(entre_contato_eng.escreva_para.value == 'Select')
  {
   alert("Write must be completed correctly.");
   entre_contato_eng.escreva_para.focus();
   return false;
   }
  
  if(entre_contato_eng.contato_nome.value.length<=1)
  {
   alert("The Name field should be filled properly.");
   entre_contato_eng.contato_nome.focus();
   return false;
   }
   
    var str_email = entre_contato_eng.contato_email.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' ))
	{
    	alert("The field E-mail must be completed correctly");
    	entre_contato_eng.contato_email.focus();
    	return false;
	}
	
	var str_confirma_email = entre_contato_eng.contato_confirma_email.value ;
    if (( str_confirma_email != str_email ))
	{
    	alert("The field Confirms E-mail to Security must be completed correctly");
    	entre_contato_eng.contato_confirma_email.focus();
    	return false;
	}
	
	var str_comentario = entre_contato_eng.mensagem.value ;
    if ( str_comentario == "" )
	{
    	alert("The field Comments must be completed correctly");
    	entre_contato_eng.mensagem.focus();
    	return false;
	}
}

//Valida Newsletter
  
function validaform_newsletter ()
{
    // recebe os valores dos objetos
    var str_nome  = form_newsletter.nome ;
    var str_email = form_newsletter.email ;
    
    // verifica se o nome esta correto
    if (( str_nome.value.length <= 1 ) || ( str_nome.value == "Nome" ))
    {
        alert ( "O campo Nome deve estar preenchido corretamente." ) ;
        str_nome.focus () ;
        return false ;
    }
    
    // verifica se o email esta correto
    if (( str_email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email.value == 'E-mail:' ))
	{
    	alert ( "O campo E-mail deve ser preenchido corretamente" ) ;
    	str_email.focus () ;
    	return false ;
	}
    
    // nenhum erro, envia
	return true;
}

//valida Área Restrita

function validaform_area_restrita ()
{
    // recebe os valores dos objetos
    var str_nome  = form_area_restrita.login ;
    var str_senha = form_area_restrita.senha ;
    
    // verifica se o nome esta correto
    if (( str_nome.value.length <= 1 ) || ( str_nome.value == "Login" ))
    {
        alert ( "O campo Login deve estar preenchido corretamente." ) ;
        str_nome.focus () ;
        return false ;
    }
    
    // verifica se a senha esta correto
    if (( str_senha.value.length <= 1 ) || ( str_senha.value == "Senha" ))
    {
        alert ( "O campo Senha deve estar preenchido corretamente." ) ;
        str_senha.focus () ;
        return false ;
    }
    
    
    // nenhum erro, envia
	return true;
}


// Valida Formulario NewsLetter
function fValidaFormNews(form)
{
	if (form.nome.value == '' )
	{
		alert("Atenção!\nO campo NOME deve ser preenchido.");
		form.nome.focus();
		return false;	
	}
	if (form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
	{
		alert("Atenção!\nO campo E-MAIL deve ser preenchido corretamente.");
		form.email.value = "" ;
		form.email.focus();
		return false;
	}
}

//Limpando Campo do Formulário ("E-mail:" & "Nome:")
function fLimpaCampo(campo,valor)
{
	if (valor == "Nome:" || valor == "E-mail:" ) 
	{
		eval(campo).value = "" ;
	}
}

// Abre Pop-up
function AbrePopUp(url, titulo, largura, altura, scrollbar) {
	var info = window.open(url ,titulo ,'width=' + largura + ', height=' + altura +', scrollbars=' + scrollbar + ', toolbar=no, location=no, status=yes, menubar=no, resizable=no, left=10, top=10');
}

//Função Para exibir Menu "ATUACAO"
function mostra(id, status) 
{
	if (status == 0 ) {
		document.getElementById('submenu').style.visibility = "hidden";
	} else {
		document.getElementById('submenu').style.visibility = "visible"
	}
}

//Função Para exibir Menu "CONTATOS"
function mostra2(id, status) 
{
	if (status == 0 ) {
		document.getElementById('submenu2').style.visibility = "hidden";
	} else {
		document.getElementById('submenu2').style.visibility = "visible"
	}
}


// Função de Máscara de Campos
function FormatMask(objForm, strField, sMask, evtKeyPress) {
  var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

  if(window.event) { // Internet Explorer
    nTecla = evtKeyPress.keyCode; }
  else if(evtKeyPress.which) { // Nestcape
    nTecla = evtKeyPress.which;
  }

  sValue = objForm[strField].value;

  // Limpa todos os caracteres de formatação que
  // já estiverem no campo.
  sValue = sValue.toString().replace( "-", "" );
  sValue = sValue.toString().replace( "-", "" );
  sValue = sValue.toString().replace( ".", "" );
  sValue = sValue.toString().replace( ".", "" );
  sValue = sValue.toString().replace( "/", "" );
  sValue = sValue.toString().replace( "/", "" );
  sValue = sValue.toString().replace( "(", "" );
  sValue = sValue.toString().replace( "(", "" );
  sValue = sValue.toString().replace( ")", "" );
  sValue = sValue.toString().replace( ")", "" );
  sValue = sValue.toString().replace( " ", "" );
  sValue = sValue.toString().replace( " ", "" );
  fldLen = sValue.length;
  mskLen = sMask.length;

  i = 0;
  nCount = 0;
  sCod = "";
  mskLen = fldLen;

  if (nTecla != 8) { // backspace
    if (sMask.charAt(i-1) == "9") { // apenas números...
      return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
    else { // qualquer caracter...


  while (i <= mskLen) {
     bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
     bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

     if (bolMask) {
       sCod += sMask.charAt(i);
       mskLen++; }
     else {
       sCod += sValue.charAt(nCount);
       nCount++;
     }

     i++;
   }

   objForm[strField].value = sCod;

      return true;
    } }
  else {
    return true;
  }
}

// Motra campo qual deficiencia
function mostraDef (valor) {
 if ( valor == 'S' ) {
  document.getElementById("qual").style.display = "block";
 } else {
  document.getElementById("qual").style.display = "none";
 }
}

// Abre Pop-up
function AbrePopUp(url, titulo, largura, altura, scrollbar) {
	var info = window.open(url ,titulo ,'width=' + largura + ', height=' + altura +', scrollbars=' + scrollbar + ', toolbar=no, location=no, status=yes, menubar=no, resizable=no, left=10, top=10');
	info.focus();
}

//Validação de newsletter
function fnValidaNews(form,evento)
{
	if (form.nome.value == "")
	{
		alert("Atenção!\nO campo NOME deve ser preenchido.");
		form.nome.focus();
		return false;	
	}
	
	if (form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
	{
		alert("Atenção!\nO campo E-MAIL deve ser preenchido corretamente.");
		form.email.focus();
		return false;
	}
}



function validaform_esqueci_senha(form){
	if(form.login.value.length<=1)
	{
	alert("O campo LOGIN deve estar preenchido corretamente.");
	form.login.focus();
	return false;
	}

	var str_email = form.email.value ;
	if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' ))
	{
	alert("O campo E-MAIL deve ser preenchido corretamente");
	form.email.focus();
	return false;
	}
}