var map = null;
var geocoder = null;

function GMapInit() {
  jsMap = document.getElementById("map");
  jsMap.style.width = GMAP_SIZE_X + "px";
  jsMap.style.height = GMAP_SIZE_Y + "px";

  if (GBrowserIsCompatible()) {
    map = new GMap2(jsMap);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    geocoder = new GClientGeocoder();
    showAddress(GMAP_ADDRESS);
  }
}

function showAddress(address) {
  if (geocoder) {
    geocoder.getLatLng(address, function(point) {
      // kdyz nenajde bod
      if (!point) {
        // nastavi souradnice na stred CR a zoomne aby byla cela videt
        map.setCenter(new GLatLng(49.653404588437894, 15.4248046875), 6);
        // JS okno s chybovou hlaskou
         //alert("Adresa '" + address + "' nebyla nalezena.");
      } else {
        // nastavi stred
        map.setCenter(point, GMAP_ZOOM);
        // nastavi znacku
        var marker = new GMarker(point);
        map.addOverlay(marker);
      }
    });
  }
}

