function getInterIndex()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	    document.getElementById("indexinter").innerHTML=xmlhttp.responseText;
	    }
	  }
	xmlhttp.open("GET","get-index.php?t="+ Math.random(),true);
	xmlhttp.send();
}

function getLocalIndex()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp2=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp2=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp2.onreadystatechange=function()
	  {
	  if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
	    {
	    document.getElementById("indexlocal").innerHTML=xmlhttp2.responseText;
	    }
	  }
	xmlhttp2.open("GET","get-local-index.php?t="+ Math.random(),true);
	xmlhttp2.send();
}

function getTopGainers()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp3=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp3=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp3.onreadystatechange=function()
	  {
	  if (xmlhttp3.readyState==4 && xmlhttp3.status==200)
	    {
	    document.getElementById("topgainers").innerHTML=xmlhttp3.responseText;
	    }
	  }
	xmlhttp3.open("GET","get-top-gainers.php?t="+ Math.random(),true);
	xmlhttp3.send();
}

function getMostActive(sector)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp4=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp4=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp4.onreadystatechange=function()
	  {
	  if (xmlhttp4.readyState==4 && xmlhttp4.status==200)
	    {
	    document.getElementById("most_active").innerHTML=xmlhttp4.responseText;
	    }
	  else { document.getElementById("most_active").innerHTML="<img src=\"images/remembermilk_orange.gif\" /> loading..."; }
	  }
	xmlhttp4.open("GET","get-most-active.php?sector="+ sector + "&" + Math.random(),true);
	xmlhttp4.send();
}

function getNews()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp5=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp5=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp5.onreadystatechange=function()
	  {
	  if (xmlhttp5.readyState==4 && xmlhttp5.status==200)
	    {
	    document.getElementById("malaysia_news").innerHTML=xmlhttp5.responseText;
	    }
	  else { document.getElementById("malaysia_news").innerHTML="<img src=\"images/remembermilk_orange.gif\" /> loading..."; }
	  }
	xmlhttp5.open("GET","get-news.php?t="+ Math.random(),true);
	xmlhttp5.send();
}

function getStockQuote(stock_quote)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp6=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp6=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp6.onreadystatechange=function()
	  {
	  if (xmlhttp6.readyState==4 && xmlhttp6.status==200)
	    {
	    document.getElementById("content").innerHTML=xmlhttp6.responseText;
	    }
	  else { document.getElementById("content").innerHTML="Searching... <img src=\"images/remembermilk_orange.gif\" />"; }
	  }
	xmlhttp6.open("GET","get-stock-quote.php?search_str="+ stock_quote + "&" + Math.random(),true);
	xmlhttp6.send();
}

function getMainMostActive()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp7=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp7=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp7.onreadystatechange=function()
	  {
	  if (xmlhttp7.readyState==4 && xmlhttp7.status==200)
	    {
	    document.getElementById("most_active").innerHTML=xmlhttp7.responseText;
	    }
	  else { document.getElementById("most_active").innerHTML="<img src=\"images/remembermilk_orange.gif\" /> loading..."; }
	  }
	xmlhttp7.open("GET","get-main-most-active.php?t="+ Math.random(),true);
	xmlhttp7.send();
}

function getEod(stock_name,counter,from_date,to_date)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp8=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp8=new ActiveXObject("Microsoft.XMLHttp");
	  }
	xmlhttp8.onreadystatechange=function()
	  {
	  if (xmlhttp8.readyState==4 && xmlhttp8.status==200)
	    {
	    document.getElementById("display_eod").innerHTML=xmlhttp8.responseText;
	    }
	  else { document.getElementById("display_eod").innerHTML="Fetching and calculating data <img src=\"images/remembermilk_orange.gif\" />"; }
	  }
	  
	xmlhttp8.open("POST","get-eod.php",true);
	xmlhttp8.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp8.send("stock_name="+stock_name+"&counter="+counter+"&from_date="+from_date+"&to_date="+to_date);
	//xmlhttp8.send(counter, from_date, to_date);
}
