// This function makes the http request AND handles the return.
// url: file to be called
// callback_function: function which handles the return value of the http_request
// target: target div for output
// return_xml: set to true if output is xml
function makeHttpRequest(url, callback_function, target, return_xml)
{
	 /**
		*	Description: This function makes a http request to the specified URL. Callback function handles the output & target specifies the target in the DOM
		*
		*	Called By: Misc; Anywhere there is a need for an Ajax call
		* Actions: Makes http request to specified url, the call the callback function with the return info from the http request and the target.
		*
	 */
	 var http_request = false;


	 if (window.XMLHttpRequest) { // Mozilla, Safari,...
			 http_request = new XMLHttpRequest();
			 // Not sure what this does.. but does generate all those 'junk after document errors..
			 //if (http_request.overrideMimeType) {
			//		 http_request.overrideMimeType('text/xml [15]');
			 //}
	 } else if (window.ActiveXObject) { // IE
			 try {
					 http_request = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e) {
					 try {
							 http_request = new ActiveXObject("Microsoft.XMLHTTP");
					 } catch (e) {}
			 }
	 }

	 if (!http_request) {
			 alert('Unfortunatelly you browser doesn\'t support this feature.');
			 return false;
	 }
	 http_request.onreadystatechange = function() {
			//alert(http_request.readyState);
			if (http_request.readyState == 4) {
				if (http_request.status == 200) {
				//alert(http_request.getAllResponseHeaders())
					if (return_xml) {
						var xml = http_request.responseXML;
						eval(callback_function + '(xml, target)');
					} else {
						var text = http_request.responseText;
						eval(callback_function + '(text, target)');
					}
				} else {
					alert('There was a problem with the request.(Code: ' + http_request.status + ')');
				}
			}
	 }
	
	 http_request.open('GET', url, true);
	 http_request.send(null);
}