//<![CDATA[

    if (GBrowserIsCompatible()) {
      // this variable will collect the html which will eventually be placed in the GMapSidebar
      var GMapSidebar_html = "";
    
      // arrays to hold copies of the markers and html used by the GMapSidebar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      // 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);

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<font size=2><br>Directions: <b>To here</b></font> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
           '<form action="http://maps.google.com/maps" method="get" target="_blank">Start address: <font size=1>e.g., "1009 Craven Street, Beaufort, SC 29902"</font><br>' +
           '<input type="text" SIZE=30 MAXLENGTH=40 name="saddr" id="saddr" value="" />' +
           '<INPUT value="Go" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                  // "(" + name + ")" + 
           '"/>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<font size=2><br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>:</font>' +
           '<form action="http://maps.google.com/maps" method="get"" target="_blank">End address: <font size=1>e.g., "166 Church Street, Charleston, SC 29401"</font><br>' +
           '<input type="text" SIZE=30 MAXLENGTH=40 name="daddr" id="daddr" value="" />' +
           '<INPUT value="Go" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" + 
           '"/>';
        // The inactive version of the direction info
        html = html + '<br>Directions: <a href="javascript:tohere('+i+')"><font size=2>To here</font></a> - <a href="javascript:fromhere('+i+')"><font size=2>From here</font></a>';

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        // save the info we need to use later for the GMapSidebar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the GMapSidebar html
        GMapSidebar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
        i++;
        return marker;
      }


      // 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]);
		//map.setCenter(new GLatLng(32.782501000000003,-79.931792000000002), 15);
      }
      function fromhere(i) {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
		//map.setCenter(new GLatLng(32.782501000000003,-79.931792000000002), 15);
      }

	 function show_map(){
		  // create the map
		  var map = new GMap2(document.getElementById("map"));
		  map.addControl(new GLargeMapControl());
		  map.addControl(new GMapTypeControl());
		  var point = new GLatLng(32.43266,-80.67304);
		  map.setCenter(point, 15);
		  html = '<font size=2><b>Rhett House Inn</b><br>1009 Craven Street <br>Beaufort, SC - 29902 <br>Phone: (843) 524.9030</font>';
		  var marker = createMarker(point,'KCI',html);
		  map.addOverlay(marker);
		  GEvent.trigger(marker,'click');
		  map.setCenter(point, 15);
	  }

    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/

    //]]>