var xmlHttp
var xmlHttp2

function fncitylist(optstateid)
{
 	if(optstateid.length==0)
	 { 
			 document.getElementById("divcitylist").innerHTML="";
			 document.getElementById("divcitylist").style.border="0px";
			 return
	 }
			 
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
	 {
		alert ("Browser does not support HTTP Request")
		 return
	 } 

	
	var url="rcity-list.php"
	passdata="stateid="+optstateid
	//alert(passdata);
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("POST",url,true)
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", passdata.length);
	xmlHttp.send(passdata)
	
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		 document.getElementById("divcitylist").innerHTML=xmlHttp.responseText;
		 document.getElementById("divcitylist").style.border="0px solid #A5ACB2";
	 } 
}


function fetchcity(stateid)
{
	
	if(stateid == '' || stateid == '0')
	{
		alert('Select State');
		return false;
	}
	
	xmlHttp2=GetXmlHttpObject()

	if (xmlHttp2==null)
	 {
		alert ("Browser does not support HTTP Request")
		 return
	 } 
	
	var url="rcity-list.php"
	passdata="allcitystate="+stateid
	//alert(passdata);
	xmlHttp2.onreadystatechange=stateChanged2
	xmlHttp2.open("POST",url,true)
	xmlHttp2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp2.setRequestHeader("Content-length", passdata.length);
	xmlHttp2.send(passdata)
	 
}

function stateChanged2() 
{ 
	if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
	 { 
		 //document.getElementById("rstcity").style.display = 'none';
		 document.getElementById("divcitylist").innerHTML=xmlHttp2.responseText;
		 document.getElementById("divcitylist").style.border="0px solid #A5ACB2";
		 
	 } 
}


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;
}