//Javascript
//hotel index page script
//create date:2011-03-30
//author :wst
//copy right : chinahighlight
//TrunMenu("citySwitch","active","li","dealHotels");
var jlRateType = new Array ( ) ;
//各个函数区
//Obj 单击对像,calback回调函数
function TrunMenu2 ( Obj , callback ) {
if ( $ ( Obj ) . size ( ) == 0 ) { return ; }
$ ( Obj ) . siblings ( "li" ) . removeClass ( "active" ) . end ( ) . addClass ( "active" ) ;
var cmid = $ ( Obj ) . attr ( "mid" ) ;
var data = $ ( Obj ) . attr ( "data" ) . split ( "|" ) ;
if ( $ ( "#" + cmid ) . size ( ) < 1 ) {
$ ( "#waitingtable" ) . siblings ( "div[name=dealHotels]" ) . hide ( ) . end ( ) . show ( ) ;
$ . ajax ( {
type : "POST" ,
url : '/api/api.asp' ,
dataType : 'json' ,
data : "method=cht.hotel.monthpromotion&cityID=" + data [ 0 ] ,
success : function ( data ) {
ListStr = ""
$ . each ( data . Hotel , function ( i , n ) {
ListStr += "<div class=\"hotelProList\" onclick=\"location.href=$(this).find('a').eq(0).attr('href')\" > \
< div class = \ "hotelPic\"><a href=\"" + n . HotelUrl + "\" url=\"" + n . HotelPic . replace ( '-s.' , '-m.' ) + "\" class=\"jq_preview\"><img src=\"" + n . HotelPic + "\" class=\"hotelSmal\" alt='" + n . HotelName + " ' / > < / a > < / d i v > \
< div class = \ "hotelInfo\" > \
< a class = \ "hotelName\" href=\"" + n . HotelUrl + "\">" + n . HotelName + "</a> " + n . HotelStar + " \
< div class = \ "hotelLocation\">" + ( n . HotelIntRate > 0 ? "Customers' Rating: " + EGAP ( n . HotelIntRate ) + "," + n . HotelIntRate : "" ) + " \
"+ (n.Localtion.length>0?" < br / > Localtion : "+n.Localtion:" ")+" < / d i v > \
< div class = \ "hotelPrice\">" + ( n . HotelLowPrice > 0 ? "From <span class=\"hotelPrice\">$" + n . HotelLowPrice + "</span>" : "" ) + " < / d i v > \
< / d i v > \
< div class = \ "clear\" > < / d i v > \
< / d i v > " ;
} ) ;
ListStr = "<div id=\"" + cmid + "\" name=\"dealHotels\">" + ListStr + "</div>" ;
$ ( "#waitingtable" ) . hide ( ) ;
$ ( "div[name=dealHotels]" ) . hide ( ) ;
$ ( "#waitingtable" ) . after ( ListStr ) ;
$ ( "#" + cmid ) . show ( 1000 ) ;
$ ( "[id=" + cmid + "]" ) . find ( "a.jq_preview" ) . preview ( ) ;
if ( typeof callback == "function" ) {
callback ( Obj ) ;
}
}
} ) ;
} else {
$ ( "div[name=dealHotels]" ) . hide ( ) ;
$ ( "#" + cmid ) . show ( ) ;
if ( typeof callback == "function" ) {
callback ( Obj ) ;
}
}
}
//显示主推酒店
function getMaimHotel ( city ) {
if ( city == "Shanghai" || city == "Beijing" || city == "Guangzhou" || city == "Xian" || city == "Shenzhen" || city == "Guilin" ) {
$ ( "#citySwitch li" ) . filter ( function ( index ) { return $ ( this ) . text ( ) . toLowerCase ( ) == city . toLowerCase ( ) } ) . trigger ( "click" ) ;
} else {
return ;
$ . ajax ( {
type : "GET" ,
url : "/hotel/ajax-index.asp" ,
dataType : "html" ,
data : "city=" + city ,
success : function ( msg ) {
if ( msg == "0" ) { return ; }
var kpNum = $ ( "#citySwitch li" ) . length ;
if ( kpNum > 6 ) {
$ ( "#citySwitch li" ) . eq ( 0 ) . text ( city ) ;
$ ( ".dealBox.roundCorner" ) . eq ( 0 ) . html ( msg ) ;
} else {
var oldHTML = $ ( "#citySwitch" ) . html ( ) ;
$ ( "#citySwitch" ) . prepend ( "<li mid='de_" + city + "' data=''>" + city + "</li>" ) ;
$ ( '<div class="dealBox roundCorner" style="display: none;" name="dealHotels" id="de_' + city + '">' + msg + '</div>' ) . insertBefore ( ".dealBox.roundCorner:first" ) ;
}
$ ( ".dealBox.roundCorner[id=de_" + city + "]" ) . find ( "a.jq_preview" ) . preview ( ) ;
}
} ) ;
}
}
//根据评分给出相应的文字评价
function EGAP ( RateN ) {
RateN = parseInt ( RateN )
if ( RateN > 4.5 ) {
return "Excellent" ;
} else if ( RateN <= 4.5 && RateN > 3.5 ) {
return "Good" ;
} else if ( RateN <= 3.5 && RateN > 2.5 ) {
return "Average" ;
} else if ( RateN <= 2.5 && RateN > 0 ) {
return "Poor" ;
} else {
return "" ;
}
}
function getPriceTh ( W ) {
if ( W == 'VEI_JL_ID' ) {
return "<tr><th style='width:25%'> Room Type Name</th><th></th></tr>" ;
} else {
return " < tr > \
< th > & nbsp ; < / t h > \
< th > & nbsp ; < / t h > \
< th > Internet < / t h > \
< th > Payment < / t h > \
< th colspan = \ "2\" > Normal Rate < / t h > \
< / t r > " ;
}
}
//获得一个房型的行
//Date --> data Node
//type --> show Style
//isHT --> witch
//index--> Index of Line
//show --> Line is Show
function getTr ( data , type , Witch , index , show ) {
var trStr = "" ;
var HideStr = "" ;
var isHT = ( Witch != 'VEI_SH_ID' && Witch != 'VEI_JL_ID' ) ? true : false ;
switch ( type ) {
case 1 :
HideStr = ( index >= 3 && ! show ) ? 'name="roomtr" style="display:none"' : "" ;
if ( Witch != 'VEI_JL_ID' ) {
trStr = '<tr ' + HideStr + '>' +
'<td class="roomType" onmouseout="$(\'#rooms' + data . horsn + '\').hide();" ' +
'onmouseover="$(\'#rooms' + data . horsn + '\').show();" ' +
'id="td' + data . horsn + '"><span class="roominfoavailable">' + data . RoomTypeName + '</span><br>' +
'<span class="roominfoNone">' + ( ( data . RoomBreakfast != '' ) ? '(' + data . RoomBreakfast + ')' : '' ) + '</span>' +
'<div id="rooms' + data . horsn + '" style="position: absolute; display: none;" class="onOutHotelInfo">' +
'<div class="roomDetail">' +
'<div class="roomtypeImg">' + ( data . RoomPic ? '<img align="left" src="' + data . RoomPic + '">' : '' ) + '</div>' +
'<div class="roomtypeinfo">' +
'<ul>' +
'<li><strong>Bed type: </strong>' + data . RoomBedType + ' M</li>' +
'<li><strong>Area: </strong>' + data . RoomArea + ' M<sup>2</sup></li>' +
'<li><strong>Floor: </strong>' + data . RoomFloor + '</li>' +
'<li><strong>Internet Access:</strong>' + ( ( data . RoomNetwork ) ? 'YES' : 'NO' ) + '</li>' +
'<li><strong>Network: </strong>' + data . RoomInternet + '</li>' +
'</ul><div class="clear"></div>' +
'</div><div class="clear"></div>' +
'</div></div></td>' +
'<td>' + showPromotion ( data . RoomPromotion ) + '</td>' +
'<td>' + showInternet ( data . RoomNetwork , data . RoomInternet ) + '</td>' +
'<td><img align="absmiddle" onmouseout="$(\'#p' + data . horsn + '\').fadeOut(300);" onmouseover="$(\'#p' + data . horsn + '\').fadeIn(300);" src="/pic/hotel/icon-docs-info-red.gif" original="/pic/hotel/icon-docs-info-red.gif">' +
'<div style="display:none;position:absolute;" id="p' + data . horsn + '" class="onOutHotel">' +
'<div class="arrowUp"></div>' +
showPaymantMsg ( data . RoomPayment ) + '</div>' + data . RoomPayment + '</td>' +
'<td><span onmouseout="$(\'#div' + data . horsn + '\').fadeOut(300);" onmouseover="$(\'#div' + data . horsn + '\').fadeIn(300);"' +
'class="red_price avgrate2">' + ( ( data . avgPrice == "On Request" ) ? "On Request" : "$" +
( isHT ? Math . ceil ( data . avgPrice * 0.847 ) : data . avgPrice ) ) + '</span>' +
'<div id="div' + data . horsn + '" style="display:none;position:absolute;" class="roomrateInfo">' +
'<table cellspacing="0" cellpadding="0" border="0"><tbody>' +
'<tr><th width="63%" scope="col">Su</th><th width="37%" scope="col">Mo</th>' +
'<th width="37%" scope="col">Tu</th><th width="37%" scope="col">We</th>' +
'<th width="37%" scope="col">Th</th><th width="37%" scope="col">Fr</th>' +
'<th width="37%" scope="col">Sa</th></tr>' +
'<tr>' + showAllDaylyRate ( data . rate , isHT ) + '</tr>' +
'<tr><td class="totalPrice" colspan="7"><strong>Total:</strong>' +
'<span class="red_price avgrate">$' + ( isHT ? Math . ceil ( Number ( data . totalPrice ) * 0.847 ) : data . totalPrice ) +
'</span></td></tr>' +
'</tbody></table>' +
'</div>' +
'</td><td>' + getBookA ( data . BookURL ) + '</td></tr>' ;
} else {
trStr = '<tr ' + HideStr + ' onmouseover="this.bgColor=\'#FFF2E1\'" onmouseout="this.bgColor=\'\'">' +
'<td><span class="roominfoavailable">' + data . roomtypeName + '</span></td>' +
'<td style="position:relative;height: 45px;">' + showJlPriceItem ( data . rate , data . roomtypeId ) + '</td>' +
'</tr>' ;
}
break ;
case 2 :
trStr = '<tr>' +
'<td colspan="7" class="allRoom"><a href="javascript:;" onclick="ShowHideTr(this);"><strong>All Room Types[' + data [ 0 ] + ']</strong>' +
'<img src="/css/images/hotel/double-arrow-up.png" style="display:none" align="absmiddle">' +
'<img src="/css/images/hotel/double-arrow-down.png" align="absmiddle">' +
'</a></td>' +
'</tr>' ;
break ;
case 3 :
trStr = '<tr>' +
'<td colspan="7" align="center"><a href="mailto:alex@chinahighlights.net?subject=Hotel reservations(' + data + ')&body=your request....%0A%0A%0A%0A%0A%0A' + document . location . href + '">Note:The hotel room rate is for request only, please click here to send your request.(alex@chinahighlights.net)</a></td>' +
'</tr>' ;
break ;
}
return trStr ;
function getBookA ( Str ) {
if ( Str == ' Sold Out ' || Str == ' Full ' ) {
return Str ;
}
if ( Str == '' ) {
return '--' ;
}
return '<a onclick="jsGetToPost(\'' + Str + '\',\'\',\'_top\')" href="JavaScript:void(0)"><img title="Book this hotel" alt="Book this hotel" src="/css/images/hotel/book-button.png"></a>' ;
}
function showPromotion ( Str ) {
if ( Str . length > 0 ) {
Str = Str . split ( '|_' ) ;
return '<img onmouseout="$(\'#Promo' + data . horsn + '\').hide();" onmouseover="$(\'#Promo' + data . horsn + '\').show();" ' +
'src="/css/images/hotel/hotel-promo-gift.gif" original="/css/images/hotel/hotel-promo-gift.gif">' +
'<div style="display: none;" class="giftIntro" id="Promo' + data . horsn + '">' +
'<h6>' + Str [ 0 ] + '</h6>' +
'<p>Special Discount For Superior Room</p>' +
'<p><span>Starting:</span>' + Str [ 1 ] + '<br>' +
'<span>Ending:</span>' + Str [ 2 ] + ' </p>' +
'</div>' ;
} else {
return "" ;
}
}
function showInternet ( a , b ) {
if ( isHT ) {
if ( a == "0" ) {
return "NO" ;
} else if ( a == "1" || a == "2" ) {
if ( b == 'Free' ) {
return '<img title="Free internet access" alt="Free internet access" src="/css/images/hotel/free-intel.gif">' ;
} else {
return '<img title="' + b + '" alt="' + b + '" src="/css/images/hotel/internet.png">' ;
}
} else if ( a == "3" ) {
if ( b == 'Free' ) {
return '<img title="Free internet access" alt="Free internet access" src="/css/images/hotel/wifi-free.gif">' ;
} else {
return '<img title="' + b + '" alt="' + b + '" src="/css/images/hotel/wifi.gif">' ;
}
} else if ( a == "4" ) {
if ( b == 'Free' ) {
return '<img title="Free internet access" alt="Free internet access" src="/css/images/hotel/wifi-intel-free.gif">' ;
} else {
return '<img title="' + b + '" alt="' + b + '" src="/css/images/hotel/wifi-intel.gif">' ;
}
} else {
return "NO" ;
}
} else {
return "NO" ;
}
}
function showPaymantMsg ( payType ) {
if ( payType == 'instant confirm' ) {
return paymenttip ( 'instant' ) ;
} else if ( payType == 'Prepay' ) {
return paymenttip ( 'Prepay' ) ;
} else if ( payType == 'Pay at hotel' ) {
return paymenttip ( 'Payathotel' ) ;
}
}
function showDalyRate ( R ) {
return '<td><span class="red_price">' + R + '</span></td>' ;
}
function showAllDaylyRate ( Ds , isHT ) {
var dayNum = Ds . length ;
var Str = "" ;
for ( var i = 0 , n = 0 , k = 0 ; i <= 6 ; i ++ ) {
//var DateArr = new Date(D).toString().split(" ");
//Ds[i].dateline,Ds[i].price
var dayIndex = ( k < dayNum ) ? new Date ( Ds [ n ] . dateline ) . getDay ( ) : 10 ;
if ( i == dayIndex ) {
if ( Ds [ n ] . price == 0 )
{ Str += showDalyRate ( 'n/a' ) ; }
else
{ Str += showDalyRate ( '$' + ( isHT ? Math . ceil ( Ds [ n ] . price * 0.847 ) : Ds [ n ] . price ) ) ; }
n ++ ; k ++ ;
if ( i == 6 && k < dayNum ) {
i = - 1 ;
Str += "</tr><tr>" ;
}
} else {
Str += showDalyRate ( ' ' ) ;
}
}
return Str ;
}
function showAllDaylyRateJL ( DR , Tid ) {
var filterArr = new Array ( ) ;
for ( i = 0 ; i < DR . length ; i ++ ) {
if ( DR [ i ] . ratetype == Tid )
{
var Str = DR [ i ] . night ;
var D = "" ;
eval ( 'D= new Date(\'' + Str . replace ( /[\-\s\:]/g , '\',\'' ) + '\')' )
DR [ i ] . timeStmp = D . getTime ( ) ;
filterArr . push ( DR [ i ] ) ;
}
}
//排序
filterArr . sort ( function ( a , b ) { return ( a . timeStmp - b . timeStmp ) ; } ) ;
var Str = "" , totalPrice = 0 ;
var dayNum = filterArr . length ;
for ( var i = 0 , n = 0 , k = 0 ; i <= 6 ; i ++ ) { //i 7天计数,n价格日期计数,k已经输出的价格数量
var dayIndex = ( k < dayNum ) ? new Date ( filterArr [ n ] . timeStmp ) . getDay ( ) : 10 ;
if ( i == dayIndex ) {
Str += showDalyRate ( '$' + filterArr [ n ] . businessprice ) ;
totalPrice = totalPrice + Number ( filterArr [ n ] . businessprice ) ;
n ++ ; k ++ ;
if ( i == 6 && k < dayNum ) { i = - 1 ; Str += "</tr><tr>" ; }
} else {
Str += showDalyRate ( ' ' ) ;
}
}
Str += '<tr><td class="totalPrice" colspan="7"><strong>Total:</strong>' +
'<span class="red_price avgrate">$' + totalPrice +
'</span></td>' ;
return Str ;
}
//JL酒店显示
function showJlPriceItem ( R , Rtid ) {
var getPayUrl = function ( Rate , typeid ) { for ( var i = 0 ; i < Rate . length ; i ++ ) { if ( Rate [ i ] . ratetype == typeid ) { return Rate [ i ] . BookURL } ; } } //从系列中取出预订地址
var getShowFp = function ( Rate , typeid ) { for ( var i = 0 ; i < Rate . length ; i ++ ) { if ( Rate [ i ] . ratetype == typeid ) { return Rate [ i ] . businessprice } ; } } //从系列中取出任意一个做价格
var getPriceTN = function ( typeid ) { for ( var i = 0 ; i < jlRateType . length ; i ++ ) { if ( jlRateType [ i ] . id == typeid ) { return jlRateType [ i ] . ratetypeEnName } } ; } //取价格代码名称
var getRoomLeft = function ( Rate , typeid ) { for ( var i = 0 ; i < Rate . length ; i ++ ) { var left = 0 ; if ( Rate [ i ] . qtyable < left || left == 0 ) { left = Rate [ i ] . qtyable } ; return left ; } } //取余房数
var ratetype = new Array ( ) ;
for ( var k = 0 ; k < R . length ; k ++ ) {
var nf = true ;
for ( var kkk = 0 ; kkk < ratetype . length ; kkk ++ ) {
if ( R [ k ] . ratetype == ratetype [ kkk ] ) {
nf = false ;
}
}
if ( nf ) ratetype . push ( R [ k ] . ratetype ) ;
}
var priceTypeCount = ratetype . length ;
if ( priceTypeCount = 1 ) {
var roomLeft = getRoomLeft ( data . rate , ratetype [ 0 ] ) ;
Str = '<table style="width:100%" id="lower-jl-' + Rtid + '">' +
' < tbody > < tr > < td width = "50%" style = "text-align:left" > \
< span class = "red_price avgrate2" onmouseover = "$(\'#lower-jl-day-'+Rtid+'\').fadeIn(300);" \
onmouseout = "$(\'#lower-jl-day-'+Rtid+'\').fadeOut(300);" > $ '+getShowFp(data.rate,ratetype[0])+' < / s p a n > \
'+ getPriceTN(ratetype[0]) +' < span title = "Only '+ roomLeft +' Room Left" style = "color:red" > < sup > [ '+roomLeft+' ] < / s u p > < / s p a n > ' +
'<div id="lower-jl-day-' + Rtid + '" style="display:none;position:absolute;" class="roomrateInfo">' +
'<table cellspacing="0" cellpadding="0" border="0"><tbody>' +
'<tr><th width="63%" scope="col">Su</th><th width="37%" scope="col">Mo</th>' +
'<th width="37%" scope="col">Tu</th><th width="37%" scope="col">We</th>' +
'<th width="37%" scope="col">Th</th><th width="37%" scope="col">Fr</th>' +
'<th width="37%" scope="col">Sa</th></tr>' +
//'<tr>'+showAllDaylyRate(data.rate,isHT)+'</tr>'+
'<tr>' + showAllDaylyRateJL ( data . rate , ratetype [ 0 ] ) + '</tr>' +
'</tbody></table>' +
'</div>' +
'</td><td width="30%"><a href="JavaScript:void(0)" onclick="jsGetToPost(\'' + getPayUrl ( data . rate , ratetype [ 0 ] ) + '\',\'\',\'_top\')">' +
'<img src="/css/images/hotel/book-button.png" alt="Book this hotel" title="Book this room"></a></td>' +
'<td>' + ( ( priceTypeCount > 1 ) ? '<img onclick="showJLMoerPrice()" title="More Price Style" src="/pic/yellow-arrow.gif">' : '' ) + '</td></tr>' + /*more price style*/
'</tbody></table>' ;
}
if ( priceTypeCount > 1 ) {
Str += ' < div id = "RoomID9-Muty" class = "RoomTypeInfoAll" \
style = "display:none;background-color: #FFFFFF; margin: -1px 0px 0px -1px; border: 1px solid rgb(255, 242, 225);" > ' ;
for ( var jj = 0 ; jj < ratetype . length ; jj ++ ) {
var roomLeft = getRoomLeft ( data . rate , ratetype [ jj ] ) ;
Str = '<table style="width:100%" id="lower-jl-' + Rtid + '">' +
' < tbody > < tr > < td width = "50%" style = "text-align:left" > \
< span class = "red_price avgrate2" onmouseover = "$(\'#lower-jl-day-full-'+Rtid+'\').fadeIn(300);" \
onmouseout = "$(\'#lower-jl-day-full-'+Rtid+'\').fadeOut(300);" > $ '+getShowFp(data.rate,ratetype[jj])+' < / s p a n > \
'+ getPriceTN(ratetype[jj]) +' < span title = "Only '+ roomLeft +' Room Left" style = "color:red" > < sup > [ '+roomLeft+' ] < / s u p > < / s p a n > ' +
'<div id="lower-jl-day-full-' + Rtid + '" style="display:none;position:absolute;" class="roomrateInfo">' +
'<table cellspacing="0" cellpadding="0" border="0"><tbody>' +
'<tr><th width="63%" scope="col">Su</th><th width="37%" scope="col">Mo</th>' +
'<th width="37%" scope="col">Tu</th><th width="37%" scope="col">We</th>' +
'<th width="37%" scope="col">Th</th><th width="37%" scope="col">Fr</th>' +
'<th width="37%" scope="col">Sa</th></tr>' +
//'<tr>'+showAllDaylyRate(data.rate,isHT)+'</tr>'+
'<tr>' + showAllDaylyRateJL ( data . rate , ratetype [ jj ] ) + '</tr>' +
'</tbody></table>' +
'</div>' +
'</td><td width="30%"><a href="JavaScript:void(0)" onclick="jsGetToPost(\'' + getPayUrl ( data . rate , ratetype [ jj ] ) + '\',\'\',\'_top\')">' +
'<img src="/css/images/hotel/book-button.png" alt="Book this hotel" title="Book this room"></a></td>' +
'<td> </td></tr>' + /*more price style*/
'</tbody></table>' ;
}
Str += '</div>' ;
}
return Str ;
}
}
function showJLMoerPrice ( ) {
p = $ ( '#RoomID9-simple' ) . offset ( ) ;
w = $ ( '#RoomID9-simple' ) . width ( ) ;
$ ( "#RoomID9-Muty" ) . css ( {
'left' : p . left , 'top' : p . top ,
'position' : 'absolute' , 'width' : w
} ) . show ( ) ;
if ( $ ( "#RoomID9-Muty" ) . attr ( 'hv' ) != 'true' ) {
$ ( "#RoomID9-Muty" ) . attr ( 'hv' , 'true' ) ;
$ ( "#RoomID9-Muty" ) . hover ( function ( ) { } , function ( ) { $ ( this ) . hide ( ) ; } )
}
}
function ShowHideTr ( e )
{
$ ( e ) . find ( "img" ) . toggle ( ) ;
$ ( e ) . parents ( "tbody" ) . find ( 'tr[name]' ) . toggle ( ) ;
}
var RateTb = function ( hid ) {
return '<table width="100%" border="0" cellpadding="0" cellspacing="0" id="Hotel' + hid + '" class="hotelPriceTab" data="new">' +
'<thead>' +
' <tr>' +
' <th scope="col"></th>' +
' <th width="4%" ></th>' +
' <th width="10%" scope="col">Internet</th>' +
' <th width="20%" scope="col">Payment</th>' +
' <th colspan="2" scope="col">Normal Rate</th>' +
' </tr>' +
'</thead>' +
'<tbody>' +
' <tr>' +
' <td colspan="6"><img src="/css/images/flight/loading.gif" /></td>' +
' </tr>' +
'</tbody>' +
'</table>' ; }
function getMorePrice ( hotelid , dataStr , o , ctime ) {
var Obj = $ ( "#Hotel" + hotelid ) ;
var ClickO = $ ( o ) ;
if ( Obj . size ( ) == 0 ) {
ClickO . parents ( ".eachhotelList" ) . append ( RateTb ( hotelid ) ) ;
Obj = $ ( "#Hotel" + hotelid ) ;
}
if ( ClickO . text ( ) == "More Price Details" ) {
if ( Obj . attr ( "data" ) == "new" ) {
//获取数据Obj.show();
var datatmp = dataStr . split ( "|" ) ;
if ( ctime != '1' ) { //whether get cookie time
datatmp [ 0 ] = GetCookie ( "searchhotel" , "starttime" ) ;
datatmp [ 1 ] = GetCookie ( "searchhotel" , "endtime" ) ;
}
$ . ajax ( {
url : "/api/api.asp?method=cht.hotel.rate" ,
dataType : "json" ,
data : "hotelid=" + hotelid + "&starttime=" + datatmp [ 0 ] + "&endtime=" + datatmp [ 1 ] + "&datatype=json" ,
type : "POST" ,
success : function ( data ) {
if ( data . statues == "0" ) {
var HotelObj = eval ( 'data.Hotel' + hotelid ) ;
WHICH = HotelObj . sourcePR ; //where the price from ?isHT = (HotelObj.sourcePR=="HT")?true:false;
HotelObj . roomType . sort ( function ( a , b ) {
return ( a . sortPrice - b . sortPrice ) ;
} ) ;
$ ( "#Hotel" + hotelid ) . find ( ">thead" ) . html ( getPriceTh ( WHICH ) ) ;
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . html ( '' ) ;
var RoomTypeCount = HotelObj . roomType . length ;
hideNum = 0 ;
for ( ii = 0 ; ii < RoomTypeCount ; ii ++ ) {
if ( HotelObj . roomType [ ii ] . isOnrequest != 'true' ) {
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . append ( getTr ( HotelObj . roomType [ ii ] , 1 , WHICH , ii - hideNum ) ) ;
} else {
hideNum ++ ;
}
}
if ( RoomTypeCount - hideNum > 3 ) {
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . append ( getTr ( [ RoomTypeCount ] , 2 , WHICH ) ) ;
}
if ( ( RoomTypeCount - hideNum ) == 0 ) {
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . append ( getTr ( hotelid , 3 , WHICH ) ) ;
}
Obj . attr ( "data" , "complete" ) ;
} else {
alert ( "System is busy. Please try to refresh your browser ...." ) ;
}
}
} ) ;
} else {
//不获取进接显示
}
ClickO . text ( "Hide Price Details" ) ;
Obj . show ( ) ;
} else {
ClickO . text ( "More Price Details" )
Obj . hide ( ) ;
}
}
//提交隐藏的表单
function subFTForm ( ) {
/*搜索结果页则ajax请求, 否则提交表单*/
var url = location . href ;
var patt = new RegExp ( "search-hotel.asp" ) ;
if ( patt . test ( url ) ) {
subFTForm2 ( ) ;
} else {
$ ( "#listCondition" ) . trigger ( "submit" ) ;
}
}
//提交隐藏的表单
function subFTForm2 ( ) {
$ . ajax ( {
type : "post" ,
data : $ ( "#listCondition" ) . serialize ( ) ,
url : "/hotel/ajax-hotel-list.asp" ,
beforeSend : function ( ) { loading = true ; } ,
complete : function ( ) { loading = false ; } ,
success : function ( msg ) {
$ ( "#contentRight2" ) . html ( msg ) . hide ( ) . slideDown ( 500 ) ;
}
} ) ;
}
//左边筛选
function getFTmenu ( ) {
$ . ajax ( {
type : "post" ,
data : $ ( "#listCondition" ) . serialize ( ) ,
url : "/hotel/condition.asp" ,
beforeSend : function ( ) { showBg ( "condition" ) } ,
success : function ( msg ) {
$ ( "#condition" ) . html ( msg ) ; //update the content
$ ( "#myBGTopDiv" ) . fadeOut ( 200 ) ; //remove the cover div
setTimeout ( '$("#myBGTopDiv").remove()' , 200 ) ;
}
} ) ;
}
//==============
//切换左边的菜单
function Togle ( obj , id ) {
var mObj = $ ( obj ) ;
var sObj = $ ( "#" + id ) ;
if ( sObj . is ( ":hidden" ) ) {
sObj . slideDown ( "slow" ) ;
mObj . removeClass ( "filtercategoryclose" ) . addClass ( "filtercategory" ) ;
} else {
sObj . slideUp ( "slow" ) ;
mObj . removeClass ( "filtercategory" ) . addClass ( "filtercategoryclose" ) ;
}
}
//文本ID, 是否覆盖[即原来的值还有], 值, 点击的对象
function fTHotels ( inputID , isOver , val , e ) {
var clickObj = $ ( e ) ;
var clickPerantObj = clickObj . parents ( "div" ) ;
var clickPerentObjID = clickPerantObj . attr ( "id" ) ;
var newVal = "" ;
//sortSort 顺序
//sortPrice 价格
//sortRating 星级
//sortType 类型
//sortFacilties 设施
//sortDistrict 周边城市
switch ( clickPerentObjID )
{
case "sortSort" :
newVal = val ;
break ;
case "sortPrice" :
clickObj . siblings ( ) . attr ( "class" , "unselect2" ) . end ( ) . attr ( "class" , "select2" ) ;
newVal = val ;
break ;
case "sortRating" :
clickObj . siblings ( ) . attr ( "class" , "unselect2" ) . end ( ) . attr ( "class" , "select2" ) ;
newVal = val ;
break ;
case "sortType" :
if ( clickObj . attr ( "class" ) == "select" ) {
clickObj . attr ( "class" , "unselect" ) ;
} else {
clickObj . attr ( "class" , "select" ) ;
}
$ ( "#sortType .select" ) . each ( function ( i ) {
if ( newVal . length > 0 ) { newVal = newVal + "," + $ ( this ) . attr ( "val" ) ; } else { newVal = $ ( this ) . attr ( "val" ) ; }
} ) ;
break ;
case "sortFacilties" :
if ( clickObj . attr ( "class" ) == "select" ) {
clickObj . attr ( "class" , "unselect" ) ;
} else {
clickObj . attr ( "class" , "select" ) ;
}
$ ( "#sortFacilties .select" ) . each ( function ( i ) {
if ( newVal . length > 0 ) { newVal = newVal + "," + $ ( this ) . attr ( "val" ) ; } else { newVal = $ ( this ) . attr ( "val" ) ; }
} ) ;
break ;
case "sortDistrict" :
break ;
default :
}
var Obj = $ ( "#listCondition #" + inputID ) ;
Obj . val ( newVal ) ;
if ( clickPerentObjID == "sortPrice" || clickPerentObjID == "sortRating" || clickPerentObjID == "sortType" ) { getFTmenu ( ) }
$ ( "#listCondition #page" ) . val ( 1 ) ; //return to first page
subFTForm ( ) ;
}
//ajax 翻页
function goToPage ( p ) {
$ ( "#listCondition #page" ) . val ( p ) ;
$ ( "#contentRight2 " ) . children ( ) . hide ( ) ;
$ ( document ) . scrollTop ( 350 ) ;
$ ( "#contentRight2" ) . append ( "<div class=\"hotelLoading\"><table width=\"100%\" border=\"0\"><tr><td width=\"56%\" align=\"center\" valign=\"middle\"><span class=\"loadingStyle1\">We are updating your hotel list.</span><br /><span class=\"loadingStyle2\">Please don't close this window.</span><br /></p><img src=\"/css/images/flight/loading.gif\" width=\"136\" height=\"10\" /><br /></td><td width=\"44%\" class=\"withLine\"><img src=\"/css/images/hotel/loading.jpg\" /></td></tr></table></div>" ) ;
subFTForm ( ) ;
}
//付款方式提示
function paymenttip ( payT ) {
if ( payT == 'Prepay' ) { //预付
return "Book and get confirmation after payment." ;
} else if ( payT == "instant" ) { //时实支付
return 'Pay now and get Real Time confirmation.' ;
} else if ( payT == "Payathotel" ) { //前台现付
return 'After making a reservation we send an email confirmation which includes all your booking details and your hotel reservation number.' ;
}
}
//=============================================
var searchHotelInputCity = [ "Beijing" , "Guangzhou" , "Guilin" , "Hangzhou" , "Hong Kong" , "Kunming" , "Nanjing" , "Shanghai" , "Shenzhen" , "Xi'an" , "Suzhou" , "Wuhan" , "Chengdu " , "Chengde" , "Chongqing " , "Dali" , "Dunhuang" , "Emeishan" , "Jingdezhen" , "Jiuzhaigou" , "Harbin" , "Huangshan" , "Lhasa" , "Lanzhou" , "Lijiang " , "Pingyao" , "Putuoshan" , "Qingdao" , "Sanya" , "Urumqi" , "Xishuangbanna" , "Yangshuo" , "Shangri La" , "Zhangjiajie" , "Zhouzhuang" , "Wuyishan" , "Wutaishan" , "Aanqiu" , "Antu" , "Anshan" , "Anshun" , "Anyang" , "Baoding" , "Baoji" , "Baoting" , "Baotou" , "Beihai" , "Benxi" , "Binhai" , "Boxing" , "Cangnan" , "Changchun" , "Changshan" , "Changdaoxian" , "Changsha" , "Changshou" , "Changshu" , "Changxingdao" , "Changzhou" , "Chaozhou" , "Chenzhou" , "Chifeng" , "Cixi" , "Datong" , "Dandong" , "Daxin" , "Deqing" , "Diqing" , "Dongguan" , "Dongying" , "Dalian" , "Dengfeng" , "Donggang" , "Duyun" , "Erdos" , "Faku" , "Fenghua" , "Fengshan" , "Fenyang" , "Foshan" , "Fuling" , "Fushun" , "Fuyang" , "Fuzhou" , "Ganzhou" , "Gaobeidian" , "Guangde" , "Guangrao" , "Guangyuang" , "Guiyang" , "Haicheng" , "Haikou" , "Haiyan" , "Handan" , "Hengyang" , "Hefei" , "Hohhot" , "Hongcun" , "Huizhou" , "Huludao" , "Hunyuan" , "Huzhou" , "Jiangmen" , "Jiangyin" , "Jiashan" , "Jinan" , "Jiaozuo" , "Jiaxing" , "Jilin" , "Jingmen" , "Jingzhou" , "Jining" , "Jinjiang" , "Jinzhou" , "Jiujiang" , "Jiuquan" , "Kaifeng" , "Kaihua" , "Kaili" , "Kaiping" , "Kashgar" , "Korla" , "Laixi" , "Lianyungang" , "Linan" , "Lingwu" , "Lishui" , "Liuyang" , "Liuzhou" , "Longquan" , "Longyan" , "Longsheng" , "Luanchuan" , "Luoyang" , "Luxi" , "Meizhou" , "Mianyang" , "Mudanjiang" , "Nanchang" , "Nandaihe" , "Nanning" , "Nankangshi" , "Ningbo" , "Nantong" , "Nanchuan" , "Panan" , "Penglai" , "Pingyang" , "Pingyao" , "Pinghu" , "Pujiang" , "Putian" , "Qufu" , "Qingyuan" , "Qinhuangdao" , "Qinzhou" , "Qionghai" , "Quanzhou" , "Rizhao" , "Rongchang" , "Shangqiu" , "Shangrao" , "Shantou" , "Shaoshan" , "Shaoxing" , "Shengzhou" , "Shenyang" , "Shijiazhuang" , "Shishi" , "Shiyan" , "Shouguang" , "Songpan" , "Songyuan" , "Suqian" , "Taian" , "Taicang" , "Taining" , "Taishun" , "Taiyuan" , "Taizhou" , "Tengchong" , "Tianjin" , "Tianshui" , "Tianzhushan" , "Tonglu" , "Urumqi" , "Wafangdian" , "Wanning" , "Wanzhou" , "Weifang" , "Weihai" , "Wenxi" , "Wenzhou" , "Wuhan" , "Wuhu" , "Wujiang" , "Wulong" , "Wutaishan" , "Wuxi" , "Wuzhen" , "Wuzhou" , "Xiangfan" , "Xiangshui" , "Xiangyang" , "Xianyang" , "Xinchang" , "Xinghua" , "Xining" , "Xinxiang" , "Xiamen " , "Xianju " , "Xuchang" , "Xuzhou" , "Yancheng" , "Yangcheng" , "Yangjiang" , "Yangquan" , "Yangzhong" , "Yangzhou" , "Yanji" , "Yantai" , "Yibin" , "Yichang" , "Yili" , "Yinchuan" , "Yiwu" , "Yixing" , "Yizheng" , "Yongcheng" , "Yongji" , "Yongjia" , "Yongxiu" , "Yueyang" , "Yuncheng" , "Yuquanshan" , "Yuyao" , "Zhangjiagang" , "Zhangjiajie" , "Zhanjiang" , "Zhaoqing" , "Zhangzhou" , "Zhashuixian" , "Zhengzhou" , "Zhenjiang" , "Zhongshan" , "Zhuhai" , "Zhuji" , "Zhuzhou" , "Zibo" , "Zigong" , "Zunyi" ] ;
var fsTips = function ( o ) {
var i = 0 ;
var cssName = Array ( 'boderflash1' , 'boderflash2' , 'boderflash3' , 'boderflash4' , 'boderflash5' , 'boderflash6' ,
'boderflash6' , 'boderflash5' , 'boderflash4' , 'boderflash3' , 'boderflash2' , 'boderflash1' ) ;
var interval = setInterval ( function ( ) {
if ( i > 0 ) o . removeClass ( cssName [ i - 1 ] ) ;
o . addClass ( cssName [ i ] ) ;
i ++ ;
if ( i > 11 ) { clearInterval ( interval ) ; o . removeClass ( cssName [ 11 ] ) ; }
} , 200 ) ;
}
/*详细页价格展示*/
function checkHotelRate ( hotelid , sino ) {
var t1 = $ ( "#changeDate #starttime2" ) . val ( ) ;
var t2 = $ ( "#changeDate #endtime2" ) . val ( ) ;
$ ( "#changeDate #hotelnight" ) . html ( Math . ceil ( ( new Date ( t2 ) - new Date ( t1 ) ) / 86400000 ) ) ;
$ ( "#changeDate #TxtSdate" ) . html ( t1 ) ;
$ ( "#changeDate #TxtEdate" ) . html ( t2 ) ;
$ ( "#changeDate #TxtSdateDay" ) . html ( new Date ( t1 ) . getDayName ( 1 ) + '.' ) ;
$ ( "#changeDate #TxtEdateDay" ) . html ( new Date ( t2 ) . getDayName ( 1 ) + '.' ) ;
$ ( "#changeDate>div" ) . eq ( 2 ) . show ( ) . end ( ) . eq ( 1 ) . hide ( ) ;
$ ( "#hotelRate>img" ) . show ( ) ;
$ ( "#hotelRate>table" ) . hide ( ) ;
$ . ajax ( {
url : "/api/api.asp?method=cht.hotel.rate" ,
dataType : "json" ,
data : "hotelid=" + hotelid + "&starttime=" + t1 + "&endtime=" + t2 + "&datatype=json" ,
type : "POST" ,
success : function ( data ) {
if ( data . statues == "0" ) {
var HotelObj = eval ( 'data.Hotel' + hotelid ) ;
WHICH = HotelObj . sourcePR ; //where the price from ?
HotelObj . roomType . sort ( function ( a , b ) {
return ( a . sortPrice - b . sortPrice ) ;
} ) ;
$ ( "#Hotel" + hotelid ) . find ( ">thead" ) . html ( getPriceTh ( WHICH ) ) ;
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . html ( '' ) ;
var RoomTypeCount = HotelObj . roomType . length ;
show3 = true ;
for ( ii = 0 ; ii < RoomTypeCount ; ii ++ ) {
if ( HotelObj . roomType [ ii ] . isOnrequest != 'true' ) {
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . append ( getTr ( HotelObj . roomType [ ii ] , 1 , WHICH , ii , 1 ) ) ;
show3 = false ;
}
}
if ( show3 ) {
$ ( "#Hotel" + hotelid ) . find ( ">tbody" ) . append ( getTr ( hotelid , 3 , WHICH ) ) ; //If on request then show email link
}
$ ( "#hotelRate>img" ) . hide ( ) ;
$ ( "#hotelRate>table" ) . fadeOut ( 350 ) ;
$ ( "#hotelRate>table" ) . fadeIn ( 380 ) ;
} else {
alert ( "System is busy. Please try to refresh your browser ...." ) ;
}
}
} ) ;
}
pageID = ( ( typeof pageID ) == 'undefined' ) ? "" : pageID ;
function searchHotel ( cityid , queryStr , callBack , o ) {
$ . facebox . settings . opacity = 0.3 ;
$ . facebox . settings . outClose = false ;
$ ( o ) . siblings ( ) . removeClass ( 'active' ) . end ( ) . addClass ( 'active' ) ;
$ ( ".hotelTypeDiv" ) . next ( ".hotelTypeactive" ) . animate ( { left : $ ( o ) . position ( ) . left + 30 } , 'fast' ) ;
$ . facebox ( '<h1>Updating your results …</h1>' ) ;
$ . getJSON ( '/api/api.asp?method=cht.hotel.getHotelList&cityID=' + cityid + '&' + queryStr , callBack ) ;
}
function searchBack ( data ) {
var Str = function ( H ) { return ' \
< div id = "h'+H.HotelId+'" class = "eachhotelList" > \
< div class = "hotelName" > < a href = "/hotel'+H.HotelUrl+'" > '+H.HotelName+' < / a > < s p a n c l a s s = " ' + s h o w s t a r ( H . H o t e l S t a r ) + ' s t a r " > < / s p a n > \
'+showNew(H.RenovateDate)+' \
< / d i v > \
< div class = "image-review" > < a rel = "nofollow" title = "Kingtown Hotel Plaza Shanghai" url = "'+H.HotelPic.replace('-s.','-m.')+'" class = "jq_preview" href = "/hotel'+H.HotelUrl+'" > < img width = "70" height = "70" border = "0" class = "outSide" title = "hotel name" src = "'+H.HotelPic+'" > < / a > \
'+showrating(H.HotelRating)+' \
< / d i v > \
< div class = "hotelInfo" > '+shoeFreeS(H.FreeService)+' \
< p > < span class = "hotelAddress" > '+H.HotelAddr+' < / s p a n > < b r > \
'+H.HotelSpecial+' < / p > \
< p > '+showLocat(H.HotelLocation)+' < / p > \
< / d i v > \
< div class = "hotelPriceDiv" > \
'+instantHotel(H.HotelPromotion,H.HotelPriceSn)+' \
< div class = "price" > '+showprice(H.HotelPrice)+' * < / d i v > \
< span class = "roomType" > '+H.LRTypeName+' < / s p a n > ' + s h o w I n t e r ( H . L R I n t F r e e , H . L R H a s I n t e r n e t )
+ ( ( H . HotelBrkNum > 0 ) ? '<span class="breakfast promo"></span>' : '' ) + ' < br > \
< a rel = "nofollow" class = "morePirce" onClick = "getMorePrice('+H.HotelId+',\''+H.startTime+'|'+H.endTime+'\',this)" href = "javascript:void(0);" > More Price Details < / a > < / d i v > \
< div class = "clear" > < / d i v > \
< / d i v > ' ; }
i = data . Hotels . length ;
$ ( "#hotelindexLeft>.eachhotelList" ) . remove ( ) ;
$ ( "#hotelindexLeft>p" ) . remove ( ) ;
$ ( "#hotelindexLeft>#pageSelect" ) . remove ( ) ;
for ( j = 0 ; j < i ; j ++ ) {
var hotel = data . Hotels [ j ] ;
$ ( "#hotelindexLeft" ) . append ( Str ( hotel ) ) ;
}
$ . facebox . close ( ) ;
$ ( "#hotelindexLeft a.jq_preview" ) . preview ( ) ;
function showprice ( p ) {
return ( p > 0 ) ? '<span class="hotelPrice">$' + p + '+</span>/night' : '<span class="onrequest">On Request</span>' ;
}
function showrating ( r ) {
return ( r > 0 ) ? '<div class="hotelReview"> <span class="hotelRate">' + r + '</span>/5</div>' : '' ;
}
function showLocat ( l ) {
return ( l . length > 0 ) ? '<span class="strong">Near:</span> ' + l : '' ;
}
function showstar ( s ) {
switch ( s ) {
case "1" : return "star5" ;
case "2" : return "star4" ;
case "3" : return "star3" ;
case "8" : return "star4s" ;
case "9" : return "star5s" ;
case "4" : return "star2" ;
default : return "tourisstars" ;
}
}
function showInter ( free , has ) {
if ( free == 'True' ) {
if ( has == '1' || has == '2' ) {
return '<span class="internet promo"></span>' ;
} else if ( has == '3' ) {
return '<span class="wifi promo">' ;
} else if ( has == '4' ) {
return '<span class="wifi promo"></span><span class="internet promo"></span>' ;
}
} else {
if ( has == '1' || has == '2' ) {
return '<span class="iternetPay promo"></span>' ;
}
}
return '' ;
}
function showNew ( d ) {
if ( d != "" ) {
var dt = new Date ( d ) . getTime ( ) ;
var dn = new Date ( ) . getTime ( ) ;
if ( ( dn - dt ) < 3600 * 1000 * 24 * 360 ) {
return '<span class="new promo"></span>' ;
}
}
return '' ;
}
function shoeFreeS ( f ) {
if ( f . indexOf ( '94' ) != - 1 ) {
return '<span class="airport promo"></span>' ;
} else if ( f . indexOf ( '95' ) != - 1 ) {
return '<span class="pazhouTrs promo"></span>' ;
} else if ( f . indexOf ( '96' ) != - 1 ) {
return '<span class="lobbywifi promo"></span>' ;
} else {
return '' ;
}
}
function instantHotel ( p , s ) {
for ( var i = 0 ; i < p . length ; i ++ ) {
if ( p [ i ] . Code == '236028' ) {
if ( p [ i ] . sn2 == s ) {
return '<span class="instantHotel promo"></span>' ;
}
}
}
return '' ;
}
function promotion ( p ) {
var hasGJH = hasYLF = hasSXX = false ; var info = '' ;
for ( var i = 0 ; i < p . length ; i ++ ) {
if ( p [ i ] . Code == '236025' ) hasGJH = true ;
if ( p [ i ] . Code == '236030' ) hasYLF = true ;
if ( p [ i ] . Code == '236035' ) hasSXX = true ;
if ( p [ i ] . info . length > 0 ) info += '<div class="hotelpromoInfo">' + p [ i ] . info + '</div>' ;
}
return hasGJH ? '<span class="pazhou promo"></span>' : '' + hasYLF ? '<span class="toppicks promo"></span>' : '' + hasSXX ? '<span class="timelypromo promo"></span>' : '<div class="clear"></div>' + info ;
}
}
$ ( function ( ) {
$ . getJSON ( '/api/api.php?method=jl.ratetype' , function ( e ) { jlRateType = e } ) ;
var shcity = $ ( "input[name='city']" ) ;
$ ( ".citySelect" ) . click ( function ( ) {
$ ( "#hotelcityList2" ) . hide ( 200 ) ;
$ ( "#hotelcityList" ) . fadeIn ( 200 ) ;
} ) ;
$ ( ".closeIt" ) . click ( function ( ) {
$ ( "#hotelcityList" ) . fadeOut ( 200 ) ;
} ) ;
$ ( "#hotelcityList a" ) . click ( function ( ) {
$ ( "#city" ) . val ( $ ( this ) . text ( ) ) ;
$ ( ".citySelect a" ) . html ( $ ( this ) . text ( ) ) ;
$ ( "#hotelcityList" ) . hide ( ) ;
} ) ;
shcity . keyup ( function ( ) {
var val = $ ( this ) . val ( ) ;
var cityNum = searchHotelInputCity . length ;
var resultStr = "" ;
if ( val . length < 1 ) {
} else if ( val . length == 1 ) {
$ ( "#hotelcityList2" ) . hide ( ) ;
} else {
$ ( "#hotelcityList" ) . hide ( ) ;
$ ( ".dropDownList li" ) . remove ( )
for ( var i = 0 ; i < cityNum ; i ++ ) {
if ( val . toLowerCase ( ) == searchHotelInputCity [ i ] . substring ( 0 , val . length ) . toLowerCase ( ) ) {
resultStr += "<li><a href=\"javascript:;\">" + searchHotelInputCity [ i ] + "</a></li>" ;
}
}
if ( resultStr == "" ) { resultStr = "<li>No such city</li>" }
$ ( ".dropDownList" ) . append ( resultStr ) ;
$ ( "#hotelcityList2" ) . show ( ) ;
$ ( "#hotelcityList2 a" ) . click ( function ( ) {
shcity . val ( $ ( this ) . text ( ) ) ;
$ ( "#hotelcityList2" ) . hide ( ) ;
getMaimHotel ( $ ( this ) . text ( ) ) ;
} ) ;
}
} ) ;
$ ( "#starttime" ) . datepicker ( {
showAnim : "fadeIn" ,
duration : 0 ,
minDate : 0 ,
maxDate : "2y" ,
numberOfMonths : 3 ,
showButtonPanel : true
} ) . bind ( 'dateSelected' ,
function ( e , selectedDate , $td ) {
$ ( "#endtime" ) . val ( new Date ( selectedDate ) . addDays ( 3 ) . asString ( ) ) ;
$ ( "#endtime" ) . focus ( ) ; $ . datepicker . dpDiv ;
}
) ;
$ ( "#endtime" ) . datepicker ( {
showAnim : "fadeIn" ,
duration : 0 ,
minDate : 0 ,
maxDate : "2y" ,
numberOfMonths : 3 ,
showButtonPanel : true ,
ortherDP : 'starttime'
} ) ;
//$(".moreOption").find("span:first").click(function(){$(".moreOption").toggle('slow')});
//鼠标移动显示大图
if ( typeof $ . fn . preview == 'function' ) { $ ( "a.jq_preview" ) . preview ( ) ; }
//鼠标移到显示提示
$ ( "img.newReview" ) . hover (
function ( ) {
$ ( "#" + $ ( this ) . attr ( "cm" ) ) . show ( ) ;
} ,
function ( ) {
$ ( "#" + $ ( this ) . attr ( "cm" ) ) . hide ( ) ;
}
) ;
//可以分别执行的
if ( pageID == "list" || pageID == "search" ) getFTmenu ( ) ;
$ ( "#hotelsearchpanelform" ) . bind ( 'submit' , function ( ) {
form = $ ( this ) ;
today = new Date ( ) . getTime ( ) ;
city = form . find ( "#city" ) . val ( ) ;
starttimev = form . find ( "#starttime" ) . val ( ) ;
endtimev = form . find ( "#endtime" ) . val ( ) ;
starttime = Date . fromString ( starttimev ) . getTime ( ) ;
endtime = Date . fromString ( endtimev ) . getTime ( ) ;
if ( city . length <= 0 ) { fsTips ( $ ( ".selectCities" ) ) ; return false ; }
if ( starttimev . length <= 0 ) { fsTips ( $ ( "#starttime" ) ) ; return false ; }
if ( endtimev . length <= 0 ) { fsTips ( $ ( "#endtime" ) ) ; return false ; }
if ( starttime >= endtime ) {
fsTips ( $ ( "#starttime" ) ) ;
fsTips ( $ ( "#endtime" ) ) ;
return false ;
}
if ( endtime - starttime > 86400000 * 15 ) {
alert ( 'If you want to book the hotel for more than 15 nights, please send us an email at alex@chinahighlights.com.' ) ;
fsTips ( $ ( "#starttime" ) ) ;
fsTips ( $ ( "#endtime" ) ) ;
return false ;
}
} ) ;
var timers ;
var hideObj = function ( nObj ) { timers = setTimeout ( function ( ) { nObj . hide ( ) } , 1000 ) ; }
$ ( "#mainMenu img" ) . hover ( function ( ) {
//$(this).parents("a").siblings(".subMenu,.subMenuRight").show();
} , function ( ) {
//$(this).parents("a").siblings(".subMenu,.subMenuRight").hide();
hideObj ( $ ( this ) . parents ( "a" ) . siblings ( ".subMenu,.subMenuRight" ) ) ;
} ) . click ( function ( e ) {
e . preventDefault ( ) ;
$ ( this ) . parents ( "a" ) . siblings ( ".subMenu,.subMenuRight" ) . show ( ) ;
} ) ;
$ ( "#mainMenu .subMenu,#mainMenu .subMenuRight" ) . hover ( function ( ) { clearTimeout ( timers ) ; } , function ( ) { hideObj ( $ ( this ) ) } ) ;
var mapdiv = $ ( ".googleMapWindow" ) ;
$ ( "#ShowHotelMap" ) . click ( function ( ) {
if ( $ ( this ) . text ( ) == "View on Map" )
{
mapdiv . slideDown ( 600 ) ;
$ ( this ) . text ( "Close on Map" ) ;
}
else
{
mapdiv . slideUp ( 600 ) ;
$ ( this ) . text ( "View on Map" ) ;
}
} ) ;
var url = location . href ;
var patt = new RegExp ( "search-hotel.asp" ) ;
if ( patt . test ( url ) ) {
subFTForm2 ( ) ;
}
var FeeTel = function ( ) {
var _tel1 = function ( v , tel _obj ) {
$ ( ".tollfreeDiv" ) . html ( tel _obj [ v ] ) ;
}
var tel _obj = {
"en-gb" : " 0800 0327753" ,
"en-au" : " 1800 764678" ,
"all" : " 800 2682918 / 86 773 2831999"
} ;
$ . get ( "/uc-client/AspHttp_Accept_Language.asp" , function ( data ) {
switch ( data ) {
case "en-gb" :
_tel1 ( data , tel _obj ) ;
break ;
case "en-au" :
_tel1 ( data , tel _obj ) ;
break ;
default :
_tel1 ( "all" , tel _obj ) ;
break ;
}
} ) ;
} ; if ( $ ( ".tollfreeDiv" ) . size ( ) > 0 ) { FeeTel ( ) ; }
//$.get('/community/template/hotel/Tmp-201202/footer-bottompromo.htm',function(data){$("#bottomPromo").html(data)});
//2012-10-23 trip advisoer show price action.
if ( pageID == "info" && $ ( "#hotelService .service" ) . size ( ) > 0 ) {
$ ( "#hotelService .service" ) . after ( "<div class='persistentCR' style='display: none;'>" + $ ( ".hide-persistentCR" ) . html ( ) + "</div>" ) ;
var sTags = $ ( ".persistentCR" ) ;
sTags _top = sTags . offset ( ) . top ;
$ ( window ) . unbind ( "scroll" ) ;
$ ( window ) . bind ( "scroll" , function ( ) {
try {
var self _top = $ ( this ) . scrollTop ( ) ;
if ( self _top > sTags _top && self _top > $ ( "#hotelService .service" ) . offset ( ) . top ) {
$ ( ".persistentCR" ) . show ( ) ;
sTags . css ( { "position" : "fixed" , "top" : 0 , "width" : 756 , "z-index" : 10 , "background" : "#FFFFFF" , "border-bottom" : "2px solid #A31022" } ) ;
} else {
$ ( ".persistentCR" ) . hide ( ) ;
sTags . css ( { "position" : "static" , "background" : "none" } ) ;
}
} catch ( err ) { }
} ) ;
}
} ) ;