diff -urpN track-4.7.x-1.x-dev/INSTALL.txt track/INSTALL.txt
--- track-4.7.x-1.x-dev/INSTALL.txt	2006-10-24 12:15:06.000000000 -0500
+++ track/INSTALL.txt	2008-01-27 12:49:36.000000000 -0600
@@ -1,4 +1,5 @@
 // $Id: INSTALL.txt,v 1.3 2006/10/24 17:15:06 gaby Exp $
 
+- Install the GMAP module
 - Put all files inside your module directory
-- Activate the module and change create tracks auth.
\ No newline at end of file
+- Activate the module and change create tracks auth.
Binary files track-4.7.x-1.x-dev/.INSTALL.txt.swp and track/.INSTALL.txt.swp differ
diff -urpN track-4.7.x-1.x-dev/misc/map.inc.js track/misc/map.inc.js
--- track-4.7.x-1.x-dev/misc/map.inc.js	2006-11-10 16:04:55.000000000 -0600
+++ track/misc/map.inc.js	2008-01-27 14:51:04.000000000 -0600
@@ -8,6 +8,7 @@ function MapClass()
  
 // var debug = true;
 // var debugid = "info";
+
  var trackbackurl = "";
  
  this.geturlproperties = geturlproperties;
@@ -68,6 +69,7 @@ function MapClass()
  }
 
  function processXMLnode(marker) {
+
      if (marker.getAttribute("type") == "alert") {
         alert(marker.getAttribute("alert"));
      }
@@ -92,7 +94,8 @@ function MapClass()
          map.clearOverlays();
      }
      if (marker.getAttribute("type") == "clearlasttrace") {
-         map.removeOverlay(lasttrace);
+//         Causes NULL reference
+//         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")));
@@ -152,6 +155,9 @@ function MapClass()
 
   trackbackurl = trackback;
 
+//  alert("DBG: TrackBack: "+trackback+" DivId: "+divid);
+//  alert(document.getElementById(divid));
+
   map = new GMap2(document.getElementById(divid));
 
   baseIcon = new GIcon();
@@ -168,10 +174,10 @@ function MapClass()
   GEvent.addListener(map, 'moveend', moved);
   GEvent.addListener(map, 'zoom', zoomed);
 
+/*
   var tileIGN = new GTileLayer(new GCopyrightCollection(""),12,15);
   tileIGN.getTileUrl = function(a,b) {
   	var z = 17 - b;
-//   	return "http://gabriel.landais.org/maps/"+z+"/"+a.x+"/"+a.y+".png";
    	return "http://gabriel.landais.org/maps/map.php?zoom="+z+"&x="+a.x+"&y="+a.y;
   }
   tileIGN.isPng = function() {return true;}
@@ -179,13 +185,18 @@ function MapClass()
   var layerIGN = [tileIGN];
   var mapIGN = new GMapType(layerIGN, G_SATELLITE_MAP.getProjection(), "IGN", G_SATELLITE_MAP);
   map.addMapType(mapIGN);
+*/
 
   map.setCenter(new GLatLng(0, 0), 0);
-  map.setMapType(G_SATELLITE_TYPE);
+//  map.setMapType(G_SATELLITE_TYPE);
+//  map.setMapType(G_HYBRID_MAP);
+  map.setMapType(G_NORMAL_MAP);
+//  map.setMapType(G_PHYSICAL_MAP);
 
   modified('initsync', false);
   modified('initasync', true);
+//  alert("initmap complete!");
 
  }
 
-}
\ No newline at end of file
+}
Binary files track-4.7.x-1.x-dev/misc/.map.inc.js.swp and track/misc/.map.inc.js.swp differ
diff -urpN track-4.7.x-1.x-dev/track.google.map.inc track/track.google.map.inc
--- track-4.7.x-1.x-dev/track.google.map.inc	2006-11-10 16:04:55.000000000 -0600
+++ track/track.google.map.inc	2008-01-27 13:11:46.000000000 -0600
@@ -101,6 +101,8 @@ class GoogleMap {
 		header("content-type:text/xml");
 //		echo "<xmldata>\n";
 		echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xmldata>\n";
+
+//echo "Count: ".count($this->dataarray);
 		for ($i = 0; $i < count($this->dataarray); $i ++) {
 
 			if ($this->dataarray[$i][0] == "clear") {
@@ -153,4 +155,4 @@ class GoogleMap {
 		echo "</xmldata>";
 	}
 
-}
\ No newline at end of file
+}
diff -urpN track-4.7.x-1.x-dev/track.gpx.inc track/track.gpx.inc
--- track-4.7.x-1.x-dev/track.gpx.inc	2006-11-10 16:04:55.000000000 -0600
+++ track/track.gpx.inc	2008-01-26 11:31:56.000000000 -0600
@@ -318,7 +318,7 @@ class GPX_file {
 </graph>
 */
 
-     echo "<graph caption='".t("Repartition")."' subCaption='' yaxisname='".t("Distance")."' xaxisname='".t("Pente")."' ynumdivlines='4' numberSuffix=' km'>";
+     echo "<graph caption='".t("Histogram")."' subCaption='' yaxisname='".t("Distance")."' xaxisname='".t("Difficulty")."' ynumdivlines='4' numberSuffix=' km'>";
 
      $trans = get_html_translation_table(HTML_ENTITIES);
 
@@ -332,35 +332,35 @@ class GPX_file {
         $tot += $datay[$i];
      }
 //     $tot = (100 * $tot) / $l;
-     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];
      }
 //     $tot = (100 * $tot) / $l;
-     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];
      }
 //     $tot = (100 * $tot) / $l;
-     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];
      }
 //     $tot = (100 * $tot) / $l;
-     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];
      }
 //     $tot = (100 * $tot) / $l;
-     echo "<set name='".t("Grosse montée")."' value='".$tot."' />"; //(>10%)
+     echo "<set name='".t("Steep ascent")."' value='".$tot."' />"; //(>10%)
 
      echo "</graph>";
 
@@ -538,7 +538,25 @@ class GPX_file {
   header('Content-Disposition: attachment; filename="'.substr($this->GPXfile, 0, -4).'.kml"');
   echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
 ?>
-<kml xmlns="http://earth.google.com/kml/2.0">
+<kml xmlns="http://earth.google.com/kml/2.1">
+<Document>
+  <name>QuadSquad <? echo $this->GPXfile; ?></name>
+  <open>1</open>
+  <Style id="lineStyle">
+	<LineStyle>
+		<color>6422FF22</color>
+		<width>4</width>
+	</LineStyle>
+  </Style>
+  <ScreenOverlay>
+	<name>Quad Squad logo</name>
+		<Icon>
+		    <href>http://www.quadsquad.ca/images/QuadSquadLogo.png</href>
+   		</Icon>
+   	<overlayXY x="0" y="1" xunits="fraction" yunits="fraction"/>
+   	<screenXY x="0" y="1" xunits="fraction" yunits="fraction"/>
+   	<size x="0" y="0" xunits="pixels" yunits="pixels"/>
+  </ScreenOverlay>
   <Folder>
     <open>1</open>
     <name><? echo $this->GPXfile; ?></name>
@@ -562,36 +580,23 @@ class GPX_file {
       <description><? echo $this->htmlentities2unicodeentities(t("Length")." : ". sprintf('%2.2f', $this->Longueur()) ."km &lt;br&gt; ".t("D+")." : ". sprintf('%2.0f', $this->DenivelePositif()) ."m / ".t("D-")." : ". sprintf('%2.0f', $this->DeniveleNegatif()) ."m"); ?></description>
     </Placemark>
     <Placemark>
-      <visibility>1</visibility>
-      <name>Trace</name>
-      <Style>
-        <IconStyle>
-          <Icon>
-            <href>root://icons/palette-4.png</href>
-            <y>32</y>
-            <w>32</w>
-            <h>32</h>
-          </Icon>
-        </IconStyle>
-        <geomScale>2</geomScale>
-        <geomColor>ffdf967a</geomColor>
-      </Style>
-    </Placemark>
+	<name>Path</name>
+	<styleUrl>#lineStyle</styleUrl>
+	<LineString>
+	<tessellate>1</tessellate>
+           <coordinates>
 <?
     for ($i=0; $i<count($this->coordonnees) - 1; $i++) {
 ?>
-    <Placemark>
-	<TimeStamp>
-		<when><? echo $this->coordonnees[$i][3]; ?></when>
-	</TimeStamp>
-	<Point>
-    	    <coordinates><? echo $this->coordonnees[$i][1].",".$this->coordonnees[$i][0].",0"; ?></coordinates>
-	</Point>
-    </Placemark>        
+    	    <? echo $this->coordonnees[$i][1].",".$this->coordonnees[$i][0].",0"; ?>
 <?
     }
 ?>
+           </coordinates>
+	</LineString>
+     </Placemark>
   </Folder>
+ </Document>
 </kml>
 <?
  }
@@ -719,4 +724,4 @@ H  LATITUDE    LONGITUDE    DATE      TI
     xml_parser_free($xml_parser);
  }
 
-}
\ No newline at end of file
+}
diff -urpN track-4.7.x-1.x-dev/track.info track/track.info
--- track-4.7.x-1.x-dev/track.info	1969-12-31 18:00:00.000000000 -0600
+++ track/track.info	2008-01-29 05:49:10.000000000 -0600
@@ -0,0 +1,5 @@
+; $Id$
+name = Track
+description = The track module can display GPS tracklogs inside a node. Users submit tracklogs in GPX format, the system renders those tracklogs on Google Maps and dynamically generates elevation profiles
+dependencies = gmap
+package = "Location"
diff -urpN track-4.7.x-1.x-dev/track.module track/track.module
--- track-4.7.x-1.x-dev/track.module	2006-11-10 16:04:55.000000000 -0600
+++ track/track.module	2008-01-27 15:04:07.000000000 -0600
@@ -27,9 +27,8 @@ function track_add() {
 function track_menu($may_cache) {
   $items = array();
   if ($may_cache) {
-//    $items[] = array('path' => 'node/add/track', 'title' =>  t('track upload'), 'access' => user_access('create tracks'));
-    $items[] = array('path' => 'track', 'callback' => 'list_trk', 'title' =>  t('track list'), 'access' => true);
-    $items[] = array('path' => 'track/add', 'callback' => 'track_add', 'title' =>  t('track upload'), 'access' => user_access('create tracks'));
+    $items[] = array('path' => 'track', 'callback' => 'list_trk', 'title' =>  t('Track list'), 'access' => true);
+    $items[] = array('path' => 'track/add', 'callback' => 'track_add', 'title' =>  t('Track upload'), 'access' => user_access('Create tracks'));
   }
 
   $items[] = array(
@@ -117,7 +116,7 @@ function get_icon($diff) {
  } elseif ($diff == "L") {
   $image_name = "modules/track/misc/pushpins/011.png";
  } else {
-  $image_name = "modules/track/misc/pushpins/001.png";
+  $image_name = "modules/track/misc/pushpins/007.png";
  }
 
  $im = imagecreatefrompng($image_name);
@@ -125,7 +124,8 @@ function get_icon($diff) {
  imageSaveAlpha($im, true);
 
  if ($diff == "XL") {
-  $black = imagecolorallocate($im, 255, 255, 255);
+//  $black = imagecolorallocate($im, 255, 255, 255);
+  $black = imagecolorallocate($im, 0, 0, 0);
  } else {
   $black = imagecolorallocate($im, 0, 0, 0);
  }
@@ -146,7 +146,6 @@ function get_icon($diff) {
 }
 
 function trackback_detail($nid) {
-// echo "toto";
   include_once("modules/track/track.google.map.inc");
   // create interface object with map
   $aMap = new GoogleMap();
@@ -168,7 +167,7 @@ function trackback_detail($nid) {
     }
 
     $varlon = max(1e-5, $lonmax - $lonmin);
-    $angle = 360;
+    $angle = 360 * 0.7;
     $zoomlevellon = 17;
     while ($angle>$varlon)
     {
@@ -177,7 +176,7 @@ function trackback_detail($nid) {
     }
 
     $varlat = max(1e-5, $latmax - $latmin);
-    $angle = 360;
+    $angle = 360 * 0.7;
     $zoomlevellat = 17;
     while ($angle>$varlat)
     {
@@ -188,6 +187,8 @@ function trackback_detail($nid) {
     $zoomlevel = max(0, max($zoomlevellat, $zoomlevellon));
 
     // center and zoom the map
+    $lonavg = ($lonmin + $lonmax) / 2.0;
+    $latavg = ($latmin + $latmax) / 2.0;
     $aMap->MoveAndZoom($lonavg, $latavg, $zoomlevel);
   }
   // map is displaying async, display
@@ -199,7 +200,8 @@ function trackback_detail($nid) {
 
     $track = node_load($nid);
     $desc = theme('info_window_html', $track);
-    $aMap->AddTrace($points, "#0000ff", 2, 0.8);
+//    $aMap->AddTrace($points, "#ff3333", 2, 0.8);
+    $aMap->AddTrace($points, "#ff0000", 3, 0.8);
     
     $intensite = $track->file->dzplus / ($track->file->length / 4);
     $intensite = ($intensite - 30) * (100 / 40);
@@ -233,7 +235,7 @@ function trackback_all() {
   $aMap->Init();
 
   if ($aMap->mapaction == "initsync") {
-    $result = db_query('SELECT min(latmin) as latminr, min(lonmin) as lonminr,max(latmax) as latmaxr, max(lonmax) as lonmaxr, avg(latstart) as latavg, avg(lonstart) as lonavg FROM {track}');
+    $result = db_query('SELECT min(latmin) as latminr, min(lonmin) as lonminr,max(latmax) as latmaxr, max(lonmax) as lonmaxr FROM {track}');
     $nresult = 0;
     if ($result) {
      while ($bounds = db_fetch_object($result)) {
@@ -241,8 +243,8 @@ function trackback_all() {
        $lonmin = $bounds->lonminr;
        $latmax = $bounds->latmaxr;
        $lonmax = $bounds->lonmaxr;
-       $latavg = $bounds->latavg;
-       $lonavg = $bounds->lonavg;
+       $lonavg = ($lonmin + $lonmax) / 2.0;
+       $latavg = ($latmin + $latmax) / 2.0;
        $nresult++;
      }
     }
@@ -334,12 +336,12 @@ function theme_info_details($track) {
 }
 
 function prepare_google_maps() {
-  $key = variable_get('googlemapskey', 'AAAAAAAAAAA');
-  //drupal_set_html_head('<style type="text/css"> v\:*{behavior:url(#default#VML);} </style>');
+  $key = variable_get('googlemap_api_key', 'AAAAAAAAAAA');
+//  drupal_set_html_head('<style type="text/css"> v\:*{behavior:url(#default#VML);} </style>');
   $basepath = $GLOBALS['base_path'];
   drupal_add_js('modules/track/misc/map.inc.js');
   $GLOBALS['base_path'] = "";
-  drupal_add_js('http://maps.google.com/maps?file=api&v=2&key='.$key);
+  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;
 }
 
@@ -353,13 +355,10 @@ function track_footer($main = 0) {
    $content .= "\n";
    $content .= "//<![CDATA[\n";
    $content .= " var myMapClass = null;\n";
-   $content .= " function loadMap() {\n";
+   $content .= "$(document).ready(function() {\n";
    $content .= "  myMapClass = new MapClass();\n";
    $content .= "  myMapClass.initmap('".base_path().$phptrackback."', 'map');\n";
-   $content .= " }\n";
-   $content .= " if (isJsEnabled()) {\n";
-   $content .= " addLoadEvent(loadMap);\n";
-   $content .= " }\n";
+   $content .= " });\n";
    $content .= "//]]>";
    $content .= "\n";
    $content .= "</script >\n";
@@ -378,7 +377,7 @@ function track_page_last() {
   $header[] = t("Length");
   $header[] = t("Z+");
   $header[] = t("Z-");
-  $header[] = "<b>".t("Intensit&eacute;")."</b>";
+  $header[] = "<b>".t("Intensity")."</b>";
 
   $rows = array();
 
@@ -421,7 +420,13 @@ function list_trk() {
   $phptrackback = 'track/ajax/all';
 
   $content = '';
-//  $content .= '   <div id="map" style="height: 600px"></div>';
+
+/*  $output .= theme_item_list(
+     array(),
+     t('Map'),
+     'ul'
+     );
+*/
 
   $content .= '   <table width="95%"><tr><td>';
   $content .= '   <div id="map" style="height: 600px; left:0px; right:0px;"></div>';
@@ -463,8 +468,6 @@ function track_perm() {
  */
 function track_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      return t('Allows users to upload GPS tracks.');
     case 'node/add#track':
       return t('Upload new track.');
   }
@@ -474,7 +477,14 @@ function track_help($section) {
  * Implementation of hook_node_info.
  */
 function track_node_info() {
-  return array('track' => array('name' => t('track'), 'base' => 'track'));
+/*  return array('track' => array('name' => t('track'), 'base' => 'track')); */
+  return array(
+    'track' => array(
+      'name' => t('Track'),
+      'module' => 'track',
+      'description' => t("A track is a GPS/GPX track file"),
+    )
+  );
 }
 
 /**
@@ -517,11 +527,15 @@ function track_view(&$node, $teaser = FA
    $phptrackback = 'track/ajax/detail/'.$node->nid."/";
 
   $node = node_prepare($node, $teaser);
-  $node->body .= theme('track_files', $node, false);
-  $node->teaser .= theme('track_files', $node, true) . "<br><b>".l(t('More details'), 'node/'.$node->nid)."</b>";
+  $node->content['track'] = array(
+    '#value' => theme('track_files', $node),
+    '#weight' => 1,
+  );
+  return $node;
 }
 
-function theme_track_files($node, $teaser) {
+//function theme_track_files($node, $teaser) {
+function theme_track_files($node) {
   //theme_node_example_order_info
   $output = "";
 
@@ -547,9 +561,6 @@ function theme_track_files($node, $tease
      'ul'
      );
 
-//    $output .= '<div id="map" style="height: 400px"></div>';
-//    $output .= '<div id="info" style="height: 30px">'.t("Loading").'...'.'</div>';
-
    $output .= '   <table width="95%"><tr><td>';
    $output .= '   <div id="map" style="height: 600px; left:0px; right:0px;"></div>';
    $output .= '   </td></tr><tr><td>';
@@ -571,7 +582,7 @@ function theme_track_files($node, $tease
     $output .= theme_item_list(
      array(
       "<p>".l($node->title . ' - '.t('GPX file'), 'track/gpx/'.$node->nid),
-      "<p>".l($node->title . ' - '.t('TRK file'), 'track/trk/'.$node->nid),
+//      "<p>".l($node->title . ' - '.t('TRK file'), 'track/trk/'.$node->nid),
       "<p>".l($node->title . ' - '.t('KML file'), 'track/kml/'.$node->nid)
      ),
      t('Downloads'),
@@ -757,4 +768,4 @@ function track_settings() {
   );
 
   return $form;
-}
\ No newline at end of file
+}
