﻿
function invokeXML(url, callback)
{
    if(navigator.appName == "Microsoft Internet Explorer")
    {
	    var xhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	else
	{
        var xhttp = new XMLHttpRequest();
    }
	xhttp.open("GET", url, true);
	
	xhttp.onreadystatechange = 
	function() 
	{
		if (xhttp.readyState == 4 && xhttp.responseText) 
		{
			validateResponse(xhttp);
			callback(xhttp.responseXML);
		}
	}
	xhttp.send(null);
}

function validateResponse(xhttp)
{
	if(xhttp.status != 200)
	{
		throw "Response code of " + xhttp.status + " received from server.";
	}
}


