// map markers var map; var markers = []; // main markers markers[1] = []; markers[2] = []; markers[3] = []; markers[4] = []; markers[5] = []; markers[6] = []; markers[7] = []; markers[8] = []; markers[9] = []; markers[10] = []; var cur_type = new Array(); cur_type = {0:false,1:false,2:false,3:false,4:false,5:false,6:false,7:false,8:false,9:false,10: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,image4,image5,image6,image7,image8,image9,image10; // markers in arrays markers_source[1] = [50.4132,14.9067,8]; markers_pcs[1] = ''; markers_title[1] = 'Mladá Boleslav'; markers_id[1] = '68'; markers_source[2] = [50.5796,16.3331,2]; markers_pcs[2] = 'data/img/9/s-broumov-dreveny-kostel4.jpg'; markers_title[2] = 'Hřbitovní kostel Panny Marie '; markers_id[2] = '67'; markers_source[3] = [50.5857,16.3318,2]; markers_pcs[3] = 'data/img/9/s-broumovsko-5.jpg'; markers_title[3] = 'Lidová architektura na Broumovsku'; markers_id[3] = '66'; markers_source[4] = [50.5387,16.2356,2]; markers_pcs[4] = 'data/img/9/s-police_nad_metuji_-_kostel.jpg'; markers_title[4] = 'Klášter v Polici nad Metují'; markers_id[4] = '65'; markers_source[5] = [50.5174,16.1791,2]; markers_pcs[5] = 'data/img/9/s-mlyn.jpg'; markers_title[5] = 'Mlýn Dřevíček'; markers_id[5] = '64'; markers_source[6] = [50.661,16.2813,3]; markers_pcs[6] = 'data/img/9/s-c054c467.jpg'; markers_title[6] = 'Ruprechtický Špičák'; markers_id[6] = '63'; markers_source[7] = [50.5498,16.2894,1]; markers_pcs[7] = 'data/img/9/s-broumovske-steny01.jpg'; markers_title[7] = 'Broumovské stěny'; markers_id[7] = '62'; markers_source[8] = [50.6468,15.3388,10]; markers_pcs[8] = 'data/img/9/s-bozkovske_dolomitove_jeskyne_(04).jpg'; markers_title[8] = 'Bozkovské dolomitové jeskyně'; markers_id[8] = '60'; markers_source[9] = [50.779,14.1994,10]; markers_pcs[9] = 'data/img/8/s-zoo_decin0017.jpg'; markers_title[9] = 'Zoologická zahrada Děčín'; markers_id[9] = '59'; markers_source[10] = [50.5478,16.0946,10]; markers_pcs[10] = 'data/img/9/s-dsc_0019.jpg'; markers_title[10] = 'Důl Bohumír'; markers_id[10] = '61'; markers_source[11] = [50.464,15.3082,9]; markers_pcs[11] = 'data/img/8/s-img00003.jpg'; markers_title[11] = 'Prachovské skály'; markers_id[11] = '58'; markers_source[12] = [50.5448,15.2002,9]; markers_pcs[12] = 'data/img/8/s-hruboskalsko,_14.11.2002r.jpg'; markers_title[12] = 'Hruboskalsko'; markers_id[12] = '57'; markers_source[13] = [50.8418,14.2454,9]; markers_pcs[13] = 'data/img/8/s-labe_udoli.jpg'; markers_title[13] = 'Labské pískovce'; markers_id[13] = '56'; markers_source[14] = [50.7876,14.0288,9]; markers_pcs[14] = 'data/img/8/s-tiske-steny01.jpg'; markers_title[14] = 'Tiské stěny'; markers_id[14] = '55'; markers_source[15] = [50.5548,16.287,9]; markers_pcs[15] = 'data/img/8/s-broumovske-steny09.jpg'; markers_title[15] = 'Broumovské stěny'; markers_id[15] = '54'; markers_source[16] = [50.6103,16.1165,9]; markers_pcs[16] = 'data/img/8/s-abfa756a.jpg'; markers_title[16] = 'Adršpašsko-teplické skály'; markers_id[16] = '53'; markers_source[17] = [50.6052,15.3281,8]; markers_pcs[17] = 'data/img/8/s-201203060947_zap_76_2012_semily.jpg'; markers_title[17] = 'Semily'; markers_id[17] = '52'; markers_source[18] = [50.5873,15.1568,8]; markers_pcs[18] = 'data/img/8/s-namesti_ceskeho_raje,_turnov_(2).jpg'; markers_title[18] = 'Turnov'; markers_id[18] = '51'; markers_source[19] = [50.7991,14.4165,8]; markers_pcs[19] = 'data/img/8/s-eska_kamenice_-_square_of_peace.jpg'; markers_title[19] = 'Česká Kamenice'; markers_id[19] = '50'; markers_source[20] = [50.9091,14.5132,8]; markers_pcs[20] = 'data/img/7/s-square_in_krasna_lipa_4.jpg'; markers_title[20] = 'Krásná Lípa'; markers_id[20] = '49'; markers_source[21] = [50.5369,16.2335,8]; markers_pcs[21] = 'data/img/7/s-police_nad_metuji,_radnice.jpg'; markers_title[21] = 'Police nad Metují'; markers_id[21] = '48'; markers_source[22] = [50.5857,16.3318,8]; markers_pcs[22] = 'data/img/7/s-mirove_namesti.jpg'; markers_title[22] = 'Broumov'; markers_id[22] = '47'; markers_source[23] = [50.4681,15.1729,7]; markers_pcs[23] = 'data/img/7/s-fil17503.jpg'; markers_title[23] = 'Horolezecká stěna Sobotka'; markers_id[23] = '46'; markers_source[24] = [50.6419,15.194,7]; markers_pcs[24] = 'data/img/7/s-image-zluta-plovarna-2_1.jpg'; markers_title[24] = 'Žlutá plovárna'; markers_id[24] = '45'; markers_source[25] = [50.7392,14.2997,7]; markers_pcs[25] = 'data/img/7/s-jda5c6a28_koupak.jpg'; markers_title[25] = 'Termální koupaliště Benešov nad Ploučnicí'; markers_id[25] = '44'; markers_source[26] = [50.9104,14.5099,7]; markers_pcs[26] = 'data/img/7/s-full_022dc6_cimg0198.jpg'; markers_title[26] = 'Areál sportu Českého Švýcarska'; markers_id[26] = '43'; markers_source[27] = [50.875,14.5743,6]; markers_pcs[27] = 'data/img/7/s-_dsc4520.jpg'; markers_title[27] = 'Informační centrum Jiřetín pod Jedlovou'; markers_id[27] = '42'; markers_source[28] = [50.6269,15.1812,5]; markers_pcs[28] = 'data/img/7/s-hospudka_2.jpg'; markers_title[28] = 'Hospůdka Křížky'; markers_id[28] = '41'; markers_source[29] = [50.3688,15.1712,5]; markers_pcs[29] = 'data/img/7/s-1492_image.jpg'; markers_title[29] = 'Středověká krčma Dětenice'; markers_id[29] = '40'; markers_source[30] = [50.9127,14.5077,5]; markers_pcs[30] = 'data/img/6/s-lipa-restaur-stara-067a-fin-ret-f.jpg'; markers_title[30] = 'Restaurace Lípa Resort'; markers_id[30] = '39'; markers_source[31] = [50.9509,14.5586,5]; markers_pcs[31] = 'data/img/6/s-r017.jpg'; markers_title[31] = 'Pizzerie & Steakhouse Lužan'; markers_id[31] = '38'; markers_source[32] = [50.6192,16.115,5]; markers_pcs[32] = 'data/img/6/s-12171599_10206220514290975_671030623_o.jpg'; markers_title[32] = 'Café bar Kalírna'; markers_id[32] = '37'; markers_source[33] = [50.6255,15.1612,4]; markers_pcs[33] = 'data/img/6/s-1_profilove_foto_-_statek_ondrikovice.jpg'; markers_title[33] = 'Statek Ondříkovice'; markers_id[33] = '36'; markers_source[34] = [50.5246,14.9463,4]; markers_pcs[34] = 'data/img/6/s-maly-pivovar-exterier_34.jpg'; markers_title[34] = 'Hotel Malý Pivovar'; markers_id[34] = '35'; markers_source[35] = [50.8632,14.4584,4]; markers_pcs[35] = 'data/img/6/s-usedlost-na-stodolci.jpg'; markers_title[35] = 'Penzion Na Stodolci'; markers_id[35] = '34'; markers_source[36] = [50.7897,14.1902,4]; markers_pcs[36] = 'data/img/5/s-hotel_silnice_1000_667px.jpg'; markers_title[36] = 'Wellness Hotel Zlatá Lípa'; markers_id[36] = '33'; markers_source[37] = [50.6193,16.1164,4]; markers_pcs[37] = 'data/img/5/s-v52256_penzion-andrspach-u-bary-a-many-2.jpg'; markers_title[37] = 'Penzion Adršpach'; markers_id[37] = '32'; markers_source[38] = [50.7931,14.1085,3]; markers_pcs[38] = 'data/img/5/s-1280px-decinsky_sneznik_cz_120.jpg'; markers_title[38] = 'Děčínský sněžník'; markers_id[38] = '31'; markers_source[39] = [50.8466,14.8763,2]; markers_pcs[39] = 'data/img/4/s-grabstejn_letecky.jpg'; markers_title[39] = 'Hrad Grabštejn'; markers_id[39] = '30'; markers_source[40] = [50.8494,14.2216,3]; markers_pcs[40] = 'data/img/5/s-kanon_labe_(5).jpg'; markers_title[40] = 'Vyhlídka Belvedér'; markers_id[40] = '29'; markers_source[41] = [50.5697,15.1554,3]; markers_pcs[41] = 'data/img/5/s-hlavatice,_obcerstveni_a_vez.jpg'; markers_title[41] = 'Skalní vyhlídka Hlavatice'; markers_id[41] = '28'; markers_source[42] = [50.5091,15.3685,3]; markers_pcs[42] = 'data/img/3/s-tichankova-rozhledna-na-vrchu-tabor.jpg'; markers_title[42] = 'Rozhledna Tábor'; markers_id[42] = '27'; markers_source[43] = [50.5942,15.2635,3]; markers_pcs[43] = 'data/img/5/s-rozhledna_kozakov.jpg'; markers_title[43] = 'Rozhledna Kozákov'; markers_id[43] = '26'; markers_source[44] = [50.7789,14.2093,2]; markers_pcs[44] = 'data/img/5/s-zamek_decin.jpg'; markers_title[44] = 'Zámek Děčín'; markers_id[44] = '25'; markers_source[45] = [50.5857,16.3318,2]; markers_pcs[45] = 'data/img/5/s-kostel_v_sonove.jpg'; markers_title[45] = 'Broumovská skupina kostlů'; markers_id[45] = '24'; markers_source[46] = [50.6264,15.0893,2]; markers_pcs[46] = 'data/img/4/s-sychrov_letecky.jpg'; markers_title[46] = 'Zámek Sychrov'; markers_id[46] = '23'; markers_source[47] = [50.5166,15.2311,2]; markers_pcs[47] = 'data/img/4/s-burg_trosky.jpg'; markers_title[47] = 'Hrad Trosky'; markers_id[47] = '22'; markers_source[48] = [50.4681,15.2858,1]; markers_pcs[48] = 'data/img/3/s-img_2890_(2).jpg'; markers_title[48] = 'Prachovské skály'; markers_id[48] = '21'; markers_source[49] = [50.7869,14.0261,1]; markers_pcs[49] = 'data/img/4/s-1280px-labske_piskovce-tiske_steny5.jpg'; markers_title[49] = 'Tiské stěny'; markers_id[49] = '20'; markers_source[50] = [50.8737,14.2515,1]; markers_pcs[50] = 'data/img/4/s-edmundsklamm_bei_hrensko_-_panoramio.jpg'; markers_title[50] = 'Hřenské soutěsky na řece Kamenici'; markers_id[50] = '19'; markers_source[51] = [50.9135,14.5074,6]; markers_pcs[51] = 'data/img/2/s-1150a.jpg'; markers_title[51] = 'Informační středisko v Domě Českého Švýcarska'; markers_id[51] = '18'; markers_source[52] = [50.4365,15.352,6]; markers_pcs[52] = 'data/img/2/s-image.ashx.jpg'; markers_title[52] = 'Městské informační centrum Jičín'; markers_id[52] = '17'; markers_source[53] = [50.5874,15.1579,6]; markers_pcs[53] = 'data/img/2/s-dsc_1777.jpg'; markers_title[53] = 'Regionální turistické informační centrum Turnov'; markers_id[53] = '16'; markers_source[54] = [50.5362,16.2337,6]; markers_pcs[54] = 'data/img/2/s-23.jpg'; markers_title[54] = 'Informační centrum Police nad Metují'; markers_id[54] = '15'; markers_source[55] = [50.595,16.17,6]; markers_pcs[55] = 'data/img/2/s-dscn1017.jpg'; markers_title[55] = 'Turistické informační centrum Teplice nad Metují'; markers_id[55] = '14'; markers_source[56] = [50.5955,16.1648,7]; markers_pcs[56] = 'data/img/1/s-image_1304385019.jpg'; markers_title[56] = 'Koupaliště Teplice nad Metují'; markers_id[56] = '13'; markers_source[57] = [50.5956,16.167,7]; markers_pcs[57] = 'data/img/1/s-uvod.jpg'; markers_title[57] = 'Sportcentrum Teplice nad Metují'; markers_id[57] = '12'; markers_source[58] = [50.4904,15.1351,2]; markers_pcs[58] = 'data/img/4/s-kost02.jpg'; markers_title[58] = 'Hrad Kost'; markers_id[58] = '10'; markers_source[59] = [50.587,16.3325,2]; markers_pcs[59] = 'data/img/1/s-img_5102.jpg'; markers_title[59] = 'Broumovský klášter'; markers_id[59] = '9'; markers_source[60] = [50.5861,16.3339,5]; markers_pcs[60] = 'data/img/1/s-img_7328.jpg'; markers_title[60] = 'Café Dientzenhofer'; markers_id[60] = '8'; markers_source[61] = [50.5861,16.3342,4]; markers_pcs[61] = 'data/img/5/s-589b0d544b242ddb42330900.jpg'; markers_title[61] = 'Dům hostů v Broumovském klášteře'; markers_id[61] = '7'; markers_source[62] = [50.5717,16.1405,3]; markers_pcs[62] = 'data/img/2/s-hrad-skaly-6.jpg'; markers_title[62] = 'Zřícenina hradu Skály'; markers_id[62] = '6'; markers_source[63] = [50.5585,16.2059,1]; markers_pcs[63] = 'data/img/4/s-ostas_-_sandstone_formation_in_the_czech_republic_02.jpg'; markers_title[63] = 'Ostaš'; markers_id[63] = '5'; markers_source[64] = [50.5948,16.1481,1]; markers_pcs[64] = 'data/img/2/s-32549zjk.png'; markers_title[64] = 'Teplické skály - vstup'; markers_id[64] = '4'; markers_source[65] = [50.6152,16.1229,1]; markers_pcs[65] = 'data/img/2/s-p1012929.jpg'; markers_title[65] = 'Adršpašské skály - vstup'; markers_id[65] = '3'; markers_source[66] = [50.5745,16.1239,3]; markers_pcs[66] = 'data/img/2/s-jz-20140924-110102.jpg'; markers_title[66] = 'Rozhledna Čáp'; markers_id[66] = '2'; markers_source[67] = [50.8842,14.2816,1]; markers_pcs[67] = 'data/img/2/s-cs-pravcicka-brana.jpg'; markers_title[67] = 'Pravčická brána'; markers_id[67] = '1'; // two corner markers var min_marker = 61; var max_marker = 49; function initialize() { // set map var myLatLng = new google.maps.LatLng(50.579632, 16.268692); var mapOptions = { zoom: 12, center: myLatLng, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map'),mapOptions); // auto center & zoom: bounds = new google.maps.LatLngBounds(); // pois markers var anchorTop = 25; var anchorLeft = 25; var originTop = 0; var originLeft = 0; image1 = new google.maps.MarkerImage('images/icon/marker-priroda.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image2 = new google.maps.MarkerImage('images/icon/marker-kultura.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image3 = new google.maps.MarkerImage('images/icon/marker-vyhlidka.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image4 = new google.maps.MarkerImage('images/icon/marker-ubytovani.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image5 = new google.maps.MarkerImage('images/icon/marker-restaurace.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image6 = new google.maps.MarkerImage('images/icon/marker-info.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image7 = new google.maps.MarkerImage('images/icon/marker-sport.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image8 = new google.maps.MarkerImage('images/icon/marker-obec.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image9 = new google.maps.MarkerImage('images/icon/marker-lezeni.png', new google.maps.Size(33, 33), new google.maps.Point(originLeft,originTop), new google.maps.Point(anchorLeft,anchorTop) ); image10 = new google.maps.MarkerImage('images/icon/marker-osatni.png', new google.maps.Size(33, 33), 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]); if (min_marker==key) { loc = new google.maps.LatLng(markers_source[key][0], markers_source[key][1]); bounds.extend(loc); } if (max_marker==key) { loc = new google.maps.LatLng(markers_source[key][0], markers_source[key][1]); bounds.extend(loc); } } // after corner markers added and if they are diferent if (min_marker 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, zIndex: parseInt(id), icon: eval('image'+poiType) }); //alert(id); 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=cz', 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); clearMarkers(4); clearMarkers(5); clearMarkers(6); clearMarkers(7); clearMarkers(8); clearMarkers(9); clearMarkers(10); } $(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('images/map-buble-left-bg.png')"); $("#overlay").css("padding-left", "10px"); } else { marker_box_x = 7; $("#overlay").css("background-image", "url('images/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('images/icon/marker-"+type+".png')"); } else { setMarkersToMap(null,type); cur_type[type] = false; $(".map-icon-"+type).css("background-image", "url('images/icon/marker-"+type+"-off.png')"); } } // 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);