Index: hovertip.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hovertip/hovertip.js,v
retrieving revision 1.1
diff -u -u -F^f -r1.1 hovertip.js
--- hovertip.js	15 Jan 2007 02:29:58 -0000	1.1
+++ hovertip.js	20 Feb 2007 15:12:06 -0000
@@ -9,9 +9,9 @@
  *  Requires jQuery.js.  <http://jquery.com>, 
  *  which may be distributed under a different licence.
  *  
- *  $Date: 2007/01/15 02:29:58 $
+ *  $Date: 2006-09-15 12:49:19 -0700 (Fri, 15 Sep 2006) $
  *  $Rev: $
- *  $Id: hovertip.js,v 1.1 2007/01/15 02:29:58 yogadex Exp $
+ *  $Id:$
  *  
  *  This plugin helps you create tooltips.  It supports:
  *  
@@ -153,7 +153,12 @@ function hovertipMouseXY(e) {
  * <span>target term</span><span class="hovertip">tooltip text</span>
  */
 targetSelectByPrevious = function(el, config) {
-  return $(el.previousSibling);
+  sibling = el.previousSibling;
+  // If the previous sibling is not an element, keep looking
+  while (sibling && sibling.nodeType != 1)
+    sibling = sibling.previousSibling;
+    
+  return $(sibling);
 }
 
 /**
@@ -400,29 +405,48 @@ function hovertipInit() {
   
   // end optional FX section
   
-  /**
-   * To enable this style of markup (id on tooltip):
-   * <span hovertip="foo">target</span>...
-   * <div id="foo" class="hovertip">blah blah</div>
-   */
-  window.setTimeout(function() {
-    $(hovertipSelect).hovertipActivate(hovertipConfig,
-                                       targetSelectById,
-                                       hovertipPrepare,
-                                       hovertipTargetPrepare);
-  }, 0);
+  if (1) { // enable some of the following methods, but not all
+    /**
+     * To enable this style of markup (id on tooltip):
+     * <span hovertip="foo">target</span>...
+     * <div id="foo" class="hovertip">blah blah</div>
+     */
+    window.setTimeout(function() {
+        $(hovertipSelect).hovertipActivate(hovertipConfig,
+                                           targetSelectById,
+                                           hovertipPrepare,
+                                           hovertipTargetPrepare);
+      }, 0);
+    
+    /**
+     * To enable this style of markup (id on target):
+     * <span id="foo">target</span>...
+     * <div target="foo" class="hovertip">blah blah</div>
+     */
+    window.setTimeout(function() {
+        $(hovertipSelect).hovertipActivate(hovertipConfig,
+                                           targetSelectByTargetAttribute,
+                                           hovertipPrepare,
+                                           hovertipTargetPrepare);
+      }, 0);
+  } else {
+    /**
+     * To enable this style of markup (id on target):
+     * <span>target</span>...
+     * <div class="hovertip">blah blah</div>
+     * 
+     * Note that your should enable either this method, or preceeding (target
+     * attribute) method.  Not both, as the div with class=hovertip will be
+     * associated with more than one target.  
+     */
+    window.setTimeout(function() {
+        $(hovertipSelect).hovertipActivate(hovertipConfig,
+                                           targetSelectByPrevious,
+                                           hovertipPrepare,
+                                           hovertipTargetPrepare);
+      }, 0);
+  }
 
-  /**
-   * To enable this style of markup (id on target):
-   * <span id="foo">target</span>...
-   * <div target="foo" class="hovertip">blah blah</div>
-   */
-  window.setTimeout(function() {
-    $(hovertipSelect).hovertipActivate(hovertipConfig,
-                                       targetSelectByTargetAttribute,
-                                       hovertipPrepare,
-                                       hovertipTargetPrepare);
-  }, 0);
   
   /**
    * This next section enables this style of markup:
