$(document).ready(function(){
	// BEGIN: External links
	$("a[href^='http']").attr('target', '_blank');
	// END: External links
	
	Cufon.replace('#content h1, #content h2, #pool-section h1, #pool-section p, #hockey-section h1, #hockey-section p');
});


function loadGoogleMap()
{
	if (GBrowserIsCompatible())
	{
		// If JavaScript is enabled, then we can give a height and width to the map div
		var mapObj = document.getElementById("map");
		mapObj.style.width="100%";
		mapObj.style.height="370px";
		
		var map = new GMap2(mapObj);
		// Find the address tag
		var address = document.getElementById("address");
		address.className = "hide";
		var address = '<address>' + address.innerHTML + '</address><form method="get" onsubmit="getDirections(); return false;"><p><label for="startFrom">Start Address:</label> <input type="text" id="startFrom" /> <input type="submit" id="submit" value="Go" /><kbd><abbr title="Example">ex.</abbr> 32 Main St Taunton, MA</kbd></p></form>';
		
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(41.84777001518392,-70.95054388046265), 13);
		
		// Place a marker in the center of the map and open the info window automatically
		var marker = new GMarker(map.getCenter());
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(address);
		});
		map.addOverlay(marker);
		marker.openInfoWindowHtml(address);
	}
}


function getDirections(address)
{
	if (document.getElementById('startFrom').value != '') window.open('http://maps.google.com/maps?saddr=' + document.getElementById('startFrom').value + '&daddr=325 Bedford Street Lakeville, MA 02347','Directions','');
}
