    if (GBrowserIsCompatible()) {
      // this variable will collect the html which will eventualkly be placed in the side_bar
	  var caddr = 0;
	  var saddr = "";
	  var marker = "";
      // arrays to hold copies of the markers and html used by the side_bar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
	  var to_htmls = [];
      var from_htmls = [];
	  var airlocat = [];

      // A function to create the marker and set up the event window
      function createMarker(point,html,label) {
        var marker = new GMarker(point,{title:label});
	        // The info window version with the "to here" form open
        to_htmls[i] = html + '<br>Start address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=80 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" id="caddr" value="'+i+'"/>';
		airlocat[i] = label+"@"+ point.lat() + ',' + point.lng();
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<br>End address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=80 name="caddr" id="caddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" id="saddr" value="'+label+"@"+ point.lat() + ',' + point.lng() +
           '"/>';
        // The inactive version of the direction info
        //html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the side_bar html
        //side_bar_html += '<a href="javascript:myclick(' + i + ')">' + label + '</a>';
        i++;
        return marker;
      }
		
	   // ===== request the directions =====
	   function getDirections() {
        var saddr = document.getElementById("saddr").value
		var addr = document.getElementById("caddr").value
		var daddr = airlocat[0];
       // var daddr = document.getElementById("daddr").value
		
        gdir.load("from: "+saddr+" to: "+daddr);
		 
      }
	  
      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }
      // functions that open the directions forms
      function tohere(i) {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }
      function fromhere(i) {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
      }
	  function zoomtohere(i) {
	  	map.setZoom(12);
	  }
	  function zoomout(i) {
	    map.closeInfoWindow();
	  	map.setCenter(new GLatLng(28.579909,-81.389234),8);
	  }

      // create the map
      var map = new GMap2(document.getElementById("mapb"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(28.579909,-81.389234),8);
	  var bounds = new GLatLngBounds();
	  
	  
	  // === create a GDirections Object ===
      var gdir=new GDirections(map, document.getElementById("directions"));

      // === Array for decoding the failure codes ===
      var reasons=[];
      reasons[G_GEO_SUCCESS]            = "Success";
      reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
      reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
      reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
      reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
      reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
      reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";
      reasons[G_GEO_BAD_REQUEST]        = "A directions request could not be successfully parsed.";
      reasons[G_GEO_MISSING_QUERY]      = "No query was specified in the input.";
      reasons[G_GEO_UNKNOWN_DIRECTIONS] = "The GDirections object could not compute directions between the points.";

      // === catch Directions errors ===
      GEvent.addListener(gdir, "error", function() {
        var code = gdir.getStatus().code;
        var reason="Code "+code;
        if (reasons[code]) {
          reason = reasons[code]
        } 

        alert("Failed to obtain directions, "+reason);
      });



      // Read the data from example.xml
      var request = new GXmlHttp.create();
      request.open("GET", "jcunningham.xml", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = request.responseXML;
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
			var label = markers[i].getAttribute("label");
			var labem = markers[i].getAttribute("labem");
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
			var locat = markers[i].getAttribute("locat");
            var point = new GLatLng(lat,lng);
            // create the marker
			var html='<div id="wind"><table width="200px"><tr><td><a href=' + locat + '><font color="#121A4E"><strong>' + label + '</strong><br><br><strong>' + labem + '</strong></font></a><hr><br>Zoom: <a href="javascript:zoomtohere('+i+')">In</a> - <a href="javascript:zoomout('+i+')">Out</a></td></tr></table></div>';
 
            var marker = createMarker(point,html,label);
            map.addOverlay(marker);
			bounds.extend(point);
          }
          // put the assembled side_bar_html contents into the side_bar div
		  //side_bar_html += '<hr width="80%" color="tan"><a href="javascript:zoomout('+i+')">Reset Map to<br>Starting Position</a>';
          //document.getElementById("side_bar").innerHTML = side_bar_html;

        }
      }
      request.send(null);
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

