﻿var xmlHttp,historyXmlHttp;var isHold;(function(){if(window.ActiveXObject){xmlHttp = new ActiveXObject("microsoft.XMLHttp");historyXmlHttp = new ActiveXObject("microsoft.XMLHttp");}else{xmlHttp = new XMLHttpRequest();historyXmlHttp= new XMLHttpRequest();}})();function callback(){switch(xmlHttp.readyState){case 4:{if(xmlHttp.status==200){var rlist=eval($ge("allRoom").value);var rprice=eval(xmlHttp.responseText);for(var i=0;i<rlist.length;i++){$ge("fp"+rlist[i]).innerHTML=rprice[i][0];$ge("rp"+rlist[i]).innerHTML=rprice[i][1];}}break;}}}function getRoomInfo(){;var hId = $ge('hotelid').value;var url='/private/RoomPrices.aspx?id='+hId,st=$gUrl("starttime"),dt=$gUrl("deptime");if(st!='') url+='&starttime='+st; if(dt!='') url+='&deptime='+dt;xmlHttp.open('GET',url);xmlHttp.onreadystatechange = callback;xmlHttp.send(null);}function rcheck(){var per = $ge('checkIn');var perv=per.value?per.value:per.innerText;if(perv==''){$alert(per,"请输入入住日期");return false;}var post=$ge('checkOut');var postv=post.value?post.value:post.innerText;if(postv==''){$alert(post,"请输入离店日期");return false;}var s1=new Date(postv.replace(/-/g, "/"));if(!postv.isDateTime()){$alert(post,"离店日期格式不正确");return false;}var s2 = new Date(perv.replace(/-/g, "/"));if(s2 >= s1 ){$alert(post,"离店日期必须大于入住日期");return false;}var time= s1.getTime() - s2.getTime();var days = parseInt(time / (1000 * 60 * 60 * 24));var now = new Date();if(parseInt((now-s2) / (1000 * 60 * 60 * 24))>0){$alert(post,"入住日期必须大于今日");return false;}if(days>28){alert("如果您需要在酒店入住28天以上，请致电：020－28552299，我们会竭诚为您服务。");return false;}var hId=$ge('hotelid').value;xmlHttp.open('GET','/private/RoomPrices.aspx?id='+hId+'&starttime='+perv+'&deptime='+postv);xmlHttp.onreadystatechange=callback;xmlHttp.send(null);}function $gUrl(){var Url=top.window.location.href;var u,g,StrBack='';if(arguments[arguments.length-1]=="#")u=Url.split("#");else u=Url.split("?");if(u.length==1) g='';else g=u[1];if(g!=''){ gg=g.split("&"); var MaxI=gg.length; str = arguments[0]+"="; for(i=0;i<MaxI;i++){if(gg[i].indexOf(str)==0){StrBack=gg[i].replace(str,"");break;}}}return StrBack;}function nextSibling(obj){var tempObj = obj;do{tempObj = tempObj.nextSibling;}while(tempObj.nextSibling&&tempObj.nextSibling.nodeType&&(tempObj.nextSibling.nodeType!=1))return tempObj;}function showRoomDetail(obj){var detailDiv = nextSibling(obj.parentNode.parentNode);detailDiv.style.display = detailDiv.style.display?"":"none";}function hideRoomDetail(obj){var roomdetail = obj.parentNode.parentNode;roomdetail.style.display = "none";}function history_show(obj){var url="/private/ViewHistory.aspx?id=";if(obj=="read"){url+="read";}else url+=$ge("hotelid").value;historyXmlHttp.open("GET",url);historyXmlHttp.onreadystatechange=historycallback;historyXmlHttp.send(null);}function historycallback(){if(historyXmlHttp.readyState==4){if(historyXmlHttp.status==200){$ge("history").innerHTML=historyXmlHttp.responseText;}}}_.__.write("<ul style=\"left:99px;top:485px;display:block;position:absolute;left:-5000px;top:-5000px;\" id=\"jmpArea\"><li id=\"div_zone\"><div class=\"hotel_jmpinfo_type\">商业区</div></li></ul><script type=\"text/javascript\" src=\"/private/address_districtlist.aspx\" charset=\"utf-8\"></script>");window.$r('domready',function(){areaControl($('txtArea'),$('jmpArea'),$('zone'),function(){return $('city').value;});});function areaControl(input,div,tagInput,fnCity){var cityId=null;var value=null;var current=null;var c_data;var f_city;c_data=window.c_data;f_city=fnCity;input.$r('click',inputClick);document.body.appendChild(div.parentNode.removeChild(div));div.$r('click',divClick);document.documentElement.$r('mousedown',bodyClick);function inputClick(){var newCity=f_city();if(cityId!=newCity){cityId=newCity;if(cityId)update();}if(!cityId)return;if(value) setCurrent(window.$(value));display(true);}function setCurrent(el){if(current==el)return;if(current){current.style.fontWeight='';}current=el;if(current){current.style.fontWeight='bold';value=current.id;for(i in window.district_data){if(current.id==window.district_data[i][1]){tagInput.value=window.district_data[i][1];input.value=window.district_data[i][0];break;}}}}function divClick(e){var el=window.$fixE(e).$target;if(el.tagName=='A'){setCurrent(el);display(false);}}function bodyClick(e){var el=window.$fixE(e).$target;if(el!=input&&!parentOf(div, el))display(false);}function display(b){var el=div;var refEl=input;if(!b){el.style.left='-5000px';el.style.top='-5000px';el.$clearIframe();displaying=false;}else{var r=window.$pageSize('win');var p=refEl.$getPos();var h=r.top+r.height-p[1]-refEl.offsetHeight;pos=h<el.offsetHeight?'lblt':'ltlb';el.$setPos(refEl, pos.slice(0,2),pos.slice(2));el.$setIframe();}}function update(){var c_data=window.district_data;var el=div;current=null;var dlist=[];for(i in c_data){if(cityId==c_data[i][2])dlist.push(c_data[i]);}var tmp=window.$('div_zone');var tit=tmp.removeChild(tmp.getElementsByTagName('div')[0]);for(i in dlist){if(dlist[i])tmp.innerHTML = dlist.map(function(id){return '<a href="#;" id="{$1}" title="{$2}">{$2}</a>'.replaceWith([0,id[1],id[0]]);}).join('');}tmp.insertBefore(tit, tmp.firstChild);}function parentOf(a,b){while(b&&b!=a)b=b.parentNode;return a==b;}}var cityXmlHttp;function createCityXmlHttpRequest(){if(window.ActiveXObject)cityXmlHttp = new ActiveXObject("microsoft.XMLHttp");else cityXmlHttp = new XMLHttpRequest();}function getCityHotelPriceList(){createCityXmlHttpRequest();var hl=$ge("hotellist").value;var url="/private/RoomPriceList.aspx?hl="+hl;if($getValue($ge("checkIn"))!=""&&$getValue($ge("checkOut"))!="")url+="&starttime="+$getValue($ge("checkIn"))+"&deptime="+$getValue($ge("checkOut"));cityXmlHttp.open("GET",url);cityXmlHttp.onreadystatechange=cityHotelPriceCallBack;cityXmlHttp.send(null);}function cityHotelPriceCallBack(){if(cityXmlHttp.readyState==4)if(cityXmlHttp.status==200){var hlp=eval(cityXmlHttp.responseText);for(var i=0;i<hlp.length;i++){for(var k=0;k<hlp[i].length;k++){if($ge(hlp[i][k][0])!=null)$ge(hlp[i][k][0]).innerHTML=hlp[i][k][1];}}}}