// Version: 17-Jul-2009

function endsWith(string, str){
	return (string.match(str+"$")==str)
}

function loadGoogleCode()
{
	var myDomain = document.domain;

	if(endsWith(myDomain, "enilno.net") ){
		include("http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAXBeYXadgvH-P6qkSq6OAexSf1J0vHOVDFDehQd3DS-KKppNAzRQj0_dI-G8MXeqA_lq0A8yD1zUdXw");
	}else if(endsWith(myDomain, "businesscompleet.nl") ){
		//include("http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAQJSN_ZSGxPnoTUbvnzGydBRzNrPgOiAVGyt-xFz68qhfCBHfehTMJXgdpwvS3Sds_tXxl5gABgDh1g");
		include("http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAA9bEVGhpZA68-OJUVK2O-IBS-EAooULQh3V8I8XlJuELekJqubhSp4tLyszvAYWb4cg6ODM3uTvqd9g");
	}else{
		//include("http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAA2VK8LwgavZF8dWDk-R-LQxRXgsRBfBBlmn0JDjhCmbK6ACpTcBTu53Z7GajZosUX7UnszFBf4kSQ0A");
		include("http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAA9bEVGhpZA68-OJUVK2O-IBS-EAooULQh3V8I8XlJuELekJqubhSp4tLyszvAYWb4cg6ODM3uTvqd9g");
	}
}

loadGoogleCode();
	
function showAddress(address) {
	// Create a base icon for all of our markers that specifies the shadow, icon dimensions, etc.

	baseIcon = new GIcon();
	baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png"
	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.shadowSize = new GSize(37, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	baseIcon.infoShadowAnchor = new GPoint(18, 25);

	function createMarker(point, index){
		var Icon = new GIcon(baseIcon);
		Icon.image = "http://www.arachnesolutions.nl/map_marker.png";
		// Set up our GMarkerOptions object
		markerOptions = { icon:Icon };
		var marker = new GMarker(point, markerOptions);
		
		GEvent.addListener(marker, "click", function() {
		  marker.openInfoWindowHtml("<b>" + letter + "</b><br>" + address);
		});
		return marker;
	}
	
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("google_map"));
		map.addControl(new GSmallMapControl());
      	map.addControl(new GMapTypeControl());
      	map.addControl(new GOverviewMapControl());
		map.setMapType(G_HYBRID_MAP);
		var geocoder = new GClientGeocoder();
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					alert(address + " not found");
				} else {
					map.setCenter(point, 13);
					map.addOverlay(createMarker(point, 0));
				}
			}
		);
	}
  
}
