Index: addthis.module
===================================================================
--- addthis.module	(revision 1295)
+++ addthis.module	(working copy)
@@ -155,13 +155,21 @@
     ));
   }
 
+  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
+    $secure = TRUE;
+    $image_url = variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif');
+  }
+  else {
+    $secure = FALSE;
+    $image_url = variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif');
+  }
   if (variable_get('addthis_dropdown_disabled', '0')) {
     return ( sprintf('
       <a class="addthis-button" href="http://www.addthis.com/bookmark.php"
         onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);">
       <img src="%s" width="%d" height="%d" %s /></a>
       ',
-      $_SERVER['HTTPS'] == 'on' ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
+      addslashes($image_url),
       addslashes(variable_get('addthis_image_width', '125')),
       addslashes(variable_get('addthis_image_height', '16')),
       addslashes(variable_get('addthis_image_attributes', 'alt=""'))
@@ -177,11 +185,11 @@
       ',
       $teaser ? url('node/'. $node->nid, array('absolute' => 1) ) : '[URL]',
       $teaser ? addslashes($node->title) : '[TITLE]',
-      $_SERVER['HTTPS'] == 'on' ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
+      addslashes($image_url),
       addslashes(variable_get('addthis_image_width', '125')),
       addslashes(variable_get('addthis_image_height', '16')),
       variable_get('addthis_image_attributes', 'alt=""'),
-      $_SERVER['HTTPS'] == 'on' ? 'https://secure.addthis.com' : 'http://s7.addthis.com'
+      $secure ? 'https://secure.addthis.com' : 'http://s7.addthis.com'
     ));
   }
 }
