//function ZoomOut(map3) {
//	var center = new  GLatLng(49.24, -123.04);
//	map3.setCenter(center, 11);
//alert(1);
//	}
//	
//	function ZoomIn(map3) {
//	if (map3.getZoom() < 16) {
//		map3.setZoom(16);
//	} else {
//		map3.zoomIn();
//	}
//}


function load() 
{

  if (GBrowserIsCompatible()) 
  {
  	
  		function createMarker(point, number, icontype) {
		  var marker = new GMarker(point, icontype);
		  var rmd_address = '<b>A-POWER RICHMOND</b><br />#1038-2560 Shell Rd, Richmond BC V6X0B8<br />Tel: 604-273-8868 &nbsp;&nbsp; Fax: 888-879-5053<br />';
	  	  var bby_address = '<b>A-POWER BURNABY</b><br />4448 E.Hastings St, Burnaby BC V5C2K2<br />Tel: 604-570-0766 &nbsp;&nbsp; Fax: 888-879-5053<br />';
	  	  var warehouse_address = '<b>A-POWER WAREHOUSE</b><br />#1038 - 2560 Shell Road (Building A), Richmond BC V6X0B8<br />Tel:	604-273-5667 &nbsp;&nbsp; Fax: 888-879-5053<br />';
			
	  	  if (number == 1) {
	  	  	var info = rmd_address;
	  	  	
	  	  } else if (number == 2) {
	  	  	var info = bby_address;
	  	  } else if (number == 4) {
	  	  	var info = warehouse_address;
	  	  }
	  	  
		  GEvent.addListener(marker, "click", function() {
		    marker.openInfoWindowHtml(info);
		    map3.setCenter(point, 14);
		  });
       	  
		  return marker;
		}
  	
  	
  		// A TextualZoomControl is a GControl that displays textual "Zoom In"
		// and "Zoom Out" buttons (as opposed to the iconic buttons used in
		// Google Maps).
		function TextualZoomControl() {
		}
		TextualZoomControl.prototype = new GControl();
		
		// Creates a one DIV for each of the buttons and places them in a container
		// DIV which is returned as our control element. We add the control to
		// to the map container and return the element for the map class to
		// position properly.
		TextualZoomControl.prototype.initialize = function(map3) {
		  var container = document.createElement("div");
		
		  var zoomOutDiv = document.createElement("div");
		  this.setButtonStyle_(zoomOutDiv);
		  container.appendChild(zoomOutDiv);
		  zoomOutDiv.appendChild(document.createTextNode("Show All Locations"));
		  GEvent.addDomListener(zoomOutDiv, "click", function() {
		    map3.returnToSavedPosition();
		    map3.closeInfoWindow();
		  });
		
		  map3.getContainer().appendChild(container);
		  return container;
		}
		
		// By default, the control will appear in the top left corner of the
		// map with 7 pixels of padding.
		TextualZoomControl.prototype.getDefaultPosition = function() {
		  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
		}
		
		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle_ = function(button) {
		  button.style.textDecoration = "underline";
		  button.style.color = "#000000";
		  button.style.backgroundColor = "white";
		  button.style.font = "11px Arial bold";
		  button.style.border = "1px solid black";
		  button.style.padding = "2px";
		  button.style.marginBottom = "3px";
		  button.style.textAlign = "center";
		  button.style.width = "6em";
		  button.style.cursor = "pointer";
		  button.style.marginLeft = "22";
		}
  	
  	
  	
  	
  		var rmd  = new GLatLng(49.1948,-123.10245);
  		var bby  = new GLatLng(49.280866,-123.004271);	
  		var warehouse = new GLatLng(49.1948,-123.10245);
  		var center = new  GLatLng(49.24, -123.04);
  		
  		var richmondIcon = new GIcon();
	      richmondIcon.image = "skin1/images/gicon_richmond.png";
	      richmondIcon.shadow = "skin1/images/gicon_shadow.png";
	      richmondIcon.iconSize = new GSize(41, 45);
	      richmondIcon.shadowSize = new GSize(41, 45);
	      richmondIcon.iconAnchor = new GPoint(13, 45);
	      richmondIcon.infoWindowAnchor = new GPoint(13, 10);
	      
	    var warehouseIcon = new GIcon();
	      warehouseIcon.image = "skin1/images/gicon_richmond.png";
	      warehouseIcon.shadow = "skin1/images/gicon_shadow.png";
	      warehouseIcon.iconSize = new GSize(41, 45);
	      warehouseIcon.shadowSize = new GSize(41, 45);
	      warehouseIcon.iconAnchor = new GPoint(13, 45);
	      warehouseIcon.infoWindowAnchor = new GPoint(13, 10);
	      
	    var burnabyIcon = new GIcon();
	      burnabyIcon.image = "skin1/images/gicon_burnaby.png";
	      burnabyIcon.shadow = "skin1/images/gicon_shadow.png";
	      burnabyIcon.iconSize = new GSize(41, 45);
	      burnabyIcon.shadowSize = new GSize(41, 45);
	      burnabyIcon.iconAnchor = new GPoint(13, 45);
	      burnabyIcon.infoWindowAnchor = new GPoint(13, 10);
  		
		var map1 = new GMap2(document.getElementById("map1"));
		map1.setCenter(rmd, 14);		
		map1.addControl(new GSmallZoomControl ());
		map1.addControl(new GMapTypeControl  ());
      	map1.addOverlay(new GMarker(rmd));
      	

		var map2 = new GMap2(document.getElementById("map2"));
		map2.setCenter(bby, 13);
		map2.addControl(new GMapTypeControl  ());
		map2.addControl(new GSmallZoomControl ());
      	map2.addOverlay(new GMarker(bby));
      	
      	
      	var map4 = new GMap2(document.getElementById("map4"));
      	map4.setCenter(warehouse, 14);
      	map4.addControl(new GSmallZoomControl ());
      	map4.addControl(new GMapTypeControl ());
      	map4.addOverlay(new GMarker(warehouse));
      	
      	
      	var map3 = new GMap2(document.getElementById("map3"));
      	map3.addControl(new TextualZoomControl());
		map3.setCenter(center, 11);
		map3.savePosition();
		map3.addControl(new GMapTypeControl  ());
		map3.addControl(new GSmallZoomControl ());
//		map3.addControl(new GLargeMapControl ());
      	map3.addOverlay(createMarker(rmd, 1, richmondIcon));
      	map3.addOverlay(createMarker(bby, 2, burnabyIcon));
//      	map3.addOverlay(createMarker(warehouse, 4, richmondIcon));      	
  }
}


