function init() {
  if (GBrowserIsCompatible()) {

    // Show the "Show map" links
    $(".venue-map-link").show();

    // Wire up the "Show map" link event
    $(".venue-map").each(function(i) {
        init_map(this);
      });
  }
}

function init_map(elem) {
  // Wire up the "Show map" link
  $(elem).parent().find(".venue-map-link").click(function() {
      show_map(elem);

      // Hide the "Show map" link
      $(this).hide();

      return false;
    });
}

function show_map(elem) {
  var latlng = $(elem).html().split(',');
  latlng = new GLatLng(latlng[0], latlng[1]);
  var startZoom = 12;

  $(elem).html('');
  $(elem).show();

  map = new GMap2(elem);
  map.setCenter(latlng, startZoom);
  map.addControl(new GSmallMapControl());
  map.addOverlay(new GMarker(latlng));
}


$(document).ready(function() {
      init();
  });
