// JavaScript Document
document.write("<div id='widget_content'>");
document.write("</div>");
var xmlhttp;
var load_msg = false;

function GetXmlHttpObject() {
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject) {
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function retrieveNews() {
//alert('in side retrieveNews()');
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	var url="/proxy_server.php";
	url=url+"?app_path="+app_path+args;
//alert('calling: '+url);
	xmlhttp.onreadystatechange=displayHTML;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function displayHTML() {
//alert('in side displayNews()');
	if (xmlhttp.readyState==4) {
		if(xmlhttp.status!=200) {
			document.getElementById("widget_content").innerHTML = "Problem retrieving data: "+xmlhttp.status;
			return;
		}
//alert(xmlhttp.responseText);
		document.getElementById("widget_content").innerHTML = xmlhttp.responseText;
	} else {
		if (!load_msg) {
			document.getElementById("widget_content").innerHTML = '<span style="font-weight:bold">Working, please wait.....</span>'; 
		} else {
			load_msg = true;
		}
	}
}
//alert('about to call retrieveNews()');
retrieveNews();