var xmlhttp;

function loadNews(id,pNo,S){
	url = "news_view.php?id="+id+"&page="+pNo+"&s="+S+"&c="+Math.random();
	
	xmlhttp=null;
	var b = 1;
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	  {
	  xmlhttp=new XMLHttpRequest();	  
	  }
	// code for IE
	else if (window.ActiveXObject)
	  {
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	  
	  }
	if (xmlhttp!=null)
	  {	  
	  xmlhttp.onreadystatechange=state_Change;
	  xmlhttp.open("GET",url,true);
	  xmlhttp.send(null);
	  }
	else
	  {
	  alert("Your browser does not support XMLHTTP.")
	  }
}

function loadHeadlines(){
	url = "news_head_view.php?"+"&c="+Math.random();
	
	xmlhttp=null;
	var b = 1;
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	  {
	  xmlhttp=new XMLHttpRequest();	  
	  }
	// code for IE
	else if (window.ActiveXObject)
	  {
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	  
	  }
	if (xmlhttp!=null)
	  {	  
	  xmlhttp.onreadystatechange=state_Change;
	  xmlhttp.open("GET",url,true);
	  xmlhttp.send(null);
	  }
	else
	  {
	  alert("Your browser does not support XMLHTTP.")
	  }
}

function state_Change(){
	
	var content = document.getElementById('contentX');
	var isIE = false;
	var ua = navigator.userAgent;	
	var s = "MSIE";	
		
	// Checking for IE Version
	if (ua.indexOf(s)>0) {
    	isIE = true;		
	}	
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4){
		// if "OK"
		if (xmlhttp.status==200){
			content.style.display = 'block';				
			content.innerHTML=xmlhttp.responseText;
		}
		else{
			alert("Problem retrieving Data:" + xmlhttp.statusText);
			content.style.display = 'none';
		}		
	}
	else{		
		content.style.display = 'block';
		content.innerHTML='<center><br><img src="images/loading.gif"><br><br></center>';
	}
	
	//document.onmousedown = XYpos;
	//content.style.top = event.screenX+" px";
	//content.style.left = tempX+" px";
}

function feature_close(){
	document.getElementById('contentX').style.display = 'none';	
}

function XYpos(e) {
	if (!e) var e = window.event;
	var content = document.getElementById('contentX');
	xPos = event.clientX;
	yPos = event.clientY;
	content.style.top = yPos + document.body.scrollTop + 'px';
	content.style.left = xPos + document.body.scrollLeft + 'px';
	//alert(xPos + " left " + yPos + " down")

}
