function isArray(n){return typeof n=="object"&&n&&typeof n.length=="number"&&!n.propertyIsEnumerable("length")&&typeof n.splice=="function"}function indexOf(n,t){if(n)for(var i=0;i<n.length;++i)if(t(n[i]))return i;return-1}function singleOrDefault(n,t){if(n)for(var i=0;i<n.length;++i)if(t(n[i]))return n[i];return null}function copyProperties(n,t){for(var i in t)n[i]=t[i]}function mergeProperties(){for(var t={},n=0;n<arguments.length;++n)arguments[n]&&copyProperties(t,arguments[n]);return t}function EncodedPath(n){copyProperties(this,n);this.className="EncodedPath";this.numLevels||(this.numLevels=18);this.zoomFactor||(this.zoomFactor=2)}function LinearRing(n){this.className="LinearRing";this.points=n}function Geometry(n){copyProperties(this,n);this.className="Geometry"}function LineString(n){this.className="LineString";this.points=n}function Polygon(n){Geometry.call(this,n);this.className="Polygon"}function MultiPolygon(n){this.className="MultiPolygon";typeof n=="object"&&(this.polygons=n.polygons)}function Icon(n){copyProperties(this,n);this.className="Icon"}function Marker(n){copyProperties(this,n);this.className="Marker"}function MapGeometriesLoadOnDemand(n){Geometry.call(this,n);this.className="MapGeometriesLoadOnDemand";this.loaded=!1}function MapPlace(n){n&&(copyProperties(this,n),this.className="MapPlace")}function MapPlacesLoadOnDemand(n){MapPlace.call(this,n);this.className="MapPlacesLoadOnDemand";this.loaded=!1}function MapLayer(n){n&&(copyProperties(this,n),this.className="MapLayer")}function MapPlaceCG(n){MapPlace.call(this,n);this.className="MapPlaceCG"}function MapLayerCG(n){MapLayer.call(this,n);this.className="MapLayerCG"}function MapPlaceUS(n){MapPlace.call(this,n);this.className="MapPlaceUS"}function MapPlaceUS1(n){MapPlace.call(this,n);this.className="MapPlaceUS"}function MapLayerUS(n){MapLayer.call(this,n);this.className="MapLayerUS"}function MapPlacePL(n){MapPlace.call(this,n);this.className="MapPlacePL"}function MapPlacePL1(n){MapPlace.call(this,n);this.className="MapPlacePL"}function MapLayerPL(n){MapLayer.call(this,n);this.className="MapLayerPL"}function MapPlaceAX(n){MapPlace.call(this,n);this.className="MapPlaceAX"}function MapLayerAX(n){MapLayer.call(this,n);this.className="MapLayerAX"}function MapPlaceAC(n){MapPlace.call(this,n);this.className="MapPlaceAC"}function MapPlaceAC1(n){MapPlace.call(this,n);this.className="MapPlaceAC1"}function MapLayerAC(n){MapLayer.call(this,n);this.className="MapLayerAC"}function MapPlaceNX(n){MapPlace.call(this,n);this.className="MapPlaceNX"}function MapLayerNX(n){MapLayer.call(this,n);this.className="MapLayerNX"}function MapPlaceAD(n){MapPlace.call(this,n);this.className="MapPlaceAD"}function MapLayerAD(n){MapLayer.call(this,n);this.className="MapLayerAD"}function MapPlaceXX(n){MapPlace.call(this,n);this.className="MapPlaceXX"}function MapLayerXX(n){MapLayer.call(this,n);this.className="MapLayerXX"}function MapQueue(){this.tasks=[];this.active=!1}function gmapLoaded(){histopolis.placeMap.manager.gmapLoaded()}function AbsoluteUrl(n,t){return n[0]==="/"?t+n:n}function MapManager(n){copyProperties(this,n);this.className="MapManager";this.waitingForGmap=!0;this.waitingForMapData=!0;this.status={Last:" ",_element:this.mapStatus,log:function(n){$(this._element).text(n);this.Last=n},Loading:function(){},Loaded:function(){this.log(" ")},InStart:function(n){this.log(n)},InEnd:function(n){this.Last===n&&this.log(" ")}};this.status.Loading("map");histopolis.placeMap.manager=this;histopolis.loadScript("//maps.googleapis.com/maps/api/js?v=3&key=AIzaSyAVYuj0iYMJ1AufV1xbERN1WpojKcOf384&callback=gmapLoaded&libraries=geometry");this.loadMapData(this.mapDataUrl,this.mapSiteUrl)}function HistopolisMap(n){copyProperties(this,n)}function PlaceManager(n){histopolis.placeMap.manager.mapDataLoaded(n)}String.prototype.startsWith||(String.prototype.startsWith=function(n,t){return t=t||0,this.indexOf(n,t)===t});EncodedPath.prototype.getGPolygon=function(n){var t=google.maps.geometry.encoding.decodePath(this.points),i={strokeColor:n.strokeColor,strokeWeight:n.strokeWeight,strokeOpacity:n.strokeOpacity,fillColor:n.fillColor,fillOpacity:n.fillOpacity,paths:t};return new google.maps.Polygon(i)};EncodedPath.prototype.getGPolyline=function(n){var t=google.maps.geometry.encoding.decodePath(this.points),i={strokeColor:n.strokeColor,strokeWeight:n.strokeWeight,strokeOpacity:n.strokeOpacity,path:t};return new google.maps.Polyline(i)};LinearRing.prototype.getGPolygon=function(n){for(var u,f,i=this.points,r=new Array(i.length/2),t=0;t<i.length;t+=2)r[t/2]=new google.maps.LatLng(i[t],i[t+1]);return u={strokeColor:n.strokeColor,strokeWeight:n.strokeWeight,strokeOpacity:n.strokeOpacity,fillColor:n.fillColor,fillOpacity:n.fillOpacity,paths:r},f=new google.maps.Polygon(u),f};LinearRing.prototype.getGPolyline=function(){for(var r,u,t=this.points,i=new Array(t.length/2),n=0;n<t.length;n+=2)i[n/2]=new google.maps.LatLng(t[n],t[n+1]);return r={paths:i},u=new google.maps.Polyline(r),u};Geometry.prototype.load=function(){return!0};Geometry.prototype.init=function(){return this.overlays||(this.overlays=[]),!0};Geometry.prototype.show=function(){for(var n=0;n<this.overlays.length;++n)this.overlays[n].setVisible(!0)};Geometry.prototype.hide=function(){for(var n=0;n<this.overlays.length;++n)this.overlays[n].setVisible(!1)};Geometry.prototype.setOptions=function(){};Geometry.prototype.addListener=function(n,t){for(var i=0;i<this.overlays.length;++i)google.maps.event.addListener(this.overlays[i],n,t)};Geometry.prototype.enableMouseover=function(n,t){this.addListener("mouseover",n);this.addListener("mouseout",t)};LineString.prototype=new Geometry;LineString.prototype.constructor=LineString;LineString.prototype.init=function(n,t){var r,u,i,e,f;for(Geometry.prototype.init.call(this,n,t),r=this.points,u=new Array(r.length/2),i=0;i<r.length;i+=2)u[i/2]=new google.maps.LatLng(r[i],r[i+1]);return e={paths:u,strokeColor:t.strokeColor,strokeOpacity:t.strokeOpacity,strokeWeight:t.strokeWeight},f=new google.maps.Polygon(e),this.overlays.push(f),f.setMap(n),!0};LineString.prototype.setOptions=function(n){if(this.overlays.length>0){var t=this.overlays[0];t.setOptions({strokeColor:n.strokeColor,strokeWeight:n.strokeWeight,strokeOpacity:n.strokeOpacity})}};LineString.prototype.addListener=function(n,t){this.overlays.length>0&&google.maps.event.addListener(this.overlays[0],n,t)};Polygon.prototype=new Geometry;Polygon.prototype.constructor=Polygon;Polygon.prototype.init=function(n,t){var r,f,i,u;if(Geometry.prototype.init.call(this,n,t),r=this.shell.getGPolygon(t),this.overlays.push(r),n.addOverlay(r),this.holes&&this.holes.length>0)for(f={strokeColor:t.strokeColor,strokeWeight:t.strokeWeight,strokeOpacity:t.strokeOpacity,opts:t.opts},i=0;i<this.holes.length;++i)u=this.holes[i].getGPolyline(f),this.overlays.push(u),n.addOverlay(u);return!0};Polygon.prototype.setOptions=function(n){if(this.overlays.length>0){var t=this.overlays[0];t.setOptions(n)}};Polygon.prototype.addListener=function(n,t){this.overlays.length>0&&google.maps.event.addListener(this.overlays[0],n,t)};MultiPolygon.prototype.load=function(){return!0};MultiPolygon.prototype.init=function(n,t){for(var i=0;i<this.polygons.length;++i)this.polygons[i].init(n,t);return!0};MultiPolygon.prototype.show=function(){for(var n=0;n<this.polygons.length;++n)this.polygons[n].show()};MultiPolygon.prototype.hide=function(){for(var n=0;n<this.polygons.length;++n)this.polygons[n].hide()};MultiPolygon.prototype.setOptions=function(n){for(var t=0;t<this.polygons.length;++t)this.polygons[t].setOptions(n)};MultiPolygon.prototype.enableMouseover=function(n,t){for(var i=0;i<this.polygons.length;++i)this.polygons[i].enableMouseover(n,t)};Icon.prototype=new Icon;Icon.prototype.constructor=Icon;Icon.prototype.getGIcon=function(){return{anchorPoint:new google.maps.Point(this.anchor[0],this.anchor[1]),icon:{size:new google.maps.Size(this.size[0],this.size[1]),url:this.image},shadow:{size:new google.maps.Size(this.shadowSize[0],this.shadowSize[1]),url:this.shadow}}};Marker.prototype=new Geometry;Marker.prototype.constructor=Marker;Marker.prototype.init=function(n,t){Geometry.prototype.init.call(this,n,t);var r=this.icon?mergeProperties(t,this.icon.getGIcon()):t,u=mergeProperties(r,{position:new google.maps.LatLng(this.y,this.x)}),i=new google.maps.Marker(u);return this.overlays.push(i),n.addOverlay(i),!0};Marker.prototype.addListener=function(n,t){google.maps.event.addListener(this.overlays[0],n,t)};MapGeometriesLoadOnDemand.prototype=new MapPlace;MapGeometriesLoadOnDemand.prototype.constructor=MapGeometriesLoadOnDemand;MapGeometriesLoadOnDemand.prototype.load=function(n){return this.loaded||this.loading||(this.loading=!0,n.loadGeometriesOnDemand(this.id,"G ",this.url)),this.loaded};MapGeometriesLoadOnDemand.prototype.init=function(){};MapGeometriesLoadOnDemand.prototype.show=function(){};MapGeometriesLoadOnDemand.prototype.hide=function(){};MapGeometriesLoadOnDemand.prototype.setOptions=function(){};MapGeometriesLoadOnDemand.prototype.addListener=function(){};MapGeometriesLoadOnDemand.prototype.enableMouseover=function(){};MapPlace.prototype.getNormalOptions=function(n){return n};MapPlace.prototype.getMouseoverOptions=function(n){return n};MapPlace.prototype.load=function(n,t){for(var u,r=!0,i=0;i<this.geometries.length;++i)u=this.geometries[i],u.load(n,t)||(r=!1);return r};MapPlace.prototype.init=function(n,t){for(var r=this.getNormalOptions(t),i=0;i<this.geometries.length;++i)this.initGeometry(n,r,this.geometries[i]);return!0};MapPlace.prototype.initGeometry=function(n,t,i){return i.init(n,t)};MapPlace.prototype.show=function(){for(var n=0;n<this.geometries.length;++n)this.geometries[n].show()};MapPlace.prototype.hide=function(){for(var n=0;n<this.geometries.length;++n)this.geometries[n].hide()};MapPlace.prototype.enableMouseover=function(n,t,i,r){for(var u=this,e=this.getNormalOptions(n),o=this.getMouseoverOptions(t),f=0;f<this.geometries.length;++f)this.geometries[f].enableMouseover(function(){u.setOptions(o);i(u)},function(){u.setOptions(e);r(u)})};MapPlace.prototype.setOptions=function(n){for(var t=0;t<this.geometries.length;++t)this.geometries[t].setOptions(n)};MapPlace.prototype.openInfoWindowHtml=function(n,t,i){var r=new google.maps.InfoWindow({content:n}),u=i.overlays[0];r.open(t,u)};MapPlacesLoadOnDemand.prototype=new MapPlace;MapPlacesLoadOnDemand.prototype.constructor=MapPlacesLoadOnDemand;MapPlacesLoadOnDemand.prototype.load=function(n,t){return this.loaded||this.loading||(this.loading=!0,n.loadPlacesOnDemand(t,this.id,this.type,this.name,this.url)),this.loaded};MapPlacesLoadOnDemand.prototype.init=function(){};MapPlacesLoadOnDemand.prototype.show=function(){};MapPlacesLoadOnDemand.prototype.hide=function(){};MapPlacesLoadOnDemand.prototype.enableMouseover=function(){};MapPlacesLoadOnDemand.prototype.setOptions=function(){};MapLayer.prototype.normalOverrides=null;MapLayer.prototype.mouseoverOverrides=null;MapLayer.prototype.normalOverridesPerType={};MapLayer.prototype.mouseoverOverridesPerType={};MapLayer.prototype.initOptions=function(n,t){typeof this.normalOverrides=="function"&&(this.normalOverrides=this.normalOverrides());this.normalOptions=mergeProperties(n,this.normalOverrides,this.normalOverridesPerType[this.type]);this.mouseoverOptions=mergeProperties(this.normalOptions,t,this.mouseoverOverrides,this.mouseoverOverridesPerType[this.type])};MapLayer.prototype.init=function(n,t,i,r){var o,f;if(this.initOptions(i,r),this.name){var s=document.createElement("li"),e=document.createElement("a"),u=document.createElement("input");u.type="checkbox";u.name=u.id="cb"+this.type;o=this;f=document.createElement("label");f.htmlFor=u.id;f.innerText?f.innerText=this.name:f.textContent=this.name;e.appendChild(u);e.appendChild(f);s.appendChild(e);t.appendChild(s);this.status=n.status;u.onclick=function(){this.checked?o.show(n):o.hide()};this.visible&&(u.checked=!0)}this.initRequired=!0};MapLayer.prototype.initPlace=function(n,t){t.init(n,this.normalOptions,this.status);var i=this;t.enableMouseover(this.normalOptions,this.mouseoverOptions,function(n){i.status.InStart(n.name)},function(n){i.status.InEnd(n.name)})};MapLayer.prototype.show=function(n){var t,r,i;if(this.visible=!0,this.initRequired){for(t=0;t<this.places.length;++t)r=this.places[t],r.load(n,this.status)&&this.initPlace(n,r);this.initRequired=!1}else for(i=0;i<this.places.length;++i)this.places[i].show()};MapLayer.prototype.hide=function(){this.visible=!1;for(var n=0;n<this.places.length;++n)this.places[n].hide()};MapPlaceCG.prototype=new MapPlace;MapPlaceCG.prototype.constructor=MapPlaceCG;MapPlaceCG.prototype.initGeometry=function(n,t,i){MapPlace.prototype.initGeometry.call(this,n,mergeProperties(t,{title:this.name}),i);var r=this;i.addListener("click",function(){_place.openInfoWindowHtml(r.tooltip,n,i)});i.addListener("dblclick",function(){location=histopolis.config.appPath+"Grave/"+r.id})};MapLayerCG.prototype=new MapLayer;MapLayerCG.prototype.constructor=MapLayerCG;MapLayerCG.prototype.normalOverrides=function(){return{anchorPoint:new google.maps.Point(5,5),icon:"http://static.histopolis.com/image/dotw8.1.5.20.png"}};MapPlaceUS.prototype=new MapPlace;MapPlaceUS.prototype.constructor=MapPlaceUS;MapPlaceUS1.prototype=new MapPlace;MapPlaceUS1.prototype.constructor=MapPlaceUS1;MapPlaceUS1.prototype.getNormalOptions=function(n){return mergeProperties(n,{strokeOpacity:0,fillColor:"#FFFFFF",fillOpacity:.4,icon:"https://maps.google.com/mapfiles/kml/shapes/info_circle.png"})};MapPlaceUS1.prototype.getMouseoverOptions=function(n){return mergeProperties(n,{strokeOpacity:.2,fillColor:"#FFFFFF",fillOpacity:.5,icon:"https://maps.google.com/mapfiles/kml/shapes/info_circle.png"})};MapLayerUS.prototype=new MapLayer;MapLayerUS.prototype.constructor=MapLayerUS;MapLayerUS.prototype.normalOverrides={strokeColor:"#FFA500",strokeWeight:2,strokeOpacity:1,fillColor:"#FFA500"};MapLayerUS.prototype.init=function(n,t,i,r){n.isAdmin||this.userID===n.userID?MapLayer.prototype.init.call(this,n,t,i,r):this.show=this.hide=this.initPlace=function(){}};MapPlacePL.prototype=new MapPlace;MapPlacePL.prototype.constructor=MapPlacePL;MapPlacePL1.prototype=new MapPlace;MapPlacePL1.prototype.constructor=MapPlacePL1;MapPlacePL1.prototype.getNormalOptions=function(n){return mergeProperties(n,{strokeOpacity:0,fillColor:"#FFFFFF",fillOpacity:.4,anchorPoint:new google.maps.Point(15,15),icon:{scaledSize:new google.maps.Size(32,32),url:"https://maps.google.com/mapfiles/kml/shapes/info_circle.png"}})};MapPlacePL1.prototype.getMouseoverOptions=function(n){return mergeProperties(n,{strokeOpacity:.2,fillColor:"#FFFFFF",fillOpacity:.5,anchorPoint:new google.maps.Point(15,15),icon:{scaledSize:new google.maps.Size(32,32),url:"https://maps.google.com/mapfiles/kml/shapes/info_circle.png"}})};MapLayerPL.prototype=new MapLayer;MapLayerPL.prototype.constructor=MapLayerPL;MapLayerPL.prototype.normalOverrides={strokeColor:"#FFCD00",strokeWeight:2,strokeOpacity:1,fillColor:"#FFCD00"};MapPlaceAX.prototype=new MapPlace;MapPlaceAX.prototype.constructor=MapPlaceAX;MapLayerAX.prototype=new MapLayer;MapLayerAX.prototype.constructor=MapLayerAX;MapLayerAX.prototype.normalOverrides={strokeOpacity:.5};MapLayerAX.prototype.mouseoverOverrides={strokeWeight:2,strokeOpacity:.8};MapLayerAX.prototype.normalOverridesPerType={A0:{strokeColor:"#FF7F50",fillColor:"#FF7F50",fillOpacity:0},A1:{strokeColor:"#0066FF",fillColor:"#0066FF",fillOpacity:.05},A2:{strokeColor:"#FF66CC",fillColor:"#FF66CC",fillOpacity:.1},A3:{strokeColor:"#0000FF",fillColor:"#0000FF",fillOpacity:.15}};MapLayerAX.prototype.mouseoverOverridesPerType={A1:{fillOpacity:.1},A2:{fillOpacity:.2},A3:{fillOpacity:.3}};MapPlaceAC.prototype=new MapPlace;MapPlaceAC.prototype.constructor=MapPlaceAC;MapPlaceAC.prototype.initGeometry=function(n,t,i){MapPlace.prototype.initGeometry.call(this,n,mergeProperties(t,{title:this.name}),i);var r=this;i.addListener("click",function(){r.openInfoWindowHtml(r.tooltip,n,i)});this.url&&i.addListener("dblclick",function(){location=histopolis.config.appPath+"Place/"+r.url})};MapPlaceAC1.prototype=new MapPlace;MapPlaceAC1.prototype.constructor=MapPlaceAC1;MapPlaceAC1.prototype.getNormalOptions=function(n){return mergeProperties(n,{icon:"https://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png"})};MapPlaceAC1.prototype.initGeometry=MapPlaceAC.prototype.initGeometry;MapLayerAC.prototype=new MapLayer;MapLayerAC.prototype.constructor=MapLayerAC;MapLayerAC.prototype.normalOverrides=function(){return{icon:"https://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png"}};MapPlaceNX.prototype=new MapPlace;MapPlaceNX.prototype.constructor=MapPlaceNX;MapLayerNX.prototype=new MapLayer;MapLayerNX.prototype.constructor=MapLayerNX;MapLayerNX.prototype.normalOverrides={strokeOpacity:.5};MapLayerNX.prototype.mouseoverOverrides={strokeWeight:2,strokeOpacity:.8};MapLayerNX.prototype.normalOverridesPerType={A0:{strokeColor:"#FF7F50",fillColor:"#FF7F50",fillOpacity:0},A1:{strokeColor:"#0066FF",fillColor:"#0066FF",fillOpacity:.05},A2:{strokeColor:"#FF66CC",fillColor:"#FF66CC",fillOpacity:.1},A3:{strokeColor:"#0000FF",fillColor:"#0000FF",fillOpacity:.15},AT:{strokeColor:"#0000FF",fillColor:"#0000FF",fillOpacity:.15},CS:{strokeColor:"#00FF00",fillColor:"#00FF00",fillOpacity:.15}};MapLayerNX.prototype.mouseoverOverridesPerType={A1:{fillOpacity:.1},A2:{fillOpacity:.2},A3:{fillOpacity:.3},AT:{fillOpacity:.3},CS:{fillOpacity:.3}};MapPlaceAD.prototype=new MapPlace;MapPlaceAD.prototype.constructor=MapPlaceAD;MapLayerAD.prototype=new MapLayer;MapLayerAD.prototype.constructor=MapLayerAD;MapLayerAD.prototype.normalOverrides={strokeOpacity:.5};MapLayerAD.prototype.mouseoverOverrides={strokeWeight:2,strokeOpacity:.8};MapLayerAD.prototype.normalOverridesPerType={CS:{strokeColor:"#00FF00",fillColor:"#00FF00",fillOpacity:.15}};MapLayerAD.prototype.mouseoverOverridesPerType={CS:{fillOpacity:.3}};MapPlaceXX.prototype=new MapPlace;MapPlaceXX.prototype.constructor=MapPlaceXX;MapLayerXX.prototype=new MapLayer;MapLayerXX.prototype.constructor=MapLayerXX;MapLayerXX.prototype.normalOverrides={strokeOpacity:.1,fillOpacity:.3,fillColor:"#E2ADBD"};MapLayerXX.prototype.normalOverridesPerType=function(){var n={fillColor:"#F5F19A"},i={fillColor:"#B2C89A"},t={fillColor:"#9ABDE3"};return{"01":n,"02":i,"04":n,"05":i,"06":n,"09":n,"13":t,"14":n,"16":t,"17":t,"18":n,"20":t,"21":i,"23":i,"25":n,"26":t,"28":n,"32":t,"33":n,"45":n,"46":n}}();MapLayerXX.prototype.mouseoverOverrides={strokeWeight:1,strokeOpacity:1,fillOpacity:.6};MapQueue.prototype.isEmpty=function(){return this.tasks.length===0};MapQueue.prototype.isActive=function(){return this.active};MapQueue.prototype.isReady=function(){return!this.isEmpty()&&!this.isActive()};MapQueue.prototype.add=function(n,t){this.tasks.push({task:n,onTimeout:t});this.isReady()&&this.scheduleNext(this)};MapQueue.prototype.scheduleNext=function(){this.active=!0;var n=this;window.setTimeout(function(){n.start()},0)};MapQueue.prototype.clearTimeout=function(){this.timeoutID&&window.clearTimeout(this.timeoutID);this.timeoutID=null};MapQueue.prototype.taskCompleted=function(){this.active=!1;this.isReady()?this.scheduleNext():this.onIdle()};MapQueue.prototype.start=function(){var n=this.tasks.shift();this.timeout&&n.onTimeout&&(this.timeoutID=window.setTimeout(n.onTimeout,this.timeout));n.task()};MapQueue.prototype.onIdle=function(){};MapManager.prototype.mapDataLoaded=function(n){copyProperties(this,n.map);this.waitingForMapData=!1;this.init()};MapManager.prototype.gmapLoaded=function(){google.maps&&(this.waitingForGmap=!1,this.init())};MapManager.prototype.init=function(){var n,t,i,r,u;if(!this.waitingForGmap&&!this.waitingForMapData){for(this.normalOptions={strokeColor:"#000000",strokeWeight:1,strokeOpacity:.3,fillColor:"#000000",fillOpacity:.1,clickable:!0,draggable:!1,opts:{mouseOutTolerance:1}},this.mouseoverOverrides={strokeWeight:2,strokeOpacity:.8,fillOpacity:.4},n=new MapQueue,t=new MapQueue,n.timeout=1e4,t.timeout=1e4,n.isReady=function(){return!n.isEmpty()&&!n.isActive()&&!t.isActive()},t.isReady=function(){return!t.isEmpty()&&!t.isActive()&&!n.isReady()},n.onIdle=function(){t.isReady()&&t.scheduleNext()},t.onIdle=function(){n.isReady()&&n.scheduleNext()},this.geometriesQueue=n,this.placesQueue=t,this.googleMap=this.initGMap(this.mapDiv,this.properties),i=0;i<this.layers.length;++i)this.layers[i].init(this,this.mapLayerLegendDiv,this.normalOptions,this.mouseoverOverrides);for(r=0;r<this.layers.length;++r)u=this.layers[r],u.visible&&u.show(this);this.status.log(" ")}};MapManager.prototype.initGMap=function(n,t){var i=null,r=google.maps.MapTypeId.ROADMAP,f,u,o,e,s;return t.mapType==="hybrid"?r=google.maps.MapTypeId.HYBRID:t.mapType==="satellite"&&(r=google.maps.MapTypeId.SATELLITE),f=new google.maps.LatLng(t.center.y,t.center.x),i=new google.maps.Map(n,{center:f,mapTypeId:r,zoom:t.zoom,scrollwheel:!1,scaleControl:!0}),t.bounds&&(u=t.bounds,o=new google.maps.LatLngBounds(new google.maps.LatLng(u.s,u.w),new google.maps.LatLng(u.n,u.e)),i.fitBounds(o)),(r===google.maps.MapTypeId.HYBRID||r===google.maps.MapTypeId.SATELLITE)&&(e=i.getZoom(),e>=19&&(s=new google.maps.MaxZoomService,s.getMaxZoomAtLatLng(f,function(n){n.status===google.maps.MaxZoomStatus.OK&&n.zoom<e&&i.setZoom(n.zoom)}))),i};MapManager.prototype.addOverlay=function(n){n.setMap(this.googleMap)};MapManager.prototype.loadScript=function(n){var t=document.createElement("SCRIPT");t.type="text/javascript";t.charset="UTF-8";n.startsWith("http://static.histopolis.com/")&&(n=window.location.origin+n.substring(28));t.src=n;document.getElementsByTagName("body")[0].appendChild(t)};MapManager.prototype.loadGeometriesOnDemand=function(n,t,i){var u=singleOrDefault(this.dependencies,function(i){return i.id===n&&i.type===t}),f,r;u&&(i=u.url);i?(i.startsWith("http://static.histopolis.com/")&&(i=window.location.origin+i.substring(28)),histopolis.config.debug&&(f=new Date,i+="?z="+f.getTime()),r=this,this.geometriesQueue.add(function(){r.loadScript(AbsoluteUrl(i,r.mapSiteUrl))},function(){r.status.log(n+" "+t+" load timeout");r.geometriesQueue.taskCompleted()})):this.status.log(n+" "+t+" unknown dependency")};MapManager.prototype.loadPlacesOnDemand=function(n,t,i,r,u){var e=singleOrDefault(this.dependencies,function(n){return n.id===t&&n.type===i}),o,f;e&&(u=e.url);u?(u.startsWith("http://static.histopolis.com/")&&(u=window.location.origin+u.substring(28)),histopolis.config.debug&&(o=new Date,u+="?z="+o.getTime()),f=this,this.placesQueue.add(function(){n.Loading(r);f.loadScript(AbsoluteUrl(u,f.mapSiteUrl))},function(){f.status.log(t+" "+i+" "+r+" load timeout");f.placesQueue.taskCompleted()})):n.log(t+" "+i+" "+r+" unknown dependency")};MapManager.prototype.onGeometriesLoaded=function(n){var r,i,t,f,u;for(this.geometriesQueue.clearTimeout(),r=0;r<this.layers.length;++r)if(i=this.layers[r],t=singleOrDefault(i.places,function(t){return singleOrDefault(t.geometries,function(t){return t instanceof MapGeometriesLoadOnDemand&&t.id===n.id&&t.loading&&!t.loaded})!=null}),t){for(f in n.geometries)t.geometries.push(n.geometries[f]);u=singleOrDefault(t.geometries,function(t){return t instanceof MapGeometriesLoadOnDemand&&t.id===n.id&&t.loading});u&&(u.loaded=!0);!i.initRequired&&t.load(i.status)&&(i.initPlace(this,t),i.visible||t.hide(Map),t.Name&&i.status.Loaded(t.name));break}this.geometriesQueue.taskCompleted()};MapManager.prototype.onPlacesLoaded=function(n){var i,u,r,t,f;if(this.placesQueue.clearTimeout(),i=singleOrDefault(this.layers,function(t){return t.type===n.type}),i){for(n.name&&this.status.Loaded(n.name),u=i.places,r=0;r<n.places.length;++r)t=n.places[r],f=indexOf(u,function(n){return!(n instanceof MapPlacesLoadOnDemand)&&n.id===t.id}),f===-1&&(u.push(t),!i.initRequired&&t.load(this,i.status)&&(i.initPlace(this,t),i.visible||t.hide(Map)));t=singleOrDefault(i.places,function(t){return t instanceof MapPlacesLoadOnDemand&&t.id===n.id&&t.type===n.type});t&&(t.loaded=!0)}this.placesQueue.taskCompleted()};MapManager.prototype.loadMapData=function(n){var t=n.substr(n.indexOf("/place00/"));t.startsWith("http://static.histopolis.com/")&&(t=window.location.origin+t.substring(28));$.get(t,"",function(data){var script=data.replace("map:new Map(","map: new HistopolisMap(");eval(script);window.placeManager=placeManager},"text").fail(function(){alert(t)})};PlaceManager.prototype.onMapPlacesLoaded=function(n){histopolis.placeMap.manager.onPlacesLoaded(n)};PlaceManager.prototype.onMapGeometriesLoaded=function(n){histopolis.placeMap.manager.onGeometriesLoaded(n)}