//<![CDATA[
function $(id){ if(id) return document.getElementById(id); }
function show(){ if(arguments.length > 0) show_hide(arguments, 'block'); }
function hide(){ if(arguments.length > 0) show_hide(arguments, 'none'); }
function show_hide(elements, state){ for(var i = elements.length; i--;) $(elements[i]).style.display = state; }
function load(){
	if(GBrowserIsCompatible()){
		var map = new GMap2($("map"));
		map.addControl(new GMapTypeControl());
		//map.addControl(new GSmallMapControl());
		map.addControl(new GLargeMapControl());
		route = new GDirections(map, $("dir"));
		var point = new GLatLng(51.396995, 7.183136);
		map.setCenter(point, 15);
		marker = new GMarker(point);
		var info="<img src='fileadmin/template/img/logo_gm.gif' width='150' height='31' border='0' style='position:relative; margin-bottom: 5px;' /><br /><!--strong>Altstadtklinik Hattingen GmbH</strong><br /-->Große Weilstr. 41<br />45525 Hattingen";
		map.addOverlay(marker);
		GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(info);});
		marker.openInfoWindowHtml(info);
	}
}
function router(start, end){
	marker.closeInfoWindow();
	route.load("from: " + start + " to: " + end, { "locale": "de" });
	hide('form'); show('dir');
}
function show_form(){
	hide('dir'); show('form');
}
function handleErrors(){
	hide('dir'); show('form');
	alert("Ihre Route konnte nicht berechnet werden. Bitte versuchen Sie es noch einmal oder geben Sie eine andere Adresse ein.");
}
//]]>
