﻿var xmlHttp,hiCity;
function createXmlHttpRequest(){if(window.ActiveXObject){xmlHttp = new ActiveXObject("microsoft.XMLHttp");}else xmlHttp = new XMLHttpRequest();}
function citycallback(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){
var ds = eval(xmlHttp.responseText);
var c=document.getElementById('city');
c.length=0;
for(var i=0;i<ds.length;i++){c.options.add(new Option(ds[i][0],ds[i][1]));}
if(document.getElementById('hotel')!=null){
getHotelList(ds[0][1]);if(hiCity!=null) {hiCity.value=ds[0][1];alert(hiCity.value)};
}
}}}
function getCitys(obj)
{
    createXmlHttpRequest();
    xmlHttp.open("GET","/meitrip/private/provinces.aspx?id="+obj);
    xmlHttp.onreadystatechange = citycallback;
    xmlHttp.send(null);
}
function getHotelList(obj){
xmlHttp.open("GET","/meitrip/private/hotellist.aspx?id="+obj);
xmlHttp.onreadystatechange = hotelscallback;
xmlHttp.send(null);
}
function hotelscallback(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){
var hl = eval(xmlHttp.responseText);
var h=document.getElementById('hotel');
h.length=0;
if(hl.length==0){h.style.display="none";return;}else h.style.display="block";
h.options.add(new Option("选择相关酒店","0"));
for(var i=0;i<hl.length;i++){h.options.add(new Option(hl[i][1],hl[i][0]));}
}}}
