var map;

    var gdir;
    var geocoder = null;
    var addressMarker;

    function initialize() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("karte"));
        map.setCenter(new GLatLng(51.79302988585448,10.939249992370605), 6);
        var nuern = new GLatLng(49.453842594330716,11.07421875);
        var regen = new GLatLng(49.0018439179785,12.058868408203125);
        var quedl = new GLatLng(51.78270999291771,11.147003173828125);
        var magde = new GLatLng(52.12758693811187,11.636581420898438);
        var goerl = new GLatLng(51.15910750294231, 14.9908447265625);
        var braun = new GLatLng(52.260172775665936, 10.537948608398438);
	var eisen = new GLatLng(50.97875011071402, 10.32989501953125);
	var aache = new GLatLng(50.776201410685395, 6.084022521972656);
	var mannh = new GLatLng(49.49355263168322, 8.469772338867188);
	var bambe = new GLatLng(49.895076727488295, 10.8929443359375);
	var naumb = new GLatLng(51.24735726816753,9.164915084838867); 
	var roth = new GLatLng(49.37935536629627, 10.180892944335938);
	
	
	
        map.addOverlay(new GMarker(nuern));
        map.addOverlay(new GMarker(regen));
        map.addOverlay(new GMarker(quedl));
        map.addOverlay(new GMarker(magde));
        map.addOverlay(new GMarker(goerl));
        map.addOverlay(new GMarker(braun));
        map.addOverlay(new GMarker(eisen));
        map.addOverlay(new GMarker(aache));
        map.addOverlay(new GMarker(mannh));
        map.addOverlay(new GMarker(bambe));
        map.addOverlay(new GMarker(naumb));
        map.addOverlay(new GMarker(roth));
        
        
        map.setMapType(G_HYBRID_MAP);
        
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
	    map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(51.165691,10.451526),5);
	
        
        
        
              }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\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_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\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.");
	   
	}

	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}
	
	
	
	

