var jsonContent;

function xmlHttpReq() {
	var myObject;
	if(typeof(XMLHttpRequest)!='undefined') {/*Firefox, Opera, Safari, IE7*/
			myObject = new XMLHttpRequest();
	}
	else {
		var activeXObjects = ['Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'];
		for(var i=0; i<activeXObjects.length; i++) {
			try {
				myObject =  new ActiveXObject(activeXObjects[i]);
			}
			catch(err){}
			}
	}
	/*There is something with the way Firfox parse the alias "this" for the xmlhttprequest object.
	See also here: https://bugzilla.mozilla.org/show_bug.cgi?id=198595 */
	return myObject;
}

function getJsonData(theUrl,theSync) {
	var oXml = new xmlHttpReq();
	oXml.open('GET',theUrl,theSync);
	/*
   * I pass "false" to get a synchronic comm.
   * The script should pause until readystate is 4,
   * because I pass the xml content to another function (theOutput = xmlhttp.responseText;)
   * and it should arrive to it for sure, before the script can go on.
   */
	oXml.onreadystatechange = function() {
		if(oXml.readyState != 4) {
			return;
		}
		else {
			try {
			jsonContent = eval('(' + oXml.responseText + ')');
			}
			catch (e) {
				return false;
			}
			isLoadedData = true;
		}
	};
	oXml.send(null);
}