
var xmlhttp_ctt = null;
function ajaxEmailContato(url)
{ 
//INICIALIZA O OBJETO QUE IRA FAZER AS SOLICITACOES
try{
    xmlhttp_ctt = new XMLHttpRequest();// Mozilla, Safari, Firefox, etc...
    try {
        if (xmlhttp_ctt.overrideMimeType) {
            //Se possível, ignora cabecalho usado pelo servidor e forca o padrao "text/xml". Alguns navegadores exigem esse padrao e pode dar erro se o servidor nao utilizar ele
            xmlhttp_ctt.overrideMimeType('text/xml');
        }
    } catch (e1) { }
}catch(e2){
    try{
        xmlhttp_ctt = new ActiveXObject("Msxml2.XMLHTTP");// Internet Explorer
    }catch(e3){
        try{
            xmlhttp_ctt = new ActiveXObject("Microsoft.XMLHTTP");// Internet Explorer
        }catch(e4){
            //tratamento para alguma outra forma de implementar XMLHTTP
            xmlhttp_ctt = false;
        }
    }
}
if (!xmlhttp_ctt){
    //Nao conseguiu instanciar o objeto xmlhttp para fazer as solicitacoes
    alert("AJAX error. Your browser must support XMLHttpRequest object or enable use of scripting.");
} 

xmlhttp_ctt.onreadystatechange = processEmailContato;
xmlhttp_ctt.open("GET",url,true);
xmlhttp_ctt.send(null);
}


function processEmailContato()
{ 
// apenas quando o estado for "completado"
if (xmlhttp_ctt.readyState == 4) {
// apenas se o servidor retornar "OK"
if (xmlhttp_ctt.status ==200) { 
var str = xmlhttp_ctt.responseText;
// procura pela div id="pagina" e insere o conteudo
// retornado nela, como texto HTML
//alert('E-mail cadastrado com sucesso.');
} else {
  alert("Houve um problema ao obter os dados. Motivo :" + xmlhttp_ctt.statusText);
}
}
}
