// JavaScript Document
function valida(theForm){
	
	var msgErro = document.getElementById("msgErro");
	msgErro.innerHTML = "";
	msgErro.className = "";
	
	var nome = document.getElementById("nome");
	if (theForm.nome.value == ""){
		nome.style.color = "#CC0000";
		theForm.nome.focus();
		msgErro.innerHTML = "Por favor, digite seu nome";
		msgErro.className = "erro";
		return (false);
	}else{
		nome.style.color = "#000000";	
	}
	
//validar email
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 seu Telefone.";
		msgErro.className = "erro";
		return (false);
	}else{
		fone.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 msg = document.getElementById("msg");
	if (theForm.msg.value == ""){
		msg.style.color = "#CC0000";
		theForm.msg.focus();
		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos obrigatorios.";
		msgErro.className = "erro";
		return (false);
	}else{
		msg.style.color = "#000000";	
	}
}