var pocet_zemi=280;var destinaci_v_db=2000;var seznam_zemi=[];var seznam_destinaci=[];var gmarkers_zeme=[];var gmarkers_destinace=[];window.onunload=pageunload;var typ="velka";if(document.getElementById("map")){if(document.getElementById("map").className=="mapa-mala"||document.getElementById("map").className=="mapa-normal"){typ="mala"}}function pageunload(){GUnload()}function nacitani(){if(document.getElementById("nacitani")){setTimeout("document.getElementById('nacitani').style.display='none'",4000)}}function zobraz_destinaci(b){if(b!="x"){zobraz(b.split(",")[0],b.split(",")[1],b.split(",")[2],b.split(",")[3],b.split(",")[4])}}function zobraz_zemi(b){if(b!="x"){zobraz(b.split(",")[0],b.split(",")[1],b.split(",")[2],b.split(",")[3],b.split(",")[4])}}function zobraz(g,f,e,c,d,b){if(mapa){mapa.closeInfoWindow();if(d==1){if(b){mapa.setCenter(new GLatLng(e,c));GEvent.trigger(gmarkers_zeme[g],"click")}else{zobrazeniDestinaci(g)}}else{mapa.setCenter(new GLatLng(e,c));GEvent.trigger(gmarkers_destinace[g],"click")}}}function zmerit(){var e;var d;var g;var f;var h=0;var j=0;var l;var c;function b(){if(e&&d){l=[e.getPoint(),d.getPoint()]}j=e.getPoint().distanceFrom(d.getPoint());j=j.toFixed(0)+"m";if(parseInt(j)>10000){j=(parseInt(j)/1000).toFixed(1)+"km"}g.setContents(j);f.setContents(j);g.setPoint(e.getPoint());g.setContents(j);f.setPoint(d.getPoint());if(c){mapa.removeOverlay(c)}c=new GPolyline(l,"#F00000",3,1);mapa.addOverlay(c)}document.getElementById("mereni-help").style.display="";document.getElementById("mereni").style.backgroundPosition="-59px 0";document.getElementById("mereni").blur();GEvent.addListener(mapa,"click",function(m,o){try{if(o&&h==0){e=new GMarker(o,{draggable:true});mapa.addOverlay(e);e.enableDragging();g=new ELabel(o,j,"labelstyle",new GSize(2,20),60);mapa.addOverlay(g);d=new GMarker(o,{draggable:true});mapa.addOverlay(d);d.enableDragging();f=new ELabel(o,j,"labelstyle",new GSize(2,20),60);mapa.addOverlay(f)}GEvent.addListener(e,"drag",function(){b()});GEvent.addListener(e,"dblclick",function(){k()});GEvent.addListener(d,"drag",function(){b()});GEvent.addListener(d,"dblclick",function(){k()});h++}catch(n){alert("Nevkládejte výchozí měřící bod na jiné prvky na mapě. Umístěte jej na volné místo a následně si jej tažením přesuňte do požadované polohy.")}});function k(){mapa.removeOverlay(c);mapa.removeOverlay(e);mapa.removeOverlay(d);mapa.removeOverlay(g);mapa.removeOverlay(f);h=5;document.getElementById("mereni-help").style.display="none";document.getElementById("mereni").style.backgroundPosition="0 0";document.getElementById("mereni").blur();j=0}}if(GBrowserIsCompatible()&&document.getElementById("map")){var mapa=new GMap2(document.getElementById("map"));mapa.setCenter(new GLatLng(49,23),4,G_HYBRID_MAP);if(typ=="velka"){mapa.addControl(new GOverviewMapControl());mapa.addControl(new google.maps.LocalSearch(),new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(350,18)))}mapa.addControl(new GLargeMapControl());mapa.addControl(new GMapTypeControl());mapa.addControl(new GScaleControl());var gicons=[];for(var a=0;a<pocet_zemi;a++){if(a==0){var icon=new GIcon();icon.image="http://labs.google.com/ridefinder/images/mm_20_red.png";icon.iconSize=new GSize(12,20);icon.iconAnchor=new GPoint(6,20);icon.infoWindowAnchor=new GPoint(6,5);gicons[0]=icon}else{var icon=new GIcon();icon.image="/pics/mapy/vlajky/"+a+".png";icon.iconSize=new GSize(26,28);icon.iconAnchor=new GPoint(13,25);icon.infoWindowAnchor=new GPoint(13,10);gicons[a]=icon}}function createMarker(b,f,e,g,d){var c;if(d==1){c=new GMarker(b,{icon:gicons[0],title:f})}else{c=new GMarker(b,{icon:gicons[g],title:f})}GEvent.addListener(c,"click",function(){c.openInfoWindowHtml(e)});if(d==1){GEvent.addListener(c,"infowindowclose",function(){c.setImage("http://labs.google.com/ridefinder/images/mm_20_red.png")});GEvent.addListener(c,"infowindowopen",function(){c.setImage("http://labs.google.com/ridefinder/images/mm_20_yellow.png")});gmarkers_destinace[g]=c}else{gmarkers_zeme[g]=c}return c}function createRequest(){try{request=new GXmlHttp.create()}catch(c){try{request=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{request=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){request=null}}}if(request==null){alert("Error creating request object!")}}function nacti_data_do_pameti(){seznam_destinaci.length=0;seznam_zemi.length=0;var b="/Stranky/Mapy/data.xml";createRequest();request.open("GET",b,true);request.onreadystatechange=function(){if(request.readyState==4){var l=GXml.parse(request.responseText);var u=l.documentElement.getElementsByTagName("o");for(var v=0;v<u.length;v++){for(var t=0;t<u[v].childNodes.length;t++){var p=u[v].childNodes[t];if(p.nodeType==1){if(p.nodeName=="io"&&p.hasChildNodes()&&p.firstChild){id_dest=p.firstChild.nodeValue}else{if(p.nodeName=="n"&&p.hasChildNodes()&&p.firstChild){nazev_dest=p.firstChild.nodeValue}else{if(p.nodeName=="iz"&&p.hasChildNodes()&&p.firstChild){idzeme_dest=p.firstChild.nodeValue}else{if(p.nodeName=="la"){if(p.hasChildNodes()&&p.firstChild){lat_dest=parseFloat(p.firstChild.nodeValue)}else{lat_dest="X"}}else{if(p.nodeName=="lo"){if(p.hasChildNodes()&&p.firstChild){lng_dest=parseFloat(p.firstChild.nodeValue)}else{lng_dest="X"}}}}}}}}seznam_destinaci[v]=id_dest+","+nazev_dest+","+idzeme_dest+","+lat_dest+","+lng_dest}var y=l.documentElement.getElementsByTagName("z");var k="";for(var v=0;v<y.length;v++){for(var t=0;t<y[v].childNodes.length;t++){var p=y[v].childNodes[t];if(p.nodeType==1){if(p.nodeName=="iz"&&p.hasChildNodes()&&p.firstChild){var q=p.firstChild.nodeValue}else{if(p.nodeName=="n"&&p.hasChildNodes()&&p.firstChild){var r=p.firstChild.nodeValue}else{if(p.nodeName=="hm"&&p.hasChildNodes()&&p.firstChild){var c="<tr><td width='100'><strong>Hlavní město:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="la"){if(p.hasChildNodes()&&p.firstChild){var f=parseFloat(p.firstChild.nodeValue)}else{var f=0}}else{if(p.nodeName=="lo"){if(p.hasChildNodes()&&p.firstChild){var z=parseFloat(p.firstChild.nodeValue)}else{var z=0}}else{if(p.nodeName=="r"&&p.hasChildNodes()&&p.firstChild){var w="<tr><td><strong>Rozloha:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="p"&&p.hasChildNodes()&&p.firstChild){var o="<tr><td><strong>Obyvatel:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="j"&&p.hasChildNodes()&&p.firstChild){var e="<tr><td><strong>Oficiální jazyk:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="s"&&p.hasChildNodes()&&p.firstChild){var d="<tr><td><strong>Státní zřízení:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="hn"&&p.hasChildNodes()&&p.firstChild){var x="<tr><td><strong>Náboženství:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="c"&&p.hasChildNodes()&&p.firstChild){var h="<tr><td><strong>Časové pásmo:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}else{if(p.nodeName=="m"&&p.hasChildNodes()&&p.firstChild){var n="<tr><td><strong>Měna:</strong></td><td>"+p.firstChild.nodeValue+"</td></tr>"}}}}}}}}}}}}}}seznam_zemi[v+1]=q+","+r+","+f+","+z+",1";k+='<option value="'+q+","+r+","+f+","+z+',1">'+r+"</option>";var s=new GLatLng(f,z);var m="<div class='marker'>";m+="<p class='marker-nadpis-border'>";m+="<img src='/pics/vlajky/"+q+".gif' alt='Vlajka'> "+r+"</p>";m+="<table width='400'>"+d+c+w+o+n+h+e+x+"</table>";m+="<p class='marker-paticka'><a class='tucne' target='_blank' href='/AtlasZemiSveta/"+q+"'>Informace o zemi</a>";m+="<img src='/pics/mapy/oddelovac.gif' class='oddelovac' width='17' height='12' alt=' '/><a class='tucne' href='javascript: return false' onclick=\"zobraz('"+q+"','"+r+"','"+f+"','"+z+"',1)\">Zobrazit destinace</a>";m+="<img src='/pics/mapy/oddelovac.gif' class='oddelovac' width='17' height='12' alt=' '/><a class='tucne blue' href='/Dovolena?&zeme="+q+"' target='_blank'>Zájezdy</a>";m+="<img src='/pics/mapy/oddelovac.gif' class='oddelovac' width='17' height='12' alt=' '/><a class='tucne red' href='/Dovolena?&zeme="+q+"&lm=1' target='_blank'>Last Minute</a>";m+="</p></div>";var g=createMarker(s,r,m,q,0);mapa.addOverlay(g)}if(k!=""){document.getElementById("zeme-mapa").innerHTML="<div id='zeme-mapa-obsah'><select id='zeme_select' onchange='zobraz_zemi(this.value)'><option value='x'>Zvolte zemi</option>"+k+"</select></div>";document.getElementById("zeme-mapa").className=""}else{document.getElementById("zeme-mapa").innerHTML="<div id='zeme-mapa-obsah'>Žádné země nenalezeny</div>"}}};request.send(null);nacitani()}function zobrazeniDestinaci(p){var e="";var h=0;var l=0;var m=0;var d="";for(var r=1;r<seznam_zemi.length;r++){var k=seznam_zemi[r].split(",");if(k[0]==p){d=k[1];l=k[2];m=k[3];break}}var g="";for(var s=0;s<document.getElementById("zeme_select").length;s++){g=document.getElementById("zeme_select")[s].value;if(g.split(",")[0]==p){document.getElementById("zeme_select").selectedIndex=s}}mapa.closeInfoWindow();for(var j=0;j<destinaci_v_db;j++){if(gmarkers_destinace[j]){mapa.removeOverlay(gmarkers_destinace[j])}}var f=new GLatLngBounds();var n=p;var b=null;var q=null;var c=null;var t="X";var u="X";function o(){if(n!=""&&n!=null){for(var x=0;x<seznam_destinaci.length;x++){var y=seznam_destinaci[x].split(",");if(y[2]==n){b=y[0];q=y[1];c=y[2];t=y[3];u=y[4];if(q!="Ostatní"&&t!="X"&&u!="X"){var z=new GLatLng(t,u);var w="<div class='marker'><p class='marker-nadpis'>"+q+"</p>";if(typ=="velka"){w+="<p class='marker-paticka'><a class='tucne' target='_blank' href='/Destinace/"+n+"/"+b+"'>Informace o destinaci</a>"}else{w+="<p class='marker-paticka'><a class='tucne' href='/Destinace/"+n+"/"+b+"'>Informace o destinaci</a>"}w+="<img src='/pics/mapy/oddelovac.gif' class='oddelovac' width='17' height='12' alt=' '/><a class='tucne blue' href='/Dovolena?&zeme="+n+"&destinace="+b+"' target='_blank'>Zájezdy</a>";w+="<img src='/pics/mapy/oddelovac.gif' class='oddelovac' width='17' height='12' alt=' '/><a class='tucne red' href='/Dovolena?&zeme="+n+"&destinace="+b+"&lm=1' target='_blank'>Last Minute</a>";w+="</p></div>";var v=createMarker(z,q,w,b,1);mapa.addOverlay(v);f.extend(z);e+='<option value="'+b+","+d+","+t+","+u+',0">'+q+"</option>"}}}if(mapa.getBoundsZoomLevel(f)>8){mapa.setZoom(8)}else{if(mapa.getBoundsZoomLevel(f)<3&&f.getCenter()=="(0, 180)"){mapa.setZoom(6)}else{if(mapa.getBoundsZoomLevel(f)<3){mapa.setZoom(3)}else{mapa.setZoom(mapa.getBoundsZoomLevel(f))}}}if(f.getCenter()=="(0, 180)"){mapa.setCenter(new GLatLng(l,m))}else{mapa.setCenter(f.getCenter())}if(e!=""){document.getElementById("destinace-mapa").innerHTML="<div id='destinace-mapa-obsah'><select onchange='zobraz_destinaci(this.value)'><option value='x'>Zvolte destinaci</option>"+e+"</select></div>";document.getElementById("destinace-mapa").className=""}else{document.getElementById("destinace-mapa").innerHTML="<div id='destinace-mapa-obsah'>Žádné destinace</div>"}}}o()}var url_zeme="";var url_destinace="";var url_lat=0;var url_lng=0;var url_zoom=4;var url_maptype=G_HYBRID_MAP;var url=location.search.substring(1);if(url.length==0||url==""){url=parent.location.hash;url=url.substring(1,url.length)}var parametry=url.split("&");for(var i=0;i<parametry.length;i++){var pos=parametry[i].indexOf("=");var parametr=parametry[i].substring(0,pos).toLowerCase();var hodnota=parametry[i].substring(pos+1).toLowerCase();if(parametr=="zeme"){url_zeme=parseFloat(hodnota)}else{if(parametr=="destinace"){url_destinace=parseFloat(hodnota)}else{if(parametr=="lat"){url_lat=parseFloat(hodnota)}else{if(parametr=="lng"){url_lng=parseFloat(hodnota)}else{if(parametr=="zoom"){url_zoom=parseInt(hodnota)}else{if(parametr=="typ"){if(hodnota=="m"){url_maptype=G_NORMAL_MAP}else{if(hodnota=="k"){url_maptype=G_SATELLITE_MAP}else{if(hodnota=="h"){url_maptype=G_HYBRID_MAP}}}}}}}}}}if(url_zeme==""||url_zeme=="0"){if(document.getElementById("input_IDzeme")){url_zeme=document.getElementById("input_IDzeme").value}}if(url_destinace==""||url_destinace=="0"){if(document.getElementById("input_IDdestinace")){url_destinace=document.getElementById("input_IDdestinace").value}}if(url_zeme!=""&&url_destinace==""){opakovac=window.setInterval("if(gmarkers_zeme[url_zeme]){GEvent.trigger(gmarkers_zeme[url_zeme], 'click');clearTimeout(opakovac);}",2000)}else{if(url_zeme!=""&&url_destinace!=""){function akce(){zobrazeniDestinaci(url_zeme);opakovac2=window.setInterval("if(gmarkers_destinace[url_destinace]){GEvent.trigger(gmarkers_destinace[url_destinace], 'click');clearTimeout(opakovac2);}",2000)}opakovac=window.setInterval("if(gmarkers_zeme[url_zeme]){clearTimeout(opakovac);akce();}",2000)}else{if(url_lat!=0&&url_lng!=0){opakovac=window.setInterval("if(document.getElementById('map')){mapa.setCenter(new GLatLng(url_lat, url_lng), url_zoom,url_maptype);;clearTimeout(opakovac);}",2000)}}}function odkaz(){var b="lat="+mapa.getCenter().lat()+"&lng="+mapa.getCenter().lng()+"&zoom="+mapa.getZoom()+"&typ="+mapa.getCurrentMapType().getUrlArg();parent.location.hash=b}if(typ=="velka"){GEvent.addListener(mapa,"moveend",odkaz);GEvent.addListener(mapa,"maptypechanged",odkaz)}nacti_data_do_pameti()}else{if(!document.getElementById("map")){}else{alert("Je nám to líto, ale Váš prohlížeč nedokáže mapy světa zobrazit. Doporučujeme Vám nainstalovat si prohlížeč Firefox z www.firefox.cz")}};