/*

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: January 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(42.941252, -70.838013);                       // The location of interest (latitude, longitude)
    var marker = new GMarker(point);

    // Add things
    switch (page) {
      case "contact":
        map.setCenter(point, 16);                                         // 17 is the maximum zoom
        map.addControl(new GSmallMapControl());                           // Compact pan/zoom controls
        break;
      case "directions":
        map.setCenter(point, 6);
        map.addControl(new GLargeMapControl());                           // 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())

  }
}
