
var http = createRequestObject();

function createRequestObject()
 {  
	// find the correct xmlHTTP, works with IE, FF and Opera
	var xmlhttp;
	try {
  	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e) {
    try {
    	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e) {
    	xmlhttp=null;
    }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp=new XMLHttpRequest();
  }
	return  xmlhttp;
}




var http_1 = createRequestObject_1();

function createRequestObject_1()
 {  
	// find the correct xmlHTTP, works with IE, FF and Opera
	var xmlhttp_1;
	try {
  	xmlhttp_1=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e) {
    try {
    	xmlhttp_1=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e) {
    	xmlhttp_1=null;
    }
  }
  if(!xmlhttp_1&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp_1=new XMLHttpRequest();
  }
	return  xmlhttp_1;
}








function stateRequest(id)
{
 //  alert(id);
  var url="showstate.php?cid="+id;  
  http.open("GET",url,true);   
  http.onreadystatechange = handleHttpResponse_state; 
  http.send(null);
}

function handleHttpResponse_state() 
 {              
  	if (http.readyState == 4)
  	{                
    	if(http.status==200) 
		{     
	      var results=http.responseText;  
		  document.getElementById('divStateInfo').innerHTML = results;    
		}  
    }  
 }   

function cityRequest(id)
{
  // alert(id);
  var url="showcity.php?sid="+id;  
  http_1.open("GET",url,true);   
  http_1.onreadystatechange = handleHttpResponse_city; 
  http_1.send(null);
}

function handleHttpResponse_city() 
 {              
  	if (http_1.readyState == 4)
  	{                
    	if(http_1.status==200) 
		{     
	      var results=http_1.responseText;  
		  document.getElementById('divCityInfo').innerHTML = results;    
		}  
    }  
 }   
 
 

function occRequest(id)
{
  // alert(id);
  var url="showoccupation.php?oid="+id;  
  http.open("GET",url,true);   
  http.onreadystatechange = handleHttpResponse_occupation; 
  http.send(null);
}

function handleHttpResponse_occupation() 
 {              
  	if (http.readyState == 4)
  	{                
    	if(http.status==200) 
		{     
	      var results=http.responseText;  
		   document.getElementById('divOccInfo').innerHTML = results;    
		}  
    }  
 }  
 
 function get_val(id)
{
  var url="showoccupation2.php?oid="+id;  
  http.open("GET",url,true);   
  http.onreadystatechange = handleHttpResponse_occupation1; 
  http.send(null);
}

function handleHttpResponse_occupation1() 
 {              
  	if (http.readyState == 4)
  	{                
    	if(http.status==200) 
		{     
	      var results=http.responseText; 
		  	if(http.responseText=="Empty")
			{
			   document.getElementById('thirdcmb').style.display="none";
		    }
			else
			{
			 document.getElementById('thirdcmb').style.display="inline"; 
			 document.getElementById('thirdcmb').innerHTML = results;  
		    }
		}  
    }  
 }   
