//codigo obtido em: http://www.jibbering.com/2002/4/httprequest.html
//Referencia do objecto: http://www.w3schools.com/xml/xml_http.asp
function Ajax() {
    this.responseHandler = null;
    this.xmlhttp = this.getXmlHttp();
}

Ajax.prototype.getXmlHttp = function() {
    if (!this.xmlhttp) {
        /*@cc_on @*/
        /*@if (@_jscript_version >= 5)
        // JScript gives us Conditional compilation, we can cope with old IE versions.
        // and security blocked creation of the objects.
        try {
            this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                this.xmlhttp = false;
            }
        }
        @end @*/
        if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
	        try {
		        this.xmlhttp = new XMLHttpRequest();
	        } catch (e) {
		        this.xmlhttp = false;
	        }
        }
        if (!this.xmlhttp && window.createRequest) {
	        try {
		        this.xmlhttp = window.createRequest();
	        } catch (e) {
		        this.xmlhttp = false;
	        }
        }
    }
    return this.xmlhttp;
}

/**
 * Executa o HTTP GET
 **/
Ajax.prototype.get = function(url, async, onResponse) {
    this.xmlhttp.open("get", url, async);
    if (typeof window.ActiveXObject != 'undefined' ) {       
       this.xmlhttp.onreadystatechange = onResponse; 
    } 
    else { 
       this.xmlhttp.onload = onResponse;
    }
    //this.xmlhttp.onreadystatechange = onResponse;
    this.xmlhttp.send(null);
}

/**
 * Executa o HTTP POST
 **/
Ajax.prototype.post = function(url, async, postData, onResponse) {
    this.xmlhttp.open("post", url, async);
    this.xmlhttp.onreadystatechange = onResponse;
    this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.xmlhttp.setRequestHeader("Content-length", postData.length);
    this.xmlhttp.setRequestHeader("Connection", "close");
    this.xmlhttp.send(postData);
}

/**
 * Executa uma chamada remota ao servidor (XML ou RPC Web Service)
 **/
Ajax.prototype.call = function(url, async, soap, onResponse) {
}