// JavaScript Document
 <!-- key voor webworkers.nl -->
document.write('<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAW2u1ya97E9P2uRzHfVLIuhQ_lSRx_c5TOdKU-aXtC4cP3GffwxS3svWhlDiufsJjfqu8pE0V9qdU7A" type="text/javascript"></script>');
// Create a directions object and register a map and DIV to hold the 
// resulting computed directions
var map;
var directionsPanel;
var directions;

window.onload = function(e) {
	initialize_maps();	
}

window.onunload = function(e) {
	GUnload();
}

function initialize_maps() {
	if (document.getElementById("map_canvas")) {
		map = new GMap2(document.getElementById("map_canvas"));
		map.setMapType(G_SATELLITE_MAP);
		var customUI = map.getDefaultUI(); 
		customUI.controls.scalecontrol = false; 
		customUI.controls.menumaptypecontrol = false;
		customUI.controls.maptypecontrol = false;
		map.setUI(customUI);
		map.setCenter(new GLatLng(51.810829, 5.92472), 15);
		// Create our "tiny" marker icon
		var mapsIcon = new GIcon(G_DEFAULT_ICON);
		mapsIcon.image = "{$url}images/mapsIcon.png";
		mapsIcon.iconSize = new GSize(75, 25);
	
		//Set up our GMarkerOptions object
		markerOptions = { icon:mapsIcon };
		map.addOverlay(new GMarker(new GLatLng(51.810829, 5.92472), markerOptions));
	}
}

function setDirections() {
	if (document.getElementById("mainContent")) {
		var strAddress = document.getElementById("locatie_adres").value;
		var strCity = document.getElementById("locatie_plaats").value;
		var strZipcode = document.getElementById("locatie_postcode").value;
		if (strCity.length > 0 && strAddress.length > 0 && strZipcode.length > 0) {
			document.getElementById("mainContent").innerHTML = "";
			directionsPanel = document.getElementById("mainContent");
			directions = new GDirections(map, directionsPanel);
			directions.load("from: " + strAddress + ", " + strZipcode + " " + strCity + " to: Broekhuizerweg 5, 6983 BM Doesburg");
		} else {
			if (strZipcode.length == 0) {
				document.getElementById("locatie_postcode").style.borderColor = "#ff0000";
				document.getElementById("locatie_postcode").focus();
			} else {
				document.getElementById("locatie_postcode").style.borderColor = "#999999";
			}
			if (strCity.length == 0) {
				document.getElementById("locatie_plaats").style.borderColor = "#ff0000";
				document.getElementById("locatie_plaats").focus();
			} else {
				document.getElementById("locatie_plaats").style.borderColor = "#999999";
			}
			if (strAddress.length == 0) {
				document.getElementById("locatie_adres").style.borderColor = "#ff0000";
				document.getElementById("locatie_adres").focus();
			} else {
				document.getElementById("locatie_adres").style.borderColor = "#999999";
			}
		}
	}
}