--- addtofavorites.module.orig	2011-01-02 20:38:40.000000000 -0800
+++ addtofavorites.module	2011-01-02 20:41:42.000000000 -0800
@@ -133,13 +133,9 @@
     $display_homepage_OK = variable_get('addtofavorites_homepage_OK', 1); //add the site to the browser's homepage
     $display_text_homepage = variable_get('addtofavorites_homepage', t("Make Us your homepage"));
     $display_icon_homepage = base_path() . drupal_get_path('module', 'addtofavorites') ."/images/set_homepage.gif";
-    
-    
-    $path = drupal_get_path('module', 'addtofavorites');
-    
-    drupal_add_js($path . '/addtofavorites.js');
+
     $links = "";
-    
+
     if ($display_site_OK) { 
             if ($display_icons) { 
 	    	$links .= "<img src=\"" . $display_icon_site . "\"";
@@ -183,3 +179,16 @@
     return $block;
   }
 }
+
+/**
+ * Implementation of hook_init().
+ *
+ * These includes do not need to be loaded for cached pages.
+ */
+function addtofavorites_init() {
+  // Add necessary JS.
+  // TODO: These shouldn't be loaded on every page, but block caching omits
+  // JS files that would be otherwise added.
+  $path = drupal_get_path('module', 'addtofavorites');
+  drupal_add_js($path . '/addtofavorites.js');
+} 
\ No newline at end of file
