    //<![CDATA[
      function createMarker(point,html) {
        var marker = new GMarker(point);
	var realHtml = "<div style='width:200px;height:70px;overflow:auto'>" + html + "</div>";

        GEvent.addListener(marker,"mouseover", function() {
          marker.openInfoWindowHtml(realHtml, {maxHeight:4});
        });        
        GEvent.addListener(marker,"mouseout", function() {
          marker.closeInfoWindow();
        });        
        
        return marker;
      }
      
      // === The basis of the arrow icon information ===
      var arrowIcon = new GIcon();
      arrowIcon.iconSize = new GSize(24,24);
      arrowIcon.shadowSize = new GSize(1,1);
      arrowIcon.iconAnchor = new GPoint(12,12);
      arrowIcon.infoWindowAnchor = new GPoint(0,0);
      
      // === Returns the bearing in degrees between two points. ===
      // North = 0, East = 90, South = 180, West = 270.
      var degreesPerRadian = 180.0 / Math.PI;
      function bearing( from, to ) {
        // See T. Vincenty, Survey Review, 23, No 176, p 88-93,1975.
        // Convert to radians.
        var lat1 = from.latRadians();
        var lon1 = from.lngRadians();
        var lat2 = to.latRadians();
        var lon2 = to.lngRadians();

        // Compute the angle.
        var angle = - Math.atan2( Math.sin( lon1 - lon2 ) * Math.cos( lat2 ), Math.cos( lat1 ) * Math.sin( lat2 ) - Math.sin( lat1 ) * Math.cos( lat2 ) * Math.cos( lon1 - lon2 ) );
        if ( angle < 0.0 )
	 angle  += Math.PI * 2.0;

        // And convert result to degrees.
        angle = angle * degreesPerRadian;
        angle = angle.toFixed(1);

        return angle;
      }
       
      // === A function to create the arrow head at the end of the polyline ===
      function arrowHead(map, points, html, golatlng, backlatlng) {
        // == obtain the bearing between the last two points
        var p1=points[points.length-1];
        var p2=points[points.length-2];
        var dir = bearing(p2,p1);
        // == round it to a multiple of 3 and cast out 120s
        var dir = Math.round(dir/3) * 3;
        while (dir >= 120) {dir -= 120;}
        // == use the corresponding triangle marker 
        arrowIcon.image = "http://www.google.com/intl/en_ALL/mapfiles/dir_"+dir+".png";
	var marker = new GMarker(p1, arrowIcon);
        map.addOverlay(marker);
        GEvent.addListener(marker,"mouseover", function() {
          marker.openInfoWindowHtml(html);
        });        
        GEvent.addListener(marker,"mouseout", function() {
          marker.closeInfoWindow();
        });        
        GEvent.addListener(marker,"click", function() {
          marker.closeInfoWindow();
	  map.setCenter(golatlng);
        });        
	var marker1 = new GMarker(golatlng);
	map.addOverlay(marker1);
        GEvent.addListener(marker1,"click", function() {
	  map.setCenter(backlatlng);
        });        
        GEvent.addListener(marker1,"mouseover", function() {
		marker1.openInfoWindow("Click to go back");
        });        
        GEvent.addListener(marker1,"mouseout", function() {
		marker1.closeInfoWindow();
        });        
	
      }
      
      // === A function to put arrow heads at intermediate points
      function midArrows(points) {
        for (var i=1; i < points.length-1; i++) {  
          var p1=points[i-1];
          var p2=points[i+1];
          var dir = bearing(p1,p2);
          // == round it to a multiple of 3 and cast out 120s
          var dir = Math.round(dir/3) * 3;
          while (dir >= 120) {dir -= 120;}
          // == use the corresponding triangle marker 
          arrowIcon.image = "http://www.google.com/intl/en_ALL/mapfiles/dir_"+dir+".png";
          map.addOverlay(new GMarker(points[i], arrowIcon));
        }
      }
      
    //]]>
