﻿//Copyright © Business Travel News, LLC. All Rights Reserved - code may not be reused in whole or in part without written consent- removal of this section consitutes a copyright violation
var tpwin; var pgevt;var div;var divIdx;var nc=new Array();var ajevt=null;var bpaTrack=false;var lgu='';var usrv=false;var dbg=false
var lgPID; var istp = false; var acced = false; var last = null; var lastT = null; var lastP = null; var lnk; var pncls = 'clsPin1'; 
var nTopOffset = 162; 

function myrnd(){return Math.round(Math.random() * 10000000000)}
function appndURL(u,a){if (u.indexOf('?')==-1){u = u + '?'}else{u = u + '&'};u = u + a;return u}

function _UserID(){var i=readCookie("UserKey");if (i==null){i=0};return i}
function _vpr(){var i=readCookie("vpr");if (i==null){i="WM"};return i}
function _Cmpstyle(){var i=readCookie("mapstyle");if (i==null){i='r';}return i}
function _sUserID(v){if (v=="0"){eraseCookie("UserKey")}else{createCookie("UserKey",v,365)}}
function _svpr(v){if (v==""){eraseCookie("vpr")}else{createCookie("vpr",v,365)}}
function _sCmpstyle(v){createCookie("mapstyle",v,365)}
function _SelPlaces() { var i = readCookie("SelPlaces"); if (i == null) { i = 0 }; return i }
function _sSelPlaces(v) { if (v == "") { eraseCookie("SelPlaces") } else { createCookie("SelPlaces", v, 1) } }

function setFocus(o){if(o){try{o.focus()}catch(e){}}}
function getObj(objID) {if (document.getElementById){return document.getElementById(objID);}else if (document.all){return document.all[objID];}else if (document.layers){return document.layers[objID];}}
function _pgEvt(){var e;try{e=event}catch(err){};return e}
function _cnEvt(evt){try{evt = (evt) ? evt : window.event;evt.returnValue = false;evt.cancelBubble = true;}catch(err){};}
function createCookie(name,value,days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
function readCookie(cookie_name) {var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );  if ( results ){return ( unescape ( results[1] ) )}else{return null}}
function eraseCookie(name) {createCookie(name,"",-1);}
function showError(error) {alert(error.get_message())}
function OnDataFail(error){showError(error);return;}

function OnFailed2(error){ showError(error);}
function donothing(){}
function disablelink(a){a.disabled=true;a.onclick=dontdo;a.href=''}
function enablelink(a,href){a.disabled=false;a.onclick='';a.href = href;}
function dontdo() { return false }

function _getratings(s) { var r = ''; $(s + " INPUT").map(function() { r = r + ($(this).attr("checked") ? 'true' : 'false') + '|' }); return r }


//do this to get referer on window.location calls
function winloc(u) {
    if (!suptwinloc()) { window.location = u; return; } 
    var a = document.createElement("a");
    if (!a.click) { window.location = u; return; }
    a.setAttribute("href", u); 
    a.style.display = "none";
    document.body.appendChild(a); //prototype shortcut
    a.click();
}
 function refreshwin(c) {

     if (c == undefined) { c = true }
     var u = window.location.href
     if (c) { u = window.location.pathname }
     var n = new String(u).length
     var l = new String(u).substring(n-1, n+1)
     if (l.toString() == "#") {         u = new String(u).substring(0, n - 1)     }

     window.location = u
 }
function suptwinloc() {
    var b=true;
    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
        var ffversion = new Number(RegExp.$1) // capture x.x portion and store as a number
        b = ffversion < 5;
    }
    return b;
}

  
 function serviceProxy(serviceUrl) {
     var _I = this;
     this.serviceUrl = serviceUrl;
     this.invoke = function(method, data, callback, error) {
         var json = JSON.stringify(data);
         var url = _I.serviceUrl + method;
         $.ajax({
             url: url,
             data: json,
             type: "POST",
             contentType: "application/json; charset=utf-8",
             dataType: "json",
             success: function(data) {
                 if (data.d) { data = data.d }
                 if (!callback) return; callback(data); return;
             },
             error: function(err) { if (!error) return; error(err); return; }
         });
     }
 }
 function AjaxFailed(result) { alert(result.status + ' ' + result.statusText);hidewait(); }
 DynaProxy = new serviceProxy("/Hotels/Dyna.asmx/");
 function onCloseP(a) { var o = $find(a); if (o) { o.hidePopup(); } }

// **************  START PAGE TRACKING ********************************************************
 function myTrackPageView(u, r, a) {
     if (a == undefined) { a = "" }
     var orgu = u; qs = ""; qs2 = "";
     if (u.indexOf('?') != -1) { qs = u.substring(u.indexOf('?') + 1); qs2 = "?" + qs }
     try { initTracking(); u = s.prop1 + "/AJAX/" + a; } catch (e) { };
    try { pageTracker._trackPageview(u + qs2); } catch (e) { };
     try { s.prop70 = a; s.prop1 = u; s.prop2 = qs; s.t(); } catch (e) { };
     try { ntptEventTag(u + qs2); } catch (e) { };
     if (bpaTrack) {
         var _BPAtrk = new Image(1, 1)
         _BPAtrk.src = "http://secure-us.imrworldwide.com/cgi-bin/m?ci=us-bpaww&cg=0&cc=1&si=http://www.businesstravel.com" + escape(orgu) + "&rnd=" + Math.ceil(Math.random() * 1000000000);
     }
     if (r) { window.setTimeout(rotateads, 1000) }
 }
 
 
function myTrackEvent(category,action,label, value){
    if (value!='' || label!=''){      var val=value; if (val==''){val=label};} 
    try{pageTracker._trackEvent(category, action,label, value)}catch(e){};
    
}
// **************  END PAGE TRACKING ********************************************************
// **************  START USER REG ********************************************************  
function doLogout(){_sUserID(0); window.location=window.location}
function dologin(q){var s=appndURL(location.href,q);window.location=lgu+ '?sh=0&caller=' + escape(s)}
function doProfile(){window.location=lgu+ '?action=editprofile&sh=0&caller=' + escape(location.href)}
function showSignup(){window.location=lgu+ '?sh=0&caller=' + escape(location.href)}
// **************  END USER REG ********************************************************  


// **************  START USER REVIEW ********************************************************  
function savRat(n){var bhv=$find('bhvRating');bhv.set_Rating(n);savMyRating();}
function updMyRating(){lblInstr.style.display='none'}
function forcelg2() {if (window.confirm("You must be logged in to review this hotel. Click 'OK' to Login or Register, click 'Cancel' to continue using the site")){dologin('act=' + "rvw,0");}}
function forcelg() { var bhv = $find('bhvRating'); if (window.confirm("You must be logged in to rate this hotel. Click 'OK' to Login or Register, click 'Cancel' to continue using the site")) { var n = bhv.get_Rating(); dologin('act=' + "savRat," + n) } else { bhv.set_Rating(orgrat) } }
function savMyRating() {
    var bhv = $find('bhvRating'); var n = bhv.get_Rating(); 
    if (n != orgrat) {
        if (orgrat == 0) { updMyRating() };
          var DTO = { 'R': n, 'PK': ppk };
          DynaProxy.invoke("SaveQuickRating", DTO, function(data) { }, AjaxFailed)
}}
function openRatings(){window.open('/hotels/Hotel-Classifications?sa=1','FacClassification','width=1040,height=600,resizable,scrollbars');}
// **************  END USER REVIEW ********************************************************  

// **************  START APP MESSAGES ********************************************************  
var TPTOH=0;
function showTPPop(bhv,parentID,evt,md){if (md==null){md=2;}pnlTPMsg.style.display=''; if (parentID!=null){$find(bhv+ 'PopupBehavior').set_parentElement(parentID);} $find(bhv + 'PopupBehavior').set_positioningMode(md);if (parentID==null){ $find(bhv+ 'PopupBehavior').set_y(pHeight()/3); $find(bhv+ 'PopupBehavior').set_x(winWidth()/3)};$find(bhv).showPopup();if (parentID==null){$find(bhv+ 'PopupBehavior').set_y(pHeight()/3); $find(bhv+ 'PopupBehavior').set_x(winWidth()/3)};_cnEvt(evt);}
function hideTPPop(bhv){ var b=$find(bhv+ 'PopupBehavior'); if (b){b._hidePopup();}}
function shTPMsg(parentID,  msg,evt,pos,h,t){if (h==null){h=true};showTPMsg(parentID,  msg,evt,pos) ;if(h){ hideTPMsg(true,t);}}
function showTPMsg(parentID,  msg,evt,md){ if (md==null){md=2}; if (TPTOH>0){window.clearTimeout(TPTOH);TPTOH=0}; document.getElementById('divTPMsg').innerHTML=msg; showTPPop('popTPMsgOn',parentID,evt,md)}
function hideTPMsg(fd,t){if (!t){t=3000};   if (fd){TPTOH=window.setTimeout(hideTPMsgto,t)}else{_cnEvt();hideTPPop('popTPMsgOn');}}
function hideTPMsgto(){pnlTPMsg.style.display='none';  TPTOH=0}
// **************  START END MESSAGES ********************************************************  



// **************  GUI ELEMENTS ********************************************************
function hidewait() {new overlayModuleTrips().hideOverlay()}

function showWait(msg){
    if (!msg){msg='Applying Changes'}
    new overlayModuleTrips().showOverlay("/widgets/Wait?s=" + escape(msg),false)
}
// **************  GUI ELEMENTS ********************************************************  



// **************  START AJAX POPUP ********************************************************  
var bLastX=-1
function OnAJAXPopDataSucceeded(r, typ){if (r!=''){showdetail(r,typ)}}
function closePAj2(e){window.setTimeout(closePAj,25)}//if this is done to quickly on click, it causes an error
function closePAjRef(e){window.location=window.location;  }
function closePAj() {
    new overlayModuleTrips().hideOverlay()
    hideModal('aj')
 }
 function closeAj() {
     b = $find('popBhvAj'); if (b) { b.hidePopup() }
}
function rAJAXPop(u,typ,arg,e){_cnEvt(e);if (typ=='DEST' ){jumpDest(u)}else{  showdetail('nw',typ,u) }}
function setDetail(c,h){c="<div id=ajTop2></div>"+c;pnlCnt.innerHTML=c;if (isMoz()){pnlCnt.style.height= h + 'px';}else{pnlCnt.style.height= h;}}
function showdetail(r, t, u) {
    _cnEvt();
    mShowModalWin('HotelQuickView', 'aj', u, 550, 720, 10, true, false, 'HotelQuickView', true)

}	

function showAJAXPop(bhv,evt){$find(bhv).show(); _cnEvt(evt);}
function hideAJAXPop(bhv){$find(bhv).hide()}


function mEnablePage(){}

function mDisablePage() {
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight + document.documentElement.scrollTop;

    var layer = document.createElement('div');
    layer.style.zIndex = 2;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.scrollHeight + 'px';
    layer.style.width = width + 'px';
    layer.style.backgroundColor = 'gray';
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.style.position = 'static';
    document.body.appendChild(layer);  
}

function hideModal(n){ if (document.getElementById('layer')){document.body.removeChild( document.getElementById('layer'))};document.body.style.position = '';if (document.getElementById(n)) { document.body.removeChild(document.getElementById(n)) } }
function mShowModalWin(name,id,src,h,w,t,trn,cntr,type,bHeight) {
    _cnEvt();

try{
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight + document.documentElement.scrollTop;
   mDisablePage()
    var size = { 'height':h, 'width': w };
    var i = document.createElement('iframe');
    i.name = name;
    i.id = id;
    if (size.height>0 && bHeight){src=appndURL(src,"h=" + size.height)}
    i.src = '/hotels/ifrblank.htm'// no white    
    i.scrolling='no';
    i.style.height = size.height + 'px';
    i.style.width = size.width + 'px';
    t=(document.documentElement.scrollTop-20)+t;
    i.style.position = 'absolute';
    i.style.zIndex = 3000;
    if (trn){i.allowTransparency=true}
    else{
      i.style.backgroundColor = 'white';
      i.style.border = '2px solid silver';
    }
    i.frameBorder = 'no';	
   
    if (cntr){i.style.top = '100px'}else{    
    i.style.top = t + 'px'}
    i.style.left = (width / 2) - (size.width / 2) + 'px';		
    document.body.appendChild(i); 
    i.src = src;    
   // myTrackEvent('Popup','ShowPopup',name, '')
} catch (e) {
alert(e.description)
//TRAVEL42WS.LogJSError(e.description, 'mShowModalWin;' + name, donothing, donothing)
}
}
function isDate(dateStr) {
    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
    var matchArray = dateStr.match(datePat); // is the format ok?
    return matchArray != null
}
function DateAdd(timeU,byMany,dateObj) {
	var millisecond=1;
	var second=millisecond*1000;
	var minute=second*60;
	var hour=minute*60;
	var day=hour*24;
	var year=day*365;

	var newDate;
	var dVal=dateObj.valueOf();
	switch(timeU) {
		case "ms": newDate=new Date(dVal+millisecond*byMany); break;
		case "s": newDate=new Date(dVal+second*byMany); break;
		case "mi": newDate=new Date(dVal+minute*byMany); break;
		case "h": newDate=new Date(dVal+hour*byMany); break;
		case "d": newDate=new Date(dVal+day*byMany); break;
		case "y": newDate=new Date(dVal+year*byMany); break;
	}
	return newDate;
}
function AND(a, b) {
    var result = 0;
    var x = binaryArray(parseInt(a));
    var y = binaryArray(parseInt(b));
    var biggerArray = (x.length >= y.length) ? x : y;
    var smallerArray = (biggerArray == x) ? y : x;
    var len = biggerArray.length;
    for (var i = 0; i < len; i++) {
        biggerArray[i] = (biggerArray[i] & smallerArray[i]) ? 1 : 0;
        result += biggerArray[i] * Math.pow(2, i);
    }
    return result;
}



function binaryArray(num) {
    var arr = new Array();
    var div;
    var mod;
    var n = num;
    var count = 0;
    do {
        mod = n % 2;
        n = parseInt(n / 2);
        arr[count++] = mod;
    } while (n > 0)
    return arr;
}

// **************  START BROWSER  ********************************************************  
function pWidth(){var w=winWidth(); if (w>1050){w=1050}else{w=900};return w}   
function pWidth2(){var w=winWidth();if (w>730){w=730};return w;}   
function pHeight2(){var h=winHeight();if (h>600){h=600};return h;}   
function pHeight(){var h=winHeight();return h;}     

function scrollTop(){
  var scr = 0
  if( isMoz()) {
    scr = window.pageYOffset;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    scr = document.documentElement.scrollTop;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    scr = document.body.scrollTop;  
   }
  return scr;
}
function setscrollTop(x){
  if( isMoz()) {
    window.pageYOffset=x;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
     document.documentElement.scrollTop=x;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
     document.body.scrollTop=x
   }
  
}
function winWidth(){
  var myWidth = 0
  if( isMoz()) {
    myWidth = window.innerWidth;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;  }
  
  return myWidth;
}
function isMoz(){return  (typeof( window.innerHeight ) == 'number') }
function isIE(){return !isMoz()}
function isIE7(){if (isIE()){return (navigator.appVersion.indexOf('MSIE 7')!=-1 || navigator.appVersion.indexOf('MSIE 8')!=-1)}else{return false}}
function isIE6p(){if (isIE()){return !(isIE7())}else{return false}}
function winHeight(){
  var myHeight = 0
  if( isMoz()) {
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientHeight || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight; 
}
function f_scrollTop() {
var n=0
	if (window.pageYOffset){n= window.pageYOffset}
	else if(document.documentElement){n= document.documentElement.scrollTop}
	else if(document.body){n= document.body.scrollTop}
return n
}
function s_scrollTop() {
	if (window.pageYOffset){window.pageYOffset=0}
	else if(document.documentElement){document.documentElement.scrollTop=0}
	else if(document.body){document.body.scrollTop=0}
}
function s_scrollLeft() {
	if (window.pageXOffset){window.pageXOffset=0}
	else if(document.documentElement){document.documentElement.scrollLeft=0}
	else if(document.body){document.body.scrollLeft=0}
}

// **************  END BROWSER  ********************************************************  


// **************  START COMMON MAP ********************************************************  
var curmaplink=null;
function dogetmapdest(sb) {
    $("#pnlMapPlacesP").addClass('ColumnLinkListRef');myTrackEvent('HotMap', 'HotMapNav', sb, '');
    var DTO = { 'sFileName': sb};DynaProxy.invoke("GetMapDest", DTO, ondogetmapdest, AjaxFailed)
}
function ondogetmapdest(s) {$('#pnlMapPlacesHTML').hide();$('.pnlMapPlaces').html(s).show();$("#pnlMapPlacesP").removeClass('ColumnLinkListRef');document.getElementById('bkBox').scrollIntoView();if (curmaplink) {curmaplink.childNodes[0].className = '';curmaplink=null;}}
// **************  END COMMON MAP ********************************************************  


// **************  GUI ELEMENTS ********************************************************  
function showshelp() { mShowModalWin('MapHelp', 'aj', '/widgets/MapHelp/widget.aspx', 400, 700, 30, true, false, 'SearchHelp') }

function openClassification() { window.open('/hotels/classifications?sa=1', 'HotelClassification', 'width=1000,height=600,resizable,scrollbars'); }
function togVid(a) { var divWM = document.getElementById('divWM'); var divRM = document.getElementById('divRM'); _svpr(a); if (a == 'RM') { divRM.style.display = ""; divWM.style.display = "none"; } else { divWM.style.display = ""; divRM.style.display = "none"; } }
function tglStyle(a) { if (a.className == 'cSlideVHS') { a.className = 'cSlideVH' } else { a.className = 'cSlideVHS' } }
function showmore() { document.getElementById('divMore').className = 'cMoreS'; document.getElementById('lnkMore').className = 'cMoreH'; document.getElementById('lnkLess').className = 'cMoreS'; }
function showless() { document.getElementById('divMore').className = 'cMoreH'; document.getElementById('lnkMore').className = 'cMoreS'; document.getElementById('lnkLess').className = 'cMoreH' }
function accChanging(s, a) { var idx = a._selectedIndex; rot_pnls[idx].className = ''; rot_pnls[rot_pnlsL].className = 'cPanelROff'; rot_pnlsL = idx }
function setTab(a, i, t, s) {
    try {
        if (s != '') { s = s + '_' }
        if (t == false) { var _th = 0; eval('_th=' + i + 'tabth'); var s = 'window.clearInterval(' + _th + ')'; ; eval(s) }
        if (i == null || i == 'undefined') { i = '' }
        var _lasttab = 0
        eval('_lasttab=' + i + 'lasttab')
        if (_lasttab != -1) {
            var t = document.getElementById(i + "celTab" + _lasttab)
            var c = document.getElementById(i + "divTab" + _lasttab)
            t.className = s + "clsTabOff"
            c.className = s + "clsTabContentOff"
            var t = document.getElementById(i + "celTab" + a)
            var c = document.getElementById(i + "divTab" + a)
            t.className = s + "clsTabOn"
            c.className = s + "clsTabContentOn"
        }
        eval(i + 'lasttab=a')
    } catch (e) { }
}
var tabplayer;
function inittabplayer(a) { tabplayer = a; eval(a + "tabth=window.setInterval(shownext,7000)") }
function shownext() { var _lasttab = 0; var _tabcount = 0; eval('_tabcount=' + tabplayer + 'tabcount'); eval('_lasttab=' + tabplayer + 'lasttab'); var l = _lasttab + 1; if (l > _tabcount) { l = 1 }; setTab(l, tabplayer, true) }


function setSlide(a, i, t) {
    if (t == false) { var _th = 0; eval('_th=' + i + 'tabth'); var s = 'window.clearInterval(' + _th + ')'; ; eval(s) }
    if (i == null || i == 'undefined') { i = '' }
    var _lasttab = 0
    eval('_lasttab=' + i + 'lasttab')
    if (_lasttab != -1) {
        var t = document.getElementById(i + "celTab" + _lasttab)
        var c = document.getElementById(i + "divTab" + _lasttab)
        t.className = "clsSlideOff"
        c.className = "clsTabContentOff"
        var t = document.getElementById(i + "celTab" + a)
        var c = document.getElementById(i + "divTab" + a)
        t.className = "clsSlideOn"
        c.className = "clsTabContentOn"
    }
    eval(i + 'lasttab=a')

}
var slideplayer;
function initslideplayer(a) { slideplayer = a; eval(a + "tabth=window.setInterval(shownextslide,7000)") }
function shownextslide() { var _lasttab = 0; var _tabcount = 0; eval('_tabcount=' + slideplayer + 'tabcount'); eval('_lasttab=' + slideplayer + 'lasttab'); var l = _lasttab + 1; if (l > _tabcount) { l = 1 }; setSlide(l, slideplayer, true) }


function pageLoad(s, e) {
    try { pageLoad_vtab(s, e) } catch (e) { }
    try { pageLoad_htab(s, e) } catch (e) { }
    try { pageLoad_map(s, e) } catch (e) { }
    try { pageLoad_temp(s, e) } catch (e) { }
}
function rotatingTab(settingarg){
	this.setting=settingarg
	settingarg=null
	var setting=this.setting
	setting.fadeduration=parseInt(setting.fadeduration)
	setting.tabcount=parseInt(setting.tabcount)
	setting.curTab=1
	setting.ispaused=!setting.autoplay[0]
	setting.currentstep=0 //keep track of # of slides tabs has gone through
	setting.totalsteps=setting.tabcount*setting.autoplay[2]
	setting.fglayer=0, setting.bglayer=1 //index of active and background layer (switches after each change of slide)
	setting.oninit=setting.oninit || function(){}
	setting.onTabChange=setting.onTabChange || function(){}
	var tabs=this
	
		var setting=tabs.setting
		tabs.showslide(setting.curTab) //show initial slide
		setting.oninit.call(tabs) //trigger oninit() event
	
}

rotatingTab.prototype={

    showtab: function(idx){
      if (!this.setting.ispaused){this.navigate('pause')}
        this.navigate(idx)
     },
	navigate:function(keyword){
		clearTimeout(this.setting.playtimer)
		this.setting.totalsteps=100000 //if any of the nav buttons are clicked on, set totalsteps limit to an "unreachable" number 
		if (!isNaN(parseInt(keyword))){
			this.showslide(parseInt(keyword))
		}
		else if (/(prev)|(next)/i.test(keyword)){
			this.showslide(keyword.toLowerCase())
		}
		else{ //if play|pause button
			var tabs=this
			if (!this.setting.ispaused){ //if pause Gallery
				this.setting.autoplay[0]=false
			}
			else if (this.setting.ispaused){ //if play Gallery
				this.setting.autoplay[0]=true
				this.setting.playtimer=setTimeout(function(){tabs.showslide('next')}, this.setting.autoplay[1])
			}
			tabs.setting.ispaused=!tabs.setting.ispaused
		}
	},

	showslide:function(keyword){
		var tabs=this
		
		var setting=tabs.setting
		var totaltabs=setting.tabcount
		var tabindex=(keyword=="next")? (setting.curTab<totaltabs? setting.curTab+1 : 1)
			: (keyword=="prev")? (setting.curTab>1? setting.curTab-1 : totaltabs)
			: Math.min(keyword, totaltabs)		
        var t=document.getElementById(setting.wrapperid +"celTab" + setting.curTab)
        var c=document.getElementById(setting.wrapperid +"divTab" + setting.curTab)
        t.className=setting.skin + "clsTabOff"
        c.className=setting.skin + "clsTabContentOff"
        var t=document.getElementById(setting.wrapperid+"celTab" + tabindex)
        var c=document.getElementById(setting.wrapperid+"divTab" + tabindex)        
        t.className=setting.skin + "clsTabOn"
        c.className=setting.skin + "clsTabContentOn"
        

	clearTimeout(setting.playtimer)
				setting.currentstep+=1
				if (setting.autoplay[0]){
					if (setting.currentstep<=setting.totalsteps)
						setting.playtimer=setTimeout(function(){tabs.showslide('next')}, setting.autoplay[1])
					else
						tabs.navigate("play/pause")
				}
		setting.curTab=tabindex

	}
	
	}


	// **************  START AC SEARCH ********************************************************  
	$(function() {
	    var cache = {};

	    $(".SearchHotels").click(function(event) { cts(event); return false });
	    $("#txtHotelSearchTerm")
	            .keydown(function(event) { if (event.keyCode == '13') { cts(event); return false } })
	            .autocomplete({
	                source: function(request, response) {
	                    var ctscntxt = "HOTEL"
	                    var Req = new Object();
	                    Req.Term = request.term;
	                    Req.Context = ctscntxt;

	                    var DTO = { 'Request': Req };
	                    var json = JSON.stringify(DTO);
	                    $.ajax({
	                        url: "/hotels/AutoComplete.asmx/GetCompleteList",
	                        dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", data: json,
	                        error: function() { response("") },
	                        success: function(data) {
	                            if (data.d) { data = data.d }
	                            var resp = $.map(data, function(item) {
	                                item.Name = "<img align=left height=18 width=18 style='padding-right:8px;' src='/hotels/i/ac/" + item.Type + ".png'/>" + item.Name
	                                return { label: item.Name, value: item.Data, url: item.URL, placekey: item.Key, type: item.Type, src: ctscntxt }
	                            })
	                            response(resp)
	                        }
	                    })
	                },
	                minLength: 3,
	                select: function(event, ui) {
	                    var ut = ui.item
	                    var trk = ""; var trkt = "act";
	                    if (ut.type == "X") { trk = "&" + trkt + "acfm=1" }
	                    trk = trkt + "=1" + trk
	                    onACItemSelected(trk, ut.url, ut.type, ut.value, ut.placekey)
	                },
	                delay: 150,
	                open: function() { $(this).removeClass("ui-corner-all").addClass("ui-corner-top"); },
	                close: function() { $(this).removeClass("ui-corner-top").addClass("ui-corner-all"); }
	            })
	    try { $("#txtHotelSearchTerm").data("autocomplete")._renderItem = renderAC; } catch (e) { }


	});

	function renderAC(ul, item) { return $("<li></li>").data("item.autocomplete", item).append("<a>" + item.label + "</a>").appendTo(ul); };

	// **************  END AC SEARCH ********************************************************  
