document.addEventListener("DOMContentLoaded", () => {
let gme = new Object();
gme.zoomTypes = [0,1,2];
gme.defaultMapTypes = ["roadmap", "satellite", "hybrid", "terrain", "{map.styledMapName}"];
gme.mapSettings = {
id: 'gme-' + {map.uid},
title: '{map.title}',
width: '{map.width}',
height: '{map.height}',
zoom: {f:if(condition:"{map.zoom}", then:"{map.zoom}", else:"0")},
minZoom: {f:if(condition:"{map.zoomMin}", then:"{map.zoomMin}", else:"0")},
maxZoom: {f:if(condition:"{map.zoomMax}", then:"{map.zoomMax}", else:"0")},
lat: {f:if(condition:"{map.latitude} != 0", then: "{map.latitude}", else:"0")},
lng: {f:if(condition:"{map.longitude} != 0", then: "{map.longitude}", else:"0")},
geolocation: {f:if(condition:"{map.geolocation} != 0", then: "1", else:"0")},
kmlUrl: '{map.kmlUrl}',
kmlPreserveViewport: {f:if(condition:"{map.kmlPreserveViewport}", then:"true", else:"false")},
kmlLocal: {f:if(condition:"{map.kmlLocal}", then:"1", else:"0")},
scrollZoom: {f:if(condition:"{map.scrollZoom}", then:"1", else:"0")},
draggable: {f:if(condition:"{map.draggable}", then:"1", else:"0")},
doubleClickZoom: {f:if(condition:"{map.doubleClickZoom}", then:"0", else:"1")},
markerCluster: {f:if(condition:"{map.markerCluster}", then:"1", else:"0")},
markerClusterZoom: {f:if(condition:"{map.markerClusterZoom} > 0", then:"{map.markerClusterZoom}", else:"null")},
markerClusterSize: {f:if(condition:"{map.markerClusterSize} > 0", then:"{map.markerClusterSize}", else:"null")},
markerClusterStyle: {map.markerClusterStyle},
markerClusterStyle: '',
markerSearch: {f:if(condition:"{map.markerSearch}", then:"1", else:"0")},
defaultType: {map.defaultType},
scaleControl: {f:if(condition:"{map.scaleControl}", then:"1", else:"0")},
streetviewControl: {f:if(condition:"{map.streetviewControl}", then:"1", else:"0")},
fullscreenControl: {f:if(condition:"{map.fullscreenControl}", then:"1", else:"0")},
zoomControl: {f:if(condition:"{map.zoomControl}", then:"1", else:"0")},
mapTypeControl: {f:if(condition:"{map.mapTypeControl}", then:"1", else:"0")},
showRoute: {f:if(condition:"{map.showRoute}", then:"1", else:"0")},
calcRoute: {f:if(condition:"{map.calcRoute}", then:"1", else:"0")},
travelMode: {map.travelMode},
unitSystem: {map.unitSystem},
showForm: {f:if(condition:"{map.showForm}", then:"1", else:"0")},
showCategories: {f:if(condition:"{map.showCategories}", then:"1", else:"0")},
logicalAnd: {f:if(condition:"{settings.logicalAnd}", then:"1", else:"0")},
styledMapName: '{map.styledMapName}',
styledMapCode: {map.styledMapCode},
styledMapCode: '',
defaultZoom: 11
}
gme.mapSettings.mapTypes = [];
gme.mapSettings.mapTypes[{i.index}] = gme.defaultMapTypes[{type}];
gme.request = [];
gme.request['{k}'] = '{item}';
gme.addresses = [];
gme.addresses[{i.index}] = {
uid: {address.uid},
title: '{address.title}',
latitude: {address.latitude -> f:format.number(decimals:6, thousandsSeparator:'')},
longitude: {address.longitude -> f:format.number(decimals:6, thousandsSeparator:'')},
address: '{address.address}',
marker: '{f:uri.image(src:address.marker.uid,absolute:1,treatIdAsReference:1,width:address.imageWidth,height:'{address.imageHeight}c')}',
imageSize: 1,
marker: '{f:uri.image(src:address.marker.originalResource.publicUrl,absolute:1)}',
imageSize: 0,
marker: '{f:uri.image(src:category.gmeMarker.uid,absolute:1,treatIdAsReference:1,width:category.gmeImageWidth,height:'{category.gmeImageHeight}c')}',
imageSize: 1,
marker: '{f:uri.image(src:category.gmeMarker.originalResource.publicUrl,absolute:1)}',
imageSize: 0,
imageWidth: '{address.imageWidth}',
imageHeight: '{address.imageHeight}',
infoWindowContent: '',
infoWindowLink: '{address.infoWindowLink}',
openByClick: 1,
openByClick: {f:if(condition:"{address.openByClick}", then:"1", else:"0")},
closeByClick: 1,
closeByClick: {f:if(condition:"{address.closeByClick}", then:"1", else:"0")},
opened: {f:if(condition:"{address.opened}", then:"1", else:"0")},
categories: '{category.uid}{f:if(condition:icat.isLast,then:'',else:',')}'
}
gme.ll = {};
gme.ll.alert = "";
gme.ll.submit = "";
gme.ll.noSearchResults = "";
gme.ll.infoWindowLinkText = "";
const element = document.getElementById(gme.mapSettings.id);
element.gomapsext(gme);
if(gme.mapSettings.width.indexOf('%') != -1) {
window.addEventListener('resize', () => {
element.dispatchEvent(new Event('mapresize'));
});
}
}); // end of closure