function loadMapsAPI(){ldelim}if(window.google&&google.maps)return;{rdelim}window.initMap=function(){ldelim}{rdelim}
loadMapsAPI();$(document).ready(function(){ldelim}loadMap{$gmap.id}();{rdelim});var defaultZoom{$gmap.id}={$gmap.gmap_zoom};var map{$gmap.id};var infowindow{$gmap.id};var markerList{$gmap.id}=[];function loadMap{$gmap.id}(){ldelim}console.log('loadMap');var defaultLatlng{$gmap.id}=new google.maps.LatLng({$gmap.latitude},{$gmap.longitude});var myOptions{$gmap.id}={ldelim}zoom:defaultZoom{$gmap.id},center:defaultLatlng{$gmap.id},mapTypeId:google.maps.MapTypeId.ROADMAP{rdelim};map{$gmap.id}=new google.maps.Map(document.getElementById("myMap{$gmap.id}"),myOptions{$gmap.id});infowindow{$gmap.id}=new google.maps.InfoWindow({ldelim}maxWidth:700{rdelim});loadMarkers{$gmap.id}();{rdelim}
function loadMarkers{$gmap.id}(){ldelim}var lmarkers{$gmap.id}={$markers};$.each(lmarkers{$gmap.id},function(i,item){ldelim}loadMarker{$gmap.id}(item);{rdelim});{rdelim}
function loadMarker{$gmap.id}(markerData){ldelim}var myLatlng=new google.maps.LatLng(markerData['latitude'],markerData['longitude']);var image='/modules/gmap/images/'+markerData['image']+'.png';if(markerData['img_title']!='/modules/gmap/img/no_image.png'){ldelim}var a_stimg="";{rdelim}else{ldelim}var a_stimg="";{rdelim};if(markerData['marker_cat_title']!=''){ldelim}if(markerData['marker_cat_link']=='/'||markerData['marker_cat_link']=='javascript:void(0);'){ldelim}var a_categ="
"+markerData['marker_cat_title']+"";{rdelim}else{ldelim}var a_categ=""+markerData['marker_cat_title']+"";{rdelim}{rdelim}else{ldelim}var a_categ='';{rdelim};if(markerData['title']!=''){ldelim}if(markerData['title_link']=='/'||markerData['title_link']=='javascript:void(0);'){ldelim}var a_title=""+markerData['title']+"";{rdelim}else{ldelim}var a_title=""+markerData['title']+"";{rdelim}{rdelim}else{ldelim}var a_title='';{rdelim};if(markerData['marker_street']!=''){ldelim}var a_city=""+markerData['marker_city']+", "+markerData['marker_street']+", "+markerData['marker_building']+"";{rdelim}else{ldelim}var a_city='';{rdelim};if(markerData['marker_dopfield']!=''){ldelim}var a_dopfield=""+markerData['marker_dopfield']+"
";{rdelim}else{ldelim}var a_dopfield='';{rdelim};if(markerData['marker_phone']!=''){ldelim}var a_phone=""+markerData['marker_phone']+"";{rdelim}else{ldelim}var a_phone='';{rdelim};if(markerData['marker_www']!=''){ldelim}var a_placeholders=new Array('http://www.','https://www.','http://','https://');var a_www=""+str_replace(a_placeholders,'www.',markerData['marker_www'])+"";{rdelim}else{ldelim}
var a_www='';{rdelim};var a_divs="";var a_dive="
";var a_uls="";var a_ultws="";var content=a_divs+a_stimg+a_uls+a_categ+a_title+a_city+a_dopfield+a_ule+a_ultws+a_phone+a_www+a_ule+a_dive;var marker=new google.maps.Marker({ldelim}id:markerData['id'],map:map{$gmap.id},content:content,icon:image,position:myLatlng{rdelim});markerList{$gmap.id}[marker.id]=marker;google.maps.event.addListener(marker,'click',function(){ldelim}showMarker{$gmap.id}(marker.id);{rdelim});{rdelim}
function showMarker{$gmap.id}(markerId){ldelim}var marker=markerList{$gmap.id}[markerId];if(marker){ldelim}infowindow{$gmap.id}.setContent(marker.content);infowindow{$gmap.id}.open(map{$gmap.id},marker);{rdelim}else{ldelim}alert('Error marker not found: '+markerId);{rdelim}{rdelim}
function str_replace(search,replace,subject){ldelim}if(!(replace instanceof Array)){ldelim}replace=new Array(replace);if(search instanceof Array){ldelim}while(search.length>replace.length){ldelim}replace[replace.length]=replace[0];{rdelim}{rdelim}{rdelim}if(!(search instanceof Array))search=new Array(search);while(search.length>replace.length){ldelim}replace[replace.length]='';{rdelim}if(subject instanceof Array){ldelim}for(k in subject){ldelim}subject[k]=str_replace(search,replace,subject[k]);{rdelim}return subject;{rdelim}for(var k=0;k-1){ldelim}subject=subject.replace(search[k],replace[k]);i=subject.indexOf(search[k],i);{rdelim}{rdelim}return subject;{rdelim}