//<![CDATA[

    // Check to see if this browser can run the Google API

      var gmarkers = [];
      var htmls = [];
      var to_htmls = [];
      var from_htmls = [];
      var i=0;

      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
		var tinyIcon = new GIcon();
    	tinyIcon.image = "images/mm_20_brown.png";
    	tinyIcon.shadow = "images/mm_20_shadow.png";
    	tinyIcon.iconSize = new GSize(12, 20);
    	tinyIcon.shadowSize = new GSize(22, 20);
    	tinyIcon.iconAnchor = new GPoint(6, 20);
    	tinyIcon.infoWindowAnchor = new GPoint(5, 1);
		
        var marker = new GMarker(point, {icon:tinyIcon});

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<p class="mapbody"><strong>Get directions</strong>: <em>To here</em> - <a href="javascript:fromhere(' + i + ')" class="mapbodylink">From here</a>' +
           '<form action="http://maps.google.com/maps" method="get" target="_blank">Start address:<br>' +
           '<input type="text" name="saddr" id="saddr" value="" class="mapbodyformbox" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT" class="mapbody">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" +
           '"/></p>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<p class="mapbody"><strong>Get directions</strong>: <a href="javascript:tohere(' + i + ')" class="mapbodylink">To here</a> - <em>From here</em>' +
           '<form action="http://maps.google.com/maps" method="get"" target="_blank">End address:<br>' +
           '<input type="text" name="daddr" id="daddr" value="" class="mapbodyformbox" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT" class="mapbody">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" +
           '"/></p>';
        // The inactive version of the direction info
        html = html + '<p><strong>Get directions</strong>: <a href="javascript:tohere('+i+')" class="mapbodylink">To here</a> - <a href="javascript:fromhere('+i+')" class="mapbodylink">From here</a></p>';

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        gmarkers[i] = marker;
        htmls[i] = html;
        i++;
        return marker;
      }

      // functions that open the directions forms
      function tohere(i) {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }
      function fromhere(i) {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
      }

      // Display the map, with some controls and set the initial location
      function load() {
      if (GBrowserIsCompatible()) {

	  var map = new GMap2(document.getElementById("map"));
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(29.7668, -95.3706), 16);

      // Set up markers with info windows 

      var point = new GLatLng(29.7677,-95.3737);
      var marker = createMarker(point,'Deuce','<p class="mapbody"><span class="maptitle"><strong>Deuce Creative</strong><br>1518 Washington, Suite G<br>Houston, Texas 77007</span>')
      map.addOverlay(marker);
	  }
}
    //]]>
