function load() {
	if (GBrowserIsCompatible()) {
		var address = "Am Speicher XI 28217 Bremen";
		var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.iconSize = new GSize(20, 20);
	baseIcon.shadowSize = new GSize(80, 54);
	baseIcon.iconAnchor = new GPoint(19, 53);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	
		var info= '<div style="background-color:#fff;padding:2px;">'
				+ '<img src="/sites/all/themes/standard/img/logo_maps.gif" width="100"/><br />'
				+ '<div style="border-top:1px solid #ccc;padding-top:10px;margin-top:10px;color:#666">'
				+ 'grow Werbeagentur GmbH<br />Rembertistraße 32, 3. OG<br />'
				+ '28203 Bremen<br /><br />'
				+ '</div></div>';
		
		var map = new GMap2(document.getElementById("google-canvas"));

		var geocoder = new GClientGeocoder();
		
		var lat = geocoder.getLatLng(address, function(point){
			point = new GLatLng(53.079939, 8.818494);
			var konsul = new GLatLng(53.079939, 8.818494);
			var marker = new GMarker(point);
			
			map.setCenter(point,14);
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.addOverlay(marker);
			marker.openInfoWindowHtml(info);
			
			
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(info);
			});
			
			map.addOverlay(marker);
		});
		
		gdir = new GDirections(map, document.getElementById("directions"));
		
		GEvent.addListener(gdir, "error", handleErrors);
	}
}

function setDirections(fromAddress,fromPlace) {
	if (fromPlace == "") {
		from = fromAddress;
	} else {
		from = fromAddress + ", " + fromPlace; 
	}
	gdir.load("from: " + from + " to: 53.097477, 8.769257",
						{ "locale": "de_DE" });
}

function handleErrors(){
	 if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) {
		 alert("Es konnte keine passende Adresse gefunden werden. Möglicherweise ist die Adresse neu und noch nicht im Kartenmaterial enthalten oder die Adresse ist nicht präzise genug. Bitte geben Sie die Adresse im Format 'Straße Nr., Ort' ein.\nError code: " + gdir.getStatus().code);
	 }		 
	 else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) {
		 alert("Ihre Anfrage konnte leider nicht ausgeführt werden. Eine genauere Fehlerbeschreibung ist leider nicht verfügbar.\n Error code: " + gdir.getStatus().code);			
	 }
	 else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) {
		 alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
	 }
	 else if (gdir.getStatus().code == G_GEO_BAD_KEY) {
		 alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
	 }
	 else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) {
		 alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	 }
	 else {
		 alert("An unknown error occurred.");
	 }
}

