//impede que seja mudada a aba, caso os campos ainda não tenham sido gravador
function aviso_aba(id,number){
	if(gE(id).value.length > 0){
		alert('Você deve primeiro clicar em GRAVAR antes de continuar.');
	} else {
	AlternarAbas('td_'+number,'div_'+number);
	}
}

function pessoais(){

	if (gE('nome').value.length==0){
	alert("Preencha o campo [Nome]");
	gE('nome').focus();
	return false;
	}
	if (gE('nasc').value.length==0){
	alert('Preencha o campo [Data de nascimento]');
	gE('nasc').focus();
	return false;
	}
	if (gE('endereco').value.length==0){
	alert('Preencha o campo [Endereço]');
	gE('endereco').focus();
	return false;
	}
	if (gE('bairro').value.length==0){
	alert('Preencha o campo [Bairro]');
	gE('bairro').focus();
	return false;
	}
	if (gE('cidade').value.length==0){
	alert('Preencha o campo [Cidade]');
	gE('cidade').focus();
	return false;
	}
	if (gE('fone').value.length==0){
	alert('Preencha o campo [Telefone]');
	gE('fone').focus();
	return false;
	}
	if (gE('icpf').value.length==0){
	alert('Preencha o campo [CPF]');
	gE('icpf').focus();
	return false;
	}
	if (gE('email').value.length==0){
	alert('Preencha o campo [Email]');
	gE('email').focus();
	return false;
	}
	if (gE('foto').value.length==0){
	alert('Por favor insira uma foto no formato GIF ou JPG!');
	gE('foto').focus();
	return false;
	} 
	return true;
}

function mask_dt(campo,size)
{
    if(size == 1)
	{
		if(campo.value.length == 2)
    	{
        	campo.value += "/";         
    	}
    	if(campo.value.length == 5)
    	{
        	campo.value += "/";         
    	}
	} else {
		if(campo.value.length == 2)
    	{
        	campo.value += "/";         
    	}	
	}
}


function academico(){

	if (gE('instituicao').value.length==0){
		alert("Preencha o campo [Instituição de ensino]");
		gE('instituicao').focus();
		return false;
	} else if (gE('dt_conclusao').value.length==0){
		alert("Preencha o campo [Data de conclusão]");
		gE('dt_conclusao').focus();
		return false;
	} else {
		return true;
	}
}

function cursos(){

	if (gE('curso_inst').value.length==0){
	alert("Preencha o campo [Instituição de ensino]");
	gE('curso_inst').focus();
	return false;
	}
	if (gE('curso_nome').value.length==0){
	alert("Preencha o campo [Curso]");
	gE('curso_nome').focus();
	return false;
	}
	if (gE('curso_conclusao').value.length==0){
	alert("Preencha o campo [Data de conclusão]");
	gE('curso_conclusao').focus();
	return false;
	}
	
	return true;
}

function pro(){

	if (gE('empresa').value.length==0){
	alert("Preencha o campo [Empresa]");
	gE('empresa').focus();
	return false;
	}
	if (gE('funcao').value.length==0){
	alert("Preencha o campo [Cargo]");
	gE('funcao').focus();
	return false;
	}
	if (gE('dt_admissao').value.length==0){
	alert("Preencha o campo [Data de admissão]");
	gE('dt_admissao').focus();
	return false;
	}
	if (gE('atividades').value.length==0){
	alert("Preencha o campo [Funções executadas]");
	gE('atividades').focus();
	return false;
	}
	
	return true;
}

function perfil(){

	if (gE('softwares').value.length==0){
	alert("Preencha o campo [Conhecimentos em Softwares / Sistema Operacional]");
	gE('softwares').focus();
	return false;
	}
	
	if (gE('pret_salarial').value.length==0){
	alert("Preencha o campo [Pretensão salarial]");
	gE('pret_salarial').focus();
	return false;
	}
	
	var sal = gE('pret_salarial').value.replace(",",".");
	
	if (sal < 400.00){
	alert("A pretensão salarial não pode ser menor que R$400,00!");
	gE('pret_salarial').focus();
	return false;
	}
	return true;
}

function update(modulo, itemid, id_cv)
{
	document.location.href="empresarh_cadastro.php?p=6&item="+itemid+"&cv="+id_cv+"&edit="+modulo+"";	
}

function exclui(modulo, itemid, id_cv)
{
	if(modulo == "dados")
	{
		if(confirm("Ao clicar em OK, todas suas informações serão deletadas, confirma?"))
		{
			document.location.href="rh/delete.php?p=6&item="+itemid+"&modulo="+modulo+"&cv="+id_cv;
		}
	} else {
	
		if(confirm("Tem certeza que deseja deletar estes dados?"))
		{
			document.location.href="rh/delete.php?p=6&item="+itemid+"&modulo="+modulo+"&cv="+id_cv;
		}
		
	}
}