var gMarkers = null;
var gOptions = null;

$(document).ready(function() {
  gMarkers = new Array();
  gOptions = new Array();

  $('#map').jmap('init', { mapCenter:[39.287296,-76.620927], mapZoom:15 }, function(el, options) {
    $('#mapHotelLink').click(function() {
      $(el).jmap('addMarker', {
        pointLatLng:[39.287296,-76.620927],
        pointHTML: "<b>Marriott Inner Harbor at Camden Yards</b><br/>110 South Eutaw Street, Baltimore, MD 21201"
      }, function(marker, options) {
        marker.openInfoWindowHtml(options.pointHTML);
        $('#gMapsLink').attr({ href: 'http://maps.google.com?q='+escape('110 South Eutaw Street, Baltimore, MD 21201') });
      });
    });

    $('#mapBWILink').click(function(el) {
      $(el).jmap('addMarker', {
        pointLatLng:[39.179412,-76.668906],
        pointHTML: "<b>BWI</b><br/>BWI Thurgood Marshall Airport"
      }, function(marker, options) {
        marker.openInfoWindowHtml(options.pointHTML);
        $('#gMapsLink').attr({ href: 'http://maps.google.com?q=' + escape('BWI Airport') });
     });
   });
  });

  $('#mapHotelLink').click();

});

//Event.observe(window,"load",function(oEvt) {
//	if(GMap2 && GBrowserIsCompatible()) {
//		gGeocoder = new GClientGeocoder();
//        gMap = new GMap2($("map"));
//		gMap.addControl(new GSmallMapControl());
//		gMap.setCenter(new GLatLng(39.287296,-76.620927,false), 15);
//		hotelAddr = new KAddress(gMap,gGeocoder,"Marriott Inner Harbor at Camden Yards","110 South Eutaw Street, Baltimore, MD 21201",function() {
//			hotelAddr.openInfoWindow(true);
//		});
//		anatomyBoardAddr = new KAddress(gMap,gGeocoder,"Anatomy Board","655 West Baltimore Street, Baltimore, MD 21201");
//		bwiAddr = new KAddress(gMap,gGeocoder,"BWI","BWI Airport");
//		Event.observe("mapHotelLink","click",hotelAddr.getOpenInfoWindowEventListener(),false);
//		Event.observe("mapAnatomyBoardLink","click",anatomyBoardAddr.getOpenInfoWindowEventListener(),false);
//		Event.observe("mapBWILink","click",bwiAddr.getOpenInfoWindowEventListener(),false);
//    } else {
//		$("map").innerHTML = "Google maps cannot be loaded.";
//	}
//},false);
//Event.observe(window,"unload",function(oEvt) {
//	if(gMap) {
//		GUnload()				
//	}
//},false);
