var html;
var to_html;
var from_html;
	  
	  function addDirections(point){

	  html = '<div id="basicDir">Directions: <a href="javascript:tohere()">To here<\/a> - <a href="javascript:fromhere()">From here<\/a><br/><br/></div>';
	  
	  // The info window version with the "to here" form open
      to_html = '<div id="toDir">Directions: <b>To here<\/b> - <a href="javascript:fromhere()">From here<\/a>' +
         '<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
         '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
         '<INPUT value="Get Directions" TYPE="SUBMIT">' +
         '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                // "(" + name + ")" + 
         '"/></form></div>';
		 
      // The info window version with the "to here" form open
      from_html = '<div id="fromDir">Directions: <a href="javascript:tohere()">To here<\/a> - <b>From here<\/b>' +
         '<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
         '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
         '<INPUT value="Get Directions" TYPE="SUBMIT">' +
         '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                // "(" + name + ")" + 
         '"/></form></div>';
		 
	  html = html + to_html + from_html;
		
      return html;
    }

    // functions that open the directions forms
    function tohere() {
      document.getElementById("basicDir").style.display = "none";
	  document.getElementById("toDir").style.display = "block";
	  document.getElementById("fromDir").style.display = "none";
    }
    function fromhere() {
      document.getElementById("fromDir").style.display = "block";
	  document.getElementById("basicDir").style.display = "none";
	  document.getElementById("toDir").style.display = "none";
    }
