//Cadastra Email
function CadastraEmail(div) {
if(document.Newsletter.nome.value == ''){
alert("Digite seu nome!");
document.Newsletter.nome.focus();
} else if(document.Newsletter.email.value.length<5 || document.Newsletter.email.value.indexOf("@")<=0 || document.Newsletter.email.value.indexOf(".")<=0){
alert("Digite um e-mail valido");
document.Newsletter.email.focus();
} else {

document.getElementById(div).style.display = "block";
if(document.getElementById) { // Para os browsers complacentes com o DOM W3C.
var exibeResultado = document.getElementById(div); // div que exibirá o resultado.
var AjaxXx = openAjaxXx(); // Inicia o Ajax.
AjaxXx.open("POST", "_App/php/CadastraEmail.php?tipo="+document.Newsletter.tipo.value+"&nome="+document.Newsletter.nome.value+"&email="+document.Newsletter.email.value, true); // fazendo a requisição
AjaxXx.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	// Setando Content-type
//Ajax.setRequestHeader("Content-length", div.length); // Comprimento do conteúdo=comprimento dos dados a enviar
//Função carregar
AjaxXx.onreadystatechange = function(){
if(AjaxXx.readyState == 1) { // Quando estiver carregando, exibe: carregando...
exibeResultado.innerHTML = "<div><br /><br /><br />Carregando...</div>";
}
if(AjaxXx.readyState == 4) { // Quando estiver tudo pronto.
if(AjaxXx.status == 200) {
var resultado = AjaxXx.responseText; // Coloca o retornado pelo Ajax nessa variável
resultado = resultado.replace(/\+/g,""); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
//resultado = resultado.replace(/ã/g,"a");
resultado = unescape(resultado); // Resolve o problema dos acentos
exibeResultado.innerHTML = resultado;
} else {
exibeResultado.innerHTML = "Por favor, tente novamente!";
}
}
}
AjaxXx.send(null); // submete
}
}
}