function xmlLoad(url)
{
	var xmldoc = newDocument();
	xmldoc.async = false;  
	xmldoc.load(url);
	return xmldoc;  
};


function newDocument(rootTagName, namespaceURL)
{
	if (!rootTagName) rootTagName = "";
	if (!namespaceURL) namespaceURL = "";

	if (document.implementation && document.implementation.createDocument) 
	{
		// This is the W3C standard way to do it
		return document.implementation.createDocument(namespaceURL, rootTagName, null);
	}
	else 
	{ 
		// This is the IE way to do it
		// Create an empty document as an ActiveX object
		// If there is no root element, this is all we have to do
		var doc = new ActiveXObject("MSXML2.DOMDocument");

		// If there is a root tag, initialize the document
		if (rootTagName) 
		{
			// Look for a namespace prefix
			var prefix = "";
			var tagname = rootTagName;
			var p = rootTagName.indexOf(':');
			if (p != -1) 
			{
				prefix = rootTagName.substring(0, p);
				tagname = rootTagName.substring(p+1);
			}

			// If we have a namespace, we must have a namespace prefix
			// If we don't have a namespace, we discard any prefix
			if (namespaceURL) 
			{
				if (!prefix) prefix = "a0"; // What Firefox uses
			}
			else prefix = "";

			// Create the root element (with optional namespace) as a
			// string of text
			var text = "<" + (prefix?(prefix+":"):"") + tagname + (namespaceURL ?(" xmlns:" + prefix + '="' + namespaceURL +'"') :"") + "/>";
			// And parse that text into the empty document
			doc.loadXML(text);
		}
	return doc;
	}
}

function makeHttpRequest(url, callback_function, return_xml) 
{ 
 var http_request, response, i; 

 var activex_ids = [ 
   'MSXML2.XMLHTTP.3.0', 
   'MSXML2.XMLHTTP', 
   'Microsoft.XMLHTTP' 
 ]; 

 if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+... 
   http_request = new XMLHttpRequest(); 
   if (http_request.overrideMimeType) { 
     http_request.overrideMimeType('text/xml'); 
   } 
 } else if (window.ActiveXObject) { // IE6 and older 
   for (i = 0; i < activex_ids.length; i++) { 
     try { 
       http_request = new ActiveXObject(activex_ids[i]); 
     } catch (e) {} 
   } 
 } 

 if (!http_request) { 
   alert('Unfortunately your browser doesn’t support this feature.'); 
   return false; 
 } 

 http_request.onreadystatechange = function() { 
   if (http_request.readyState !== 4) { 
       // not ready yet 
       return; 
   } 
   if (http_request.status !== 200) { 
     // ready, but not OK 
     alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
     return; 
   } 
   if (return_xml) { 
     response = http_request.responseXML; 
   } else { 
     response = http_request.responseText; 
   } 
   // invoke the callback 
   callback_function(response); 
 }; 

 http_request.open("GET", url, true); 
 http_request.send(null); 
}

