//<![CDATA[
function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("nc_map"));

   // Training Centre NCG
    var ncgtrainingcentre = new GLatLng(53.21511141666399,6.602075099945068)
    //Centre Netherlands
    var centerNL = new GLatLng( 52.0910828514,5.18219947815)

    // Training Centre Cadmatic
    var cadmatictrainingcentre = new GLatLng(60.43734209222607,22.2428297996521)
    //Centre Finland
    var centerFL = new GLatLng(65,25)
    
    //Centre Europe
    var centerEU = new GLatLng(57,10)
    
    //default view: Europe
	map.setCenter(centerEU, 3);

    //Add some control items.
	var mapControl = new GMapTypeControl();
	var bottomRightZoom = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(0,0));
	var bottomRightType = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(20,1));
	map.removeMapType(G_SATELLITE_MAP);
	map.addControl(new GMapTypeControl(), bottomRightType);
	map.addControl(new GSmallZoomControl (), bottomRightZoom);   
	map.enableScrollWheelZoom()

	// A TextualZoomControl is a GControl that displays textual "Zoom In"
	// and "Zoom Out" buttons (as opposed to the iconic buttons used in
	// Google Maps).
	// We define the function first
	function TextualZoomControl() {
	}
	// To "subclass" the GControl, we set the prototype object to
	// an instance of the GControl object
	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(map) {  
		var container = document.createElement("div");  
		
		var zoomNCGDiv = document.createElement("div");  
		this.setButtonStyle_(zoomNCGDiv);  
		container.appendChild(zoomNCGDiv);  
		zoomNCGDiv.appendChild(document.createTextNode("NCG"));
		GEvent.addDomListener(zoomNCGDiv , "click", function() {    
          map.setCenter(ncgtrainingcentre, 15);
		});  
		
		var zoomGNDiv = document.createElement("div");  
		this.setButtonStyle_(zoomGNDiv);  
		container.appendChild(zoomGNDiv);  
		zoomGNDiv.appendChild(document.createTextNode("Groningen"));
		GEvent.addDomListener(zoomGNDiv, "click", function() {    
          map.setCenter(ncgtrainingcentre, 11);
		});  
		
		var zoomNLDiv = document.createElement("div");  
		this.setButtonStyle_(zoomNLDiv);  
		container.appendChild(zoomNLDiv);  
		zoomNLDiv.appendChild(document.createTextNode("Netherlands"));
		GEvent.addDomListener(zoomNLDiv, "click", function() {    
          map.setCenter(centerNL, 6);
		});  
		
		var zoomCadDiv = document.createElement("div");  
		this.setButtonStyle_(zoomCadDiv);  
		container.appendChild(zoomCadDiv);  
		zoomCadDiv.appendChild(document.createTextNode("Cadmatic"));  
		GEvent.addDomListener(zoomCadDiv, "click", function() {    
          map.setCenter(cadmatictrainingcentre, 15);
		});  
		
		var zoomTKDiv = document.createElement("div");  
		this.setButtonStyle_(zoomTKDiv);  
		container.appendChild(zoomTKDiv);  
		zoomTKDiv.appendChild(document.createTextNode("Turku"));  
		GEvent.addDomListener(zoomTKDiv, "click", function() {    
          map.setCenter(cadmatictrainingcentre, 11);
		});  
		
		var zoomFLDiv = document.createElement("div");  
		this.setButtonStyle_(zoomFLDiv);  
		container.appendChild(zoomFLDiv);  
		zoomFLDiv.appendChild(document.createTextNode("Finland"));  
		GEvent.addDomListener(zoomFLDiv, "click", function() {    
          map.setCenter(centerFL, 4);
		});  
		
		var zoomEUDiv = document.createElement("div");  
		this.setButtonStyle_(zoomEUDiv);  
		container.appendChild(zoomEUDiv);  
		zoomEUDiv.appendChild(document.createTextNode("Europe"));  
		GEvent.addDomListener(zoomEUDiv, "click", function() {    
          map.setCenter(cadmatictrainingcentre, 3);
		});  
		
		map.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.color = "#000000";  
	  button.style.backgroundColor = "lightblue";  
	  button.style.font = "x-small Arial";  
	  button.style.border = "1px solid #C0C0C0";  
	  button.style.padding = "2px";  
	  button.style.marginBottom = "1px";  
	  button.style.textAlign = "center";  
	  button.style.width = "6em";  
	  button.style.cursor = "pointer";
	}



    // Creates a marker at the given point with the given number label
    function createMarker(point, html) {
	// Create our "tiny" marker icon
	var tinyIcon = new GIcon();
	tinyIcon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
	tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	tinyIcon.iconSize = new GSize(12, 20);
	tinyIcon.shadowSize = new GSize(22, 20);
	tinyIcon.iconAnchor = new GPoint(6, 20);
	tinyIcon.infoWindowAnchor = new GPoint(5, 1);
	// Set up our GMarkerOptions object literal
	markerOptions = { icon:tinyIcon };      
	
	var marker = new GMarker(point, markerOptions);
      GEvent.addListener(marker, "click", function() {

//            marker.openInfoWindowHtml(html);
        marker.openInfoWindowTabsHtml(html, 'image');
      });
      return marker;
    }

    var infoTabsNCG = [
      new GInfoWindowTab("Centre", "<font face='Arial' size='3' color='#012E72'><b>NCG Training Centre<br></b></font><br><img src='../../images/training/CiGGoogleMaps.jpg' height='120' width='180' />"),
      new GInfoWindowTab("Address", "<font face='Arial' size='3' color='#012E72'><b>NCG Training Centre<br></b></font><table align='left' class='koristeltu_taulukko' id='table8' style='border-width: 0' ><font size='2' color='#000000' face='Arial'><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>Osloweg 110, 3<sup>rd</sup> Floor</font></td></tr><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>9723 BX Groningen</font></td></tr><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>The Netherlands</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Sales:</font></td><td><font size='2' color='#000000' face='Arial'>+31 (0)50 57 53 985</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Telephone:</font></td><td><font size='2' color='#000000' face='Arial'>+31 (0)50 57 53 980</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Fax:</font></td><td><font size='2' color='#000000' face='Arial'>+31 (0)50 57 53 981</font></td></tr></font></table>")
    ];

    var infoTabsCAD = [
      new GInfoWindowTab("Centre", "<font face='Arial' size='3' color='#012E72'><b>Cadmatic Training Centre<br></b></font><br><img src='../../images/training/CadmaticGoogleMaps.jpg' height='120' width='180' />"),
      new GInfoWindowTab("Address", "<font face='Arial' size='3' color='#012E72'><b>Cadmatic Training Centre<br></b></font><table align='left' class='koristeltu_taulukko' id='table8' style='border-width: 0' ><font size='2' color='#000000' face='Arial'><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>Itäinen Rantakatu 72</font></td></tr><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>20810 Turku</font></td></tr><tr><td colspan='2'><font size='2' color='#000000' face='Arial'>Finland</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Sales:</font></td><td><font size='2' color='#000000' face='Arial'>+358-2-412 411</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Telephone:</font></td><td><font size='2' color='#000000' face='Arial'>+358-2-412 411</font></td></tr><tr><td width='70'><font size='2' color='#000000' face='Arial'>Fax:</font></td><td><font size='2' color='#000000' face='Arial'>+358-2-412 4444</font></td></tr></font></table>")
    ];

	map.addControl(new TextualZoomControl());
    map.addOverlay(createMarker(ncgtrainingcentre, infoTabsNCG));
    map.addOverlay(createMarker(cadmatictrainingcentre, infoTabsCAD));
  }
}
//]]>


