    //<![CDATA[

    if (GBrowserIsCompatible()) {
      var gmarkers = [];
	  var mainmarker;
      var htmls = [];
      // arrays to hold variants of the info window html with get direction forms open
      var to_htmls = [];
      var from_htmls = [];


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);

        var i = gmarkers.length;

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<br>Directions: <b>To here<\/b> - <a href="javascript:fromhere(' + i + ')">From here<\/a>' +
           '<br>Start address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT"><br>' +
           '<input type="hidden" id="daddr" value="'+name+"@"+ point.lat() + ',' + point.lng() + 
           '"/>';
		  // console.log(name);
		  // console.log(point.lat());
		  // console.log(point.lng());
        // The info window version with the "from here" form open
        from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here<\/a> - <b>From here<\/b>' +
           '<br>End address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT"><br>' +
           '<input type="hidden" id="saddr" value="'+name+"@"+ point.lat() + ',' + point.lng() +
           '"/>';
		   //console.log(name);
		   //console.log(point.lat());
		   //console.log(point.lng());
        // The inactive version of the direction info
        //html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here<\/a>';

        GEvent.addListener(marker, "click", function() {
			mainmarker = marker;
          marker.openInfoWindowHtml(html);
        });
        gmarkers.push(marker);
        htmls[i] = html;
        return marker;
      }

      // ===== request the directions =====
      function getDirections() {
        // ==== set the start and end locations ====
        var saddr = document.getElementById("saddr").value
        var daddr = document.getElementById("daddr").value
        gdir.load("from: "+saddr+" to: "+daddr);
      }
	  
	  function getDirectionsFromForm() {
        // ==== set the start and end locations ====
		var saddr = document.getElementById("Address").value + ',' + document.getElementById("City").value + ',' + document.getElementById("State").value + ',' + document.getElementById("Zipcode").value
        //var saddr = document.getElementById("saddr").value
        var daddr = document.getElementById("endaddress").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]);
      }


      // create the map
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(26.397467,-81.807958), 15);
	  
	var point = new GLatLng(26.397467,-81.807958);
	var marker = createMarker(point,'Bonita Community Health Centers','Bonita Community Health Centers')
	map.addOverlay(marker);
	//mainmarker.openInfoWindowHtml('Bonita Community Health Centers');
	//console.log(marker.getIcon().infoWindowAnchor);
	map.openInfoWindowHtml( marker.getLatLng(), 'Bonita Community Health Centers',{pixelOffset: new GSize(0,-32)});

      // === 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);
      });

    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

    // This Javascript is based on code provided by the
    // Community Church Javascript Team
    // http://www.bisphamchurch.org.uk/   
    // http://econym.org.uk/gmap/

    //]]>