// JavaScript Document

function abre_formulario(url){
	window.open(url, "", "width=384, height=293");
	}


function valida(theForm){
	
	var msgErro = document.getElementById("msgErro");
	msgErro.innerHTML = "";
	msgErro.className = "";
	
	var nome = document.getElementById("nome");
	if (theForm.nome.value == ""){
		nome.style.color = "#ff0000";
		theForm.nome.focus();
		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos indicados e tente novamente.";
		msgErro.className = "erro";
		return (false);
	}else{
		nome.style.color = "#333333";	
	}
	
	var email = document.getElementById("email");
	if (theForm.email.value == ""){
		email.style.color = "#ff0000";
		theForm.email.focus();
		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos indicados e tente novamente.";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#333333";	
	}
	
	var assunto = document.getElementById("assunto");
	if (theForm.assunto.value == ""){
		assunto.style.color = "#ff0000";
		theForm.assunto.focus();
		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos indicados e tente novamente.";
		msgErro.className = "erro";
		return (false);
	}else{
		assunto.style.color = "#333333";	
	}
	
	var msg = document.getElementById("msg");
	if (theForm.msg.value == ""){
		msg.style.color = "#ff0000";
		theForm.msg.focus();
		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos indicados e tente novamente.";
		msgErro.className = "erro";
		return (false);
	}else{
		msg.style.color = "#333333";	
	}
}

function valida_cadastro(theForm){
	
	
	var nome = document.getElementById("nome");
	if (theForm.nome.value == ""){
		
		theForm.nome.focus();
		alert("Preencha o campo nome!");
		return (false);
	}
	
	
	var cpf = document.getElementById("cpf");
	if (theForm.cpf.value == ""){
		
		theForm.cpf.focus();
		alert("Preencha o campo CPF!");
		
		return (false);
	}
	
	var sexo = document.getElementById("sexo");
	if (theForm.sexo.value == "0"){
		
		theForm.sexo.focus();
		alert("Preencha o campo sexo!");
		return (false);
	}
	
	var estado_civil = document.getElementById("estado_civil");
	if (theForm.estado_civil.value == "0"){
		
		theForm.estado_civil.focus();
		alert("Preencha o campo Estado Civil!");
		return (false);
	}
	
	var endereco = document.getElementById("endereco");
	if (theForm.endereco.value == ""){
		
		theForm.endereco.focus();
		alert("Preencha o campo Endereço!");
		return (false);
	}
	
	var bairro = document.getElementById("bairro");
	if (theForm.bairro.value == ""){
		
		theForm.bairro.focus();
		alert("Preencha o campo Bairro!");
		return (false);
	}
	
	var cep = document.getElementById("cep");
	if (theForm.cep.value == ""){
		
		theForm.cep.focus();
		alert("Preencha o campo CEP!");
		return (false);
	}
	
	var cidade = document.getElementById("cidade");
	if (theForm.cidade.value == ""){
		
		theForm.cidade.focus();
		alert("Preencha o campo Cidade!");
		return (false);
	}
	
	var estado = document.getElementById("estado");
	if (theForm.estado.value == "0"){
		
		theForm.estado.focus();
		alert("Preencha o campo Estado!");
		return (false);
	}
	
	var data_nasc = document.getElementById("data_nasc");
	if (theForm.data_nasc.value == ""){
		
		theForm.data_nasc.focus();
		alert("Preencha o campo Data de Nascimento!");
		return (false);
	}
	
	var email = document.getElementById("email");
	if (theForm.email.value == ""){
		
		theForm.email.focus();
		alert("Preencha o campo E-mail!");
		return (false);
	}
	
	var situacao_educacional = document.getElementById("situacao_educacional");
	if (theForm.situacao_educacional.value == "0"){
	
		theForm.situacao_educacional.focus();
		alert("Preencha o campo Situação Educacional!");
		return (false);
	}	
	
}
