function getLatest(url, tblID) {
	
	var xmlHttp;
	try
	{
		/* Firefox, Opera 8.0+, Safari */
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		/* Internet Explorer */
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==4)
		{
			var kickOut = xmlHttp.responseText;
			if( kickOut != undefined )
			{
				eval( kickOut );
				for(i=0;i<ajaxOut.length;i++){
					addRowToTable(tblID,ajaxOut[i][0],ajaxOut[i][1],ajaxOut[i][2],ajaxOut[i][3],ajaxOut[i][4]);
				}
			}
			var d = new Date();

			var curr_hour = d.getHours();
			var curr_min = d.getMinutes();

		}
		document.getElementById('timeout').innerHTML="<b style='color: orange;'>Latest Updated: "+curr_hour+":"+curr_min+"</b>";
    }
	var postid = document.getElementById("lastID").value;
	xmlHttp.open("GET",url+postid,true);
	xmlHttp.send(null);
}
function addRowToTable(tblID,firstCol,secondCol,thirdCol,postID,timeOut)
{
  var tbl = document.getElementById(tblID);
  var colVals = new Array(firstCol,secondCol,thirdCol);
  var row = tbl.insertRow(1);
  for (i=0;i<3;i++){
	  var cell = row.insertCell(i);
	  if( i == 0 )
		  cell.setAttribute('style','background-color: #585758; border-bottom: 1px solid #565757;');
	  else
		  cell.setAttribute('style','background-color: #585758; text-align: center; border-bottom: 1px solid #565757; border-left: 1px solid #565757;');
	  cell.innerHTML = colVals[i];
  }
  document.getElementById("lastID").value=postID;
  document.getElementById("newCount").value = parseInt(document.getElementById("newCount").value) + 1;
  document.getElementById('newout').innerHTML="<b style='color:#76c96e;'>"+document.getElementById("newCount").value+" new posts since last refresh.</b>";
}
