var geocoder1;
var directionDisplay1;
var directionsService = new google.maps.DirectionsService();
var map1;
function initialize1() {
directionsDisplay1 = new google.maps.DirectionsRenderer();
geocoder1 = new google.maps.Geocoder();
var startplace1 = new google.maps.LatLng(52.52340510, 13.41139990);
var myOptions1 = {
zoom:8,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
navigationControl: true,
navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR},
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('44.687184, 4.714328');
}
function codeAddress1(address) {
if (geocoder1) {
geocoder1.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map1.setCenter(results[0].geometry.location);
var infowindow = new google.maps.InfoWindow({
content: "44.687184, 4.714328"
});
var marker = new google.maps.Marker({
position: results[0].geometry.location,
title:"44.687184, 4.714328"
});
marker.setMap(map1);
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map1,marker);
});
} else {
alert("Could not find the start location. Please be more specific!");
}
});
}
}
function calcRoute1() {
var start = document.getElementById("fromAddress1").value;
var end = '44.687184, 4.714328';
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);
}
});
}