AjaxUtil = function() {
	this.xmlHttpReq = null;
	this.loading = false;

	this.query = function(url, qry, onUpdate) {
		// Mozilla/Safari/IE7+
		if (window.XMLHttpRequest) {
			this.xmlHttpReq = new XMLHttpRequest();
			if (this.xmlHttpReq.overrideMimeType) {
				this.xmlHttpReq.overrideMimeType("text/xml");
			}
		}
		// IE6 y anteriores
		else if (window.ActiveXObject) {
			this.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
	
		var self = this;
		this.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				self.loading = false; 
				onUpdate(self.xmlHttpReq);
			}
		}
		
		this.loading = true;

		this.xmlHttpReq.open('POST', url, true);
		this.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		this.xmlHttpReq.send(qry);
	}
  
	this.abort = function() {
		this.xmlHttpReq.abort();
	}
}

