
var xmlHttp


function showstate()
{
Company = document.frm.Company.value;
if(Company!=""){
 document.getElementById('state').style.visibility='hidden';
 document.getElementById("state").style.display="none";
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 


if(Company==''){
	//alert('i m here');
	  document.getElementById('txtstate').style.visibility='hidden';
}else{
	document.getElementById('txtstate').style.visibility='visible';
    url = 'state.php?Company='+Company;
	
}
//alert(url);
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged1() 
{ 

if (xmlHttp.readyState==4)
{ 

document.getElementById("txtstate").innerHTML=xmlHttp.responseText;
}
}

function showcity(state)
{
	var Company 
	Company = document.frm.Company.value;
	
   document.getElementById('city').style.visibility='hidden';
    document.getElementById("city").style.display="none";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

if(state!=''){
   document.getElementById('city').style.visibility='hidden';
   document.getElementById('txtcity').style.visibility='visible';
    url = 'city.php?State='+ state +'&Company='+Company;
	
	xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}else{
	 document.getElementById('city').style.visibility='visible';
     document.getElementById('txtcity').style.visibility='hidden';
}
//alert(url);

} 

function stateChanged2() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtcity").innerHTML=xmlHttp.responseText;
}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}



