  google.load("maps", "2.x");
 
  // Call this function when the page has been loaded   
  var global_markers = new Array();  // pole všech značek
  var map;  
  
  // Inicializace mapy
  function initialize() {
    // určení DIVu, který obsahuje mapu
    map = new google.maps.Map2(document.getElementById("map"));
    map.setMapType(G_HYBRID_MAP);
    // přidání ovládátek na mapu (zoomovadlo, přepínač a náhled)
    map.addControl(new GSmallZoomControl());
    map.addControl(new GMenuMapTypeControl());   
    // určení výchozí polohy a měřítka mapy
    map.setCenter(new GLatLng(sx,sy), meritko);   
    //javascript:void(prompt('Aktualni souradnice mapy:',map.getCenter()));
    //javascript:void(prompt('',gApplication.getMap().getCenter()));  
    map.getContainer().style.overflow="hidden"; 
  
  // Vytvoří značku, parametry: souřadnice značky, html kód okna, popiska značky 
  function createMarker(point, content, cap) {
    // objekt obsahující vlastnosti značky
    
    var opt = new Object();
    opt.title = cap;
    var marker = new GMarker(point, {icon:Myicon, title:opt.title})
 
    // obsloužení kliknutí na značku
    GEvent.addListener(marker, "click", function() {
    // vycentruje a zazoomuje      
      marker.openInfoWindowHtml(content);  
    });  
    return marker;
  }

    var Myicon = new GIcon();
    //picture definition
    Myicon.image = "../img/icon-map.png";
    //size
    Myicon.iconSize = new GSize(16, 16);
    //and where the anchors will be
    Myicon.iconAnchor = new GPoint(8, 8);
    Myicon.infoWindowAnchor = new GPoint(8, 0);

    // Načtení a zpracování dat z XML souboru
    GDownloadUrl(mapaxml, function(data, responseCode) {  
      var xml = GXml.parse(data);                                  
      var s;
      var oblasti = xml.documentElement.getElementsByTagName("oblast");
      
      // smyčka přes všechny oblasty v XML souboru  
      for (var i = 0; i < oblasti.length; i++) {
        // souřadnice oblastu    
        var point = new GLatLng(parseFloat(oblasti[i].getAttribute("lat")),                            
                                parseFloat(oblasti[i].getAttribute("lng")));
                                
        // html obsah informačního okna, které se zobrazí po kliknutí na značku                        
        s = "<a href='"+oblasti[i].getAttribute("url")+"' target='_self'><img src='"+oblasti[i].getAttribute("image")+"' alt='"+oblasti[i].getAttribute("label")+"' width='190'><br>"+oblasti[i].getAttribute("label")+"</a>";
        // vytvoření značky
        var marker = createMarker(point, s, oblasti[i].getAttribute("label"));
        
        // přidání značky do globálního pole
        global_markers [global_markers.length] = marker;
      
        // přidání značky na mapu 
        map.addOverlay(marker);
      }      
    });
             
  }      
  google.setOnLoadCallback(initialize);    

