var xmlHttpArea;

function showArea(Scity)
{ 
	
	document.getElementById("dis").length   =   0;
	xmlHttpArea=GetxmlHttpAreaObject();
	if (xmlHttpArea==null)
	{
		alert ("ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖAJAX£¡");
		return;
	} 
	var url="/getarea.asp";
	url=url+"?city="+Scity;
	url=url+"&sid="+Math.random();
	xmlHttpArea.onreadystatechange=getAreaListCallback;
	xmlHttpArea.open("GET",url,true);
	xmlHttpArea.send(null);
}



function getAreaListCallback() {
if (xmlHttpArea.readyState == 4) {
  var response = eval("("+xmlHttpArea.responseText+")");
  
  var oOption=null;
  oOption=document.createElement("OPTION");
  oOption.value="";
  oOption.text="All";
  document.getElementById("dis").options.add(oOption);
  for(i=0;i < response.locations.location.length; i++) {
      //  flat_id = response.locations.location[i].id;
        var oarea = response.locations.location[i].area;
		oOption  = document.createElement("OPTION");
		oOption.value    = oarea;
		oOption.text     = oarea;
		document.getElementById("dis").options.add(oOption);

		}
	} // end   if (state == 4)
} // end   function



function GetxmlHttpAreaObject()
{
var xmlHttpArea=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttpArea=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttpArea=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttpArea=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttpArea;
}

