// utilities-httprequest.js
	
// initialize the callback and request objects to false
var callbackObj = false;
var requestObj = false;

function HttpRequest (aCallbackObj) {
		
	// set the callback property
	callbackObj = aCallbackObj;
	
	// check for native versus activex XMLHttpRequest objects
	if (window.XMLHttpRequest && !(window.ActiveXObject)) {
		
		// try to create a native XMLHttpRequest object
		try { 
			requestObj = new XMLHttpRequest(); 
		} catch (aError) { 
			requestObj = false; 
		}
		
	} else if (window.ActiveXObject) {
		
		// try to create an activex XMLHttpRequest object
		try { 
			requestObj = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (aError) {
			try {
				requestObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (aError) {
				requestObj = false;
			}
		}
		
	}
	
}

HttpRequest.prototype.GetURL = function (aURL) {
	
	// verify that we have a request object present
	if (requestObj) {
		
		// get the specific URL
		requestObj.open("GET", aURL, true);
		
		// specify the state change callback function
		requestObj.onreadystatechange = this.StateChangeCallback;
  
  		// send the http request
		requestObj.send(null);
		
	}
	
}

HttpRequest.prototype.StateChangeCallback = function () {
	
	// monitor the readyState property for completion
	if (requestObj.readyState == 4) {
		
		// verify that the get was error free
		if (requestObj.status == 200) {
			
			// pass the response text to the callback function
			callbackObj.HttpCallback(requestObj.responseText);
			
		}
		
	}
	
}