// JavaScript Document
var xmlHttp;
var id;

function linkme(link_url,divid)
{
	var url = link_url;
	id = divid;

	var date = new Date();
	var timestamp = date.getTime();

	if(link_url.indexOf("?")==-1){
		rantext = "?time=" + timestamp;
	}else{
		rantext = "&time=" + timestamp;
	}
		
	xmlHttp=GetXmlHttpObject(linkstateChanged);	
	xmlHttp.open("GET", link_url + rantext, true);
	xmlHttp.send(null);
}

function linkstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
	document.getElementById(id).innerHTML=xmlHttp.responseText ;
} 
}

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null;

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") ;
return ;
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP";
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP";
} 
try
{ 
objXmlHttp=new ActiveXObject(strName);
objXmlHttp.onreadystatechange=handler ;
return objXmlHttp;
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled");
return;
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest();
objXmlHttp.onload=handler;
objXmlHttp.onerror=handler;
return objXmlHttp;
}
} 

function switch_display(){
	if(document.getElementById('display').value == 'Show Info'){
		document.getElementById('tbl_info').style.display = 'block';
		document.getElementById('tbl_stats').style.display = 'none';
		document.getElementById('display').value = 'Show Stats';
	}
	else{
		document.getElementById('tbl_info').style.display = 'none';
		document.getElementById('tbl_stats').style.display = 'block';
		document.getElementById('display').value = 'Show Info';
	}
}


function ajax_post(url, params, divid)
  {
  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.open("POST",url,true);
    
    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
       	 	if(xmlHttp.responseText != ""){
       	 		// return value: xmlHttp.responseText
       	 		if(divid.length>0)
       	 			document.getElementById(divid).innerHTML=xmlHttp.responseText ;
       	 	}
        }
      }
      
    xmlHttp.send(params);
  }
  
  function ajax_eval(url)
  {
  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)
        {
       	 	if(xmlHttp.responseText != ""){
 					eval(xmlHttp.responseText);
       	 	}
        }
      }
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
  
  
  

