//Recebe valores e chama a função LOAD
function xmlObj(args) {
	this._args = args;
	this.load();
}

//Carrega página
xmlObj.prototype.load = function() {
	this._request = this._getXMLHTTPRequest();
	var _this = this;
	this._request.onreadystatechange = function(){_this._onData()};
	//Vamos abrir a criança!
	this._request.open("GET",this._args.url, true);
	this._request.send(null);
}


xmlObj.prototype._onData = function() {
	//Verifica Status.. se = 4(ultimo estagio) continua
	if(this._request.readyState == 4) {
		//O IE as vezes deixa prosseguir msm não tendo chegado ao 4 estagio... então verifica se esta = a 200 .. que é a msm merda
		if(this._request.status == "200") {
			var obj = this._args.obj;
			var func = this._args.func;
			var args = this._args.args;
			args.response = this._request.responseXML;
			args.responseText = this._request.responseText;
			obj[func](args);
		}
		//Deu merda ... deleta request
		delete this._request;
	}
}

xmlObj.prototype._getXMLHTTPRequest = function(){
	var xmlHttp;
	//Por conta de versao de browser... Melhor tentar os dois ActiveX
	try	{
		xmlHttp = new ActiveXObject("Msxml2.XMLHttp");
	} catch(e) {
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
		} catch(e2) {}
	}
	if(xmlHttp == undefined && (typeof XMLHttpRequest != 'undefined')) {
		xmlHttp = new XMLHttpRequest();
	}
	//retorna xmlHttp com o ActiveX a ser usado
	return xmlHttp;
}
