/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// These functions are used in conjunction with the Google Maps that have been added to the M&C Web Site during it's
// redesign and update in June 2007 by APC.  This file is included by each of the map_<office>.htm files and contains
// javascript functions common to each file.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// This function creates a red tear drop shaped marker and corresponding information window for the supplied point
// and address.
function createInfoMarker(point, address) {
    var marker = new GMarker(point);

    GEvent.addListener(marker, "click",function() {marker.openInfoWindowHtml(address);});
    return marker;
}

// This function displays all the Mardon Location markers on a Google Map as red tear drop shaped markers.  Each Marker
// is plotted using the Longitude and Latitude of each office address.  The map itself is centred on New Westminster which
// is approx. the centre of the region that allows all locations to be accurately shown.
function ShowAllMardonLocationsOnMap() {
  if (GBrowserIsCompatible())
  {
      // Variables for all the Mardon Location Addresses
      var strCambie = "Mardon Campbell<br/>3080 Cambie Street, Vancouver<br/>B.C. V5Z 2V9<br/>Phone: Phone: 604-876-3366     Fax: 604-876-1308"
      var strRichmond = "Mardon Campbell<br/>145-3900 Steveston Hwy, Richmond<br/>B.C. V7E 2K2<br/>Phone: 604-274-9971     Fax: 604-274-6501"
      var strWhiteRock = "Mardon Campbell<br/>Unit 10 - 3268 King George Hwy, Surrey<br/>B.C. V4P 1A5<br/>Phone: Phone: 604-542-0077     Fax: 604-542-0076"
      var strGarrison = "Mardon & Garrison<br/>139 - 3000 Lougheed Hwy, Coquitlam<br/>B.C. V3B 1C5<br/>Phone: Phone: 604-464-1933     Fax: 604-464-1533"
      var strGroup = "Mardon Group<br/>318 - 800 West Pender Street, Vancouver<br/>B.C. V6C 2V6<br/>Phone: Phone: 604-877-7762     Fax: 604-877-7763"

      var map = new GMap(document.getElementById("map"));
      map.addControl(new GLargeMapControl());					// Display the Large ZoomIn/ZoomOut controls
      map.addControl(new GMapTypeControl());					// Display the Map/Satellite/Hybrib controls

      map.centerAndZoom(new GPoint(-122.91,49.21), 7);			// Centre map on New Westminster and speficy appropriate Zoom 

      // Create a marker for M&C Cambie location
      var pointCambie = new GPoint(-123.115048, 49.258041);			// M&C Cambie Point on the map using the latitude and longitude coordinates of this address
      var marker = createInfoMarker(pointCambie, strCambie);			// Create a Red Tear Drop map marker
      map.addOverlay(marker);							// Add the marker to the map

      // Create a marker for M&C Richmond location
      var pointRichmond = new GPoint(-123.183209, 49.133800);			// M&C Cambie Point on the map using the latitude and longitude coordinates of this address
      var marker = createInfoMarker(pointRichmond, strRichmond);		// Create a Red Tear Drop map marker
      map.addOverlay(marker);							// Add the marker to the map

      // Create a marker for M&C White Rock location
      var pointWhiteRock = new GPoint(-122.813607, 49.061767);		// M&C White Rock Point on the map using the latitude and longitude coordinates of this address
      var marker = createInfoMarker(pointWhiteRock, strWhiteRock);		// Create a Red Tear Drop map marker
      map.addOverlay(marker);							// Add the marker to the map

      // Create a marker for M&Garrison location
      var pointGarrison = new GPoint(-122.768914, 49.264407);			// M&Garrison Point on the map using the latitude and longitude coordinates of this address
      var marker = createInfoMarker(pointGarrison, strGarrison );		// Create a Red Tear Drop map marker
      map.addOverlay(marker);							// Add the marker to the map

      // Create a marker for Mardon Group location
      var pointGroup = new GPoint(-123.115855, 49.285283);			// Mardon Group Point on the map using the latitude and longitude coordinates of this address
      var marker = createInfoMarker(pointGroup, strGroup);			// Create a Red Tear Drop map marker
      map.addOverlay(marker);							// Add the marker to the map
  }
}
