var _instance=null,NokiaMap=function(){return null===_instance&&(_instance=this,void this.generateMapScript())};NokiaMap.prototype._map_container=null,NokiaMap.prototype._map=null,NokiaMap.prototype._marker_container=null,NokiaMap.prototype._markers=[],NokiaMap.prototype._info_bubbles=null,NokiaMap.prototype._fitToBoundingBox=!0,NokiaMap.prototype._click_type=null,NokiaMap.prototype._bounding_box=null,NokiaMap.prototype.generateMapScript=function(){try{$("head").append($("<style/>").html("#mapContainer img { max-width: none !important; }"))}catch(d){var a=document.createElement("style"),b="#mapContainer img { max-width: none !important; }";a.setAttribute("type","text/css"),a.styleSheet.cssText=b;var c=document.getElementsByTagName("head")[0];c.appendChild(a)}$.getScript("http://js.api.here.com/se/2.5.3/jsl.js?blank=true",function(){nokia.Features.load(nokia.Features.getFeaturesFromMatrix(["maps","directions","positioning"]),_instance.onMapsApiFeaturesLoaded,_instance.onMapsApiFeaturesError,null,!1)})},NokiaMap.prototype.onMapsApiFeaturesLoaded=function(){nokia.Settings.set("app_id","iaDj5UEiye6THyRMclKe"),nokia.Settings.set("app_code","OhX6nZeP3vik_2sGohuQmA"),_instance._info_bubbles=new nokia.maps.map.component.InfoBubbles,_instance._click_type=nokia.maps.dom.Page.browser.touch?"tap":"click",$.getScript("/js/nokia-interactive.js",function(){return NokiaScriptLoaded()})},NokiaMap.prototype.onMapsApiFeaturesError=function(){console.log("Error loading nokia maps")},NokiaMap.prototype.loadMap=function(a,b,c,d,e){"undefined"!=typeof d&&(_instance._fitToBoundingBox=!1),_instance._map_container=document.getElementById(a),_instance._map=new nokia.maps.map.Display(_instance._map_container,{center:[b,c],zoomLevel:"undefined"!=typeof d?d:10,components:[new nokia.maps.map.component.Behavior,new nokia.maps.map.component.ZoomBar,new nokia.maps.map.component.Overview,new nokia.maps.map.component.ScaleBar,new Interactive,_instance._info_bubbles]}),_instance._marker_container=new nokia.maps.map.Container,_instance._map.objects.add(_instance._marker_container),_instance._map.addListener("displayready",_instance.zoomToBoundingBox,!1)},NokiaMap.prototype.loadMapFromBoundingBox=function(a,b,c,d){_instance._map_container=document.getElementById(a),_instance._map=new nokia.maps.map.Display(_instance._map_container,{center:[b,c],components:[new nokia.maps.map.component.Behavior,new nokia.maps.map.component.ZoomBar,new nokia.maps.map.component.Overview,new nokia.maps.map.component.TypeSelector,new nokia.maps.map.component.ScaleBar,new Interactive,_instance._info_bubbles]}),d.topLeft=new nokia.maps.geo.Coordinate(d.topLeft.latitude,d.topLeft.longitude),d.bottomRight=new nokia.maps.geo.Coordinate(d.bottomRight.latitude,d.bottomRight.longitude),_instance._bounding_box=d,_instance._map.addListener("displayready",function(){if(null===_instance._bounding_box)return!1;var a=new nokia.maps.geo.BoundingBox(_instance._bounding_box.topLeft,_instance._bounding_box.bottomRight);_instance._map.zoomTo(a,!1,null)},!1)},NokiaMap.prototype.createMarker=function(a,b,c,d){if("undefined"!=typeof a&&"undefined"!=typeof b){var e=new nokia.maps.map.Marker(new nokia.maps.geo.Coordinate(a,b));if("undefined"!=typeof c&&"string"==typeof c&&(e.html=c,e.addListener(_instance._click_type,function(a){_instance._info_bubbles.openBubble(a.target.html,a.target.coordinate)},!1)),"undefined"!=typeof d&&"undefined"!=typeof d.icon){e.set("icon",d.icon);var f="undefined"!=typeof d.offsetX?d.offsetX:0,g="undefined"!=typeof d.offsetY?d.offsetY:0;e.set("anchor",new nokia.maps.util.Point(f,g))}_instance._markers.push(e)}},NokiaMap.prototype.addDragEvent=function(a){document.getElementById("positionMarker");"undefined"==typeof a&&(a=0),_instance._markers[a].addListener("drag",_instance.mapDragListener,!0),_instance._markers[a].addListener("dragend",_instance.mapDragListener,!1)},NokiaMap.prototype.addClickEvent=function(a){"undefined"==typeof a&&(a=0),"undefined"!=typeof _instance._markers[a]&&_instance._markers[a].addListener(_instance._click_type,_instance.mapClickListener,!0)},NokiaMap.prototype.addMarkers=function(){_instance._marker_container.objects.addAll(_instance._markers)},NokiaMap.prototype.mapDragListener=function(a){var b=a.dataTransfer.getData("application/map-drag-type");if("marker"===b||"standardmarker"===b){var c=a.dataTransfer.getData("application/map-drag-object"),d=a.dataTransfer.getData("application/map-drag-object-offset");_instance._map.pixelToGeo(a.displayX-d.x+c.anchor.x,a.displayY-d.y+c.anchor.y);"dragend"===a.type?"function"==typeof NokiaMapDragEnd&&NokiaMapDragEnd(c.coordinate.latitude,c.coordinate.longitude):"drag"===a.type&&"function"==typeof NokiaMapDrag&&NokiaMapDrag(c.coordinate.latitude,c.coordinate.longitude)}},NokiaMap.prototype.mapClickListener=function(a){if("function"==typeof NokiaMapClicked)return NokiaMapClicked(a)},NokiaMap.prototype.addMapContainerClick=function(){_instance._marker_container.addListener(_instance._click_type,_instance.mapContainerClick,!1)},NokiaMap.prototype.mapContainerClick=function(a){_instance._info_bubbles.openBubble(a.target.html,a.target.coordinate,function(){var b=$(a.target.html).attr("data-id");"undefined"!=typeof b&&($(".js-result-"+b).removeClass("listing-select"),$(".js-result-"+b+" .icon-listing-arrow").removeClass("listing-is-selected listing-is-selected-pulse"))})},NokiaMap.prototype.mapInvokeClick=function(a){return"undefined"!=typeof a&&!isNaN(a)&&(_instance._marker_container.dispatch(new nokia.maps.dom.Event({type:"click",target:_instance._marker_container.objects.get(a)})),_lat=_instance._marker_container.objects.get(a).coordinate.latitude,_lon=_instance._marker_container.objects.get(a).coordinate.longitude,void _instance._map.setCenter(new nokia.maps.geo.Coordinate(_lat,_lon)))},NokiaMap.prototype.redrawMarker=function(a,b,c){if("undefined"==typeof a||"undefined"==typeof b)return!1;"undefined"==typeof c&&(c=0);var d=new nokia.maps.geo.Coordinate(a,b);_instance._markers[c].set("coordinate",d),_instance._map.setCenter(new nokia.maps.geo.Coordinate(a,b))},NokiaMap.prototype.fixMarker=function(a){"undefined"==typeof a&&(a=0),_instance._markers[a].disableDrag()},NokiaMap.prototype.floatMarker=function(a){"undefined"==typeof a&&(a=0),_instance._markers[a].enableDrag()},NokiaMap.prototype.setMapZoomLevel=function(a){_instance._map.set("zoomLevel",a)},NokiaMap.prototype.mapBoundingBox=function(a,b,c){"undefined"==typeof c&&(c=0);var d=new nokia.maps.geo.BoundingBox(a.topLeft,a.bottomRight);_instance._map.zoomTo(d),"undefined"!=typeof b&&b===!0&&_instance.redrawMarker(d.getCenter().latitude,d.getCenter().longitude,c)},NokiaMap.prototype.zoomToBoundingBox=function(){if(_instance._fitToBoundingBox===!1||0===_instance._markers.length)return!1;var a=_instance._marker_container.getBoundingBox();if(null===a)return!1;_instance._map.zoomTo(a,!1,null);var b=_instance._map.zoomLevel;_instance.setMapZoomLevel(b-1)},NokiaMap.prototype.removeScrollZoom=function(){_instance._map.removeComponent(_instance._map.getComponentById("zoom.MouseWheel"))};