function redirectToGoogleMaps(from,to) {
		mapsFenster = window.open("http://maps.google.de/maps?daddr="+to+"&geocode=&dirflg=&saddr="+from+"&f=d&t=m", "GoogleMaps", "width=800,height=600,left=100,top=200");
		mapsFenster.focus();
		}
		
var map;
var gdir;
var geocoder = null;
var addressMarker;
var p_markerArr;
var mmgr;
        
		
	function initialize() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map_canvas"));
		
		map.setCenter(new GLatLng(51.211306, 10.473297), 9);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
		
		map.addMapType(G_PHYSICAL_MAP);
		map.setMapType(G_PHYSICAL_MAP);
		
		geocoder = new GClientGeocoder();
		p_markerArr = new Array();
		
		var juettnerIcon = new GIcon(G_DEFAULT_ICON);
		juettnerIcon.image = "http://www.juettner24.de/img/juettnerMarker.png";
		
		showAddressGeo(51.210965, 10.473263,"descMhl1",juettnerIcon,0);
		showAddressGeo(51.210237, 10.461354,"descMhl2",juettnerIcon,1);
		
		showAddressGeo(51.027133, 11.513743,"descApl1",juettnerIcon,2);
		showAddressGeo(51.011109, 11.513071,"descApl2",juettnerIcon,3);
		
		showAddressGeo(51.105783, 10.641923,"descBls1",juettnerIcon,4);
		showAddressGeo(51.155307, 10.832642,"descBte1",juettnerIcon,5);
		showAddressGeo(51.493779, 10.438765,"descBisch1",juettnerIcon,6);
		showAddressGeo(51.442378, 10.567383,"descBlei1",juettnerIcon,7);
		
		//showAddressGeo(50.865628, 12.856495,"descRoehr1",juettnerIcon,8);
		showAddressGeo(51.513194, 10.256258,"descDuder1",juettnerIcon,9);
		showAddressGeo(50.97534, 10.32537,"descEisen1",juettnerIcon,10);
		showAddressGeo(50.978278, 11.034256,"descErfurt1",juettnerIcon,11);
		showAddressGeo(50.990844, 11.012213,"descErfurt2",juettnerIcon,12);
		showAddressGeo(51.423914, 10.361272,"descWorbis1",juettnerIcon,13);
		
		showAddressGeo(51.377462, 10.138379,"descHeili1",juettnerIcon,14);
		showAddressGeo(51.387537, 10.320419,"descLeine1",juettnerIcon,15);
		showAddressGeo(51.506671, 10.78489,"descNdh1",juettnerIcon,16);
		showAddressGeo(51.502144, 10.794706,"descNdh2",juettnerIcon,17);
		//showAddressGeo(51.505595, 10.794903,"descNdh3",juettnerIcon,18);
		showAddressGeo(51.37028, 10.865917,"descSdh1",juettnerIcon,19);
		showAddressGeo(50.971309, 11.022334,"descErfurt3",juettnerIcon,20);
		
		showAddressGeo(50.88237, 10.50035,"descTab1",juettnerIcon,21);
		
		
		mmgr = new GMarkerManager(map);
		mmgr.addMarkers(p_markerArr,0,17);
		mmgr.refresh();
      }
    }	
	
    function setDirections(fromAddress, toAddress, locale) {
	  //die direction funktion ersteinmal deaktiviert
	  errorRedirect("");
	  
	  //$('#map_canvas').width(250);
	  //map.checkResize();
      //gdir.load("from: " + fromAddress + " to: " + toAddress,                { "locale": locale });
				
    }

    function handleErrors(){
	   //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);
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	    errorRedirect("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)
	     errorRedirect("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);
		 //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 errorRedirect("An unknown error occurred.");
	   
	}

	function errorRedirect(error) {
		$('#map_canvas').width(490);
		
		MeinFenster = window.open("http://maps.google.de/maps?daddr="+$('#toAddress').val()+"&geocode=&dirflg=&saddr="+$('#fromAddress').val()+"&f=d&ie=UTF8&t=m", "GoogleMaps", "width=800,height=600,left=100,top=200");
		MeinFenster.focus();
		//MeinFenster = window.open("http://maps.google.de/maps?daddr=Bahnstra%C3%9Fe,+99752+Lipprechterode&geocode=&dirflg=&saddr=hannover&f=d&sll=51.458994,10.559788&sspn=0.009559,0.019312&ie=UTF8&t=h&z=11", "GoogleMaps", "width=800,height=600,left=100,top=200");
		}
	
	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...
	}
	
	function findMarkerFromId(id) {
		for(var i=0; i<p_markerArr.length; i++)
		{
			if(p_markerArr[i].id == id) {
				return p_markerArr[i];
				}
			}
		}

		
	function setMarkerManager()
	{
	  for(var i=0; i<p_markerArr.length; i++)
	  {
	     mmgr.addMarker(p_markerArr[i],0,17);
	  }
	  
	  mmgr.refresh();
	  
	  return mmgr;
	}  
	
	function showAddressGeo(la,lo,e,cIcon,id) {
      
		markerOptions = { icon:cIcon };
        var marker = new GMarker(new GLatLng(la, lo), markerOptions	);
        GEvent.addListener(marker, "click", function() {
			
			var eId      = $(e);
			var copyE    = eId.cloneNode(true);
			copyE.show();
			
			
			marker.openInfoWindow(copyE);
		});
		
		marker.id = id;
		p_markerArr.push(marker);
		
    }
	
	function showAddress(address,htmlInfo) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              //alert(address + " not found");
            } else {
              //map.setCenter(point, 13);
			  //map.setCenter(point, 11);
              var marker = new GMarker(point);
              GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(htmlInfo);
				});
			  map.addOverlay(marker);
			  
            }
          }
        );
		
      }
    }

	function showAddressLog(address,htmlInfo) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              //alert(address + " not found");
            } else {
              //map.setCenter(point, 13);
			  //map.setCenter(point, 11);
              var marker = new GMarker(point);
              GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(htmlInfo);
				});
			  map.addOverlay(marker);
			  console.log(point);
            }
          }
        );
		
      }
    }

	function centerAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 11);
            }
          }
        );
		
      }
    }	
