var Events={TRACK:"track:TRACK",NEW_REQUIREMENTS:"requirements:NEW_REQUIREMENTS",POST_REQUIREMENTS:"requirements:POST_REQUIREMENTS",POPUP_HOTEL_BUBBLE:"map:POPUP_HOTEL_BUBBLE",CLOSE_HOTEL_BUBBLE:"map:CLOSE_HOTEL_BUBBLE",POPUP_OFFER_BUBBLE:"map:POPUP_OFFER_BUBBLE",ZOOM_HOTEL_CLUSTER:"map:ZOOM_HOTEL_CLUSTER",PACKAGE_SELECT:"hotelWidget:PACKAGE_SELECT",OFFERS_UPDATE:"offer:OFFERS_UPDATE",OFFER_UPDATE_PREFIX:"offer:OFFER_UPDATE_",HOTELS_UPDATE:"hotel:HOTELS_UPDATE",HOTEL_UPDATE_PREFIX:"hotel:HOTEL_UPDATE_",HOTELS_GET_HOTELS_INFORMATION:"hotel:HOTELS_GET_HOTELS_INFORMATION",HOTELS_CREATE_OUTPUT:"hotel:HOTELS_CREATE_OUTPUT",TALLY_UPDATE:"tally:TALLY_UPDATE",FILTER_CHANGE:"hotel:FILTER_CHANGE",FILTER_HOTELS:"hotel:FILTER_HOTELS",ROUTE_SETFROMHOTEL:"hotel:ROUTE_SETFROMHOTEL",ROUTE_SETVIAHOTEL:"hotel:ROUTE_SETVIAHOTEL",ROUTE_SETTOHOTEL:"hotel:ROUTE_SETTOHOTEL",ROUTE_REQUESTED:"hotel:ROUTE_REQUESTED",ROUTE_FOUND:"hotel:ROUTE_FOUND",ROUTE_PROXIMITY_UPDATE:"hotel:ROUTE_PROXIMITY_UPDATE"};
var Filter=$.klass({initialize:function(){this.items={bookable:false,available:false,nonss:false,openingsoon:false,unavailable:false};
this.visibleHotels=null
}});
var HotelListPanel=$.klass({initialize:function(B,D,H,E,G,I,A,F,J){var C=this;
this.div=B;
this.hotelVO=D;
this.networkFunnel=H;
this.hotelBeacon=E;
this.offerBeacon=G;
this.interactionBeacon=I;
this.requirementsBeacon=A;
this.toastBeacon=F;
this.trackBeacon=J;
this.filter=new Filter();
this.msveMap=null;
this.div.find(".hotelPanelPlus").hide();
this.div.find(".hotelPanelPlus").click(function(){C.becomeLarger()
});
this.div.find(".hotelPanelMinus, .hotelPanelMinusMini").click(function(){C.becomeSmaller()
});
this.div.find(".hotelPanelMinus").hide();
this.div.find(".hotelPanelInfoCheckAvail").click(function(){C.showForm()
});
E.bind(Events.FILTER_HOTELS,function(L,K){C.onHotelFilter(K)
});
this.hideDetails(true);
if(this.div.find(".hotelPanelInfoImage:visible").length===0){this.div.find(".hotelPanelPlus").show();
this.div.find(".hotelPanelMinus").hide();
this.div.find(".hotelPanelMinusMini").hide()
}this.initialisePackages()
},onHotelFilter:function(A){this.filter.visibleHotels=A;
this.applyFilter()
},applyFilter:function(){this.vo=this.hotelVO;
if($(this.div).is(":visible")){if((this.filter.visibleHotels===null)||(Utils.arrayIndexOf(this.filter.visibleHotels,this.vo.hotelId)!==-1)){this.div.fadeTo("fast",1)
}else{this.div.fadeTo("fast",0.2)
}}},showInfoExtra:function(){this.div.find(".hotelPanelInfoImage").show("normal");
this.div.find(".hotelPanelInfoIcons, .hotelPanelInfoLinks, .hotelPanelInfoPrice, .hotelPanelDetailLink, .hotelPanePriceBookable, .booknow, .hi-comment, .cellcode-apology, .cellcode-remora").slideDown("normal");
this.div.click()
},hideInfoExtra:function(){this.div.find(".hotelPanelInfoImage").hide("normal");
this.div.find(".hotelPanelInfoIcons, .hotelPanelInfoPrice, .hotelPanelInfoLinks, .hotelPanelDetailLink, .hotelPanePriceBookable, .booknow, .hi-comment, .cellcode-apology, .cellcode-remora").slideUp("normal");
this.div.click()
},hideWarningAndPackages:function(){this.div.find(".warningAndPackages").hide("normal")
},showWarningAndPackages:function(){this.div.find(".warningAndPackages").show("normal")
},showForm:function(){this.hideCheckAvail();
var A=this.div.find(".hotelPanelForm");
if(A.find("fieldset").length===0){A.html($(".htmlLibrary .bookingForm").html());
A.hide();
A.roomrequirements()
}A.slideDown("normal")
},hideForm:function(A){if(A===true){this.hideCheckAvail()
}else{this.showCheckAvail()
}this.div.find(".hotelPanelForm").slideUp("normal")
},showCheckAvail:function(){this.div.find(".hotelPanelInfoCheckAvail").slideDown("normal")
},hideCheckAvail:function(){this.div.find(".hotelPanelInfoCheckAvail").slideUp("normal")
},toggleDetails:function(){if(this.div.find(".hotelPanelDetails:visible").length>0){this.hideDetails()
}else{this.showDetails()
}this.div.click()
},showDetails:function(){var A=this;
this.div.find(".hotelPanelDetailLinkOpen, .hotelPanelDetailLink").text(I18N.HOTELDETAILS_HIDEMORE).addClass("hotelPanelDetailLinkOpen").removeClass("hotelPanelDetailLink");
this.div.find(".hotelPanelDetails").slideDown("normal");
this.div.click()
},hideDetails:function(A){this.div.find(".hotelPanelDetailLinkOpen, .hotelPanelDetailLink").text(I18N.HOTELDETAILS_SHOWMORE).addClass("hotelPanelDetailLink").removeClass("hotelPanelDetailLinkOpen");
if(A===true){this.div.find(".hotelPanelDetails").hide()
}else{this.div.find(".hotelPanelDetails").slideUp("normal")
}if(!A){this.div.click()
}},initialisePackages:function(){var B=this;
B.div.find(".warningAndPackages .box").addClass("box-close");
var A=function(){B.div.find(".packageParkFly input[type=radio]").hide();
B.div.find(".packageParkFly input[type=radio]").show()
};
if(this.div.find(".packageRestaurant").length>0){this.packageRestaurant=new HotelWidget(this.div.find(".packageRestaurant"),false,true,false);
this.packageRestaurant.endCallBack=A;
this.div.find(".packageRestaurant h5").click(function(){B.packageRestaurant.toggle()
})
}else{this.packageRestaurant=null
}if(this.div.find(".packageParkFly").length>0){this.packageParkFly=new HotelWidget(this.div.find(".packageParkFly"),false,true,false);
this.packageParkFly.endCallBack=A;
this.div.find(".packageParkFly h5").click(function(){B.packageParkFly.toggle()
})
}else{this.packageParkFly=null
}if(this.div.find(".packageBedAndBreakfast").length>0){this.packageBedAndBreakfast=new HotelWidget(this.div.find(".packageBedAndBreakfast"),false,true,false);
this.packageBedAndBreakfast.endCallBack=A;
this.div.find(".packageBedAndBreakfast h5").click(function(){B.packageBedAndBreakfast.toggle()
})
}else{this.packageBedAndBreakfast=null
}},becomeSmaller:function(){this.hideForm();
this.hideDetails();
this.hideInfoExtra();
this.hideForm(true);
this.hideDetails();
this.hideWarningAndPackages();
this.div.find(".hotelPanelPlus").show();
this.div.find(".hotelPanelMinus").hide();
this.div.find(".hotelPanelMinusMini").hide()
},becomeLarger:function(){this.showInfoExtra();
this.showCheckAvail();
this.showWarningAndPackages();
this.div.find(".hotelPanelPlus").hide();
this.div.find(".hotelPanelMinus").hide();
this.div.find(".hotelPanelMinusMini").show()
}});
var HotelVO=$.klass({LOADSTATUS:{INITIAL:0,LOADING:1,LOADED:2,FAILED:-1},STATUS:{BOOKABLE:"BOOKABLE",OPENINGSOON:"OPENINGSOON",UNAVAILABLE:"UNAVAILABLE",AVAILABLE:"AVAILABLE",NONSS:"NONSS"},initialize:function(D,C,G,E,A,B,F){this.hotelId=D;
this.name=C;
this.latitude=G;
this.longitude=E;
this.loadStatus=HotelVO.prototype.LOADSTATUS.INITIAL;
this.availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.INITIAL;
this.status=A;
this.availabilityStatus=B;
this.routeId=F
},getNameAsSEO:function(){return this.name.toLowerCase().replace(/ /g,"-").replace(/'|\)|\(/g,"")
}});
var HotelWidget=$.klass({initialize:function(F,A,E,C,B,D){this.div=F;
this.ieIsIncapable=(B===true);
this.stepCallback=(D===undefined)?function(){}:D;
this.endCallBack=undefined;
if(this.div.html()===""){this.div.html($(".htmlLibrary .hotelWidget").html())
}this.isOpen=C;
if(C){this.div.addClass("box-open")
}else{this.div.find(".boxbody5").hide()
}if(A){this.div.find(".box").addClass("boxkeyline")
}if(E){this.div.find(".box2").addClass("boxhollow")
}},toggle:function(){if(this.isOpen){this.close()
}else{this.open()
}},setTitle:function(A){this.div.find("h5").text(A)
},select:function(){this.div.find("input")[0].checked=true
},setOptions:function(A,B,J){var L="";
var G="optsubgrp"+Math.floor(Math.random()*100000000);
for(var D=0;
D<A.length;
D++){var C=Math.floor(Math.random()*100000000)+"";
var I=A[D][0];
var H=A[D][1];
var F=A[D][2];
var K=A[D][3];
L+='<input style="float:left; display:inline; width:13px; height:13px; margin:0 5px 0 5px;" name="'+B+'" id="opt'+C+'" value="'+K+'" type="radio"/>';
L+='<label style="font-size:1.1em; width:305px; font-weight:bold; display:block; float:left; margin:-1px 0 0 0" for="opt'+C+'">';
L+='<span style="float:right">'+I18N.CURRENCY[H]+F+"</span>";
L+=I+"</label>";
L+='<div style="clear:both"></div>'
}this.div.find("h5").before(L);
this.div.find("h5").remove();
this.div.find("input").click(function(){J.trigger(Events.PACKAGE_SELECT,[G])
});
var E=this.div.find(".box");
J.bind(Events.PACKAGE_SELECT,function(M,N){if(G===N){E.addClass("boxhi")
}else{E.removeClass("boxhi")
}})
},setTitleClick:function(A){this.div.find("h5").click(A)
},setBody:function(A){this.div.find(".boxbodyinner").html(A)
},open:function(){var A=this;
this.div.removeClass("box-close");
this.div.addClass("box-open");
var B=function(){if(A.endCallBack!==undefined){A.endCallBack()
}};
if($.browser.msie&&($.browser.version<8)&&this.ieIsIncapable){B=function(){A.div.find(".boxbodyinner").css("visibility","visible");
if(A.endCallBack!==undefined){A.endCallBack()
}}
}if($.browser.msie&&($.browser.version<7)){this.div.find(".boxbody5").slideDownWithTick("slow",B,this.stepCallback)
}else{this.div.find(".boxbody5").slideDown("slow",B)
}this.isOpen=true
},close:function(){this.div.removeClass("box-open");
this.div.addClass("box-close");
if($.browser.msie&&($.browser.version<8)&&this.ieIsIncapable){this.div.find(".boxbodyinner").css("visibility","hidden")
}if($.browser.msie&&($.browser.version<7)){this.div.find(".boxbody5").slideUpWithTick("slow",this.endCallBack,this.stepCallback)
}else{this.div.find(".boxbody5").slideUp("slow",this.endCallBack)
}this.isOpen=false
}});
var MapPanel=$.klass({initialize:function(I,E,D,N,B,A,U,C,J,F,Y,K,M){var Q=this;
this.mapContainer=I;
this.initial=E;
this.networkFunnel=D;
this.hotelBeacon=N;
this.offerBeacon=B;
this.interactionBeacon=A;
this.requirementsBeacon=U;
this.toastBeacon=C;
this.trackBeacon=J;
this.withControls=(F===true);
this.key=Y;
this.noLogo=K;
this.stafHiddenField=null;
this.stafAddendum="";
this.currentBubbleHotelId=null;
MapPanel.prototype.TOASTS=I18N.TOASTS;
this.filter=new Filter();
Msn.VE.API.Constants.vedirectionsendicon=Msn.VE.API.Constants.vedirectionsstarticon=CQ_ASSETS_URL+"images/map/search.png";
this.infoToasts={};
this.hotelIds={};
this.hotels=[];
this.offers=[];
this.llpoints=null;
this.waypoints=null;
this.requirementsVO=null;
this.postPrefix="";
this.allowSeamlessAvailability=false;
this.requirementsBeacon.bind(Events.NEW_REQUIREMENTS,function(a,b,Z){Q.onNewRequirements(b,Z)
});
this.requirementsBeacon.bind(Events.POST_REQUIREMENTS,function(b,Z,a){Q.onPostRequirements(Z,a)
});
this.onShowAsSearchResultsOnAllHotels=function(Z,a){Q.showAsSearchResultsOnAllHotels(a)
};
this.onShowAsClustersOnAllHotels=function(Z,a){Q.showAsClustersOnAllHotels(a)
};
this.onReceiveOffers=function(a,Z){Q.receiveOffers(Z)
};
this.onShowAsRouteOnProximateHotels=function(b,a,Z){Q.showAsRouteOnProximateHotels(a,Z)
};
this.onRouteRequested=function(a,Z,b){Q.routeRequested(Z,b)
};
this.onHotelClusteringChangeTimeout=function(){Q.doHotelClusteringChangeTimeout()
};
this.fnOnFilter=function(a,Z){Q.onFilter(Z)
};
this.fnOnHotelFilter=function(a,Z){Q.onHotelFilter(Z)
};
this.fnUpdateToast=function(a,Z){Q.updateToast(Z)
};
this.fnOnChangeView=function(){Q.onChangeView()
};
var H="msveMap"+Math.floor(Math.random()*10000);
this.mapContainer.css("position","relative");
this.mapContainer.append('<div id="'+H+'" style="width:100%; height:100%; position:relative"></div>');
var T=new VEMap(H);
if(M){T.SetCredentials(M)
}this.map=T;
var R=new VEMapOptions();
R.EnableBirdseye=false;
R.EnableDashboardLabels=false;
T.HideDashboard();
T.HideScalebar();
var O=(this.noLogo===true)?VEMapStyle.Shaded:VEMapStyle.Road;
T.LoadMap(this.initial,this.initial.zoom,O,false,VEMapMode.Mode2D,false,0,R);
T.SetMouseWheelZoomToCenter(false);
T.vemapcontrol.GetCurrentMode().GetBounds=function(){return new Msn.VE.Bounds(1,17,0.9,0.57,1.04,0.71)
};
T.SetZoomLevel(this.initial.zoom);
MapControl.Features.MapStyle.Hybrid=false;
MapControl.Features.MapStyle.Aerial=false;
MapControl.Features.MapStyle.BirdsEye=false;
MapControl.Features.MapStyle.View3D=false;
MapControl.Features.MapStyle.Shaded=false;
this.mapContainer.append('<div class="corner corner-tl"></div>');
this.mapContainer.append('<div class="corner corner-tr"></div>');
this.mapContainer.append('<div class="corner corner-bl"></div>');
this.mapContainer.append('<div class="corner corner-br"></div>');
if(this.withControls){this.mapContainer.append('<div class="zoomIn" style="position:absolute; left:72px; top:25px; z-index:201"><img src="'+CQ_ASSETS_URL+'images/map/zoom-plus.png" /></div>');
this.mapContainer.append('<div class="zoomOut" style="position:absolute; left:95px; top:25px; z-index:201"><img src="'+CQ_ASSETS_URL+'images/map/zoom-minus.png" /></div>');
this.mapContainer.find(".zoomOut").mousedown(function(){T.ZoomOut();
return false
});
this.mapContainer.find(".zoomIn").mousedown(function(){T.ZoomIn();
return false
});
if(this.key===undefined){var X='<div class="mapkey" style="position:absolute; right:10px; top:10px; z-index:201"><div class="mapkey2"><dl>';
X+='<dt class="clearfix search"><img src="'+CQ_ASSETS_URL+'images/map/search.png" style="margin:0 8px"/>'+I18N.MAPKEY_SEARCH+"</dt>";
X+='<dt class="clearfix bookable"><img src="'+CQ_ASSETS_URL+'images/map/bookable.png"/><span class="label">'+I18N.MAPKEY_BOOKABLE+"</span></dt>";
X+='<dt style="display:none" class="clearfix onrequirements"><img src="'+CQ_ASSETS_URL+'images/map/available.png"/>'+I18N.MAPKEY_AVAILABLE+"</dt>";
X+='<dt style="display:none" class="clearfix onrequirements"><img src="'+CQ_ASSETS_URL+'images/map/nonss.png"/>'+I18N.MAPKEY_NONSS+"</dt>";
X+='<dt class="clearfix"><img src="'+CQ_ASSETS_URL+'images/map/openingsoon.png"/>'+I18N.MAPKEY_OPENINGSOON+"</dt>";
X+='<dt style="display:none" class="clearfix onrequirements"><img src="'+CQ_ASSETS_URL+'images/map/unavailable.png"/>'+I18N.MAPKEY_UNAVAILABLE+"</dt>";
X+="</dl></div></div>";
this.mapContainer.append(X);
this.key=this.mapContainer.find(".mapkey");
this.key.find("dl dt:first").css("padding-bottom","5px")
}this.mapContainer.append('<div class="panCluster" style="display:block; position:absolute; left:10px; top:10px; z-index:201"><img src="'+CQ_ASSETS_URL+'images/map/pan-cluster.png" /></div>');
var S=function(){var Z=Q.mapContainer.find(".panCluster");
Z.unbind("mouseup",S);
Z.unbind("mouseout",S);
Z.unbind("dragstart",S);
Q.map.EndContinuousPan()
};
this.mapContainer.find(".panCluster").mousedown(function(b){$(this).bind("mouseup",S);
$(this).bind("mouseout",S);
$(this).bind("dragstart",S);
var Z=0;
var c=0;
var a=b.target;
while(a!==null){Z+=a.offsetLeft;
c+=a.offsetTop;
a=a.offsetParent
}Z=b.pageX-Z-25;
c=b.pageY-c-25;
if(Math.abs(Z)>=Math.abs(c)){if(Z>0){T.StartContinuousPan(10,0)
}else{T.StartContinuousPan(-10,0)
}}else{if(c>0){T.StartContinuousPan(0,10)
}else{T.StartContinuousPan(0,-10)
}}return false
})
}var L=this.mapContainer.width();
var V='<div class="toast" style="position:absolute; display:none; left:'+Math.floor(L/4)+"px; top:0px; width:"+Math.floor(L/2)+'px; z-index:201"><ul></ul></div>';
this.mapContainer.append(V);
this.toast=this.mapContainer.find(".toast");
this.offersLayer=new VEShapeLayer();
this.map.AddShapeLayer(this.offersLayer);
this.hotelLayer=new VEShapeLayer();
this.map.AddShapeLayer(this.hotelLayer);
this.searchPosLayer=new VEShapeLayer();
this.map.AddShapeLayer(this.searchPosLayer);
this.curClusters=[];
this.curOfferClusters=[];
var W=this.mapContainer.find(".MSVE_Map").append('<div class="bubbleLayer"></div>');
W=this.mapContainer.find(".bubbleLayer");
var P=new MapPanelHotelBubble(W,this.hotelBeacon,this.requirementsBeacon,this.interactionBeacon);
this.mapPanelHotelBubble=P;
var G=new MapPanelOfferBubble(W,this.offerBeacon);
this.mapPanelOfferBubble=G;
if(this.initial.suppressSearchIcon!==true){this.searchPosIcon=new VEShape(VEShapeType.Pushpin,this.initial);
this.searchPosIcon.SetCustomIcon('<img class="searchPosIcon" style="position:relative; top:-15px" src="'+CQ_ASSETS_URL+'images/map/search.png"/>');
this.searchPosLayer.AddShape(this.searchPosIcon)
}this.onZoomHotelCluster=function(a,Z){T.SetCenterAndZoom(Z.GetClusterShape().GetPoints()[0],T.GetZoomLevel()+1)
};
this.interactionBeacon.bind(Events.ZOOM_HOTEL_CLUSTER,this.onZoomHotelCluster);
this.onPopupHotelBubble=function(c,b){Q.currentBubbleHotelId=b.hotelId;
var a=T.LatLongToPixel(new VELatLong(b.latitude,b.longitude));
var Z=parseInt(P.div.parents(".MSVE_Map").css("left"),10);
var d=parseInt(P.div.parents(".MSVE_Map").css("top"),10);
P.div.css("left",(a.x-Z+MapPanelHotelBubble.prototype.OFFSET_X)+"px");
P.div.css("top",(a.y-d+MapPanelHotelBubble.prototype.OFFSET_Y)+"px");
a.x-=150;
T.PanToLatLong(T.PixelToLatLong(a));
if(Q.requirementsVO!==null){Q.networkFunnel.getAvailability([b])
}Q.networkFunnel.getUpdate(b);
P.update(b);
Q.updateSTAF()
};
this.interactionBeacon.bind(Events.POPUP_HOTEL_BUBBLE,this.onPopupHotelBubble);
this.onCloseHotelBubble=function(Z){Q.currentBubbleHotelId=null;
Q.updateSTAF()
};
this.interactionBeacon.bind(Events.CLOSE_HOTEL_BUBBLE,this.onCloseHotelBubble);
this.onPopupOfferBubble=function(c,b){var a=T.LatLongToPixel(new VELatLong(b.latitude,b.longitude));
var Z=parseInt(G.div.parents(".MSVE_Map").css("left"),10);
var d=parseInt(G.div.parents(".MSVE_Map").css("top"),10);
G.div.css("left",(a.x-Z+MapPanelOfferBubble.prototype.OFFSET_X)+"px");
G.div.css("top",(a.y-d+MapPanelOfferBubble.prototype.OFFSET_Y)+"px");
T.PanToLatLong(T.PixelToLatLong(a));
Q.networkFunnel.getOfferUpdate(b);
G.update(b)
};
this.interactionBeacon.bind(Events.POPUP_OFFER_BUBBLE,this.onPopupOfferBubble);
if(this.noLogo===true){this.mapContainer.find(".MSVE_PoweredByLogo").hide()
}else{this.mapContainer.find(".MSVE_PoweredByLogo").css({left:"3px",bottom:"4px"})
}this.mapContainer.find(".MSVE_Copyright").css({width:"auto",paddingLeft:"95px"});
this.mapContainer.find(".MSVE_CopyrightForeground").css("right","8px");
this.mapContainer.find(".MSVE_CopyrightBackground").css("right","7px");
T.AttachEvent("onchangeview",this.fnOnChangeView);
this.onStartZoom=function(){if(P.hotelvo!==null){P.hide()
}if(G.offervo!==null){G.hide()
}};
T.AttachEvent("onstartzoom",this.onStartZoom);
this.onEndZoom=function(){var a=parseInt(Q.mapContainer.find(".MSVE_Map").css("left"),10);
var c=parseInt(Q.mapContainer.find(".MSVE_Map").css("top"),10);
if(P.hotelvo!==null){var b=T.LatLongToPixel(new VELatLong(P.hotelvo.latitude,P.hotelvo.longitude));
P.div.css("left",(b.x-a+MapPanelHotelBubble.prototype.OFFSET_X)+"px");
P.div.css("top",(b.y-c+MapPanelHotelBubble.prototype.OFFSET_Y)+"px");
P.show()
}if(G.offervo!==null){var Z=T.LatLongToPixel(new VELatLong(G.offervo.latitude,G.offervo.longitude));
G.div.css("left",(Z.x-a+MapPanelOfferBubble.prototype.OFFSET_X)+"px");
G.div.css("top",(Z.y-c+MapPanelOfferBubble.prototype.OFFSET_Y)+"px");
G.show()
}};
T.AttachEvent("onendzoom",this.onEndZoom);
this.hotelBeacon.bind(Events.FILTER_CHANGE,this.fnOnFilter);
this.hotelBeacon.bind(Events.FILTER_HOTELS,this.fnOnHotelFilter);
this.toastBeacon.bind(Events.TALLY_UPDATE,this.fnUpdateToast);
this.offerBeacon.bind(Events.OFFERS_UPDATE,this.onReceiveOffers);
DD_belatedPNG.fix(".msveMap img");
DD_belatedPNG.fix(".toast");
DD_belatedPNG.fix(".toast .info");
DD_belatedPNG.fix(".mapkey");
DD_belatedPNG.fix(".mapkey2")
},nuke:function(B){for(var D=0;
D<this.curClusters.length;
D++){this.curClusters[D].nuke(B)
}for(var C=0;
C<this.offers.length;
C++){this.offers[C].mapPanelBlob.nuke(B)
}for(var A=0;
A<this.hotels.length;
A++){this.hotels[A].mapPanelBlob.nuke(B)
}if(B===true){if(this.interactionBeacon!==null){this.interactionBeacon.unbind(Events.ZOOM_HOTEL_CLUSTER,this.onZoomHotelCluster);
this.interactionBeacon.unbind(Events.POPUP_HOTEL_BUBBLE,this.onPopupHotelBubble);
this.interactionBeacon.unbind(Events.CLOSE_HOTEL_BUBBLE,this.onCloseHotelBubble);
this.interactionBeacon.unbind(Events.POPUP_OFFER_BUBBLE,this.onPopupOfferBubble)
}this.map.DetachEvent("onchangeview",this.fnOnChangeView);
this.map.DetachEvent("onstartzoom",this.onStartZoom);
this.map.DetachEvent("onendzoom",this.onEndZoom);
if(this.hotelBeacon!==null){this.hotelBeacon.unbind(Events.FILTER_CHANGE,this.fnOnFilter);
this.hotelBeacon.unbind(Events.FILTER_HOTELS,this.fnOnHotelFilter);
this.toastBeacon.unbind(Events.TALLY_UPDATE,this.fnUpdateToast);
this.offerBeacon.unbind(Events.OFFERS_UPDATE,this.onReceiveOffers)
}if(this.hotelBeacon!==null){this.hotelBeacon.unbind(Events.HOTELS_UPDATE,this.onShowAsSearchResultsOnAllHotels);
this.hotelBeacon.unbind(Events.HOTELS_UPDATE,this.onShowAsClustersOnAllHotels);
this.hotelBeacon.unbind(Events.ROUTE_PROXIMITY_UPDATE,this.onShowAsRouteOnProximateHotels);
this.hotelBeacon.unbind(Events.ROUTE_REQUESTED,this.onRouteRequested)
}clearTimeout(this.hotelClusteringChangeTimeout);
this.offers=[];
this.hotels=[];
this.curClusters=[];
this.interactionBeacon=this.hotelBeacon=this.toastBeacon=this.offerBeacon=null;
this.onZoomHotelCluster=this.onPopupHotelBubble=this.onCloseHotelBubble=this.onPopupOfferBubble=null;
this.fnOnFilter=this.fnOnHotelFilter=this.fnUpdateToast=this.onReceiveOffers=null;
this.onShowAsSearchResultsOnAllHotels=this.onShowAsClustersOnAllHotels=this.onShowAsRouteOnProximateHotels=this.onRouteRequested=null;
this.hotelClusteringChangeTimeout=this.onHotelClusteringChangeTimeout=null;
this.stafHiddenField=null
}},updateToast:function(C){var A="";
for(var D in this.infoToasts){A+='<li class="info">'+D+"</li>"
}for(var B=0;
B<C.length;
B++){A+="<li>"+C[B]+"</li>"
}if(A===""){if(this.toast.parents(":hidden").length>0){this.toast.stop(true,true).css("display","none")
}else{this.toast.stop(true,true).slideUp("normal")
}return 
}this.toast.find("ul").html(A);
this.toast.stop(true,true).slideDown("normal")
},onFilter:function(A){this.filter.items=A
},onHotelFilter:function(A){var B=this;
this.hotelLayer.Hide();
setTimeout(function(){B.hotelLayer.Show()
},1);
this.filter.visibleHotels=A;
setTimeout(function(){B.onChangeView2()
},100)
},doRequirementsPost:function(G,H,F,D){$("form.MapPanel_onPostRequirements").remove();
$("body").append('<form class="MapPanel_onPostRequirements" action="'+this.postPrefix+G+'" method="post"/>');
var E=$("form.MapPanel_onPostRequirements");
E.append('<input type="hidden" name="searchModel.searchTerm" value="'+Utils.htmlEntities(F.name)+'"/>');
E.append('<input type="hidden" name="searchModel.hotel.code" value="'+F.hotelId+'"/>');
E.append('<input type="hidden" name="searchModel.hotel.name" value="'+Utils.htmlEntities(F.name)+'"/>');
E.append('<input type="hidden" name="searchModel.location.location.latitude" value="'+F.latitude+'"/>');
E.append('<input type="hidden" name="searchModel.location.location.longitude" value="'+F.longitude+'"/>');
E.append('<input type="hidden" name="action" value="search"/>');
if(this.waypoints!==null){E.append('<input type="hidden" name="availabilityModel.routeFrom.searchTerm" value="'+Utils.htmlEntities(this.waypoints[0])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeFrom.point.latitude" value="'+Utils.htmlEntities(this.llpoints[0][0])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeFrom.point.longitude" value="'+Utils.htmlEntities(this.llpoints[0][1])+'"/>');
if(this.waypoints.length===2){E.append('<input type="hidden" name="availabilityModel.routeTo.searchTerm" value="'+Utils.htmlEntities(this.waypoints[1])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeTo.point.latitude" value="'+Utils.htmlEntities(this.llpoints[1][0])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeTo.point.longitude" value="'+Utils.htmlEntities(this.llpoints[1][1])+'"/>')
}else{E.append('<input type="hidden" name="availabilityModel.routeVia.searchTerm" value="'+Utils.htmlEntities(this.waypoints[1])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeVia.point.latitude" value="'+Utils.htmlEntities(this.llpoints[1][0])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeVia.point.longitude" value="'+Utils.htmlEntities(this.llpoints[1][1])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeTo.searchTerm" value="'+Utils.htmlEntities(this.waypoints[2])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeTo.point.latitude" value="'+Utils.htmlEntities(this.llpoints[2][0])+'"/>');
E.append('<input type="hidden" name="availabilityModel.routeTo.point.longitude" value="'+Utils.htmlEntities(this.llpoints[2][1])+'"/>')
}}if(D!==undefined){E.append('<input type="hidden" name="bookingSelection.hotelCode" value="'+F.hotelId+'"/>');
E.append('<input type="hidden" name="bookingSelection.substitutionWithWarning" value="true"/>');
E.append('<input type="hidden" name="bookingSelection.selectedRateClassification" value="'+D+'"/>');
for(var C=0;
C<F.availability.roomOfferSets.length;
C++){E.append('<input type="hidden" value="'+F.availability.roomOfferSets[C].rateClassification+'" name="bookingSelection.originalRoomOfferSetsFE['+C+'].rateClassification"/>');
E.append('<input type="hidden" value="'+F.availability.roomOfferSets[C].ratePlan.code+'" name="bookingSelection.originalRoomOfferSetsFE['+C+'].ratePlanCode"/>');
E.append('<input type="hidden" value="'+F.availability.roomOfferSets[C].roomOffers[0].selectedRoom.type+'" name="bookingSelection.originalRoomOfferSetsFE['+C+'].roomOffers[0].selectedRoom.type"/>')
}}var A=H.toHiddenArray();
for(var B=0;
B<A.length;
B++){E.append('<input type="hidden" name="'+A[B][0]+'" value="'+A[B][1]+'"/>')
}E[0].submit()
},onPostRequirements:function(B,A){this.doRequirementsPost("bookingSummary!execute.action",this.requirementsVO,B,A)
},onNewRequirements:function(D,C){if(this.allowSeamlessAvailability&&D.bookingOption!=="explorecalendar"){for(var B=0;
B<this.hotels.length;
B++){if(this.hotels[B].status===HotelVO.prototype.STATUS.BOOKABLE){this.hotels[B].availabilityStatus=undefined;
this.hotels[B].availability=undefined;
this.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+this.hotels[B].hotelId,[this.hotels[B]])
}}this.setRequirements(D)
}else{var A="/en/bookHotelCheckAvailability!execute.action";
if(D.bookingOption==="explorecalendar"){A="/en/search!execute.action"
}this.doRequirementsPost(A,D,C)
}},setRequirements:function(B){var A=this;
this.requirementsVO=B;
if(this.key!==false){this.key.find(".onrequirements").slideDown("normal");
this.key.find(".bookable .label").addClass("label2line").text("Availability unchecked")
}this.onChangeView();
if(this.mapPanelHotelBubble.hotelvo!==null){this.networkFunnel.getAvailability([this.mapPanelHotelBubble.hotelvo])
}},updateSTAF:function(){if(this.stafHiddenField!==null){var B=this.map.GetCenter();
var A="book.action?searchModel.location.location.latitude="+B.Latitude+"&searchModel.location.location.longitude="+B.Longitude+"&zoomLevel="+this.map.GetZoomLevel();
if(this.currentBubbleHotelId!==null){A+="&searchModel.location.hotelId="+this.currentBubbleHotelId
}this.stafHiddenField.val(A+this.stafAddendum)
}},onChangeView:function(){var A=this;
setTimeout(function(){A.onChangeView2()
},100)
},onChangeView2:function(){var E=this;
for(var F=0;
F<E.offers.length;
F++){E.offers[F].mapPanelBlob.setup()
}for(var D=0;
D<E.hotels.length;
D++){E.hotels[D].mapPanelBlob.setup()
}clearTimeout(this.hotelClusteringChangeTimeout);
this.hotelClusteringChangeTimeout=setTimeout(this.onHotelClusteringChangeTimeout,1);
this.updateSTAF();
if(this.requirementsVO===null){return 
}if(this.map.GetZoomLevel()<MapPanel.prototype.AVAIL_MIN_ZOOM){this.infoToasts[MapPanel.prototype.TOASTS.INFO_AVAIL]=true;
this.toastBeacon.broadcastKeys();
return 
}else{delete this.infoToasts[MapPanel.prototype.TOASTS.INFO_AVAIL];
this.toastBeacon.broadcastKeys()
}var B=this.map.GetMapView();
var A=[];
for(var C=0;
C<this.hotels.length;
C++){if(((this.hotels[C].routeId!==undefined)||(this.hotels[C].mapPanelBlob.forReferenceOnly!==true))&&(this.hotels[C].latitude<B.TopLeftLatLong.Latitude)&&(this.hotels[C].latitude>B.BottomRightLatLong.Latitude)&&(this.hotels[C].longitude>B.TopLeftLatLong.Longitude)&&(this.hotels[C].longitude<B.BottomRightLatLong.Longitude)){A.push(this.hotels[C])
}}this.networkFunnel.getAvailability(A)
},getDirections:function(A,F,D,E){var C=this;
var B=new VERouteOptions();
B.DistanceUnit=VERouteDistanceUnit.Mile;
B.RouteCallback=function(G){C.toastBeacon.removeItem(MapPanel.prototype.TOASTS.MSVEROUTE);
if(E!==true){C.map.SetCenterAndZoom(G.RouteLegs[G.RouteLegs.length-1].EndLocation,15)
}if(D!==undefined){D()
}else{C.hotelBeacon.trigger(Events.ROUTE_FOUND,[G,A,F])
}};
B.SetBestMapView=false;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.MSVEROUTE);
this.map.GetDirections(A,B);
this.hotelBeacon.trigger(Events.ROUTE_REQUESTED,[A,F])
},showAsSearchResults:function(B){this.hotelLayer.Hide();
var A=this;
this.addHotels(B,true);
this.hotelLayer.Show();
this.hotelBeacon.bind(Events.HOTELS_UPDATE,this.onShowAsSearchResultsOnAllHotels)
},showAsSearchResultsOnAllHotels:function(E){var D=this;
this.hotelBeacon.unbind(Events.HOTELS_UPDATE,this.onShowAsSearchResultsOnAllHotels);
this.hotelLayer.Hide();
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.ALLHOTELS_SHOW);
var A=Utils.objectToArray(E);
var C=[];
for(var B=0;
B<A.length;
B++){if(this.hotelIds[A[B].hotelId]===true){continue
}if((this.historyRecord!==undefined)&&(A[B].latitude===this.historyRecord[1])&&(A[B].longitude===this.historyRecord[2])){A[B].historyRecordNumber=this.historyRecord[0];
A[B].historyRecordAction=this.historyRecord[3];
this.addHotels([A[B]])
}else{C.push(A[B])
}}this.addHotels(C,true,true);
this.toastBeacon.removeItem(MapPanel.prototype.TOASTS.ALLHOTELS_SHOW);
this.hotelLayer.Show();
this.onChangeView()
},showAsRoute:function(){this.hotelBeacon.bind(Events.ROUTE_PROXIMITY_UPDATE,this.onShowAsRouteOnProximateHotels);
this.hotelBeacon.bind(Events.HOTELS_UPDATE,this.onShowAsSearchResultsOnAllHotels);
this.hotelBeacon.bind(Events.ROUTE_REQUESTED,this.onRouteRequested)
},routeRequested:function(B,C){this.llpoints=[];
for(var A=0;
A<B.length;
A++){this.llpoints.push(B[A].split(","))
}this.waypoints=C
},showAsRouteOnProximateHotels:function(C,A){this.hotelLayer.Hide();
for(var B=0;
B<C.length;
B++){this.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+C[B].hotelId,[C[B]])
}this.addHotels(A);
this.hotelLayer.Show();
this.onChangeView()
},showAsClusters:function(B){if(B!==undefined){var C=[];
this.hotelLayer.Hide();
this.addHotels(B);
for(var A=0;
A<B.length;
A++){C.push(new VELatLong(B[A].latitude,B[A].longitude))
}this.map.SetMapView(C);
this.hotelLayer.Show()
}this.hotelBeacon.bind(Events.HOTELS_UPDATE,this.onShowAsClustersOnAllHotels)
},showAsClustersOnAllHotels:function(F){var E=this;
this.hotelBeacon.unbind(Events.HOTELS_UPDATE,this.onShowAsClustersOnAllHotels);
this.hotelLayer.Hide();
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.ALLHOTELS_SHOW);
var A=Utils.objectToArray(F);
var C=[];
for(var B=0;
B<A.length;
B++){if(this.hotelIds[A[B].hotelId]===true){continue
}C.push(A[B])
}var D=new VEClusteringOptions();
D.Callback=function(G){E.onHotelClusteringChange(G)
};
D.Icon=new VECustomIconSpecification();
D.Icon.CustomHTML='<img src="'+CQ_ASSETS_URL+'images/map/cluster.png"/>';
this.hotelLayer.SetClusteringConfiguration(VEClusteringType.Grid,D);
this.addHotels(C);
this.toastBeacon.removeItem(MapPanel.prototype.TOASTS.ALLHOTELS_SHOW);
this.hotelLayer.Show();
this.onChangeView()
},doHotelClusteringChangeTimeout:function(){for(var A=0;
A<this.curClusters.length;
A++){this.curClusters[A].setup()
}},onHotelClusteringChange:function(C){clearTimeout(this.hotelClusteringChangeTimeout);
this.hotelClusteringChangeTimeout=setTimeout(this.onHotelClusteringChangeTimeout,1);
for(var D=0;
D<this.curClusters.length;
D++){this.curClusters[D].nuke(true)
}this.curClusters=[];
for(var B=0;
B<C.length;
B++){var A=new MapPanelHotelCluster(C[B],this.hotelBeacon,this.interactionBeacon,this.map,!this.withControls);
this.curClusters.push(A)
}},receiveOffers:function(C){var B=this;
this.offersLayer.Hide();
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.OFFERS_SHOW);
var A=Utils.cloneArray(C);
this.addOffers(A);
this.toastBeacon.removeItem(MapPanel.prototype.TOASTS.OFFERS_SHOW);
this.offersLayer.Show();
this.onChangeView()
},addHotels:function(G,F,B){if(F===undefined){F=!this.withControls
}if(B===undefined){B=false
}var A=[];
for(var C=0;
C<G.length;
C++){var E=G[C];
var D=new VEShape(VEShapeType.Pushpin,new VELatLong(E.latitude,E.longitude));
D.hotelVO=E;
E.mapPanelBlob=new MapPanelHotelBlob(E,D,true,this.hotelBeacon,this.interactionBeacon,this.trackBeacon,this.filter,F,B);
this.hotels.push(E);
this.hotelIds[E.hotelId]=true;
A.push(D)
}this.hotelLayer.AddShape(A)
},addOffers:function(E){var B=[];
for(var D=0;
D<E.length;
D++){var C=E[D];
var A=new VEShape(VEShapeType.Pushpin,new VELatLong(C.latitude,C.longitude));
A.offerVO=C;
C.mapPanelBlob=new MapPanelOfferBlob(C,A,this.offerBeacon,this.interactionBeacon);
this.offers.push(C);
B.push(A)
}this.offersLayer.AddShape(B)
},OFFERS_MIN_ZOOM:9,AVAIL_MIN_ZOOM:12,INPUT_DATA_CHUNKING:50,TOASTS:{}});
MapPanel.prototype.UK_VIEW=new VELatLong(54,-4);
MapPanel.prototype.UK_VIEW.zoom=6;
MapPanel.prototype.UK_VIEW.suppressSearchIcon=true;
Msn.VE.MappeView=Msn.VE.MapView;
Msn.VE.MapView=function(B){var A=new Msn.VE.MappeView(B);
A.SetZoomeLevel=A.SetZoomLevel;
A.SetZoomLevel=function(C){if(C<6){C=6;
A.SetCentre=A.SetCenter;
A.SetCenter=function(D){A.SetCenter=A.SetCentre
}
}A.SetZoomeLevel(C)
};
return A
};
var MapPanelBlobIndex=0;
var MapPanelBlob=$.klass({initialize:function(B,A,E,D){var C=this;
this.vo=B;
this.shape=A;
this.blobBeacon=E;
this.suppressInteractivity=(D===true);
MapPanelBlobIndex++;
this.index=MapPanelBlobIndex;
this.onclick=function(F){C.click(F);
return false
};
this.onmouseover=function(F){C.mouseover(F)
};
this.onmouseout=function(F){C.mouseout(F)
}
},setup:function(){var A=$("#mapBlob"+this.index);
if(A.length===0){return 
}A.find(".tooltipmask").stop(true).fadeTo(0,0);
A.bind("click",this.onclick);
A.bind("mouseover",this.onmouseover);
A.bind("mouseout",this.onmouseout)
},nuke:function(A){var B=$("#mapBlob"+this.index);
B.unbind("click",this.onclick);
B.unbind("mouseover",this.onmouseover);
B.unbind("mouseout",this.onmouseout);
if(A===true){this.vo=this.shape=this.blobBeacon=this.shape.hotelVO=this.shape.offerVO=this.vo.mapPanelBlob=null
}},mouseover:function(B){if(this.suppressInteractivity){return 
}var A=$("#mapBlob"+this.index);
A.parents(".VEAPI_Pushpin").css("zIndex",1002);
A.find(".tooltipmask").stop(true).show().fadeTo(150,1)
},mouseout:function(B){if(this.suppressInteractivity){return 
}var A=$("#mapBlob"+this.index);
A.parents(".VEAPI_Pushpin").css("zIndex",1001);
A.find(".tooltipmask").stop(true).fadeTo(150,0,function(){$(this).hide();
A.parents(".VEAPI_Pushpin").css("zIndex",1000)
})
}});
var mapPanelBubbleUID=0;
var MapPanelBubble=$.klass({initialize:function(A){mapPanelBubbleUID++;
this.div=A.append('<div class="mpb'+mapPanelBubbleUID+'" style="z-index:7000; position:absolute"></div>').find("div.mpb"+mapPanelBubbleUID);
this.htmlSelector=".htmlLibrary .bubbleInner"
},update:function(){var B=this;
this.div.find(".bubble").remove();
this.div.html($(this.htmlSelector).html());
var A=this.div.find(".bubble");
A.find(".bubbleClose").click(function(){B.close()
});
A.mousedown(Utils.cancelBubbling);
A.mouseup(Utils.cancelBubbling);
A.click(Utils.cancelBubbling);
A.dblclick(Utils.cancelBubbling);
A.bind("mousewheel",Utils.cancelBubbling);
A.bind("DOMMouseScroll",Utils.cancelBubbling);
if(window.DD_belatedPNG!==undefined){DD_belatedPNG.fixPng(B.div.find(".bubble")[0]);
DD_belatedPNG.fixPng(B.div.find(".bubbleInnerPointer")[0]);
DD_belatedPNG.fixPng(B.div.find(".bubbleInner1")[0]);
DD_belatedPNG.fixPng(B.div.find(".bubbleInner2")[0]);
DD_belatedPNG.fixPng(B.div.find(".bubbleClose")[0])
}return A
},hide:function(){this.div.hide()
},show:function(){this.div.show()
},close:function(){this.div.html("")
}});
var MapPanelHotelBlob=$.klass(MapPanelBlob,{initialize:function($super,H,G,E,C,I,J,B,D,A){var F=this;
$super(H,G,C,D);
this.bookable=E;
this.interactionBeacon=I;
this.trackBeacon=J;
this.forReferenceOnly=A;
this.filter=B;
this.visible=true;
this.minZoomLevel=-1;
this.currentHTML="";
this.update(H);
this.blobBeacon.bind(Events.HOTEL_UPDATE_PREFIX+H.hotelId,function(L,K){F.update(K)
});
this.blobBeacon.bind(Events.FILTER_CHANGE,function(L,K){F.onFilter(K)
});
this.blobBeacon.bind(Events.FILTER_HOTELS,function(L,K){F.onHotelFilter(K)
});
this.onRouteRequested=function(){delete F.vo.routeId;
this.suppressInteractivity=true;
F.update(F.vo)
};
this.blobBeacon.bind(Events.ROUTE_REQUESTED,this.onRouteRequested)
},IMGNAMEDEFAULT:"bookable",IMGNAME:{},nuke:function($super,A){if(A===true){this.blobBeacon.unbind(Events.ROUTE_REQUESTED,this.onRouteRequested);
this.interactionBeacon=this.trackBeacon=null
}$super(A)
},getImgName:function(){var A=MapPanelHotelBlob.prototype.IMGNAME[this.vo.status];
if(this.vo.status===HotelVO.prototype.STATUS.BOOKABLE){A=MapPanelHotelBlob.prototype.IMGNAME[this.vo.availabilityStatus]
}if(A===undefined){A=MapPanelHotelBlob.prototype.IMGNAMEDEFAULT
}return A
},onFilter:function(A){this.filter.items=A;
this.applyFilter()
},onHotelFilter:function(A){this.filter.visibleHotels=A;
this.applyFilter()
},setHTML:function(A){this.shape.SetCustomIcon(A)
},applyFilter:function(){var A=this.getImgName();
if((((this.forReferenceOnly)&&(this.vo.routeId===undefined))||(this.filter.items[A]!==true))&&((this.filter.visibleHotels===null)||(Utils.arrayIndexOf(this.filter.visibleHotels,this.vo.hotelId)!==-1))){this.show()
}else{this.hide()
}},NUDGERIGHT:13,NUDGEUP:12,show:function(A){if(!this.visible){this.visible=true;
this.shape.Show()
}},hide:function(A){if(this.visible){this.visible=false;
this.shape.Hide()
}},update:function(H){this.vo=H;
if(H.routeId!==undefined){this.suppressInteractivity=false
}if((this.forReferenceOnly)&&(H.routeId===undefined)){var F='<img title="'+H.name+'" src="'+CQ_ASSETS_URL+'images/map/forrefonly.png" style="position:absolute; cursor:default; left:7px; top:6px" />';
if(this.currentHTML!==F){this.setHTML(F,H);
this.currentHTML=F
}if(this.minZoomLevel!==9){this.shape.SetMinZoomLevel(9);
this.minZoomLevel=9
}return 
}else{if(this.shape!==null){if(this.minZoomLevel!==1){this.shape.SetMinZoomLevel(1);
this.minZoomLevel=1
}}}this.applyFilter();
var C="";
var J="";
var B=37;
var A="fff";
var G=this.NUDGEUP;
var I=-5;
var E=this.getImgName();
if(H.routeId!==undefined){C="rp-";
if(H.status===HotelVO.prototype.STATUS.OPENINGSOON){A="666";
B=30
}else{if((H.availabilityStatus===HotelVO.prototype.STATUS.NONSS)||(H.availabilityStatus===HotelVO.prototype.STATUS.AVAILABLE)||(H.availabilityStatus===HotelVO.prototype.STATUS.UNAVAILABLE)){B=30
}}J='<div class="'+E+'" style="width:'+B+"px; text-align:center; font-size:0.55em; font-weight:bold; color:#"+A+";";
if(this.isStatic===true){J+="position:relative; left:"+(this.NUDGERIGHT+7)+"px; top:-20px"
}else{J+="position:absolute; z-index:1001; left:"+(this.NUDGERIGHT+7)+"px; top:"+(5-G)+"px"
}J+='">'+H.routeId+"</div>";
I=-9
}else{G+=3
}this.nuke();
var D='<div id="mapBlob'+this.index+'"';
if(this.suppressInteractivity){D+=' style="cursor:default"'
}D+='><img src="'+CQ_ASSETS_URL+"images/map/"+C+E+'.png"';
if(this.isStatic!==true){D+=' style="float:left; position:absolute; left:'+this.NUDGERIGHT+"px; top:-"+G+'px"'
}D+=" />"+J;
if(this.isStatic!==true){D+='<div class="tooltipmask" style="display:none; position:absolute; left:19px; bottom:'+I+'px"><img src="'+CQ_ASSETS_URL+'images/map/cluster-popup-top.png"/><div class="tooltip tooltipcluster">';
D+=I18N.HOTEL_TOOLTIP_PREFIX_HTML+Utils.allowBreaks(this.vo.name)+I18N.HOTEL_TOOLTIP_SUFFIX_HTML;
D+='</div><img src="'+CQ_ASSETS_URL+'images/map/cluster-popup-btm.png"/></div>'
}D+="</div>";
if(this.currentHTML!==D){this.setHTML(D,H);
this.currentHTML=D
}this.setup()
},click:function(A){if(this.suppressInteractivity){return 
}this.interactionBeacon.trigger(Events.POPUP_HOTEL_BUBBLE,[this.vo]);
$(".home-radios").controlDcCheckbox()
}});
MapPanelHotelBlob.prototype.IMGNAME[HotelVO.prototype.STATUS.BOOKABLE]="bookable";
MapPanelHotelBlob.prototype.IMGNAME[HotelVO.prototype.STATUS.AVAILABLE]="available";
MapPanelHotelBlob.prototype.IMGNAME[HotelVO.prototype.STATUS.NONSS]="nonss";
MapPanelHotelBlob.prototype.IMGNAME[HotelVO.prototype.STATUS.OPENINGSOON]="openingsoon";
MapPanelHotelBlob.prototype.IMGNAME[HotelVO.prototype.STATUS.UNAVAILABLE]="unavailable";
var MapPanelHotelBlobStatic=$.klass(MapPanelHotelBlob,{initialize:function($super,D,B,C,A){this.div=D;
this.isStatic=true;
$super(B,null,C,A,null,null);
A.unbind(Events.ROUTE_REQUESTED,this.onRouteRequested)
},applyFilter:function(){return 
},onFilter:function(A){return 
},onHotelFilter:function(A){return 
},mouseover:function(A){},mouseout:function(A){},NUDGERIGHT:0,NUDGEUP:0,setHTML:function(A){this.div.html(A)
}});
var MapPanelHotelBubble=$.klass(MapPanelBubble,{initialize:function($super,A,C,E,D){var B=this;
$super(A);
this.hotelBeacon=C;
this.requirementsBeacon=E;
this.interactionBeacon=D;
this.hotelvo=null;
this.onUpdate=function(H,G,F){B.update(G,F)
};
this.onCheckAvailability=function(){B.checkAvailability()
}
},nuke:function(){$("#ui-datepicker-div").hide();
$(".msveMap .linkedDates").datepicker("destroy");
if(this.hotelvo!==null){this.hotelBeacon.unbind(Events.HOTEL_UPDATE_PREFIX+this.hotelvo.hotelId,this.onUpdate)
}},update:function($super,Q,L){if((this.hotelvo!==null)&&(this.hotelvo.hotelId===Q.hotelId)&&(L===true)){return 
}var M=this;
this.nuke();
var P=$super();
var E;
var K;
this.hotelvo=Q;
this.hotelBeacon.bind(Events.HOTEL_UPDATE_PREFIX+this.hotelvo.hotelId,this.onUpdate);
var C=['<form id="hcBubbleFormDYNAMIC" onsubmit="return true;" action="/en/hotel/'+this.hotelvo.hotelId+'" method="post" class="hotelPanelMainForm">','<fieldset class="hotel-checking-form">','  <legend class="hidden">Hotel checking form</legend>','  <input type="hidden" name="searchModel.searchTerm" value="',pio.prop1,'" />','  <input type="hidden" name="searchModel.location.location.latitude" value="',this.hotelvo.latitude,'" />','  <input type="hidden" name="searchModel.location.location.longitude" value="',this.hotelvo.longitude,'" />','  <input type="hidden" name="hotelWithDist.hotel.code" value="',this.hotelvo.hotelId,'" />','  <input type="hidden" name="hotelWithDist.hotel.name" value="',this.hotelvo.name,'" />','  <input type="hidden" name="searchModel.from" value="',this.hotelvo.routeId!==undefined?"routeplanner":"",'" />','	<input type="hidden" name="availabilityModel.nights" value ="1"/>','	<input type="hidden" name="availabilityModel.numOfRooms" value ="1"/>','  <input type="hidden" name="availabilityModel.sessionId" value="',this.hotelvo.sessionId,'" />','  <input type="hidden" name="searchModel.offerReference" value="',"",'" />',"  <div>",'    <input type="submit" id="hcFormDYNAMIC_action" name="action" class="summary-button" style="display: none " value="',this.hotelvo.name,'" />',"    <h4>",'      <a href="#" class="hotelPanelDetailLinkDYNAMIC">',this.hotelvo.name,"</a>","    </h4>","  </div>","</fieldset>","</form>"];
P.find("#hotelBubbleInfo").html(C.join("\n"));
$(".hotelPanelDetailLinkDYNAMIC").click(function(){$("form#hcBubbleFormDYNAMIC").submit()
});
$("a.moreHotelDetails").click(function(){$("form#hcBubbleFormDYNAMIC").submit();
event.preventDefault()
});
$(".bubbleInner3 .image").click(function(){$("form#hcBubbleFormDYNAMIC").submit()
});
var X=function(){var g=P.find(".bubbleInner3");
var f=g.height("auto").height()+1;
if((f%2)===0){f++
}g.height(f)
};
if(Q.loadStatus===HotelVO.prototype.LOADSTATUS.LOADING){P.find(".info").html('<img src="'+CQ_ASSETS_URL+'images/throbber.gif"/>')
}else{if(Q.loadStatus===HotelVO.prototype.LOADSTATUS.FAILED){P.find(".info").html(I18N.HOTELBUBBLE_INFOFAIL+"<br/>&nbsp;")
}else{P.find(".address").html(Utils.formatAddress(Q.address));
P.find(".tel").html(Q.telephone);
if((Q.images!==undefined)&&(Q.images[0]!==undefined)){P.find(".info .image").html('<img src="'+Q.images[0].image[0].src+'" width="100%"/>')
}else{P.find(".info .image").remove()
}}}if(Q.availabilityLoadStatus===HotelVO.prototype.LOADSTATUS.LOADING){P.find(".widgets").html('<img src="'+CQ_ASSETS_URL+'images/throbber.gif"/>')
}else{if(Q.availabilityLoadStatus===HotelVO.prototype.LOADSTATUS.FAILED){P.find(".widgets").text(I18N.HOTELBUBBLE_AVAILFAIL)
}else{if(Q.availabilityLoadStatus===HotelVO.prototype.LOADSTATUS.INITIAL){if(Q.status===HotelVO.prototype.STATUS.BOOKABLE){P.find(".widgets").append('<div class="checkAvailabilityWidget"></div>');
E=new HotelWidget(P.find(".checkAvailabilityWidget"),true,false,true,true,X);
var G='<form method="post" action="checkHotelAvailabilty.action">';
G+=' <input type="hidden" name="searchModel.searchTerm" value="'+this.hotelvo.name+'"/>';
G+=' <input type="hidden" name="searchModel.hotel.code" value="'+this.hotelvo.hotelId+'"/>';
G+=' <input type="hidden" name="searchModel.location.location.latitude" value="'+this.hotelvo.latitude+'"/>';
G+=' <input type="hidden" name="searchModel.location.location.longitude" value="'+this.hotelvo.longitude+'"/>';
G+=$(".htmlLibrary .bookingForm").html();
G+="</form>";
E.setBody(G);
var B=E.div.find("form");
B.roomrequirements();
B.find(".linkedDates").datepickerinit();
B.submit(function(f){if($(this).find(".errorLabel:visible").length>0){return false
}$(this).find("button").hide().after('<img src="'+CQ_ASSETS_URL+'images/throbber.gif" style="float:right"/>');
M.requirementsBeacon.trigger(Events.NEW_REQUIREMENTS,[B[0].requirementsVO,M.hotelvo]);
return false
});
E.setTitle(I18N.HOTELBUBBLE_AVAILWIDGET_TITLE);
E.setTitleClick(function(){if((K!==undefined)&&(K.isOpen)){K.close()
}E.toggle()
})
}else{if((Q.status===HotelVO.prototype.STATUS.OPENINGSOON)||(Q.status===HotelVO.prototype.STATUS.UNAVAILABLE)){P.find(".widgets").append('<div class="warning"><div class="warning2">'+Q.specialMessage+"</div></div>")
}}var c={};
if(Q.midWeekRate!==undefined){for(var a=0;
a<Q.midWeekRate.length;
a++){c[Q.midWeekRate[a].classification]=true
}}if(Q.weekendRate!==undefined){for(var Y=0;
Y<Q.weekendRate.length;
Y++){c[Q.weekendRate[Y].classification]=true
}}var c={};
if(Q.midWeekRate!==undefined){for(var a=0;
a<Q.midWeekRate.length;
a++){c[Q.midWeekRate[a].classification]=true
}}if(Q.weekendRate!==undefined){for(var Y=0;
Y<Q.weekendRate.length;
Y++){c[Q.weekendRate[Y].classification]=true
}}var U="";
if(c.C===true){if(Q.dinnerBedAndBreakfastPackageInfo!==undefined){if(U!==""){U+='<div class="hr-dotted"></div>'
}U+='<div class="extra-details">';
U+=" <h4>"+I18N.HOTELBUBBLE_DINNERBB+"</h4>";
var J=Q.dinnerBedAndBreakfastPackageInfo.image.src;
if(J.indexOf("_PLACEHOLDER_")!==-1){J=CQ_ASSETS_URL+"images/booking/quinceys_108x81.jpg"
}U+=' <img alt="" src="'+J+'"/>';
U+=' <div class="info">';
U+="  <p>"+Q.dinnerBedAndBreakfastPackageInfo.text+"</p>";
U+='  <ul class="links">';
for(var T=0;
T<Q.dinnerBedAndBreakfastPackageInfo.menus.length;
T++){U+='   <li><a href="'+Q.dinnerBedAndBreakfastPackageInfo.menus[T].pdfPath+'">'+Q.dinnerBedAndBreakfastPackageInfo.menus[T].description+"</a><br />(PDF "+parseInt(Q.dinnerBedAndBreakfastPackageInfo.menus[T].pdfSizeInBytes/1024)+"Kb)</li>"
}if(Q.dinnerBedAndBreakfastPackageInfo.packageDetailsUrl!==""){U+='   <li><a href="'+Q.dinnerBedAndBreakfastPackageInfo.packageDetailsUrl+'">'+I18N.HOTELBUBBLE_FULLOFFER+"</a></li>"
}U+="  </ul>";
U+=" </div>";
U+=' <div style="clear: both;"/>';
U+="</div>"
}}if((c.D===true)||(c.E===true)){if(U!==""){U+='<div class="hr-dotted"></div>'
}U+='<div class="extra-details">';
U+=" <h4>"+I18N.HOTELBUBBLE_PARKFLY+"</h4>";
U+=' <img alt="" src="'+Q.parkAndFlyInformation.image.src+'"/>';
U+=' <div class="info">';
U+="  <p>"+Q.parkAndFlyInformation.text+"</p>";
if(Q.parkAndFlyInformation.packageDetailsUrl!==""){U+='  <ul class="links">';
U+='   <li><a href="'+Q.parkAndFlyInformation.packageDetailsUrl+'">'+I18N.HOTELBUBBLE_FULLOFFER+"</a></li>";
U+="  </ul>"
}U+=" </div>";
U+=' <div style="clear: both;"/>';
U+="</div>"
}if(U!==""){P.find(".widgets").append('<div class="packagesWidget"></div>');
K=new HotelWidget(P.find(".packagesWidget"),false,true,false,false,X);
K.setBody(U);
K.setTitle(I18N.HOTELBUBBLE_PACKAGESWIDGET_TITLE);
K.setTitleClick(function(){if((E!==undefined)&&(E.isOpen)){E.close()
}K.toggle()
})
}if(Q.historyRecordNumber!==undefined){P.find(".widgets").append('<form method="post" action="'+Q.historyRecordAction+'" style="margin-top:10px"><fieldset><input type="hidden" name="historyRecordNumber" value="'+Q.historyRecordNumber+'"/><button type="submit" class="ctabutton" style="float:right">View booking</button></fieldset></form>')
}}else{if((Q.availabilityStatus===HotelVO.prototype.STATUS.AVAILABLE)||(Q.availabilityStatus===HotelVO.prototype.STATUS.NONSS)){var O="optgrp"+Math.floor(Math.random()*100000000);
var A=$("<div/>");
var I=this.groupOffers(Q.availability.roomOfferSets);
if(I.length>0){P.find(".widgets").append('<p style="font-weight:bold;margin:8px 0 5px 0; padding: 0">Please make your selection</p>')
}if((Q.availability.cellCode!==undefined)&&(Q.availability.cellCode!==null)){if(Q.availability.cellCode.available===true){P.find(".widgets").append('<div class="cellcode-remora" style="position:relative; top:8px"><div class="cellcode-remora2" style="width:297px;">'+Utils.htmlEntities(Q.availability.cellCode.description)+" prices shown here</div></div>");
P.find(".widgets").append('<div class="clear"></div>');
P.find(".widgets").append('<form class="withValidCellcode"/>')
}else{P.find(".widgets").append('<div class="cellcode-apology" style="float:right; text-align:right; padding:4px 12px;">Promotion not available for this hotel</div>');
P.find(".widgets").append('<div class="clear"></div>');
P.find(".widgets").append("<form/>")
}}else{P.find(".widgets").append("<form/>")
}var N=P.find(".widgets form");
var b=false;
if(Q.availability.limitedAvailability){if($(".limitedRoomInfo").length==0){var R='<div class="limitedRoomInfo"><img src="/assets/images/icons/icon_limited_rooms.gif" alt="Last Few Rooms" class="limitedRoomsIcon"/><span class="limitedRooms"><strong>Last few rooms</strong></span></div>';
$(".bubbleInner3 .widgets").prepend(R)
}}for(var Z=0;
Z<I.length;
Z++){var e=null;
if(I[Z][0].ratePlan.classification==="D"||I[Z][0].ratePlan.classification==="E"){if(Q.parkAndFlyInformation!==undefined){e='<div class="clearfix"><img width="110" src="'+Q.parkAndFlyInformation.image.src+'" align="right"/>';
e+=Q.parkAndFlyInformation.text;
e+='<ul class="links">';
if(Q.parkAndFlyInformation.packageDetailsUrl!==""){e+='<li><a href="'+Q.parkAndFlyInformation.packageDetailsUrl+'">'+I18N.HOTELBUBBLE_FULLOFFER+"</a></li>"
}e+="</ul>";
e+="</div>"
}}else{if(I[Z][0].ratePlan.classification==="C"){if(Q.dinnerBedAndBreakfastPackageInfo!==undefined){e='<div class="clearfix"><img width="110" src="'+Q.dinnerBedAndBreakfastPackageInfo.image.src+'" align="right"/>';
e+=Q.dinnerBedAndBreakfastPackageInfo.text;
e+='<ul class="links">';
for(var S=0;
S<Q.dinnerBedAndBreakfastPackageInfo.menus.length;
S++){e+='<li><a href="'+Q.dinnerBedAndBreakfastPackageInfo.menus[S].pdfPath+'">'+Q.dinnerBedAndBreakfastPackageInfo.menus[S].description+"</a> (PDF "+parseInt(Q.dinnerBedAndBreakfastPackageInfo.menus[S].pdfSizeInBytes/1024)+"Kb)</li>"
}if(Q.dinnerBedAndBreakfastPackageInfo.packageDetailsUrl!==""){e+='<li><a href="'+Q.dinnerBedAndBreakfastPackageInfo.packageDetailsUrl+'">'+I18N.HOTELBUBBLE_FULLOFFER+"</a></li>"
}e+="</ul>"
}}}N.append('<div class="widget'+Z+'"></div>');
var F=new HotelWidget(N.find(".widget"+Z),false,true,(e!==null),false,X);
var D=[];
for(var W=0;
W<I[Z].length;
W++){var d=I18N.RATECLASSIFICATION[I[Z][W].ratePlan.classification];
if(d===undefined){d=I[Z][W].ratePlan.description
}if(I[Z][0].ratePlan.classification==="A"&&b){d+='<span style="font-weight:normal"> (flexible)</span>'
}var H=0;
for(var V=0;
V<I[Z][W].roomOffers.length;
V++){H+=I[Z][W].roomOffers[V].selectedRoom.totalPrice.amount
}D.push([d,I[Z][W].roomOffers[0].selectedRoom.totalPrice.currencyCode,H.toFixed(2),I[Z][W].ratePlan.classification])
}if(I[Z][0].ratePlan.classification==="F"){$(".widget"+Z).addClass("premier_offer");
b=true
}F.setOptions(D,O,A);
if(e!==null){F.setBody(e)
}if((I.length>2&&Z===1)||(I.length===1&&Z===0)||(I.length===2&&Z===1&&I[Z][0].ratePlan.classification==="A")||(I.length===2&&Z===0&&I[1][0].ratePlan.classification!="A")){F.select()
}}if(b){N.append('<p class="non_flexible" style="margin: 5px; text-align: right;">*Pre-pay, no amends or refunds</a></p>')
}N.append('<div class="clear"></div>');
N.append('<button type="button" class="ctabutton" style="float:right;margin-top:5px;">'+I18N.HOTELBUBBLE_BOOKBUTTON+"</button>");
N.css("padding-bottom","1.3em");
N.find("button").click(function(){var h=null;
var f=N[0][O];
if(f.length===undefined){f=[f]
}for(var g=0;
g<f.length;
g++){if(f[g].checked){h=f[g].value;
break
}}if(h===null){return 
}$(this).hide().after('<img src="'+CQ_ASSETS_URL+'images/throbber.gif" style="float:right"/>');
M.requirementsBeacon.trigger(Events.POST_REQUIREMENTS,[Q,h])
});
N.append('<div><a href="#" class="infolink" style="float:right; margin-top:11px; padding:0 20px 0 10px;">'+I18N.HOTELBUBBLE_BREAKDOWNLINK+"</a></div>");
N.find(".infolink").click(function(){var r='<div class="pipop-padding"><div class="priceBreakWrapper"><div class="pbTitle">';
r+="<h2>"+Q.name+'</h2><h3>Price breakdown</h3><hr/></div><div style="height:400px; overflow:auto"><div style="width:480px">';
r+='<table class="price-breakdown">';
r+='<thead><tr><th></th><th style="font-weight:normal" colspan="'+Q.availability.roomOfferSets.length+'">Price per room (inc VAT & taxes)</th></tr>';
r+='<tr><th class="date-col">Date</th>';
var o=false;
var g=false;
var i=false;
for(var j=0;
j<Q.availability.roomOfferSets.length;
j++){var f=Q.availability.roomOfferSets[j].ratePlan.classification;
var n=Q.availability.roomOfferSets[j].ratePlan.cardFeeApplies;
r+='<th valign="bottom">'+I18N.RATECLASSIFICATION[f];
if(f==="F"){g=true
}if(!i&&n){i=true
}r+="</th>"
}r+="</tr></thead>";
var u=Q.availability.roomOfferSets[0].roomOffers[0].selectedRoom.dailyRates.length;
var q="Total "+((u===1)?"1 night":(u+" nights"));
r+='<tfoot><tr class="yellow-top"><td colspan="'+(Q.availability.roomOfferSets.length+1)+'"></td></tr><tr><td class="date-col"><nobr>'+q+"</nobr></td>";
for(var m=0;
m<Q.availability.roomOfferSets.length;
m++){var p=0;
for(var h=0;
h<Q.availability.roomOfferSets[m].roomOffers.length;
h++){p+=Q.availability.roomOfferSets[m].roomOffers[h].selectedRoom.totalPrice.amount
}r+="<td>"+I18N.CURRENCY[Q.availability.roomOfferSets[m].roomOffers[0].selectedRoom.totalPrice.currencyCode]+"<span>"+p.toFixed(2)+"</span></td>"
}r+='</tr><tr class="yellow-btm"><td colspan="'+(Q.availability.roomOfferSets.length+1)+'"/></tr></tfoot>';
r+="<tbody>";
for(var t=0;
t<Q.availability.roomOfferSets[0].roomOffers[0].selectedRoom.dailyRates.length;
t++){var s=new Date(Q.availability.roomOfferSets[0].roomOffers[0].selectedRoom.dailyRates[t].date.replace(/-/g,"/"));
for(var k=0;
k<Q.availability.roomOfferSets[0].roomOffers.length;
k++){r+='<tr><td class="date-col">';
if(k===0){r+="<nobr>"+I18N.DAY_NAMES[s.getDay()]+" "+s.getDate()+" "+I18N.MONTH_NAMES[s.getMonth()]+" "+s.getFullYear()+"</nobr>"
}r+="</td>";
for(var l=0;
l<Q.availability.roomOfferSets.length;
l++){r+="<td>"+I18N.CURRENCY[Q.availability.roomOfferSets[l].roomOffers[k].selectedRoom.dailyRates[t].price.currencyCode];
r+="<span>"+Q.availability.roomOfferSets[l].roomOffers[k].selectedRoom.dailyRates[t].price.amount.toFixed(2)+"</span></td>"
}r+="</tr>"
}}r+="</tbody></table>";
if(i){r+="<p>If you book a Premier Saver room and pay with a credit card you will be charged &pound;2 to process your payment. There is no charge for debit cards.</p>"
}if(g){r+='<p><strong>* Premier Saver terms & conditions</strong><br />Advertised rates are room only inclusive of VAT. "Rooms from &pound;29 offer" is available for stays until 16.12.10 inclusive. Bookings must be made online or through our Customer Contact Centre at least 21 days in advance of stay. Offer valid for minimum 2 night stays Monday to Saturday inclusive except for Sundays and in relation to bookings which fall exclusively within the periods 27.08.10 until 30.08.10 or 14.10.10 until 31.10.10 inclusive, when the offer applies to minimum one night stays on any day of the week. Offer also applies throughout the offer period to one night stays at participating airport and motorway service station hotels. No cancellations, amendments or refunds can be made. Offer is available at selected Premier Inns only and is subject to availability. Please check alternative dates if your selected date is not available.</p>'
}r+="</div></div></div></div>";
N.dialognow($(r),undefined,true);
return false
});
N.append('<div class="clear"></div>')
}else{P.find(".widgets").text(I18N.HOTELBUBBLE_UNAVAILABLE)
}}}}if(M.hotelvo.routeId===undefined){P.find(".routeOptions").remove()
}else{P.find(".routeFromHotel").click(function(){M.hotelBeacon.trigger(Events.ROUTE_SETFROMHOTEL,[M.hotelvo]);
return false
});
P.find(".routeViaHotel").click(function(){M.hotelBeacon.trigger(Events.ROUTE_SETVIAHOTEL,[M.hotelvo]);
return false
});
P.find(".routeToHotel").click(function(){M.hotelBeacon.trigger(Events.ROUTE_SETTOHOTEL,[M.hotelvo]);
return false
})
}if($.browser.msie&&($.browser.version<7)){X()
}},groupOffers:function(E){var F={};
var A=[];
for(var D=0;
D<E.length;
D++){var C=E[D].ratePlan.classification;
if(F[C]===undefined){F[C]=[]
}F[C].push(E[D])
}for(var B in F){A.push(F[B])
}return A
},close:function($super){this.interactionBeacon.trigger(Events.CLOSE_HOTEL_BUBBLE);
this.nuke();
$super();
this.hotelvo=null
},OFFSET_X:-434,OFFSET_Y:-208});
var MapPanelHotelClusterIndex=0;
var MapPanelHotelCluster=$.klass({initialize:function(A,C,F,E,D){MapPanelHotelClusterIndex++;
var B=this;
this.index=MapPanelHotelClusterIndex;
this.cluster=A;
this.hotelBeacon=C;
this.interactionBeacon=F;
this.map=E;
this.suppressInteractivity=(D===true);
this.oldHTML="";
this.onUpdate=function(G){B.update(G)
};
this.onclick=function(G){B.click(G);
return false
};
this.onmouseover=function(G){B.mouseover(G)
};
this.onmouseout=function(G){B.mouseout(G)
}
},setup:function(){this.update();
for(var A=0;
A<this.cluster.Shapes.length;
A++){this.hotelBeacon.bind(Events.HOTEL_UPDATE_PREFIX+this.cluster.Shapes[A].hotelVO.hotelId,this.onUpdate)
}this.nuke();
var B=$("#mapCluster"+this.index);
if(B.length===0){return 
}B.bind("click",this.onclick);
B.bind("mouseover",this.onmouseover);
B.bind("mouseout",this.onmouseout)
},nuke:function(B){var C=$("#mapCluster"+this.index);
C.unbind("click",this.onclick);
C.unbind("mouseover",this.onmouseover);
C.unbind("mouseout",this.onmouseout);
for(var A=0;
A<this.cluster.Shapes.length;
A++){this.hotelBeacon.unbind(Events.HOTEL_UPDATE_PREFIX+this.cluster.Shapes[A].hotelVO.hotelId,this.onUpdate)
}if(B===true){this.onUpdate=this.onclick=this.onmouseover=this.onmouseout=this.cluster=this.hotelBeacon=this.interactionBeacon=this.map=null
}},click:function(A){if(this.suppressInteractivity){return 
}this.interactionBeacon.trigger(Events.ZOOM_HOTEL_CLUSTER,this.cluster)
},mouseover:function(B){if(this.suppressInteractivity){return 
}if($(B.relatedTarget).parents("#mapCluster"+this.index).length>0){return 
}var A=$("#mapCluster"+this.index);
A.parents(".VEAPI_Pushpin").css("zIndex",1002);
A.find(".clusterIconPopup").stop(true,true).fadeIn(150)
},mouseout:function(B){if(this.suppressInteractivity){return 
}if($(B.relatedTarget).parents("#mapCluster"+this.index).length>0){return 
}var A=$("#mapCluster"+this.index);
A.parents(".VEAPI_Pushpin").css("zIndex",1001);
A.find(".clusterIconPopup").stop(true,true).fadeOut(150,function(){A.parents(".VEAPI_Pushpin").css("zIndex",1000)
})
},update:function(){var A=this.cluster.GetClusterShape();
var B='<div id="mapCluster'+this.index+'"';
if(this.suppressInteractivity){B+=' style="cursor:default"'
}B+='><img class="clusterIcon" src="'+CQ_ASSETS_URL+"images/map/cluster";
var D=true;
for(var C=0;
C<this.cluster.Shapes.length;
C++){if((this.cluster.Shapes[C].hotelVO.availabilityStatus!==HotelVO.prototype.STATUS.UNAVAILABLE)&&(this.cluster.Shapes[C].hotelVO.availabilityStatus!==HotelVO.prototype.STATUS.OPENINGSOON)){D=false;
break
}}if(D){B+="-unavailable"
}B+='.png"/><div class="clusterIconPopup" style="display:none; position:absolute; left:-25px; top:-30px"><img src="'+CQ_ASSETS_URL+'images/map/cluster-popup-top.png"/><div class="tooltip tooltipcluster">';
B+=I18N.CLUSTER_TOOLTIP_PREFIX_HTML+this.cluster.Shapes.length+I18N.CLUSTER_TOOLTIP_SUFFIX_HTML;
B+='</div><img src="'+CQ_ASSETS_URL+'images/map/cluster-popup-btm.png"/></div></div>';
if(B===this.oldHTML){return 
}A.SetCustomIcon(B);
A.Title="";
A.Notes="";
A._eroContent=null;
this.oldHTML=B
}});
var MapPanelOfferBlob=$.klass(MapPanelBlob,{initialize:function($super,C,A,B,D){$super(C,A,B);
this.interactionBeacon=D;
var E='<div id="mapBlob'+this.index+'">';
E+='<img src="'+CQ_ASSETS_URL+'images/map/activity.png" style="position:absolute; cursor:default; left:9px; top:8px" />';
E+='<div style="width:128px;display:none;overflow:hidden;position:absolute;left:28px" class="tooltipmask"><div class="tooltip tooltipsimple">'+C.name+"</div></div>";
E+="</div>";
A.SetCustomIcon(E)
},nuke:function($super,A){if(A===true){this.interactionBeacon=null
}$super(A)
},click:function(A){if(this.suppressInteractivity){return 
}this.interactionBeacon.trigger(Events.POPUP_OFFER_BUBBLE,this.vo)
}});
var MapPanelOfferBubble=$.klass(MapPanelBubble,{initialize:function($super,B,A){var C=this;
$super(B);
this.offerBeacon=A;
this.offervo=null;
this.onUpdate=function(E,D){C.update(D)
};
this.htmlSelector=".htmlLibrary > .bubbleOfferInner"
},nuke:function(){if(this.offervo!==null){this.offerBeacon.unbind(Events.OFFER_UPDATE_PREFIX+this.offervo.offerId,this.onUpdate)
}},update:function($super,C){var G=$super();
this.nuke();
this.offervo=C;
this.offerBeacon.bind(Events.OFFER_UPDATE_PREFIX+this.offervo.offerId,this.onUpdate);
var E=$("input[type=hidden][name=searchTerm]").val();
var D=$("input[type=hidden][name=offerCategory]").val();
var H=$("input[type=hidden][name=region]").val();
G.find("a.offerDetail").attr("href","offerDetail.action?searchTerm="+E+"&originalSearchCategory="+D+"&originalSearchRegion="+H+"&offerLocation.offerReference="+C.offerId);
G.find("h4").text(C.name);
if(C.loadStatus===HotelVO.prototype.LOADSTATUS.LOADING){G.find(".info").html('<img style="display:inline" src="'+CQ_ASSETS_URL+'images/throbber.gif"/>')
}else{if(C.loadStatus===HotelVO.prototype.LOADSTATUS.FAILED){G.find(".info").html(I18N.OFFERBUBBLE_INFOFAIL+"<br/>&nbsp;")
}else{G.find(".address").html(Utils.formatAddress(C.address,true));
G.find(".tel").html(C.telephone);
if(C.image!==undefined){G.find(".img img").attr("src",C.imageUrl)
}else{G.find(".img").remove();
G.find(".info").css("width","295px")
}var A=C.url;
var F=A;
var B=G.find(".thirdpartyurl");
if(A!==""){if(A.indexOf("://")===-1){A="http://"+A
}if(F.substr(0,7).toLowerCase()==="http://"){F=F.substr(7)
}B.attr({href:A,target:"blank"}).text(F);
B.html(Utils.allowBreaks(B.html())+'<span class="external"></span>')
}else{B.remove()
}G.find('input[name="offerLocation.offerReference"]').val(C.offerId);
G.find('input[name="offerLocation.category"]').val(C.category);
G.find('input[name="offerLocation.company"]').val(C.name);
G.find('input[name="offerLocation.point.longitude"]').val(C.longitude);
G.find('input[name="offerLocation.point.latitude"]').val(C.latitude);
G.find(".cta2").text(C.offerText)
}}setTimeout(function(){G.find("form").css("zoom",1)
},1)
},close:function($super){$super();
this.nuke();
this.offervo=null
},OFFSET_X:-258,OFFSET_Y:98});
var MapPanelTooltip=$.klass({initialize:function(A){this.veShape=A;
this.close()
},update:function(B,A){this.veShape.SetCustomIcon('<div class="tooltip tooltipsimple">'+B+"</div>");
this.veShape.Show()
},close:function(){this.veShape.Hide()
}});
var NetworkFunnel=$.klass({initialize:function(D,H,B,A,C,G,F){var E=this;
this.hotelBeacon=D;
this.requirementsBeacon=H;
this.offerBeacon=B;
this.toastBeacon=A;
this.sessionId=F;
if(this.sessionId===undefined){this.sessionId=null
}this.responseBeacon=$("<div/>");
this.allHotelsInTransit=false;
this.allOffersInTransit=false;
this.infoInTransit={};
this.offerInTransit={};
this.availabilityInTransit={};
this.allOffersCache=null;
this.allHotelsCache=null;
this.allHotels={};
this.infoCache={};
this.offerCache={};
this.availabilityCache={};
if(C!==undefined){this.populateCache(C)
}this.requirements=null;
if((G!==undefined)&&(G!==null)){this.requirements=G
}this.requirementsBeacon.bind(Events.NEW_REQUIREMENTS,function(I,J){E.onNewRequirements(J)
});
this.currentRoute=null;
this.hotelBeacon.bind(Events.ROUTE_REQUESTED,function(J,I,K){E.onRouteRequested(I,K)
})
},onRouteRequested:function(A,B){this.currentRoute=A
},populateCache:function(B){for(var A=0;
A<B.length;
A++){this.allHotels[B[A].hotelId]=B[A]
}},onNewRequirements:function(A){this.availabilityCache={};
this.requirements=A
},getAllHotels:function(){var A=this;
if(this.allHotelsCache!==null){this.hotelBeacon.trigger(Events.HOTELS_UPDATE,[this.allHotels]);
return 
}if(this.allHotelsInTransit){return 
}this.allHotelsInTransit=true;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.ALLHOTELS);
$.ajax({url:WS_URL+"directoryService/hotelLocations",error:function(){A.toastBeacon.removeItem(MapPanel.prototype.TOASTS.ALLHOTELS)
},success:function(C){A.toastBeacon.removeItem(MapPanel.prototype.TOASTS.ALLHOTELS);
A.allHotelsCache=C.hotelLocationList;
for(var B=0;
B<C.hotelLocationList.length;
B++){var D=new HotelVO(C.hotelLocationList[B].hotelId,C.hotelLocationList[B].name,C.hotelLocationList[B].latitude,C.hotelLocationList[B].longitude,C.hotelLocationList[B].status);
if(D.status!=="BOOKABLE"){D.status=HotelVO.prototype.STATUS.OPENINGSOON
}D.loadStatus=HotelVO.prototype.LOADSTATUS.INITIAL;
D.availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.INITIAL;
A.allHotels[D.hotelId]=D
}A.allHotelsInTransit=false;
A.hotelBeacon.trigger(Events.HOTELS_UPDATE,[A.allHotels])
}})
},getAllOffers:function(B){var C=this;
if(this.allOffersCache!==null){this.offerBeacon.trigger(Events.OFFERS_UPDATE,[this.allOffersCache]);
return 
}if(this.allOffersInTransit){return 
}this.allOffersInTransit=true;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.OFFERS);
var A=WS_URL+"offerService/";
if(B==="ANY"){B=undefined
}if(B===undefined){A+="locations"
}else{A+="offersInCategory/"+escape(B)
}$.ajax({url:A,error:function(){C.toastBeacon.removeItem(MapPanel.prototype.TOASTS.OFFERS)
},success:function(E){C.toastBeacon.removeItem(MapPanel.prototype.TOASTS.OFFERS);
var G=[];
for(var D=0;
D<E.offerLocation.length;
D++){var F=new OfferVO(E.offerLocation[D].offerReference,E.offerLocation[D].company,E.offerLocation[D].point.latitude,E.offerLocation[D].point.longitude,E.offerLocation[D].category);
G.push(F)
}C.allOffersCache=G;
C.allOffersInTransit=false;
C.offerBeacon.trigger(Events.OFFERS_UPDATE,[C.allOffersCache])
}})
},getHotelsOnRoute:function(A,B,E,D){var C=this;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.NEARROUTE);
$.ajax({url:WS_URL+"hotelLocator/route/hotels",type:"PUT",contentType:"application/xml",data:RequestConstructor.createRoutePlan(A),error:function(){C.toastBeacon.removeItem(MapPanel.prototype.TOASTS.NEARROUTE)
},success:function(J){C.toastBeacon.removeItem(MapPanel.prototype.TOASTS.NEARROUTE);
if(B!==C.currentRoute){return 
}if(J==null||((typeof J.suggestions)!=="object")||(J.suggestions.length===0)){return 
}var G=[];
var I=[];
for(var K=0;
K<J.suggestions.length;
K++){var F=C.allHotels[J.suggestions[K].hotelId];
if(F===undefined){var H=new HotelVO(J.suggestions[K].hotelId,J.suggestions[K].name,J.suggestions[K].location.latitude,J.suggestions[K].location.longitude);
H.routeId="H"+(K+1);
H.distance=J.suggestions[K].distance;
H.loadStatus=OfferVO.prototype.LOADSTATUS.INITIAL;
I.push(H);
C.allHotels[H.hotelId]=H
}else{F.routeId="H"+(K+1);
F.distance=J.suggestions[K].distance;
G.push(F)
}}C.hotelBeacon.trigger(Events.ROUTE_PROXIMITY_UPDATE,[G,I,D])
}})
},getRefinedHotelList:function(C){var B=this;
var A="";
$.each(C,function(D){A+=this.value+","
});
A=A.replace(/,$/,"");
if(A!==""||A===undefined){$.ajax({url:WS_URL+"directoryService/facilities?facilities="+A,success:function(D){B.hotelBeacon.trigger(Events.FILTER_HOTELS,[D.hotelCodes])
},error:function(){}})
}else{B.hotelBeacon.trigger(Events.FILTER_HOTELS,[null])
}},getUpdate:function(A){var B=this;
if(this.infoCache[A.hotelId]!==undefined){this.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+A.hotelId,this.infoCache[A.hotelId]);
return 
}if(this.infoInTransit[A.hotelId]){return 
}this.infoInTransit[A.hotelId]=true;
A.loadStatus=HotelVO.prototype.LOADSTATUS.LOADING;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.HOTELINFO);
$.ajax({url:WS_URL+"directoryService/hotel/"+A.hotelId,error:function(){B.toastBeacon.removeItem(MapPanel.prototype.TOASTS.HOTELINFO);
A.loadStatus=HotelVO.prototype.LOADSTATUS.FAILED;
B.infoInTransit[A.hotelId]=false;
B.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+A.hotelId,A)
},success:function(D){B.toastBeacon.removeItem(MapPanel.prototype.TOASTS.HOTELINFO);
if(((typeof D.hotels)!=="object")||(D.hotels.length===0)){A.loadStatus=HotelVO.prototype.LOADSTATUS.FAILED
}else{var E=D.hotels[0];
for(var C in E){if(C==="status"){continue
}A[C]=E[C]
}A.loadStatus=HotelVO.prototype.LOADSTATUS.LOADED;
B.infoCache[A.hotelId]=A
}B.infoInTransit[A.hotelId]=false;
B.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+A.hotelId,A);
B.hotelBeacon.trigger(Events.HOTELS_CREATE_OUTPUT,A)
}})
},getOfferUpdate:function(A){var B=this;
if(this.offerCache[A.offerId]!==undefined){this.offerBeacon.trigger(Events.OFFER_UPDATE_PREFIX+A.offerId,this.offerCache[A.offerId]);
return 
}if(this.offerInTransit[A.offerId]){return 
}this.offerInTransit[A.offerId]=true;
A.loadStatus=OfferVO.prototype.LOADSTATUS.LOADING;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.OFFERINFO);
$.ajax({url:WS_URL+"offerService/offer/"+A.offerId,error:function(){B.toastBeacon.removeItem(MapPanel.prototype.TOASTS.OFFERINFO);
A.loadStatus=OfferVO.prototype.LOADSTATUS.FAILED;
B.offerInTransit[A.offerId]=false;
B.offerBeacon.trigger(Events.OFFER_UPDATE_PREFIX+A.offerId,A)
},success:function(C){B.toastBeacon.removeItem(MapPanel.prototype.TOASTS.OFFERINFO);
A.name=C.company;
A.address={};
A.address.addressLine1=C.address;
A.address.addressLine2=C.street;
A.address.addressLine3=C.town;
A.address.addressLine4=C.county;
A.address.postCode=C.postcode;
A.telephone=C.telephone;
A.image=C.image;
A.imageUrl=C.imageUrl;
A.url=C.website;
A.offerText=C.offer;
A.loadStatus=OfferVO.prototype.LOADSTATUS.LOADED;
B.offerCache[A.offerId]=A;
B.offerInTransit[A.offerId]=false;
B.offerBeacon.trigger(Events.OFFER_UPDATE_PREFIX+A.offerId,A)
}})
},getAvailability:function(F){var E=this;
var C=[];
var B=[];
for(var D=0;
D<F.length;
D++){if(this.availabilityCache[F[D].hotelId]!==undefined){this.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+F[D].hotelId,[this.availabilityCache[F[D].hotelId],true])
}else{if(!this.availabilityInTransit[F[D].hotelId]){this.availabilityInTransit[F[D].hotelId]=true;
C.push(F[D]);
B.push(F[D].hotelId);
F[D].availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.LOADING;
this.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+F[D].hotelId,[F[D]])
}}}if(B.length===0){return 
}var A=this.requirements;
this.toastBeacon.addItem(MapPanel.prototype.TOASTS.AVAILABILITY);
$.ajax({url:WS_URL+"hotelAvailability/availabilityForHotels",type:"PUT",contentType:"application/xml",data:RequestConstructor.createMultiHotelAvailabilityRequest(B,this.requirements,this.sessionId),error:function(){E.toastBeacon.removeItem(MapPanel.prototype.TOASTS.AVAILABILITY);
if(A!==E.requirements){return 
}for(var G=0;
G<C.length;
G++){F[G].availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.FAILED;
E.availabilityInTransit[F[G].hotelId]=false;
E.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+F[G].hotelId,F[G])
}},success:function(K){E.toastBeacon.removeItem(MapPanel.prototype.TOASTS.AVAILABILITY);
if(A!==E.requirements){return 
}if(((typeof K.availabilityForHotels)!=="object")||(K.availabilityForHotels.length===0)){for(var J=0;
J<C.length;
J++){F[J].availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.FAILED;
E.availabilityInTransit[F[J].hotelId]=false;
E.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+F[J].hotelId,F[J])
}return 
}for(var L=0;
L<K.availabilityForHotels.length;
L++){var I=null;
for(var H=0;
H<C.length;
H++){if(C[H].hotelId===K.availabilityForHotels[L].hotelCode){I=C[H];
break
}}if(I===null){continue
}I.availabilityLoadStatus=HotelVO.prototype.LOADSTATUS.LOADED;
I.availability=K.availabilityForHotels[L];
this.sessionId=K.availabilityForHotels[L].sessionId;
if(I.availability.success){I.availabilityStatus=HotelVO.prototype.STATUS.AVAILABLE;
for(var G=0;
G<I.availability.roomOfferSets.length;
G++){for(var M=0;
M<I.availability.roomOfferSets[G].roomOffers.length;
M++){if(I.availability.roomOfferSets[G].roomOffers[M].substitutedRoomType===true){I.availabilityStatus=HotelVO.prototype.STATUS.NONSS
}}}}else{I.availabilityStatus=HotelVO.prototype.STATUS.UNAVAILABLE
}E.availabilityCache[I.hotelId]=I;
E.availabilityInTransit[I.hotelId]=false;
E.hotelBeacon.trigger(Events.HOTEL_UPDATE_PREFIX+I.hotelId,[I])
}}})
},MICROS_STATUS:{UNAVAILABLE:"NO_AVAILABILITY_AT_SPECIFIED_PROPERTY"}});
var OfferVO=$.klass({LOADSTATUS:{INITIAL:0,LOADING:1,LOADED:2,FAILED:-1},initialize:function(G,C,H,A,D,J,E,F,I,B){this.offerId=G;
this.name=C;
this.latitude=H;
this.longitude=A;
this.category=D;
this.address=J;
this.offerText=E;
this.telephone=F;
this.imageUrl=I;
this.url=B
}});
var RequestConstructor={XML_HEADER:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',getNewXML:function(A,B){if(document.implementation&&document.implementation.createDocument){return document.implementation.createDocument("","",null)
}else{if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLDOM")
}}return null
},xmlToString:function(A){if(window.XMLSerializer){return RequestConstructor.XML_HEADER+(new XMLSerializer()).serializeToString(A)
}return RequestConstructor.XML_HEADER+A.xml
},createTextInNode:function(C,D,A){var B=C.createElement(D);
B.appendChild(C.createTextNode(A));
return B
},createMultiHotelAvailabilityRequest:function(B,H,G){var F=RequestConstructor.getNewXML();
var C=B;
if(typeof B==="string"){C=[B]
}var E=F.createElement("multiHotelAvailabilityRequest");
F.appendChild(E);
var A=F.createElement("hotelIds");
for(var D=0;
D<C.length;
D++){A.appendChild(RequestConstructor.createTextInNode(F,"hotelId",C[D]))
}E.appendChild(A);
E.appendChild(RequestConstructor.serialiseRequirementsVO(F,H,G));
E.appendChild(F.createElement("filterParams"));
return RequestConstructor.xmlToString(F).replace(/<\?xml version=\"1.0\"\?>/,"")
},createRoutePlan:function(C){var G=RequestConstructor.getNewXML();
var F=G.createElement("routePlan");
G.appendChild(F);
var E=G.createElement("points");
for(var D=0;
D<C.length;
D++){var B=G.createElement("point");
B.appendChild(RequestConstructor.createTextInNode(G,"latitude",C[D][0]));
B.appendChild(RequestConstructor.createTextInNode(G,"longitude",C[D][1]));
E.appendChild(B)
}F.appendChild(E);
var A=G.createElement("radius");
A.appendChild(RequestConstructor.createTextInNode(G,"distance",0.05));
F.appendChild(A);
return RequestConstructor.xmlToString(G)
},serialiseDate:function(A){return A.getFullYear()+"-"+Utils.doubleDigits(A.getMonth()+1)+"-"+Utils.doubleDigits(A.getDate())
},serialiseRequirementsVO:function(K,H,D){var A=K.createElement("availabilityRequest");
var E=K.createElement("cellCodes");
for(var G=0;
G<H.cellCodes.length;
G++){E.appendChild(RequestConstructor.createTextInNode(K,"cellCode",H.cellCodes[G]))
}A.appendChild(E);
if(D!==null&&D!=="undefined"&&D.length!==0&&D!=="null"){A.appendChild(RequestConstructor.createTextInNode(K,"sessionId",D))
}var J=new Date(H.startDate);
J.setDate(J.getDate()+H.nights);
var L=RequestConstructor.serialiseDate(J);
var F=RequestConstructor.serialiseDate(H.startDate);
var B=RequestConstructor.createTextInNode(K,"stay",F+"/"+L);
A.appendChild(B);
var I=K.createElement("roomRequirements");
for(var C=0;
C<H.noOfRooms;
C++){I.appendChild(RequestConstructor.serialiseRequirementVO(K,H.rooms[C]))
}A.appendChild(I);
return A
},serialiseRequirementVO:function(G,D){var H=G.createElement("roomRequirement");
var B=RequestConstructor.createTextInNode(G,"adults",D.adults);
H.appendChild(B);
var C=RequestConstructor.createTextInNode(G,"children",D.children);
H.appendChild(C);
var E=RequestConstructor.createTextInNode(G,"cot",D.cot);
H.appendChild(E);
var A=RequestConstructor.createTextInNode(G,"occupancy",D.occupancy);
H.appendChild(A);
var F=RequestConstructor.createTextInNode(G,"smoking","false");
H.appendChild(F);
return H
}};
var RouteInfoDirections=$.klass({initialize:function(C,B){var A=this;
C.addClass("routeInfoDirections");
C.html($(".htmlLibrary .routeInfoDirections").html());
this.div=C;
B.bind(Events.ROUTE_FOUND,function(F,D,E,G){A.onData(D,E,G)
});
B.bind(Events.ROUTE_REQUESTED,function(E,D,F){A.onClear(D,F)
})
},onClear:function(A,B){this.div.find("table").html('<tr><td><img src="'+CQ_ASSETS_URL+'images/throbber.gif" /></td></tr>')
},onData:function(G,H,F){var I="";
var C=0;
I+='<tr class="waypoint"><td width="259" colspan="3"><b>'+I18N.ROUTEINFO_START+": </b>"+F[0]+"</td></tr>";
for(var B=0;
B<G.RouteLegs.length;
B++){var D=G.RouteLegs[B].Itinerary.Items;
for(var A=0;
A<D.length;
A++){if(D[A].Distance===0){I+='<tr class="waypoint"><td width="259" colspan="3">';
if(B===G.RouteLegs.length-1){I+="<b>"+I18N.ROUTEINFO_END+": </b>"+F[B+1]
}else{I+="<b>"+I18N.ROUTEINFO_VIA+": </b>"+F[B+1]
}I+="</td></tr>";
break
}if(C===0){I+='<tr class="leg"><td class="index"></td><td class="directions">'+D[A].Text+'</td><td class="distance"></td></tr>';
C++;
continue
}I+='<tr class="leg"><td valign="top" class="index">'+C+".</td>";
I+='<td valign="top" class="directions">'+D[A].Text+"</td>";
var E=D[A].Distance.toFixed(1);
if(E===0){E=0.1
}I+='<td valign="top" class="distance">'+E+" "+I18N.ROUTEINFO_MILES_SHORT+"</td></tr>";
C++
}C++
}this.div.find("table").html(I)
}});
var RouteInfoHotelsRowIndex=0;
var RouteInfoHotels=$.klass({initialize:function(E,C,D,B){var A=this;
this.div=E;
this.hotelBeacon=C;
this.requirementsBeacon=D;
this.isPrintPage=B;
this.reqsVO=null;
this.points=null;
this.waypoints=null;
this.allHotels=null;
E.addClass("routeInfoHotels");
E.html($(".htmlLibrary .routeInfoHotels").html());
C.bind(Events.ROUTE_PROXIMITY_UPDATE,function(I,H,F,G){A.onData(H,F,G)
});
C.bind(Events.ROUTE_REQUESTED,function(G,F,H){A.onRoute(F,H)
});
D.bind(Events.NEW_REQUIREMENTS,function(G,F){A.onReqs(F)
})
},onRoute:function(A,B){this.div.find(".routeInfoHotelsList table").html('<tr><td><img src="'+CQ_ASSETS_URL+'images/throbber.gif" /></td></tr>');
this.points=A;
this.waypoints=B
},onReqs:function(A){this.reqsVO=A;
this.redoRows()
},onData:function(E,A,D){var F=[];
for(var C=0;
C<E.length;
C++){F.push(E[C])
}for(var B=0;
B<A.length;
B++){F.push(A[B])
}if(this.isPrintPage){this.hotelBeacon.trigger(Events.HOTELS_GET_HOTELS_INFORMATION,[F])
}else{this.reqsVO=D;
this.allHotels=F;
this.redoRows();
DD_belatedPNG.fix(".routeInfoHotelsList td.blob img")
}},redoRows:function(){if(this.allHotels===null){return 
}var I=this.div.find(".routeInfoHotelsList table");
I.html("");
var B="";
var G=this.points[0].split(",");
G.push(this.waypoints[0]);
var F=null;
var A=null;
if(this.points.length>2){F=this.points[1].split(",");
F.push(this.waypoints[1]);
A=this.points[2].split(",");
A.push(this.waypoints[2])
}else{A=this.points[1].split(",");
A.push(this.waypoints[1])
}B+="searchModel.from=routeplanner&";
B+="routeFrom.searchTerm="+G[2]+"&";
B+="routeFrom.point.latitude="+G[0]+"&";
B+="routeFrom.point.longitude="+G[1]+"&";
B+="routeTo.searchTerm="+A[2]+"&";
B+="routeTo.point.latitude="+A[0]+"&";
B+="routeTo.point.longitude="+A[1]+"&";
if(F!==null){B+="routeVia.searchTerm="+F[2]+"&";
B+="routeVia.point.latitude="+F[0]+"&";
B+="routeVia.point.longitude="+F[1]+"&"
}var H=false;
if(this.reqsVO.startDate!==null){var D=this.reqsVO.toHiddenArray();
for(var C=0;
C<D.length;
C++){B+=D[C][0]+"="+D[C][1]+"&"
}H=true
}for(var E=0;
E<this.allHotels.length;
E++){this.addRowHTML(this.allHotels[E],I,B,H)
}},addRowHTML:function(G,F,D,B){RouteInfoHotelsRowIndex++;
var E=SITE_PATH+"/"+LOCALE+"/hotel/"+G.hotelId+"/"+G.getNameAsSEO();
if(B){E=SITE_PATH+"/"+LOCALE+"/checkHotel/"+G.hotelId+"/"+G.getNameAsSEO();
D+="hotelWithDist.hotel.code="+G.hotelId+"&";
D+="searchModel.searchTerm="+G.name+"&"
}var H='<tr class="hotel"><td class="blob"><div style="position:relative;font-size:1.5em;height:25px" id="rih'+RouteInfoHotelsRowIndex+'"></div></td>';
H+='<td class="name">';
if(D!==undefined){H+='<a href="'+E+"?"+D+'">'
}H+=G.name;
if(D!==undefined){H+="</a></td>"
}H+='<td class="distance">'+G.distance+" "+I18N.ROUTEINFO_MILES_SHORT+"</td></tr>";
F.append(H);
var A=F.find("#rih"+RouteInfoHotelsRowIndex);
var C=new MapPanelHotelBlobStatic(A,G,true,this.hotelBeacon)
}});
var Tally=$.klass({initialize:function(){this.beacon=$("<div/>");
this.tally={}
},bind:function(B,A){this.beacon.bind(B,A)
},unbind:function(B,A){this.beacon.unbind(B,A)
},nuke:function(A){if(A===true){this.beacon=null
}},addItem:function(A){if(this.tally[A]===undefined){this.tally[A]=0
}this.tally[A]++;
this.broadcastKeys()
},removeItem:function(A){this.tally[A]--;
if(this.tally[A]===0){delete this.tally[A]
}this.broadcastKeys()
},getKeys:function(){var B=[];
for(var A in this.tally){B.push(A)
}return B
},broadcastKeys:function(){this.beacon.trigger(Events.TALLY_UPDATE,[this.getKeys()])
}});

