var READY_STATE_UNITIALIZED=0;
var READY_STATE_LOADING=1;
var READY_STATE_LOADED=2;
var READY_STATE_INTERACTIVE=3;
var READY_STATE_COMPLETE=4;
function ajax( ) {
var me = this;
var req = null;
if (window.XMLHttpRequest) {
try {
req = new XMLHttpRequest( );
} catch(e) {
req = null;
}
} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = null;
alert('esta nulo');
}
}
} 
this.request = req;
this.carregarArquivo = function(url,loadHandler,parametro) {
if (this.request) {
this.request.open("GET", url, true);
this.request.onreadystatechange = function(){loadHandler(me,parametro)};
//this.request.setRequestHeader("Content-Type", "text/xml");
this.request.send("");
}  
};
this.carregarArquivoPost = function(url,param,loadHandler,parametro) {
    if (this.request) {
        this.request.open("POST", url, true);
        this.request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        this.request.onreadystatechange = function(){loadHandler(me,parametro)};
        this.request.send(param);
    }
};

this.carregarArquivoTravar = function(url) {
    if (this.request) {
        this.request.open("GET", url, false);
        this.request.send(null);
        return this.request.responseText;
    }
};

this.carregarArquivoTravarPost = function(url) {
    if (this.request) {
        this.request.open("POST", url, false);
        this.request.send(null);
        return this.request.responseText;
    }
};

this.carregarArquivoAssinPost = function(url,param) {
    if (this.request) {
        this.request.open("POST", url, false);
		this.request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        this.request.send(param);
        return this.request.responseText;
    }
};

}

