// Bob's Rod & Tackle :: Google Maps API for Contact Page
var gmarker = '';
function createMarker() {
		var point = new GLatLng(41.4251992, -72.1102309);
        var marker = new GMarker(point);
		var html = '<div style="width:240px"><b style="font-size:12px;">Bob\'s Rod & Tackle<\/b><br>50 Norwich Road (RT 32)<br>Quaker Hill, CT 06375<br>(860) 439-1213'+
				   '<br><br><a href="javascript:tohere()"><b>&raquo; Get Directions to Bob\'s Rod & Tackle<\/b><\/a><\/div>';
		
		GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
		
		marker.openInfoWindowHtml(html);
		
        return marker;
}

function loadMap() {
  var map = new GMap2(document.getElementById("map"));

  map.setCenter(new GLatLng(41.4258172, -72.1102309), 16);
  map.addControl(new GSmallMapControl());
  
  map.addMapType(G_HYBRID_MAP);
  map.setMapType(G_HYBRID_MAP);
  
  var marker = createMarker();
  gmarker = marker;
  map.addOverlay(marker);
  
  map.addControl(new ContextMenuControl());
}

function tohere() {
	var html = '<div style="width:260px"><b style="font-size:12px;">Bob\'s Rod & Tackle<\/b><br>50 Norwich Road (RT 32)<br>Quaker Hill, CT 06375<br>(860) 439-1213';
	var to_html = html + '<br><br><b>&raquo; Get Directions to Bob\'s Rod & Tackle<\/b>' +
           '<br><br>Start Address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" SIZE=36 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions &raquo;" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="41.4251992,-72.1102309"/><\/div>';
   gmarker.openInfoWindowHtml(to_html);
}