function valida(obj){ 
if(obj.nome.value==''){ 
alert('Favor preencher o campo NOME'); 
obj.nome.focus(); 
retorna(obj); 
return false; 
} 
if(obj.fone.value==''){ 
alert('Favor preencher o campo TELEFONE'); 
obj.fone.focus(); 
retorna(obj); 
return false; 
} 
var email = obj.email.value; 
var BadChars = "*|,\":<>[]{}`\'';()&$#% "; 
var GoodChars = "@."; 
var posarroba = email.indexOf ('@',0); 
if (email.length < 6) // o email é menor que 6 caracteres 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
for (var i = 0; i < email.length; i++) 
{ 
if (BadChars.indexOf(email.charAt(i)) != -1) // Contém caracteres inválidos, badchars 
{ 
alert("Seu \"E-mail\" contém caracteres inválidos!"); 
obj.email.value = ''; 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
} 
for (var i = 0; i < GoodChars.length; i++) 
{ 
if (email.indexOf(GoodChars.charAt(i)) == -1) // não tem goodchars 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
if (email.indexOf(GoodChars.charAt(i),0) == 0) // começou com goodchars (. ou @) 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
if (email.lastIndexOf(GoodChars.charAt(i)) > email.length-3) //existe menos de 2 caracteres depois do ultimo goodchar 
{ 
alert("\"E-mail\" inválido! Seu e-mail não deve terminar com @."); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
} 
if (email.lastIndexOf('@') > email.lastIndexOf('.')) //Não tem ponto depois do arroba 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 

if (email.indexOf ('@.',0) != -1 || email.indexOf ('.@',0) != -1) // . e @ colados 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
if (email.indexOf ('@',posarroba+1) != -1) // Contém mais de um " @ " 
{ 
alert("\"E-mail\" inválido!"); 
obj.email.focus(); 
retorna(obj); 
return false; 
} 
if(form.emailconfirm.value != document.form.email.value )
	{
		alert("O seu e-mail está diferente. Digite novamente, por favor!");
		document.form.email.focus();
return false; 
}
}
function retorna(obj){ 
obj.Submit.disabled=false; 
obj.Submit.value='Enviar'; 
} 

