var mapObject, markers = [], markersData = {"aktivnosti":[{"area":"Aktivnosti","location":"46.165349,14.305401","image":"\/pic\/product\/s\/pot-treh-gradov.1.jpg","erpID":"pot-treh-gradov","title":"Pot treh gradov","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/pot-treh-gradov.html"},{"area":"Aktivnosti","location":"46.165063,14.306787","image":"\/pic\/product\/s\/pot-skritih-kotickov.1.jpg","erpID":"pot-skritih-kotickov","title":"Pot skritih koti\u010dkov","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/pot-skritih-kotickov.html"},{"area":"Aktivnosti","location":"46.164064,14.306894","image":"\/pic\/product\/s\/pot-v-pustal.1.jpg","erpID":"pot-v-pustal","title":"Pot v Pu\u0161tal","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/pot-v-pustal.html"},{"area":"Aktivnosti","location":"46.167686,14.305612","image":"\/pic\/product\/s\/pot-v-crngrob.1.jpg","erpID":"pot-v-crngrob","title":"Pot v Crngrob","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/pot-v-crngrob.html"},{"area":"Aktivnosti","location":"46.167972,14.306186","image":"\/pic\/product\/s\/pot-v-staro-loko.1.jpg","erpID":"pot-v-staro-loko","title":"Pot v Staro Loko","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/pot-v-staro-loko.html"},{"area":"Aktivnosti","location":"46.166019,14.306309","image":"\/pic\/product\/s\/romualdova-pot.1.jpg","erpID":"romualdova-pot","title":"Romualdova pot","address":null,"phone":null,"mobile":null,"url":"\/turisticna-ponudba\/aktivnosti\/romualdova-pot.html"}]}; var mapOptions = { zoom: 17, center: new google.maps.LatLng(46.1655555, 14.3071011), mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, position: google.maps.ControlPosition.LEFT_CENTER }, panControl: false, panControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE, position: google.maps.ControlPosition.RIGHT_BOTTOM }, scrollwheel: false, scaleControl: false, scaleControlOptions: { position: google.maps.ControlPosition.TOP_LEFT }, streetViewControl: true, streetViewControlOptions: { position: google.maps.ControlPosition.RIGHT_BOTTOM }, styles: [ { "featureType": "landscape", "stylers": [ { "hue": "#FFBB00" }, { "saturation": 43.400000000000006 }, { "lightness": 37.599999999999994 }, { "gamma": 1} ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#FFC200" }, { "saturation": -61.8 }, { "lightness": 45.599999999999994 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FF0300" }, { "saturation": -100 }, { "lightness": 51.19999999999999 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#FF0300" }, { "saturation": -100 }, { "lightness": 52 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#0078FF" }, { "saturation": -13.200000000000003 }, { "lightness": 2.4000000000000057 }, { "gamma": 1 } ] }, { "featureType": "poi.business", "stylers": [ { visibility: "off" } ] } ] }; var marker; mapObject = new google.maps.Map(document.getElementById('map'), mapOptions); for (var key in markersData) { markersData[key].forEach(function (item) { item.location = item.location.split(',') marker = new google.maps.Marker({ position: new google.maps.LatLng(item.location[0], item.location[1]), map: mapObject, icon: '/pic/pins/' + key + '.png', erpID: item.erpID }); if ('undefined' === typeof markers[key]) { markers[key] = []; } markers[key].push(marker); //markers[key][item.erpID] = marker; google.maps.event.addListener(marker, 'click', (function () { closeInfoBox(); getInfoBox(item).open(mapObject, this); mapObject.setCenter(new google.maps.LatLng(item.location[0], item.location[1])); })); }); }