/* © 2008 Landon Springer
//////
USAGE:
new AJAXObj( file to load , query parameters for loaded file , function reference to call onsuccess )

//////
MISC.:
-window.AJAX_BUFFER_FUNC will be called after this file has loaded, if it exists
-variable AJAX_INCLUDED is so that other files can reference this one, and know that it is loaded

*/
var AJAX_INCLUDED = true;
function AJAXObj(src,qString,callback) {
	this.x = false;
	if(window.XMLHttpRequest) this.x = new XMLHttpRequest();
	if(window.ActiveXObject && !this.x) this.x = new ActiveXObject("Microsoft.XMLHTTP");
	if(window.createRequest && !this.x) this.x = window.createRequest();
	if(!this.x) {
		alert("AJAX Failed to Initialize!");
	} else {
		this.toCall = callback;
		this.readyStateCB = function(e) {
			if(typeof(this) != "function") {
				if(this.readyState==4) {
					this.par.toCall(this);
				}
			} else {
				if(this.par.x.readyState==4) {
					this.par.toCall(this.par.x);
				}
			}
			delete this;
		};
		this.readyStateCB.par = this;
		this.x.par = this;
		d = new Date().getTime();
		this.x.open("GET",src+"?"+qString+"&nocache="+d,true);
		this.x.onreadystatechange = this.readyStateCB;
		this.x.send(null);
	}
	return this;
}
if(typeof(window.AJAX_BUFFER_FUNC) == "function") window.AJAX_BUFFER_FUNC();
