// JavaScript Document
function valida(theForm){
	
	var msgErro = document.getElementById("msgErro");
	msgErro.innerHTML = "";
	msgErro.className = "";
	
	var razao = document.getElementById("razao");
	if (theForm.razao.value == ""){
		razao.style.color = "#CC0000";
		theForm.razao.focus();
		msgErro.innerHTML = "Por favor, digite a razão social";
		msgErro.className = "erro";
		return (false);
	}else{
		razao.style.color = "#000000";	
	}
	
	var nome = document.getElementById("nome");
	if (theForm.nome.value == ""){
		nome.style.color = "#CC0000";
		theForm.nome.focus();
		msgErro.innerHTML = "Por favor, digite o nome para contato";
		msgErro.className = "erro";
		return (false);
	}else{
		nome.style.color = "#000000";	
	}
	
var email = document.getElementById("email");
	if (theForm.email.value == ""){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "Por favor, digite seu e-mail";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}
	
	var email = document.getElementById("email");
	var filtro=/^.+@.+\..{2,3}$/;
	if (filtro.test(theForm.email.value) == false){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "E-mail inválido";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}
	

	var fone = document.getElementById("fone");
	if (theForm.fone.value == ""){
		fone.style.color = "#CC0000";
		theForm.fone.focus();
		msgErro.innerHTML = "Por favor, digite o telefone para contato.";
		msgErro.className = "erro";
		return (false);
	}else{
		fone.style.color = "#000000";	
	}
	var celular = document.getElementById("celular");
	if (theForm.celular.value == ""){
		celular.style.color = "#CC0000";
		theForm.celular.focus();
		msgErro.innerHTML = "Por favor, digite o celular para contato.";
		msgErro.className = "erro";
		return (false);
	}else{
		celular.style.color = "#000000";	
	}
	var cidade = document.getElementById("cidade");
	if (theForm.cidade.value == ""){
		cidade.style.color = "#CC0000";
		theForm.cidade.focus();
		msgErro.innerHTML = "Por favor, digite sua cidade.";
		msgErro.className = "erro";
		return (false);
	}else{
		cidade.style.color = "#000000";	
	}
	var estado = document.getElementById("estado");
	if (theForm.estado.value == "0"){
		cidade.style.color = "#CC0000";
		theForm.estado.focus();
		msgErro.innerHTML = "Por favor, escolha seu estado.";
		msgErro.className = "erro";
		return (false);
	}else{
		cidade.style.color = "#000000";	
	}

}