HZAjax = function(url, func) {
	this.url_ = url;
	this.func_ = func;
	this.LOADED = false;
	this.params = null;
	this.requestType = "GET";
	this.xmlhttp = null;
	this.async = true;
	this.aborted = false;
}

HZAjax.prototype.setParams = function(s) {
	this.params = s;
}

HZAjax.prototype.setRequestType = function(type) {
	this.requestType = type;
}

HZAjax.prototype.send = function() {
	this.xmlhttp=null;

	if (window.ActiveXObject) {
		// code for IE
		this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	} else if (window.XMLHttpRequest) {
		// code for Mozilla, etc.
		this.xmlhttp=new XMLHttpRequest();
	} 
	
	if (this.xmlhttp!=null) {
		if (this.func_ != null) {
			this.xmlhttp.onreadystatechange = this.func_;
		}
		this.xmlhttp.open(this.requestType,this.url_,this.async);

		if (this.params) {
		 	this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			this.xmlhttp.setRequestHeader("Content-length", this.params.length);
			this.xmlhttp.setRequestHeader("Connection", "close");
		}
		this.xmlhttp.send(this.params);
	} else {
		alert("Your browser does not support XMLHTTP.");
	}
}

HZAjax.prototype.abort = function() {
	this.xmlhttp.abort();
}

HZAjax.prototype.checkReadyState = function() {
	if (this.aborted) return false;
	try {
		if(this.xmlhttp.readyState == 4) {
			if(this.xmlhttp.status == 200) {
	    			return true;
			} else {
				alert("Problem retrieving XML data: status->" + this.xmlhttp);
			}
	  	}
	} catch(e) {
	}
}


