Index: sharethis.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sharethis/Attic/sharethis.module,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 sharethis.module
--- sharethis.module	16 Dec 2008 22:27:52 -0000	1.1.2.5
+++ sharethis.module	16 Dec 2008 23:11:55 -0000
@@ -142,17 +142,19 @@
   if (!$teaser || variable_get('sharethis_teaser', 1)) {
     if (variable_get('sharethis_sharethis_this_where', 'links') == 'links') {
       if (_sharethis_sharethis_this_show($node->type, $node->nid) && user_access('use share this')) {
-        if (sharethis_add_js()) {
           $sharethis = sharethis_get_js($node->title, array(
             'url' => url('node/'. $node->nid, array('absolute' => TRUE)),
           ));
           $links['sharethis_sharethis_this'] = array(
-            'title' => $sharethis,
-            'html' => TRUE,
+            'title' => t('ShareThis'),
             'attributes' => array('id' => 'sharethis_'. $node->nid),
           );
+          sharethis_add_js('sharethis_'. $node->nid, array(
+            'title' => $node->title,
+            'url' => url('node/'. $node->nid, array('absolute' => TRUE)),
+          ));
           return $links;
-        }
+          
       }
     }
   }
@@ -182,20 +184,35 @@
 }
 
 /**
- * Adds the ShareThis JavaScript header code.
- *
- * @return
- *   Whether or not the code was added.
+ * Adds a ShareThis button to the page.
  */
-function sharethis_add_js() {
+function sharethis_add_js($id, $options = array(), $element = array()) {
+  if (empty($element)) {
+    $element = array('button' => TRUE);
+  }
   static $added = FALSE;
+  // Make sure the ShareThis header code is added.
   if ($added === FALSE) {
     $code = variable_get('sharethis_sharethis_this_code', 0);
     if (!empty($code)) {
-      drupal_set_html_head($code);
+      $sharethis = array('shareThisCode' => $code);
+      drupal_add_js($sharethis, 'setting');
+      drupal_add_js(drupal_get_path('module', 'sharethis') .'/sharethis.js');
       $added = TRUE;
     }
   }
+  
+  if ($added) {
+    $sharethis = array(
+      'shareThis' => array(
+        $id => array(
+          'options' => $options,
+          'element' => $element,
+        ),
+      ),
+    );
+    drupal_add_js($sharethis, 'setting');
+  }
   return $added;
 }
 
Index: sharethis.js
===================================================================
RCS file: sharethis.js
diff -N sharethis.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sharethis.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,17 @@
+// $Id$
+
+/**
+ * Drupal ShareThis behaviors.
+ */
+Drupal.behaviors.sharethis = function() {
+  if (Drupal.settings.shareThisCode) {
+    jQuery.getScript(Drupal.settings.shareThisCode, function() {
+      for (shareThis in Drupal.settings.shareThis) {
+        var share = Drupal.settings.shareThis[shareThis];
+        var options = share.options;
+        var element = share.element;
+        var blah = SHARETHIS.addEntry(options, element);
+      }
+    });
+  }
+}
