//检索页面初始化 function win_search_load() { //清空省份列表 clearSelect(document.forms[0].listProvinceName); //清空城市列表 clearSelect(document.forms[0].listCityName); //省份,城市列表补白 addOption(document.forms[0].listProvinceName, DEFAULT_PROVINCE, "-1"); addOption(document.forms[0].listCityName, DEFAULT_CITY, "-1"); //添加省份列表 for(i = 0; i < ProvinceList.length; i++) { var text = ProvinceList[i].name; var value = ProvinceList[i].id; addOption(document.forms[0].listProvinceName, text, value); } } //快捷城市列表单击 function rad_city_click() { //重置省份,城市列表 document.forms[0].listProvinceName.selectedIndex = 0; //清空城市列表 clearSelect(document.forms[0].listCityName); addOption(document.forms[0].listCityName, DEFAULT_CITY, "-1"); //清空其他城市 var name = document.forms[0].txtCityName.value; if(name.trim() != DEFAULT_CITY_NAME) { document.forms[0].txtCityName.value = DEFAULT_CITY_NAME; } } //添加城市 function add_city() { //取得当前省份ID var provId = document.forms[0].listProvinceName.value; //初始化城市 clearSelect(document.forms[0].listCityName); addOption(document.forms[0].listCityName, DEFAULT_CITY, "-1"); if(provId != -1) { for(var i = 0; i < CityList.length; i++) { if(CityList[i].id1 == provId) { addOption(document.forms[0].listCityName,CityList[i].name1,CityList[i].id2); } } } document.forms[0].listCityName.options[0].selected = true; } //选择省份 function list_province_change() { //清空其他城市 var name = document.forms[0].txtCityName.value; if(name.trim() != DEFAULT_CITY_NAME) { document.forms[0].txtCityName.value = DEFAULT_CITY_NAME; } //重置快捷城市 var index = getRadioSelectedIndex(document.forms[0].radCityName); if( index != -1) { document.forms[0].radCityName[index].checked = false; } //添加城市 add_city(); } //选择城市 function list_city_change() { //清空其他城市 var name = document.forms[0].txtCityName.value; if(name.trim() != DEFAULT_CITY_NAME) { document.forms[0].txtCityName.value = DEFAULT_CITY_NAME; } //重置快捷城市 var index = getRadioSelectedIndex(document.forms[0].radCityName); if( index != -1) { document.forms[0].radCityName[index].checked = false; } } //其他城市 function txt_city_focus() { if(document.forms[0].txtCityName.value == DEFAULT_CITY_NAME) { document.forms[0].txtCityName.value = ""; } //重置省份,城市列表 document.forms[0].listProvinceName.selectedIndex = 0; //清空城市列表 clearSelect(document.forms[0].listCityName); addOption(document.forms[0].listCityName, DEFAULT_CITY, "-1"); //重置快捷城市 var index = getRadioSelectedIndex(document.forms[0].radCityName); if( index != -1) { document.forms[0].radCityName[index].checked = false; } } function txt_city_blur() { var name = document.forms[0].txtCityName.value; if(name.trim() == '' || name == DEFAULT_CITY_NAME) { document.forms[0].txtCityName.value = DEFAULT_CITY_NAME; document.forms[0].radCityName[0].checked = true; } } //入住日期的回调函数 function callback_date(date) { document.forms[0].txtInDate.value = date; if(document.forms[0].txtOutDate.value.length == 0) { showCalendar('txtOutDate',false,'txtOutDate','txtInDate'); } } function do_search_submit() { //check document.forms[0].hidCityName.value = ""; var tCity = "" + document.forms[0].txtCityName.value; var nIndex = getRadioSelectedIndex(document.forms[0].radCityName); if( nIndex != -1) { document.forms[0].hidCityName.value = document.forms[0].radCityName[nIndex].value; } else if(document.forms[0].listCityName.selectedIndex > 0) { document.forms[0].hidCityName.value = document.forms[0].listCityName[document.forms[0].listCityName.selectedIndex].text; } else if( tCity.trim() != "" && tCity.trim() != DEFAULT_CITY_NAME) { document.forms[0].hidCityName.value = tCity.trim(); } else { alert(NON_CITY); document.forms[0].txtCityName.focus(); return; } sDate = document.forms[0].txtInDate.value; if(sDate.trim() == "") { alert(NON_INDATE); document.forms[0].txtInDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_IDDATE); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidNowDate.value) < 0) { alert(INVALID_INDATE + document.forms[0].hidNowDate.value + "。"); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) >= 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtInDate.focus(); return; } sDate = document.forms[0].txtOutDate.value; if(sDate.trim() == "") { alert(NON_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) <= 0) { alert(INVALID_OUTDATE_1 + document.forms[0].txtInDate.value + "。"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) > 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) > 20*24*60*60*1000) { alert(INVALID_DATE); document.forms[0].txtOutDate.focus(); return; } document.forms[0].hidInDate.value = ""; document.forms[0].hidOutDate.value = ""; document.forms[0].hidHotelName.value = ""; document.forms[0].hidHotelLevel.value = ""; document.forms[0].hidHotelPrice.value = ""; document.forms[0].hidInDate.value = document.forms[0].txtInDate.value; document.forms[0].hidOutDate.value = document.forms[0].txtOutDate.value; document.forms[0].hidHotelName.value = document.forms[0].txtHotelName.value; var hotellevel = ""; if(document.forms[0].chkStar0.checked) hotellevel = "1"; else hotellevel = "0"; if(document.forms[0].chkStar1.checked) hotellevel = hotellevel + "1"; else hotellevel = hotellevel + "0"; if(document.forms[0].chkStar2.checked) hotellevel = hotellevel + "1"; else hotellevel = hotellevel + "0"; if(document.forms[0].chkStar3.checked) hotellevel = hotellevel + "1"; else hotellevel = hotellevel + "0"; if(document.forms[0].chkStar4.checked) hotellevel = hotellevel + "1"; else hotellevel = hotellevel + "0"; if(document.forms[0].chkStar5.checked) hotellevel = hotellevel + "1"; else hotellevel = hotellevel + "0"; document.forms[0].hidHotelLevel.value = hotellevel; var price = ""; if(document.forms[0].chkPrice0.checked) price = "1"; else price = "0"; if(document.forms[0].chkPrice1.checked) price = price + "1"; else price = price + "0"; if(document.forms[0].chkPrice2.checked) price = price + "1"; else price = price + "0"; if(document.forms[0].chkPrice3.checked) price = price + "1"; else price = price + "0"; if(document.forms[0].chkPrice4.checked) price = price + "1"; else price = price + "0"; document.forms[0].hidHotelPrice.value = price; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do"; document.forms[0].submit(); } function list_zone_change() { var zoneType = document.forms[0].listZoneType.value; //初始化区域 clearSelect(document.forms[0].listZone); var defaultZone = ""; if(zoneType == "2") { defaultZone = DEFAULT_SHOP_AREA; } else if(zoneType == "3") { defaultZone = DEFAULT_TRAFFIC_AREA; } else if(zoneType == "4") { defaultZone = DEFAULT_TOUR_AREA; } else { defaultZone = DEFAULT_AREA; } addOption(document.forms[0].listZone, defaultZone, "-1"); if(zoneType == "2") { for(var i = 0; i < ShopAreaList.length; i++) { addOption(document.forms[0].listZone,ShopAreaList[i].name,ShopAreaList[i].id); } } else if(zoneType == "3") { for(var i = 0; i < TrafficAreaList.length; i++) { addOption(document.forms[0].listZone,TrafficAreaList[i].name,TrafficAreaList[i].id); } } else if(zoneType == "4") { for(var i = 0; i < TourAreaList.length; i++) { addOption(document.forms[0].listZone,TourAreaList[i].name,TourAreaList[i].id); } } else { for(var i = 0; i < AreaList.length; i++) { addOption(document.forms[0].listZone,AreaList[i].name,AreaList[i].id); } } document.forms[0].listZone.options[0].selected = true; } function do_research_submit() { window.location.href = "switchdo.do?prefix=/hotel&page=/hotelSearchC.do"; } function do_consearch_submit() { sDate = document.forms[0].txtInDate.value; if(sDate.trim() == "") { alert(NON_INDATE); document.forms[0].txtInDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_IDDATE); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidNowDate.value) < 0) { alert(INVALID_INDATE + document.forms[0].hidNowDate.value + "。"); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) >= 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtInDate.focus(); return; } sDate = document.forms[0].txtOutDate.value; if(sDate.trim() == "") { alert(NON_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) <= 0) { alert(INVALID_OUTDATE_1 + document.forms[0].txtInDate.value + "。"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) > 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) > 20*24*60*60*1000) { alert(INVALID_DATE); document.forms[0].txtOutDate.focus(); return; } document.forms[0].hidInDate.value = ""; document.forms[0].hidOutDate.value = ""; document.forms[0].hidHotelName.value = ""; document.forms[0].hidHotelLevel.value = ""; document.forms[0].hidHotelPrice.value = ""; document.forms[0].hidZoneType.value = ""; document.forms[0].hidZone.value = ""; document.forms[0].hidOrderBy.value = ""; document.forms[0].hidInDate.value = document.forms[0].txtInDate.value; document.forms[0].hidOutDate.value = document.forms[0].txtOutDate.value; document.forms[0].hidHotelName.value = document.forms[0].txtHotelName.value; var index = document.forms[0].listHotelLevel.selectedIndex; var hotellevel = ""; for(var i = 1; i <= 6; i++) { if( index == i) { hotellevel = hotellevel + "1"; } else { hotellevel = hotellevel + "0"; } } document.forms[0].hidHotelLevel.value = hotellevel; var index = document.forms[0].listHotelPrice.selectedIndex; var hotelprice = ""; for(var i = 1; i <= 5; i++) { if( index == i ) { hotelprice = hotelprice + "1"; } else { hotelprice = hotelprice + "0"; } } document.forms[0].hidHotelPrice.value = hotelprice; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do"; document.forms[0].submit(); } function do_zonesearch_submit() { if(document.forms[0].listZone.selectedIndex < 1) { switch(document.forms[0].listZoneType.selectedIndex) { case 0: alert(NON_AREA); return; case 1: alert(NON_SHOP_AREA); return; case 2: alert(NON_TRAFFIC_AREA); return; case 3: alert(NON_TOUR_AREA); return; } } document.forms[0].hidOrderBy.value = ""; document.forms[0].hidZoneType.value = document.forms[0].listZoneType.options[document.forms[0].listZoneType.selectedIndex].value; document.forms[0].hidZone.value = document.forms[0].listZone.options[document.forms[0].listZone.selectedIndex].value; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do"; document.forms[0].submit(); } function rad_orderby_click() { document.forms[0].hidOrderBy.value = getRadioValue(document.forms[0].radOrderBy); document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do"; document.forms[0].submit(); } function hotel_map(picture,name) { if(picture == "" || name == "") { return; } var action = "hotel/b2c/hotelMap.jsp?pname=" + picture + "&hname=" + name; window.open(action,null,'width=550,height=500,scrollbars=yes,resizable=yes'); } function page_scroll(pageno) { document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do?PageNo=" + pageno; document.forms[0].submit(); } function list_pageno_change() { var index = document.forms[0].listPageNo.selectedIndex; var value = document.forms[0].listPageNo.options[index].value; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do?PageNo=" + value; document.forms[0].submit(); } function hotelRoomInfo(hotelid,hotelShop) { var para = "HotelID=" + hotelid + "&InDate=" + document.forms[0].hidInDate.value+"&OutDate="+document.forms[0].hidOutDate.value+"&Shop="+hotelShop; var url = "switchdo.do?prefix=/hotel&page=/hotelRoomInfoC.do?" + para; window.open(url,"roominfo",'width=710,height=380,location=no,toolbar=yes,scrollbars=yes,resizable=yes'); } function hotelInfo(hotelid) { document.forms[0].hidHotelID.value = hotelid; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelInfoC.do"; document.forms[0].submit(); } function do_preorder(hotelid,roomid,paytype) { document.forms[0].hidHotelID.value = hotelid; document.forms[0].hidRoomID.value = roomid; document.forms[0].hidPayType.value = paytype; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelOrderC.do"; document.forms[0].submit(); } function pop_zancun(hotelid) { var url = "switchdo.do?prefix=/hotel&page=/hotelSaveC.do?hidHotelID=" + hotelid; window.open(url,null,'width=450,height=200,location=no,toolbar=yes,scrollbars=yes,resizable=yes'); } function inputdate_submit() { sDate = document.forms[0].txtInDate.value; if(sDate.trim() == "") { alert(NON_INDATE); document.forms[0].txtInDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_IDDATE); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidNowDate.value) < 0) { alert(INVALID_INDATE + document.forms[0].hidNowDate.value + "。"); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) >= 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtInDate.focus(); return; } sDate = document.forms[0].txtOutDate.value; if(sDate.trim() == "") { alert(NON_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) <= 0) { alert(INVALID_OUTDATE_1 + document.forms[0].txtInDate.value + "。"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) > 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) > 20*24*60*60*1000) { alert(INVALID_DATE); document.forms[0].txtOutDate.focus(); return; } document.forms[0].hidInDate.value = document.forms[0].txtInDate.value; document.forms[0].hidOutDate.value = document.forms[0].txtOutDate.value; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelInfoC.do"; document.forms[0].submit(); } function hotelsubmit() { //check document.forms[0].hidCityName.value = ""; var tCity = "" + document.forms[0].txtCityName.value; if( tCity.trim() != "") { document.forms[0].hidCityName.value = tCity.trim(); } else { alert(NON_CITY); document.forms[0].txtCityName.focus(); return; } sDate = document.forms[0].txtInDate.value; if(sDate.trim() == "") { alert(NON_INDATE); document.forms[0].txtInDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_IDDATE); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidNowDate.value) < 0) { alert(INVALID_INDATE + document.forms[0].hidNowDate.value + "。"); document.forms[0].txtInDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) >= 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电(010)85118522!"); document.forms[0].txtInDate.focus(); return; } sDate = document.forms[0].txtOutDate.value; if(sDate.trim() == "") { alert(NON_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(!isDate(sDate)) { alert(ERROR_OUTDATE); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) <= 0) { alert(INVALID_OUTDATE_1 + document.forms[0].txtInDate.value + "。"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].hidLastDate.value) > 0) { alert("本系统不支持" + document.forms[0].hidLastDate.value +"日之后的预订,\n如需预订请致电010-85227698!"); document.forms[0].txtOutDate.focus(); return; } if(compareDate(sDate,document.forms[0].txtInDate.value) > 20*24*60*60*1000) { alert(INVALID_DATE); document.forms[0].txtOutDate.focus(); return; } document.forms[0].hidInDate.value = ""; document.forms[0].hidOutDate.value = ""; document.forms[0].hidHotelName.value = ""; document.forms[0].hidHotelLevel.value = ""; document.forms[0].hidHotelPrice.value = ""; document.forms[0].hidInDate.value = document.forms[0].txtInDate.value; document.forms[0].hidOutDate.value = document.forms[0].txtOutDate.value; document.forms[0].hidHotelName.value = document.forms[0].txtHotelName.value; var index = document.forms[0].listHotelLevel.selectedIndex; var hotellevel = ""; for(var i = 1; i <= 6; i++) { if( index == i) { hotellevel = hotellevel + "1"; } else { hotellevel = hotellevel + "0"; } } document.forms[0].hidHotelLevel.value = hotellevel; var index = document.forms[0].listHotelPrice.selectedIndex; var hotelprice = ""; for(var i = 1; i <= 5; i++) { if( index == i ) { hotelprice = hotelprice + "1"; } else { hotelprice = hotelprice + "0"; } } document.forms[0].hidHotelPrice.value = hotelprice; document.forms[0].action = "switchdo.do?prefix=/hotel&page=/hotelSearchResultC.do"; document.forms[0].submit(); } function hotel_bbs(hotelid) { var url = "switchdo.do?prefix=/hotel&page=/hotelBBSC.do?hidHotelID=" + hotelid; window.location.href = url; }