//this page is the core xmlhttp communication, generic for anywhere.
//<SCRIPT LANGUAGE="JAVASCRIPT">

var LoadType = {
	USER: 1,
	MEMBER: 2
}
XmlHttp.methods = {
	GET: "GET",
	POST: "POST"
}
var _tmp;


function XmlHttp(method, page, async, callback, params) {
	if (method == XmlHttp.methods.GET || method == XmlHttp.methods.POST) {
		this.xmlhttp = (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest());
		this.method = method;
		this.page = page;
		this.async = async;
		this.params = params;
		if (this.async) {
			this.xmlhttp.onreadystatechange = this.stateChange;
		}
		this.callback = callback;
	} else {
		alert("Error: method var didn't use the XmlHttp.methods enum.");
	}
}

XmlHttp.prototype.stateChange = function() {
	if (_tmp.xmlhttp.readyState == 4) {
		_tmp.callback((_tmp.xmlhttp.status == 200 ? _tmp.xmlhttp.responseText : _tmp.xmlhttp.status+"\n"+_tmp.xmlhttp.statusText), _tmp.params);
	}
};
XmlHttp.prototype.send = function(glob) {
	if (this.async && !this.callback) {
		alert("Error: Async and no callback function.");
	} else {
		_tmp = this;
		this.xmlhttp.open(this.method, this.page, this.async);
		if (this.async) {
			this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			this.xmlhttp.setRequestHeader("Content-length", (glob ? glob.length : 0));
			this.xmlhttp.setRequestHeader("Connection", "close");
		}
		this.xmlhttp.send(glob);
		if (!this.async)	{
			return (this.xmlhttp.responseText);
		}
	}
};

//END xmlHTTP functions
//</SCRIPT>