 
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
	var locale = 'nl';

    function initialize() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map_canvas"));
        gdir = new GDirections(map, document.getElementById("directions"));
		map.addControl(new GSmallMapControl());
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
		map.enableScrollWheelZoom();
		
		//Center punt van Kaart en zoomlevel
		map.setCenter(new GLatLng(53.09368, 6.68779), 9);

		//Marker met eigen icoontje
		pointOfInterest = new GLatLng(53.09368, 6.68779);
        var gtIcon = new GIcon(G_DEFAULT_ICON);
		gtIcon.iconSize = new GSize(60, 54);
        gtIcon.image = "http://www.hethotel.nl/zuidlaren/images/point.png";
        map.addOverlay(new GMarker(pointOfInterest, { icon:gtIcon }));


		function createMarker(point,html) {
	        var marker = new GMarker(point);
	        GEvent.addListener(marker, "click", function() {
          		marker.openInfoWindowHtml(html);
        	});
        		return marker;
      		}
		/* ALLE LOCATIES, 3 regels code staat voor 1 locatie */
		var point_verkeersparkassen = new GLatLng(52.96788, 6.53634);
      	var marker_verkeersparkassen = createMarker(point_verkeersparkassen,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Verkeerspark Assen</h1><br><a href="http://www.verkeersparkassen.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_verkeersparkassen);

		var point_emmen = new GLatLng(52.78460, 6.89565);
      	var marker_emmen = createMarker(point_emmen,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Dierenpark Emmen</h1><br><a href="http://www.dierenpark-emmen.nl" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_emmen);
		
		var point_oranje = new GLatLng(52.90921, 6.43975);
      	var marker_oranje = createMarker(point_oranje,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Speelstad Oranje</h1><br><a href="http://www.speelstadoranje.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_oranje);

		var point_tamboer = new GLatLng(52.72714, 6.47763);
      	var marker_tamboer = createMarker(point_tamboer,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>De Tamboer, Hoogeveen</h1><br><a href="http://www.detamboer.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_tamboer);

		var point_hunebedden = new GLatLng(52.94073, 6.83307);
      	var marker_hunebedden = createMarker(point_hunebedden,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Nationaal Hunebedden Museum</h1><br><a href="http://www.hunebedcentrum.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_hunebedden);

		var point_vangogh = new GLatLng(52.71608, 6.85004);
      	var marker_vangogh = createMarker(point_vangogh,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Van Gogh Huis</h1><br><a href="http://www.vangogh-drenthe.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_vangogh);

		var point_bioscoop = new GLatLng(52.72613, 6.47944);
      	var marker_bioscoop = createMarker(point_bioscoop,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Bioscoop Hoogeveen</h1><br><a href="http://www.movieunlimited.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_bioscoop);

		var point_podium = new GLatLng(52.72011, 6.47561);
      	var marker_podium = createMarker(point_podium,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Het Podium</h1><br><a href="http://www.hetpodium.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_podium);

		var point_delijst = new GLatLng(52.72011, 6.47561);
      	var marker_delijst = createMarker(point_delijst,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Café de Lijst</h1><br><a href="http://www.cafedelijst.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_delijst);

		var point_planetron = new GLatLng(52.82535, 6.36975);
      	var marker_planetron = createMarker(point_planetron,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Planetron Dwingeloo</h1><br><a href="http://www.planetron.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_planetron);

		var point_vliegveld = new GLatLng(52.73210, 6.51883);
      	var marker_vliegveld = createMarker(point_vliegveld,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Vliegveld Hoogeveen</h1><br><a href="http://www.vliegveldhoogeveen.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_vliegveld);

		var point_karting = new GLatLng(52.73586, 6.49057);
      	var marker_karting = createMarker(point_karting,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Indoor Karting Hoogeveen</h1><br><a href="http://www.kartinghoogeveen.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_karting);

		var point_thermen = new GLatLng(52.64787, 6.43002);
      	var marker_thermen = createMarker(point_thermen,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Thermen Holiday</h1><br><a href="http://www.thermenholiday.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_thermen);

		var point_westerbork = new GLatLng(52.92172, 6.57008);
      	var marker_westerbork = createMarker(point_westerbork,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Herinneringscentrum Kamp Westerbork</h1><br><a href="http://www.kampwesterbork.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_westerbork);

		var point_drenthsmuseum = new GLatLng(52.99311, 6.56380);
      	var marker_drenthsmuseum = createMarker(point_drenthsmuseum,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Drenths Museum</h1><br><a href="http://www.drentsmuseum.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_drenthsmuseum);

		var point_groningermuseum = new GLatLng(53.21211, 6.56576);
      	var marker_groningermuseum = createMarker(point_groningermuseum,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Groninger Museum</h1><br><a href="http://www.groningermuseum.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_groningermuseum);

		var point_martinitoren = new GLatLng(53.21873, 6.56768);
      	var marker_martinitoren = createMarker(point_martinitoren,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Martini Toren</h1><br><a href="http://www.martinistad.nl/groningen/martinitoren/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_martinitoren);
	
		var point_eurokart = new GLatLng(53.23763, 6.59364);
      	var marker_eurokart = createMarker(point_eurokart,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Euro Karting Groningen</h1><br><a href="http://www.euro-kartracing.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_eurokart);

		var point_zwemzuidlaren = new GLatLng(53.09003, 6.67967);
      	var marker_zwemzuidlaren = createMarker(point_zwemzuidlaren,'<div style="width:240px; font-family:Arial, Verdana; font-size:11px; color:#000000;"><h1>Subtropisch Zwemparadijs Zuidlaren</h1><br><a href="http://aqualaren.nl/" target="_blank">Bezoek de website</a></div>')
     	map.addOverlay(marker_zwemzuidlaren);
		
		/* EIND ALLE LOCATIES */
      }
    }
    
	//Routebeschrijving functie
    function setDirections(fromAddress, toAddress) {
        if ((fromAddress.toLowerCase().indexOf(',nl') == -1) || 
            (fromAddress.toLowerCase().indexOf(', nl') == -1))
            fromAddress += ", NL";
        if (fromAddress != '') {
            gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
        }
	}

	//Error outputs
    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);


	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}

function onGDirectionsLoad(){ 
	}
