      function popup(w,h,site) {
        x = screen.availWidth/2-w/2;
        y = screen.availHeight/2-h/2;
        window.open(
            ''+site+'','','width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
      }
	  
      var map;
      var gdir;
      var geocoder = null;
      var toAddress = 'Greizer Str. 8, 07570 Weida, DE';
      var map;

      function addAddressToMap(response) {
      	map.clearOverlays();
      	
      	if (!response || response.Status.code != 200) {
      		$("#error_message").html("Wir konnten Ihre Adresse leider nicht finden.").show();
      	} else {
      		place = response.Placemark[0];
      		point = new GLatLng(place.Point.coordinates[1],
      		place.Point.coordinates[0]);
      		map.setCenter(point, 15);

      		marker = new GMarker(point);
      		map.addOverlay(marker);
      		marker.openInfoWindowHtml('<div style="width: 290px; height: 110px;">' +
      		'<img title="Unsere Praxis" src="thumbs/Unternehmen/aussen.jpg" style="float: left; margin-right: 10px"/><br />' +
      		'<b>Stefan Kl&ouml;pfel</b><br />' +
      		'<b>Moto-Shop Kl&ouml;pfel</b><br />' +
      		'Greizer Str. 8<br />' + 
      		'07570 Weida</div>');
      	}
      }

      function showLocation(address) {
      	geocoder.getLocations(address, addAddressToMap);
      }

      function setDirections(fromAddress) {
    	
      	$("#error_message").hide();
      	map.clearOverlays();
      	
      	gdir = new GDirections(map, document.getElementById("directions"));
      	GEvent.addListener(gdir, "error", handleErrors);

      	gdir.load("from: " + fromAddress + " to: " + "Weida, Greizer Str. 8", { "locale": "de" });
      }

      function handleErrors(){
    	showLocation(toAddress);
    	$("#error_message").html("Wir konnten Ihre Adresse leider nicht finden. Eventuell ist Ihre Adrese zu neu oder inkorrekt geschrieben.").show();
      	$("#fromAddress").val("");
      	
      }
