function ajaxReq () {
	// Properties.
	this.requestURL;
	this.requestMethod;
	this.requestBody;
	this.responseText;
	this.callbackfunction;
	this.name;
	this.error = false;
	
	// Methods
	//this.useHttpResponse = ajaxReq_useHttpResponse;
	this.update = ajaxReq_update;
	this.XMLHTTP = ajaxReq_setRequestObject();
	//alert(typeof(this.XMLHTTP));
}
function ajaxReq_setRequestObject() {
	// Set XMLHTTP request object accordingly.

	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}
function ajaxReq_update() {
	//alert(this.requestURL);
	//top.window.sendMessageToAlertPane('Processing request...thing ' + this.name + '. readyState: ' + this.XMLHTTP.readyState);
	
	this.XMLHTTP.open(this.requestMethod, this.requestURL, true);
	
	switch (this.requestMethod.toUpperCase()) {
		case 'GET':
			this.requestBody = null;
			this.XMLHTTP.onreadystatechange = eval(this.callbackfunction);
			this.XMLHTTP.send(this.requestBody);
			break;
		case 'POST':
			//try {
				//top.window.sendMessageToAlertPane(this.name + ' readyState: ' + this.XMLHTTP.readyState);
				if ( this.XMLHTTP.readyState == 1 ) {
					this.XMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
					this.XMLHTTP.onreadystatechange = eval(this.callbackfunction);
					this.XMLHTTP.send(this.requestBody);
				}
			//}
			//catch (e) {
				//alert("Error:" + e);
				//top.window.sendMessageToAlertPane('Error setting requestHeader on ' + this.name + '. readyState: ' + this.XMLHTTP.readyState);
			//	this.error = true;
			//}
			break;
	}
	//alert(this.requestBody);
}
function ajaxReq_callback() {
	var text;
	alert(ajaxReq.XMLHTTP.readyState);
	if (ajaxReq.XMLHTTP.readyState == 4) {
		if ( ajaxReq.XMLHTTP.status == 200 ) {
			alert(ajaxReq.XMLHTTP.status);
			text = ajaxReq.XMLHTTP.responseText;
			
			return text;
			//document.getElementById("billboard").innerHTML = textout;
		}
	}
	//alert(this.responseText);
}
// Class (static) variables.
ajaxReq.REQUEST_METHOD_GET = "GET";
ajaxReq.REQUEST_METHOD_POST = "POST";