 if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("gam"));
    map.setCenter(new GLatLng(41.058300,-71.933250), 12);
	map.addControl(new GLargeMapControl());
	map.addControl(new GScaleControl());
	map.addControl(new GMapTypeControl());

	var markers_visible = true;

	var gosmans_html_src = "<a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=GOSDR'><b>Gosman's Dock</b></a><br><font size='1'>484 West Lake Dr.</font><div align='left'><ul><li><a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=GOSDR'>Gosman's Restaurant</a> - 631-668-5330</li><li><a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=TOPSIDE'>Topside Restaurant</a> - 631-668-2549 x2</li><li><a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=TOPSIDE'>Inlet Café & Sushi Bar</a>- 631-668-2549 x2</li><li><a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=TOPSIDE'>Clam Bar</a> - 631-668-2549 x3</li><li><a href='/cgibin/tracker.cgi?url=http://www.gosmans.com/%3FAID=GOSFM'>Fish Market</a> - 631-668-5645</li></ul></div>";

	var icon_gosmans = new GIcon();
	icon_gosmans.image = "/_images/map_icon_gosmans.png";
	icon_gosmans.shadow = "/_images/map_icon_gosmans_shadow.png";
	icon_gosmans.iconSize = new GSize(50, 33);
	icon_gosmans.shadowSize = new GSize(72, 33);
	icon_gosmans.iconAnchor = new GPoint(50, 34);
	icon_gosmans.infoWindowAnchor = new GPoint(40, 33);

	var opts = new Object(); 
	opts.title = "Gosman's Dock";
	opts.icon = icon_gosmans;

	var marker_gosmans = new GMarker(new GLatLng(41.075550, -71.938100), opts);
	map.addOverlay(marker_gosmans);

	GEvent.addListener(marker_gosmans, "click", function() {

		marker_gosmans.openInfoWindowHtml(gosmans_html_src);
	});

	var mplh_html_src = "<a href='/cgibin/tracker.cgi?url=http://www.MontaukLighthouse.com'><b>Montauk Point Lighthouse</b></a><br><font size='1'>2000 Montauk Hwy.</font><div align='left'><ul><li><a href='/cgibin/tracker.cgi?url=http://www.MontaukLighthouse.com'>Museum</a> - 631-668-2544 x1</li><li><a href='/cgibin/tracker.cgi?url=http://www.MontaukLighthouse.com'>Gift Shop</a> - 631-668-2544 x2</li></ul></div>";

	var icon_mplh = new GIcon();
	icon_mplh.image = "/_images/map_icon_lighthouse.png";
	icon_mplh.shadow = "/_images/map_icon_lighthouse_shadow.png";
	icon_mplh.iconSize = new GSize(14, 53);
	icon_mplh.shadowSize = new GSize(50, 51);
	icon_mplh.iconAnchor = new GPoint(7, 53);
	icon_mplh.infoWindowAnchor = new GPoint(7, 6);

	var opts = new Object(); 
	opts.title = 'Montauk Point Lighthouse';
	opts.icon = icon_mplh;

	var marker_mplh = new GMarker(new GLatLng(41.0709, -71.8573), opts);
	map.addOverlay(marker_mplh);

	GEvent.addListener(marker_mplh, "click", function() {

		marker_mplh.openInfoWindowHtml(mplh_html_src);
	});


	var village_html_src = '<b>Montauk Village Area</b> <div align="left"> <ul> <li><strong><a href="/cgibin/tracker.cgi?url=http://www.MontaukBikeShop.com">Montauk Bike Shop</a></strong><br/> <font size="1">725A Montauk Hwy. - 631-668-8975</font></li> <li><a href="/cgibin/tracker.cgi?url=http://www.kaikaisandal.com"><strong>Kai Kai Sandals</strong></a><br/> <font size="1">771 Montauk Hwy. - 631-668-4499</font></li> <li><a href="/cgibin/tracker.cgi?url=http://www.montauksands.com"><strong>Sands Motel</strong></a><br/> <font size="1">701 Montauk Hwy. - 631-668-5100</font></li> <li><a href="/cgibin/tracker.cgi?url=http://www.oceanresortinn.com"><strong>Ocean Resort Inn</strong></a><br/> <font size="1">95 S. Emerson Ave. - 631-668-2300</font></li> <li><a href="/cgibin/tracker.cgi?url=http://www.marshallandsons.com"><strong>SHELL Service Station</strong></a><br/> <font size="1">701 Montauk Hwy. - 631-668-2990</font></li><li><a href="/cgibin/tracker.cgi?url=http://www.montaukmotel.com"><strong>Oceanside Beach Resort</strong></a><br/> <font size="1">626 Montauk Hwy. - 631-668-9825</font></li></ul></div>';

	var icon_village = new GIcon();
	icon_village.image = "/_images/map_icon_village.png";
	icon_village.shadow = "/_images/map_icon_village_shadow.png";
	icon_village.iconSize = new GSize(61, 60);
	icon_village.shadowSize = new GSize(86, 61);
	icon_village.iconAnchor = new GPoint(15, 58);
	icon_village.infoWindowAnchor = new GPoint(40, 40);

	var opts = new Object(); 
	opts.title = 'Montauk Village Area';
	opts.icon = icon_village;

	var marker_village = new GMarker(new GLatLng(41.034700, -71.944250), opts);
	map.addOverlay(marker_village);

	GEvent.addListener(marker_village, "click", function() {

		marker_village.openInfoWindowHtml(village_html_src);
	});
  }				   
  else{ alert('Sorry, your browser is not compatible.\nPlease upgrade your browser and try again.'); }
  

function toggle_markers () {

 if (GBrowserIsCompatible()) {

	var toggle_control = document.getElementById('toggle_markers');

	if(typeof(toggle_control) != 'undefined'){

		toggle_control.disabled = true;

		// hide the markers if unchecked

		if(toggle_control.checked == false){

			map.removeOverlay(marker_gosmans);
			map.removeOverlay(marker_mplh);
			map.removeOverlay(marker_village);
			markers_visible = false;
		}
		// -OR- show the markers if checked
		else{
			if(markers_visible == false){
				map.addOverlay(marker_gosmans);
				map.addOverlay(marker_mplh);
				map.addOverlay(marker_village);
				markers_visible = true;
			}
		}
		toggle_control.disabled = false;
	}
  }
}

function createMarker(point, html) {
  var marker = new GMarker(point);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
  });
  return marker;
}







