    if (document.getElementById("map")) {
	  var linkTitle;
	  var fullAddress;
	  var linkLatitude;
	  var linkLongitude;
	  var m;
	  var map;
	  var htmls;
	  var to_htmls;
      var from_htmls;
	  var marker;
	}
	
	function load() {
      if (document.getElementById("map") && (GBrowserIsCompatible())) {
        
		linkTitle = document.getElementById("linktitle").innerHTML;
		fullAddress = document.getElementById("fulladdress").innerHTML;
		linkLatitude = document.getElementById("linklatitude").innerHTML;
		linkLongitude = document.getElementById("linklongitude").innerHTML;
		m = document.getElementById("map");
		m.style.height = "500px";
		m.style.width = "527px";
		m.style.border = "1px solid #000000";

		var map = new GMap2(m);
        map.setUIToDefault();
		//map.addControl(new GLargeMapControl());  // included with setUIToDefault
		//map.addControl(new GMapTypeControl());  // included with setUIToDefault
		map.setCenter(new GLatLng(linkLatitude,linkLongitude), 14);

		var start = '<div style="white-space:nowrap;font-family:Verdana,Arial;font-size:11px;margin-top:10px;">';
		var title = linkTitle;
		var address = '<br/><span style="font-family:Verdana,Arial;font-size:9px;color:#666666;">' + fullAddress + '</span>';
		var directions = '<br/><span style="line-height:20px;"><strong>Directions:</strong> <a href="javascript:tohere()" title="Click for directions to this location">To here</a> - <a href="javascript:fromhere()" title="Click for directions from this location">From here</a></span>';
		var end = '</div>';
		
		var point = new GLatLng(linkLatitude,linkLongitude);
		marker = new GMarker(point);
		map.addOverlay(marker);
		
		marker.openInfoWindowHtml(start + '<strong>' + title + '</strong>' + address + directions + end);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(start + '<strong>' + title + '</strong>' + address + directions + end);
		});

		//GEvent.addListener(map, 'moveend', function() {
		//	var center = map.getCenter();
		//	var latLngStr = '(' + center.y + ', ' + center.x + ')';
		//	document.getElementById("message").innerHTML = latLngStr;
		//});

		// The info window version with the "to here" form open
		to_htmls = '<form action="http://maps.google.com/maps" method="get" target="_blank" style="margin-bottom:0;">' + start + '<strong>' + title + '</strong>' + address + '<br/><span style="line-height:20px;"><strong>Directions:</strong> To here - <a href="javascript:fromhere()" title="Click for directions from this location">From here</a></span>' +
		'<br/>Start address:<br/>' +
		'<input type="text" style="font-family:Verdana,Arial;font-size:11px;border:1px solid #999999;" SIZE=30 MAXLENGTH=100 name="saddr" id="saddr" value="" /><br/>' +
		'<INPUT value="Get Directions" TYPE="SUBMIT">' +
		'<input type="hidden" name="daddr" value="' + point.y + ',' + point.x + "(" + title + ")" + '"/>' + end + '</form>';
		// The info window version with the "from here" form open
		from_htmls = '<form action="http://maps.google.com/maps" method="get" target="_blank" style="margin-bottom:0;">' + start + '<strong>' + title + '</strong>' + address + '<br/><span style="line-height:20px;"><strong>Directions:</strong> <a href="javascript:tohere()" title="Click for directions to this location">To here</a> - From here</span>' +
		'<br/>End address:<br/>' +
		'<input type="text" style="font-family:Verdana,Arial;font-size:11px;border:1px solid #999999;" SIZE=30 MAXLENGTH=100 name="daddr" id="daddr" value="" /><br/>' +
		'<INPUT value="Get Directions" TYPE="SUBMIT">' +
		'<input type="hidden" name="saddr" value="' + point.y + ',' + point.x + "(" + title + ")" + '"/>' + end + '</form>';
	   
      }
    }
	
	// functions that open the directions forms
    function tohere() {
      marker.openInfoWindowHtml(to_htmls);
    }
    function fromhere(i) {
      marker.openInfoWindowHtml(from_htmls);
    }
