--- a/src/main/resources/scripts/map.js Thu Aug 25 13:13:58 2011 -0400
+++ b/src/main/resources/scripts/map.js Thu Aug 25 13:58:35 2011 -0400
@@ -95,11 +95,31 @@
function updateStats(workout) {
var list = document.getElementById('stats').getElementsByTagName('ul')[0];
- list.getElementsByClassName('date').getElementsByTagName('span').innerHTML = workout.date;
- list.getElementsByClassName('start').getElementsByTagName('span').innerHTML = workout.date;
- list.getElementsByClassName('duration').getElementsByTagName('span').innerHTML = workout.duration;
- list.getElementsByClassName('distance').getElementsByTagName('span').innerHTML = workout.distance;
- list.getElementsByClassName('pace').getElementsByTagName('span').innerHTML = workout.distance;
- list.getElementsByClassName('speed').getElementsByTagName('span').innerHTML = workout.distance;
- list.getElementsByClassName('climb').getElementsByTagName('span').innerHTML = workout.climb;
-}
\ No newline at end of file
+ list.getElementsByClassName('date')[0].getElementsByTagName('span')[0].innerHTML = workout.date;
+ list.getElementsByClassName('start')[0].getElementsByTagName('span')[0].innerHTML = workout.date;
+ list.getElementsByClassName('duration')[0].getElementsByTagName('span')[0].innerHTML = workout.duration;
+ list.getElementsByClassName('distance')[0].getElementsByTagName('span')[0].innerHTML = workout.distance;
+ list.getElementsByClassName('pace')[0].getElementsByTagName('span')[0].innerHTML = workout.distance;
+ list.getElementsByClassName('speed')[0].getElementsByTagName('span')[0].innerHTML = workout.distance;
+ list.getElementsByClassName('climb')[0].getElementsByTagName('span')[0].innerHTML = workout.climb;
+}
+
+function showResult(workout) {
+ // update the map
+ OLMap.clearMap();
+ //OLMap.addTrail(workout.gpx, "red");
+ OLMap.addTrail("Jun-26-11.gpx", "red");
+ // fetch the json data containing the events
+ workout = getWorkout(workout.json);
+ // center the map on the events
+ OLMap.centerMap(workout.events);
+ //TODO: store
+ // update the stats section
+ updateStats(workout);
+
+ // draw the speed graph
+ var graph = new Graph();
+ graph.init();
+ graph.drawSpeedGraph(workout);
+
+}