// JavaScript Document
function isNumber (cStr) { 
var aV = 1; 
var cOK = "0123456789()- ";
for (i = 0; i < cStr.length; i++) { 
   ch = cStr.charAt(i); 
   for (j = 0; j < cOK.length; j++) 
      if (ch == cOK.charAt(j)) break; 
   if (j == cOK.length) { 
      aV = 0; break; 
   } 
} 
return (aV);
} 

function valida_contato() {
	
	if (document.form.nome.value == "") {
		alert("Informe seu nome!");
		document.form.nome.focus();
		return;
	}

	if (document.form.email.value == "") {
		alert("Informe seu e-mail!");
		document.form.email.focus();
		return;
	}
	else {
		if (!Validar_Email(document.form.email.value)) {
			alert("E-mail inválido!");
			document.form.email.focus();
			return;
		}
}

	if (document.form.telefone.value == "") {
		alert("Informe o telefone!");
		document.form.telefone.focus();
		return;
	}
	
	if (!isNumber(document.form.telefone.value)) { 
	  alert("Digite somente números no campo telefone."); 
	  document.form.telefone.focus(); 
	  return;
		}

	if (document.form.txt_uf.value == "0") {
		alert("Selecione o estado!");
		document.form.txt_uf.focus();
		return;
	}


	if (document.form.municipio.value == "") {
		alert("Informe o município!");
		document.form.municipio.focus();
		return;
	}


if (document.form.msg.value == "") {
		alert("Informe a mensagem!");
		document.form.msg.focus();
		return;
	}
	
	document.form.action="contato.asp";
	document.form.submit();
}