diff -urpN trackchris/INSTALL.txt track/INSTALL.txt
--- trackchris/INSTALL.txt	2009-02-16 02:26:53.000000000 -0600
+++ track/INSTALL.txt	2009-02-16 10:02:57.000000000 -0600
@@ -3,3 +3,9 @@
 - Install the GMAP module
 - Put all files inside your module directory
 - Activate the module and change create tracks auth.
+
+Note:  
+- Does not work correctly with Drupal caching for the
+  main track list.  For now be sure to disable caching until
+  somebody figures out a better way to turn off caching of links
+  under http://mysite/track/...
Binary files trackchris/.INSTALL.txt.swp and track/.INSTALL.txt.swp differ
diff -urpN trackchris/misc/map.inc.js track/misc/map.inc.js
--- trackchris/misc/map.inc.js	2009-02-16 02:26:53.000000000 -0600
+++ track/misc/map.inc.js	2009-02-16 10:00:26.000000000 -0600
@@ -71,7 +71,7 @@ function MapClass()
  function processXMLnode(marker) {
 
      if (marker.getAttribute("type") == "alert") {
-        alert(marker.getAttribute("alert"));
+   //     alert(marker.getAttribute("alert"));
      }
      if (marker.getAttribute("type") == "point") {
      	addMarker(marker);
@@ -94,8 +94,9 @@ function MapClass()
          map.clearOverlays();
      }
      if (marker.getAttribute("type") == "clearlasttrace") {
-//         FIXME Causes NULL reference
-//         map.removeOverlay(lasttrace);
+         if (lasttrace != null) {
+            map.removeOverlay(lasttrace);
+         }
      }
      if (marker.getAttribute("type") == "move") {
          map.setCenter(new GLatLng(parseFloat(marker.getAttribute("y")), parseFloat(marker.getAttribute("x"))), 17 - parseFloat(marker.getAttribute("zl")));
@@ -106,11 +107,15 @@ function MapClass()
  }
 
  function processxmlDoc(xmlDoc) {
-      var markers = xmlDoc.documentElement.getElementsByTagName("data");
-      markerstoadd = [];
-
-      for (var i = 0; i < markers.length; i++) { // er"<"erg<>
-        processXMLnode(markers[i]);
+      if (xmlDoc.documentElement != null) {
+       var markers = xmlDoc.documentElement.getElementsByTagName("data");
+       markerstoadd = [];
+
+       //alert("ok!");
+
+       for (var i = 0; i < markers.length; i++) { // er"<"erg<>
+         processXMLnode(markers[i]);
+       }
       }
  }
 
Binary files trackchris/misc/.map.inc.js.swp and track/misc/.map.inc.js.swp differ
Binary files trackchris/misc/pushpins/007.png and track/misc/pushpins/007.png differ
diff -urpN trackchris/track.gpx.inc track/track.gpx.inc
--- trackchris/track.gpx.inc	2009-02-16 02:26:53.000000000 -0600
+++ track/track.gpx.inc	2009-02-16 09:55:48.000000000 -0600
@@ -1,5 +1,5 @@
 <?
-// $Id: track.gpx.inc,v 1.5 2008/01/29 13:47:30 gaby Exp $
+// $Id: track.gpx.inc,v 1.4 2006/11/10 22:04:55 gaby Exp $
 
 class GPX_file {
   var $coordonnees = array();
@@ -331,31 +331,31 @@ class GPX_file {
      for ($i=0; $i<10; $i++) {
         $tot += $datay[$i];
      }
-     echo "<set name='".t("Grosse descente")."' value='".$tot."' />";   //<-10%
+     echo "<set name='".t("Steep descent")."' value='".$tot."' />";   //<-10%
 
      $tot = 0;
      for ($i=10; $i<19; $i++) {
         $tot += $datay[$i];
      }
-     echo "<set name='".t("Descente")."' value='".$tot."' />"; //(entre -10% et -2%)
+     echo "<set name='".t("Descent")."' value='".$tot."' />"; //(entre -10% et -2%)
 
      $tot = 0;
      for ($i=19; $i<22; $i++) {
         $tot += $datay[$i];
      }
-     echo "<set name='".t("Plat")."' value='".$tot."' />"; // (entre -2% et 2%)
+     echo "<set name='".t("Flat")."' value='".$tot."' />"; // (entre -2% et 2%)
 
      $tot = 0;
      for ($i=22; $i<31; $i++) {
         $tot += $datay[$i];
      }
-     echo "<set name='".t("Montée")."' value='".$tot."' />"; //(entre 2% et 10%)
+     echo "<set name='".t("Ascent")."' value='".$tot."' />"; //(entre 2% et 10%)
 
      $tot = 0;
      for ($i=31; $i<41; $i++) {
         $tot += $datay[$i];
      }
-     echo "<set name='".t("Grosse montée")."' value='".$tot."' />"; //(>10%)
+     echo "<set name='".t("Steep ascent")."' value='".$tot."' />"; //(>10%)
 
      echo "</graph>";
   }
@@ -555,7 +555,7 @@ H  LATITUDE    LONGITUDE    DATE      TI
     xml_set_element_handler($xml_parser, array(&$this,"debutElement"), array(&$this,"finElement"));
     xml_set_character_data_handler($xml_parser, array(&$this,"characterData"));
     if (!($fp = fopen($filename, "r"))) {
-       die("Impossible d'ouvrir le fichier.");
+       die("Can't open file: ".$filename);
     }
 
     while ($data = fread($fp, 4096)) {
diff -urpN trackchris/track.module track/track.module
--- trackchris/track.module	2009-02-16 02:26:53.000000000 -0600
+++ track/track.module	2009-02-16 20:33:48.000000000 -0600
@@ -8,6 +8,9 @@
 
 include_once(drupal_get_path('module', 'track') ."/track.gpx.inc");
 include_once(drupal_get_path('module', 'track') ."/track.tile.inc");
+include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
+include_once(drupal_get_path('module', 'node') ."/node.pages.inc");
+
 
 $phptrackback = "";
 
@@ -27,41 +30,65 @@ function track_add() {
 function track_menu() {
   $items = array();
 
+  // Menu items appearing under Navigation
+  $items['track'] = array(
+   'title' => 'Track list',
+   'page callback' => 'list_trk',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
+   'type' => MENU_NORMAL_ITEM);
+  $items['track/add'] = array(
+   'title' => 'Track upload',
+   'page callback' => 'track_add',
+   'access callback' => 'user_access',
+   'access arguments' => array('Create tracks'),
+   'type' => MENU_NORMAL_ITEM);
+
+  // Callbacks for various track functions
   $items['track/trk'] = array(
-   'callback' => 'download_trk',
-   'access' => true,
+   'page callback' => 'download_trk',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/kml'] = array(
-   'callback' => 'download_kml',
-   'access' => true,
+   'page callback' => 'download_kml',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/gpx'] = array(
-   'callback' => 'download_gpx',
-   'access' => true,
+   'page callback' => 'download_gpx',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/icon'] = array(
-   'callback' => 'get_icon',
-   'access' => true,
+   'page callback' => 'get_icon',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/ajax/all'] = array(
-   'callback' => 'trackback_all',
-   'access' => true,
+   'page callback' => 'trackback_all',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/ajax/detail'] = array(
-   'callback' => 'trackback_detail',
-   'access' => true,
+   'page callback' => 'trackback_detail',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/profile'] = array(
-   'callback' => 'trackback_profile',
-   'access' => true,
+   'page callback' => 'trackback_profile',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/repartition'] = array(
-   'callback' => 'trackback_repartition',
-   'access' => true,
+   'page callback' => 'trackback_repartition',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
   $items['track/boundslist'] = array(
-   'callback' => 'track_boundslist',
-   'access' => true,
+   'page callback' => 'track_boundslist',
+   'access callback' => 'user_access',
+   'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);
 
   return $items;
@@ -92,13 +119,13 @@ function get_icon($diff) {
  header("Content-type: image/png");
 
  if ($diff == "S") {
-  $image_name = "modules/track/misc/pushpins/058.png";
+  $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/058.png";
  } elseif ($diff == "M") {
-  $image_name = "modules/track/misc/pushpins/150.png";
+  $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/150.png";
  } elseif ($diff == "L") {
-  $image_name = "modules/track/misc/pushpins/011.png";
+  $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/011.png";
  } else {
-  $image_name = "modules/track/misc/pushpins/007.png";
+  $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/007.png";
  }
 
  $im = imagecreatefrompng($image_name);
@@ -127,7 +154,6 @@ function get_icon($diff) {
 }
 
 function trackback_detail($nid) {
-  include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
   // create interface object with map
   $aMap = new GoogleMap();
   // init all values
@@ -202,13 +228,11 @@ function trackback_detail($nid) {
     $aMap->AddPoint($points[0][0], $points[0][1], $track->nid, $desc, $mapicon);
     $aMap->DisplayInfo("info", "");
   }
-
   // send scenario to map
   $aMap->ShowXMLforAJAX();
 }
 
 function trackback_all() {
-  include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
   // create interface object with map
   $aMap = new GoogleMap();
   // init all values
@@ -316,12 +340,8 @@ function theme_info_details($track) {
 }
 
 function prepare_google_maps() {
-  $key = variable_get('googlemap_api_key', 'AAAAAAAAAAA');
-  $basepath = $GLOBALS['base_path'];
+  _gmap_doheader();
   drupal_add_js(drupal_get_path('module', 'track') .'/misc/map.inc.js');
-  $GLOBALS['base_path'] = "";
-  drupal_set_html_head('<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$key.'"type="text/javascript"></script>');
-  $GLOBALS['base_path'] = $basepath;
 }
 
 function track_footer($main = 0) {
@@ -369,8 +389,12 @@ function track_page_last() {
     $row[] = sprintf('%2.2f', $track->file->dzplus)." m";
     $row[] = sprintf('%2.2f', $track->file->dzminu)." m";
 
-    $intensite = $track->file->dzplus / ($track->file->length / 4);
-    $intensite = ($intensite - 30) * (100 / 40);
+    if ($track->file->length != 0) {
+      $intensite = $track->file->dzplus / ($track->file->length / 4);
+      $intensite = ($intensite - 30) * (100 / 40);
+    } else {
+      $intensite = 0.0;
+    }
 
     if ($intensite < 30) {
       $sint = "S";
@@ -398,6 +422,8 @@ function list_trk() {
   global $phptrackback;
   $phptrackback = 'track/ajax/all';
 
+  prepare_google_maps();
+
   $content = '';
 
 /*  $output .= theme_item_list(
@@ -487,9 +513,9 @@ function track_flash_chart($width, $heig
   $output .= '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
   $output .= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
   $output .= 'WIDTH="'.$width.'" HEIGHT="'.$height.'" id="FC2Area3D" ALIGN="">';
-  $output .= '<PARAM NAME=movie VALUE="'.base_path().'modules/track/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'">';
+  $output .= '<PARAM NAME=movie VALUE="'.drupal_get_path('module', 'track').'/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'">';
   $output .= '<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>';
-  $output .= '<EMBED src="'.base_path().'modules/track/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'" quality=high ';
+  $output .= '<EMBED src="'.drupal_get_path('module', 'track').'/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'" quality=high ';
   $output .= 'bgcolor=#FFFFFF WIDTH="'.$width.'" HEIGHT="'.$height.'" NAME="FC2Area3D" ';
   $output .= 'ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
   $output .= '</OBJECT>';
@@ -512,7 +538,33 @@ function track_view(&$node, $teaser = FA
   return $node;
 }
 
+//function track_theme() {
+//  return array(
+//    'track' => array(
+//      'function' => 'theme_track_files',
+//      'arguments' => array('track' => NULL),
+//    ),
+//  );
+//}
+
+/**
+ * Implementation of hook_theme().
+ */
+function track_theme() {
+  return array(
+    'track' => array('arguments' => array('element')),
+    'track_files' => array('arguments' => array('element')),
+    'item_list' => array('arguments' => array('element')),
+  );
+}
+
+function theme_track($node) {
+  return theme_track_files($node);
+}
+
 function theme_track_files($node) {
+  prepare_google_maps();
+
   //theme_node_example_order_info
   $output = "";
 
@@ -658,6 +710,7 @@ function track_validate_file(&$node) {
    if (file_exists($current_file)) {
      $node->file = file_check_local($current_file);
      $node->current_file = $node->file->filepath;
+     $file = $node->file;
    }
   }
   return $file;
@@ -746,3 +799,4 @@ function track_settings() {
 
   return $form;
 }
+
