// JavaScript Document
try {
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e) {
    try {
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(ex) {
        try {
            ajax = new XMLHttpRequest();
        }
        catch(exc) {
            alert("Esse browser não tem recursos para uso do Ajax");
            ajax = null;
        }
    }
}

if (!ajax)  
	alert("Error initializing XMLHttpRequest!");

function newsletter(email){
	ajax.open("GET", "newsletter.php?email="+email, true);
	ajax.onreadystatechange = function() {
		if(ajax.readyState == 4 ) {
			if (ajax.status == 200) { 
				var retorno = ajax.responseText;
				document.formNews.email.value = email;
				alert(retorno);
				document.formNews.email.value = '';
			}
		}
		if(ajax.readyState == 1 ) {
		   document.formNews.email.value = 'Aguarde...';
		}
	}
	ajax.send(null);
}
