// JavaScript Document
<!--
function checaCampos() 
	{
       var nome = document.contato.nome;
       var email = document.contato.email;
	   var assunto = document.contato.assunto;
	   var msg = document.contato.msg;
       var BadChars = "*|,\":<>[]{}`\'';()&$#% ";
	   var GoodChars = "@.";
	   var posarroba = email.value.indexOf ('@',0);
	      
	  
	   if (nome.value == "")
	   {
	   	    alert("\nPreencha o campo 'Nome'");
   			nome.focus();
			return false;
	   }
	   if (email.value == "")
	   {
            alert("\nPreencha o campo 'E-mail'");
			email.focus();
			return false;
       }
	   else
	   {
	   		if (email.value.length < 3) //o e-mail é menor que 3 caracteres - caractesristica do grupo milla
			{
				alert("\nE-mail inválido!");
				email.focus();
				return false;
			}
			for (var i = 0; i < email.value.length; i++)
			{
				if (BadChars.indexOf(email.value.charAt(i)) != -1) //Contém caracteres inválidos, famosos BadChars
				{
					alert("\nO e-mail contém caracteres inválidos");
					email.focus();
					return false;
				}
			}
			for (var i = 0; i < GoodChars.length; i++)
			{
				if (email.value.indexOf(GoodChars.charAt(i)) == -1) //não tem goodchars
				{
					alert("\nE-mail inválido!");
					email.focus();
					return false;
				}
				if (email.value.indexOf(GoodChars.charAt(i),0) == 0) //começou com goodchars(. ou @)
				{
					alert("\nE-mail inválido!");
					email.focus();
					return false;
				}
				if (email.value.lastIndexOf(GoodChars.charAt(i)) > email.value.length-3)//existe menos de dois caracteres apos o ultimo goodchar
				{
					alert("\nE-mail inválido! Seu email não deve terminar com @.");
					email.focus();
					return false;
				}
			}
			if (email.value.lastIndexOf('@') > email.value.lastIndexOf('.')) //não tem ponto depois do arroba
			{
				alert("\nE-mail inválido!");
				email.focus();
				return false;
			}
			if (email.value.indexOf('@.',0) != -1 || email.value.indexOf ('.@',0) != -1) //. e @ colados
			{
				alert("\nE-mail inválido!");
				email.focus();
				return false;
			}
			if (email.value.indexOf ('@',posarroba + 1) != -1) //Contém mais de um @
			{
				alert("\nE-mail inválido!");
				email.focus();
				return false;
			}
	   }
	   
	   	   if (assunto.value == "")
	   {
	   	    alert("\nPreencha o campo 'Assunto'");
   			assunto.focus();
			return false;
	   }
	   
	   	   if (msg.value == "")
	   {
	   	    alert("\nPreencha o campo 'Mensagem'");
   			msg.focus();
			return false;
	   }


       
	 		return true;	
    }
//-->
