function atseg()
{
	var url = "../classes/jpgraph/src/Examples/antispamex01.php";
	ajaxSeg(url);	
}
function Validaemail(email){

	var BadChars = "*|,\":<>[]{}`\'';()&$#% ";
	var GoodChars = "@."; 
	var posarroba = email.indexOf ('@',0);

	if (email.length == 0){
		alert('O campo E-mail deve ser preenchido.');
		return false;
	}
	if (email.length < 6) { // o email é menor que 6 caracteres
		alert("\"E-mail\" inválido!"); 
		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!");
			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!");
				return false;
		}
		if (email.indexOf(GoodChars.charAt(i),0) == 0) { // começou com goodchars (. ou @)
			alert("\"E-mail\" inválido!");
			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 @.");
			return false;
		}
	}
	if (email.lastIndexOf('@') > email.lastIndexOf('.')) { //Não tem ponto depois do arroba
		alert("\"E-mail\" inválido!");
		return false;
	}

	if (email.indexOf ('@.',0) != -1 || email.indexOf ('.@',0) != -1) { // . e @ colados
		alert("\"E-mail\" inválido!");
		return false;
	}
	if (email.indexOf ('@',posarroba+1) != -1) { // Contém mais de um " @ " 
		alert("\"E-mail\" inválido!");
		return false;
	}
	
	return true; // Retorna verdadeiro se o e-mail é válido.
}

function valida(){
	
	var nome = document.getElementById("nome").value;
	var telefone = document.getElementById("telefone").value;
	var email = document.getElementById("email").value;
	var codigo = document.getElementById("codigo").value;
	if(nome == ""){
	alert("Por favor preencha o campo Nome!");
	return false;
	}else if(email== ""){
		alert("Por favor preencha o campo Email!");
	return false;
	}
	else if(telefone == ""){
	alert("Por favor preencha o campo Telefone!");
	return false;
	}	
	else if(codigo.length < 4){
		alert("Por favor preencha o campo Codigo corretamente!");
			document.getElementById("codigo").style.border = "1px #ff0000 solid";
			return false;
	}		
	else if(email != ""){
		if(Validaemail(email) == false){
			return false;
			}
		
		}
}