/**  Drop Down Menu Class

Implements Drop Down Menu behaviour using a trigger_node (what is clicked to show the menu) and the menu_node (a hidden element that appears when the trigger node is clicked).

The menu_node is automatically positioned beneath the trigger_node in the constructor.
**/

var DropDownMenu = Class.create({
  initialize: function(trigger_node, menu_node) {
    this.trigger_node = trigger_node;
    this.menu_node = menu_node;
    $(this.menu_node).hide();

    //Set up the trigger_node click event
    var me = this;
    $(this.trigger_node).observe('click', function(event) {
      me.refreshPositions();
      me.show();
    });
    //Set up the trigger_node mouseout event
    $(this.trigger_node).observe('mouseout', function(event) {
      var menu_node = me.getMenuNode();
      var mouse_entered = me.getRelatedTarget(event);
      if(mouse_entered !== null && !mouse_entered.descendantOf(menu_node) && mouse_entered.tagName != "HTML") {
        me.hide();
      }
    });
    
  },
  refreshPositions: function() {
    //Get cumulative position offsets of trigger_node...
    var offset_left, offset_top, offset_height;
    [offset_left, offset_top] = $(this.getTriggerNode()).cumulativeOffset();
    offset_height = $(this.getTriggerNode()).getHeight();
    
    //Position menu node so that it's directly under the trigger node, and
    //hide it
    $(this.getMenuNode()).setStyle({
      position: 'absolute',
      left: offset_left + 'px',
      top: (offset_top + offset_height) + 'px',
      zIndex: 1
    });

  },
  getTriggerNode: function() {
    return this.trigger_node;
  },
  setTriggerNode: function(trigger_node) {
    this.trigger_node = trigger_node;
  },
  getMenuNode: function() {
    return this.menu_node;
  },
  setMenuNode: function(menu_node) {
    this.menu_node = menu_node;
  },
  show: function() {
    $(this.menu_node).show();
  },
  hide: function() {
    $(this.menu_node).hide();
  },
  getRelatedTarget: function(event) {
    if(event.toElement) {
      return event.toElement;
    }
    if(event.relatedTarget) {
      return event.relatedTarget;
    }
    return null;
  }
});

@@ -1002,18 +1002,14 @@
 %7D);%0A
-    %0A
   %7D,%0A
+%0A
   re
@@ -1150,9 +1150,8 @@
     
-%5B
 offs
@@ -1149,33 +1149,86 @@
 %0A    offset_left
-,
+ = $(this.getTriggerNode()).cumulativeOffset()%5B0%5D;%0A   
  offset_top%5D = $
@@ -1222,17 +1222,16 @@
 fset_top
-%5D
  = $(thi
@@ -1268,16 +1268,19 @@
 Offset()
+%5B1%5D
 ;%0A    of
@@ -1335,13 +1335,9 @@
 ();%0A
-    
 %0A
+
     
@@ -1590,22 +1590,22 @@
     %7D);%0A
-%0A
   %7D,%0A
+%0A
   getTri
@@ -1658,24 +1658,25 @@
 _node;%0A  %7D,%0A
+%0A
   setTrigger
@@ -1745,24 +1745,25 @@
 _node;%0A  %7D,%0A
+%0A
   getMenuNod
@@ -1810,16 +1810,17 @@
 e;%0A  %7D,%0A
+%0A
   setMen
@@ -1885,16 +1885,17 @@
 e;%0A  %7D,%0A
+%0A
   show: 
@@ -1942,16 +1942,17 @@
 );%0A  %7D,%0A
+%0A
   hide: 
@@ -1994,21 +1994,22 @@
 hide();%0A
-
   %7D,%0A
+%0A
   getRel

FIX the Annotation DropDownMenu now works for IE, Safary, and Chrome.