﻿// do tohoto objektu se ukládají místa k zobrazení na mapě
function Place(lat, lng, name, img, desc, url) {
    var imgPath = '';
    this.lat = lat;
    this.lng = lng;
    this.name = name;
    this.img = imgPath + img;
    this.desc = desc;
    this.url = url;
    this.windowHtml = '';
    this.marker = '';
}

// seznamy
var pocetMap = 5;

mapa1 = new Object;
mapa1.stredX = 48.83399;
mapa1.stredY = 16.013432;
mapa1.linka = "kezhHerr`ByAwBeHtWmG`BuNL_M|EgIWyAwIyFgQUgJwF{RsCkZkEoFuW|LaWpU_c@fQ}CqUyMjSmL{^yYtLpa@gQjEgQdHqUpI}LlLuf@KmEyMuIoP}HyMkFyD{CoGaFsM_QyJwMsIoQmAiKuJqFe`@wQ}CgQmGkDoGsHqC`@oD{DrAmEjB}DjEgHvDaGxAkCtBaCb@w@L}@@m@Iq@ISo@HA`CKb@]HkAg@]LMhBSt@_@A][Au@p@oAl@mAJs@Mm@e@IoBXi@[o@sAgA{DmAn@Qc@O}@gCBQQyHvBa@]c@JwDn@";
mapa1.levels = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
mapa1.places = new Array(
new Place(48.79988176300894, 15.992574691772461, 'Hotel Happy Star', '/img/cyklomap/mapa-hotel.gif', 'When you leave the hotel go left on Greenway 48 and then turn right at the first chapel and head along the path “5000”.', ''),
new Place(48.809859357357524, 15.989656448364257, 'Henyk hut', '', 'Orientation point. Cycling Path 5001.', ''),
new Place(48.81421156698257, 16.003131866455078, 'Havranice heath', '/img/cyklomap/havran_vresov.jpg', 'Unique natural system with original flora and fauna, take the path then turn left to the path “5001”. (Wine tasting at the Znovin Znojmo hut is open in the summer.)', ''),
new Place(48.837379308938786, 15.997638702392578, 'Sealsfield rock', '/img/cyklomap/sealsfield_1.jpg', 'Canyon Dyje river is visible from the rock cliff with rock of the writer Charles Sealsfield. From Popice continue along the path 5000.', ''),
new Place(48.84969340553456, 16.040382385253906, 'Kraví hill', '/img/cyklomap/zn_panor_1.jpg', 'City hall, historical panorama of Znojmo, Mikulas church, Tremperk and city hall are visible from Kraví hill.', ''),
new Place(48.8524043595297, 16.04278564453125, 'The path passing by Lukas villa is very steep down to the Dyje river.', '', '(16 %)', ''),
new Place(48.854013919014534, 16.04355812072754, 'Bridge over the Dyje river.', '/img/cyklomap/zn_prehrada.jpg', 'Pub Pod obří hlavou. Znojmo dam.', ''),
new Place(48.85572931360579, 16.052119731903076, 'Hus park', '/img/cyklomap/cstezka_parky.jpg', 'The cycling path through the city parks.', ''),
new Place(48.85665404926805, 16.051915884017944, 'Znojmo, Komenský square.', '/img/cyklomap/zn_komenskeho.jpg', 'The path ends at the town medieval wall.', '')
);

mapa2 = new Object;
mapa2.stredX = 48.834781;
mapa2.stredY = 16.003304;
mapa2.linka = "sieiHac~`BiMbMeB`Ds@dBvAtEe@r@|@|CsAdAoApAk@lAkAzBwAjBiB`E_B`EEnAgBbEyBgDsF|KN|B?|BGrAA|ALzDN`DFtCMjBaAtDa@fCo@jFWjA{EfMo@~BIjB@v@T^`@Lh@y@n@{C|@{CrAqCzAcCt@qB^u@vEsE~@o@|ACnANnAi@d@]rBcB~A{@j@CzA`DG`A_BdFSz@[bAc@nB{AlWWxDQxCA~@@z@HzBZlN~Cn~@|O?v@`GnY_\\|CxJjKuW`FjKpCgJoMv`@cHvPiD`VcMjSqC`OpChJ}IxRpCxCjQq@l@lEoAzDbYvQfChJ~DhKvFmE`XbHgCl[vEnFHfQxFr@nBvQeEnFuHxYuBvc@qBrK?|LE`Kw@nIaFvMoM`a@jCrHpKmE~J]nKeAxNmIdKoIz`@{eCzf@rJtStDsOmCzAyLzBwJtQiC~D_FvK_GlGsGjByCvCbAvBGfFwIlDj@vB~BzB{DrCiC|Aa@dABhAl@`NtMx@iE|@}DfA{DvB_FvCuGfAiDhAoFrBeK`@cDb@mDtAsHfBcJnCcK~@oCt@tA";
mapa2.levels = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
mapa2.places = new Array(
new Place(48.85673875702427, 16.05179786682129, 'Znojmo, Komenský square', '/img/cyklomap/zn_nkomen_2m.jpg', 'The destination of the cycling path in Znojmo. (295 m above see level, Cycling path 48)', ''),
new Place(48.86211034778807, 16.041905879974365, 'Znojmo, Masaryk colony', '', 'Home colony between 1918-1939', ''),
new Place(48.85962579401566, 16.032679080963134, 'Old settlement of Saint Hypolita', '/img/cyklomap/hradiste_1m.jpg', 'Provost of Křížovníci, church of Saint Hypolita, view point at Dyje river and Znojmo, the Cycling path 5000.', ''),
new Place(48.848394354727084, 16.015748977661133, 'Králův stolec', '/img/cyklomap/kralstolec_1m.jpg', 'View point into the Dyje canyon in the Podyji National Park – Trauznice valley.', ''),
new Place(48.853138550976425, 15.991458892822265, 'Anděl mill', '/img/cyklomap/andel_ml_1m.jpg', 'Old mill. The path shortly goes up.', ''),
new Place(48.84201157208408, 15.97463607788086, 'Mašovice shooting range', '/img/cyklomap/masov_strel_1m.jpg', 'The heath of the former military shooting range.', ''),
new Place(48.846968184053495, 15.942792892456055, 'Pub U Rybníka', '/img/cyklomap/hosp_urybnika.jpg', 'Refreshment stop for cyclists.', ''),
new Place(48.83655308284243, 15.94767451286316, 'U milíře', '/img/cyklomap/u_milire.jpg', 'Crossroads of cycling path that connects the path 5000 with 48 – Greenways', ''),
new Place(48.821445572961586, 15.966482162475586, 'Iron stairs', '/img/cyklomap/np_schody.jpg', 'Former trail of the border patrol.', ''),
new Place(48.82302787260976, 15.971288681030273, 'Difficult way up - 18 %', '', '', ''),
new Place(48.81514413417898, 15.976524353027343, 'View point into Dyje canyon', '', 'Nine mills valley and at left Stone Sea.', ''),
new Place(48.81514413417898, 15.976524353027343, 'Šobes vineyard', '/img/cyklomap/sobes_1m.jpg', 'The vineyard produces the best white wines in the Czech Republic. Znovin Znojmo wine-hut with wine tasting.', ''),
new Place(48.79988176300894, 15.992574691772461, 'The Happy Star hotel', '/img/cyklomap/mapa-hotel.gif', 'The path starts at the left side of the hotel and follow Greenway 48.', '')
);

mapa3 = new Object;
mapa3.stredX = 48.827266;
mapa3.stredY = 15.952835;
mapa3.linka = "gfzhHqpr`BsAwBu@zBwCxK{@lEwG~A_HCuETaExAeDfB_Bd@eBCgCYgB?iAXsDxEiAbD{@fAkDh@_AlAgAnDy@pEv@|B`AjAbBtAlCzBdApCz@`CTtE`@|AwB`EkC}BaHlAqB|DyAvBq@{C}@?iAz@{Bb@}@fCoDGmClAuEvFqHrDeCjDeE{@}BlEwLrVpTbEw{@cPaR~lAqHvc@cDrRsMv}@{WqGsF~S[nDE|DXvDAdGj@vFBnBQbBwJ_H{BhK|@lAkC`KeHtAeBzD|CnF`HrGaNvZwCdGzQtWhJfCbMuIlG?vFbW|C~EpBgBhDjDfD`V";
mapa3.levels = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
mapa3.places = new Array(
new Place(48.79988176300894, 15.992574691772461, 'The Happy Star hotel', '/img/cyklomap/mapa-hotel.gif', 'This cycling path starts at the left side of the hotel and goes along “Greenway 48” (Prague – Vienna). Turn right at the first chapel and at the crossroads of Henyk hut go straight down.', ''),
new Place(48.81330724283114, 15.982961654663086, 'Water pumping station', '', 'At water station turn left and follow the yellow tourist marks.', ''),
new Place(48.8118518118986, 15.977640151977539, 'Foot bridge over Dyje river', '/img/cyklomap/lavka_1m.jpg', 'Greenways number 48/5000.', ''),
new Place(48.81525717144822, 15.976181030273438, 'Šobes vineyard', '/img/cyklomap/sobes_1m.jpg', 'Znovín Znojmo wine hut', ''),
new Place(48.81884597223549, 15.973734855651855, 'View point - Nine mills ', '', 'Beginning of uphill section - 16 %', ''),
new Place(48.821417317156744, 15.966482162475586, 'View poin of Iron Stairs', '/img/cyklomap/np_schody.jpg', 'Border with Austria.', ''),
new Place(48.836531897378705, 15.947728157043457, 'U milíře', '/img/cyklomap/u_milire.jpg', 'Path crossroads (48/5000).', ''),
new Place(48.84397450557891, 15.929338932037354, 'Žlebský creek', '/img/cyklomap/zlebsky_2m.jpg', 'Údolní hráz.', ''),
new Place(48.84977812506875, 15.916786193847656, 'Příčky', '', 'Go left at the crossroads.', ''),
new Place(48.837040346035, 15.904855728149414, 'Nový Hrádek', '/img/cyklomap/novy hradek _3m.jpg', 'Medieval castle with great view point.', '')
);

mapa4 = new Object;
mapa4.stredX = 48.78102;
mapa4.stredY = 16.08025;
mapa4.linka = "gfzhHqpr`BkA_CzCoI~@aDvAsGv@eDl@gBt@uAhF}Gh@{Af@m@l@mCTyA`@}A|@sD~AmLpBqG~@gBz@kArBeGbAiLTaKR}Cf@iAXw@FwBX]|Be@xB_AxAcAfAqAp@mAnAaBxAuAlAo@pFuE|KuPdHoK`AuAxAyCVw@E{F_@o@oJwDeG}BaC_A_@m@?eAxBqKf@yDXoLb@sIb@}CtAcFN}AIeGHqAl@sDbAiEDsBKcJ`@wK@}EeAaYm@mEs@qGe@kDU{B[iGy@qUwJlE{AxB_CxAhAsl@lCkDdEaKa@wTeE{@Z{H?yJTaCzEsWG_Ba@kC]Hc@eAWeB@iA`@o@~@cBl@}BVwAN}Aj@Fv@wCbAkA|@_B`BiGh@uAj@eCnB_QfAf@fDqUbD`@lCa@`As@ZeB\\wDbB}BzRTtk@gAlT_AhRaA~@OlDaEgBofASeMi@ac@SiI?aCNeD^yBdBel@fP{MxBqEpIaObAqCvHgXbGyPlFhI";
mapa4.levels = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
mapa4.places = new Array(
new Place(48.79988176300894, 15.992574691772461, 'The Happy Star hotel', '/img/cyklomap/mapa-hotel.gif', 'Follow the path 48.', ''),
new Place(48.792192290860434, 16.015491485595703, 'Šatov', '', 'Wine village, a base of the Znovin Znojmo wine producer', ''),
new Place(48.78915292818445, 16.058964729309082, 'Wine cellars', '', 'Valley of wine cellar surrounded by Daníž creek.', ''),
new Place(48.78763317780504, 16.083083152770996, 'Chvalovice', '', 'Crossing point of the Znojmo – Vienna road', ''),
new Place(48.78207686144284, 16.09548568725586, 'Dyjákovičky', '', 'Follow the cycling path 5007.', ''),
new Place(48.7623420193112, 16.1303973197937, 'Right junction from the cycling path 5007.', '', 'Vineyard of Eko Hnízdo.', ''),
new Place(48.75290671778965, 16.14243507385254, 'Lampelberg', '/img/cyklomap/lampelberg_1m.jpg', '', '')
);

mapa5 = new Object;
mapa5.stredX = 48.78108;
mapa5.stredY = 15.972834;
mapa5.linka = "gfzhHqpr`B_AqCsBvGuAdF{ApHcBjJ}@~GgAlGaB|HkAxEgHrOyDxQtBjAj`@~LhA~BbJvFhDzG`ClA`I{C~DlE~AHr@pCbD|EzEtArA_CxCqC~GoBjB`@lAjHhAPfFgB`Fm@dAxAjA\\fCbCxBbB`DrBhCvBbCvDzAtC~AhC}@xEDbBZnDInDAdBu@dI`CxApElAdDz@z@s@rAOhBwGfB`Ch@|AvBxAn@l@hBpAd@~@x@T|Az@vEB~CpApBwKtBrBr@j@pFxGrBnBdB`BjAbBnGbNxA`EpDw@tAk@`EsB`AGz@`CdBcBrBcAlB{@jBeA|EcApAw@pDz@vBz@bDf@";
mapa5.levels = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
mapa5.places = new Array(
new Place(48.79988176300894, 15.992574691772461, 'The Happy Star hotel', '/img/cyklomap/mapa-hotel.gif', 'The Happy Star hotel is located here in Hnanice.', ''),
new Place(48.795075981039915, 15.970559120178223, 'Border crossing point to Austria', '', 'Border crossing point for cyclists, tourists, horse riders, with random passport check.', ''),
new Place(48.79357761369239, 15.969529151916504, 'Helliger Stein', '/img/cyklomap/hs_retz_1m.jpg', 'View point into Retz region with lots of historical artifacts.', ''),
new Place(48.785088376436136, 15.96835970878601, 'Retzbach', '', 'Municipality in Austria.', ''),
new Place(48.78042964181752, 15.957469940185547, 'Weinviertel-Radweg', '', 'The cycling path following the contours through wide vineyards.', ''),
new Place(48.75693851024491, 15.951451063156128, 'Retz', '/img/cyklomap/hs_retz_2m.jpg', 'Austrian town with a lot of historical sites and a bicycle museum.', '')
);


function createMarker(u, mapa) {
    var places = mapa.places;
    var point = new GLatLng(places[u].lat, places[u].lng);
    var marker = new GMarker(point);
    var html = '<p><strong>' + places[u].name + '</strong></p>';
    if (places[u].img != '') {
        html += '<table style="border: none; font-size: 100%;"><tr><td style="vertical-align: top; height: 100px; width: 130px;"><img src="' + places[u].img + '" alt="" style="margin-right: 10px;" /></td><td style="vertical-align: top;">' + places[u].desc;
        if (places[u].url != '') html += '<br /><br /><a href="' + places[u].url + '">Více informací »</a>';
        html += '</td></tr></table>';
    }
    else {
        html += '<p>' + places[u].desc;
        if (places[u].url != '') html += '<br /><br /><a href="' + places[u].url + '">Více informací »</a>';
        html += '</p>';
    }
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html, { maxWidth: 300 });
    });
    //places[u].windowHtml = html;
    //places[u].marker = marker; // ukládáme pro vyvolávání v odkazech
    return marker;
}

//function openMapWindow(u) {
//    places[u].marker.openInfoWindowHtml(places[u].windowHtml, { maxWidth: 300 });
//}

// spouští se při nahrání stránky
function load() {
    if (GBrowserIsCompatible()) {
        for (var i = 1; i <= pocetMap; i++) {
            var mapa = eval('mapa' + i);
            var map = new GMap2(document.getElementById("map" + i));
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            map.addControl(new GScaleControl());
            map.setCenter(new GLatLng(mapa.stredX, mapa.stredY), 12);

            for (var j = 0; j < mapa.places.length; j++) {
                map.addOverlay(createMarker(j, mapa));
            }
            var encodedPolyline = new GPolyline.fromEncoded({
                color: "#990099",
                weight: 6,
                opacity: 0.5,
                points: mapa.linka,
                levels: mapa.levels,
                zoomFactor: 32,
                numLevels: 4
            });
            map.addOverlay(encodedPolyline);
        }
    }
}

addDOMLoadEvent(load);

