top.infoPessoalDiv.isLoaded = false;
//top.perfilDiv.isLoaded = false;
top.objetivosDiv.isLoaded = false;
top.formacaoDiv.isLoaded = false;
top.cursoDiv.isLoaded = false;
top.idiomaDiv.isLoaded = false;
top.habilidadeDiv.isLoaded = false;
top.expProfDiv.isLoaded = false;
top.atividadesDiv.isLoaded = false;
top.comentarioDiv.isLoaded = false;

var myForm;
function validarEhunter(){
    if ( document.getElementById("tipo_doc_id") ){
      if ( document.getElementById("tipo_doc_id").value == 1 ){
        myForm = document.cpfForm;
        checkCpf();
      }else{
        myForm = document.passForm;
        checkPass();
      }
    }else{
      myForm = document.cpfForm;
      checkCpf();
    }
    
}

function checkCpf(){
	if ( !checkField( true, myForm.ID_1, lbl9 , "Cpf" ) ) return;
  
  if ( ! checkSenhaBlock() ) return;
  
  if ( !checkField( true, myForm.COD_PERFIL_1, clbl14 , "List" ) ) return;
  
  if ( ! checkEmailBlock() ) return;
  
  if ( ! checkCepBlock() ) return;
  
  if ( ! naoDeficiente() ) return;

  if ( ! confirmaEmail() ) return;
return;
}

function checkPass(){
  if ( !checkField( true, myForm.ID_ORIGEM_1, clbl37 , "List" ) ) return;
	  
  if ( !checkField( true, myForm.ID_1, lbl9 , "" ) ) return;
  
  if (isEmpty(myForm.ID_1.value)){
      myForm.ID_1.focus();
      janelaerro("Preenche codigo do passaporte !");
      return;
  }
  
  if ( ! checkSenhaBlock() ) return;
  
  if ( myForm.COD_PERFIL_1 ){
    if ( !checkList( myForm.COD_PERFIL_1, err4 ) ) return;
  }
  
  if ( ! checkEmailBlock() ) return;
  
  if ( ! checkCepBlock() ) return;

  if ( ! confirmaEmail() ) return;

return;
}

function submitForm(){
  disableForwardLink();    
  myForm.submit();     
}

function mostraBloco(){
  valor = document.getElementById("tipo_doc_id").value;
  
	if (valor == 1){
	document.getElementById("div_CPF").style.display="block";
	document.getElementById("div_passaporte").style.display="none";
	}
	
  if (valor == 2){
	document.getElementById("div_CPF").style.display="none";
	document.getElementById("div_passaporte").style.display="block";
	}
  
  if ( valor == 0 ){
    document.getElementById("div_CPF").style.display="none";
	  document.getElementById("div_passaporte").style.display="none";
  }
	
}

function checkSenhaBlock(){
  if ( myForm.SENHA ){
    if ( !checkField( true, myForm.SENHA, clbl34, "Senha" ) ){
       myForm.SENHA.value = "";
       return;
    }
    
  }
	
  if ( myForm.CONF_SENHA ){
    if( myForm.NOVA_SENHA){
			if ( !checkField( true, myForm.NOVA_SENHA, lbl70, "Senha" ) ){
        myForm.NOVA_SENHA.value="";
        return;
      }
			if ( !checkField( true, myForm.CONF_SENHA, lbl70, "ConfSenha",myForm.NOVA_SENHA.value ) ){
        myForm.CONF_SENHA.value=""
        return;
      }
		}else{
			if ( !checkField( true, myForm.CONF_SENHA, lbl10, "Senha" ) ){
        myForm.CONF_SENHA.value="";
        return;
			}
      if ( !checkField( true, myForm.CONF_SENHA, lbl10, "ConfSenha",myForm.SENHA.value ) ){
        myForm.CONF_SENHA.value="";
        return;
      }
		}
  }
  return true;
}

function checkCepBlock( ){
  if ( !checkField( false, myForm.CEP_1, clbl69, "Cep" ) ) return false;
  return true;
}

function checkEmailBlock( ){
		if ( !checkField( true, myForm.EMAIL_1, clbl20, "Email" ) ) return false;
  return true;
}

var confEmail = "";
function confirmaEmail(){
  if ( myForm.EMAIL_1 ){
    top.janelaConfirmEmail();
  }else
    submitForm();
}

function sendConfEmail( confEmail ){
  email = myForm.EMAIL_1.value;
  if ( confEmail == email ){
    submitForm();
  }
  else{
		treatFieldError( true, myForm.EMAIL_1, clbl20, err7, true );
    return;
  }
}

function naoDeficiente() {
  if(myForm.DEFICIENCIA_1){  
    if (myForm.DEFICIENCIA_1.value!=1) {
	    alert('Este banco de currículos é exclusivo para o cadastro de pessoas com deficiência. Se você não for deficiente encaminhe seu currículo para o email ibdd@ibdd.org.br.');
	    return false;
	  }
  }
  return true;
}
