LibManager.require("frame.prototype.ajax");LibManager.require("frame.prototype.form");LibManager.require("frame.prototype.selector");LibManager.require("cookie");LibManager.require("frame.scriptaculous.effects");LibManager.require("dom");var map=null,hotels=[],venues=[],markerList=null,categoryKeyList=null,currentSectionWrapper="mapHotelListWrapper",currentSectionHeader="mapHotelListHeader",$j=jQuery.noConflict(),hotelsBoundary,loadedCategories=[];
function importanceOrder(a){return GOverlay.getZIndex(a.getPoint().lat())+a.importance*1E6}function removeChildrenFromNode(a){if(a)for(;a.hasChildNodes();)removeChildrenFromNode(a.firstChild),a.removeChild(a.firstChild)}
function makeHtmlSafe(a){return a.replace(/,/g,", ").replace(/&#8217;/g,"\u0019").replace(/&#38;/g,"&").replace(/&amp;/g,"&").replace(/&#39;/g,"'").replace(/&eacute;/g,"\u00e9").replace(/&aacute;/g,"\u00e1").replace(/&iacute;/g,"\u00ed").replace(/&uacute;/g,"\u00fa").replace(/&agrave;/g,"\u00e0").replace(/&#8217;/g,"\u2019")}
GMap2.prototype.centerAndZoomOnBounds=function(a){var b=(a.getNorthEast().lat()+a.getSouthWest().lat())/2,c=(a.getNorthEast().lng()+a.getSouthWest().lng())/2;a.getNorthEast().lng()<a.getSouthWest().lng()&&(c+=180);b=new GLatLng(b,c);map.setCenter(b,map.getBoundsZoomLevel(a))};GMap2.prototype.restrictZoom=function(a,b){for(var c=map.getMapTypes(),d=0,e=c.length;d<e;d++){if(a)c[d].getMinimumResolution=function(){return a};if(b)c[d].getMaxiumResolution=function(){return b}}};
function isBrowser(a){return navigator.userAgent.toLowerCase().indexOf(a)!=-1?!0:!1}function getURLParam(a){a=RegExp("[\\?&]"+a+"=([^&#]*)").exec(window.location.href);return a==null?"":a[1]}var Accordian=Class.create();
Accordian.prototype={initialize:function(a,b){var c=this;a=$(a);this.options=Object.extend({headingSelector:"h2",sectionSelector:"div.accContent",showSection:1,duration:0.4},b||{});headings=$$("#"+a.id+" "+this.options.headingSelector);sections=$$("#"+a.id+" "+this.options.sectionSelector);headings.each(function(a,b){Event.observe(a,"click",function(){c.showSection(sections[b],a)});Event.observe(a,"mouseover",function(){a.hasClassName("active")||a.addClassName("hover")});Event.observe(a,"mouseout",
function(){a.removeClassName("hover")})});sections.each(function(a,b){!c.options.showSection||b+1!=c.options.showSection?a.hide():a.show()});this.options.showSection&&headings[this.options.showSection-1].addClassName("active")},showSection:function(a,b){var c=this;if(a.visible())return!1;headings.each(function(a){a.removeClassName("active")});b.addClassName("active");b.removeClassName("hover");effects=[];sections.each(function(b){b==a?effects.push(new Effect.BlindDown(b,c.options.duration,0,{sync:!0})):
effects.push(new Effect.BlindUp(b,c.options.duration,0,{sync:!0}))});new Effect.Parallel(effects,{duration:0.5})}};var Map=Class.create();
Map.prototype={minZoom:12,hotelsInView:0,maxHotelsInView:200,maxVenuesInView:200,mapList:!1,mapVenueList:!1,mapZoom:null,mapCentre:null,ajaxBaseUrl:null,ajaxRequest:null,ajaxTimeout:null,ajaxReqTime:null,ajaxMaxReqTime:3E5,ajaxCheckInterval:500,alert:!1,mapOptions:[],searchFormId:"mapOptionsForm",optionsFormId:"mapOptionsForm",mapAccordian:null,numHotels:0,mapLocation:"",mapInitZoom:"",venueMarkersLoaded:!1,hotelMarkersLoaded:!1,displayMapVenues:!0,gmapApiKey:"",searchRequest:"",geocoder:"",initialize:function(a,
b,c,d,e,f){if(GBrowserIsCompatible()){this.addVmlNamespace();map=new GMap2($(a));map.mapType=b;this.ajaxBaseUrl=ajaxBaseUrl.length>0?ajaxBaseUrl:"/";this.mapInitZoom=f||0;this.mapLocation=window.mapLocation||getURLParam("mapLocation");this.limitRegion=window.limitRegion||"";markerList=new MarkerList;if($(c))this.mapList=!0,this.hotelLinkList=new HotelLinkList(c);if($(d))this.mapVenueList=!0,this.venueLinkList=new HotelLinkList(d);if(e==!1)this.displayMapVenues=!1;this.displayMapVenues&&this.setupVenueIcons();
switch(b.toLowerCase()){case "dynamic":this.geocoder=new GClientGeocoder;this.geocoder.setBaseCountryCode("uk");this.displayMapVenues&&(categoryKeyList=new CategoryKeyList(!1));this.setupDynamicMap();break;case "static":this.displayMapVenues&&(categoryKeyList=new CategoryKeyList(!0));this.setupStaticMap();break;case "region":this.displayMapVenues&&(categoryKeyList=new CategoryKeyList(!1));this.setupRegionMap();break;case "regionhotels":this.displayMapVenues&&(categoryKeyList=new CategoryKeyList(!1));
this.setupRegionHotelsMap(hotelIds);break;default:return}var h=this;GEvent.addListener(map,"move",function(){if(isBrowser("netscape")&&h.mapList)$("mapSidebar").style.overflow="hidden",$("mapLoading").style.overflow="hidden"});GEvent.addListener(map,"moveend",function(){if(isBrowser("netscape")&&h.mapList)$("mapSidebar").style.overflow="auto",$("mapLoading").style.overflow="auto"});map.savePosition()}},addVmlNamespace:function(){if(document.namespaces){for(var a=0;a<document.namespaces.length;a++)if(document.namespaces(a).name==
"v")return;document.namespaces.add("v","urn:schemas-microsoft-com:vml")}},setupVenueIcons:function(){this.createNonAsyncMvcJsonRequest({},"MapJson/GetAllVenueCategories",markerList.populateIcons,!1)},setupDynamicMap:function(){var a=this;GEvent.addListener(map,"load",function(){a.updateDynamicMap()}.bind(this));this.msgBox=new MapLoader(map,$("mapLoading"),$("mapLoadingText"),$("mapLoadingBar"),$("mapLoadingBarFill"));this.mapAccordian=new Accordian("mapSidebar",{headingSelector:"h2",sectionSelector:"div.accContent"});
map.addControl(new GLargeMapControl);map.addControl(new GScaleControl);map.addControl(new GMapTypeControl,new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(70,7)));var b=new GOverviewMapControl(new GSize(125,125));map.addControl(b);this.mapLocation.length>0?this.setMapLocation(this.mapLocation):this.loadMapPosition();map.enableContinuousZoom();map.enableDoubleClickZoom();if(this.limitRegion.length>0){var c=this.getRegionBounds(this.limitRegion);GEvent.addListener(map,"move",function(){a.checkBounds(c)});
b=map.getMapTypes();for(var d=0;d<b.length;d++)b[d].getMinimumResolution=function(){return a.getMinRegionZoom(a.limitRegion)}}GEvent.addListener(map,"moveend",function(){a.alert&&a.displayAlert(!1);a.updateDynamicMap()}.bind(this));this.setupMapOptions();this.setupSearchBox();new GKeyboardHandler(map);Event.observe(window,"unload",a.saveMapPosition)},setupStaticMap:function(){var a=this;GEvent.addListener(map,"load",function(){hotels.each(function(b){markerList.addMarker({hotel:b,options:a.mapOptions})})});
map.addControl(new GSmallMapControl);map.addControl(new GScaleControl);map.enableContinuousZoom();map.enableDoubleClickZoom();this.mapList&&GEvent.addListener(map,"moveend",function(){a.updateMapList();a.updateVenueList()});var b=new GLatLngBounds;hotels.each(function(a){b.extend(new GLatLng(a.latitude,a.longitude))});hotels.length>0&&(map.centerAndZoomOnBounds(b),hotels.length==1&&this.mapInitZoom&&map.setZoom(this.mapInitZoom));if(this.displayMapVenues){mapBounds=map.getBounds();var c={LongitudeMin:mapBounds.getSouthWest().lng(),
LongitudeMax:mapBounds.getNorthEast().lng(),LatitudeMin:mapBounds.getSouthWest().lat(),LatitudeMax:mapBounds.getNorthEast().lat()};this.updateBoundCategories(mapBounds);this.createMvcJsonRequest(c,"MapJson/GetVenuesInMapSquare",a.displayStaticVenues,!1)}},setupRegionMap:function(){new GLatLng(0,0);map.disableDragging();this.createMvcJsonRequest({Code:locationCode},"MapJson/GetLocationDetails",this.displayLocations,!1)},setupRegionHotelsMap:function(a){map.addControl(new GSmallMapControl);map.addControl(new GScaleControl);
map.enableContinuousZoom();map.enableDoubleClickZoom();this.createNonAsyncMvcJsonRequest({HotelIds:a},"MapJson/GetHotelDetails",this.displayStaticHotels,!1)},showMapElement:function(a){var b=$("mapContainer");a?b.style.visibility="visible":removeChildrenFromNode(b)},displayLocations:function(a){var b=a.length;if(b==0)this.showMapElement(!1);else{this.showMapElement(!0);if(b<3)for(var c=map.getMapTypes(),d=0;d<c.length;d++)c[d].getMaximumResolution=function(){return 8};var e=new GLatLngBounds;for(d=
0;d<b;d++)e.extend(new GLatLng(a[d].Position.Latitude,a[d].Position.Longitude));GEvent.addListener(map,"load",function(){for(var c,d,g,j,k,l=0;l<b;l++)c="map-"+a[l].Name,c=c.replace(/ /g,"").replace(/&/g,"&amp;"),d=new GLatLng(a[l].Position.Latitude,a[l].Position.Longitude),g=a[l].Name,j=a[l].Url,k=a[l].RegionGeoCodes,k.length>0?(new LocationRegion(c,d,g,j,"mapLocation",k),map.setMapType(G_SATELLITE_MAP)):new LocationLabel(c,d,g,j,"mapLocation");map.centerAndZoomOnBounds(e)});b>0&&map.centerAndZoomOnBounds(e)}},
setupMapOptions:function(){var a=$(this.optionsFormId);if(a){var b=this;$A(a.getElementsByTagName("input")).each(function(a){Event.observe(a,"click",b.applyMapOptions.bindAsEventListener(b))});this.mapOptions.starRating=this.getStarRating()}},getStarRating:function(){var a=0;Form.getInputs(this.optionsFormId,"radio","starRating").each(function(b){if(b.checked==!0)a=b.value});return a},applyMapOptions:function(){var a=this.getStarRating();if(a!=this.mapOptions.starRating)this.mapOptions.starRating=
a,this.updateMapOptions()},setupSearchBox:function(){var a=$(this.searchFormId);a&&(Event.observe(a,"submit",this.mapLocationSearch.bindAsEventListener(this)),this.updateSearchBox())},updateSearchBox:function(){if(this.mapLocation.length>0&&$("locationSearchBox"))$("locationSearchBox").value=this.mapLocation},mapLocationSearch:function(a){var b=this,c=Form.getInputs(this.searchFormId,"text");c=c[0].value;c.length?(this.displayAlert("Searching..."),this.geocoder.getLocations(c,function(a){a.Status.code==
G_GEO_SUCCESS?a.Placemark.length>1?b.displayAlert(a.Placemark,c):b.gotoPosition(a.Placemark[0].Point.coordinates[1],a.Placemark[0].Point.coordinates[0],13,a.Placemark[0].address):b.displayAlert(c+"<br />not found.<br />Please try a different search.")})):alert("Please enter a location or an address in the search box.");Event.stop(a)},processSearch:function(a,b){a[0].Position?this.displayHotels(a,!0):!a[0].Position&&a.length==1?this.gotoLocation(a[0].Code):this.displayAlert(a,b)},gotoLocation:function(a){this.createMvcJsonRequest({Code:a},
"MapJson/GetHotelsForLocationCode",this.processSearch)},gotoPosition:function(a,b,c,d){a=new GLatLng(a,b);map.setCenter(a,c);c=new GIcon;c.image="/content/images/skin/maps/map_search_pin.png";c.iconSize=new GSize(20,34);c.iconAnchor=new GPoint(10,17);c.infoWindowAnchor=new GPoint(20,0);var e=new GMarker(a,{icon:c,zIndexProcess:importanceOrder});map.addOverlay(e);e.openInfoWindowHtml(d);GEvent.addListener(e,"click",function(){e.openInfoWindowHtml(d);return!1})},checkBounds:function(a){var b=map.getBounds();
if(!a.contains(b.getNorthEast())||!a.contains(b.getSouthWest())){var c=map.getCenter(),d=c.lng();c=c.lat();var e=(b.getNorthEast().lng()-b.getSouthWest().lng())/2,f=(b.getNorthEast().lat()-b.getSouthWest().lat())/2;b=a.getNorthEast().lng()-e;var h=a.getNorthEast().lat()-f;e=a.getSouthWest().lng()+e;a=a.getSouthWest().lat()+f;d<e?d=e:d>b&&(d=b);c<a?c=a:c>h&&(c=h);map.setCenter(new GLatLng(c,d))}},updateDynamicMap:function(){var a=map.getBounds();map.southWest=a.getSouthWest();map.northEast=a.getNorthEast();
a=map.northEast.lng()-map.southWest.lng();var b=map.northEast.lat()-map.southWest.lat(),c=map.getCenter(),d=map.getZoom(),e=!1;if(this.mapCentre==null||Math.abs(this.mapCentre.lng()-c.lng())>a/2||Math.abs(this.mapCentre.lat()-c.lat())>b/2)e=!0;e||d<this.mapZoom||d>this.mapZoom||this.msgBox.queue!==null?(this.mapCentre=c,this.mapZoom=d,this.createMvcJsonRequest({LongitudeMin:map.southWest.lng(),LongitudeMax:map.northEast.lng(),LatitudeMin:map.southWest.lat(),LatitudeMax:map.northEast.lat()},"MapJson/GetHotelCountWithinMapSquare",
this.checkNumHotels,e),this.displayMapVenues&&(this.updateMapCategories(map),this.createMvcJsonRequest({LongitudeMin:map.southWest.lng(),LongitudeMax:map.northEast.lng(),LatitudeMin:map.southWest.lat(),LatitudeMax:map.northEast.lat()},"MapJson/GetVenueCountWithinMapSquare",this.checkNumVenues,e))):d>=this.mapZoom&&d>=this.minZoom&&(this.displayMapVenues&&this.updateVenueList(),this.updateMapList())},updateMapList:function(){var a=this;this.msgBox.cancel();hotels.each(function(b){a.msgBox.add(a.hotelLinkList,
a.hotelLinkList.addHotelLink,{hotel:b,options:a.mapOptions})});this.msgBox.add(this.hotelLinkList,this.hotelLinkList.updateHotelLinks,this.mapOptions);this.msgBox.add(this,this.checkIfMapEmpty);this.msgBox.execute()},updateVenueList:function(){var a=this;this.msgBox.cancel();venues.each(function(b){a.msgBox.add(a.venueLinkList,a.venueLinkList.addVenueLink,{venue:b,options:a.mapOptions})});this.msgBox.add(this.venueLinkList,this.venueLinkList.updateVenueLinks,this.mapOptions);this.msgBox.execute()},
updateBoundCategories:function(a){this.createNonAsyncMvcJsonRequest({LongitudeMin:a.getSouthWest().lng(),LongitudeMax:a.getNorthEast().lng(),LatitudeMin:a.getSouthWest().lat(),LatitudeMax:a.getNorthEast().lat()},"MapJson/GetVenueCategoriesInMapSquare",categoryKeyList.updateKeys,2)},updateMapCategories:function(a){this.createMvcJsonRequest({LongitudeMin:a.southWest.lng(),LongitudeMax:a.northEast.lng(),LatitudeMin:a.southWest.lat(),LatitudeMax:a.northEast.lat()},"MapJson/GetVenueCategoriesInMapSquare",
categoryKeyList.updateKeys,3)},checkIfMapEmpty:function(){var a=this.hotelLinkList.getNumHotelLinks();map.getZoom()>=this.minZoom&&this.numHotels<=this.maxHotelsInView&&(a==0?this.displayNoHotels():(this.msgBox.hide(!0,!0),this.mapAccordian.showSection($(currentSectionWrapper),$(currentSectionHeader))))},checkNumHotels:function(a,b){this.numHotels=a;this.numHotels==0||this.mapZoom<this.minZoom||this.numHotels>this.maxHotelsInView?this.updateMapNum(this.numHotels,b):(this.updateMapPoints(),this.mapAccordian.showSection($(currentSectionWrapper),
$(currentSectionHeader)))},checkNumVenues:function(a,b){this.numVenues=a;a==0||this.mapZoom<this.minZoom||a>this.maxVenuesInView?this.updateVenueMapNum(a,b):this.updateVenueMapPoints()},updateMapNum:function(a){if(this.mapZoom<this.minZoom||a>this.maxHotelsInView)this.msgBox.cancel(),markerList.removeAllMarkers(),hotels=hotels.clear();this.hotelLinkList.removeAllHotelLinks();this.hotelLinkList.hideList();a>0?(this.msgBox.show(a+" hotels in this area.<br />Zoom in to view...",!1,!0),this.hotelLinkList.removeAlert(),
this.hotelLinkList.showAlert("Zoom in further to view hotel locations")):this.displayNoHotels()},updateVenueMapNum:function(a){if(this.mapZoom<this.minZoom||a>this.maxVenuesInView)this.msgBox.cancel(),markerList.removeAllMarkers(),venues=venues.clear();this.venueLinkList.removeAllHotelLinks();this.venueLinkList.hideList();a>0?(this.venueLinkList.removeAlert(),this.venueLinkList.showAlert("Zoom in further to view attraction locations")):this.displayNoVenues()},displayNoHotels:function(){var a="";a=
this.mapOptions.starRating>0?"No hotels in this area which match your selection":"No hotels in this area";this.msgBox.show(a,!1,!0);this.hotelLinkList.showAlert(a)},displayNoVenues:function(){this.venueLinkList.showAlert("No attractions in this area")},updateMapPoints:function(){var a=map.northEast.lng()-map.southWest.lng(),b=map.northEast.lat()-map.southWest.lat(),c=new GLatLngBounds;c.extend(new GLatLng(map.southWest.lat()-b,map.southWest.lng()-a));c.extend(new GLatLng(map.northEast.lat()+b,map.northEast.lng()+
a));a={LongitudeMin:c.getSouthWest().lng(),LongitudeMax:c.getNorthEast().lng(),LatitudeMin:c.getSouthWest().lat(),LatitudeMax:c.getNorthEast().lat()};this.msgBox.show("Downloading hotels...",!1,!1);this.createMvcJsonRequest(a,"MapJson/GetHotelsWithinMapSquare",this.displayHotels,!1)},updateVenueMapPoints:function(){var a=map.northEast.lng()-map.southWest.lng(),b=map.northEast.lat()-map.southWest.lat(),c=new GLatLngBounds;c.extend(new GLatLng(map.southWest.lat()-b,map.southWest.lng()-a));c.extend(new GLatLng(map.northEast.lat()+
b,map.northEast.lng()+a));a={LongitudeMin:c.getSouthWest().lng(),LongitudeMax:c.getNorthEast().lng(),LatitudeMin:c.getSouthWest().lat(),LatitudeMax:c.getNorthEast().lat()};this.msgBox.show("Downloading attractions...",!1,!1);this.createMvcJsonRequest(a,"MapJson/GetVenuesInMapSquare",this.displayVenues,!1)},displayStaticHotels:function(a){var b=this,c=a.length;if(c==0)this.showMapElement(!1);else{this.showMapElement(!0);for(var d=[],e=0;e<c;e++)d[d.length]=new Hotel(a[e].Id,a[e].Name,a[e].Address,
a[e].Position.Longitude,a[e].Position.Latitude,a[e].StarRating,a[e].Url,"hotel");var f=new GLatLngBounds;d.each(function(a){f.extend(new GLatLng(a.latitude,a.longitude))});d.length>0&&(map.centerAndZoomOnBounds(f),d.length==1&&this.mapInitZoom&&map.setZoom(this.mapInitZoom));this.displayMapVenues&&(hotelsBoundary=f,this.updateBoundCategories(f));d.each(function(a){markerList.addMarker({hotel:a,options:b.mapOptions})})}},displayHotels:function(a,b){var c=a.length;if(c==0)this.msgBox.show("Sorry: No hotels in that area",
!1,!0);else if(b){for(var d=new GLatLngBounds,e=0;e<c;e++)d.extend(new GLatLng(a[e].Position.Latitude,a[e].Position.Longitude));map.centerAndZoomOnBounds(d);map.getZoom()<this.minZoom&&(markerList.removeAllMarkers(),hotels=hotels.clear())}else{this.msgBox.show("Displaying hotels...",!0,!1);hotels=hotels.clear();this.msgBox.cancel();for(e=0;e<c;e++)hotels[hotels.length]=new Hotel(a[e].Id,a[e].Name,a[e].Address,a[e].Position.Longitude,a[e].Position.Latitude,a[e].StarRating,a[e].Url,"hotel"),this.msgBox.add(markerList,
markerList.addMarker,{hotel:hotels[e],options:this.mapOptions}),this.msgBox.add(this.hotelLinkList,this.hotelLinkList.addHotelLink,{hotel:hotels[e],options:this.mapOptions});d=new GLatLng(53.96500597034407,-1.071823597085313);map.getBounds().contains(d)&&(d=new Hotel("superbreak","Superbreak Mini-Holidays","Eboracum Way, YORK YO31 7RE.",d.lng(),d.lat(),"http://www.superbreak.com/",0,"superbreak"),hotels[hotels.length]=d,this.msgBox.add(markerList,markerList.addMarker,{hotel:d,options:this.mapOptions}));
this.msgBox.add(markerList,markerList.hideMarkers);this.msgBox.add(markerList,markerList.cleanUpMarkers,this.mapOptions);this.msgBox.add(this.hotelLinkList,this.hotelLinkList.updateHotelLinks,this.mapOptions);this.msgBox.execute();this.hotelMarkersLoaded=!0}},displayVenues:function(a){var b=a.length;venues=venues.clear();b!=0&&this.msgBox.show("Displaying attractions...",!0,!1);for(var c=0;c<b;c++)venues[venues.length]=new Venue(a[c].Id,a[c].CategoryId,a[c].Name,a[c].Description,a[c].ShortDescription,
a[c].Address,a[c].Telephone,a[c].Position.Longitude,a[c].Position.Latitude,a[c].Website,a[c].VenueCategoryName,a[c].TicketsAvailable,a[c].ThumbnailImage,"venue"),this.msgBox.add(markerList,markerList.addVenueMarker,{venue:venues[c],options:this.mapOptions}),this.msgBox.add(this.venueLinkList,this.venueLinkList.addVenueLink,{venue:venues[c],options:this.mapOptions});this.msgBox.add(markerList,markerList.hideMarkers);this.msgBox.add(markerList,markerList.cleanUpMarkers,this.mapOptions);this.msgBox.add(this.venueLinkList,
this.venueLinkList.updateVenueLinks,this.mapOptions);this.msgBox.execute();this.venueMarkersLoaded=!0},displayStaticVenues:function(a){var b=a.length;venues=venues.clear();for(var c=0;c<b;c++)venues[venues.length]=new Venue(a[c].Id,a[c].CategoryId,a[c].Name,a[c].Description,a[c].ShortDescription,a[c].Address,a[c].Telephone,a[c].Position.Longitude,a[c].Position.Latitude,a[c].Website,a[c].VenueCategoryName,a[c].TicketsAvailable,a[c].ThumbnailImage,"venue"),markerList.addVenueMarker({venue:venues[c],
options:this.mapOptions}),markerList.hideMarkers()},centreMapOnHotels:function(){var a=new GLatLngBounds;if(hotels.length>1){for(var b=0,c=hotels.length;b<c;b++)a.extend(new GLatLng(hotels[b].latitude,hotels[b].longitude));map.centerAndZoomOnBounds(a)}},updateMapOptions:function(){if(map.getZoom()>=this.minZoom){this.msgBox.show("Updating map...",!0,!1);this.msgBox.cancel();var a=this;this.msgBox.add(markerList,markerList.cleanUpMarkers,this.mapOptions);this.msgBox.add(this.hotelLinkList,this.hotelLinkList.updateHotelLinks,
this.mapOptions);hotels.each(function(b){a.msgBox.add(markerList,markerList.addMarker,{hotel:b,options:a.mapOptions});a.msgBox.add(a.hotelLinkList,a.hotelLinkList.addHotelLink,{hotel:b,options:a.mapOptions})});this.msgBox.add(this,this.checkIfMapEmpty);this.msgBox.execute()}},displayAlert:function(a,b){a?typeof a!="string"?this.displayLocationsInAlert(a,b):(this.alert=!0,this.msgBox.show(a,!1,!0)):(this.alert=!1,this.msgBox.hide(!0,!0))},displayLocationsInAlert:function(a,b){var c='<div id="mapSearchRefine"><h3 class="title">Please refine your search</h3>';
c+='<p>We have several matches for <span class="searchString">'+b+"</span>.";c+="Please select from the following locations.</p>";c+='<ul id="mapAltLocations"><li><h4 class="title">';c+='<span class="matchingLocation">'+b+"</span> found in:";c+="</h4><ol> ";for(var d=0;d<a.length;d++){this.alert=!0;var e=a[d].Point.coordinates;c+='<li><a href="javascript:gmap.gotoPosition('+e[1]+", "+e[0]+", 13, '"+a[d].address+"');\">"+a[d].address+"</a></li>"}c+="</ol></li></ul>";this.msgBox.show(c,!1,!0)},clearError:function(){this.error=
!1},createMvcJsonRequest:function(a,b,c,d){var e=this;$j.ajax({type:"POST",url:ajaxBaseUrl+b,dataType:"json",contentType:"application/json; charset=utf-8",data:a!=null?$j.toJSON(a):null,success:function(a){e.clearError();e.successFn=c;eval(e.successFn(a,d));e.successFn=null}})},createNonAsyncMvcJsonRequest:function(a,b,c,d){var e=this;$j.ajax({async:!1,type:"POST",url:ajaxBaseUrl+b,dataType:"json",contentType:"application/json; charset=utf-8",data:a!=null?$j.toJSON(a):null,success:function(a){e.clearError();
e.successFn=c;eval(e.successFn(a,d));e.successFn=null}})},callInProgress:function(){switch(this.ajaxRequest.transport.readyState){case 1:case 2:case 3:return!0;default:return!1}},checkResponse:function(){var a=this;this.ajaxReqTime+=this.ajaxCheckInterval;if(this.callInProgress()&&this.ajaxReqTime>=this.ajaxMaxReqTime){if(this.ajaxRequest.transport.abort(),this.ajaxRequest.options.onFailure)this.ajaxRequest.options.onFailure()}else this.ajaxTimeout=window.setTimeout(function(){a.checkResponse()},
this.ajaxCheckInterval)},saveMapPosition:function(){var a=map.getBounds(),b=a.getSouthWest();a=a.getNorthEast();b=b.lat()+","+b.lng()+","+a.lat()+","+a.lng();setCookie("mapLocation",b,"","/")},loadMapPosition:function(){var a=new GLatLngBounds,b=getCookie("mapLocation");if(b){var c=[];c=b.split(",");a.extend(new GLatLng(c[0],c[1]));a.extend(new GLatLng(c[2],c[3]));map.centerAndZoomOnBounds(a)}else this.limitRegion.length>0?this.setMapLocation(this.limitRegion):(a.extend(new GLatLng(50.32,-7.58)),
a.extend(new GLatLng(56.99,2.9)),map.centerAndZoomOnBounds(a))},setMapLocation:function(a){var b;switch(a.toLowerCase()){case "london":case "centrallondonmap":centre=new GLatLng(51.50785462430557,-0.11415481567382812);a=12;b="London";break;case "manchester":case "centralmancmap":centre=new GLatLng(53.4789543789555,-2.2436141967773438);a=13;b="Manchester";break;case "paris":case "centralparismap":centre=new GLatLng(48.8582095,2.34677625);a=12;b="Paris";break;case "edinburgh":case "map_edinburgh":centre=
new GLatLng(55.94689292347294,-3.20526123046875);a=13;b="Edinburgh";break;case "barcelona":case "map_barcelona":centre=new GLatLng(41.38608229923676,2.165851593017578);a=13;b="Barcelona";break;case "amsterdam":case "map_amsterdam":centre=new GLatLng(52.36836764198347,4.890804290771484);a=13;b="Amsterdam";break;case "scotland":centre=new GLatLng(56.15778819063682,-3.7353515625);a=7;b="Scotland";break;case "northeast":centre=new GLatLng(54.54339315407258,-1.329345703125);a=8;b="North East";break;case "northwest":centre=
new GLatLng(53.55336278552809,-2.6092529296875);a=9;b="North West";break;case "heartofengland":centre=new GLatLng(52.91718335527073,-1.7852783203125);a=9;b="Heart of England";break;case "eastanglia":centre=new GLatLng(52.30176096373671,0.7635498046875);a=8;b="East Anglia";break;case "southeast":centre=new GLatLng(51.337475662965204,0.1593017578125);a=8;b="South East";break;case "southernengland":case "southofengland":centre=new GLatLng(51.06901665960392,-1.34033203125);a=8;b="Southern England";break;
case "westcountry":centre=new GLatLng(50.70515564735687,-3.9825439453125);a=8;b="West Country";break;default:centre=new GLatLng(0,0),a=1}map.setCenter(centre,a);this.mapLocation=b;this.updateSearchBox()},getRegionBounds:function(a){var b=new GLatLngBounds;switch(a.toLowerCase()){case "london":case "centrallondonmap":b.extend(new GLatLng(51.452723257688525,-0.19809722900390622));b.extend(new GLatLng(51.56298547479647,-0.029869079589843747));break;default:b=new GLatLngBounds}return b},getMinRegionZoom:function(a){switch(a.toLowerCase()){case "london":case "centrallondonmap":a=
12;break;default:a=20}return a}};var Hotel=Class.create();
Hotel.prototype={initialize:function(a,b,c,d,e,f,h,g,j){this.id=a;this.type=g;this.header=b.replace(/&amp;/g,"&").replace(/&#39;/g,"'");this.address=c.replace(/,/g,", ").replace(/&amp;/g,"&").replace(/&#39;/g,"'").replace(/&eacute;/g,"\u00e9").replace(/&aacute;/g,"\u00e1").replace(/&iacute;/g,"\u00ed").replace(/&uacute;/g,"\u00fa").replace(/&agrave;/g,"\u00e0").replace(/&#8217;/g,"\u2019");this.longitude=parseFloat(d);this.latitude=parseFloat(e);this.starRating=parseInt(f);this.url=h;this.packageType=
j;this.latLng=new GLatLng(this.latitude,this.longitude)},checkStarRating:function(a){if(this.starRating==0)return!0;return a==0||!a||a==this.starRating||a==this.starRating-1?!0:!1}};var Venue=Class.create();
Venue.prototype={id:null,categoryid:null,name:null,shortDescription:null,shortDescriptionAbb:null,address:null,telephone:null,longitude:null,latitude:null,website:null,categoryName:null,ticketsAvailable:!1,thumbnailImage:null,venueType:null,initialize:function(a,b,c,d,e,f,h,g,j,k,l,m,o,n){this.id=a;this.type=makeHtmlSafe(n);this.name=makeHtmlSafe(c);this.shortDescription=makeHtmlSafe(d);this.shortDescriptionAbb=makeHtmlSafe(e);this.address=makeHtmlSafe(f);this.telephone=h;this.longitude=parseFloat(g);
this.latitude=parseFloat(j);this.website=k;this.categoryid=b;this.categoryName=makeHtmlSafe(l);this.ticketsAvailable=m;this.thumbnailImage=o;this.latLng=new GLatLng(this.latitude,this.longitude)}};var MarkerList=Class.create();
MarkerList.prototype={hotelZoom:17,firstRun:!0,hoverMarker:null,offMap:null,stickyHover:!1,markerOpen:0,venueIcons:"",venueHoverMarkers:"",loadedHoverMarkers:"",initialize:function(){this.markers=[];this.venueIcons=[];this.venueHoverMarkers=[];this.loadedHoverMarkers=[];this.hotelIcon=this.createIcon("hotel",!1);this.superbreakIcon=this.createIcon("superbreak",!1);this.airportCarparkIcon=this.createIcon("airportCarpark",!1);this.venueIcon=this.createIcon("venue",!1);this.offMap=new GLatLng(-90,-180);
this.hoverMarker=new GMarker(this.offMap,{icon:this.createIcon("hotel",!0),zIndexProcess:importanceOrder});this.hoverMarker.importance=2},populateIcons:function(a){for(var b=a.length,c=0;c<b;c++)markerList.venueIcons.push(markerList.createIcon("venue",!1,a[c].Id)),markerList.venueHoverMarkers.push(markerList.createHoverMarker(markerList.createIcon("venue",!0,a[c].Id)))},getIcon:function(a){return this.venueIcons.find(function(b){if(b.categoryId==a)return b})},getHoverMarker:function(a){var b=this.hoverMarker;
if(a)for(i=0;i<this.venueHoverMarkers.length;i+=1)this.venueHoverMarkers[i].categoryId==a.categoryid&&(b=this.venueHoverMarkers[i]);return b},checkIsHoverMarkerLoaded:function(a){var b=!1;for(i=0;i<this.loadedHoverMarkers.length;i+=1)this.loadedHoverMarkers[i].categoryId==a.categoryId&&(b=!0);return b},addToLoadedHoverMarkers:function(a){this.loadedHoverMarkers.push(a)},addHoverMarker:function(a){var b=this.hoverMarker;if(a)for(i=0;i<this.venueHoverMarkers.length;i+=1)this.venueHoverMarkers[i].categoryId==
a.categoryid&&(b=this.venueHoverMarkers[i]);return b},createHoverMarker:function(a){marker=new GMarker(this.offMap,{icon:a,zIndexProcess:importanceOrder});marker.categoryId=a.categoryId;marker.importance=1;return marker},createIcon:function(a,b,c){var d=0,e=0,f="";switch(a.toLowerCase()){case "hotel":d=16;e=15;f="/content/images/skin/maps/mapicon_hotel.png";break;case "superbreak":e=d=20;f="/content/images/icons/map-sb-logo.gif";break;case "venue":e=d=15;f="/content/images/skin/maps/mapicon_cat"+
c+".png";break;case "airportcarpark":e=d=15,f="/content/images/skin/maps/mapicon_car.png"}var h=new GIcon;if(b&&(a=="hotel"||a=="airportCarpark"))f=f.replace(".png","_on.png");h.categoryId=c;h.image=f;h.iconSize=new GSize(d,e);h.iconAnchor=new GPoint(d/2,e/2);h.infoWindowAnchor=new GPoint(d,0);return h},addMarker:function(a){var b=a.hotel;a=a.options.starRating;if(!this.markers.find(function(a){return a.id===b.id&&(a.categoryId=="hotel"||a.categoryId=="airportCarpark")}))b.packageType=="AP"||b.packageType==
"MG"?(this.offMap=new GLatLng(-90,-180),this.hoverMarker=new GMarker(this.offMap,{icon:this.createIcon("airportCarpark",!0),zIndexProcess:importanceOrder}),this.hoverMarker.importance=2,this.markers[this.markers.length]=this.createMarker(b)):b.checkStarRating(a)&&(this.markers[this.markers.length]=this.createMarker(b))},addVenueMarker:function(a){var b=a.venue;this.markers.find(function(a){return a.id===b.id&&a.categoryId!=="hotel"})||(this.markers[this.markers.length]=this.createVenueMarker(b))},
hideMarkers:function(){this.markers.each(function(a){categoryKeyList.getKey(a.categoryId,"").enabled||a.hide()})},cleanUpMarkers:function(a){var b=a.starRating,c=this;this.markers.each(function(a){var e=hotels.find(function(b){return b.id===a.id&&a.categoryId=="hotel"?b:!1}),f=venues.find(function(b){return b.id===a.id&&a.categoryId!=="hotel"?b:!1});if((!e||!e.checkStarRating(b))&&!f)a.popup&&map.closeInfoWindow(),c.removeMarker(a)});this.compactMarkers()},createMarker:function(a){var b=this;this.firstRun&&
(map.addOverlay(this.hoverMarker),GEvent.addListener(this.hoverMarker,"click",function(){map.closeInfoWindow()}),this.hoverMarker.hide());this.firstRun=!1;var c="";if(a.type=="hotel")c=this.hotelIcon;else if(a.type=="superbreak")c=this.superbreakIcon;if(a.packageType=="AP"||a.packageType=="MG")c=this.airportCarparkIcon;var d=new GMarker(a.latLng,{icon:c,title:a.header,zIndexProcess:importanceOrder});GEvent.addListener(d,"click",function(){b.showPopup(d,a)});GEvent.addListener(d,"infowindowopen",function(){if(d.id!=
"superbreak")b.showHoverIcon(d),b.stickyHover=!0,b.markerOpen=d.id});GEvent.addListener(d,"infowindowclose",function(){b.hidePopup(d);b.stickyHover=!1;b.hideHoverIcon(d);b.markerOpen=0});GEvent.addListener(d,"dblclick",function(){});d.id=a.id;d.importance=2;d.categoryId="hotel";map.addOverlay(d);return d},createVenueMarker:function(a){var b=this,c=this.getIcon(a.categoryid),d=this.getHoverMarker(a);this.checkIsHoverMarkerLoaded(d)||(map.addOverlay(d),GEvent.addListener(d,"click",function(){map.closeInfoWindow()}),
d.hide(),this.addToLoadedHoverMarkers(d));var e=new GMarker(a.latLng,{icon:c,title:a.name,zIndexProcess:importanceOrder});GEvent.addListener(e,"click",function(){b.showVenuePopup(e,a)});GEvent.addListener(e,"infowindowopen",function(){if(e.id!="superbreak")b.showHoverIcon(e,a),b.stickyHover=!0,b.markerOpen=e.id});GEvent.addListener(e,"infowindowclose",function(){b.hidePopup(e);b.stickyHover=!1;b.hideHoverIcon(e,a);b.markerOpen=0});GEvent.addListener(e,"dblclick",function(){});e.id=a.id;e.importance=
1;e.categoryId=a.categoryid;map.addOverlay(e);return e},showHoverIcon:function(a,b){hoverMarker=this.getHoverMarker(b);this.stickyHover||(hoverMarker.setPoint(a.getPoint()),a.hide(),hoverMarker.show())},hideHoverIcon:function(a,b){hoverMarker=this.getHoverMarker(b);this.stickyHover||(hoverMarker.setPoint(this.offMap),hoverMarker.hide(),a.show())},zoomToMarker:function(a,b){var c=document.createElement("a"),d=a.latLng;$("popupLinks");var e=this,f=$("zoomControl");removeChildrenFromNode(f);c.appendChild(document.createTextNode("Zoom Out"));
c.setAttribute("href","");c.onclick=function(){return!1};Event.observe(c,"click",function(){e.zoomOutToMarker(a,b);return!1});f.appendChild(c);map.setCenter(d,this.hotelZoom)},zoomOutToMarker:function(a,b){var c=document.createElement("a"),d=a.latLng;$("popupLinks");var e=this,f=$("zoomControl");removeChildrenFromNode(f);c.appendChild(document.createTextNode("Zoom In"));c.setAttribute("href","");c.onclick=function(){return!1};Event.observe(c,"click",function(){e.zoomToMarker(a,b);return!1});f.appendChild(c);
map.setCenter(d,b)},removeMarker:function(a){removeChildrenFromNode(a.popup);a.popup=null;this.markers[this.markers.indexOf(a)]=null;map.removeOverlay(a)},removeAllMarkers:function(){for(var a=0,b=this.markers.length;a<b;a++)map.removeOverlay(this.markers[a]),this.markers[a]=null;this.compactMarkers()},compactMarkers:function(){this.markers=this.markers.compact()},getMarker:function(a){for(var b=0,c=this.markers.length;b<c;b++)if(this.markers[b].id===a)return this.markers[b]},showPopup:function(a,
b){if(a.popup)map.closeInfoWindow();else{a.popup=document.createElement("div");var c=document.createElement("h4"),d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("span"),h=document.createElement("div"),g=document.createElement("img"),j=document.createElement("p"),k=document.createElement("p"),l=document.createElement("div"),m=document.createElement("a");c.appendChild(document.createTextNode(b.header));f.appendChild(document.createTextNode(b.starRating+" Stars"));
j.appendChild(document.createTextNode(b.address));k.setAttribute("id","popupLinks");l.setAttribute("id","zoomControl");map.mapType!="static"&&m.appendChild(document.createTextNode("View hotel"));d.appendChild(e);e.appendChild(f);b.type=="hotel"&&k.appendChild(m);if(map.getZoom()<this.hotelZoom){var o=this,n=document.createElement("a");n.appendChild(document.createTextNode("Zoom in"));b.type=="hotel"&&map.mapType!="static"&&k.appendChild(document.createTextNode(" | "));l.appendChild(n);k.appendChild(l);
n.setAttribute("href","");n.onclick=function(){return!1};Event.observe(n,"click",function(){o.zoomToMarker(b,map.getZoom());return!1})}h.appendChild(g);h.appendChild(j);Element.addClassName(a.popup,"hotelMapPopup");Element.addClassName(d,"stars");Element.addClassName(e,"stars"+b.starRating+"Small");f.setAttribute("title",b.starRating+" Stars");Element.addClassName(j,"hotelMapAddress");Element.addClassName(h,"hotelMapDetails");b.id=="superbreak"?g.setAttribute("src","/content/images/icons/map-sb-logo-big.gif"):
g.setAttribute("src","/content/images/hotels/thumbnails/"+b.id+"_BRO.jpg");Element.addClassName(k,"hotelMapPopupLinks");if(b.url.length>0)b.url=b.url.replace(/&amp;/g,"&");m.setAttribute("href",b.url);Event.observe(m,"click",function(){document.location.href="/hotel/hotel?groupId="+b.id});b.id=="superbreak"&&(map.getZoom()<this.hotelZoom&&k.appendChild(document.createTextNode(" | ")),e=document.createElement("a"),e.appendChild(document.createTextNode("Contact us")),k.appendChild(e),k.appendChild(document.createTextNode(" | ")),
f=document.createElement("a"),f.appendChild(document.createTextNode("About us")),k.appendChild(f),e.setAttribute("href","/info/contactus.htm"),f.setAttribute("href","/info/about-us.htm"));a.popup.appendChild(c);b.type=="hotel"&&a.popup.appendChild(d);a.popup.appendChild(h);a.popup.appendChild(k);map.closeInfoWindow();a.openInfoWindow(a.popup)}},hidePopup:function(a){removeChildrenFromNode(a.popup);a.popup=null},showVenueMoreInfoPopup:function(a,b){var c=this,d=document.createElement("h4"),e=document.createElement("div"),
f=document.createElement("p"),h=document.createElement("p"),g=document.createElement("p"),j=document.createElement("p"),k=document.createElement("p"),l=document.createElement("div"),m=document.createElement("div");document.createElement("div");var o=document.createElement("div");j=document.createElement("p");var n=document.createElement("a");Element.addClassName(e,"venueMapDetails");popup=document.createElement("div");l.appendChild(document.createTextNode("Address"));m.appendChild(document.createTextNode("Telephone"));
o.appendChild(document.createTextNode("Category"));k.appendChild(document.createTextNode(b.categoryName));d.appendChild(document.createTextNode(b.name));f.appendChild(document.createTextNode(b.address));h.appendChild(document.createTextNode(b.telephone));g.appendChild(document.createTextNode(b.shortDescription));n.appendChild(document.createTextNode("Go Back"));n.setAttribute("href","javascript:;");Event.observe(n,"click",function(){c.showVenuePopup(a,b)});j.appendChild(n);e.appendChild(g);e.appendChild(l);
e.appendChild(f);b.telephone.length>0&&(e.appendChild(m),e.appendChild(h));e.appendChild(o);e.appendChild(k);Element.addClassName(e,"venueMapDetails");Element.addClassName(j,"venueMapPopupLinks");Element.addClassName(popup,"venueMapPopupMoreInfo");popup.appendChild(d);popup.appendChild(e);popup.appendChild(j);map.closeInfoWindow();a.openInfoWindow(popup)},showVenuePopup:function(a,b){var c=this;popup=document.createElement("div");var d=document.createElement("h4"),e=document.createElement("div"),
f=document.createElement("p"),h=document.createElement("p"),g=document.createElement("p"),j=document.createElement("a"),k=document.createElement("a");document.createElement("a");var l=document.createElement("a"),m=document.createElement("div"),o=document.createElement("div");m.appendChild(document.createTextNode("Add this attraction to the end of your booking!"));d.appendChild(document.createTextNode(b.name));f.appendChild(document.createTextNode(b.shortDescriptionAbb));h.appendChild(document.createTextNode(b.address));
j.appendChild(document.createTextNode("Book Tickets"));k.appendChild(document.createTextNode("More Info"));l.appendChild(document.createTextNode("Show All Attractions"));l.setAttribute("href","javascript:;");l.setAttribute("id","showKeyLink");f.appendChild(document.createTextNode(" "));f.appendChild(k);g.setAttribute("id","popupLinks");o.setAttribute("id","zoomControl");Event.observe(k,"click",function(){c.showVenueMoreInfoPopup(a,b)});Event.observe(l,"click",function(){categoryKeyList.showKey()});
if(map.getZoom()<this.hotelZoom)j=document.createElement("a"),j.appendChild(document.createTextNode("Zoom In")),o.appendChild(j),g.appendChild(o),j.setAttribute("href",""),j.onclick=function(){return!1},Event.observe(j,"click",function(){c.zoomToMarker(b,map.getZoom());return!1});g.appendChild(document.createTextNode("\u00a0\u00a0"));g.appendChild(l);e.appendChild(f);e.appendChild(h);Element.addClassName(popup,"venueMapPopup");Element.addClassName(k,"moreInfoLink");Element.addClassName(f,"venueMapDescription");
Element.addClassName(h,"venueAddress");Element.addClassName(e,"venueMapDetails");Element.addClassName(g,"venueMapPopupLinks");Element.addClassName(m,"venueMapPopupTickets");popup.appendChild(d);popup.appendChild(e);popup.appendChild(g);b.ticketsAvailable==1&&popup.appendChild(m);map.closeInfoWindow();a.openInfoWindow(popup)}};var CategoryKey=Class.create();
CategoryKey.prototype={id:null,categoryId:null,keyCheckbox:null,keyCol:null,name:null,enabled:!0,selectable:!0,initialize:function(a,b,c,d){this.categoryId=a;this.name=makeHtmlSafe(b);this.id="category"+a;if(c==0)this.enabled=!1;if(d==0)this.selectable=!1},createKey:function(){var a=document.createElement("img"),b=document.createElement("input");document.createElement("label");b.setAttribute("type","checkbox");b.setAttribute("name",this.id);b.setAttribute("id",this.id);b.setAttribute("categoryId",
this.categoryId);this.categoryId=="hotel"?a.setAttribute("src",markerList.hotelIcon.image):this.categoryId=="airportCarpark"?a.setAttribute("src",markerList.airportCarparkIcon.image):a.setAttribute("src",markerList.getIcon(this.categoryId).image);Event.observe(b,"click",this.toggleKey.bindAsEventListener(this));this.keyImg=a;this.keyCheckbox=b;this.enabled&&this.keyCheckbox.setAttribute("checked",!0)},getKeyCol:function(){var a=document.createElement("label"),b=document.createElement("td");a.setAttribute("for",
"category"+this.categoryId);a.appendChild(document.createTextNode(this.name));b.appendChild(this.keyImg);this.selectable?b.appendChild(this.keyCheckbox):b.appendChild(document.createTextNode("  "));b.appendChild(a);return b},toggleKey:function(){if(ArrayContains(loadedCategories,this.categoryId)==!1){var a=hotelsBoundary.getSouthWest().lng(),b=hotelsBoundary.getNorthEast().lng(),c=hotelsBoundary.getSouthWest().lat(),d=hotelsBoundary.getNorthEast().lat();$j.ajax({async:!1,type:"POST",url:ajaxBaseUrl+
"MapJson/GetVenuesInCategory",dataType:"json",data:{LongitudeMin:a,LongitudeMax:b,LatitudeMin:c,LatitudeMax:d,categoryId:this.categoryId},success:function(a){DisplayVenuesInCategories(a)},error:function(){}});loadedCategories.push(this.categoryId)}for(i=1;i<markerList.markers.length;i+=1)if(markerList.markers[i].categoryId==this.categoryId)this.keyCheckbox.checked==!0?(markerList.markers[i].show(),this.enabled=!0):(markerList.markers[i].hide(),this.enabled=!1)}};var CategoryKeyList=Class.create();
CategoryKeyList.prototype={mapKey:null,mapKeyWrapper:null,mapKeyControls:null,mapKeyShowControl:null,allEnabled:!1,selectAllBf:null,deSelectAllBf:null,initialize:function(a){var b=document.createElement("a"),c=document.createElement("a");this.mapKey=$("mapKey");this.mapKeyWrapper=$("mapKeyWrapper");this.mapKeyControls=$("mapKeyControls");this.mapKeyShowControl=$("mapKeyShowControl");this.keyList=[];this.allEnabled=a;b.appendChild(document.createTextNode("Select All"));b.setAttribute("href","javascript:;");
b.setAttribute("id","selectAll");c.appendChild(document.createTextNode("Hide Map Key"));c.setAttribute("href","javascript:;");this.mapKeyControls.appendChild(b);this.mapKeyControls.appendChild(document.createTextNode("\u00a0\u00a0"));this.mapKeyShowControl!==void 0&&(Event.observe(this.mapKeyShowControl,"click",this.showKey.bindAsEventListener(this)),Event.observe(c,"click",this.hideKey.bindAsEventListener(this)),this.mapKeyControls.appendChild(c));this.selectAllBf=this.selectAllKeys.bindAsEventListener(this);
this.deSelectAllBf=this.deSelectAllKeys.bindAsEventListener(this);Event.observe(b,"click",this.selectAllBf)},getKey:function(a,b,c,d){var e=categoryKeyList;this.allEnabled&&(c=!0);key=new CategoryKey(a,b,c,d);key.createKey();key.isNew=!0;for(i=0;i<e.keyList.length;i+=1)if(e.keyList[i].categoryId==a)key=e.keyList[i],key.isNew=!1;return key},selectAllKeys:function(){var a=$("selectAll");a.removeChild(a.firstChild);a.appendChild(document.createTextNode("Deselect All"));Event.stopObserving(a,"click",
this.selectAllBf);Event.observe(a,"click",this.deSelectAllBf);a=1;for(var b=this.keyList.length;a<b;a++)if(keyCheckbox=$(this.keyList[a].id),keyCheckbox!==void 0)$(this.keyList[a].id).checked=!0,this.keyList[a].toggleKey()},deSelectAllKeys:function(){var a=$("selectAll");a.removeChild(a.firstChild);a.appendChild(document.createTextNode("Select All"));Event.stopObserving(a,"click",this.deSelectAllBf);Event.observe(a,"click",this.selectAllBf);a=1;for(var b=this.keyList.length;a<b;a++)if(keyCheckbox=
$(this.keyList[a].id),keyCheckbox!==void 0)$(this.keyList[a].id).checked=!1,this.keyList[a].toggleKey()},showKey:function(){this.mapKey.style.display="block";this.mapKeyShowControl.style.display="none"},hideKey:function(){this.mapKey.style.display="none";this.mapKeyShowControl.style.display="block"},updateKeys:function(a,b){var c=categoryKeyList,d=a.length,e=document.createElement("table"),f=document.createElement("tbody"),h=document.createElement("tr"),g=c.getKey("hotel","Hotel",!0,!1);g.isNew&&
c.keyList.push(g);h.appendChild(g.getKeyCol());f.appendChild(h);g=c.getKey("airportCarpark","Car Park",!0,!1);g.isNew&&c.keyList.push(g);h.appendChild(g.getKeyCol());f.appendChild(h);for(g=0;g<d;g++){var j=c.getKey(a[g].Id,a[g].Name,a[g].Enabled,a[g].Selectable);j.isNew&&c.keyList.push(j);(g+2)%b==0?(h.appendChild(j.getKeyCol()),f.appendChild(h),h=document.createElement("tr")):h.appendChild(j.getKeyCol());g==d-1&&f.appendChild(h)}removeChildrenFromNode(c.mapKeyWrapper);e.appendChild(f);c.mapKeyWrapper.appendChild(e);
if(c.mapKeyShowControl==void 0)c.mapKey.style.display="block";d=c.keyList.length;for(g=0;g<d;g++)if(typeof $(c.keyList[g].id)!="undefined")$(c.keyList[g].id).checked=c.keyList[g].enabled}};var HotelLinkList=Class.create();
HotelLinkList.prototype={alert:!1,alertNode:null,listWrapper:null,cityWrapper:null,venueWrapper:null,initialize:function(a){this.mapOptions=$("mapOptions");this.listWrapper=$("mapHotelListWrapper");this.cityWrapper=$("mapCityListWrapper");this.venueWrapper=$("mapVenueListWrapper");if(this.listElem=$(a))this.idPrepend="hotelMapLink_"},addHotelLink:function(a){var b=a.hotel;a=a.options.starRating;!$(this.idPrepend+b.id)&&b.checkStarRating(a)&&this.withinMapView(b)&&this.createHotelLink(b)},addVenueLink:function(a){a=
a.venue;$(this.idPrepend+a.id)||this.withinMapView(a)&&this.createVenueLink(a)},createHotelLink:function(a){if(a.id!="superbreak"){this.removeAlert();var b=document.createElement("li");b.setAttribute("id",this.idPrepend+a.id);var c=document.createElement("a");c.setAttribute("href","javascript:;");var d=document.createTextNode(a.header.replace(/\//," / "));b.appendChild(c);c.appendChild(d);this.listElem.appendChild(b);var e=this;c.onclick=function(){return!1};Event.observe(c,"click",function(){e.popupInfoWindow(a);
currentSectionWrapper="mapHotelListWrapper";currentSectionHeader="mapHotelListHeader"});Event.observe(c,"mouseover",function(){var b=markerList.getMarker(a.id);markerList.showHoverIcon(b)});Event.observe(c,"mouseout",function(){var b=markerList.getMarker(a.id);markerList.hideHoverIcon(b)})}},createVenueLink:function(a){this.removeAlert();var b=document.createElement("li");b.setAttribute("id",this.idPrepend+a.id);var c=document.createElement("a");c.setAttribute("href","javascript:;");var d=document.createTextNode(a.name.replace(/\//,
" / "));b.appendChild(c);c.appendChild(d);this.listElem.appendChild(b);var e=this;c.onclick=function(){return!1};Event.observe(c,"click",function(){e.popupVenueInfoWindow(a);currentSectionWrapper="mapVenueListWrapper";currentSectionHeader="mapVenueListHeader"});Event.observe(c,"mouseover",function(){var b=markerList.getMarker(a.id);markerList.showHoverIcon(b,a)});Event.observe(c,"mouseout",function(){var b=markerList.getMarker(a.id);markerList.hideHoverIcon(b,a)})},popupInfoWindow:function(a){var b=
markerList.getMarker(a.id);b&&markerList.showPopup(b,a)},popupVenueInfoWindow:function(a){var b=markerList.getMarker(a.id);b&&markerList.showVenuePopup(b,a)},updateHotelLinks:function(a){a=a.starRating;this.removeAllHotelLinks();for(var b=0,c=hotels.length;b<c;b++)this.withinMapView(hotels[b])&&hotels[b].checkStarRating(a)&&this.createHotelLink(hotels[b]);this.getNumHotelLinks()},getNumHotelLinks:function(){return this.listElem.childNodes.length},removeAllHotelLinks:function(){removeChildrenFromNode(this.listElem)},
updateVenueLinks:function(){this.removeAllHotelLinks();for(var a=0,b=venues.length;a<b;a++)this.withinMapView(venues[a])&&this.createVenueLink(venues[a]);this.getNumHotelLinks()},hideList:function(){},withinMapView:function(a){return a.longitude<map.northEast.lng()&&a.longitude>map.southWest.lng()&&a.latitude<map.northEast.lat()&&a.latitude>map.southWest.lat()?!0:!1},showAlert:function(a){if(!this.alert)this.alert=!0,this.alertNode=document.createElement("p"),this.alertNode.setAttribute("class","alert"),
this.alertNode.appendChild(document.createTextNode(a)),this.listElem.parentNode.insertBefore(this.alertNode,this.listElem)},removeAlert:function(){if(this.alert)this.alert=!1,this.listElem.parentNode.removeChild(this.alertNode),this.alertNode=null}};var LocationLabel=Class.create();
LocationLabel.prototype={CLASSDEF:{name:"LocationLabel",parent:GOverlay},icon:null,label:null,initialize:function(a,b,c,d,e){var f=this;this.icon=document.createElement("div");this.icon.setAttribute("id",a);Element.addClassName(this.icon,e);Element.addClassName(this.icon,"pointerCursor");this.icon.style.position="absolute";this.icon.style.zIndex=20;this.label=document.createElement("div");this.label.setAttribute("id",a+"Label");Element.addClassName(this.label,e+"Label");this.label.style.position=
"absolute";this.label.style.zIndex=10;a=document.createElement("a");a.appendChild(document.createTextNode(c));a.setAttribute("title","Hotels in "+c);a.setAttribute("href",d);this.label.appendChild(a);map.getPane(G_MAP_MAP_PANE).appendChild(this.label);map.getPane(G_MAP_MAP_PANE).appendChild(this.icon);if(this.label.offsetWidth>150)this.label.hide(),this.label.show(),this.label.style.whiteSpace="normal";this.label.w=this.label.offsetWidth;this.label.hide();this.map=map;this.point=b;this.setPos(b,e);
Event.observe(this.icon,"mouseover",function(){f.icon.style.zIndex=200;f.label.style.zIndex=100;Effect.Appear(f.label,{duration:0.2,from:0,to:0.9})});Event.observe(this.icon,"mouseout",function(){f.icon.style.zIndex=20;f.label.style.zIndex=10;Effect.Fade(f.label,{duration:0.2})});d.length>0&&Event.observe(this.icon,"click",function(){document.location.href=d.replace(/&amp;/g,"&")});return this},setPos:function(a,b){var c=this.map.fromLatLngToDivPixel(a);this.x=parseInt(c.x);this.y=parseInt(c.y);this.icon.style.left=
this.x-10+"px";this.icon.style.top=this.y-10+"px";c=new GPoint;c.x=this.x+this.label.w+10;c.y=this.y;c=this.map.fromDivPixelToLatLng(c);this.map.getBounds().contains(c)?(this.label.style.left=this.x-10+"px",this.label.style.top=this.y-10+"px"):(this.label.style.left=this.x-this.label.w+10+"px",this.label.style.top=this.y-10+"px",Element.addClassName(this.label,b+"LabelLeft"))},updatePos:function(){this.setPos(this.point)},checkMapBounds:function(a){var b=new GPoint;b.x=this.x-10;b.y=this.y-10;var c=
new GPoint;c.x=this.x+this.icon.offsetWidth+10;c.y=this.y-this.icon.offsetHeight+10;b=this.map.fromDivPixelToLatLng(b);c=this.map.fromDivPixelToLatLng(c);if(!a.contains(b)||!a.contains(c))a.extend(b),a.extend(c);return a},setOpacity:function(a){a<0?a=0:a>100&&(a=100);var b=a/100;if(typeof this.label.style.filter=="string")this.label.style.filter="alpha(opacity:"+a+")";if(typeof this.label.style.KHTMLOpacity=="string")this.label.style.KHTMLOpacity=b;if(typeof this.label.style.MozOpacity=="string")this.label.style.MozOpacity=
b;if(typeof this.label.style.opacity=="string")this.label.style.opacity=b}};var LocationRegion=Class.create();
LocationRegion.prototype={CLASSDEF:{name:"LocationRegion",parent:GOverlay},initialize:function(a,b,c,d,e){this.map=map;this.locationLabel=new LocationLabel(a,b,c,d,e);return this},drawRegion:function(a,b){var c=[],d;d=a.split("|");if(!(d.length<=2))return d.each(function(a){a=a.split(",");c.push(new GLatLng(a[0],a[1]))}),d=d[0].split(","),c.push(new GLatLng(d[0],d[1])),d=new GPolygon(c,"#fff",2,0.25,"#fff",b),this.map.addOverlay(d),d}};Event.observe(window,"unload",GUnload);
function ArrayContains(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return!0;return!1}
function DisplayVenuesInCategories(a){var b=a.length;venues=venues.clear();for(var c=0;c<b;c++)venues[venues.length]=new Venue(a[c].Id,a[c].CategoryId,a[c].Name,a[c].Description,a[c].ShortDescription,a[c].Address,a[c].Telephone,a[c].Position.Longitude,a[c].Position.Latitude,a[c].Website,a[c].VenueCategoryName,a[c].TicketsAvailable,a[c].ThumbnailImage,"venue"),markerList.addVenueMarker({venue:venues[c],options:this.mapOptions}),markerList.hideMarkers()};
