//<![CDATA[ 
		
var map;
var mapScale = 10;
var pathImage = "";
var points = [];
var gmarkers = [];
var to_htmls = [];
var from_htmls = [];

//document.onunload = GUnload;

function loadMap() {
  if (GBrowserIsCompatible()) {
	
	var marker;
	
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	

	
	                       
	
	for( i=0; i < points.length; i++ ) {
		
		points[i][2] = '<a href="http://maps.google.com/maps?q='+points[i][3] + ' ' + points[i][4] + ' ' + points[i][5] + '  ' + points[i][6]+'" target="_blank">' + points[i][2] + '</a><br><br>' + points[i][3] + '<br>' + points[i][4] + ', ' + points[i][5] + '  ' + points[i][6] + '<br>'+ points[i][7] +'<br><br>Navigate: <a href="#" onclick="javascript:map.setZoom(map.getZoom()+1);">Zoom In</a> - <a href="#" onclick="javascript:map.setZoom(map.getZoom()-1);">Zoom Out</a>';
		
		if( i == 0 ) {
			map.setCenter(new GLatLng(points[i][0], points[i][1]), mapScale);
		}
		to_htmls[i] = points[i][2] + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
		   '<br><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="' + points[i][3] + ',' + points[i][4] + ',' + points[i][5] + '+' + points[i][6] + 
		   '@' + points[i][0] + ',' + points[i][1] +
				  // "(" + name + ")" + 
		   '"/>';
		
		// The info window version with the "to here" form open
		from_htmls[i] = points[i][2] + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
		   '<br><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="' + points[i][3] + ',' + points[i][4] + ',' + points[i][5] + '+' + points[i][6] + 
		   '@' + points[i][0] + ',' + points[i][1] +
				  // "(" + name + ")" + 
		   '"/>';
		
		// The inactive version of the direction info
		points[i][2] += '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';


		marker = createMarker(new GLatLng(points[i][0], points[i][1]), points[i][2]);
		map.addOverlay(marker);
		gmarkers[i] = marker;
		
	}
  }
}

function createMarker(point, html) {

    var icon = new GIcon();
	
	icon.iconSize = new GSize(24, 24);
	icon.shadowSize = new GSize(32, 30);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	icon.image = pathImage;
	
  var marker = new GMarker(point, icon);
  GEvent.addListener(marker, "mouseover", function() {
	marker.openInfoWindowHtml(html);
	marker.showMapBlowup
  });
  return marker;
}

function myclick(i) {
if( gmarkers[i] )
	gmarkers[i].openInfoWindowHtml(points[i][2]);
}


function tohere(i) {
gmarkers[i].openInfoWindowHtml(to_htmls[i]);
}
function fromhere(i) {
gmarkers[i].openInfoWindowHtml(from_htmls[i]);
}



//]]>