<!--
 
function createMarkerMontagepunt(point, html, id, tav, address, postal, city, rembours) {

	var img_base_path = "../../images/";

	//set up the icon
	var icon = new GIcon(point);
	if(rembours==1){
		//icon.image = img_base_path+"pointer_zw.png";
		icon.image = img_base_path+"pointer.png";
	}else{
		icon.image = img_base_path+"pointer.png";
	}
	icon.shadow = img_base_path+"pointer_schaduw.png";

	icon.iconSize = new GSize(30, 21);
	icon.shadowSize = new GSize(30, 21);
	icon.iconAnchor = new GPoint(9, 10);
	icon.infoWindowAnchor = new GPoint(12, 1);

	//create the marker
	var marker = new GMarker(point,{ draggable: false, icon: icon });

	//info window
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
		//target the form field with the data
		document.getElementById('order_montage_id').value=id;
		document.getElementById('order_montage_tav').value=tav;
		document.getElementById('order_montage_address').value=address;
		document.getElementById('order_montage_postal').value=postal;
		document.getElementById('order_montage_city').value=city;
		
		document.getElementById('order_montage_id').readOnly=true;
		document.getElementById('order_montage_tav').readOnly=true;
		document.getElementById('order_montage_address').readOnly=true;
		document.getElementById('order_montage_postal').readOnly=true;
		document.getElementById('order_montage_city').readOnly=true;
		
		//enable the radio button order_payment1 (only if rembours is supported)
		if(rembours==1){
			if(document.getElementById('order_payment1')){
				document.getElementById('order_payment1').disabled=false;
			}
		}else{
			if(document.getElementById('order_payment1')){
				document.getElementById('order_payment1').disabled=true;
			}
		}

	});

	return marker;
}
//same as above, but without the target of the text fields
function createMarkerMontagepunt2(point, html, rembours) {

	var img_base_path = "http://www.bandendeal.nl/images/";

	//set up the icon
	var icon = new GIcon(point);
	//icon.image = img_base_path+"pointer.png";
	if(rembours==1){
		icon.image = img_base_path+"pointer.png";
	}else{
		icon.image = img_base_path+"pointer_g.png";
	}
	icon.shadow = img_base_path+"pointer_schaduw.png";
	icon.iconSize = new GSize(30, 21);
	icon.shadowSize = new GSize(30, 21);
	icon.iconAnchor = new GPoint(9, 10);
	icon.infoWindowAnchor = new GPoint(12, 1);

	//create the marker
	var marker = new GMarker(point,{ draggable: false, icon: icon });

	//info window
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});

	return marker;
}

function createMarker(point, index, tekst, col) {

	var img_base_path = "http://3dClearEarth.nl/images/google/";

	var baseIcon = new GIcon(point);
	baseIcon.shadow = img_base_path+"klant_schaduw.png";
	baseIcon.iconSize = new GSize(17, 31);
	baseIcon.shadowSize = new GSize(33, 31);
	baseIcon.iconAnchor = new GPoint(8, 28); // dit was > 9,34
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	baseIcon.infoShadowAnchor = new GPoint(18, 25);
	//baseIcon.enableDragging();
	//Create a lettered icon for this point using our icon class
	//var letter = String.fromCharCode("A".charCodeAt(0) + index);
	var icon = new GIcon(baseIcon);
	if(col){
		var img = "klant_"+col+".png";
	}else{
		var img = "klant.png";
	}
	icon.image = img_base_path+""+img;
	var marker = new GMarker(point,{ draggable: false, icon: icon });//{ draggable: true }
	GEvent.addListener(marker, "dragend", function() {
		ditPunt=marker.getPoint();//marker.location
		document.getElementById(latitudeField).value = ditPunt.lat();
		document.getElementById(longitudeField).value = ditPunt.lng();
	});
	return marker;
}

function fetchCoordinates() {
	/* here you should not change anything  */
	var gRequest = null;
	var postalcode = document.getElementById(postalCodeField).value;
	var city = document.getElementById(cityField).value;
	var street = document.getElementById(streetField).value;
	if(document.getElementById(countryField)){
		var country = document.getElementById(countryField).value;
	}else{
		var country = 'The Netherlands';
	}
 
	if(country == '' ) {//postalcode == '' || city == '' || street == '' || 
		/* you can change the error message here */
		alert("Please fill in the country fields first");
	}else if(postalcode == '' && (city == '' || street == '')){
		alert ("Please fill in the adress fields first");
	}else {
		var gRequest = "http://maps.google.com/maps/geo?q=" +street+ "+" +postalcode+ "+" +city+ "+" +country+ "&callback=getCoordinates&output=JSON&key="+apiKey;
		var scriptObj = document.createElement("script");
		scriptObj.setAttribute("type", "text/javascript");
		scriptObj.setAttribute("src", gRequest);
		document.getElementsByTagName("head").item(0).appendChild(scriptObj);
	}
}


function getCoordinates(data) {
	switch(data.Status.code) {
		case 610:
			/* you can change the error message here */
			alert("Api key not valid:"+apiKey);
			break;
		case 603:
		case 602:
		case 601:
		case 500:
			/* you can change the error message here */
			alert("Cannot get coordinates for this address");
			break;
		case 200:
			document.getElementById(latitudeField).value = data.Placemark[0].Point.coordinates[1];
			document.getElementById(longitudeField).value = data.Placemark[0].Point.coordinates[0];
			var point = new GLatLng(data.Placemark[0].Point.coordinates[1],data.Placemark[0].Point.coordinates[0]);

			//clear all existing overlays !
			map.clearOverlays();

			//add new overlay with given coordinates
			map.addOverlay(createMarker(point, 100, "test","orange"));

        	if (map.getZoom()<zoomLevel) {
				zoom= zoomLevel;
			}else{
				zoom=map.getZoom();
			}
			map.setCenter(point, zoom);
			//alert ('test');
			break;
	}
}


function showAddress(address, field) {
	if (geocoder) {
		var cityField;
		if(field!='')
		{
			cityField = field;
		}
		else
		{
			cityField = 'order_client_city';
		}
		var city = document.getElementById(cityField).value;
		var address = city;

		geocoder.getLatLng(
			address,
			function(point) {
				if (point) {
					map.setCenter(point, 10);
				}
			}
		);
	}
}

//-->