/*

File: map.js
Purpose: To display an interactive map via the Google Maps API.  Maps parameters
  may be changed to better suit a given page.
Author: Ryan Brady
Last modified: February 2007
Requirements:
  - An appropriate Google Maps API key (<http://www.google.com/apis/maps/>)
    referenced in the <head> element via the <script> element.
    e.g. <script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAZNSIv8IPbJFRrnJ88f9_HRRb8bYYKBEcWdJlhNIas_q2wA_mkBSk-oi0VpLtWrJvW1NmipmO59FYAw"></script>
  - onload() and onunload() events in the <body> tag.  The GUnload() function is
    handled by Google.
    e.g., <body onload="loadMap('pagename');" onunload="GUnload();">
Arguements:
  - page: The web page calling the loadMap() function.  Pass from the <body>'s
    onload() event.

*/



function loadMap(page) {

  if (GBrowserIsCompatible()) {

    // Variables
    var map = new GMap2(document.getElementById("google_map"));
    var point = new GLatLng(43.186501, -70.873819);                             // The location of interest (latitude, longitude)
    var marker = new GMarker(point);

    // Add things
    switch (page) {

      case "worship_time_and_directions":
        map.setCenter(point, 14);                                               // 17 is the maximum zoom
        map.addControl(new GSmallMapControl());                                 // Compact pan/zoom controls
        //map.addControl(new GLargeMapControl());                               // Large pan/zoom, re-center and scale tick-marks
        //map.addControl(new GMapTypeControl());                                // Display-type controls (map, satellite, hybrid)
        break;

    }
    
    map.addOverlay(marker);                                                     // Mark the location with a red marker (This line must be after map.setCenter())

  }
}
