// map markers var map; var markers = []; // main markers markers[1] = []; markers[2] = []; markers[3] = []; var cur_type = new Array(); cur_type = {0:false,1:false,2:false}; var markers_list = []; var markers_source = []; var markers_id = []; var markers_xy = []; var markers_pcs = []; var markers_title = []; var markers_text = []; var topRight; var bottomLeft; var scale; var detailShow = false; var marker_box_x = 12; // default right margin of overlay from marker var image1,image2,image3; // markers in arrays markers_source[1] = [49.0903,16.6147,1]; markers_pcs[1] = '../gallery/poi/11/s-c22c71cb.jpg'; markers_title[1] = 'Rajhrad Monastery'; markers_id[1] = '11'; markers_source[2] = [49.7122,12.9956,1]; markers_pcs[2] = '../gallery/poi/6/s-e66f0ced.jpg'; markers_title[2] = 'Kladruby Monastery'; markers_id[2] = '6'; markers_source[3] = [50.637,13.8262,3]; markers_pcs[3] = '../gallery/poi/12/s-94f84a0d.jpg'; markers_title[3] = 'Teplice Convent'; markers_id[3] = '12'; markers_source[4] = [50.0721,14.418,1]; markers_pcs[4] = '../gallery/poi/13/s-6c4c013c.jpg'; markers_title[4] = 'Emauzy Monastery'; markers_id[4] = '13'; markers_source[5] = [48.3394,20.0623,3]; markers_pcs[5] = '../gallery/poi/20/s-e1142ff7.jpg'; markers_title[5] = 'Rimavské Janovce monastery'; markers_id[5] = '20'; markers_source[6] = [48.6298,19.2008,1]; markers_pcs[6] = '../gallery/poi/8/s-ccf919cb.jpg'; markers_title[6] = 'Monastery Premenenia Pána in Sampor'; markers_id[6] = '8'; markers_source[7] = [47.5525,17.7606,1]; markers_pcs[7] = '../gallery/poi/22/s-36724fd6.jpg'; markers_title[7] = 'Pannonhalma monastery'; markers_id[7] = '22'; markers_source[8] = [48.9158,18.0736,3]; markers_pcs[8] = '../gallery/poi/25/s-cd42d284.jpg'; markers_title[8] = 'Skalka monastery'; markers_id[8] = '25'; markers_source[9] = [48.0039,18.656,3]; markers_pcs[9] = '../gallery/poi/23/s-fadea665.jpg'; markers_title[9] = 'Hronovce – Čajakovo monastery'; markers_id[9] = '23'; markers_source[10] = [50.148,14.1013,3]; markers_pcs[10] = '../gallery/poi/18/s-a6634e02.jpg'; markers_title[10] = 'Kladno Castle'; markers_id[10] = '18'; markers_source[11] = [47.2541,17.7282,1]; markers_pcs[11] = '../gallery/poi/10/s-d0c3989c.jpg'; markers_title[11] = 'Saint Maurice Monastery'; markers_id[11] = '10'; markers_source[12] = [46.9139,17.8896,1]; markers_pcs[12] = '../gallery/poi/27/s-915d10f5.jpg'; markers_title[12] = 'Tihany Monastery'; markers_id[12] = '27'; markers_source[13] = [48.196,20.6833,2]; markers_pcs[13] = '../gallery/poi/35/s-c367811b.jpg'; markers_title[13] = 'Boldva'; markers_id[13] = '35'; markers_source[14] = [47.9533,19.2379,2]; markers_pcs[14] = '../gallery/poi/50/s-45768f71.jpg'; markers_title[14] = 'Tereske'; markers_id[14] = '50'; markers_source[15] = [47.7393,17.3894,2]; markers_pcs[15] = '../gallery/poi/43/s-f68135a6.jpg'; markers_title[15] = 'Lébény'; markers_id[15] = '43'; markers_source[16] = [49.3251,17.03,3]; markers_pcs[16] = ''; markers_title[16] = 'Pustiměř Convent'; markers_id[16] = '30'; markers_source[17] = [52.6578,17.9557,2]; markers_pcs[17] = '../gallery/poi/31/s-704a447f.jpg'; markers_title[17] = 'Mogilno Monastery'; markers_id[17] = '31'; markers_source[18] = [49.8772,14.8971,2]; markers_pcs[18] = '../gallery/poi/5/s-018a1767.jpg'; markers_title[18] = 'Sázava Monastery'; markers_id[18] = '5'; markers_source[19] = [46.9333,21.2167,2]; markers_pcs[19] = '../gallery/poi/51/s-eb9b20ca.jpg'; markers_title[19] = 'Csoltmonostor'; markers_id[19] = '51'; markers_source[20] = [47.1395,16.5829,2]; markers_pcs[20] = '../gallery/poi/41/s-373a6287.jpg'; markers_title[20] = 'Ják'; markers_id[20] = '41'; markers_source[21] = [50.0852,14.3567,1]; markers_pcs[21] = '../gallery/poi/14/s-9237e2f1.jpg'; markers_title[21] = 'Břevnov Monastery'; markers_id[21] = '14'; markers_source[22] = [47.4466,19.0136,1]; markers_pcs[22] = '../gallery/poi/36/s-ec76c632.jpg'; markers_title[22] = 'Budapest, SzentSzabinaLelkészség'; markers_id[22] = '36'; markers_source[23] = [46.7093,19.7305,2]; markers_pcs[23] = '../gallery/poi/38/s-ad1426c0.jpg'; markers_title[23] = 'Bugac, Felsőmonostortanya (Pétermonostor)'; markers_id[23] = '38'; markers_source[24] = [47.4453,18.2679,2]; markers_pcs[24] = '../gallery/poi/34/s-1da5af74.jpg'; markers_title[24] = 'Bokod (Vértesszentkereszt)'; markers_id[24] = '34'; markers_source[25] = [47.2567,17.1505,2]; markers_pcs[25] = '../gallery/poi/39/s-c175016e.jpg'; markers_title[25] = 'Celldömölk'; markers_id[25] = '39'; markers_source[26] = [51.9662,16.9007,1]; markers_pcs[26] = '../gallery/poi/9/s-38c9f496.jpg'; markers_title[26] = 'Lubin Abbey'; markers_id[26] = '9'; markers_source[27] = [47.6887,17.6343,1]; markers_pcs[27] = '../gallery/poi/40/s-27e9e448.jpg'; markers_title[27] = 'Győr'; markers_id[27] = '40'; markers_source[28] = [46.3566,17.8452,2]; markers_pcs[28] = '../gallery/poi/42/s-89eeb795.jpg'; markers_title[28] = 'Kaposszentjakab'; markers_id[28] = '42'; markers_source[29] = [46.9246,17.5538,2]; markers_pcs[29] = '../gallery/poi/44/s-2f9cdc70.jpg'; markers_title[29] = 'Monostorapáti (Almád)'; markers_id[29] = '44'; markers_source[30] = [46.8198,16.9953,2]; markers_pcs[30] = '../gallery/poi/45/s-b52a3ecd.jpg'; markers_title[30] = 'Kapornak'; markers_id[30] = '45'; markers_source[31] = [46.4897,20.0955,2]; markers_pcs[31] = '../gallery/poi/46/s-d384e4f8.jpg'; markers_title[31] = 'Szermonostor'; markers_id[31] = '46'; markers_source[32] = [47.4859,18.3155,2]; markers_pcs[32] = '../gallery/poi/47/s-c0d31b07.jpg'; markers_title[32] = 'Oroszlány, CamaldoleseHermitage (Majk)'; markers_id[32] = '47'; markers_source[33] = [47.6861,16.5904,2]; markers_pcs[33] = '../gallery/poi/49/s-87ef351a.jpg'; markers_title[33] = 'Sopron'; markers_id[33] = '49'; markers_source[34] = [47.9178,19.6947,2]; markers_pcs[34] = '../gallery/poi/48/s-08adb6c4.jpg'; markers_title[34] = 'Pásztó'; markers_id[34] = '48'; markers_source[35] = [46.7382,17.1048,2]; markers_pcs[35] = '../gallery/poi/52/s-2a4efe4d.jpg'; markers_title[35] = 'Zalavár/Zalaapáti'; markers_id[35] = '52'; markers_source[36] = [48.3203,19.0887,2]; markers_pcs[36] = '../gallery/poi/53/s-69c8e890.jpg'; markers_title[36] = 'Bzovik Monastery'; markers_id[36] = '53'; markers_source[37] = [48.3461,18.5566,2]; markers_pcs[37] = '../gallery/poi/24/s-d05c1ce1.jpg'; markers_title[37] = 'Hronský Beňadik monastery'; markers_id[37] = '24'; markers_source[38] = [50.0183,19.8048,1]; markers_pcs[38] = '../gallery/poi/17/s-dad8ab99.jpg'; markers_title[38] = 'Tyniec Abbey'; markers_id[38] = '17'; markers_source[39] = [50.8498,20.9501,2]; markers_pcs[39] = '../gallery/poi/32/s-df73be5e.jpg'; markers_title[39] = 'Holy Cross Monastery'; markers_id[39] = '32'; markers_source[40] = [51.145,16.2419,2]; markers_pcs[40] = '../gallery/poi/55/s-6a96908a.jpg'; markers_title[40] = 'Legnickie Pole Monastery'; markers_id[40] = '55'; markers_source[41] = [50.732,16.069,1]; markers_pcs[41] = '../gallery/poi/54/s-e800ad77.jpg'; markers_title[41] = 'Krzeszow Abbey'; markers_id[41] = '54'; markers_source[42] = [50.5872,16.3328,1]; markers_pcs[42] = '../gallery/poi/4/s-c8e9326a.jpg'; markers_title[42] = 'Broumov Monastery'; markers_id[42] = '4'; markers_source[43] = [49.2168,15.873,3]; markers_pcs[43] = '../gallery/poi/7/s-e52b32d5.jpg'; markers_title[43] = 'Třebíč Monastery'; markers_id[43] = '7'; markers_source[44] = [50.5336,14.722,3]; markers_pcs[44] = '../gallery/poi/56/s-72bd93ae.jpg'; markers_title[44] = 'Bezděz Monastery'; markers_id[44] = '56'; markers_source[45] = [50.2109,14.4363,1]; markers_pcs[45] = ''; markers_title[45] = 'Panenské Břežany Castle'; markers_id[45] = '57'; markers_source[46] = [48.1349,17.8404,3]; markers_pcs[46] = '../gallery/poi/21/s-22c2e3c8.jpg'; markers_title[46] = 'Diakovce monastery'; markers_id[46] = '21'; markers_source[47] = [48.4973,18.1185,2]; markers_pcs[47] = '../gallery/poi/19/s-36231a82.jpg'; markers_title[47] = 'Ludanice monastery'; markers_id[47] = '19'; markers_source[48] = [48.345,18.0909,2]; markers_pcs[48] = '../gallery/poi/26/s-0a9495b3.jpg'; markers_title[48] = 'St. Hypolit monastery in Nitra on the hill Zobor'; markers_id[48] = '26'; function initialize() { // styled map var styles = [{ stylers: [ { hue: "#00ffe6" }, { saturation: -20 }] },{ featureType: "road", elementType: "geometry", stylers: [ { lightness: 100 }, { visibility: "simplified" }] },{ featureType: "road.local", elementType: "geometry", stylers: [ { color: "#c7cabf" }] },{ featureType: "road", elementType: "labels", stylers: [ { visibility: "off" }] },{ featureType: "road.highway", elementType: "geometry", stylers: [ { color: "#c1b88f" }, { weight: "2" }] },{ featureType: "road.highway", elementType: "labels.text.stroke", stylers: [ { color: "#FFFFFF" }, { visibility: "on" },] },{ featureType: "poi.park", elementType: "geometry", stylers: [ { color: "#c5cbbf" }] },{ featureType: "water", elementType: "all", stylers: [ { visibility: "on" }, { color: "#ffffff" }] }]; var styledMap = new google.maps.StyledMapType(styles,{name: "Styled Map"}); // set map var myLatLng = new google.maps.LatLng(50.579632, 16.268692); var mapOptions = { zoom: 7, center: myLatLng, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map'),mapOptions); map.mapTypes.set('map_style', styledMap); map.setMapTypeId('map_style'); // pois markers var anchorTop = 25; var anchorLeft = 25; var originTop = 0; var originLeft = 0; image1 = new google.maps.MarkerImage('../pcs/marker-1.png', new google.maps.Size(45, 45), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image2 = new google.maps.MarkerImage('../pcs/marker-2.png', new google.maps.Size(45, 45), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image3 = new google.maps.MarkerImage('../pcs/marker-3.png', new google.maps.Size(45, 45), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); for (var key in markers_source) { addMarker(key,markers_source[key][0],markers_source[key][1],markers_source[key][2]); } // listener on idle map -> recalculate position all markers google.maps.event.addListener(map, 'idle', function() { // get map x,y topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()); bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()); scale = Math.pow(2,map.getZoom()); // get marker x,y for (var i = 1; i < markers_list.length; i++) { worldPoint = map.getProjection().fromLatLngToPoint(markers_list[i].getPosition()); markers_xy[i] = new google.maps.Point((worldPoint.x-bottomLeft.x)*scale,(worldPoint.y-topRight.y)*scale); } }); // hide overlay if move map google.maps.event.addListener(map, 'center_changed', function() { $("#overlay").hide(); }); // hide overlay if zoom change google.maps.event.addListener(map, 'zoom_changed', function() { $("#overlay").hide(); }); } // add marker function addMarker(id,lat,lon,poiType) { markers_list[id] = new google.maps.Marker({ position: new google.maps.LatLng(lat,lon,true), map: map, icon: eval('image'+poiType) }); markers[poiType].push(markers_list[id]); var showMarkerBubble = new Function("event", "markerBubble("+id+");"); google.maps.event.addListener(markers_list[id], 'mouseover', showMarkerBubble); google.maps.event.addListener(markers_list[id], 'mouseout', function() { $("#overlay").hide(); }); var showDetailBubble = new Function("event", "detailBubble("+id+");"); google.maps.event.addListener(markers_list[id], 'click', showDetailBubble); } // load poi data by ajax function getPoiDetail(id_poi) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('detail-box').innerHTML = xmlhttp.responseText; } } xmlhttp.open('GET','../ajax/poi-detail.php?id='+id_poi+'&l='+2, true); xmlhttp.send(); } // function for show detail overlay function detailBubble(num) { $("#detail strong").text(markers_title[num]); if (!detailShow || detailShow!=num) { $("#detail").show(); getPoiDetail(markers_id[num]); detailShow = num; } else { $("#detail").hide(); detailShow = false; document.getElementById('detail-box').innerHTML = '
'; } } function clearMapMarkers() { clearMarkers(1); clearMarkers(2); clearMarkers(3); } $(document).ready(function() { $( "#detail-close" ).click(function(e){ e.preventDefault(); $("#detail").hide(); detailShow = false; document.getElementById('detail-box').innerHTML = '
'; }); var t = setTimeout(clearMapMarkers, 500); }); // function for show markers overlay function markerBubble(num) { $("#overlay strong").text(markers_title[num]); $("#overlay div").css("background-image", "url('"+markers_pcs[num]+"')"); if (markers_xy[num].x > ($("#map").width()-237)) { marker_box_x = -237; $("#overlay").css("background-image", "url('../pcs/map-buble-left-bg.png')"); $("#overlay").css("padding-left", "10px"); } else { marker_box_x = 7; $("#overlay").css("background-image", "url('../pcs/map-buble-right-bg.png')"); $("#overlay").css("padding-left", "13px"); } $("#overlay").css({ left:($("#map").position().left + markers_xy[num].x + marker_box_x), top:($("#map").position().top + markers_xy[num].y - 51) }); $("#overlay").show(); } function setMarkersToMap(sendMap,type) { if (!type) { for (var key in markers) { for (var i = 0; i < markers[key].length; i++) { markers[key][i].setMap(sendMap); } } } else { for (var i = 0; i < markers[type].length; i++) { markers[type][i].setMap(sendMap); } } } // hide markers function clearMarkers(type) { //alert(type+" --- "+cur_type[type]); if (!cur_type[type]) { setMarkersToMap(map,type); cur_type[type] = true; $(".map-icon-"+type).css("background-image", "url('../pcs/marker-"+type+"-s.png')"); } else { setMarkersToMap(null,type); cur_type[type] = false; $(".map-icon-"+type).css("background-image", "url('../pcs/marker-disable.png')"); // "+type+"-s-off } } // shows markers function showOverlays(type) { setMarkersToMap(map,type); } // deletes all markers function deleteMarkers(type) { clearMarkers(type); markers[type] = null; } google.maps.event.addDomListener(window, 'load', initialize);