1 // Copyright (c) Guillaume Cottenceau and licensed under the Apache 2.0 License
4 document.getElementById("debugbox").innerHTML += new Date() + txt + "<br/>";
7 function getIcon(filename) {
8 return new google.maps.MarkerImage("images/" + filename + ".png",
9 new google.maps.Size(32, 32),
10 new google.maps.Point(0, 0),
11 new google.maps.Point(16, 32));
13 function getSelectedIcon(filename) {
14 return new google.maps.MarkerImage("images/" + filename + "h.png",
15 new google.maps.Size(32, 32),
16 new google.maps.Point(0, 0),
17 new google.maps.Point(16, 32));
20 function getShadow(filename) {
21 return new google.maps.MarkerImage("images/" + filename + "s.png",
22 new google.maps.Size(56, 32),
23 new google.maps.Point(0, 0),
24 new google.maps.Point(16, 32));
27 function getNameRegion(name, region) {
28 return region.length > 0 ? name + ", " + region : name;
32 function displayDirectionsMoreinfo(route, node) {
33 var total_distance = 0, total_duration = 0;
34 for (i = 0; i < route.legs.length; i++) {
35 total_distance += route.legs[i].distance.value;
36 total_duration += route.legs[i].duration.value;
38 total_distance = Math.round(total_distance / 1000.0);
39 var total_hours = parseInt(total_duration / 60.0 / 60.0);
40 var total_minutes = Math.round(total_duration / 60.0 - total_hours * 60);
41 if (total_hours > 0 && total_minutes < 10) {
42 total_minutes = '0' + total_minutes;
44 var base_sentence = total_hours == 0 ? '{1} km, about {2} minutes'
45 : '{1} km, about {3} hours and {2} minutes';
46 node.innerHTML = base_sentence.replace('{1}', total_distance)
47 .replace('{2}', total_minutes)
48 .replace('{3}', total_hours);