var map = null;
var geocoder = null;
function gmap_initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(41.188473,16.903152), 13);
    geocoder = new GClientGeocoder();
  }
}
function gmap_show_address(address) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          //alert(address + " not found");
        } else {
          map.setCenter(point, 13);
          var marker = new GMarker(point);
          map.addOverlay(marker);
          marker.openInfoWindowHtml('<a href="http://maps.google.com/maps?q='+address+'&ie=UTF8&iwloc=addr">'+address+'</a>');
          map.addControl(new GSmallMapControl());
          map.addControl(new GMapTypeControl());
        }
      }
    );
  }
}
function gmap_show_address_with_coords(address,lat,lon) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          point=new GLatLng(lat,lon);
        }
        map.setCenter(point, 13);
        var marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml('<a href="http://maps.google.com/maps?q='+address+'&ie=UTF8&ll='+lat+','+lon+'&iwloc=addr">'+address+'</a>');
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
      }
    );
  }
}
