Index: gmap.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.module,v
retrieving revision 1.104.2.9
diff -u -p -r1.104.2.9 gmap.module
--- gmap.module	30 Nov 2010 22:58:57 -0000	1.104.2.9
+++ gmap.module	6 Dec 2010 14:48:41 -0000
@@ -1203,6 +1203,10 @@ function gmap_keys_service() {
         'name' => t('Gmap'),
         'description' => t('Google Maps API Key'),
       ),
+      'gmap_ssl' => array(
+        'name' => t('Gmap'),
+        'description' => t('Google Maps API Key - SSL (in case of different domains)'),
+      ),
     );
   }
   elseif (module_exists('keys')) {
@@ -1224,6 +1228,10 @@ function gmap_keys_service() {
           'name' => t('Google Maps'),
           'description' => t('Google Maps API Key'),
         ),
+        'google_maps_ssl' => array(
+          'name' => t('Google Maps'),
+          'description' => t('Google Maps API Key - SSL (in case of different domain names)'),
+        ),
       );
     }
   }
@@ -1233,12 +1241,24 @@ function gmap_keys_service() {
  * Retrieve the Google Maps key that is in use for the site.
  */
 function gmap_get_key() {
-  $key = variable_get('googlemap_api_key', '');
+  $ssl = $_SERVER['SERVER_PORT'] == 443;
+  
+  if ($ssl)
+    $key = variable_get('googlemap_api_key_ssl', variable_get('googlemap_api_key', ''));
+  else
+    $key = variable_get('googlemap_api_key', '');
+
   if (module_exists('keys_api')) {
-    $key = keys_api_get_key('gmap', $_SERVER['HTTP_HOST']);
+    if ($ssl)
+      $key = keys_api_get_key('gmap_ssl', $_SERVER['HTTP_HOST']);
+    if (!$ssl || empty($key))
+      $key = keys_api_get_key('gmap', $_SERVER['HTTP_HOST']);
   }
   elseif (module_exists('keys')) {
-    $key = keys_get_key('google_maps');
+    if ($ssl)
+      $key = keys_get_key('google_maps');
+    if (!$ssl || empty($key))
+      $key = keys_get_key('google_maps_ssl');
   }
   return $key;
 }
Index: gmap_settings_ui.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_settings_ui.inc,v
retrieving revision 1.12.2.6
diff -u -p -r1.12.2.6 gmap_settings_ui.inc
--- gmap_settings_ui.inc	15 Sep 2010 23:40:50 -0000	1.12.2.6
+++ gmap_settings_ui.inc	6 Dec 2010 14:48:41 -0000
@@ -25,6 +25,13 @@ function gmap_admin_settings(&$form_stat
       '#size' => 50,
       '#maxlength' => 255,
     );
+    
+    $form['initialization']['googlemap_api_key_ssl'] = array(
+      '#type' => 'textfield',
+      '#default_value' => variable_get('googlemap_api_key_ssl', variable_get('googlemap_api_key', '')),
+      '#size' => 50,
+      '#maxlength' => 255,
+    );
   }
   else {
     $form['initialization']['googlemap_api_key'] = array(
@@ -32,10 +39,17 @@ function gmap_admin_settings(&$form_stat
       '#title' => t('Google Maps API Key'),
       '#value' => t('Managed by <a href="@url">Keys</a>.', array('@url' => url('admin/settings/keys'))),
     );
+    $form['initialization']['googlemap_api_key_ssl'] = array(
+      '#type' => 'item',
+      '#title' => t('Google Maps API Key - SSSL'),
+      '#value' => t('Managed by <a href="@url">Keys</a>.', array('@url' => url('admin/settings/keys'))),
+    );
   }
 
   $form['initialization']['googlemap_api_key']['#title'] = t('Google Maps API Key');
   $form['initialization']['googlemap_api_key']['#description'] = t('Your personal Googlemaps API key.  You must get this for each separate website at <a href="http://code.google.com/apis/maps/signup.html">Google Map API website</a>.');
+  $form['initialization']['googlemap_api_key_ssl']['#title'] = t('Google Maps API Key - SSL');
+  $form['initialization']['googlemap_api_key_ssl']['#description'] = t('The API key to be used when your site is in SSL (in case of different domain names).');
 
   if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) {
     $form['initialization']['gmap_private_markerfile'] = array(
