/* Google Maps */
//<![CDATA[
var map = null;
var geocoder = null;
var directionsPanel;
var directions;
function load(adres, html, icon) {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("googleMap"));
	geocoder = new GClientGeocoder();
	map.addControl(new GLargeMapControl());
	showAddress(adres, html, icon);
	}
}

function showAddress(address, html, icon) {
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
        map.setCenter(point, 14);
        /* Custom Icon */
        var myIcon = new GIcon();
		myIcon.image = icon;
		myIcon.iconSize = new GSize(50,35);
		myIcon.shadowSize = new GSize(50,35);
		myIcon.iconAnchor = new GPoint(0,0);
		myIcon.infoWindowAnchor = new GPoint(15,0);
		myIcon.imageMap = [29,0,29,1,29,2,29,3,29,4,29,5,29,6,29,7,29,8,29,9,29,10,29,11,29,12,29,13,29,14,29,15,29,16,29,17,29,18,22,19,22,20,22,21,21,22,21,23,21,24,20,25,20,26,20,27,19,28,19,29,19,30,18,31,18,32,7,32,7,31,7,30,7,29,6,28,6,27,6,26,5,25,5,24,5,23,4,22,4,21,4,20,3,19,3,18,3,17,3,16,2,15,2,14,2,13,1,12,1,11,1,10,0,9,0,8,0,7,0,6,17,5,21,4,22,3,23,2,23,1,24,0];
        var markerOptions = {icon:myIcon, draggable: false};
        /* Custom Icon afgelopen */
        var marker = new GMarker(point, markerOptions);        
        map.addOverlay(marker);
        marker.openInfoWindowHtml(html);
      }
    }
  );
}
function getDirections(adres) {
	locale = "nl";
	from = document.getElementById('vertrek').value;
	directionsPanel = document.getElementById("googleRoute");
	directionsPanel.innerHTML = "";
	directions = new GDirections(map, directionsPanel);
	directions.load("from: "+from+" to: "+adres+"",{"locale":locale});
}
//]]>
