// Benötigte Variablen
// latDestination
// lngDestination
// mapZoomLevel
// mapMarker
// addressDestination

 var directionDisplay;
  var directionsService;
  var map;

  function initialize() {


    directionsDisplay = new google.maps.DirectionsRenderer();
    directionsService = new google.maps.DirectionsService();
    console.log("Lat: " + latDestination + " - Long: " + lngDestination);
    console.log("ZoomLevel: " + mapZoomLevel);
    console.log("Maptype: " + google.maps.MapTypeId.SATELLITE);
      
    var wpgermany = new google.maps.LatLng(latDestination, lngDestination);
    var myOptions = {
      zoom:mapZoomLevel,
      center: wpgermany,
      mapTypeId: google.maps.MapTypeId.ROADMAP
      
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    directionsDisplay.setMap(map);
    directionsDisplay.setPanel(document.getElementById("directionsPanel"));


    var image = mapMarker;
    var beachMarker = new google.maps.Marker({
        position: wpgermany,
        map: map,
        icon: image
    });


  }


  function calcRoute() {

    var start = document.getElementById("start").value;

    //var end = document.getElementById("end").value;
    var end = latDestination + " " + lngDestination;



    var request = {
        origin:start,
        destination:end,
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };

    directionsService.route(request, function(response, status) {

      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);

      }
    });


  }

