// 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, ind) {
	var getdate = new Date();  //Used to prevent caching during ajax call
  if (ind!=null) {
	  if(xmlhttp) { 
	var sendstr;
		sendstr="get_descrip.php?id="+id+"&ind="+ind;	
    xmlhttp.open("get",sendstr,true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleIndustryServer;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(null); //Posting txtname to PHP File
	  }
  } else {
  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 handleIndustryServer() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
	   document.getElementById("detailsnew").innerHTML=xmlhttp.responseText; //Update the HTML Form element
	   
	   w=700;
	   h=200;
	   xc = Math.round((document.body.clientWidth/2)-(w/2));
	   yc = Math.round((document.body.clientHeight/2)-(h/2));
	   document.getElementById("detailsnew").style.left=xc + "px";
	   document.getElementById("detailsnew").style.top=yc + "px";
	   document.getElementById("detailsnew").style.display="block";
	   document.getElementById("contentbody").style.color="#000000";
	   }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }
}


function handleResonseStateServer() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
	   document.getElementById("statdesc").innerHTML=xmlhttp.responseText; //Update the HTML Form element
	   document.getElementById("national").style.display="none";
	   document.getElementById("statdesc").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("statdesc").style.display="none";
	window.location.hash = "statearea"
}
function industryClose(){
	document.getElementById("detailsnew").style.display="none";
}