  		var directionDisplay;
  		var directionsService = new google.maps.DirectionsService();
  		var map;
    	var stepDisplay;
  		var markerArray = [];
 
	function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer({draggable: true
});
    var MobilCantu = new google.maps.LatLng(40.7371,15.8053);
    var myOptions = {
      zoom:7,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: MobilCantu
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var image = '/extension/ezwebin/design/ezwebin/images/logmap.png';
  	var myLatLng = new google.maps.LatLng(40.7371,15.8053);
  	var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image,
      zIndex:10
  	});
    directionsDisplay.setMap(map);
    stepDisplay = new google.maps.InfoWindow();
  }
  function calcRoute() {
    for (i = 0; i < markerArray.length; i++) {
      markerArray[i].setMap(null);
    }
    markerArray = [];
    var start = $("#partenza").val();
    var latlng = new google.maps.LatLng(40.7371,15.8053);
    var request = {
        origin:start, 
        destination:latlng,
        travelMode: google.maps.DirectionsTravelMode.DRIVING,
        unitSystem: google.maps.UnitSystem.METRIC,
        waypoints: [ ]
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
      var warnings = document.getElementById("warnings_panel");
	    warnings.innerHTML = "<b>" + response.routes[0].warnings + "</b>";
        directionsDisplay.setDirections(response);
        showSteps(response);
      }
    });
  }
  function showSteps(directionResult) {
    var myRoute = directionResult.routes[0].legs[0];
    for (var i = 0; i < myRoute.steps.length; i++) {
      var marker = new google.maps.Marker({
        position: myRoute.steps[i].start_point, 
        map: map,
        zIndex:5
      });
      attachInstructionText(marker, myRoute.steps[i].instructions);
      markerArray[i] = marker;
    }
  }
  function attachInstructionText(marker, text) {
    google.maps.event.addListener(marker, 'click', function() {
      stepDisplay.setContent(text);
      stepDisplay.open(map, marker);
    });
  }
