// JavaScript Document
function downloadText(url, callbackFunction) {
   var xmlhttp = false;
   if(window.ActiveXObject) {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")}
   else if(window.ActiveXObject) {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")}
   else if(window.XMLHttpRequest) {
	  xmlhttp = new XMLHttpRequest()}
   if(xmlhttp) {
      xmlhttp.open("GET", url);
      xmlhttp.onreadystatechange = function() {
         if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            callbackFunction(xmlhttp.responseText);
            delete xmlhttp;
            xmlhttp = null;
            }
         }
      xmlhttp.send(null);
      }
   }

downloadText("data/news/news.php?s=2&date=false&q="+Math.random(),displayNews);


function displayNews(html){
	var pageId = "sidebar"; 
	var pageLoader = document.getElementById("pgLoader");
	var htmlText;
	if(!html || html=="" || html == null){
		htmlText="<div id='errorMSG' class='hm_msg'><span>Sorry!</span><br /> An error occurred while <br />loading this content.<br /> Please click <a href=''>here</a> to refresh<br />this page.</div>";
		}else{htmlText=html}
	var div = document.createElement("div");
	div.innerHTML=htmlText;
	document.getElementById(pageId).removeChild(pageLoader);
	document.getElementById(pageId).appendChild(div);
	}


