diff -rupN gmap_current/gmap.install gmap_new/gmap.install
--- gmap_current/gmap.install	2008-11-25 11:56:36.000000000 +1100
+++ gmap.install	2008-11-25 12:22:13.000000000 +1100
@@ -76,3 +76,15 @@ function gmap_update_5001() {
   menu_rebuild();
   return $ret;
 }
+
+/**
+ * Update 5002
+ * Add database columns for the gmap_views_polygons.patch
+ */
+function gmap_update_5002() {
+  $ret = array();
+  $ret[] = update_sql("ALTER TABLE {view_view} ADD (
+                         page_gmap_marker_type varchar(20) NOT NULL DEFAULT 'marker',
+                         block_gmap_marker_type varchar(20) NOT NULL DEFAULT 'marker')");
+  return $ret;
+}
diff -rupN gmap_current/gmap.module gmap_new/gmap.module
--- gmap_current/gmap.module	2008-11-25 11:56:37.000000000 +1100
+++ gmap.module	2008-11-25 11:57:45.000000000 +1100
@@ -35,7 +35,7 @@ function gmap_defaults() {
     'baselayers' => array('Map', 'Satellite', 'Hybrid'),
     'styles' => array(
       'line_default' => array('0000ff', 5, 45, '', 0, 0),
-      'poly_default' => array('000000', 3, 25, 'ff0000', 45),
+      'poly_default' => array('000000', 3, 25, 'ff0000', 45, FALSE),
     ),
     'line_colors' => array('#00cc00', '#ff0000', '#0000ff'),
   );
@@ -99,7 +99,23 @@ function gmap_gmap($op, &$map) {
         drupal_add_js($path . variable_get('gmap_mm_type', 'gmap') .'_marker.js');
       }
       if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) {
-        drupal_add_js($path .'locpick.js');
+        $singlemap = 0;
+        if (arg(0) == 'node' && is_numeric(arg(1))) {
+          $node = node_load(arg(1));
+          $nodetype = $node->type;
+        }
+        else if (arg(0) == 'node' && arg(1) == 'add') {
+          $nodetype = arg(2);
+        }
+
+        $singlemap = variable_get('location_single_map_' . $nodetype, 0);
+
+        if ($singlemap) {
+          drupal_add_js($path .'locpick_single_map.js');
+        }
+        else {
+          drupal_add_js($path .'locpick_multi_map.js');
+        }
       }
       if (variable_get('gmap_load_zoom_plugin', FALSE) && !$map['behavior']['nomousezoom']) {
         drupal_add_js(drupal_get_path('module', 'gmap') .'/thirdparty/mousewheel.js');
@@ -840,6 +856,8 @@ function process_gmap_control($element, 
  */
 function process_gmap_style($element) {
   $isline = ($element['#gmap_style_type'] == 'line');
+  $ispoly = ($element['#gmap_style_type'] == 'poly');
+
   // Stroke color
   $element[0] = array(
     '#type' => 'textfield',
@@ -894,6 +912,17 @@ function process_gmap_style($element) {
     '#disabled' => $isline,
     '#attributes' => array('class' => 'gmap_style'),
   );
+  if ($ispoly) {
+    // Random color in views
+    $element[5] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use random colors in gmap views?'),
+      '#description' => t('If this is selected a random color will be used for each polygon on a gmap view.'),
+      '#default_value' => FALSE,
+      '#value' => $element['#value'][5],
+      '#attributes' => array('class' => 'gmap_style'),
+    );
+  }
   unset($element['#input']);
   $element += _element_info('fieldset');
   return $element;
@@ -973,7 +1002,7 @@ function process_gmap_overlay_edit($elem
     '#type' => 'gmap_style',
     '#title' => t('Polygon style'),
     '#gmap_style_type' => 'poly',
-    '#default_value' => array('000000', 3, 25, 'ff0000', 45), // @@@
+    '#default_value' => array('000000', 3, 25, 'ff0000', 45, FALSE), // @@@
   );
   gmap_widget_setup($element['polystyle'], 'overlayedit_polystyle', $element['#map']);
   $element['polystyle']['polystyle_apply'] = array(
diff -rupN gmap_current/gmap_views.module gmap_new/gmap_views.module
--- gmap_current/gmap_views.module	2008-11-25 11:56:36.000000000 +1100
+++ gmap_views.module	2008-11-25 11:57:45.000000000 +1100
@@ -21,6 +21,62 @@ function gmap_views_views_style_plugins(
 }
 
 /**
+ * Implementation of hook_form_alter().
+ */
+function gmap_views_form_alter($form_id, &$form) {
+
+  if ($form_id == 'views_edit_view') {
+
+    $form['page-info']['gmap-fieldset'] = array(
+      '#type' => 'fieldset',
+      '#title' => 'GMap View Options',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
+    $form['page-info']['gmap-fieldset']['page_gmap_marker_type'] = array(
+      '#type' => 'radios',
+      '#title' => 'Marker display type',
+      '#options' => array('marker' => 'marker', 'polygon' => 'polygon'),
+      '#default_value' => $form['#parameters'][1]->page_gmap_marker_type ? $form['#parameters'][1]->page_gmap_marker_type : 'marker',
+    );
+
+    $form['block-info']['gmap-fieldset'] = array(
+      '#type' => 'fieldset',
+      '#title' => 'GMap View Options',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
+    $form['block-info']['gmap-fieldset']['block_gmap_marker_type'] = array(
+      '#type' => 'radios',
+      '#title' => 'Marker display type',
+      '#options' => array('marker' => 'marker', 'polygon' => 'polygon'),
+      '#default_value' => $form['#parameters'][1]->block_gmap_marker_type ? $form['#parameters'][1]->block_gmap_marker_type : 'marker',
+    );
+
+    // Override the normal submit function and call it from the new submit function so the new function can be done last.
+    $form['#submit'] = array("gmap_views_view_edit_form_submit" => array());
+  }
+
+}
+
+/**
+ * Additional hook_submit for the views edit form.
+ * To accompany views_edit_view_submit()
+ */
+function gmap_views_view_edit_form_submit($form_id, $form) {
+
+  $return = views_edit_view_submit($form_id, $form);
+
+  $vid = $form['vid'];
+  $page_marker_type = $form['page_gmap_marker_type'] ? $form['page_gmap_marker_type'] : 'marker';
+  $block_marker_type = $form['block_gmap_marker_type'] ? $form['block_gmap_marker_type'] : 'marker';
+
+  db_query("UPDATE {view_view} SET page_gmap_marker_type = '%s', block_gmap_marker_type = '%s' WHERE vid = %d", $page_marker_type, $block_marker_type, $vid);
+
+  return $return;
+}
+
+/**
  * Implementation of hook_gmap().
  */
 function gmap_views_gmap($op, &$map) {
@@ -96,86 +152,200 @@ function theme_views_view_gmap($view, $r
     );
   }
 
-  $fatmarkers = (isset($thismap['#settings']['behavior']['fatmarkers']) && $thismap['#settings']['behavior']['fatmarkers']);
-
-  $markers = array();
+  $markermode = $thismap['#settings']['markermode'];
+  $markertypes = variable_get('gmap_node_markers', array());
 
-  if ($fatmarkers) {
-    $thismap['#settings']['viewfields'] = $view->field;
-    $datafields = array();
-    foreach ($view->field as $field) {
-      if ($fields[$field['id']]['visible'] !== FALSE) {
-        $datafields[] = $field['queryname'];
+  // Find out if we are processing a block or a page and use the appropriate marker type.
+  $shapetype = 'marker';
+  if ($view->build_type == 'block') {
+    $shapetype = $view->block_gmap_marker_type;
+  }
+  else if ($view->build_type == 'page') {
+    $shapetype = $view->page_gmap_marker_type;
+  }
+
+  if ($shapetype == 'polygon') {
+    $thismap['#settings']['shapes'] = array();
+    $shapes = array();
+    $points = array();
+    $endpoint = 0;
+    $color = 0;
+    $count = 0;
+    $loc_count = -1;
+    $first = 1;
+
+    foreach ($results as $entry) {
+      // If the node has changed, get the number of locations for the shape.
+      if($loc_count == -1) {
+        $node = node_load($entry->nid);
+        $loc_array = $node->locations;
+        $loc_count = count($loc_array);
       }
-    }
-  }
 
-  $markermode = $thismap['#settings']['markermode'];
-  $markertypes = variable_get('gmap_node_markers', array());
+      if ($loc_count > 2) {
+        $location = _gmap_views_get_lat_long_from_ids($entry, $point_ids);
 
-  foreach ($results as $entry) {
-    $type = $entry->gmap_node_type;
-    $location = _gmap_views_get_lat_long_from_ids($entry, $point_ids);
-
-    if (($location['lat']) && ($location['lon'])) {
-      if ($fatmarkers) {
-        $data = array();
-        foreach ($view->field as $field) {
-          if ($fields[$field['id']]['visible'] !== FALSE) {
-            $data[] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $entry, $view);
-          }
-        }
-        $themarker = array(
-          'markername' => isset($markertypes[$type]) ? $markertypes[$type] : 'drupal',
-          'latitude' => $location['lat'],
-          'longitude' => $location['lon'],
-          'view' => array_values($data),
-        );
-        if (isset($entry->gmap_taxonomy_marker) && !empty($entry->gmap_taxonomy_marker)) {
-          $themarker['markername'] = $entry->gmap_taxonomy_marker;
+        if (($location['lat']) && ($location['lon'])) {
+          // If this is the first point for the polygon save it to use as the last point also so that the polygon joins up.
+          if ($first) {
+            $endpoint = array($location['lat'], $location['lon']);
+            $first = 0;
+          }
+          $points[] = array($location['lat'], $location['lon']);
         }
+        $count++;
+
+        if ($count == $loc_count) {
+          // Popup
+          if ($markermode == 1) {
+            // @@@ TODO: Switch to using views_theme sometime. Unfortunately, it changes the function prototype.. :-/
+            //$marker_popup = views_theme('gmap_views_marker_label', $view->name, $view, $fields, $entry);
+            $marker_popup = theme('gmap_views_marker_label', $view, $fields, $entry);
+
+            // add themed HTML to either text or tabs depending on whether or not
+            // it was an array.
+            if (is_array($marker_popup)) {
+              // Tabbed.
+              $shapes['tabs'] = $marker_popup;
+            }
+            else {
+              $shapes['text'] = $marker_popup;
+            }
+          }
+          // Link
+          else if ($markermode == 2) {
+            $shapes['link'] = url('node/'. $entry->nid);
+          }
+
+          $shapes['type'] = 'polygon';
+
+          // Use random color if gmap settings say so
+          if ($thismap['#settings']['styles']['poly_default'][5]) {
+            $color = str_pad( base_convert( mt_rand(0, (255*255*255)), 10, 16 ), 6, '0', STR_PAD_LEFT);
+          }
+          // If the color hasn't been set on the polygon node then use the default.
+          if (!$color) {
+            $color = $thismap['#settings']['styles']['poly_default'][3];
+          }
+          if (substr($color, 0, 1) == '#') {
+            $color = substr($color, 1);
+          }
+
+          // Use polygon defaults for opacity and line size.
+          $shapes['style'] = $thismap['#settings']['styles']['poly_default'];
+
+          if ($color) {
+            $shapes['style'][0] = $color;
+            $shapes['style'][3] = $color;
+          }
+
+          if ($endpoint) {
+            $points[] = $endpoint;
+          }
+
+          $shapes['points'] = $points;
+          $thismap['#settings']['shapes'][] = $shapes;
+
+          $shapes = array();
+          $points = array();
+          $endpoint = 0;
+          $color = 0;
+          $count = 0;
+          $loc_count = -1;
+          $first = 1;
+      }
+
       }
       else {
-        // Common
-        $themarker = array(
-          'markername' => isset($markertypes[$type]) ? $markertypes[$type] : 'drupal',
-          'latitude' => $location['lat'],
-          'longitude' => $location['lon']
-        );
-        if (isset($entry->gmap_taxonomy_marker) && !empty($entry->gmap_taxonomy_marker)) {
-          $themarker['markername'] = $entry->gmap_taxonomy_marker;
+        $loc_count = -1;
+      }
+    }
+
+    $output .= theme('gmap', $thismap);
+    return $output;
+  } // End if marker type polygon
+
+  elseif ($shapetype == 'marker') {
+    $fatmarkers = (isset($thismap['#settings']['behavior']['fatmarkers']) && $thismap['#settings']['behavior']['fatmarkers']);
+
+    $markers = array();
+
+    if ($fatmarkers) {
+      $thismap['#settings']['viewfields'] = $view->field;
+      $datafields = array();
+      foreach ($view->field as $field) {
+        if ($fields[$field['id']]['visible'] !== FALSE) {
+          $datafields[] = $field['queryname'];
         }
-        // Popup
-        if ($markermode == 1) {
-          // @@@ TODO: Switch to using views_theme sometime. Unfortunately, it changes the function prototype.. :-/
-          //$marker_popup = views_theme('gmap_views_marker_label', $view->name, $view, $fields, $entry);
-          $marker_popup = theme('gmap_views_marker_label', $view, $fields, $entry);
+      }
+    }
 
-          // add themed HTML to either text or tabs depending on whether or not
-          // it was an array.
-          if (is_array($marker_popup)) {
-            // Tabbed.
-            $themarker['tabs'] = $marker_popup;
+    foreach ($results as $entry) {
+      $type = $entry->gmap_node_type;
+      $location = _gmap_views_get_lat_long_from_ids($entry, $point_ids);
+
+      if (($location['lat']) && ($location['lon'])) {
+        if ($fatmarkers) {
+          $data = array();
+          foreach ($view->field as $field) {
+            if ($fields[$field['id']]['visible'] !== FALSE) {
+              $data[] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $entry, $view);
+            }
+          }
+          $themarker = array(
+            'markername' => isset($markertypes[$type]) ? $markertypes[$type] : 'drupal',
+            'latitude' => $location['lat'],
+            'longitude' => $location['lon'],
+            'view' => array_values($data),
+          );
+          if (isset($entry->gmap_taxonomy_marker) && !empty($entry->gmap_taxonomy_marker)) {
+            $themarker['markername'] = $entry->gmap_taxonomy_marker;
+          }
+        }
+        else {
+          // Common
+          $themarker = array(
+            'markername' => isset($markertypes[$type]) ? $markertypes[$type] : 'drupal',
+            'latitude' => $location['lat'],
+            'longitude' => $location['lon']
+          );
+          if (isset($entry->gmap_taxonomy_marker) && !empty($entry->gmap_taxonomy_marker)) {
+            $themarker['markername'] = $entry->gmap_taxonomy_marker;
+          }
+          // Popup
+          if ($markermode == 1) {
+            // @@@ TODO: Switch to using views_theme sometime. Unfortunately, it changes the function prototype.. :-/
+            //$marker_popup = views_theme('gmap_views_marker_label', $view->name, $view, $fields, $entry);
+            $marker_popup = theme('gmap_views_marker_label', $view, $fields, $entry);
+
+            // add themed HTML to either text or tabs depending on whether or not
+            // it was an array.
+            if (is_array($marker_popup)) {
+              // Tabbed.
+              $themarker['tabs'] = $marker_popup;
+            }
+            else {
+              $themarker['text'] = $marker_popup;
+            }
           }
-          else {
-            $themarker['text'] = $marker_popup;
+          // Link
+          else if ($markermode == 2) {
+            $themarker['link'] = url('node/'. $entry->nid);
           }
         }
-        // Link
-        else if ($markermode == 2) {
-          $themarker['link'] = url('node/'. $entry->nid);
+        if (isset($entry->node_title)) {
+          $themarker['opts']['title'] = $entry->node_title;
         }
-      }
-      if (isset($entry->node_title)) {
-        $themarker['opts']['title'] = $entry->node_title;
-      }
 
-      $markers[] = $themarker;
+        $markers[] = $themarker;
+      }
     }
-  }
-  $thismap['#settings']['markers'] = $markers;
-  $output .= theme('gmap', $thismap);
-  return $output;
+    $thismap['#settings']['markers'] = $markers;
+
+    $output .= theme('gmap', $thismap);
+    return $output;
+    } // End if marker type marker
+
 }
 
 /**
diff -rupN gmap_current/js/gmap_shapes.js gmap_new/js/gmap_shapes.js
--- gmap_current/js/gmap_shapes.js	2008-11-25 11:56:38.000000000 +1100
+++ js/gmap_shapes.js	2008-11-25 12:35:13.000000000 +1100
@@ -80,6 +80,22 @@ Drupal.gmap.addHandler('gmap', function(
         shape.shape = new Pl(cargs);
         break;
     }
+
+    // Event handling for mouse movement and clicking
+    var s = shape.shape;
+    GEvent.addListener(s, 'click', function(point){
+      obj.map.openInfoWindowHtml(point, shape.text);
+    });
+    GEvent.addListener(s,'mouseover',function() {
+      obj.change('mouseovermarker',-1,shape);
+      //var bounds = s.getBounds();
+      //var point = bounds.getCenter();
+      //obj.map.openInfoWindowHtml(point, shape.text);
+    });
+    GEvent.addListener(s,'mouseout',function() {
+      obj.change('mouseoutmarker',-1,shape);
+      //obj.map.closeInfoWindow();
+    });
   });
 
   obj.bind('addshape', function(shape) {
diff -rupN gmap_current/js/locpick.js gmap_new/js/locpick.js
--- gmap_current/js/locpick.js	2008-11-25 11:56:38.000000000 +1100
+++ js/locpick.js	1970-01-01 10:00:00.000000000 +1000
@@ -1,145 +0,0 @@
-/* $Id: locpick.js,v 1.1.2.4 2008/06/26 20:37:24 bdragon Exp $ */
-
-/**
- * Location chooser interface.
- */
-
-Drupal.gmap.addHandler('gmap',function(elem) {
-  var obj = this;
-
-  var binding = obj.bind("locpickchange", function() {
-    if (obj.locpick_coord) {
-      GEvent.trigger(obj.map,"click",null,obj.locpick_coord);
-    }
-  });
-
-  obj.bind("locpickremove", function() {
-    obj.map.removeOverlay(obj.locpick_point);
-    obj.locpick_coord = null;
-    obj.change('locpickchange', -1);
-  });
-
-  obj.bind("init", function() {
-    if (obj.vars.behavior.locpick) {
-      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
-
-      GEvent.addListener(obj.map, "click", function(overlay,point) {
-        obj.map.checkResize();
-        if (!overlay) {
-          if (obj.locpick_point) {
-            obj.map.removeOverlay(obj.locpick_point);
-          }
-          obj.map.zoomIn();
-          obj.map.zoomIn();
-          obj.map.addOverlay(obj.locpick_point = new GMarker(point, {draggable: true}));
-          GEvent.addListener(obj.locpick_point, 'drag', function() {
-            obj.locpick_coord = obj.locpick_point.getLatLng();
-            obj.change('locpickchange', binding);
-          });
-          GEvent.addListener(obj.locpick_point, 'dragend', function() {
-            obj.locpick_coord = obj.locpick_point.getLatLng();
-            obj.map.zoomIn();
-            obj.map.zoomIn();
-            obj.map.panTo(obj.locpick_coord);
-            obj.change('locpickchange', binding);
-          });
-          obj.locpick_coord = point;
-          obj.map.panTo(point);
-          obj.change('locpickchange', binding);
-        }
-        else {
-          // Unsetting the location
-          obj.change('locpickremove',-1);
-        }
-      });
-    }
-  });
-
-  obj.bind("ready", function() {
-    // Fake a click to set the initial point, if one was set.
-    if (obj.vars.behavior.locpick) {
-      if (!obj.locpick_invalid) {
-        obj.change('locpickchange', -1);
-      }
-    }
-  });
-
-});
-
-Drupal.gmap.addHandler('locpick_latitude',function(elem) {
-  var obj = this;
-  
-  obj.bind("init", function() {
-    if (elem.value != '') {
-      obj.vars.latitude = Number(elem.value);
-      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
-    }
-    else {
-      obj.locpick_coord = null;
-      obj.locpick_invalid = true;
-    }
-  });
-
-  var binding = obj.bind("locpickchange", function() {
-    if (obj.locpick_coord) {
-      elem.value = obj.locpick_coord.lat();
-    }
-    else {
-      elem.value = '';
-    }
-  });
-
-  $(elem).change(function() {
-    if (elem.value != '') {
-      if (obj.locpick_coord) {
-        obj.locpick_coord = new GLatLng(Number(elem.value), obj.locpick_coord.lng());
-        obj.change('locpickchange', binding);
-      }
-      else {
-        obj.locpick_coord = new GLatLng(Number(elem.value), 0.0);
-      }
-    }
-    else {
-      obj.change('locpickremove', -1);
-    }
-  });
-});
-
-Drupal.gmap.addHandler('locpick_longitude', function(elem) {
-  var obj = this;
-
-  obj.bind("init", function() {
-    if (elem.value != '') {
-      obj.vars.longitude = Number(elem.value);
-      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
-    }
-    else {
-      obj.locpick_invalid = true;
-    }
-  });
-
-  var binding = obj.bind("locpickchange", function() {
-    if (obj.locpick_coord) {
-      elem.value = obj.locpick_coord.lng();
-    }
-    else {
-      elem.value = '';
-    }
-  });
-
-  $(elem).change(function() {
-    if (elem.value != '') {
-      if (obj.locpick_coord) {
-        obj.locpick_coord = new GLatLng(obj.locpick_coord.lat(), Number(elem.value));
-        obj.change('locpickchange', binding);
-      }
-      else {
-        obj.locpick_coord = new GLatLng(0.0, Number(elem.value));
-      }
-    }
-    else {
-      obj.change('locpickremove', -1);
-    }
-  });
-});
-
diff -rupN gmap_current/js/locpick_multi_map.js gmap_new/js/locpick_multi_map.js
--- gmap_current/js/locpick_multi_map.js	1970-01-01 10:00:00.000000000 +1000
+++ js/locpick_multi_map.js	2008-11-25 11:57:45.000000000 +1100
@@ -0,0 +1,145 @@
+/* $Id: locpick.js,v 1.1.2.4 2008/06/26 20:37:24 bdragon Exp $ */
+
+/**
+ * Location chooser interface.
+ */
+
+Drupal.gmap.addHandler('gmap',function(elem) {
+  var obj = this;
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord) {
+      GEvent.trigger(obj.map,"click",null,obj.locpick_coord);
+    }
+  });
+
+  obj.bind("locpickremove", function() {
+    obj.map.removeOverlay(obj.locpick_point);
+    obj.locpick_coord = null;
+    obj.change('locpickchange', -1);
+  });
+
+  obj.bind("init", function() {
+    if (obj.vars.behavior.locpick) {
+      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+
+      GEvent.addListener(obj.map, "click", function(overlay,point) {
+        obj.map.checkResize();
+        if (!overlay) {
+          if (obj.locpick_point) {
+            obj.map.removeOverlay(obj.locpick_point);
+          }
+          obj.map.zoomIn();
+          obj.map.zoomIn();
+          obj.map.addOverlay(obj.locpick_point = new GMarker(point, {draggable: true}));
+          GEvent.addListener(obj.locpick_point, 'drag', function() {
+            obj.locpick_coord = obj.locpick_point.getLatLng();
+            obj.change('locpickchange', binding);
+          });
+          GEvent.addListener(obj.locpick_point, 'dragend', function() {
+            obj.locpick_coord = obj.locpick_point.getLatLng();
+            obj.map.zoomIn();
+            obj.map.zoomIn();
+            obj.map.panTo(obj.locpick_coord);
+            obj.change('locpickchange', binding);
+          });
+          obj.locpick_coord = point;
+          obj.map.panTo(point);
+          obj.change('locpickchange', binding);
+        }
+        else {
+          // Unsetting the location
+          obj.change('locpickremove',-1);
+        }
+      });
+    }
+  });
+
+  obj.bind("ready", function() {
+    // Fake a click to set the initial point, if one was set.
+    if (obj.vars.behavior.locpick) {
+      if (!obj.locpick_invalid) {
+        obj.change('locpickchange', -1);
+      }
+    }
+  });
+
+});
+
+Drupal.gmap.addHandler('locpick_latitude',function(elem) {
+  var obj = this;
+  
+  obj.bind("init", function() {
+    if (elem.value != '') {
+      obj.vars.latitude = Number(elem.value);
+      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+    }
+    else {
+      obj.locpick_coord = null;
+      obj.locpick_invalid = true;
+    }
+  });
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord) {
+      elem.value = obj.locpick_coord.lat();
+    }
+    else {
+      elem.value = '';
+    }
+  });
+
+  $(elem).change(function() {
+    if (elem.value != '') {
+      if (obj.locpick_coord) {
+        obj.locpick_coord = new GLatLng(Number(elem.value), obj.locpick_coord.lng());
+        obj.change('locpickchange', binding);
+      }
+      else {
+        obj.locpick_coord = new GLatLng(Number(elem.value), 0.0);
+      }
+    }
+    else {
+      obj.change('locpickremove', -1);
+    }
+  });
+});
+
+Drupal.gmap.addHandler('locpick_longitude', function(elem) {
+  var obj = this;
+
+  obj.bind("init", function() {
+    if (elem.value != '') {
+      obj.vars.longitude = Number(elem.value);
+      obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+    }
+    else {
+      obj.locpick_invalid = true;
+    }
+  });
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord) {
+      elem.value = obj.locpick_coord.lng();
+    }
+    else {
+      elem.value = '';
+    }
+  });
+
+  $(elem).change(function() {
+    if (elem.value != '') {
+      if (obj.locpick_coord) {
+        obj.locpick_coord = new GLatLng(obj.locpick_coord.lat(), Number(elem.value));
+        obj.change('locpickchange', binding);
+      }
+      else {
+        obj.locpick_coord = new GLatLng(0.0, Number(elem.value));
+      }
+    }
+    else {
+      obj.change('locpickremove', -1);
+    }
+  });
+});
+
diff -rupN gmap_current/js/locpick_single_map.js gmap_new/js/locpick_single_map.js
--- gmap_current/js/locpick_single_map.js	1970-01-01 10:00:00.000000000 +1000
+++ js/locpick_single_map.js	2008-11-25 11:57:45.000000000 +1100
@@ -0,0 +1,246 @@
+/* $Id: locpick.js,v 1.1.2.4 2008/06/26 20:37:24 bdragon Exp $ */
+
+/**
+ * Location chooser interface.
+ */
+
+Drupal.gmap.addHandler('gmap',function(elem) {
+  var obj = this;
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord[obj.current_locpick]) {
+      GEvent.trigger(obj.map,"click",null,obj.locpick_coord[obj.current_locpick]);
+    }
+  });
+
+  obj.bind("locpickremove", function() {
+    obj.map.removeOverlay(obj.locpick_point[obj.current_locpick]);
+    obj.locpick_coord[obj.current_locpick] = null;
+    obj.change('locpickchange', -1, obj.current_locpick);
+  });
+
+  obj.bind("init", function() {
+    if (obj.vars.behavior.locpick) {
+      obj.locpick_coord = [];
+      obj.locpick_point = [];
+      obj.locpick_invalid = [];
+      var i = 0;
+      obj.current_locpick = -1;
+
+      GEvent.addListener(obj.map, "click", function(overlay,point) {
+        obj.map.checkResize();
+        if (!overlay) {
+          // obj.locpick count is the number of locpicks available so only allow that many markers
+          // If this is the initial loading then use the obj.current_locpick that is already set.
+          obj.full = true;
+          for (i = 0; i < obj.locpick_count; i++) {
+            if (obj.locpick_coord[i] == null || obj.locpick_point[i] == null) {
+              obj.full = false;
+            }
+          }
+          if (obj.full == false) {
+            if (obj.locpick_set == false) {
+              obj.current_locpick = -1;
+              for (i = 0; i < obj.locpick_coord.length; i++) {
+                if (obj.locpick_coord[i] == null) {
+                  if (obj.current_locpick == -1) {
+                    obj.current_locpick = i;
+                  }
+                }
+              }
+            }
+
+            if (obj.current_locpick == -1) {
+              obj.current_locpick = obj.locpick_coord.length;
+            }
+
+            if (obj.current_locpick != null) {
+              obj.locpick_coord[obj.current_locpick] = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+            }
+
+            obj.map.addOverlay(obj.locpick_point[obj.current_locpick] = new GMarker(point, {draggable: true}));
+
+            GEvent.addListener(obj.locpick_point[obj.current_locpick], 'dragstart', function() {
+              // Get the current marker.
+              obj.current_locpick = -1;
+              for (i = 0; i < obj.locpick_coord.length; i++) {
+                if (obj.locpick_coord[i] == this.getLatLng()) {
+                  if (obj.current_locpick == -1) {
+                    obj.current_locpick = i;
+                  }
+                }
+              }
+            });
+
+            GEvent.addListener(obj.locpick_point[obj.current_locpick], 'drag', function() {
+              obj.locpick_coord[obj.current_locpick] = obj.locpick_point[obj.current_locpick].getLatLng();
+              obj.change('locpickchange', binding);
+            });
+            GEvent.addListener(obj.locpick_point[obj.current_locpick], 'dragend', function() {
+              obj.locpick_coord[obj.current_locpick] = obj.locpick_point[obj.current_locpick].getLatLng();
+              obj.map.panTo(obj.locpick_coord[obj.current_locpick]);
+              obj.change('locpickchange', binding);
+            });
+            obj.locpick_coord[obj.current_locpick] = point;
+            obj.map.panTo(point);
+            obj.change('locpickchange', binding);
+          }
+        }
+        else {
+          if (overlay instanceof GMarker) {
+            obj.current_locpick = -1;
+            for (i = 0; i < obj.locpick_coord.length; i++) {
+             if (obj.locpick_coord[i] == overlay.getLatLng()) {
+                if (obj.current_locpick == -1) {
+                  obj.current_locpick = i;
+                }
+              }
+            }
+          }
+          // Unsetting the location
+          obj.change('locpickremove',-1);
+        }
+      });
+    }
+  });
+
+  obj.bind("ready", function() {
+    // Fake a click to set the initial point, if one was set.
+    if (obj.vars.behavior.locpick) {
+      obj.locpick_set = true;
+      for (i = 0; i < obj.locpick_count; i++) {
+        obj.current_locpick = i;
+        if (!obj.locpick_invalid[obj.current_locpick]) {
+          if (obj.locpick_coord[obj.current_locpick] != null) {
+            obj.change('locpickchange', -1);
+          }
+        }
+      }
+      obj.locpick_set = false;
+    }
+  });
+
+});
+
+Drupal.gmap.addHandler('locpick_latitude',function(elem) {
+  var obj = this;
+  if (isNaN(elem.id.substring(elem.id.length - 3)) == false) {
+    var locpick_lat_id = elem.id.substring(elem.id.length - 3) * 1;
+  }
+  else if (isNaN(elem.id.substring(elem.id.length - 2)) == false) {
+    var locpick_lat_id = elem.id.substring(elem.id.length - 2) * 1;
+  }
+  else {
+    var locpick_lat_id = elem.id.substring(elem.id.length - 1) * 1;
+  }
+
+  if (!obj.locpick_count || obj.locpick_count < (locpick_lat_id + 1)){
+    obj.locpick_count = (locpick_lat_id + 1);
+  }
+
+  obj.bind("init", function() {
+    if (elem.value != '') {
+      obj.vars.latitude = Number(elem.value);
+      if (obj.locpick_coord[locpick_lat_id]) {
+        obj.locpick_coord[locpick_lat_id] = new GLatLng(obj.vars.latitude, obj.locpick_coord[locpick_lat_id].lng());
+      }
+      else {
+        obj.locpick_coord[locpick_lat_id] = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+      }
+      obj.locpick_invalid[locpick_lat_id] = false;
+    }
+    else {
+      obj.locpick_coord[locpick_lat_id] = null;
+      obj.locpick_invalid[locpick_lat_id] = true;
+    }
+  });
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord[locpick_lat_id]) {
+      elem.value = obj.locpick_coord[locpick_lat_id].lat();
+    }
+    else {
+      elem.value = '';
+    }
+  });
+
+  $(elem).change(function() {
+    obj.current_locpick = locpick_lat_id;
+    if (elem.value != '') {
+      if (obj.locpick_coord[locpick_lat_id]) {
+        obj.locpick_coord[locpick_lat_id] = new GLatLng(Number(elem.value), obj.locpick_coord[locpick_lat_id].lng());
+        obj.locpick_set = true;
+        obj.change('locpickchange', binding);
+        obj.locpick_set = false;
+      }
+      else {
+        obj.locpick_coord[locpick_lat_id] = new GLatLng(Number(elem.value), 0.0);
+      }
+    }
+    else {
+      obj.change('locpickremove', -1);
+    }
+  });
+});
+
+Drupal.gmap.addHandler('locpick_longitude', function(elem) {
+  var obj = this;
+  //var locpick_lng_id = elem.id[(elem.id.length - 1)] * 1;
+  if (isNaN(elem.id.substring(elem.id.length - 3)) == false) {
+    var locpick_lng_id = elem.id.substring(elem.id.length - 3) * 1;
+  }
+  else if (isNaN(elem.id.substring(elem.id.length - 2)) == false) {
+    var locpick_lng_id = elem.id.substring(elem.id.length - 2) * 1;
+  }
+  else {
+    var locpick_lng_id = elem.id.substring(elem.id.length - 1) * 1;
+  }
+
+  if (!obj.locpick_count || obj.locpick_count < (locpick_lng_id + 1)){
+    obj.locpick_count = (locpick_lng_id + 1);
+  }
+
+  obj.bind("init", function() {
+    if (elem.value != '') {
+      obj.vars.longitude = Number(elem.value);
+      if (obj.locpick_coord[locpick_lng_id]) {
+        obj.locpick_coord[locpick_lng_id] = new GLatLng(obj.locpick_coord[locpick_lng_id].lat(), obj.vars.longitude);
+      }
+      else {
+        obj.locpick_coord[locpick_lng_id] = new GLatLng(obj.vars.latitude, obj.vars.longitude);
+      }
+      obj.locpick_invalid[locpick_lng_id] = false;
+    }
+    else {
+      obj.locpick_invalid[locpick_lng_id] = true;
+    }
+  });
+
+  var binding = obj.bind("locpickchange", function() {
+    if (obj.locpick_coord[locpick_lng_id]) {
+      elem.value = obj.locpick_coord[locpick_lng_id].lng();
+    }
+    else {
+      elem.value = '';
+    }
+  });
+
+  $(elem).change(function() {
+    obj.current_locpick = locpick_lng_id;
+    if (elem.value != '') {
+      if (obj.locpick_coord[locpick_lng_id]) {
+        obj.locpick_coord[locpick_lng_id] = new GLatLng(obj.locpick_coord[locpick_lng_id].lat(), Number(elem.value));
+        obj.locpick_set = true;
+        obj.change('locpickchange', binding);
+        obj.locpick_set = false;
+      }
+      else {
+        obj.locpick_coord[locpick_lng_id] = new GLatLng(0.0, Number(elem.value));
+      }
+    }
+    else {
+      obj.change('locpickremove', -1);
+    }
+  });
+});
+
