function change_city(state_id,city_array){
	if(state_id!=-1 && state_id!=""){
		theSel = document.getElementById("drop_id_city");
	    theSel.options.length = 0; // removes all options.
	    theSel.options.length = (1);
	  
	   
			for (i=0;i< city_array.length; i=i+1) {
		       if (city_array[i] !='') {
		          theSel.options.length = (i); // make it one longer (ie prefers that)
		          theSel.options[i] = new Option(city_array[i],city_array[i]);
		        
		       }
		    }	
		
	}
    
}
var xmlHttp;

function show_city(str)
{
if (str.length==0)
 {
 document.getElementById("livesearch").innerHTML="";
 document.getElementById("livesearch").style.border="0px";
 return
 }

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 

var url="return_city2.php";
url=url+"?state_id="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged() 
{ 

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var city_array=xmlHttp.responseText.split(",");
 change_city(8,city_array);
 }
}

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;
}
