$(document).ready(function(){

	(function(){ // Append Google Map (Rebel House address) to page
      if (GBrowserIsCompatible()) {
		// Load Google Map
        var map = new GMap2(document.getElementById("google_map"));
		var address = "1068 Yonge St., Toronto, ON";
		
		if (location.getParams("address") != "") {
			var directionsPanel = document.getElementById("google_route");
			var directions = new GDirections(map, directionsPanel);
			directions.load("from: " + location.getParams("address") + " to: " + address);
		}

		var geocoder = new GClientGeocoder();
		geocoder.getLatLng(
			address,
			function(point) {
			  if (!point) {
				if (console) { console.log(address + " not found") };
			  } else {
				map.setCenter(point, 13);
				var marker = new GMarker(point);
				map.addOverlay(marker);
				marker.openInfoWindowHtml(
					"The Rebel House Pub: <br />" + address
				);
			  }
			}
		);
		map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
      }
	})();
	
}).unload(function(){
	GUnload(); // Unload Google Maps from DOM to reduce memory leaks...
})
