function toonLocatie(adres) {

	var address = adres + ", nl";

	// Create new geocoding object
	var geocoder = new GClientGeocoder();
	
	// Retrieve location information, pass it to addToMap()
	geocoder.getLocations(address, addToMap);	
	
	showMapPopup('map_popup');
}

// Creates a marker at the given point with the given number label
function createMarker(point) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {

    var target = place.address
    
    var th = '<h3>' + vestiging + '</h3>';
    var text = '<table border=0><tr><td width=200px><UL>' + th + '<br>' + target + '</UL>';

    //Toevoegen routeplanner
    text = text + 'Route per auto: geef <u>de cijfers van uw postcode</u> of <u>het adres (straat, woonplaats)</u> van uw vertrekpunt:<br><br>';
    text = text + '<form action="http://maps.google.nl/maps"\n\
                   method="get"" target="_blank"><input type="text" SIZE=40 MAXLENGTH=40\n\
                   name="saddr" id="saddr" value="" />';
    text = text + '<br><br><INPUT value="Toon route" \n\
                   TYPE="SUBMIT"><input type="hidden" name="daddr" value="' + point + "(" + vestiging + ")" + '"/><br><br>';
    text = text + '</td>';
    //alert(text);

    marker.openInfoWindowHtml(text);
    });
	return marker;
}

function addToMap(response)
{

	var map = new GMap2(document.getElementById("map"));	
 
	// Retrieve the object
	place = response.Placemark[0];
	
	// Retrieve the latitude and longitude
	point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
	
	// Center the map on this point
	//map.setCenter(point, 15, G_HYBRID_MAP);
	map.setCenter(point, 15);


	// Create marker icon
	//var icon = new GIcon();
	//icon.image = "http://www.mooipurmerend.nl/images/gmarker.png";
	//icon.iconSize = new GSize(20, 20);
	//icon.iconAnchor = new GPoint(6, 20);
	//icon.infoWindowAnchor = new GPoint(5, 1);
	//map.addOverlay(createMarker(point, icon));



	// Add the marker to map
    map.addOverlay(createMarker(point));
	//map.addOverlay(new GMarker(point));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
}
