function ajax(url,callbackFunction)
{
	this.bindFunction = function (caller, object) {
		return function() {
			return caller.apply(object, new Array(object));
		}
	}

	this.stateChange = function (object) {
		if (this.request.readyState==4) {
			this.callbackFunction(this.request.responseText);
		}
	}

	this.getRequest = function() {
		if (window.ActiveXObject)
			return new ActiveXObject('Microsoft.XMLHTTP');
		else if (window.XMLHttpRequest)
			return new XMLHttpRequest();
		else
			return false;
	}

	if (arguments[2])
		this.postBody = arguments[2];
	else 
		this.postBody="";

	this.callbackFunction=callbackFunction;
	this.url=url;	
	this.request = this.getRequest();

	if(this.request) {
		this.request.onreadystatechange = this.bindFunction(this.stateChange, this);

		if (this.postBody!="") {
			this.request.open("POST", url, true);
			this.request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			this.request.setRequestHeader('Connection', 'close');
		} else {
			this.request.open("GET", url, true);
		}

		this.request.send(this.postBody);
	}
}


