function XMLfromString(str)
{
   if(typeof(ActiveXObject) != 'undefined')
   {
      var xmldata = new ActiveXObject('MSXML.DomDocument');
      xmldata.async = false;
      xmldata.loadXML(str);
      return xmldata;
   }
   else if(typeof(XMLHttpRequest) != 'undefined')
   {
		var parser=new DOMParser();
		var xmldata = parser.parseFromString(str,"text/xml");
	   return xmldata;
	}
}

function getXMLHttp()
{
	var xmlhttp = null;
	if (window.ActiveXObject)
	{
		if (navigator.userAgent.toLowerCase().indexOf("msie 5") != -1)
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined')
	{
		xmlhttp = new XMLHttpRequest()
	}
	return xmlhttp
} 

function executeCallback(callbackString)
{
	if(callbackString.indexOf('(')==-1) {
		callbackString = callbackString + '()';
	}
	try{
		eval(callbackString);
	}catch(e){

	}	
}

function loadContent(div_id,content_url, callback)
{
	var http = getXMLHttp();
	http.open("GET", content_url, true);
	http.onreadystatechange= function() {
		if(http.readyState==4)
		{
			document.getElementById(div_id).innerHTML = http.responseText;
			if(callback)
			{
				executeCallback(callback);
			}
		}
	}
	http.send(null);
}


