function new_ajax() {
    try {
        xmlHttp = new XMLHttpRequest();
    } catch (ee) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlHttp = false;
            }
        }
    }
    return xmlHttp;
}

function ajax_get(url, objeto) {
    xmlHttp = new_ajax();
    xmlHttp.open("GET", url + "&lixo=" + new Date().getTime(), true);
    objeto.innerHTML = "Carregando..."
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200 || xmlHttp.status == 500) {
                objeto.innerHTML = xmlHttp.responseText;
            }
            else {
                objeto.innerHTML = 'Erro ' + xmlHttp.status
            }
        }
    }
    xmlHttp.send(null);
    return false
}

function ajax_post(url, objeto, param) {
    xmlHttp = new_ajax();
    xmlHttp.open("POST", url, true);
    objeto.innerHTML = "Carregando..."
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", param.length);
    xmlHttp.setRequestHeader("Connection", "close");  
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200 || xmlHttp.status == 500) {
                objeto.innerHTML = xmlHttp.responseText;
            }
            else {
                objeto.innerHTML = 'Erro ' + xmlHttp.status
            }
        }
    }
    xmlHttp.send(param);
}

function ajax_post_contato(url, objeto, param) {
    xmlHttp = new_ajax();
    xmlHttp.open("POST", url, true);
    objeto.innerHTML = "Enviando o contato.."
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", param.length);
    xmlHttp.setRequestHeader("Connection", "close");  
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200 || xmlHttp.status == 500) {
                objeto.innerHTML = xmlHttp.responseText;
				alert("Contato feito com sucesso em breve entraremos em contato.")
				document.form.reset()
            }
            else {
                objeto.innerHTML = 'Erro ' + xmlHttp.status
            }
        }
    }
    xmlHttp.send(param);
}