﻿/* namespace, predevsim pro praci s google maps */
GM = {
  createGoogleMap: function(id, centera, centerb, zoom) {
    GM.map = new google.maps.Map(document.getElementById(id), {
      zoom: zoom,     
      center: new google.maps.LatLng(centera, centerb),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    GM.infowindow = new google.maps.InfoWindow();
  },

  // prida ikonku do mapy, vyzaduje Shadowbox v pripade ze se v html nachazi obrazky!
  createMarker: function(coords, html, title){
    coords = coords.split(',');

    var marker = new google.maps.Marker({
      position: new google.maps.LatLng(parseFloat(coords[0]), parseFloat(coords[1])),
      map: GM.map,
      flat: true,
      title: title
    });
    
    google.maps.event.addListener(marker, 'click', function() {
        GM.infowindow.setContent(html);
        GM.infowindow.open(GM.map, marker);
    });
  }
};

