var icons = { main: new google.maps.MarkerImage( 'http://maps.google.com/mapfiles/marker.png', // (width,height) new google.maps.Size( 24, 38 ), // The origin point (x,y) new google.maps.Point( 0, 0 ), // The anchor point (x,y) new google.maps.Point( 12, 38 ) ), start: new google.maps.MarkerImage( 'http://maps.gstatic.com/mapfiles/markers2/icon_greenA.png', // (width,height) new google.maps.Size( 24, 38 ), // The origin point (x,y) new google.maps.Point( 0, 0 ), // The anchor point (x,y) new google.maps.Point( 12, 38 ) ), end: new google.maps.MarkerImage( // URL 'http://maps.gstatic.com/mapfiles/markers2/icon_greenB.png', // (width,height) new google.maps.Size( 24, 38 ), // The origin point (x,y) new google.maps.Point( 0, 0 ), // The anchor point (x,y) new google.maps.Point( 12, 38 ) ) }; var geocoder1; var directionDisplay1; var directionsService = new google.maps.DirectionsService(); var map1; var marker1; if(typeof map_type_1 === "undefined" || '' == map_type_1) { var a_map_type = 'ROADMAP'; } else { var a_map_type = map_type_1; } if(typeof zoom_control_1 === "undefined" || 'NONE' == zoom_control_1 || '' == zoom_control_1) { var a_zoom_control = false; var a_zoom_control_style = 'SMALL'; } else { var a_zoom_control = true; var a_zoom_control_style = zoom_control_1; } if(typeof pan_control_1 === "undefined" || 'true' == pan_control_1) { var a_pan_control = true; } else { var a_pan_control = false; } if(typeof type_control_1 === "undefined" || 'NONE' == type_control_1 || '' == type_control_1) { var a_type_control = false; var a_type_control_style = 'DEFAULT '; } else { var a_type_control = true; var a_type_control_style = type_control_1; } function initialize1() { directionsDisplay1 = new google.maps.DirectionsRenderer({suppressMarkers: true}); geocoder1 = new google.maps.Geocoder(); var startplace1 = new google.maps.LatLng(52.52340510, 13.41139990); var myOptions1 = { zoom: zoom_1, disableDefaultUI: true, mapTypeId: google.maps.MapTypeId[a_map_type], zoomControl: a_zoom_control, zoomControlOptions: { style: google.maps.ZoomControlStyle[a_zoom_control_style] }, panControl: a_pan_control, mapTypeControl: a_type_control, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle[a_type_control_style]}, center: startplace1 } map1 = new google.maps.Map(document.getElementById("map_canvas1"), myOptions1); directionsDisplay1.setMap(map1); directionsDisplay1.setPanel(document.getElementById("map_directions1")); google.maps.NavigationControlStyle.SMALL; codeAddress1(destination_1); } function codeAddress1(address) { if (geocoder1) { geocoder1.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map1.setCenter(results[0].geometry.location); if(typeof alt_destination_1 === "undefined") { var infowindow1 = new google.maps.InfoWindow({ content: destination_1 }); marker1 = new google.maps.Marker({ position: results[0].geometry.location, icon: icons.main, title: destination_1 }); } else { var infowindow1 = new google.maps.InfoWindow({ content: alt_destination_1 }); marker1 = new google.maps.Marker({ position: results[0].geometry.location, icon: icons.main, title: alt_destination_1 }); } marker1.setMap(map1); google.maps.event.addListener(marker1, 'click', function() { infowindow1.open(map1,marker1); }); } else { alert("Could not find the target location. Please be more specific!"); } }); } } function calcRoute1() { var start = document.getElementById("fromAddress1").value; var end = destination_1; var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(result, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay1.setDirections(result); marker1.setMap(null); var leg = result.routes[0].legs[0]; makeMarker( leg.start_location, icons.start, start ); makeMarker( leg.end_location, icons.end, end ); } }); } function makeMarker( position, icon, title ) { new google.maps.Marker({ position: position, map: map1, icon: icon, title: title }); }