var useAJXns;

if (useAJXns) {
	if (typeof(ajx) == "undefined") {
		ajx = {}
	}
	_ajx = ajx;
} else {
	_ajx = this;
}

// AJAX PROTOTYPE

if (typeof(_ajx.Ajax) == "undefined") {
	_ajx.Ajax = {}
}

_ajx.Ajax = function () {
	this.req = {};
	this.isIE = false;
}

_ajx.Ajax.prototype.makeRequest = function (url, meth, onComp, onErr) {

	if (meth != "POST") {
		meth = "GET";
	}

	this.onComplete = onComp;
	this.onError = onErr;

	var pointer = this;

//	branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		this.req = new XMLHttpRequest();

		if (this.req.overrideMimeType) {
      		this.req.overrideMimeType('text/xml');
    	}

		this.req.onreadystatechange = function () { pointer.processReqChange() };
		this.req.open(meth, url, true);
		this.req.send(null);
	} else if (window.ActiveXObject) {
//		branch for IE/Windows ActiveX version
		this.req = new ActiveXObject("Microsoft.XMLHTTP");

		if (this.req) {
			if (this.req.overrideMimeType) {
	      		this.req.overrideMimeType('text/xml');
	    	}
			this.req.onreadystatechange = function () { pointer.processReqChange() };
			this.req.open(meth, url, true);
			this.req.send();
		}
	}
}

_ajx.Ajax.prototype.processReqChange = function() {
	// only if req shows "loaded"
	if (this.req.readyState == 4) {
		// only if "OK"
		if (this.req.status == 200) {
			this.onComplete( this.req );
		} else {
			this.onError( this.req.status );
		}
	}
}
