Index: gmap.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.js,v
retrieving revision 1.13
diff -u -r1.13 gmap.js
--- gmap.js	19 Nov 2006 07:50:04 -0000	1.13
+++ gmap.js	28 Nov 2006 23:13:07 -0000
@@ -1,6 +1,212 @@
- 
 /* $Id: gmap.js,v 1.13 2006/11/19 07:50:04 webgeer Exp $ */
 
+Drupal.gmapAutoAttach = function() {
+
+  Drupal.gmap = {};
+  Drupal.gmap.maps = {};
+  Drupal.gmap.geocoder = null;
+
+  // Init Google map facilities
+
+  // Init map divs
+  $('div.gmap-map').each(function() {
+    var mapid = this.id;
+    // If this didn't come with a settings array, give up.
+    if (!(b = Drupal.settings.gmap[mapid])) return;
+
+    a = Drupal.gmap.maps[mapid] = {};
+    // XXX Does anything particularly require this?
+    a.div = this;
+    a.controls = {};
+    a.vars = {};
+    a.vars['latlon'] = b.latlon;
+    a.vars['height'] = b.height;
+    a.vars['width'] = b.width;
+    a.vars['points'] = b.points;
+    a.vars['pointsOverlays'] = b.pointsOverlays;
+    a.vars['controltype'] = b.controltype;
+    a.vars['maptype'] = b.maptype;
+    // This part is silly.
+    a.vars['line1'] = b.line1;
+    a.vars['line2'] = b.line2;
+    a.vars['line3'] = b.line3;
+   
+    a.map = new GMap2(this);
+    a.currentControl = null;
+
+    var map = Drupal.gmap.maps[mapid].map;
+    map.addControl(new GMapTypeControl());
+    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
+    map.setMapType(G_NORMAL_MAP);
+    gmap_change_controltype(mapid,a.vars.controltype);
+
+  });
+
+  // Tie controls
+  $('.gmap-control').each(function() {
+    // Determine the specifics
+    var mapid = this.id.split('-');
+    var func = mapid.pop();
+    // Throw away the leading "gmap"
+    mapid.shift();
+    // The rest of it is our map id.
+    mapid = mapid.join('-');
+
+    // Store a reference to ourselves. GEvent shadows the 'this' var.
+    var control = Drupal.gmap.maps[mapid].controls[func] = this;
+    
+    var map = Drupal.gmap.maps[mapid].map;
+
+    switch (func) {
+    case 'maptype':
+      // Google -> Drupal
+      GEvent.addListener(map, "maptypechanged", function() {
+        control.value = gmap_type_map2form(map.getCurrentMapType());
+        gmap_macrochanged(mapid);
+      });
+
+      // Drupal -> Google
+      $(this).change(function() {
+        map.setMapType(gmap_type_form2map(this.value));
+        gmap_macrochanged(mapid);
+      });
+      break;
+    case 'zoom':
+      // Google -> Drupal
+      GEvent.addListener(map, "zoomend", function(previouszoom,newzoom) {
+        control.value = newzoom;
+        gmap_macrochanged(mapid);
+      });
+
+      // Drupal -> Google
+      $(this).change(function() {
+        map.setZoom(parseInt(this.value));
+        gmap_macrochanged(mapid);
+      });
+      break;
+    case 'controltype':
+      // Drupal -> Google
+      $(this).change(function() {
+        gmap_change_controltype(mapid,this.value);
+        gmap_macrochanged(mapid);
+      });
+      // Google -> Drupal
+      // N/A
+      break;
+    case 'width':
+    case 'height':
+      // Drupal -> Google
+      $(this).change(function() {
+        a = gmap_validate_dim(this.value);
+        if (a) {
+          map.getContainer().style[func] = a;
+          this.value = a;
+          gmap_macrochanged(mapid);
+        }
+      });
+      // Google -> Drupal
+      // N/A
+      break;
+    case 'latlong':
+      // Drupal -> Google
+      $(this).change(function() {
+        var splitstring=this.value.split(",");
+        map.panTo(new GLatLng(splitstring[0],splitstring[1]));
+        Drupal.gmap.maps[mapid].vars.latlon = this.value;
+        gmap_macrochanged(mapid);
+      });
+      // Google -> Drupal
+      GEvent.addListener(map, "moveend", function() {
+        var center = map.getCenter();
+        control.value = center.lat() + ', ' + center.lng();
+        Drupal.gmap.maps[mapid].vars.latlon = control.value;
+        gmap_macrochanged(mapid);
+      });
+      break;
+
+
+    }
+  });
+
+  // Sync
+  $('div.gmap-map').each(function() {
+    gmap_macrochanged(this.id);
+  });
+
+}
+
+function gmap_validate_dim(dim) {
+  return dim;
+  //needs to be fixed to allow either 'px' or '%'
+  var reg = /(\d+)/;
+  var ar = reg.exec(dim);
+  try {
+    valid_dim = ar[0] + 'px';
+    return valid_dim;
+  } catch (e) {alert(e);
+    return false;
+  }
+}
+
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.gmapAutoAttach);
+}
+
+function gmap_type_map2form(maptype) {
+  if (maptype == G_NORMAL_MAP) return "Map";
+  if (maptype == G_HYBRID_MAP) return "Hybrid";
+  if (maptype == G_SATELLITE_MAP) return "Satellite";
+}
+
+function gmap_type_form2map(val) {
+  if (val == "Map") return G_NORMAL_MAP;
+  if (val == "Hybrid") return G_HYBRID_MAP;
+  if (val == "Satellite") return G_SATELLITE_MAP;
+} 
+
+function gmap_change_controltype(mapid,control) {
+  a = Drupal.gmap.maps[mapid];
+  a.vars.controltype = control;
+  if (a.currentControl) {
+    a.map.removeControl(a.currentControl);
+  }
+  if (control == "Small") a.map.addControl(a.currentControl = new GSmallMapControl());
+  if (control == "Large") a.map.addControl(a.currentControl = new GLargeMapControl());
+}
+
+
+function gmap_macrochanged(mapid) {
+  map = Drupal.gmap.maps[mapid];
+  if (map.controls['macrotext']) {
+    var output = '[gmap';
+    output += ' |zoom='    + map.map.getZoom();
+    output += ' |center='  + map.vars.latlon;
+    output += ' |width='   + map.vars.width;
+    output += ' |height='  + map.vars.height;
+    output += ' |id='      + mapid;
+    output += ' |control=' + map.vars.controltype;
+    output += ' |type='    + gmap_type_map2form(map.map.getCurrentMapType());
+
+    // XXX Fix this
+    //I don't know what alignment does or how to use it. Needs updating
+    //var alignment = ' |align=' + gmapObj.alignment;
+
+    if (map.vars.points.length > 0) {
+      output += ' |markers=' + map.vars.points.join(' + ');
+    }
+
+    // Wouldn't it be simpler to have an arbitrary # of lines?
+    if (map.vars.line1.length >0) output += ' |line1=' + map.vars.line1;
+    if (map.vars.line2.length >0) output += ' |line2=' + map.vars.line2;
+    if (map.vars.line3.length >0) output += ' |line3=' + map.vars.line3;
+
+    output += ']';
+    map.controls['macrotext'].value = output;
+  }
+}
+
+//////////////////// Old functions below the line /////////////////////
+
 var baseIcon=new Array();
 var geocoder = null;
  
Index: gmap.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.module,v
retrieving revision 1.50
diff -u -r1.50 gmap.module
--- gmap.module	19 Nov 2006 07:46:14 -0000	1.50
+++ gmap.module	28 Nov 2006 23:13:07 -0000
@@ -28,25 +28,12 @@
 define('GMAP_CLUSTER', variable_get('gmap_cluster',0));
 define('GMAP_WMS', variable_get('gmap_wms',0));
 
-define('GMAP_API_V', '2.55a');
-
-/**
- * Implementation of hook_help.
- *
- */
-
-function gmap_help($section) {
-  switch ($section) {
-    case 'admin/modules#description':
-      return t('Filter to allow insertion of a google map into a node');
-  }
-}
+define('GMAP_API_V', '2.66');
 
 /**
  * Implementation of hook_perm.
  *
  */
-
 function gmap_perm() {
   return array('create macro');
 }
@@ -138,8 +125,12 @@
         $style .= ' margin-left: auto; margin-right: auto;';
     }
 
+    
+
+
 //    $outtext .= "\n<!--\n\n".print_r($gmap, 1)."\n\n -->\n";
     $outtext.='<div id="'.$gmap['id'].'" style="'.$style.'" class="gmap-map"></div>
+
               <script type="text/javascript">
               //<![CDATA[
               //initialize global gmap variables
@@ -810,8 +801,7 @@
 
   $gmap_path = drupal_get_path('module','gmap');
 
-  theme_add_style($gmap_path. '/gmap.css');
-  drupal_add_js('misc/drupal.js');
+  drupal_add_css('gmap.css','module');
   drupal_add_js($gmap_path. '/gmap.js');
   $js = '<script src="http://maps.google.com/maps?file=api&amp;v='.GMAP_API_V.'&amp;key='.variable_get('googlemap_api_key', '').'" type="text/javascript"></script>';
   drupal_set_html_head($js);
@@ -940,9 +930,18 @@
       'access' => user_access('create macro')||user_access('show user map')||user_access('show node map'),
     );  */
     $items[] = array(
+      'path' => 'admin/settings/gmap',
+      'title' => t('GMap'),
+      'description' => t('Configure GMap settings'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'gmap_admin_settings',
+      'access' => user_access('administer site configuration'),
+      'type' => MENU_NORMAL_ITEM,
+    );
+    $items[] = array(
       'path' => 'map/macro',
       'type' => MENU_NORMAL_ITEM,
-      'title' => t('build a GMap macro'),
+      'title' => t('Build a GMap macro'),
       'access' => user_access('create macro'),
       'callback' => 'gmap_macro_page',
     );
@@ -955,7 +954,7 @@
   return $items;
 }
 
-function gmap_settings() {
+function gmap_admin_settings() {
   //note the same google api key variable name as in the googlemap module is used
   //note the name of the variable for center of the map is latlong although the format is actually longitude, latitude
 
@@ -1131,17 +1130,17 @@
                                            '#size'=>50,
     '#description'=>t('The gmap macro for the map to be used in the location.module for setting latitude and longitude.'),
   );
-  return $form;
+  return system_settings_form($form);
 }
 
 function gmap_macro_page() {
   drupal_add_js(drupal_get_path('module','gmap'). '/gmapmacro.js');
   _gmap_doheader();
-  return gmap_macro_form();
+  return drupal_get_form('gmap_macro_form');
 }
 
 function gmap_macro_form() {
-        $form['macroform'] = array(
+    $form['macroform'] = array(
     '#type' => 'fieldset',
     '#title' => t('Gmap macro creation'),
     '#theme' => 'gmap_macro',
@@ -1149,92 +1148,116 @@
   $linecolors = array(GMAP_LINECOLOR1, GMAP_LINECOLOR2, GMAP_LINECOLOR3); 
   $form['macroform']['mapdiv'] = array(
     '#type'   => 'markup',
-    '#value'  => '<div id="map" style="width: '.GMAP_WIDTH.'; height: '.GMAP_HEIGHT.';" class="gmap-map"></div>'
-  );
-  $form['macroform']['javascript'] = array(
-    '#value' => drupal_call_js('gmap_set_line_colors', $linecolors),
+    '#value'  => '<div id="map" style="width: '.GMAP_WIDTH.'; height: '.GMAP_HEIGHT.';" class="gmap gmap-map"></div>'
   );
+
+// Todo: Change this to a setting.
+drupal_add_js('gmap_set_line_colors("'.implode('","',$linecolors).'")','inline');
+
+$settings = array();
+$settings['map'] = array(
+  'latlon' => GMAP_LONGLAT,
+  'height' => GMAP_HEIGHT,
+  'width' => GMAP_WIDTH,
+  'points' => array(),
+  'pointsOverlays' => array(),
+  'controltype' => GMAP_CONTROL,
+  'maptype' => GMAP_TYPE,
+  'line1' => array('overlay' => null, 'points' => null, 'line' => ""),
+  'line2' => array('overlay' => null, 'points' => null, 'line' => ""),
+  'line3' => array('overlay' => null, 'points' => null, 'line' => ""),
+);
+ 
+drupal_add_js(array('gmap'=>$settings),'setting');
+
+
   $form['macroform']['mapid'] = array(
     '#type' => 'textfield',
-    '#id' => 'gmap-mapid',
+    '#id' => 'gmap-map-mapid',
     '#title' => t('Map id attribute'),
     '#default_value' => variable_get('gmap_default_mapid', 'map'),
-    '#attributes' => array('onchange' => 'set_gmap_mapid(this.value)'),
+    '#attributes' => array('class' => 'gmap-control'),
   );
   $form['macroform']['maptype'] = array(
     '#type' => 'select', 
-    '#id' => 'gmap-maptype',
+    '#id' => 'gmap-map-maptype',
     '#title' => t('Map type'), 
     '#options' => drupal_map_assoc(array('Map', 'Satellite', 'Hybrid')), 
     '#default_value' => GMAP_TYPE,
     '#required' => FALSE,
-    '#attributes' => array('onchange' => 'set_gmap_type(this.value);'),
+    '#attributes' => array('class' => 'gmap-control'),
   );
   $form['macroform']['controltype'] = array(
     '#type' => 'select', 
-    '#id' => 'gmap-controltype',
+    '#id' => 'gmap-map-controltype',
     '#title' => t('Controls'), 
     '#options' => drupal_map_assoc(array('None', 'Small', 'Large')), 
     '#required' => FALSE,
     '#default_value' => GMAP_CONTROL,
-    '#attributes' => array('onchange' => 'set_control_type(this.value);')
+    '#attributes' => array('class' => 'gmap-control'),
+//'onchange' => 'set_control_type(this.value);') // XXX
   );  
   $form['macroform']['latlong'] = array(
     '#type' => 'textfield',
-    '#id' => 'gmap-latlong',
+    '#id' => 'gmap-map-latlong',
     '#title' => t('The Latitude and Longitude of the centre of the map'),
     '#default_value' => GMAP_LONGLAT,
     '#size' => 50,
-    '#attributes' => array('onchange' => 'set_gmap_latlong(this.value);'),
+    '#attributes' => array('class' => 'gmap-control'),
   );
   $form['macroform']['width'] = array(
     '#type' => 'textfield',
-    '#id' => 'gmap-width',
+    '#id' => 'gmap-map-width',
     '#title' => t('Map width'),
     '#default_value' => GMAP_WIDTH,
     '#size' => 25,
-    '#attributes' => array('onchange' => 'set_gmap_dimension(this, \'width\');'),
+    '#attributes' => array('class' => 'gmap-control'),
+//'onchange' => 'set_gmap_dimension(this, \'width\');'),
   ); 
   $form['macroform']['height'] = array(
     '#type' => 'textfield',
+    '#id' => 'gmap-map-height',
     '#title' => t('Map height'),
-    '#id' => 'gmap-height',
     '#default_value' => GMAP_HEIGHT,
     '#size' => 25,
-    '#attributes' => array('onchange' => 'set_gmap_dimension(this, \'height\');'),
+    '#attributes' => array('class' => 'gmap-control'),
+//'onchange' => 'set_gmap_dimension(this, \'height\');'),
   ); 
   $form['macroform']['alignment'] = array(
     '#type' => 'select', 
-    '#id' => 'gmap-alignment',
+    '#id' => 'gmap-map-alignment',
     '#title' => t('Alignment'), 
     '#options' => drupal_map_assoc(array('None', 'Right', 'Left', 'Center')), 
 //    '#default_value' => GMAP_ALIGNMENT,
     '#required' => FALSE,
-    '#attributes' => array('onchange' => 'set_gmap_alignment(this.value);')
+    '#attributes' => array('class' => 'gmap-control'),
+//'onchange' => 'set_gmap_alignment(this.value);') // XXX
   );  
   $form['macroform']['clicktype'] = array(
     '#type' => 'select', 
-    '#id' => 'gmap-clicktype',
+    '#id' => 'gmap-map-clicktype',
     '#title' => t('What happens when you click on the map'), 
     '#options' => drupal_map_assoc(array('Points', 'Line1', 'Line2', 'Line3')), 
     '#required' => FALSE,
     '#default_value' => 'Points',
-//    '#attributes' => array('onchange' => 'docontrol(this.value);')
+    '#attributes' => array('class' => 'gmap-control'),
+//'onchange' => 'docontrol(this.value);')
   );    
   $form['macroform']['zoom'] = array(
     '#type' => 'select', 
-    '#id' => 'gmap-zoom',
+    '#id' => 'gmap-map-zoom',
     '#title' => t('The current magnification of the map'),
     '#default_value' => GMAP_ZOOM,
     '#options' => drupal_map_assoc(range(0, 17)),
-    '#attributes' => array('onchange' => 'setgmapZoom(this.value);'),
+    '#attributes' => array('class' => 'gmap-control'),
   );
   $form['macroform']['textarea'] = array(
     '#type' => 'textarea',
-    '#id' => 'gmap-macrotext',
+    '#id' => 'gmap-map-macrotext',
     '#title' => t('Macro text'),
+    '#attributes' => array('class' => 'gmap-control'),
   );
-  return drupal_get_form('macroform', $form);
+  return $form;
 }
 
 /**
Index: gmap_location.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_location.module,v
retrieving revision 1.25
diff -u -r1.25 gmap_location.module
--- gmap_location.module	19 Nov 2006 07:47:18 -0000	1.25
+++ gmap_location.module	28 Nov 2006 23:13:07 -0000
@@ -10,31 +10,17 @@
  */
 
 /**
- * Implementation of hook_help.
+ * Implementation of hook_perm().
  *
  */
-
-function gmap_location_help($section) {
-  switch ($section) {
-    case 'admin/modules#description':
-      return t('Display location.module information on Google Maps (needs gmap.module)');
-  }
-}
-
-/**
- * Implementation of hook_perm.
- *
- */
-
 function gmap_location_perm() {
   return array('set user location', 'show user map', 'user locations', 'show node map');
 }
 
 /**
- * Implementation of hook_menu.
+ * Implementation of hook_menu().
  *
  */
-
 function gmap_location_menu($may_cache) {
   $items=array();
 
@@ -61,7 +47,6 @@
  * Draws a page with a google map that has all of the site users.
  *
  */
-
 function gmap_location_user_page() {
   global $user;
   $locationbyuser=array();
@@ -145,8 +130,6 @@
  * @param $nn
  * The node number to draw on the map.  If this is not set, or is null then all of the nodes will be drawn.
  */
-
-
 function gmap_location_node_page($nid=null) {
   if ($nid && $n=node_load($nid)){
     if (node_access('view',$n)) {
@@ -196,7 +179,6 @@
  * @return
  * A gmap centred on the
  */
-
 function gmap_location_node_map($n,$thismap,$single=false){
   if ((isset($n->gmap_location_latitude) && isset($n->gmap_location_longitude)) || (isset($n->location['latitude']) && isset($n->location['longitude']))){
     $latitude = isset($n->gmap_location_latitude) ? $n->gmap_location_latitude : $n->location['latitude'];
@@ -255,11 +237,10 @@
 }
 
 /**
- * Implementation of hook_settings.
+ * Admin Settings Page
  *
  */
-
-function gmap_location_settings() {
+function gmap_location_admin_settings() {
 
   $markers=gmap_get_markers();
   
@@ -371,9 +352,9 @@
   return $form;
 }
 
-/*
- * draw block of location for current node.
-*/
+/**
+ * Draw block of location for current node.
+ */
 function gmap_location_block($op = 'list', $delta = 0, $edit = array()) {
 
   // The $op parameter determines what piece of information is being requested.
@@ -620,47 +601,46 @@
 
 function gmap_location_form_alter($form_id, &$form) {
 
-  if (module_exist('location')) {
+  if (module_exists('location')) {
     return;
   }
 
-  if(isset($form['type'])) {
-    $type = $form['type']['#value'];
-    switch ($form_id) {
-      case $type .'_node_settings':
-        $form['gmap'] = array(
-          '#type' => 'fieldset',
-          '#title' => t('Google Maps'),
-          '#weight' => 0,  //0 puts at the top, 1 puts it at the bottom below the submit??
-        );
-        $form['gmap']['gmap_node_'. $type] = array(
-          '#type' => 'checkbox',
-          '#title' => t('Allow users to add Google Maps info to this node type'),
-          '#default_value' => variable_get('gmap_node_'. $type, 0),
-          '#description' => t('The location information will be available to the google maps module, and can be shown in a block.'),
-          '#required' => FALSE,
-        );
-        $form['gmap']['gmap_node_marker_'.$type] = array(
-          '#type' => 'select',
-          '#title' => t('Marker for this nodetype'),
-          '#default_value' => variable_get('gmap_node_marker_'.$type, variable_get('gmap_user_map_marker', 'drupal')),
-          '#options' => gmap_get_markers(),
-        );
-        break;
-      case $type .'_node_form':
-        if(variable_get('gmap_node_'. $type, 0)) {
-          $edit = array();
-          _gmap_location_map_form($form, $edit, 'node');
-        }
-        break;
+  if ($form_id == 'node_type_form') {
+    $type = $form['old_type']['#value'];
+    
+    $form['gmap'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Google Maps'),
+      '#weight' => 0,  //0 puts at the top, 1 puts it at the bottom below the submit??
+    );
+    $form['gmap']['gmap_node'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow users to add Google Maps info to this node type'),
+      '#default_value' => variable_get('gmap_node_'. $type, 0),
+      '#description' => t('The location information will be available to the google maps module, and can be shown in a block.'),
+      '#required' => FALSE,
+    );
+    $form['gmap']['gmap_node_marker'] = array(
+      '#type' => 'select',
+      '#title' => t('Marker for this nodetype'),
+      '#default_value' => variable_get('gmap_node_marker_'.$type, variable_get('gmap_user_map_marker', 'drupal')),
+      '#options' => gmap_get_markers(),
+    );
+  }
+  else {
+    if (isset($form['type']) && $form_id == $form['type'].'_node_form) {
+      echo "Flush!";
+      if(variable_get('gmap_node_'. $type, 0)) {
+        $edit = array();
+        _gmap_location_map_form($form, $edit, 'node');
+      }
     }
   }
 }
 
 /**
- *  implementation of hook_form()
+ * Implementation of hook_form()
  */
-
 function gmap_location_form(&$node, &$param) {
 
 }
Index: gmapmacro.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmapmacro.js,v
retrieving revision 1.4
diff -u -r1.4 gmapmacro.js
--- gmapmacro.js	16 Apr 2006 07:39:48 -0000	1.4
+++ gmapmacro.js	28 Nov 2006 23:13:07 -0000
@@ -4,18 +4,26 @@
 var mapdiv;
 var colors;
 
-if (isJsEnabled()) {
-  addLoadEvent(gmap_init);
+if (Drupal.jsEnabled) {
+//  $(document).ready(gmap_init).unload(gmap_uninit);
 }
 
 function gmap_args(args) {
   gmap_args = args;
 }
 
+function gmap_uninit() {
+  // uninit.
+  alert("Test");
+  GUnload();
+}
+
 function gmap_init() {
   if (!GBrowserIsCompatible()) { return; }
-  
-  mapdiv = $('map');
+
+  $('div#map').each(function() {
+     mapdiv = this;
+  });
   map = new GMap2(mapdiv);
   
   keyboardhandler=new GKeyboardHandler(map);
@@ -28,9 +36,9 @@
 
    // extend the map object
   map.drupal = new Object();
-  map.drupal.mapid=$('gmap-mapid').value
-  map.drupal.latLongStr = $('gmap-latlong').value;
-  map.drupal.currentControlType = 'Large';
+  map.drupal.mapid = $('#gmap-mapid').val();
+  map.drupal.latLongStr = $('#gmap-latlong').val();
+  map.drupal.currentControlType = 'Large'; // $('#gmap-maptype').val();
   map.drupal.currentControl = mycontrol;
   map.drupal.linecolors = colors;
   map.drupal.points = new Array();
@@ -38,29 +46,29 @@
   map.drupal.line1overlay=null;  map.drupal.line1points=new Array(); map.drupal.line1string=new String(); map.drupal.gmapline1=new String();
   map.drupal.line2overlay=null;  map.drupal.line2points=new Array(); map.drupal.line2string=new String(); map.drupal.gmapline2=new String();
   map.drupal.line3overlay=null;  map.drupal.line3points=new Array(); map.drupal.line3string=new String(); map.drupal.gmapline3=new String();
-  $('gmap-macrotext').value = map_to_macro(map);
+  $('#gmap-macrotext').val(map_to_macro(map));
   
   // Event listeners
   GEvent.addListener(map, "moveend", function() {
     var center = map.getCenter();
     map.drupal.latLongStr = center.lat() + ', ' + center.lng() ;
 
-    $('gmap-latlong').value = map.drupal.latLongStr;
-    $('gmap-macrotext').value = map_to_macro(map);
+    $('#gmap-latlong').val(map.drupal.latLongStr);
+    $('#gmap-macrotext').val(map_to_macro(map));
   });
   
   GEvent.addListener(map, "zoomend", function(previouszoom,newzoom) {
-    $('gmap-zoom').value = newzoom;
-    $('gmap-macrotext').value = map_to_macro(map);
+    $('#gmap-zoom').val(newzoom);
+    $('#gmap-macrotext').val(map_to_macro(map));
 
   });
   
   GEvent.addListener(map, "maptypechanged", function() {
     var maptype = map.getCurrentMapType();
-    if (maptype == G_NORMAL_MAP) $('gmap-maptype').value = "Map";
-    if (maptype == G_HYBRID_MAP) $('gmap-maptype').value = "Hybrid";
-    if (maptype == G_SATELLITE_MAP) $('gmap-maptype').value = "Satellite";
-    $('gmap-macrotext').value = map_to_macro(map);
+    if (maptype == G_NORMAL_MAP) $('#gmap-maptype').val("Map");
+    if (maptype == G_HYBRID_MAP) $('#gmap-maptype').val("Hybrid");
+    if (maptype == G_SATELLITE_MAP) $('#gmap-maptype').val("Satellite");
+    $('#gmap-macrotext').val(map_to_macro(map));
   });
 
   GEvent.addListener(map, 'click', function(overlay, point) {
@@ -82,7 +90,7 @@
       map.removeOverlay(overlay);
     }
     else if (point) {
-      var selected = $('gmap-clicktype').value;
+      var selected = $('#gmap-clicktype').val();
       switch (selected) {
         // I've got the feeling that some of the following logic could be trimmed
         case 'Points':
@@ -122,15 +130,15 @@
           break;
       }      
     }
-    $('gmap-macrotext').value = map_to_macro(map);
+    $('#gmap-macrotext').val(map_to_macro(map));
   });
   //initialize default values
-  set_gmap_latlong($('gmap-latlong').value);
-  map.setZoom(parseInt($('gmap-zoom').value));
-  set_gmap_type($('gmap-maptype').value);
-  set_control_type($('gmap-controltype').value);
-  set_gmap_dimension($('gmap-height'), 'height');
-  set_gmap_dimension($('gmap-width'), 'width');
+  set_gmap_latlong($('#gmap-latlong').val());
+  map.setZoom(parseInt($('#gmap-zoom').val()));
+  set_gmap_type($('#gmap-maptype').val());
+  set_control_type($('#gmap-controltype').val());
+  set_gmap_dimension($('#gmap-height').val(), 'height');
+  set_gmap_dimension($('#gmap-width').val(), 'width');
 }
 
 function gmap_set_line_colors(args) {
@@ -143,8 +151,8 @@
 function map_to_macro(gmap) {
   var zooml = ' |zoom=' + gmap.getZoom();
   var centerStr = ' |center=' + gmap.drupal.latLongStr;
-  var width = ' |width=' + $('gmap-width').value;
-  var height = ' |height=' + $('gmap-height').value;
+  var width = ' |width=' + $('#gmap-width').val();
+  var height = ' |height=' + $('#gmap-height').val();
   var id = ' |id=' + gmap.drupal.mapid;
   var control = ' |control=' + gmap.drupal.currentControlType;
   var type = ' |type=' + gmap.drupal.currentMapType;
@@ -169,7 +177,7 @@
 
 function set_gmap_mapid(instring) {
    map.drupal.mapid=instring;
-   $('gmap-macrotext').value=map_to_macro(map);
+   $('#gmap-macrotext').val(map_to_macro(map));
 }
 
 function set_gmap_latlong(instring) {
@@ -184,7 +192,7 @@
   }
   if (incontrol == "Small") map.addControl(map.drupal.currentControl = new GSmallMapControl());
   if (incontrol == "Large") map.addControl(map.drupal.currentControl = new GLargeMapControl());
-  $('gmap-macrotext').value = map_to_macro(map);
+  $('#gmap-macrotext').val(map_to_macro(map));
 }
 
 function set_gmap_type(intype) {
@@ -192,12 +200,12 @@
   if (intype == "Map") map.setMapType(G_NORMAL_MAP);
   if (intype == "Hybrid") map.setMapType(G_HYBRID_MAP);
   if (intype == "Satellite") map.setMapType(G_SATELLITE_MAP);
-  $('gmap-macrotext').value = map_to_macro(map);
+  $('#gmap-macrotext').val(map_to_macro(map));
 }
 
 function setgmapZoom(invalue) {
   map.setZoom(parseInt(invalue));
-  $('gmap-macrotext').value = map_to_macro(map);
+  $('#gmap-macrotext').val(map_to_macro(map));
 }
 
 function set_gmap_dimension(elem, dimension) {
@@ -214,8 +222,8 @@
     }
  //   gmap_init(map);
     map.checkResize();
-    $('gmap-macrotext').value = map_to_macro(map);
-    set_gmap_latlong($('gmap-latlong').value);
+    $('#gmap-macrotext').val(map_to_macro(map));
+    set_gmap_latlong($('#gmap-latlong').val());
   }
 }
 
@@ -234,7 +242,7 @@
 }
 
 function newid() {
-  var newvalue = $('gmap-id').value;
+  var newvalue = $('#gmap-mapid').val();
   newvalue=newvalue.match(/^[0-9A-Za-z_-]+/);
   if (newvalue.length==0) {
     newvalue='map';
--- /dev/null	2005-11-20 21:22:37.000000000 -0600
+++ gmap.info	2006-11-26 15:51:39.000000000 -0600
@@ -0,0 +1,3 @@
+; $Id$
+name = GMap
+description = Filter to allow insertion of a google map into a node
--- /dev/null	2005-11-20 21:22:37.000000000 -0600
+++ gmap_location.info	2006-11-26 16:13:43.000000000 -0600
@@ -0,0 +1,4 @@
+; $Id$
+name = GMap Location
+description = Display location.module information on Google Maps
+dependencies = gmap
