$(function(){if($.MapResults.RequiresHandler){$("a[rel=.destinationMapsItem]").one("click",function(){$.MapResults.GetMapData()});$("#map").text("Loading ...")}});$.MapResults={RequiresHandler:true,firingElement:null,_titleList:new Array(),ZoomLevel:15,GetMapData:function(){try{_mapsDataProxy.GetDestinationMapData(getSessionId(),this.GetMapData_Callback,this.OnPageError)}catch(a){LogError("MapsResults.js - GetMapData(): "+a)}},GetMapData_Callback:function(Result){eval(Result)},OnPageError:function(a){LogError("*** OnPageError captured a callback error:\r\n\r\n"+a.message)},processMapData:function(b){if(b){$("#map").jmap("init",{mapType:"hybrid",mapCenter:[b[0].latitude,b[0].longitude],mapEnableDoubleClickZoom:true,mapEnableScrollZoom:true,mapEnableSmoothZoom:true,mapShowjMapsIcon:false});$("#map").jmap("CreateMarkerManager");for(var a=0;a<b.length;a++){$("#map").jmap("AddMarker",{pointLatLng:[b[a].latitude,b[a].longitude],pointHTML:b[a].html,pointIcon:$.MapResults.CreateIcon(b[a].mapIndex,b[a].title)},function(c,d){$.MapResults.MarkerShow(c,d,b[a].hotelCode)})}if(this.firingElement){this.firingElement.click()}else{$.MapResults.RequiresHandler=false}this.firingElement=null;this.WireTitles()}return},WireTitles:function(){setTimeout(function(){$.MapResults.AddTitles()},1000);$("#map").click(function(){$.MapResults.AddTitles()});$("#map").mousewheel(function(){setTimeout(function(){$.MapResults.AddTitles()},1000)})},AddTitles:function(){var a=$("#map").find("img").filter(function(b){return($(this).attr("src").match("/Destinations/Handlers/MapMarkerImageHandler.ashx")!=null)});a.each(function(d){var e=$(this).attr("src");var c=e.indexOf("category=");var g=e.substr(c+9);var f=$.MapResults._titleList[g-1];if(f.Id==g){$(this).attr("title",f.Title);return}for(var b=0;b<$.MapResults._titleList.length;b++){var f=$.MapResults._titleList[b];if(f.Id==g){$(this).attr("title",f.Title);break}}})},MarkerShow:function(b,c,d){var a=$(".mapLink"+d);a.click(function(){$.MapResults.ShowMapTab(null);$("#map").jmap("MoveTo",{mapCenter:c.pointLatLng,mapZoom:$.MapResults.ZoomLevel},function(){setTimeout(function(){b.openInfoWindowHtml(c.pointHTML,{maxContent:c.pointMaxContent,maxTitle:c.pointMaxTitle})},1000)})})},CreateIcon:function(a,d){var b=new GIcon();b.image="/Destinations/Handlers/MapMarkerImageHandler.ashx?type=hotel&category="+a;b.shadow="/images/maps/hotelicon_shadow2_shadow2.png";b.iconSize=new GSize(85,43);b.iconAnchor=new GPoint(22,43);b.infoWindowAnchor=new GPoint(15,10);var c=new Object();c.Id=a;c.Title=d;this._titleList.push(c);return b},ShowMapTab:function(a){$("a[rel=.destinationMapsItem]").click();if(a&&this.RequiresHandler){this.RequiresHandler=false;this.firingElement=$(a)}}};$.fn.MapKey=function(b){var a=this;var b=jQuery.extend({mapContainer:null,hotelListContainer:null,visibilityText:null},b);a.data("mapContainer",b.mapContainer);a.data("hotelListContainer",b.hotelListContainer);a.data("visibilityText",b.visibilityText);a.toggle(function(){var d=a.data("mapContainer");if(d){a.data("mapContainerOriginalWidth",d.width());var c=a.data("hotelListContainer");d.width(d.width()-c.width());c.show()}a.data("visibilityText").text("Hide")},function(){var c=a.data("mapContainer");if(c){c.width(a.data("mapContainerOriginalWidth"));a.data("hotelListContainer").hide()}a.data("visibilityText").text("Show")})};