diff --git a/sharethis.module b/sharethis.module
index b11b052..ad2f3fe 100644
--- a/sharethis.module
+++ b/sharethis.module
@@ -33,6 +33,39 @@ function sharethis_help($path, $arg) {
 }
 
 /**
+ * Implements hook_page_build().
+ */
+function sharethis_page_build() {
+  // First get all of the options for the sharethis widget from the database:
+  $data_options = sharethis_get_options_array();
+
+  // These are the ShareThis scripts:
+  $st_js_options['switchTo5x'] = $data_options['widget'] == 'st_multi' ? TRUE : FALSE;
+  if ($data_options['late_load']) {
+    $st_js_options['__st_loadLate'] = TRUE;
+  }
+  $st_js = "<script type='text/javascript'>";
+  foreach ($st_js_options as $name => $value) {
+    $st_js .= 'var ' . $name . ' = ' . drupal_json_encode($value) . ';';
+  }
+  $st_js .= '</script>';
+
+  // Check if we're using SSL or not.
+  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
+    $st_js .= "<script type='text/javascript' src='https://ws.sharethis.com/button/buttons.js'></script>";
+  }
+  else {
+    $st_js .= "<script type='text/javascript' src='http://w.sharethis.com/button/buttons.js'></script>";
+  }
+
+  // Provide the publisher ID.
+  $stlight = drupal_json_encode(array(
+    'publisher' => $data_options['publisherID'],
+  ));
+  $st_js .= "<script type='text/javascript'>stLight.options($stlight);</script>";
+}
+
+/**
  * Implements hook_permission().
  */
 function sharethis_permission() {
@@ -445,31 +478,7 @@ function sharethis_get_button_HTML($data_options, $mPath, $mTitle) {
     ));
   }
 
-  // These are the ShareThis scripts:
-  $st_js_options['switchTo5x'] = $data_options['widget'] == 'st_multi' ? TRUE : FALSE;
-  if ($data_options['late_load']) {
-    $st_js_options['__st_loadLate'] = TRUE;
-  }
-  $st_js = "<script type='text/javascript'>";
-  foreach ($st_js_options as $name => $value) {
-    $st_js .= 'var ' . $name . ' = ' . drupal_json_encode($value) . ';';
-  }
-  $st_js .= '</script>';
-
-  // Check if we're using SSL or not.
-  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
-    $st_js .= "<script type='text/javascript' src='https://ws.sharethis.com/button/buttons.js'></script>";
-  }
-  else {
-    $st_js .= "<script type='text/javascript' src='http://w.sharethis.com/button/buttons.js'></script>";
-  }
-
-  // Provide the publisher ID.
-  $stlight = drupal_json_encode(array(
-    'publisher' => $data_options['publisherID'],
-  ));
-  $st_js .= "<script type='text/javascript'>stLight.options($stlight);</script>";
-  return '<div class="sharethis-wrapper">' . $st_spans . $st_js . '</div>';
+  return '<div class="sharethis-wrapper">' . $st_spans . '</div>';
 }
 
 /**
