    
	var pcZwartsluis  = "8064 XC";
	var pcSteenbergen = "4651 SJ";
	
	var vanPostcode   = pcSteenbergen;
	var monteurNaam;
	var eilandText	  = '';
	var eilandText_   = '<span style="font-size:12px;line-height:10px;">Voor de Waddeneilanden wordt een extra toeslag in rekening gebracht</span>'
	
//Peter  (17- Texel; 88- Vlieland/Terschelling; 91- Ameland
	var arPeter	=	new Array(10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 36, 37, 38, 39, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99)
//Erwin
	var arErwin	=	new Array(20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69)
	
	
function initialize() {
      if (GBrowserIsCompatible()) 
      {	gdir = new GDirections();
        GEvent.addListener(gdir,"load", set_distance); 
      }
    }
    
	
	
function setDirections(toAddress, locale) {
	var mntErwin;
		for(i = 0; i < arErwin.length; i++){
			if (toAddress.substr(0,2) == arErwin[i]) {
				mntErwin = true;
				if (toAddress.substr(0,2) == 17 || toAddress.substr(0,2) == 88 || toAddress.substr(0,2) == 91){
					eilandText = eilandText_;
				}else {
					eilandText = '';
				}
			}
		}
			if (mntErwin) {
				vanPostcode = pcSteenbergen;
				monteurNaam = 'Edwin';
			}else {
				vanPostcode = pcZwartsluis;
				monteurNaam = 'Peter';
			}
		 gdir.load("from: " + vanPostcode + " to: " + toAddress, {locale: locale, travelMode:G_TRAVEL_MODE_DRIVING, avoidHighways: false} );
   	}
	
		
		
	function  checkMonteur() {
			// var kilometers = gdir.getDistance().meters / 1000;
			// alert('kilometers: ' + kilometers = 'Postcode: ' + toAddress)
		}	
		



    function set_distance() {
    	handleErrors(); 
    	document.getElementById("afstand").innerHTML = "<strong>De afstand is:</strong> " + gdir.getDistance().html; 
	
	var kilometers = gdir.getDistance().meters / 1000;
	var kmHoogTarief 	= 65;	//	> 100km
	var kmMiddenTarief 	= 55;	//	55 - 100km	
	var kmLaagTarief 	= 35; 	//  < 35km
	var kmRegioTarief 	= 15; 	//  < 15km
	
	var kmTarief;
	var laagHoog;
			
	if (kilometers < 10) {
		kmTarief = kmRegioTarief;
		laagHoog = "kmRegioTarief";
	}else{
	if (kilometers < 35) {
		kmTarief = kmLaagTarief;
		laagHoog = "kmLaagTarief";
		}
	else {
		if (kilometers >65) {
			kmTarief = kmHoogTarief;
			laagHoog = "kmHoogTarief";
		}
		else {
	 		kmTarief = kmMiddenTarief;
			laagHoog = "kmMiddenTarief";
	 	}
	}	
}
	 
	//document.getElementById("prijs").innerHTML = "<strong>De voorrijkosten zijn : </strong>"  + Math.floor(kmTarief) + " Euro"; 
	document.getElementById("prijs").innerHTML = "<strong>De voorrijkosten zijn : </strong>"  + kmTarief + " Euro" + ' <br/> ' +eilandText; 
	 
	  
    }
    
  function handleErrors()
  {
  // http://code.google.com/apis/maps/documentation/reference.html#GGeoStatusCode
   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 || gdir.getStatus().code == G_GEO_MISSING_ADDRESS)
     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 if (gdir.getStatus().code == G_GEO_UNAVAILABLE_ADDRESS)
     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
   else if (gdir.getStatus().code == G_GEO_UNKNOWN_DIRECTIONS)
     alert("The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region.\n Error code: " + gdir.getStatus().code);     
   else if (gdir.getStatus().code == G_GEO_TOO_MANY_QUERIES)
     alert("The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time.\n Error code: " + gdir.getStatus().code);     
    }