function validacao_stagio1(){
	if (document.form_agenciar.nome.value == ""){
		alert("O preenchimento do Nome é obrigatório.");
		document.form_agenciar.nome.focus();
		return (false);
	}
	if (document.form_agenciar.rg.value == ""){
		alert("O preenchimento do RG é obrigatório.");
		document.form_agenciar.rg.focus();
		return (false);
	}
    return (true);
}

function SomenteNumero(e){ 
	var tecla=(window.event)?event.keyCode:e.which;
    if(tecla > 47 && tecla < 58) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
} 

function validacao_stagio2(){
	if (document.form_agenciar.data_nasc.value == "00/00/0000"){
		alert("O preenchimento da Data de Nascimento é obrigatório.");
		document.form_agenciar.data_nasc.focus();
		return (false);
	}
	if (document.form_agenciar.sexo[0].checked == false && document.form_agenciar.sexo[1].checked == false){
		alert("O preenchimento do Sexo é obrigatório.");
		document.form_agenciar.sexo[0].focus();
		return (false);
	}
	if (document.form_agenciar.fone_princ.value == ""){
		alert("O preenchimento do Fone Principal é obrigatório.");
		document.form_agenciar.fone_princ.focus();
		return (false);
	}
	if (document.form_agenciar.email.value == ""){
		alert("O preenchimento do E-mail é obrigatório.");
		document.form_agenciar.email.focus();
		return (false);
	}
    return (true);
}

function calculaidade(dataNasc) {

	var ano_nasc = dataNasc.split('/');
	var dia_nasc =ano_nasc[0];
	var mes_nasc =ano_nasc[1];
	var ano_nasc =ano_nasc[2];
	
	var data_atual = new Date()
	var mes_atual = data_atual.getMonth() + 1;
	var dia_atual = data_atual.getDate();
	var ano_atual = data_atual.getFullYear();
	
	var sua_idade = ano_atual - ano_nasc
	if (mes_atual < mes_nasc) {
		sua_idade = sua_idade - 1;
	}
	if (mes_atual == mes_nasc) {
		if (dia_atual < dia_nasc) {
			sua_idade = sua_idade - 1;
		}
	}
	document.getElementById("IDADE").value = sua_idade

	if (sua_idade >= 18){
		document.getElementById("PERFIL").value = "Adulto"
	}else{
		document.getElementById("PERFIL").value = "Criança"
	}
	
	return sua_idade;
}

function validacao_stagio3(){
	if (document.form_agenciar.file_foto.value == ""){
		alert("Para continuar é necessário ao menos uma foto.");
		return (false);
	}
    return (true);
}


