function getMarkerUrlFromQueryString(n,t){"use strict";return"/Browse/Map.aspx?"+n+"="+t+"&"+$("input[id*=SearchData]").val()}function unhighlightMarker(n){"use strict";for(var t=0;t<markers.length;t=t+1)if(markers[t].id===n){markers[t].setAnimation(null);markers[t].setIcon(markers[t].getIcon().replace("_highlight",""));return}}function highlightMarker(n){"use strict";for(var t=0;t<markers.length;t=t+1)if(markers[t].id===n){markers[t].setAnimation(google.maps.Animation.BOUNCE);markers[t].getIcon().indexOf("_highlight")===-1&&markers[t].setIcon(markers[t].getIcon().replace(".png","_highlight.png"));return}}function reloadHouseCardsFromLatLng(n){"use strict";var t="/AJAX/GetHousesInMapBounds.aspx?"+n;galleryXhr.abort();galleryXhr=$.ajax({type:"GET",url:t}).done(function(n){$(".listingsContainer").html(n);$(".LoadingScreen").stop().fadeOut();$(".js-RightPane-feature-contentSlider").contentSlider({optionscardType:"Gallery",slideSidePadding:0});$(".royalSlider").each(function(){hhLib.PhotoScroller.sliderInit($(this))});hhLib.AdvancedSearch.Attach()})}function closeInfoWindow(){"use strict";infoWindow&&infoWindow.hide()}function closeMapCard(){"use strict";var n=parseInt(rightPane.attr("dataID"),10);$(".MapCard").animate({right:"-"+($(".MapCard:first").width()+20)+"px"}).removeClass("is-active");unhighlightMarker(n);rightPane.attr("dataID","");setTimeout(function(){var n=parseInt($("html").css("top"),10);$("html").removeClass("noscroll");$("html,body").scrollTop(-n);$(".MapCard:not(.is-active)").remove()},500)}function loadMapCard(n){"use strict";var r=parseInt(rightPane.attr("dataID"),10),t="/AJAX/GetHouseMapCard.aspx?houseID="+n;$(".MapCard:not(:last-child)").remove();n!==r&&unhighlightMarker(r);highlightMarker(n);var i=new URL(document.location).searchParams,u=i.get("minguests"),f=i.get("availablefrom"),e=i.get("availableto");u&&(t+="&minguests="+u);f&&(t+="&availablefrom="+f);e&&(t+="&availableto="+e);isShortlist&&(t+="&showCheckbox=true");jQuery.get(t,function(t){$(".js-MapPage").append(t);rightPane.attr("dataID",n);var i=$(".js-MapCard").height()+parseInt($(".js-MapCard").css("padding-top"),10)-$(".js-MapCard-description").position().top-$(".js-MapCard-actions").height()-30;isShortlist&&$("input[id='mapCardSelect"+n+"']").prop("checked",$("input[id='houseCardSelect"+n+"']").prop("checked"));rightPane.is(":visible")?($(".js-MapCard-description").css("height",i),($("html").scrollTop()||$("body").scrollTop()>0)&&(returnScrollHeight=$("html").scrollTop()||$("body").scrollTop(),$("html").css("top",-returnScrollHeight)),$("html").addClass("noscroll")):$(".js-MapCard-description").css("height",i-10);$(".royalSlider").each(function(){hhLib.PhotoScroller.sliderInit($(this))});$(".MapCard").css({top:returnScrollHeight});$(".MapCard:last").animate({right:"0"}).addClass("is-active");$(".MapCard:first:not(:last-child)").animate({right:"-"+($(".MapCard:first").width()+20)+"px"}).css("overflow","hidden").removeClass("is-active")})}function markerClick(n,t){"use strict";n.setZIndex(google.maps.Marker.MAX_ZINDEX);switch(t){case"House":case"House_Outside":if(parseInt(rightPane.attr("dataID"),10)===n.id)return;dataLayer.push({event:"Map Marker Click",eventLabel:n.title});loadMapCard(n.id);break;case"Location":case"Location_Outside":window.location=getMarkerUrlFromQueryString("location",n.id);break;case"Region":window.location=getMarkerUrlFromQueryString("region",n.id)}}function positionInfoWindowOnMarker(n){"use strict";var e=overlay.getProjection(),t=e.fromLatLngToContainerPixel(n.getPosition()),u=viewType==="House"||viewType==="None"?355:180,f=viewType==="House"||viewType==="None"?100:50,i=t.x-u/2-5,r=t.y-f-65,o=document.getElementById("map-container").offsetWidth;infoWindow.attr("class","InfoWindow appear-top");i<0?(i=t.x+30,r=t.y-f/2-45,infoWindow.attr("class","InfoWindow appear-right")):i+u>o?(i=t.x-u-40,r=t.y-f/2-40,infoWindow.attr("class","InfoWindow appear-left")):r<50&&(r=t.y+5,infoWindow.attr("class","InfoWindow appear-bottom"));infoWindow.css("left",i);infoWindow.css("top",r);infoWindow.show()}function markerHover(n,t,i,r){"use strict";n.getIcon().indexOf("_highlight")===-1&&n.setIcon(n.getIcon().replace(".png","_highlight.png"));switch(t){case"House":var u="/AJAX/ajax_mapHouseInfoWindow.aspx?houseID="+n.id+"&shortlist="+isShortlist;jQuery.get(u,function(t){infoWindow.html(t);infoWindow.children().click(function(){parseInt(rightPane.attr("dataID"),10)!==n.id&&loadMapCard(n.id)});infoWindow.hover(function(){$(this).toggleClass("is-hover")});positionInfoWindowOnMarker(n)});break;case"Location":case"Region":infoWindow.html("<div class='LocationMapInfoWindow'><div class='location-name'>"+i+"<\/div>"+r+" houses matching search criteria<\/div>");positionInfoWindowOnMarker(n)}}function getMarkerOptions(n,t,i,r,u,f,e,o){"use strict";var s="/Images/Maps/"+n.toLowerCase()+(e||!o?"":"_noMatch")+".png",h=new google.maps.Point(11,19);return new google.maps.Marker({icon:s,clickable:i,map:f,position:t,anchorPoint:h,id:r,zIndex:e?2:1,title:o?null:htmlDecode(u)})}function htmlDecode(n){var t=document.createElement("div");return t.innerHTML=n,t.firstChild.nodeValue}function createMarker(n,t,i,r,u,f){"use strict";var e=getMarkerOptions(u,n,!0,t,i,map,r>0,f);markers[markers.length]=e;f&&(google.maps.event.addListener(e,"click",function(){markerClick(e,u)}),Modernizr.touch||(google.maps.event.addListener(e,"mouseover",function(){markerHover(e,u,i,r)}),google.maps.event.addListener(e,"mouseout",function(){parseInt(rightPane.attr("dataid"),10)!==t&&unhighlightMarker(t);closeInfoWindow()})))}function reloadMarkersFromLatLng(){"use strict";closeMapCard();closeInfoWindow();$(".LoadingScreen").stop().fadeIn();viewType=map.getZoom()!==defaultZoomLevel?map.getZoom()>=11?"House":map.getZoom()>=8?"Location":"Region":initialViewType;var i="/AJAX/GetMarkersInMapBounds.aspx?zoom="+map.getZoom()+"&markerType="+viewType,r="&neLat="+map.getBounds().getNorthEast().lat()+"&neLng="+map.getBounds().getNorthEast().lng()+"&swLat="+map.getBounds().getSouthWest().lat()+"&swLng="+map.getBounds().getSouthWest().lng()+"&"+$("input[id*=SearchData]").val(),n,t;i=i+r;markerXhr.abort();markerXhr=$.ajax({type:"GET",url:i,contentType:"application/json; charset=utf-8",dataType:"json"}).done(function(i){for(rightPane.is(":visible")&&reloadHouseCardsFromLatLng(r);markers.length;)markers.pop().setMap(null);for(n=0;n<i.length;n=n+1){t=new google.maps.LatLng(i[n].Latitude,i[n].Longitude);switch(i[n].Type){case 1:createMarker(t,i[n].ID,i[n].Title,i[n].Count,"House",!0);break;case 2:createMarker(t,i[n].ID,i[n].Title,i[n].Count,"Location",!0);break;case 3:createMarker(t,i[n].ID,i[n].Title,i[n].Count,"Region",!0)}}})}function drawMap(n,t,i,r,u,f,e,o,s,h,c){"use strict";var p;if(google.maps.visualRefresh=!0,defaultZoomLevel=t,viewType=initialViewType=c!==undefined?c:"House",infoWindow=$("#InfoWindow"),rightPane=$(".js-RightPane"),p=s?"greedy":"cooperative",map=new google.maps.Map(document.getElementById("map"),{center:n,zoom:t,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:o,zoomControl:r,zoomControlOptions:{style:i==="SMALL"?google.maps.ZoomControlStyle.SMALL:google.maps.ZoomControlStyle.LARGE},panControl:f,streetViewControl:e,gestureHandling:p,minZoom:5,styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]}]}),google.maps.event.addListenerOnce(map,"bounds_changed",function(){markerXhr.abort();galleryXhr.abort()}),google.maps.event.addListener(map,"zoom_changed",function(){dataLayer.push({event:"Map Zoom",eventLabel:$("input[id*=SearchLocationName]").val()})}),google.maps.event.addListener(map,"center_changed",function(){dataLayer.push({event:"Map Pan",eventLabel:$("input[id*=SearchLocationName]").val()})}),u){var y=document.createElement("div"),l=document.createElement("div"),a=document.createElement("div"),v=document.createElement("div");y.className="zoomControls";l.style.color="#FFFFFF";l.style.cursor="pointer";l.style.textAlign="center";l.style.opacity="0.8";y.appendChild(l);a.className="zoomIn";a.innerHTML="+";l.appendChild(a);v.className="zoomOut";v.innerHTML="&minus;";l.appendChild(v);google.maps.event.addDomListener(a,"click",function(){map.setZoom(map.getZoom()+1)});google.maps.event.addDomListener(v,"click",function(){map.setZoom(map.getZoom()-1)});map.controls[google.maps.ControlPosition.TOP_LEFT].push(y)}bounds=new google.maps.LatLngBounds;mapWidth=map.getDiv().offsetWidth;mapHeight=map.getDiv().offsetHeight;isShortlist=h;overlay=new google.maps.OverlayView;overlay.draw=function(){return};overlay.setMap(map)}function extendBounds(n){"use strict";var t=bounds.getSouthWest(),i=bounds.getNorthEast(),r=google.maps.event.addListener(map,"idle",function(){var u=overlay.getProjection().fromLatLngToContainerPixel(t),e=u.x,o=u.y,s=new google.maps.Point(e,o),h=overlay.getProjection().fromDivPixelToLatLng(s),f=overlay.getProjection().fromLatLngToContainerPixel(i),c=f.x,l=f.y,a=new google.maps.Point(c,l),v=overlay.getProjection().fromDivPixelToLatLng(a);bounds.extend(h);bounds.extend(v);map.fitBounds(bounds);defaultZoomLevel=map.getZoom();google.maps.event.removeListener(r);n&&google.maps.event.addListener(map,"idle",function(){reloadMarkersFromLatLng()})})}var map,overlay,infoWindow,modalMap,mapWidth,mapHeight,bounds=null,isShortlist=!1,defaultZoomLevel,markers=[],viewType,initialViewType,returnScrollHeight,markerXhr=new XMLHttpRequest,galleryXhr=new XMLHttpRequest,rightPane;$(document).ready(function(){"use strict";$(".RightPane").hammer().on({tap:function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;$(this).closest(".js-contentSlider-slide").hasClass("is-active")&&($(n.target).is(".rsArrowIcn, .rsArrow, .js-listCard-add, .Button--book")||loadMapCard(parseInt($(this).attr("dataid"),10)))}},".RightPane-feature .js-GalleryCardContainer");$(".RightPane").hammer().on({tap:function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;$(n.target).is(".rsArrowIcn, .rsArrow, .js-listCard-add, .Button--book")||loadMapCard(parseInt($(this).attr("dataid"),10))}},".js-SearchPage-Gallery .js-GalleryCardContainer");$(".RightPane").on({click:function(n){if($(n.target).is(".Button"))return!0;n.preventDefault?n.preventDefault():n.returnValue=!1},mouseenter:function(){highlightMarker(parseInt($(this).attr("dataid"),10))},mouseleave:function(){var n=parseInt($(this).attr("dataid"),10);parseInt(rightPane.attr("dataID"),10)!==n&&unhighlightMarker(n)}},".js-GalleryCardContainer")})