// JavaScript Document
var time_variable;
function getXMLObject()  //XML OBJECT
{
   
   var xmlHttp = false;
   try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) {
     try {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object

function showFunction(id) {
	var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
	var sendstr;
		sendstr="get_descrip.php?id="+id;	
    xmlhttp.open("get",sendstr,true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleResonseServer;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(null); //Posting txtname to PHP File
  }
}

function nationalFunction(id) {
	var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
	var sendstr;
		sendstr="get_national.php?id="+id;	
    //location.href = sendstr;
	xmlhttp.open("get",sendstr,true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleResonseServer;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(null); //Posting txtname to PHP File
  }
}

function stateFunction(id) {
	var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
	var sendstr;
		sendstr="gets_statedescrip.php?id="+id;	
    xmlhttp.open("get",sendstr,true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleResonseStateServer;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(null); //Posting txtname to PHP File
  }
}


function handleResonseServer() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
	   document.getElementById("details").innerHTML=xmlhttp.responseText; //Update the HTML Form element
	   document.getElementById("contents").style.display="none";
	   document.getElementById("details").style.display="block";
	   window.location.hash = "top"
	   }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }
}

function handleResonseStateServer() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
	   document.getElementById("state").innerHTML=xmlhttp.responseText; //Update the HTML Form element
	   document.getElementById("national").style.display="none";
	   document.getElementById("state").style.display="block";
	   window.location.hash = "top"
	   }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }
}

function returnFunction() {
	document.getElementById("contents").style.display="block";
	document.getElementById("details").style.display="none";
	window.location.hash = "top"
	
}

function nationalReturn(){
	document.getElementById("national").style.display="block";
	document.getElementById("state").style.display="none";
	window.location.hash = "top"
}