// JavaScript Document
$ ( function ( ) {
var sdates = $ ( "#hotelstarttime,#hotelendtime" )
. datepicker ( { showAnim : "fadeIn" , duration : 0 , minDate : 0 , maxDate : "2y" , numberOfMonths : 3 , showButtonPanel : true } ) ;
shcity = $ ( "a[name='city']" ) ;
$ ( "#hotelcityList a" ) . click ( function ( ) {
$ ( "#citys" ) . val ( $ ( this ) . text ( ) ) ;
shcity . text ( $ ( this ) . text ( ) ) ;
$ ( "#hotelcityList" ) . hide ( ) ;
} ) ;
$ ( "a[name='city']" ) . click ( function ( ) {
$ ( "#hotelcityList" ) . fadeIn ( 200 ) ;
} ) ;
$ ( ".closeIt" ) . click ( function ( ) {
$ ( "#hotelcityList" ) . fadeOut ( 200 ) ;
} ) ;
$ ( "#introContent p:not(:first)" ) . hide ( ) ;
$ ( "#introContent" ) . slideDown ( ) ;
var mapdiv = $ ( "#mapEara" ) , mapbtn = $ ( "#ShowHotelMap" ) ;
$ ( ".mapcontrolButton" ) . click ( function ( ) {
if ( mapbtn . text ( ) == "Close Map" )
{
mapdiv . slideUp ( 600 ) ;
mapbtn . text ( "Show Map" ) ;
}
else
{
mapdiv . slideDown ( 600 ) ;
mapbtn . text ( "Close Map" ) ;
}
} ) ;
getFTmenu ( ) ;
if ( typeof $ . fn . preview == 'function' ) { $ ( "a.jq_preview" ) . preview ( ) ; }
} ) ;
//显示房型
function showRoom ( ) {
if ( ReadyRate )
{
clearInterval ( showRoomT ) ;
pastRoom ( ) ;
}
}
//价格展示
function pastRoom ( )
{
$ ( ".eachhotelList table[data^='Hotel']" ) . each ( function ( ) {
RObjId = $ ( this ) . attr ( "data" ) ;
EachObj = eval ( 'hotelRate.' + RObjId ) ;
isHT = ( EachObj . sourcePR == "HT" ) ? true : false ;
$ ( this ) . find ( "tbody" ) . html ( '' ) ;
EachObj . roomType . sort ( function ( a , b ) {
return ( a . sortPrice - b . sortPrice ) ;
} ) ;
RoomTypeCount = EachObj . roomType . length ;
for ( ii = 0 ; ii < RoomTypeCount ; ii ++ ) {
$ ( this ) . find ( ">tbody" ) . append ( getTr ( EachObj . roomType [ ii ] , 1 , isHT , ii ) ) ;
}
if ( RoomTypeCount > 3 ) {
$ ( this ) . find ( ">tbody" ) . append ( getTr ( [ RoomTypeCount ] , 2 , isHT ) ) ;
}
if ( RoomTypeCount == 0 ) {
$ ( this ) . find ( ">tbody" ) . append ( getTr ( RObjId , 3 , isHT ) ) ;
}
} ) ;
}
//
function getTr ( data , type , isHT , index ) {
var trStr = "" ;
var HideStr = "" ;
switch ( type ) {
case 1 :
HideStr = ( index >= 3 ) ? 'name="roomtr" style="display:none"' : "" ;
trStr = '<tr ' + HideStr + '>' +
'<td class="roomType" onmouseout="$(\'#rooms' + data . RTsn + '\').hide();" ' +
'onmouseover="$(\'#rooms' + data . RTsn + '\').show();" ' +
'id="td' + data . RTsn + '"><span classname="roominfoavailable">' + data . RoomTypeName + '</span><br>' +
'<span class="roominfoNone">' + ( ( data . RoomBreakfast != '' ) ? '(' + data . RoomBreakfast + ')' : '' ) + '</span>' +
'<div id="rooms' + data . RTsn + '" 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 . RTsn + '\').fadeOut(300);" onmouseover="$(\'#p' + data . RTsn + '\').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 . RTsn + '" class="onOutHotel">' +
'<div class="arrowUp"></div>' +
showPaymantMsg ( data . RoomPayment ) + '</div>' + data . RoomPayment + '</td>' +
'<td><span onmouseout="$(\'#div' + data . RTsn + '\').fadeOut(300);" onmouseover="$(\'#div' + data . RTsn + '\').fadeIn(300);"' +
'class="red_price avgrate2">$' + data . avgPrice + '</span>' +
'<div id="div' + data . RTsn + '" style="display:none;position:absolute;" class="roomrateInfo">' +
'<table cellspacing="0" cellpadding="0" border="0"><tbody>' +
'<tr><th width="63%" scope="col">Daily Room Rates</th><th width="37%" scope="col"> </th></tr>' +
showAllDaylyRate ( data . rate ) +
'<tr><td class="totalPrice" colspan="2"><strong>Total:</strong><span class="red_price avgrate">$' +
data . totalPrice + '</span></td></tr></tbody></table>' +
'</div>' +
'</td><td><a onclick="jsGetToPost(\'' + data . BookURL + '\',\'\',\'_top\')" href="JavaScript:void(0)">' +
'<img title="Book this hotel" alt="Book this hotel" src="/css/images/hotel/book-button.png"></a></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 showPromotion ( Str ) {
if ( Str . length > 0 ) {
Str = Str . split ( '|_' ) ;
return '<img onmouseout="$(\'#Promo' + data . RTsn + '\').hide();" onmouseover="$(\'#Promo' + data . RTsn + '\').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 . RTsn + '">' +
'<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="Free internet access" alt="Free internet access" 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="Free internet access" alt="Free internet access" 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="Free internet access" alt="Free internet access" src="/css/images/hotel/wifi-intel.gif">' ;
}
}
} 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 ( D , R ) {
var DateArr = new Date ( D ) . toString ( ) . split ( " " ) ;
return '<tr><td>' + DateArr [ 1 ] + '. ' + DateArr [ 2 ] + ', ' + DateArr [ 3 ] + '</td><td><span class="red_price">$' + R + '</span></td></tr>' ;
}
function showAllDaylyRate ( Ds ) {
var n = Ds . length ;
var Str = "" ;
for ( i = 0 ; i < n ; i ++ ) {
Str += showDalyRate ( Ds [ i ] . dateline , Ds [ i ] . price ) ;
}
return Str ;
}
}
function ShowHideTr ( e )
{
$ ( e ) . find ( "img" ) . toggle ( ) ;
$ ( e ) . parents ( "tbody" ) . find ( 'tr[name]' ) . toggle ( ) ;
}
function showHideLocation ( e )
{
var eimg = $ ( e ) . find ( 'img' ) , textStr = $ ( "#localMore" ) , Obj = $ ( ".hideLocation" ) ;
if ( Obj . css ( "display" ) == "block" )
{
Obj . css ( "display" , "none" ) ; //Obj.hide();
textStr . html ( "More Location Select<img src=\"/css/images/hotel/double-arrow-down.png\" align=\"absmiddle\">" ) ;
//eimg.attr("src","/css/images/hotel/double-arrow-down.png");
}
else
{
Obj . css ( "display" , "block" ) ;
textStr . html ( "Less Location Select<img src=\"/css/images/hotel/double-arrow-up.png\" align=\"absmiddle\"" ) ;
//eimg.attr("src","/css/images/hotel/double-arrow-up.png");
}
}
//==============
//切换左边的菜单
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" ) ;
}
}
//提交隐藏的表单
function subFTForm ( ) {
$ ( "#listCondition" ) . trigger ( "submit" ) ;
}
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 ) ;
}
} ) ;
}
//ajax 翻页
function goToPage ( p ) {
$ ( "#listCondition #page" ) . val ( p ) ;
$ ( "#contentRight2 " ) . children ( ) . hide ( ) ;
$ ( document ) . scrollTop ( 350 ) ;
$ ( "#contentRight2" ) . append ( "<img src=\"/pic/horloading.gif\" style=\"padding:100px;\"/>" ) ;
subFTForm ( ) ;
}
//文本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 ) ;
$ ( "#listCondition #page" ) . val ( 1 ) ; //return to first page
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.' ;
}
}
function Guaranteetip ( ) {
return 'Our lowest price guarantee is only <strong>available for the lowest price room type that we use from each hotel.</strong> All claims must <strong>compare the same room in the same hotel on the same day</strong>. The comparison <strong>must include the same items (breakfast, service fees and tax)</strong> as us. For the guarantee, you <strong>must finish your payment within our specified advanced booking time</strong>. For instant hotel booking, you must pay online directly. For prepay hotels, the advanced booking time must be based on our quote email. The prices are <strong>not guaranteed until after payment</strong>. If you find a cheaper price from another site, please contact with the website address of the offer. We will check it. If it is valid we <strong>will debit your account for the difference</strong>.' ;
}