  //<![CDATA[
 
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
 
    function load() {
	  try{
		  if (GBrowserIsCompatible() && document.getElementById("map") != null) {      
		  
			map = new GMap2(document.getElementById("map"));
			
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
	 
			geocoder = new GClientGeocoder();
			geocoder.setBaseCountryCode("de");
			showAddress("54.323643, 10.137896");
	 
			gdir = new GDirections(map, document.getElementById("directions"));
			GEvent.addListener(gdir, "load", onGDirectionsLoad);
			GEvent.addListener(gdir, "error", handleErrors);

			//clear textfield-value		
				document.getElementById("fromAddress").onclick=function(){
					if(document.getElementById("fromAddress").value=='Startadresse')
						document.getElementById("fromAddress").value='';	
				}
			//end: clear textfield-value
			
		  }
		 }
		 catch(e){}
	  
    }
	    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(new GLatLng(54.323643, 10.137896), 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              
            }
          }
        );
      }
    }

function createMarker(point,html) { 
         var marker = new GMarker(point, markerOptions); 
         GEvent.addListener(marker, "click", function() { 
           marker.openInfoWindowHtml(html); 
         }); 
         return marker; 
}
    
    function setDirections(fromAddress, toAddress, locale) {
     gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });			
				showForm2();
    }
	
	
	function showForm2(){		
			//clicking on submit-button -> show form2 and set value	
			if(document.getElementById("fromAddress").value!='Startadresse'){
				document.getElementsByName("search_route")[0].style.display='block';	//show form
				document.getElementById("saddr").value=""+document.getElementById("fromAddress").value;		//set value in form2					
			}		
	}
	
 
    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...
	}
 
 
	
	
 
    //]]>




//icon.image = "/img/haus.png"; 


   //Wenn Marker verschoben werden muss   
//function load() {
////				//Anfahrt Bayerischer Hof
////				//prüft, ob der Browser Google Maps darstellen kann
//				if (GBrowserIsCompatible() && document.getElementById("map") != null) {
//					// Create our "tiny" marker iconvar 
//					var tinyIcon = new GIcon();
//					tinyIcon.image = "/img/map01.gif";
//					//tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
//					tinyIcon.iconSize = new GSize(16, 16);
//					//tinyIcon.shadowSize = new GSize(18, 18);
//					tinyIcon.iconAnchor = new GPoint(8, 8);
//					tinyIcon.infoWindowAnchor = new GPoint(8, 8);
//					// Set up our GMarkerOptions object literalmarkerOptions = { icon:tinyIcon };
//					var bigIcon = new GIcon();
//					bigIcon.image = "/img/map02.gif";
//					//tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
//					bigIcon.iconSize = new GSize(23, 23);
//					//tinyIcon.shadowSize = new GSize(18, 18);
//					bigIcon.iconAnchor = new GPoint(11, 11);
//					bigIcon.infoWindowAnchor = new GPoint(11, 11);
//					
//					var map = new GMap2(document.getElementById("map"));
//					map.setCenter(new GLatLng(51.158348, 10.441211), 5, G_PHYSICAL_MAP);
//					map.addControl(new GSmallMapControl());
//					map.addControl(new GMapTypeControl());
//					map.removeMapType(G_HYBRID_MAP);
//					map.addMapType(G_PHYSICAL_MAP);
//					
//					// Set up our GMarkerOptions object literalmarkerOptions = { icon:tinyIcon };
//					function createMarker(point,html,icon) {
//					   var marker = new GMarker(point,icon);
//					   GEvent.addListener(marker, "click", function() {
//					   marker.openInfoWindowHtml(html);
//						});  return marker; 
//					 }
//
////Musterhauszentrum Hohenstein
//					var point = new GLatLng(48.327767, 9.332285);
//					var marker = createMarker(point, '<div><strong>Hohenstein-Oberstetten</strong><br /><br />Schw&ouml;rer Musterhauszentrum - Kreis Reutlingen<br />72531 Hohenstein-Oberstetten<br />Tel.: 0049 (0) 73 87 / 1 60 (werktags)<br />Tel.: 0049 (0) 73 87 / 16-314 (Sa. u. So)<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', bigIcon);
//					map.addOverlay(marker);
//					
////Königswetterhausen
//					var point = new GLatLng(52.293184, 13.607366);
//					var marker = createMarker(point, '<div><strong>K&ouml;nigs Wusterhausen</strong><br />BDF-Ausstellungsgel&auml;nde<br />Am Notteflie&szlig; 26+28<br />15711 K&ouml;nigs Wusterhausen<br />Tel.: 0049 (0) 33 75 / 29 48 12 oder / 29 48 11 / 29 53 17<br />Fax: 0049 (0) 33 75 / 29 48 10<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//
//					
////Berlin
//					var point = new GLatLng(52.538907, 13.453129);
//					var marker = createMarker(point, '<div><strong>Berlin - Prenzlauer Berg</strong><br /><br />Villa Desiree Plan 145.1 <br />Stedingerweg 3<br />10407 Berlin - Prenzlauer Berg<br />Tel.: 0049 (0) 30 / 42 80 54 85<br />Fax: 0049 (0) 30 / 42 80 54 87<br /><br /><br />Plan 481.2<br />Stedingerweg 1<br />10407 Berlin - Prenzlauer Berg<br />Tel.: 0049 (0) 30 / 42 02 33 97<br />Fax: 0049 (0) 30 / 42 02<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
////Suhr CH
//					var point = new GLatLng(47.374925, 8.083915);
//					var marker = createMarker(point, '<div><strong>Suhr (Schweiz)</strong><br />Home Expo Suhr<br />Bernstra&szlig;e Ost Nr. 46<br />CH - 5034 Suhr<br />Tel.: 0041 (0) 62 / 8 42 85 40<br />Fax: 0041 (0) 62 / 8 42 85 41<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
////Langenhagen
//					var point = new GLatLng(52.447342, 9.713391);
//					var marker = createMarker(point, '<div><strong>Langenhagen</strong><br />M&uuml;nchnerstra&szlig;e 25 c<br />Fertighaus-Welt Hannover am Flughafen<br />30855 Langenhagen<br />Tel.: 0049 (0) 5 11 / 4 75 47 52<br />Fax: 0049 (0) 5 11 / 4 75 47 56<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
////Buchholz
//					var point = new GLatLng(53.317697, 9.869485);
//					var marker = createMarker(point, '<div><strong>Buchholz in der Nordheide</strong><br />Mohnblumenring 3<br />21244 Buchholz in der Nordheide<br />Tel.: 0049 (0) 41 81 / 3 80 08 45<br />Fax: 0049 (0) 41 81 / 3 80 08 36<br />Navigationssystem:<br />Fasanenstieg an der B 75 (Baugebiet Kattenberg Nord) <br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
//					
////Stelle
//					var point = new GLatLng(53.389427, 10.077592);
//					var marker = createMarker(point, '<div><strong>Musterhauszentrum</strong><br />Zum Reiherhorst 16<br />Tel.: 0049 (0) 41 74 / 59 30 80<br />Fax: 0049 (0) 41 74 / 59 30 90<br />21435 Stelle<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
////Mühlheim-Kärlich		
//					var point = new GLatLng(50.395635, 7.524654);
//					var marker = createMarker(point, '<div><strong>Musterhauszentrum</strong><br />Industriestra&szlig;e 27<br />56218 M&uuml;lheim-K&auml;rlich<br />Tel.: 0049 (0) 26 30 / 28 85 oder 28 86<br />Fax: 0049 (0) 26 30 / 25 93<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//
////Estenfeld					
//					var point = new GLatLng(49.836096, 10.011817);
//					var marker = createMarker(point, '<div><strong>Musterhauszentrum - Gewerbegebiet</strong><br />Otto-Hahn-Stra&szlig;e 8<br />97230 Estenfeld<br />Tel.: 0049 (0) 93 05 / 7 17<br />Tel.: 0049 (0) 93 05 / 16 26<br />Fax: 0049 (0) 93 05 / 99 31 87<br /><br />Weitere Informationen und &Ouml;ffnungszeiten (Link)<br /><br />Anfahrt: </div>', tinyIcon);
//					map.addOverlay(marker);
//					
//				}		
//				if (GBrowserIsCompatible() && document.getElementById("map02") != null) {
//					// Create our "tiny" marker iconvar 
//					var bigIcon = new GIcon();
//					bigIcon.image = "/img/map02.gif";
//					//tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
//					bigIcon.iconSize = new GSize(23, 23);
//					//tinyIcon.shadowSize = new GSize(18, 18);
//					bigIcon.iconAnchor = new GPoint(11, 11);
//					bigIcon.infoWindowAnchor = new GPoint(11, 11);
//					
//					var map = new GMap2(document.getElementById("map02"));
//					map.setCenter(new GLatLng(48.327767, 9.332285), 8);
//					map.addControl(new GSmallMapControl());
//					map.addControl(new GMapTypeControl());
//					map.removeMapType(G_HYBRID_MAP);
//					map.addMapType(G_PHYSICAL_MAP);
//					
//					// Set up our GMarkerOptions object literalmarkerOptions = { icon:tinyIcon };
//					function createMarker(point,html,icon) {
//					   var marker = new GMarker(point,icon);
//					   GEvent.addListener(marker, "click", function() {
//					   marker.openInfoWindowHtml(html);
//						});  return marker; 
//					 }
//
////Musterhauszentrum Hohenstein
//					var point = new GLatLng(48.325958, 9.331250);
//					var marker = createMarker(point, '<div><strong>Schw&ouml;rerHaus KG Hauptsitz</strong><br />Hohenstein-Oberstetten</div>', bigIcon);
//					map.addOverlay(marker);
//
//				}
//   }
////   
    function unload() {
    	if(document.getElementById("map") != null)
    		GUnload();
    }
	
	
	
	
	