// JavaScript Document
function UrlToDiv(divId,remoteUrl){	
	$(divId).update('数据加载中.......');	
	new Ajax.Request(remoteUrl, { 
  			method: "get", 
  			onSuccess: function(transport) {    				
  			 $(divId).innerHTML=transport.responseText;
			 } 
			 });
	}
	
function DelDiv(divId){
	$(divId).remove();
	isClickChain=false;
	}
	
var starJson={"StarList":[{"Star":"不限","Value":""},{"Star":"二星及以下/经济型","Value":"2"},{"Star":"三星级/舒适型","Value":"3"},{"Star":"四星级/高档型","Value":"4"},{"Star":"五星级/豪华型","Value":"5"}]};

 var isClickChain;
  var isClickChainId;
  isClickChain=false;
  isClickChainId="";
  function ShowTopChain(cId){
  if(isClickChain){
 	$(isClickChainId).remove();
  }
  isClickChain=true;
  isClickChainId="showTopChaindetail"+cId;
  	new Insertion.Bottom("chainList"+cId,"<div id='showTopChaindetail"+cId+"'>11</div>");
	//alert($('chainList'+cId).innerHTML);
  	UrlToDiv('showTopChaindetail'+cId,'HomeChainList.asp?cid='+cId);
  }

function selfPriceJson(hId){
	var CheckInDate=$F('CheckInDate1');
	var CheckOutDate=$F('CheckOutDate1');
		location.replace("HotelSearch.asp?CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate+"&H_Id="+hId);
	}


function PriceJson4Days(){
	$('PriceListTableElong').update("<img src='/images/loading.gif' />");
	var hotelid=$F('thisHotelId');
	
	if($F('H_Signed')==1||$F('H_Signed')==2){
		hotelid="e"+hotelid;
		
		}
	else{
		hotelid="c"+$F('cthyHotelId');
		}
	  var CheckInDate=$F('CheckInDate1');
	  var dateArray=CheckInDate.split('-');
	  var newDate=new Date(dateArray[0],parseInt(dateArray[1]-1),dateArray[2]);
	  //newDate.addDays(1)
	//  alert(newDate);
	  var CheckOutDate=$F('CheckOutDate1');
	//alert(hotelid);
			var ResultCode;
			var HotelInvStatusCode;
			var LowestPrice;
			var message;
//return;
			//rooms
			var RoomName;
			var RoomTypeId;
			var RoomInvStatusCode;
			var RatePlanID;
			var RatePlanCode;
			var RatePlanName;
			var GuestTypeCode;
			var TotalPrice;
			var CurrencyCode;
			var TaxesAmount;
			
			//rates
			var thisDate;
			var CurrencyCode;
			var InvStatusCode;
			var RetailRate;
			var MemberRate;
			var AddBedRate;
			
	//$('RoomPriceMenu').nextSiblings('.roomTyelist'); 
	var jurl="/WebServices/WebServices_Price.asp?HotelId="+hotelid+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
	//alert(jurl);
	new Ajax.Request(jurl, { 
  		method: "get", 
		onSuccess: function(transport) { 
		$('PriceListTableElong').update(transport.responseText);
		//new Insertion.Bottom('PriceListTable', thisRoomDetail); 
    	//alert(transport.responseText);
		
					
					
					
		}
 });
	
	
	}


function BookRoom(rid){
	var jurl;
	 var CheckInDate=$F('CheckInDate1');
	  var dateArray=CheckInDate.split('-');
	  
	  var CheckOutDate=$F('CheckOutDate1');
	if($F('H_Signed')==1||$F('H_Signed')==2){
		jurl="/booking/Booking.asp?hId=e"+$F('thisHotelId')+"&rId="+$F('thisRoomid'+rid)+"&id="+CheckInDate+"&od="+CheckOutDate;
		}
	else{
		jurl="/booking/Booking.asp?hId=c"+$F('cthyHotelId')+"&rId="+$F('thisRoomid'+rid)+"&id="+CheckInDate+"&od="+CheckOutDate;
		}
		location.replace(jurl);
	}
function PriceJson(){
	
	
	//
	var arraydateTd=$$(".checkindatetd");
						
var dateArray2=$F("CheckInDate1").split('-');
var newDate2=new Date(dateArray2[0],parseInt(dateArray2[1]-1),dateArray2[2]);
for(var i=0;i<arraydateTd.size();i++){
arraydateTd[i].update((newDate2.getMonth()+1)+"月"+newDate2.getDate()+"日");
newDate2.addDays(1);
	  
	  }
	//
	
	 var hotelid=$F('thisHotelId');
	 var cthyHotelId=$F('cthyHotelId');
	  var CheckInDate=$F('CheckInDate1');
	  var dateArray=CheckInDate.split('-');
	 // newDate=new Date(dateArray[0],parseInt(dateArray[1]-1),dateArray[2]);
	 //newDate2.addDays(1)
	 
	  var CheckOutDate=newDate2.getFullYear()+"-"+(newDate2.getMonth()+1)+"-"+newDate2.getDate();

	//alert(hotelid);
	
	 var channelType;
	 var isRoomInfo=false;
			var ResultCode;
			var HotelInvStatusCode;
			var LowestPrice;
			var message;
//return;
			//rooms
			var RoomName;
			var RoomTypeId;
			var RoomInvStatusCode;
			var RatePlanID;
			var RatePlanCode;
			var RatePlanName;
			var GuestTypeCode;
			var TotalPrice;
			var CurrencyCode;
			var TaxesAmount;
			
			//rates
			var thisDate;
			var CurrencyCode;
			var InvStatusCode;
			var RetailRate;
			var MemberRate;
			var AddBedRate;
			$$('tr.roomTyelist').each(Element.remove);
	//$('RoomPriceMenu').nextSiblings('.roomTyelist'); 
	
	var SignChannel=$F('H_Signed');
	switch(SignChannel){//判断签约状态
		case '0':
		jurl="/WebServices1/CthyPriceJson.asp?HotelId="+hotelid+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
		channelType="c";
		break;
		case '1':
		jurl="/WebServices1/priceJson.asp?HotelId="+hotelid+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
		channelType="e";
		isRoomInfo=true;
		break;
		case '2':
		jurl="/WebServices1/GetCtripPrice.asp?HotelId="+hotelid+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
		channelType="t";
		break;
		default:
		jurl="/WebServices1/priceJson.asp?HotelId="+hotelid+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
		channelType="c";
		
		}
	//alert(jurl);
//	return;
	
	new Ajax.Request(jurl, { 
  		method: "get", 
		onSuccess: function(transport) { 
		var json = transport.responseText.evalJSON();
		ResultCode=json.ResultCode;
		HotelInvStatusCode=json.HotelInvStatusCode;
		LowestPrice=json.LowestPrice;
		message=json.message;
    	
		if(json.ResultCode==0){//数据返回正常
			var roomCount=json.Rooms.size();//返回数组个数
			var rateCount;
			var k=0;
			var thisRoomDetail;
			var firstDayPrice;
			var outDoorPrice;
			var avegPrice;
			var roomIsFull;
			var priceListTrTitle="";
			var priceListTrcontent="";
			var priceListTable;
			var buttomValue;
			var buttomAction;
				for(var i=0;i<roomCount;i++){
					roomIsFull=false;
					thisRoomDetail="";
					//priceListTrcontent="";
					priceListTrcontent=""
					rateCount=json.Rooms[i].rates.size();//返回每日价格
					
					RoomName=json.Rooms[i].RoomName;
					RoomTypeId=json.Rooms[i].RoomTypeId;
					RoomInvStatusCode=json.Rooms[i].RoomInvStatusCode;
					RatePlanID=json.Rooms[i].RatePlanID;
					RatePlanCode=json.Rooms[i].RatePlanCode;
					RatePlanName=json.Rooms[i].RatePlanName;
					GuestTypeCode=json.Rooms[i].GuestTypeCode;
					TotalPrice=json.Rooms[i].TotalPrice;
					CurrencyCode=json.Rooms[i].CurrencyCode;
					TaxesAmount=json.Rooms[i].TaxesAmount;			
					//自行扩充房间数组
					//alert(rateCount);
					avegPrice=parseInt(TotalPrice/rateCount);
					
					for(k=0;k<rateCount;k++){						
						thisDate=json.Rooms[i].rates[k].Date;
						CurrencyCode=json.Rooms[i].rates[k].CurrencyCode;
						InvStatusCode=json.Rooms[i].rates[k].InvStatusCode;
						RetailRate=json.Rooms[i].rates[k].RetailRate;
						MemberRate=json.Rooms[i].rates[k].MemberRate;
						AddBedRate=json.Rooms[i].rates[k].AddBedRate;						
						
						if(k==0){							
							outDoorPrice=RetailRate;
							
							}
						if(MemberRate==-1){
							roomIsFull=true;
							priceListTrcontent=priceListTrcontent+"<td bgcolor='#FFFFFF'>满房</td>";
							}
						else{
							priceListTrcontent=priceListTrcontent+"<td bgcolor='#FFFFFF'>"+MemberRate+"</td>";
							}
							
							if(RoomInvStatusCode==1||roomIsFull){
						buttomValue="满房";
						buttomAction="#";
						
						}
						else{
							buttomValue="预订";
							buttomAction="javascript:gotohotel('"+channelType+cthyHotelId+"','"+RoomTypeId+"')";
							}
							
							
					
					}
			
					thisRoomDetail="<tr id='subRoom"+RoomTypeId+"' class=roomTyelist><td>"+RoomName+"</td><td><DEL>"+outDoorPrice+"</DEL>元</td>"+priceListTrcontent+"<td>"+RatePlanName+"</td><td><a href="+buttomAction+" ><img src='http://hotels.cthy.com/images/Book_67.gif' class=btn11 border=0  /></a></td></tr>";
			
					new Insertion.Bottom('RoomPriceMenu', thisRoomDetail); 	
					
					
				}
				
			
		} 
  } 
 });
}


//列表中读取前三个房型价格
function ListPriceJson(hIdStr,inDateStr,outDateStr){
	 
	  var CheckInDate=inDateStr;
	  var dateArray=CheckInDate.split('-');
	  var newDate=new Date(dateArray[0],parseInt(dateArray[1]-1),dateArray[2]);
	  //newDate.addDays(1)
	//  alert(newDate);
	  var CheckOutDate=outDateStr;
	//alert(hotelid);
	
			var ResultCode;
			var HotelInvStatusCode;
			var LowestPrice;
			var message;
//return;
			//rooms
			var RoomName;
			var RoomTypeId;
			var RoomInvStatusCode;
			var RatePlanID;
			var RatePlanCode;
			var RatePlanName;
			var GuestTypeCode;
			var TotalPrice;
			var CurrencyCode;
			var TaxesAmount;
			
			//rates
			var thisDate;
			var CurrencyCode;
			var InvStatusCode;
			var RetailRate;
			var MemberRate;
			var AddBedRate;
			//$$('tr.roomTyelist').each(Element.remove);
	//$('RoomPriceMenu').nextSiblings('.roomTyelist'); 
	var jurl="WebServices/priceJson.asp?HotelId="+hIdStr+"&CheckInDate="+CheckInDate+"&CheckOutDate="+CheckOutDate;
	
	new Ajax.Request(jurl, { 
  		method: "get", 
		onSuccess: function(transport) { 
		var json = transport.responseText.evalJSON();
		ResultCode=json.ResultCode;
		HotelInvStatusCode=json.HotelInvStatusCode;
		LowestPrice=json.LowestPrice;
		message=json.message;
    	
		if(json.ResultCode==0){//数据返回正常
			var roomCount=json.Rooms.size();//返回数组个数
			var rateCount;
			var k=0;
			var thisRoomDetail;
			var firstDayPrice;
			var outDoorPrice;
			var avegPrice;
			var roomIsFull;
			var priceListTrTitle="";
			var priceListTrcontent="";
			var priceListTable;
			if(roomCount>=3){
				roomCount=3;
				}
				for(var i=0;i<roomCount;i++){
					roomIsFull=false;
					thisRoomDetail="";
					//priceListTrcontent="";
					priceListTrcontent=""
					rateCount=json.Rooms[i].rates.size();//返回每日价格
					
					RoomName=json.Rooms[i].RoomName;
					RoomTypeId=json.Rooms[i].RoomTypeId;
					RoomInvStatusCode=json.Rooms[i].RoomInvStatusCode;
					RatePlanID=json.Rooms[i].RatePlanID;
					RatePlanCode=json.Rooms[i].RatePlanCode;
					RatePlanName=json.Rooms[i].RatePlanName;
					GuestTypeCode=json.Rooms[i].GuestTypeCode;
					TotalPrice=json.Rooms[i].TotalPrice;
					CurrencyCode=json.Rooms[i].CurrencyCode;
					TaxesAmount=json.Rooms[i].TaxesAmount;			
					//自行扩充房间数组
					//alert(rateCount);
					avegPrice=parseInt(TotalPrice/rateCount);
					for(k=0;k<rateCount;k++){						
						thisDate=json.Rooms[i].rates[k].Date;
						CurrencyCode=json.Rooms[i].rates[k].CurrencyCode;
						InvStatusCode=json.Rooms[i].rates[k].InvStatusCode;
						RetailRate=json.Rooms[i].rates[k].RetailRate;
						MemberRate=json.Rooms[i].rates[k].MemberRate;
						AddBedRate=json.Rooms[i].rates[k].AddBedRate;
						
						if(i==0){
						priceListTrTitle=priceListTrTitle+"<td bgcolor='#F8D1BC'>"+(newDate.getMonth()+1)+"/"+newDate.getDate()+"</td>";
						}
						if(k==0){
							firstDayPrice=MemberRate;
							outDoorPrice=RetailRate;
							
							}
						if(MemberRate==-1){
							roomIsFull=true;
							priceListTrcontent=priceListTrcontent+"<td bgcolor='#FFFFFF'>满房</td>";
							}
						else{
							priceListTrcontent=priceListTrcontent+"<td bgcolor='#FFFFFF'>"+MemberRate+"</td>";
							}
						//自行扩充每日房价数组
						
					newDate.addDays(1)
					}
					if(i==0){
					priceListTrTitle="<tr>"+priceListTrTitle+"</tr>";
					}
					
					priceListTable="<table class=priceListTable style='display:none;'>"+priceListTrTitle+priceListTrcontent+"</table>";
					//alert(priceListTable)
					thisRoomDetail="<tr id='subRoom"+RoomTypeId+hIdStr+"' class=roomTyelist><td>"+RoomName+"</td><td><DEL>"+outDoorPrice+"</DEL>元</td><td>RMB&nbsp; "+firstDayPrice+"元</td><td onmouseover=showPriceTable('subRoom"+RoomTypeId+hIdStr+"'); onmouseout=showPriceTable('subRoom"+RoomTypeId+hIdStr+"')><a href='javascript:void(0);' class=priceClass  >RMB&nbsp; "+avegPrice+"元</a>"+priceListTable+"</td><td>"+RatePlanName+"</td><td><INPUT class=btn11 onClick=gotohotel('e"+hIdStr+"','"+RoomTypeId+"') type=button value=预订></td></tr>";
					//alert(thisRoomDetail);
					new Insertion.Bottom('RoomPriceMenu'+hIdStr, thisRoomDetail); 	
					
					
				}
			
		} 
  } 
 });
}
function gotohotel(hId,rId){
	var jUrl="/booking/Booking.asp?hId="+hId+"&rId="+rId+"&i="+$F('CheckInDate1')+"&o="+$F('CheckOutDate1');
	location.replace(jUrl);
	}
function showPriceTable(objId){
		var theTable=$(objId).down('table');
		//alert(objId);
		if(theTable.style.display=="none"){
			theTable.style.display="block";
			}
		else{
			theTable.style.display="none";
			}
	
	}

var isShowRoomInfo;
var isShowRoomId;
isShowRoomInfo=false;
function showRoominfo(rId){
		if(isShowRoomInfo){
			$(isShowRoomId).remove();
			isShowRoomInfo=false;
			return;
			}
		
		var hotelId=$F('thisHotelId');		
		var url="WebServices/roomJson.asp?HotelId="+hotelId+"&RoomId="+rId;	
		
		new Ajax.Request(url, { 
  		method: "get", 
		onSuccess: function(transport) { 
		var json = transport.responseText.evalJSON();		
		var roominfo;
		roominfo="<ul>";
		roominfo=roominfo+"<li>房间数量："+json.roomTypeNum+"</li>";
		roominfo=roominfo+"<li>楼层："+json.floor+"</li>";
		roominfo=roominfo+"<li>房间面积："+json.area+"</li>";
			if(json.hasBroadnet==1){
				roominfo=roominfo+"<li>有宽带";
				if(json.broadnetFee==1){
					roominfo=roominfo+"/收费</li>";
				}
				else
				{
					roominfo=roominfo+"/免费</li>";
				}
			}
			else{
				roominfo=roominfo+"<li>无宽带</li>";
			}
		
		roominfo=roominfo+"<li>房间描述："+json.bedDescription+"</li>";
		roominfo=roominfo+"</ul>";
		roominfo="<tr id='showroominfo"+rId+"'><td colspan=6>"+roominfo+"</td></tr>";
		//document.write(roominfo);
		new Insertion.After('subRoom'+rId,roominfo);
		isShowRoomInfo=true;
		isShowRoomId='showroominfo'+rId;
		//$('roominfo'+iInt).update(roominfo);
    	//document.write(json.roomTypeNum); 
  } 
 });
		
		
	
	}
	
	
	


	
 function daysBetween(DateOne,DateTwo){   
      var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-'));  
       var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1);  
       var OneYear = DateOne.substring(0,DateOne.indexOf ('-'));  
     
       var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-'));  
      var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1);  
       var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));  
    
       var cha=((Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear)-Date.parse(OneMonth+'/'+OneDay+'/'+OneYear))/86400000);   
       return cha;  
  }	

function SubOrder(){
	if($F('CityId')==""){
		alert('选择一个城市!');
		getItemsForDropdown();
		return;
		}
	$('PageSearchForm').submit();
	}
	
	function getItemsForDropdown(){
var inputValue=$('itemname').value;
if(inputValue=="输入城市拼音/汉字/缩写"){
	inputValue="";
	$('itemname').value="";
	}
if(inputValue==""){
endSelect=13;
}
else{
endSelect=cityajaxJson.City.size();
}
var re = new RegExp("^.*"+inputValue+".*","i");
$('ajaxList').select('li').each(Element.remove);
//hideMe('itemsForDropdownLayer');
$('itemsForDropdownLayer').style.display="block";
	for(var i=0;i<endSelect;i++){
		if(re.test(cityajaxJson.City[i].n)){
		var cname=cityajaxJson.City[i].n;
		new Insertion.Bottom('ajaxList', "<li onclick=setSearchCity('"+cityajaxJson.City[i].v+"','"+cname.split("|")[0]+"'); onmouseover=changeBackColor(this,1); onmouseout=changeBackColor(this,2);><span class=ajaxList1>"+cname.split("|")[1]+"</span>"+cname.split("|")[0]+"<span class=ajaxList2></span></li>"); 	
		}
		//$('ajaxList').select('li')[0].style.background="#c8e3fc";
	}
}


function hideMe(itemId){
	if($(itemId).style.display=="block"){
		$(itemId).style.display="none";
	}
	else{
		$(itemId).style.display="block";
	}
}
function changeBackColor(obj,cInt){
	if(cInt==1){
		obj.style.background="#c8e3fc";
	}
	else{
		obj.style.background="white";
	}

}
function setSearchCity(cId,nStr){
$('itemsForDropdownLayer').style.display="none";
$('itemname').value=nStr;
$('CityId').value=cId;
if($('BuId')){$('BuId').value=""}
if($('itemnameBuId')){$('itemnameBuId').value=""}

}
function getItemsBuId(){
	var CityId=$F('CityId');
	$('itemsForDropdownLayerBuId').style.display="block";
	UrlToDiv("itemsForDropdownLayerBuId","GetBuList.asp?cityid="+CityId);
	}
function setBuid(bId,bName){
	$('itemsForDropdownLayerBuId').style.display="none";
	$('BuId').value=bId;
	$('itemnameBuId').value=bName;
	}
function CheckTheDate(d1Id,d2Id){
	var date1=$F(d1Id);
	var date2=$F(d2Id);
	return parseInt(daysBetween(date1,date2));
	}
function ChangeInState(){
		if(CheckTheDate('CheckInDate','CheckOutDate')<=0){
			alert("离店日期不能先于入住日期");
			$('CheckOutDate').focus();
			return;
			}
			$('days').value=CheckTheDate('CheckInDate','CheckOutDate');
			$('daysView').update($F('CheckInDate')+"到"+$F('CheckOutDate'));
			$('RoomcountView').update($F("Rooms")+"间");
			//var pattern =/^\d{8}$/;   
　　　　　//　flag = pattern.test($F('EH_ID')); 
			var jurl;
			
			//渠道判断
			var SignChannel=$F('H_Signed');
			
	switch(SignChannel){
		case '0':
		jurl="/WebServices1/cthySingleRoomPrice.asp?HotelId="+$F('elongId')+"&CheckInDate="+$F("CheckInDate")+"&CheckOutDate="+$F("CheckOutDate")+"&RoomId="+$F('rId');
		
		break;
		case '1':
		jurl="/WebServices1/SingleRoomPrice.asp?HotelId="+$F('elongId')+"&CheckInDate="+$F("CheckInDate")+"&CheckOutDate="+$F("CheckOutDate")+"&RoomId="+$F('rId');
		
		
		break;
		case '2':
		jurl="/WebServices1/CtripSingelRoomPrice.asp?HotelId="+$F('elongId')+"&CheckInDate="+$F("CheckInDate")+"&CheckOutDate="+$F("CheckOutDate")+"&RoomId="+$F('rId');
		channelType="t";
		break;
		default:
		jurl="/WebServices1/cthySingleRoomPrice.asp?HotelId="+$F('elongId')+"&CheckInDate="+$F("CheckInDate")+"&CheckOutDate="+$F("CheckOutDate")+"&RoomId="+$F('rId');
		
		
		}
			
			//渠道判断
			//alert(jurl);
			//return;
			
			
		
		

			//房型名字结束
			
		
			//document.write(jurl);
			//ajax读取每日房价
			new Ajax.Request(jurl, { 
  		method: "get", 
		onSuccess: function(transport) { 
		var json = transport.responseText.evalJSON();
		$('RealRoomName').update(json.rName);
    	$('RoomName').value=json.rName;
		 var dateArray2=$F("CheckInDate").split('-');
	  var newDate2=new Date(dateArray2[0],parseInt(dateArray2[1]-1),dateArray2[2]);
	  
		AvgRate=parseInt(json.AvgRate);
		$('AvgRate').value=AvgRate;
		$('AvgRateView').update("RMB "+AvgRate+"元");
		$('Allmoneys').update("RMB "+(AvgRate*parseInt($F("Rooms"))*CheckTheDate('CheckInDate','CheckOutDate'))+"元");
		rates=json.rates;
		$('eachDayPriceListTable').select('tr').each(Element.remove);
		new Insertion.Bottom('eachDayPriceListTable', "<tr><td align='center'>日期</td><td align='center'>价格</td></tr>");
		var allDaysPricelist;
		allDaysPricelist="";
		for(var i=0;i<rates.size();i++){
			new Insertion.Bottom('eachDayPriceListTable', "<tr><td align='center'>"+(newDate2.getMonth()+1)+"月"+newDate2.getDate()+"日</td><td align='center'>RMB "+rates[i].MemberRate+"元</td></tr>"); 	
			if(i==0){
				allDaysPricelist=rates[i].MemberRate;
				}
			else{
				allDaysPricelist=allDaysPricelist+","+rates[i].MemberRate;
				}
			newDate2.addDays(1);
			
			}
		$('allDaysPricelist').value=allDaysPricelist;
		//alert($F('allDaysPricelist'));
		}
		}
		);
			
	}
	
function changeRooms(){
	$('RoomcountView').update($F("Rooms")+"间");
	$('Allmoneys').update("RMB "+(AvgRate*parseInt($F("Rooms"))*CheckTheDate('CheckInDate','CheckOutDate'))+"元");
	}
	
function CheckOrder(){
	if($F('cust_name')==""){
		alert("填写入住人姓名!");
		$('cust_name').focus();
		return;
		}
	if($F('cust_tel')==""){
		alert("填写联系电话!");
		$('cust_tel').focus();
		return;
		}
		
	$('_BookForm').submit();
	}
	////////////////////////////////////////////////
Date.prototype.Format = function(fmt)
{
    //author: meizz
    var o =
     {
        "M+" : this.getMonth() , //月份
        "d+" : this.getDate(), //日
        "h+" : this.getHours(), //小时
        "m+" : this.getMinutes(), //分
        "s+" : this.getSeconds(), //秒
        "q+" : Math.floor((this.getMonth() + 3) / 3), //季度
        "S" : this.getMilliseconds() //毫秒
     };
    if (/(y+)/.test(fmt))
         fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt))
             fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}


Date.prototype.addDays = function(d)
{
	//alert(this.getDate());
    this.setDate(this.getDate() + d);
}


Date.prototype.addWeeks = function(w)
{
    this.addDays(w * 7);
}


Date.prototype.addMonths= function(m)
{
    var d = this.getDate();
    this.setMonth(this.getMonth() + m);

    if (this.getDate() < d)
        this.setDate(0);
}


Date.prototype.addYears = function(y)
{
    var m = this.getMonth();
    this.setFullYear(this.getFullYear() + y);

    if (m < this.getMonth())
     {
        this.setDate(0);
     }
}

function addFavHotel() {
			var url=window.location.href;
			var title=window.document.title;
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}
function userlogout(){
	if(confirm("确定退出？")){
		location.replace('logout.asp');
		}
	}