]> git.mjollnir.org Git - moodle.git/commitdiff
Checking YUI into Moodle for future AJAX work
authormoodler <moodler>
Thu, 13 Jul 2006 08:35:43 +0000 (08:35 +0000)
committermoodler <moodler>
Thu, 13 Jul 2006 08:35:43 +0000 (08:35 +0000)
101 files changed:
lib/yui/README.txt [new file with mode: 0644]
lib/yui/animation/README [new file with mode: 0755]
lib/yui/animation/animation-debug.js [new file with mode: 0755]
lib/yui/animation/animation-min.js [new file with mode: 0755]
lib/yui/animation/animation.js [new file with mode: 0755]
lib/yui/autocomplete/README [new file with mode: 0755]
lib/yui/autocomplete/autocomplete-debug.js [new file with mode: 0755]
lib/yui/autocomplete/autocomplete-min.js [new file with mode: 0755]
lib/yui/autocomplete/autocomplete.js [new file with mode: 0755]
lib/yui/calendar/README [new file with mode: 0755]
lib/yui/calendar/assets/calendar.css [new file with mode: 0755]
lib/yui/calendar/assets/callt.gif [new file with mode: 0755]
lib/yui/calendar/assets/calrt.gif [new file with mode: 0755]
lib/yui/calendar/assets/calx.gif [new file with mode: 0755]
lib/yui/calendar/calendar-debug.js [new file with mode: 0755]
lib/yui/calendar/calendar-min.js [new file with mode: 0755]
lib/yui/calendar/calendar.js [new file with mode: 0755]
lib/yui/connection/README [new file with mode: 0755]
lib/yui/connection/connection-debug.js [new file with mode: 0755]
lib/yui/connection/connection-min.js [new file with mode: 0755]
lib/yui/connection/connection.js [new file with mode: 0755]
lib/yui/container/README [new file with mode: 0755]
lib/yui/container/assets/alrt16_1.gif [new file with mode: 0755]
lib/yui/container/assets/blck16_1.gif [new file with mode: 0755]
lib/yui/container/assets/close12_1.gif [new file with mode: 0755]
lib/yui/container/assets/container.css [new file with mode: 0755]
lib/yui/container/assets/hlp16_1.gif [new file with mode: 0755]
lib/yui/container/assets/info16_1.gif [new file with mode: 0755]
lib/yui/container/assets/tip16_1.gif [new file with mode: 0755]
lib/yui/container/assets/warn16_1.gif [new file with mode: 0755]
lib/yui/container/container-debug.js [new file with mode: 0755]
lib/yui/container/container-min.js [new file with mode: 0755]
lib/yui/container/container.js [new file with mode: 0755]
lib/yui/container/container_core-debug.js [new file with mode: 0755]
lib/yui/container/container_core-min.js [new file with mode: 0755]
lib/yui/container/container_core.js [new file with mode: 0755]
lib/yui/dom/README [new file with mode: 0755]
lib/yui/dom/dom-debug.js [new file with mode: 0755]
lib/yui/dom/dom-min.js [new file with mode: 0755]
lib/yui/dom/dom.js [new file with mode: 0755]
lib/yui/dragdrop/README [new file with mode: 0755]
lib/yui/dragdrop/dragdrop-debug.js [new file with mode: 0755]
lib/yui/dragdrop/dragdrop-min.js [new file with mode: 0755]
lib/yui/dragdrop/dragdrop.js [new file with mode: 0755]
lib/yui/event/README [new file with mode: 0755]
lib/yui/event/event-debug.js [new file with mode: 0755]
lib/yui/event/event-min.js [new file with mode: 0755]
lib/yui/event/event.js [new file with mode: 0755]
lib/yui/fonts/README [new file with mode: 0755]
lib/yui/fonts/fonts-min.css [new file with mode: 0755]
lib/yui/fonts/fonts.css [new file with mode: 0755]
lib/yui/grids/README [new file with mode: 0755]
lib/yui/grids/grids-min.css [new file with mode: 0755]
lib/yui/grids/grids.css [new file with mode: 0755]
lib/yui/logger/README [new file with mode: 0755]
lib/yui/logger/assets/logger.css [new file with mode: 0755]
lib/yui/logger/logger-debug.js [new file with mode: 0755]
lib/yui/logger/logger-min.js [new file with mode: 0755]
lib/yui/logger/logger.js [new file with mode: 0755]
lib/yui/menu/README [new file with mode: 0755]
lib/yui/menu/assets/menu.css [new file with mode: 0755]
lib/yui/menu/assets/menuarodwn8_dim_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuarodwn8_hov_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuarodwn8_nrm_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuarorght8_dim_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuarorght8_hov_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuarorght8_nrm_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuchk8_dim_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuchk8_hov_1.gif [new file with mode: 0755]
lib/yui/menu/assets/menuchk8_nrm_1.gif [new file with mode: 0755]
lib/yui/menu/menu-debug.js [new file with mode: 0755]
lib/yui/menu/menu-min.js [new file with mode: 0755]
lib/yui/menu/menu.js [new file with mode: 0755]
lib/yui/reset/README [new file with mode: 0755]
lib/yui/reset/reset-min.css [new file with mode: 0755]
lib/yui/reset/reset.css [new file with mode: 0755]
lib/yui/slider/README [new file with mode: 0755]
lib/yui/slider/slider-debug.js [new file with mode: 0755]
lib/yui/slider/slider-min.js [new file with mode: 0755]
lib/yui/slider/slider.js [new file with mode: 0755]
lib/yui/treeview/README [new file with mode: 0755]
lib/yui/treeview/assets/lm.gif [new file with mode: 0755]
lib/yui/treeview/assets/lmh.gif [new file with mode: 0755]
lib/yui/treeview/assets/ln.gif [new file with mode: 0755]
lib/yui/treeview/assets/loading.gif [new file with mode: 0755]
lib/yui/treeview/assets/lp.gif [new file with mode: 0755]
lib/yui/treeview/assets/lph.gif [new file with mode: 0755]
lib/yui/treeview/assets/tm.gif [new file with mode: 0755]
lib/yui/treeview/assets/tmh.gif [new file with mode: 0755]
lib/yui/treeview/assets/tn.gif [new file with mode: 0755]
lib/yui/treeview/assets/tp.gif [new file with mode: 0755]
lib/yui/treeview/assets/tph.gif [new file with mode: 0755]
lib/yui/treeview/assets/tree.css [new file with mode: 0755]
lib/yui/treeview/assets/vline.gif [new file with mode: 0755]
lib/yui/treeview/treeview-debug.js [new file with mode: 0755]
lib/yui/treeview/treeview-min.js [new file with mode: 0755]
lib/yui/treeview/treeview.js [new file with mode: 0755]
lib/yui/yahoo/README [new file with mode: 0755]
lib/yui/yahoo/yahoo-debug.js [new file with mode: 0755]
lib/yui/yahoo/yahoo-min.js [new file with mode: 0755]
lib/yui/yahoo/yahoo.js [new file with mode: 0755]

diff --git a/lib/yui/README.txt b/lib/yui/README.txt
new file mode 100644 (file)
index 0000000..e67ccb8
--- /dev/null
@@ -0,0 +1,8 @@
+This directory is a completely unmodified copy of the "build" 
+directory from the Yahoo User Interface library, downloaded 
+from:
+
+        http://developer.yahoo.com/yui
+
+
+Added to Moodle 13th July, 2006
diff --git a/lib/yui/animation/README b/lib/yui/animation/README
new file mode 100755 (executable)
index 0000000..0dad542
--- /dev/null
@@ -0,0 +1,20 @@
+Animation Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* ColorAnim subclass added\r
+* Motion and Scroll now inherit from ColorAnim\r
+* getDefaultUnit method added\r
+* defaultUnit and defaultUnits deprecated\r
+* getDefault and setDefault methods deprecated\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Scroll now handles relative ("by") animation correctly \r
+\r
+* Now converts "auto" values of "from" to appropriate initial values\r
+\r
+*** version 0.9.0 ***\r
+\r
+* Initial release\r
+\r
diff --git a/lib/yui/animation/animation-debug.js b/lib/yui/animation/animation-debug.js
new file mode 100755 (executable)
index 0000000..7b9320d
--- /dev/null
@@ -0,0 +1,1288 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.11.0\r
+*/\r
+\r
+/**\r
+ *\r
+ * Base class for animated DOM objects.\r
+ * @class Base animation class that provides the interface for building animated effects.\r
+ * <p>Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);</p>\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+\r
+YAHOO.util.Anim = function(el, attributes, duration, method) {\r
+   if (el) {\r
+      this.init(el, attributes, duration, method);\r
+   }\r
+};\r
+\r
+YAHOO.util.Anim.prototype = {\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   toString: function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Anim " + id);\r
+   },\r
+\r
+   patterns: { // cached for performance\r
+      noNegatives:      /width|height|opacity|padding/i, // keep at zero or above\r
+      offsetAttribute:  /^((width|height)|(top|left))$/, // use offsetValue as default\r
+      defaultUnit:      /width|height|top$|bottom$|left$|right$/i, // use 'px' by default\r
+      offsetUnit:       /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset\r
+   },\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   doMethod: function(attr, start, end) {\r
+      return this.method(this.currentFrame, start, end - start, this.totalFrames);\r
+   },\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   setAttribute: function(attr, val, unit) {\r
+      if ( this.patterns.noNegatives.test(attr) ) {\r
+         val = (val > 0) ? val : 0;\r
+      }\r
+\r
+      YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);\r
+   },\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   getAttribute: function(attr) {\r
+      var el = this.getEl();\r
+      var val = YAHOO.util.Dom.getStyle(el, attr);\r
+\r
+      if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {\r
+         return parseFloat(val);\r
+      }\r
+\r
+      var a = this.patterns.offsetAttribute.exec(attr) || [];\r
+      var pos = !!( a[3] ); // top or left\r
+      var box = !!( a[2] ); // width or height\r
+\r
+      // use offsets for width/height and abs pos top/left\r
+      if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {\r
+         val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];\r
+      } else { // default to zero for other 'auto'\r
+         val = 0;\r
+      }\r
+\r
+      return val;\r
+   },\r
+\r
+   /**\r
+    * Returns the unit to use when none is supplied.\r
+    * Applies the "defaultUnit" test to decide whether to use pixels or not\r
+    * @param {attr} attr The name of the attribute.\r
+    * @return {String} The default unit to be used.\r
+    */\r
+   getDefaultUnit: function(attr) {\r
+       if ( this.patterns.defaultUnit.test(attr) ) {\r
+         return 'px';\r
+       }\r
+\r
+       return '';\r
+   },\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   setRuntimeAttribute: function(attr) {\r
+      var start;\r
+      var end;\r
+      var attributes = this.attributes;\r
+\r
+      this.runtimeAttributes[attr] = {};\r
+\r
+      var isset = function(prop) {\r
+         return (typeof prop !== 'undefined');\r
+      };\r
+\r
+      if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {\r
+         return false; // note return; nothing to animate to\r
+      }\r
+\r
+      start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);\r
+\r
+      // To beats by, per SMIL 2.1 spec\r
+      if ( isset(attributes[attr]['to']) ) {\r
+         end = attributes[attr]['to'];\r
+      } else if ( isset(attributes[attr]['by']) ) {\r
+         if (start.constructor == Array) {\r
+            end = [];\r
+            for (var i = 0, len = start.length; i < len; ++i) {\r
+               end[i] = start[i] + attributes[attr]['by'][i];\r
+            }\r
+         } else {\r
+            end = start + attributes[attr]['by'];\r
+         }\r
+      }\r
+\r
+      this.runtimeAttributes[attr].start = start;\r
+      this.runtimeAttributes[attr].end = end;\r
+\r
+      // set units if needed\r
+      this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);\r
+   },\r
+\r
+   /**\r
+    * @param {String or HTMLElement} el Reference to the element that will be animated\r
+    * @param {Object} attributes The attribute(s) to be animated.\r
+    * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+    * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+    * All attribute names use camelCase.\r
+    * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+    * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+    */\r
+   init: function(el, attributes, duration, method) {\r
+      /**\r
+       * Whether or not the animation is running.\r
+       * @private\r
+       * @type Boolean\r
+       */\r
+      var isAnimated = false;\r
+\r
+      /**\r
+       * A Date object that is created when the animation begins.\r
+       * @private\r
+       * @type Date\r
+       */\r
+      var startTime = null;\r
+\r
+      /**\r
+       * The number of frames this animation was able to execute.\r
+       * @private\r
+       * @type Int\r
+       */\r
+      var actualFrames = 0;\r
+\r
+      /**\r
+       * The element to be animated.\r
+       * @private\r
+       * @type HTMLElement\r
+       */\r
+      el = YAHOO.util.Dom.get(el);\r
+\r
+      /**\r
+       * The collection of attributes to be animated.\r
+       * Each attribute must have at least a "to" or "by" defined in order to animate.\r
+       * If "to" is supplied, the animation will end with the attribute at that value.\r
+       * If "by" is supplied, the animation will end at that value plus its starting value.\r
+       * If both are supplied, "to" is used, and "by" is ignored.\r
+       * @member YAHOO#util#Anim\r
+       * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).\r
+       * @type Object\r
+       */\r
+      this.attributes = attributes || {};\r
+\r
+      /**\r
+       * The length of the animation.  Defaults to "1" (second).\r
+       * @type Number\r
+       */\r
+      this.duration = duration || 1;\r
+\r
+      /**\r
+       * The method that will provide values to the attribute(s) during the animation.\r
+       * Defaults to "YAHOO.util.Easing.easeNone".\r
+       * @type Function\r
+       */\r
+      this.method = method || YAHOO.util.Easing.easeNone;\r
+\r
+      /**\r
+       * Whether or not the duration should be treated as seconds.\r
+       * Defaults to true.\r
+       * @type Boolean\r
+       */\r
+      this.useSeconds = true; // default to seconds\r
+\r
+      /**\r
+       * The location of the current animation on the timeline.\r
+       * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.\r
+       * @type Int\r
+       */\r
+      this.currentFrame = 0;\r
+\r
+      /**\r
+       * The total number of frames to be executed.\r
+       * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.\r
+       * @type Int\r
+       */\r
+      this.totalFrames = YAHOO.util.AnimMgr.fps;\r
+\r
+\r
+      /**\r
+       * Returns a reference to the animated element.\r
+       * @return {HTMLElement}\r
+       */\r
+      this.getEl = function() { return el; };\r
+\r
+      /**\r
+       * Checks whether the element is currently animated.\r
+       * @return {Boolean} current value of isAnimated.\r
+       */\r
+      this.isAnimated = function() {\r
+         return isAnimated;\r
+      };\r
+\r
+      /**\r
+       * Returns the animation start time.\r
+       * @return {Date} current value of startTime.\r
+       */\r
+      this.getStartTime = function() {\r
+         return startTime;\r
+      };\r
+\r
+      this.runtimeAttributes = {};\r
+\r
+      var logger = {};\r
+      logger.log = function() {YAHOO.log.apply(window, arguments)};\r
+\r
+      logger.log('creating new instance of ' + this);\r
+\r
+      /**\r
+       * Starts the animation by registering it with the animation manager.\r
+       */\r
+      this.animate = function() {\r
+         if ( this.isAnimated() ) { return false; }\r
+\r
+         this.currentFrame = 0;\r
+\r
+         this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;\r
+\r
+         YAHOO.util.AnimMgr.registerElement(this);\r
+      };\r
+\r
+      /**\r
+       * Stops the animation.  Normally called by AnimMgr when animation completes.\r
+       */\r
+      this.stop = function() {\r
+         YAHOO.util.AnimMgr.stop(this);\r
+      };\r
+\r
+      var onStart = function() {\r
+         this.onStart.fire();\r
+         for (var attr in this.attributes) {\r
+            this.setRuntimeAttribute(attr);\r
+         }\r
+\r
+         isAnimated = true;\r
+         actualFrames = 0;\r
+         startTime = new Date();\r
+      };\r
+\r
+      /**\r
+       * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).\r
+       * @private\r
+       */\r
+\r
+      var onTween = function() {\r
+         var data = {\r
+            duration: new Date() - this.getStartTime(),\r
+            currentFrame: this.currentFrame\r
+         };\r
+\r
+         data.toString = function() {\r
+            return (\r
+               'duration: ' + data.duration +\r
+               ', currentFrame: ' + data.currentFrame\r
+            );\r
+         };\r
+\r
+         this.onTween.fire(data);\r
+\r
+         var runtimeAttributes = this.runtimeAttributes;\r
+\r
+         for (var attr in runtimeAttributes) {\r
+            this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);\r
+         }\r
+\r
+         actualFrames += 1;\r
+      };\r
+\r
+      var onComplete = function() {\r
+         var actual_duration = (new Date() - startTime) / 1000 ;\r
+\r
+         var data = {\r
+            duration: actual_duration,\r
+            frames: actualFrames,\r
+            fps: actualFrames / actual_duration\r
+         };\r
+\r
+         data.toString = function() {\r
+            return (\r
+               'duration: ' + data.duration +\r
+               ', frames: ' + data.frames +\r
+               ', fps: ' + data.fps\r
+            );\r
+         };\r
+\r
+         isAnimated = false;\r
+         actualFrames = 0;\r
+         this.onComplete.fire(data);\r
+      };\r
+\r
+      /**\r
+       * Custom event that fires after onStart, useful in subclassing\r
+       * @private\r
+       */\r
+      this._onStart = new YAHOO.util.CustomEvent('_start', this, true);\r
+\r
+      /**\r
+       * Custom event that fires when animation begins\r
+       * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)\r
+       */\r
+      this.onStart = new YAHOO.util.CustomEvent('start', this);\r
+\r
+      /**\r
+       * Custom event that fires between each frame\r
+       * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)\r
+       */\r
+      this.onTween = new YAHOO.util.CustomEvent('tween', this);\r
+\r
+      /**\r
+       * Custom event that fires after onTween\r
+       * @private\r
+       */\r
+      this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);\r
+\r
+      /**\r
+       * Custom event that fires when animation ends\r
+       * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)\r
+       */\r
+      this.onComplete = new YAHOO.util.CustomEvent('complete', this);\r
+      /**\r
+       * Custom event that fires after onComplete\r
+       * @private\r
+       */\r
+      this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);\r
+\r
+      this._onStart.subscribe(onStart);\r
+      this._onTween.subscribe(onTween);\r
+      this._onComplete.subscribe(onComplete);\r
+   }\r
+};\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Handles animation queueing and threading.\r
+ * Used by Anim and subclasses.\r
+ */\r
+YAHOO.util.AnimMgr = new function() {\r
+   /**\r
+    * Reference to the animation Interval\r
+    * @private\r
+    * @type Int\r
+    */\r
+   var thread = null;\r
+\r
+   /**\r
+    * The current queue of registered animation objects.\r
+    * @private\r
+    * @type Array\r
+    */\r
+   var queue = [];\r
+\r
+   /**\r
+    * The number of active animations.\r
+    * @private\r
+    * @type Int\r
+    */\r
+   var tweenCount = 0;\r
+\r
+   /**\r
+    * Base frame rate (frames per second).\r
+    * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).\r
+    * @type Int\r
+    *\r
+    */\r
+   this.fps = 200;\r
+\r
+   /**\r
+    * Interval delay in milliseconds, defaults to fastest possible.\r
+    * @type Int\r
+    *\r
+    */\r
+   this.delay = 1;\r
+\r
+   /**\r
+    * Adds an animation instance to the animation queue.\r
+    * All animation instances must be registered in order to animate.\r
+    * @param {object} tween The Anim instance to be be registered\r
+    */\r
+   this.registerElement = function(tween) {\r
+      queue[queue.length] = tween;\r
+      tweenCount += 1;\r
+      tween._onStart.fire();\r
+      this.start();\r
+   };\r
+\r
+   this.unRegister = function(tween, index) {\r
+      tween._onComplete.fire();\r
+      index = index || getIndex(tween);\r
+      if (index != -1) { queue.splice(index, 1); }\r
+\r
+      tweenCount -= 1;\r
+      if (tweenCount <= 0) { this.stop(); }\r
+   };\r
+\r
+   /**\r
+    * Starts the animation thread.\r
+        * Only one thread can run at a time.\r
+    */\r
+   this.start = function() {\r
+      if (thread === null) { thread = setInterval(this.run, this.delay); }\r
+   };\r
+\r
+   /**\r
+    * Stops the animation thread or a specific animation instance.\r
+    * @param {object} tween A specific Anim instance to stop (optional)\r
+    * If no instance given, Manager stops thread and all animations.\r
+    */\r
+   this.stop = function(tween) {\r
+      if (!tween) {\r
+         clearInterval(thread);\r
+         for (var i = 0, len = queue.length; i < len; ++i) {\r
+            if (queue[i].isAnimated()) {\r
+               this.unRegister(tween, i);\r
+            }\r
+         }\r
+         queue = [];\r
+         thread = null;\r
+         tweenCount = 0;\r
+      }\r
+      else {\r
+         this.unRegister(tween);\r
+      }\r
+   };\r
+\r
+   /**\r
+    * Called per Interval to handle each animation frame.\r
+    */\r
+   this.run = function() {\r
+      for (var i = 0, len = queue.length; i < len; ++i) {\r
+         var tween = queue[i];\r
+         if ( !tween || !tween.isAnimated() ) { continue; }\r
+\r
+         if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)\r
+         {\r
+            tween.currentFrame += 1;\r
+\r
+            if (tween.useSeconds) {\r
+               correctFrame(tween);\r
+            }\r
+            tween._onTween.fire();\r
+         }\r
+         else { YAHOO.util.AnimMgr.stop(tween, i); }\r
+      }\r
+   };\r
+\r
+   var getIndex = function(anim) {\r
+      for (var i = 0, len = queue.length; i < len; ++i) {\r
+         if (queue[i] == anim) {\r
+            return i; // note return;\r
+         }\r
+      }\r
+      return -1;\r
+   };\r
+\r
+   /**\r
+    * On the fly frame correction to keep animation on time.\r
+    * @private\r
+    * @param {Object} tween The Anim instance being corrected.\r
+    */\r
+   var correctFrame = function(tween) {\r
+      var frames = tween.totalFrames;\r
+      var frame = tween.currentFrame;\r
+      var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);\r
+      var elapsed = (new Date() - tween.getStartTime());\r
+      var tweak = 0;\r
+\r
+      if (elapsed < tween.duration * 1000) { // check if falling behind\r
+         tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);\r
+      } else { // went over duration, so jump to end\r
+         tweak = frames - (frame + 1);\r
+      }\r
+      if (tweak > 0 && isFinite(tweak)) { // adjust if needed\r
+         if (tween.currentFrame + tweak >= frames) {// dont go past last frame\r
+            tweak = frames - (frame + 1);\r
+         }\r
+\r
+         tween.currentFrame += tweak;\r
+      }\r
+   };\r
+};\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ *\r
+ * @class Used to calculate Bezier splines for any number of control points.\r
+ *\r
+ */\r
+YAHOO.util.Bezier = new function()\r
+{\r
+   /**\r
+    * Get the current position of the animated element based on t.\r
+    * Each point is an array of "x" and "y" values (0 = x, 1 = y)\r
+    * At least 2 points are required (start and end).\r
+    * First point is start. Last point is end.\r
+    * Additional control points are optional.\r
+    * @param {Array} points An array containing Bezier points\r
+    * @param {Number} t A number between 0 and 1 which is the basis for determining current position\r
+    * @return {Array} An array containing int x and y member data\r
+    */\r
+   this.getPosition = function(points, t)\r
+   {\r
+      var n = points.length;\r
+      var tmp = [];\r
+\r
+      for (var i = 0; i < n; ++i){\r
+         tmp[i] = [points[i][0], points[i][1]]; // save input\r
+      }\r
+\r
+      for (var j = 1; j < n; ++j) {\r
+         for (i = 0; i < n - j; ++i) {\r
+            tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];\r
+            tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];\r
+         }\r
+      }\r
+\r
+      return [ tmp[0][0], tmp[0][1] ];\r
+\r
+   };\r
+};\r
+/**\r
+ * @class ColorAnim subclass for color fading\r
+ * <p>Usage: <code>var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);</code></p>\r
+ * <p>Color values can be specified with either 112233, #112233, [255,255,255], or rgb(255,255,255)\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @constructor\r
+ * @param {HTMLElement | String} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to Y.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a Y.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.ColorAnim = function(el, attributes, duration,  method) {\r
+      YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.ColorAnim.superclass;\r
+   var prototype = Y.ColorAnim.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("ColorAnim " + id);\r
+   };\r
+\r
+   /**\r
+    * Only certain attributes should be treated as colors.\r
+    * @type Object\r
+    */\r
+   prototype.patterns.color = /color$/i;\r
+   prototype.patterns.rgb    = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;\r
+   prototype.patterns.hex    = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;\r
+   prototype.patterns.hex3   = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;\r
+\r
+   /**\r
+    * Attempts to parse the given string and return a 3-tuple.\r
+    * @param {String} s The string to parse.\r
+    * @return {Array} The 3-tuple of rgb values.\r
+    */\r
+   prototype.parseColor = function(s) {\r
+      if (s.length == 3) { return s; }\r
+\r
+      var c = this.patterns.hex.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];\r
+      }\r
+\r
+      c = this.patterns.rgb.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];\r
+      }\r
+\r
+      c = this.patterns.hex3.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];\r
+      }\r
+\r
+      return null;\r
+   };\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      var el = this.getEl();\r
+      if (  this.patterns.color.test(attr) ) {\r
+         var val = YAHOO.util.Dom.getStyle(el, attr);\r
+\r
+         if (val == 'transparent') { // bgcolor default\r
+            var parent = el.parentNode; // try and get from an ancestor\r
+            val = Y.Dom.getStyle(parent, attr);\r
+\r
+            while (parent && val == 'transparent') {\r
+               parent = parent.parentNode;\r
+               val = Y.Dom.getStyle(parent, attr);\r
+               if (parent.tagName.toUpperCase() == 'HTML') {\r
+                  val = 'ffffff';\r
+               }\r
+            }\r
+         }\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val;\r
+\r
+      if ( this.patterns.color.test(attr) ) {\r
+         val = [];\r
+         for (var i = 0, len = start.length; i < len; ++i) {\r
+            val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);\r
+         }\r
+\r
+         val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';\r
+      }\r
+      else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   prototype.setRuntimeAttribute = function(attr) {\r
+      superclass.setRuntimeAttribute.call(this, attr);\r
+\r
+      if ( this.patterns.color.test(attr) ) {\r
+         var attributes = this.attributes;\r
+         var start = this.parseColor(this.runtimeAttributes[attr].start);\r
+         var end = this.parseColor(this.runtimeAttributes[attr].end);\r
+         // fix colors if going "by"\r
+         if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {\r
+            end = this.parseColor(attributes[attr].by);\r
+\r
+            for (var i = 0, len = start.length; i < len; ++i) {\r
+               end[i] = start[i] + end[i];\r
+            }\r
+         }\r
+\r
+         this.runtimeAttributes[attr].start = start;\r
+         this.runtimeAttributes[attr].end = end;\r
+      }\r
+   };\r
+})();/*\r
+TERMS OF USE - EASING EQUATIONS\r
+Open source under the BSD License.\r
+Copyright Â© 2001 Robert Penner All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\r
+\r
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\r
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\r
+    * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+*/\r
+\r
+YAHOO.util.Easing = {\r
+\r
+   /**\r
+    * Uniform speed between points.\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeNone: function (t, b, c, d) {\r
+       return c*t/d + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and accelerates towards end. (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeIn: function (t, b, c, d) {\r
+       return c*(t/=d)*t + b;\r
+   },\r
+\r
+   /**\r
+    * Begins quickly and decelerates towards end.  (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeOut: function (t, b, c, d) {\r
+       return -c *(t/=d)*(t-2) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and decelerates towards end. (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeBoth: function (t, b, c, d) {\r
+       if ((t/=d/2) < 1) return c/2*t*t + b;\r
+       return -c/2 * ((--t)*(t-2) - 1) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and accelerates towards end. (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeInStrong: function (t, b, c, d) {\r
+       return c*(t/=d)*t*t*t + b;\r
+   },\r
+\r
+   /**\r
+    * Begins quickly and decelerates towards end.  (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeOutStrong: function (t, b, c, d) {\r
+       return -c * ((t=t/d-1)*t*t*t - 1) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and decelerates towards end. (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeBothStrong: function (t, b, c, d) {\r
+       if ((t/=d/2) < 1) return c/2*t*t*t*t + b;\r
+       return -c/2 * ((t-=2)*t*t*t - 2) + b;\r
+   },\r
+\r
+   /**\r
+    * snap in elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+\r
+   elasticIn: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
+   },\r
+\r
+   /**\r
+    * snap out elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   elasticOut: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;\r
+   },\r
+\r
+   /**\r
+    * snap both elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   elasticBoth: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
+       return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;\r
+   },\r
+\r
+\r
+   /**\r
+    * back easing in - backtracking slightly, then reversing direction and moving to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backIn: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       return c*(t/=d)*t*((s+1)*t - s) + b;\r
+   },\r
+\r
+   /**\r
+    * back easing out - moving towards target, overshooting it slightly,\r
+    * then reversing and coming back to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backOut: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;\r
+   },\r
+\r
+   /**\r
+    * back easing in/out - backtracking slightly, then reversing direction and moving to target,\r
+    * then overshooting target, reversing, and finally coming back to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backBoth: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;\r
+       return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;\r
+   },\r
+\r
+   /**\r
+    * bounce in\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceIn: function (t, b, c, d) {\r
+       return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;\r
+   },\r
+\r
+   /**\r
+    * bounce out\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceOut: function (t, b, c, d) {\r
+       if ((t/=d) < (1/2.75)) {\r
+               return c*(7.5625*t*t) + b;\r
+       } else if (t < (2/2.75)) {\r
+               return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;\r
+       } else if (t < (2.5/2.75)) {\r
+               return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;\r
+       } else {\r
+               return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;\r
+       }\r
+   },\r
+\r
+   /**\r
+    * bounce both\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceBoth: function (t, b, c, d) {\r
+       if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;\r
+       return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;\r
+   }\r
+};\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Anim subclass for moving elements along a path defined by the "points" member of "attributes".  All "points" are arrays with x, y coordinates.\r
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.Motion = function(el, attributes, duration,  method) {\r
+      if (el) { // dont break existing subclasses not using YAHOO.extend\r
+         YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);\r
+      }\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.Motion.superclass;\r
+   var prototype = Y.Motion.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Motion " + id);\r
+   };\r
+\r
+   prototype.patterns.points = /^points$/i;\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   prototype.setAttribute = function(attr, val, unit) {\r
+      if (  this.patterns.points.test(attr) ) {\r
+         unit = unit || 'px';\r
+         superclass.setAttribute.call(this, 'left', val[0], unit);\r
+         superclass.setAttribute.call(this, 'top', val[1], unit);\r
+      } else {\r
+         superclass.setAttribute.call(this, attr, val, unit);\r
+      }\r
+   };\r
+\r
+   /**\r
+    * Sets the default value to be used when "from" is not supplied.\r
+    * @param {String} attr The attribute being set.\r
+    * @param {Number} val The default value to be applied to the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      if (  this.patterns.points.test(attr) ) {\r
+         var val = [\r
+            superclass.getAttribute.call(this, 'left'),\r
+            superclass.getAttribute.call(this, 'top')\r
+         ];\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val = null;\r
+\r
+      if ( this.patterns.points.test(attr) ) {\r
+         var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;\r
+         val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);\r
+      } else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   prototype.setRuntimeAttribute = function(attr) {\r
+      if ( this.patterns.points.test(attr) ) {\r
+         var el = this.getEl();\r
+         var attributes = this.attributes;\r
+         var start;\r
+         var control = attributes['points']['control'] || [];\r
+         var end;\r
+         var i, len;\r
+\r
+         if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points\r
+            control = [control];\r
+         } else { // break reference to attributes.points.control\r
+            var tmp = [];\r
+            for (i = 0, len = control.length; i< len; ++i) {\r
+               tmp[i] = control[i];\r
+            }\r
+            control = tmp;\r
+         }\r
+\r
+         if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative\r
+            Y.Dom.setStyle(el, 'position', 'relative');\r
+         }\r
+\r
+         if ( isset(attributes['points']['from']) ) {\r
+            Y.Dom.setXY(el, attributes['points']['from']); // set position to from point\r
+         }\r
+         else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position\r
+\r
+         start = this.getAttribute('points'); // get actual top & left\r
+\r
+         // TO beats BY, per SMIL 2.1 spec\r
+         if ( isset(attributes['points']['to']) ) {\r
+            end = translateValues.call(this, attributes['points']['to'], start);\r
+\r
+            var pageXY = Y.Dom.getXY(this.getEl());\r
+            for (i = 0, len = control.length; i < len; ++i) {\r
+               control[i] = translateValues.call(this, control[i], start);\r
+            }\r
+\r
+\r
+         } else if ( isset(attributes['points']['by']) ) {\r
+            end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];\r
+\r
+            for (i = 0, len = control.length; i < len; ++i) {\r
+               control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];\r
+            }\r
+         }\r
+\r
+         this.runtimeAttributes[attr] = [start];\r
+\r
+         if (control.length > 0) {\r
+            this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);\r
+         }\r
+\r
+         this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;\r
+      }\r
+      else {\r
+         superclass.setRuntimeAttribute.call(this, attr);\r
+      }\r
+   };\r
+\r
+   var translateValues = function(val, start) {\r
+      var pageXY = Y.Dom.getXY(this.getEl());\r
+      val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];\r
+\r
+      return val;\r
+   };\r
+\r
+   var isset = function(prop) {\r
+      return (typeof prop !== 'undefined');\r
+   };\r
+})();\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Anim subclass for scrolling elements to a position defined by the "scroll" member of "attributes".  All "scroll" members are arrays with x, y scroll positions.\r
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.Scroll = function(el, attributes, duration,  method) {\r
+      if (el) { // dont break existing subclasses not using YAHOO.extend\r
+         YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);\r
+      }\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.Scroll.superclass;\r
+   var prototype = Y.Scroll.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Scroll " + id);\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val = null;\r
+\r
+      if (attr == 'scroll') {\r
+         val = [\r
+            this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),\r
+            this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)\r
+         ];\r
+\r
+      } else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      var val = null;\r
+      var el = this.getEl();\r
+\r
+      if (attr == 'scroll') {\r
+         val = [ el.scrollLeft, el.scrollTop ];\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   prototype.setAttribute = function(attr, val, unit) {\r
+      var el = this.getEl();\r
+\r
+      if (attr == 'scroll') {\r
+         el.scrollLeft = val[0];\r
+         el.scrollTop = val[1];\r
+      } else {\r
+         superclass.setAttribute.call(this, attr, val, unit);\r
+      }\r
+   };\r
+})();\r
diff --git a/lib/yui/animation/animation-min.js b/lib/yui/animation/animation-min.js
new file mode 100755 (executable)
index 0000000..bbea1cc
--- /dev/null
@@ -0,0 +1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.0*/YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(){YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();for(var attr in this.attributes){this.setRuntimeAttribute(attr);}isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){this.unRegister(tween,i);}}queue=[];thread=null;tweenCount=0;}else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null){tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}tween._onTween.fire();}else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var prototype=Y.ColorAnim.prototype;prototype.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};prototype.patterns.color=/color$/i;prototype.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;prototype.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;prototype.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;prototype.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};prototype.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(val=='transparent'){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&val=='transparent'){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='ffffff';}}}}else{val=superclass.getAttribute.call(this,attr);}return val;};prototype.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};prototype.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},bounceBoth:function(t,b,c,d){if(t<d/2)return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var prototype=Y.Motion.prototype;prototype.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};prototype.patterns.points=/^points$/i;prototype.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};prototype.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}return val;};prototype.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};prototype.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}control=tmp;}if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}else{Y.Dom.setXY(el,Y.Dom.getXY(el));}start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var prototype=Y.Scroll.prototype;prototype.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};prototype.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};prototype.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};prototype.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();\r
diff --git a/lib/yui/animation/animation.js b/lib/yui/animation/animation.js
new file mode 100755 (executable)
index 0000000..5f2f9d1
--- /dev/null
@@ -0,0 +1,1284 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.11.0\r
+*/\r
+\r
+/**\r
+ *\r
+ * Base class for animated DOM objects.\r
+ * @class Base animation class that provides the interface for building animated effects.\r
+ * <p>Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);</p>\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+\r
+YAHOO.util.Anim = function(el, attributes, duration, method) {\r
+   if (el) {\r
+      this.init(el, attributes, duration, method);\r
+   }\r
+};\r
+\r
+YAHOO.util.Anim.prototype = {\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   toString: function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Anim " + id);\r
+   },\r
+\r
+   patterns: { // cached for performance\r
+      noNegatives:      /width|height|opacity|padding/i, // keep at zero or above\r
+      offsetAttribute:  /^((width|height)|(top|left))$/, // use offsetValue as default\r
+      defaultUnit:      /width|height|top$|bottom$|left$|right$/i, // use 'px' by default\r
+      offsetUnit:       /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset\r
+   },\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   doMethod: function(attr, start, end) {\r
+      return this.method(this.currentFrame, start, end - start, this.totalFrames);\r
+   },\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   setAttribute: function(attr, val, unit) {\r
+      if ( this.patterns.noNegatives.test(attr) ) {\r
+         val = (val > 0) ? val : 0;\r
+      }\r
+\r
+      YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);\r
+   },\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   getAttribute: function(attr) {\r
+      var el = this.getEl();\r
+      var val = YAHOO.util.Dom.getStyle(el, attr);\r
+\r
+      if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {\r
+         return parseFloat(val);\r
+      }\r
+\r
+      var a = this.patterns.offsetAttribute.exec(attr) || [];\r
+      var pos = !!( a[3] ); // top or left\r
+      var box = !!( a[2] ); // width or height\r
+\r
+      // use offsets for width/height and abs pos top/left\r
+      if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {\r
+         val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];\r
+      } else { // default to zero for other 'auto'\r
+         val = 0;\r
+      }\r
+\r
+      return val;\r
+   },\r
+\r
+   /**\r
+    * Returns the unit to use when none is supplied.\r
+    * Applies the "defaultUnit" test to decide whether to use pixels or not\r
+    * @param {attr} attr The name of the attribute.\r
+    * @return {String} The default unit to be used.\r
+    */\r
+   getDefaultUnit: function(attr) {\r
+       if ( this.patterns.defaultUnit.test(attr) ) {\r
+         return 'px';\r
+       }\r
+\r
+       return '';\r
+   },\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   setRuntimeAttribute: function(attr) {\r
+      var start;\r
+      var end;\r
+      var attributes = this.attributes;\r
+\r
+      this.runtimeAttributes[attr] = {};\r
+\r
+      var isset = function(prop) {\r
+         return (typeof prop !== 'undefined');\r
+      };\r
+\r
+      if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {\r
+         return false; // note return; nothing to animate to\r
+      }\r
+\r
+      start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);\r
+\r
+      // To beats by, per SMIL 2.1 spec\r
+      if ( isset(attributes[attr]['to']) ) {\r
+         end = attributes[attr]['to'];\r
+      } else if ( isset(attributes[attr]['by']) ) {\r
+         if (start.constructor == Array) {\r
+            end = [];\r
+            for (var i = 0, len = start.length; i < len; ++i) {\r
+               end[i] = start[i] + attributes[attr]['by'][i];\r
+            }\r
+         } else {\r
+            end = start + attributes[attr]['by'];\r
+         }\r
+      }\r
+\r
+      this.runtimeAttributes[attr].start = start;\r
+      this.runtimeAttributes[attr].end = end;\r
+\r
+      // set units if needed\r
+      this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);\r
+   },\r
+\r
+   /**\r
+    * @param {String or HTMLElement} el Reference to the element that will be animated\r
+    * @param {Object} attributes The attribute(s) to be animated.\r
+    * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+    * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+    * All attribute names use camelCase.\r
+    * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+    * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+    */\r
+   init: function(el, attributes, duration, method) {\r
+      /**\r
+       * Whether or not the animation is running.\r
+       * @private\r
+       * @type Boolean\r
+       */\r
+      var isAnimated = false;\r
+\r
+      /**\r
+       * A Date object that is created when the animation begins.\r
+       * @private\r
+       * @type Date\r
+       */\r
+      var startTime = null;\r
+\r
+      /**\r
+       * The number of frames this animation was able to execute.\r
+       * @private\r
+       * @type Int\r
+       */\r
+      var actualFrames = 0;\r
+\r
+      /**\r
+       * The element to be animated.\r
+       * @private\r
+       * @type HTMLElement\r
+       */\r
+      el = YAHOO.util.Dom.get(el);\r
+\r
+      /**\r
+       * The collection of attributes to be animated.\r
+       * Each attribute must have at least a "to" or "by" defined in order to animate.\r
+       * If "to" is supplied, the animation will end with the attribute at that value.\r
+       * If "by" is supplied, the animation will end at that value plus its starting value.\r
+       * If both are supplied, "to" is used, and "by" is ignored.\r
+       * @member YAHOO#util#Anim\r
+       * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values).\r
+       * @type Object\r
+       */\r
+      this.attributes = attributes || {};\r
+\r
+      /**\r
+       * The length of the animation.  Defaults to "1" (second).\r
+       * @type Number\r
+       */\r
+      this.duration = duration || 1;\r
+\r
+      /**\r
+       * The method that will provide values to the attribute(s) during the animation.\r
+       * Defaults to "YAHOO.util.Easing.easeNone".\r
+       * @type Function\r
+       */\r
+      this.method = method || YAHOO.util.Easing.easeNone;\r
+\r
+      /**\r
+       * Whether or not the duration should be treated as seconds.\r
+       * Defaults to true.\r
+       * @type Boolean\r
+       */\r
+      this.useSeconds = true; // default to seconds\r
+\r
+      /**\r
+       * The location of the current animation on the timeline.\r
+       * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.\r
+       * @type Int\r
+       */\r
+      this.currentFrame = 0;\r
+\r
+      /**\r
+       * The total number of frames to be executed.\r
+       * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.\r
+       * @type Int\r
+       */\r
+      this.totalFrames = YAHOO.util.AnimMgr.fps;\r
+\r
+\r
+      /**\r
+       * Returns a reference to the animated element.\r
+       * @return {HTMLElement}\r
+       */\r
+      this.getEl = function() { return el; };\r
+\r
+      /**\r
+       * Checks whether the element is currently animated.\r
+       * @return {Boolean} current value of isAnimated.\r
+       */\r
+      this.isAnimated = function() {\r
+         return isAnimated;\r
+      };\r
+\r
+      /**\r
+       * Returns the animation start time.\r
+       * @return {Date} current value of startTime.\r
+       */\r
+      this.getStartTime = function() {\r
+         return startTime;\r
+      };\r
+\r
+      this.runtimeAttributes = {};\r
+\r
+\r
+\r
+      /**\r
+       * Starts the animation by registering it with the animation manager.\r
+       */\r
+      this.animate = function() {\r
+         if ( this.isAnimated() ) { return false; }\r
+\r
+         this.currentFrame = 0;\r
+\r
+         this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;\r
+\r
+         YAHOO.util.AnimMgr.registerElement(this);\r
+      };\r
+\r
+      /**\r
+       * Stops the animation.  Normally called by AnimMgr when animation completes.\r
+       */\r
+      this.stop = function() {\r
+         YAHOO.util.AnimMgr.stop(this);\r
+      };\r
+\r
+      var onStart = function() {\r
+         this.onStart.fire();\r
+         for (var attr in this.attributes) {\r
+            this.setRuntimeAttribute(attr);\r
+         }\r
+\r
+         isAnimated = true;\r
+         actualFrames = 0;\r
+         startTime = new Date();\r
+      };\r
+\r
+      /**\r
+       * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).\r
+       * @private\r
+       */\r
+\r
+      var onTween = function() {\r
+         var data = {\r
+            duration: new Date() - this.getStartTime(),\r
+            currentFrame: this.currentFrame\r
+         };\r
+\r
+         data.toString = function() {\r
+            return (\r
+               'duration: ' + data.duration +\r
+               ', currentFrame: ' + data.currentFrame\r
+            );\r
+         };\r
+\r
+         this.onTween.fire(data);\r
+\r
+         var runtimeAttributes = this.runtimeAttributes;\r
+\r
+         for (var attr in runtimeAttributes) {\r
+            this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);\r
+         }\r
+\r
+         actualFrames += 1;\r
+      };\r
+\r
+      var onComplete = function() {\r
+         var actual_duration = (new Date() - startTime) / 1000 ;\r
+\r
+         var data = {\r
+            duration: actual_duration,\r
+            frames: actualFrames,\r
+            fps: actualFrames / actual_duration\r
+         };\r
+\r
+         data.toString = function() {\r
+            return (\r
+               'duration: ' + data.duration +\r
+               ', frames: ' + data.frames +\r
+               ', fps: ' + data.fps\r
+            );\r
+         };\r
+\r
+         isAnimated = false;\r
+         actualFrames = 0;\r
+         this.onComplete.fire(data);\r
+      };\r
+\r
+      /**\r
+       * Custom event that fires after onStart, useful in subclassing\r
+       * @private\r
+       */\r
+      this._onStart = new YAHOO.util.CustomEvent('_start', this, true);\r
+\r
+      /**\r
+       * Custom event that fires when animation begins\r
+       * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)\r
+       */\r
+      this.onStart = new YAHOO.util.CustomEvent('start', this);\r
+\r
+      /**\r
+       * Custom event that fires between each frame\r
+       * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)\r
+       */\r
+      this.onTween = new YAHOO.util.CustomEvent('tween', this);\r
+\r
+      /**\r
+       * Custom event that fires after onTween\r
+       * @private\r
+       */\r
+      this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);\r
+\r
+      /**\r
+       * Custom event that fires when animation ends\r
+       * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)\r
+       */\r
+      this.onComplete = new YAHOO.util.CustomEvent('complete', this);\r
+      /**\r
+       * Custom event that fires after onComplete\r
+       * @private\r
+       */\r
+      this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);\r
+\r
+      this._onStart.subscribe(onStart);\r
+      this._onTween.subscribe(onTween);\r
+      this._onComplete.subscribe(onComplete);\r
+   }\r
+};\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Handles animation queueing and threading.\r
+ * Used by Anim and subclasses.\r
+ */\r
+YAHOO.util.AnimMgr = new function() {\r
+   /**\r
+    * Reference to the animation Interval\r
+    * @private\r
+    * @type Int\r
+    */\r
+   var thread = null;\r
+\r
+   /**\r
+    * The current queue of registered animation objects.\r
+    * @private\r
+    * @type Array\r
+    */\r
+   var queue = [];\r
+\r
+   /**\r
+    * The number of active animations.\r
+    * @private\r
+    * @type Int\r
+    */\r
+   var tweenCount = 0;\r
+\r
+   /**\r
+    * Base frame rate (frames per second).\r
+    * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).\r
+    * @type Int\r
+    *\r
+    */\r
+   this.fps = 200;\r
+\r
+   /**\r
+    * Interval delay in milliseconds, defaults to fastest possible.\r
+    * @type Int\r
+    *\r
+    */\r
+   this.delay = 1;\r
+\r
+   /**\r
+    * Adds an animation instance to the animation queue.\r
+    * All animation instances must be registered in order to animate.\r
+    * @param {object} tween The Anim instance to be be registered\r
+    */\r
+   this.registerElement = function(tween) {\r
+      queue[queue.length] = tween;\r
+      tweenCount += 1;\r
+      tween._onStart.fire();\r
+      this.start();\r
+   };\r
+\r
+   this.unRegister = function(tween, index) {\r
+      tween._onComplete.fire();\r
+      index = index || getIndex(tween);\r
+      if (index != -1) { queue.splice(index, 1); }\r
+\r
+      tweenCount -= 1;\r
+      if (tweenCount <= 0) { this.stop(); }\r
+   };\r
+\r
+   /**\r
+    * Starts the animation thread.\r
+        * Only one thread can run at a time.\r
+    */\r
+   this.start = function() {\r
+      if (thread === null) { thread = setInterval(this.run, this.delay); }\r
+   };\r
+\r
+   /**\r
+    * Stops the animation thread or a specific animation instance.\r
+    * @param {object} tween A specific Anim instance to stop (optional)\r
+    * If no instance given, Manager stops thread and all animations.\r
+    */\r
+   this.stop = function(tween) {\r
+      if (!tween) {\r
+         clearInterval(thread);\r
+         for (var i = 0, len = queue.length; i < len; ++i) {\r
+            if (queue[i].isAnimated()) {\r
+               this.unRegister(tween, i);\r
+            }\r
+         }\r
+         queue = [];\r
+         thread = null;\r
+         tweenCount = 0;\r
+      }\r
+      else {\r
+         this.unRegister(tween);\r
+      }\r
+   };\r
+\r
+   /**\r
+    * Called per Interval to handle each animation frame.\r
+    */\r
+   this.run = function() {\r
+      for (var i = 0, len = queue.length; i < len; ++i) {\r
+         var tween = queue[i];\r
+         if ( !tween || !tween.isAnimated() ) { continue; }\r
+\r
+         if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)\r
+         {\r
+            tween.currentFrame += 1;\r
+\r
+            if (tween.useSeconds) {\r
+               correctFrame(tween);\r
+            }\r
+            tween._onTween.fire();\r
+         }\r
+         else { YAHOO.util.AnimMgr.stop(tween, i); }\r
+      }\r
+   };\r
+\r
+   var getIndex = function(anim) {\r
+      for (var i = 0, len = queue.length; i < len; ++i) {\r
+         if (queue[i] == anim) {\r
+            return i; // note return;\r
+         }\r
+      }\r
+      return -1;\r
+   };\r
+\r
+   /**\r
+    * On the fly frame correction to keep animation on time.\r
+    * @private\r
+    * @param {Object} tween The Anim instance being corrected.\r
+    */\r
+   var correctFrame = function(tween) {\r
+      var frames = tween.totalFrames;\r
+      var frame = tween.currentFrame;\r
+      var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);\r
+      var elapsed = (new Date() - tween.getStartTime());\r
+      var tweak = 0;\r
+\r
+      if (elapsed < tween.duration * 1000) { // check if falling behind\r
+         tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);\r
+      } else { // went over duration, so jump to end\r
+         tweak = frames - (frame + 1);\r
+      }\r
+      if (tweak > 0 && isFinite(tweak)) { // adjust if needed\r
+         if (tween.currentFrame + tweak >= frames) {// dont go past last frame\r
+            tweak = frames - (frame + 1);\r
+         }\r
+\r
+         tween.currentFrame += tweak;\r
+      }\r
+   };\r
+};\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ *\r
+ * @class Used to calculate Bezier splines for any number of control points.\r
+ *\r
+ */\r
+YAHOO.util.Bezier = new function()\r
+{\r
+   /**\r
+    * Get the current position of the animated element based on t.\r
+    * Each point is an array of "x" and "y" values (0 = x, 1 = y)\r
+    * At least 2 points are required (start and end).\r
+    * First point is start. Last point is end.\r
+    * Additional control points are optional.\r
+    * @param {Array} points An array containing Bezier points\r
+    * @param {Number} t A number between 0 and 1 which is the basis for determining current position\r
+    * @return {Array} An array containing int x and y member data\r
+    */\r
+   this.getPosition = function(points, t)\r
+   {\r
+      var n = points.length;\r
+      var tmp = [];\r
+\r
+      for (var i = 0; i < n; ++i){\r
+         tmp[i] = [points[i][0], points[i][1]]; // save input\r
+      }\r
+\r
+      for (var j = 1; j < n; ++j) {\r
+         for (i = 0; i < n - j; ++i) {\r
+            tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];\r
+            tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];\r
+         }\r
+      }\r
+\r
+      return [ tmp[0][0], tmp[0][1] ];\r
+\r
+   };\r
+};\r
+/**\r
+ * @class ColorAnim subclass for color fading\r
+ * <p>Usage: <code>var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);</code></p>\r
+ * <p>Color values can be specified with either 112233, #112233, [255,255,255], or rgb(255,255,255)\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @constructor\r
+ * @param {HTMLElement | String} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to Y.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a Y.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.ColorAnim = function(el, attributes, duration,  method) {\r
+      YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.ColorAnim.superclass;\r
+   var prototype = Y.ColorAnim.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("ColorAnim " + id);\r
+   };\r
+\r
+   /**\r
+    * Only certain attributes should be treated as colors.\r
+    * @type Object\r
+    */\r
+   prototype.patterns.color = /color$/i;\r
+   prototype.patterns.rgb    = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;\r
+   prototype.patterns.hex    = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;\r
+   prototype.patterns.hex3   = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;\r
+\r
+   /**\r
+    * Attempts to parse the given string and return a 3-tuple.\r
+    * @param {String} s The string to parse.\r
+    * @return {Array} The 3-tuple of rgb values.\r
+    */\r
+   prototype.parseColor = function(s) {\r
+      if (s.length == 3) { return s; }\r
+\r
+      var c = this.patterns.hex.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];\r
+      }\r
+\r
+      c = this.patterns.rgb.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];\r
+      }\r
+\r
+      c = this.patterns.hex3.exec(s);\r
+      if (c && c.length == 4) {\r
+         return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];\r
+      }\r
+\r
+      return null;\r
+   };\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      var el = this.getEl();\r
+      if (  this.patterns.color.test(attr) ) {\r
+         var val = YAHOO.util.Dom.getStyle(el, attr);\r
+\r
+         if (val == 'transparent') { // bgcolor default\r
+            var parent = el.parentNode; // try and get from an ancestor\r
+            val = Y.Dom.getStyle(parent, attr);\r
+\r
+            while (parent && val == 'transparent') {\r
+               parent = parent.parentNode;\r
+               val = Y.Dom.getStyle(parent, attr);\r
+               if (parent.tagName.toUpperCase() == 'HTML') {\r
+                  val = 'ffffff';\r
+               }\r
+            }\r
+         }\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val;\r
+\r
+      if ( this.patterns.color.test(attr) ) {\r
+         val = [];\r
+         for (var i = 0, len = start.length; i < len; ++i) {\r
+            val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);\r
+         }\r
+\r
+         val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';\r
+      }\r
+      else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   prototype.setRuntimeAttribute = function(attr) {\r
+      superclass.setRuntimeAttribute.call(this, attr);\r
+\r
+      if ( this.patterns.color.test(attr) ) {\r
+         var attributes = this.attributes;\r
+         var start = this.parseColor(this.runtimeAttributes[attr].start);\r
+         var end = this.parseColor(this.runtimeAttributes[attr].end);\r
+         // fix colors if going "by"\r
+         if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {\r
+            end = this.parseColor(attributes[attr].by);\r
+\r
+            for (var i = 0, len = start.length; i < len; ++i) {\r
+               end[i] = start[i] + end[i];\r
+            }\r
+         }\r
+\r
+         this.runtimeAttributes[attr].start = start;\r
+         this.runtimeAttributes[attr].end = end;\r
+      }\r
+   };\r
+})();/*\r
+TERMS OF USE - EASING EQUATIONS\r
+Open source under the BSD License.\r
+Copyright Â© 2001 Robert Penner All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\r
+\r
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\r
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\r
+    * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+*/\r
+\r
+YAHOO.util.Easing = {\r
+\r
+   /**\r
+    * Uniform speed between points.\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeNone: function (t, b, c, d) {\r
+       return c*t/d + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and accelerates towards end. (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeIn: function (t, b, c, d) {\r
+       return c*(t/=d)*t + b;\r
+   },\r
+\r
+   /**\r
+    * Begins quickly and decelerates towards end.  (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeOut: function (t, b, c, d) {\r
+       return -c *(t/=d)*(t-2) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and decelerates towards end. (quadratic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeBoth: function (t, b, c, d) {\r
+       if ((t/=d/2) < 1) return c/2*t*t + b;\r
+       return -c/2 * ((--t)*(t-2) - 1) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and accelerates towards end. (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeInStrong: function (t, b, c, d) {\r
+       return c*(t/=d)*t*t*t + b;\r
+   },\r
+\r
+   /**\r
+    * Begins quickly and decelerates towards end.  (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeOutStrong: function (t, b, c, d) {\r
+       return -c * ((t=t/d-1)*t*t*t - 1) + b;\r
+   },\r
+\r
+   /**\r
+    * Begins slowly and decelerates towards end. (quartic)\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   easeBothStrong: function (t, b, c, d) {\r
+       if ((t/=d/2) < 1) return c/2*t*t*t*t + b;\r
+       return -c/2 * ((t-=2)*t*t*t - 2) + b;\r
+   },\r
+\r
+   /**\r
+    * snap in elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+\r
+   elasticIn: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
+   },\r
+\r
+   /**\r
+    * snap out elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   elasticOut: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;\r
+   },\r
+\r
+   /**\r
+    * snap both elastic effect\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number} p Period (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   elasticBoth: function (t, b, c, d, a, p) {\r
+       if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);\r
+       if (!a || a < Math.abs(c)) { a=c; var s=p/4; }\r
+       else var s = p/(2*Math.PI) * Math.asin (c/a);\r
+       if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;\r
+       return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;\r
+   },\r
+\r
+   /**\r
+    * back easing in - backtracking slightly, then reversing direction and moving to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backIn: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       return c*(t/=d)*t*((s+1)*t - s) + b;\r
+   },\r
+\r
+   /**\r
+    * back easing out - moving towards target, overshooting it slightly,\r
+    * then reversing and coming back to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backOut: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;\r
+   },\r
+\r
+   /**\r
+    * back easing in/out - backtracking slightly, then reversing direction and moving to target,\r
+    * then overshooting target, reversing, and finally coming back to target\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @param {Number) s Overshoot (optional)\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   backBoth: function (t, b, c, d, s) {\r
+       if (typeof s == 'undefined') s = 1.70158;\r
+       if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;\r
+       return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;\r
+   },\r
+\r
+   /**\r
+    * bounce in\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceIn: function (t, b, c, d) {\r
+       return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;\r
+   },\r
+\r
+   /**\r
+    * bounce out\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceOut: function (t, b, c, d) {\r
+       if ((t/=d) < (1/2.75)) {\r
+               return c*(7.5625*t*t) + b;\r
+       } else if (t < (2/2.75)) {\r
+               return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;\r
+       } else if (t < (2.5/2.75)) {\r
+               return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;\r
+       } else {\r
+               return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;\r
+       }\r
+   },\r
+\r
+   /**\r
+    * bounce both\r
+    * @param {Number} t Time value used to compute current value.\r
+    * @param {Number} b Starting value.\r
+    * @param {Number} c Delta between start and end values.\r
+    * @param {Number} d Total length of animation.\r
+    * @return {Number} The computed value for the current animation frame.\r
+    */\r
+   bounceBoth: function (t, b, c, d) {\r
+       if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;\r
+       return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;\r
+   }\r
+};\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Anim subclass for moving elements along a path defined by the "points" member of "attributes".  All "points" are arrays with x, y coordinates.\r
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.Motion = function(el, attributes, duration,  method) {\r
+      if (el) { // dont break existing subclasses not using YAHOO.extend\r
+         YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);\r
+      }\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.Motion.superclass;\r
+   var prototype = Y.Motion.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Motion " + id);\r
+   };\r
+\r
+   prototype.patterns.points = /^points$/i;\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   prototype.setAttribute = function(attr, val, unit) {\r
+      if (  this.patterns.points.test(attr) ) {\r
+         unit = unit || 'px';\r
+         superclass.setAttribute.call(this, 'left', val[0], unit);\r
+         superclass.setAttribute.call(this, 'top', val[1], unit);\r
+      } else {\r
+         superclass.setAttribute.call(this, attr, val, unit);\r
+      }\r
+   };\r
+\r
+   /**\r
+    * Sets the default value to be used when "from" is not supplied.\r
+    * @param {String} attr The attribute being set.\r
+    * @param {Number} val The default value to be applied to the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      if (  this.patterns.points.test(attr) ) {\r
+         var val = [\r
+            superclass.getAttribute.call(this, 'left'),\r
+            superclass.getAttribute.call(this, 'top')\r
+         ];\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val = null;\r
+\r
+      if ( this.patterns.points.test(attr) ) {\r
+         var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;\r
+         val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);\r
+      } else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Sets the actual values to be used during the animation.\r
+    * Should only be needed for subclass use.\r
+    * @param {Object} attr The attribute object\r
+    * @private\r
+    */\r
+   prototype.setRuntimeAttribute = function(attr) {\r
+      if ( this.patterns.points.test(attr) ) {\r
+         var el = this.getEl();\r
+         var attributes = this.attributes;\r
+         var start;\r
+         var control = attributes['points']['control'] || [];\r
+         var end;\r
+         var i, len;\r
+\r
+         if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points\r
+            control = [control];\r
+         } else { // break reference to attributes.points.control\r
+            var tmp = [];\r
+            for (i = 0, len = control.length; i< len; ++i) {\r
+               tmp[i] = control[i];\r
+            }\r
+            control = tmp;\r
+         }\r
+\r
+         if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative\r
+            Y.Dom.setStyle(el, 'position', 'relative');\r
+         }\r
+\r
+         if ( isset(attributes['points']['from']) ) {\r
+            Y.Dom.setXY(el, attributes['points']['from']); // set position to from point\r
+         }\r
+         else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position\r
+\r
+         start = this.getAttribute('points'); // get actual top & left\r
+\r
+         // TO beats BY, per SMIL 2.1 spec\r
+         if ( isset(attributes['points']['to']) ) {\r
+            end = translateValues.call(this, attributes['points']['to'], start);\r
+\r
+            var pageXY = Y.Dom.getXY(this.getEl());\r
+            for (i = 0, len = control.length; i < len; ++i) {\r
+               control[i] = translateValues.call(this, control[i], start);\r
+            }\r
+\r
+\r
+         } else if ( isset(attributes['points']['by']) ) {\r
+            end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ];\r
+\r
+            for (i = 0, len = control.length; i < len; ++i) {\r
+               control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];\r
+            }\r
+         }\r
+\r
+         this.runtimeAttributes[attr] = [start];\r
+\r
+         if (control.length > 0) {\r
+            this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);\r
+         }\r
+\r
+         this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;\r
+      }\r
+      else {\r
+         superclass.setRuntimeAttribute.call(this, attr);\r
+      }\r
+   };\r
+\r
+   var translateValues = function(val, start) {\r
+      var pageXY = Y.Dom.getXY(this.getEl());\r
+      val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];\r
+\r
+      return val;\r
+   };\r
+\r
+   var isset = function(prop) {\r
+      return (typeof prop !== 'undefined');\r
+   };\r
+})();\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version: 0.10.0\r
+*/\r
+\r
+/**\r
+ * @class Anim subclass for scrolling elements to a position defined by the "scroll" member of "attributes".  All "scroll" members are arrays with x, y scroll positions.\r
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>\r
+ * @requires YAHOO.util.Anim\r
+ * @requires YAHOO.util.AnimMgr\r
+ * @requires YAHOO.util.Easing\r
+ * @requires YAHOO.util.Bezier\r
+ * @requires YAHOO.util.Dom\r
+ * @requires YAHOO.util.Event\r
+ * @requires YAHOO.util.CustomEvent\r
+ * @constructor\r
+ * @param {String or HTMLElement} el Reference to the element that will be animated\r
+ * @param {Object} attributes The attribute(s) to be animated.\r
+ * Each attribute is an object with at minimum a "to" or "by" member defined.\r
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").\r
+ * All attribute names use camelCase.\r
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based\r
+ * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)\r
+ */\r
+(function() {\r
+   YAHOO.util.Scroll = function(el, attributes, duration,  method) {\r
+      if (el) { // dont break existing subclasses not using YAHOO.extend\r
+         YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);\r
+      }\r
+   };\r
+\r
+   YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);\r
+\r
+   // shorthand\r
+   var Y = YAHOO.util;\r
+   var superclass = Y.Scroll.superclass;\r
+   var prototype = Y.Scroll.prototype;\r
+\r
+   /**\r
+    * toString method\r
+    * @return {String} string represenation of anim obj\r
+    */\r
+   prototype.toString = function() {\r
+      var el = this.getEl();\r
+      var id = el.id || el.tagName;\r
+      return ("Scroll " + id);\r
+   };\r
+\r
+   /**\r
+    * Returns the value computed by the animation's "method".\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} start The value this attribute should start from for this animation.\r
+    * @param {Number} end  The value this attribute should end at for this animation.\r
+    * @return {Number} The Value to be applied to the attribute.\r
+    */\r
+   prototype.doMethod = function(attr, start, end) {\r
+      var val = null;\r
+\r
+      if (attr == 'scroll') {\r
+         val = [\r
+            this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames),\r
+            this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)\r
+         ];\r
+\r
+      } else {\r
+         val = superclass.doMethod.call(this, attr, start, end);\r
+      }\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Returns current value of the attribute.\r
+    * @param {String} attr The name of the attribute.\r
+    * @return {Number} val The current value of the attribute.\r
+    */\r
+   prototype.getAttribute = function(attr) {\r
+      var val = null;\r
+      var el = this.getEl();\r
+\r
+      if (attr == 'scroll') {\r
+         val = [ el.scrollLeft, el.scrollTop ];\r
+      } else {\r
+         val = superclass.getAttribute.call(this, attr);\r
+      }\r
+\r
+      return val;\r
+   };\r
+\r
+   /**\r
+    * Applies a value to an attribute\r
+    * @param {String} attr The name of the attribute.\r
+    * @param {Number} val The value to be applied to the attribute.\r
+    * @param {String} unit The unit ('px', '%', etc.) of the value.\r
+    */\r
+   prototype.setAttribute = function(attr, val, unit) {\r
+      var el = this.getEl();\r
+\r
+      if (attr == 'scroll') {\r
+         el.scrollLeft = val[0];\r
+         el.scrollTop = val[1];\r
+      } else {\r
+         superclass.setAttribute.call(this, attr, val, unit);\r
+      }\r
+   };\r
+})();\r
diff --git a/lib/yui/autocomplete/README b/lib/yui/autocomplete/README
new file mode 100755 (executable)
index 0000000..a3b5c1f
--- /dev/null
@@ -0,0 +1,30 @@
+AutoComplete Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* The method getListIds() has been deprecated for getListItems(), which returns\r
+an array of DOM references.\r
+\r
+* All classnames have been prefixed with "yui-ac-".\r
+\r
+* Container elements should no longer have CSS property "display" set to "none".\r
+\r
+* The useIFrame property can now be set after instantiation.\r
+\r
+* On some browsers, the unmatchedItemSelectEvent may not be fired properly when\r
+delimiter characters are defined.\r
+\r
+* On some browsers, defining delimiter characters while enabling forceSelection\r
+may result in unexpected behavior.\r
+\r
+\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Initial release\r
+\r
+* In order to enable the useIFrame property, it should be set in the\r
+constructor.\r
+\r
+* On some browsers, defining delimiter characters while enabling forceSelection\r
+may result in unexpected behavior.\r
diff --git a/lib/yui/autocomplete/autocomplete-debug.js b/lib/yui/autocomplete/autocomplete-debug.js
new file mode 100755 (executable)
index 0000000..f78c68f
--- /dev/null
@@ -0,0 +1,2784 @@
+/*\r\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r\r
+Code licensed under the BSD License:\r\r
+http://developer.yahoo.com/yui/license.txt\r\r
+version: 0.11.0\r\r
+*/\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing the customizable functionality of a plug-and-play DHTML\r\r
+ * auto complete widget.  Some key features:\r\r
+ * <ul>\r\r
+ * <li>Navigate with up/down arrow keys and/or mouse to pick a selection</li>\r\r
+ * <li>The drop down container can "roll down" or "fly out" via configurable\r\r
+ * animation</li>\r\r
+ * <li>UI look-and-feel customizable through CSS, including container\r\r
+ * attributes, borders, position, fonts, etc</li>\r\r
+ * </ul>\r\r
+ *\r\r
+ * requires YAHOO.util.Dom Dom utility\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ * requires YAHOO.widget.DataSource Data source class\r\r
+ * see YAHOO.util.Animation Animation utility\r\r
+ * see JSON JSON library\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {element | string} inputEl DOM element reference or string ID of the auto complete input field\r\r
+ * @param {element | string} containerEl DOM element reference or string ID of the auto complete &lt;div&gt;\r\r
+ *                              container\r\r
+ * @param {object} oDataSource Instance of YAHOO.widget.DataSource for query/results\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.AutoComplete = function(inputEl,containerEl,oDataSource,oConfigs) {\r\r
+    if(inputEl && containerEl && oDataSource) {\r\r
+        // Validate data source\r\r
+        if (oDataSource && (oDataSource instanceof YAHOO.widget.DataSource)) {\r\r
+            this.dataSource = oDataSource;\r\r
+        }\r\r
+        else {\r\r
+            YAHOO.log("Could not instantiate AutoComplete due to an invalid DataSource", "error", this.toString());\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Validate input element\r\r
+        if(YAHOO.util.Dom.inDocument(inputEl)) {\r\r
+            if(typeof inputEl == "string") {\r\r
+                    this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + inputEl;\r\r
+                    this._oTextbox = document.getElementById(inputEl);\r\r
+            }\r\r
+            else {\r\r
+                this._sName = (inputEl.id) ?\r\r
+                    "instance" + YAHOO.widget.AutoComplete._nIndex + " " + inputEl.id:\r\r
+                    "instance" + YAHOO.widget.AutoComplete._nIndex;\r\r
+                this._oTextbox = inputEl;\r\r
+            }\r\r
+        }\r\r
+        else {\r\r
+            YAHOO.log("Could not instantiate AutoComplete due to an invalid input element", "error", this.toString());\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Validate container element\r\r
+        if(YAHOO.util.Dom.inDocument(containerEl)) {\r\r
+            if(typeof containerEl == "string") {\r\r
+                    this._oContainer = document.getElementById(containerEl);\r\r
+            }\r\r
+            else {\r\r
+                this._oContainer = containerEl;\r\r
+            }\r\r
+            if(this._oContainer.style.display == "none") {\r\r
+                YAHOO.log("The container may not display properly if display is set to \"none\" in CSS", "warn", this.toString());\r\r
+            }\r\r
+        }\r\r
+        else {\r\r
+            YAHOO.log("Could not instantiate AutoComplete due to an invalid container element", "error", this.toString());\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Set any config params passed in to override defaults\r\r
+        if (typeof oConfigs == "object") {\r\r
+            for(var sConfig in oConfigs) {\r\r
+                if (sConfig) {\r\r
+                    this[sConfig] = oConfigs[sConfig];\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        // Initialization sequence\r\r
+        this._initContainer();\r\r
+        this._initProps();\r\r
+        this._initList();\r\r
+        this._initContainerHelpers();\r\r
+\r\r
+        // Set up events\r\r
+        var oSelf = this;\r\r
+        var oTextbox = this._oTextbox;\r\r
+        // Events are actually for the content module within the container\r\r
+        var oContent = this._oContainer._oContent;\r\r
+\r\r
+        // Dom events\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"focus",oSelf._onTextboxFocus,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"blur",oSelf._onTextboxBlur,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"mouseover",oSelf._onContainerMouseover,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"mouseout",oSelf._onContainerMouseout,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"scroll",oSelf._onContainerScroll,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"resize",oSelf._onContainerResize,oSelf);\r\r
+        if(oTextbox.form) {\r\r
+            YAHOO.util.Event.addListener(oTextbox.form,"submit",oSelf._onFormSubmit,oSelf);\r\r
+        }\r\r
+\r\r
+        // Custom events\r\r
+        this.textboxFocusEvent = new YAHOO.util.CustomEvent("textboxFocus", this);\r\r
+        this.textboxKeyEvent = new YAHOO.util.CustomEvent("textboxKey", this);\r\r
+        this.dataRequestEvent = new YAHOO.util.CustomEvent("dataRequest", this);\r\r
+        this.dataReturnEvent = new YAHOO.util.CustomEvent("dataReturn", this);\r\r
+        this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this);\r\r
+        this.containerExpandEvent = new YAHOO.util.CustomEvent("containerExpand", this);\r\r
+        this.typeAheadEvent = new YAHOO.util.CustomEvent("typeAhead", this);\r\r
+        this.itemMouseOverEvent = new YAHOO.util.CustomEvent("itemMouseOver", this);\r\r
+        this.itemMouseOutEvent = new YAHOO.util.CustomEvent("itemMouseOut", this);\r\r
+        this.itemArrowToEvent = new YAHOO.util.CustomEvent("itemArrowTo", this);\r\r
+        this.itemArrowFromEvent = new YAHOO.util.CustomEvent("itemArrowFrom", this);\r\r
+        this.itemSelectEvent = new YAHOO.util.CustomEvent("itemSelect", this);\r\r
+        this.unmatchedItemSelectEvent = new YAHOO.util.CustomEvent("unmatchedItemSelect", this);\r\r
+        this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this);\r\r
+        this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this);\r\r
+        this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this);\r\r
+        \r\r
+        // Finish up\r\r
+        oTextbox.setAttribute("autocomplete","off");\r\r
+        YAHOO.widget.AutoComplete._nIndex++;\r\r
+        YAHOO.log("AutoComplete initialized","info",this.toString());\r\r
+    }\r\r
+    // Required arguments were not found\r\r
+    else {\r\r
+        YAHOO.log("Could not instantiate AutoComplete due invalid arguments", "error", this.toString());\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * The data source object that encapsulates the data used for auto completion.\r\r
+ * This object should be an inherited object from YAHOO.widget.DataSource.\r\r
+ *\r\r
+ * @type object\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataSource = null;\r\r
+\r\r
+/**\r\r
+ * Number of characters that must be entered before querying for results.\r\r
+ * Default: 1.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.minQueryLength = 1;\r\r
+\r\r
+/**\r\r
+ * Maximum number of results to display in auto complete container. Default: 10.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 10;\r\r
+\r\r
+/**\r\r
+ * Number of seconds to delay before submitting a query request.  If a query\r\r
+ * request is received before a previous one has completed its delay, the\r\r
+ * previous request is cancelled and the new request is set to the delay.\r\r
+ * Default: 0.5.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.queryDelay = 0.5;\r\r
+\r\r
+/**\r\r
+ * Class name of a highlighted item within the auto complete container.\r\r
+ * Default: "yui-ac-highlight".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.highlightClassName = "yui-ac-highlight";\r\r
+\r\r
+/**\r\r
+ * Class name of a pre-highlighted item within the auto complete container.\r\r
+ * Default: null.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.prehighlightClassName = null;\r\r
+\r\r
+/**\r\r
+ * Query delimiter. A single character separator for multiple delimited\r\r
+ * selections. Multiple delimiter characteres may be defined as an array of\r\r
+ * strings. A null value or empty string indicates that query results cannot\r\r
+ * be delimited. This feature is not recommended if you need forceSelection to\r\r
+ * be true. Default: null.\r\r
+ *\r\r
+ * @type string or array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.delimChar = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the first item in the auto complete container should be\r\r
+ * automatically highlighted on expand. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.autoHighlight = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete input field should be automatically updated\r\r
+ * with the first query result as the user types, auto-selecting the substring\r\r
+ * that the user has not typed. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.typeAhead = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to animate the expansion/collapse of the auto complete\r\r
+ * container in the horizontal direction. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animHoriz = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to animate the expansion/collapse of the auto complete\r\r
+ * container in the vertical direction. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animVert = true;\r\r
+\r\r
+/**\r\r
+ * Speed of container expand/collapse animation, in seconds. Default: 0.3.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animSpeed = 0.3;\r\r
+\r\r
+/**\r\r
+ * Whether or not to force the user's selection to match one of the query\r\r
+ * results. Enabling this feature essentially transforms the auto complete form\r\r
+ * input field into a &lt;select&gt; field. This feature is not recommended\r\r
+ * with delimiter character(s) defined. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.forceSelection = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to allow browsers to cache user-typed input in the input\r\r
+ * field. Disabling this feature will prevent the widget from setting the\r\r
+ * autocomplete="off" on the auto complete input field. When autocomplete="off"\r\r
+ * and users click the back button after form submission, user-typed input can\r\r
+ * be prefilled by the browser from its cache. This caching of user input may\r\r
+ * not be desired for sensitive data, such as credit card numbers, in which\r\r
+ * case, implementers should consider setting allowBrowserAutocomplete to false.\r\r
+ * Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container should always be displayed.\r\r
+ * Enabling this feature prevents the toggling of the container to a collapsed\r\r
+ * state. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.alwaysShowContainer = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to use an iFrame to layer over Windows form elements in\r\r
+ * IE. Set to true only when the auto complete container will be on top of a\r\r
+ * &lt;select&gt; field in IE and thus exposed to the IE z-index bug (i.e.,\r\r
+ * 5.5 < IE < 7). Default:false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.useIFrame = false;\r\r
+\r\r
+/**\r\r
+ * Configurable iFrame src used when useIFrame = true. Implementations over SSL\r\r
+ * should set this parameter to an appropriate https location in order to avoid\r\r
+ * security-related browser errors. Default:"about:blank".\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.iFrameSrc = "about:blank";\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container should have a shadow. Default:false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.useShadow = false;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the auto complete instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the auto complete instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getName = function() {\r\r
+    return this._sName;\r\r
+};\r\r
+\r\r
+ /**\r\r
+ * Public accessor to the unique name of the auto complete instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the auto complete instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.toString = function() {\r\r
+    return "AutoComplete " + this._sName;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to the internal array of DOM &lt;li&gt; elements that\r\r
+ * display query results within the auto complete container.\r\r
+ *\r\r
+ * @return {array} Array of &lt;li&gt; elements within the auto complete\r\r
+ *                 container\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getListItems = function() {\r\r
+    return this._aListItems;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to the data held in an &lt;li&gt; element of the\r\r
+ * auto complete container.\r\r
+ *\r\r
+ * @return {object or array} Object or array of result data or null\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getListItemData = function(oListItem) {\r\r
+    if(oListItem._oResultData) {\r\r
+        return oListItem._oResultData;\r\r
+    }\r\r
+    else {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container header. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_hd".\r\r
+ *\r\r
+ * @param {string} sHeader HTML markup for container header\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setHeader = function(sHeader) {\r\r
+    if(sHeader) {\r\r
+        if(this._oContainer._oContent._oHeader) {\r\r
+            this._oContainer._oContent._oHeader.innerHTML = sHeader;\r\r
+            this._oContainer._oContent._oHeader.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oHeader.innerHTML = "";\r\r
+        this._oContainer._oContent._oHeader.style.display = "none";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container footer. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_ft".\r\r
+ *\r\r
+ * @param {string} sFooter HTML markup for container footer\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setFooter = function(sFooter) {\r\r
+    if(sFooter) {\r\r
+        if(this._oContainer._oContent._oFooter) {\r\r
+            this._oContainer._oContent._oFooter.innerHTML = sFooter;\r\r
+            this._oContainer._oContent._oFooter.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oFooter.innerHTML = "";\r\r
+        this._oContainer._oContent._oFooter.style.display = "none";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container body. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_bd".\r\r
+ *\r\r
+ * @param {string} sHeader HTML markup for container body\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setBody = function(sBody) {\r\r
+    if(sBody) {\r\r
+        if(this._oContainer._oContent._oBody) {\r\r
+            this._oContainer._oContent._oBody.innerHTML = sBody;\r\r
+            this._oContainer._oContent._oBody.style.display = "block";\r\r
+            this._oContainer._oContent.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oBody.innerHTML = "";\r\r
+        this._oContainer._oContent.style.display = "none";\r\r
+    }\r\r
+    this._maxResultsDisplayed = 0;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Overridable method that converts a result item object into HTML markup\r\r
+ * for display. Return data values are accessible via the oResultItem object,\r\r
+ * and the key return value will always be oResultItem[0]. Markup will be\r\r
+ * displayed within &lt;li&gt; element tags in the container.\r\r
+ *\r\r
+ * @param {object} oResultItem Result item object representing one query result\r\r
+ * @param {string} sQuery The current query string\r\r
+ * @return {string} HTML markup of formatted result data\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultItem, sQuery) {\r\r
+    var sResult = oResultItem[0];\r\r
+    if(sResult) {\r\r
+        return sResult;\r\r
+    }\r\r
+    else {\r\r
+        return "";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Makes query request to the data source.\r\r
+ *\r\r
+ * @param {string} sQuery Query string.\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {\r\r
+    if(sQuery) {\r\r
+        this._sendQuery(sQuery);\r\r
+    }\r\r
+    else {\r\r
+        YAHOO.log("Query could not be sent because the string value was empty or null.","warn",this.toString());\r\r
+        return;\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when the auto complete text input box receives focus. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     -  args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxFocusEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete text input box receives key input. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The keycode number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance makes a query to the data source.\r\r
+ * Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataRequestEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance receives query results from the data\r\r
+ * source. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ *     - args[2] Results array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataReturnEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance does not receive query results from the\r\r
+ * data source due to an error. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete container is expanded. If alwaysShowContainer is\r\r
+ * enabled, then containerExpandEvent will be fired when the container is\r\r
+ * populated with results. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete textbox has been prefilled by the type-ahead\r\r
+ * feature. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ *     - args[2] The prefill string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.typeAheadEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been moused over. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt element item moused to\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been moused out. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item moused from\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been arrowed to. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item arrowed to\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemArrowToEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been arrowed away from. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item arrowed from\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an item is selected via mouse click, ENTER key, or TAB key.\r\r
+ * Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The selected &lt;li&gt; element item\r\r
+ *     - args[2] The data returned for the item, either as an object, or mapped from the schema into an array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an user selection does not match any of the displayed result items.\r\r
+ * Note that this event may not behave as expected when delimiter characters\r\r
+ * have been defined. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The user selection\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired if forceSelection is enabled and the user's input has been cleared\r\r
+ * because it did not match one of the returned query results. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete container is collapsed. If alwaysShowContainer is\r\r
+ * enabled, then containerCollapseEvent will be fired when the container is\r\r
+ * cleared of results. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.containerCollapseEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete text input box loses focus. Subscribers receive\r\r
+ * an array of the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxBlurEvent = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class variable to index multiple auto complete instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete._nIndex = 0;\r\r
+\r\r
+/**\r\r
+ * Name of auto complete instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sName = null;\r\r
+\r\r
+/**\r\r
+ * Text input box DOM element.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oTextbox = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the textbox is currently in focus. If query results come back\r\r
+ * but the user has already moved on, do not proceed with auto complete behavior.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bFocused = true;\r\r
+\r\r
+/**\r\r
+ * Animation instance for container expand/collapse.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oAnim = null;\r\r
+\r\r
+/**\r\r
+ * Container DOM element.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oContainer = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container is currently open.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bContainerOpen = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not the mouse is currently over the auto complete\r\r
+ * container. This is necessary in order to prevent clicks on container items\r\r
+ * from being text input box blur events.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bOverContainer = false;\r\r
+\r\r
+/**\r\r
+ * Array of &lt;li&gt; elements references that contain query results within the\r\r
+ * auto complete container.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._aListItems = null;\r\r
+\r\r
+/**\r\r
+ * Number of &lt;li&gt; elements currently displayed in auto complete container.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;\r\r
+\r\r
+/**\r\r
+ * Internal count of &lt;li&gt; elements displayed and hidden in auto complete container.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0;\r\r
+\r\r
+/**\r\r
+ * Current query string\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sCurQuery = null;\r\r
+\r\r
+/**\r\r
+ * Past queries this session (for saving delimited queries).\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sSavedQuery = null;\r\r
+\r\r
+/**\r\r
+ * Pointer to the currently highlighted &lt;li&gt; element in the container.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oCurItem = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not an item has been selected since the container was populated\r\r
+ * with results. Reset to false by _populateList, and set to true when item is\r\r
+ * selected.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bItemSelected = false;\r\r
+\r\r
+/**\r\r
+ * Key code of the last key pressed in textbox.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nKeyCode = null;\r\r
+\r\r
+/**\r\r
+ * Delay timeout ID.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nDelayID = -1;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Updates and validates latest public config properties.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initProps = function() {\r\r
+    // Correct any invalid values\r\r
+    var minQueryLength = this.minQueryLength;\r\r
+    if(isNaN(minQueryLength) || (minQueryLength < 1)) {\r\r
+        minQueryLength = 1;\r\r
+    }\r\r
+    var maxResultsDisplayed = this.maxResultsDisplayed;\r\r
+    if(isNaN(this.maxResultsDisplayed) || (this.maxResultsDisplayed < 1)) {\r\r
+        this.maxResultsDisplayed = 10;\r\r
+    }\r\r
+    var queryDelay = this.queryDelay;\r\r
+    if(isNaN(this.queryDelay) || (this.queryDelay < 0)) {\r\r
+        this.queryDelay = 0.5;\r\r
+    }\r\r
+    var aDelimChar = (this.delimChar) ? this.delimChar : null;\r\r
+    if(aDelimChar) {\r\r
+        if(typeof aDelimChar == "string") {\r\r
+            this.delimChar = [aDelimChar];\r\r
+        }\r\r
+        else if(aDelimChar.constructor != Array) {\r\r
+            this.delimChar = null;\r\r
+        }\r\r
+    }\r\r
+    var animSpeed = this.animSpeed;\r\r
+    if((this.animHoriz || this.animVert) && YAHOO.util.Anim) {\r\r
+        if(isNaN(animSpeed) || (animSpeed < 0)) {\r\r
+            animSpeed = 0.3;\r\r
+        }\r\r
+        if(!this._oAnim ) {\r\r
+            oAnim = new YAHOO.util.Anim(this._oContainer._oContent, {}, this.animSpeed);\r\r
+            this._oAnim = oAnim;\r\r
+        }\r\r
+        else {\r\r
+            this._oAnim.duration = animSpeed;\r\r
+        }\r\r
+    }\r\r
+    if(this.forceSelection && this.delimChar) {\r\r
+        YAHOO.log("The forceSelection feature has been enabled with delimChar defined.","warn", this.toString());\r\r
+    }\r\r
+    if(this.alwaysShowContainer && (this.useShadow || this.useIFrame)) {\r\r
+        YAHOO.log("The features useShadow and useIFrame are not compatible with the alwaysShowContainer feature.","warn", this.toString());\r\r
+    }\r\r
+\r\r
+    if(this.alwaysShowContainer) {\r\r
+        this._bContainerOpen = true;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes the auto complete container helpers if they are enabled and do\r\r
+ * not exist\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initContainerHelpers = function() {\r\r
+    if(this.useShadow && !this._oContainer._oShadow) {\r\r
+        var oShadow = document.createElement("div");\r\r
+        oShadow.className = "yui-ac-shadow";\r\r
+        this._oContainer._oShadow = this._oContainer.appendChild(oShadow);\r\r
+    }\r\r
+    if(this.useIFrame && !this._oContainer._oIFrame) {\r\r
+        var oIFrame = document.createElement("iframe");\r\r
+        oIFrame.src = this.iFrameSrc;\r\r
+        oIFrame.frameBorder = 0;\r\r
+        oIFrame.scrolling = "no";\r\r
+        oIFrame.style.position = "absolute";\r\r
+        oIFrame.style.width = "100%";\r\r
+        oIFrame.style.height = "100%";\r\r
+        this._oContainer._oIFrame = this._oContainer.appendChild(oIFrame);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes the auto complete container once at object creation\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initContainer = function() {\r\r
+    if(!this._oContainer._oContent) {\r\r
+        // The oContent div helps size the iframe and shadow properly\r\r
+        var oContent = document.createElement("div");\r\r
+        oContent.className = "yui-ac-content";\r\r
+        oContent.style.display = "none";\r\r
+        this._oContainer._oContent = this._oContainer.appendChild(oContent);\r\r
+\r\r
+        var oHeader = document.createElement("div");\r\r
+        oHeader.className = "yui-ac-hd";\r\r
+        oHeader.style.display = "none";\r\r
+        this._oContainer._oContent._oHeader = this._oContainer._oContent.appendChild(oHeader);\r\r
+\r\r
+        var oBody = document.createElement("div");\r\r
+        oBody.className = "yui-ac-bd";\r\r
+        this._oContainer._oContent._oBody = this._oContainer._oContent.appendChild(oBody);\r\r
+\r\r
+        var oFooter = document.createElement("div");\r\r
+        oFooter.className = "yui-ac-ft";\r\r
+        oFooter.style.display = "none";\r\r
+        this._oContainer._oContent._oFooter = this._oContainer._oContent.appendChild(oFooter);\r\r
+    }\r\r
+    else {\r\r
+        YAHOO.log("Could not initialize the container","warn",this.toString());\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Clears out contents of container body and creates up to\r\r
+ * YAHOO.widget.AutoComplete#maxResultsDisplayed &lt;li&gt; elements in an\r\r
+ * &lt;ul&gt; element.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initList = function() {\r\r
+    this._aListItems = [];\r\r
+    while(this._oContainer._oContent._oBody.hasChildNodes()) {\r\r
+        var oldListItems = this.getListItems();\r\r
+        if(oldListItems) {\r\r
+            for(var oldi = oldListItems.length-1; oldi >= 0; i--) {\r\r
+                oldListItems[oldi] = null;\r\r
+            }\r\r
+        }\r\r
+        this._oContainer._oContent._oBody.innerHTML = "";\r\r
+    }\r\r
+\r\r
+    var oList = document.createElement("ul");\r\r
+    oList = this._oContainer._oContent._oBody.appendChild(oList);\r\r
+    for(var i=0; i<this.maxResultsDisplayed; i++) {\r\r
+        var oItem = document.createElement("li");\r\r
+        oItem = oList.appendChild(oItem);\r\r
+        this._aListItems[i] = oItem;\r\r
+        this._initListItem(oItem, i);\r\r
+    }\r\r
+    this._maxResultsDisplayed = this.maxResultsDisplayed;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes each &lt;li&gt; element in the container list.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; DOM element\r\r
+ * @param {number} nItemIndex The index of the element\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initListItem = function(oItem, nItemIndex) {\r\r
+    var oSelf = this;\r\r
+    oItem.style.display = "none";\r\r
+    oItem._nItemIndex = nItemIndex;\r\r
+\r\r
+    oItem.mouseover = oItem.mouseout = oItem.onclick = null;\r\r
+    YAHOO.util.Event.addListener(oItem,"mouseover",oSelf._onItemMouseover,oSelf);\r\r
+    YAHOO.util.Event.addListener(oItem,"mouseout",oSelf._onItemMouseout,oSelf);\r\r
+    YAHOO.util.Event.addListener(oItem,"click",oSelf._onItemMouseclick,oSelf);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element mouseover events in the container.\r\r
+ *\r\r
+ * @param {event} v The mouseover event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseover = function(v,oSelf) {\r\r
+    if(oSelf.prehighlightClassName) {\r\r
+        oSelf._togglePrehighlight(this,"mouseover");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._toggleHighlight(this,"to");\r\r
+    }\r\r
+\r\r
+    oSelf.itemMouseOverEvent.fire(oSelf, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element mouseout events in the container.\r\r
+ *\r\r
+ * @param {event} v The mouseout event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseout = function(v,oSelf) {\r\r
+    if(oSelf.prehighlightClassName) {\r\r
+        oSelf._togglePrehighlight(this,"mouseout");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._toggleHighlight(this,"from");\r\r
+    }\r\r
+\r\r
+    oSelf.itemMouseOutEvent.fire(oSelf, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element click events in the container.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseclick = function(v,oSelf) {\r\r
+    // In case item has not been moused over\r\r
+    oSelf._toggleHighlight(this,"to");\r\r
+    oSelf._selectItem(this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container mouseover events.\r\r
+ *\r\r
+ * @param {event} v The mouseover event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerMouseover = function(v,oSelf) {\r\r
+    oSelf._bOverContainer = true;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container mouseout events.\r\r
+ *\r\r
+ * @param {event} v The mouseout event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerMouseout = function(v,oSelf) {\r\r
+    oSelf._bOverContainer = false;\r\r
+    // If container is still active\r\r
+    if(oSelf._oCurItem) {\r\r
+        oSelf._toggleHighlight(oSelf._oCurItem,"to");\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container scroll events.\r\r
+ *\r\r
+ * @param {event} v The scroll event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerScroll = function(v,oSelf) {\r\r
+    oSelf._oTextbox.focus();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container resize events.\r\r
+ *\r\r
+ * @param {event} v The resize event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerResize = function(v,oSelf) {\r\r
+    oSelf._toggleContainerHelpers(oSelf._bContainerOpen);\r\r
+};\r\r
+\r\r
+\r\r
+/**\r\r
+ * Handles textbox keydown events of functional keys, mainly for UI behavior.\r\r
+ *\r\r
+ * @param {event} v The keydown event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown = function(v,oSelf) {\r\r
+    var nKeyCode = v.keyCode;\r\r
+\r\r
+    switch (nKeyCode) {\r\r
+        case 9: // tab\r\r
+            if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {\r\r
+                if(oSelf._bContainerOpen) {\r\r
+                    YAHOO.util.Event.stopEvent(v);\r\r
+                }\r\r
+            }\r\r
+            // select an item or clear out\r\r
+            if(oSelf._oCurItem) {\r\r
+                oSelf._selectItem(oSelf._oCurItem);\r\r
+            }\r\r
+            else {\r\r
+                oSelf._clearList();\r\r
+            }\r\r
+            break;\r\r
+        case 13: // enter\r\r
+            if(oSelf._nKeyCode != nKeyCode) {\r\r
+                if(oSelf._bContainerOpen) {\r\r
+                    YAHOO.util.Event.stopEvent(v);\r\r
+                }\r\r
+            }\r\r
+            if(oSelf._oCurItem) {\r\r
+                oSelf._selectItem(oSelf._oCurItem);\r\r
+            }\r\r
+            else {\r\r
+                oSelf._clearList();\r\r
+            }\r\r
+            break;\r\r
+        case 27: // esc\r\r
+            oSelf._clearList();\r\r
+            return;\r\r
+        case 39: // right\r\r
+            oSelf._jumpSelection();\r\r
+            break;\r\r
+        case 38: // up\r\r
+            YAHOO.util.Event.stopEvent(v);\r\r
+            oSelf._moveSelection(nKeyCode);\r\r
+            break;\r\r
+        case 40: // down\r\r
+            YAHOO.util.Event.stopEvent(v);\r\r
+            oSelf._moveSelection(nKeyCode);\r\r
+            break;\r\r
+        default:\r\r
+            break;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles textbox keypress events, mainly for stopEvent in Safari.\r\r
+ *\r\r
+ * @param {event} v The keyup event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress = function(v,oSelf) {\r\r
+    var nKeyCode = v.keyCode;\r\r
+\r\r
+    switch (nKeyCode) {\r\r
+    case 9: // tab\r\r
+    case 13: // enter\r\r
+        if((oSelf._nKeyCode != nKeyCode)) {\r\r
+                YAHOO.util.Event.stopEvent(v);\r\r
+        }\r\r
+        break;\r\r
+    case 38: // up\r\r
+    case 40: // down\r\r
+        YAHOO.util.Event.stopEvent(v);\r\r
+        break;\r\r
+    default:\r\r
+        break;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles textbox keyup events that trigger queries.\r\r
+ *\r\r
+ * @param {event} v The keyup event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp = function(v,oSelf) {\r\r
+    // Check to see if any of the public properties have been updated\r\r
+    oSelf._initProps();\r\r
+\r\r
+    var nKeyCode = v.keyCode;\r\r
+    oSelf._nKeyCode = nKeyCode;\r\r
+    var sChar = String.fromCharCode(nKeyCode);\r\r
+    var sText = this.value; //string in textbox\r\r
+\r\r
+    // Filter out chars that don't trigger queries\r\r
+    if (oSelf._isIgnoreKey(nKeyCode) || (sText.toLowerCase() == oSelf._sCurQuery)) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        oSelf.textboxKeyEvent.fire(oSelf, nKeyCode);\r\r
+    }\r\r
+\r\r
+    // Set timeout on the request\r\r
+    if (oSelf.queryDelay > 0) {\r\r
+        var nDelayID =\r\r
+            setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay * 1000));\r\r
+\r\r
+        if (oSelf._nDelayID != -1) {\r\r
+            clearTimeout(oSelf._nDelayID);\r\r
+        }\r\r
+\r\r
+        oSelf._nDelayID = nDelayID;\r\r
+    }\r\r
+    else {\r\r
+        // No delay so send request immediately\r\r
+        oSelf._sendQuery(sText);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Whether or not key is functional or should be ignored. Note that the right\r\r
+ * arrow key is NOT an ignored key since it triggers queries for certain intl\r\r
+ * charsets.\r\r
+ *\r\r
+ * @param {number} nKeycode Code of key pressed\r\r
+ * @return {boolean} Whether or not to be ignore key\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._isIgnoreKey = function(nKeyCode) {\r\r
+    if ((nKeyCode == 9) || (nKeyCode == 13)  || // tab, enter\r\r
+            (nKeyCode == 16) || (nKeyCode == 17) || // shift, ctl\r\r
+            (nKeyCode >= 18 && nKeyCode <= 20) || // alt,pause/break,caps lock\r\r
+            (nKeyCode == 27) || // esc\r\r
+            (nKeyCode >= 33 && nKeyCode <= 35) || // page up,page down,end\r\r
+            (nKeyCode >= 36 && nKeyCode <= 38) || // home,left,up\r\r
+            (nKeyCode == 40) || // down\r\r
+            (nKeyCode >= 44 && nKeyCode <= 45)) { // print screen,insert\r\r
+        return true;\r\r
+    }\r\r
+    return false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles text input box receiving focus.\r\r
+ *\r\r
+ * @param {event} v The focus event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxFocus = function (v,oSelf) {\r\r
+    oSelf._oTextbox.setAttribute("autocomplete","off");\r\r
+    oSelf._bFocused = true;\r\r
+    oSelf.textboxFocusEvent.fire(oSelf);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles text input box losing focus.\r\r
+ *\r\r
+ * @param {event} v The focus event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxBlur = function (v,oSelf) {\r\r
+    // Don't treat as a blur if it was a selection via mouse click\r\r
+    if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) {\r\r
+        // Current query needs to be validated\r\r
+        if(!oSelf._bItemSelected) {\r\r
+            if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && !oSelf._textMatchesOption())) {\r\r
+                if(oSelf.forceSelection) {\r\r
+                    oSelf._clearSelection();\r\r
+                }\r\r
+                else {\r\r
+                    oSelf.unmatchedItemSelectEvent.fire(oSelf, oSelf._sCurQuery);\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        if(oSelf._bContainerOpen) {\r\r
+            oSelf._clearList();\r\r
+        }\r\r
+        oSelf._bFocused = false;\r\r
+        oSelf.textboxBlurEvent.fire(oSelf);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles form submission event.\r\r
+ *\r\r
+ * @param {event} v The submit event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onFormSubmit = function(v,oSelf) {\r\r
+    if(oSelf.allowBrowserAutocomplete) {\r\r
+        oSelf._oTextbox.setAttribute("autocomplete","on");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._oTextbox.setAttribute("autocomplete","off");\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Makes query request to the data source.\r\r
+ *\r\r
+ * @param {string} sQuery Query string.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sendQuery = function(sQuery) {\r\r
+    // Delimiter has been enabled\r\r
+    var aDelimChar = (this.delimChar) ? this.delimChar : null;\r\r
+    if(aDelimChar) {\r\r
+        // Loop through all possible delimiters and find the latest one\r\r
+        // A " " may be a false positive if they are defined as delimiters AND\r\r
+        // are used to separate delimited queries\r\r
+        var nDelimIndex = -1;\r\r
+        for(var i = aDelimChar.length-1; i >= 0; i--) {\r\r
+            var nNewIndex = sQuery.lastIndexOf(aDelimChar[i]);\r\r
+            if(nNewIndex > nDelimIndex) {\r\r
+                nDelimIndex = nNewIndex;\r\r
+            }\r\r
+        }\r\r
+        // If we think the last delimiter is a space (" "), make sure it is NOT\r\r
+        // a false positive by also checking the char directly before it\r\r
+        if(aDelimChar[i] == " ") {\r\r
+            for (var j = aDelimChar.length-1; j >= 0; j--) {\r\r
+                if(sQuery[nDelimIndex - 1] == aDelimChar[j]) {\r\r
+                    nDelimIndex--;\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        // A delimiter has been found so extract the latest query\r\r
+        if (nDelimIndex > -1) {\r\r
+            var nQueryStart = nDelimIndex + 1;\r\r
+            // Trim any white space from the beginning...\r\r
+            while(sQuery.charAt(nQueryStart) == " ") {\r\r
+                nQueryStart += 1;\r\r
+            }\r\r
+            // ...and save the rest of the string for later\r\r
+            this._sSavedQuery = sQuery.substring(0,nQueryStart);\r\r
+            // Here is the query itself\r\r
+            sQuery = sQuery.substr(nQueryStart);\r\r
+        }\r\r
+        else if(sQuery.indexOf(this._sSavedQuery) < 0){\r\r
+            this._sSavedQuery = null;\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Don't search queries that are too short\r\r
+    if (sQuery.length < this.minQueryLength) {\r\r
+        if (this._nDelayID != -1) {\r\r
+            clearTimeout(this._nDelayID);\r\r
+        }\r\r
+        this._clearList();\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    sQuery = encodeURIComponent(sQuery);\r\r
+    this._nDelayID = -1;    // Reset timeout ID because request has been made\r\r
+    this.dataRequestEvent.fire(this, sQuery);\r\r
+    this.dataSource.getResults(this._populateList, sQuery, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Hides all visuals related to the array of &lt;li&gt; elements in the container.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._clearList = function() {\r\r
+    this._oContainer._oContent.scrollTop = 0;\r\r
+    var aItems = this._aListItems;\r\r
+\r\r
+    if(aItems && (aItems.length > 0)) {\r\r
+        for(var i = aItems.length-1; i >= 0 ; i--) {\r\r
+            aItems[i].style.display = "none";\r\r
+        }\r\r
+    }\r\r
+\r\r
+    if (this._oCurItem) {\r\r
+        this._toggleHighlight(this._oCurItem,"from");\r\r
+    }\r\r
+\r\r
+    this._oCurItem = null;\r\r
+    this._nDisplayedItems = 0;\r\r
+    this._sCurQuery = null;\r\r
+    this._toggleContainer(false);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Populates the array of &lt;li&gt; elements in the container with query\r\r
+ * results. This method is passed to YAHOO.widget.DataSource#getResults as a\r\r
+ * callback function so results from the datasource are returned to the\r\r
+ * auto complete instance.\r\r
+ *\r\r
+ * @param {string} sQuery The query string\r\r
+ * @param {object} aResults An array of query result objects from the data source\r\r
+ * @param {string} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, aResults, oSelf) {\r\r
+    if(aResults === null) {\r\r
+        oSelf.dataErrorEvent.fire(oSelf, sQuery);\r\r
+    }\r\r
+    if (!oSelf._bFocused || !aResults) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);\r\r
+    var contentStyle = oSelf._oContainer._oContent.style;\r\r
+    contentStyle.width = (!isOpera) ? null : "";\r\r
+    contentStyle.height = (!isOpera) ? null : "";\r\r
+\r\r
+    var sCurQuery = decodeURIComponent(sQuery);\r\r
+    oSelf._sCurQuery = sCurQuery;\r\r
+    oSelf._bItemSelected = false;\r\r
+\r\r
+    if(oSelf._maxResultsDisplayed != oSelf.maxResultsDisplayed) {\r\r
+        oSelf._initList();\r\r
+    }\r\r
+\r\r
+    var nItems = Math.min(aResults.length,oSelf.maxResultsDisplayed);\r\r
+    oSelf._nDisplayedItems = nItems;\r\r
+    if (nItems > 0) {\r\r
+        oSelf._initContainerHelpers();\r\r
+        var aItems = oSelf._aListItems;\r\r
+\r\r
+        // Fill items with data\r\r
+        for(var i = nItems-1; i >= 0; i--) {\r\r
+            var oItemi = aItems[i];\r\r
+            var oResultItemi = aResults[i];\r\r
+            oItemi.innerHTML = oSelf.formatResult(oResultItemi, sCurQuery);\r\r
+            oItemi.style.display = "list-item";\r\r
+            oItemi._sResultKey = oResultItemi[0];\r\r
+            oItemi._oResultData = oResultItemi;\r\r
+\r\r
+        }\r\r
+\r\r
+        // Empty out remaining items if any\r\r
+        for(var j = aItems.length-1; j >= nItems ; j--) {\r\r
+            var oItemj = aItems[j];\r\r
+            oItemj.innerHTML = null;\r\r
+            oItemj.style.display = "none";\r\r
+            oItemj._sResultKey = null;\r\r
+            oItemj._oResultData = null;\r\r
+        }\r\r
+\r\r
+        if(oSelf.autoHighlight) {\r\r
+            // Go to the first item\r\r
+            var oFirstItem = aItems[0];\r\r
+            oSelf._toggleHighlight(oFirstItem,"to");\r\r
+            oSelf.itemArrowToEvent.fire(oSelf, oFirstItem);\r\r
+            oSelf._typeAhead(oFirstItem,sQuery);\r\r
+        }\r\r
+        else {\r\r
+            oSelf._oCurItem = null;\r\r
+        }\r\r
+\r\r
+        // Expand the container\r\r
+        oSelf._toggleContainer(true);\r\r
+    }\r\r
+    else {\r\r
+        oSelf._clearList();\r\r
+    }\r\r
+    oSelf.dataReturnEvent.fire(oSelf, sQuery, aResults);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * When YAHOO.widget.AutoComplete#bForceSelection is true and the user attempts\r\r
+ * leave the text input box without selecting an item from the query results,\r\r
+ * the user selection is cleared.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._clearSelection = function() {\r\r
+    var sValue = this._oTextbox.value;\r\r
+    var sChar = (this.delimChar) ? this.delimChar[0] : null;\r\r
+    var nIndex = (sChar) ? sValue.lastIndexOf(sChar, sValue.length-2) : -1;\r\r
+    if(nIndex > -1) {\r\r
+        this._oTextbox.value = sValue.substring(0,nIndex);\r\r
+    }\r\r
+    else {\r\r
+         this._oTextbox.value = "";\r\r
+    }\r\r
+    this._sSavedQuery = this._oTextbox.value;\r\r
+\r\r
+    // Fire custom event\r\r
+    this.selectionEnforceEvent.fire(this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Whether or not user-typed value in the text input box matches any of the\r\r
+ * query results.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() {\r\r
+    var foundMatch = false;\r\r
+\r\r
+    for(var i = this._nDisplayedItems-1; i >= 0 ; i--) {\r\r
+        var oItem = this._aListItems[i];\r\r
+        var sMatch = oItem._sResultKey.toLowerCase();\r\r
+        if (sMatch == this._sCurQuery.toLowerCase()) {\r\r
+            foundMatch = true;\r\r
+            break;\r\r
+        }\r\r
+    }\r\r
+    return(foundMatch);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates in the text input box with the first query result as the user types,\r\r
+ * selecting the substring that the user has not typed.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; element item whose data populates the input field\r\r
+ * @param {string} sQuery Query string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._typeAhead = function(oItem, sQuery) {\r\r
+    // Don't update if turned off\r\r
+    if (!this.typeAhead) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var oTextbox = this._oTextbox;\r\r
+    var sValue = this._oTextbox.value; // any saved queries plus what user has typed\r\r
+\r\r
+    // Don't update with type-ahead if text selection is not supported\r\r
+    if(!oTextbox.setSelectionRange && !oTextbox.createTextRange) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    // Select the portion of text that the user has not typed\r\r
+    var nStart = sValue.length;\r\r
+    this._updateValue(oItem);\r\r
+    var nEnd = oTextbox.value.length;\r\r
+    this._selectText(oTextbox,nStart,nEnd);\r\r
+    var sPrefill = oTextbox.value.substr(nStart,nEnd);\r\r
+    this.typeAheadEvent.fire(this,sQuery,sPrefill);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Selects text in a text input box.\r\r
+ *\r\r
+ * @param {object} oTextbox Text input box element in which to select text\r\r
+ * @param {number} nStart Starting index of text string to select\r\r
+ * @param {number} nEnd Ending index of text selection\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._selectText = function(oTextbox, nStart, nEnd) {\r\r
+    if (oTextbox.setSelectionRange) { // For Mozilla\r\r
+        oTextbox.setSelectionRange(nStart,nEnd);\r\r
+    }\r\r
+    else if (oTextbox.createTextRange) { // For IE\r\r
+        var oTextRange = oTextbox.createTextRange();\r\r
+        oTextRange.moveStart("character", nStart);\r\r
+        oTextRange.moveEnd("character", nEnd-oTextbox.value.length);\r\r
+        oTextRange.select();\r\r
+    }\r\r
+    else {\r\r
+        oTextbox.select();\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Syncs auto complete container with its helpers.\r\r
+ *\r\r
+ * @param {boolean} bShow True if container is expanded, false if collapsed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers = function(bShow) {\r\r
+    var bFireEvent = false;\r\r
+    var width = this._oContainer._oContent.offsetWidth + "px";\r\r
+    var height = this._oContainer._oContent.offsetHeight + "px";\r\r
+\r\r
+    if(this.useIFrame && this._oContainer._oIFrame) {\r\r
+        bFireEvent = true;\r\r
+        if(this.alwaysShowContainer || bShow) {\r\r
+            this._oContainer._oIFrame.style.width = width;\r\r
+            this._oContainer._oIFrame.style.height = height;\r\r
+        }\r\r
+        else {\r\r
+            this._oContainer._oIFrame.style.width = 0;\r\r
+            this._oContainer._oIFrame.style.height = 0;\r\r
+        }\r\r
+    }\r\r
+    if(this.useShadow && this._oContainer._oShadow) {\r\r
+        bFireEvent = true;\r\r
+        if(this.alwaysShowContainer || bShow) {\r\r
+            this._oContainer._oShadow.style.width = width;\r\r
+            this._oContainer._oShadow.style.height = height;\r\r
+        }\r\r
+        else {\r\r
+           this._oContainer._oShadow.style.width = 0;\r\r
+            this._oContainer._oShadow.style.height = 0;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Animates expansion or collapse of the container.\r\r
+ *\r\r
+ * @param {boolean} bShow True if container should be expanded, false if\r\r
+ *                        container should be collapsed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) {\r\r
+    // Implementer has container always open so don't mess with it\r\r
+    if(this.alwaysShowContainer) {\r\r
+        // Fire these events to give implementers a hook into the container\r\r
+        // being populated and being emptied\r\r
+        if(bShow) {\r\r
+            this.containerExpandEvent.fire(this);\r\r
+        }\r\r
+        else {\r\r
+            this.containerCollapseEvent.fire(this);\r\r
+        }\r\r
+        this._bContainerOpen = bShow;\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var oContainer = this._oContainer;\r\r
+    // Container is already closed\r\r
+    if (!bShow && !this._bContainerOpen) {\r\r
+        oContainer._oContent.style.display = "none";\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    // If animation is enabled...\r\r
+    var oAnim = this._oAnim;\r\r
+    if (oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) {\r\r
+        // If helpers need to be collapsed, do it right away...\r\r
+        // but if helpers need to be expanded, wait until after the container expands\r\r
+        if(!bShow) {\r\r
+            this._toggleContainerHelpers(bShow);\r\r
+        }\r\r
+\r\r
+        if(oAnim.isAnimated()) {\r\r
+            oAnim.stop();\r\r
+        }\r\r
+\r\r
+        // Clone container to grab current size offscreen\r\r
+        var oClone = oContainer._oContent.cloneNode(true);\r\r
+        oContainer.appendChild(oClone);\r\r
+        oClone.style.top = "-9000px";\r\r
+        oClone.style.display = "block";\r\r
+\r\r
+        // Current size of the container is the EXPANDED size\r\r
+        var wExp = oClone.offsetWidth;\r\r
+        var hExp = oClone.offsetHeight;\r\r
+\r\r
+        // Calculate COLLAPSED sizes based on horiz and vert anim\r\r
+        var wColl = (this.animHoriz) ? 0 : wExp;\r\r
+        var hColl = (this.animVert) ? 0 : hExp;\r\r
+\r\r
+        // Set animation sizes\r\r
+        oAnim.attributes = (bShow) ?\r\r
+            {width: { to: wExp }, height: { to: hExp }} :\r\r
+            {width: { to: wColl}, height: { to: hColl }};\r\r
+\r\r
+        // If opening anew, set to a collapsed size...\r\r
+        if(bShow && !this._bContainerOpen) {\r\r
+            oContainer._oContent.style.width = wColl+"px";\r\r
+            oContainer._oContent.style.height = hColl+"px";\r\r
+        }\r\r
+        // Else, set it to its last known size.\r\r
+        else {\r\r
+            oContainer._oContent.style.width = wExp+"px";\r\r
+            oContainer._oContent.style.height = hExp+"px";\r\r
+        }\r\r
+\r\r
+        oContainer.removeChild(oClone);\r\r
+        oClone = null;\r\r
+\r\r
+       var oSelf = this;\r\r
+       var onAnimComplete = function() {\r\r
+            // Finish the collapse\r\r
+               oAnim.onComplete.unsubscribeAll();\r\r
+\r\r
+            if(bShow) {\r\r
+                oSelf.containerExpandEvent.fire(oSelf);\r\r
+            }\r\r
+            else {\r\r
+                oContainer._oContent.style.display = "none";\r\r
+                oSelf.containerCollapseEvent.fire(oSelf);\r\r
+            }\r\r
+            oSelf._toggleContainerHelpers(bShow);\r\r
+       };\r\r
+\r\r
+        // Display container and animate it\r\r
+        oContainer._oContent.style.display = "block";\r\r
+        oAnim.onComplete.subscribe(onAnimComplete);\r\r
+        oAnim.animate();\r\r
+        this._bContainerOpen = bShow;\r\r
+    }\r\r
+    // Else don't animate, just show or hide\r\r
+    else {\r\r
+        if(bShow) {\r\r
+            oContainer._oContent.style.display = "block";\r\r
+            this.containerExpandEvent.fire(this);\r\r
+        }\r\r
+        else {\r\r
+            oContainer._oContent.style.display = "none";\r\r
+            this.containerCollapseEvent.fire(this);\r\r
+        }\r\r
+        this._toggleContainerHelpers(bShow);\r\r
+        this._bContainerOpen = bShow;\r\r
+   }\r\r
+\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Toggles the highlight on or off for an item in the container, and also cleans\r\r
+ * up highlighting of any previous item.\r\r
+ *\r\r
+ * @param {object} oNewItem New The &lt;li&gt; element item to receive highlight\r\r
+ *                              behavior\r\r
+ * @param {string} sType "mouseover" will toggle highlight on, and "mouseout"\r\r
+ *                       will toggle highlight off.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleHighlight = function(oNewItem, sType) {\r\r
+    var sHighlight = this.highlightClassName;\r\r
+    if(this._oCurItem) {\r\r
+        // Remove highlight from old item\r\r
+        YAHOO.util.Dom.removeClass(this._oCurItem, sHighlight);\r\r
+    }\r\r
+\r\r
+    if((sType == "to") && sHighlight) {\r\r
+        // Apply highlight to new item\r\r
+        YAHOO.util.Dom.addClass(oNewItem, sHighlight);\r\r
+        this._oCurItem = oNewItem;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Toggles the pre-highlight on or off for an item in the container.\r\r
+ *\r\r
+ * @param {object} oNewItem New The &lt;li&gt; element item to receive highlight\r\r
+ *                              behavior\r\r
+ * @param {string} sType "mouseover" will toggle highlight on, and "mouseout"\r\r
+ *                       will toggle highlight off.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._togglePrehighlight = function(oNewItem, sType) {\r\r
+    if(oNewItem == this._oCurItem) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var sPrehighlight = this.prehighlightClassName;\r\r
+    if((sType == "mouseover") && sPrehighlight) {\r\r
+        // Apply prehighlight to new item\r\r
+        YAHOO.util.Dom.addClass(oNewItem, sPrehighlight);\r\r
+    }\r\r
+    else {\r\r
+        // Remove prehighlight from old item\r\r
+        YAHOO.util.Dom.removeClass(oNewItem, sPrehighlight);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates the text input box value with selected query result. If a delimiter\r\r
+ * has been defined, then the value gets appended with the delimiter.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; element item with which to update the value\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._updateValue = function(oItem) {\r\r
+    var oTextbox = this._oTextbox;\r\r
+    var sDelimChar = (this.delimChar) ? this.delimChar[0] : null;\r\r
+    var sSavedQuery = this._sSavedQuery;\r\r
+    var sResultKey = oItem._sResultKey;\r\r
+    oTextbox.focus();\r\r
+\r\r
+    // First clear text field\r\r
+    oTextbox.value = "";\r\r
+    // Grab data to put into text field\r\r
+    if(sDelimChar) {\r\r
+        if(sSavedQuery) {\r\r
+            oTextbox.value = sSavedQuery;\r\r
+        }\r\r
+        oTextbox.value += sResultKey + sDelimChar;\r\r
+        if(sDelimChar != " ") {\r\r
+            oTextbox.value += " ";\r\r
+        }\r\r
+    }\r\r
+    else { oTextbox.value = sResultKey; }\r\r
+\r\r
+    // scroll to bottom of textarea if necessary\r\r
+    if(oTextbox.type == "textarea") {\r\r
+        oTextbox.scrollTop = oTextbox.scrollHeight;\r\r
+    }\r\r
+\r\r
+    // move cursor to end\r\r
+    var end = oTextbox.value.length;\r\r
+    this._selectText(oTextbox,end,end);\r\r
+\r\r
+    this._oCurItem = oItem;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Selects a result item from the container\r\r
+ *\r\r
+ * @param {object} oItem The selected &lt;li&gt; element item\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._selectItem = function(oItem) {\r\r
+    this._bItemSelected = true;\r\r
+    this._updateValue(oItem);\r\r
+    this.itemSelectEvent.fire(this, oItem, oItem._oResultData);\r\r
+    this._clearList();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * For values updated by type-ahead, the right arrow key jumps to the end\r\r
+ * of the textbox, otherwise the container is closed.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._jumpSelection = function() {\r\r
+    if(!this.typeAhead) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this._clearList();\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Triggered by up and down arrow keys, changes the current highlighted\r\r
+ * &lt;li&gt; element item. Scrolls container if necessary.\r\r
+ *\r\r
+ * @param {number} nKeyCode Code of key pressed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._moveSelection = function(nKeyCode) {\r\r
+    if(this._bContainerOpen) {\r\r
+        // Determine current item's id number\r\r
+        var oCurItem = this._oCurItem;\r\r
+        var nCurItemIndex = -1;\r\r
+\r\r
+        if (oCurItem) {\r\r
+            nCurItemIndex = oCurItem._nItemIndex;\r\r
+        }\r\r
+\r\r
+        var nNewItemIndex = (nKeyCode == 40) ?\r\r
+                (nCurItemIndex + 1) : (nCurItemIndex - 1);\r\r
+\r\r
+        // Out of bounds\r\r
+        if (nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) {\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        if (oCurItem) {\r\r
+            // Unhighlight current item\r\r
+            this._toggleHighlight(oCurItem, "from");\r\r
+            this.itemArrowFromEvent.fire(this, oCurItem);\r\r
+        }\r\r
+        if (nNewItemIndex == -1) {\r\r
+           // Go back to query (remove type-ahead string)\r\r
+            if(this.delimChar && this._sSavedQuery) {\r\r
+                if (!this._textMatchesOption()) {\r\r
+                    this._oTextbox.value = this._sSavedQuery;\r\r
+                }\r\r
+                else {\r\r
+                    this._oTextbox.value = this._sSavedQuery + this._sCurQuery;\r\r
+                }\r\r
+            }\r\r
+            else {\r\r
+                this._oTextbox.value = this._sCurQuery;\r\r
+            }\r\r
+            this._oCurItem = null;\r\r
+            return;\r\r
+        }\r\r
+        if (nNewItemIndex == -2) {\r\r
+            // Close container\r\r
+            this._clearList();\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        var oNewItem = this._aListItems[nNewItemIndex];\r\r
+\r\r
+        // Scroll the container if necessary\r\r
+        if((YAHOO.util.Dom.getStyle(this._oContainer._oContent,"overflow") == "auto") &&\r\r
+        (nNewItemIndex > -1) && (nNewItemIndex < this._nDisplayedItems)) {\r\r
+            // User is keying down\r\r
+            if(nKeyCode == 40) {\r\r
+                // Bottom of selected item is below scroll area...\r\r
+                if((oNewItem.offsetTop+oNewItem.offsetHeight) > (this._oContainer._oContent.scrollTop + this._oContainer._oContent.offsetHeight)) {\r\r
+                    // Set bottom of scroll area to bottom of selected item\r\r
+                    this._oContainer._oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - this._oContainer._oContent.offsetHeight;\r\r
+                }\r\r
+                // Bottom of selected item is above scroll area...\r\r
+                else if((oNewItem.offsetTop+oNewItem.offsetHeight) < this._oContainer._oContent.scrollTop) {\r\r
+                    // Set top of selected item to top of scroll area\r\r
+                    this._oContainer._oContent.scrollTop = oNewItem.offsetTop;\r\r
+\r\r
+                }\r\r
+            }\r\r
+            // User is keying up\r\r
+            else {\r\r
+                // Top of selected item is above scroll area\r\r
+                if(oNewItem.offsetTop < this._oContainer._oContent.scrollTop) {\r\r
+                    // Set top of scroll area to top of selected item\r\r
+                    this._oContainer._oContent.scrollTop = oNewItem.offsetTop;\r\r
+                }\r\r
+                // Top of selected item is below scroll area\r\r
+                else if(oNewItem.offsetTop > (this._oContainer._oContent.scrollTop + this._oContainer._oContent.offsetHeight)) {\r\r
+                    // Set bottom of selected item to bottom of scroll area\r\r
+                    this._oContainer._oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - this._oContainer._oContent.offsetHeight;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        this._toggleHighlight(oNewItem, "to");\r\r
+        this.itemArrowToEvent.fire(this, oNewItem);\r\r
+        if(this.typeAhead) {\r\r
+            this._updateValue(oNewItem);\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing encapsulation of a data source. \r\r
+ *  \r\r
+ * @constructor\r\r
+ *\r\r
+ */\r\r
+YAHOO.widget.DataSource = function() { \r\r
+    /* abstract class */\r\r
+};\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public constants\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Error message for null data responses.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.ERROR_DATANULL = "Response data was null";\r\r
+\r\r
+/**\r\r
+ * Error message for data responses with parsing errors.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.ERROR_DATAPARSE = "Response data could not be parsed";\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Max size of the local cache.  Set to 0 to turn off caching.  Caching is\r\r
+ * useful to reduce the number of server connections.  Recommended only for data\r\r
+ * sources that return comprehensive results for queries or when stale data is\r\r
+ * not an issue. Default: 15.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.maxCacheEntries = 15;\r\r
+\r\r
+/**\r\r
+ * Use this to equate cache matching with the type of matching done by your live\r\r
+ * data source. If caching is on and queryMatchContains is true, the cache\r\r
+ * returns results that "contain" the query string. By default,\r\r
+ * queryMatchContains is set to false, meaning the cache only returns results\r\r
+ * that "start with" the query string. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchContains = false;\r\r
+\r\r
+/**\r\r
+ * Data source query subset matching. If caching is on and queryMatchSubset is\r\r
+ * true, substrings of queries will return matching cached results. For\r\r
+ * instance, if the first query is for "abc" susequent queries that start with\r\r
+ * "abc", like "abcd", will be queried against the cache, and not the live data\r\r
+ * source. Recommended only for data sources that return comprehensive results\r\r
+ * for queries with very few characters. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchSubset = false;\r\r
+\r\r
+/**\r\r
+ * Data source query case-sensitivity matching. If caching is on and\r\r
+ * queryMatchCase is true, queries will only return results for case-sensitive\r\r
+ * matches. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchCase = false;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the data source instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getName = function() {\r\r
+    return this._sName;\r\r
+};\r\r
+\r\r
+ /**\r\r
+ * Public accessor to the unique name of the data source instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.toString = function() {\r\r
+    return "DataSource " + this._sName;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Retrieves query results, first checking the local cache, then making the\r\r
+ * query request to the live data source as defined by the function doQuery.\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to\r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oParent) {\r\r
+    \r\r
+    // First look in cache\r\r
+    var aResults = this._doQueryCache(oCallbackFn,sQuery,oParent);\r\r
+    \r\r
+    // Not in cache, so get results from server\r\r
+    if(aResults.length === 0) {\r\r
+        this.queryEvent.fire(this, oParent, sQuery);\r\r
+        this.doQuery(oCallbackFn, sQuery, oParent);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Abstract method implemented by subclasses to make a query to the live data\r\r
+ * source. Must call the callback function with the response returned from the\r\r
+ * query. Populates cache (if enabled).\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function implemented by oParent to\r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    /* override this */ \r\r
+};\r\r
+\r\r
+/**\r\r
+ * Flushes cache.\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.flushCache = function() {\r\r
+    if(this._aCache) {\r\r
+        this._aCache = [];\r\r
+    }\r\r
+    if(this._aCacheHelper) {\r\r
+        this._aCacheHelper = [];\r\r
+    }\r\r
+    this.cacheFlushEvent.fire(this);\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when a query is made to the live data source. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when a query is made to the local cache. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.cacheQueryEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when data is retrieved from the live data source. Subscribers receive\r\r
+ * the following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getResultsEvent = null;\r\r
+    \r\r
+/**\r\r
+ * Fired when data is retrieved from the local cache. Subscribers receive the\r\r
+ * following array :<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getCachedResultsEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an error is encountered with the live data source. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Error message string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.dataErrorEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the local cache is flushed. Subscribers receive the following\r\r
+ * array :<br>\r\r
+ *     - args[0] The data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.cacheFlushEvent = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class variable to index multiple data source instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource._nIndex = 0;\r\r
+\r\r
+/**\r\r
+ * Name of data source instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._sName = null;\r\r
+\r\r
+/**\r\r
+ * Local cache of data result objects indexed chronologically.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._aCache = null;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Initializes data source instance.\r\r
+ *  \r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._init = function() {\r\r
+    // Validate and initialize public configs\r\r
+    var maxCacheEntries = this.maxCacheEntries;\r\r
+    if(isNaN(maxCacheEntries) || (maxCacheEntries < 0)) {\r\r
+        maxCacheEntries = 0;\r\r
+    }\r\r
+    // Initialize local cache\r\r
+    if(maxCacheEntries > 0 && !this._aCache) {\r\r
+        this._aCache = [];\r\r
+    }\r\r
+    \r\r
+    this._sName = "instance" + YAHOO.widget.DataSource._nIndex;\r\r
+    YAHOO.widget.DataSource._nIndex++;\r\r
+    \r\r
+    this.queryEvent = new YAHOO.util.CustomEvent("query", this);\r\r
+    this.cacheQueryEvent = new YAHOO.util.CustomEvent("cacheQuery", this);\r\r
+    this.getResultsEvent = new YAHOO.util.CustomEvent("getResults", this);\r\r
+    this.getCachedResultsEvent = new YAHOO.util.CustomEvent("getCachedResults", this);\r\r
+    this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this);\r\r
+    this.cacheFlushEvent = new YAHOO.util.CustomEvent("cacheFlush", this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Adds a result object to the local cache, evicting the oldest element if the \r\r
+ * cache is full. Newer items will have higher indexes, the oldest item will have\r\r
+ * index of 0. \r\r
+ *\r\r
+ * @param {object} resultObj  Object literal of data results, including internal\r\r
+ *                            properties and an array of result objects\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._addCacheElem = function(resultObj) {\r\r
+    var aCache = this._aCache;\r\r
+    // Don't add if anything important is missing.\r\r
+    if(!aCache || !resultObj || !resultObj.query || !resultObj.results) {\r\r
+        return;\r\r
+    }\r\r
+    \r\r
+    // If the cache is full, make room by removing from index=0\r\r
+    if(aCache.length >= this.maxCacheEntries) {\r\r
+        aCache.shift();\r\r
+    }\r\r
+        \r\r
+    // Add to cache, at the end of the array\r\r
+    aCache.push(resultObj);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Queries the local cache for results. If query has been cached, the callback\r\r
+ * function is called with the results, and the cached is refreshed so that it\r\r
+ * is now the newest element.  \r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ * @return {array} aResults Result object from local cache if found, otherwise \r\r
+ *                          null\r\r
+ * @private \r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, oParent) {\r\r
+    var aResults = [];\r\r
+    var bMatchFound = false;\r\r
+    var aCache = this._aCache;\r\r
+    var nCacheLength = (aCache) ? aCache.length : 0;\r\r
+    var bMatchContains = this.queryMatchContains;\r\r
+    \r\r
+    // If cache is enabled...\r\r
+    if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) {\r\r
+        this.cacheQueryEvent.fire(this, oParent, sQuery);\r\r
+        // If case is unimportant, normalize query now instead of in loops\r\r
+        if(!this.queryMatchCase) {\r\r
+            var sOrigQuery = sQuery;\r\r
+            sQuery = sQuery.toLowerCase();\r\r
+        }\r\r
+\r\r
+        // Loop through each cached element's query property...\r\r
+        for(var i = nCacheLength-1; i >= 0; i--) {\r\r
+            var resultObj = aCache[i];\r\r
+            var aAllResultItems = resultObj.results;\r\r
+            // If case is unimportant, normalize match key for comparison\r\r
+            var matchKey = (!this.queryMatchCase) ?\r\r
+                encodeURIComponent(resultObj.query.toLowerCase()):\r\r
+                encodeURIComponent(resultObj.query);\r\r
+            \r\r
+            // If a cached match key exactly matches the query...\r\r
+            if(matchKey == sQuery) {\r\r
+                    // Stash all result objects into aResult[] and stop looping through the cache.\r\r
+                    bMatchFound = true;\r\r
+                    aResults = aAllResultItems;\r\r
+                    \r\r
+                    // The matching cache element was not the most recent,\r\r
+                    // so now we need to refresh the cache.\r\r
+                    if(i != nCacheLength-1) {                        \r\r
+                        // Remove element from its original location\r\r
+                        aCache.splice(i,1);\r\r
+                        // Add element as newest\r\r
+                        this._addCacheElem(resultObj);\r\r
+                    }\r\r
+                    break;\r\r
+            }\r\r
+            // Else if this query is not an exact match and subset matching is enabled...\r\r
+            else if(this.queryMatchSubset) {\r\r
+                // Loop through substrings of each cached element's query property...\r\r
+                for(var j = sQuery.length-1; j >= 0 ; j--) {\r\r
+                    var subQuery = sQuery.substr(0,j);\r\r
+                    \r\r
+                    // If a substring of a cached sQuery exactly matches the query...\r\r
+                    if(matchKey == subQuery) {                    \r\r
+                        bMatchFound = true;\r\r
+                        \r\r
+                        // Go through each cached result object to match against the query...\r\r
+                        for(var k = aAllResultItems.length-1; k >= 0; k--) {\r\r
+                            var aRecord = aAllResultItems[k];\r\r
+                            var sKeyIndex = (this.queryMatchCase) ?\r\r
+                                encodeURIComponent(aRecord[0]).indexOf(sQuery):\r\r
+                                encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery);\r\r
+                            \r\r
+                            // A STARTSWITH match is when the query is found at the beginning of the key string...\r\r
+                            if((!bMatchContains && (sKeyIndex === 0)) ||\r\r
+                            // A CONTAINS match is when the query is found anywhere within the key string...\r\r
+                            (bMatchContains && (sKeyIndex > -1))) {\r\r
+                                // Stash a match into aResults[].\r\r
+                                aResults.unshift(aRecord);\r\r
+                            }\r\r
+                        }\r\r
+                        \r\r
+                        // Add the subset match result set object as the newest element to cache,\r\r
+                        // and stop looping through the cache.\r\r
+                        resultObj = {};\r\r
+                        resultObj.query = sQuery;\r\r
+                        resultObj.results = aResults;\r\r
+                        this._addCacheElem(resultObj);\r\r
+                        break;\r\r
+                    }\r\r
+                }\r\r
+                if(bMatchFound) {\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        \r\r
+        // If there was a match, send along the results.\r\r
+        if(bMatchFound) {\r\r
+            this.getCachedResultsEvent.fire(this, oParent, sOrigQuery, aResults);\r\r
+            oCallbackFn(sOrigQuery, aResults, oParent);\r\r
+        }\r\r
+    }\r\r
+    return aResults;\r\r
+};\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using XML HTTP requests that return\r\r
+ * query results.\r\r
+ * requires YAHOO.util.Connect XMLHTTPRequest library\r\r
+ * extends YAHOO.widget.DataSource\r\r
+ *  \r\r
+ * @constructor\r\r
+ * @param {string} sScriptURI Absolute or relative URI to script that returns \r\r
+ *                            query results as JSON, XML, or delimited flat data\r\r
+ * @param {array} aSchema Data schema definition of results\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+    \r\r
+    // Initialization sequence\r\r
+    if(!aSchema || (aSchema.constructor != Array)) {\r\r
+        YAHOO.log("Could not instantiate XHR DataSource due to invalid arguments", "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.schema = aSchema;\r\r
+    }\r\r
+    this.scriptURI = sScriptURI;\r\r
+    this._init();\r\r
+    YAHOO.log("XHR DataSource initialized","info",this.toString());\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_XHR.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public constants\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * JSON data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_JSON = 0;\r\r
+\r\r
+/**\r\r
+ * XML data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_XML = 1;\r\r
+\r\r
+/**\r\r
+ * Flat file data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_FLAT = 2;\r\r
+\r\r
+/**\r\r
+ * Error message for XHR failure.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.ERROR_DATAXHR = "XHR response failed";\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Number of milliseconds the XHR connection will wait for a server response. A\r\r
+ * a value of zero indicates the XHR connection will wait forever. Any value\r\r
+ * greater than zero will use the Connection utility's Auto-Abort feature.\r\r
+ * Default: 0.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.connTimeout = 0;\r\r
+\r\r
+\r\r
+/**\r\r
+ * Absolute or relative URI to script that returns query results. For instance,\r\r
+ * queries will be sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptURI = null;\r\r
+\r\r
+/**\r\r
+ * Query string parameter name sent to scriptURI. For instance, queries will be\r\r
+ * sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput\r\r
+ * Default: "query".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptQueryParam = "query";\r\r
+\r\r
+/**\r\r
+ * String of key/value pairs to append to requests made to scriptURI. Define\r\r
+ * this string when you want to send additional query parameters to your script.\r\r
+ * When defined, queries will be sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput&<scriptQueryAppend>\r\r
+ * Default: "".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptQueryAppend = "";\r\r
+\r\r
+/**\r\r
+ * XHR response data type. Other types that may be defined are TYPE_XML and\r\r
+ * TYPE_FLAT. Default: TYPE_JSON.\r\r
+ *\r\r
+ * @type type\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.responseType = YAHOO.widget.DS_XHR.prototype.TYPE_JSON;\r\r
+\r\r
+/**\r\r
+ * String after which to strip results. If the results from the XHR are sent\r\r
+ * back as HTML, the gzip HTML comment appears at the end of the data and should\r\r
+ * be ignored.  Default: "\n&lt;!--"\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.responseStripAfter = "\n<!--";\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by scriptURI for results. Results are\r\r
+ * passed back to a callback function.\r\r
+ *  \r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var isXML = (this.responseType == this.TYPE_XML);\r\r
+    var sUri = this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;\r\r
+    if(this.scriptQueryAppend.length > 0) {\r\r
+        sUri += "&" + this.scriptQueryAppend;\r\r
+    }\r\r
+    YAHOO.log("Data source is querying URL " + sUri, "info", this.toString());\r\r
+    var oResponse = null;\r\r
+    \r\r
+    var oSelf = this;\r\r
+    /**\r\r
+     * Sets up ajax request callback\r\r
+     *\r\r
+     * @param {object} oReq          HTTPXMLRequest object\r\r
+     * @private\r\r
+     */\r\r
+    var responseSuccess = function(oResp) {\r\r
+        // Response ID does not match last made request ID.\r\r
+        if(!oSelf._oConn || (oResp.tId != oSelf._oConn.tId)) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATANULL);\r\r
+            YAHOO.log(oSelf.ERROR_DATANULL, "error", this.toString());\r\r
+            return;\r\r
+        }\r\r
+//DEBUG\r\r
+/*YAHOO.log(oResp.responseXML.getElementsByTagName("Result"),'warn');\r\r
+for(var foo in oResp) {\r\r
+    YAHOO.log(foo + ": "+oResp[foo],'warn');\r\r
+}\r\r
+YAHOO.log('responseXML.xml: '+oResp.responseXML.xml,'warn');*/\r\r
+        if(!isXML) {\r\r
+            oResp = oResp.responseText;\r\r
+        }\r\r
+        else { \r\r
+            oResp = oResp.responseXML;\r\r
+        }\r\r
+        if(oResp === null) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATANULL);\r\r
+            YAHOO.log(oSelf.ERROR_DATANULL, "error", oSelf.toString());\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        var aResults = oSelf.parseResponse(sQuery, oResp, oParent);\r\r
+        var resultObj = {};\r\r
+        resultObj.query = decodeURIComponent(sQuery);\r\r
+        resultObj.results = aResults;\r\r
+        if(aResults === null) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATAPARSE);\r\r
+            YAHOO.log(oSelf.ERROR_DATAPARSE, "error", oSelf.toString());\r\r
+            return;\r\r
+        }\r\r
+        else {\r\r
+            oSelf.getResultsEvent.fire(oSelf, oParent, sQuery, aResults);\r\r
+            oSelf._addCacheElem(resultObj);\r\r
+            oCallbackFn(sQuery, aResults, oParent);\r\r
+        }\r\r
+    };\r\r
+\r\r
+    var responseFailure = function(oResp) {\r\r
+        oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATAXHR);\r\r
+        YAHOO.log(oSelf.ERROR_DATAXHR + ": " + oResp.statusText, "error", oSelf.toString());\r\r
+        return;\r\r
+    };\r\r
+    \r\r
+    var oCallback = {\r\r
+        success:responseSuccess,\r\r
+        failure:responseFailure\r\r
+    };\r\r
+    \r\r
+    if(!isNaN(this.connTimeout) && this.connTimeout > 0) {\r\r
+        oCallback.timeout = this.connTimeout;\r\r
+    }\r\r
+    \r\r
+    if(this._oConn) {\r\r
+        YAHOO.util.Connect.abort(this._oConn);\r\r
+    }\r\r
+    \r\r
+    oSelf._oConn = YAHOO.util.Connect.asyncRequest("GET", sUri, oCallback, null);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Parses raw response data into an array of result objects. The result data key\r\r
+ * is always stashed in the [0] element of each result object. \r\r
+ *\r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oResponse The raw response data to parse\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ * @returns {array} Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParent) {\r\r
+    var aSchema = this.schema;\r\r
+    var aResults = [];\r\r
+    var bError = false;\r\r
+\r\r
+    // Strip out comment at the end of results\r\r
+    var nEnd = ((this.responseStripAfter !== "") && (oResponse.indexOf)) ?\r\r
+        oResponse.indexOf(this.responseStripAfter) : -1;\r\r
+    if(nEnd != -1) {\r\r
+        oResponse = oResponse.substring(0,nEnd);\r\r
+    }\r\r
+\r\r
+    switch (this.responseType) {\r\r
+        case this.TYPE_JSON:\r\r
+            var jsonList;\r\r
+            // Divert KHTML clients from JSON lib\r\r
+            if(window.JSON && (navigator.userAgent.toLowerCase().indexOf('khtml')== -1)) {\r\r
+                // Use the JSON utility if available\r\r
+                var jsonObjParsed = JSON.parse(oResponse);\r\r
+                if(!jsonObjParsed) {\r\r
+                    bError = true;\r\r
+                    break;\r\r
+                }\r\r
+                else {\r\r
+                    // eval is necessary here since aSchema[0] is of unknown depth\r\r
+                    jsonList = eval("jsonObjParsed." + aSchema[0]);\r\r
+                }\r\r
+            }\r\r
+            else {\r\r
+                // Parse the JSON response as a string\r\r
+                try {\r\r
+                    // Trim leading spaces\r\r
+                    while (oResponse.substring(0,1) == " ") {\r\r
+                        oResponse = oResponse.substring(1, oResponse.length);\r\r
+                    }\r\r
+\r\r
+                    // Invalid JSON response\r\r
+                    if(oResponse.indexOf("{") < 0) {\r\r
+                        bError = true;\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Empty (but not invalid) JSON response\r\r
+                    if(oResponse.indexOf("{}") === 0) {\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Turn the string into an object literal...\r\r
+                    // ...eval is necessary here\r\r
+                    var jsonObjRaw = eval("(" + oResponse + ")");\r\r
+                    if(!jsonObjRaw) {\r\r
+                        bError = true;\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Grab the object member that contains an array of all reponses...\r\r
+                    // ...eval is necessary here since aSchema[0] is of unknown depth\r\r
+                    jsonList = eval("(jsonObjRaw." + aSchema[0]+")");\r\r
+                }\r\r
+                catch(e) {\r\r
+                    bError = true;\r\r
+                    break;\r\r
+               }\r\r
+            }\r\r
+\r\r
+            if(!jsonList) {\r\r
+                bError = true;\r\r
+                break;\r\r
+            }\r\r
+\r\r
+            // Loop through the array of all responses...\r\r
+            for(var i = jsonList.length-1; i >= 0 ; i--) {\r\r
+                var aResultItem = [];\r\r
+                var jsonResult = jsonList[i];\r\r
+                // ...and loop through each data field value of each response\r\r
+                for(var j = aSchema.length-1; j >= 1 ; j--) {\r\r
+                    // ...and capture data into an array mapped according to the schema...\r\r
+                    var dataFieldValue = jsonResult[aSchema[j]];\r\r
+                    if(!dataFieldValue) {\r\r
+                        dataFieldValue = "";\r\r
+                    }\r\r
+                    //YAHOO.log("data: " + i + " value:" +j+" = "+dataFieldValue,"debug",this.toString());\r\r
+                    aResultItem.unshift(dataFieldValue);\r\r
+                }\r\r
+                // Capture the array of data field values in an array of results\r\r
+                aResults.unshift(aResultItem);\r\r
+            }\r\r
+            break;\r\r
+        case this.TYPE_XML:\r\r
+            // Get the collection of results\r\r
+            var xmlList = oResponse.getElementsByTagName(aSchema[0]);\r\r
+            if(!xmlList) {\r\r
+                bError = true;\r\r
+                break;\r\r
+            }\r\r
+            // Loop through each result\r\r
+            for(var k = xmlList.length-1; k >= 0 ; k--) {\r\r
+                var result = xmlList.item(k);\r\r
+                //YAHOO.log("Result"+k+" is "+result.attributes.item(0).firstChild.nodeValue,"debug",this.toString());\r\r
+                var aFieldSet = [];\r\r
+                // Loop through each data field in each result using the schema\r\r
+                for(var m = aSchema.length-1; m >= 1 ; m--) {\r\r
+                    //YAHOO.log(aSchema[m]+" is "+result.attributes.getNamedItem(aSchema[m]).firstChild.nodeValue);\r\r
+                    var sValue = null;\r\r
+                    // Values may be held in an attribute...\r\r
+                    var xmlAttr = result.attributes.getNamedItem(aSchema[m]);\r\r
+                    if(xmlAttr) {\r\r
+                        sValue = xmlAttr.value;\r\r
+                        //YAHOO.log("Attr value is "+sValue,"debug",this.toString());\r\r
+                    }\r\r
+                    // ...or in a node\r\r
+                    else{\r\r
+                        var xmlNode = result.getElementsByTagName(aSchema[m]);\r\r
+                        if(xmlNode && xmlNode.item(0) && xmlNode.item(0).firstChild) {\r\r
+                            sValue = xmlNode.item(0).firstChild.nodeValue;\r\r
+                            //YAHOO.log("Node value is "+sValue,"debug",this.toString());\r\r
+                        }\r\r
+                        else {\r\r
+                            sValue = "";\r\r
+                            //YAHOO.log("Value not found","debug",this.toString());\r\r
+                        }\r\r
+                    }\r\r
+                    // Capture the schema-mapped data field values into an array\r\r
+                    aFieldSet.unshift(sValue);\r\r
+                }\r\r
+                // Capture each array of values into an array of results\r\r
+                aResults.unshift(aFieldSet);\r\r
+            }\r\r
+            break;\r\r
+        case this.TYPE_FLAT:\r\r
+            if(oResponse.length > 0) {\r\r
+                // Delete the last line delimiter at the end of the data if it exists\r\r
+                var newLength = oResponse.length-aSchema[0].length;\r\r
+                if(oResponse.substr(newLength) == aSchema[0]) {\r\r
+                    oResponse = oResponse.substr(0, newLength);\r\r
+                }\r\r
+                var aRecords = oResponse.split(aSchema[0]);\r\r
+                for(var n = aRecords.length-1; n >= 0; n--) {\r\r
+                    aResults[n] = aRecords[n].split(aSchema[1]);\r\r
+                }\r\r
+            }\r\r
+            break;\r\r
+        default:\r\r
+            break;\r\r
+    }\r\r
+    sQuery = null;\r\r
+    oResponse = null;\r\r
+    oParent = null;\r\r
+    if(bError) {\r\r
+        return null;\r\r
+    }\r\r
+    else {\r\r
+        return aResults;\r\r
+    }\r\r
+};            \r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * XHR connection object.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype._oConn = null;\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using a native Javascript struct as\r\r
+ * its live data source.\r\r
+ *  \r\r
+ * @constructor\r\r
+ * extends YAHOO.widget.DataSource \r\r
+ *  \r\r
+ * @param {string} oFunction In-memory Javascript function that returns query\r\r
+ *                           results as an array of objects\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction = function(oFunction, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialization sequence\r\r
+    if(!oFunction  || (oFunction.constructor != Function)) {\r\r
+        YAHOO.log("Could not instantiate JSFunction DataSource due to invalid arguments", "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.dataFunction = oFunction;\r\r
+        this._init();\r\r
+        YAHOO.log("JS Function DataSource initialized","info",this.toString());\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_JSFunction.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * In-memory Javascript function that returns query results.\r\r
+ *\r\r
+ * @type function\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction.prototype.dataFunction = null;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by function for results. Results are\r\r
+ * passed back to a callback function.\r\r
+ *  \r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var oFunction = this.dataFunction;\r\r
+    var aResults = [];\r\r
+    \r\r
+    aResults = oFunction(sQuery);\r\r
+    if(aResults === null) {\r\r
+        this.dataErrorEvent.fire(this, oParent, sQuery, this.ERROR_DATANULL);\r\r
+        YAHOO.log(oSelf.ERROR_DATANULL, "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    \r\r
+    var resultObj = {};\r\r
+    resultObj.query = decodeURIComponent(sQuery);\r\r
+    resultObj.results = aResults;\r\r
+    this._addCacheElem(resultObj);\r\r
+    \r\r
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);\r\r
+    oCallbackFn(sQuery, aResults, oParent);\r\r
+    return;\r\r
+};\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using a native Javascript array as\r\r
+ * its live data source.\r\r
+ *\r\r
+ * @constructor\r\r
+ * extends YAHOO.widget.DataSource\r\r
+ *\r\r
+ * @param {string} aData In-memory Javascript array of simple string data\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray = function(aData, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialization sequence\r\r
+    if(!aData || (aData.constructor != Array)) {\r\r
+        YAHOO.log("Could not instantiate JSArray DataSource due to invalid arguments", "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.data = aData;\r\r
+        this._init();\r\r
+        YAHOO.log("JS Array DataSource initialized","info",this.toString());\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_JSArray.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * In-memory Javascript array of strings.\r\r
+ *\r\r
+ * @type array\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray.prototype.data = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by data for results. Results are passed\r\r
+ * back to a callback function.\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to\r\r
+ *                             which to return results\r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var aData = this.data;\r\r
+    var aResults = [];\r\r
+    var bMatchFound = false;\r\r
+    var bMatchContains = this.queryMatchContains;\r\r
+    if(!this.queryMatchCase) {\r\r
+        sQuery = sQuery.toLowerCase();\r\r
+    }\r\r
+\r\r
+    // Loop through each element of the array...\r\r
+    for(var i = aData.length-1; i >= 0; i--) {\r\r
+        var aDataset = [];\r\r
+        if(typeof aData[i] == "string") {\r\r
+            aDataset[0] = aData[i];\r\r
+        }\r\r
+        else {\r\r
+            aDataset = aData[i];\r\r
+        }\r\r
+\r\r
+        var sKeyIndex = (this.queryMatchCase) ?\r\r
+            encodeURIComponent(aDataset[0]).indexOf(sQuery):\r\r
+            encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);\r\r
+\r\r
+        // A STARTSWITH match is when the query is found at the beginning of the key string...\r\r
+        if((!bMatchContains && (sKeyIndex === 0)) ||\r\r
+        // A CONTAINS match is when the query is found anywhere within the key string...\r\r
+        (bMatchContains && (sKeyIndex > -1))) {\r\r
+            // Stash a match into aResults[].\r\r
+            aResults.unshift(aDataset);\r\r
+        }\r\r
+    }\r\r
+\r\r
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);\r\r
+    oCallbackFn(sQuery, aResults, oParent);\r\r
+};\r\r
diff --git a/lib/yui/autocomplete/autocomplete-min.js b/lib/yui/autocomplete/autocomplete-min.js
new file mode 100755 (executable)
index 0000000..2ded0d9
--- /dev/null
@@ -0,0 +1,181 @@
+/*\r\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r\r
+Code licensed under the BSD License:\r\r
+http://developer.yahoo.com/yui/license.txt\r\r
+version: 0.11.0\r\r
+*/\r\r
+\r\r
+\r\r
+YAHOO.widget.AutoComplete=function(inputEl,containerEl,oDataSource,oConfigs){if(inputEl&&containerEl&&oDataSource){if(oDataSource&&(oDataSource instanceof YAHOO.widget.DataSource)){this.dataSource=oDataSource;}\r\r
+else{return;}\r\r
+if(YAHOO.util.Dom.inDocument(inputEl)){if(typeof inputEl=="string"){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+inputEl;this._oTextbox=document.getElementById(inputEl);}\r\r
+else{this._sName=(inputEl.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+inputEl.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=inputEl;}}\r\r
+else{return;}\r\r
+if(YAHOO.util.Dom.inDocument(containerEl)){if(typeof containerEl=="string"){this._oContainer=document.getElementById(containerEl);}\r\r
+else{this._oContainer=containerEl;}\r\r
+if(this._oContainer.style.display=="none"){}}\r\r
+else{return;}\r\r
+if(typeof oConfigs=="object"){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}\r\r
+this._initContainer();this._initProps();this._initList();this._initContainerHelpers();var oSelf=this;var oTextbox=this._oTextbox;var oContent=this._oContainer._oContent;YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);YAHOO.util.Event.addListener(oTextbox,"focus",oSelf._onTextboxFocus,oSelf);YAHOO.util.Event.addListener(oTextbox,"blur",oSelf._onTextboxBlur,oSelf);YAHOO.util.Event.addListener(oContent,"mouseover",oSelf._onContainerMouseover,oSelf);YAHOO.util.Event.addListener(oContent,"mouseout",oSelf._onContainerMouseout,oSelf);YAHOO.util.Event.addListener(oContent,"scroll",oSelf._onContainerScroll,oSelf);YAHOO.util.Event.addListener(oContent,"resize",oSelf._onContainerResize,oSelf);if(oTextbox.form){YAHOO.util.Event.addListener(oTextbox.form,"submit",oSelf._onFormSubmit,oSelf);}\r\r
+this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);oTextbox.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}\r\r
+else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.5;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.iFrameSrc="about:blank";YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.getName=function(){return this._sName;};YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.getListItems=function(){return this._aListItems;};YAHOO.widget.AutoComplete.prototype.getListItemData=function(oListItem){if(oListItem._oResultData){return oListItem._oResultData;}\r\r
+else{return false;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(sHeader){if(sHeader){if(this._oContainer._oContent._oHeader){this._oContainer._oContent._oHeader.innerHTML=sHeader;this._oContainer._oContent._oHeader.style.display="block";}}\r\r
+else{this._oContainer._oContent._oHeader.innerHTML="";this._oContainer._oContent._oHeader.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setFooter=function(sFooter){if(sFooter){if(this._oContainer._oContent._oFooter){this._oContainer._oContent._oFooter.innerHTML=sFooter;this._oContainer._oContent._oFooter.style.display="block";}}\r\r
+else{this._oContainer._oContent._oFooter.innerHTML="";this._oContainer._oContent._oFooter.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setBody=function(sBody){if(sBody){if(this._oContainer._oContent._oBody){this._oContainer._oContent._oBody.innerHTML=sBody;this._oContainer._oContent._oBody.style.display="block";this._oContainer._oContent.style.display="block";}}\r\r
+else{this._oContainer._oContent._oBody.innerHTML="";this._oContainer._oContent.style.display="none";}\r\r
+this._maxResultsDisplayed=0;};YAHOO.widget.AutoComplete.prototype.formatResult=function(oResultItem,sQuery){var sResult=oResultItem[0];if(sResult){return sResult;}\r\r
+else{return"";}};YAHOO.widget.AutoComplete.prototype.sendQuery=function(sQuery){if(sQuery){this._sendQuery(sQuery);}\r\r
+else{return;}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._oTextbox=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._oContainer=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._aListItems=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._initProps=function(){var minQueryLength=this.minQueryLength;if(isNaN(minQueryLength)||(minQueryLength<1)){minQueryLength=1;}\r\r
+var maxResultsDisplayed=this.maxResultsDisplayed;if(isNaN(this.maxResultsDisplayed)||(this.maxResultsDisplayed<1)){this.maxResultsDisplayed=10;}\r\r
+var queryDelay=this.queryDelay;if(isNaN(this.queryDelay)||(this.queryDelay<0)){this.queryDelay=0.5;}\r\r
+var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){if(typeof aDelimChar=="string"){this.delimChar=[aDelimChar];}\r\r
+else if(aDelimChar.constructor!=Array){this.delimChar=null;}}\r\r
+var animSpeed=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(isNaN(animSpeed)||(animSpeed<0)){animSpeed=0.3;}\r\r
+if(!this._oAnim){oAnim=new YAHOO.util.Anim(this._oContainer._oContent,{},this.animSpeed);this._oAnim=oAnim;}\r\r
+else{this._oAnim.duration=animSpeed;}}\r\r
+if(this.forceSelection&&this.delimChar){}\r\r
+if(this.alwaysShowContainer&&(this.useShadow||this.useIFrame)){}\r\r
+if(this.alwaysShowContainer){this._bContainerOpen=true;}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._oContainer._oShadow){var oShadow=document.createElement("div");oShadow.className="yui-ac-shadow";this._oContainer._oShadow=this._oContainer.appendChild(oShadow);}\r\r
+if(this.useIFrame&&!this._oContainer._oIFrame){var oIFrame=document.createElement("iframe");oIFrame.src=this.iFrameSrc;oIFrame.frameBorder=0;oIFrame.scrolling="no";oIFrame.style.position="absolute";oIFrame.style.width="100%";oIFrame.style.height="100%";this._oContainer._oIFrame=this._oContainer.appendChild(oIFrame);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){if(!this._oContainer._oContent){var oContent=document.createElement("div");oContent.className="yui-ac-content";oContent.style.display="none";this._oContainer._oContent=this._oContainer.appendChild(oContent);var oHeader=document.createElement("div");oHeader.className="yui-ac-hd";oHeader.style.display="none";this._oContainer._oContent._oHeader=this._oContainer._oContent.appendChild(oHeader);var oBody=document.createElement("div");oBody.className="yui-ac-bd";this._oContainer._oContent._oBody=this._oContainer._oContent.appendChild(oBody);var oFooter=document.createElement("div");oFooter.className="yui-ac-ft";oFooter.style.display="none";this._oContainer._oContent._oFooter=this._oContainer._oContent.appendChild(oFooter);}\r\r
+else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._oContainer._oContent._oBody.hasChildNodes()){var oldListItems=this.getListItems();if(oldListItems){for(var oldi=oldListItems.length-1;oldi>=0;i--){oldListItems[oldi]=null;}}\r\r
+this._oContainer._oContent._oBody.innerHTML="";}\r\r
+var oList=document.createElement("ul");oList=this._oContainer._oContent._oBody.appendChild(oList);for(var i=0;i<this.maxResultsDisplayed;i++){var oItem=document.createElement("li");oItem=oList.appendChild(oItem);this._aListItems[i]=oItem;this._initListItem(oItem,i);}\r\r
+this._maxResultsDisplayed=this.maxResultsDisplayed;};YAHOO.widget.AutoComplete.prototype._initListItem=function(oItem,nItemIndex){var oSelf=this;oItem.style.display="none";oItem._nItemIndex=nItemIndex;oItem.mouseover=oItem.mouseout=oItem.onclick=null;YAHOO.util.Event.addListener(oItem,"mouseover",oSelf._onItemMouseover,oSelf);YAHOO.util.Event.addListener(oItem,"mouseout",oSelf._onItemMouseout,oSelf);YAHOO.util.Event.addListener(oItem,"click",oSelf._onItemMouseclick,oSelf);};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseover");}\r\r
+else{oSelf._toggleHighlight(this,"to");}\r\r
+oSelf.itemMouseOverEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseout");}\r\r
+else{oSelf._toggleHighlight(this,"from");}\r\r
+oSelf.itemMouseOutEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(v,oSelf){oSelf._toggleHighlight(this,"to");oSelf._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(v,oSelf){oSelf._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(v,oSelf){oSelf._bOverContainer=false;if(oSelf._oCurItem){oSelf._toggleHighlight(oSelf._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(v,oSelf){oSelf._oTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(v,oSelf){oSelf._toggleContainerHelpers(oSelf._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}\r\r
+if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}\r\r
+else{oSelf._clearList();}\r\r
+break;case 13:if(oSelf._nKeyCode!=nKeyCode){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}\r\r
+if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}\r\r
+else{oSelf._clearList();}\r\r
+break;case 27:oSelf._clearList();return;case 39:oSelf._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;case 40:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:case 13:if((oSelf._nKeyCode!=nKeyCode)){YAHOO.util.Event.stopEvent(v);}\r\r
+break;case 38:case 40:YAHOO.util.Event.stopEvent(v);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(v,oSelf){oSelf._initProps();var nKeyCode=v.keyCode;oSelf._nKeyCode=nKeyCode;var sChar=String.fromCharCode(nKeyCode);var sText=this.value;if(oSelf._isIgnoreKey(nKeyCode)||(sText.toLowerCase()==oSelf._sCurQuery)){return;}\r\r
+else{oSelf.textboxKeyEvent.fire(oSelf,nKeyCode);}\r\r
+if(oSelf.queryDelay>0){var nDelayID=setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay*1000));if(oSelf._nDelayID!=-1){clearTimeout(oSelf._nDelayID);}\r\r
+oSelf._nDelayID=nDelayID;}\r\r
+else{oSelf._sendQuery(sText);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(nKeyCode){if((nKeyCode==9)||(nKeyCode==13)||(nKeyCode==16)||(nKeyCode==17)||(nKeyCode>=18&&nKeyCode<=20)||(nKeyCode==27)||(nKeyCode>=33&&nKeyCode<=35)||(nKeyCode>=36&&nKeyCode<=38)||(nKeyCode==40)||(nKeyCode>=44&&nKeyCode<=45)){return true;}\r\r
+return false;};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(v,oSelf){oSelf._oTextbox.setAttribute("autocomplete","off");oSelf._bFocused=true;oSelf.textboxFocusEvent.fire(oSelf);};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(v,oSelf){if(!oSelf._bOverContainer||(oSelf._nKeyCode==9)){if(!oSelf._bItemSelected){if(!oSelf._bContainerOpen||(oSelf._bContainerOpen&&!oSelf._textMatchesOption())){if(oSelf.forceSelection){oSelf._clearSelection();}\r\r
+else{oSelf.unmatchedItemSelectEvent.fire(oSelf,oSelf._sCurQuery);}}}\r\r
+if(oSelf._bContainerOpen){oSelf._clearList();}\r\r
+oSelf._bFocused=false;oSelf.textboxBlurEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onFormSubmit=function(v,oSelf){if(oSelf.allowBrowserAutocomplete){oSelf._oTextbox.setAttribute("autocomplete","on");}\r\r
+else{oSelf._oTextbox.setAttribute("autocomplete","off");}};YAHOO.widget.AutoComplete.prototype._sendQuery=function(sQuery){var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){var nDelimIndex=-1;for(var i=aDelimChar.length-1;i>=0;i--){var nNewIndex=sQuery.lastIndexOf(aDelimChar[i]);if(nNewIndex>nDelimIndex){nDelimIndex=nNewIndex;}}\r\r
+if(aDelimChar[i]==" "){for(var j=aDelimChar.length-1;j>=0;j--){if(sQuery[nDelimIndex-1]==aDelimChar[j]){nDelimIndex--;break;}}}\r\r
+if(nDelimIndex>-1){var nQueryStart=nDelimIndex+1;while(sQuery.charAt(nQueryStart)==" "){nQueryStart+=1;}\r\r
+this._sSavedQuery=sQuery.substring(0,nQueryStart);sQuery=sQuery.substr(nQueryStart);}\r\r
+else if(sQuery.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}\r\r
+if(sQuery.length<this.minQueryLength){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}\r\r
+this._clearList();return;}\r\r
+sQuery=encodeURIComponent(sQuery);this._nDelayID=-1;this.dataRequestEvent.fire(this,sQuery);this.dataSource.getResults(this._populateList,sQuery,this);};YAHOO.widget.AutoComplete.prototype._clearList=function(){this._oContainer._oContent.scrollTop=0;var aItems=this._aListItems;if(aItems&&(aItems.length>0)){for(var i=aItems.length-1;i>=0;i--){aItems[i].style.display="none";}}\r\r
+if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}\r\r
+this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._populateList=function(sQuery,aResults,oSelf){if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,sQuery);}\r\r
+if(!oSelf._bFocused||!aResults){return;}\r\r
+var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var contentStyle=oSelf._oContainer._oContent.style;contentStyle.width=(!isOpera)?null:"";contentStyle.height=(!isOpera)?null:"";var sCurQuery=decodeURIComponent(sQuery);oSelf._sCurQuery=sCurQuery;oSelf._bItemSelected=false;if(oSelf._maxResultsDisplayed!=oSelf.maxResultsDisplayed){oSelf._initList();}\r\r
+var nItems=Math.min(aResults.length,oSelf.maxResultsDisplayed);oSelf._nDisplayedItems=nItems;if(nItems>0){oSelf._initContainerHelpers();var aItems=oSelf._aListItems;for(var i=nItems-1;i>=0;i--){var oItemi=aItems[i];var oResultItemi=aResults[i];oItemi.innerHTML=oSelf.formatResult(oResultItemi,sCurQuery);oItemi.style.display="list-item";oItemi._sResultKey=oResultItemi[0];oItemi._oResultData=oResultItemi;}\r\r
+for(var j=aItems.length-1;j>=nItems;j--){var oItemj=aItems[j];oItemj.innerHTML=null;oItemj.style.display="none";oItemj._sResultKey=null;oItemj._oResultData=null;}\r\r
+if(oSelf.autoHighlight){var oFirstItem=aItems[0];oSelf._toggleHighlight(oFirstItem,"to");oSelf.itemArrowToEvent.fire(oSelf,oFirstItem);oSelf._typeAhead(oFirstItem,sQuery);}\r\r
+else{oSelf._oCurItem=null;}\r\r
+oSelf._toggleContainer(true);}\r\r
+else{oSelf._clearList();}\r\r
+oSelf.dataReturnEvent.fire(oSelf,sQuery,aResults);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var sValue=this._oTextbox.value;var sChar=(this.delimChar)?this.delimChar[0]:null;var nIndex=(sChar)?sValue.lastIndexOf(sChar,sValue.length-2):-1;if(nIndex>-1){this._oTextbox.value=sValue.substring(0,nIndex);}\r\r
+else{this._oTextbox.value="";}\r\r
+this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var foundMatch=false;for(var i=this._nDisplayedItems-1;i>=0;i--){var oItem=this._aListItems[i];var sMatch=oItem._sResultKey.toLowerCase();if(sMatch==this._sCurQuery.toLowerCase()){foundMatch=true;break;}}\r\r
+return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){if(!this.typeAhead){return;}\r\r
+var oTextbox=this._oTextbox;var sValue=this._oTextbox.value;if(!oTextbox.setSelectionRange&&!oTextbox.createTextRange){return;}\r\r
+var nStart=sValue.length;this._updateValue(oItem);var nEnd=oTextbox.value.length;this._selectText(oTextbox,nStart,nEnd);var sPrefill=oTextbox.value.substr(nStart,nEnd);this.typeAheadEvent.fire(this,sQuery,sPrefill);};YAHOO.widget.AutoComplete.prototype._selectText=function(oTextbox,nStart,nEnd){if(oTextbox.setSelectionRange){oTextbox.setSelectionRange(nStart,nEnd);}\r\r
+else if(oTextbox.createTextRange){var oTextRange=oTextbox.createTextRange();oTextRange.moveStart("character",nStart);oTextRange.moveEnd("character",nEnd-oTextbox.value.length);oTextRange.select();}\r\r
+else{oTextbox.select();}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(bShow){var bFireEvent=false;var width=this._oContainer._oContent.offsetWidth+"px";var height=this._oContainer._oContent.offsetHeight+"px";if(this.useIFrame&&this._oContainer._oIFrame){bFireEvent=true;if(this.alwaysShowContainer||bShow){this._oContainer._oIFrame.style.width=width;this._oContainer._oIFrame.style.height=height;}\r\r
+else{this._oContainer._oIFrame.style.width=0;this._oContainer._oIFrame.style.height=0;}}\r\r
+if(this.useShadow&&this._oContainer._oShadow){bFireEvent=true;if(this.alwaysShowContainer||bShow){this._oContainer._oShadow.style.width=width;this._oContainer._oShadow.style.height=height;}\r\r
+else{this._oContainer._oShadow.style.width=0;this._oContainer._oShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(bShow){if(this.alwaysShowContainer){if(bShow){this.containerExpandEvent.fire(this);}\r\r
+else{this.containerCollapseEvent.fire(this);}\r\r
+this._bContainerOpen=bShow;return;}\r\r
+var oContainer=this._oContainer;if(!bShow&&!this._bContainerOpen){oContainer._oContent.style.display="none";return;}\r\r
+var oAnim=this._oAnim;if(oAnim&&oAnim.getEl()&&(this.animHoriz||this.animVert)){if(!bShow){this._toggleContainerHelpers(bShow);}\r\r
+if(oAnim.isAnimated()){oAnim.stop();}\r\r
+var oClone=oContainer._oContent.cloneNode(true);oContainer.appendChild(oClone);oClone.style.top="-9000px";oClone.style.display="block";var wExp=oClone.offsetWidth;var hExp=oClone.offsetHeight;var wColl=(this.animHoriz)?0:wExp;var hColl=(this.animVert)?0:hExp;oAnim.attributes=(bShow)?{width:{to:wExp},height:{to:hExp}}:{width:{to:wColl},height:{to:hColl}};if(bShow&&!this._bContainerOpen){oContainer._oContent.style.width=wColl+"px";oContainer._oContent.style.height=hColl+"px";}\r\r
+else{oContainer._oContent.style.width=wExp+"px";oContainer._oContent.style.height=hExp+"px";}\r\r
+oContainer.removeChild(oClone);oClone=null;var oSelf=this;var onAnimComplete=function(){oAnim.onComplete.unsubscribeAll();if(bShow){oSelf.containerExpandEvent.fire(oSelf);}\r\r
+else{oContainer._oContent.style.display="none";oSelf.containerCollapseEvent.fire(oSelf);}\r\r
+oSelf._toggleContainerHelpers(bShow);};oContainer._oContent.style.display="block";oAnim.onComplete.subscribe(onAnimComplete);oAnim.animate();this._bContainerOpen=bShow;}\r\r
+else{if(bShow){oContainer._oContent.style.display="block";this.containerExpandEvent.fire(this);}\r\r
+else{oContainer._oContent.style.display="none";this.containerCollapseEvent.fire(this);}\r\r
+this._toggleContainerHelpers(bShow);this._bContainerOpen=bShow;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(oNewItem,sType){var sHighlight=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,sHighlight);}\r\r
+if((sType=="to")&&sHighlight){YAHOO.util.Dom.addClass(oNewItem,sHighlight);this._oCurItem=oNewItem;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(oNewItem,sType){if(oNewItem==this._oCurItem){return;}\r\r
+var sPrehighlight=this.prehighlightClassName;if((sType=="mouseover")&&sPrehighlight){YAHOO.util.Dom.addClass(oNewItem,sPrehighlight);}\r\r
+else{YAHOO.util.Dom.removeClass(oNewItem,sPrehighlight);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(oItem){var oTextbox=this._oTextbox;var sDelimChar=(this.delimChar)?this.delimChar[0]:null;var sSavedQuery=this._sSavedQuery;var sResultKey=oItem._sResultKey;oTextbox.focus();oTextbox.value="";if(sDelimChar){if(sSavedQuery){oTextbox.value=sSavedQuery;}\r\r
+oTextbox.value+=sResultKey+sDelimChar;if(sDelimChar!=" "){oTextbox.value+=" ";}}\r\r
+else{oTextbox.value=sResultKey;}\r\r
+if(oTextbox.type=="textarea"){oTextbox.scrollTop=oTextbox.scrollHeight;}\r\r
+var end=oTextbox.value.length;this._selectText(oTextbox,end,end);this._oCurItem=oItem;};YAHOO.widget.AutoComplete.prototype._selectItem=function(oItem){this._bItemSelected=true;this._updateValue(oItem);this.itemSelectEvent.fire(this,oItem,oItem._oResultData);this._clearList();};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(!this.typeAhead){return;}\r\r
+else{this._clearList();}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(nKeyCode){if(this._bContainerOpen){var oCurItem=this._oCurItem;var nCurItemIndex=-1;if(oCurItem){nCurItemIndex=oCurItem._nItemIndex;}\r\r
+var nNewItemIndex=(nKeyCode==40)?(nCurItemIndex+1):(nCurItemIndex-1);if(nNewItemIndex<-2||nNewItemIndex>=this._nDisplayedItems){return;}\r\r
+if(oCurItem){this._toggleHighlight(oCurItem,"from");this.itemArrowFromEvent.fire(this,oCurItem);}\r\r
+if(nNewItemIndex==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._oTextbox.value=this._sSavedQuery;}\r\r
+else{this._oTextbox.value=this._sSavedQuery+this._sCurQuery;}}\r\r
+else{this._oTextbox.value=this._sCurQuery;}\r\r
+this._oCurItem=null;return;}\r\r
+if(nNewItemIndex==-2){this._clearList();return;}\r\r
+var oNewItem=this._aListItems[nNewItemIndex];if((YAHOO.util.Dom.getStyle(this._oContainer._oContent,"overflow")=="auto")&&(nNewItemIndex>-1)&&(nNewItemIndex<this._nDisplayedItems)){if(nKeyCode==40){if((oNewItem.offsetTop+oNewItem.offsetHeight)>(this._oContainer._oContent.scrollTop+this._oContainer._oContent.offsetHeight)){this._oContainer._oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-this._oContainer._oContent.offsetHeight;}\r\r
+else if((oNewItem.offsetTop+oNewItem.offsetHeight)<this._oContainer._oContent.scrollTop){this._oContainer._oContent.scrollTop=oNewItem.offsetTop;}}\r\r
+else{if(oNewItem.offsetTop<this._oContainer._oContent.scrollTop){this._oContainer._oContent.scrollTop=oNewItem.offsetTop;}\r\r
+else if(oNewItem.offsetTop>(this._oContainer._oContent.scrollTop+this._oContainer._oContent.offsetHeight)){this._oContainer._oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-this._oContainer._oContent.offsetHeight;}}}\r\r
+this._toggleHighlight(oNewItem,"to");this.itemArrowToEvent.fire(this,oNewItem);if(this.typeAhead){this._updateValue(oNewItem);}}};YAHOO.widget.DataSource=function(){};YAHOO.widget.DataSource.prototype.ERROR_DATANULL="Response data was null";YAHOO.widget.DataSource.prototype.ERROR_DATAPARSE="Response data could not be parsed";YAHOO.widget.DataSource.prototype.maxCacheEntries=15;YAHOO.widget.DataSource.prototype.queryMatchContains=false;YAHOO.widget.DataSource.prototype.queryMatchSubset=false;YAHOO.widget.DataSource.prototype.queryMatchCase=false;YAHOO.widget.DataSource.prototype.getName=function(){return this._sName;};YAHOO.widget.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.widget.DataSource.prototype.getResults=function(oCallbackFn,sQuery,oParent){var aResults=this._doQueryCache(oCallbackFn,sQuery,oParent);if(aResults.length===0){this.queryEvent.fire(this,oParent,sQuery);this.doQuery(oCallbackFn,sQuery,oParent);}};YAHOO.widget.DataSource.prototype.doQuery=function(oCallbackFn,sQuery,oParent){};YAHOO.widget.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];}\r\r
+if(this._aCacheHelper){this._aCacheHelper=[];}\r\r
+this.cacheFlushEvent.fire(this);};YAHOO.widget.DataSource.prototype.queryEvent=null;YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;YAHOO.widget.DataSource.prototype.getResultsEvent=null;YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;YAHOO.widget.DataSource.prototype.dataErrorEvent=null;YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;YAHOO.widget.DataSource._nIndex=0;YAHOO.widget.DataSource.prototype._sName=null;YAHOO.widget.DataSource.prototype._aCache=null;YAHOO.widget.DataSource.prototype._init=function(){var maxCacheEntries=this.maxCacheEntries;if(isNaN(maxCacheEntries)||(maxCacheEntries<0)){maxCacheEntries=0;}\r\r
+if(maxCacheEntries>0&&!this._aCache){this._aCache=[];}\r\r
+this._sName="instance"+YAHOO.widget.DataSource._nIndex;YAHOO.widget.DataSource._nIndex++;this.queryEvent=new YAHOO.util.CustomEvent("query",this);this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);};YAHOO.widget.DataSource.prototype._addCacheElem=function(resultObj){var aCache=this._aCache;if(!aCache||!resultObj||!resultObj.query||!resultObj.results){return;}\r\r
+if(aCache.length>=this.maxCacheEntries){aCache.shift();}\r\r
+aCache.push(resultObj);};YAHOO.widget.DataSource.prototype._doQueryCache=function(oCallbackFn,sQuery,oParent){var aResults=[];var bMatchFound=false;var aCache=this._aCache;var nCacheLength=(aCache)?aCache.length:0;var bMatchContains=this.queryMatchContains;if((this.maxCacheEntries>0)&&aCache&&(nCacheLength>0)){this.cacheQueryEvent.fire(this,oParent,sQuery);if(!this.queryMatchCase){var sOrigQuery=sQuery;sQuery=sQuery.toLowerCase();}\r\r
+for(var i=nCacheLength-1;i>=0;i--){var resultObj=aCache[i];var aAllResultItems=resultObj.results;var matchKey=(!this.queryMatchCase)?encodeURIComponent(resultObj.query.toLowerCase()):encodeURIComponent(resultObj.query);if(matchKey==sQuery){bMatchFound=true;aResults=aAllResultItems;if(i!=nCacheLength-1){aCache.splice(i,1);this._addCacheElem(resultObj);}\r\r
+break;}\r\r
+else if(this.queryMatchSubset){for(var j=sQuery.length-1;j>=0;j--){var subQuery=sQuery.substr(0,j);if(matchKey==subQuery){bMatchFound=true;for(var k=aAllResultItems.length-1;k>=0;k--){var aRecord=aAllResultItems[k];var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aRecord[0]).indexOf(sQuery):encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aRecord);}}\r\r
+resultObj={};resultObj.query=sQuery;resultObj.results=aResults;this._addCacheElem(resultObj);break;}}\r\r
+if(bMatchFound){break;}}}\r\r
+if(bMatchFound){this.getCachedResultsEvent.fire(this,oParent,sOrigQuery,aResults);oCallbackFn(sOrigQuery,aResults,oParent);}}\r\r
+return aResults;};YAHOO.widget.DS_XHR=function(sScriptURI,aSchema,oConfigs){if(typeof oConfigs=="object"){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}\r\r
+if(!aSchema||(aSchema.constructor!=Array)){return;}\r\r
+else{this.schema=aSchema;}\r\r
+this.scriptURI=sScriptURI;this._init();};YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_XHR.prototype.TYPE_JSON=0;YAHOO.widget.DS_XHR.prototype.TYPE_XML=1;YAHOO.widget.DS_XHR.prototype.TYPE_FLAT=2;YAHOO.widget.DS_XHR.prototype.ERROR_DATAXHR="XHR response failed";YAHOO.widget.DS_XHR.prototype.connTimeout=0;YAHOO.widget.DS_XHR.prototype.scriptURI=null;YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.prototype.TYPE_JSON;YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n<!--";YAHOO.widget.DS_XHR.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var isXML=(this.responseType==this.TYPE_XML);var sUri=this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;if(this.scriptQueryAppend.length>0){sUri+="&"+this.scriptQueryAppend;}\r\r
+var oResponse=null;var oSelf=this;var responseSuccess=function(oResp){if(!oSelf._oConn||(oResp.tId!=oSelf._oConn.tId)){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,oSelf.ERROR_DATANULL);return;}\r\r
+for(var foo in oResp){}\r\r
+if(!isXML){oResp=oResp.responseText;}\r\r
+else{oResp=oResp.responseXML;}\r\r
+if(oResp===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,oSelf.ERROR_DATANULL);return;}\r\r
+var aResults=oSelf.parseResponse(sQuery,oResp,oParent);var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,oSelf.ERROR_DATAPARSE);return;}\r\r
+else{oSelf.getResultsEvent.fire(oSelf,oParent,sQuery,aResults);oSelf._addCacheElem(resultObj);oCallbackFn(sQuery,aResults,oParent);}};var responseFailure=function(oResp){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,oSelf.ERROR_DATAXHR);return;};var oCallback={success:responseSuccess,failure:responseFailure};if(!isNaN(this.connTimeout)&&this.connTimeout>0){oCallback.timeout=this.connTimeout;}\r\r
+if(this._oConn){YAHOO.util.Connect.abort(this._oConn);}\r\r
+oSelf._oConn=YAHOO.util.Connect.asyncRequest("GET",sUri,oCallback,null);};YAHOO.widget.DS_XHR.prototype.parseResponse=function(sQuery,oResponse,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var nEnd=((this.responseStripAfter!=="")&&(oResponse.indexOf))?oResponse.indexOf(this.responseStripAfter):-1;if(nEnd!=-1){oResponse=oResponse.substring(0,nEnd);}\r\r
+switch(this.responseType){case this.TYPE_JSON:var jsonList;if(window.JSON&&(navigator.userAgent.toLowerCase().indexOf('khtml')==-1)){var jsonObjParsed=JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}\r\r
+else{jsonList=eval("jsonObjParsed."+aSchema[0]);}}\r\r
+else{try{while(oResponse.substring(0,1)==" "){oResponse=oResponse.substring(1,oResponse.length);}\r\r
+if(oResponse.indexOf("{")<0){bError=true;break;}\r\r
+if(oResponse.indexOf("{}")===0){break;}\r\r
+var jsonObjRaw=eval("("+oResponse+")");if(!jsonObjRaw){bError=true;break;}\r\r
+jsonList=eval("(jsonObjRaw."+aSchema[0]+")");}\r\r
+catch(e){bError=true;break;}}\r\r
+if(!jsonList){bError=true;break;}\r\r
+for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}\r\r
+aResultItem.unshift(dataFieldValue);}\r\r
+aResults.unshift(aResultItem);}\r\r
+break;case this.TYPE_XML:var xmlList=oResponse.getElementsByTagName(aSchema[0]);if(!xmlList){bError=true;break;}\r\r
+for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k);var aFieldSet=[];for(var m=aSchema.length-1;m>=1;m--){var sValue=null;var xmlAttr=result.attributes.getNamedItem(aSchema[m]);if(xmlAttr){sValue=xmlAttr.value;}\r\r
+else{var xmlNode=result.getElementsByTagName(aSchema[m]);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){sValue=xmlNode.item(0).firstChild.nodeValue;}\r\r
+else{sValue="";}}\r\r
+aFieldSet.unshift(sValue);}\r\r
+aResults.unshift(aFieldSet);}\r\r
+break;case this.TYPE_FLAT:if(oResponse.length>0){var newLength=oResponse.length-aSchema[0].length;if(oResponse.substr(newLength)==aSchema[0]){oResponse=oResponse.substr(0,newLength);}\r\r
+var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){aResults[n]=aRecords[n].split(aSchema[1]);}}\r\r
+break;default:break;}\r\r
+sQuery=null;oResponse=null;oParent=null;if(bError){return null;}\r\r
+else{return aResults;}};YAHOO.widget.DS_XHR.prototype._oConn=null;YAHOO.widget.DS_JSFunction=function(oFunction,oConfigs){if(typeof oConfigs=="object"){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}\r\r
+if(!oFunction||(oFunction.constructor!=Function)){return;}\r\r
+else{this.dataFunction=oFunction;this._init();}};YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;YAHOO.widget.DS_JSFunction.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var oFunction=this.dataFunction;var aResults=[];aResults=oFunction(sQuery);if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,this.ERROR_DATANULL);return;}\r\r
+var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);return;};YAHOO.widget.DS_JSArray=function(aData,oConfigs){if(typeof oConfigs=="object"){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}\r\r
+if(!aData||(aData.constructor!=Array)){return;}\r\r
+else{this.data=aData;this._init();}};YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSArray.prototype.data=null;YAHOO.widget.DS_JSArray.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var aData=this.data;var aResults=[];var bMatchFound=false;var bMatchContains=this.queryMatchContains;if(!this.queryMatchCase){sQuery=sQuery.toLowerCase();}\r\r
+for(var i=aData.length-1;i>=0;i--){var aDataset=[];if(typeof aData[i]=="string"){aDataset[0]=aData[i];}\r\r
+else{aDataset=aData[i];}\r\r
+var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aDataset[0]).indexOf(sQuery):encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aDataset);}}\r\r
+this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);};\r\r
diff --git a/lib/yui/autocomplete/autocomplete.js b/lib/yui/autocomplete/autocomplete.js
new file mode 100755 (executable)
index 0000000..98f48f2
--- /dev/null
@@ -0,0 +1,2752 @@
+/*\r\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r\r
+Code licensed under the BSD License:\r\r
+http://developer.yahoo.com/yui/license.txt\r\r
+version: 0.11.0\r\r
+*/\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing the customizable functionality of a plug-and-play DHTML\r\r
+ * auto complete widget.  Some key features:\r\r
+ * <ul>\r\r
+ * <li>Navigate with up/down arrow keys and/or mouse to pick a selection</li>\r\r
+ * <li>The drop down container can "roll down" or "fly out" via configurable\r\r
+ * animation</li>\r\r
+ * <li>UI look-and-feel customizable through CSS, including container\r\r
+ * attributes, borders, position, fonts, etc</li>\r\r
+ * </ul>\r\r
+ *\r\r
+ * requires YAHOO.util.Dom Dom utility\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ * requires YAHOO.widget.DataSource Data source class\r\r
+ * see YAHOO.util.Animation Animation utility\r\r
+ * see JSON JSON library\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {element | string} inputEl DOM element reference or string ID of the auto complete input field\r\r
+ * @param {element | string} containerEl DOM element reference or string ID of the auto complete &lt;div&gt;\r\r
+ *                              container\r\r
+ * @param {object} oDataSource Instance of YAHOO.widget.DataSource for query/results\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.AutoComplete = function(inputEl,containerEl,oDataSource,oConfigs) {\r\r
+    if(inputEl && containerEl && oDataSource) {\r\r
+        // Validate data source\r\r
+        if (oDataSource && (oDataSource instanceof YAHOO.widget.DataSource)) {\r\r
+            this.dataSource = oDataSource;\r\r
+        }\r\r
+        else {\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Validate input element\r\r
+        if(YAHOO.util.Dom.inDocument(inputEl)) {\r\r
+            if(typeof inputEl == "string") {\r\r
+                    this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + inputEl;\r\r
+                    this._oTextbox = document.getElementById(inputEl);\r\r
+            }\r\r
+            else {\r\r
+                this._sName = (inputEl.id) ?\r\r
+                    "instance" + YAHOO.widget.AutoComplete._nIndex + " " + inputEl.id:\r\r
+                    "instance" + YAHOO.widget.AutoComplete._nIndex;\r\r
+                this._oTextbox = inputEl;\r\r
+            }\r\r
+        }\r\r
+        else {\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Validate container element\r\r
+        if(YAHOO.util.Dom.inDocument(containerEl)) {\r\r
+            if(typeof containerEl == "string") {\r\r
+                    this._oContainer = document.getElementById(containerEl);\r\r
+            }\r\r
+            else {\r\r
+                this._oContainer = containerEl;\r\r
+            }\r\r
+            if(this._oContainer.style.display == "none") {\r\r
+            }\r\r
+        }\r\r
+        else {\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        // Set any config params passed in to override defaults\r\r
+        if (typeof oConfigs == "object") {\r\r
+            for(var sConfig in oConfigs) {\r\r
+                if (sConfig) {\r\r
+                    this[sConfig] = oConfigs[sConfig];\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        // Initialization sequence\r\r
+        this._initContainer();\r\r
+        this._initProps();\r\r
+        this._initList();\r\r
+        this._initContainerHelpers();\r\r
+\r\r
+        // Set up events\r\r
+        var oSelf = this;\r\r
+        var oTextbox = this._oTextbox;\r\r
+        // Events are actually for the content module within the container\r\r
+        var oContent = this._oContainer._oContent;\r\r
+\r\r
+        // Dom events\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"focus",oSelf._onTextboxFocus,oSelf);\r\r
+        YAHOO.util.Event.addListener(oTextbox,"blur",oSelf._onTextboxBlur,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"mouseover",oSelf._onContainerMouseover,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"mouseout",oSelf._onContainerMouseout,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"scroll",oSelf._onContainerScroll,oSelf);\r\r
+        YAHOO.util.Event.addListener(oContent,"resize",oSelf._onContainerResize,oSelf);\r\r
+        if(oTextbox.form) {\r\r
+            YAHOO.util.Event.addListener(oTextbox.form,"submit",oSelf._onFormSubmit,oSelf);\r\r
+        }\r\r
+\r\r
+        // Custom events\r\r
+        this.textboxFocusEvent = new YAHOO.util.CustomEvent("textboxFocus", this);\r\r
+        this.textboxKeyEvent = new YAHOO.util.CustomEvent("textboxKey", this);\r\r
+        this.dataRequestEvent = new YAHOO.util.CustomEvent("dataRequest", this);\r\r
+        this.dataReturnEvent = new YAHOO.util.CustomEvent("dataReturn", this);\r\r
+        this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this);\r\r
+        this.containerExpandEvent = new YAHOO.util.CustomEvent("containerExpand", this);\r\r
+        this.typeAheadEvent = new YAHOO.util.CustomEvent("typeAhead", this);\r\r
+        this.itemMouseOverEvent = new YAHOO.util.CustomEvent("itemMouseOver", this);\r\r
+        this.itemMouseOutEvent = new YAHOO.util.CustomEvent("itemMouseOut", this);\r\r
+        this.itemArrowToEvent = new YAHOO.util.CustomEvent("itemArrowTo", this);\r\r
+        this.itemArrowFromEvent = new YAHOO.util.CustomEvent("itemArrowFrom", this);\r\r
+        this.itemSelectEvent = new YAHOO.util.CustomEvent("itemSelect", this);\r\r
+        this.unmatchedItemSelectEvent = new YAHOO.util.CustomEvent("unmatchedItemSelect", this);\r\r
+        this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this);\r\r
+        this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this);\r\r
+        this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this);\r\r
+        \r\r
+        // Finish up\r\r
+        oTextbox.setAttribute("autocomplete","off");\r\r
+        YAHOO.widget.AutoComplete._nIndex++;\r\r
+    }\r\r
+    // Required arguments were not found\r\r
+    else {\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * The data source object that encapsulates the data used for auto completion.\r\r
+ * This object should be an inherited object from YAHOO.widget.DataSource.\r\r
+ *\r\r
+ * @type object\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataSource = null;\r\r
+\r\r
+/**\r\r
+ * Number of characters that must be entered before querying for results.\r\r
+ * Default: 1.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.minQueryLength = 1;\r\r
+\r\r
+/**\r\r
+ * Maximum number of results to display in auto complete container. Default: 10.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 10;\r\r
+\r\r
+/**\r\r
+ * Number of seconds to delay before submitting a query request.  If a query\r\r
+ * request is received before a previous one has completed its delay, the\r\r
+ * previous request is cancelled and the new request is set to the delay.\r\r
+ * Default: 0.5.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.queryDelay = 0.5;\r\r
+\r\r
+/**\r\r
+ * Class name of a highlighted item within the auto complete container.\r\r
+ * Default: "yui-ac-highlight".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.highlightClassName = "yui-ac-highlight";\r\r
+\r\r
+/**\r\r
+ * Class name of a pre-highlighted item within the auto complete container.\r\r
+ * Default: null.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.prehighlightClassName = null;\r\r
+\r\r
+/**\r\r
+ * Query delimiter. A single character separator for multiple delimited\r\r
+ * selections. Multiple delimiter characteres may be defined as an array of\r\r
+ * strings. A null value or empty string indicates that query results cannot\r\r
+ * be delimited. This feature is not recommended if you need forceSelection to\r\r
+ * be true. Default: null.\r\r
+ *\r\r
+ * @type string or array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.delimChar = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the first item in the auto complete container should be\r\r
+ * automatically highlighted on expand. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.autoHighlight = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete input field should be automatically updated\r\r
+ * with the first query result as the user types, auto-selecting the substring\r\r
+ * that the user has not typed. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.typeAhead = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to animate the expansion/collapse of the auto complete\r\r
+ * container in the horizontal direction. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animHoriz = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to animate the expansion/collapse of the auto complete\r\r
+ * container in the vertical direction. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animVert = true;\r\r
+\r\r
+/**\r\r
+ * Speed of container expand/collapse animation, in seconds. Default: 0.3.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.animSpeed = 0.3;\r\r
+\r\r
+/**\r\r
+ * Whether or not to force the user's selection to match one of the query\r\r
+ * results. Enabling this feature essentially transforms the auto complete form\r\r
+ * input field into a &lt;select&gt; field. This feature is not recommended\r\r
+ * with delimiter character(s) defined. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.forceSelection = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to allow browsers to cache user-typed input in the input\r\r
+ * field. Disabling this feature will prevent the widget from setting the\r\r
+ * autocomplete="off" on the auto complete input field. When autocomplete="off"\r\r
+ * and users click the back button after form submission, user-typed input can\r\r
+ * be prefilled by the browser from its cache. This caching of user input may\r\r
+ * not be desired for sensitive data, such as credit card numbers, in which\r\r
+ * case, implementers should consider setting allowBrowserAutocomplete to false.\r\r
+ * Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container should always be displayed.\r\r
+ * Enabling this feature prevents the toggling of the container to a collapsed\r\r
+ * state. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.alwaysShowContainer = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not to use an iFrame to layer over Windows form elements in\r\r
+ * IE. Set to true only when the auto complete container will be on top of a\r\r
+ * &lt;select&gt; field in IE and thus exposed to the IE z-index bug (i.e.,\r\r
+ * 5.5 < IE < 7). Default:false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.useIFrame = false;\r\r
+\r\r
+/**\r\r
+ * Configurable iFrame src used when useIFrame = true. Implementations over SSL\r\r
+ * should set this parameter to an appropriate https location in order to avoid\r\r
+ * security-related browser errors. Default:"about:blank".\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.iFrameSrc = "about:blank";\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container should have a shadow. Default:false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.useShadow = false;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the auto complete instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the auto complete instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getName = function() {\r\r
+    return this._sName;\r\r
+};\r\r
+\r\r
+ /**\r\r
+ * Public accessor to the unique name of the auto complete instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the auto complete instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.toString = function() {\r\r
+    return "AutoComplete " + this._sName;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to the internal array of DOM &lt;li&gt; elements that\r\r
+ * display query results within the auto complete container.\r\r
+ *\r\r
+ * @return {array} Array of &lt;li&gt; elements within the auto complete\r\r
+ *                 container\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getListItems = function() {\r\r
+    return this._aListItems;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to the data held in an &lt;li&gt; element of the\r\r
+ * auto complete container.\r\r
+ *\r\r
+ * @return {object or array} Object or array of result data or null\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.getListItemData = function(oListItem) {\r\r
+    if(oListItem._oResultData) {\r\r
+        return oListItem._oResultData;\r\r
+    }\r\r
+    else {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container header. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_hd".\r\r
+ *\r\r
+ * @param {string} sHeader HTML markup for container header\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setHeader = function(sHeader) {\r\r
+    if(sHeader) {\r\r
+        if(this._oContainer._oContent._oHeader) {\r\r
+            this._oContainer._oContent._oHeader.innerHTML = sHeader;\r\r
+            this._oContainer._oContent._oHeader.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oHeader.innerHTML = "";\r\r
+        this._oContainer._oContent._oHeader.style.display = "none";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container footer. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_ft".\r\r
+ *\r\r
+ * @param {string} sFooter HTML markup for container footer\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setFooter = function(sFooter) {\r\r
+    if(sFooter) {\r\r
+        if(this._oContainer._oContent._oFooter) {\r\r
+            this._oContainer._oContent._oFooter.innerHTML = sFooter;\r\r
+            this._oContainer._oContent._oFooter.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oFooter.innerHTML = "";\r\r
+        this._oContainer._oContent._oFooter.style.display = "none";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sets HTML markup for the auto complete container body. This markup will be\r\r
+ * inserted within a &lt;div&gt; tag with a class of "ac_bd".\r\r
+ *\r\r
+ * @param {string} sHeader HTML markup for container body\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.setBody = function(sBody) {\r\r
+    if(sBody) {\r\r
+        if(this._oContainer._oContent._oBody) {\r\r
+            this._oContainer._oContent._oBody.innerHTML = sBody;\r\r
+            this._oContainer._oContent._oBody.style.display = "block";\r\r
+            this._oContainer._oContent.style.display = "block";\r\r
+        }\r\r
+    }\r\r
+    else {\r\r
+        this._oContainer._oContent._oBody.innerHTML = "";\r\r
+        this._oContainer._oContent.style.display = "none";\r\r
+    }\r\r
+    this._maxResultsDisplayed = 0;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Overridable method that converts a result item object into HTML markup\r\r
+ * for display. Return data values are accessible via the oResultItem object,\r\r
+ * and the key return value will always be oResultItem[0]. Markup will be\r\r
+ * displayed within &lt;li&gt; element tags in the container.\r\r
+ *\r\r
+ * @param {object} oResultItem Result item object representing one query result\r\r
+ * @param {string} sQuery The current query string\r\r
+ * @return {string} HTML markup of formatted result data\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultItem, sQuery) {\r\r
+    var sResult = oResultItem[0];\r\r
+    if(sResult) {\r\r
+        return sResult;\r\r
+    }\r\r
+    else {\r\r
+        return "";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Makes query request to the data source.\r\r
+ *\r\r
+ * @param {string} sQuery Query string.\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {\r\r
+    if(sQuery) {\r\r
+        this._sendQuery(sQuery);\r\r
+    }\r\r
+    else {\r\r
+        return;\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when the auto complete text input box receives focus. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     -  args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxFocusEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete text input box receives key input. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The keycode number\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance makes a query to the data source.\r\r
+ * Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataRequestEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance receives query results from the data\r\r
+ * source. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ *     - args[2] Results array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataReturnEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete instance does not receive query results from the\r\r
+ * data source due to an error. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete container is expanded. If alwaysShowContainer is\r\r
+ * enabled, then containerExpandEvent will be fired when the container is\r\r
+ * populated with results. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete textbox has been prefilled by the type-ahead\r\r
+ * feature. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The query string\r\r
+ *     - args[2] The prefill string\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.typeAheadEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been moused over. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt element item moused to\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been moused out. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item moused from\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been arrowed to. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item arrowed to\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemArrowToEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when result item has been arrowed away from. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The &lt;li&gt; element item arrowed from\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an item is selected via mouse click, ENTER key, or TAB key.\r\r
+ * Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The selected &lt;li&gt; element item\r\r
+ *     - args[2] The data returned for the item, either as an object, or mapped from the schema into an array\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an user selection does not match any of the displayed result items.\r\r
+ * Note that this event may not behave as expected when delimiter characters\r\r
+ * have been defined. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ *     - args[1] The user selection\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired if forceSelection is enabled and the user's input has been cleared\r\r
+ * because it did not match one of the returned query results. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete container is collapsed. If alwaysShowContainer is\r\r
+ * enabled, then containerCollapseEvent will be fired when the container is\r\r
+ * cleared of results. Subscribers receive the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.containerCollapseEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the auto complete text input box loses focus. Subscribers receive\r\r
+ * an array of the following array:<br>\r\r
+ *     - args[0] The auto complete object instance\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype.textboxBlurEvent = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class variable to index multiple auto complete instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete._nIndex = 0;\r\r
+\r\r
+/**\r\r
+ * Name of auto complete instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sName = null;\r\r
+\r\r
+/**\r\r
+ * Text input box DOM element.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oTextbox = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the textbox is currently in focus. If query results come back\r\r
+ * but the user has already moved on, do not proceed with auto complete behavior.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bFocused = true;\r\r
+\r\r
+/**\r\r
+ * Animation instance for container expand/collapse.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oAnim = null;\r\r
+\r\r
+/**\r\r
+ * Container DOM element.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oContainer = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the auto complete container is currently open.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bContainerOpen = false;\r\r
+\r\r
+/**\r\r
+ * Whether or not the mouse is currently over the auto complete\r\r
+ * container. This is necessary in order to prevent clicks on container items\r\r
+ * from being text input box blur events.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bOverContainer = false;\r\r
+\r\r
+/**\r\r
+ * Array of &lt;li&gt; elements references that contain query results within the\r\r
+ * auto complete container.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._aListItems = null;\r\r
+\r\r
+/**\r\r
+ * Number of &lt;li&gt; elements currently displayed in auto complete container.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;\r\r
+\r\r
+/**\r\r
+ * Internal count of &lt;li&gt; elements displayed and hidden in auto complete container.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0;\r\r
+\r\r
+/**\r\r
+ * Current query string\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sCurQuery = null;\r\r
+\r\r
+/**\r\r
+ * Past queries this session (for saving delimited queries).\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sSavedQuery = null;\r\r
+\r\r
+/**\r\r
+ * Pointer to the currently highlighted &lt;li&gt; element in the container.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._oCurItem = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not an item has been selected since the container was populated\r\r
+ * with results. Reset to false by _populateList, and set to true when item is\r\r
+ * selected.\r\r
+ *\r\r
+ * @type boolean\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._bItemSelected = false;\r\r
+\r\r
+/**\r\r
+ * Key code of the last key pressed in textbox.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nKeyCode = null;\r\r
+\r\r
+/**\r\r
+ * Delay timeout ID.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._nDelayID = -1;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Updates and validates latest public config properties.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initProps = function() {\r\r
+    // Correct any invalid values\r\r
+    var minQueryLength = this.minQueryLength;\r\r
+    if(isNaN(minQueryLength) || (minQueryLength < 1)) {\r\r
+        minQueryLength = 1;\r\r
+    }\r\r
+    var maxResultsDisplayed = this.maxResultsDisplayed;\r\r
+    if(isNaN(this.maxResultsDisplayed) || (this.maxResultsDisplayed < 1)) {\r\r
+        this.maxResultsDisplayed = 10;\r\r
+    }\r\r
+    var queryDelay = this.queryDelay;\r\r
+    if(isNaN(this.queryDelay) || (this.queryDelay < 0)) {\r\r
+        this.queryDelay = 0.5;\r\r
+    }\r\r
+    var aDelimChar = (this.delimChar) ? this.delimChar : null;\r\r
+    if(aDelimChar) {\r\r
+        if(typeof aDelimChar == "string") {\r\r
+            this.delimChar = [aDelimChar];\r\r
+        }\r\r
+        else if(aDelimChar.constructor != Array) {\r\r
+            this.delimChar = null;\r\r
+        }\r\r
+    }\r\r
+    var animSpeed = this.animSpeed;\r\r
+    if((this.animHoriz || this.animVert) && YAHOO.util.Anim) {\r\r
+        if(isNaN(animSpeed) || (animSpeed < 0)) {\r\r
+            animSpeed = 0.3;\r\r
+        }\r\r
+        if(!this._oAnim ) {\r\r
+            oAnim = new YAHOO.util.Anim(this._oContainer._oContent, {}, this.animSpeed);\r\r
+            this._oAnim = oAnim;\r\r
+        }\r\r
+        else {\r\r
+            this._oAnim.duration = animSpeed;\r\r
+        }\r\r
+    }\r\r
+    if(this.forceSelection && this.delimChar) {\r\r
+    }\r\r
+    if(this.alwaysShowContainer && (this.useShadow || this.useIFrame)) {\r\r
+    }\r\r
+\r\r
+    if(this.alwaysShowContainer) {\r\r
+        this._bContainerOpen = true;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes the auto complete container helpers if they are enabled and do\r\r
+ * not exist\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initContainerHelpers = function() {\r\r
+    if(this.useShadow && !this._oContainer._oShadow) {\r\r
+        var oShadow = document.createElement("div");\r\r
+        oShadow.className = "yui-ac-shadow";\r\r
+        this._oContainer._oShadow = this._oContainer.appendChild(oShadow);\r\r
+    }\r\r
+    if(this.useIFrame && !this._oContainer._oIFrame) {\r\r
+        var oIFrame = document.createElement("iframe");\r\r
+        oIFrame.src = this.iFrameSrc;\r\r
+        oIFrame.frameBorder = 0;\r\r
+        oIFrame.scrolling = "no";\r\r
+        oIFrame.style.position = "absolute";\r\r
+        oIFrame.style.width = "100%";\r\r
+        oIFrame.style.height = "100%";\r\r
+        this._oContainer._oIFrame = this._oContainer.appendChild(oIFrame);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes the auto complete container once at object creation\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initContainer = function() {\r\r
+    if(!this._oContainer._oContent) {\r\r
+        // The oContent div helps size the iframe and shadow properly\r\r
+        var oContent = document.createElement("div");\r\r
+        oContent.className = "yui-ac-content";\r\r
+        oContent.style.display = "none";\r\r
+        this._oContainer._oContent = this._oContainer.appendChild(oContent);\r\r
+\r\r
+        var oHeader = document.createElement("div");\r\r
+        oHeader.className = "yui-ac-hd";\r\r
+        oHeader.style.display = "none";\r\r
+        this._oContainer._oContent._oHeader = this._oContainer._oContent.appendChild(oHeader);\r\r
+\r\r
+        var oBody = document.createElement("div");\r\r
+        oBody.className = "yui-ac-bd";\r\r
+        this._oContainer._oContent._oBody = this._oContainer._oContent.appendChild(oBody);\r\r
+\r\r
+        var oFooter = document.createElement("div");\r\r
+        oFooter.className = "yui-ac-ft";\r\r
+        oFooter.style.display = "none";\r\r
+        this._oContainer._oContent._oFooter = this._oContainer._oContent.appendChild(oFooter);\r\r
+    }\r\r
+    else {\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Clears out contents of container body and creates up to\r\r
+ * YAHOO.widget.AutoComplete#maxResultsDisplayed &lt;li&gt; elements in an\r\r
+ * &lt;ul&gt; element.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initList = function() {\r\r
+    this._aListItems = [];\r\r
+    while(this._oContainer._oContent._oBody.hasChildNodes()) {\r\r
+        var oldListItems = this.getListItems();\r\r
+        if(oldListItems) {\r\r
+            for(var oldi = oldListItems.length-1; oldi >= 0; i--) {\r\r
+                oldListItems[oldi] = null;\r\r
+            }\r\r
+        }\r\r
+        this._oContainer._oContent._oBody.innerHTML = "";\r\r
+    }\r\r
+\r\r
+    var oList = document.createElement("ul");\r\r
+    oList = this._oContainer._oContent._oBody.appendChild(oList);\r\r
+    for(var i=0; i<this.maxResultsDisplayed; i++) {\r\r
+        var oItem = document.createElement("li");\r\r
+        oItem = oList.appendChild(oItem);\r\r
+        this._aListItems[i] = oItem;\r\r
+        this._initListItem(oItem, i);\r\r
+    }\r\r
+    this._maxResultsDisplayed = this.maxResultsDisplayed;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Initializes each &lt;li&gt; element in the container list.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; DOM element\r\r
+ * @param {number} nItemIndex The index of the element\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._initListItem = function(oItem, nItemIndex) {\r\r
+    var oSelf = this;\r\r
+    oItem.style.display = "none";\r\r
+    oItem._nItemIndex = nItemIndex;\r\r
+\r\r
+    oItem.mouseover = oItem.mouseout = oItem.onclick = null;\r\r
+    YAHOO.util.Event.addListener(oItem,"mouseover",oSelf._onItemMouseover,oSelf);\r\r
+    YAHOO.util.Event.addListener(oItem,"mouseout",oSelf._onItemMouseout,oSelf);\r\r
+    YAHOO.util.Event.addListener(oItem,"click",oSelf._onItemMouseclick,oSelf);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element mouseover events in the container.\r\r
+ *\r\r
+ * @param {event} v The mouseover event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseover = function(v,oSelf) {\r\r
+    if(oSelf.prehighlightClassName) {\r\r
+        oSelf._togglePrehighlight(this,"mouseover");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._toggleHighlight(this,"to");\r\r
+    }\r\r
+\r\r
+    oSelf.itemMouseOverEvent.fire(oSelf, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element mouseout events in the container.\r\r
+ *\r\r
+ * @param {event} v The mouseout event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseout = function(v,oSelf) {\r\r
+    if(oSelf.prehighlightClassName) {\r\r
+        oSelf._togglePrehighlight(this,"mouseout");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._toggleHighlight(this,"from");\r\r
+    }\r\r
+\r\r
+    oSelf.itemMouseOutEvent.fire(oSelf, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles &lt;li&gt; element click events in the container.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onItemMouseclick = function(v,oSelf) {\r\r
+    // In case item has not been moused over\r\r
+    oSelf._toggleHighlight(this,"to");\r\r
+    oSelf._selectItem(this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container mouseover events.\r\r
+ *\r\r
+ * @param {event} v The mouseover event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerMouseover = function(v,oSelf) {\r\r
+    oSelf._bOverContainer = true;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container mouseout events.\r\r
+ *\r\r
+ * @param {event} v The mouseout event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerMouseout = function(v,oSelf) {\r\r
+    oSelf._bOverContainer = false;\r\r
+    // If container is still active\r\r
+    if(oSelf._oCurItem) {\r\r
+        oSelf._toggleHighlight(oSelf._oCurItem,"to");\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container scroll events.\r\r
+ *\r\r
+ * @param {event} v The scroll event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerScroll = function(v,oSelf) {\r\r
+    oSelf._oTextbox.focus();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles container resize events.\r\r
+ *\r\r
+ * @param {event} v The resize event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onContainerResize = function(v,oSelf) {\r\r
+    oSelf._toggleContainerHelpers(oSelf._bContainerOpen);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles textbox keydown events of functional keys, mainly for UI behavior.\r\r
+ *\r\r
+ * @param {event} v The keydown event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown = function(v,oSelf) {\r\r
+    var nKeyCode = v.keyCode;\r\r
+\r\r
+    switch (nKeyCode) {\r\r
+        case 9: // tab\r\r
+            if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {\r\r
+                if(oSelf._bContainerOpen) {\r\r
+                    YAHOO.util.Event.stopEvent(v);\r\r
+                }\r\r
+            }\r\r
+            // select an item or clear out\r\r
+            if(oSelf._oCurItem) {\r\r
+                oSelf._selectItem(oSelf._oCurItem);\r\r
+            }\r\r
+            else {\r\r
+                oSelf._clearList();\r\r
+            }\r\r
+            break;\r\r
+        case 13: // enter\r\r
+            if(oSelf._nKeyCode != nKeyCode) {\r\r
+                if(oSelf._bContainerOpen) {\r\r
+                    YAHOO.util.Event.stopEvent(v);\r\r
+                }\r\r
+            }\r\r
+            if(oSelf._oCurItem) {\r\r
+                oSelf._selectItem(oSelf._oCurItem);\r\r
+            }\r\r
+            else {\r\r
+                oSelf._clearList();\r\r
+            }\r\r
+            break;\r\r
+        case 27: // esc\r\r
+            oSelf._clearList();\r\r
+            return;\r\r
+        case 39: // right\r\r
+            oSelf._jumpSelection();\r\r
+            break;\r\r
+        case 38: // up\r\r
+            YAHOO.util.Event.stopEvent(v);\r\r
+            oSelf._moveSelection(nKeyCode);\r\r
+            break;\r\r
+        case 40: // down\r\r
+            YAHOO.util.Event.stopEvent(v);\r\r
+            oSelf._moveSelection(nKeyCode);\r\r
+            break;\r\r
+        default:\r\r
+            break;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles textbox keypress events, mainly for stopEvent in Safari.\r\r
+ *\r\r
+ * @param {event} v The keyup event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress = function(v,oSelf) {\r\r
+    var nKeyCode = v.keyCode;\r\r
+\r\r
+    switch (nKeyCode) {\r\r
+    case 9: // tab\r\r
+    case 13: // enter\r\r
+        if((oSelf._nKeyCode != nKeyCode)) {\r\r
+                YAHOO.util.Event.stopEvent(v);\r\r
+        }\r\r
+        break;\r\r
+    case 38: // up\r\r
+    case 40: // down\r\r
+        YAHOO.util.Event.stopEvent(v);\r\r
+        break;\r\r
+    default:\r\r
+        break;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles textbox keyup events that trigger queries.\r\r
+ *\r\r
+ * @param {event} v The keyup event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp = function(v,oSelf) {\r\r
+    // Check to see if any of the public properties have been updated\r\r
+    oSelf._initProps();\r\r
+\r\r
+    var nKeyCode = v.keyCode;\r\r
+    oSelf._nKeyCode = nKeyCode;\r\r
+    var sChar = String.fromCharCode(nKeyCode);\r\r
+    var sText = this.value; //string in textbox\r\r
+\r\r
+    // Filter out chars that don't trigger queries\r\r
+    if (oSelf._isIgnoreKey(nKeyCode) || (sText.toLowerCase() == oSelf._sCurQuery)) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        oSelf.textboxKeyEvent.fire(oSelf, nKeyCode);\r\r
+    }\r\r
+\r\r
+    // Set timeout on the request\r\r
+    if (oSelf.queryDelay > 0) {\r\r
+        var nDelayID =\r\r
+            setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay * 1000));\r\r
+\r\r
+        if (oSelf._nDelayID != -1) {\r\r
+            clearTimeout(oSelf._nDelayID);\r\r
+        }\r\r
+\r\r
+        oSelf._nDelayID = nDelayID;\r\r
+    }\r\r
+    else {\r\r
+        // No delay so send request immediately\r\r
+        oSelf._sendQuery(sText);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Whether or not key is functional or should be ignored. Note that the right\r\r
+ * arrow key is NOT an ignored key since it triggers queries for certain intl\r\r
+ * charsets.\r\r
+ *\r\r
+ * @param {number} nKeycode Code of key pressed\r\r
+ * @return {boolean} Whether or not to be ignore key\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._isIgnoreKey = function(nKeyCode) {\r\r
+    if ((nKeyCode == 9) || (nKeyCode == 13)  || // tab, enter\r\r
+            (nKeyCode == 16) || (nKeyCode == 17) || // shift, ctl\r\r
+            (nKeyCode >= 18 && nKeyCode <= 20) || // alt,pause/break,caps lock\r\r
+            (nKeyCode == 27) || // esc\r\r
+            (nKeyCode >= 33 && nKeyCode <= 35) || // page up,page down,end\r\r
+            (nKeyCode >= 36 && nKeyCode <= 38) || // home,left,up\r\r
+            (nKeyCode == 40) || // down\r\r
+            (nKeyCode >= 44 && nKeyCode <= 45)) { // print screen,insert\r\r
+        return true;\r\r
+    }\r\r
+    return false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles text input box receiving focus.\r\r
+ *\r\r
+ * @param {event} v The focus event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxFocus = function (v,oSelf) {\r\r
+    oSelf._oTextbox.setAttribute("autocomplete","off");\r\r
+    oSelf._bFocused = true;\r\r
+    oSelf.textboxFocusEvent.fire(oSelf);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles text input box losing focus.\r\r
+ *\r\r
+ * @param {event} v The focus event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onTextboxBlur = function (v,oSelf) {\r\r
+    // Don't treat as a blur if it was a selection via mouse click\r\r
+    if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) {\r\r
+        // Current query needs to be validated\r\r
+        if(!oSelf._bItemSelected) {\r\r
+            if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && !oSelf._textMatchesOption())) {\r\r
+                if(oSelf.forceSelection) {\r\r
+                    oSelf._clearSelection();\r\r
+                }\r\r
+                else {\r\r
+                    oSelf.unmatchedItemSelectEvent.fire(oSelf, oSelf._sCurQuery);\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        if(oSelf._bContainerOpen) {\r\r
+            oSelf._clearList();\r\r
+        }\r\r
+        oSelf._bFocused = false;\r\r
+        oSelf.textboxBlurEvent.fire(oSelf);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles form submission event.\r\r
+ *\r\r
+ * @param {event} v The submit event\r\r
+ * @param {object} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._onFormSubmit = function(v,oSelf) {\r\r
+    if(oSelf.allowBrowserAutocomplete) {\r\r
+        oSelf._oTextbox.setAttribute("autocomplete","on");\r\r
+    }\r\r
+    else {\r\r
+        oSelf._oTextbox.setAttribute("autocomplete","off");\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Makes query request to the data source.\r\r
+ *\r\r
+ * @param {string} sQuery Query string.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._sendQuery = function(sQuery) {\r\r
+    // Delimiter has been enabled\r\r
+    var aDelimChar = (this.delimChar) ? this.delimChar : null;\r\r
+    if(aDelimChar) {\r\r
+        // Loop through all possible delimiters and find the latest one\r\r
+        // A " " may be a false positive if they are defined as delimiters AND\r\r
+        // are used to separate delimited queries\r\r
+        var nDelimIndex = -1;\r\r
+        for(var i = aDelimChar.length-1; i >= 0; i--) {\r\r
+            var nNewIndex = sQuery.lastIndexOf(aDelimChar[i]);\r\r
+            if(nNewIndex > nDelimIndex) {\r\r
+                nDelimIndex = nNewIndex;\r\r
+            }\r\r
+        }\r\r
+        // If we think the last delimiter is a space (" "), make sure it is NOT\r\r
+        // a false positive by also checking the char directly before it\r\r
+        if(aDelimChar[i] == " ") {\r\r
+            for (var j = aDelimChar.length-1; j >= 0; j--) {\r\r
+                if(sQuery[nDelimIndex - 1] == aDelimChar[j]) {\r\r
+                    nDelimIndex--;\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        // A delimiter has been found so extract the latest query\r\r
+        if (nDelimIndex > -1) {\r\r
+            var nQueryStart = nDelimIndex + 1;\r\r
+            // Trim any white space from the beginning...\r\r
+            while(sQuery.charAt(nQueryStart) == " ") {\r\r
+                nQueryStart += 1;\r\r
+            }\r\r
+            // ...and save the rest of the string for later\r\r
+            this._sSavedQuery = sQuery.substring(0,nQueryStart);\r\r
+            // Here is the query itself\r\r
+            sQuery = sQuery.substr(nQueryStart);\r\r
+        }\r\r
+        else if(sQuery.indexOf(this._sSavedQuery) < 0){\r\r
+            this._sSavedQuery = null;\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Don't search queries that are too short\r\r
+    if (sQuery.length < this.minQueryLength) {\r\r
+        if (this._nDelayID != -1) {\r\r
+            clearTimeout(this._nDelayID);\r\r
+        }\r\r
+        this._clearList();\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    sQuery = encodeURIComponent(sQuery);\r\r
+    this._nDelayID = -1;    // Reset timeout ID because request has been made\r\r
+    this.dataRequestEvent.fire(this, sQuery);\r\r
+    this.dataSource.getResults(this._populateList, sQuery, this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Hides all visuals related to the array of &lt;li&gt; elements in the container.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._clearList = function() {\r\r
+    this._oContainer._oContent.scrollTop = 0;\r\r
+    var aItems = this._aListItems;\r\r
+\r\r
+    if(aItems && (aItems.length > 0)) {\r\r
+        for(var i = aItems.length-1; i >= 0 ; i--) {\r\r
+            aItems[i].style.display = "none";\r\r
+        }\r\r
+    }\r\r
+\r\r
+    if (this._oCurItem) {\r\r
+        this._toggleHighlight(this._oCurItem,"from");\r\r
+    }\r\r
+\r\r
+    this._oCurItem = null;\r\r
+    this._nDisplayedItems = 0;\r\r
+    this._sCurQuery = null;\r\r
+    this._toggleContainer(false);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Populates the array of &lt;li&gt; elements in the container with query\r\r
+ * results. This method is passed to YAHOO.widget.DataSource#getResults as a\r\r
+ * callback function so results from the datasource are returned to the\r\r
+ * auto complete instance.\r\r
+ *\r\r
+ * @param {string} sQuery The query string\r\r
+ * @param {object} aResults An array of query result objects from the data source\r\r
+ * @param {string} oSelf The auto complete instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, aResults, oSelf) {\r\r
+    if(aResults === null) {\r\r
+        oSelf.dataErrorEvent.fire(oSelf, sQuery);\r\r
+    }\r\r
+    if (!oSelf._bFocused || !aResults) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);\r\r
+    var contentStyle = oSelf._oContainer._oContent.style;\r\r
+    contentStyle.width = (!isOpera) ? null : "";\r\r
+    contentStyle.height = (!isOpera) ? null : "";\r\r
+\r\r
+    var sCurQuery = decodeURIComponent(sQuery);\r\r
+    oSelf._sCurQuery = sCurQuery;\r\r
+    oSelf._bItemSelected = false;\r\r
+\r\r
+    if(oSelf._maxResultsDisplayed != oSelf.maxResultsDisplayed) {\r\r
+        oSelf._initList();\r\r
+    }\r\r
+\r\r
+    var nItems = Math.min(aResults.length,oSelf.maxResultsDisplayed);\r\r
+    oSelf._nDisplayedItems = nItems;\r\r
+    if (nItems > 0) {\r\r
+        oSelf._initContainerHelpers();\r\r
+        var aItems = oSelf._aListItems;\r\r
+\r\r
+        // Fill items with data\r\r
+        for(var i = nItems-1; i >= 0; i--) {\r\r
+            var oItemi = aItems[i];\r\r
+            var oResultItemi = aResults[i];\r\r
+            oItemi.innerHTML = oSelf.formatResult(oResultItemi, sCurQuery);\r\r
+            oItemi.style.display = "list-item";\r\r
+            oItemi._sResultKey = oResultItemi[0];\r\r
+            oItemi._oResultData = oResultItemi;\r\r
+\r\r
+        }\r\r
+\r\r
+        // Empty out remaining items if any\r\r
+        for(var j = aItems.length-1; j >= nItems ; j--) {\r\r
+            var oItemj = aItems[j];\r\r
+            oItemj.innerHTML = null;\r\r
+            oItemj.style.display = "none";\r\r
+            oItemj._sResultKey = null;\r\r
+            oItemj._oResultData = null;\r\r
+        }\r\r
+\r\r
+        if(oSelf.autoHighlight) {\r\r
+            // Go to the first item\r\r
+            var oFirstItem = aItems[0];\r\r
+            oSelf._toggleHighlight(oFirstItem,"to");\r\r
+            oSelf.itemArrowToEvent.fire(oSelf, oFirstItem);\r\r
+            oSelf._typeAhead(oFirstItem,sQuery);\r\r
+        }\r\r
+        else {\r\r
+            oSelf._oCurItem = null;\r\r
+        }\r\r
+\r\r
+        // Expand the container\r\r
+        oSelf._toggleContainer(true);\r\r
+    }\r\r
+    else {\r\r
+        oSelf._clearList();\r\r
+    }\r\r
+    oSelf.dataReturnEvent.fire(oSelf, sQuery, aResults);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * When YAHOO.widget.AutoComplete#bForceSelection is true and the user attempts\r\r
+ * leave the text input box without selecting an item from the query results,\r\r
+ * the user selection is cleared.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._clearSelection = function() {\r\r
+    var sValue = this._oTextbox.value;\r\r
+    var sChar = (this.delimChar) ? this.delimChar[0] : null;\r\r
+    var nIndex = (sChar) ? sValue.lastIndexOf(sChar, sValue.length-2) : -1;\r\r
+    if(nIndex > -1) {\r\r
+        this._oTextbox.value = sValue.substring(0,nIndex);\r\r
+    }\r\r
+    else {\r\r
+         this._oTextbox.value = "";\r\r
+    }\r\r
+    this._sSavedQuery = this._oTextbox.value;\r\r
+\r\r
+    // Fire custom event\r\r
+    this.selectionEnforceEvent.fire(this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Whether or not user-typed value in the text input box matches any of the\r\r
+ * query results.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() {\r\r
+    var foundMatch = false;\r\r
+\r\r
+    for(var i = this._nDisplayedItems-1; i >= 0 ; i--) {\r\r
+        var oItem = this._aListItems[i];\r\r
+        var sMatch = oItem._sResultKey.toLowerCase();\r\r
+        if (sMatch == this._sCurQuery.toLowerCase()) {\r\r
+            foundMatch = true;\r\r
+            break;\r\r
+        }\r\r
+    }\r\r
+    return(foundMatch);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates in the text input box with the first query result as the user types,\r\r
+ * selecting the substring that the user has not typed.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; element item whose data populates the input field\r\r
+ * @param {string} sQuery Query string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._typeAhead = function(oItem, sQuery) {\r\r
+    // Don't update if turned off\r\r
+    if (!this.typeAhead) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var oTextbox = this._oTextbox;\r\r
+    var sValue = this._oTextbox.value; // any saved queries plus what user has typed\r\r
+\r\r
+    // Don't update with type-ahead if text selection is not supported\r\r
+    if(!oTextbox.setSelectionRange && !oTextbox.createTextRange) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    // Select the portion of text that the user has not typed\r\r
+    var nStart = sValue.length;\r\r
+    this._updateValue(oItem);\r\r
+    var nEnd = oTextbox.value.length;\r\r
+    this._selectText(oTextbox,nStart,nEnd);\r\r
+    var sPrefill = oTextbox.value.substr(nStart,nEnd);\r\r
+    this.typeAheadEvent.fire(this,sQuery,sPrefill);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Selects text in a text input box.\r\r
+ *\r\r
+ * @param {object} oTextbox Text input box element in which to select text\r\r
+ * @param {number} nStart Starting index of text string to select\r\r
+ * @param {number} nEnd Ending index of text selection\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._selectText = function(oTextbox, nStart, nEnd) {\r\r
+    if (oTextbox.setSelectionRange) { // For Mozilla\r\r
+        oTextbox.setSelectionRange(nStart,nEnd);\r\r
+    }\r\r
+    else if (oTextbox.createTextRange) { // For IE\r\r
+        var oTextRange = oTextbox.createTextRange();\r\r
+        oTextRange.moveStart("character", nStart);\r\r
+        oTextRange.moveEnd("character", nEnd-oTextbox.value.length);\r\r
+        oTextRange.select();\r\r
+    }\r\r
+    else {\r\r
+        oTextbox.select();\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Syncs auto complete container with its helpers.\r\r
+ *\r\r
+ * @param {boolean} bShow True if container is expanded, false if collapsed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers = function(bShow) {\r\r
+    var bFireEvent = false;\r\r
+    var width = this._oContainer._oContent.offsetWidth + "px";\r\r
+    var height = this._oContainer._oContent.offsetHeight + "px";\r\r
+\r\r
+    if(this.useIFrame && this._oContainer._oIFrame) {\r\r
+        bFireEvent = true;\r\r
+        if(this.alwaysShowContainer || bShow) {\r\r
+            this._oContainer._oIFrame.style.width = width;\r\r
+            this._oContainer._oIFrame.style.height = height;\r\r
+        }\r\r
+        else {\r\r
+            this._oContainer._oIFrame.style.width = 0;\r\r
+            this._oContainer._oIFrame.style.height = 0;\r\r
+        }\r\r
+    }\r\r
+    if(this.useShadow && this._oContainer._oShadow) {\r\r
+        bFireEvent = true;\r\r
+        if(this.alwaysShowContainer || bShow) {\r\r
+            this._oContainer._oShadow.style.width = width;\r\r
+            this._oContainer._oShadow.style.height = height;\r\r
+        }\r\r
+        else {\r\r
+           this._oContainer._oShadow.style.width = 0;\r\r
+            this._oContainer._oShadow.style.height = 0;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Animates expansion or collapse of the container.\r\r
+ *\r\r
+ * @param {boolean} bShow True if container should be expanded, false if\r\r
+ *                        container should be collapsed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) {\r\r
+    // Implementer has container always open so don't mess with it\r\r
+    if(this.alwaysShowContainer) {\r\r
+        // Fire these events to give implementers a hook into the container\r\r
+        // being populated and being emptied\r\r
+        if(bShow) {\r\r
+            this.containerExpandEvent.fire(this);\r\r
+        }\r\r
+        else {\r\r
+            this.containerCollapseEvent.fire(this);\r\r
+        }\r\r
+        this._bContainerOpen = bShow;\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var oContainer = this._oContainer;\r\r
+    // Container is already closed\r\r
+    if (!bShow && !this._bContainerOpen) {\r\r
+        oContainer._oContent.style.display = "none";\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    // If animation is enabled...\r\r
+    var oAnim = this._oAnim;\r\r
+    if (oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) {\r\r
+        // If helpers need to be collapsed, do it right away...\r\r
+        // but if helpers need to be expanded, wait until after the container expands\r\r
+        if(!bShow) {\r\r
+            this._toggleContainerHelpers(bShow);\r\r
+        }\r\r
+\r\r
+        if(oAnim.isAnimated()) {\r\r
+            oAnim.stop();\r\r
+        }\r\r
+\r\r
+        // Clone container to grab current size offscreen\r\r
+        var oClone = oContainer._oContent.cloneNode(true);\r\r
+        oContainer.appendChild(oClone);\r\r
+        oClone.style.top = "-9000px";\r\r
+        oClone.style.display = "block";\r\r
+\r\r
+        // Current size of the container is the EXPANDED size\r\r
+        var wExp = oClone.offsetWidth;\r\r
+        var hExp = oClone.offsetHeight;\r\r
+\r\r
+        // Calculate COLLAPSED sizes based on horiz and vert anim\r\r
+        var wColl = (this.animHoriz) ? 0 : wExp;\r\r
+        var hColl = (this.animVert) ? 0 : hExp;\r\r
+\r\r
+        // Set animation sizes\r\r
+        oAnim.attributes = (bShow) ?\r\r
+            {width: { to: wExp }, height: { to: hExp }} :\r\r
+            {width: { to: wColl}, height: { to: hColl }};\r\r
+\r\r
+        // If opening anew, set to a collapsed size...\r\r
+        if(bShow && !this._bContainerOpen) {\r\r
+            oContainer._oContent.style.width = wColl+"px";\r\r
+            oContainer._oContent.style.height = hColl+"px";\r\r
+        }\r\r
+        // Else, set it to its last known size.\r\r
+        else {\r\r
+            oContainer._oContent.style.width = wExp+"px";\r\r
+            oContainer._oContent.style.height = hExp+"px";\r\r
+        }\r\r
+\r\r
+        oContainer.removeChild(oClone);\r\r
+        oClone = null;\r\r
+\r\r
+       var oSelf = this;\r\r
+       var onAnimComplete = function() {\r\r
+            // Finish the collapse\r\r
+               oAnim.onComplete.unsubscribeAll();\r\r
+\r\r
+            if(bShow) {\r\r
+                oSelf.containerExpandEvent.fire(oSelf);\r\r
+            }\r\r
+            else {\r\r
+                oContainer._oContent.style.display = "none";\r\r
+                oSelf.containerCollapseEvent.fire(oSelf);\r\r
+            }\r\r
+            oSelf._toggleContainerHelpers(bShow);\r\r
+       };\r\r
+\r\r
+        // Display container and animate it\r\r
+        oContainer._oContent.style.display = "block";\r\r
+        oAnim.onComplete.subscribe(onAnimComplete);\r\r
+        oAnim.animate();\r\r
+        this._bContainerOpen = bShow;\r\r
+    }\r\r
+    // Else don't animate, just show or hide\r\r
+    else {\r\r
+        if(bShow) {\r\r
+            oContainer._oContent.style.display = "block";\r\r
+            this.containerExpandEvent.fire(this);\r\r
+        }\r\r
+        else {\r\r
+            oContainer._oContent.style.display = "none";\r\r
+            this.containerCollapseEvent.fire(this);\r\r
+        }\r\r
+        this._toggleContainerHelpers(bShow);\r\r
+        this._bContainerOpen = bShow;\r\r
+   }\r\r
+\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Toggles the highlight on or off for an item in the container, and also cleans\r\r
+ * up highlighting of any previous item.\r\r
+ *\r\r
+ * @param {object} oNewItem New The &lt;li&gt; element item to receive highlight\r\r
+ *                              behavior\r\r
+ * @param {string} sType "mouseover" will toggle highlight on, and "mouseout"\r\r
+ *                       will toggle highlight off.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._toggleHighlight = function(oNewItem, sType) {\r\r
+    var sHighlight = this.highlightClassName;\r\r
+    if(this._oCurItem) {\r\r
+        // Remove highlight from old item\r\r
+        YAHOO.util.Dom.removeClass(this._oCurItem, sHighlight);\r\r
+    }\r\r
+\r\r
+    if((sType == "to") && sHighlight) {\r\r
+        // Apply highlight to new item\r\r
+        YAHOO.util.Dom.addClass(oNewItem, sHighlight);\r\r
+        this._oCurItem = oNewItem;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Toggles the pre-highlight on or off for an item in the container.\r\r
+ *\r\r
+ * @param {object} oNewItem New The &lt;li&gt; element item to receive highlight\r\r
+ *                              behavior\r\r
+ * @param {string} sType "mouseover" will toggle highlight on, and "mouseout"\r\r
+ *                       will toggle highlight off.\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._togglePrehighlight = function(oNewItem, sType) {\r\r
+    if(oNewItem == this._oCurItem) {\r\r
+        return;\r\r
+    }\r\r
+\r\r
+    var sPrehighlight = this.prehighlightClassName;\r\r
+    if((sType == "mouseover") && sPrehighlight) {\r\r
+        // Apply prehighlight to new item\r\r
+        YAHOO.util.Dom.addClass(oNewItem, sPrehighlight);\r\r
+    }\r\r
+    else {\r\r
+        // Remove prehighlight from old item\r\r
+        YAHOO.util.Dom.removeClass(oNewItem, sPrehighlight);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates the text input box value with selected query result. If a delimiter\r\r
+ * has been defined, then the value gets appended with the delimiter.\r\r
+ *\r\r
+ * @param {object} oItem The &lt;li&gt; element item with which to update the value\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._updateValue = function(oItem) {\r\r
+    var oTextbox = this._oTextbox;\r\r
+    var sDelimChar = (this.delimChar) ? this.delimChar[0] : null;\r\r
+    var sSavedQuery = this._sSavedQuery;\r\r
+    var sResultKey = oItem._sResultKey;\r\r
+    oTextbox.focus();\r\r
+\r\r
+    // First clear text field\r\r
+    oTextbox.value = "";\r\r
+    // Grab data to put into text field\r\r
+    if(sDelimChar) {\r\r
+        if(sSavedQuery) {\r\r
+            oTextbox.value = sSavedQuery;\r\r
+        }\r\r
+        oTextbox.value += sResultKey + sDelimChar;\r\r
+        if(sDelimChar != " ") {\r\r
+            oTextbox.value += " ";\r\r
+        }\r\r
+    }\r\r
+    else { oTextbox.value = sResultKey; }\r\r
+\r\r
+    // scroll to bottom of textarea if necessary\r\r
+    if(oTextbox.type == "textarea") {\r\r
+        oTextbox.scrollTop = oTextbox.scrollHeight;\r\r
+    }\r\r
+\r\r
+    // move cursor to end\r\r
+    var end = oTextbox.value.length;\r\r
+    this._selectText(oTextbox,end,end);\r\r
+\r\r
+    this._oCurItem = oItem;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Selects a result item from the container\r\r
+ *\r\r
+ * @param {object} oItem The selected &lt;li&gt; element item\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._selectItem = function(oItem) {\r\r
+    this._bItemSelected = true;\r\r
+    this._updateValue(oItem);\r\r
+    this.itemSelectEvent.fire(this, oItem, oItem._oResultData);\r\r
+    this._clearList();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * For values updated by type-ahead, the right arrow key jumps to the end\r\r
+ * of the textbox, otherwise the container is closed.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._jumpSelection = function() {\r\r
+    if(!this.typeAhead) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this._clearList();\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Triggered by up and down arrow keys, changes the current highlighted\r\r
+ * &lt;li&gt; element item. Scrolls container if necessary.\r\r
+ *\r\r
+ * @param {number} nKeyCode Code of key pressed\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.AutoComplete.prototype._moveSelection = function(nKeyCode) {\r\r
+    if(this._bContainerOpen) {\r\r
+        // Determine current item's id number\r\r
+        var oCurItem = this._oCurItem;\r\r
+        var nCurItemIndex = -1;\r\r
+\r\r
+        if (oCurItem) {\r\r
+            nCurItemIndex = oCurItem._nItemIndex;\r\r
+        }\r\r
+\r\r
+        var nNewItemIndex = (nKeyCode == 40) ?\r\r
+                (nCurItemIndex + 1) : (nCurItemIndex - 1);\r\r
+\r\r
+        // Out of bounds\r\r
+        if (nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) {\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        if (oCurItem) {\r\r
+            // Unhighlight current item\r\r
+            this._toggleHighlight(oCurItem, "from");\r\r
+            this.itemArrowFromEvent.fire(this, oCurItem);\r\r
+        }\r\r
+        if (nNewItemIndex == -1) {\r\r
+           // Go back to query (remove type-ahead string)\r\r
+            if(this.delimChar && this._sSavedQuery) {\r\r
+                if (!this._textMatchesOption()) {\r\r
+                    this._oTextbox.value = this._sSavedQuery;\r\r
+                }\r\r
+                else {\r\r
+                    this._oTextbox.value = this._sSavedQuery + this._sCurQuery;\r\r
+                }\r\r
+            }\r\r
+            else {\r\r
+                this._oTextbox.value = this._sCurQuery;\r\r
+            }\r\r
+            this._oCurItem = null;\r\r
+            return;\r\r
+        }\r\r
+        if (nNewItemIndex == -2) {\r\r
+            // Close container\r\r
+            this._clearList();\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        var oNewItem = this._aListItems[nNewItemIndex];\r\r
+\r\r
+        // Scroll the container if necessary\r\r
+        if((YAHOO.util.Dom.getStyle(this._oContainer._oContent,"overflow") == "auto") &&\r\r
+        (nNewItemIndex > -1) && (nNewItemIndex < this._nDisplayedItems)) {\r\r
+            // User is keying down\r\r
+            if(nKeyCode == 40) {\r\r
+                // Bottom of selected item is below scroll area...\r\r
+                if((oNewItem.offsetTop+oNewItem.offsetHeight) > (this._oContainer._oContent.scrollTop + this._oContainer._oContent.offsetHeight)) {\r\r
+                    // Set bottom of scroll area to bottom of selected item\r\r
+                    this._oContainer._oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - this._oContainer._oContent.offsetHeight;\r\r
+                }\r\r
+                // Bottom of selected item is above scroll area...\r\r
+                else if((oNewItem.offsetTop+oNewItem.offsetHeight) < this._oContainer._oContent.scrollTop) {\r\r
+                    // Set top of selected item to top of scroll area\r\r
+                    this._oContainer._oContent.scrollTop = oNewItem.offsetTop;\r\r
+\r\r
+                }\r\r
+            }\r\r
+            // User is keying up\r\r
+            else {\r\r
+                // Top of selected item is above scroll area\r\r
+                if(oNewItem.offsetTop < this._oContainer._oContent.scrollTop) {\r\r
+                    // Set top of scroll area to top of selected item\r\r
+                    this._oContainer._oContent.scrollTop = oNewItem.offsetTop;\r\r
+                }\r\r
+                // Top of selected item is below scroll area\r\r
+                else if(oNewItem.offsetTop > (this._oContainer._oContent.scrollTop + this._oContainer._oContent.offsetHeight)) {\r\r
+                    // Set bottom of selected item to bottom of scroll area\r\r
+                    this._oContainer._oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - this._oContainer._oContent.offsetHeight;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+\r\r
+        this._toggleHighlight(oNewItem, "to");\r\r
+        this.itemArrowToEvent.fire(this, oNewItem);\r\r
+        if(this.typeAhead) {\r\r
+            this._updateValue(oNewItem);\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing encapsulation of a data source. \r\r
+ *  \r\r
+ * @constructor\r\r
+ *\r\r
+ */\r\r
+YAHOO.widget.DataSource = function() { \r\r
+    /* abstract class */\r\r
+};\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public constants\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Error message for null data responses.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.ERROR_DATANULL = "Response data was null";\r\r
+\r\r
+/**\r\r
+ * Error message for data responses with parsing errors.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.ERROR_DATAPARSE = "Response data could not be parsed";\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Max size of the local cache.  Set to 0 to turn off caching.  Caching is\r\r
+ * useful to reduce the number of server connections.  Recommended only for data\r\r
+ * sources that return comprehensive results for queries or when stale data is\r\r
+ * not an issue. Default: 15.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.maxCacheEntries = 15;\r\r
+\r\r
+/**\r\r
+ * Use this to equate cache matching with the type of matching done by your live\r\r
+ * data source. If caching is on and queryMatchContains is true, the cache\r\r
+ * returns results that "contain" the query string. By default,\r\r
+ * queryMatchContains is set to false, meaning the cache only returns results\r\r
+ * that "start with" the query string. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchContains = false;\r\r
+\r\r
+/**\r\r
+ * Data source query subset matching. If caching is on and queryMatchSubset is\r\r
+ * true, substrings of queries will return matching cached results. For\r\r
+ * instance, if the first query is for "abc" susequent queries that start with\r\r
+ * "abc", like "abcd", will be queried against the cache, and not the live data\r\r
+ * source. Recommended only for data sources that return comprehensive results\r\r
+ * for queries with very few characters. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchSubset = false;\r\r
+\r\r
+/**\r\r
+ * Data source query case-sensitivity matching. If caching is on and\r\r
+ * queryMatchCase is true, queries will only return results for case-sensitive\r\r
+ * matches. Default: false.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryMatchCase = false;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the data source instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getName = function() {\r\r
+    return this._sName;\r\r
+};\r\r
+\r\r
+ /**\r\r
+ * Public accessor to the unique name of the data source instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.toString = function() {\r\r
+    return "DataSource " + this._sName;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Retrieves query results, first checking the local cache, then making the\r\r
+ * query request to the live data source as defined by the function doQuery.\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to\r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oParent) {\r\r
+    \r\r
+    // First look in cache\r\r
+    var aResults = this._doQueryCache(oCallbackFn,sQuery,oParent);\r\r
+    \r\r
+    // Not in cache, so get results from server\r\r
+    if(aResults.length === 0) {\r\r
+        this.queryEvent.fire(this, oParent, sQuery);\r\r
+        this.doQuery(oCallbackFn, sQuery, oParent);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Abstract method implemented by subclasses to make a query to the live data\r\r
+ * source. Must call the callback function with the response returned from the\r\r
+ * query. Populates cache (if enabled).\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function implemented by oParent to\r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    /* override this */ \r\r
+};\r\r
+\r\r
+/**\r\r
+ * Flushes cache.\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.flushCache = function() {\r\r
+    if(this._aCache) {\r\r
+        this._aCache = [];\r\r
+    }\r\r
+    if(this._aCacheHelper) {\r\r
+        this._aCacheHelper = [];\r\r
+    }\r\r
+    this.cacheFlushEvent.fire(this);\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when a query is made to the live data source. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.queryEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when a query is made to the local cache. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.cacheQueryEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when data is retrieved from the live data source. Subscribers receive\r\r
+ * the following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getResultsEvent = null;\r\r
+    \r\r
+/**\r\r
+ * Fired when data is retrieved from the local cache. Subscribers receive the\r\r
+ * following array :<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.getCachedResultsEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when an error is encountered with the live data source. Subscribers\r\r
+ * receive the following array:<br>\r\r
+ *     - args[0] The data source instance\r\r
+ *     - args[1] The requesting object\r\r
+ *     - args[2] The query string\r\r
+ *     - args[3] Error message string\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.dataErrorEvent = null;\r\r
+\r\r
+/**\r\r
+ * Fired when the local cache is flushed. Subscribers receive the following\r\r
+ * array :<br>\r\r
+ *     - args[0] The data source instance\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype.cacheFlushEvent = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class variable to index multiple data source instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource._nIndex = 0;\r\r
+\r\r
+/**\r\r
+ * Name of data source instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._sName = null;\r\r
+\r\r
+/**\r\r
+ * Local cache of data result objects indexed chronologically.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._aCache = null;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Initializes data source instance.\r\r
+ *  \r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._init = function() {\r\r
+    // Validate and initialize public configs\r\r
+    var maxCacheEntries = this.maxCacheEntries;\r\r
+    if(isNaN(maxCacheEntries) || (maxCacheEntries < 0)) {\r\r
+        maxCacheEntries = 0;\r\r
+    }\r\r
+    // Initialize local cache\r\r
+    if(maxCacheEntries > 0 && !this._aCache) {\r\r
+        this._aCache = [];\r\r
+    }\r\r
+    \r\r
+    this._sName = "instance" + YAHOO.widget.DataSource._nIndex;\r\r
+    YAHOO.widget.DataSource._nIndex++;\r\r
+    \r\r
+    this.queryEvent = new YAHOO.util.CustomEvent("query", this);\r\r
+    this.cacheQueryEvent = new YAHOO.util.CustomEvent("cacheQuery", this);\r\r
+    this.getResultsEvent = new YAHOO.util.CustomEvent("getResults", this);\r\r
+    this.getCachedResultsEvent = new YAHOO.util.CustomEvent("getCachedResults", this);\r\r
+    this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this);\r\r
+    this.cacheFlushEvent = new YAHOO.util.CustomEvent("cacheFlush", this);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Adds a result object to the local cache, evicting the oldest element if the \r\r
+ * cache is full. Newer items will have higher indexes, the oldest item will have\r\r
+ * index of 0. \r\r
+ *\r\r
+ * @param {object} resultObj  Object literal of data results, including internal\r\r
+ *                            properties and an array of result objects\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._addCacheElem = function(resultObj) {\r\r
+    var aCache = this._aCache;\r\r
+    // Don't add if anything important is missing.\r\r
+    if(!aCache || !resultObj || !resultObj.query || !resultObj.results) {\r\r
+        return;\r\r
+    }\r\r
+    \r\r
+    // If the cache is full, make room by removing from index=0\r\r
+    if(aCache.length >= this.maxCacheEntries) {\r\r
+        aCache.shift();\r\r
+    }\r\r
+        \r\r
+    // Add to cache, at the end of the array\r\r
+    aCache.push(resultObj);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Queries the local cache for results. If query has been cached, the callback\r\r
+ * function is called with the results, and the cached is refreshed so that it\r\r
+ * is now the newest element.  \r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ * @return {array} aResults Result object from local cache if found, otherwise \r\r
+ *                          null\r\r
+ * @private \r\r
+ */\r\r
+YAHOO.widget.DataSource.prototype._doQueryCache = function(oCallbackFn, sQuery, oParent) {\r\r
+    var aResults = [];\r\r
+    var bMatchFound = false;\r\r
+    var aCache = this._aCache;\r\r
+    var nCacheLength = (aCache) ? aCache.length : 0;\r\r
+    var bMatchContains = this.queryMatchContains;\r\r
+    \r\r
+    // If cache is enabled...\r\r
+    if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) {\r\r
+        this.cacheQueryEvent.fire(this, oParent, sQuery);\r\r
+        // If case is unimportant, normalize query now instead of in loops\r\r
+        if(!this.queryMatchCase) {\r\r
+            var sOrigQuery = sQuery;\r\r
+            sQuery = sQuery.toLowerCase();\r\r
+        }\r\r
+\r\r
+        // Loop through each cached element's query property...\r\r
+        for(var i = nCacheLength-1; i >= 0; i--) {\r\r
+            var resultObj = aCache[i];\r\r
+            var aAllResultItems = resultObj.results;\r\r
+            // If case is unimportant, normalize match key for comparison\r\r
+            var matchKey = (!this.queryMatchCase) ?\r\r
+                encodeURIComponent(resultObj.query.toLowerCase()):\r\r
+                encodeURIComponent(resultObj.query);\r\r
+            \r\r
+            // If a cached match key exactly matches the query...\r\r
+            if(matchKey == sQuery) {\r\r
+                    // Stash all result objects into aResult[] and stop looping through the cache.\r\r
+                    bMatchFound = true;\r\r
+                    aResults = aAllResultItems;\r\r
+                    \r\r
+                    // The matching cache element was not the most recent,\r\r
+                    // so now we need to refresh the cache.\r\r
+                    if(i != nCacheLength-1) {                        \r\r
+                        // Remove element from its original location\r\r
+                        aCache.splice(i,1);\r\r
+                        // Add element as newest\r\r
+                        this._addCacheElem(resultObj);\r\r
+                    }\r\r
+                    break;\r\r
+            }\r\r
+            // Else if this query is not an exact match and subset matching is enabled...\r\r
+            else if(this.queryMatchSubset) {\r\r
+                // Loop through substrings of each cached element's query property...\r\r
+                for(var j = sQuery.length-1; j >= 0 ; j--) {\r\r
+                    var subQuery = sQuery.substr(0,j);\r\r
+                    \r\r
+                    // If a substring of a cached sQuery exactly matches the query...\r\r
+                    if(matchKey == subQuery) {                    \r\r
+                        bMatchFound = true;\r\r
+                        \r\r
+                        // Go through each cached result object to match against the query...\r\r
+                        for(var k = aAllResultItems.length-1; k >= 0; k--) {\r\r
+                            var aRecord = aAllResultItems[k];\r\r
+                            var sKeyIndex = (this.queryMatchCase) ?\r\r
+                                encodeURIComponent(aRecord[0]).indexOf(sQuery):\r\r
+                                encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery);\r\r
+                            \r\r
+                            // A STARTSWITH match is when the query is found at the beginning of the key string...\r\r
+                            if((!bMatchContains && (sKeyIndex === 0)) ||\r\r
+                            // A CONTAINS match is when the query is found anywhere within the key string...\r\r
+                            (bMatchContains && (sKeyIndex > -1))) {\r\r
+                                // Stash a match into aResults[].\r\r
+                                aResults.unshift(aRecord);\r\r
+                            }\r\r
+                        }\r\r
+                        \r\r
+                        // Add the subset match result set object as the newest element to cache,\r\r
+                        // and stop looping through the cache.\r\r
+                        resultObj = {};\r\r
+                        resultObj.query = sQuery;\r\r
+                        resultObj.results = aResults;\r\r
+                        this._addCacheElem(resultObj);\r\r
+                        break;\r\r
+                    }\r\r
+                }\r\r
+                if(bMatchFound) {\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        \r\r
+        // If there was a match, send along the results.\r\r
+        if(bMatchFound) {\r\r
+            this.getCachedResultsEvent.fire(this, oParent, sOrigQuery, aResults);\r\r
+            oCallbackFn(sOrigQuery, aResults, oParent);\r\r
+        }\r\r
+    }\r\r
+    return aResults;\r\r
+};\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using XML HTTP requests that return\r\r
+ * query results.\r\r
+ * requires YAHOO.util.Connect XMLHTTPRequest library\r\r
+ * extends YAHOO.widget.DataSource\r\r
+ *  \r\r
+ * @constructor\r\r
+ * @param {string} sScriptURI Absolute or relative URI to script that returns \r\r
+ *                            query results as JSON, XML, or delimited flat data\r\r
+ * @param {array} aSchema Data schema definition of results\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+    \r\r
+    // Initialization sequence\r\r
+    if(!aSchema || (aSchema.constructor != Array)) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.schema = aSchema;\r\r
+    }\r\r
+    this.scriptURI = sScriptURI;\r\r
+    this._init();\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_XHR.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public constants\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * JSON data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_JSON = 0;\r\r
+\r\r
+/**\r\r
+ * XML data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_XML = 1;\r\r
+\r\r
+/**\r\r
+ * Flat file data type\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.TYPE_FLAT = 2;\r\r
+\r\r
+/**\r\r
+ * Error message for XHR failure.\r\r
+ *\r\r
+ * @type constant\r\r
+ * @final\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.ERROR_DATAXHR = "XHR response failed";\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Number of milliseconds the XHR connection will wait for a server response. A\r\r
+ * a value of zero indicates the XHR connection will wait forever. Any value\r\r
+ * greater than zero will use the Connection utility's Auto-Abort feature.\r\r
+ * Default: 0.\r\r
+ *\r\r
+ * @type number\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.connTimeout = 0;\r\r
+\r\r
+\r\r
+/**\r\r
+ * Absolute or relative URI to script that returns query results. For instance,\r\r
+ * queries will be sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptURI = null;\r\r
+\r\r
+/**\r\r
+ * Query string parameter name sent to scriptURI. For instance, queries will be\r\r
+ * sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput\r\r
+ * Default: "query".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptQueryParam = "query";\r\r
+\r\r
+/**\r\r
+ * String of key/value pairs to append to requests made to scriptURI. Define\r\r
+ * this string when you want to send additional query parameters to your script.\r\r
+ * When defined, queries will be sent to\r\r
+ *   <scriptURI>?<scriptQueryParam>=userinput&<scriptQueryAppend>\r\r
+ * Default: "".\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.scriptQueryAppend = "";\r\r
+\r\r
+/**\r\r
+ * XHR response data type. Other types that may be defined are TYPE_XML and\r\r
+ * TYPE_FLAT. Default: TYPE_JSON.\r\r
+ *\r\r
+ * @type type\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.responseType = YAHOO.widget.DS_XHR.prototype.TYPE_JSON;\r\r
+\r\r
+/**\r\r
+ * String after which to strip results. If the results from the XHR are sent\r\r
+ * back as HTML, the gzip HTML comment appears at the end of the data and should\r\r
+ * be ignored.  Default: "\n&lt;!--"\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.responseStripAfter = "\n<!--";\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by scriptURI for results. Results are\r\r
+ * passed back to a callback function.\r\r
+ *  \r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var isXML = (this.responseType == this.TYPE_XML);\r\r
+    var sUri = this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;\r\r
+    if(this.scriptQueryAppend.length > 0) {\r\r
+        sUri += "&" + this.scriptQueryAppend;\r\r
+    }\r\r
+    var oResponse = null;\r\r
+    \r\r
+    var oSelf = this;\r\r
+    /**\r\r
+     * Sets up ajax request callback\r\r
+     *\r\r
+     * @param {object} oReq          HTTPXMLRequest object\r\r
+     * @private\r\r
+     */\r\r
+    var responseSuccess = function(oResp) {\r\r
+        // Response ID does not match last made request ID.\r\r
+        if(!oSelf._oConn || (oResp.tId != oSelf._oConn.tId)) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATANULL);\r\r
+            return;\r\r
+        }\r\r
+//DEBUG\r\r
+for(var foo in oResp) {\r\r
+}\r\r
+        if(!isXML) {\r\r
+            oResp = oResp.responseText;\r\r
+        }\r\r
+        else { \r\r
+            oResp = oResp.responseXML;\r\r
+        }\r\r
+        if(oResp === null) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATANULL);\r\r
+            return;\r\r
+        }\r\r
+\r\r
+        var aResults = oSelf.parseResponse(sQuery, oResp, oParent);\r\r
+        var resultObj = {};\r\r
+        resultObj.query = decodeURIComponent(sQuery);\r\r
+        resultObj.results = aResults;\r\r
+        if(aResults === null) {\r\r
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATAPARSE);\r\r
+            return;\r\r
+        }\r\r
+        else {\r\r
+            oSelf.getResultsEvent.fire(oSelf, oParent, sQuery, aResults);\r\r
+            oSelf._addCacheElem(resultObj);\r\r
+            oCallbackFn(sQuery, aResults, oParent);\r\r
+        }\r\r
+    };\r\r
+\r\r
+    var responseFailure = function(oResp) {\r\r
+        oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, oSelf.ERROR_DATAXHR);\r\r
+        return;\r\r
+    };\r\r
+    \r\r
+    var oCallback = {\r\r
+        success:responseSuccess,\r\r
+        failure:responseFailure\r\r
+    };\r\r
+    \r\r
+    if(!isNaN(this.connTimeout) && this.connTimeout > 0) {\r\r
+        oCallback.timeout = this.connTimeout;\r\r
+    }\r\r
+    \r\r
+    if(this._oConn) {\r\r
+        YAHOO.util.Connect.abort(this._oConn);\r\r
+    }\r\r
+    \r\r
+    oSelf._oConn = YAHOO.util.Connect.asyncRequest("GET", sUri, oCallback, null);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Parses raw response data into an array of result objects. The result data key\r\r
+ * is always stashed in the [0] element of each result object. \r\r
+ *\r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oResponse The raw response data to parse\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ * @returns {array} Array of result objects\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParent) {\r\r
+    var aSchema = this.schema;\r\r
+    var aResults = [];\r\r
+    var bError = false;\r\r
+\r\r
+    // Strip out comment at the end of results\r\r
+    var nEnd = ((this.responseStripAfter !== "") && (oResponse.indexOf)) ?\r\r
+        oResponse.indexOf(this.responseStripAfter) : -1;\r\r
+    if(nEnd != -1) {\r\r
+        oResponse = oResponse.substring(0,nEnd);\r\r
+    }\r\r
+\r\r
+    switch (this.responseType) {\r\r
+        case this.TYPE_JSON:\r\r
+            var jsonList;\r\r
+            // Divert KHTML clients from JSON lib\r\r
+            if(window.JSON && (navigator.userAgent.toLowerCase().indexOf('khtml')== -1)) {\r\r
+                // Use the JSON utility if available\r\r
+                var jsonObjParsed = JSON.parse(oResponse);\r\r
+                if(!jsonObjParsed) {\r\r
+                    bError = true;\r\r
+                    break;\r\r
+                }\r\r
+                else {\r\r
+                    // eval is necessary here since aSchema[0] is of unknown depth\r\r
+                    jsonList = eval("jsonObjParsed." + aSchema[0]);\r\r
+                }\r\r
+            }\r\r
+            else {\r\r
+                // Parse the JSON response as a string\r\r
+                try {\r\r
+                    // Trim leading spaces\r\r
+                    while (oResponse.substring(0,1) == " ") {\r\r
+                        oResponse = oResponse.substring(1, oResponse.length);\r\r
+                    }\r\r
+\r\r
+                    // Invalid JSON response\r\r
+                    if(oResponse.indexOf("{") < 0) {\r\r
+                        bError = true;\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Empty (but not invalid) JSON response\r\r
+                    if(oResponse.indexOf("{}") === 0) {\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Turn the string into an object literal...\r\r
+                    // ...eval is necessary here\r\r
+                    var jsonObjRaw = eval("(" + oResponse + ")");\r\r
+                    if(!jsonObjRaw) {\r\r
+                        bError = true;\r\r
+                        break;\r\r
+                    }\r\r
+\r\r
+                    // Grab the object member that contains an array of all reponses...\r\r
+                    // ...eval is necessary here since aSchema[0] is of unknown depth\r\r
+                    jsonList = eval("(jsonObjRaw." + aSchema[0]+")");\r\r
+                }\r\r
+                catch(e) {\r\r
+                    bError = true;\r\r
+                    break;\r\r
+               }\r\r
+            }\r\r
+\r\r
+            if(!jsonList) {\r\r
+                bError = true;\r\r
+                break;\r\r
+            }\r\r
+\r\r
+            // Loop through the array of all responses...\r\r
+            for(var i = jsonList.length-1; i >= 0 ; i--) {\r\r
+                var aResultItem = [];\r\r
+                var jsonResult = jsonList[i];\r\r
+                // ...and loop through each data field value of each response\r\r
+                for(var j = aSchema.length-1; j >= 1 ; j--) {\r\r
+                    // ...and capture data into an array mapped according to the schema...\r\r
+                    var dataFieldValue = jsonResult[aSchema[j]];\r\r
+                    if(!dataFieldValue) {\r\r
+                        dataFieldValue = "";\r\r
+                    }\r\r
+                    aResultItem.unshift(dataFieldValue);\r\r
+                }\r\r
+                // Capture the array of data field values in an array of results\r\r
+                aResults.unshift(aResultItem);\r\r
+            }\r\r
+            break;\r\r
+        case this.TYPE_XML:\r\r
+            // Get the collection of results\r\r
+            var xmlList = oResponse.getElementsByTagName(aSchema[0]);\r\r
+            if(!xmlList) {\r\r
+                bError = true;\r\r
+                break;\r\r
+            }\r\r
+            // Loop through each result\r\r
+            for(var k = xmlList.length-1; k >= 0 ; k--) {\r\r
+                var result = xmlList.item(k);\r\r
+                var aFieldSet = [];\r\r
+                // Loop through each data field in each result using the schema\r\r
+                for(var m = aSchema.length-1; m >= 1 ; m--) {\r\r
+                    var sValue = null;\r\r
+                    // Values may be held in an attribute...\r\r
+                    var xmlAttr = result.attributes.getNamedItem(aSchema[m]);\r\r
+                    if(xmlAttr) {\r\r
+                        sValue = xmlAttr.value;\r\r
+                    }\r\r
+                    // ...or in a node\r\r
+                    else{\r\r
+                        var xmlNode = result.getElementsByTagName(aSchema[m]);\r\r
+                        if(xmlNode && xmlNode.item(0) && xmlNode.item(0).firstChild) {\r\r
+                            sValue = xmlNode.item(0).firstChild.nodeValue;\r\r
+                        }\r\r
+                        else {\r\r
+                            sValue = "";\r\r
+                        }\r\r
+                    }\r\r
+                    // Capture the schema-mapped data field values into an array\r\r
+                    aFieldSet.unshift(sValue);\r\r
+                }\r\r
+                // Capture each array of values into an array of results\r\r
+                aResults.unshift(aFieldSet);\r\r
+            }\r\r
+            break;\r\r
+        case this.TYPE_FLAT:\r\r
+            if(oResponse.length > 0) {\r\r
+                // Delete the last line delimiter at the end of the data if it exists\r\r
+                var newLength = oResponse.length-aSchema[0].length;\r\r
+                if(oResponse.substr(newLength) == aSchema[0]) {\r\r
+                    oResponse = oResponse.substr(0, newLength);\r\r
+                }\r\r
+                var aRecords = oResponse.split(aSchema[0]);\r\r
+                for(var n = aRecords.length-1; n >= 0; n--) {\r\r
+                    aResults[n] = aRecords[n].split(aSchema[1]);\r\r
+                }\r\r
+            }\r\r
+            break;\r\r
+        default:\r\r
+            break;\r\r
+    }\r\r
+    sQuery = null;\r\r
+    oResponse = null;\r\r
+    oParent = null;\r\r
+    if(bError) {\r\r
+        return null;\r\r
+    }\r\r
+    else {\r\r
+        return aResults;\r\r
+    }\r\r
+};            \r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * XHR connection object.\r\r
+ *\r\r
+ * @type object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.DS_XHR.prototype._oConn = null;\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using a native Javascript struct as\r\r
+ * its live data source.\r\r
+ *  \r\r
+ * @constructor\r\r
+ * extends YAHOO.widget.DataSource \r\r
+ *  \r\r
+ * @param {string} oFunction In-memory Javascript function that returns query\r\r
+ *                           results as an array of objects\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction = function(oFunction, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialization sequence\r\r
+    if(!oFunction  || (oFunction.constructor != Function)) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.dataFunction = oFunction;\r\r
+        this._init();\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_JSFunction.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * In-memory Javascript function that returns query results.\r\r
+ *\r\r
+ * @type function\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction.prototype.dataFunction = null;\r\r
+\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by function for results. Results are\r\r
+ * passed back to a callback function.\r\r
+ *  \r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to \r\r
+ *                             which to return results \r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_JSFunction.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var oFunction = this.dataFunction;\r\r
+    var aResults = [];\r\r
+    \r\r
+    aResults = oFunction(sQuery);\r\r
+    if(aResults === null) {\r\r
+        this.dataErrorEvent.fire(this, oParent, sQuery, this.ERROR_DATANULL);\r\r
+        return;\r\r
+    }\r\r
+    \r\r
+    var resultObj = {};\r\r
+    resultObj.query = decodeURIComponent(sQuery);\r\r
+    resultObj.results = aResults;\r\r
+    this._addCacheElem(resultObj);\r\r
+    \r\r
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);\r\r
+    oCallbackFn(sQuery, aResults, oParent);\r\r
+    return;\r\r
+};\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Implementation of YAHOO.widget.DataSource using a native Javascript array as\r\r
+ * its live data source.\r\r
+ *\r\r
+ * @constructor\r\r
+ * extends YAHOO.widget.DataSource\r\r
+ *\r\r
+ * @param {string} aData In-memory Javascript array of simple string data\r\r
+ * @param {object} oConfigs Optional object literal of config params\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray = function(aData, oConfigs) {\r\r
+    // Set any config params passed in to override defaults\r\r
+    if(typeof oConfigs == "object") {\r\r
+        for(var sConfig in oConfigs) {\r\r
+            this[sConfig] = oConfigs[sConfig];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialization sequence\r\r
+    if(!aData || (aData.constructor != Array)) {\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this.data = aData;\r\r
+        this._init();\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.DS_JSArray.prototype = new YAHOO.widget.DataSource();\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public member variables\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * In-memory Javascript array of strings.\r\r
+ *\r\r
+ * @type array\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray.prototype.data = null;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Queries the live data source defined by data for results. Results are passed\r\r
+ * back to a callback function.\r\r
+ *\r\r
+ * @param {object} oCallbackFn Callback function defined by oParent object to\r\r
+ *                             which to return results\r\r
+ * @param {string} sQuery Query string\r\r
+ * @param {object} oParent The object instance that has requested data\r\r
+ */\r\r
+YAHOO.widget.DS_JSArray.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {\r\r
+    var aData = this.data;\r\r
+    var aResults = [];\r\r
+    var bMatchFound = false;\r\r
+    var bMatchContains = this.queryMatchContains;\r\r
+    if(!this.queryMatchCase) {\r\r
+        sQuery = sQuery.toLowerCase();\r\r
+    }\r\r
+\r\r
+    // Loop through each element of the array...\r\r
+    for(var i = aData.length-1; i >= 0; i--) {\r\r
+        var aDataset = [];\r\r
+        if(typeof aData[i] == "string") {\r\r
+            aDataset[0] = aData[i];\r\r
+        }\r\r
+        else {\r\r
+            aDataset = aData[i];\r\r
+        }\r\r
+\r\r
+        var sKeyIndex = (this.queryMatchCase) ?\r\r
+            encodeURIComponent(aDataset[0]).indexOf(sQuery):\r\r
+            encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);\r\r
+\r\r
+        // A STARTSWITH match is when the query is found at the beginning of the key string...\r\r
+        if((!bMatchContains && (sKeyIndex === 0)) ||\r\r
+        // A CONTAINS match is when the query is found anywhere within the key string...\r\r
+        (bMatchContains && (sKeyIndex > -1))) {\r\r
+            // Stash a match into aResults[].\r\r
+            aResults.unshift(aDataset);\r\r
+        }\r\r
+    }\r\r
+\r\r
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);\r\r
+    oCallbackFn(sQuery, aResults, oParent);\r\r
+};\r\r
diff --git a/lib/yui/calendar/README b/lib/yui/calendar/README
new file mode 100755 (executable)
index 0000000..73d1c53
--- /dev/null
@@ -0,0 +1,24 @@
+Calendar Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+       - DateMath: DateMath.add now properly adds weeks\r
+       - DateMath: between() function added\r
+       - DateMath: getWeekNumber() fixed to take starting day of week into account\r
+       - All references to Calendar's built in CSS class handlers are removed, replaced with calls to Dom utility (addClass, removeClass)\r
+       - Several CSS class constants now have clearer names\r
+       - All CSS classes are now properly namespaced to avoid CSS conflicts\r
+       - Fixed table:hover bug in CSS\r
+       - Calendar no longer requires the container ID and variable name to match in order for month navigation to function properly\r
+       - Calendar month navigation arrows are now represented as background images\r
+\r
+*** version 0.10.0 ***\r
+\r
+       - Major performance improvements from attaching DOM events to associated table cells only once, when the Calendar shell is built\r
+       - DOM events for mouseover/mouseout are now fired for all browsers (not just Internet Explorer)\r
+       - Reset functionality bug fixed for 2-up Calendar view\r
+\r
+*** version 0.9.0 ***\r
+\r
+* Initial release\r
+\r
diff --git a/lib/yui/calendar/assets/calendar.css b/lib/yui/calendar/assets/calendar.css
new file mode 100755 (executable)
index 0000000..59e8909
--- /dev/null
@@ -0,0 +1,169 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+.yui-cal2upwrapper {*height:1%;} /* IE */\r
+.yui-cal2upwrapper:after {content:'.';clear:both;display:block;visibility:hidden;height:0;} /* others */\r
+\r
+.yui-calcontainer {\r
+       float:left;\r
+       padding:5px;\r
+       background-color:#F7F9FB;\r
+       border:1px solid #7B9EBD;\r
+}\r
+\r
+.yui-calcontainer .title {\r
+       font:100% sans-serif;\r
+       color:#000;\r
+       font-weight:bold;\r
+       margin-bottom:5px;\r
+       height:auto;\r
+       width:304px;\r
+       position:relative;\r
+}\r
+\r
+.yui-calcontainer .title .close-icon {\r
+       position:absolute;\r
+       right:0;\r
+       top:0;\r
+       border:none;\r
+}\r
+\r
+.yui-calcontainer .cal2up {\r
+       float:left;\r
+}\r
+\r
+.yui-calendar .calnavleft {\r
+       position:absolute;\r
+       background-repeat:no-repeat;\r
+       cursor:pointer;\r
+       top:2px;\r
+       bottom:0;\r
+       width:9px;\r
+       height:12px;   \r
+       left:2px;\r
+}\r
+\r
+.yui-calendar .calnavright {\r
+       position:absolute;\r
+       background-repeat:no-repeat;\r
+       cursor:pointer;\r
+       top:2px;\r
+       bottom:0;\r
+       width:9px;\r
+       height:12px;  \r
+       right:2px;\r
+}\r
+\r
+/* Calendar element styles */\r
+\r
+.yui-calendar {\r
+       font:100% sans-serif;\r
+       text-align:center;\r
+       border-spacing:0;\r
+       border-collapse:separate;\r
+}\r
+\r
+.yui-calendar td.calcell {\r
+       width:1.5em;\r
+       height:1em;\r
+       border:1px solid #E0E0E0;\r
+       background-color:#FFF;\r
+}\r
+\r
+.yui-calendar td.calcell a {\r
+       color:#003DB8;\r
+       text-decoration:none;\r
+}\r
+\r
+.yui-calendar td.calcell.today {\r
+       border:1px solid #000;\r
+}\r
+\r
+.yui-calendar td.calcell.oom {\r
+       cursor:default;\r
+       color:#999;\r
+       background-color:#EEE;\r
+       border:1px solid #E0E0E0;\r
+}\r
+\r
+.yui-calendar td.calcell.selected {\r
+       color:#003DB8;\r
+       background-color:#FFF19F;\r
+       border:1px solid #FF9900;\r
+}\r
+\r
+.yui-calendar td.calcell.calcellhover {\r
+       cursor:pointer;\r
+       color:#FFF;\r
+       background-color:#FF9900;\r
+       border:1px solid #FF9900;\r
+}\r
+\r
+/* Added to perform some correction for Opera 8.5\r
+   hover redraw bug */\r
+table.yui-calendar:hover {\r
+       background-color:#FFF;\r
+}\r
+\r
+.yui-calendar td.calcell.calcellhover a {\r
+       color:#FFF;\r
+}\r
+\r
+.yui-calendar td.calcell.restricted {\r
+       text-decoration:line-through;\r
+}\r
+\r
+.yui-calendar td.calcell.previous {\r
+       color:#CCC;\r
+}\r
+\r
+.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }\r
+.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }\r
+.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }\r
+.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }\r
+\r
+\r
+.yui-calendar .calhead {\r
+       border:1px solid #E0E0E0;\r
+       vertical-align:middle;\r
+       background-color:#FFF;\r
+}\r
+\r
+.yui-calendar .calheader {\r
+       position:relative;\r
+       width:100%;\r
+       text-align:center;\r
+}\r
+\r
+.yui-calendar .calheader img {\r
+       border:none;\r
+}\r
+\r
+.yui-calendar .calweekdaycell {\r
+       color:#666;\r
+       font-weight:normal;\r
+}\r
+\r
+.yui-calendar .calfoot {\r
+       background-color:#EEE;\r
+}\r
+\r
+.yui-calendar .calrowhead, .yui-calendar .calrowfoot {\r
+       color:#666;\r
+       font-size:9px;\r
+       font-style:italic;\r
+       font-weight:normal;\r
+       width:15px;\r
+}\r
+\r
+.yui-calendar .calrowhead {\r
+       border-right-width:2px;\r
+}\r
+\r
+/*Specific changes for calendar running under fonts/reset */\r
+.yui-calendar a:hover {background:inherit;}\r
+p#clear {clear:left; padding-top:10px;}\r
diff --git a/lib/yui/calendar/assets/callt.gif b/lib/yui/calendar/assets/callt.gif
new file mode 100755 (executable)
index 0000000..a6cc8da
Binary files /dev/null and b/lib/yui/calendar/assets/callt.gif differ
diff --git a/lib/yui/calendar/assets/calrt.gif b/lib/yui/calendar/assets/calrt.gif
new file mode 100755 (executable)
index 0000000..ee137b2
Binary files /dev/null and b/lib/yui/calendar/assets/calrt.gif differ
diff --git a/lib/yui/calendar/assets/calx.gif b/lib/yui/calendar/assets/calx.gif
new file mode 100755 (executable)
index 0000000..27e7bc3
Binary files /dev/null and b/lib/yui/calendar/assets/calx.gif differ
diff --git a/lib/yui/calendar/calendar-debug.js b/lib/yui/calendar/calendar-debug.js
new file mode 100755 (executable)
index 0000000..12f8121
--- /dev/null
@@ -0,0 +1,2918 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+/**\r
+* @class\r
+* <p>YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility\r
+* used for adding, subtracting, and comparing dates.</p>\r
+*/\r
+YAHOO.widget.DateMath = new function() {\r
+\r
+       /**\r
+       * Constant field representing Day\r
+       * @type String\r
+       */\r
+       this.DAY = "D";\r
+\r
+       /**\r
+       * Constant field representing Week\r
+       * @type String\r
+       */\r
+       this.WEEK = "W";\r
+\r
+       /**\r
+       * Constant field representing Year\r
+       * @type String\r
+       */\r
+       this.YEAR = "Y";\r
+\r
+       /**\r
+       * Constant field representing Month\r
+       * @type String\r
+       */\r
+       this.MONTH = "M";\r
+\r
+       /**\r
+       * Constant field representing one day, in milliseconds\r
+       * @type Integer\r
+       */\r
+       this.ONE_DAY_MS = 1000*60*60*24;\r
+\r
+       /**\r
+       * Adds the specified amount of time to the this instance.\r
+       * @param {Date} date    The JavaScript Date object to perform addition on\r
+       * @param {string} field The this field constant to be used for performing addition.\r
+       * @param {Integer} amount       The number of units (measured in the field constant) to add to the date.\r
+       */\r
+       this.add = function(date, field, amount) {\r
+               var d = new Date(date.getTime());\r
+               switch (field) {\r
+                       case this.MONTH:\r
+                               var newMonth = date.getMonth() + amount;\r
+                               var years = 0;\r
+\r
+\r
+                               if (newMonth < 0) {\r
+                                       while (newMonth < 0) {\r
+                                               newMonth += 12;\r
+                                               years -= 1;\r
+                                       }\r
+                               } else if (newMonth > 11) {\r
+                                       while (newMonth > 11) {\r
+                                               newMonth -= 12;\r
+                                               years += 1;\r
+                                       }\r
+                               }\r
+                               \r
+                               d.setMonth(newMonth);\r
+                               d.setFullYear(date.getFullYear() + years);\r
+                               break;\r
+                       case this.DAY:\r
+                               d.setDate(date.getDate() + amount);\r
+                               break;\r
+                       case this.YEAR:\r
+                               d.setFullYear(date.getFullYear() + amount);\r
+                               break;\r
+                       case this.WEEK:\r
+                               d.setDate(date.getDate() + (amount * 7));\r
+                               break;\r
+               }\r
+               return d;\r
+       };\r
+\r
+       /**\r
+       * Subtracts the specified amount of time from the this instance.\r
+       * @param {Date} date    The JavaScript Date object to perform subtraction on\r
+       * @param {Integer} field        The this field constant to be used for performing subtraction.\r
+       * @param {Integer} amount       The number of units (measured in the field constant) to subtract from the date.\r
+       */\r
+       this.subtract = function(date, field, amount) {\r
+               return this.add(date, field, (amount*-1));\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is before another date on the calendar.\r
+       * @param {Date} date            The Date object to compare with the compare argument\r
+       * @param {Date} compareTo       The Date object to use for the comparison\r
+       * @return {Boolean} true if the date occurs before the compared date; false if not.\r
+       */\r
+       this.before = function(date, compareTo) {\r
+               var ms = compareTo.getTime();\r
+               if (date.getTime() < ms) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is after another date on the calendar.\r
+       * @param {Date} date            The Date object to compare with the compare argument\r
+       * @param {Date} compareTo       The Date object to use for the comparison\r
+       * @return {Boolean} true if the date occurs after the compared date; false if not.\r
+       */\r
+       this.after = function(date, compareTo) {\r
+               var ms = compareTo.getTime();\r
+               if (date.getTime() > ms) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is between two other dates on the calendar.\r
+       * @param {Date} date            The date to check for\r
+       * @param {Date} dateBegin       The start of the range\r
+       * @param {Date} dateEnd         The end of the range\r
+       * @return {Boolean} true if the date occurs between the compared dates; false if not.\r
+       */\r
+       this.between = function(date, dateBegin, dateEnd) {\r
+               if (this.after(date, dateBegin) && this.before(date, dateEnd)) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+       \r
+       /**\r
+       * Retrieves a JavaScript Date object representing January 1 of any given year.\r
+       * @param {Integer} calendarYear         The calendar year for which to retrieve January 1\r
+       * @return {Date}        January 1 of the calendar year specified.\r
+       */\r
+       this.getJan1 = function(calendarYear) {\r
+               return new Date(calendarYear,0,1); \r
+       };\r
+\r
+       /**\r
+       * Calculates the number of days the specified date is from January 1 of the specified calendar year.\r
+       * Passing January 1 to this function would return an offset value of zero.\r
+       * @param {Date} date    The JavaScript date for which to find the offset\r
+       * @param {Integer} calendarYear The calendar year to use for determining the offset\r
+       * @return {Integer}     The number of days since January 1 of the given year\r
+       */\r
+       this.getDayOffset = function(date, calendarYear) {\r
+               var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.\r
+               \r
+               // Find the number of days the passed in date is away from the calendar year start\r
+               var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);\r
+               return dayOffset;\r
+       };\r
+\r
+       /**\r
+       * Calculates the week number for the given date. This function assumes that week 1 is the\r
+       * week in which January 1 appears, regardless of whether the week consists of a full 7 days.\r
+       * The calendar year can be specified to help find what a the week number would be for a given\r
+       * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or\r
+       * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction\r
+       * easily.\r
+       * @param {Date} date    The JavaScript date for which to find the week number\r
+       * @param {Integer} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is\r
+       *                                                                                       the calendar year of parameter "date".\r
+       * @param {Integer} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).\r
+       * @return {Integer}     The week number of the given date.\r
+       */\r
+       this.getWeekNumber = function(date, calendarYear, weekStartsOn) {\r
+               date.setHours(12,0,0,0);\r
+\r
+               if (! weekStartsOn) {\r
+                       weekStartsOn = 0;\r
+               }\r
+               if (! calendarYear) {\r
+                       calendarYear = date.getFullYear();\r
+               }\r
+               \r
+               var weekNum = -1;\r
+               \r
+               var jan1 = this.getJan1(calendarYear);\r
+\r
+               var jan1Offset = jan1.getDay() - weekStartsOn;\r
+               var jan1DayOfWeek = (jan1Offset >= 0 ? jan1Offset : (7 + jan1Offset));\r
+\r
+               var endOfWeek1 = this.add(jan1, this.DAY, (6 - jan1DayOfWeek));\r
+               endOfWeek1.setHours(23,59,59,999);\r
+\r
+               var month = date.getMonth();\r
+               var day = date.getDate();\r
+               var year = date.getFullYear();\r
+               \r
+               var dayOffset = this.getDayOffset(date, calendarYear); // Days since Jan 1, Calendar Year\r
+                       \r
+               if (dayOffset < 0 || this.before(date, endOfWeek1)) {\r
+                       weekNum = 1;\r
+               } else {\r
+                       weekNum = 2;\r
+                       var weekBegin = new Date(endOfWeek1.getTime() + 1);\r
+                       var weekEnd = this.add(weekBegin, this.WEEK, 1);\r
+\r
+                       while (! this.between(date, weekBegin, weekEnd)) {\r
+                               weekBegin = this.add(weekBegin, this.WEEK, 1);\r
+                               weekEnd = this.add(weekEnd, this.WEEK, 1);\r
+                               weekNum += 1;\r
+                       }\r
+               }\r
+               \r
+               return weekNum;\r
+       };\r
+\r
+       /**\r
+       * Determines if a given week overlaps two different years.\r
+       * @param {Date} weekBeginDate   The JavaScript Date representing the first day of the week.\r
+       * @return {Boolean}     true if the date overlaps two different years.\r
+       */\r
+       this.isYearOverlapWeek = function(weekBeginDate) {\r
+               var overlaps = false;\r
+               var nextWeek = this.add(weekBeginDate, this.DAY, 6);\r
+               if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {\r
+                       overlaps = true;\r
+               }\r
+               return overlaps;\r
+       };\r
+\r
+       /**\r
+       * Determines if a given week overlaps two different months.\r
+       * @param {Date} weekBeginDate   The JavaScript Date representing the first day of the week.\r
+       * @return {Boolean}     true if the date overlaps two different months.\r
+       */\r
+       this.isMonthOverlapWeek = function(weekBeginDate) {\r
+               var overlaps = false;\r
+               var nextWeek = this.add(weekBeginDate, this.DAY, 6);\r
+               if (nextWeek.getMonth() != weekBeginDate.getMonth()) {\r
+                       overlaps = true;\r
+               }\r
+               return overlaps;\r
+       };\r
+\r
+       /**\r
+       * Gets the first day of a month containing a given date.\r
+       * @param {Date} date    The JavaScript Date used to calculate the month start\r
+       * @return {Date}                The JavaScript Date representing the first day of the month\r
+       */\r
+       this.findMonthStart = function(date) {\r
+               var start = new Date(date.getFullYear(), date.getMonth(), 1);\r
+               return start;\r
+       };\r
+\r
+       /**\r
+       * Gets the last day of a month containing a given date.\r
+       * @param {Date} date    The JavaScript Date used to calculate the month end\r
+       * @return {Date}                The JavaScript Date representing the last day of the month\r
+       */\r
+       this.findMonthEnd = function(date) {\r
+               var start = this.findMonthStart(date);\r
+               var nextMonth = this.add(start, this.MONTH, 1);\r
+               var end = this.subtract(nextMonth, this.DAY, 1);\r
+               return end;\r
+       };\r
+\r
+       /**\r
+       * Clears the time fields from a given date, effectively setting the time to midnight.\r
+       * @param {Date} date    The JavaScript Date for which the time fields will be cleared\r
+       * @return {Date}                The JavaScript Date cleared of all time fields\r
+       */\r
+       this.clearTime = function(date) {\r
+               date.setHours(0,0,0,0);\r
+               return date;\r
+       };\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* <p>Calendar_Core is the base class for the Calendar widget. In its most basic\r
+* implementation, it has the ability to render a calendar widget on the page\r
+* that can be manipulated to select a single date, move back and forth between\r
+* months and years.</p>\r
+* <p>To construct the placeholder for the calendar widget, the code is as\r
+* follows:\r
+*      <xmp>\r
+*              <div id="cal1Container"></div>\r
+*      </xmp>\r
+* Note that the table can be replaced with any kind of element.\r
+* </p>\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar_Core = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {     \r
+               if (! id) {\r
+                       YAHOO.log("No ID specified", "error");\r
+               }\r
+               if (! containerId) {\r
+                       YAHOO.log("No container ID specified", "error");\r
+               }\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+/**\r
+* The path to be used for images loaded for the Calendar\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") == 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");\r
+\r
+/**\r
+* Type constant used for renderers to represent an individual date (M/D/Y)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.DATE = "D";\r
+\r
+/**\r
+* Type constant used for renderers to represent an individual date across any year (M/D)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.MONTH_DAY = "MD";\r
+\r
+/**\r
+* Type constant used for renderers to represent a weekday\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.WEEKDAY = "WD";\r
+\r
+/**\r
+* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.RANGE = "R";\r
+\r
+/**\r
+* Type constant used for renderers to represent a month across any year\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.MONTH = "M";\r
+\r
+/**\r
+* Constant that represents the total number of date cells that are displayed in a given month\r
+* including \r
+* @final\r
+* @type Integer\r
+*/\r
+YAHOO.widget.Calendar_Core.DISPLAY_DAYS = 42;\r
+\r
+/**\r
+* Constant used for halting the execution of the remainder of the render stack\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.STOP_RENDER = "S";\r
+\r
+YAHOO.widget.Calendar_Core.prototype = {\r
+\r
+       /**\r
+       * The configuration object used to set up the calendars various locale and style options.\r
+       * @type Object\r
+       */\r
+       Config : null,\r
+\r
+       /**\r
+       * The parent CalendarGroup, only to be set explicitly by the parent group\r
+       * @type CalendarGroup\r
+       */      \r
+       parent : null,\r
+\r
+       /**\r
+       * The index of this item in the parent group\r
+       * @type Integer\r
+       */\r
+       index : -1,\r
+\r
+       /**\r
+       * The collection of calendar table cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       cells : null,\r
+\r
+       /**\r
+       * The collection of calendar week header cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       weekHeaderCells : null,\r
+\r
+       /**\r
+       * The collection of calendar week footer cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       weekFooterCells : null,\r
+       \r
+       /**\r
+       * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].\r
+       * @type Array[](Integer[])\r
+       */\r
+       cellDates : null,\r
+\r
+       /**\r
+       * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.\r
+       * @type String\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.\r
+       * @type HTMLElement\r
+       */\r
+       oDomContainer : null,\r
+\r
+       /**\r
+       * A Date object representing today's date.\r
+       * @type Date\r
+       */\r
+       today : null,\r
+\r
+       /**\r
+       * The list of render functions, along with required parameters, used to render cells. \r
+       * @type Array[]\r
+       */\r
+       renderStack : null,\r
+\r
+       /**\r
+       * A copy of the initial render functions created before rendering.\r
+       * @type Array\r
+       * @private\r
+       */\r
+       _renderStack : null,\r
+\r
+       /**\r
+       * A Date object representing the month/year that the calendar is currently set to\r
+       * @type Date\r
+       */\r
+       pageDate : null,\r
+\r
+       /**\r
+       * A Date object representing the month/year that the calendar is initially set to\r
+       * @type Date\r
+       * @private\r
+       */\r
+       _pageDate : null,\r
+       \r
+       /**\r
+       * A Date object representing the minimum selectable date\r
+       * @type Date\r
+       */\r
+       minDate : null,\r
+       \r
+       /**\r
+       * A Date object representing the maximum selectable date\r
+       * @type Date\r
+       */\r
+       maxDate : null,\r
+       \r
+       /**\r
+       * The list of currently selected dates. The data format for this local collection is \r
+       * an array of date field arrays, e.g:\r
+       * [\r
+       *       [2004,5,25],\r
+       *       [2004,5,26]\r
+       * ]\r
+       * @type Array[](Integer[])\r
+       */\r
+       selectedDates : null,\r
+\r
+       /**\r
+       * The private list of initially selected dates.\r
+       * @type Array\r
+       * @private\r
+       */\r
+       _selectedDates : null,\r
+\r
+       /**\r
+       * A boolean indicating whether the shell of the calendar has already been rendered to the page\r
+       * @type Boolean\r
+       */      \r
+       shellRendered : false,\r
+\r
+       /**\r
+       * The HTML table element that represents this calendar\r
+       * @type HTMLTableElement\r
+       */      \r
+       table : null,\r
+\r
+       /**\r
+       * The HTML cell element that represents the main header cell TH used in the calendar table\r
+       * @type HTMLTableCellElement\r
+       */      \r
+       headerCell : null\r
+};\r
+\r
+\r
+\r
+/**\r
+* Initializes the calendar widget. This method must be called by all subclass constructors.\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.init = function(id, containerId, monthyear, selected) {\r
+\r
+       this.logger = new YAHOO.widget.LogWriter("Calendar_Core " + id);        \r
+\r
+       this.setupConfig();\r
+\r
+       this.id = id;\r
+\r
+       this.cellDates = new Array();\r
+       \r
+       this.cells = new Array();\r
+       \r
+       this.renderStack = new Array();\r
+       this._renderStack = new Array();\r
+\r
+       this.oDomContainer = document.getElementById(containerId);\r
+       \r
+       if (! this.oDomContainer) {\r
+               this.logger.log("No valid container present.", "error");\r
+       }\r
+\r
+       this.today = new Date();\r
+       YAHOO.widget.DateMath.clearTime(this.today);\r
+\r
+       var month;\r
+       var year;\r
+\r
+       if (monthyear) {\r
+               var aMonthYear = monthyear.split(this.Locale.DATE_FIELD_DELIMITER);\r
+               month = parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);\r
+               year = parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);\r
+       } else {\r
+               month = this.today.getMonth()+1;\r
+               year = this.today.getFullYear();\r
+       }\r
+\r
+       this.logger.log("Initialized with month/year of " + month + "/" + year, "info");\r
+\r
+       this.pageDate = new Date(year, month-1, 1);\r
+       this._pageDate = new Date(this.pageDate.getTime());\r
+\r
+       if (selected) {\r
+               this.selectedDates = this._parseDates(selected);\r
+               this._selectedDates = this.selectedDates.concat();\r
+       } else {\r
+               this.selectedDates = new Array();\r
+               this._selectedDates = new Array();\r
+       }\r
+\r
+       this.wireDefaultEvents();\r
+       this.wireCustomEvents();\r
+};\r
+\r
+\r
+/**\r
+* Wires the local DOM events for the Calendar, including cell selection, hover, and\r
+* default navigation that is used for moving back and forth between calendar pages.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents = function() {\r
+       \r
+       /**\r
+       * The default event function that is attached to a date link within a calendar cell\r
+       * when the calendar is rendered. \r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       */\r
+       this.doSelectCell = function(e, cal) {          \r
+               var cell = this;\r
+               var index = cell.index;\r
+\r
+               cal.logger.log("Selecting cell " + index + " via click", "info");\r
+\r
+               var d = cal.cellDates[index];\r
+               var date = new Date(d[0],d[1]-1,d[2]);\r
+               \r
+               if (! cal.isDateOOM(date) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_RESTRICTED) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_OOB)) {\r
+                       if (cal.Options.MULTI_SELECT) {\r
+                               var link = cell.getElementsByTagName("A")[0];\r
+                               link.blur();\r
+                               \r
+                               var cellDate = cal.cellDates[index];\r
+                               var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);\r
+                               \r
+                               if (cellDateIndex > -1) {       \r
+                                       cal.deselectCell(index);\r
+                               } else {\r
+                                       cal.selectCell(index);\r
+                               }       \r
+                               \r
+                       } else {\r
+                               var link = cell.getElementsByTagName("A")[0];\r
+                               link.blur()\r
+                               cal.selectCell(index);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+       * The event that is executed when the user hovers over a cell\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */\r
+       this.doCellMouseOver = function(e, cal) {\r
+               var cell = this;\r
+               var index = cell.index;\r
+               var d = cal.cellDates[index];\r
+               var date = new Date(d[0],d[1]-1,d[2]);\r
+\r
+               if (! cal.isDateOOM(date) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_RESTRICTED) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_OOB)) {\r
+                       YAHOO.util.Dom.addClass(cell, cal.Style.CSS_CELL_HOVER);\r
+               }\r
+       }\r
+\r
+       /**\r
+       * The event that is executed when the user moves the mouse out of a cell\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */\r
+       this.doCellMouseOut = function(e, cal) {\r
+               YAHOO.util.Dom.removeClass(this, cal.Style.CSS_CELL_HOVER);\r
+       }\r
+       \r
+       /**\r
+       * A wrapper event that executes the nextMonth method through a DOM event\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */      \r
+       this.doNextMonth = function(e, cal) {\r
+               cal.nextMonth();\r
+       }\r
+\r
+       /**\r
+       * A wrapper event that executes the previousMonth method through a DOM event\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */              \r
+       this.doPreviousMonth = function(e, cal) {\r
+               cal.previousMonth();\r
+       }\r
+}\r
+\r
+/**\r
+* This function can be extended by subclasses to attach additional DOM events to\r
+* the calendar. By default, this method is unimplemented.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.wireCustomEvents = function() { }\r
+\r
+/**\r
+This method is called to initialize the widget configuration variables, including\r
+style, localization, and other display and behavioral options.\r
+<p>Config: Container for the CSS style configuration variables.</p>\r
+<p><strong>Config.Style</strong> - Defines the CSS classes used for different calendar elements</p>\r
+<blockquote>\r
+       <div><em>CSS_CALENDAR</em> : Container table</div>\r
+       <div><em>CSS_HEADER</em> : </div>\r
+       <div><em>CSS_HEADER_TEXT</em> : Calendar header</div>\r
+       <div><em>CSS_FOOTER</em> : Calendar footer</div>\r
+       <div><em>CSS_CELL</em> : Calendar day cell</div>\r
+       <div><em>CSS_CELL_OOM</em> : Calendar OOM (out of month) cell</div>\r
+       <div><em>CSS_CELL_SELECTED</em> : Calendar selected cell</div>\r
+       <div><em>CSS_CELL_RESTRICTED</em> : Calendar restricted cell</div>\r
+       <div><em>CSS_CELL_TODAY</em> : Calendar cell for today's date</div>\r
+       <div><em>CSS_ROW_HEADER</em> : The cell preceding a row (used for week number by default)</div>\r
+       <div><em>CSS_ROW_FOOTER</em> : The cell following a row (not implemented by default)</div>\r
+       <div><em>CSS_WEEKDAY_CELL</em> : The cells used for labeling weekdays</div>\r
+       <div><em>CSS_WEEKDAY_ROW</em> : The row containing the weekday label cells</div>\r
+       <div><em>CSS_CONTAINER</em> : The border style used for the default UED rendering</div>\r
+       <div><em>CSS_2UPWRAPPER</em> : Special container class used to properly adjust the sizing and float</div>\r
+       <div><em>CSS_NAV_LEFT</em> : Left navigation arrow</div>\r
+       <div><em>CSS_NAV_RIGHT</em> : Right navigation arrow</div>\r
+       <div><em>CSS_CELL_TOP</em> : Outlying cell along the top row</div>\r
+       <div><em>CSS_CELL_LEFT</em> : Outlying cell along the left row</div>\r
+       <div><em>CSS_CELL_RIGHT</em> : Outlying cell along the right row</div>\r
+       <div><em>CSS_CELL_BOTTOM</em> : Outlying cell along the bottom row</div>\r
+       <div><em>CSS_CELL_HOVER</em> : Cell hover style</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT1</em> : Highlight color 1 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT2</em> : Highlight color 2 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT3</em> : Highlight color 3 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT4</em> : Highlight color 4 for styling cells</div>\r
+\r
+</blockquote>\r
+<p><strong>Config.Locale</strong> - Defines the locale string arrays used for localization</p>\r
+<blockquote>\r
+       <div><em>MONTHS_SHORT</em> : Array of 12 months in short format ("Jan", "Feb", etc.)</div>\r
+       <div><em>MONTHS_LONG</em> : Array of 12 months in short format ("Jan", "Feb", etc.)</div>\r
+       <div><em>WEEKDAYS_1CHAR</em> : Array of 7 days in 1-character format ("S", "M", etc.)</div>\r
+       <div><em>WEEKDAYS_SHORT</em> : Array of 7 days in short format ("Su", "Mo", etc.)</div>\r
+       <div><em>WEEKDAYS_MEDIUM</em> : Array of 7 days in medium format ("Sun", "Mon", etc.)</div>\r
+       <div><em>WEEKDAYS_LONG</em> : Array of 7 days in long format ("Sunday", "Monday", etc.)</div>\r
+       <div><em>DATE_DELIMITER</em> : The value used to delimit series of multiple dates (Default: ",")</div>\r
+       <div><em>DATE_FIELD_DELIMITER</em> : The value used to delimit date fields (Default: "/")</div>\r
+       <div><em>DATE_RANGE_DELIMITER</em> : The value used to delimit date fields (Default: "-")</div>\r
+       <div><em>MY_MONTH_POSITION</em> : The value used to determine the position of the month in a month/year combo (e.g. 12/2005) (Default: 1)</div>\r
+       <div><em>MY_YEAR_POSITION</em> : The value used to determine the position of the year in a month/year combo (e.g. 12/2005) (Default: 2)</div>   \r
+       <div><em>MD_MONTH_POSITION</em> : The value used to determine the position of the month in a month/day combo (e.g. 12/25) (Default: 1)</div>\r
+       <div><em>MD_DAY_POSITION</em> : The value used to determine the position of the day in a month/day combo (e.g. 12/25) (Default: 2)</div>\r
+       <div><em>MDY_MONTH_POSITION</em> : The value used to determine the position of the month in a month/day/year combo (e.g. 12/25/2005) (Default: 1)</div>\r
+       <div><em>MDY_DAY_POSITION</em> : The value used to determine the position of the day in a month/day/year combo (e.g. 12/25/2005) (Default: 2)</div>\r
+       <div><em>MDY_YEAR_POSITION</em> : The value used to determine the position of the year in a month/day/year combo (e.g. 12/25/2005) (Default: 3)</div>\r
+</blockquote>\r
+<p><strong>Config.Options</strong> - Defines other configurable calendar widget options</p>\r
+<blockquote>\r
+       <div><em>SHOW_WEEKDAYS</em> : Boolean, determines whether to display the weekday headers (defaults to true)</div>\r
+       <div><em>LOCALE_MONTHS</em> : Array, points to the desired Config.Locale array (defaults to Config.Locale.MONTHS_LONG)</div>\r
+       <div><em>LOCALE_WEEKDAYS</em> : Array, points to the desired Config.Locale array (defaults to Config.Locale.WEEKDAYS_SHORT)</div>\r
+       <div><em>START_WEEKDAY</em> : Integer, 0-6, representing the day that a week begins on</div>\r
+       <div><em>SHOW_WEEK_HEADER</em> : Boolean, determines whether to display row headers</div>\r
+       <div><em>SHOW_WEEK_FOOTER</em> : Boolean, determines whether to display row footers</div>\r
+       <div><em>HIDE_BLANK_WEEKS</em> : Boolean, determines whether to hide extra weeks that are completely OOM</div>\r
+       <div><em>NAV_ARROW_LEFT</em> : String, the image path used for the left navigation arrow</div>\r
+       <div><em>NAV_ARROW_RIGHT</em> : String, the image path used for the right navigation arrow</div>\r
+</blockquote>\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setupConfig = function() {\r
+       /**\r
+       * Container for the CSS style configuration variables.\r
+       */\r
+       this.Config = new Object();\r
+       \r
+       this.Config.Style = {\r
+               // Style variables\r
+               CSS_ROW_HEADER: "calrowhead",\r
+               CSS_ROW_FOOTER: "calrowfoot",\r
+               CSS_CELL : "calcell",\r
+               CSS_CELL_SELECTED : "selected",\r
+               CSS_CELL_RESTRICTED : "restricted",\r
+               CSS_CELL_TODAY : "today",\r
+               CSS_CELL_OOM : "oom",\r
+               CSS_CELL_OOB : "previous",\r
+               CSS_HEADER : "calheader",\r
+               CSS_HEADER_TEXT : "calhead",\r
+               CSS_WEEKDAY_CELL : "calweekdaycell",\r
+               CSS_WEEKDAY_ROW : "calweekdayrow",\r
+               CSS_FOOTER : "calfoot",\r
+               CSS_CALENDAR : "yui-calendar",\r
+               CSS_CONTAINER : "yui-calcontainer",\r
+               CSS_2UPWRAPPER : "yui-cal2upwrapper", \r
+               CSS_NAV_LEFT : "calnavleft",\r
+               CSS_NAV_RIGHT : "calnavright",\r
+               CSS_CELL_TOP : "calcelltop",\r
+               CSS_CELL_LEFT : "calcellleft",\r
+               CSS_CELL_RIGHT : "calcellright",\r
+               CSS_CELL_BOTTOM : "calcellbottom",\r
+               CSS_CELL_HOVER : "calcellhover",\r
+               CSS_CELL_HIGHLIGHT1 : "highlight1",\r
+               CSS_CELL_HIGHLIGHT2 : "highlight2",\r
+               CSS_CELL_HIGHLIGHT3 : "highlight3",\r
+               CSS_CELL_HIGHLIGHT4 : "highlight4"\r
+       };\r
+\r
+       this.Style = this.Config.Style;\r
+\r
+       this.Config.Locale = {\r
+               // Locale definition\r
+               MONTHS_SHORT : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],\r
+               MONTHS_LONG : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],\r
+               WEEKDAYS_1CHAR : ["S", "M", "T", "W", "T", "F", "S"],\r
+               WEEKDAYS_SHORT : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],\r
+               WEEKDAYS_MEDIUM : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],\r
+               WEEKDAYS_LONG : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],\r
+               DATE_DELIMITER : ",",\r
+               DATE_FIELD_DELIMITER : "/",\r
+               DATE_RANGE_DELIMITER : "-",\r
+               MY_MONTH_POSITION : 1,\r
+               MY_YEAR_POSITION : 2,\r
+               MD_MONTH_POSITION : 1,\r
+               MD_DAY_POSITION : 2,\r
+               MDY_MONTH_POSITION : 1,\r
+               MDY_DAY_POSITION : 2,\r
+               MDY_YEAR_POSITION : 3\r
+       };\r
+\r
+       this.Locale = this.Config.Locale;\r
+\r
+       this.Config.Options = {\r
+               // Configuration variables\r
+               MULTI_SELECT : false,\r
+               SHOW_WEEKDAYS : true,\r
+               START_WEEKDAY : 0,\r
+               SHOW_WEEK_HEADER : false,\r
+               SHOW_WEEK_FOOTER : false,\r
+               HIDE_BLANK_WEEKS : false,\r
+               NAV_ARROW_LEFT : YAHOO.widget.Calendar_Core.IMG_ROOT + "us/tr/callt.gif",\r
+               NAV_ARROW_RIGHT : YAHOO.widget.Calendar_Core.IMG_ROOT + "us/tr/calrt.gif"\r
+       };\r
+\r
+       this.Options = this.Config.Options;\r
+\r
+       this.customConfig();\r
+\r
+       if (! this.Options.LOCALE_MONTHS) {\r
+               this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;\r
+       }\r
+       if (! this.Options.LOCALE_WEEKDAYS) {\r
+               this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;\r
+       }\r
+\r
+       // If true, reconfigure weekday arrays to place Mondays first\r
+       if (this.Options.START_WEEKDAY > 0) {\r
+               for (var w=0;w<this.Options.START_WEEKDAY;++w) {\r
+                       this.Locale.WEEKDAYS_SHORT.push(this.Locale.WEEKDAYS_SHORT.shift());\r
+                       this.Locale.WEEKDAYS_MEDIUM.push(this.Locale.WEEKDAYS_MEDIUM.shift());\r
+                       this.Locale.WEEKDAYS_LONG.push(this.Locale.WEEKDAYS_LONG.shift());              \r
+               }\r
+       }\r
+};\r
+\r
+/**\r
+* This method is called when subclasses need to override configuration variables\r
+* or create new ones. Values can be explicitly set as follows:\r
+* <blockquote><code>\r
+*      this.Config.Style.CSS_CELL = "newcalcell";\r
+*      this.Config.Locale.MONTHS_SHORT = ["Jan", "Fv", "Mars", "Avr", "Mai", "Juin", "Juil", "Aot", "Sept", "Oct", "Nov", "Dc"];\r
+* </code></blockquote>\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.customConfig = function() { };\r
+\r
+/**\r
+* Builds the date label that will be displayed in the calendar header or\r
+* footer, depending on configuration.\r
+* @return      The formatted calendar month label\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildMonthLabel = function() {\r
+       var text = this.Options.LOCALE_MONTHS[this.pageDate.getMonth()] + " " + this.pageDate.getFullYear();\r
+       return text;\r
+};\r
+\r
+/**\r
+* Builds the date digit that will be displayed in calendar cells\r
+* @return      The formatted day label\r
+* @type        String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildDayLabel = function(workingDate) {\r
+       var day = workingDate.getDate();\r
+       return day;\r
+};\r
+\r
+\r
+\r
+/**\r
+* Builds the calendar table shell that will be filled in with dates and formatting.\r
+* This method calls buildShellHeader, buildShellBody, and buildShellFooter (in that order) \r
+* to construct the pieces of the calendar table. The construction of the shell should\r
+* only happen one time when the calendar is initialized.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShell = function() {\r
+       \r
+       this.table = document.createElement("TABLE");\r
+       this.table.cellSpacing = 0;     \r
+       YAHOO.widget.Calendar_Core.setCssClasses(this.table, [this.Style.CSS_CALENDAR]);\r
+\r
+       this.table.id = this.id;\r
+       \r
+       this.buildShellHeader();\r
+       this.buildShellBody();\r
+       this.buildShellFooter();\r
+       \r
+       YAHOO.util.Event.addListener(window, "unload", this._unload, this);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell header by inserting a THEAD into the local calendar table.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellHeader = function() {\r
+       var head = document.createElement("THEAD");\r
+       var headRow = document.createElement("TR");\r
+\r
+       var headerCell = document.createElement("TH");\r
+       \r
+       var colSpan = 7;\r
+       if (this.Config.Options.SHOW_WEEK_HEADER) {\r
+               this.weekHeaderCells = new Array();\r
+               colSpan += 1;\r
+       }\r
+       if (this.Config.Options.SHOW_WEEK_FOOTER) {\r
+               this.weekFooterCells = new Array();\r
+               colSpan += 1;\r
+       }       \r
+       \r
+       headerCell.colSpan = colSpan;\r
+       \r
+       YAHOO.widget.Calendar_Core.setCssClasses(headerCell,[this.Style.CSS_HEADER_TEXT]);\r
+\r
+       this.headerCell = headerCell;\r
+\r
+       headRow.appendChild(headerCell);\r
+       head.appendChild(headRow);\r
+\r
+       // Append day labels, if needed\r
+       if (this.Options.SHOW_WEEKDAYS) {\r
+               var row = document.createElement("TR");\r
+               var fillerCell;\r
+\r
+               YAHOO.widget.Calendar_Core.setCssClasses(row,[this.Style.CSS_WEEKDAY_ROW]);\r
+               \r
+               if (this.Config.Options.SHOW_WEEK_HEADER) {\r
+                       fillerCell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       row.appendChild(fillerCell);\r
+               }\r
+               \r
+               for(var i=0;i<this.Options.LOCALE_WEEKDAYS.length;++i) {\r
+                       var cell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       cell.innerHTML=this.Options.LOCALE_WEEKDAYS[i];\r
+                       row.appendChild(cell);\r
+               }\r
+\r
+               if (this.Config.Options.SHOW_WEEK_FOOTER) {\r
+                       fillerCell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       row.appendChild(fillerCell);\r
+               }\r
+                               \r
+               head.appendChild(row);\r
+       }\r
+\r
+       this.table.appendChild(head);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell body (6 weeks by 7 days)\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellBody = function() {\r
+       // This should only get executed once\r
+       this.tbody = document.createElement("TBODY");\r
+\r
+       for (var r=0;r<6;++r) {\r
+               var row = document.createElement("TR");\r
+               \r
+               for (var c=0;c<this.headerCell.colSpan;++c) {\r
+                       var cell;\r
+                       if (this.Config.Options.SHOW_WEEK_HEADER && c===0) { // Row header\r
+                               cell = document.createElement("TH");\r
+                               this.weekHeaderCells[this.weekHeaderCells.length] = cell;\r
+                       } else if (this.Config.Options.SHOW_WEEK_FOOTER && c==(this.headerCell.colSpan-1)){ // Row footer\r
+                               cell = document.createElement("TH");\r
+                               this.weekFooterCells[this.weekFooterCells.length] = cell;\r
+                       } else {\r
+                               cell = document.createElement("TD");\r
+                               this.cells[this.cells.length] = cell;\r
+                               YAHOO.widget.Calendar_Core.setCssClasses(cell, [this.Style.CSS_CELL]);\r
+                               YAHOO.util.Event.addListener(cell, "click", this.doSelectCell, this);\r
+\r
+                               YAHOO.util.Event.addListener(cell, "mouseover", this.doCellMouseOver, this);\r
+                               YAHOO.util.Event.addListener(cell, "mouseout", this.doCellMouseOut, this);\r
+                       }\r
+                       row.appendChild(cell);\r
+               }\r
+               this.tbody.appendChild(row);\r
+       }\r
+       \r
+       this.table.appendChild(this.tbody);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell footer. In the default implementation, there is\r
+* no footer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellFooter = function() { };\r
+\r
+/**\r
+* Outputs the calendar shell to the DOM, inserting it into the placeholder element.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderShell = function() {\r
+       this.oDomContainer.appendChild(this.table);\r
+       this.shellRendered = true;\r
+};\r
+\r
+/**\r
+* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute\r
+* when the method is called: renderHeader, renderBody, renderFooter.\r
+* Refer to the documentation for those methods for information on \r
+* individual render tasks.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.render = function() {\r
+       if (! this.shellRendered) {\r
+               this.buildShell();\r
+               this.renderShell();\r
+       }\r
+\r
+       this.resetRenderers();\r
+\r
+       this.cellDates.length = 0;\r
+\r
+       // Find starting day of the current month\r
+       var workingDate = YAHOO.widget.DateMath.findMonthStart(this.pageDate);\r
+\r
+       this.renderHeader();\r
+       this.renderBody(workingDate);\r
+       this.renderFooter();\r
+\r
+       this.onRender();\r
+};\r
+\r
+\r
+\r
+/**\r
+* Appends the header contents into the widget header.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderHeader = function() {\r
+       this.logger.log("Rendering header", "info");\r
+\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+/**\r
+* Appends the calendar body. The default implementation calculates the number of\r
+* OOM (out of month) cells that need to be rendered at the start of the month, renders those, \r
+* and renders all the day cells using the built-in cell rendering methods.\r
+*\r
+* While iterating through all of the cells, the calendar checks for renderers in the\r
+* local render stack that match the date of the current cell, and then applies styles\r
+* as necessary.\r
+* \r
+* @param {Date}        workingDate     The current working Date object being used to generate the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderBody = function(workingDate) {\r
+       this.logger.log("Rendering body", "info");\r
+\r
+       this.preMonthDays = workingDate.getDay();\r
+       if (this.Options.START_WEEKDAY > 0) {\r
+               this.preMonthDays -= this.Options.START_WEEKDAY;\r
+       }\r
+       if (this.preMonthDays < 0) {\r
+               this.preMonthDays += 7;\r
+       }\r
+       \r
+       this.logger.log(this.preMonthDays + " preciding out-of-month days", "info");\r
+\r
+       this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();\r
+       this.logger.log(this.monthDays + " month days", "info");\r
+\r
+       this.postMonthDays = YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;\r
+       this.logger.log(this.postMonthDays + " post-month days", "info");\r
+       \r
+       workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);\r
+       this.logger.log("Calendar page starts on " + workingDate, "info");\r
+       \r
+       var weekRowIndex = 0;\r
+       \r
+       for (var c=0;c<this.cells.length;++c) {\r
+               var cellRenderers = new Array();\r
+               \r
+               var cell = this.cells[c];\r
+               this.clearElement(cell);\r
+\r
+               cell.index = c;\r
+               cell.id = this.id + "_cell" + c;\r
+               \r
+               this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates\r
+\r
+               if (workingDate.getDay() == this.Options.START_WEEKDAY) {\r
+                       var rowHeaderCell = null;\r
+                       var rowFooterCell = null;\r
+                       \r
+                       if (this.Options.SHOW_WEEK_HEADER) {\r
+                               rowHeaderCell = this.weekHeaderCells[weekRowIndex];\r
+                               this.clearElement(rowHeaderCell);\r
+                       }\r
+                       \r
+                       if (this.Options.SHOW_WEEK_FOOTER) {\r
+                               rowFooterCell = this.weekFooterCells[weekRowIndex];\r
+                               this.clearElement(rowFooterCell);\r
+                       }                       \r
+                       \r
+                       if (this.Options.HIDE_BLANK_WEEKS && this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+                               // The first day of the week is not in this month, and it's not an overlap week\r
+                               continue;\r
+                       } else {\r
+                               if (rowHeaderCell) {\r
+                                       this.renderRowHeader(workingDate, rowHeaderCell);\r
+                               }\r
+                               if (rowFooterCell) {\r
+                                       this.renderRowFooter(workingDate, rowFooterCell);\r
+                               }       \r
+                       }\r
+               }\r
+\r
+               this.logger.log("Rendering cell " + cell.id + " (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");\r
+\r
+               var renderer = null;\r
+               \r
+               if (workingDate.getFullYear()   == this.today.getFullYear() &&\r
+                       workingDate.getMonth()          == this.today.getMonth() &&\r
+                       workingDate.getDate()           == this.today.getDate()) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellStyleToday;\r
+               }\r
+               \r
+               if (this.isDateOOM(workingDate)) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellNotThisMonth;\r
+               } else {\r
+                       for (var r=0;r<this.renderStack.length;++r) {\r
+                               var rArray = this.renderStack[r];\r
+                               var type = rArray[0];\r
+                               \r
+                               var month;\r
+                               var day;\r
+                               var year;\r
+\r
+                               switch (type) {\r
+                                       case YAHOO.widget.Calendar_Core.DATE:\r
+                                               month = rArray[1][1];\r
+                                               day = rArray[1][2];\r
+                                               year = rArray[1][0];\r
+\r
+                                               if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {\r
+                                                       renderer = rArray[2];\r
+                                                       this.renderStack.splice(r,1);\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.MONTH_DAY:\r
+                                               month = rArray[1][0];\r
+                                               day = rArray[1][1];\r
+                                               \r
+                                               if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {\r
+                                                       renderer = rArray[2];\r
+                                                       this.renderStack.splice(r,1);\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.RANGE:\r
+                                               var date1 = rArray[1][0];\r
+                                               var date2 = rArray[1][1];\r
+\r
+                                               var d1month = date1[1];\r
+                                               var d1day = date1[2];\r
+                                               var d1year = date1[0];\r
+                                               \r
+                                               var d1 = new Date(d1year, d1month-1, d1day);\r
+\r
+                                               var d2month = date2[1];\r
+                                               var d2day = date2[2];\r
+                                               var d2year = date2[0];\r
+\r
+                                               var d2 = new Date(d2year, d2month-1, d2day);\r
+\r
+                                               if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {\r
+                                                       renderer = rArray[2];\r
+\r
+                                                       if (workingDate.getTime()==d2.getTime()) { \r
+                                                               this.renderStack.splice(r,1);\r
+                                                       }\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.WEEKDAY:\r
+                                               \r
+                                               var weekday = rArray[1][0];\r
+                                               if (workingDate.getDay()+1 == weekday) {\r
+                                                       renderer = rArray[2];\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.MONTH:\r
+                                               \r
+                                               month = rArray[1][0];\r
+                                               if (workingDate.getMonth()+1 == month) {\r
+                                                       renderer = rArray[2];\r
+                                               }\r
+                                               break;\r
+                               }\r
+                               \r
+                               if (renderer) {\r
+                                       cellRenderers[cellRenderers.length]=renderer;\r
+                               }\r
+                       }\r
+\r
+               }\r
+\r
+               if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellStyleSelected; \r
+               }\r
+\r
+               if (this.minDate) {\r
+                       this.minDate = YAHOO.widget.DateMath.clearTime(this.minDate);\r
+               }\r
+               if (this.maxDate) {\r
+                       this.maxDate = YAHOO.widget.DateMath.clearTime(this.maxDate);\r
+               }\r
+\r
+               if (\r
+                       (this.minDate && (workingDate.getTime() < this.minDate.getTime())) ||\r
+                       (this.maxDate && (workingDate.getTime() > this.maxDate.getTime()))\r
+               ) {\r
+                       cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;\r
+               } else {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellDefault;     \r
+               }\r
+               \r
+               for (var x=0;x<cellRenderers.length;++x) {\r
+                       var ren = cellRenderers[x];\r
+                       this.logger.log("renderer[" + x + "] for (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");\r
+\r
+                       if (ren.call(this,workingDate,cell) == YAHOO.widget.Calendar_Core.STOP_RENDER) {\r
+                               break;\r
+                       }\r
+               }\r
+               \r
+               workingDate = YAHOO.widget.DateMath.add(workingDate, YAHOO.widget.DateMath.DAY, 1); // Go to the next day\r
+               if (workingDate.getDay() == this.Options.START_WEEKDAY) {\r
+                       weekRowIndex += 1;\r
+               }\r
+\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);\r
+\r
+               if (c >= 0 && c <= 6) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);\r
+               }\r
+               if ((c % 7) == 0) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);\r
+               }\r
+               if (((c+1) % 7) == 0) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);\r
+               }\r
+               \r
+               var postDays = this.postMonthDays; \r
+               if (postDays >= 7 && this.Options.HIDE_BLANK_WEEKS) {\r
+                       var blankWeeks = Math.floor(postDays/7);\r
+                       for (var p=0;p<blankWeeks;++p) {\r
+                               postDays -= 7;\r
+                       }\r
+               }\r
+               \r
+               if (c >= ((this.preMonthDays+postDays+this.monthDays)-7)) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);\r
+               }\r
+       \r
+               this.logger.log("Final styles for (" + workingDate.getFullYear() + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + "): " + cell.className, "cellrender");\r
+\r
+       }\r
+               \r
+};\r
+\r
+/**\r
+* Appends the contents of the calendar widget footer into the shell. By default, \r
+* the calendar does not contain a footer, and this method must be implemented by \r
+* subclassing the widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderFooter = function() { };\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._unload = function(e, cal) {\r
+       for (var c in cal.cells) {\r
+               c = null;\r
+       }\r
+       \r
+       cal.cells = null;\r
+       \r
+       cal.tbody = null;\r
+       cal.oDomContainer = null;\r
+       cal.table = null;\r
+       cal.headerCell = null;\r
+       \r
+       cal = null;\r
+};\r
+                                                                                                 \r
+                                                                                                 \r
+/****************** BEGIN BUILT-IN TABLE CELL RENDERERS ************************************/\r
+\r
+YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);\r
+       cell.innerHTML = workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+}\r
+\r
+/**\r
+* Renders the row header for a week. The date passed in should be\r
+* the first date of the given week.\r
+* @param {Date}                                        workingDate             The current working Date object (beginning of the week) being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderRowHeader = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_ROW_HEADER);\r
+       \r
+       var useYear = this.pageDate.getFullYear();\r
+       \r
+       if (! YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)) {\r
+               useYear = workingDate.getFullYear();\r
+       }\r
+       \r
+       var weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useYear, this.Options.START_WEEKDAY);\r
+       cell.innerHTML = weekNum;\r
+       \r
+       if (this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM); \r
+       }\r
+};\r
+\r
+/**\r
+* Renders the row footer for a week. The date passed in should be\r
+* the first date of the given week.\r
+* @param {Date}                                        workingDate             The current working Date object (beginning of the week) being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderRowFooter = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_ROW_FOOTER);\r
+       \r
+       if (this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM); \r
+       }\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell in the calendar widget table.\r
+* All logic for determining how a standard default cell will be rendered is \r
+* encapsulated in this method, and must be accounted for when extending the\r
+* widget class.\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellDefault = function(workingDate, cell) {\r
+       cell.innerHTML = "";\r
+       var link = document.createElement("a");\r
+\r
+       link.href="javascript:void(null);";\r
+       link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();\r
+\r
+       link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));\r
+       cell.appendChild(link);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight1 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight2 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight3 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight4 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering today's date to the current calendar cell\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering selected dates to the current calendar cell\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering dates that are not a part of the current\r
+* month (preceding or trailing the cells for the current month)\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);\r
+       cell.innerHTML=workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+};\r
+\r
+/**\r
+* Renders the current calendar cell as a non-selectable "black-out" date using the default\r
+* restricted style.\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted = function(workingDate, cell) {\r
+       YAHOO.widget.Calendar_Core.setCssClasses(cell, [this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);\r
+       cell.innerHTML=workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+};\r
+/******************** END BUILT-IN TABLE CELL RENDERERS ************************************/\r
+\r
+/******************** BEGIN MONTH NAVIGATION METHODS ************************************/\r
+/**\r
+* Adds the designated number of months to the current calendar month, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of months to add to the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addMonths = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.add(this.pageDate, YAHOO.widget.DateMath.MONTH, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Subtracts the designated number of months from the current calendar month, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of months to subtract from the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.subtractMonths = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.subtract(this.pageDate, YAHOO.widget.DateMath.MONTH, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Adds the designated number of years to the current calendar, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of years to add to the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addYears = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.add(this.pageDate, YAHOO.widget.DateMath.YEAR, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Subtcats the designated number of years from the current calendar, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of years to subtract from the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.subtractYears = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.subtract(this.pageDate, YAHOO.widget.DateMath.YEAR, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Navigates to the next month page in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.nextMonth = function() {\r
+       this.addMonths(1);\r
+};\r
+\r
+/**\r
+* Navigates to the previous month page in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.previousMonth = function() {\r
+       this.subtractMonths(1);\r
+};\r
+\r
+/**\r
+* Navigates to the next year in the currently selected month in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.nextYear = function() {\r
+       this.addYears(1);\r
+};\r
+\r
+/**\r
+* Navigates to the previous year in the currently selected month in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.previousYear = function() {\r
+       this.subtractYears(1);\r
+};\r
+\r
+/****************** END MONTH NAVIGATION METHODS ************************************/\r
+\r
+/************* BEGIN SELECTION METHODS *************************************************************/\r
+\r
+/**\r
+* Resets the calendar widget to the originally selected month and year, and \r
+* sets the calendar to the initial selection(s).\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.reset = function() {\r
+       this.selectedDates.length = 0;\r
+       this.selectedDates = this._selectedDates.concat();\r
+\r
+       this.pageDate = new Date(this._pageDate.getTime());\r
+       this.onReset();\r
+};\r
+\r
+/**\r
+* Clears the selected dates in the current calendar widget and sets the calendar\r
+* to the current month and year.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.clear = function() {\r
+       this.selectedDates.length = 0;\r
+       this.pageDate = new Date(this.today.getTime());\r
+       this.onClear();\r
+};\r
+\r
+/**\r
+* Selects a date or a collection of dates on the current calendar. This method, by default,\r
+* does not call the render method explicitly. Once selection has completed, render must be \r
+* called for the changes to be reflected visually.\r
+* @param       {String/Date/Date[]}    date    The date string of dates to select in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects.\r
+* @return                                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.select = function(date) {\r
+       this.onBeforeSelect();\r
+       this.logger.log("Select: " + date, "info");\r
+\r
+       var aToBeSelected = this._toFieldArray(date);\r
+       this.logger.log("Selection field array: " + aToBeSelected, "info");\r
+\r
+       for (var a=0;a<aToBeSelected.length;++a) {\r
+               var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select\r
+               if (this._indexOfSelectedFieldArray(toSelect) == -1) { // not already selected?\r
+                       this.selectedDates[this.selectedDates.length]=toSelect;\r
+               }\r
+       }\r
+       \r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.onSelect();\r
+\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Selects a date on the current calendar by referencing the index of the cell that should be selected.\r
+* This method is used to easily select a single cell (usually with a mouse click) without having to do\r
+* a full render. The selected style is applied to the cell directly.\r
+* @param       {Integer}       cellIndex       The index of the cell to select in the current calendar. \r
+* @return                                                      Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.selectCell = function(cellIndex) {\r
+       this.onBeforeSelect();\r
+\r
+       this.cells = this.tbody.getElementsByTagName("TD");\r
+\r
+       var cell = this.cells[cellIndex];\r
+       var cellDate = this.cellDates[cellIndex];\r
+\r
+       var dCellDate = this._toDate(cellDate);\r
+       this.logger.log("Select: " + dCellDate, "info");\r
+\r
+       var selectDate = cellDate.concat();\r
+\r
+       this.selectedDates.push(selectDate);\r
+       \r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.renderCellStyleSelected(dCellDate,cell);\r
+\r
+       this.onSelect();\r
+       this.doCellMouseOut.call(cell, null, this);\r
+\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects a date or a collection of dates on the current calendar. This method, by default,\r
+* does not call the render method explicitly. Once deselection has completed, render must be \r
+* called for the changes to be reflected visually.\r
+* @param       {String/Date/Date[]}    date    The date string of dates to deselect in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects. \r
+* @return                                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselect = function(date) {\r
+       this.onBeforeDeselect();\r
+\r
+       var aToBeSelected = this._toFieldArray(date);\r
+\r
+       this.logger.log("Select: " + aToBeSelected, "info");\r
+\r
+       for (var a=0;a<aToBeSelected.length;++a) {\r
+               var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select\r
+               var index = this._indexOfSelectedFieldArray(toSelect);\r
+       \r
+               if (index != -1) {      \r
+                       this.selectedDates.splice(index,1);\r
+               }\r
+       }\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       } \r
+\r
+       this.onDeselect();\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects a date on the current calendar by referencing the index of the cell that should be deselected.\r
+* This method is used to easily deselect a single cell (usually with a mouse click) without having to do\r
+* a full render. The selected style is removed from the cell directly.\r
+* @param       {Integer}       cellIndex       The index of the cell to deselect in the current calendar. \r
+* @return                                                      Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselectCell = function(i) {\r
+       this.onBeforeDeselect();\r
+       this.cells = this.tbody.getElementsByTagName("TD");\r
+\r
+       var cell = this.cells[i];\r
+       var cellDate = this.cellDates[i];\r
+       var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);\r
+\r
+       var dCellDate = this._toDate(cellDate);\r
+       this.logger.log("Deselect: " + dCellDate, "info");\r
+\r
+       var selectDate = cellDate.concat();\r
+\r
+       if (cellDateIndex > -1) {\r
+               if (this.pageDate.getMonth() == dCellDate.getMonth() &&\r
+                       this.pageDate.getFullYear() == dCellDate.getFullYear()) {\r
+                       YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);\r
+               }\r
+\r
+               this.selectedDates.splice(cellDateIndex, 1);\r
+       }\r
+\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.onDeselect();\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects all dates on the current calendar.\r
+* @return                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+*                                              Assuming that this function executes properly, the return value should be an empty array.\r
+*                                              However, the empty array is returned for the sake of being able to check the selection status\r
+*                                              of the calendar.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselectAll = function() {\r
+       this.onBeforeDeselect();\r
+       var count = this.selectedDates.length;\r
+       this.selectedDates.length = 0;\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+       \r
+       if (count > 0) {\r
+               this.onDeselect();\r
+       }\r
+\r
+       return this.getSelectedDates();\r
+};\r
+/************* END SELECTION METHODS *************************************************************/\r
+\r
+\r
+/************* BEGIN TYPE CONVERSION METHODS ****************************************************/\r
+\r
+/**\r
+* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure\r
+* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].\r
+* @private\r
+* @param       {String/Date/Date[]}    date    The date string of dates to deselect in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects. \r
+* @return                                              Array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._toFieldArray = function(date) {\r
+       var returnDate = new Array();\r
+\r
+       if (date instanceof Date) {\r
+               returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];\r
+       } else if (typeof date == 'string') {\r
+               returnDate = this._parseDates(date);\r
+       } else if (date instanceof Array) {\r
+               for (var i=0;i<date.length;++i) {\r
+                       var d = date[i];\r
+                       returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];\r
+               }\r
+       }\r
+       \r
+       return returnDate;\r
+};\r
+\r
+/**\r
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.\r
+* @private\r
+* @param       {Integer[]}             dateFieldArray  The date field array to convert to a JavaScript Date.\r
+* @return                                      JavaScript Date object representing the date field array\r
+* @type Date\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._toDate = function(dateFieldArray) {\r
+       if (dateFieldArray instanceof Date) {\r
+               return dateFieldArray;\r
+       } else {\r
+               return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);\r
+       }\r
+};\r
+/************* END TYPE CONVERSION METHODS ******************************************************/\r
+\r
+\r
+/************* BEGIN UTILITY METHODS ****************************************************/\r
+/**\r
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.\r
+* @private\r
+* @param       {Integer[]}     array1  The first date field array to compare\r
+* @param       {Integer[]}     array2  The first date field array to compare\r
+* @return                                              The boolean that represents the equality of the two arrays\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._fieldArraysAreEqual = function(array1, array2) {\r
+       var match = false;\r
+\r
+       if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {\r
+               match=true;     \r
+       }\r
+\r
+       return match;\r
+};\r
+\r
+/**\r
+* Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.\r
+* @private\r
+* @param       {Integer[]}             find    The date field array to search for\r
+* @return                                      The index of the date field array within the collection of selected dates.\r
+*                                                              -1 will be returned if the date is not found.\r
+* @type Integer\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._indexOfSelectedFieldArray = function(find) {\r
+       var selected = -1;\r
+\r
+       for (var s=0;s<this.selectedDates.length;++s) {\r
+               var sArray = this.selectedDates[s];\r
+               if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {\r
+                       selected = s;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return selected;\r
+};\r
+\r
+/**\r
+* Determines whether a given date is OOM (out of month).\r
+* @param       {Date}  date    The JavaScript Date object for which to check the OOM status\r
+* @return      {Boolean}       true if the date is OOM\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.isDateOOM = function(date) {\r
+       var isOOM = false;\r
+       if (date.getMonth() != this.pageDate.getMonth()) {\r
+               isOOM = true;\r
+       }\r
+       return isOOM;\r
+};\r
+\r
+/************* END UTILITY METHODS *******************************************************/\r
+\r
+/************* BEGIN EVENT HANDLERS ******************************************************/\r
+\r
+/**\r
+* Event executed before a date is selected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onBeforeSelect = function() {\r
+       if (! this.Options.MULTI_SELECT) {\r
+               this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);\r
+               this.deselectAll();\r
+       }\r
+};\r
+\r
+/**\r
+* Event executed when a date is selected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onSelect = function() { };\r
+\r
+/**\r
+* Event executed before a date is deselected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onBeforeDeselect = function() { };\r
+\r
+/**\r
+* Event executed when a date is deselected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onDeselect = function() { };\r
+\r
+/**\r
+* Event executed when the user navigates to a different calendar page.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onChangePage = function() {\r
+               var me = this;\r
+\r
+               this.renderHeader();\r
+               if (this.renderProcId) {\r
+                       clearTimeout(this.renderProcId);\r
+               }\r
+               this.renderProcId = setTimeout(function() {\r
+                                                                                       me.render();\r
+                                                                                       me.renderProcId = null;\r
+                                                                               }, 1);\r
+};\r
+\r
+/**\r
+* Event executed when the calendar widget is rendered.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onRender = function() { };\r
+\r
+/**\r
+* Event executed when the calendar widget is reset to its original state.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onReset = function() { this.render(); };\r
+\r
+/**\r
+* Event executed when the calendar widget is completely cleared to the current month with no selections.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onClear = function() { this.render(); };\r
+\r
+/**\r
+* Validates the calendar widget. This method has no default implementation\r
+* and must be extended by subclassing the widget.\r
+* @return      Should return true if the widget validates, and false if\r
+* it doesn't.\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.validate = function() { return true; };\r
+\r
+/************* END EVENT HANDLERS *********************************************************/\r
+\r
+\r
+/************* BEGIN DATE PARSE METHODS ***************************************************/\r
+\r
+\r
+/**\r
+* Converts a date string to a date field array\r
+* @private\r
+* @param       {String}        sDate                   Date string. Valid formats are mm/dd and mm/dd/yyyy.\r
+* @return                              A date field array representing the string passed to the method\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseDate = function(sDate) {\r
+       var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);\r
+       var rArray;\r
+\r
+       if (aDate.length == 2) {\r
+               rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];\r
+               rArray.type = YAHOO.widget.Calendar_Core.MONTH_DAY;\r
+       } else {\r
+               rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];\r
+               rArray.type = YAHOO.widget.Calendar_Core.DATE;\r
+       }\r
+       return rArray;\r
+};\r
+\r
+/**\r
+* Converts a multi or single-date string to an array of date field arrays\r
+* @private\r
+* @param       {String}        sDates          Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy\r
+* @return                                                      An array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseDates = function(sDates) {\r
+       var aReturn = new Array();\r
+\r
+       var aDates = sDates.split(this.Locale.DATE_DELIMITER);\r
+       \r
+       for (var d=0;d<aDates.length;++d) {\r
+               var sDate = aDates[d];\r
+\r
+               if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {\r
+                       // This is a range\r
+                       var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);\r
+\r
+                       var dateStart = this._parseDate(aRange[0]);\r
+                       var dateEnd = this._parseDate(aRange[1]);\r
+\r
+                       var fullRange = this._parseRange(dateStart, dateEnd);\r
+                       aReturn = aReturn.concat(fullRange);\r
+               } else {\r
+                       // This is not a range\r
+                       var aDate = this._parseDate(sDate);\r
+                       aReturn.push(aDate);\r
+               }\r
+       }\r
+       return aReturn;\r
+};\r
+\r
+/**\r
+* Converts a date range to the full list of included dates\r
+* @private\r
+* @param       {Integer[]}     startDate       Date field array representing the first date in the range\r
+* @param       {Integer[]}     endDate         Date field array representing the last date in the range\r
+* @return                                                      An array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseRange = function(startDate, endDate) {\r
+       var dStart   = new Date(startDate[0],startDate[1]-1,startDate[2]);\r
+       var dCurrent = YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);\r
+       var dEnd     = new Date(endDate[0],  endDate[1]-1,  endDate[2]);\r
+\r
+       var results = new Array();\r
+       results.push(startDate);\r
+       while (dCurrent.getTime() <= dEnd.getTime()) {\r
+               results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);\r
+               dCurrent = YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);\r
+       }\r
+       return results;\r
+};\r
+\r
+/************* END DATE PARSE METHODS *****************************************************/\r
+\r
+/************* BEGIN RENDERER METHODS *****************************************************/\r
+\r
+/**\r
+* Resets the render stack of the current calendar to its original pre-render value.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.resetRenderers = function() {\r
+       this.renderStack = this._renderStack.concat();\r
+};\r
+\r
+/**\r
+* Clears the inner HTML, CSS class and style information from the specified cell.\r
+* @param       {HTMLTableCellElement}  The cell to clear\r
+*/ \r
+YAHOO.widget.Calendar_Core.prototype.clearElement = function(cell) {\r
+       cell.innerHTML = "&nbsp;";\r
+       cell.className="";\r
+};\r
+\r
+/**\r
+* Adds a renderer to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the conditions specified in the date string for this renderer.\r
+* @param       {String}        sDates          A date string to associate with the specified renderer. Valid formats\r
+*                                                                      include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addRenderer = function(sDates, fnRender) {\r
+       var aDates = this._parseDates(sDates);\r
+       for (var i=0;i<aDates.length;++i) {\r
+               var aDate = aDates[i];\r
+       \r
+               if (aDate.length == 2) { // this is either a range or a month/day combo\r
+                       if (aDate[0] instanceof Array) { // this is a range\r
+                               this._addRenderer(YAHOO.widget.Calendar_Core.RANGE,aDate,fnRender);\r
+                       } else { // this is a month/day combo\r
+                               this._addRenderer(YAHOO.widget.Calendar_Core.MONTH_DAY,aDate,fnRender);\r
+                       }\r
+               } else if (aDate.length == 3) {\r
+                       this._addRenderer(YAHOO.widget.Calendar_Core.DATE,aDate,fnRender);\r
+               }\r
+       }\r
+};\r
+\r
+/**\r
+* The private method used for adding cell renderers to the local render stack.\r
+* This method is called by other methods that set the renderer type prior to the method call.\r
+* @private\r
+* @param       {String}        type            The type string that indicates the type of date renderer being added.\r
+*                                                                      Values are YAHOO.widget.Calendar_Core.DATE, YAHOO.widget.Calendar_Core.MONTH_DAY, YAHOO.widget.Calendar_Core.WEEKDAY,\r
+*                                                                      YAHOO.widget.Calendar_Core.RANGE, YAHOO.widget.Calendar_Core.MONTH\r
+* @param       {Array}         aDates          An array of dates used to construct the renderer. The format varies based\r
+*                                                                      on the renderer type\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._addRenderer = function(type, aDates, fnRender) {\r
+       var add = [type,aDates,fnRender];\r
+       this.renderStack.unshift(add);  \r
+       \r
+       this._renderStack = this.renderStack.concat();\r
+};\r
+\r
+/**\r
+* Adds a month to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the month passed to this method.\r
+* @param       {Integer}       month           The month (1-12) to associate with this renderer\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addMonthRenderer = function(month, fnRender) {\r
+       this._addRenderer(YAHOO.widget.Calendar_Core.MONTH,[month],fnRender);\r
+};\r
+\r
+/**\r
+* Adds a weekday to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the weekday passed to this method.\r
+* @param       {Integer}       weekay          The weekday (1-7) to associate with this renderer\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addWeekdayRenderer = function(weekday, fnRender) {\r
+       this._addRenderer(YAHOO.widget.Calendar_Core.WEEKDAY,[weekday],fnRender);\r
+};\r
+//// END RENDERER METHODS ////\r
+\r
+//// BEGIN CSS METHODS ////\r
+\r
+/**\r
+* Sets the specified array of CSS classes into the referenced element\r
+* @param       {HTMLElement}   element         The element to set the CSS classes into\r
+* @param       {String[]}              aStyles         An array of CSS class names\r
+*/\r
+YAHOO.widget.Calendar_Core.setCssClasses = function(element, aStyles) {\r
+       element.className = "";\r
+       var className = aStyles.join(" ");\r
+       element.className = className;\r
+};\r
+\r
+/**\r
+* Removes all styles from all body cells in the current calendar table.\r
+* @param       {style}         The CSS class name to remove from all calendar body cells\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.clearAllBodyCellStyles = function(style) {\r
+       for (var c=0;c<this.cells.length;++c) {\r
+               YAHOO.util.Dom.removeClass(this.cells[c],style);\r
+       }\r
+};\r
+\r
+//// END CSS METHODS ////\r
+\r
+//// BEGIN GETTER/SETTER METHODS ////\r
+/**\r
+* Sets the calendar's month explicitly.\r
+* @param {Integer}     month           The numeric month, from 1 (January) to 12 (December)\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setMonth = function(month) {\r
+       this.pageDate.setMonth(month);\r
+};\r
+\r
+/**\r
+* Sets the calendar's year explicitly.\r
+* @param {Integer}     year            The numeric 4-digit year\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setYear = function(year) {\r
+       this.pageDate.setFullYear(year);\r
+};\r
+\r
+/**\r
+* Gets the list of currently selected dates from the calendar.\r
+* @return      An array of currently selected JavaScript Date objects.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.getSelectedDates = function() {\r
+       var returnDates = new Array();\r
+\r
+       for (var d=0;d<this.selectedDates.length;++d) {\r
+               var dateArray = this.selectedDates[d];\r
+\r
+               var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);\r
+               returnDates.push(date);\r
+       }\r
+\r
+       returnDates.sort();\r
+       return returnDates;\r
+};\r
+\r
+/// END GETTER/SETTER METHODS ///\r
+\r
+/**\r
+* Returns a string representing the current browser.\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core._getBrowser = function() {\r
+  /**\r
+   * UserAgent\r
+   * @private\r
+   * @type String\r
+   */\r
+  var ua = navigator.userAgent.toLowerCase();\r
+  \r
+  if (ua.indexOf('opera')!=-1) // Opera (check first in case of spoof)\r
+        return 'opera';\r
+  else if (ua.indexOf('msie')!=-1) // IE\r
+        return 'ie';\r
+  else if (ua.indexOf('safari')!=-1) // Safari (check before Gecko because it includes "like Gecko")\r
+        return 'safari';\r
+  else if (ua.indexOf('gecko') != -1) // Gecko\r
+        return 'gecko';\r
+ else\r
+  return false;\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.toString = function() {\r
+       return "Calendar_Core " + this.id;\r
+}\r
+\r
+YAHOO.widget.Cal_Core = YAHOO.widget.Calendar_Core;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* Calendar is the default implementation of the YAHOO.widget.Calendar_Core base class.\r
+* This class is the UED-approved version of the calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for YAHOO.widget.Calendar_Core.\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar.prototype = new YAHOO.widget.Calendar_Core();\r
+\r
+YAHOO.widget.Calendar.prototype.buildShell = function() {\r
+       this.border = document.createElement("DIV");\r
+       this.border.className =  this.Style.CSS_CONTAINER;\r
+       \r
+       this.table = document.createElement("TABLE");\r
+       this.table.cellSpacing = 0;     \r
+       \r
+       YAHOO.widget.Calendar_Core.setCssClasses(this.table, [this.Style.CSS_CALENDAR]);\r
+\r
+       this.border.id = this.id;\r
+       \r
+       this.buildShellHeader();\r
+       this.buildShellBody();\r
+       this.buildShellFooter();\r
+};\r
+\r
+YAHOO.widget.Calendar.prototype.renderShell = function() {\r
+       this.border.appendChild(this.table);\r
+       this.oDomContainer.appendChild(this.border);\r
+       this.shellRendered = true;\r
+};\r
+\r
+YAHOO.widget.Calendar.prototype.renderHeader = function() {\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       if (this.linkLeft) {\r
+               YAHOO.util.Event.removeListener(this.linkLeft, "mousedown", this.previousMonth);\r
+       }\r
+       this.linkLeft = document.createElement("A");\r
+       this.linkLeft.innerHTML = "&nbsp;";\r
+       YAHOO.util.Event.addListener(this.linkLeft, "mousedown", this.previousMonth, this, true);\r
+       this.linkLeft.style.backgroundImage =  "url(" + this.Options.NAV_ARROW_LEFT + ")";\r
+       this.linkLeft.className = this.Style.CSS_NAV_LEFT;\r
+       \r
+       if (this.linkRight) {\r
+               YAHOO.util.Event.removeListener(this.linkRight, "mousedown", this.nextMonth);\r
+       }\r
+       this.linkRight = document.createElement("A");\r
+       this.linkRight.innerHTML = "&nbsp;";\r
+       YAHOO.util.Event.addListener(this.linkRight, "mousedown", this.nextMonth, this, true);\r
+       this.linkRight.style.backgroundImage = "url(" + this.Options.NAV_ARROW_RIGHT + ")";\r
+       this.linkRight.className = this.Style.CSS_NAV_RIGHT;\r
+       \r
+       headerContainer.appendChild(this.linkLeft);\r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       headerContainer.appendChild(this.linkRight);\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+YAHOO.widget.Cal = YAHOO.widget.Calendar;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* <p>YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar_Core. This class facilitates\r
+* the ability to have multi-page calendar views that share a single dataset and are\r
+* dependent on each other.</p>\r
+* \r
+* <p>The calendar group instance will refer to each of its elements using a 0-based index.\r
+* For example, to construct the placeholder for a calendar group widget with id "cal1" and\r
+* containerId of "cal1Container", the markup would be as follows:\r
+*      <xmp>\r
+*              <div id="cal1Container_0"></div>\r
+*              <div id="cal1Container_1"></div>\r
+*      </xmp>\r
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.\r
+* </p>\r
+* @constructor\r
+* @param {Integer}             pageCount       The number of pages that this calendar should display.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}      containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.CalendarGroup = function(pageCount, id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {\r
+               this.init(pageCount, id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+/**\r
+* Initializes the calendar group. All subclasses must call this method in order for the\r
+* group to be initialized properly.\r
+* @param {Integer}             pageCount       The number of pages that this calendar should display.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}              containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.init = function(pageCount, id, containerId, monthyear, selected) {\r
+       this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + id);        \r
+       \r
+       this.id = id;\r
+       this.selectedDates = new Array();\r
+       this.containerId = containerId;\r
+       \r
+       this.pageCount = pageCount;\r
+\r
+       this.pages = new Array();\r
+\r
+       for (var p=0;p<pageCount;++p) {\r
+               var cal = this.constructChild(id + "_" + p, this.containerId + "_" + p , monthyear, selected);\r
+                               \r
+               cal.parent = this;\r
+               \r
+               cal.index = p;\r
+\r
+               cal.pageDate.setMonth(cal.pageDate.getMonth()+p);\r
+               cal._pageDate = new Date(cal.pageDate.getFullYear(),cal.pageDate.getMonth(),cal.pageDate.getDate());\r
+               this.pages.push(cal);\r
+       }\r
+       \r
+       this.doNextMonth = function(e, calGroup) {\r
+               calGroup.nextMonth();\r
+       };\r
+       \r
+       this.doPreviousMonth = function(e, calGroup) {\r
+               calGroup.previousMonth();\r
+       };\r
+       \r
+       this.logger.log("Initialized " + pageCount + "-page CalendarGroup", "info");\r
+};\r
+\r
+/**\r
+* Adds a function to all child Calendars within this CalendarGroup.\r
+* @param {String}              fnName          The name of the function\r
+* @param {Function}            fn                      The function to apply to each Calendar page object\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setChildFunction = function(fnName, fn) {\r
+       for (var p=0;p<this.pageCount;++p) {\r
+               this.pages[p][fnName] = fn;\r
+       }\r
+}\r
+\r
+/**\r
+* Calls a function within all child Calendars within this CalendarGroup.\r
+* @param {String}              fnName          The name of the function\r
+* @param {Array}               args            The arguments to pass to the function\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.callChildFunction = function(fnName, args) {\r
+       for (var p=0;p<this.pageCount;++p) {\r
+               var page = this.pages[p];\r
+               if (page[fnName]) {\r
+                       var fn = page[fnName];\r
+                       fn.call(page, args);\r
+               }\r
+       }       \r
+}\r
+\r
+/**\r
+* Constructs a child calendar. This method can be overridden if a subclassed version of the default\r
+* calendar is to be used.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}              containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+* @return                                                      The YAHOO.widget.Calendar_Core instance that is constructed\r
+* @type YAHOO.widget.Calendar_Core\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,monthyear,selected) {\r
+       return new YAHOO.widget.Calendar_Core(id,containerId,monthyear,selected);\r
+};\r
+\r
+\r
+/**\r
+* Sets the calendar group's month explicitly. This month will be set into the first\r
+* page of the multi-page calendar, and all other months will be iterated appropriately.\r
+* @param {Integer}     month           The numeric month, from 1 (January) to 12 (December)\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.setMonth(month+p);\r
+       }\r
+};\r
+\r
+/**\r
+* Sets the calendar group's year explicitly. This year will be set into the first\r
+* page of the multi-page calendar, and all other months will be iterated appropriately.\r
+* @param {Integer}     year            The numeric 4-digit year\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setYear = function(year) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               if ((cal.pageDate.getMonth()+1) == 1 && p>0)\r
+               {\r
+                       year+=1;\r
+               }\r
+               cal.setYear(year);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the render function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.render = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.render();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the select function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.select = function(date) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.select(date);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the selectCell function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.selectCell = function(cellIndex) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.selectCell(cellIndex);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselect function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselect = function(date) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.deselect(date);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselectAll function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselectAll = function() {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.deselectAll();\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselectAll function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselectCell = function(cellIndex) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.deselectCell(cellIndex);\r
+       }\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Calls the reset function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.reset = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.reset();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the clear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.clear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.clear();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the nextMonth function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.nextMonth = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.nextMonth();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the previousMonth function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.previousMonth = function() {\r
+       for (var p=this.pages.length-1;p>=0;--p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.previousMonth();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the nextYear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.nextYear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.nextYear();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the previousYear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.previousYear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.previousYear();\r
+       }\r
+};\r
+\r
+/**\r
+* Synchronizes the data values for all child calendars within the group. If the sync\r
+* method is called passing in the caller object, the values of all children will be set\r
+* to the values of the caller. If the argument is ommitted, the values from all children\r
+* will be combined into one distinct list and set into each child.\r
+* @param       {YAHOO.widget.Calendar_Core}    caller          The YAHOO.widget.Calendar_Core that is initiating the call to sync().\r
+* @return                                                              Array of selected dates, in JavaScript Date object form.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.sync = function(caller) {\r
+       var calendar;\r
+\r
+       if (caller)\r
+       {\r
+               this.selectedDates = caller.selectedDates.concat();\r
+       } else {\r
+               var hash = new Object();\r
+               var combinedDates = new Array();\r
+\r
+               for (var p=0;p<this.pages.length;++p)\r
+               {\r
+                       calendar = this.pages[p];\r
+\r
+                       var values = calendar.selectedDates;\r
+\r
+                       for (var v=0;v<values.length;++v)\r
+                       {\r
+                               var valueArray = values[v];\r
+                               hash[valueArray.toString()] = valueArray;\r
+                       }\r
+               }\r
+\r
+               for (var val in hash)\r
+               {\r
+                       combinedDates[combinedDates.length]=hash[val];\r
+               }\r
+               \r
+               this.selectedDates = combinedDates.concat();\r
+       }\r
+\r
+       // Set all the values into the children\r
+       for (p=0;p<this.pages.length;++p)\r
+       {\r
+               calendar = this.pages[p];\r
+               if (! calendar.Options.MULTI_SELECT) {\r
+                       calendar.clearAllBodyCellStyles(calendar.Config.Style.CSS_CELL_SELECTED);\r
+               }\r
+               calendar.selectedDates = this.selectedDates.concat();\r
+               \r
+       }\r
+       \r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Gets the list of currently selected dates from the calendar.\r
+* @return                      An array of currently selected JavaScript Date objects.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.getSelectedDates = function() { \r
+       var returnDates = new Array();\r
+\r
+       for (var d=0;d<this.selectedDates.length;++d)\r
+       {\r
+               var dateArray = this.selectedDates[d];\r
+\r
+               var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);\r
+               returnDates.push(date);\r
+       }\r
+\r
+       returnDates.sort();\r
+       return returnDates;\r
+};\r
+\r
+/**\r
+* Calls the addRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addRenderer = function(sDates, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addRenderer(sDates, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the addMonthRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addMonthRenderer = function(month, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addMonthRenderer(month, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the addWeekdayRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer = function(weekday, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addWeekdayRenderer(weekday, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Sets an event handler universally across all child calendars within the group. For instance,\r
+* to set the onSelect handler for all child calendars to a function called fnSelect, the call would be:\r
+* <code>\r
+* calGroup.wireEvent("onSelect", fnSelect);\r
+* </code>\r
+* @param       {String}        eventName       The name of the event to handler to set within all child calendars.\r
+* @param       {Function}      fn                      The function to set into the specified event handler.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.wireEvent = function(eventName, fn) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal[eventName] = fn;\r
+       }\r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.CalendarGroup.prototype.toString = function() {\r
+       return "CalendarGroup " + this.id;\r
+}\r
+\r
+YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* Calendar2up_Cal is the default implementation of the Calendar_Core base class, when used\r
+* in a 2-up view. This class is the UED-approved version of the calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for Calendar_Core. This class\r
+* has some special attributes that only apply to calendars rendered within the calendar group implementation. \r
+* There should be no reason to instantiate this class directly.\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar2up_Cal = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0)\r
+       {\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar2up_Cal.prototype = new YAHOO.widget.Calendar_Core();\r
+\r
+/**\r
+* Renders the header for each individual calendar in the 2-up view. More\r
+* specifically, this method handles the placement of left and right arrows for\r
+* navigating between calendar pages.\r
+*/\r
+YAHOO.widget.Calendar2up_Cal.prototype.renderHeader = function() {\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       if (this.index == 0) {\r
+\r
+               if (this.linkLeft) {\r
+                       YAHOO.util.Event.removeListener(this.linkLeft, "mousedown", this.parent.doPreviousMonth);\r
+               }\r
+               this.linkLeft = document.createElement("A");\r
+               this.linkLeft.innerHTML = "&nbsp;";\r
+               this.linkLeft.style.backgroundImage =  "url(" + this.Options.NAV_ARROW_LEFT + ")";\r
+               this.linkLeft.className = this.Style.CSS_NAV_LEFT;\r
+               \r
+               YAHOO.util.Event.addListener(this.linkLeft, "mousedown", this.parent.doPreviousMonth, this.parent);\r
+               headerContainer.appendChild(this.linkLeft);\r
+       }\r
+       \r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       \r
+       if (this.index == 1) {\r
+\r
+               if (this.linkRight) {\r
+                       YAHOO.util.Event.removeListener(this.linkRight, "mousedown", this.parent.doNextMonth);\r
+               }\r
+               this.linkRight = document.createElement("A");\r
+               this.linkRight.innerHTML = "&nbsp;";\r
+               this.linkRight.style.backgroundImage = "url(" + this.Options.NAV_ARROW_RIGHT + ")";\r
+               this.linkRight.className = this.Style.CSS_NAV_RIGHT;\r
+\r
+               YAHOO.util.Event.addListener(this.linkRight, "mousedown", this.parent.doNextMonth, this.parent);\r
+               headerContainer.appendChild(this.linkRight);\r
+       }\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+\r
+\r
+\r
+/**\r
+* @class\r
+* Calendar2up is the default implementation of the CalendarGroup base class, when used\r
+* in a 2-up view. This class is the UED-approved version of the 2-up calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for CalendarGroup. \r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar2up = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0)\r
+       {       \r
+               this.buildWrapper(containerId);\r
+               this.init(2, id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar2up.prototype = new YAHOO.widget.CalendarGroup();\r
+\r
+/**\r
+* CSS class representing the wrapper for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPWRAPPER = "yui-cal2upwrapper";\r
+\r
+/**\r
+* CSS class representing the container for the calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_CONTAINER = "yui-calcontainer";\r
+\r
+/**\r
+* CSS class representing the container for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPCONTAINER = "cal2up";\r
+\r
+/**\r
+* CSS class representing the title for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPTITLE = "title";\r
+\r
+/**\r
+* CSS class representing the close icon for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPCLOSE = "close-icon";\r
+\r
+/**\r
+* Implementation of CalendarGroup.constructChild that ensures that child calendars of \r
+* Calendar2up will be of type Calendar2up_Cal.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.constructChild = function(id,containerId,monthyear,selected) {\r
+       var cal = new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);\r
+       return cal;\r
+};\r
+\r
+/**\r
+* Builds the wrapper container for the 2-up calendar.\r
+* @param {String} containerId  The id of the outer container element.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.buildWrapper = function(containerId) {\r
+       var outerContainer = document.getElementById(containerId);\r
+       \r
+       outerContainer.className = YAHOO.widget.Calendar2up.CSS_2UPWRAPPER;\r
+       \r
+       var innerContainer = document.createElement("DIV");\r
+       innerContainer.className = YAHOO.widget.Calendar2up.CSS_CONTAINER;\r
+       innerContainer.id = containerId + "_inner";\r
+       \r
+       var cal1Container = document.createElement("DIV");\r
+       cal1Container.id = containerId + "_0";\r
+       cal1Container.className = YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;\r
+       cal1Container.style.marginRight = "10px";\r
+       \r
+       var cal2Container = document.createElement("DIV");\r
+       cal2Container.id = containerId + "_1"; \r
+       cal2Container.className = YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;\r
+       \r
+       outerContainer.appendChild(innerContainer);\r
+       innerContainer.appendChild(cal1Container);\r
+       innerContainer.appendChild(cal2Container);\r
+       \r
+       this.innerContainer = innerContainer;\r
+       this.outerContainer = outerContainer;\r
+}\r
+\r
+/**\r
+* Renders the 2-up calendar.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.render = function() {\r
+       this.renderHeader();\r
+       YAHOO.widget.CalendarGroup.prototype.render.call(this);\r
+       this.renderFooter();\r
+};\r
+\r
+/**\r
+* Renders the header located at the top of the container for the 2-up calendar.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.renderHeader = function() {\r
+       if (! this.title) {\r
+               this.title = "";\r
+       }\r
+       if (! this.titleDiv)\r
+       {\r
+               this.titleDiv = document.createElement("DIV");\r
+               if (this.title == "")\r
+               {\r
+                       this.titleDiv.style.display="none";\r
+               }\r
+       }\r
+\r
+       this.titleDiv.className = YAHOO.widget.Calendar2up.CSS_2UPTITLE;\r
+       this.titleDiv.innerHTML = this.title;\r
+\r
+       if (this.outerContainer.style.position == "absolute")\r
+       {\r
+               var linkClose = document.createElement("A");\r
+               linkClose.href = "javascript:void(null)";\r
+               YAHOO.util.Event.addListener(linkClose, "click", this.hide, this);\r
+\r
+               var imgClose = document.createElement("IMG");\r
+               imgClose.src = YAHOO.widget.Calendar_Core.IMG_ROOT + "us/my/bn/x_d.gif";\r
+               imgClose.className = YAHOO.widget.Calendar2up.CSS_2UPCLOSE;\r
+\r
+               linkClose.appendChild(imgClose);\r
+\r
+               this.linkClose = linkClose;\r
+\r
+               this.titleDiv.appendChild(linkClose);\r
+       }\r
+\r
+       this.innerContainer.insertBefore(this.titleDiv, this.innerContainer.firstChild);\r
+}\r
+\r
+/**\r
+* Hides the 2-up calendar's outer container from view.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.hide = function(e, cal) {\r
+       if (! cal)\r
+       {\r
+               cal = this;\r
+       }\r
+       cal.outerContainer.style.display = "none";\r
+}\r
+\r
+/**\r
+* Renders a footer for the 2-up calendar container. By default, this method is\r
+* unimplemented.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.renderFooter = function() {}\r
+\r
+YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
\ No newline at end of file
diff --git a/lib/yui/calendar/calendar-min.js b/lib/yui/calendar/calendar-min.js
new file mode 100755 (executable)
index 0000000..fbf497c
--- /dev/null
@@ -0,0 +1,155 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+YAHOO.widget.DateMath=new function(){this.DAY="D";this.WEEK="W";this.YEAR="Y";this.MONTH="M";this.ONE_DAY_MS=1000*60*60*24;this.add=function(date,field,amount){var d=new Date(date.getTime());switch(field){case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0){newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11){newMonth-=12;years+=1;}}\r
+d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+(amount*7));break;}\r
+return d;};this.subtract=function(date,field,amount){return this.add(date,field,(amount*-1));};this.before=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()<ms){return true;}else{return false;}};this.after=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()>ms){return true;}else{return false;}};this.between=function(date,dateBegin,dateEnd){if(this.after(date,dateBegin)&&this.before(date,dateEnd)){return true;}else{return false;}};this.getJan1=function(calendarYear){return new Date(calendarYear,0,1);};this.getDayOffset=function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;};this.getWeekNumber=function(date,calendarYear,weekStartsOn){date.setHours(12,0,0,0);if(!weekStartsOn){weekStartsOn=0;}\r
+if(!calendarYear){calendarYear=date.getFullYear();}\r
+var weekNum=-1;var jan1=this.getJan1(calendarYear);var jan1Offset=jan1.getDay()-weekStartsOn;var jan1DayOfWeek=(jan1Offset>=0?jan1Offset:(7+jan1Offset));var endOfWeek1=this.add(jan1,this.DAY,(6-jan1DayOfWeek));endOfWeek1.setHours(23,59,59,999);var month=date.getMonth();var day=date.getDate();var year=date.getFullYear();var dayOffset=this.getDayOffset(date,calendarYear);if(dayOffset<0||this.before(date,endOfWeek1)){weekNum=1;}else{weekNum=2;var weekBegin=new Date(endOfWeek1.getTime()+1);var weekEnd=this.add(weekBegin,this.WEEK,1);while(!this.between(date,weekBegin,weekEnd)){weekBegin=this.add(weekBegin,this.WEEK,1);weekEnd=this.add(weekEnd,this.WEEK,1);weekNum+=1;}}\r
+return weekNum;};this.isYearOverlapWeek=function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}\r
+return overlaps;};this.isMonthOverlapWeek=function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}\r
+return overlaps;};this.findMonthStart=function(date){var start=new Date(date.getFullYear(),date.getMonth(),1);return start;};this.findMonthEnd=function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;};this.clearTime=function(date){date.setHours(0,0,0,0);return date;};}\r
+YAHOO.widget.Calendar_Core=function(id,containerId,monthyear,selected){if(arguments.length>0){this.init(id,containerId,monthyear,selected);}}\r
+YAHOO.widget.Calendar_Core.IMG_ROOT=(window.location.href.toLowerCase().indexOf("https")==0?"https://a248.e.akamai.net/sec.yimg.com/i/":"http://us.i1.yimg.com/us.yimg.com/i/");YAHOO.widget.Calendar_Core.DATE="D";YAHOO.widget.Calendar_Core.MONTH_DAY="MD";YAHOO.widget.Calendar_Core.WEEKDAY="WD";YAHOO.widget.Calendar_Core.RANGE="R";YAHOO.widget.Calendar_Core.MONTH="M";YAHOO.widget.Calendar_Core.DISPLAY_DAYS=42;YAHOO.widget.Calendar_Core.STOP_RENDER="S";YAHOO.widget.Calendar_Core.prototype={Config:null,parent:null,index:-1,cells:null,weekHeaderCells:null,weekFooterCells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,pageDate:null,_pageDate:null,minDate:null,maxDate:null,selectedDates:null,_selectedDates:null,shellRendered:false,table:null,headerCell:null};YAHOO.widget.Calendar_Core.prototype.init=function(id,containerId,monthyear,selected){this.setupConfig();this.id=id;this.cellDates=new Array();this.cells=new Array();this.renderStack=new Array();this._renderStack=new Array();this.oDomContainer=document.getElementById(containerId);this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);var month;var year;if(monthyear){var aMonthYear=monthyear.split(this.Locale.DATE_FIELD_DELIMITER);month=parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);year=parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);}else{month=this.today.getMonth()+1;year=this.today.getFullYear();}\r
+this.pageDate=new Date(year,month-1,1);this._pageDate=new Date(this.pageDate.getTime());if(selected){this.selectedDates=this._parseDates(selected);this._selectedDates=this.selectedDates.concat();}else{this.selectedDates=new Array();this._selectedDates=new Array();}\r
+this.wireDefaultEvents();this.wireCustomEvents();};YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents=function(){this.doSelectCell=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){if(cal.Options.MULTI_SELECT){var link=cell.getElementsByTagName("A")[0];link.blur();var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1){cal.deselectCell(index);}else{cal.selectCell(index);}}else{var link=cell.getElementsByTagName("A")[0];link.blur()\r
+cal.selectCell(index);}}}\r
+this.doCellMouseOver=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){YAHOO.util.Dom.addClass(cell,cal.Style.CSS_CELL_HOVER);}}\r
+this.doCellMouseOut=function(e,cal){YAHOO.util.Dom.removeClass(this,cal.Style.CSS_CELL_HOVER);}\r
+this.doNextMonth=function(e,cal){cal.nextMonth();}\r
+this.doPreviousMonth=function(e,cal){cal.previousMonth();}}\r
+YAHOO.widget.Calendar_Core.prototype.wireCustomEvents=function(){}\r
+YAHOO.widget.Calendar_Core.prototype.setupConfig=function(){this.Config=new Object();this.Config.Style={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTED:"selected",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_CONTAINER:"yui-calcontainer",CSS_2UPWRAPPER:"yui-cal2upwrapper",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};this.Style=this.Config.Style;this.Config.Locale={MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"],WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],DATE_DELIMITER:",",DATE_FIELD_DELIMITER:"/",DATE_RANGE_DELIMITER:"-",MY_MONTH_POSITION:1,MY_YEAR_POSITION:2,MD_MONTH_POSITION:1,MD_DAY_POSITION:2,MDY_MONTH_POSITION:1,MDY_DAY_POSITION:2,MDY_YEAR_POSITION:3};this.Locale=this.Config.Locale;this.Config.Options={MULTI_SELECT:false,SHOW_WEEKDAYS:true,START_WEEKDAY:0,SHOW_WEEK_HEADER:false,SHOW_WEEK_FOOTER:false,HIDE_BLANK_WEEKS:false,NAV_ARROW_LEFT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/callt.gif",NAV_ARROW_RIGHT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/calrt.gif"};this.Options=this.Config.Options;this.customConfig();if(!this.Options.LOCALE_MONTHS){this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;}\r
+if(!this.Options.LOCALE_WEEKDAYS){this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;}\r
+if(this.Options.START_WEEKDAY>0){for(var w=0;w<this.Options.START_WEEKDAY;++w){this.Locale.WEEKDAYS_SHORT.push(this.Locale.WEEKDAYS_SHORT.shift());this.Locale.WEEKDAYS_MEDIUM.push(this.Locale.WEEKDAYS_MEDIUM.shift());this.Locale.WEEKDAYS_LONG.push(this.Locale.WEEKDAYS_LONG.shift());}}};YAHOO.widget.Calendar_Core.prototype.customConfig=function(){};YAHOO.widget.Calendar_Core.prototype.buildMonthLabel=function(){var text=this.Options.LOCALE_MONTHS[this.pageDate.getMonth()]+" "+this.pageDate.getFullYear();return text;};YAHOO.widget.Calendar_Core.prototype.buildDayLabel=function(workingDate){var day=workingDate.getDate();return day;};YAHOO.widget.Calendar_Core.prototype.buildShell=function(){this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.table.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();YAHOO.util.Event.addListener(window,"unload",this._unload,this);};YAHOO.widget.Calendar_Core.prototype.buildShellHeader=function(){var head=document.createElement("THEAD");var headRow=document.createElement("TR");var headerCell=document.createElement("TH");var colSpan=7;if(this.Config.Options.SHOW_WEEK_HEADER){this.weekHeaderCells=new Array();colSpan+=1;}\r
+if(this.Config.Options.SHOW_WEEK_FOOTER){this.weekFooterCells=new Array();colSpan+=1;}\r
+headerCell.colSpan=colSpan;YAHOO.widget.Calendar_Core.setCssClasses(headerCell,[this.Style.CSS_HEADER_TEXT]);this.headerCell=headerCell;headRow.appendChild(headerCell);head.appendChild(headRow);if(this.Options.SHOW_WEEKDAYS){var row=document.createElement("TR");var fillerCell;YAHOO.widget.Calendar_Core.setCssClasses(row,[this.Style.CSS_WEEKDAY_ROW]);if(this.Config.Options.SHOW_WEEK_HEADER){fillerCell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);row.appendChild(fillerCell);}\r
+for(var i=0;i<this.Options.LOCALE_WEEKDAYS.length;++i){var cell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_WEEKDAY_CELL]);cell.innerHTML=this.Options.LOCALE_WEEKDAYS[i];row.appendChild(cell);}\r
+if(this.Config.Options.SHOW_WEEK_FOOTER){fillerCell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);row.appendChild(fillerCell);}\r
+head.appendChild(row);}\r
+this.table.appendChild(head);};YAHOO.widget.Calendar_Core.prototype.buildShellBody=function(){this.tbody=document.createElement("TBODY");for(var r=0;r<6;++r){var row=document.createElement("TR");for(var c=0;c<this.headerCell.colSpan;++c){var cell;if(this.Config.Options.SHOW_WEEK_HEADER&&c===0){cell=document.createElement("TH");this.weekHeaderCells[this.weekHeaderCells.length]=cell;}else if(this.Config.Options.SHOW_WEEK_FOOTER&&c==(this.headerCell.colSpan-1)){cell=document.createElement("TH");this.weekFooterCells[this.weekFooterCells.length]=cell;}else{cell=document.createElement("TD");this.cells[this.cells.length]=cell;YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL]);YAHOO.util.Event.addListener(cell,"click",this.doSelectCell,this);YAHOO.util.Event.addListener(cell,"mouseover",this.doCellMouseOver,this);YAHOO.util.Event.addListener(cell,"mouseout",this.doCellMouseOut,this);}\r
+row.appendChild(cell);}\r
+this.tbody.appendChild(row);}\r
+this.table.appendChild(this.tbody);};YAHOO.widget.Calendar_Core.prototype.buildShellFooter=function(){};YAHOO.widget.Calendar_Core.prototype.renderShell=function(){this.oDomContainer.appendChild(this.table);this.shellRendered=true;};YAHOO.widget.Calendar_Core.prototype.render=function(){if(!this.shellRendered){this.buildShell();this.renderShell();}\r
+this.resetRenderers();this.cellDates.length=0;var workingDate=YAHOO.widget.DateMath.findMonthStart(this.pageDate);this.renderHeader();this.renderBody(workingDate);this.renderFooter();this.onRender();};YAHOO.widget.Calendar_Core.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar_Core.prototype.renderBody=function(workingDate){this.preMonthDays=workingDate.getDay();if(this.Options.START_WEEKDAY>0){this.preMonthDays-=this.Options.START_WEEKDAY;}\r
+if(this.preMonthDays<0){this.preMonthDays+=7;}\r
+this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var weekRowIndex=0;for(var c=0;c<this.cells.length;++c){var cellRenderers=new Array();var cell=this.cells[c];this.clearElement(cell);cell.index=c;cell.id=this.id+"_cell"+c;this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];if(workingDate.getDay()==this.Options.START_WEEKDAY){var rowHeaderCell=null;var rowFooterCell=null;if(this.Options.SHOW_WEEK_HEADER){rowHeaderCell=this.weekHeaderCells[weekRowIndex];this.clearElement(rowHeaderCell);}\r
+if(this.Options.SHOW_WEEK_FOOTER){rowFooterCell=this.weekFooterCells[weekRowIndex];this.clearElement(rowFooterCell);}\r
+if(this.Options.HIDE_BLANK_WEEKS&&this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){continue;}else{if(rowHeaderCell){this.renderRowHeader(workingDate,rowHeaderCell);}\r
+if(rowFooterCell){this.renderRowFooter(workingDate,rowFooterCell);}}}\r
+var renderer=null;if(workingDate.getFullYear()==this.today.getFullYear()&&workingDate.getMonth()==this.today.getMonth()&&workingDate.getDate()==this.today.getDate()){cellRenderers[cellRenderers.length]=this.renderCellStyleToday;}\r
+if(this.isDateOOM(workingDate)){cellRenderers[cellRenderers.length]=this.renderCellNotThisMonth;}else{for(var r=0;r<this.renderStack.length;++r){var rArray=this.renderStack[r];var type=rArray[0];var month;var day;var year;switch(type){case YAHOO.widget.Calendar_Core.DATE:month=rArray[1][1];day=rArray[1][2];year=rArray[1][0];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day&&workingDate.getFullYear()==year){renderer=rArray[2];this.renderStack.splice(r,1);}\r
+break;case YAHOO.widget.Calendar_Core.MONTH_DAY:month=rArray[1][0];day=rArray[1][1];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day){renderer=rArray[2];this.renderStack.splice(r,1);}\r
+break;case YAHOO.widget.Calendar_Core.RANGE:var date1=rArray[1][0];var date2=rArray[1][1];var d1month=date1[1];var d1day=date1[2];var d1year=date1[0];var d1=new Date(d1year,d1month-1,d1day);var d2month=date2[1];var d2day=date2[2];var d2year=date2[0];var d2=new Date(d2year,d2month-1,d2day);if(workingDate.getTime()>=d1.getTime()&&workingDate.getTime()<=d2.getTime()){renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(r,1);}}\r
+break;case YAHOO.widget.Calendar_Core.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday){renderer=rArray[2];}\r
+break;case YAHOO.widget.Calendar_Core.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month){renderer=rArray[2];}\r
+break;}\r
+if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}\r
+if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1){cellRenderers[cellRenderers.length]=this.renderCellStyleSelected;}\r
+if(this.minDate){this.minDate=YAHOO.widget.DateMath.clearTime(this.minDate);}\r
+if(this.maxDate){this.maxDate=YAHOO.widget.DateMath.clearTime(this.maxDate);}\r
+if((this.minDate&&(workingDate.getTime()<this.minDate.getTime()))||(this.maxDate&&(workingDate.getTime()>this.maxDate.getTime()))){cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=this.renderCellDefault;}\r
+for(var x=0;x<cellRenderers.length;++x){var ren=cellRenderers[x];if(ren.call(this,workingDate,cell)==YAHOO.widget.Calendar_Core.STOP_RENDER){break;}}\r
+workingDate=YAHOO.widget.DateMath.add(workingDate,YAHOO.widget.DateMath.DAY,1);if(workingDate.getDay()==this.Options.START_WEEKDAY){weekRowIndex+=1;}\r
+YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL);if(c>=0&&c<=6){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TOP);}\r
+if((c%7)==0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_LEFT);}\r
+if(((c+1)%7)==0){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_RIGHT);}\r
+var postDays=this.postMonthDays;if(postDays>=7&&this.Options.HIDE_BLANK_WEEKS){var blankWeeks=Math.floor(postDays/7);for(var p=0;p<blankWeeks;++p){postDays-=7;}}\r
+if(c>=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_BOTTOM);}}};YAHOO.widget.Calendar_Core.prototype.renderFooter=function(){};YAHOO.widget.Calendar_Core.prototype._unload=function(e,cal){for(var c in cal.cells){c=null;}\r
+cal.cells=null;cal.tbody=null;cal.oDomContainer=null;cal.table=null;cal.headerCell=null;cal=null;};YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;}\r
+YAHOO.widget.Calendar_Core.prototype.renderRowHeader=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_ROW_HEADER);var useYear=this.pageDate.getFullYear();if(!YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)){useYear=workingDate.getFullYear();}\r
+var weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useYear,this.Options.START_WEEKDAY);cell.innerHTML=weekNum;if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderRowFooter=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_ROW_FOOTER);if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML="";var link=document.createElement("a");link.href="javascript:void(null);";link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));cell.appendChild(link);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.util.Dom.addClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.addMonths=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractMonths=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.addYears=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractYears=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar_Core.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar_Core.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar_Core.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar_Core.prototype.reset=function(){this.selectedDates.length=0;this.selectedDates=this._selectedDates.concat();this.pageDate=new Date(this._pageDate.getTime());this.onReset();};YAHOO.widget.Calendar_Core.prototype.clear=function(){this.selectedDates.length=0;this.pageDate=new Date(this.today.getTime());this.onClear();};YAHOO.widget.Calendar_Core.prototype.select=function(date){this.onBeforeSelect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a<aToBeSelected.length;++a){var toSelect=aToBeSelected[a];if(this._indexOfSelectedFieldArray(toSelect)==-1){this.selectedDates[this.selectedDates.length]=toSelect;}}\r
+if(this.parent){this.parent.sync(this);}\r
+this.onSelect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.selectCell=function(cellIndex){this.onBeforeSelect();this.cells=this.tbody.getElementsByTagName("TD");var cell=this.cells[cellIndex];var cellDate=this.cellDates[cellIndex];var dCellDate=this._toDate(cellDate);var selectDate=cellDate.concat();this.selectedDates.push(selectDate);if(this.parent){this.parent.sync(this);}\r
+this.renderCellStyleSelected(dCellDate,cell);this.onSelect();this.doCellMouseOut.call(cell,null,this);return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselect=function(date){this.onBeforeDeselect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a<aToBeSelected.length;++a){var toSelect=aToBeSelected[a];var index=this._indexOfSelectedFieldArray(toSelect);if(index!=-1){this.selectedDates.splice(index,1);}}\r
+if(this.parent){this.parent.sync(this);}\r
+this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectCell=function(i){this.onBeforeDeselect();this.cells=this.tbody.getElementsByTagName("TD");var cell=this.cells[i];var cellDate=this.cellDates[i];var cellDateIndex=this._indexOfSelectedFieldArray(cellDate);var dCellDate=this._toDate(cellDate);var selectDate=cellDate.concat();if(cellDateIndex>-1){if(this.pageDate.getMonth()==dCellDate.getMonth()&&this.pageDate.getFullYear()==dCellDate.getFullYear()){YAHOO.util.Dom.removeClass(cell,this.Style.CSS_CELL_SELECTED);}\r
+this.selectedDates.splice(cellDateIndex,1);}\r
+if(this.parent){this.parent.sync(this);}\r
+this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectAll=function(){this.onBeforeDeselect();var count=this.selectedDates.length;this.selectedDates.length=0;if(this.parent){this.parent.sync(this);}\r
+if(count>0){this.onDeselect();}\r
+return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype._toFieldArray=function(date){var returnDate=new Array();if(date instanceof Date){returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}else if(typeof date=='string'){returnDate=this._parseDates(date);}else if(date instanceof Array){for(var i=0;i<date.length;++i){var d=date[i];returnDate[returnDate.length]=[d.getFullYear(),d.getMonth()+1,d.getDate()];}}\r
+return returnDate;};YAHOO.widget.Calendar_Core.prototype._toDate=function(dateFieldArray){if(dateFieldArray instanceof Date){return dateFieldArray;}else{return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);}};YAHOO.widget.Calendar_Core.prototype._fieldArraysAreEqual=function(array1,array2){var match=false;if(array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]){match=true;}\r
+return match;};YAHOO.widget.Calendar_Core.prototype._indexOfSelectedFieldArray=function(find){var selected=-1;for(var s=0;s<this.selectedDates.length;++s){var sArray=this.selectedDates[s];if(find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]){selected=s;break;}}\r
+return selected;};YAHOO.widget.Calendar_Core.prototype.isDateOOM=function(date){var isOOM=false;if(date.getMonth()!=this.pageDate.getMonth()){isOOM=true;}\r
+return isOOM;};YAHOO.widget.Calendar_Core.prototype.onBeforeSelect=function(){if(!this.Options.MULTI_SELECT){this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}};YAHOO.widget.Calendar_Core.prototype.onSelect=function(){};YAHOO.widget.Calendar_Core.prototype.onBeforeDeselect=function(){};YAHOO.widget.Calendar_Core.prototype.onDeselect=function(){};YAHOO.widget.Calendar_Core.prototype.onChangePage=function(){var me=this;this.renderHeader();if(this.renderProcId){clearTimeout(this.renderProcId);}\r
+this.renderProcId=setTimeout(function(){me.render();me.renderProcId=null;},1);};YAHOO.widget.Calendar_Core.prototype.onRender=function(){};YAHOO.widget.Calendar_Core.prototype.onReset=function(){this.render();};YAHOO.widget.Calendar_Core.prototype.onClear=function(){this.render();};YAHOO.widget.Calendar_Core.prototype.validate=function(){return true;};YAHOO.widget.Calendar_Core.prototype._parseDate=function(sDate){var aDate=sDate.split(this.Locale.DATE_FIELD_DELIMITER);var rArray;if(aDate.length==2){rArray=[aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar_Core.MONTH_DAY;}else{rArray=[aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar_Core.DATE;}\r
+return rArray;};YAHOO.widget.Calendar_Core.prototype._parseDates=function(sDates){var aReturn=new Array();var aDates=sDates.split(this.Locale.DATE_DELIMITER);for(var d=0;d<aDates.length;++d){var sDate=aDates[d];if(sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var aRange=sDate.split(this.Locale.DATE_RANGE_DELIMITER);var dateStart=this._parseDate(aRange[0]);var dateEnd=this._parseDate(aRange[1]);var fullRange=this._parseRange(dateStart,dateEnd);aReturn=aReturn.concat(fullRange);}else{var aDate=this._parseDate(sDate);aReturn.push(aDate);}}\r
+return aReturn;};YAHOO.widget.Calendar_Core.prototype._parseRange=function(startDate,endDate){var dStart=new Date(startDate[0],startDate[1]-1,startDate[2]);var dCurrent=YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);var dEnd=new Date(endDate[0],endDate[1]-1,endDate[2]);var results=new Array();results.push(startDate);while(dCurrent.getTime()<=dEnd.getTime()){results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);dCurrent=YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);}\r
+return results;};YAHOO.widget.Calendar_Core.prototype.resetRenderers=function(){this.renderStack=this._renderStack.concat();};YAHOO.widget.Calendar_Core.prototype.clearElement=function(cell){cell.innerHTML="&nbsp;";cell.className="";};YAHOO.widget.Calendar_Core.prototype.addRenderer=function(sDates,fnRender){var aDates=this._parseDates(sDates);for(var i=0;i<aDates.length;++i){var aDate=aDates[i];if(aDate.length==2){if(aDate[0]instanceof Array){this._addRenderer(YAHOO.widget.Calendar_Core.RANGE,aDate,fnRender);}else{this._addRenderer(YAHOO.widget.Calendar_Core.MONTH_DAY,aDate,fnRender);}}else if(aDate.length==3){this._addRenderer(YAHOO.widget.Calendar_Core.DATE,aDate,fnRender);}}};YAHOO.widget.Calendar_Core.prototype._addRenderer=function(type,aDates,fnRender){var add=[type,aDates,fnRender];this.renderStack.unshift(add);this._renderStack=this.renderStack.concat();};YAHOO.widget.Calendar_Core.prototype.addMonthRenderer=function(month,fnRender){this._addRenderer(YAHOO.widget.Calendar_Core.MONTH,[month],fnRender);};YAHOO.widget.Calendar_Core.prototype.addWeekdayRenderer=function(weekday,fnRender){this._addRenderer(YAHOO.widget.Calendar_Core.WEEKDAY,[weekday],fnRender);};YAHOO.widget.Calendar_Core.setCssClasses=function(element,aStyles){element.className="";var className=aStyles.join(" ");element.className=className;};YAHOO.widget.Calendar_Core.prototype.clearAllBodyCellStyles=function(style){for(var c=0;c<this.cells.length;++c){YAHOO.util.Dom.removeClass(this.cells[c],style);}};YAHOO.widget.Calendar_Core.prototype.setMonth=function(month){this.pageDate.setMonth(month);};YAHOO.widget.Calendar_Core.prototype.setYear=function(year){this.pageDate.setFullYear(year);};YAHOO.widget.Calendar_Core.prototype.getSelectedDates=function(){var returnDates=new Array();for(var d=0;d<this.selectedDates.length;++d){var dateArray=this.selectedDates[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}\r
+returnDates.sort();return returnDates;};YAHOO.widget.Calendar_Core._getBrowser=function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1)\r
+return'opera';else if(ua.indexOf('msie')!=-1)\r
+return'ie';else if(ua.indexOf('safari')!=-1)\r
+return'safari';else if(ua.indexOf('gecko')!=-1)\r
+return'gecko';else\r
+return false;}\r
+YAHOO.widget.Calendar_Core.prototype.toString=function(){return"Calendar_Core "+this.id;}\r
+YAHOO.widget.Cal_Core=YAHOO.widget.Calendar_Core;YAHOO.widget.Calendar=function(id,containerId,monthyear,selected){if(arguments.length>0){this.init(id,containerId,monthyear,selected);}}\r
+YAHOO.widget.Calendar.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar.prototype.buildShell=function(){this.border=document.createElement("DIV");this.border.className=this.Style.CSS_CONTAINER;this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.border.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();};YAHOO.widget.Calendar.prototype.renderShell=function(){this.border.appendChild(this.table);this.oDomContainer.appendChild(this.border);this.shellRendered=true;};YAHOO.widget.Calendar.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;if(this.linkLeft){YAHOO.util.Event.removeListener(this.linkLeft,"mousedown",this.previousMonth);}\r
+this.linkLeft=document.createElement("A");this.linkLeft.innerHTML="&nbsp;";YAHOO.util.Event.addListener(this.linkLeft,"mousedown",this.previousMonth,this,true);this.linkLeft.style.backgroundImage="url("+this.Options.NAV_ARROW_LEFT+")";this.linkLeft.className=this.Style.CSS_NAV_LEFT;if(this.linkRight){YAHOO.util.Event.removeListener(this.linkRight,"mousedown",this.nextMonth);}\r
+this.linkRight=document.createElement("A");this.linkRight.innerHTML="&nbsp;";YAHOO.util.Event.addListener(this.linkRight,"mousedown",this.nextMonth,this,true);this.linkRight.style.backgroundImage="url("+this.Options.NAV_ARROW_RIGHT+")";this.linkRight.className=this.Style.CSS_NAV_RIGHT;headerContainer.appendChild(this.linkLeft);headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));headerContainer.appendChild(this.linkRight);this.headerCell.appendChild(headerContainer);};YAHOO.widget.Cal=YAHOO.widget.Calendar;YAHOO.widget.CalendarGroup=function(pageCount,id,containerId,monthyear,selected){if(arguments.length>0){this.init(pageCount,id,containerId,monthyear,selected);}}\r
+YAHOO.widget.CalendarGroup.prototype.init=function(pageCount,id,containerId,monthyear,selected){this.id=id;this.selectedDates=new Array();this.containerId=containerId;this.pageCount=pageCount;this.pages=new Array();for(var p=0;p<pageCount;++p){var cal=this.constructChild(id+"_"+p,this.containerId+"_"+p,monthyear,selected);cal.parent=this;cal.index=p;cal.pageDate.setMonth(cal.pageDate.getMonth()+p);cal._pageDate=new Date(cal.pageDate.getFullYear(),cal.pageDate.getMonth(),cal.pageDate.getDate());this.pages.push(cal);}\r
+this.doNextMonth=function(e,calGroup){calGroup.nextMonth();};this.doPreviousMonth=function(e,calGroup){calGroup.previousMonth();};};YAHOO.widget.CalendarGroup.prototype.setChildFunction=function(fnName,fn){for(var p=0;p<this.pageCount;++p){this.pages[p][fnName]=fn;}}\r
+YAHOO.widget.CalendarGroup.prototype.callChildFunction=function(fnName,args){for(var p=0;p<this.pageCount;++p){var page=this.pages[p];if(page[fnName]){var fn=page[fnName];fn.call(page,args);}}}\r
+YAHOO.widget.CalendarGroup.prototype.constructChild=function(id,containerId,monthyear,selected){return new YAHOO.widget.Calendar_Core(id,containerId,monthyear,selected);};YAHOO.widget.CalendarGroup.prototype.setMonth=function(month){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.setMonth(month+p);}};YAHOO.widget.CalendarGroup.prototype.setYear=function(year){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];if((cal.pageDate.getMonth()+1)==1&&p>0)\r
+{year+=1;}\r
+cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.render();}};YAHOO.widget.CalendarGroup.prototype.select=function(date){var ret;for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];ret=cal.select(date);}\r
+return ret;};YAHOO.widget.CalendarGroup.prototype.selectCell=function(cellIndex){var ret;for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];ret=cal.selectCell(cellIndex);}\r
+return ret;};YAHOO.widget.CalendarGroup.prototype.deselect=function(date){var ret;for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];ret=cal.deselect(date);}\r
+return ret;};YAHOO.widget.CalendarGroup.prototype.deselectAll=function(){var ret;for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];ret=cal.deselectAll();}\r
+return ret;};YAHOO.widget.CalendarGroup.prototype.deselectCell=function(cellIndex){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.deselectCell(cellIndex);}\r
+return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.reset=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.reset();}};YAHOO.widget.CalendarGroup.prototype.clear=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.clear();}};YAHOO.widget.CalendarGroup.prototype.nextMonth=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.nextMonth();}};YAHOO.widget.CalendarGroup.prototype.previousMonth=function(){for(var p=this.pages.length-1;p>=0;--p)\r
+{var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.nextYear();}};YAHOO.widget.CalendarGroup.prototype.previousYear=function(){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.previousYear();}};YAHOO.widget.CalendarGroup.prototype.sync=function(caller){var calendar;if(caller)\r
+{this.selectedDates=caller.selectedDates.concat();}else{var hash=new Object();var combinedDates=new Array();for(var p=0;p<this.pages.length;++p)\r
+{calendar=this.pages[p];var values=calendar.selectedDates;for(var v=0;v<values.length;++v)\r
+{var valueArray=values[v];hash[valueArray.toString()]=valueArray;}}\r
+for(var val in hash)\r
+{combinedDates[combinedDates.length]=hash[val];}\r
+this.selectedDates=combinedDates.concat();}\r
+for(p=0;p<this.pages.length;++p)\r
+{calendar=this.pages[p];if(!calendar.Options.MULTI_SELECT){calendar.clearAllBodyCellStyles(calendar.Config.Style.CSS_CELL_SELECTED);}\r
+calendar.selectedDates=this.selectedDates.concat();}\r
+return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.getSelectedDates=function(){var returnDates=new Array();for(var d=0;d<this.selectedDates.length;++d)\r
+{var dateArray=this.selectedDates[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}\r
+returnDates.sort();return returnDates;};YAHOO.widget.CalendarGroup.prototype.addRenderer=function(sDates,fnRender){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.addRenderer(sDates,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addMonthRenderer=function(month,fnRender){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.addMonthRenderer(month,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer=function(weekday,fnRender){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal.addWeekdayRenderer(weekday,fnRender);}};YAHOO.widget.CalendarGroup.prototype.wireEvent=function(eventName,fn){for(var p=0;p<this.pages.length;++p)\r
+{var cal=this.pages[p];cal[eventName]=fn;}};YAHOO.widget.CalendarGroup.prototype.toString=function(){return"CalendarGroup "+this.id;}\r
+YAHOO.widget.CalGrp=YAHOO.widget.CalendarGroup;YAHOO.widget.Calendar2up_Cal=function(id,containerId,monthyear,selected){if(arguments.length>0)\r
+{this.init(id,containerId,monthyear,selected);}}\r
+YAHOO.widget.Calendar2up_Cal.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar2up_Cal.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;if(this.index==0){if(this.linkLeft){YAHOO.util.Event.removeListener(this.linkLeft,"mousedown",this.parent.doPreviousMonth);}\r
+this.linkLeft=document.createElement("A");this.linkLeft.innerHTML="&nbsp;";this.linkLeft.style.backgroundImage="url("+this.Options.NAV_ARROW_LEFT+")";this.linkLeft.className=this.Style.CSS_NAV_LEFT;YAHOO.util.Event.addListener(this.linkLeft,"mousedown",this.parent.doPreviousMonth,this.parent);headerContainer.appendChild(this.linkLeft);}\r
+headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));if(this.index==1){if(this.linkRight){YAHOO.util.Event.removeListener(this.linkRight,"mousedown",this.parent.doNextMonth);}\r
+this.linkRight=document.createElement("A");this.linkRight.innerHTML="&nbsp;";this.linkRight.style.backgroundImage="url("+this.Options.NAV_ARROW_RIGHT+")";this.linkRight.className=this.Style.CSS_NAV_RIGHT;YAHOO.util.Event.addListener(this.linkRight,"mousedown",this.parent.doNextMonth,this.parent);headerContainer.appendChild(this.linkRight);}\r
+this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar2up=function(id,containerId,monthyear,selected){if(arguments.length>0)\r
+{this.buildWrapper(containerId);this.init(2,id,containerId,monthyear,selected);}}\r
+YAHOO.widget.Calendar2up.prototype=new YAHOO.widget.CalendarGroup();YAHOO.widget.Calendar2up.CSS_2UPWRAPPER="yui-cal2upwrapper";YAHOO.widget.Calendar2up.CSS_CONTAINER="yui-calcontainer";YAHOO.widget.Calendar2up.CSS_2UPCONTAINER="cal2up";YAHOO.widget.Calendar2up.CSS_2UPTITLE="title";YAHOO.widget.Calendar2up.CSS_2UPCLOSE="close-icon";YAHOO.widget.Calendar2up.prototype.constructChild=function(id,containerId,monthyear,selected){var cal=new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);return cal;};YAHOO.widget.Calendar2up.prototype.buildWrapper=function(containerId){var outerContainer=document.getElementById(containerId);outerContainer.className=YAHOO.widget.Calendar2up.CSS_2UPWRAPPER;var innerContainer=document.createElement("DIV");innerContainer.className=YAHOO.widget.Calendar2up.CSS_CONTAINER;innerContainer.id=containerId+"_inner";var cal1Container=document.createElement("DIV");cal1Container.id=containerId+"_0";cal1Container.className=YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;cal1Container.style.marginRight="10px";var cal2Container=document.createElement("DIV");cal2Container.id=containerId+"_1";cal2Container.className=YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;outerContainer.appendChild(innerContainer);innerContainer.appendChild(cal1Container);innerContainer.appendChild(cal2Container);this.innerContainer=innerContainer;this.outerContainer=outerContainer;}\r
+YAHOO.widget.Calendar2up.prototype.render=function(){this.renderHeader();YAHOO.widget.CalendarGroup.prototype.render.call(this);this.renderFooter();};YAHOO.widget.Calendar2up.prototype.renderHeader=function(){if(!this.title){this.title="";}\r
+if(!this.titleDiv)\r
+{this.titleDiv=document.createElement("DIV");if(this.title=="")\r
+{this.titleDiv.style.display="none";}}\r
+this.titleDiv.className=YAHOO.widget.Calendar2up.CSS_2UPTITLE;this.titleDiv.innerHTML=this.title;if(this.outerContainer.style.position=="absolute")\r
+{var linkClose=document.createElement("A");linkClose.href="javascript:void(null)";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this);var imgClose=document.createElement("IMG");imgClose.src=YAHOO.widget.Calendar_Core.IMG_ROOT+"us/my/bn/x_d.gif";imgClose.className=YAHOO.widget.Calendar2up.CSS_2UPCLOSE;linkClose.appendChild(imgClose);this.linkClose=linkClose;this.titleDiv.appendChild(linkClose);}\r
+this.innerContainer.insertBefore(this.titleDiv,this.innerContainer.firstChild);}\r
+YAHOO.widget.Calendar2up.prototype.hide=function(e,cal){if(!cal)\r
+{cal=this;}\r
+cal.outerContainer.style.display="none";}\r
+YAHOO.widget.Calendar2up.prototype.renderFooter=function(){}\r
+YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;\r
diff --git a/lib/yui/calendar/calendar.js b/lib/yui/calendar/calendar.js
new file mode 100755 (executable)
index 0000000..4e6e836
--- /dev/null
@@ -0,0 +1,2876 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+/**\r
+* @class\r
+* <p>YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility\r
+* used for adding, subtracting, and comparing dates.</p>\r
+*/\r
+YAHOO.widget.DateMath = new function() {\r
+\r
+       /**\r
+       * Constant field representing Day\r
+       * @type String\r
+       */\r
+       this.DAY = "D";\r
+\r
+       /**\r
+       * Constant field representing Week\r
+       * @type String\r
+       */\r
+       this.WEEK = "W";\r
+\r
+       /**\r
+       * Constant field representing Year\r
+       * @type String\r
+       */\r
+       this.YEAR = "Y";\r
+\r
+       /**\r
+       * Constant field representing Month\r
+       * @type String\r
+       */\r
+       this.MONTH = "M";\r
+\r
+       /**\r
+       * Constant field representing one day, in milliseconds\r
+       * @type Integer\r
+       */\r
+       this.ONE_DAY_MS = 1000*60*60*24;\r
+\r
+       /**\r
+       * Adds the specified amount of time to the this instance.\r
+       * @param {Date} date    The JavaScript Date object to perform addition on\r
+       * @param {string} field The this field constant to be used for performing addition.\r
+       * @param {Integer} amount       The number of units (measured in the field constant) to add to the date.\r
+       */\r
+       this.add = function(date, field, amount) {\r
+               var d = new Date(date.getTime());\r
+               switch (field) {\r
+                       case this.MONTH:\r
+                               var newMonth = date.getMonth() + amount;\r
+                               var years = 0;\r
+\r
+\r
+                               if (newMonth < 0) {\r
+                                       while (newMonth < 0) {\r
+                                               newMonth += 12;\r
+                                               years -= 1;\r
+                                       }\r
+                               } else if (newMonth > 11) {\r
+                                       while (newMonth > 11) {\r
+                                               newMonth -= 12;\r
+                                               years += 1;\r
+                                       }\r
+                               }\r
+                               \r
+                               d.setMonth(newMonth);\r
+                               d.setFullYear(date.getFullYear() + years);\r
+                               break;\r
+                       case this.DAY:\r
+                               d.setDate(date.getDate() + amount);\r
+                               break;\r
+                       case this.YEAR:\r
+                               d.setFullYear(date.getFullYear() + amount);\r
+                               break;\r
+                       case this.WEEK:\r
+                               d.setDate(date.getDate() + (amount * 7));\r
+                               break;\r
+               }\r
+               return d;\r
+       };\r
+\r
+       /**\r
+       * Subtracts the specified amount of time from the this instance.\r
+       * @param {Date} date    The JavaScript Date object to perform subtraction on\r
+       * @param {Integer} field        The this field constant to be used for performing subtraction.\r
+       * @param {Integer} amount       The number of units (measured in the field constant) to subtract from the date.\r
+       */\r
+       this.subtract = function(date, field, amount) {\r
+               return this.add(date, field, (amount*-1));\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is before another date on the calendar.\r
+       * @param {Date} date            The Date object to compare with the compare argument\r
+       * @param {Date} compareTo       The Date object to use for the comparison\r
+       * @return {Boolean} true if the date occurs before the compared date; false if not.\r
+       */\r
+       this.before = function(date, compareTo) {\r
+               var ms = compareTo.getTime();\r
+               if (date.getTime() < ms) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is after another date on the calendar.\r
+       * @param {Date} date            The Date object to compare with the compare argument\r
+       * @param {Date} compareTo       The Date object to use for the comparison\r
+       * @return {Boolean} true if the date occurs after the compared date; false if not.\r
+       */\r
+       this.after = function(date, compareTo) {\r
+               var ms = compareTo.getTime();\r
+               if (date.getTime() > ms) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+\r
+       /**\r
+       * Determines whether a given date is between two other dates on the calendar.\r
+       * @param {Date} date            The date to check for\r
+       * @param {Date} dateBegin       The start of the range\r
+       * @param {Date} dateEnd         The end of the range\r
+       * @return {Boolean} true if the date occurs between the compared dates; false if not.\r
+       */\r
+       this.between = function(date, dateBegin, dateEnd) {\r
+               if (this.after(date, dateBegin) && this.before(date, dateEnd)) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       };\r
+       \r
+       /**\r
+       * Retrieves a JavaScript Date object representing January 1 of any given year.\r
+       * @param {Integer} calendarYear         The calendar year for which to retrieve January 1\r
+       * @return {Date}        January 1 of the calendar year specified.\r
+       */\r
+       this.getJan1 = function(calendarYear) {\r
+               return new Date(calendarYear,0,1); \r
+       };\r
+\r
+       /**\r
+       * Calculates the number of days the specified date is from January 1 of the specified calendar year.\r
+       * Passing January 1 to this function would return an offset value of zero.\r
+       * @param {Date} date    The JavaScript date for which to find the offset\r
+       * @param {Integer} calendarYear The calendar year to use for determining the offset\r
+       * @return {Integer}     The number of days since January 1 of the given year\r
+       */\r
+       this.getDayOffset = function(date, calendarYear) {\r
+               var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.\r
+               \r
+               // Find the number of days the passed in date is away from the calendar year start\r
+               var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);\r
+               return dayOffset;\r
+       };\r
+\r
+       /**\r
+       * Calculates the week number for the given date. This function assumes that week 1 is the\r
+       * week in which January 1 appears, regardless of whether the week consists of a full 7 days.\r
+       * The calendar year can be specified to help find what a the week number would be for a given\r
+       * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or\r
+       * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction\r
+       * easily.\r
+       * @param {Date} date    The JavaScript date for which to find the week number\r
+       * @param {Integer} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is\r
+       *                                                                                       the calendar year of parameter "date".\r
+       * @param {Integer} weekStartsOn OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).\r
+       * @return {Integer}     The week number of the given date.\r
+       */\r
+       this.getWeekNumber = function(date, calendarYear, weekStartsOn) {\r
+               date.setHours(12,0,0,0);\r
+\r
+               if (! weekStartsOn) {\r
+                       weekStartsOn = 0;\r
+               }\r
+               if (! calendarYear) {\r
+                       calendarYear = date.getFullYear();\r
+               }\r
+               \r
+               var weekNum = -1;\r
+               \r
+               var jan1 = this.getJan1(calendarYear);\r
+\r
+               var jan1Offset = jan1.getDay() - weekStartsOn;\r
+               var jan1DayOfWeek = (jan1Offset >= 0 ? jan1Offset : (7 + jan1Offset));\r
+\r
+               var endOfWeek1 = this.add(jan1, this.DAY, (6 - jan1DayOfWeek));\r
+               endOfWeek1.setHours(23,59,59,999);\r
+\r
+               var month = date.getMonth();\r
+               var day = date.getDate();\r
+               var year = date.getFullYear();\r
+               \r
+               var dayOffset = this.getDayOffset(date, calendarYear); // Days since Jan 1, Calendar Year\r
+                       \r
+               if (dayOffset < 0 || this.before(date, endOfWeek1)) {\r
+                       weekNum = 1;\r
+               } else {\r
+                       weekNum = 2;\r
+                       var weekBegin = new Date(endOfWeek1.getTime() + 1);\r
+                       var weekEnd = this.add(weekBegin, this.WEEK, 1);\r
+\r
+                       while (! this.between(date, weekBegin, weekEnd)) {\r
+                               weekBegin = this.add(weekBegin, this.WEEK, 1);\r
+                               weekEnd = this.add(weekEnd, this.WEEK, 1);\r
+                               weekNum += 1;\r
+                       }\r
+               }\r
+               \r
+               return weekNum;\r
+       };\r
+\r
+       /**\r
+       * Determines if a given week overlaps two different years.\r
+       * @param {Date} weekBeginDate   The JavaScript Date representing the first day of the week.\r
+       * @return {Boolean}     true if the date overlaps two different years.\r
+       */\r
+       this.isYearOverlapWeek = function(weekBeginDate) {\r
+               var overlaps = false;\r
+               var nextWeek = this.add(weekBeginDate, this.DAY, 6);\r
+               if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {\r
+                       overlaps = true;\r
+               }\r
+               return overlaps;\r
+       };\r
+\r
+       /**\r
+       * Determines if a given week overlaps two different months.\r
+       * @param {Date} weekBeginDate   The JavaScript Date representing the first day of the week.\r
+       * @return {Boolean}     true if the date overlaps two different months.\r
+       */\r
+       this.isMonthOverlapWeek = function(weekBeginDate) {\r
+               var overlaps = false;\r
+               var nextWeek = this.add(weekBeginDate, this.DAY, 6);\r
+               if (nextWeek.getMonth() != weekBeginDate.getMonth()) {\r
+                       overlaps = true;\r
+               }\r
+               return overlaps;\r
+       };\r
+\r
+       /**\r
+       * Gets the first day of a month containing a given date.\r
+       * @param {Date} date    The JavaScript Date used to calculate the month start\r
+       * @return {Date}                The JavaScript Date representing the first day of the month\r
+       */\r
+       this.findMonthStart = function(date) {\r
+               var start = new Date(date.getFullYear(), date.getMonth(), 1);\r
+               return start;\r
+       };\r
+\r
+       /**\r
+       * Gets the last day of a month containing a given date.\r
+       * @param {Date} date    The JavaScript Date used to calculate the month end\r
+       * @return {Date}                The JavaScript Date representing the last day of the month\r
+       */\r
+       this.findMonthEnd = function(date) {\r
+               var start = this.findMonthStart(date);\r
+               var nextMonth = this.add(start, this.MONTH, 1);\r
+               var end = this.subtract(nextMonth, this.DAY, 1);\r
+               return end;\r
+       };\r
+\r
+       /**\r
+       * Clears the time fields from a given date, effectively setting the time to midnight.\r
+       * @param {Date} date    The JavaScript Date for which the time fields will be cleared\r
+       * @return {Date}                The JavaScript Date cleared of all time fields\r
+       */\r
+       this.clearTime = function(date) {\r
+               date.setHours(0,0,0,0);\r
+               return date;\r
+       };\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* <p>Calendar_Core is the base class for the Calendar widget. In its most basic\r
+* implementation, it has the ability to render a calendar widget on the page\r
+* that can be manipulated to select a single date, move back and forth between\r
+* months and years.</p>\r
+* <p>To construct the placeholder for the calendar widget, the code is as\r
+* follows:\r
+*      <xmp>\r
+*              <div id="cal1Container"></div>\r
+*      </xmp>\r
+* Note that the table can be replaced with any kind of element.\r
+* </p>\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar_Core = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+/**\r
+* The path to be used for images loaded for the Calendar\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.IMG_ROOT = (window.location.href.toLowerCase().indexOf("https") == 0 ? "https://a248.e.akamai.net/sec.yimg.com/i/" : "http://us.i1.yimg.com/us.yimg.com/i/");\r
+\r
+/**\r
+* Type constant used for renderers to represent an individual date (M/D/Y)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.DATE = "D";\r
+\r
+/**\r
+* Type constant used for renderers to represent an individual date across any year (M/D)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.MONTH_DAY = "MD";\r
+\r
+/**\r
+* Type constant used for renderers to represent a weekday\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.WEEKDAY = "WD";\r
+\r
+/**\r
+* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.RANGE = "R";\r
+\r
+/**\r
+* Type constant used for renderers to represent a month across any year\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.MONTH = "M";\r
+\r
+/**\r
+* Constant that represents the total number of date cells that are displayed in a given month\r
+* including \r
+* @final\r
+* @type Integer\r
+*/\r
+YAHOO.widget.Calendar_Core.DISPLAY_DAYS = 42;\r
+\r
+/**\r
+* Constant used for halting the execution of the remainder of the render stack\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.STOP_RENDER = "S";\r
+\r
+YAHOO.widget.Calendar_Core.prototype = {\r
+\r
+       /**\r
+       * The configuration object used to set up the calendars various locale and style options.\r
+       * @type Object\r
+       */\r
+       Config : null,\r
+\r
+       /**\r
+       * The parent CalendarGroup, only to be set explicitly by the parent group\r
+       * @type CalendarGroup\r
+       */      \r
+       parent : null,\r
+\r
+       /**\r
+       * The index of this item in the parent group\r
+       * @type Integer\r
+       */\r
+       index : -1,\r
+\r
+       /**\r
+       * The collection of calendar table cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       cells : null,\r
+\r
+       /**\r
+       * The collection of calendar week header cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       weekHeaderCells : null,\r
+\r
+       /**\r
+       * The collection of calendar week footer cells\r
+       * @type HTMLTableCellElement[]\r
+       */\r
+       weekFooterCells : null,\r
+       \r
+       /**\r
+       * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].\r
+       * @type Array[](Integer[])\r
+       */\r
+       cellDates : null,\r
+\r
+       /**\r
+       * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.\r
+       * @type String\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.\r
+       * @type HTMLElement\r
+       */\r
+       oDomContainer : null,\r
+\r
+       /**\r
+       * A Date object representing today's date.\r
+       * @type Date\r
+       */\r
+       today : null,\r
+\r
+       /**\r
+       * The list of render functions, along with required parameters, used to render cells. \r
+       * @type Array[]\r
+       */\r
+       renderStack : null,\r
+\r
+       /**\r
+       * A copy of the initial render functions created before rendering.\r
+       * @type Array\r
+       * @private\r
+       */\r
+       _renderStack : null,\r
+\r
+       /**\r
+       * A Date object representing the month/year that the calendar is currently set to\r
+       * @type Date\r
+       */\r
+       pageDate : null,\r
+\r
+       /**\r
+       * A Date object representing the month/year that the calendar is initially set to\r
+       * @type Date\r
+       * @private\r
+       */\r
+       _pageDate : null,\r
+       \r
+       /**\r
+       * A Date object representing the minimum selectable date\r
+       * @type Date\r
+       */\r
+       minDate : null,\r
+       \r
+       /**\r
+       * A Date object representing the maximum selectable date\r
+       * @type Date\r
+       */\r
+       maxDate : null,\r
+       \r
+       /**\r
+       * The list of currently selected dates. The data format for this local collection is \r
+       * an array of date field arrays, e.g:\r
+       * [\r
+       *       [2004,5,25],\r
+       *       [2004,5,26]\r
+       * ]\r
+       * @type Array[](Integer[])\r
+       */\r
+       selectedDates : null,\r
+\r
+       /**\r
+       * The private list of initially selected dates.\r
+       * @type Array\r
+       * @private\r
+       */\r
+       _selectedDates : null,\r
+\r
+       /**\r
+       * A boolean indicating whether the shell of the calendar has already been rendered to the page\r
+       * @type Boolean\r
+       */      \r
+       shellRendered : false,\r
+\r
+       /**\r
+       * The HTML table element that represents this calendar\r
+       * @type HTMLTableElement\r
+       */      \r
+       table : null,\r
+\r
+       /**\r
+       * The HTML cell element that represents the main header cell TH used in the calendar table\r
+       * @type HTMLTableCellElement\r
+       */      \r
+       headerCell : null\r
+};\r
+\r
+\r
+\r
+/**\r
+* Initializes the calendar widget. This method must be called by all subclass constructors.\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.init = function(id, containerId, monthyear, selected) {\r
+       this.setupConfig();\r
+\r
+       this.id = id;\r
+\r
+       this.cellDates = new Array();\r
+       \r
+       this.cells = new Array();\r
+       \r
+       this.renderStack = new Array();\r
+       this._renderStack = new Array();\r
+\r
+       this.oDomContainer = document.getElementById(containerId);\r
+       \r
+       this.today = new Date();\r
+       YAHOO.widget.DateMath.clearTime(this.today);\r
+\r
+       var month;\r
+       var year;\r
+\r
+       if (monthyear) {\r
+               var aMonthYear = monthyear.split(this.Locale.DATE_FIELD_DELIMITER);\r
+               month = parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);\r
+               year = parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);\r
+       } else {\r
+               month = this.today.getMonth()+1;\r
+               year = this.today.getFullYear();\r
+       }\r
+\r
+       this.pageDate = new Date(year, month-1, 1);\r
+       this._pageDate = new Date(this.pageDate.getTime());\r
+\r
+       if (selected) {\r
+               this.selectedDates = this._parseDates(selected);\r
+               this._selectedDates = this.selectedDates.concat();\r
+       } else {\r
+               this.selectedDates = new Array();\r
+               this._selectedDates = new Array();\r
+       }\r
+\r
+       this.wireDefaultEvents();\r
+       this.wireCustomEvents();\r
+};\r
+\r
+\r
+/**\r
+* Wires the local DOM events for the Calendar, including cell selection, hover, and\r
+* default navigation that is used for moving back and forth between calendar pages.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents = function() {\r
+       \r
+       /**\r
+       * The default event function that is attached to a date link within a calendar cell\r
+       * when the calendar is rendered. \r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       */\r
+       this.doSelectCell = function(e, cal) {          \r
+               var cell = this;\r
+               var index = cell.index;\r
+               var d = cal.cellDates[index];\r
+               var date = new Date(d[0],d[1]-1,d[2]);\r
+               \r
+               if (! cal.isDateOOM(date) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_RESTRICTED) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_OOB)) {\r
+                       if (cal.Options.MULTI_SELECT) {\r
+                               var link = cell.getElementsByTagName("A")[0];\r
+                               link.blur();\r
+                               \r
+                               var cellDate = cal.cellDates[index];\r
+                               var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);\r
+                               \r
+                               if (cellDateIndex > -1) {       \r
+                                       cal.deselectCell(index);\r
+                               } else {\r
+                                       cal.selectCell(index);\r
+                               }       \r
+                               \r
+                       } else {\r
+                               var link = cell.getElementsByTagName("A")[0];\r
+                               link.blur()\r
+                               cal.selectCell(index);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+       * The event that is executed when the user hovers over a cell\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */\r
+       this.doCellMouseOver = function(e, cal) {\r
+               var cell = this;\r
+               var index = cell.index;\r
+               var d = cal.cellDates[index];\r
+               var date = new Date(d[0],d[1]-1,d[2]);\r
+\r
+               if (! cal.isDateOOM(date) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_RESTRICTED) && ! YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_OOB)) {\r
+                       YAHOO.util.Dom.addClass(cell, cal.Style.CSS_CELL_HOVER);\r
+               }\r
+       }\r
+\r
+       /**\r
+       * The event that is executed when the user moves the mouse out of a cell\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */\r
+       this.doCellMouseOut = function(e, cal) {\r
+               YAHOO.util.Dom.removeClass(this, cal.Style.CSS_CELL_HOVER);\r
+       }\r
+       \r
+       /**\r
+       * A wrapper event that executes the nextMonth method through a DOM event\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */      \r
+       this.doNextMonth = function(e, cal) {\r
+               cal.nextMonth();\r
+       }\r
+\r
+       /**\r
+       * A wrapper event that executes the previousMonth method through a DOM event\r
+       * @param        e               The event\r
+       * @param        cal             A reference to the calendar passed by the Event utility\r
+       * @private\r
+       */              \r
+       this.doPreviousMonth = function(e, cal) {\r
+               cal.previousMonth();\r
+       }\r
+}\r
+\r
+/**\r
+* This function can be extended by subclasses to attach additional DOM events to\r
+* the calendar. By default, this method is unimplemented.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.wireCustomEvents = function() { }\r
+\r
+/**\r
+This method is called to initialize the widget configuration variables, including\r
+style, localization, and other display and behavioral options.\r
+<p>Config: Container for the CSS style configuration variables.</p>\r
+<p><strong>Config.Style</strong> - Defines the CSS classes used for different calendar elements</p>\r
+<blockquote>\r
+       <div><em>CSS_CALENDAR</em> : Container table</div>\r
+       <div><em>CSS_HEADER</em> : </div>\r
+       <div><em>CSS_HEADER_TEXT</em> : Calendar header</div>\r
+       <div><em>CSS_FOOTER</em> : Calendar footer</div>\r
+       <div><em>CSS_CELL</em> : Calendar day cell</div>\r
+       <div><em>CSS_CELL_OOM</em> : Calendar OOM (out of month) cell</div>\r
+       <div><em>CSS_CELL_SELECTED</em> : Calendar selected cell</div>\r
+       <div><em>CSS_CELL_RESTRICTED</em> : Calendar restricted cell</div>\r
+       <div><em>CSS_CELL_TODAY</em> : Calendar cell for today's date</div>\r
+       <div><em>CSS_ROW_HEADER</em> : The cell preceding a row (used for week number by default)</div>\r
+       <div><em>CSS_ROW_FOOTER</em> : The cell following a row (not implemented by default)</div>\r
+       <div><em>CSS_WEEKDAY_CELL</em> : The cells used for labeling weekdays</div>\r
+       <div><em>CSS_WEEKDAY_ROW</em> : The row containing the weekday label cells</div>\r
+       <div><em>CSS_CONTAINER</em> : The border style used for the default UED rendering</div>\r
+       <div><em>CSS_2UPWRAPPER</em> : Special container class used to properly adjust the sizing and float</div>\r
+       <div><em>CSS_NAV_LEFT</em> : Left navigation arrow</div>\r
+       <div><em>CSS_NAV_RIGHT</em> : Right navigation arrow</div>\r
+       <div><em>CSS_CELL_TOP</em> : Outlying cell along the top row</div>\r
+       <div><em>CSS_CELL_LEFT</em> : Outlying cell along the left row</div>\r
+       <div><em>CSS_CELL_RIGHT</em> : Outlying cell along the right row</div>\r
+       <div><em>CSS_CELL_BOTTOM</em> : Outlying cell along the bottom row</div>\r
+       <div><em>CSS_CELL_HOVER</em> : Cell hover style</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT1</em> : Highlight color 1 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT2</em> : Highlight color 2 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT3</em> : Highlight color 3 for styling cells</div>\r
+       <div><em>CSS_CELL_HIGHLIGHT4</em> : Highlight color 4 for styling cells</div>\r
+\r
+</blockquote>\r
+<p><strong>Config.Locale</strong> - Defines the locale string arrays used for localization</p>\r
+<blockquote>\r
+       <div><em>MONTHS_SHORT</em> : Array of 12 months in short format ("Jan", "Feb", etc.)</div>\r
+       <div><em>MONTHS_LONG</em> : Array of 12 months in short format ("Jan", "Feb", etc.)</div>\r
+       <div><em>WEEKDAYS_1CHAR</em> : Array of 7 days in 1-character format ("S", "M", etc.)</div>\r
+       <div><em>WEEKDAYS_SHORT</em> : Array of 7 days in short format ("Su", "Mo", etc.)</div>\r
+       <div><em>WEEKDAYS_MEDIUM</em> : Array of 7 days in medium format ("Sun", "Mon", etc.)</div>\r
+       <div><em>WEEKDAYS_LONG</em> : Array of 7 days in long format ("Sunday", "Monday", etc.)</div>\r
+       <div><em>DATE_DELIMITER</em> : The value used to delimit series of multiple dates (Default: ",")</div>\r
+       <div><em>DATE_FIELD_DELIMITER</em> : The value used to delimit date fields (Default: "/")</div>\r
+       <div><em>DATE_RANGE_DELIMITER</em> : The value used to delimit date fields (Default: "-")</div>\r
+       <div><em>MY_MONTH_POSITION</em> : The value used to determine the position of the month in a month/year combo (e.g. 12/2005) (Default: 1)</div>\r
+       <div><em>MY_YEAR_POSITION</em> : The value used to determine the position of the year in a month/year combo (e.g. 12/2005) (Default: 2)</div>   \r
+       <div><em>MD_MONTH_POSITION</em> : The value used to determine the position of the month in a month/day combo (e.g. 12/25) (Default: 1)</div>\r
+       <div><em>MD_DAY_POSITION</em> : The value used to determine the position of the day in a month/day combo (e.g. 12/25) (Default: 2)</div>\r
+       <div><em>MDY_MONTH_POSITION</em> : The value used to determine the position of the month in a month/day/year combo (e.g. 12/25/2005) (Default: 1)</div>\r
+       <div><em>MDY_DAY_POSITION</em> : The value used to determine the position of the day in a month/day/year combo (e.g. 12/25/2005) (Default: 2)</div>\r
+       <div><em>MDY_YEAR_POSITION</em> : The value used to determine the position of the year in a month/day/year combo (e.g. 12/25/2005) (Default: 3)</div>\r
+</blockquote>\r
+<p><strong>Config.Options</strong> - Defines other configurable calendar widget options</p>\r
+<blockquote>\r
+       <div><em>SHOW_WEEKDAYS</em> : Boolean, determines whether to display the weekday headers (defaults to true)</div>\r
+       <div><em>LOCALE_MONTHS</em> : Array, points to the desired Config.Locale array (defaults to Config.Locale.MONTHS_LONG)</div>\r
+       <div><em>LOCALE_WEEKDAYS</em> : Array, points to the desired Config.Locale array (defaults to Config.Locale.WEEKDAYS_SHORT)</div>\r
+       <div><em>START_WEEKDAY</em> : Integer, 0-6, representing the day that a week begins on</div>\r
+       <div><em>SHOW_WEEK_HEADER</em> : Boolean, determines whether to display row headers</div>\r
+       <div><em>SHOW_WEEK_FOOTER</em> : Boolean, determines whether to display row footers</div>\r
+       <div><em>HIDE_BLANK_WEEKS</em> : Boolean, determines whether to hide extra weeks that are completely OOM</div>\r
+       <div><em>NAV_ARROW_LEFT</em> : String, the image path used for the left navigation arrow</div>\r
+       <div><em>NAV_ARROW_RIGHT</em> : String, the image path used for the right navigation arrow</div>\r
+</blockquote>\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setupConfig = function() {\r
+       /**\r
+       * Container for the CSS style configuration variables.\r
+       */\r
+       this.Config = new Object();\r
+       \r
+       this.Config.Style = {\r
+               // Style variables\r
+               CSS_ROW_HEADER: "calrowhead",\r
+               CSS_ROW_FOOTER: "calrowfoot",\r
+               CSS_CELL : "calcell",\r
+               CSS_CELL_SELECTED : "selected",\r
+               CSS_CELL_RESTRICTED : "restricted",\r
+               CSS_CELL_TODAY : "today",\r
+               CSS_CELL_OOM : "oom",\r
+               CSS_CELL_OOB : "previous",\r
+               CSS_HEADER : "calheader",\r
+               CSS_HEADER_TEXT : "calhead",\r
+               CSS_WEEKDAY_CELL : "calweekdaycell",\r
+               CSS_WEEKDAY_ROW : "calweekdayrow",\r
+               CSS_FOOTER : "calfoot",\r
+               CSS_CALENDAR : "yui-calendar",\r
+               CSS_CONTAINER : "yui-calcontainer",\r
+               CSS_2UPWRAPPER : "yui-cal2upwrapper", \r
+               CSS_NAV_LEFT : "calnavleft",\r
+               CSS_NAV_RIGHT : "calnavright",\r
+               CSS_CELL_TOP : "calcelltop",\r
+               CSS_CELL_LEFT : "calcellleft",\r
+               CSS_CELL_RIGHT : "calcellright",\r
+               CSS_CELL_BOTTOM : "calcellbottom",\r
+               CSS_CELL_HOVER : "calcellhover",\r
+               CSS_CELL_HIGHLIGHT1 : "highlight1",\r
+               CSS_CELL_HIGHLIGHT2 : "highlight2",\r
+               CSS_CELL_HIGHLIGHT3 : "highlight3",\r
+               CSS_CELL_HIGHLIGHT4 : "highlight4"\r
+       };\r
+\r
+       this.Style = this.Config.Style;\r
+\r
+       this.Config.Locale = {\r
+               // Locale definition\r
+               MONTHS_SHORT : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],\r
+               MONTHS_LONG : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],\r
+               WEEKDAYS_1CHAR : ["S", "M", "T", "W", "T", "F", "S"],\r
+               WEEKDAYS_SHORT : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],\r
+               WEEKDAYS_MEDIUM : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],\r
+               WEEKDAYS_LONG : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],\r
+               DATE_DELIMITER : ",",\r
+               DATE_FIELD_DELIMITER : "/",\r
+               DATE_RANGE_DELIMITER : "-",\r
+               MY_MONTH_POSITION : 1,\r
+               MY_YEAR_POSITION : 2,\r
+               MD_MONTH_POSITION : 1,\r
+               MD_DAY_POSITION : 2,\r
+               MDY_MONTH_POSITION : 1,\r
+               MDY_DAY_POSITION : 2,\r
+               MDY_YEAR_POSITION : 3\r
+       };\r
+\r
+       this.Locale = this.Config.Locale;\r
+\r
+       this.Config.Options = {\r
+               // Configuration variables\r
+               MULTI_SELECT : false,\r
+               SHOW_WEEKDAYS : true,\r
+               START_WEEKDAY : 0,\r
+               SHOW_WEEK_HEADER : false,\r
+               SHOW_WEEK_FOOTER : false,\r
+               HIDE_BLANK_WEEKS : false,\r
+               NAV_ARROW_LEFT : YAHOO.widget.Calendar_Core.IMG_ROOT + "us/tr/callt.gif",\r
+               NAV_ARROW_RIGHT : YAHOO.widget.Calendar_Core.IMG_ROOT + "us/tr/calrt.gif"\r
+       };\r
+\r
+       this.Options = this.Config.Options;\r
+\r
+       this.customConfig();\r
+\r
+       if (! this.Options.LOCALE_MONTHS) {\r
+               this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;\r
+       }\r
+       if (! this.Options.LOCALE_WEEKDAYS) {\r
+               this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;\r
+       }\r
+\r
+       // If true, reconfigure weekday arrays to place Mondays first\r
+       if (this.Options.START_WEEKDAY > 0) {\r
+               for (var w=0;w<this.Options.START_WEEKDAY;++w) {\r
+                       this.Locale.WEEKDAYS_SHORT.push(this.Locale.WEEKDAYS_SHORT.shift());\r
+                       this.Locale.WEEKDAYS_MEDIUM.push(this.Locale.WEEKDAYS_MEDIUM.shift());\r
+                       this.Locale.WEEKDAYS_LONG.push(this.Locale.WEEKDAYS_LONG.shift());              \r
+               }\r
+       }\r
+};\r
+\r
+/**\r
+* This method is called when subclasses need to override configuration variables\r
+* or create new ones. Values can be explicitly set as follows:\r
+* <blockquote><code>\r
+*      this.Config.Style.CSS_CELL = "newcalcell";\r
+*      this.Config.Locale.MONTHS_SHORT = ["Jan", "Fv", "Mars", "Avr", "Mai", "Juin", "Juil", "Aot", "Sept", "Oct", "Nov", "Dc"];\r
+* </code></blockquote>\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.customConfig = function() { };\r
+\r
+/**\r
+* Builds the date label that will be displayed in the calendar header or\r
+* footer, depending on configuration.\r
+* @return      The formatted calendar month label\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildMonthLabel = function() {\r
+       var text = this.Options.LOCALE_MONTHS[this.pageDate.getMonth()] + " " + this.pageDate.getFullYear();\r
+       return text;\r
+};\r
+\r
+/**\r
+* Builds the date digit that will be displayed in calendar cells\r
+* @return      The formatted day label\r
+* @type        String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildDayLabel = function(workingDate) {\r
+       var day = workingDate.getDate();\r
+       return day;\r
+};\r
+\r
+\r
+\r
+/**\r
+* Builds the calendar table shell that will be filled in with dates and formatting.\r
+* This method calls buildShellHeader, buildShellBody, and buildShellFooter (in that order) \r
+* to construct the pieces of the calendar table. The construction of the shell should\r
+* only happen one time when the calendar is initialized.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShell = function() {\r
+       \r
+       this.table = document.createElement("TABLE");\r
+       this.table.cellSpacing = 0;     \r
+       YAHOO.widget.Calendar_Core.setCssClasses(this.table, [this.Style.CSS_CALENDAR]);\r
+\r
+       this.table.id = this.id;\r
+       \r
+       this.buildShellHeader();\r
+       this.buildShellBody();\r
+       this.buildShellFooter();\r
+       \r
+       YAHOO.util.Event.addListener(window, "unload", this._unload, this);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell header by inserting a THEAD into the local calendar table.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellHeader = function() {\r
+       var head = document.createElement("THEAD");\r
+       var headRow = document.createElement("TR");\r
+\r
+       var headerCell = document.createElement("TH");\r
+       \r
+       var colSpan = 7;\r
+       if (this.Config.Options.SHOW_WEEK_HEADER) {\r
+               this.weekHeaderCells = new Array();\r
+               colSpan += 1;\r
+       }\r
+       if (this.Config.Options.SHOW_WEEK_FOOTER) {\r
+               this.weekFooterCells = new Array();\r
+               colSpan += 1;\r
+       }       \r
+       \r
+       headerCell.colSpan = colSpan;\r
+       \r
+       YAHOO.widget.Calendar_Core.setCssClasses(headerCell,[this.Style.CSS_HEADER_TEXT]);\r
+\r
+       this.headerCell = headerCell;\r
+\r
+       headRow.appendChild(headerCell);\r
+       head.appendChild(headRow);\r
+\r
+       // Append day labels, if needed\r
+       if (this.Options.SHOW_WEEKDAYS) {\r
+               var row = document.createElement("TR");\r
+               var fillerCell;\r
+\r
+               YAHOO.widget.Calendar_Core.setCssClasses(row,[this.Style.CSS_WEEKDAY_ROW]);\r
+               \r
+               if (this.Config.Options.SHOW_WEEK_HEADER) {\r
+                       fillerCell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       row.appendChild(fillerCell);\r
+               }\r
+               \r
+               for(var i=0;i<this.Options.LOCALE_WEEKDAYS.length;++i) {\r
+                       var cell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       cell.innerHTML=this.Options.LOCALE_WEEKDAYS[i];\r
+                       row.appendChild(cell);\r
+               }\r
+\r
+               if (this.Config.Options.SHOW_WEEK_FOOTER) {\r
+                       fillerCell = document.createElement("TH");\r
+                       YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);\r
+                       row.appendChild(fillerCell);\r
+               }\r
+                               \r
+               head.appendChild(row);\r
+       }\r
+\r
+       this.table.appendChild(head);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell body (6 weeks by 7 days)\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellBody = function() {\r
+       // This should only get executed once\r
+       this.tbody = document.createElement("TBODY");\r
+\r
+       for (var r=0;r<6;++r) {\r
+               var row = document.createElement("TR");\r
+               \r
+               for (var c=0;c<this.headerCell.colSpan;++c) {\r
+                       var cell;\r
+                       if (this.Config.Options.SHOW_WEEK_HEADER && c===0) { // Row header\r
+                               cell = document.createElement("TH");\r
+                               this.weekHeaderCells[this.weekHeaderCells.length] = cell;\r
+                       } else if (this.Config.Options.SHOW_WEEK_FOOTER && c==(this.headerCell.colSpan-1)){ // Row footer\r
+                               cell = document.createElement("TH");\r
+                               this.weekFooterCells[this.weekFooterCells.length] = cell;\r
+                       } else {\r
+                               cell = document.createElement("TD");\r
+                               this.cells[this.cells.length] = cell;\r
+                               YAHOO.widget.Calendar_Core.setCssClasses(cell, [this.Style.CSS_CELL]);\r
+                               YAHOO.util.Event.addListener(cell, "click", this.doSelectCell, this);\r
+\r
+                               YAHOO.util.Event.addListener(cell, "mouseover", this.doCellMouseOver, this);\r
+                               YAHOO.util.Event.addListener(cell, "mouseout", this.doCellMouseOut, this);\r
+                       }\r
+                       row.appendChild(cell);\r
+               }\r
+               this.tbody.appendChild(row);\r
+       }\r
+       \r
+       this.table.appendChild(this.tbody);\r
+};\r
+\r
+/**\r
+* Builds the calendar shell footer. In the default implementation, there is\r
+* no footer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.buildShellFooter = function() { };\r
+\r
+/**\r
+* Outputs the calendar shell to the DOM, inserting it into the placeholder element.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderShell = function() {\r
+       this.oDomContainer.appendChild(this.table);\r
+       this.shellRendered = true;\r
+};\r
+\r
+/**\r
+* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute\r
+* when the method is called: renderHeader, renderBody, renderFooter.\r
+* Refer to the documentation for those methods for information on \r
+* individual render tasks.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.render = function() {\r
+       if (! this.shellRendered) {\r
+               this.buildShell();\r
+               this.renderShell();\r
+       }\r
+\r
+       this.resetRenderers();\r
+\r
+       this.cellDates.length = 0;\r
+\r
+       // Find starting day of the current month\r
+       var workingDate = YAHOO.widget.DateMath.findMonthStart(this.pageDate);\r
+\r
+       this.renderHeader();\r
+       this.renderBody(workingDate);\r
+       this.renderFooter();\r
+\r
+       this.onRender();\r
+};\r
+\r
+\r
+\r
+/**\r
+* Appends the header contents into the widget header.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderHeader = function() {\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+/**\r
+* Appends the calendar body. The default implementation calculates the number of\r
+* OOM (out of month) cells that need to be rendered at the start of the month, renders those, \r
+* and renders all the day cells using the built-in cell rendering methods.\r
+*\r
+* While iterating through all of the cells, the calendar checks for renderers in the\r
+* local render stack that match the date of the current cell, and then applies styles\r
+* as necessary.\r
+* \r
+* @param {Date}        workingDate     The current working Date object being used to generate the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderBody = function(workingDate) {\r
+\r
+       this.preMonthDays = workingDate.getDay();\r
+       if (this.Options.START_WEEKDAY > 0) {\r
+               this.preMonthDays -= this.Options.START_WEEKDAY;\r
+       }\r
+       if (this.preMonthDays < 0) {\r
+               this.preMonthDays += 7;\r
+       }\r
+       \r
+       this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();\r
+       this.postMonthDays = YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;\r
+       \r
+       workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);\r
+       \r
+       var weekRowIndex = 0;\r
+       \r
+       for (var c=0;c<this.cells.length;++c) {\r
+               var cellRenderers = new Array();\r
+               \r
+               var cell = this.cells[c];\r
+               this.clearElement(cell);\r
+\r
+               cell.index = c;\r
+               cell.id = this.id + "_cell" + c;\r
+               \r
+               this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]; // Add this date to cellDates\r
+\r
+               if (workingDate.getDay() == this.Options.START_WEEKDAY) {\r
+                       var rowHeaderCell = null;\r
+                       var rowFooterCell = null;\r
+                       \r
+                       if (this.Options.SHOW_WEEK_HEADER) {\r
+                               rowHeaderCell = this.weekHeaderCells[weekRowIndex];\r
+                               this.clearElement(rowHeaderCell);\r
+                       }\r
+                       \r
+                       if (this.Options.SHOW_WEEK_FOOTER) {\r
+                               rowFooterCell = this.weekFooterCells[weekRowIndex];\r
+                               this.clearElement(rowFooterCell);\r
+                       }                       \r
+                       \r
+                       if (this.Options.HIDE_BLANK_WEEKS && this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+                               // The first day of the week is not in this month, and it's not an overlap week\r
+                               continue;\r
+                       } else {\r
+                               if (rowHeaderCell) {\r
+                                       this.renderRowHeader(workingDate, rowHeaderCell);\r
+                               }\r
+                               if (rowFooterCell) {\r
+                                       this.renderRowFooter(workingDate, rowFooterCell);\r
+                               }       \r
+                       }\r
+               }\r
+\r
+               \r
+\r
+               var renderer = null;\r
+               \r
+               if (workingDate.getFullYear()   == this.today.getFullYear() &&\r
+                       workingDate.getMonth()          == this.today.getMonth() &&\r
+                       workingDate.getDate()           == this.today.getDate()) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellStyleToday;\r
+               }\r
+               \r
+               if (this.isDateOOM(workingDate)) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellNotThisMonth;\r
+               } else {\r
+                       for (var r=0;r<this.renderStack.length;++r) {\r
+                               var rArray = this.renderStack[r];\r
+                               var type = rArray[0];\r
+                               \r
+                               var month;\r
+                               var day;\r
+                               var year;\r
+\r
+                               switch (type) {\r
+                                       case YAHOO.widget.Calendar_Core.DATE:\r
+                                               month = rArray[1][1];\r
+                                               day = rArray[1][2];\r
+                                               year = rArray[1][0];\r
+\r
+                                               if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {\r
+                                                       renderer = rArray[2];\r
+                                                       this.renderStack.splice(r,1);\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.MONTH_DAY:\r
+                                               month = rArray[1][0];\r
+                                               day = rArray[1][1];\r
+                                               \r
+                                               if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {\r
+                                                       renderer = rArray[2];\r
+                                                       this.renderStack.splice(r,1);\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.RANGE:\r
+                                               var date1 = rArray[1][0];\r
+                                               var date2 = rArray[1][1];\r
+\r
+                                               var d1month = date1[1];\r
+                                               var d1day = date1[2];\r
+                                               var d1year = date1[0];\r
+                                               \r
+                                               var d1 = new Date(d1year, d1month-1, d1day);\r
+\r
+                                               var d2month = date2[1];\r
+                                               var d2day = date2[2];\r
+                                               var d2year = date2[0];\r
+\r
+                                               var d2 = new Date(d2year, d2month-1, d2day);\r
+\r
+                                               if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {\r
+                                                       renderer = rArray[2];\r
+\r
+                                                       if (workingDate.getTime()==d2.getTime()) { \r
+                                                               this.renderStack.splice(r,1);\r
+                                                       }\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.WEEKDAY:\r
+                                               \r
+                                               var weekday = rArray[1][0];\r
+                                               if (workingDate.getDay()+1 == weekday) {\r
+                                                       renderer = rArray[2];\r
+                                               }\r
+                                               break;\r
+                                       case YAHOO.widget.Calendar_Core.MONTH:\r
+                                               \r
+                                               month = rArray[1][0];\r
+                                               if (workingDate.getMonth()+1 == month) {\r
+                                                       renderer = rArray[2];\r
+                                               }\r
+                                               break;\r
+                               }\r
+                               \r
+                               if (renderer) {\r
+                                       cellRenderers[cellRenderers.length]=renderer;\r
+                               }\r
+                       }\r
+\r
+               }\r
+\r
+               if (this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()]) > -1) {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellStyleSelected; \r
+               }\r
+\r
+               if (this.minDate) {\r
+                       this.minDate = YAHOO.widget.DateMath.clearTime(this.minDate);\r
+               }\r
+               if (this.maxDate) {\r
+                       this.maxDate = YAHOO.widget.DateMath.clearTime(this.maxDate);\r
+               }\r
+\r
+               if (\r
+                       (this.minDate && (workingDate.getTime() < this.minDate.getTime())) ||\r
+                       (this.maxDate && (workingDate.getTime() > this.maxDate.getTime()))\r
+               ) {\r
+                       cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;\r
+               } else {\r
+                       cellRenderers[cellRenderers.length]=this.renderCellDefault;     \r
+               }\r
+               \r
+               for (var x=0;x<cellRenderers.length;++x) {\r
+                       var ren = cellRenderers[x];\r
+                       if (ren.call(this,workingDate,cell) == YAHOO.widget.Calendar_Core.STOP_RENDER) {\r
+                               break;\r
+                       }\r
+               }\r
+               \r
+               workingDate = YAHOO.widget.DateMath.add(workingDate, YAHOO.widget.DateMath.DAY, 1); // Go to the next day\r
+               if (workingDate.getDay() == this.Options.START_WEEKDAY) {\r
+                       weekRowIndex += 1;\r
+               }\r
+\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);\r
+\r
+               if (c >= 0 && c <= 6) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);\r
+               }\r
+               if ((c % 7) == 0) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);\r
+               }\r
+               if (((c+1) % 7) == 0) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);\r
+               }\r
+               \r
+               var postDays = this.postMonthDays; \r
+               if (postDays >= 7 && this.Options.HIDE_BLANK_WEEKS) {\r
+                       var blankWeeks = Math.floor(postDays/7);\r
+                       for (var p=0;p<blankWeeks;++p) {\r
+                               postDays -= 7;\r
+                       }\r
+               }\r
+               \r
+               if (c >= ((this.preMonthDays+postDays+this.monthDays)-7)) {\r
+                       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);\r
+               }\r
+       }\r
+               \r
+};\r
+\r
+/**\r
+* Appends the contents of the calendar widget footer into the shell. By default, \r
+* the calendar does not contain a footer, and this method must be implemented by \r
+* subclassing the widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderFooter = function() { };\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._unload = function(e, cal) {\r
+       for (var c in cal.cells) {\r
+               c = null;\r
+       }\r
+       \r
+       cal.cells = null;\r
+       \r
+       cal.tbody = null;\r
+       cal.oDomContainer = null;\r
+       cal.table = null;\r
+       cal.headerCell = null;\r
+       \r
+       cal = null;\r
+};\r
+                                                                                                 \r
+                                                                                                 \r
+/****************** BEGIN BUILT-IN TABLE CELL RENDERERS ************************************/\r
+\r
+YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);\r
+       cell.innerHTML = workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+}\r
+\r
+/**\r
+* Renders the row header for a week. The date passed in should be\r
+* the first date of the given week.\r
+* @param {Date}                                        workingDate             The current working Date object (beginning of the week) being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderRowHeader = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_ROW_HEADER);\r
+       \r
+       var useYear = this.pageDate.getFullYear();\r
+       \r
+       if (! YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)) {\r
+               useYear = workingDate.getFullYear();\r
+       }\r
+       \r
+       var weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useYear, this.Options.START_WEEKDAY);\r
+       cell.innerHTML = weekNum;\r
+       \r
+       if (this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM); \r
+       }\r
+};\r
+\r
+/**\r
+* Renders the row footer for a week. The date passed in should be\r
+* the first date of the given week.\r
+* @param {Date}                                        workingDate             The current working Date object (beginning of the week) being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderRowFooter = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_ROW_FOOTER);\r
+       \r
+       if (this.isDateOOM(workingDate) && ! YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)) {\r
+               YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM); \r
+       }\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell in the calendar widget table.\r
+* All logic for determining how a standard default cell will be rendered is \r
+* encapsulated in this method, and must be accounted for when extending the\r
+* widget class.\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellDefault = function(workingDate, cell) {\r
+       cell.innerHTML = "";\r
+       var link = document.createElement("a");\r
+\r
+       link.href="javascript:void(null);";\r
+       link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();\r
+\r
+       link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));\r
+       cell.appendChild(link);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight1 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight2 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight3 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);\r
+};\r
+\r
+/**\r
+* Renders a single standard calendar cell using the CSS hightlight4 style\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering today's date to the current calendar cell\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering selected dates to the current calendar cell\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);\r
+};\r
+\r
+/**\r
+* Applies the default style used for rendering dates that are not a part of the current\r
+* month (preceding or trailing the cells for the current month)\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth = function(workingDate, cell) {\r
+       YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);\r
+       cell.innerHTML=workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+};\r
+\r
+/**\r
+* Renders the current calendar cell as a non-selectable "black-out" date using the default\r
+* restricted style.\r
+* @param {Date}                                        workingDate             The current working Date object being used to generate the calendar\r
+* @param {HTMLTableCellElement}        cell                    The current working cell in the calendar\r
+* @return      YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering\r
+*                      should not be terminated\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted = function(workingDate, cell) {\r
+       YAHOO.widget.Calendar_Core.setCssClasses(cell, [this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);\r
+       cell.innerHTML=workingDate.getDate();\r
+       return YAHOO.widget.Calendar_Core.STOP_RENDER;\r
+};\r
+/******************** END BUILT-IN TABLE CELL RENDERERS ************************************/\r
+\r
+/******************** BEGIN MONTH NAVIGATION METHODS ************************************/\r
+/**\r
+* Adds the designated number of months to the current calendar month, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of months to add to the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addMonths = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.add(this.pageDate, YAHOO.widget.DateMath.MONTH, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Subtracts the designated number of months from the current calendar month, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of months to subtract from the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.subtractMonths = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.subtract(this.pageDate, YAHOO.widget.DateMath.MONTH, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Adds the designated number of years to the current calendar, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of years to add to the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addYears = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.add(this.pageDate, YAHOO.widget.DateMath.YEAR, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Subtcats the designated number of years from the current calendar, and sets the current\r
+* calendar page date to the new month.\r
+* @param {Integer}     count   The number of years to subtract from the current calendar\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.subtractYears = function(count) {\r
+       this.pageDate = YAHOO.widget.DateMath.subtract(this.pageDate, YAHOO.widget.DateMath.YEAR, count);\r
+       this.resetRenderers();\r
+       this.onChangePage();\r
+};\r
+\r
+/**\r
+* Navigates to the next month page in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.nextMonth = function() {\r
+       this.addMonths(1);\r
+};\r
+\r
+/**\r
+* Navigates to the previous month page in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.previousMonth = function() {\r
+       this.subtractMonths(1);\r
+};\r
+\r
+/**\r
+* Navigates to the next year in the currently selected month in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.nextYear = function() {\r
+       this.addYears(1);\r
+};\r
+\r
+/**\r
+* Navigates to the previous year in the currently selected month in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.previousYear = function() {\r
+       this.subtractYears(1);\r
+};\r
+\r
+/****************** END MONTH NAVIGATION METHODS ************************************/\r
+\r
+/************* BEGIN SELECTION METHODS *************************************************************/\r
+\r
+/**\r
+* Resets the calendar widget to the originally selected month and year, and \r
+* sets the calendar to the initial selection(s).\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.reset = function() {\r
+       this.selectedDates.length = 0;\r
+       this.selectedDates = this._selectedDates.concat();\r
+\r
+       this.pageDate = new Date(this._pageDate.getTime());\r
+       this.onReset();\r
+};\r
+\r
+/**\r
+* Clears the selected dates in the current calendar widget and sets the calendar\r
+* to the current month and year.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.clear = function() {\r
+       this.selectedDates.length = 0;\r
+       this.pageDate = new Date(this.today.getTime());\r
+       this.onClear();\r
+};\r
+\r
+/**\r
+* Selects a date or a collection of dates on the current calendar. This method, by default,\r
+* does not call the render method explicitly. Once selection has completed, render must be \r
+* called for the changes to be reflected visually.\r
+* @param       {String/Date/Date[]}    date    The date string of dates to select in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects.\r
+* @return                                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.select = function(date) {\r
+       this.onBeforeSelect();\r
+\r
+       var aToBeSelected = this._toFieldArray(date);\r
+\r
+       for (var a=0;a<aToBeSelected.length;++a) {\r
+               var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select\r
+               if (this._indexOfSelectedFieldArray(toSelect) == -1) { // not already selected?\r
+                       this.selectedDates[this.selectedDates.length]=toSelect;\r
+               }\r
+       }\r
+       \r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.onSelect();\r
+\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Selects a date on the current calendar by referencing the index of the cell that should be selected.\r
+* This method is used to easily select a single cell (usually with a mouse click) without having to do\r
+* a full render. The selected style is applied to the cell directly.\r
+* @param       {Integer}       cellIndex       The index of the cell to select in the current calendar. \r
+* @return                                                      Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.selectCell = function(cellIndex) {\r
+       this.onBeforeSelect();\r
+\r
+       this.cells = this.tbody.getElementsByTagName("TD");\r
+\r
+       var cell = this.cells[cellIndex];\r
+       var cellDate = this.cellDates[cellIndex];\r
+\r
+       var dCellDate = this._toDate(cellDate);\r
+\r
+       var selectDate = cellDate.concat();\r
+\r
+       this.selectedDates.push(selectDate);\r
+       \r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.renderCellStyleSelected(dCellDate,cell);\r
+\r
+       this.onSelect();\r
+       this.doCellMouseOut.call(cell, null, this);\r
+\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects a date or a collection of dates on the current calendar. This method, by default,\r
+* does not call the render method explicitly. Once deselection has completed, render must be \r
+* called for the changes to be reflected visually.\r
+* @param       {String/Date/Date[]}    date    The date string of dates to deselect in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects. \r
+* @return                                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselect = function(date) {\r
+       this.onBeforeDeselect();\r
+\r
+       var aToBeSelected = this._toFieldArray(date);\r
+\r
+       for (var a=0;a<aToBeSelected.length;++a) {\r
+               var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select\r
+               var index = this._indexOfSelectedFieldArray(toSelect);\r
+       \r
+               if (index != -1) {      \r
+                       this.selectedDates.splice(index,1);\r
+               }\r
+       }\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       } \r
+\r
+       this.onDeselect();\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects a date on the current calendar by referencing the index of the cell that should be deselected.\r
+* This method is used to easily deselect a single cell (usually with a mouse click) without having to do\r
+* a full render. The selected style is removed from the cell directly.\r
+* @param       {Integer}       cellIndex       The index of the cell to deselect in the current calendar. \r
+* @return                                                      Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselectCell = function(i) {\r
+       this.onBeforeDeselect();\r
+       this.cells = this.tbody.getElementsByTagName("TD");\r
+\r
+       var cell = this.cells[i];\r
+       var cellDate = this.cellDates[i];\r
+       var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);\r
+\r
+       var dCellDate = this._toDate(cellDate);\r
+\r
+       var selectDate = cellDate.concat();\r
+\r
+       if (cellDateIndex > -1) {\r
+               if (this.pageDate.getMonth() == dCellDate.getMonth() &&\r
+                       this.pageDate.getFullYear() == dCellDate.getFullYear()) {\r
+                       YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);\r
+               }\r
+\r
+               this.selectedDates.splice(cellDateIndex, 1);\r
+       }\r
+\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+\r
+       this.onDeselect();\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Deselects all dates on the current calendar.\r
+* @return                              Array of JavaScript Date objects representing all individual dates that are currently selected.\r
+*                                              Assuming that this function executes properly, the return value should be an empty array.\r
+*                                              However, the empty array is returned for the sake of being able to check the selection status\r
+*                                              of the calendar.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.deselectAll = function() {\r
+       this.onBeforeDeselect();\r
+       var count = this.selectedDates.length;\r
+       this.selectedDates.length = 0;\r
+\r
+       if (this.parent) {\r
+               this.parent.sync(this);\r
+       }\r
+       \r
+       if (count > 0) {\r
+               this.onDeselect();\r
+       }\r
+\r
+       return this.getSelectedDates();\r
+};\r
+/************* END SELECTION METHODS *************************************************************/\r
+\r
+\r
+/************* BEGIN TYPE CONVERSION METHODS ****************************************************/\r
+\r
+/**\r
+* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure\r
+* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].\r
+* @private\r
+* @param       {String/Date/Date[]}    date    The date string of dates to deselect in the current calendar. Valid formats are\r
+*                                                              individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).\r
+*                                                              Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).\r
+*                                                              This method can also take a JavaScript Date object or an array of Date objects. \r
+* @return                                              Array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._toFieldArray = function(date) {\r
+       var returnDate = new Array();\r
+\r
+       if (date instanceof Date) {\r
+               returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];\r
+       } else if (typeof date == 'string') {\r
+               returnDate = this._parseDates(date);\r
+       } else if (date instanceof Array) {\r
+               for (var i=0;i<date.length;++i) {\r
+                       var d = date[i];\r
+                       returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];\r
+               }\r
+       }\r
+       \r
+       return returnDate;\r
+};\r
+\r
+/**\r
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.\r
+* @private\r
+* @param       {Integer[]}             dateFieldArray  The date field array to convert to a JavaScript Date.\r
+* @return                                      JavaScript Date object representing the date field array\r
+* @type Date\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._toDate = function(dateFieldArray) {\r
+       if (dateFieldArray instanceof Date) {\r
+               return dateFieldArray;\r
+       } else {\r
+               return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);\r
+       }\r
+};\r
+/************* END TYPE CONVERSION METHODS ******************************************************/\r
+\r
+\r
+/************* BEGIN UTILITY METHODS ****************************************************/\r
+/**\r
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.\r
+* @private\r
+* @param       {Integer[]}     array1  The first date field array to compare\r
+* @param       {Integer[]}     array2  The first date field array to compare\r
+* @return                                              The boolean that represents the equality of the two arrays\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._fieldArraysAreEqual = function(array1, array2) {\r
+       var match = false;\r
+\r
+       if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {\r
+               match=true;     \r
+       }\r
+\r
+       return match;\r
+};\r
+\r
+/**\r
+* Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.\r
+* @private\r
+* @param       {Integer[]}             find    The date field array to search for\r
+* @return                                      The index of the date field array within the collection of selected dates.\r
+*                                                              -1 will be returned if the date is not found.\r
+* @type Integer\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._indexOfSelectedFieldArray = function(find) {\r
+       var selected = -1;\r
+\r
+       for (var s=0;s<this.selectedDates.length;++s) {\r
+               var sArray = this.selectedDates[s];\r
+               if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {\r
+                       selected = s;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return selected;\r
+};\r
+\r
+/**\r
+* Determines whether a given date is OOM (out of month).\r
+* @param       {Date}  date    The JavaScript Date object for which to check the OOM status\r
+* @return      {Boolean}       true if the date is OOM\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.isDateOOM = function(date) {\r
+       var isOOM = false;\r
+       if (date.getMonth() != this.pageDate.getMonth()) {\r
+               isOOM = true;\r
+       }\r
+       return isOOM;\r
+};\r
+\r
+/************* END UTILITY METHODS *******************************************************/\r
+\r
+/************* BEGIN EVENT HANDLERS ******************************************************/\r
+\r
+/**\r
+* Event executed before a date is selected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onBeforeSelect = function() {\r
+       if (! this.Options.MULTI_SELECT) {\r
+               this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);\r
+               this.deselectAll();\r
+       }\r
+};\r
+\r
+/**\r
+* Event executed when a date is selected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onSelect = function() { };\r
+\r
+/**\r
+* Event executed before a date is deselected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onBeforeDeselect = function() { };\r
+\r
+/**\r
+* Event executed when a date is deselected in the calendar widget.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onDeselect = function() { };\r
+\r
+/**\r
+* Event executed when the user navigates to a different calendar page.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onChangePage = function() {\r
+               var me = this;\r
+\r
+               this.renderHeader();\r
+               if (this.renderProcId) {\r
+                       clearTimeout(this.renderProcId);\r
+               }\r
+               this.renderProcId = setTimeout(function() {\r
+                                                                                       me.render();\r
+                                                                                       me.renderProcId = null;\r
+                                                                               }, 1);\r
+};\r
+\r
+/**\r
+* Event executed when the calendar widget is rendered.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onRender = function() { };\r
+\r
+/**\r
+* Event executed when the calendar widget is reset to its original state.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onReset = function() { this.render(); };\r
+\r
+/**\r
+* Event executed when the calendar widget is completely cleared to the current month with no selections.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.onClear = function() { this.render(); };\r
+\r
+/**\r
+* Validates the calendar widget. This method has no default implementation\r
+* and must be extended by subclassing the widget.\r
+* @return      Should return true if the widget validates, and false if\r
+* it doesn't.\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.validate = function() { return true; };\r
+\r
+/************* END EVENT HANDLERS *********************************************************/\r
+\r
+\r
+/************* BEGIN DATE PARSE METHODS ***************************************************/\r
+\r
+\r
+/**\r
+* Converts a date string to a date field array\r
+* @private\r
+* @param       {String}        sDate                   Date string. Valid formats are mm/dd and mm/dd/yyyy.\r
+* @return                              A date field array representing the string passed to the method\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseDate = function(sDate) {\r
+       var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);\r
+       var rArray;\r
+\r
+       if (aDate.length == 2) {\r
+               rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];\r
+               rArray.type = YAHOO.widget.Calendar_Core.MONTH_DAY;\r
+       } else {\r
+               rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];\r
+               rArray.type = YAHOO.widget.Calendar_Core.DATE;\r
+       }\r
+       return rArray;\r
+};\r
+\r
+/**\r
+* Converts a multi or single-date string to an array of date field arrays\r
+* @private\r
+* @param       {String}        sDates          Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy\r
+* @return                                                      An array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseDates = function(sDates) {\r
+       var aReturn = new Array();\r
+\r
+       var aDates = sDates.split(this.Locale.DATE_DELIMITER);\r
+       \r
+       for (var d=0;d<aDates.length;++d) {\r
+               var sDate = aDates[d];\r
+\r
+               if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {\r
+                       // This is a range\r
+                       var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);\r
+\r
+                       var dateStart = this._parseDate(aRange[0]);\r
+                       var dateEnd = this._parseDate(aRange[1]);\r
+\r
+                       var fullRange = this._parseRange(dateStart, dateEnd);\r
+                       aReturn = aReturn.concat(fullRange);\r
+               } else {\r
+                       // This is not a range\r
+                       var aDate = this._parseDate(sDate);\r
+                       aReturn.push(aDate);\r
+               }\r
+       }\r
+       return aReturn;\r
+};\r
+\r
+/**\r
+* Converts a date range to the full list of included dates\r
+* @private\r
+* @param       {Integer[]}     startDate       Date field array representing the first date in the range\r
+* @param       {Integer[]}     endDate         Date field array representing the last date in the range\r
+* @return                                                      An array of date field arrays\r
+* @type Array[](Integer[])\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._parseRange = function(startDate, endDate) {\r
+       var dStart   = new Date(startDate[0],startDate[1]-1,startDate[2]);\r
+       var dCurrent = YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);\r
+       var dEnd     = new Date(endDate[0],  endDate[1]-1,  endDate[2]);\r
+\r
+       var results = new Array();\r
+       results.push(startDate);\r
+       while (dCurrent.getTime() <= dEnd.getTime()) {\r
+               results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);\r
+               dCurrent = YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);\r
+       }\r
+       return results;\r
+};\r
+\r
+/************* END DATE PARSE METHODS *****************************************************/\r
+\r
+/************* BEGIN RENDERER METHODS *****************************************************/\r
+\r
+/**\r
+* Resets the render stack of the current calendar to its original pre-render value.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.resetRenderers = function() {\r
+       this.renderStack = this._renderStack.concat();\r
+};\r
+\r
+/**\r
+* Clears the inner HTML, CSS class and style information from the specified cell.\r
+* @param       {HTMLTableCellElement}  The cell to clear\r
+*/ \r
+YAHOO.widget.Calendar_Core.prototype.clearElement = function(cell) {\r
+       cell.innerHTML = "&nbsp;";\r
+       cell.className="";\r
+};\r
+\r
+/**\r
+* Adds a renderer to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the conditions specified in the date string for this renderer.\r
+* @param       {String}        sDates          A date string to associate with the specified renderer. Valid formats\r
+*                                                                      include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addRenderer = function(sDates, fnRender) {\r
+       var aDates = this._parseDates(sDates);\r
+       for (var i=0;i<aDates.length;++i) {\r
+               var aDate = aDates[i];\r
+       \r
+               if (aDate.length == 2) { // this is either a range or a month/day combo\r
+                       if (aDate[0] instanceof Array) { // this is a range\r
+                               this._addRenderer(YAHOO.widget.Calendar_Core.RANGE,aDate,fnRender);\r
+                       } else { // this is a month/day combo\r
+                               this._addRenderer(YAHOO.widget.Calendar_Core.MONTH_DAY,aDate,fnRender);\r
+                       }\r
+               } else if (aDate.length == 3) {\r
+                       this._addRenderer(YAHOO.widget.Calendar_Core.DATE,aDate,fnRender);\r
+               }\r
+       }\r
+};\r
+\r
+/**\r
+* The private method used for adding cell renderers to the local render stack.\r
+* This method is called by other methods that set the renderer type prior to the method call.\r
+* @private\r
+* @param       {String}        type            The type string that indicates the type of date renderer being added.\r
+*                                                                      Values are YAHOO.widget.Calendar_Core.DATE, YAHOO.widget.Calendar_Core.MONTH_DAY, YAHOO.widget.Calendar_Core.WEEKDAY,\r
+*                                                                      YAHOO.widget.Calendar_Core.RANGE, YAHOO.widget.Calendar_Core.MONTH\r
+* @param       {Array}         aDates          An array of dates used to construct the renderer. The format varies based\r
+*                                                                      on the renderer type\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype._addRenderer = function(type, aDates, fnRender) {\r
+       var add = [type,aDates,fnRender];\r
+       this.renderStack.unshift(add);  \r
+       \r
+       this._renderStack = this.renderStack.concat();\r
+};\r
+\r
+/**\r
+* Adds a month to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the month passed to this method.\r
+* @param       {Integer}       month           The month (1-12) to associate with this renderer\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addMonthRenderer = function(month, fnRender) {\r
+       this._addRenderer(YAHOO.widget.Calendar_Core.MONTH,[month],fnRender);\r
+};\r
+\r
+/**\r
+* Adds a weekday to the render stack. The function reference passed to this method will be executed\r
+* when a date cell matches the weekday passed to this method.\r
+* @param       {Integer}       weekay          The weekday (1-7) to associate with this renderer\r
+* @param       {Function}      fnRender        The function executed to render cells that match the render rules for this renderer.\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.addWeekdayRenderer = function(weekday, fnRender) {\r
+       this._addRenderer(YAHOO.widget.Calendar_Core.WEEKDAY,[weekday],fnRender);\r
+};\r
+//// END RENDERER METHODS ////\r
+\r
+//// BEGIN CSS METHODS ////\r
+\r
+/**\r
+* Sets the specified array of CSS classes into the referenced element\r
+* @param       {HTMLElement}   element         The element to set the CSS classes into\r
+* @param       {String[]}              aStyles         An array of CSS class names\r
+*/\r
+YAHOO.widget.Calendar_Core.setCssClasses = function(element, aStyles) {\r
+       element.className = "";\r
+       var className = aStyles.join(" ");\r
+       element.className = className;\r
+};\r
+\r
+/**\r
+* Removes all styles from all body cells in the current calendar table.\r
+* @param       {style}         The CSS class name to remove from all calendar body cells\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.clearAllBodyCellStyles = function(style) {\r
+       for (var c=0;c<this.cells.length;++c) {\r
+               YAHOO.util.Dom.removeClass(this.cells[c],style);\r
+       }\r
+};\r
+\r
+//// END CSS METHODS ////\r
+\r
+//// BEGIN GETTER/SETTER METHODS ////\r
+/**\r
+* Sets the calendar's month explicitly.\r
+* @param {Integer}     month           The numeric month, from 1 (January) to 12 (December)\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setMonth = function(month) {\r
+       this.pageDate.setMonth(month);\r
+};\r
+\r
+/**\r
+* Sets the calendar's year explicitly.\r
+* @param {Integer}     year            The numeric 4-digit year\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.setYear = function(year) {\r
+       this.pageDate.setFullYear(year);\r
+};\r
+\r
+/**\r
+* Gets the list of currently selected dates from the calendar.\r
+* @return      An array of currently selected JavaScript Date objects.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.getSelectedDates = function() {\r
+       var returnDates = new Array();\r
+\r
+       for (var d=0;d<this.selectedDates.length;++d) {\r
+               var dateArray = this.selectedDates[d];\r
+\r
+               var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);\r
+               returnDates.push(date);\r
+       }\r
+\r
+       returnDates.sort();\r
+       return returnDates;\r
+};\r
+\r
+/// END GETTER/SETTER METHODS ///\r
+\r
+/**\r
+* Returns a string representing the current browser.\r
+* @type String\r
+*/\r
+YAHOO.widget.Calendar_Core._getBrowser = function() {\r
+  /**\r
+   * UserAgent\r
+   * @private\r
+   * @type String\r
+   */\r
+  var ua = navigator.userAgent.toLowerCase();\r
+  \r
+  if (ua.indexOf('opera')!=-1) // Opera (check first in case of spoof)\r
+        return 'opera';\r
+  else if (ua.indexOf('msie')!=-1) // IE\r
+        return 'ie';\r
+  else if (ua.indexOf('safari')!=-1) // Safari (check before Gecko because it includes "like Gecko")\r
+        return 'safari';\r
+  else if (ua.indexOf('gecko') != -1) // Gecko\r
+        return 'gecko';\r
+ else\r
+  return false;\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar_Core.prototype.toString = function() {\r
+       return "Calendar_Core " + this.id;\r
+}\r
+\r
+YAHOO.widget.Cal_Core = YAHOO.widget.Calendar_Core;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* Calendar is the default implementation of the YAHOO.widget.Calendar_Core base class.\r
+* This class is the UED-approved version of the calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for YAHOO.widget.Calendar_Core.\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar.prototype = new YAHOO.widget.Calendar_Core();\r
+\r
+YAHOO.widget.Calendar.prototype.buildShell = function() {\r
+       this.border = document.createElement("DIV");\r
+       this.border.className =  this.Style.CSS_CONTAINER;\r
+       \r
+       this.table = document.createElement("TABLE");\r
+       this.table.cellSpacing = 0;     \r
+       \r
+       YAHOO.widget.Calendar_Core.setCssClasses(this.table, [this.Style.CSS_CALENDAR]);\r
+\r
+       this.border.id = this.id;\r
+       \r
+       this.buildShellHeader();\r
+       this.buildShellBody();\r
+       this.buildShellFooter();\r
+};\r
+\r
+YAHOO.widget.Calendar.prototype.renderShell = function() {\r
+       this.border.appendChild(this.table);\r
+       this.oDomContainer.appendChild(this.border);\r
+       this.shellRendered = true;\r
+};\r
+\r
+YAHOO.widget.Calendar.prototype.renderHeader = function() {\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       if (this.linkLeft) {\r
+               YAHOO.util.Event.removeListener(this.linkLeft, "mousedown", this.previousMonth);\r
+       }\r
+       this.linkLeft = document.createElement("A");\r
+       this.linkLeft.innerHTML = "&nbsp;";\r
+       YAHOO.util.Event.addListener(this.linkLeft, "mousedown", this.previousMonth, this, true);\r
+       this.linkLeft.style.backgroundImage =  "url(" + this.Options.NAV_ARROW_LEFT + ")";\r
+       this.linkLeft.className = this.Style.CSS_NAV_LEFT;\r
+       \r
+       if (this.linkRight) {\r
+               YAHOO.util.Event.removeListener(this.linkRight, "mousedown", this.nextMonth);\r
+       }\r
+       this.linkRight = document.createElement("A");\r
+       this.linkRight.innerHTML = "&nbsp;";\r
+       YAHOO.util.Event.addListener(this.linkRight, "mousedown", this.nextMonth, this, true);\r
+       this.linkRight.style.backgroundImage = "url(" + this.Options.NAV_ARROW_RIGHT + ")";\r
+       this.linkRight.className = this.Style.CSS_NAV_RIGHT;\r
+       \r
+       headerContainer.appendChild(this.linkLeft);\r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       headerContainer.appendChild(this.linkRight);\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+YAHOO.widget.Cal = YAHOO.widget.Calendar;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* <p>YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar_Core. This class facilitates\r
+* the ability to have multi-page calendar views that share a single dataset and are\r
+* dependent on each other.</p>\r
+* \r
+* <p>The calendar group instance will refer to each of its elements using a 0-based index.\r
+* For example, to construct the placeholder for a calendar group widget with id "cal1" and\r
+* containerId of "cal1Container", the markup would be as follows:\r
+*      <xmp>\r
+*              <div id="cal1Container_0"></div>\r
+*              <div id="cal1Container_1"></div>\r
+*      </xmp>\r
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.\r
+* </p>\r
+* @constructor\r
+* @param {Integer}             pageCount       The number of pages that this calendar should display.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}      containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.CalendarGroup = function(pageCount, id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0) {\r
+               this.init(pageCount, id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+/**\r
+* Initializes the calendar group. All subclasses must call this method in order for the\r
+* group to be initialized properly.\r
+* @param {Integer}             pageCount       The number of pages that this calendar should display.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}              containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.init = function(pageCount, id, containerId, monthyear, selected) {\r
+       this.id = id;\r
+       this.selectedDates = new Array();\r
+       this.containerId = containerId;\r
+       \r
+       this.pageCount = pageCount;\r
+\r
+       this.pages = new Array();\r
+\r
+       for (var p=0;p<pageCount;++p) {\r
+               var cal = this.constructChild(id + "_" + p, this.containerId + "_" + p , monthyear, selected);\r
+                               \r
+               cal.parent = this;\r
+               \r
+               cal.index = p;\r
+\r
+               cal.pageDate.setMonth(cal.pageDate.getMonth()+p);\r
+               cal._pageDate = new Date(cal.pageDate.getFullYear(),cal.pageDate.getMonth(),cal.pageDate.getDate());\r
+               this.pages.push(cal);\r
+       }\r
+       \r
+       this.doNextMonth = function(e, calGroup) {\r
+               calGroup.nextMonth();\r
+       };\r
+       \r
+       this.doPreviousMonth = function(e, calGroup) {\r
+               calGroup.previousMonth();\r
+       };\r
+};\r
+\r
+/**\r
+* Adds a function to all child Calendars within this CalendarGroup.\r
+* @param {String}              fnName          The name of the function\r
+* @param {Function}            fn                      The function to apply to each Calendar page object\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setChildFunction = function(fnName, fn) {\r
+       for (var p=0;p<this.pageCount;++p) {\r
+               this.pages[p][fnName] = fn;\r
+       }\r
+}\r
+\r
+/**\r
+* Calls a function within all child Calendars within this CalendarGroup.\r
+* @param {String}              fnName          The name of the function\r
+* @param {Array}               args            The arguments to pass to the function\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.callChildFunction = function(fnName, args) {\r
+       for (var p=0;p<this.pageCount;++p) {\r
+               var page = this.pages[p];\r
+               if (page[fnName]) {\r
+                       var fn = page[fnName];\r
+                       fn.call(page, args);\r
+               }\r
+       }       \r
+}\r
+\r
+/**\r
+* Constructs a child calendar. This method can be overridden if a subclassed version of the default\r
+* calendar is to be used.\r
+* @param {String}              id                      The id of the element that will be inserted into the DOM.\r
+* @param {String}              containerId     The id of the container element that the calendar will be inserted into.\r
+* @param {String}              monthyear       The month/year string used to set the current calendar page\r
+* @param {String}              selected        A string of date values formatted using the date parser. The built-in\r
+                                                                       default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                                       MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                                       Any combination of these can be combined by delimiting the string with\r
+                                                                       commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+* @return                                                      The YAHOO.widget.Calendar_Core instance that is constructed\r
+* @type YAHOO.widget.Calendar_Core\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,monthyear,selected) {\r
+       return new YAHOO.widget.Calendar_Core(id,containerId,monthyear,selected);\r
+};\r
+\r
+\r
+/**\r
+* Sets the calendar group's month explicitly. This month will be set into the first\r
+* page of the multi-page calendar, and all other months will be iterated appropriately.\r
+* @param {Integer}     month           The numeric month, from 1 (January) to 12 (December)\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.setMonth(month+p);\r
+       }\r
+};\r
+\r
+/**\r
+* Sets the calendar group's year explicitly. This year will be set into the first\r
+* page of the multi-page calendar, and all other months will be iterated appropriately.\r
+* @param {Integer}     year            The numeric 4-digit year\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.setYear = function(year) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               if ((cal.pageDate.getMonth()+1) == 1 && p>0)\r
+               {\r
+                       year+=1;\r
+               }\r
+               cal.setYear(year);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the render function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.render = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.render();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the select function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.select = function(date) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.select(date);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the selectCell function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.selectCell = function(cellIndex) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.selectCell(cellIndex);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselect function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselect = function(date) {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.deselect(date);\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselectAll function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselectAll = function() {\r
+       var ret;\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               ret = cal.deselectAll();\r
+       }\r
+       return ret;\r
+};\r
+\r
+/**\r
+* Calls the deselectAll function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.deselectCell = function(cellIndex) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.deselectCell(cellIndex);\r
+       }\r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Calls the reset function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.reset = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.reset();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the clear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.clear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.clear();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the nextMonth function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.nextMonth = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.nextMonth();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the previousMonth function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.previousMonth = function() {\r
+       for (var p=this.pages.length-1;p>=0;--p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.previousMonth();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the nextYear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.nextYear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.nextYear();\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the previousYear function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.previousYear = function() {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.previousYear();\r
+       }\r
+};\r
+\r
+/**\r
+* Synchronizes the data values for all child calendars within the group. If the sync\r
+* method is called passing in the caller object, the values of all children will be set\r
+* to the values of the caller. If the argument is ommitted, the values from all children\r
+* will be combined into one distinct list and set into each child.\r
+* @param       {YAHOO.widget.Calendar_Core}    caller          The YAHOO.widget.Calendar_Core that is initiating the call to sync().\r
+* @return                                                              Array of selected dates, in JavaScript Date object form.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.sync = function(caller) {\r
+       var calendar;\r
+\r
+       if (caller)\r
+       {\r
+               this.selectedDates = caller.selectedDates.concat();\r
+       } else {\r
+               var hash = new Object();\r
+               var combinedDates = new Array();\r
+\r
+               for (var p=0;p<this.pages.length;++p)\r
+               {\r
+                       calendar = this.pages[p];\r
+\r
+                       var values = calendar.selectedDates;\r
+\r
+                       for (var v=0;v<values.length;++v)\r
+                       {\r
+                               var valueArray = values[v];\r
+                               hash[valueArray.toString()] = valueArray;\r
+                       }\r
+               }\r
+\r
+               for (var val in hash)\r
+               {\r
+                       combinedDates[combinedDates.length]=hash[val];\r
+               }\r
+               \r
+               this.selectedDates = combinedDates.concat();\r
+       }\r
+\r
+       // Set all the values into the children\r
+       for (p=0;p<this.pages.length;++p)\r
+       {\r
+               calendar = this.pages[p];\r
+               if (! calendar.Options.MULTI_SELECT) {\r
+                       calendar.clearAllBodyCellStyles(calendar.Config.Style.CSS_CELL_SELECTED);\r
+               }\r
+               calendar.selectedDates = this.selectedDates.concat();\r
+               \r
+       }\r
+       \r
+       return this.getSelectedDates();\r
+};\r
+\r
+/**\r
+* Gets the list of currently selected dates from the calendar.\r
+* @return                      An array of currently selected JavaScript Date objects.\r
+* @type Date[]\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.getSelectedDates = function() { \r
+       var returnDates = new Array();\r
+\r
+       for (var d=0;d<this.selectedDates.length;++d)\r
+       {\r
+               var dateArray = this.selectedDates[d];\r
+\r
+               var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);\r
+               returnDates.push(date);\r
+       }\r
+\r
+       returnDates.sort();\r
+       return returnDates;\r
+};\r
+\r
+/**\r
+* Calls the addRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addRenderer = function(sDates, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addRenderer(sDates, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the addMonthRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addMonthRenderer = function(month, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addMonthRenderer(month, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Calls the addWeekdayRenderer function of all child calendars within the group.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer = function(weekday, fnRender) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal.addWeekdayRenderer(weekday, fnRender);\r
+       }\r
+};\r
+\r
+/**\r
+* Sets an event handler universally across all child calendars within the group. For instance,\r
+* to set the onSelect handler for all child calendars to a function called fnSelect, the call would be:\r
+* <code>\r
+* calGroup.wireEvent("onSelect", fnSelect);\r
+* </code>\r
+* @param       {String}        eventName       The name of the event to handler to set within all child calendars.\r
+* @param       {Function}      fn                      The function to set into the specified event handler.\r
+*/\r
+YAHOO.widget.CalendarGroup.prototype.wireEvent = function(eventName, fn) {\r
+       for (var p=0;p<this.pages.length;++p)\r
+       {\r
+               var cal = this.pages[p];\r
+               cal[eventName] = fn;\r
+       }\r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.CalendarGroup.prototype.toString = function() {\r
+       return "CalendarGroup " + this.id;\r
+}\r
+\r
+YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt \r
+**/\r
+\r
+/**\r
+* @class\r
+* Calendar2up_Cal is the default implementation of the Calendar_Core base class, when used\r
+* in a 2-up view. This class is the UED-approved version of the calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for Calendar_Core. This class\r
+* has some special attributes that only apply to calendars rendered within the calendar group implementation. \r
+* There should be no reason to instantiate this class directly.\r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar2up_Cal = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0)\r
+       {\r
+               this.init(id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar2up_Cal.prototype = new YAHOO.widget.Calendar_Core();\r
+\r
+/**\r
+* Renders the header for each individual calendar in the 2-up view. More\r
+* specifically, this method handles the placement of left and right arrows for\r
+* navigating between calendar pages.\r
+*/\r
+YAHOO.widget.Calendar2up_Cal.prototype.renderHeader = function() {\r
+       this.headerCell.innerHTML = "";\r
+       \r
+       var headerContainer = document.createElement("DIV");\r
+       headerContainer.className = this.Style.CSS_HEADER;\r
+       \r
+       if (this.index == 0) {\r
+\r
+               if (this.linkLeft) {\r
+                       YAHOO.util.Event.removeListener(this.linkLeft, "mousedown", this.parent.doPreviousMonth);\r
+               }\r
+               this.linkLeft = document.createElement("A");\r
+               this.linkLeft.innerHTML = "&nbsp;";\r
+               this.linkLeft.style.backgroundImage =  "url(" + this.Options.NAV_ARROW_LEFT + ")";\r
+               this.linkLeft.className = this.Style.CSS_NAV_LEFT;\r
+               \r
+               YAHOO.util.Event.addListener(this.linkLeft, "mousedown", this.parent.doPreviousMonth, this.parent);\r
+               headerContainer.appendChild(this.linkLeft);\r
+       }\r
+       \r
+       headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));\r
+       \r
+       if (this.index == 1) {\r
+\r
+               if (this.linkRight) {\r
+                       YAHOO.util.Event.removeListener(this.linkRight, "mousedown", this.parent.doNextMonth);\r
+               }\r
+               this.linkRight = document.createElement("A");\r
+               this.linkRight.innerHTML = "&nbsp;";\r
+               this.linkRight.style.backgroundImage = "url(" + this.Options.NAV_ARROW_RIGHT + ")";\r
+               this.linkRight.className = this.Style.CSS_NAV_RIGHT;\r
+\r
+               YAHOO.util.Event.addListener(this.linkRight, "mousedown", this.parent.doNextMonth, this.parent);\r
+               headerContainer.appendChild(this.linkRight);\r
+       }\r
+       \r
+       this.headerCell.appendChild(headerContainer);\r
+};\r
+\r
+\r
+\r
+\r
+/**\r
+* @class\r
+* Calendar2up is the default implementation of the CalendarGroup base class, when used\r
+* in a 2-up view. This class is the UED-approved version of the 2-up calendar selector widget. For all documentation\r
+* on the implemented methods listed here, see the documentation for CalendarGroup. \r
+* @constructor\r
+* @param {String}      id                      The id of the table element that will represent the calendar widget\r
+* @param {String}      containerId     The id of the container element that will contain the calendar table\r
+* @param {String}      monthyear       The month/year string used to set the current calendar page\r
+* @param {String}      selected        A string of date values formatted using the date parser. The built-in\r
+                                                               default date format is MM/DD/YYYY. Ranges are defined using\r
+                                                               MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD.\r
+                                                               Any combination of these can be combined by delimiting the string with\r
+                                                               commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"\r
+*/\r
+YAHOO.widget.Calendar2up = function(id, containerId, monthyear, selected) {\r
+       if (arguments.length > 0)\r
+       {       \r
+               this.buildWrapper(containerId);\r
+               this.init(2, id, containerId, monthyear, selected);\r
+       }\r
+}\r
+\r
+YAHOO.widget.Calendar2up.prototype = new YAHOO.widget.CalendarGroup();\r
+\r
+/**\r
+* CSS class representing the wrapper for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPWRAPPER = "yui-cal2upwrapper";\r
+\r
+/**\r
+* CSS class representing the container for the calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_CONTAINER = "yui-calcontainer";\r
+\r
+/**\r
+* CSS class representing the container for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPCONTAINER = "cal2up";\r
+\r
+/**\r
+* CSS class representing the title for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPTITLE = "title";\r
+\r
+/**\r
+* CSS class representing the close icon for the 2-up calendar\r
+* @type string\r
+*/\r
+YAHOO.widget.Calendar2up.CSS_2UPCLOSE = "close-icon";\r
+\r
+/**\r
+* Implementation of CalendarGroup.constructChild that ensures that child calendars of \r
+* Calendar2up will be of type Calendar2up_Cal.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.constructChild = function(id,containerId,monthyear,selected) {\r
+       var cal = new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);\r
+       return cal;\r
+};\r
+\r
+/**\r
+* Builds the wrapper container for the 2-up calendar.\r
+* @param {String} containerId  The id of the outer container element.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.buildWrapper = function(containerId) {\r
+       var outerContainer = document.getElementById(containerId);\r
+       \r
+       outerContainer.className = YAHOO.widget.Calendar2up.CSS_2UPWRAPPER;\r
+       \r
+       var innerContainer = document.createElement("DIV");\r
+       innerContainer.className = YAHOO.widget.Calendar2up.CSS_CONTAINER;\r
+       innerContainer.id = containerId + "_inner";\r
+       \r
+       var cal1Container = document.createElement("DIV");\r
+       cal1Container.id = containerId + "_0";\r
+       cal1Container.className = YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;\r
+       cal1Container.style.marginRight = "10px";\r
+       \r
+       var cal2Container = document.createElement("DIV");\r
+       cal2Container.id = containerId + "_1"; \r
+       cal2Container.className = YAHOO.widget.Calendar2up.CSS_2UPCONTAINER;\r
+       \r
+       outerContainer.appendChild(innerContainer);\r
+       innerContainer.appendChild(cal1Container);\r
+       innerContainer.appendChild(cal2Container);\r
+       \r
+       this.innerContainer = innerContainer;\r
+       this.outerContainer = outerContainer;\r
+}\r
+\r
+/**\r
+* Renders the 2-up calendar.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.render = function() {\r
+       this.renderHeader();\r
+       YAHOO.widget.CalendarGroup.prototype.render.call(this);\r
+       this.renderFooter();\r
+};\r
+\r
+/**\r
+* Renders the header located at the top of the container for the 2-up calendar.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.renderHeader = function() {\r
+       if (! this.title) {\r
+               this.title = "";\r
+       }\r
+       if (! this.titleDiv)\r
+       {\r
+               this.titleDiv = document.createElement("DIV");\r
+               if (this.title == "")\r
+               {\r
+                       this.titleDiv.style.display="none";\r
+               }\r
+       }\r
+\r
+       this.titleDiv.className = YAHOO.widget.Calendar2up.CSS_2UPTITLE;\r
+       this.titleDiv.innerHTML = this.title;\r
+\r
+       if (this.outerContainer.style.position == "absolute")\r
+       {\r
+               var linkClose = document.createElement("A");\r
+               linkClose.href = "javascript:void(null)";\r
+               YAHOO.util.Event.addListener(linkClose, "click", this.hide, this);\r
+\r
+               var imgClose = document.createElement("IMG");\r
+               imgClose.src = YAHOO.widget.Calendar_Core.IMG_ROOT + "us/my/bn/x_d.gif";\r
+               imgClose.className = YAHOO.widget.Calendar2up.CSS_2UPCLOSE;\r
+\r
+               linkClose.appendChild(imgClose);\r
+\r
+               this.linkClose = linkClose;\r
+\r
+               this.titleDiv.appendChild(linkClose);\r
+       }\r
+\r
+       this.innerContainer.insertBefore(this.titleDiv, this.innerContainer.firstChild);\r
+}\r
+\r
+/**\r
+* Hides the 2-up calendar's outer container from view.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.hide = function(e, cal) {\r
+       if (! cal)\r
+       {\r
+               cal = this;\r
+       }\r
+       cal.outerContainer.style.display = "none";\r
+}\r
+\r
+/**\r
+* Renders a footer for the 2-up calendar container. By default, this method is\r
+* unimplemented.\r
+*/\r
+YAHOO.widget.Calendar2up.prototype.renderFooter = function() {}\r
+\r
+YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
\ No newline at end of file
diff --git a/lib/yui/connection/README b/lib/yui/connection/README
new file mode 100755 (executable)
index 0000000..362eb86
--- /dev/null
@@ -0,0 +1,80 @@
+Connection Manager Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* Each transactions can be defined with a timeout threshold, in milliseconds,\r
+through the callback object.  If the threshold is reached, and the transaction\r
+hasn't completed, the transaction will call abort().\r
+\r
+* abort() will now accept a callback object as the second argument.  The\r
+failure callback will receive a response object to indicate the transaction was\r
+aborted.\r
+\r
+* setForm() will now support file uploads by setting the second argument to\r
+true (e.g., YAHOO.util.Connect.setForm(formObject, true).  File upload does not\r
+use the callback success or failure handler.  Instead, it uses a new callback\r
+object handler: upload.\r
+\r
+* HTML form submit will no longer submit form fields without a defined name\r
+attribute.\r
+\r
+* The default POST header of 'Content-Type','application/x-www-form-urlencoded'\r
+can be overridden by calling setDefaultPostHeader(false).  This\r
+will remove the default header from non-HTML form, POST submissions.\r
+\r
+* setHeader() now enumerates through the _http_header object with\r
+propertyIsEnumerable to prevent collisions with members added to Object via\r
+prototype.\r
+\r
+*** version 0.10.0 ***\r
+\r
+* handleTransactionResponse() now treats the full HTTP 2xx range as a success\r
+case, instead of just HTTP 200.\r
+\r
+* To accommodate multiple field values in Mozilla/Firefox, multiple initHeader\r
+calls with the same label will now result in the values concatenated to a\r
+comma- delimited string value.\r
+Example:\r
+Setting Content-Type:'application/x-www-form-urlencoded' and Content-\r
+Type:'text/xml' will result in Content-Type:'application/x-www-form-urlencoded,\r
+text/xml'.\r
+\r
+* Default polling interval lowered to 50ms.\r
+\r
+* YAHOO.util.Connect.setPollingInterval() will allow you to set a polling\r
+interval -- in milliseconds -- to override the default value.\r
+\r
+* YAHOO.util.Connect.getResponseHeader[headerLabel] now supported as a response\r
+object property to provide symmetry with the native XHR object's property.\r
+Example:\r
+YAHOO.util.Connect.getResponseHeader['Content-Length'] will return the value\r
+for the Content-Length header, if the header is available.\r
+\r
+* YAHOO.util.Connect.allResponseHeaders property renamed to\r
+getAllResponseHeaders to provide symmetry with the native XHR object's\r
+property.\r
+\r
+* YAHOO.util.Connect.setForm() now supports HTTP GET as well as HTTP POST.\r
+\r
+* YAHOO.util.Connect.setForm() now accepts an HTML form object as well as its\r
+name attribute value.\r
+\r
+* YAHOO.util.Connect.setForm() will not submit HTML form fields that are\r
+disabled or do not have a name attribute value.\r
+\r
+* [FIXED] Response exceptions result in infinite callback loop in\r
+Mozilla/Firefox.\r
+\r
+* [FIXED] YAHOO.util.Connect.abort() now properly clears polling interval.\r
+\r
+* [FIXED] isCallInProgress() now verifies whether XHR instance still exists,\r
+and returns false if the connection object is no longer available.\r
+\r
+*** version 0.9.0 ***\r
+\r
+* Initial release\r
+\r
+\r
+\r
+\r
+\r
diff --git a/lib/yui/connection/connection-debug.js b/lib/yui/connection/connection-debug.js
new file mode 100755 (executable)
index 0000000..c6d5f00
--- /dev/null
@@ -0,0 +1,801 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.11.0
+*/
+
+/**
+ * The Connection Manager provides a simplified interface to the XMLHttpRequest
+ * object.  It handles cross-browser instantiantion of XMLHttpRequest, negotiates the
+ * interactive states and server response, returning the results to a pre-defined
+ * callback you create.
+ * @ class
+ */
+YAHOO.util.Connect =
+{
+/**
+   * Array of MSFT ActiveX ids for XMLHttpRequest.
+   * @private
+   * @type array
+   */
+       _msxml_progid:[
+                       'MSXML2.XMLHTTP.3.0',
+                       'MSXML2.XMLHTTP',
+                       'Microsoft.XMLHTTP'
+                       ],
+
+  /**
+   * Object literal of HTTP header(s)
+   * @private
+   * @type object
+   */
+       _http_header:{},
+
+  /**
+   * Determines if HTTP headers are set.
+   * @private
+   * @type boolean
+   */
+       _has_http_headers:false,
+
+ /**
+  * Property that that determines if a default header of
+  * Content-Type of 'application/x-www-form-urlencoded'
+  * will be added to any client HTTP headers sent.
+  * @private
+  * @type boolean
+  */
+    _default_post_header:true,
+
+ /**
+  * Property modified by setForm() to determine if the data
+  * should be submitted as an HTML form.
+  * @private
+  * @type boolean
+  */
+    _isFormSubmit:false,
+
+ /**
+  * Property modified by setForm() to determine if a file(s)
+  * upload is expected.
+  * @private
+  * @type boolean
+  */
+    _isFileUpload:false,
+
+ /**
+  * Property modified by setForm() to set a reference to the HTML
+  * form node if the desired action is file upload.
+  * @private
+  * @type object
+  */
+    _formNode:null,
+
+ /**
+  * Property modified by setForm() to set the HTML form data
+  * for each transaction.
+  * @private
+  * @type string
+  */
+    _sFormData:null,
+
+ /**
+  * Collection of polling references to the polling mechanism in handleReadyState.
+  * @private
+  * @type string
+  */
+    _poll:[],
+
+ /**
+  * Queue of timeout references for each transaction with a defined timeout value.
+  * @private
+  * @type string
+  */
+    _timeOut:[],
+
+  /**
+   * The polling frequency, in milliseconds, for HandleReadyState.
+   * when attempting to determine a transaction's XHR readyState.
+   * The default is 50 milliseconds.
+   * @private
+   * @type int
+   */
+     _polling_interval:50,
+
+  /**
+   * A transaction counter that increments the transaction id for each transaction.
+   * @private
+   * @type int
+   */
+     _transaction_id:0,
+
+  /**
+   * Member to add an ActiveX id to the existing xml_progid array.
+   * In the event(unlikely) a new ActiveX id is introduced, it can be added
+   * without internal code modifications.
+   * @public
+   * @param string id The ActiveX id to be added to initialize the XHR object.
+   * @return void
+   */
+       setProgId:function(id)
+       {
+               this._msxml_progid.unshift(id);
+               YAHOO.log('ActiveX Program Id  ' + id + ' added to _msxml_progid.', 'info', 'Connection');
+       },
+
+  /**
+   * Member to enable or disable the default POST header.
+   * @public
+   * @param boolean b Use default header - true or false .
+   * @return void
+   */
+       setDefaultPostHeader:function(b)
+       {
+               YAHOO.log('Default POST header set to  ' + b, 'info', 'Connection');
+               this._default_post_header = b;
+       },
+
+  /**
+   * Member to modify the default polling interval.
+   * @public
+   * @param {int} i The polling interval in milliseconds.
+   * @return void
+   */
+       setPollingInterval:function(i)
+       {
+               if(typeof i == 'number' && isFinite(i)){
+                               this._polling_interval = i;
+                               YAHOO.log('Default polling interval set to  ' + i, 'info', 'Connection');
+               }
+       },
+
+  /**
+   * Instantiates a XMLHttpRequest object and returns an object with two properties:
+   * the XMLHttpRequest instance and the transaction id.
+   * @private
+   * @param {int} transactionId Property containing the transaction id for this transaction.
+   * @return connection object
+   */
+       createXhrObject:function(transactionId)
+       {
+               var obj,http;
+               try
+               {
+                       // Instantiates XMLHttpRequest in non-IE browsers and assigns to http.
+                       http = new XMLHttpRequest();
+                       //  Object literal with http and tId properties
+                       obj = { conn:http, tId:transactionId };
+                       YAHOO.log('XHR object created for transaction  ' + transactionId, 'info', 'Connection');
+               }
+               catch(e)
+               {
+                       for(var i=0; i<this._msxml_progid.length; ++i){
+                               try
+                               {
+                                       // Instantiates XMLHttpRequest for IE and assign to http.
+                                       http = new ActiveXObject(this._msxml_progid[i]);
+                                       //  Object literal with http and tId properties
+                                       obj = { conn:http, tId:transactionId };
+                                       YAHOO.log('ActiveX XHR object created for transaction  ' + transactionId, 'info', 'Connection');
+                                       break;
+                               }
+                               catch(e){}
+                       }
+               }
+               finally
+               {
+                       return obj;
+               }
+       },
+
+  /**
+   * This method is called by asyncRequest to create a
+   * valid connection object for the transaction.  It also passes a
+   * transaction id and increments the transaction id counter.
+   * @private
+   * @return object
+   */
+       getConnectionObject:function()
+       {
+               var o;
+               var tId = this._transaction_id;
+
+               try
+               {
+                       o = this.createXhrObject(tId);
+                       if(o){
+                               this._transaction_id++;
+                       }
+               }
+               catch(e){}
+               finally
+               {
+                       return o;
+               }
+       },
+
+  /**
+   * Method for initiating an asynchronous request via the XHR object.
+   * @public
+   * @param {string} method HTTP transaction method
+   * @param {string} uri Fully qualified path of resource
+   * @param callback User-defined callback function or object
+   * @param {string} postData POST body
+   * @return {object} Returns the connection object
+   */
+       asyncRequest:function(method, uri, callback, postData)
+       {
+               var o = this.getConnectionObject();
+
+               if(!o){
+                       YAHOO.log('Unable to create connection object.', 'error', 'Connection');
+                       return null;
+               }
+               else{
+                       if(this._isFormSubmit){
+                               if(this._isFileUpload){
+                                       this.uploadFile(o.tId, callback, uri);
+                                       this.releaseObject(o);
+                                       return;
+                               }
+
+                               //If the specified HTTP method is GET, setForm() will return an
+                               //encoded string that is concatenated to the uri to
+                               //create a querystring.
+                               if(method == 'GET'){
+                                       uri += "?" +  this._sFormData;
+                               }
+                               else if(method == 'POST'){
+                                       postData =  this._sFormData;
+                               }
+                               this._sFormData = '';
+                       }
+
+                       o.conn.open(method, uri, true);
+
+                       if(this._isFormSubmit || (postData && this._default_post_header)){
+                               this.initHeader('Content-Type','application/x-www-form-urlencoded');
+                               YAHOO.log('Initialize default header Content-Type to application/x-www-form-urlencoded.', 'info', 'Connection');
+                               if(this._isFormSubmit){
+                                       this._isFormSubmit = false;
+                               }
+                       }
+
+                       //Verify whether the transaction has any user-defined HTTP headers
+                       //and set them.
+                       if(this._has_http_headers){
+                               this.setHeader(o);
+                       }
+
+                       this.handleReadyState(o, callback);
+                       postData?o.conn.send(postData):o.conn.send(null);
+
+                       return o;
+               }
+       },
+
+  /**
+   * This method serves as a timer that polls the XHR object's readyState
+   * property during a transaction, instead of binding a callback to the
+   * onreadystatechange event.  Upon readyState 4, handleTransactionResponse
+   * will process the response, and the timer will be cleared.
+   *
+   * @private
+   * @param {object} o The connection object
+   * @param callback User-defined callback object
+   * @return void
+   */
+    handleReadyState:function(o, callback)
+    {
+        var timeOut = callback.timeout;
+        var oConn = this;
+
+        try
+        {
+            if(timeOut !== undefined){
+               this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true) }, timeOut);
+            }
+            this._poll[o.tId] = window.setInterval(
+                function(){
+                                       if(o.conn && o.conn.readyState == 4){
+                                               window.clearInterval(oConn._poll[o.tId]);
+                                               oConn._poll.splice(o.tId);
+                                               if(timeOut){
+                                                       oConn._timeOut.splice(o.tId);
+                                               }
+
+                                               oConn.handleTransactionResponse(o, callback);
+                    }
+                }
+            ,this._polling_interval);
+        }
+        catch(e)
+        {
+            window.clearInterval(oConn._poll[o.tId]);
+            oConn._poll.splice(o.tId);
+                       if(timeOut){
+                               oConn._timeOut.splice(o.tId);
+                       }
+
+            oConn.handleTransactionResponse(o, callback);
+        }
+    },
+
+  /**
+   * This method attempts to interpret the server response and
+   * determine whether the transaction was successful, or if an error or
+   * exception was encountered.
+   *
+   * @private
+   * @param {object} o The connection object
+   * @param {object} callback - User-defined callback object
+   * @param {boolean} determines if the transaction was aborted.
+   * @return void
+   */
+    handleTransactionResponse:function(o, callback, isAbort)
+    {
+               // If no valid callback is provided, then do not process any callback handling.
+               if(!callback){
+                       this.releaseObject(o);
+                       YAHOO.log('No callback object to process.  Transaction complete.', 'warn', 'Connection');
+                       return;
+               }
+
+               var httpStatus, responseObject;
+
+               try
+               {
+                       if(o.conn.status !== undefined && o.conn.status != 0){
+                               httpStatus = o.conn.status;
+                       }
+                       else{
+                               httpStatus = 13030;
+                       }
+               }
+               catch(e){
+                       // 13030 is the custom code to indicate the condition -- in Mozilla/FF --
+                       // when the o object's status and statusText properties are
+                       // unavailable, and a query attempt throws an exception.
+                       httpStatus = 13030;
+               }
+
+               if(httpStatus >= 200 && httpStatus < 300){
+                       responseObject = this.createResponseObject(o, callback.argument);
+                       if(callback.success){
+                               if(!callback.scope){
+                                       callback.success(responseObject);
+                                       YAHOO.log('Success callback. HTTP code is ' + httpStatus, 'info', 'Connection');
+                               }
+                               else{
+                                       // If a scope property is defined, the callback will be fired from
+                                       // the context of the object.
+                                       callback.success.apply(callback.scope, [responseObject]);
+                                       YAHOO.log('Success callback with scope. HTTP code is ' + httpStatus, 'info', 'Connection');
+                               }
+                       }
+               }
+               else{
+                       switch(httpStatus){
+                               // The following case labels are wininet.dll error codes that may be encountered.
+                               // Server timeout
+                               case 12002:
+                               // 12029 to 12031 correspond to dropped connections.
+                               case 12029:
+                               case 12030:
+                               case 12031:
+                               // Connection closed by server.
+                               case 12152:
+                               // See above comments for variable status.
+                               case 13030:
+                                       responseObject = this.createExceptionObject(o.tId, callback.argument, isAbort);
+                                       if(callback.failure){
+                                               if(!callback.scope){
+                                                       callback.failure(responseObject);
+                                                       YAHOO.log('Failure callback. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
+                                               }
+                                               else{
+                                                       callback.failure.apply(callback.scope,[responseObject]);
+                                                       YAHOO.log('Failure callback with scope. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection');
+                                               }
+                                       }
+                                       break;
+                               default:
+                                       responseObject = this.createResponseObject(o, callback.argument);
+                                       if(callback.failure){
+                                               if(!callback.scope){
+                                                       callback.failure(responseObject);
+                                                       YAHOO.log('Failure callback. HTTP status code is ' + httpStatus, 'warn', 'Connection');
+                                               }
+                                               else{
+                                                       callback.failure.apply(callback.scope,[responseObject]);
+                                                       YAHOO.log('Failure callback with scope. HTTP status code is ' + httpStatus, 'warn', 'Connection');
+                                               }
+                                       }
+                       }
+               }
+
+               this.releaseObject(o);
+    },
+
+  /**
+   * This method evaluates the server response, creates and returns the results via
+   * its properties.  Success and failure cases will differ in the response
+   * object's property values.
+   * @private
+   * @param {object} o The connection object
+   * @param {} callbackArg User-defined argument or arguments to be passed to the callback
+   * @return object
+   */
+    createResponseObject:function(o, callbackArg)
+    {
+               var obj = {};
+               var headerObj = {};
+
+               try
+               {
+                       var headerStr = o.conn.getAllResponseHeaders();
+                       var header = headerStr.split('\n');
+                       for(var i=0; i < header.length; i++){
+                               var delimitPos = header[i].indexOf(':');
+                               if(delimitPos != -1){
+                                       headerObj[header[i].substring(0,delimitPos)] = header[i].substring(delimitPos+1);
+                               }
+                       }
+               }
+               catch(e){}
+
+               obj.tId = o.tId;
+               obj.status = o.conn.status;
+               obj.statusText = o.conn.statusText;
+               obj.getResponseHeader = headerObj;
+               obj.getAllResponseHeaders = headerStr;
+               obj.responseText = o.conn.responseText;
+               obj.responseXML = o.conn.responseXML;
+
+               if(typeof callbackArg !== undefined){
+                       obj.argument = callbackArg;
+               }
+
+               return obj;
+    },
+
+  /**
+   * If a transaction cannot be completed due to dropped or closed connections,
+   * there may be not be enough information to build a full response object.
+   * The failure callback will be fired and this specific condition can be identified
+   * by a status property value of 0.
+   *
+   * If an abort was successful, the status property will report a value of -1.
+   *
+   * @private
+   * @param {int} tId Transaction Id
+   * @param callbackArg The user-defined arguments
+   * @param isAbort Determines if the exception is an abort.
+   * @return object
+   */
+    createExceptionObject:function(tId, callbackArg, isAbort)
+    {
+               var COMM_CODE = 0;
+               var COMM_ERROR = 'communication failure';
+               var ABORT_CODE = -1;
+               var ABORT_ERROR = 'transaction aborted';
+
+               var obj = {};
+
+               obj.tId = tId;
+               if(isAbort){
+                       obj.status = ABORT_CODE;
+                       obj.statusText = ABORT_ERROR;
+               }
+               else{
+                       obj.status = COMM_CODE;
+                       obj.statusText = COMM_ERROR;
+               }
+
+               if(callbackArg){
+                       obj.argument = callbackArg;
+               }
+
+               return obj;
+    },
+
+  /**
+   * Public method that stores the custom HTTP headers for each transaction.
+   * @public
+   * @param {string} label The HTTP header label
+   * @param {string} value The HTTP header value
+   * @return void
+   */
+       initHeader:function(label,value)
+       {
+               if(this._http_header[label] === undefined){
+                       this._http_header[label] = value;
+               }
+               else{
+                       this._http_header[label] =  value + "," + this._http_header[label];
+               }
+
+               this._has_http_headers = true;
+       },
+
+  /**
+   * Accessor that sets the HTTP headers for each transaction.
+   * @private
+   * @param {object} o The connection object for the transaction.
+   * @return void
+   */
+       setHeader:function(o)
+       {
+               for(var prop in this._http_header){
+                       if(this._http_header.propertyIsEnumerable){
+                               o.conn.setRequestHeader(prop, this._http_header[prop]);
+                               YAHOO.log('HTTP header ' + prop + ' set with value of ' + this._http_header[prop], 'info', 'Connection');
+                       }
+               }
+               delete this._http_header;
+
+               this._http_header = {};
+               this._has_http_headers = false;
+       },
+
+  /**
+   * This method assembles the form label and value pairs and
+   * constructs an encoded string.
+   * asyncRequest() will automatically initialize the
+   * transaction with a HTTP header Content-Type of
+   * application/x-www-form-urlencoded.
+   * @public
+   * @param {string || object} form id or name attribute, or form object.
+   * @param {string} optional boolean to indicate SSL environment.
+   * @param {string} optional qualified path of iframe resource for SSL in IE.
+   * @return void
+   */
+       setForm:function(formId, isUpload, secureUri)
+       {
+               this._sFormData = '';
+               if(typeof formId == 'string'){
+                       // Determine if the argument is a form id or a form name.
+                       // Note form name usage is deprecated by supported
+                       // here for legacy reasons.
+                       var oForm = (document.getElementById(formId) || document.forms[formId]);
+               }
+               else if(typeof formId == 'object'){
+                       var oForm = formId;
+               }
+               else{
+                       YAHOO.log('Unable to create form object ' + formId, 'warn', 'Connection');
+                       return;
+               }
+
+               // If the isUpload argument is true, setForm will call createFrame to initialize
+               // an iframe as the form target.
+               //
+               // The argument secureURI is also required by IE in SSL environments
+               // where the secureURI string is a fully qualified HTTP path, used to set the source
+               // of the iframe, to a stub resource in the same domain.
+               if(isUpload){
+                       (typeof secureUri == 'string')?this.createFrame(secureUri):this.createFrame();
+                       this._isFormSubmit = true;
+                       this._isFileUpload = true;
+                       this._formNode = oForm;
+
+                       return;
+               }
+
+               var oElement, oName, oValue, oDisabled;
+               var hasSubmit = false;
+
+               // Iterate over the form elements collection to construct the
+               // label-value pairs.
+               for (var i=0; i<oForm.elements.length; i++){
+                       oDisabled = oForm.elements[i].disabled;
+
+                       // If the name attribute is not populated, the form field's
+                       // value will not be submitted.
+                       oElement = oForm.elements[i];
+                       oName = oForm.elements[i].name;
+                       oValue = oForm.elements[i].value;
+
+                       // Do not submit fields that are disabled or
+                       // do not have a name attribute value.
+                       if(!oDisabled && oName !== undefined)
+                       {
+                               switch (oElement.type)
+                               {
+                                       case 'select-one':
+                                       case 'select-multiple':
+                                               for(var j=0; j<oElement.options.length; j++){
+                                                       if(oElement.options[j].selected){
+                                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].value || oElement.options[j].text) + '&';
+                                                       }
+                                               }
+                                               break;
+                                       case 'radio':
+                                       case 'checkbox':
+                                               if(oElement.checked){
+                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                               }
+                                               break;
+                                       case 'file':
+                                               // stub case as XMLHttpRequest will only send the file path as a string.
+                                       case undefined:
+                                               // stub case for fieldset element which returns undefined.
+                                       case 'reset':
+                                               // stub case for input type reset button.
+                                       case 'button':
+                                               // stub case for input type button elements.
+                                               break;
+                                       case 'submit':
+                                               if(hasSubmit == false){
+                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                                       hasSubmit = true;
+                                               }
+                                               break;
+                                       default:
+                                               this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                               break;
+                               }
+                       }
+               }
+
+               this._isFormSubmit = true;
+               this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1);
+
+               YAHOO.log('Form initialized for transaction. POST message is: ' + this._sFormData, 'info', 'Connection');
+       },
+
+  /**
+   * Creates an iframe to be used for form file uploads.  It is remove from the
+   * document upon completion of the upload transaction.
+   *
+   * @private
+   * @param {string} optional qualified path of iframe resource for SSL in IE.
+   * @return void
+   */
+       createFrame:function(secureUri){
+
+               // IE does not allow the setting of id and name attributes as DOM
+               // properties.  A different iframe creation pattern is required for IE.
+               if(window.ActiveXObject){
+                       var io = document.createElement('<IFRAME name="ioFrame" id="ioFrame">');
+                       if(secureUri){
+                               // IE will throw a security exception in an SSL environment if the
+                               // iframe source isn't set to a valid resource.
+                               io.src = secureUri;
+                       }
+               }
+               else{
+                       var io = document.createElement('IFRAME');
+                       io.id = 'ioFrame';
+                       io.name = 'ioFrame';
+               }
+
+               io.style.position = 'absolute';
+               io.style.top = '-1000px';
+               io.style.left = '-1000px';
+
+               document.body.appendChild(io);
+       },
+
+  /**
+   * Uploads HTML form, including files/attachments,  targeting the
+   * iframe created in createFrame.
+   *
+   * @private
+   * @param {int} id The transaction id.
+   * @param {object} callback - User-defined callback object.
+   * @param {string} uri Fully qualified path of resource.
+   * @return void
+   */
+       uploadFile:function(id, callback, uri){
+               // Initialize the HTML form properties in case they are
+               // not defined in the HTML form.
+               this._formNode.action = uri;
+               this._formNode.enctype = 'multipart/form-data';
+               this._formNode.method = 'POST';
+               this._formNode.target = 'ioFrame';
+               this._formNode.submit();
+
+               // Reset form status properties.
+               this._formNode = null;
+               this._isFileUpload = false;
+               this._isFormSubmit = false;
+
+               // Create the upload callback handler that fires when the iframe
+               // receives the load event.  Subsequently, the event handler is detached
+               // and the iframe removed from the document.
+
+               var uploadCallback = function()
+               {
+                       var oResponse =
+                       {
+                               tId: id,
+                               responseText: document.getElementById("ioFrame").contentWindow.document.body.innerHTML,
+                               argument: callback.argument
+                       }
+
+                       if(callback.upload && !callback.scope){
+                               callback.upload(oResponse);
+                               YAHOO.log('Upload callback.', 'info', 'Connection');
+                       }
+                       else{
+                               callback.upload.apply(callback.scope, [oResponse]);
+                               YAHOO.log('Upload callback with object scope.', 'info', 'Connection');
+                       }
+
+                       YAHOO.util.Event.removeListener("ioFrame", "load", uploadCallback);
+                       window.ioFrame.location.replace('#');
+                       setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100);
+               };
+
+               // Bind the onload handler to the iframe to detect the file upload response.
+               YAHOO.util.Event.addListener("ioFrame", "load", uploadCallback);
+       },
+
+  /**
+   * Public method to terminate a transaction, if it has not reached readyState 4.
+   * @public
+   * @param {object} o The connection object returned by asyncRequest.
+   * @param {object} callback  User-defined callback object.
+   * @param {string} isTimeout boolean to indicate if abort was a timeout.
+   * @return void
+   */
+       abort:function(o, callback, isTimeout)
+       {
+               if(this.isCallInProgress(o)){
+                       window.clearInterval(this._poll[o.tId]);
+                       this._poll.splice(o.tId);
+                       if(isTimeout){
+                               this._timeOut.splice(o.tId);
+                       }
+                       o.conn.abort();
+
+                       this.handleTransactionResponse(o, callback, true);
+                       YAHOO.log('Transaction ' + o.tId + ' aborted.', 'info', 'Connection');
+
+                       return true;
+               }
+               else{
+                       YAHOO.log('Transaction ' + o.tId + ' abort failed.', 'warn', 'Connection');
+
+                       return false;
+               }
+       },
+
+  /**
+   * Public method to check if the transaction is still being processed.
+   * @public
+   * @param {object} o The connection object returned by asyncRequest
+   * @return boolean
+   */
+       isCallInProgress:function(o)
+       {
+               // if the XHR object assigned to the transaction has not been dereferenced,
+               // then check its readyState status.  Otherwise, return false.
+               if(o.conn){
+                       return o.conn.readyState != 4 && o.conn.readyState != 0;
+               }
+               else{
+                       //The XHR object has been destroyed.
+                       return false;
+               }
+       },
+
+  /**
+   * Dereference the XHR instance and the connection object after the transaction is completed.
+   * @private
+   * @param {object} o The connection object
+   * @return void
+   */
+       releaseObject:function(o)
+       {
+               //dereference the XHR instance.
+               o.conn = null;
+
+               YAHOO.log('Connection object for transaction ' + o.tId + ' destroyed.', 'info', 'Connection');
+
+               //dereference the connection object.
+               o = null;
+       }
+};
diff --git a/lib/yui/connection/connection-min.js b/lib/yui/connection/connection-min.js
new file mode 100755 (executable)
index 0000000..af812ec
--- /dev/null
@@ -0,0 +1,87 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_default_post_header:true,_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:[],_timeOut:[],_polling_interval:50,_transaction_id:0,setProgId:function(id)\r
+{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)\r
+{this._default_post_header=b;},setPollingInterval:function(i)\r
+{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)\r
+{var obj,http;try\r
+{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}\r
+catch(e)\r
+{for(var i=0;i<this._msxml_progid.length;++i){try\r
+{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}\r
+catch(e){}}}\r
+finally\r
+{return obj;}},getConnectionObject:function()\r
+{var o;var tId=this._transaction_id;try\r
+{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}\r
+catch(e){}\r
+finally\r
+{return o;}},asyncRequest:function(method,uri,callback,postData)\r
+{var o=this.getConnectionObject();if(!o){return null;}\r
+else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri);this.releaseObject(o);return;}\r
+if(method=='GET'){uri+="?"+this._sFormData;}\r
+else if(method=='POST'){postData=this._sFormData;}\r
+this._sFormData='';}\r
+o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._default_post_header)){this.initHeader('Content-Type','application/x-www-form-urlencoded');if(this._isFormSubmit){this._isFormSubmit=false;}}\r
+if(this._has_http_headers){this.setHeader(o);}\r
+this.handleReadyState(o,callback);postData?o.conn.send(postData):o.conn.send(null);return o;}},handleReadyState:function(o,callback)\r
+{var timeOut=callback.timeout;var oConn=this;try\r
+{if(timeOut!==undefined){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true)},timeOut);}\r
+this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);if(timeOut){oConn._timeOut.splice(o.tId);}\r
+oConn.handleTransactionResponse(o,callback);}},this._polling_interval);}\r
+catch(e)\r
+{window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);if(timeOut){oConn._timeOut.splice(o.tId);}\r
+oConn.handleTransactionResponse(o,callback);}},handleTransactionResponse:function(o,callback,isAbort)\r
+{if(!callback){this.releaseObject(o);return;}\r
+var httpStatus,responseObject;try\r
+{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}\r
+else{httpStatus=13030;}}\r
+catch(e){httpStatus=13030;}\r
+if(httpStatus>=200&&httpStatus<300){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}\r
+else{callback.success.apply(callback.scope,[responseObject]);}}}\r
+else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,isAbort);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}\r
+else{callback.failure.apply(callback.scope,[responseObject]);}}\r
+break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}\r
+else{callback.failure.apply(callback.scope,[responseObject]);}}}}\r
+this.releaseObject(o);},createResponseObject:function(o,callbackArg)\r
+{var obj={};var headerObj={};try\r
+{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+1);}}}\r
+catch(e){}\r
+obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}\r
+return obj;},createExceptionObject:function(tId,callbackArg,isAbort)\r
+{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}\r
+else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}\r
+if(callbackArg){obj.argument=callbackArg;}\r
+return obj;},initHeader:function(label,value)\r
+{if(this._http_header[label]===undefined){this._http_header[label]=value;}\r
+else{this._http_header[label]=value+","+this._http_header[label];}\r
+this._has_http_headers=true;},setHeader:function(o)\r
+{for(var prop in this._http_header){if(this._http_header.propertyIsEnumerable){o.conn.setRequestHeader(prop,this._http_header[prop]);}}\r
+delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri)\r
+{this._sFormData='';if(typeof formId=='string'){var oForm=(document.getElementById(formId)||document.forms[formId]);}\r
+else if(typeof formId=='object'){var oForm=formId;}\r
+else{return;}\r
+if(isUpload){(typeof secureUri=='string')?this.createFrame(secureUri):this.createFrame();this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}\r
+var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oDisabled=oForm.elements[i].disabled;oElement=oForm.elements[i];oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)\r
+{switch(oElement.type)\r
+{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].value||oElement.options[j].text)+'&';}}\r
+break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}\r
+break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}\r
+break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}\r
+this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);},createFrame:function(secureUri){if(window.ActiveXObject){var io=document.createElement('<IFRAME name="ioFrame" id="ioFrame">');if(secureUri){io.src=secureUri;}}\r
+else{var io=document.createElement('IFRAME');io.id='ioFrame';io.name='ioFrame';}\r
+io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},uploadFile:function(id,callback,uri){this._formNode.action=uri;this._formNode.enctype='multipart/form-data';this._formNode.method='POST';this._formNode.target='ioFrame';this._formNode.submit();this._formNode=null;this._isFileUpload=false;this._isFormSubmit=false;var uploadCallback=function()\r
+{var oResponse={tId:id,responseText:document.getElementById("ioFrame").contentWindow.document.body.innerHTML,argument:callback.argument}\r
+if(callback.upload&&!callback.scope){callback.upload(oResponse);}\r
+else{callback.upload.apply(callback.scope,[oResponse]);}\r
+YAHOO.util.Event.removeListener("ioFrame","load",uploadCallback);window.ioFrame.location.replace('#');setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100);};YAHOO.util.Event.addListener("ioFrame","load",uploadCallback);},abort:function(o,callback,isTimeout)\r
+{if(this.isCallInProgress(o)){window.clearInterval(this._poll[o.tId]);this._poll.splice(o.tId);if(isTimeout){this._timeOut.splice(o.tId);}\r
+o.conn.abort();this.handleTransactionResponse(o,callback,true);return true;}\r
+else{return false;}},isCallInProgress:function(o)\r
+{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}\r
+else{return false;}},releaseObject:function(o)\r
+{o.conn=null;o=null;}};\r
diff --git a/lib/yui/connection/connection.js b/lib/yui/connection/connection.js
new file mode 100755 (executable)
index 0000000..670a106
--- /dev/null
@@ -0,0 +1,775 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.11.0
+*/
+
+/**
+ * The Connection Manager provides a simplified interface to the XMLHttpRequest
+ * object.  It handles cross-browser instantiantion of XMLHttpRequest, negotiates the
+ * interactive states and server response, returning the results to a pre-defined
+ * callback you create.
+ * @ class
+ */
+YAHOO.util.Connect =
+{
+/**
+   * Array of MSFT ActiveX ids for XMLHttpRequest.
+   * @private
+   * @type array
+   */
+       _msxml_progid:[
+                       'MSXML2.XMLHTTP.3.0',
+                       'MSXML2.XMLHTTP',
+                       'Microsoft.XMLHTTP'
+                       ],
+
+  /**
+   * Object literal of HTTP header(s)
+   * @private
+   * @type object
+   */
+       _http_header:{},
+
+  /**
+   * Determines if HTTP headers are set.
+   * @private
+   * @type boolean
+   */
+       _has_http_headers:false,
+
+ /**
+  * Determines if a default header of
+  * Content-Type of 'application/x-www-form-urlencoded'
+  * will be added to any client HTTP headers sent for POST
+  * transactions.
+  * @private
+  * @type boolean
+  */
+    _default_post_header:true,
+
+ /**
+  * Property modified by setForm() to determine if the data
+  * should be submitted as an HTML form.
+  * @private
+  * @type boolean
+  */
+    _isFormSubmit:false,
+
+ /**
+  * Property modified by setForm() to determine if a file(s)
+  * upload is expected.
+  * @private
+  * @type boolean
+  */
+    _isFileUpload:false,
+
+ /**
+  * Property modified by setForm() to set a reference to the HTML
+  * form node if the desired action is file upload.
+  * @private
+  * @type object
+  */
+    _formNode:null,
+
+ /**
+  * Property modified by setForm() to set the HTML form data
+  * for each transaction.
+  * @private
+  * @type string
+  */
+    _sFormData:null,
+
+ /**
+  * Collection of polling references to the polling mechanism in handleReadyState.
+  * @private
+  * @type string
+  */
+    _poll:[],
+
+ /**
+  * Queue of timeout values for each transaction callback with a defined timeout value.
+  * @private
+  * @type string
+  */
+    _timeOut:[],
+
+  /**
+   * The polling frequency, in milliseconds, for HandleReadyState.
+   * when attempting to determine a transaction's XHR readyState.
+   * The default is 50 milliseconds.
+   * @private
+   * @type int
+   */
+     _polling_interval:50,
+
+  /**
+   * A transaction counter that increments the transaction id for each transaction.
+   * @private
+   * @type int
+   */
+     _transaction_id:0,
+
+  /**
+   * Member to add an ActiveX id to the existing xml_progid array.
+   * In the event(unlikely) a new ActiveX id is introduced, it can be added
+   * without internal code modifications.
+   * @public
+   * @param string id The ActiveX id to be added to initialize the XHR object.
+   * @return void
+   */
+       setProgId:function(id)
+       {
+               this._msxml_progid.unshift(id);
+       },
+
+  /**
+   * Member to enable or disable the default POST header.
+   * @public
+   * @param boolean b Set and use default header - true or false .
+   * @return void
+   */
+       setDefaultPostHeader:function(b)
+       {
+               this._default_post_header = b;
+       },
+
+  /**
+   * Member to modify the default polling interval.
+   * @public
+   * @param {int} i The polling interval in milliseconds.
+   * @return void
+   */
+       setPollingInterval:function(i)
+       {
+               if(typeof i == 'number' && isFinite(i)){
+                               this._polling_interval = i;
+               }
+       },
+
+  /**
+   * Instantiates a XMLHttpRequest object and returns an object with two properties:
+   * the XMLHttpRequest instance and the transaction id.
+   * @private
+   * @param {int} transactionId Property containing the transaction id for this transaction.
+   * @return connection object
+   */
+       createXhrObject:function(transactionId)
+       {
+               var obj,http;
+               try
+               {
+                       // Instantiates XMLHttpRequest in non-IE browsers and assigns to http.
+                       http = new XMLHttpRequest();
+                       //  Object literal with http and tId properties
+                       obj = { conn:http, tId:transactionId };
+               }
+               catch(e)
+               {
+                       for(var i=0; i<this._msxml_progid.length; ++i){
+                               try
+                               {
+                                       // Instantiates XMLHttpRequest for IE and assign to http.
+                                       http = new ActiveXObject(this._msxml_progid[i]);
+                                       //  Object literal with http and tId properties
+                                       obj = { conn:http, tId:transactionId };
+                                       break;
+                               }
+                               catch(e){}
+                       }
+               }
+               finally
+               {
+                       return obj;
+               }
+       },
+
+  /**
+   * This method is called by asyncRequest to create a
+   * valid connection object for the transaction.  It also passes a
+   * transaction id and increments the transaction id counter.
+   * @private
+   * @return object
+   */
+       getConnectionObject:function()
+       {
+               var o;
+               var tId = this._transaction_id;
+
+               try
+               {
+                       o = this.createXhrObject(tId);
+                       if(o){
+                               this._transaction_id++;
+                       }
+               }
+               catch(e){}
+               finally
+               {
+                       return o;
+               }
+       },
+
+  /**
+   * Method for initiating an asynchronous request via the XHR object.
+   * @public
+   * @param {string} method HTTP transaction method
+   * @param {string} uri Fully qualified path of resource
+   * @param callback User-defined callback function or object
+   * @param {string} postData POST body
+   * @return {object} Returns the connection object
+   */
+       asyncRequest:function(method, uri, callback, postData)
+       {
+               var o = this.getConnectionObject();
+
+               if(!o){
+                       return null;
+               }
+               else{
+                       if(this._isFormSubmit){
+                               if(this._isFileUpload){
+                                       this.uploadFile(o.tId, callback, uri);
+                                       this.releaseObject(o);
+                                       return;
+                               }
+
+                               //If the specified HTTP method is GET, setForm() will return an
+                               //encoded string that is concatenated to the uri to
+                               //create a querystring.
+                               if(method == 'GET'){
+                                       uri += "?" +  this._sFormData;
+                               }
+                               else if(method == 'POST'){
+                                       postData =  this._sFormData;
+                               }
+                               this._sFormData = '';
+                       }
+
+                       o.conn.open(method, uri, true);
+
+                       if(this._isFormSubmit || (postData && this._default_post_header)){
+                               this.initHeader('Content-Type','application/x-www-form-urlencoded');
+                               if(this._isFormSubmit){
+                                       this._isFormSubmit = false;
+                               }
+                       }
+
+                       //Verify whether the transaction has any user-defined HTTP headers
+                       //and set them.
+                       if(this._has_http_headers){
+                               this.setHeader(o);
+                       }
+
+                       this.handleReadyState(o, callback);
+                       postData?o.conn.send(postData):o.conn.send(null);
+
+                       return o;
+               }
+       },
+
+  /**
+   * This method serves as a timer that polls the XHR object's readyState
+   * property during a transaction, instead of binding a callback to the
+   * onreadystatechange event.  Upon readyState 4, handleTransactionResponse
+   * will process the response, and the timer will be cleared.
+   *
+   * @private
+   * @param {object} o The connection object
+   * @param callback User-defined callback object
+   * @return void
+   */
+    handleReadyState:function(o, callback)
+    {
+        var timeOut = callback.timeout;
+        var oConn = this;
+
+        try
+        {
+            if(timeOut !== undefined){
+               this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true) }, timeOut);
+            }
+            this._poll[o.tId] = window.setInterval(
+                function(){
+                                       if(o.conn && o.conn.readyState == 4){
+                                               window.clearInterval(oConn._poll[o.tId]);
+                                               oConn._poll.splice(o.tId);
+                                               if(timeOut){
+                                                       oConn._timeOut.splice(o.tId);
+                                               }
+
+                                               oConn.handleTransactionResponse(o, callback);
+                    }
+                }
+            ,this._polling_interval);
+        }
+        catch(e)
+        {
+            window.clearInterval(oConn._poll[o.tId]);
+            oConn._poll.splice(o.tId);
+                       if(timeOut){
+                               oConn._timeOut.splice(o.tId);
+                       }
+
+            oConn.handleTransactionResponse(o, callback);
+        }
+    },
+
+  /**
+   * This method attempts to interpret the server response and
+   * determine whether the transaction was successful, or if an error or
+   * exception was encountered.
+   *
+   * @private
+   * @param {object} o The connection object
+   * @param {object} callback - User-defined callback object
+   * @param {boolean} determines if the transaction was aborted.
+   * @return void
+   */
+    handleTransactionResponse:function(o, callback, isAbort)
+    {
+               // If no valid callback is provided, then do not process any callback handling.
+               if(!callback){
+                       this.releaseObject(o);
+                       return;
+               }
+
+               var httpStatus, responseObject;
+
+               try
+               {
+                       if(o.conn.status !== undefined && o.conn.status != 0){
+                               httpStatus = o.conn.status;
+                       }
+                       else{
+                               httpStatus = 13030;
+                       }
+               }
+               catch(e){
+                       // 13030 is the custom code to indicate the condition -- in Mozilla/FF --
+                       // when the o object's status and statusText properties are
+                       // unavailable, and a query attempt throws an exception.
+                       httpStatus = 13030;
+               }
+
+               if(httpStatus >= 200 && httpStatus < 300){
+                       responseObject = this.createResponseObject(o, callback.argument);
+                       if(callback.success){
+                               if(!callback.scope){
+                                       callback.success(responseObject);
+                               }
+                               else{
+                                       // If a scope property is defined, the callback will be fired from
+                                       // the context of the object.
+                                       callback.success.apply(callback.scope, [responseObject]);
+                               }
+                       }
+               }
+               else{
+                       switch(httpStatus){
+                               // The following case labels are wininet.dll error codes that may be encountered.
+                               // Server timeout
+                               case 12002:
+                               // 12029 to 12031 correspond to dropped connections.
+                               case 12029:
+                               case 12030:
+                               case 12031:
+                               // Connection closed by server.
+                               case 12152:
+                               // See above comments for variable status.
+                               case 13030:
+                                       responseObject = this.createExceptionObject(o.tId, callback.argument, isAbort);
+                                       if(callback.failure){
+                                               if(!callback.scope){
+                                                       callback.failure(responseObject);
+                                               }
+                                               else{
+                                                       callback.failure.apply(callback.scope, [responseObject]);
+                                               }
+                                       }
+                                       break;
+                               default:
+                                       responseObject = this.createResponseObject(o, callback.argument);
+                                       if(callback.failure){
+                                               if(!callback.scope){
+                                                       callback.failure(responseObject);
+                                               }
+                                               else{
+                                                       callback.failure.apply(callback.scope, [responseObject]);
+                                               }
+                                       }
+                       }
+               }
+
+               this.releaseObject(o);
+    },
+
+  /**
+   * This method evaluates the server response, creates and returns the results via
+   * its properties.  Success and failure cases will differ in the response
+   * object's property values.
+   * @private
+   * @param {object} o The connection object
+   * @param {} callbackArg User-defined argument or arguments to be passed to the callback
+   * @return object
+   */
+    createResponseObject:function(o, callbackArg)
+    {
+               var obj = {};
+               var headerObj = {};
+
+               try
+               {
+                       var headerStr = o.conn.getAllResponseHeaders();
+                       var header = headerStr.split('\n');
+                       for(var i=0; i < header.length; i++){
+                               var delimitPos = header[i].indexOf(':');
+                               if(delimitPos != -1){
+                                       headerObj[header[i].substring(0,delimitPos)] = header[i].substring(delimitPos+1);
+                               }
+                       }
+               }
+               catch(e){}
+
+               obj.tId = o.tId;
+               obj.status = o.conn.status;
+               obj.statusText = o.conn.statusText;
+               obj.getResponseHeader = headerObj;
+               obj.getAllResponseHeaders = headerStr;
+               obj.responseText = o.conn.responseText;
+               obj.responseXML = o.conn.responseXML;
+
+               if(typeof callbackArg !== undefined){
+                       obj.argument = callbackArg;
+               }
+
+               return obj;
+    },
+
+  /**
+   * If a transaction cannot be completed due to dropped or closed connections,
+   * there may be not be enough information to build a full response object.
+   * The failure callback will be fired and this specific condition can be identified
+   * by a status property value of 0.
+   *
+   * If an abort was successful, the status property will report a value of -1.
+   *
+   * @private
+   * @param {int} tId Transaction Id
+   * @param callbackArg The user-defined arguments
+   * @param isAbort Determines if the exception is an abort.
+   * @return object
+   */
+    createExceptionObject:function(tId, callbackArg, isAbort)
+    {
+               var COMM_CODE = 0;
+               var COMM_ERROR = 'communication failure';
+               var ABORT_CODE = -1;
+               var ABORT_ERROR = 'transaction aborted';
+
+               var obj = {};
+
+               obj.tId = tId;
+               if(isAbort){
+                       obj.status = ABORT_CODE;
+                       obj.statusText = ABORT_ERROR;
+               }
+               else{
+                       obj.status = COMM_CODE;
+                       obj.statusText = COMM_ERROR;
+               }
+
+               if(callbackArg){
+                       obj.argument = callbackArg;
+               }
+
+               return obj;
+    },
+
+  /**
+   * Public method that stores the custom HTTP headers for each transaction.
+   * @public
+   * @param {string} label The HTTP header label
+   * @param {string} value The HTTP header value
+   * @return void
+   */
+       initHeader:function(label,value)
+       {
+               if(this._http_header[label] === undefined){
+                       this._http_header[label] = value;
+               }
+               else{
+                       this._http_header[label] =  value + "," + this._http_header[label];
+               }
+
+               this._has_http_headers = true;
+       },
+
+  /**
+   * Accessor that sets the HTTP headers for each transaction.
+   * @private
+   * @param {object} o The connection object for the transaction.
+   * @return void
+   */
+       setHeader:function(o)
+       {
+               for(var prop in this._http_header){
+                       if(this._http_header.propertyIsEnumerable){
+                               o.conn.setRequestHeader(prop, this._http_header[prop]);
+                       }
+               }
+               delete this._http_header;
+
+               this._http_header = {};
+               this._has_http_headers = false;
+       },
+
+  /**
+   * This method assembles the form label and value pairs and
+   * constructs an encoded string.
+   * asyncRequest() will automatically initialize the
+   * transaction with a HTTP header Content-Type of
+   * application/x-www-form-urlencoded.
+   * @public
+   * @param {string || object} form id or name attribute, or form object.
+   * @param {string} optional boolean to indicate SSL environment.
+   * @param {string} optional qualified path of iframe resource for SSL in IE.
+   * @return void
+   */
+       setForm:function(formId, isUpload, secureUri)
+       {
+               this._sFormData = '';
+               if(typeof formId == 'string'){
+                       // Determine if the argument is a form id or a form name.
+                       // Note form name usage is deprecated by supported
+                       // here for legacy reasons.
+                       var oForm = (document.getElementById(formId) || document.forms[formId]);
+               }
+               else if(typeof formId == 'object'){
+                       var oForm = formId;
+               }
+               else{
+                       return;
+               }
+
+               // If the isUpload argument is true, setForm will call createFrame to initialize
+               // an iframe as the form target.
+               //
+               // The argument secureURI is also required by IE in SSL environments
+               // where the secureURI string is a fully qualified HTTP path, used to set the source
+               // of the iframe, to a stub resource in the same domain.
+               if(isUpload){
+                       (typeof secureUri == 'string')?this.createFrame(secureUri):this.createFrame();
+                       this._isFormSubmit = true;
+                       this._isFileUpload = true;
+                       this._formNode = oForm;
+
+                       return;
+               }
+
+               var oElement, oName, oValue, oDisabled;
+               var hasSubmit = false;
+
+               // Iterate over the form elements collection to construct the
+               // label-value pairs.
+               for (var i=0; i<oForm.elements.length; i++){
+                       oDisabled = oForm.elements[i].disabled;
+
+                       // If the name attribute is not populated, the form field's
+                       // value will not be submitted.
+                       oElement = oForm.elements[i];
+                       oName = oForm.elements[i].name;
+                       oValue = oForm.elements[i].value;
+
+                       // Do not submit fields that are disabled or
+                       // do not have a name attribute value.
+                       if(!oDisabled && oName)
+                       {
+                               switch (oElement.type)
+                               {
+                                       case 'select-one':
+                                       case 'select-multiple':
+                                               for(var j=0; j<oElement.options.length; j++){
+                                                       if(oElement.options[j].selected){
+                                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].value || oElement.options[j].text) + '&';
+                                                       }
+                                               }
+                                               break;
+                                       case 'radio':
+                                       case 'checkbox':
+                                               if(oElement.checked){
+                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                               }
+                                               break;
+                                       case 'file':
+                                               // stub case as XMLHttpRequest will only send the file path as a string.
+                                       case undefined:
+                                               // stub case for fieldset element which returns undefined.
+                                       case 'reset':
+                                               // stub case for input type reset button.
+                                       case 'button':
+                                               // stub case for input type button elements.
+                                               break;
+                                       case 'submit':
+                                               if(hasSubmit == false){
+                                                       this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                                       hasSubmit = true;
+                                               }
+                                               break;
+                                       default:
+                                               this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+                                               break;
+                               }
+                       }
+               }
+
+               this._isFormSubmit = true;
+               this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1);
+       },
+
+  /**
+   * Creates an iframe to be used for form file uploads.  It is remove from the
+   * document upon completion of the upload transaction.
+   *
+   * @private
+   * @param {string} optional qualified path of iframe resource for SSL in IE.
+   * @return void
+   */
+       createFrame:function(secureUri){
+
+               // IE does not allow the setting of id and name attributes as DOM
+               // properties.  A different iframe creation pattern is required for IE.
+               if(window.ActiveXObject){
+                       var io = document.createElement('<IFRAME name="ioFrame" id="ioFrame">');
+                       if(secureUri){
+                               // IE will throw a security exception in an SSL environment if the
+                               // iframe source isn't set to a valid resource.
+                               io.src = secureUri;
+                       }
+               }
+               else{
+                       var io = document.createElement('IFRAME');
+                       io.id = 'ioFrame';
+                       io.name = 'ioFrame';
+               }
+
+               io.style.position = 'absolute';
+               io.style.top = '-1000px';
+               io.style.left = '-1000px';
+
+               document.body.appendChild(io);
+       },
+
+  /**
+   * Uploads HTML form, including files/attachments,  targeting the
+   * iframe created in createFrame.
+   *
+   * @private
+   * @param {int} id The transaction id.
+   * @param {object} callback - User-defined callback object.
+   * @param {string} uri Fully qualified path of resource.
+   * @return void
+   */
+       uploadFile:function(id, callback, uri){
+               // Initialize the HTML form properties in case they are
+               // not defined in the HTML form.
+               this._formNode.action = uri;
+               this._formNode.enctype = 'multipart/form-data';
+               this._formNode.method = 'POST';
+               this._formNode.target = 'ioFrame';
+               this._formNode.submit();
+
+               // Reset form status properties.
+               this._formNode = null;
+               this._isFileUpload = false;
+               this._isFormSubmit = false;
+
+               // Create the upload callback handler that fires when the iframe
+               // receives the load event.  Subsequently, the event handler is detached
+               // and the iframe removed from the document.
+
+               var uploadCallback = function()
+               {
+                       var oResponse =
+                       {
+                               tId: id,
+                               responseText: document.getElementById("ioFrame").contentWindow.document.body.innerHTML,
+                               argument: callback.argument
+                       }
+
+                       if(callback.upload && !callback.scope){
+                               callback.upload(oResponse);
+                       }
+                       else{
+                               callback.upload.apply(callback.scope, [oResponse]);
+                       }
+
+                       YAHOO.util.Event.removeListener("ioFrame", "load", uploadCallback);
+                       window.ioFrame.location.replace('#');
+                       setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100);
+               };
+
+               // Bind the onload handler to the iframe to detect the file upload response.
+               YAHOO.util.Event.addListener("ioFrame", "load", uploadCallback);
+       },
+
+  /**
+   * Public method to terminate a transaction, if it has not reached readyState 4.
+   * @public
+   * @param {object} o The connection object returned by asyncRequest.
+   * @param {object} callback  User-defined callback object.
+   * @param {string} isTimeout boolean to indicate if abort was a timeout.
+   * @return void
+   */
+       abort:function(o, callback, isTimeout)
+       {
+               if(this.isCallInProgress(o)){
+                       window.clearInterval(this._poll[o.tId]);
+                       this._poll.splice(o.tId);
+                       if(isTimeout){
+                               this._timeOut.splice(o.tId);
+                       }
+                       o.conn.abort();
+                       this.handleTransactionResponse(o, callback, true);
+
+                       return true;
+               }
+               else{
+                       return false;
+               }
+       },
+
+  /**
+   * Public method to check if the transaction is still being processed.
+   * @public
+   * @param {object} o The connection object returned by asyncRequest
+   * @return boolean
+   */
+       isCallInProgress:function(o)
+       {
+               // if the XHR object assigned to the transaction has not been dereferenced,
+               // then check its readyState status.  Otherwise, return false.
+               if(o.conn){
+                       return o.conn.readyState != 4 && o.conn.readyState != 0;
+               }
+               else{
+                       //The XHR object has been destroyed.
+                       return false;
+               }
+       },
+
+  /**
+   * Dereference the XHR instance and the connection object after the transaction is completed.
+   * @private
+   * @param {object} o The connection object
+   * @return void
+   */
+       releaseObject:function(o)
+       {
+               //dereference the XHR instance.
+               o.conn = null;
+               //dereference the connection object.
+               o = null;
+       }
+};
diff --git a/lib/yui/container/README b/lib/yui/container/README
new file mode 100755 (executable)
index 0000000..59e45cb
--- /dev/null
@@ -0,0 +1,30 @@
+Container Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+       - toString function added to all classes for easy logging\r
+       - YAHOO.extend is now being used for inheritance on all container classes\r
+       - Module: monitorresize feature now works on all browsers\r
+       - Module: Fixed bug with image root and isSecure\r
+       - Overlay: Fixed bugs related to IFRAME shim positioning\r
+       - Overlay: center() now works in quirks mode\r
+       - Overlay: Overlay now has a custom destroy() method that also removes the IFRAME shim\r
+       - OverlayManager: Fixed bug in the prototype that was preventing multiple Managers on one page\r
+       - OverlayManager: focusEvent now fires at all appropriate times\r
+       - Tooltip: context can now be specified as an array, so Tooltips can be reused across multiple context elements\r
+       - Tooltip: preventoverlap now functions properly for large context elements (i.e, images)\r
+       - Tooltip: fixed bugs regarding setTimeout\r
+       - Tooltip: added mousemove event to allow for more accurate Tooltip positioning\r
+       - Panel: added dragEvent for monitoring all event handlers for drag and drop\r
+       - Panel: modality mask is now resized on scroll\r
+       - Panel: KeyListeners are now properly destroyed when the Panel is destroyed\r
+       - Panel: Header is now sized properly in quirks mode\r
+       - Dialog: Blinking cursor issue is fixed for Firefox\r
+       - Dialog: callback object for Connection is now public (this.callback)\r
+       - Dialog: onsuccess/onfailure properties removed (as a result of the public callback object)\r
+       - Dialog: Dialog is now invisible by default\r
+       - Dialog: Buttons are now properly cleaned up on destroy\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Initial release\r
diff --git a/lib/yui/container/assets/alrt16_1.gif b/lib/yui/container/assets/alrt16_1.gif
new file mode 100755 (executable)
index 0000000..443d39b
Binary files /dev/null and b/lib/yui/container/assets/alrt16_1.gif differ
diff --git a/lib/yui/container/assets/blck16_1.gif b/lib/yui/container/assets/blck16_1.gif
new file mode 100755 (executable)
index 0000000..5668961
Binary files /dev/null and b/lib/yui/container/assets/blck16_1.gif differ
diff --git a/lib/yui/container/assets/close12_1.gif b/lib/yui/container/assets/close12_1.gif
new file mode 100755 (executable)
index 0000000..e2f67d7
Binary files /dev/null and b/lib/yui/container/assets/close12_1.gif differ
diff --git a/lib/yui/container/assets/container.css b/lib/yui/container/assets/container.css
new file mode 100755 (executable)
index 0000000..9580fc8
--- /dev/null
@@ -0,0 +1,210 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+.overlay {\r
+       position:absolute;\r
+       display:block;\r
+}\r
+\r
+.tt {\r
+       visibility:hidden;\r
+       position:absolute;\r
+       color:#333;\r
+       background-color:#FDFFB4;\r
+       font-family:arial,helvetica,verdana,sans-serif;\r
+       padding:2px;\r
+       border:1px solid #FCC90D;\r
+       font:100% sans-serif;\r
+       width:auto;\r
+}\r
+\r
+* html body.masked select {\r
+       visibility:hidden;\r
+}\r
+\r
+* html div.panel-container select {\r
+       visibility:inherit;\r
+}\r
+\r
+* html div.drag select {\r
+       visibility:hidden;\r
+}\r
+\r
+* html div.hide-select select {\r
+       visibility:hidden;\r
+}\r
+\r
+.mask {\r
+    z-index:0;   \r
+    display:none;\r
+    position:absolute;\r
+    top:0;\r
+    left:0;\r
+    -moz-opacity: 0.5;\r
+    opacity:.50;\r
+    filter: alpha(opacity=50);\r
+    background-color:#CCC;\r
+}\r
+\r
+.hide-scrollbars * {\r
+       overflow:hidden;\r
+}\r
+\r
+.hide-scrollbars textarea, .hide-scrollbars select {\r
+       overflow:hidden;\r
+       display:none;\r
+}\r
+\r
+.show-scrollbars textarea, .show-scrollbars select {\r
+       overflow:visible;\r
+}\r
+\r
+.panel-container {\r
+       position:absolute;\r
+       background-color:transparent;\r
+       z-index:6;\r
+       visibility:hidden;\r
+       overflow:visible;\r
+       width:auto;\r
+}\r
+\r
+.panel-container.matte {\r
+       padding:3px;\r
+       background-color:#FFF;\r
+}\r
+\r
+.panel-container.matte .underlay {\r
+       display:none;\r
+}\r
+\r
+.panel-container.shadow {\r
+       padding:0px;\r
+       background-color:transparent;\r
+}\r
+\r
+.panel-container.shadow .underlay {\r
+       visibility:inherit;\r
+       position:absolute;\r
+       background-color:#CCC;\r
+       top:3px;left:3px;\r
+       z-index:0;\r
+       width:100%;\r
+       height:100%;\r
+    -moz-opacity: 0.7;\r
+    opacity:.70;\r
+    filter:alpha(opacity=70);\r
+}\r
+\r
+.panel {\r
+       visibility:hidden;\r
+       border-collapse:separate;\r
+       position:relative;\r
+       left:0px;top:0px;\r
+       font:1em Arial;\r
+       background-color:#FFF;\r
+       border:1px solid #000;\r
+       z-index:1;\r
+       overflow:auto;\r
+}\r
+\r
+.panel .hd {\r
+       background-color:#3d77cb;\r
+       color:#FFF;\r
+       font-size:100%;\r
+       line-height:100%;\r
+       border:1px solid #FFF;\r
+       border-bottom:1px solid #000;\r
+       font-weight:bold;\r
+       overflow:hidden;\r
+       padding:4px;\r
+}\r
+\r
+.panel .bd {\r
+       overflow:hidden;\r
+       padding:4px;\r
+}\r
+\r
+.panel .bd p {\r
+       margin:0 0 1em;\r
+}\r
+\r
+.panel .close {\r
+       position:absolute;\r
+       top:5px;\r
+       right:4px;\r
+       z-index:6;\r
+       height:12px;\r
+       width:12px;\r
+       margin:0px;\r
+       padding:0px;\r
+       background-repeat:no-repeat;\r
+       cursor:pointer;\r
+       visibility:inherit;\r
+}\r
+\r
+.panel .close.nonsecure {\r
+       background-image:url(http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);\r
+}\r
+\r
+.panel .close.secure {\r
+       background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);\r
+}\r
+\r
+.panel .ft {\r
+       padding:4px;\r
+       overflow:hidden;\r
+}\r
+\r
+.simple-dialog .bd .icon {\r
+       background-repeat:no-repeat;\r
+       width:16px;\r
+       height:16px;\r
+       margin-right:10px;\r
+       float:left;\r
+}\r
+\r
+.dialog .ft, .simple-dialog .ft {\r
+       padding-bottom:5px;\r
+       padding-right:5px;\r
+       text-align:right;\r
+}\r
+\r
+.dialog form, .simple-dialog form {\r
+       margin:0;\r
+}\r
+\r
+.button-group button {\r
+       font:100 76% verdana;\r
+       text-decoration:none;\r
+       background-color: #E4E4E4;\r
+       color: #333;\r
+       cursor: hand;\r
+       vertical-align: middle;\r
+       border: 2px solid #797979;\r
+       border-top-color:#FFF;\r
+       border-left-color:#FFF;\r
+       margin:2px;\r
+       padding:2px;\r
+}\r
+\r
+.button-group button.default {\r
+       font-weight:bold;\r
+}\r
+\r
+.button-group button:hover, .button-group button.hover { \r
+       border:2px solid #90A029;\r
+       background-color:#EBF09E;\r
+       border-top-color:#FFF;\r
+       border-left-color:#FFF;\r
+}\r
+\r
+.button-group button:active { \r
+       border:2px solid #E4E4E4;\r
+       background-color:#BBB;\r
+       border-top-color:#333;\r
+       border-left-color:#333;\r
+}\r
diff --git a/lib/yui/container/assets/hlp16_1.gif b/lib/yui/container/assets/hlp16_1.gif
new file mode 100755 (executable)
index 0000000..4645c8f
Binary files /dev/null and b/lib/yui/container/assets/hlp16_1.gif differ
diff --git a/lib/yui/container/assets/info16_1.gif b/lib/yui/container/assets/info16_1.gif
new file mode 100755 (executable)
index 0000000..22f697a
Binary files /dev/null and b/lib/yui/container/assets/info16_1.gif differ
diff --git a/lib/yui/container/assets/tip16_1.gif b/lib/yui/container/assets/tip16_1.gif
new file mode 100755 (executable)
index 0000000..8f0be2b
Binary files /dev/null and b/lib/yui/container/assets/tip16_1.gif differ
diff --git a/lib/yui/container/assets/warn16_1.gif b/lib/yui/container/assets/warn16_1.gif
new file mode 100755 (executable)
index 0000000..d679df5
Binary files /dev/null and b/lib/yui/container/assets/warn16_1.gif differ
diff --git a/lib/yui/container/container-debug.js b/lib/yui/container/container-debug.js
new file mode 100755 (executable)
index 0000000..7bb86ad
--- /dev/null
@@ -0,0 +1,3974 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+/**\r
+* @class \r
+* Config is a utility used within an object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+* @constructor\r
+*/\r
+YAHOO.util.Config = function(owner) {\r
+       if (owner) {\r
+               this.init(owner);\r
+       } else {\r
+               YAHOO.log("No owner specified for Config object", "error");\r
+       }\r
+}\r
+\r
+YAHOO.util.Config.prototype = {\r
+       \r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * @type object\r
+       */\r
+       owner : null,\r
+\r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * args: key, value\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       configChangedEvent : null,\r
+\r
+       /**\r
+       * Boolean flag that specifies whether a queue is currently being executed\r
+       * @type boolean\r
+       */\r
+       queueInProgress : false,\r
+\r
+       /**\r
+       * Adds a property to the Config object's private config hash. \r
+       * @param {string}       key     The configuration property's name\r
+       * @param {object}       propertyObject  The object containing all of this property's arguments\r
+       */\r
+       addProperty : function(key, propertyObject){},\r
+\r
+       /**\r
+       * Returns a key-value configuration map of the values currently set in the Config object.\r
+       * @return {object} The current config, represented in a key-value map\r
+       */\r
+       getConfig : function(){},\r
+\r
+       /**\r
+       * Returns the value of specified property.\r
+       * @param {key}          The name of the property\r
+       * @return {object}      The value of the specified property\r
+       */\r
+       getProperty : function(key){},\r
+\r
+       /**\r
+       * Resets the specified property's value to its initial value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       resetProperty : function(key){},\r
+\r
+       /**\r
+       * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @param {boolean}      Whether the value should be set silently, without firing the property event.\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */\r
+       setProperty : function(key,value,silent){},\r
+\r
+       /**\r
+       * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is\r
+       * moved from its current position to the end of the queue.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */      \r
+       queueProperty : function(key,value){},\r
+\r
+       /**\r
+       * Fires the event for a property using the property's current value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       refireEvent : function(key){},\r
+\r
+       /**\r
+       * Applies a key-value object literal to the configuration, replacing any existing values, and queueing the property events.\r
+       * Although the values will be set, fireQueue() must be called for their associated events to execute.\r
+       * @param {object}       userConfig      The configuration object literal\r
+       * @param {boolean}      init            When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.\r
+       */\r
+       applyConfig : function(userConfig,init){},\r
+\r
+       /**\r
+       * Refires the events for all configuration properties using their current values.\r
+       */\r
+       refresh : function(){},\r
+\r
+       /**\r
+       * Fires the normalized list of queued property change events\r
+       */\r
+       fireQueue : function(){},\r
+\r
+       /**\r
+       * Subscribes an external handler to the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       * @param {boolean}      override        Optional. If true, will override "this" within the handler to map to the scope object passed into the method.\r
+       */      \r
+       subscribeToConfigEvent : function(key,handler,obj,override){},\r
+\r
+       /**\r
+       * Unsubscribes an external handler from the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       */\r
+       unsubscribeFromConfigEvent: function(key,handler,obj){},\r
+\r
+       /**\r
+       * Validates that the value passed in is a boolean.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */      \r
+       checkBoolean: function(val) {\r
+               if (typeof val == 'boolean') {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Validates that the value passed in is a number.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */\r
+       checkNumber: function(val) {\r
+               if (isNaN(val)) {\r
+                       return false;\r
+               } else {\r
+                       return true;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* Initializes the configuration object and all of its local members.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+*/\r
+YAHOO.util.Config.prototype.init = function(owner) {\r
+\r
+       this.owner = owner;\r
+       this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");\r
+       this.queueInProgress = false;\r
+\r
+       /* Private Members */\r
+\r
+       var config = {};\r
+       var initialConfig = {};\r
+       var eventQueue = [];\r
+\r
+       /**\r
+       * @private\r
+       * Fires a configuration property event using the specified value. \r
+       * @param {string}       key                     The configuration property's name\r
+       * @param {value}        object          The value of the correct type for the property\r
+       */ \r
+       var fireEvent = function( key, value ) {\r
+               YAHOO.log("Firing Config event: " + key + "=" + value, "info");\r
+               \r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       property.event.fire(value);\r
+               }       \r
+       }\r
+       /* End Private Members */\r
+\r
+       this.addProperty = function( key, propertyObject ) {\r
+               key = key.toLowerCase();\r
+               \r
+               YAHOO.log("Added property: " + key, "info");\r
+\r
+               config[key] = propertyObject;\r
+\r
+               propertyObject.event = new YAHOO.util.CustomEvent(key);\r
+               propertyObject.key = key;\r
+\r
+               if (propertyObject.handler) {\r
+                       propertyObject.event.subscribe(propertyObject.handler, this.owner, true);\r
+               }\r
+\r
+               this.setProperty(key, propertyObject.value, true);\r
+               \r
+               if (! propertyObject.suppressEvent) {\r
+                       this.queueProperty(key, propertyObject.value);\r
+               }\r
+       }\r
+\r
+       this.getConfig = function() {\r
+               var cfg = {};\r
+                       \r
+               for (var prop in config) {\r
+                       var property = config[prop]\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               cfg[prop] = property.value;\r
+                       }\r
+               }\r
+               \r
+               return cfg;\r
+       }\r
+\r
+       this.getProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.value;\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.resetProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       this.setProperty(key, initialConfig[key].value);\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.setProperty = function(key, value, silent) {\r
+               key = key.toLowerCase();\r
+               \r
+               YAHOO.log("setProperty: " + key + "=" + value, "info");\r
+\r
+               if (this.queueInProgress && ! silent) {\r
+                       this.queueProperty(key,value); // Currently running through a queue... \r
+                       return true;\r
+               } else {\r
+                       var property = config[key];\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               if (property.validator && ! property.validator(value)) { // validator\r
+                                       return false;\r
+                               } else {\r
+                                       property.value = value;\r
+                                       if (! silent) {\r
+                                               fireEvent(key, value);\r
+                                               this.configChangedEvent.fire([key, value]);\r
+                                       }\r
+                                       return true;\r
+                               }\r
+                       } else {\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.queueProperty = function(key, value) {\r
+               key = key.toLowerCase();\r
+\r
+               YAHOO.log("queueProperty: " + key + "=" + value, "info");\r
+\r
+               var property = config[key];\r
+                                                       \r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator\r
+                               return false;\r
+                       } else {\r
+\r
+                               if (typeof value != 'undefined') {\r
+                                       property.value = value;\r
+                               } else {\r
+                                       value = property.value;\r
+                               }\r
+\r
+                               var foundDuplicate = false;\r
+\r
+                               for (var i=0;i<eventQueue.length;i++) {\r
+                                       var queueItem = eventQueue[i];\r
+\r
+                                       if (queueItem) {\r
+                                               var queueItemKey = queueItem[0];\r
+                                               var queueItemValue = queueItem[1];\r
+                                               \r
+                                               if (queueItemKey.toLowerCase() == key) {\r
+                                                       // found a dupe... push to end of queue, null current item, and break\r
+                                                       eventQueue[i] = null;\r
+                                                       eventQueue.push([key, (typeof value != 'undefined' ? value : queueItemValue)]);\r
+                                                       foundDuplicate = true;\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+                               \r
+                               if (! foundDuplicate && typeof value != 'undefined') { // this is a refire, or a new property in the queue\r
+                                       eventQueue.push([key, value]);\r
+                               }\r
+                       }\r
+\r
+                       if (property.supercedes) {\r
+                               for (var s=0;s<property.supercedes.length;s++) {\r
+                                       var supercedesCheck = property.supercedes[s];\r
+\r
+                                       for (var q=0;q<eventQueue.length;q++) {\r
+                                               var queueItemCheck = eventQueue[q];\r
+\r
+                                               if (queueItemCheck) {\r
+                                                       var queueItemCheckKey = queueItemCheck[0];\r
+                                                       var queueItemCheckValue = queueItemCheck[1];\r
+                                                       \r
+                                                       if ( queueItemCheckKey.toLowerCase() == supercedesCheck.toLowerCase() ) {\r
+                                                               eventQueue.push([queueItemCheckKey, queueItemCheckValue]);\r
+                                                               eventQueue[q] = null;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+       \r
+                       YAHOO.log("Config event queue: " + this.outputEventQueue(), "info");\r
+\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.refireEvent = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event && typeof property.value != 'undefined') {\r
+                       if (this.queueInProgress) {\r
+                               this.queueProperty(key);\r
+                       } else {\r
+                               fireEvent(key, property.value);\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.applyConfig = function(userConfig, init) {\r
+               if (init) {\r
+                       initialConfig = userConfig;\r
+               }\r
+               for (var prop in userConfig) {\r
+                       this.queueProperty(prop, userConfig[prop]);\r
+               }\r
+       }\r
+\r
+       this.refresh = function() {\r
+               for (var prop in config) {\r
+                       this.refireEvent(prop);\r
+               }\r
+       }\r
+\r
+       this.fireQueue = function() {\r
+               this.queueInProgress = true;\r
+               for (var i=0;i<eventQueue.length;i++) {\r
+                       var queueItem = eventQueue[i];\r
+                       if (queueItem) {\r
+                               var key = queueItem[0];\r
+                               var value = queueItem[1];\r
+                               \r
+                               var property = config[key];\r
+                               property.value = value;\r
+\r
+                               fireEvent(key,value);\r
+                       }\r
+               }\r
+               \r
+               this.queueInProgress = false;\r
+               eventQueue = new Array();\r
+       }\r
+\r
+       this.subscribeToConfigEvent = function(key, handler, obj, override) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {\r
+                               property.event.subscribe(handler, obj, override);\r
+                       }\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+\r
+       this.unsubscribeFromConfigEvent = function(key, handler, obj) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.event.unsubscribe(handler, obj);\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.toString = function() {\r
+               var output = "Config";\r
+               if (this.owner) {\r
+                       output += " [" + this.owner.toString() + "]";\r
+               }\r
+               return output;\r
+       }\r
+\r
+       this.outputEventQueue = function() {\r
+               var output = "";\r
+               for (var q=0;q<eventQueue.length;q++) {\r
+                       var queueItem = eventQueue[q];\r
+                       if (queueItem) {\r
+                               output += queueItem[0] + "=" + queueItem[1] + ", ";\r
+                       }\r
+               }\r
+               return output;\r
+       }\r
+}\r
+\r
+/**\r
+* Checks to determine if a particular function/object pair are already subscribed to the specified CustomEvent\r
+* @param {YAHOO.util.CustomEvent} evt  The CustomEvent for which to check the subscriptions\r
+* @param {Function}    fn      The function to look for in the subscribers list\r
+* @param {object}      obj     The execution scope object for the subscription\r
+* @return {boolean}    true, if the function/object pair is already subscribed to the CustomEvent passed in\r
+*/\r
+YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {\r
+       for (var e=0;e<evt.subscribers.length;e++) {\r
+               var subsc = evt.subscribers[e];\r
+               if (subsc && subsc.obj == obj && subsc.fn == fn) {\r
+                       return true;\r
+                       break;\r
+               }\r
+       }\r
+       return false;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class \r
+* Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.\r
+* @param {string}      el      The element ID representing the Module <em>OR</em>\r
+* @param {Element}     el      The element representing the Module\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Module = function(el, userConfig) {\r
+       if (el) { \r
+               this.init(el, userConfig); \r
+       } else {\r
+               YAHOO.log("No element or element ID specified for Module instantiation", "error");\r
+       }\r
+}\r
+\r
+/**\r
+* Constant representing the prefix path to use for non-secure images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";\r
+\r
+/**\r
+* Constant representing the prefix path to use for securely served images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";\r
+\r
+/**\r
+* Constant for the default CSS class name that represents a Module\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_MODULE = "module";\r
+\r
+/**\r
+* Constant representing the module header\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_HEADER = "hd";\r
+\r
+/**\r
+* Constant representing the module body\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_BODY = "bd";\r
+\r
+/**\r
+* Constant representing the module footer\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_FOOTER = "ft";\r
+\r
+/**\r
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = null;\r
+\r
+YAHOO.widget.Module.prototype = {\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type function\r
+       */\r
+       constructor : YAHOO.widget.Module,\r
+\r
+       /**\r
+       * The main module element that contains the header, body, and footer\r
+       * @type Element\r
+       */\r
+       element : null, \r
+\r
+       /**\r
+       * The header element, denoted with CSS class "hd"\r
+       * @type Element\r
+       */\r
+       header : null,\r
+\r
+       /**\r
+       * The body element, denoted with CSS class "bd"\r
+       * @type Element\r
+       */\r
+       body : null,\r
+\r
+       /**\r
+       * The footer element, denoted with CSS class "ft"\r
+       * @type Element\r
+       */\r
+       footer : null,\r
+\r
+       /**\r
+       * The id of the element\r
+       * @type string\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * Array of elements\r
+       * @type Element[]\r
+       */\r
+       childNodesInDOM : null,\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot : YAHOO.widget.Module.IMG_ROOT,\r
+\r
+       /**\r
+       * CustomEvent fired prior to class initalization.\r
+       * args: class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeInitEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after class initalization.\r
+       * args: class reference of the initializing class, such as this.initEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       initEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is appended to the DOM\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       appendEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeRenderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       renderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the header content of the Module is modified\r
+       * args: string/element representing the new header content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeHeaderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the body content of the Module is modified\r
+       * args: string/element representing the new body content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeBodyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the footer content of the Module is modified\r
+       * args: string/element representing the new footer content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeFooterEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the content of the Module is modified\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeContentEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is destroyed\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       destroyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeShowEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       showEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeHideEvent : null,\r
+       \r
+       /**\r
+       * CustomEvent fired after the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       hideEvent : null,\r
+               \r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initEvents : function() {\r
+\r
+               this.beforeInitEvent            = new YAHOO.util.CustomEvent("beforeInit");\r
+               this.initEvent                          = new YAHOO.util.CustomEvent("init");\r
+\r
+               this.appendEvent                        = new YAHOO.util.CustomEvent("append");\r
+\r
+               this.beforeRenderEvent          = new YAHOO.util.CustomEvent("beforeRender");\r
+               this.renderEvent                        = new YAHOO.util.CustomEvent("render");\r
+\r
+               this.changeHeaderEvent          = new YAHOO.util.CustomEvent("changeHeader");\r
+               this.changeBodyEvent            = new YAHOO.util.CustomEvent("changeBody");\r
+               this.changeFooterEvent          = new YAHOO.util.CustomEvent("changeFooter");\r
+\r
+               this.changeContentEvent         = new YAHOO.util.CustomEvent("changeContent");\r
+\r
+               this.destroyEvent                       = new YAHOO.util.CustomEvent("destroy");\r
+               this.beforeShowEvent            = new YAHOO.util.CustomEvent("beforeShow");\r
+               this.showEvent                          = new YAHOO.util.CustomEvent("show");\r
+               this.beforeHideEvent            = new YAHOO.util.CustomEvent("beforeHide");\r
+               this.hideEvent                          = new YAHOO.util.CustomEvent("hide");\r
+       }, \r
+\r
+       /**\r
+       * String representing the current user-agent platform\r
+       * @type string\r
+       */\r
+       platform : function() {\r
+                                       var ua = navigator.userAgent.toLowerCase();\r
+                                       if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {\r
+                                               return "windows";\r
+                                       } else if (ua.indexOf("macintosh") != -1) {\r
+                                               return "mac";\r
+                                       } else {\r
+                                               return false;\r
+                                       }\r
+                               }(),\r
+\r
+       /**\r
+       * String representing the current user-agent browser\r
+       * @type string\r
+       */\r
+       browser : function() {\r
+                       var ua = navigator.userAgent.toLowerCase();\r
+                                 if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)\r
+                                        return 'opera';\r
+                                 } else if (ua.indexOf('msie 7')!=-1) { // IE7\r
+                                        return 'ie7';\r
+                                 } else if (ua.indexOf('msie') !=-1) { // IE\r
+                                        return 'ie';\r
+                                 } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")\r
+                                        return 'safari';\r
+                                 } else if (ua.indexOf('gecko') != -1) { // Gecko\r
+                                        return 'gecko';\r
+                                 } else {\r
+                                        return false;\r
+                                 }\r
+                       }(),\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure : function() {\r
+               if (window.location.href.toLowerCase().indexOf("https") == 0) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }(),\r
+\r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initDefaultConfig : function() {\r
+               // Add properties //\r
+\r
+               this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );\r
+               this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );\r
+               this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );\r
+       },\r
+\r
+       /**\r
+       * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+       * @param {string}       el      The element ID representing the Module <em>OR</em>\r
+       * @param {Element}      el      The element representing the Module\r
+       * @param {object}       userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+       */\r
+       init : function(el, userConfig) {\r
+\r
+               this.initEvents();\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Module);\r
+\r
+               this.cfg = new YAHOO.util.Config(this);\r
+               \r
+               if (this.isSecure) {\r
+                       this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;\r
+               }\r
+\r
+               if (typeof el == "string") {\r
+                       var elId = el;\r
+\r
+                       el = document.getElementById(el);\r
+                       if (! el) {\r
+                               el = document.createElement("DIV");\r
+                               el.id = elId;\r
+                       }\r
+               }\r
+\r
+               this.element = el;\r
+               \r
+               if (el.id) {\r
+                       this.id = el.id;\r
+               } \r
+\r
+               var childNodes = this.element.childNodes;\r
+\r
+               if (childNodes) {\r
+                       for (var i=0;i<childNodes.length;i++) {\r
+                               var child = childNodes[i];\r
+                               switch (child.className) {\r
+                                       case YAHOO.widget.Module.CSS_HEADER:\r
+                                               this.header = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_BODY:\r
+                                               this.body = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_FOOTER:\r
+                                               this.footer = child;\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               this.initDefaultConfig();\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+\r
+               // Subscribe to the fireQueue() method of Config so that any queued configuration changes are\r
+               // excecuted upon render of the Module\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {\r
+                       this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);\r
+               }\r
+\r
+               this.initEvent.fire(YAHOO.widget.Module);\r
+       },\r
+\r
+       /**\r
+       * Initialized an empty DOM element that is placed out of the visible area that can be used to detect text resize.\r
+       */\r
+       initResizeMonitor : function() {\r
+\r
+        if(this.browser != "opera") {\r
+\r
+            var resizeMonitor = document.getElementById("_yuiResizeMonitor");\r
+    \r
+            if (! resizeMonitor) {\r
+    \r
+                resizeMonitor = document.createElement("iframe");\r
+    \r
+                var bIE = (this.browser.indexOf("ie") === 0);\r
+    \r
+                if(this.isSecure && this.RESIZE_MONITOR_SECURE_URL && bIE) {\r
+    \r
+                    resizeMonitor.src = this.RESIZE_MONITOR_SECURE_URL;\r
+    \r
+                }\r
+                \r
+                resizeMonitor.id = "_yuiResizeMonitor";\r
+                resizeMonitor.style.visibility = "hidden";\r
+                \r
+                document.body.appendChild(resizeMonitor);\r
+    \r
+                resizeMonitor.style.width = "10em";\r
+                resizeMonitor.style.height = "10em";\r
+                resizeMonitor.style.position = "absolute";\r
+                \r
+                var nLeft = -1 * resizeMonitor.offsetWidth,\r
+                    nTop = -1 * resizeMonitor.offsetHeight;\r
+    \r
+                resizeMonitor.style.top = nTop + "px";\r
+                resizeMonitor.style.left =  nLeft + "px";\r
+                resizeMonitor.style.borderStyle = "none";\r
+                resizeMonitor.style.borderWidth = "0";\r
+                YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0");\r
+                \r
+                resizeMonitor.style.visibility = "visible";\r
+    \r
+                if(!bIE) {\r
+    \r
+                    var doc = resizeMonitor.contentWindow.document;\r
+    \r
+                    doc.open();\r
+                    doc.close();\r
+                \r
+                }\r
+    \r
+            }\r
+    \r
+            if(resizeMonitor && resizeMonitor.contentWindow) {\r
+    \r
+                this.resizeMonitor = resizeMonitor;\r
+    \r
+                YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true);\r
+    \r
+            }\r
+        \r
+        }\r
+\r
+       },\r
+\r
+       /**\r
+       * Event handler fired when the resize monitor element is resized.\r
+       */\r
+       onDomResize : function(e, obj) { \r
+\r
+        var nLeft = -1 * this.resizeMonitor.offsetWidth,\r
+            nTop = -1 * this.resizeMonitor.offsetHeight;\r
+        \r
+        this.resizeMonitor.style.top = nTop + "px";\r
+        this.resizeMonitor.style.left =  nLeft + "px";\r
+       \r
+       },\r
+\r
+       /**\r
+       * Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {string}       headerContent   The HTML used to set the header <em>OR</em>\r
+       * @param {Element}      headerContent   The Element to append to the header\r
+       */      \r
+       setHeader : function(headerContent) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               if (typeof headerContent == "string") {\r
+                       this.header.innerHTML = headerContent;\r
+               } else {\r
+                       this.header.innerHTML = "";\r
+                       this.header.appendChild(headerContent);\r
+               }\r
+\r
+               this.changeHeaderEvent.fire(headerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the header\r
+       */      \r
+       appendToHeader : function(element) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               this.header.appendChild(element);\r
+               this.changeHeaderEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {string}       bodyContent     The HTML used to set the body <em>OR</em>\r
+       * @param {Element}      bodyContent     The Element to append to the body\r
+       */              \r
+       setBody : function(bodyContent) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               if (typeof bodyContent == "string")\r
+               {\r
+                       this.body.innerHTML = bodyContent;\r
+               } else {\r
+                       this.body.innerHTML = "";\r
+                       this.body.appendChild(bodyContent);\r
+               }\r
+\r
+               this.changeBodyEvent.fire(bodyContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the body\r
+       */\r
+       appendToBody : function(element) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               this.body.appendChild(element);\r
+               this.changeBodyEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {string}       footerContent   The HTML used to set the footer <em>OR</em>\r
+       * @param {Element}      footerContent   The Element to append to the footer\r
+       */      \r
+       setFooter : function(footerContent) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               if (typeof footerContent == "string") {\r
+                       this.footer.innerHTML = footerContent;\r
+               } else {\r
+                       this.footer.innerHTML = "";\r
+                       this.footer.appendChild(footerContent);\r
+               }\r
+\r
+               this.changeFooterEvent.fire(footerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the footer\r
+       */\r
+       appendToFooter : function(element) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               this.footer.appendChild(element);\r
+               this.changeFooterEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+       * @param {string}       appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+       * @param {Element}      appendToNode    The element to which the Module should be appended to prior to rendering        \r
+       * @param {Element}      moduleElement   OPTIONAL. The element that represents the actual Standard Module container. \r
+       * @return {boolean} Success or failure of the render\r
+       */\r
+       render : function(appendToNode, moduleElement) {\r
+               this.beforeRenderEvent.fire();\r
+\r
+               if (! moduleElement) {\r
+                       moduleElement = this.element;\r
+               }\r
+\r
+               var me = this;\r
+               var appendTo = function(element) {\r
+                       if (typeof element == "string") {\r
+                               element = document.getElementById(element);\r
+                       }\r
+                       \r
+                       if (element) {\r
+                               element.appendChild(me.element);\r
+                               me.appendEvent.fire();\r
+                       }\r
+               }\r
+\r
+               if (appendToNode) {\r
+                       appendTo(appendToNode);\r
+               } else { // No node was passed in. If the element is not pre-marked up, this fails\r
+                       if (! YAHOO.util.Dom.inDocument(this.element)) {\r
+                               YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               // Need to get everything into the DOM if it isn't already\r
+               \r
+               if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {\r
+                       // There is a header, but it's not in the DOM yet... need to add it\r
+                       var firstChild = moduleElement.firstChild;\r
+                       if (firstChild) { // Insert before first child if exists\r
+                               moduleElement.insertBefore(this.header, firstChild);\r
+                       } else { // Append to empty body because there are no children\r
+                               moduleElement.appendChild(this.header);\r
+                       }\r
+               }\r
+\r
+               if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {\r
+                       // There is a body, but it's not in the DOM yet... need to add it\r
+                       if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM\r
+                               moduleElement.insertBefore(this.body, this.footer);\r
+                       } else { // Append to element because there is no footer\r
+                               moduleElement.appendChild(this.body);\r
+                       }\r
+               }\r
+\r
+               if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {\r
+                       // There is a footer, but it's not in the DOM yet... need to add it\r
+                       moduleElement.appendChild(this.footer);\r
+               }\r
+\r
+               this.renderEvent.fire();\r
+               return true;\r
+       },\r
+\r
+       /**\r
+       * Removes the Module element from the DOM and sets all child elements to null.\r
+       */\r
+       destroy : function() {\r
+               if (this.element) {\r
+                       var parent = this.element.parentNode;\r
+               }\r
+               if (parent) {\r
+                       parent.removeChild(this.element);\r
+               }\r
+\r
+               this.element = null;\r
+               this.header = null;\r
+               this.body = null;\r
+               this.footer = null;\r
+\r
+               this.destroyEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.\r
+       */\r
+       show : function() {\r
+               this.cfg.setProperty("visible", true);\r
+       },\r
+\r
+       /**\r
+       * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.\r
+       */\r
+       hide : function() {\r
+               this.cfg.setProperty("visible", false);\r
+       },\r
+\r
+       // BUILT-IN EVENT HANDLERS FOR MODULE //\r
+\r
+       /**\r
+       * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".\r
+       * This method is responsible for firing showEvent and hideEvent.\r
+       */\r
+       configVisible : function(type, args, obj) {\r
+               var visible = args[0];\r
+               if (visible) {\r
+                       this.beforeShowEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "block");\r
+                       this.showEvent.fire();\r
+               } else {\r
+                       this.beforeHideEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "none");\r
+                       this.hideEvent.fire();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Default event handler for the "monitorresize" configuration property\r
+       */\r
+       configMonitorResize : function(type, args, obj) {\r
+               var monitor = args[0];\r
+               if (monitor) {\r
+                       this.initResizeMonitor();\r
+               } else {\r
+                       YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);\r
+                       this.resizeMonitor = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Module.prototype.toString = function() {\r
+       return "Module " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Overlay = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);\r
+\r
+/**\r
+* The URL of the blank image that will be placed in the iframe\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.IFRAME_SRC = "promo/m/irs/blank.gif";\r
+\r
+/**\r
+* Constant representing the top left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_LEFT = "tl";\r
+\r
+/**\r
+* Constant representing the top right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";\r
+\r
+/**\r
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";\r
+\r
+/**\r
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";\r
+\r
+/**\r
+* Constant representing the default CSS class used for an Overlay\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";\r
+\r
+/**\r
+* CustomEvent fired before the Overlay is moved.\r
+* args: x,y that the Overlay will be moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.beforeMoveEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the Overlay is moved.\r
+* args: x,y that the Overlay was moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Overlay);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       if (this.platform == "mac" && this.browser == "gecko") {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {\r
+                       this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {\r
+                       this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);\r
+               }\r
+       }\r
+\r
+       this.initEvent.fire(YAHOO.widget.Overlay);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.\r
+*/\r
+YAHOO.widget.Overlay.prototype.initEvents = function() {\r
+       YAHOO.widget.Overlay.superclass.initEvents.call(this);\r
+\r
+       this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);\r
+       this.moveEvent = new YAHOO.util.CustomEvent("move", this);\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add overlay config properties //\r
+       this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );\r
+\r
+       this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );\r
+\r
+       this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );\r
+       this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );\r
+}\r
+\r
+/**\r
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);\r
+* @param {int} x       The Overlay's new x position\r
+* @param {int} y       The Overlay's new y position\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {\r
+       this.cfg.setProperty("xy",[x,y]);\r
+}\r
+\r
+/**\r
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");\r
+}\r
+\r
+/**\r
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "show-scrollbars");\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {\r
+       var visible = args[0];\r
+       var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");\r
+\r
+       var effect = this.cfg.getProperty("effect");\r
+\r
+       var effectInstances = new Array();\r
+       if (effect) {\r
+               if (effect instanceof Array) {\r
+                       for (var i=0;i<effect.length;i++) {\r
+                               var eff = effect[i];\r
+                               effectInstances[effectInstances.length] = eff.effect(this, eff.duration);\r
+                       }\r
+               } else {\r
+                       effectInstances[effectInstances.length] = effect.effect(this, effect.duration);\r
+               }\r
+       }\r
+\r
+       var isMacGecko = (this.platform == "mac" && this.browser == "gecko");\r
+\r
+       if (visible) { // Show\r
+               if (isMacGecko) {\r
+                       this.showMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate in\r
+                       if (visible) { // Animate in if not showing\r
+                               if (currentVis != "visible") {\r
+                                       this.beforeShowEvent.fire();\r
+                                       for (var i=0;i<effectInstances.length;i++) {\r
+                                               var e = effectInstances[i];\r
+                                               if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)) {\r
+                                                       e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true); // Delegate showEvent until end of animateInComplete\r
+                                               }\r
+                                               e.animateIn();\r
+                                       }\r
+                               }\r
+                       }\r
+               } else { // Show\r
+                       if (currentVis != "visible") {\r
+                               this.beforeShowEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "visible");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.showEvent.fire();\r
+                       }\r
+               }\r
+\r
+       } else { // Hide\r
+               if (isMacGecko) {\r
+                       this.hideMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate out if showing\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               for (var i=0;i<effectInstances.length;i++) {\r
+                                       var e = effectInstances[i];\r
+                                       if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)) {                            \r
+                                               e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true); // Delegate hideEvent until end of animateOutComplete\r
+                                       }\r
+                                       e.animateOut();\r
+                               }\r
+                       }\r
+               } else { // Simple hide\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.hideEvent.fire();\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+/**\r
+* Center event handler used for centering on scroll/resize, but only if the Overlay is visible\r
+*/\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function() {\r
+       if (this.cfg.getProperty("visible")) {\r
+               this.center();\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "fixedcenter" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configFixedCenter = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       if (val) {\r
+               this.center();\r
+                       \r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) {\r
+                       this.beforeShowEvent.subscribe(this.center, this, true);\r
+               }\r
+               \r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);\r
+               }\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe( this.doCenterOnDOMEvent, this, true);\r
+               }\r
+       } else {\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "zIndex" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {\r
+       var zIndex = args[0];\r
+\r
+       var el = this.element;\r
+\r
+       if (! zIndex) {\r
+               zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");\r
+               if (! zIndex || isNaN(zIndex)) {\r
+                       zIndex = 0;\r
+               }\r
+       }\r
+\r
+       if (this.iframe) {\r
+               if (zIndex <= 0) {\r
+                       zIndex = 1;\r
+               }\r
+               YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));\r
+       }\r
+\r
+       YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);\r
+       this.cfg.setProperty("zIndex", zIndex, true);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "xy" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {\r
+       var pos = args[0];\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       this.cfg.setProperty("x", x);\r
+       this.cfg.setProperty("y", y);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.log("xy: " + [x,y], "iframe");\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x,y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "x" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {\r
+       var x = args[0];\r
+       var y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setX(this.element, x, true);\r
+       \r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "y" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {\r
+       var x = this.cfg.getProperty("x");\r
+       var y = args[0];\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setY(this.element, y, true);\r
+\r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "iframe" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {\r
+\r
+       var val = args[0];\r
+\r
+       var el = this.element;\r
+       \r
+       var showIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "block";\r
+               }\r
+       }\r
+\r
+       var hideIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+       }\r
+\r
+       if (val) { // IFRAME shim is enabled\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, showIframe, this)) {\r
+                       this.showEvent.subscribe(showIframe, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, hideIframe, this)) {\r
+                       this.hideEvent.subscribe(hideIframe, this, true);\r
+               }\r
+\r
+               var x = this.cfg.getProperty("x");\r
+               var y = this.cfg.getProperty("y");\r
+\r
+               if (! x || ! y) {\r
+                       YAHOO.log("syncPosition needed for iframe", "iframe");\r
+                       this.syncPosition();\r
+                       x = this.cfg.getProperty("x");\r
+                       y = this.cfg.getProperty("y");\r
+               }\r
+\r
+               YAHOO.log("iframe positioning to: " + [x,y], "iframe");\r
+\r
+               if (! isNaN(x) && ! isNaN(y)) {\r
+                       if (! this.iframe) {\r
+                               this.iframe = document.createElement("iframe");\r
+                               if (this.isSecure) {\r
+                                       this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC;\r
+                               }\r
+                               \r
+                               var parent = el.parentNode;\r
+                               if (parent) {\r
+                                       parent.appendChild(this.iframe);\r
+                               } else {\r
+                                       document.body.appendChild(this.iframe);\r
+                               }\r
+\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "border", "none");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");\r
+                               if (this.cfg.getProperty("visible")) {\r
+                                       showIframe.call(this);\r
+                               } else {\r
+                                       hideIframe.call(this);\r
+                               }\r
+                       }\r
+                       \r
+                       var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "block";\r
+                       }\r
+\r
+                       YAHOO.util.Dom.setXY(this.iframe, [x,y]);\r
+\r
+                       var width = el.clientWidth;\r
+                       var height = el.clientHeight;\r
+\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "none";\r
+                       }\r
+               }\r
+       } else {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+               this.showEvent.unsubscribe(showIframe, this);\r
+               this.hideEvent.unsubscribe(hideIframe, this);\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* The default event handler fired when the "constraintoviewport" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {\r
+                       this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);\r
+               }\r
+       } else {\r
+               this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {\r
+       var contextArgs = args[0];\r
+\r
+       if (contextArgs) {\r
+               var contextEl = contextArgs[0];\r
+               var elementMagnetCorner = contextArgs[1];\r
+               var contextMagnetCorner = contextArgs[2];\r
+\r
+               if (contextEl) {\r
+                       if (typeof contextEl == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);\r
+                       }\r
+                       \r
+                       if (elementMagnetCorner && contextMagnetCorner) {\r
+                               this.align(elementMagnetCorner, contextMagnetCorner);\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.\r
+* @param {string} elementAlign         The string representing the corner of the Overlay that should be aligned to the context element\r
+* @param {string} contextAlign         The corner of the context element that the elementAlign corner should stick to.\r
+*/\r
+YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {\r
+       var contextArgs = this.cfg.getProperty("context");\r
+       if (contextArgs) {\r
+               var context = contextArgs[0];\r
+               \r
+               var element = this.element;\r
+               var me = this;\r
+\r
+               if (! elementAlign) {\r
+                       elementAlign = contextArgs[1];\r
+               }\r
+\r
+               if (! contextAlign) {\r
+                       contextAlign = contextArgs[2];\r
+               }\r
+\r
+               if (element && context) {\r
+                       var elementRegion = YAHOO.util.Dom.getRegion(element);\r
+                       var contextRegion = YAHOO.util.Dom.getRegion(context);\r
+\r
+                       var doAlign = function(v,h) {\r
+                               switch (elementAlign) {\r
+                                       case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                               me.moveTo(h,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                               me.moveTo(h,v-element.offsetHeight);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v-element.offsetHeight);\r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       switch (contextAlign) {\r
+                               case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                       doAlign(contextRegion.top, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                       doAlign(contextRegion.top, contextRegion.right);\r
+                                       break;          \r
+                               case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.right);\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.\r
+*/\r
+YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {\r
+       var pos = args[0];\r
+\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       var width = parseInt(this.cfg.getProperty("width"));\r
+\r
+       if (isNaN(width)) {\r
+               width = 0;\r
+       }\r
+\r
+       var offsetHeight = this.element.offsetHeight;\r
+       var offsetWidth = (width>0?width:this.element.offsetWidth); //this.element.offsetWidth;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+       var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+       var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+       var topConstraint = scrollY + 10;\r
+       var leftConstraint = scrollX + 10;\r
+       var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+       var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+       \r
+       if (x < leftConstraint) {\r
+               x = leftConstraint;\r
+       } else if (x > rightConstraint) {\r
+               x = rightConstraint;\r
+       }\r
+\r
+       if (y < topConstraint) {\r
+               y = topConstraint;\r
+       } else if (y > bottomConstraint) {\r
+               y = bottomConstraint;\r
+       }\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+       this.cfg.setProperty("xy", [x,y], true);\r
+}\r
+\r
+/**\r
+* Centers the container in the viewport.\r
+*/\r
+YAHOO.widget.Overlay.prototype.center = function() {\r
+       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getClientWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getClientHeight();\r
+\r
+       var elementWidth = this.element.offsetWidth;\r
+       var elementHeight = this.element.offsetHeight;\r
+\r
+       var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;\r
+       var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;\r
+       \r
+       this.element.style.left = parseInt(x) + "px";\r
+       this.element.style.top = parseInt(y) + "px";\r
+       this.syncPosition();\r
+\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.\r
+*/\r
+YAHOO.widget.Overlay.prototype.syncPosition = function() {\r
+       var pos = YAHOO.util.Dom.getXY(this.element);\r
+       this.cfg.setProperty("x", pos[0], true);\r
+       this.cfg.setProperty("y", pos[1], true);\r
+       this.cfg.setProperty("xy", pos, true);\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {\r
+       YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Removes the Overlay element from the DOM and sets all child elements to null.\r
+*/\r
+YAHOO.widget.Overlay.prototype.destroy = function() {\r
+       if (this.iframe) {\r
+               this.iframe.parentNode.removeChild(this.iframe);\r
+       }\r
+       \r
+       this.iframe = null;\r
+\r
+       YAHOO.widget.Overlay.superclass.destroy.call(this);  \r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Overlay.prototype.toString = function() {\r
+       return "Overlay " + this.id;\r
+}\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window scroll\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window resize\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window scroll\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowScrollEvent.fire();\r
+}\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window resize\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowResizeEvent.fire();\r
+}\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Overlay._initialized == null;\r
+\r
+if (YAHOO.widget.Overlay._initialized == null) {\r
+       YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);\r
+       YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);\r
+\r
+       YAHOO.widget.Overlay._initialized = true;\r
+}\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* OverlayManager is used for maintaining the focus status of multiple Overlays.\r
+* @param {Array}       overlays        Optional. A collection of Overlays to register with the manager.\r
+* @param {object}      userConfig              The object literal representing the user configuration of the OverlayManager\r
+* @constructor\r
+*/\r
+YAHOO.widget.OverlayManager = function(userConfig) {\r
+       this.init(userConfig);\r
+}\r
+\r
+/**\r
+* The CSS class representing a focused Overlay\r
+* @type string\r
+*/\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";\r
+\r
+YAHOO.widget.OverlayManager.prototype = {\r
+\r
+       constructor : YAHOO.widget.OverlayManager,\r
+\r
+       /**\r
+       * The array of Overlays that are currently registered\r
+       * @type Array\r
+       */\r
+       overlays : null,\r
+\r
+       /**\r
+       * Initializes the default configuration of the OverlayManager\r
+       */      \r
+       initDefaultConfig : function() {\r
+               this.cfg.addProperty("overlays", { suppressEvent:true } );\r
+               this.cfg.addProperty("focusevent", { value:"mousedown" } );\r
+       }, \r
+\r
+       /**\r
+       * Returns the currently focused Overlay\r
+       * @return {Overlay}     The currently focused Overlay\r
+       */\r
+       getActive : function() {},\r
+\r
+       /**\r
+       * Focuses the specified Overlay\r
+       * @param {Overlay}      The Overlay to focus\r
+       * @param {string}       The id of the Overlay to focus\r
+       */\r
+       focus : function(overlay) {},\r
+\r
+       /**\r
+       * Removes the specified Overlay from the manager\r
+       * @param {Overlay}      The Overlay to remove\r
+       * @param {string}       The id of the Overlay to remove\r
+       */\r
+       remove: function(overlay) {},\r
+\r
+       /**\r
+       * Removes focus from all registered Overlays in the manager\r
+       */\r
+       blurAll : function() {},\r
+\r
+       /**\r
+       * Initializes the OverlayManager\r
+       * @param {Array}        overlays        Optional. A collection of Overlays to register with the manager.\r
+       * @param {object}       userConfig              The object literal representing the user configuration of the OverlayManager\r
+       */\r
+       init : function(userConfig) {\r
+               this.cfg = new YAHOO.util.Config(this);\r
+\r
+               this.initDefaultConfig();\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               this.cfg.fireQueue();\r
+\r
+               var activeOverlay = null;\r
+\r
+               this.getActive = function() {\r
+                       return activeOverlay;\r
+               }\r
+\r
+               this.focus = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               this.blurAll();\r
+                               activeOverlay = o;\r
+                               YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");\r
+                               if (! isNaN(topZIndex) && this.overlays[0] != overlay) {\r
+                                       activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex) + 1));\r
+                               }\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                       }\r
+               }\r
+\r
+               this.remove = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");\r
+                               o.cfg.setProperty("zIndex", -1000, true);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               this.overlays = this.overlays.slice(0, this.overlays.length-1);\r
+                               o.cfg.setProperty("zIndex", originalZ, true);\r
+\r
+                               o.cfg.setProperty("manager", null);\r
+                               o.focusEvent = null\r
+                               o.blurEvent = null;\r
+                               o.focus = null;\r
+                               o.blur = null;\r
+                       }\r
+               }\r
+\r
+               this.blurAll = function() {\r
+                       activeOverlay = null;\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               YAHOO.util.Dom.removeClass(this.overlays[o].element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                       }               \r
+               }\r
+\r
+               var overlays = this.cfg.getProperty("overlays");\r
+               \r
+               if (! this.overlays) {\r
+                       this.overlays = new Array();\r
+               }\r
+\r
+               if (overlays) {\r
+                       this.register(overlays);\r
+                       this.overlays.sort(this.compareZIndexDesc);\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.\r
+       * @param {Overlay}      overlay         An Overlay to register with the manager.\r
+       * @param {Overlay[]}    overlay         An array of Overlays to register with the manager.\r
+       * @return       {boolean}       True if any Overlays are registered.\r
+       */\r
+       register : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       overlay.cfg.addProperty("manager", { value:this } );\r
+\r
+                       overlay.focusEvent = new YAHOO.util.CustomEvent("focus");\r
+                       overlay.blurEvent = new YAHOO.util.CustomEvent("blur");\r
+                       \r
+                       var mgr=this;\r
+\r
+                       overlay.focus = function() {\r
+                               mgr.focus(this);\r
+                               this.focusEvent.fire();\r
+                       } \r
+\r
+                       overlay.blur = function() {\r
+                               mgr.blurAll();\r
+                               this.blurEvent.fire();\r
+                       }\r
+\r
+                       var focusOnDomEvent = function(e,obj) {\r
+                               overlay.focus();\r
+                       }\r
+                       \r
+                       var focusevent = this.cfg.getProperty("focusevent");\r
+                       YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);\r
+\r
+                       var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex");\r
+                       if (! isNaN(zIndex)) {\r
+                               overlay.cfg.setProperty("zIndex", parseInt(zIndex));\r
+                       } else {\r
+                               overlay.cfg.setProperty("zIndex", 0);\r
+                       }\r
+                       \r
+                       this.overlays.push(overlay);\r
+                       return true;\r
+               } else if (overlay instanceof Array) {\r
+                       var regcount = 0;\r
+                       for (var i=0;i<overlay.length;i++) {\r
+                               if (this.register(overlay[i])) {\r
+                                       regcount++;\r
+                               }\r
+                       }\r
+                       if (regcount > 0) {\r
+                               return true;\r
+                       }\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Attempts to locate an Overlay by instance or ID.\r
+       * @param {Overlay}      overlay         An Overlay to locate within the manager\r
+       * @param {string}       overlay         An Overlay id to locate within the manager\r
+       * @return       {Overlay}       The requested Overlay, if found, or null if it cannot be located.\r
+       */\r
+       find : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o] == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }\r
+               } else if (typeof overlay == "string") {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o].id == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }                       \r
+               }\r
+               return null;\r
+       },\r
+\r
+       /**\r
+       * Used for sorting the manager's Overlays by z-index.\r
+       * @private\r
+       */\r
+       compareZIndexDesc : function(o1, o2) {\r
+               var zIndex1 = o1.cfg.getProperty("zIndex");\r
+               var zIndex2 = o2.cfg.getProperty("zIndex");\r
+\r
+               if (zIndex1 > zIndex2) {\r
+                       return -1;\r
+               } else if (zIndex1 < zIndex2) {\r
+                       return 1;\r
+               } else {\r
+                       return 0;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Shows all Overlays in the manager.\r
+       */\r
+       showAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].show();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Hides all Overlays in the manager.\r
+       */\r
+       hideAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].hide();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       toString : function() {\r
+               return "OverlayManager";\r
+       }\r
+\r
+}/**\r
+* Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+* Code licensed under the BSD License:\r
+* http://developer.yahoo.net/yui/license.txt\r
+* KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.\r
+* @param {Element}     attachTo        The element or element ID to which the key event should be attached\r
+* @param {string}      attachTo        The element or element ID to which the key event should be attached\r
+* @param {object}      keyData         The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).\r
+* @param {function}    handler         The CustomEvent handler to fire when the key event is detected\r
+* @param {object}      handler         An object literal representing the handler. \r
+* @param {string}      event           Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.\r
+* @constructor\r
+*/\r
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {\r
+       if (! attachTo) {\r
+               YAHOO.log("No attachTo element specified", "error");\r
+       }\r
+       if (! keyData) {\r
+               YAHOO.log("No keyData specified", "error");\r
+       }\r
+       if (! handler) {\r
+               YAHOO.log("No handler specified", "error");\r
+       }\r
+\r
+       if (! event) {\r
+               event = YAHOO.util.KeyListener.KEYDOWN;\r
+       }\r
+\r
+       var keyEvent = new YAHOO.util.CustomEvent("keyPressed");\r
+       \r
+       this.enabledEvent = new YAHOO.util.CustomEvent("enabled");\r
+       this.disabledEvent = new YAHOO.util.CustomEvent("disabled");\r
+\r
+       if (typeof attachTo == 'string') {\r
+               attachTo = document.getElementById(attachTo);\r
+       }\r
+\r
+       if (typeof handler == 'function') {\r
+               keyEvent.subscribe(handler);\r
+       } else {\r
+               keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);\r
+       }\r
+\r
+       /**\r
+       * Handles the key event when a key is pressed.\r
+       * @private\r
+       */\r
+       function handleKeyPress(e, obj) {\r
+               var keyPressed = e.charCode || e.keyCode;\r
+               \r
+               if (! keyData.shift)    keyData.shift = false;\r
+               if (! keyData.alt)              keyData.alt = false;\r
+               if (! keyData.ctrl)             keyData.ctrl = false;\r
+\r
+               // check held down modifying keys first\r
+               if (e.shiftKey == keyData.shift && \r
+                       e.altKey   == keyData.alt &&\r
+                       e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match\r
+\r
+                       if (keyData.keys instanceof Array) {\r
+                               for (var i=0;i<keyData.keys.length;i++) {\r
+                                       if (keyPressed == keyData.keys[i]) {\r
+                                               keyEvent.fire(keyPressed, e);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               if (keyPressed == keyData.keys) {\r
+                                       keyEvent.fire(keyPressed, e);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.enable = function() {\r
+               if (! this.enabled) {\r
+                       YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);\r
+                       this.enabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = true;\r
+       }\r
+\r
+       this.disable = function() {\r
+               if (this.enabled) {\r
+                       YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);\r
+                       this.disabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = false;\r
+       }\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       this.toString = function() {\r
+               return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + (attachTo.id ? "[" + attachTo.id + "]" : "");\r
+       }\r
+\r
+}\r
+\r
+/**\r
+* Constant representing the DOM "keydown" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYDOWN = "keydown";\r
+\r
+/**\r
+* Constant representing the DOM "keyup" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYUP = "keyup";\r
+\r
+/**\r
+* Boolean indicating the enabled/disabled state of the Tooltip\r
+* @type Booleam\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabled = null;\r
+\r
+/**\r
+* Enables the KeyListener, by dynamically attaching the key event to the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.enable = function() {};\r
+\r
+/**\r
+* Disables the KeyListener, by dynamically removing the key event from the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.disable = function() {};\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is enabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabledEvent = null;\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is disabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.disabledEvent = null;\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Tooltip is an implementation of Overlay that behaves like an OS tooltip, displaying when the user mouses over a particular element, and disappearing on mouse out.\r
+* @param {string}      el      The element ID representing the Tooltip <em>OR</em>\r
+* @param {Element}     el      The element representing the Tooltip\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Tooltip = function(el, userConfig) {\r
+       YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);\r
+\r
+YAHOO.widget.Tooltip.logger = new YAHOO.widget.LogWriter("Tooltip");\r
+\r
+/**\r
+* Constant representing the Tooltip CSS class\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";\r
+\r
+/**\r
+* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.\r
+* @param {string}      el      The element ID representing the Tooltip <em>OR</em>\r
+* @param {Element}     el      The element representing the Tooltip\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {\r
+       this.logger = YAHOO.widget.Tooltip.logger;\r
+\r
+       if (document.readyState && document.readyState != "complete") {\r
+               var deferredInit = function() {\r
+                       this.init(el, userConfig);\r
+               }\r
+               YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);\r
+       } else {\r
+               YAHOO.widget.Tooltip.superclass.init.call(this, el);\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Tooltip);\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               \r
+               this.cfg.queueProperty("visible",false);\r
+               this.cfg.queueProperty("constraintoviewport",true);\r
+\r
+               this.setBody("");\r
+               this.render(this.cfg.getProperty("container"));\r
+\r
+               this.initEvent.fire(YAHOO.widget.Tooltip);\r
+       }\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);\r
+\r
+       this.cfg.addProperty("preventoverlap",          { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );\r
+\r
+       this.cfg.addProperty("showdelay",                       { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );\r
+       this.cfg.addProperty("autodismissdelay",        { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );\r
+       this.cfg.addProperty("hidedelay",                       { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );\r
+\r
+       this.cfg.addProperty("text",                            { handler:this.configText, suppressEvent:true } );\r
+       this.cfg.addProperty("container",                       { value:document.body, handler:this.configContainer } );\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "text" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {\r
+       var text = args[0];\r
+       if (text) {\r
+               this.setBody(text);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "container" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {\r
+       var container = args[0];\r
+       if (typeof container == 'string') {\r
+               this.cfg.setProperty("container", document.getElementById(container), true);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {\r
+       var context = args[0];\r
+       if (context) {\r
+               \r
+               // Normalize parameter into an array\r
+               if (! (context instanceof Array)) {\r
+                       if (typeof context == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(context)], true);\r
+                       } else { // Assuming this is an element\r
+                               this.cfg.setProperty("context", [context], true);\r
+                       }\r
+                       context = this.cfg.getProperty("context");\r
+               }\r
+\r
+\r
+               // Remove any existing mouseover/mouseout listeners\r
+               if (this._context) {\r
+                       for (var c=0;c<this._context.length;++c) {\r
+                               var el = this._context[c];\r
+                               YAHOO.util.Event.removeListener(el, "mouseover", this.onContextMouseOver);\r
+                               YAHOO.util.Event.removeListener(el, "mousemove", this.onContextMouseMove);\r
+                               YAHOO.util.Event.removeListener(el, "mouseout", this.onContextMouseOut);\r
+                       }\r
+               }\r
+\r
+               // Add mouseover/mouseout listeners to context elements\r
+               this._context = context;\r
+               for (var c=0;c<this._context.length;++c) {\r
+                       var el = this._context[c];\r
+                       YAHOO.util.Event.addListener(el, "mouseover", this.onContextMouseOver, this);\r
+                       YAHOO.util.Event.addListener(el, "mousemove", this.onContextMouseMove, this);\r
+                       YAHOO.util.Event.addListener(el, "mouseout", this.onContextMouseOut, this);\r
+               }\r
+       }\r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+// BEGIN BUILT-IN DOM EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the user moves the mouse while over the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseMove = function(e, obj) {\r
+       obj.pageX = YAHOO.util.Event.getPageX(e);\r
+       obj.pageY = YAHOO.util.Event.getPageY(e);\r
+\r
+}\r
+\r
+/**\r
+* The default event handler fired when the user mouses over the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOver = function(e, obj) {\r
+\r
+       if (obj.hideProcId) {\r
+               clearTimeout(obj.hideProcId);\r
+               obj.logger.log("Clearing hide timer: " + obj.hideProcId, "time");\r
+               obj.hideProcId = null;\r
+       }\r
+       \r
+       var context = this;\r
+       YAHOO.util.Event.addListener(context, "mousemove", obj.onContextMouseMove, obj);\r
+\r
+       if (context.title) {\r
+               obj._tempTitle = context.title;\r
+               context.title = "";\r
+       }\r
+\r
+       /**\r
+       * The unique process ID associated with the thread responsible for showing the Tooltip.\r
+       * @type int\r
+       */\r
+       obj.showProcId = obj.doShow(e, context);\r
+       obj.logger.log("Setting show tooltip timeout: " + this.showProcId, "time");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the user mouses out of the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOut = function(e, obj) {\r
+       var el = this;\r
+\r
+       if (obj._tempTitle) {\r
+               el.title = obj._tempTitle;\r
+               obj._tempTitle = null;\r
+       }\r
+       \r
+       if (obj.showProcId) {\r
+               clearTimeout(obj.showProcId);\r
+               obj.logger.log("Clearing show timer: " + obj.showProcId, "time");\r
+               obj.showProcId = null;          \r
+       }\r
+\r
+       if (obj.hideProcId) {\r
+               clearTimeout(obj.hideProcId);\r
+               obj.logger.log("Clearing hide timer: " + obj.hideProcId, "time");\r
+               obj.hideProcId = null;\r
+       }\r
+\r
+\r
+       obj.hideProcId = setTimeout(function() {\r
+                               obj.hide();\r
+                               }, obj.cfg.getProperty("hidedelay"));\r
+}\r
+\r
+// END BUILT-IN DOM EVENT HANDLERS //\r
+\r
+/**\r
+* Processes the showing of the Tooltip by setting the timeout delay and offset of the Tooltip.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @return {int}        The process ID of the timeout function associated with doShow\r
+*/\r
+YAHOO.widget.Tooltip.prototype.doShow = function(e, context) {\r
+       \r
+       var yOffset = 25;\r
+       if (this.browser == "opera" && context.tagName == "A") {\r
+               yOffset += 12;\r
+       }\r
+\r
+       var me = this;\r
+       return setTimeout(\r
+               function() {\r
+                       if (me._tempTitle) {\r
+                               me.setBody(me._tempTitle);\r
+                       } else {\r
+                               me.cfg.refireEvent("text");\r
+                       }\r
+\r
+                       me.logger.log("Show tooltip", "time");\r
+                       me.moveTo(me.pageX, me.pageY + yOffset);\r
+                       if (me.cfg.getProperty("preventoverlap")) {\r
+                               me.preventOverlap(me.pageX, me.pageY);\r
+                       }\r
+                       \r
+                       YAHOO.util.Event.removeListener(context, "mousemove", me.onContextMouseMove);\r
+\r
+                       me.show();\r
+                       me.hideProcId = me.doHide();\r
+                       me.logger.log("Hide tooltip time active: " + me.hideProcId, "time");\r
+               },\r
+       this.cfg.getProperty("showdelay"));\r
+}\r
+\r
+/**\r
+* Sets the timeout for the auto-dismiss delay, which by default is 5 seconds, meaning that a tooltip will automatically dismiss itself after 5 seconds of being displayed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.doHide = function() {\r
+       var me = this;\r
+       me.logger.log("Setting hide tooltip timeout", "time");\r
+       return setTimeout(\r
+               function() {\r
+                       me.logger.log("Hide tooltip", "time");\r
+                       me.hide();\r
+               },\r
+               this.cfg.getProperty("autodismissdelay"));\r
+}\r
+\r
+/**\r
+* Fired when the Tooltip is moved, this event handler is used to prevent the Tooltip from overlapping with its context element.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.preventOverlap = function(pageX, pageY) {\r
+       \r
+       var height = this.element.offsetHeight;\r
+       \r
+       var elementRegion = YAHOO.util.Dom.getRegion(this.element);\r
+\r
+       elementRegion.top -= 5;\r
+       elementRegion.left -= 5;\r
+       elementRegion.right += 5;\r
+       elementRegion.bottom += 5;\r
+\r
+       var mousePoint = new YAHOO.util.Point(pageX, pageY);\r
+       \r
+       this.logger.log("context " + elementRegion, "ttip");\r
+       this.logger.log("mouse " + mousePoint, "ttip");\r
+\r
+       if (elementRegion.contains(mousePoint)) {\r
+               this.logger.log("OVERLAP", "warn");\r
+               this.cfg.setProperty("y", (pageY-height-5))\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Tooltip.prototype.toString = function() {\r
+       return "Tooltip " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Panel is an implementation of Overlay that behaves like an OS window, with a draggable header and an optional close icon at the top right.\r
+* @param {string}      el      The element ID representing the Panel <em>OR</em>\r
+* @param {Element}     el      The element representing the Panel\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Panel = function(el, userConfig) {\r
+       YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Panel\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Panel.CSS_PANEL = "panel";\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Panel's wrapping container\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";\r
+\r
+/**\r
+* CustomEvent fired after the modality mask is shown\r
+* args: none\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Panel.prototype.showMaskEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the modality mask is hidden\r
+* args: none\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Panel.prototype.hideMaskEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Panel.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Panel);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);\r
+\r
+       this.buildWrapper();                    \r
+       \r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               var draggable = this.cfg.getProperty("draggable");\r
+               if (draggable) {\r
+                       if (! this.header) {\r
+                               this.setHeader("&nbsp;");\r
+                       }\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.Panel);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+*/\r
+YAHOO.widget.Panel.prototype.initEvents = function() {\r
+       YAHOO.widget.Panel.superclass.initEvents.call(this);\r
+\r
+       this.showMaskEvent = new YAHOO.util.CustomEvent("showMask");\r
+       this.hideMaskEvent = new YAHOO.util.CustomEvent("hideMask");\r
+\r
+       this.dragEvent = new YAHOO.util.CustomEvent("drag");\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Panel's Config object (cfg).\r
+*/\r
+YAHOO.widget.Panel.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add panel config properties //\r
+\r
+       this.cfg.addProperty("close", { value:true, handler:this.configClose, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+       this.cfg.addProperty("draggable", { value:true, handler:this.configDraggable, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+\r
+       this.cfg.addProperty("underlay", { value:"shadow", handler:this.configUnderlay, supercedes:["visible"] } );\r
+       this.cfg.addProperty("modal",   { value:false, handler:this.configModal, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+\r
+       this.cfg.addProperty("keylisteners", { handler:this.configKeyListeners, suppressEvent:true, supercedes:["visible"] } );\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "close" property is changed. The method controls the appending or hiding of the close icon at the top right of the Panel.\r
+*/\r
+YAHOO.widget.Panel.prototype.configClose = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       var doHide = function(e, obj) {\r
+               obj.hide();\r
+       }\r
+\r
+       if (val) {\r
+               if (! this.close) {\r
+                       this.close = document.createElement("DIV");\r
+                       YAHOO.util.Dom.addClass(this.close, "close");\r
+\r
+                       if (this.isSecure) {\r
+                               YAHOO.util.Dom.addClass(this.close, "secure");\r
+                       } else {\r
+                               YAHOO.util.Dom.addClass(this.close, "nonsecure");\r
+                       }\r
+\r
+                       this.close.innerHTML = "&nbsp;";\r
+                       this.innerElement.appendChild(this.close);\r
+                       YAHOO.util.Event.addListener(this.close, "click", doHide, this);        \r
+               } else {\r
+                       this.close.style.display = "block";\r
+               }\r
+       } else {\r
+               if (this.close) {\r
+                       this.close.style.display = "none";\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "draggable" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configDraggable = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (this.header) {\r
+                       YAHOO.util.Dom.setStyle(this.header,"cursor","move");\r
+                       this.registerDragDrop();\r
+               }\r
+       } else {\r
+               if (this.dd) {\r
+                       this.dd.unreg();\r
+               }\r
+               if (this.header) {\r
+                       YAHOO.util.Dom.setStyle(this.header,"cursor","auto");\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "underlay" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configUnderlay = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       switch (val.toLowerCase()) {\r
+               case "shadow":\r
+                       YAHOO.util.Dom.removeClass(this.element, "matte");\r
+                       YAHOO.util.Dom.addClass(this.element, "shadow");\r
+\r
+                       if (! this.underlay) { // create if not already in DOM\r
+                               this.underlay = document.createElement("DIV");\r
+                               this.underlay.className = "underlay";\r
+                               this.underlay.innerHTML = "&nbsp;";\r
+                               this.element.appendChild(this.underlay);\r
+                       } \r
+\r
+                       this.sizeUnderlay();\r
+                       break;\r
+               case "matte":\r
+                       YAHOO.util.Dom.removeClass(this.element, "shadow");\r
+                       YAHOO.util.Dom.addClass(this.element, "matte");\r
+                       break;\r
+               case "none":\r
+               default:\r
+                       YAHOO.util.Dom.removeClass(this.element, "shadow");\r
+                       YAHOO.util.Dom.removeClass(this.element, "matte");\r
+                       break;\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "modal" property is changed. This handler subscribes or unsubscribes to the show and hide events to handle the display or hide of the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.configModal = function(type, args, obj) {\r
+       var modal = args[0];\r
+\r
+       if (modal) {\r
+               this.buildMask();\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed( this.showEvent, this.showMask, this ) ) {\r
+                       this.showEvent.subscribe(this.showMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( this.hideEvent, this.hideMask, this) ) {\r
+                       this.hideEvent.subscribe(this.hideMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( YAHOO.widget.Overlay.windowResizeEvent, this.sizeMask, this ) ) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( YAHOO.widget.Overlay.windowScrollEvent, this.sizeMask, this ) ) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.sizeMask, this, true);\r
+               }\r
+       } else {\r
+               this.beforeShowEvent.unsubscribe(this.showMask, this);\r
+               this.hideEvent.unsubscribe(this.hideMask, this);\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.sizeMask);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "keylisteners" property is changed. \r
+*/\r
+YAHOO.widget.Panel.prototype.configKeyListeners = function(type, args, obj) {\r
+       var listeners = args[0];\r
+\r
+       if (listeners) {\r
+               if (listeners instanceof Array) {\r
+                       for (var i=0;i<listeners.length;i++) {\r
+                               var listener = listeners[i];\r
+\r
+                               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, listener.enable, listener)) {\r
+                                       this.showEvent.subscribe(listener.enable, listener, true);\r
+                               }\r
+                               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, listener.disable, listener)) {\r
+                                       this.hideEvent.subscribe(listener.disable, listener, true);\r
+                                       this.destroyEvent.subscribe(listener.disable, listener, true);\r
+                               }\r
+                       }\r
+               } else {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, listeners.enable, listeners)) {\r
+                               this.showEvent.subscribe(listeners.enable, listeners, true);\r
+                       }\r
+                       if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, listeners.disable, listeners)) {\r
+                               this.hideEvent.subscribe(listeners.disable, listeners, true);\r
+                               this.destroyEvent.subscribe(listeners.disable, listeners, true); \r
+                       }\r
+               }\r
+       } \r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+\r
+/**\r
+* Builds the wrapping container around the Panel that is used for positioning the shadow and matte underlays. The container element is assigned to a  local instance variable called container, and the element is reinserted inside of it.\r
+*/\r
+YAHOO.widget.Panel.prototype.buildWrapper = function() {\r
+       var elementParent = this.element.parentNode;\r
+\r
+       var elementClone = this.element.cloneNode(true);\r
+       this.innerElement = elementClone;\r
+       this.innerElement.style.visibility = "inherit";\r
+\r
+       YAHOO.util.Dom.addClass(this.innerElement, YAHOO.widget.Panel.CSS_PANEL);\r
+\r
+       var wrapper = document.createElement("DIV");\r
+       wrapper.className = YAHOO.widget.Panel.CSS_PANEL_CONTAINER;\r
+       wrapper.id = elementClone.id + "_c";\r
+       \r
+       wrapper.appendChild(elementClone);\r
+       \r
+       if (elementParent) {\r
+               elementParent.replaceChild(wrapper, this.element);\r
+       }\r
+\r
+       this.element = wrapper;\r
+\r
+       // Resynchronize the local field references\r
+\r
+       var childNodes = this.innerElement.childNodes;\r
+       if (childNodes) {\r
+               for (var i=0;i<childNodes.length;i++) {\r
+                       var child = childNodes[i];\r
+                       switch (child.className) {\r
+                               case YAHOO.widget.Module.CSS_HEADER:\r
+                                       this.header = child;\r
+                                       break;\r
+                               case YAHOO.widget.Module.CSS_BODY:\r
+                                       this.body = child;\r
+                                       break;\r
+                               case YAHOO.widget.Module.CSS_FOOTER:\r
+                                       this.footer = child;\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.initDefaultConfig(); // We've changed the DOM, so the configuration must be re-tooled to get the DOM references right\r
+}\r
+\r
+/**\r
+* Adjusts the size of the shadow based on the size of the element.\r
+*/\r
+YAHOO.widget.Panel.prototype.sizeUnderlay = function() {\r
+       if (this.underlay && this.browser != "gecko" && this.browser != "safari") {\r
+               this.underlay.style.width = this.innerElement.offsetWidth + "px";\r
+               this.underlay.style.height = this.innerElement.offsetHeight + "px";\r
+       }\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Panel.prototype.onDomResize = function(e, obj) { \r
+       YAHOO.widget.Panel.superclass.onDomResize.call(this, e, obj);\r
+       var me = this;\r
+       setTimeout(function() {\r
+               me.sizeUnderlay();\r
+       }, 0);\r
+};\r
+\r
+/**\r
+* Registers the Panel's header for drag & drop capability.\r
+*/\r
+YAHOO.widget.Panel.prototype.registerDragDrop = function() {\r
+       if (this.header) {\r
+               this.dd = new YAHOO.util.DD(this.element.id, this.id);\r
+\r
+               if (! this.header.id) {\r
+                       this.header.id = this.id + "_h";\r
+               }\r
+               \r
+               var me = this;\r
+\r
+               this.dd.startDrag = function() {\r
+\r
+                       if (me.browser == "ie") {\r
+                               YAHOO.util.Dom.addClass(me.element,"drag");\r
+                       }\r
+\r
+                       if (me.cfg.getProperty("constraintoviewport")) {\r
+                               var offsetHeight = me.element.offsetHeight;\r
+                               var offsetWidth = me.element.offsetWidth;\r
+\r
+                               var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+                               var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+                               var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+                               var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+                               var topConstraint = scrollY + 10;\r
+                               var leftConstraint = scrollX + 10;\r
+                               var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+                               var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+\r
+                               this.minX = leftConstraint\r
+                               this.maxX = rightConstraint;\r
+                               this.constrainX = true;\r
+\r
+                               this.minY = topConstraint;\r
+                               this.maxY = bottomConstraint;\r
+                               this.constrainY = true;\r
+                       } else {\r
+                               this.constrainX = false;\r
+                               this.constrainY = false;\r
+                       }\r
+\r
+                       me.dragEvent.fire("startDrag", arguments);\r
+               }\r
+               \r
+               this.dd.onDrag = function() {\r
+                       me.syncPosition();\r
+                       me.cfg.refireEvent("iframe");\r
+                       if (this.platform == "mac" && this.browser == "gecko") {\r
+                               this.showMacGeckoScrollbars();\r
+                       }\r
+\r
+                       me.dragEvent.fire("onDrag", arguments);\r
+               }\r
+\r
+               this.dd.endDrag = function() {\r
+                       if (me.browser == "ie") {\r
+                               YAHOO.util.Dom.removeClass(me.element,"drag");\r
+                       }\r
+\r
+                       me.dragEvent.fire("endDrag", arguments);\r
+               }\r
+\r
+               this.dd.setHandleElId(this.header.id);\r
+               this.dd.addInvalidHandleType("INPUT");\r
+               this.dd.addInvalidHandleType("SELECT");\r
+               this.dd.addInvalidHandleType("TEXTAREA");\r
+       }\r
+}\r
+\r
+/**\r
+* Builds the mask that is laid over the document when the Panel is configured to be modal.\r
+*/\r
+YAHOO.widget.Panel.prototype.buildMask = function() {\r
+       if (! this.mask) {\r
+               this.mask = document.createElement("DIV");\r
+               this.mask.id = this.id + "_mask";\r
+               this.mask.className = "mask";\r
+               this.mask.innerHTML = "&nbsp;";\r
+\r
+               var maskClick = function(e, obj) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+\r
+               YAHOO.util.Event.addListener(this.mask, maskClick, this);\r
+\r
+               document.body.appendChild(this.mask);\r
+       }\r
+}\r
+\r
+/**\r
+* Hides the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.hideMask = function() {\r
+       if (this.cfg.getProperty("modal") && this.mask) {\r
+               this.mask.style.display = "none";\r
+               this.hideMaskEvent.fire();\r
+               YAHOO.util.Dom.removeClass(document.body, "masked");\r
+       }\r
+}\r
+\r
+/**\r
+* Shows the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.showMask = function() {\r
+       if (this.cfg.getProperty("modal") && this.mask) {\r
+               YAHOO.util.Dom.addClass(document.body, "masked");\r
+               this.sizeMask();\r
+               this.mask.style.display = "block";\r
+               this.showMaskEvent.fire();\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the size of the modality mask to cover the entire scrollable area of the document\r
+*/\r
+YAHOO.widget.Panel.prototype.sizeMask = function() {\r
+       if (this.mask) {\r
+               this.mask.style.height = YAHOO.util.Dom.getDocumentHeight()+"px";\r
+               this.mask.style.width = YAHOO.util.Dom.getDocumentWidth()+"px";\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.innerElement;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("underlay");\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.innerElement;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("underlay");\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Renders the Panel by inserting the elements that are not already in the main Panel into their correct places. Optionally appends the Panel to the specified node prior to the render's execution. NOTE: For Panels without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+* @param {string}      appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+* @param {Element}     appendToNode    The element to which the Module should be appended to prior to rendering        \r
+* @return {boolean} Success or failure of the render\r
+*/\r
+YAHOO.widget.Panel.prototype.render = function(appendToNode) {\r
+       return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Panel.prototype.toString = function() {\r
+       return "Panel " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.\r
+* @param {string}      el      The element ID representing the Dialog <em>OR</em>\r
+* @param {Element}     el      The element representing the Dialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Dialog = function(el, userConfig) {\r
+       YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Dialog\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Dialog.CSS_DIALOG = "dialog";\r
+\r
+\r
+/**\r
+* CustomEvent fired prior to submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.beforeSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.submitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to manual submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.manualSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to asynchronous submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.asyncSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to form-based submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.formSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after cancel\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.cancelEvent = null;\r
+\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).\r
+*/\r
+YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);\r
+\r
+       /**\r
+       * The internally maintained callback object for use with the Connection utility\r
+       * @type object\r
+       * @private\r
+       */\r
+       this.callback = {\r
+               success : null,\r
+               failure : null,\r
+               argument: null,\r
+               scope : this\r
+       }\r
+\r
+       this.doSubmit = function() {\r
+               var method = this.cfg.getProperty("postmethod");\r
+               switch (method) {\r
+                       case "async":\r
+                               YAHOO.util.Connect.setForm(this.form.name);\r
+                               var cObj = YAHOO.util.Connect.asyncRequest('POST', this.form.action, this.callback);\r
+                               this.asyncSubmitEvent.fire();\r
+                               break;\r
+                       case "form":\r
+                               this.form.submit();\r
+                               this.formSubmitEvent.fire();\r
+                               break;\r
+                       case "none":\r
+                       case "manual":\r
+                               this.manualSubmitEvent.fire();\r
+                               break;\r
+               }\r
+       }\r
+\r
+       // Add form dialog config properties //\r
+       this.cfg.addProperty("postmethod", { value:"async", validator:function(val) { \r
+                                                                                                       if (val != "form" && val != "async" && val != "none" && val != "manual") {\r
+                                                                                                               return false;\r
+                                                                                                       } else {\r
+                                                                                                               return true;\r
+                                                                                                       }\r
+                                                                                               } });\r
+\r
+       this.cfg.addProperty("buttons",         { value:"none", handler:this.configButtons } );\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.\r
+*/\r
+YAHOO.widget.Dialog.prototype.initEvents = function() {\r
+       YAHOO.widget.Dialog.superclass.initEvents.call(this);\r
+       \r
+       this.beforeSubmitEvent  = new YAHOO.util.CustomEvent("beforeSubmit");\r
+       this.submitEvent                = new YAHOO.util.CustomEvent("submit");\r
+\r
+       this.manualSubmitEvent  = new YAHOO.util.CustomEvent("manualSubmit");\r
+       this.asyncSubmitEvent   = new YAHOO.util.CustomEvent("asyncSubmit");\r
+       this.formSubmitEvent    = new YAHOO.util.CustomEvent("formSubmit");\r
+\r
+       this.cancelEvent                = new YAHOO.util.CustomEvent("cancel");\r
+}\r
+\r
+/**\r
+* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Dialog <em>OR</em>\r
+* @param {Element}     el      The element representing the Dialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Dialog);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);\r
+\r
+       this.cfg.setProperty("visible", false);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.renderEvent.subscribe(this.registerForm, this, true);\r
+\r
+       this.showEvent.subscribe(this.focusFirst, this, true);\r
+       this.beforeHideEvent.subscribe(this.blurButtons, this, true);\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               var buttonCfg = this.cfg.getProperty("buttons");\r
+               if (buttonCfg && buttonCfg != "none") {\r
+                       if (! this.footer) {\r
+                               this.setFooter("");\r
+                       }\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.Dialog);\r
+}\r
+\r
+/**\r
+* Prepares the Dialog's internal FORM object, creating one if one is not currently present.\r
+*/\r
+YAHOO.widget.Dialog.prototype.registerForm = function() {\r
+       var form = this.element.getElementsByTagName("FORM")[0];\r
+\r
+       if (! form) {\r
+               var formHTML = "<form name=\"frm_" + this.id + "\" action=\"\"></form>";\r
+               this.body.innerHTML += formHTML;\r
+               form = this.element.getElementsByTagName("FORM")[0];\r
+       }\r
+\r
+       this.firstFormElement = function() {\r
+               for (var f=0;f<form.elements.length;f++ ) {\r
+                       var el = form.elements[f];\r
+                       if (el.focus) {\r
+                               if (el.type && el.type != "hidden") {\r
+                                       return el;\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+               return null;\r
+       }();\r
+\r
+       this.lastFormElement = function() {\r
+               for (var f=form.elements.length-1;f>=0;f-- ) {\r
+                       var el = form.elements[f];\r
+                       if (el.focus) {\r
+                               if (el.type && el.type != "hidden") {\r
+                                       return el;\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+               return null;\r
+       }();\r
+\r
+       this.form = form;\r
+\r
+       if (this.cfg.getProperty("modal") && this.form) {\r
+\r
+               var me = this;\r
+               \r
+               var firstElement = this.firstFormElement || this.firstButton;\r
+               if (firstElement) {\r
+                       this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );\r
+                       this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);\r
+                       this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);\r
+               }\r
+\r
+               var lastElement = this.lastButton || this.lastFormElement;\r
+               if (lastElement) {\r
+                       this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );\r
+                       this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);\r
+                       this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);\r
+               }\r
+       }\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler for the "buttons" configuration property\r
+*/\r
+YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {\r
+       var buttons = args[0];\r
+       if (buttons != "none") {\r
+               this.buttonSpan = null;\r
+               this.buttonSpan = document.createElement("SPAN");\r
+               this.buttonSpan.className = "button-group";\r
+\r
+               for (var b=0;b<buttons.length;b++) {\r
+                       var button = buttons[b];\r
+\r
+                       var htmlButton = document.createElement("BUTTON");\r
+\r
+                       if (button.isDefault) {\r
+                               htmlButton.className = "default";\r
+                               this.defaultHtmlButton = htmlButton;\r
+                       }\r
+\r
+                       htmlButton.appendChild(document.createTextNode(button.text));\r
+                       YAHOO.util.Event.addListener(htmlButton, "click", button.handler, this, true);\r
+\r
+                       this.buttonSpan.appendChild(htmlButton);                \r
+                       button.htmlButton = htmlButton;\r
+\r
+                       if (b == 0) {\r
+                               this.firstButton = button.htmlButton;\r
+                       }\r
+\r
+                       if (b == (buttons.length-1)) {\r
+                               this.lastButton = button.htmlButton;\r
+                       }\r
+\r
+               }\r
+\r
+               this.setFooter(this.buttonSpan);\r
+\r
+               this.cfg.refireEvent("iframe");\r
+               this.cfg.refireEvent("underlay");\r
+       } else { // Do cleanup\r
+               if (this.buttonSpan) {\r
+                       if (this.buttonSpan.parentNode) {\r
+                               this.buttonSpan.parentNode.removeChild(this.buttonSpan);\r
+                       }\r
+\r
+                       this.buttonSpan = null;\r
+                       this.firstButtom = null;\r
+                       this.lastButton = null;\r
+                       this.defaultHtmlButton = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default handler fired when the "success" property is changed. Used for asynchronous submission only.\r
+*/ \r
+YAHOO.widget.Dialog.prototype.configOnSuccess = function(type,args,obj){};\r
+\r
+/**\r
+* The default handler fired when the "failure" property is changed. Used for asynchronous submission only.\r
+*/ \r
+YAHOO.widget.Dialog.prototype.configOnFailure = function(type,args,obj){};\r
+\r
+/**\r
+* Executes a submission of the form based on the value of the postmethod property.\r
+*/\r
+YAHOO.widget.Dialog.prototype.doSubmit = function() {};\r
+\r
+/**\r
+* The default event handler used to focus the first field of the form when the Dialog is shown.\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusFirst = function(type,args,obj) {\r
+       if (args) {\r
+               var e = args[1];\r
+               if (e) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+       }\r
+\r
+       if (this.firstFormElement) {\r
+               this.firstFormElement.focus();\r
+       } else {\r
+               this.focusDefaultButton();\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the last button in the button or form element in the Dialog\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusLast = function(type,args,obj) {\r
+       if (args) {\r
+               var e = args[1];\r
+               if (e) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+       }\r
+\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               this.focusLastButton();\r
+       } else {\r
+               if (this.lastFormElement) {\r
+                       this.lastFormElement.focus();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the button that is designated as the default. By default, his handler is executed when the show event is fired.\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusDefaultButton = function() {\r
+       if (this.defaultHtmlButton) {\r
+               this.defaultHtmlButton.focus();\r
+       }\r
+}\r
+\r
+/**\r
+* Blurs all the html buttons\r
+*/\r
+YAHOO.widget.Dialog.prototype.blurButtons = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[0].htmlButton;\r
+               if (html) {\r
+                       html.blur();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the first button in the button list\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusFirstButton = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[0].htmlButton;\r
+               if (html) {\r
+                       html.focus();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the first button in the button list\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusLastButton = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[buttons.length-1].htmlButton;\r
+               if (html) {\r
+                       html.focus();\r
+               }\r
+       }\r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Built-in function hook for writing a validation function that will be checked for a "true" value prior to a submit. This function, as implemented by default, always returns true, so it should be overridden if validation is necessary.\r
+*/\r
+YAHOO.widget.Dialog.prototype.validate = function() {\r
+       return true;\r
+}\r
+\r
+/**\r
+* Executes a submit of the Dialog followed by a hide, if validation is successful.\r
+*/\r
+YAHOO.widget.Dialog.prototype.submit = function() {\r
+       if (this.validate()) {\r
+               this.beforeSubmitEvent.fire();\r
+               this.doSubmit();\r
+               this.submitEvent.fire();\r
+               this.hide();\r
+               return true;\r
+       } else {\r
+               return false;\r
+       }\r
+}\r
+\r
+/**\r
+* Executes the cancel of the Dialog followed by a hide.\r
+*/\r
+YAHOO.widget.Dialog.prototype.cancel = function() {\r
+       this.cancelEvent.fire();\r
+       this.hide();    \r
+}\r
+\r
+/**\r
+* Returns a JSON-compatible data structure representing the data currently contained in the form.\r
+* @return {object} A JSON object reprsenting the data of the current form.\r
+*/\r
+YAHOO.widget.Dialog.prototype.getData = function() {\r
+       var form = this.form;\r
+       var data = {};\r
+\r
+       if (form) {\r
+               for (var i in this.form) {\r
+                       var formItem = form[i];\r
+                       if (formItem) {\r
+                               if (formItem.tagName) { // Got a single form item\r
+                                       switch (formItem.tagName) {\r
+                                               case "INPUT":\r
+                                                       switch (formItem.type) {\r
+                                                               case "checkbox": \r
+                                                                       data[i] = formItem.checked;\r
+                                                                       break;\r
+                                                               case "textbox":\r
+                                                               case "text":\r
+                                                               case "hidden":\r
+                                                                       data[i] = formItem.value;\r
+                                                                       break;\r
+                                                       }\r
+                                                       break;\r
+                                               case "TEXTAREA":\r
+                                                       data[i] = formItem.value;\r
+                                                       break;\r
+                                               case "SELECT":\r
+                                                       var val = new Array();\r
+                                                       for (var x=0;x<formItem.options.length;x++)     {\r
+                                                               var option = formItem.options[x];\r
+                                                               if (option.selected) {\r
+                                                                       var selval = option.value;\r
+                                                                       if (! selval || selval == "") {\r
+                                                                               selval = option.text;\r
+                                                                       }\r
+                                                                       val[val.length] = selval;\r
+                                                               }\r
+                                                       }\r
+                                                       data[i] = val;\r
+                                                       break;\r
+                                       }\r
+                               } else if (formItem[0] && formItem[0].tagName) { // this is an array of form items\r
+                                       switch (formItem[0].tagName) {\r
+                                               case "INPUT" :\r
+                                                       switch (formItem[0].type) {\r
+                                                               case "radio":\r
+                                                                       for (var r=0; r<formItem.length; r++) {\r
+                                                                               var radio = formItem[r];\r
+                                                                               if (radio.checked) {\r
+                                                                                       data[radio.name] = radio.value;\r
+                                                                                       break;\r
+                                                                               }\r
+                                                                       }\r
+                                                                       break;\r
+                                                               case "checkbox":\r
+                                                                       var cbArray = new Array();\r
+                                                                       for (var c=0; c<formItem.length; c++) {\r
+                                                                               var check = formItem[c];\r
+                                                                               if (check.checked) {\r
+                                                                                       cbArray[cbArray.length] = check.value;\r
+                                                                               }\r
+                                                                       }\r
+                                                                       data[formItem[0].name] = cbArray;\r
+                                                                       break;\r
+                                                       }\r
+                                       }\r
+                               }\r
+                       }\r
+               }       \r
+       }\r
+       return data;\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Dialog.prototype.toString = function() {\r
+       return "Dialog " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* SimpleDialog is a simple implementation of Dialog that can be used to submit a single value. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.\r
+* @param {string}      el      The element ID representing the SimpleDialog <em>OR</em>\r
+* @param {Element}     el      The element representing the SimpleDialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.SimpleDialog = function(el, userConfig) {\r
+       YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);\r
+\r
+/**\r
+* Constant for the standard network icon for a blocking action\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for alarm\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for help\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_HELP  = "nt/ic/ut/bsc/hlp16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for info\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_INFO  = "nt/ic/ut/bsc/info16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for warn\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_WARN  = "nt/ic/ut/bsc/warn16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for a tip\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_TIP   = "nt/ic/ut/bsc/tip16_1.gif";\r
+\r
+/**\r
+* Constant representing the default CSS class used for a SimpleDialog\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add dialog config properties //\r
+       this.cfg.addProperty("icon",    { value:"none", handler:this.configIcon, suppressEvent:true } );\r
+       this.cfg.addProperty("text",    { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );\r
+}\r
+\r
+\r
+/**\r
+* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the SimpleDialog <em>OR</em>\r
+* @param {Element}     el      The element representing the SimpleDialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+\r
+       this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);\r
+\r
+       this.cfg.queueProperty("postmethod", "manual");\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               if (! this.body) {\r
+                       this.setBody("");\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.SimpleDialog);\r
+\r
+}\r
+/**\r
+* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.registerForm = function() {\r
+       YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);\r
+       this.form.innerHTML += "<input type=\"hidden\" name=\"" + this.id + "\" value=\"\"/>";\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Fired when the "icon" property is set.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {\r
+       var icon = args[0];\r
+       if (icon && icon != "none") {\r
+               var iconHTML = "<img src=\"" + this.imageRoot + icon + "\" class=\"icon\" />";\r
+               this.body.innerHTML = iconHTML + this.body.innerHTML;\r
+       }\r
+}\r
+\r
+/**\r
+* Fired when the "text" property is set.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {\r
+       var text = args[0];\r
+       if (text) {\r
+               this.setBody(text);\r
+               this.cfg.refireEvent("icon");\r
+       }\r
+}\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.SimpleDialog.prototype.toString = function() {\r
+       return "SimpleDialog " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.\r
+* @param {Overlay}     overlay         The Overlay that the animation should be associated with\r
+* @param {object}      attrIn          The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(float), and method(i.e. YAHOO.util.Easing.easeIn).\r
+* @param {object}      attrOut         The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(float), and method(i.e. YAHOO.util.Easing.easeIn).\r
+* @param {Element}     targetElement   Optional. The target element that should be animated during the transition. Defaults to overlay.element.\r
+* @param {class}       Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.\r
+* @constructor\r
+*/\r
+YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {\r
+       if (! animClass) {\r
+               animClass = YAHOO.util.Anim;\r
+       }\r
+\r
+       /**\r
+       * The overlay to animate\r
+       */\r
+       this.overlay = overlay;\r
+       /**\r
+       * The animation attributes to use when transitioning into view\r
+       */\r
+       this.attrIn = attrIn;\r
+       /**\r
+       * The animation attributes to use when transitioning out of view\r
+       */\r
+       this.attrOut = attrOut;\r
+       /**\r
+       * The target element to be animated\r
+       */\r
+       this.targetElement = targetElement || overlay.element;\r
+       /**\r
+       * The animation class to use for animating the overlay\r
+       */\r
+       this.animClass = animClass;\r
+}\r
+\r
+/**\r
+* Initializes the animation classes and events.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.init = function() {\r
+       this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");\r
+       this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");\r
+\r
+       this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");\r
+       this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");\r
+\r
+       this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);\r
+       this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);\r
+       this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);\r
+       this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);\r
+\r
+       this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);\r
+       this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);\r
+       this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);\r
+       this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);\r
+}\r
+\r
+/**\r
+* Triggers the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.animateIn = function() {\r
+       this.beforeAnimateInEvent.fire();\r
+       this.animIn.animate();\r
+}\r
+\r
+/**\r
+* Triggers the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.animateOut = function() {\r
+       this.beforeAnimateOutEvent.fire();\r
+       this.animOut.animate();\r
+}\r
+\r
+/**\r
+* The default onStart handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { }\r
+/**\r
+* The default onTween handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { }\r
+/**\r
+* The default onComplete handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { }\r
+\r
+/**\r
+* The default onStart handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { }\r
+/**\r
+* The default onTween handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { }\r
+/**\r
+* The default onComplete handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { }\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.ContainerEffect.prototype.toString = function() {\r
+       var output = "ContainerEffect";\r
+       if (this.overlay) {\r
+               output += " [" + this.overlay.toString() + "]";\r
+       }\r
+       return output;\r
+}\r
+\r
+/**\r
+* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.\r
+* @param {Overlay}     The Overlay object to animate\r
+* @param {float}       The duration of the animation\r
+* @type ContainerEffect\r
+*/\r
+YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {\r
+       var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );\r
+\r
+       fade.handleStartAnimateIn = function(type,args,obj) {\r
+               YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");\r
+               \r
+               if (! obj.overlay.underlay) {\r
+                       obj.overlay.cfg.refireEvent("underlay");\r
+               }\r
+\r
+               if (obj.overlay.underlay) {\r
+                       obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");\r
+                       obj.overlay.underlay.style.filter = null;\r
+               }\r
+\r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible"); \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);\r
+       }\r
+\r
+       fade.handleCompleteAnimateIn = function(type,args,obj) {\r
+               YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");\r
+\r
+               if (obj.overlay.element.style.filter) {\r
+                       obj.overlay.element.style.filter = null;\r
+               }                       \r
+               \r
+               if (obj.overlay.underlay) {\r
+                       YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);\r
+               }\r
+\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+               obj.animateInCompleteEvent.fire();\r
+       }\r
+\r
+       fade.handleStartAnimateOut = function(type, args, obj) {\r
+               YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");\r
+\r
+               if (obj.overlay.underlay) {\r
+                       obj.overlay.underlay.style.filter = null;\r
+               }\r
+       }\r
+\r
+       fade.handleCompleteAnimateOut =  function(type, args, obj) { \r
+               YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");\r
+               if (obj.overlay.element.style.filter) {\r
+                       obj.overlay.element.style.filter = null;\r
+               }                               \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");\r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1); \r
+\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+\r
+               obj.animateOutCompleteEvent.fire();\r
+       };      \r
+\r
+       fade.init();\r
+       return fade;\r
+};\r
+\r
+\r
+/**\r
+* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.\r
+* @param {Overlay}     The Overlay object to animate\r
+* @param {float}       The duration of the animation\r
+* @type ContainerEffect\r
+*/\r
+YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {\r
+       var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);\r
+       var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);\r
+\r
+       var clientWidth = YAHOO.util.Dom.getClientWidth();\r
+       var offsetWidth = overlay.element.offsetWidth;\r
+\r
+       var slide = new YAHOO.widget.ContainerEffect(overlay, { \r
+                                                                                                                       attributes:{ points: { to:[x, y] } }, \r
+                                                                                                                       duration:dur, \r
+                                                                                                                       method:YAHOO.util.Easing.easeIn \r
+                                                                                                               }, \r
+                                                                                                               { \r
+                                                                                                                       attributes:{ points: { to:[(clientWidth+25), y] } },\r
+                                                                                                                       duration:dur, \r
+                                                                                                                       method:YAHOO.util.Easing.easeOut\r
+                                                                                                               },\r
+                                                                                                               overlay.element,\r
+                                                                                                               YAHOO.util.Motion\r
+                                                                                               );\r
+\r
+       slide.handleStartAnimateIn = function(type,args,obj) {\r
+               obj.overlay.element.style.left = (-25-offsetWidth) + "px";\r
+               obj.overlay.element.style.top  = y + "px";\r
+       }\r
+       \r
+       slide.handleTweenAnimateIn = function(type, args, obj) {\r
+\r
+\r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var currentX = pos[0];\r
+               var currentY = pos[1];\r
+\r
+               if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {\r
+                       YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");\r
+               }\r
+\r
+               obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+       }\r
+       \r
+       slide.handleCompleteAnimateIn = function(type, args, obj) {\r
+               obj.overlay.cfg.setProperty("xy", [x,y], true);\r
+               obj.startX = x;\r
+               obj.startY = y;\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+               obj.animateInCompleteEvent.fire();\r
+       }\r
+\r
+       slide.handleStartAnimateOut = function(type, args, obj) {\r
+               var clientWidth = YAHOO.util.Dom.getViewportWidth();\r
+               \r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var x = pos[0];\r
+               var y = pos[1];\r
+\r
+               var currentTo = obj.animOut.attributes.points.to;\r
+               obj.animOut.attributes.points.to = [(clientWidth+25), y];\r
+       }\r
+\r
+       slide.handleTweenAnimateOut = function(type, args, obj) {\r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var x = pos[0];\r
+               var y = pos[1];\r
+\r
+               obj.overlay.cfg.setProperty("xy", [x,y], true);\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+       }\r
+\r
+       slide.handleCompleteAnimateOut = function(type, args, obj) { \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");           \r
+               var offsetWidth = obj.overlay.element.offsetWidth;\r
+\r
+               obj.overlay.cfg.setProperty("xy", [x,y]);\r
+               obj.animateOutCompleteEvent.fire();\r
+       };      \r
+\r
+       slide.init();\r
+       return slide;\r
+}
\ No newline at end of file
diff --git a/lib/yui/container/container-min.js b/lib/yui/container/container-min.js
new file mode 100755 (executable)
index 0000000..8ded017
--- /dev/null
@@ -0,0 +1,292 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+YAHOO.util.Config=function(owner){if(owner){this.init(owner);}}\r
+YAHOO.util.Config.prototype={owner:null,configChangedEvent:null,queueInProgress:false,addProperty:function(key,propertyObject){},getConfig:function(){},getProperty:function(key){},resetProperty:function(key){},setProperty:function(key,value,silent){},queueProperty:function(key,value){},refireEvent:function(key){},applyConfig:function(userConfig,init){},refresh:function(){},fireQueue:function(){},subscribeToConfigEvent:function(key,handler,obj,override){},unsubscribeFromConfigEvent:function(key,handler,obj){},checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}}\r
+YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}}\r
+this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);}\r
+this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}}\r
+this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop]\r
+if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}}\r
+return cfg;}\r
+this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}}\r
+this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){this.setProperty(key,initialConfig[key].value);}else{return undefined;}}\r
+this.setProperty=function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=config[key];if(typeof property!='undefined'&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){fireEvent(key,value);this.configChangedEvent.fire([key,value]);}\r
+return true;}}else{return false;}}}\r
+this.queueProperty=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(typeof value!='undefined'&&property.validator&&!property.validator(value)){return false;}else{if(typeof value!='undefined'){property.value=value;}else{value=property.value;}\r
+var foundDuplicate=false;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey.toLowerCase()==key){eventQueue[i]=null;eventQueue.push([key,(typeof value!='undefined'?value:queueItemValue)]);foundDuplicate=true;break;}}}\r
+if(!foundDuplicate&&typeof value!='undefined'){eventQueue.push([key,value]);}}\r
+if(property.supercedes){for(var s=0;s<property.supercedes.length;s++){var supercedesCheck=property.supercedes[s];for(var q=0;q<eventQueue.length;q++){var queueItemCheck=eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey.toLowerCase()==supercedesCheck.toLowerCase()){eventQueue.push([queueItemCheckKey,queueItemCheckValue]);eventQueue[q]=null;break;}}}}}\r
+return true;}else{return false;}}\r
+this.refireEvent=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event&&typeof property.value!='undefined'){if(this.queueInProgress){this.queueProperty(key);}else{fireEvent(key,property.value);}}}\r
+this.applyConfig=function(userConfig,init){if(init){initialConfig=userConfig;}\r
+for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}}\r
+this.refresh=function(){for(var prop in config){this.refireEvent(prop);}}\r
+this.fireQueue=function(){this.queueInProgress=true;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=config[key];property.value=value;fireEvent(key,value);}}\r
+this.queueInProgress=false;eventQueue=new Array();}\r
+this.subscribeToConfigEvent=function(key,handler,obj,override){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}\r
+return true;}else{return false;}}\r
+this.unsubscribeFromConfigEvent=function(key,handler,obj){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}}\r
+this.toString=function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}\r
+return output;}\r
+this.outputEventQueue=function(){var output="";for(var q=0;q<eventQueue.length;q++){var queueItem=eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}\r
+return output;}}\r
+YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;break;}}\r
+return false;}\r
+YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}}\r
+YAHOO.widget.Module.IMG_ROOT="http://us.i1.yimg.com/us.yimg.com/i/";YAHOO.widget.Module.IMG_ROOT_SSL="https://a248.e.akamai.net/sec.yimg.com/i/";YAHOO.widget.Module.CSS_MODULE="module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL=null;YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,childNodesInDOM:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,beforeInitEvent:null,initEvent:null,appendEvent:null,beforeRenderEvent:null,renderEvent:null,changeHeaderEvent:null,changeBodyEvent:null,changeFooterEvent:null,changeContentEvent:null,destroyEvent:null,beforeShowEvent:null,showEvent:null,beforeHideEvent:null,hideEvent:null,initEvents:function(){this.beforeInitEvent=new YAHOO.util.CustomEvent("beforeInit");this.initEvent=new YAHOO.util.CustomEvent("init");this.appendEvent=new YAHOO.util.CustomEvent("append");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.changeHeaderEvent=new YAHOO.util.CustomEvent("changeHeader");this.changeBodyEvent=new YAHOO.util.CustomEvent("changeBody");this.changeFooterEvent=new YAHOO.util.CustomEvent("changeFooter");this.changeContentEvent=new YAHOO.util.CustomEvent("changeContent");this.destroyEvent=new YAHOO.util.CustomEvent("destroy");this.beforeShowEvent=new YAHOO.util.CustomEvent("beforeShow");this.showEvent=new YAHOO.util.CustomEvent("show");this.beforeHideEvent=new YAHOO.util.CustomEvent("beforeHide");this.hideEvent=new YAHOO.util.CustomEvent("hide");},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")==0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty("visible",{value:true,handler:this.configVisible,validator:this.cfg.checkBoolean});this.cfg.addProperty("effect",{suppressEvent:true,supercedes:["visible"]});this.cfg.addProperty("monitorresize",{value:true,handler:this.configMonitorResize});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(this.isSecure){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;}\r
+if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("DIV");el.id=elId;}}\r
+this.element=el;if(el.id){this.id=el.id;}\r
+var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}\r
+this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}\r
+this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){if(this.browser!="opera"){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("iframe");var bIE=(this.browser.indexOf("ie")===0);if(this.isSecure&&this.RESIZE_MONITOR_SECURE_URL&&bIE){resizeMonitor.src=this.RESIZE_MONITOR_SECURE_URL;}\r
+resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.visibility="hidden";document.body.appendChild(resizeMonitor);resizeMonitor.style.width="10em";resizeMonitor.style.height="10em";resizeMonitor.style.position="absolute";var nLeft=-1*resizeMonitor.offsetWidth,nTop=-1*resizeMonitor.offsetHeight;resizeMonitor.style.top=nTop+"px";resizeMonitor.style.left=nLeft+"px";resizeMonitor.style.borderStyle="none";resizeMonitor.style.borderWidth="0";YAHOO.util.Dom.setStyle(resizeMonitor,"opacity","0");resizeMonitor.style.visibility="visible";if(!bIE){var doc=resizeMonitor.contentWindow.document;doc.open();doc.close();}}\r
+if(resizeMonitor&&resizeMonitor.contentWindow){this.resizeMonitor=resizeMonitor;YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow,"resize",this.onDomResize,this,true);}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}\r
+if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}\r
+this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}\r
+this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}\r
+if(typeof bodyContent=="string")\r
+{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}\r
+this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}\r
+this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}\r
+if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}\r
+this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}\r
+this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}\r
+var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}\r
+if(element){element.appendChild(me.element);me.appendEvent.fire();}}\r
+if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}\r
+if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}\r
+if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}\r
+if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}\r
+this.renderEvent.fire();return true;},destroy:function(){if(this.element){var parent=this.element.parentNode;}\r
+if(parent){parent.removeChild(this.element);}\r
+this.element=null;this.header=null;this.body=null;this.footer=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.util.Event.removeListener(this.resizeMonitor,"resize",this.onDomResize);this.resizeMonitor=null;}}}\r
+YAHOO.widget.Module.prototype.toString=function(){return"Module "+this.id;}\r
+YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.Overlay,YAHOO.widget.Module);YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}\r
+this.initEvent.fire(YAHOO.widget.Overlay);}\r
+YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);}\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});}\r
+YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);}\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");}\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");}\r
+YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}\r
+var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}\r
+if(effect){if(visible){if(currentVis!="visible"){this.beforeShowEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}\r
+e.animateIn();}}}}else{if(currentVis!="visible"){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}\r
+if(effect){if(currentVis!="hidden"){this.beforeHideEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}\r
+e.animateOut();}}}else{if(currentVis!="hidden"){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}}\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}}\r
+YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}}\r
+YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}\r
+if(this.iframe){if(zIndex<=0){zIndex=1;}\r
+YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}\r
+YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);}\r
+YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];var el=this.element;var showIframe=function(){if(this.iframe){this.iframe.style.display="block";}}\r
+var hideIframe=function(){if(this.iframe){this.iframe.style.display="none";}}\r
+if(val){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,showIframe,this)){this.showEvent.subscribe(showIframe,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,hideIframe,this)){this.hideEvent.subscribe(hideIframe,this,true);}\r
+var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}\r
+if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");if(this.isSecure){this.iframe.src=this.imageRoot+YAHOO.widget.Overlay.IFRAME_SRC;}\r
+var parent=el.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}\r
+YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(this.cfg.getProperty("visible")){showIframe.call(this);}else{hideIframe.call(this);}}\r
+var iframeDisplay=YAHOO.util.Dom.getStyle(this.iframe,"display");if(iframeDisplay=="none"){this.iframe.style.display="block";}\r
+YAHOO.util.Dom.setXY(this.iframe,[x,y]);var width=el.clientWidth;var height=el.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(iframeDisplay=="none"){this.iframe.style.display="none";}}}else{if(this.iframe){this.iframe.style.display="none";}\r
+this.showEvent.unsubscribe(showIframe,this);this.hideEvent.unsubscribe(hideIframe,this);}}\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}}\r
+YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}\r
+if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}}\r
+YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}\r
+if(!contextAlign){contextAlign=contextArgs[2];}\r
+if(element&&context){var elementRegion=YAHOO.util.Dom.getRegion(element);var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}}\r
+switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}}\r
+YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var width=parseInt(this.cfg.getProperty("width"));if(isNaN(width)){width=0;}\r
+var offsetHeight=this.element.offsetHeight;var offsetWidth=(width>0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}\r
+if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}\r
+this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);}\r
+YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);}\r
+YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}\r
+this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;}\r
+YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();}\r
+YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();}\r
+YAHOO.widget.Overlay._initialized==null;if(YAHOO.widget.Overlay._initialized==null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}\r
+YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);}\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;}\r
+this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));}\r
+this.overlays.sort(this.compareZIndexDesc);}}\r
+this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null\r
+o.blurEvent=null;o.focus=null;o.blur=null;}}\r
+this.blurAll=function(){activeOverlay=null;for(var o=0;o<this.overlays.length;o++){YAHOO.util.Dom.removeClass(this.overlays[o].element,YAHOO.widget.OverlayManager.CSS_FOCUSED);}}\r
+var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=new Array();}\r
+if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus");overlay.blurEvent=new YAHOO.util.CustomEvent("blur");var mgr=this;overlay.focus=function(){mgr.focus(this);this.focusEvent.fire();}\r
+overlay.blur=function(){mgr.blurAll();this.blurEvent.fire();}\r
+var focusOnDomEvent=function(e,obj){overlay.focus();}\r
+var focusevent=this.cfg.getProperty("focusevent");YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex));}else{overlay.cfg.setProperty("zIndex",0);}\r
+this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}\r
+if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o].id==overlay){return this.overlays[o];}}}\r
+return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}},toString:function(){return"OverlayManager";}}\r
+YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}\r
+var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}\r
+if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}\r
+function handleKeyPress(e,obj){var keyPressed=e.charCode||e.keyCode;if(!keyData.shift)keyData.shift=false;if(!keyData.alt)keyData.alt=false;if(!keyData.ctrl)keyData.ctrl=false;if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){if(keyPressed==keyData.keys[i]){keyEvent.fire(keyPressed,e);break;}}}else{if(keyPressed==keyData.keys){keyEvent.fire(keyPressed,e);}}}}\r
+this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}\r
+this.enabled=true;}\r
+this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}\r
+this.enabled=false;}\r
+this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+(attachTo.id?"["+attachTo.id+"]":"");}}\r
+YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.prototype.enabled=null;YAHOO.util.KeyListener.prototype.enable=function(){};YAHOO.util.KeyListener.prototype.disable=function(){};YAHOO.util.KeyListener.prototype.enabledEvent=null;YAHOO.util.KeyListener.prototype.disabledEvent=null;YAHOO.widget.Tooltip=function(el,userConfig){YAHOO.widget.Tooltip.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.Tooltip,YAHOO.widget.Overlay);YAHOO.widget.Tooltip.CSS_TOOLTIP="tt";YAHOO.widget.Tooltip.prototype.init=function(el,userConfig){if(document.readyState&&document.readyState!="complete"){var deferredInit=function(){this.init(el,userConfig);}\r
+YAHOO.util.Event.addListener(window,"load",deferredInit,this,true);}else{YAHOO.widget.Tooltip.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Tooltip);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Tooltip.CSS_TOOLTIP);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.render(this.cfg.getProperty("container"));this.initEvent.fire(YAHOO.widget.Tooltip);}}\r
+YAHOO.widget.Tooltip.prototype.initDefaultConfig=function(){YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);this.cfg.addProperty("preventoverlap",{value:true,validator:this.cfg.checkBoolean,supercedes:["x","y","xy"]});this.cfg.addProperty("showdelay",{value:200,handler:this.configShowDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("autodismissdelay",{value:5000,handler:this.configAutoDismissDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("hidedelay",{value:250,handler:this.configHideDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("text",{handler:this.configText,suppressEvent:true});this.cfg.addProperty("container",{value:document.body,handler:this.configContainer});}\r
+YAHOO.widget.Tooltip.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}}\r
+YAHOO.widget.Tooltip.prototype.configContainer=function(type,args,obj){var container=args[0];if(typeof container=='string'){this.cfg.setProperty("container",document.getElementById(container),true);}}\r
+YAHOO.widget.Tooltip.prototype.configContext=function(type,args,obj){var context=args[0];if(context){if(!(context instanceof Array)){if(typeof context=="string"){this.cfg.setProperty("context",[document.getElementById(context)],true);}else{this.cfg.setProperty("context",[context],true);}\r
+context=this.cfg.getProperty("context");}\r
+if(this._context){for(var c=0;c<this._context.length;++c){var el=this._context[c];YAHOO.util.Event.removeListener(el,"mouseover",this.onContextMouseOver);YAHOO.util.Event.removeListener(el,"mousemove",this.onContextMouseMove);YAHOO.util.Event.removeListener(el,"mouseout",this.onContextMouseOut);}}\r
+this._context=context;for(var c=0;c<this._context.length;++c){var el=this._context[c];YAHOO.util.Event.addListener(el,"mouseover",this.onContextMouseOver,this);YAHOO.util.Event.addListener(el,"mousemove",this.onContextMouseMove,this);YAHOO.util.Event.addListener(el,"mouseout",this.onContextMouseOut,this);}}}\r
+YAHOO.widget.Tooltip.prototype.onContextMouseMove=function(e,obj){obj.pageX=YAHOO.util.Event.getPageX(e);obj.pageY=YAHOO.util.Event.getPageY(e);}\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOver=function(e,obj){if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}\r
+var context=this;YAHOO.util.Event.addListener(context,"mousemove",obj.onContextMouseMove,obj);if(context.title){obj._tempTitle=context.title;context.title="";}\r
+obj.showProcId=obj.doShow(e,context);}\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOut=function(e,obj){var el=this;if(obj._tempTitle){el.title=obj._tempTitle;obj._tempTitle=null;}\r
+if(obj.showProcId){clearTimeout(obj.showProcId);obj.showProcId=null;}\r
+if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}\r
+obj.hideProcId=setTimeout(function(){obj.hide();},obj.cfg.getProperty("hidedelay"));}\r
+YAHOO.widget.Tooltip.prototype.doShow=function(e,context){var yOffset=25;if(this.browser=="opera"&&context.tagName=="A"){yOffset+=12;}\r
+var me=this;return setTimeout(function(){if(me._tempTitle){me.setBody(me._tempTitle);}else{me.cfg.refireEvent("text");}\r
+me.moveTo(me.pageX,me.pageY+yOffset);if(me.cfg.getProperty("preventoverlap")){me.preventOverlap(me.pageX,me.pageY);}\r
+YAHOO.util.Event.removeListener(context,"mousemove",me.onContextMouseMove);me.show();me.hideProcId=me.doHide();},this.cfg.getProperty("showdelay"));}\r
+YAHOO.widget.Tooltip.prototype.doHide=function(){var me=this;return setTimeout(function(){me.hide();},this.cfg.getProperty("autodismissdelay"));}\r
+YAHOO.widget.Tooltip.prototype.preventOverlap=function(pageX,pageY){var height=this.element.offsetHeight;var elementRegion=YAHOO.util.Dom.getRegion(this.element);elementRegion.top-=5;elementRegion.left-=5;elementRegion.right+=5;elementRegion.bottom+=5;var mousePoint=new YAHOO.util.Point(pageX,pageY);if(elementRegion.contains(mousePoint)){this.logger.log("OVERLAP","warn");this.cfg.setProperty("y",(pageY-height-5))}}\r
+YAHOO.widget.Tooltip.prototype.toString=function(){return"Tooltip "+this.id;}\r
+YAHOO.widget.Panel=function(el,userConfig){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.Panel,YAHOO.widget.Overlay);YAHOO.widget.Panel.CSS_PANEL="panel";YAHOO.widget.Panel.CSS_PANEL_CONTAINER="panel-container";YAHOO.widget.Panel.prototype.showMaskEvent=null;YAHOO.widget.Panel.prototype.hideMaskEvent=null;YAHOO.widget.Panel.prototype.init=function(el,userConfig){YAHOO.widget.Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Panel);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.beforeRenderEvent.subscribe(function(){var draggable=this.cfg.getProperty("draggable");if(draggable){if(!this.header){this.setHeader("&nbsp;");}}},this,true);this.initEvent.fire(YAHOO.widget.Panel);}\r
+YAHOO.widget.Panel.prototype.initEvents=function(){YAHOO.widget.Panel.superclass.initEvents.call(this);this.showMaskEvent=new YAHOO.util.CustomEvent("showMask");this.hideMaskEvent=new YAHOO.util.CustomEvent("hideMask");this.dragEvent=new YAHOO.util.CustomEvent("drag");}\r
+YAHOO.widget.Panel.prototype.initDefaultConfig=function(){YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);this.cfg.addProperty("close",{value:true,handler:this.configClose,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("draggable",{value:true,handler:this.configDraggable,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("underlay",{value:"shadow",handler:this.configUnderlay,supercedes:["visible"]});this.cfg.addProperty("modal",{value:false,handler:this.configModal,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("keylisteners",{handler:this.configKeyListeners,suppressEvent:true,supercedes:["visible"]});}\r
+YAHOO.widget.Panel.prototype.configClose=function(type,args,obj){var val=args[0];var doHide=function(e,obj){obj.hide();}\r
+if(val){if(!this.close){this.close=document.createElement("DIV");YAHOO.util.Dom.addClass(this.close,"close");if(this.isSecure){YAHOO.util.Dom.addClass(this.close,"secure");}else{YAHOO.util.Dom.addClass(this.close,"nonsecure");}\r
+this.close.innerHTML="&nbsp;";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doHide,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}}\r
+YAHOO.widget.Panel.prototype.configDraggable=function(type,args,obj){var val=args[0];if(val){if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}}else{if(this.dd){this.dd.unreg();}\r
+if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","auto");}}}\r
+YAHOO.widget.Panel.prototype.configUnderlay=function(type,args,obj){var val=args[0];switch(val.toLowerCase()){case"shadow":YAHOO.util.Dom.removeClass(this.element,"matte");YAHOO.util.Dom.addClass(this.element,"shadow");if(!this.underlay){this.underlay=document.createElement("DIV");this.underlay.className="underlay";this.underlay.innerHTML="&nbsp;";this.element.appendChild(this.underlay);}\r
+this.sizeUnderlay();break;case"matte":YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.addClass(this.element,"matte");break;case"none":default:YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.removeClass(this.element,"matte");break;}}\r
+YAHOO.widget.Panel.prototype.configModal=function(type,args,obj){var modal=args[0];if(modal){this.buildMask();if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMask,this)){this.showEvent.subscribe(this.showMask,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMask,this)){this.hideEvent.subscribe(this.hideMask,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.sizeMask,this,true);}}else{this.beforeShowEvent.unsubscribe(this.showMask,this);this.hideEvent.unsubscribe(this.hideMask,this);YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.sizeMask);}}\r
+YAHOO.widget.Panel.prototype.configKeyListeners=function(type,args,obj){var listeners=args[0];if(listeners){if(listeners instanceof Array){for(var i=0;i<listeners.length;i++){var listener=listeners[i];if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listener.enable,listener)){this.showEvent.subscribe(listener.enable,listener,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listener.disable,listener)){this.hideEvent.subscribe(listener.disable,listener,true);this.destroyEvent.subscribe(listener.disable,listener,true);}}}else{if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listeners.enable,listeners)){this.showEvent.subscribe(listeners.enable,listeners,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listeners.disable,listeners)){this.hideEvent.subscribe(listeners.disable,listeners,true);this.destroyEvent.subscribe(listeners.disable,listeners,true);}}}}\r
+YAHOO.widget.Panel.prototype.buildWrapper=function(){var elementParent=this.element.parentNode;var elementClone=this.element.cloneNode(true);this.innerElement=elementClone;this.innerElement.style.visibility="inherit";YAHOO.util.Dom.addClass(this.innerElement,YAHOO.widget.Panel.CSS_PANEL);var wrapper=document.createElement("DIV");wrapper.className=YAHOO.widget.Panel.CSS_PANEL_CONTAINER;wrapper.id=elementClone.id+"_c";wrapper.appendChild(elementClone);if(elementParent){elementParent.replaceChild(wrapper,this.element);}\r
+this.element=wrapper;var childNodes=this.innerElement.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}\r
+this.initDefaultConfig();}\r
+YAHOO.widget.Panel.prototype.sizeUnderlay=function(){if(this.underlay&&this.browser!="gecko"&&this.browser!="safari"){this.underlay.style.width=this.innerElement.offsetWidth+"px";this.underlay.style.height=this.innerElement.offsetHeight+"px";}}\r
+YAHOO.widget.Panel.prototype.onDomResize=function(e,obj){YAHOO.widget.Panel.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.sizeUnderlay();},0);};YAHOO.widget.Panel.prototype.registerDragDrop=function(){if(this.header){this.dd=new YAHOO.util.DD(this.element.id,this.id);if(!this.header.id){this.header.id=this.id+"_h";}\r
+var me=this;this.dd.startDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.addClass(me.element,"drag");}\r
+if(me.cfg.getProperty("constraintoviewport")){var offsetHeight=me.element.offsetHeight;var offsetWidth=me.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;this.minX=leftConstraint\r
+this.maxX=rightConstraint;this.constrainX=true;this.minY=topConstraint;this.maxY=bottomConstraint;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}\r
+me.dragEvent.fire("startDrag",arguments);}\r
+this.dd.onDrag=function(){me.syncPosition();me.cfg.refireEvent("iframe");if(this.platform=="mac"&&this.browser=="gecko"){this.showMacGeckoScrollbars();}\r
+me.dragEvent.fire("onDrag",arguments);}\r
+this.dd.endDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.removeClass(me.element,"drag");}\r
+me.dragEvent.fire("endDrag",arguments);}\r
+this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}}\r
+YAHOO.widget.Panel.prototype.buildMask=function(){if(!this.mask){this.mask=document.createElement("DIV");this.mask.id=this.id+"_mask";this.mask.className="mask";this.mask.innerHTML="&nbsp;";var maskClick=function(e,obj){YAHOO.util.Event.stopEvent(e);}\r
+YAHOO.util.Event.addListener(this.mask,maskClick,this);document.body.appendChild(this.mask);}}\r
+YAHOO.widget.Panel.prototype.hideMask=function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";this.hideMaskEvent.fire();YAHOO.util.Dom.removeClass(document.body,"masked");}}\r
+YAHOO.widget.Panel.prototype.showMask=function(){if(this.cfg.getProperty("modal")&&this.mask){YAHOO.util.Dom.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}}\r
+YAHOO.widget.Panel.prototype.sizeMask=function(){if(this.mask){this.mask.style.height=YAHOO.util.Dom.getDocumentHeight()+"px";this.mask.style.width=YAHOO.util.Dom.getDocumentWidth()+"px";}}\r
+YAHOO.widget.Panel.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Panel.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Panel.prototype.render=function(appendToNode){return YAHOO.widget.Panel.superclass.render.call(this,appendToNode,this.innerElement);}\r
+YAHOO.widget.Panel.prototype.toString=function(){return"Panel "+this.id;}\r
+YAHOO.widget.Dialog=function(el,userConfig){YAHOO.widget.Dialog.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.Dialog,YAHOO.widget.Panel);YAHOO.widget.Dialog.CSS_DIALOG="dialog";YAHOO.widget.Dialog.prototype.beforeSubmitEvent=null;YAHOO.widget.Dialog.prototype.submitEvent=null;YAHOO.widget.Dialog.prototype.manualSubmitEvent=null;YAHOO.widget.Dialog.prototype.asyncSubmitEvent=null;YAHOO.widget.Dialog.prototype.formSubmitEvent=null;YAHOO.widget.Dialog.prototype.cancelEvent=null;YAHOO.widget.Dialog.prototype.initDefaultConfig=function(){YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null,scope:this}\r
+this.doSubmit=function(){var method=this.cfg.getProperty("postmethod");switch(method){case"async":YAHOO.util.Connect.setForm(this.form.name);var cObj=YAHOO.util.Connect.asyncRequest('POST',this.form.action,this.callback);this.asyncSubmitEvent.fire();break;case"form":this.form.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}}\r
+this.cfg.addProperty("postmethod",{value:"async",validator:function(val){if(val!="form"&&val!="async"&&val!="none"&&val!="manual"){return false;}else{return true;}}});this.cfg.addProperty("buttons",{value:"none",handler:this.configButtons});}\r
+YAHOO.widget.Dialog.prototype.initEvents=function(){YAHOO.widget.Dialog.superclass.initEvents.call(this);this.beforeSubmitEvent=new YAHOO.util.CustomEvent("beforeSubmit");this.submitEvent=new YAHOO.util.CustomEvent("submit");this.manualSubmitEvent=new YAHOO.util.CustomEvent("manualSubmit");this.asyncSubmitEvent=new YAHOO.util.CustomEvent("asyncSubmit");this.formSubmitEvent=new YAHOO.util.CustomEvent("formSubmit");this.cancelEvent=new YAHOO.util.CustomEvent("cancel");}\r
+YAHOO.widget.Dialog.prototype.init=function(el,userConfig){YAHOO.widget.Dialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Dialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Dialog.CSS_DIALOG);this.cfg.setProperty("visible",false);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.renderEvent.subscribe(this.registerForm,this,true);this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.beforeRenderEvent.subscribe(function(){var buttonCfg=this.cfg.getProperty("buttons");if(buttonCfg&&buttonCfg!="none"){if(!this.footer){this.setFooter("");}}},this,true);this.initEvent.fire(YAHOO.widget.Dialog);}\r
+YAHOO.widget.Dialog.prototype.registerForm=function(){var form=this.element.getElementsByTagName("FORM")[0];if(!form){var formHTML="<form name=\"frm_"+this.id+"\" action=\"\"></form>";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];}\r
+this.firstFormElement=function(){for(var f=0;f<form.elements.length;f++){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;break;}}}\r
+return null;}();this.lastFormElement=function(){for(var f=form.elements.length-1;f>=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;break;}}}\r
+return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}\r
+var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}}\r
+YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("SPAN");this.buttonSpan.className="button-group";for(var b=0;b<buttons.length;b++){var button=buttons[b];var htmlButton=document.createElement("BUTTON");if(button.isDefault){htmlButton.className="default";this.defaultHtmlButton=htmlButton;}\r
+htmlButton.appendChild(document.createTextNode(button.text));YAHOO.util.Event.addListener(htmlButton,"click",button.handler,this,true);this.buttonSpan.appendChild(htmlButton);button.htmlButton=htmlButton;if(b==0){this.firstButton=button.htmlButton;}\r
+if(b==(buttons.length-1)){this.lastButton=button.htmlButton;}}\r
+this.setFooter(this.buttonSpan);this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");}else{if(this.buttonSpan){if(this.buttonSpan.parentNode){this.buttonSpan.parentNode.removeChild(this.buttonSpan);}\r
+this.buttonSpan=null;this.firstButtom=null;this.lastButton=null;this.defaultHtmlButton=null;}}}\r
+YAHOO.widget.Dialog.prototype.configOnSuccess=function(type,args,obj){};YAHOO.widget.Dialog.prototype.configOnFailure=function(type,args,obj){};YAHOO.widget.Dialog.prototype.doSubmit=function(){};YAHOO.widget.Dialog.prototype.focusFirst=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}\r
+if(this.firstFormElement){this.firstFormElement.focus();}else{this.focusDefaultButton();}}\r
+YAHOO.widget.Dialog.prototype.focusLast=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}\r
+var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){this.focusLastButton();}else{if(this.lastFormElement){this.lastFormElement.focus();}}}\r
+YAHOO.widget.Dialog.prototype.focusDefaultButton=function(){if(this.defaultHtmlButton){this.defaultHtmlButton.focus();}}\r
+YAHOO.widget.Dialog.prototype.blurButtons=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.blur();}}}\r
+YAHOO.widget.Dialog.prototype.focusFirstButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.focus();}}}\r
+YAHOO.widget.Dialog.prototype.focusLastButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[buttons.length-1].htmlButton;if(html){html.focus();}}}\r
+YAHOO.widget.Dialog.prototype.validate=function(){return true;}\r
+YAHOO.widget.Dialog.prototype.submit=function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();this.hide();return true;}else{return false;}}\r
+YAHOO.widget.Dialog.prototype.cancel=function(){this.cancelEvent.fire();this.hide();}\r
+YAHOO.widget.Dialog.prototype.getData=function(){var form=this.form;var data={};if(form){for(var i in this.form){var formItem=form[i];if(formItem){if(formItem.tagName){switch(formItem.tagName){case"INPUT":switch(formItem.type){case"checkbox":data[i]=formItem.checked;break;case"textbox":case"text":case"hidden":data[i]=formItem.value;break;}\r
+break;case"TEXTAREA":data[i]=formItem.value;break;case"SELECT":var val=new Array();for(var x=0;x<formItem.options.length;x++){var option=formItem.options[x];if(option.selected){var selval=option.value;if(!selval||selval==""){selval=option.text;}\r
+val[val.length]=selval;}}\r
+data[i]=val;break;}}else if(formItem[0]&&formItem[0].tagName){switch(formItem[0].tagName){case"INPUT":switch(formItem[0].type){case"radio":for(var r=0;r<formItem.length;r++){var radio=formItem[r];if(radio.checked){data[radio.name]=radio.value;break;}}\r
+break;case"checkbox":var cbArray=new Array();for(var c=0;c<formItem.length;c++){var check=formItem[c];if(check.checked){cbArray[cbArray.length]=check.value;}}\r
+data[formItem[0].name]=cbArray;break;}}}}}}\r
+return data;}\r
+YAHOO.widget.Dialog.prototype.toString=function(){return"Dialog "+this.id;}\r
+YAHOO.widget.SimpleDialog=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.SimpleDialog,YAHOO.widget.Dialog);YAHOO.widget.SimpleDialog.ICON_BLOCK="nt/ic/ut/bsc/blck16_1.gif";YAHOO.widget.SimpleDialog.ICON_ALARM="nt/ic/ut/bsc/alrt16_1.gif";YAHOO.widget.SimpleDialog.ICON_HELP="nt/ic/ut/bsc/hlp16_1.gif";YAHOO.widget.SimpleDialog.ICON_INFO="nt/ic/ut/bsc/info16_1.gif";YAHOO.widget.SimpleDialog.ICON_WARN="nt/ic/ut/bsc/warn16_1.gif";YAHOO.widget.SimpleDialog.ICON_TIP="nt/ic/ut/bsc/tip16_1.gif";YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG="simple-dialog";YAHOO.widget.SimpleDialog.prototype.initDefaultConfig=function(){YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);this.cfg.addProperty("icon",{value:"none",handler:this.configIcon,suppressEvent:true});this.cfg.addProperty("text",{value:"",handler:this.configText,suppressEvent:true,supercedes:["icon"]});}\r
+YAHOO.widget.SimpleDialog.prototype.init=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(YAHOO.widget.SimpleDialog);}\r
+YAHOO.widget.SimpleDialog.prototype.registerForm=function(){YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);this.form.innerHTML+="<input type=\"hidden\" name=\""+this.id+"\" value=\"\"/>";}\r
+YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML="<img src=\""+this.imageRoot+icon+"\" class=\"icon\" />";this.body.innerHTML=iconHTML+this.body.innerHTML;}}\r
+YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);this.cfg.refireEvent("icon");}}\r
+YAHOO.widget.SimpleDialog.prototype.toString=function(){return"SimpleDialog "+this.id;}\r
+YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}\r
+this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;}\r
+YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn");this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut");this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete");this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete");this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);}\r
+YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();}\r
+YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();}\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){}\r
+YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}\r
+return output;}\r
+YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}\r
+if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}\r
+YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);}\r
+fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}\r
+if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}\r
+obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();}\r
+fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}}\r
+fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}\r
+YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";}\r
+slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");}\r
+obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");}\r
+slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();}\r
+slide.handleStartAnimateOut=function(type,args,obj){var clientWidth=YAHOO.util.Dom.getViewportWidth();var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var x=pos[0];var y=pos[1];var currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(clientWidth+25),y];}\r
+slide.handleTweenAnimateOut=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var x=pos[0];var y=pos[1];obj.overlay.cfg.setProperty("xy",[x,y],true);obj.overlay.cfg.refireEvent("iframe");}\r
+slide.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");var offsetWidth=obj.overlay.element.offsetWidth;obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;}\r
diff --git a/lib/yui/container/container.js b/lib/yui/container/container.js
new file mode 100755 (executable)
index 0000000..2cabc5e
--- /dev/null
@@ -0,0 +1,3930 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+/**\r
+* @class \r
+* Config is a utility used within an object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+* @constructor\r
+*/\r
+YAHOO.util.Config = function(owner) {\r
+       if (owner) {\r
+               this.init(owner);\r
+       }\r
+}\r
+\r
+YAHOO.util.Config.prototype = {\r
+       \r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * @type object\r
+       */\r
+       owner : null,\r
+\r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * args: key, value\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       configChangedEvent : null,\r
+\r
+       /**\r
+       * Boolean flag that specifies whether a queue is currently being executed\r
+       * @type boolean\r
+       */\r
+       queueInProgress : false,\r
+\r
+       /**\r
+       * Adds a property to the Config object's private config hash. \r
+       * @param {string}       key     The configuration property's name\r
+       * @param {object}       propertyObject  The object containing all of this property's arguments\r
+       */\r
+       addProperty : function(key, propertyObject){},\r
+\r
+       /**\r
+       * Returns a key-value configuration map of the values currently set in the Config object.\r
+       * @return {object} The current config, represented in a key-value map\r
+       */\r
+       getConfig : function(){},\r
+\r
+       /**\r
+       * Returns the value of specified property.\r
+       * @param {key}          The name of the property\r
+       * @return {object}      The value of the specified property\r
+       */\r
+       getProperty : function(key){},\r
+\r
+       /**\r
+       * Resets the specified property's value to its initial value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       resetProperty : function(key){},\r
+\r
+       /**\r
+       * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @param {boolean}      Whether the value should be set silently, without firing the property event.\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */\r
+       setProperty : function(key,value,silent){},\r
+\r
+       /**\r
+       * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is\r
+       * moved from its current position to the end of the queue.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */      \r
+       queueProperty : function(key,value){},\r
+\r
+       /**\r
+       * Fires the event for a property using the property's current value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       refireEvent : function(key){},\r
+\r
+       /**\r
+       * Applies a key-value object literal to the configuration, replacing any existing values, and queueing the property events.\r
+       * Although the values will be set, fireQueue() must be called for their associated events to execute.\r
+       * @param {object}       userConfig      The configuration object literal\r
+       * @param {boolean}      init            When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.\r
+       */\r
+       applyConfig : function(userConfig,init){},\r
+\r
+       /**\r
+       * Refires the events for all configuration properties using their current values.\r
+       */\r
+       refresh : function(){},\r
+\r
+       /**\r
+       * Fires the normalized list of queued property change events\r
+       */\r
+       fireQueue : function(){},\r
+\r
+       /**\r
+       * Subscribes an external handler to the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       * @param {boolean}      override        Optional. If true, will override "this" within the handler to map to the scope object passed into the method.\r
+       */      \r
+       subscribeToConfigEvent : function(key,handler,obj,override){},\r
+\r
+       /**\r
+       * Unsubscribes an external handler from the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       */\r
+       unsubscribeFromConfigEvent: function(key,handler,obj){},\r
+\r
+       /**\r
+       * Validates that the value passed in is a boolean.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */      \r
+       checkBoolean: function(val) {\r
+               if (typeof val == 'boolean') {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Validates that the value passed in is a number.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */\r
+       checkNumber: function(val) {\r
+               if (isNaN(val)) {\r
+                       return false;\r
+               } else {\r
+                       return true;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* Initializes the configuration object and all of its local members.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+*/\r
+YAHOO.util.Config.prototype.init = function(owner) {\r
+\r
+       this.owner = owner;\r
+       this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");\r
+       this.queueInProgress = false;\r
+\r
+       /* Private Members */\r
+\r
+       var config = {};\r
+       var initialConfig = {};\r
+       var eventQueue = [];\r
+\r
+       /**\r
+       * @private\r
+       * Fires a configuration property event using the specified value. \r
+       * @param {string}       key                     The configuration property's name\r
+       * @param {value}        object          The value of the correct type for the property\r
+       */ \r
+       var fireEvent = function( key, value ) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       property.event.fire(value);\r
+               }       \r
+       }\r
+       /* End Private Members */\r
+\r
+       this.addProperty = function( key, propertyObject ) {\r
+               key = key.toLowerCase();\r
+\r
+               config[key] = propertyObject;\r
+\r
+               propertyObject.event = new YAHOO.util.CustomEvent(key);\r
+               propertyObject.key = key;\r
+\r
+               if (propertyObject.handler) {\r
+                       propertyObject.event.subscribe(propertyObject.handler, this.owner, true);\r
+               }\r
+\r
+               this.setProperty(key, propertyObject.value, true);\r
+               \r
+               if (! propertyObject.suppressEvent) {\r
+                       this.queueProperty(key, propertyObject.value);\r
+               }\r
+       }\r
+\r
+       this.getConfig = function() {\r
+               var cfg = {};\r
+                       \r
+               for (var prop in config) {\r
+                       var property = config[prop]\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               cfg[prop] = property.value;\r
+                       }\r
+               }\r
+               \r
+               return cfg;\r
+       }\r
+\r
+       this.getProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.value;\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.resetProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       this.setProperty(key, initialConfig[key].value);\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.setProperty = function(key, value, silent) {\r
+               key = key.toLowerCase();\r
+\r
+               if (this.queueInProgress && ! silent) {\r
+                       this.queueProperty(key,value); // Currently running through a queue... \r
+                       return true;\r
+               } else {\r
+                       var property = config[key];\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               if (property.validator && ! property.validator(value)) { // validator\r
+                                       return false;\r
+                               } else {\r
+                                       property.value = value;\r
+                                       if (! silent) {\r
+                                               fireEvent(key, value);\r
+                                               this.configChangedEvent.fire([key, value]);\r
+                                       }\r
+                                       return true;\r
+                               }\r
+                       } else {\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.queueProperty = function(key, value) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+                                                       \r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator\r
+                               return false;\r
+                       } else {\r
+\r
+                               if (typeof value != 'undefined') {\r
+                                       property.value = value;\r
+                               } else {\r
+                                       value = property.value;\r
+                               }\r
+\r
+                               var foundDuplicate = false;\r
+\r
+                               for (var i=0;i<eventQueue.length;i++) {\r
+                                       var queueItem = eventQueue[i];\r
+\r
+                                       if (queueItem) {\r
+                                               var queueItemKey = queueItem[0];\r
+                                               var queueItemValue = queueItem[1];\r
+                                               \r
+                                               if (queueItemKey.toLowerCase() == key) {\r
+                                                       // found a dupe... push to end of queue, null current item, and break\r
+                                                       eventQueue[i] = null;\r
+                                                       eventQueue.push([key, (typeof value != 'undefined' ? value : queueItemValue)]);\r
+                                                       foundDuplicate = true;\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+                               \r
+                               if (! foundDuplicate && typeof value != 'undefined') { // this is a refire, or a new property in the queue\r
+                                       eventQueue.push([key, value]);\r
+                               }\r
+                       }\r
+\r
+                       if (property.supercedes) {\r
+                               for (var s=0;s<property.supercedes.length;s++) {\r
+                                       var supercedesCheck = property.supercedes[s];\r
+\r
+                                       for (var q=0;q<eventQueue.length;q++) {\r
+                                               var queueItemCheck = eventQueue[q];\r
+\r
+                                               if (queueItemCheck) {\r
+                                                       var queueItemCheckKey = queueItemCheck[0];\r
+                                                       var queueItemCheckValue = queueItemCheck[1];\r
+                                                       \r
+                                                       if ( queueItemCheckKey.toLowerCase() == supercedesCheck.toLowerCase() ) {\r
+                                                               eventQueue.push([queueItemCheckKey, queueItemCheckValue]);\r
+                                                               eventQueue[q] = null;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.refireEvent = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event && typeof property.value != 'undefined') {\r
+                       if (this.queueInProgress) {\r
+                               this.queueProperty(key);\r
+                       } else {\r
+                               fireEvent(key, property.value);\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.applyConfig = function(userConfig, init) {\r
+               if (init) {\r
+                       initialConfig = userConfig;\r
+               }\r
+               for (var prop in userConfig) {\r
+                       this.queueProperty(prop, userConfig[prop]);\r
+               }\r
+       }\r
+\r
+       this.refresh = function() {\r
+               for (var prop in config) {\r
+                       this.refireEvent(prop);\r
+               }\r
+       }\r
+\r
+       this.fireQueue = function() {\r
+               this.queueInProgress = true;\r
+               for (var i=0;i<eventQueue.length;i++) {\r
+                       var queueItem = eventQueue[i];\r
+                       if (queueItem) {\r
+                               var key = queueItem[0];\r
+                               var value = queueItem[1];\r
+                               \r
+                               var property = config[key];\r
+                               property.value = value;\r
+\r
+                               fireEvent(key,value);\r
+                       }\r
+               }\r
+               \r
+               this.queueInProgress = false;\r
+               eventQueue = new Array();\r
+       }\r
+\r
+       this.subscribeToConfigEvent = function(key, handler, obj, override) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {\r
+                               property.event.subscribe(handler, obj, override);\r
+                       }\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+\r
+       this.unsubscribeFromConfigEvent = function(key, handler, obj) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.event.unsubscribe(handler, obj);\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.toString = function() {\r
+               var output = "Config";\r
+               if (this.owner) {\r
+                       output += " [" + this.owner.toString() + "]";\r
+               }\r
+               return output;\r
+       }\r
+\r
+       this.outputEventQueue = function() {\r
+               var output = "";\r
+               for (var q=0;q<eventQueue.length;q++) {\r
+                       var queueItem = eventQueue[q];\r
+                       if (queueItem) {\r
+                               output += queueItem[0] + "=" + queueItem[1] + ", ";\r
+                       }\r
+               }\r
+               return output;\r
+       }\r
+}\r
+\r
+/**\r
+* Checks to determine if a particular function/object pair are already subscribed to the specified CustomEvent\r
+* @param {YAHOO.util.CustomEvent} evt  The CustomEvent for which to check the subscriptions\r
+* @param {Function}    fn      The function to look for in the subscribers list\r
+* @param {object}      obj     The execution scope object for the subscription\r
+* @return {boolean}    true, if the function/object pair is already subscribed to the CustomEvent passed in\r
+*/\r
+YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {\r
+       for (var e=0;e<evt.subscribers.length;e++) {\r
+               var subsc = evt.subscribers[e];\r
+               if (subsc && subsc.obj == obj && subsc.fn == fn) {\r
+                       return true;\r
+                       break;\r
+               }\r
+       }\r
+       return false;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class \r
+* Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.\r
+* @param {string}      el      The element ID representing the Module <em>OR</em>\r
+* @param {Element}     el      The element representing the Module\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Module = function(el, userConfig) {\r
+       if (el) { \r
+               this.init(el, userConfig); \r
+       }\r
+}\r
+\r
+/**\r
+* Constant representing the prefix path to use for non-secure images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";\r
+\r
+/**\r
+* Constant representing the prefix path to use for securely served images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";\r
+\r
+/**\r
+* Constant for the default CSS class name that represents a Module\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_MODULE = "module";\r
+\r
+/**\r
+* Constant representing the module header\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_HEADER = "hd";\r
+\r
+/**\r
+* Constant representing the module body\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_BODY = "bd";\r
+\r
+/**\r
+* Constant representing the module footer\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_FOOTER = "ft";\r
+\r
+/**\r
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = null;\r
+\r
+YAHOO.widget.Module.prototype = {\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type function\r
+       */\r
+       constructor : YAHOO.widget.Module,\r
+\r
+       /**\r
+       * The main module element that contains the header, body, and footer\r
+       * @type Element\r
+       */\r
+       element : null, \r
+\r
+       /**\r
+       * The header element, denoted with CSS class "hd"\r
+       * @type Element\r
+       */\r
+       header : null,\r
+\r
+       /**\r
+       * The body element, denoted with CSS class "bd"\r
+       * @type Element\r
+       */\r
+       body : null,\r
+\r
+       /**\r
+       * The footer element, denoted with CSS class "ft"\r
+       * @type Element\r
+       */\r
+       footer : null,\r
+\r
+       /**\r
+       * The id of the element\r
+       * @type string\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * Array of elements\r
+       * @type Element[]\r
+       */\r
+       childNodesInDOM : null,\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot : YAHOO.widget.Module.IMG_ROOT,\r
+\r
+       /**\r
+       * CustomEvent fired prior to class initalization.\r
+       * args: class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeInitEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after class initalization.\r
+       * args: class reference of the initializing class, such as this.initEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       initEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is appended to the DOM\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       appendEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeRenderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       renderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the header content of the Module is modified\r
+       * args: string/element representing the new header content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeHeaderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the body content of the Module is modified\r
+       * args: string/element representing the new body content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeBodyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the footer content of the Module is modified\r
+       * args: string/element representing the new footer content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeFooterEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the content of the Module is modified\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeContentEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is destroyed\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       destroyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeShowEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       showEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeHideEvent : null,\r
+       \r
+       /**\r
+       * CustomEvent fired after the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       hideEvent : null,\r
+               \r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initEvents : function() {\r
+\r
+               this.beforeInitEvent            = new YAHOO.util.CustomEvent("beforeInit");\r
+               this.initEvent                          = new YAHOO.util.CustomEvent("init");\r
+\r
+               this.appendEvent                        = new YAHOO.util.CustomEvent("append");\r
+\r
+               this.beforeRenderEvent          = new YAHOO.util.CustomEvent("beforeRender");\r
+               this.renderEvent                        = new YAHOO.util.CustomEvent("render");\r
+\r
+               this.changeHeaderEvent          = new YAHOO.util.CustomEvent("changeHeader");\r
+               this.changeBodyEvent            = new YAHOO.util.CustomEvent("changeBody");\r
+               this.changeFooterEvent          = new YAHOO.util.CustomEvent("changeFooter");\r
+\r
+               this.changeContentEvent         = new YAHOO.util.CustomEvent("changeContent");\r
+\r
+               this.destroyEvent                       = new YAHOO.util.CustomEvent("destroy");\r
+               this.beforeShowEvent            = new YAHOO.util.CustomEvent("beforeShow");\r
+               this.showEvent                          = new YAHOO.util.CustomEvent("show");\r
+               this.beforeHideEvent            = new YAHOO.util.CustomEvent("beforeHide");\r
+               this.hideEvent                          = new YAHOO.util.CustomEvent("hide");\r
+       }, \r
+\r
+       /**\r
+       * String representing the current user-agent platform\r
+       * @type string\r
+       */\r
+       platform : function() {\r
+                                       var ua = navigator.userAgent.toLowerCase();\r
+                                       if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {\r
+                                               return "windows";\r
+                                       } else if (ua.indexOf("macintosh") != -1) {\r
+                                               return "mac";\r
+                                       } else {\r
+                                               return false;\r
+                                       }\r
+                               }(),\r
+\r
+       /**\r
+       * String representing the current user-agent browser\r
+       * @type string\r
+       */\r
+       browser : function() {\r
+                       var ua = navigator.userAgent.toLowerCase();\r
+                                 if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)\r
+                                        return 'opera';\r
+                                 } else if (ua.indexOf('msie 7')!=-1) { // IE7\r
+                                        return 'ie7';\r
+                                 } else if (ua.indexOf('msie') !=-1) { // IE\r
+                                        return 'ie';\r
+                                 } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")\r
+                                        return 'safari';\r
+                                 } else if (ua.indexOf('gecko') != -1) { // Gecko\r
+                                        return 'gecko';\r
+                                 } else {\r
+                                        return false;\r
+                                 }\r
+                       }(),\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure : function() {\r
+               if (window.location.href.toLowerCase().indexOf("https") == 0) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }(),\r
+\r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initDefaultConfig : function() {\r
+               // Add properties //\r
+\r
+               this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );\r
+               this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );\r
+               this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );\r
+       },\r
+\r
+       /**\r
+       * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+       * @param {string}       el      The element ID representing the Module <em>OR</em>\r
+       * @param {Element}      el      The element representing the Module\r
+       * @param {object}       userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+       */\r
+       init : function(el, userConfig) {\r
+\r
+               this.initEvents();\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Module);\r
+\r
+               this.cfg = new YAHOO.util.Config(this);\r
+               \r
+               if (this.isSecure) {\r
+                       this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;\r
+               }\r
+\r
+               if (typeof el == "string") {\r
+                       var elId = el;\r
+\r
+                       el = document.getElementById(el);\r
+                       if (! el) {\r
+                               el = document.createElement("DIV");\r
+                               el.id = elId;\r
+                       }\r
+               }\r
+\r
+               this.element = el;\r
+               \r
+               if (el.id) {\r
+                       this.id = el.id;\r
+               } \r
+\r
+               var childNodes = this.element.childNodes;\r
+\r
+               if (childNodes) {\r
+                       for (var i=0;i<childNodes.length;i++) {\r
+                               var child = childNodes[i];\r
+                               switch (child.className) {\r
+                                       case YAHOO.widget.Module.CSS_HEADER:\r
+                                               this.header = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_BODY:\r
+                                               this.body = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_FOOTER:\r
+                                               this.footer = child;\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               this.initDefaultConfig();\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+\r
+               // Subscribe to the fireQueue() method of Config so that any queued configuration changes are\r
+               // excecuted upon render of the Module\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {\r
+                       this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);\r
+               }\r
+\r
+               this.initEvent.fire(YAHOO.widget.Module);\r
+       },\r
+\r
+       /**\r
+       * Initialized an empty DOM element that is placed out of the visible area that can be used to detect text resize.\r
+       */\r
+       initResizeMonitor : function() {\r
+\r
+        if(this.browser != "opera") {\r
+\r
+            var resizeMonitor = document.getElementById("_yuiResizeMonitor");\r
+    \r
+            if (! resizeMonitor) {\r
+    \r
+                resizeMonitor = document.createElement("iframe");\r
+    \r
+                var bIE = (this.browser.indexOf("ie") === 0);\r
+    \r
+                if(this.isSecure && this.RESIZE_MONITOR_SECURE_URL && bIE) {\r
+    \r
+                    resizeMonitor.src = this.RESIZE_MONITOR_SECURE_URL;\r
+    \r
+                }\r
+                \r
+                resizeMonitor.id = "_yuiResizeMonitor";\r
+                resizeMonitor.style.visibility = "hidden";\r
+                \r
+                document.body.appendChild(resizeMonitor);\r
+    \r
+                resizeMonitor.style.width = "10em";\r
+                resizeMonitor.style.height = "10em";\r
+                resizeMonitor.style.position = "absolute";\r
+                \r
+                var nLeft = -1 * resizeMonitor.offsetWidth,\r
+                    nTop = -1 * resizeMonitor.offsetHeight;\r
+    \r
+                resizeMonitor.style.top = nTop + "px";\r
+                resizeMonitor.style.left =  nLeft + "px";\r
+                resizeMonitor.style.borderStyle = "none";\r
+                resizeMonitor.style.borderWidth = "0";\r
+                YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0");\r
+                \r
+                resizeMonitor.style.visibility = "visible";\r
+    \r
+                if(!bIE) {\r
+    \r
+                    var doc = resizeMonitor.contentWindow.document;\r
+    \r
+                    doc.open();\r
+                    doc.close();\r
+                \r
+                }\r
+    \r
+            }\r
+    \r
+            if(resizeMonitor && resizeMonitor.contentWindow) {\r
+    \r
+                this.resizeMonitor = resizeMonitor;\r
+    \r
+                YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true);\r
+    \r
+            }\r
+        \r
+        }\r
+\r
+       },\r
+\r
+       /**\r
+       * Event handler fired when the resize monitor element is resized.\r
+       */\r
+       onDomResize : function(e, obj) { \r
+\r
+        var nLeft = -1 * this.resizeMonitor.offsetWidth,\r
+            nTop = -1 * this.resizeMonitor.offsetHeight;\r
+        \r
+        this.resizeMonitor.style.top = nTop + "px";\r
+        this.resizeMonitor.style.left =  nLeft + "px";\r
+       \r
+       },\r
+\r
+       /**\r
+       * Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {string}       headerContent   The HTML used to set the header <em>OR</em>\r
+       * @param {Element}      headerContent   The Element to append to the header\r
+       */      \r
+       setHeader : function(headerContent) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               if (typeof headerContent == "string") {\r
+                       this.header.innerHTML = headerContent;\r
+               } else {\r
+                       this.header.innerHTML = "";\r
+                       this.header.appendChild(headerContent);\r
+               }\r
+\r
+               this.changeHeaderEvent.fire(headerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the header\r
+       */      \r
+       appendToHeader : function(element) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               this.header.appendChild(element);\r
+               this.changeHeaderEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {string}       bodyContent     The HTML used to set the body <em>OR</em>\r
+       * @param {Element}      bodyContent     The Element to append to the body\r
+       */              \r
+       setBody : function(bodyContent) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               if (typeof bodyContent == "string")\r
+               {\r
+                       this.body.innerHTML = bodyContent;\r
+               } else {\r
+                       this.body.innerHTML = "";\r
+                       this.body.appendChild(bodyContent);\r
+               }\r
+\r
+               this.changeBodyEvent.fire(bodyContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the body\r
+       */\r
+       appendToBody : function(element) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               this.body.appendChild(element);\r
+               this.changeBodyEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {string}       footerContent   The HTML used to set the footer <em>OR</em>\r
+       * @param {Element}      footerContent   The Element to append to the footer\r
+       */      \r
+       setFooter : function(footerContent) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               if (typeof footerContent == "string") {\r
+                       this.footer.innerHTML = footerContent;\r
+               } else {\r
+                       this.footer.innerHTML = "";\r
+                       this.footer.appendChild(footerContent);\r
+               }\r
+\r
+               this.changeFooterEvent.fire(footerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the footer\r
+       */\r
+       appendToFooter : function(element) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               this.footer.appendChild(element);\r
+               this.changeFooterEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+       * @param {string}       appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+       * @param {Element}      appendToNode    The element to which the Module should be appended to prior to rendering        \r
+       * @param {Element}      moduleElement   OPTIONAL. The element that represents the actual Standard Module container. \r
+       * @return {boolean} Success or failure of the render\r
+       */\r
+       render : function(appendToNode, moduleElement) {\r
+               this.beforeRenderEvent.fire();\r
+\r
+               if (! moduleElement) {\r
+                       moduleElement = this.element;\r
+               }\r
+\r
+               var me = this;\r
+               var appendTo = function(element) {\r
+                       if (typeof element == "string") {\r
+                               element = document.getElementById(element);\r
+                       }\r
+                       \r
+                       if (element) {\r
+                               element.appendChild(me.element);\r
+                               me.appendEvent.fire();\r
+                       }\r
+               }\r
+\r
+               if (appendToNode) {\r
+                       appendTo(appendToNode);\r
+               } else { // No node was passed in. If the element is not pre-marked up, this fails\r
+                       if (! YAHOO.util.Dom.inDocument(this.element)) {\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               // Need to get everything into the DOM if it isn't already\r
+               \r
+               if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {\r
+                       // There is a header, but it's not in the DOM yet... need to add it\r
+                       var firstChild = moduleElement.firstChild;\r
+                       if (firstChild) { // Insert before first child if exists\r
+                               moduleElement.insertBefore(this.header, firstChild);\r
+                       } else { // Append to empty body because there are no children\r
+                               moduleElement.appendChild(this.header);\r
+                       }\r
+               }\r
+\r
+               if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {\r
+                       // There is a body, but it's not in the DOM yet... need to add it\r
+                       if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM\r
+                               moduleElement.insertBefore(this.body, this.footer);\r
+                       } else { // Append to element because there is no footer\r
+                               moduleElement.appendChild(this.body);\r
+                       }\r
+               }\r
+\r
+               if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {\r
+                       // There is a footer, but it's not in the DOM yet... need to add it\r
+                       moduleElement.appendChild(this.footer);\r
+               }\r
+\r
+               this.renderEvent.fire();\r
+               return true;\r
+       },\r
+\r
+       /**\r
+       * Removes the Module element from the DOM and sets all child elements to null.\r
+       */\r
+       destroy : function() {\r
+               if (this.element) {\r
+                       var parent = this.element.parentNode;\r
+               }\r
+               if (parent) {\r
+                       parent.removeChild(this.element);\r
+               }\r
+\r
+               this.element = null;\r
+               this.header = null;\r
+               this.body = null;\r
+               this.footer = null;\r
+\r
+               this.destroyEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.\r
+       */\r
+       show : function() {\r
+               this.cfg.setProperty("visible", true);\r
+       },\r
+\r
+       /**\r
+       * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.\r
+       */\r
+       hide : function() {\r
+               this.cfg.setProperty("visible", false);\r
+       },\r
+\r
+       // BUILT-IN EVENT HANDLERS FOR MODULE //\r
+\r
+       /**\r
+       * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".\r
+       * This method is responsible for firing showEvent and hideEvent.\r
+       */\r
+       configVisible : function(type, args, obj) {\r
+               var visible = args[0];\r
+               if (visible) {\r
+                       this.beforeShowEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "block");\r
+                       this.showEvent.fire();\r
+               } else {\r
+                       this.beforeHideEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "none");\r
+                       this.hideEvent.fire();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Default event handler for the "monitorresize" configuration property\r
+       */\r
+       configMonitorResize : function(type, args, obj) {\r
+               var monitor = args[0];\r
+               if (monitor) {\r
+                       this.initResizeMonitor();\r
+               } else {\r
+                       YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);\r
+                       this.resizeMonitor = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Module.prototype.toString = function() {\r
+       return "Module " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Overlay = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);\r
+\r
+/**\r
+* The URL of the blank image that will be placed in the iframe\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.IFRAME_SRC = "promo/m/irs/blank.gif";\r
+\r
+/**\r
+* Constant representing the top left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_LEFT = "tl";\r
+\r
+/**\r
+* Constant representing the top right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";\r
+\r
+/**\r
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";\r
+\r
+/**\r
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";\r
+\r
+/**\r
+* Constant representing the default CSS class used for an Overlay\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";\r
+\r
+/**\r
+* CustomEvent fired before the Overlay is moved.\r
+* args: x,y that the Overlay will be moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.beforeMoveEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the Overlay is moved.\r
+* args: x,y that the Overlay was moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Overlay);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       if (this.platform == "mac" && this.browser == "gecko") {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {\r
+                       this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {\r
+                       this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);\r
+               }\r
+       }\r
+\r
+       this.initEvent.fire(YAHOO.widget.Overlay);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.\r
+*/\r
+YAHOO.widget.Overlay.prototype.initEvents = function() {\r
+       YAHOO.widget.Overlay.superclass.initEvents.call(this);\r
+\r
+       this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);\r
+       this.moveEvent = new YAHOO.util.CustomEvent("move", this);\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add overlay config properties //\r
+       this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );\r
+\r
+       this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );\r
+\r
+       this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );\r
+       this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );\r
+}\r
+\r
+/**\r
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);\r
+* @param {int} x       The Overlay's new x position\r
+* @param {int} y       The Overlay's new y position\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {\r
+       this.cfg.setProperty("xy",[x,y]);\r
+}\r
+\r
+/**\r
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");\r
+}\r
+\r
+/**\r
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "show-scrollbars");\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {\r
+       var visible = args[0];\r
+       var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");\r
+\r
+       var effect = this.cfg.getProperty("effect");\r
+\r
+       var effectInstances = new Array();\r
+       if (effect) {\r
+               if (effect instanceof Array) {\r
+                       for (var i=0;i<effect.length;i++) {\r
+                               var eff = effect[i];\r
+                               effectInstances[effectInstances.length] = eff.effect(this, eff.duration);\r
+                       }\r
+               } else {\r
+                       effectInstances[effectInstances.length] = effect.effect(this, effect.duration);\r
+               }\r
+       }\r
+\r
+       var isMacGecko = (this.platform == "mac" && this.browser == "gecko");\r
+\r
+       if (visible) { // Show\r
+               if (isMacGecko) {\r
+                       this.showMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate in\r
+                       if (visible) { // Animate in if not showing\r
+                               if (currentVis != "visible") {\r
+                                       this.beforeShowEvent.fire();\r
+                                       for (var i=0;i<effectInstances.length;i++) {\r
+                                               var e = effectInstances[i];\r
+                                               if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)) {\r
+                                                       e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true); // Delegate showEvent until end of animateInComplete\r
+                                               }\r
+                                               e.animateIn();\r
+                                       }\r
+                               }\r
+                       }\r
+               } else { // Show\r
+                       if (currentVis != "visible") {\r
+                               this.beforeShowEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "visible");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.showEvent.fire();\r
+                       }\r
+               }\r
+\r
+       } else { // Hide\r
+               if (isMacGecko) {\r
+                       this.hideMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate out if showing\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               for (var i=0;i<effectInstances.length;i++) {\r
+                                       var e = effectInstances[i];\r
+                                       if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)) {                            \r
+                                               e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true); // Delegate hideEvent until end of animateOutComplete\r
+                                       }\r
+                                       e.animateOut();\r
+                               }\r
+                       }\r
+               } else { // Simple hide\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.hideEvent.fire();\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+/**\r
+* Center event handler used for centering on scroll/resize, but only if the Overlay is visible\r
+*/\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function() {\r
+       if (this.cfg.getProperty("visible")) {\r
+               this.center();\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "fixedcenter" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configFixedCenter = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       if (val) {\r
+               this.center();\r
+                       \r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) {\r
+                       this.beforeShowEvent.subscribe(this.center, this, true);\r
+               }\r
+               \r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);\r
+               }\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe( this.doCenterOnDOMEvent, this, true);\r
+               }\r
+       } else {\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "zIndex" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {\r
+       var zIndex = args[0];\r
+\r
+       var el = this.element;\r
+\r
+       if (! zIndex) {\r
+               zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");\r
+               if (! zIndex || isNaN(zIndex)) {\r
+                       zIndex = 0;\r
+               }\r
+       }\r
+\r
+       if (this.iframe) {\r
+               if (zIndex <= 0) {\r
+                       zIndex = 1;\r
+               }\r
+               YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));\r
+       }\r
+\r
+       YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);\r
+       this.cfg.setProperty("zIndex", zIndex, true);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "xy" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {\r
+       var pos = args[0];\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       this.cfg.setProperty("x", x);\r
+       this.cfg.setProperty("y", y);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x,y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "x" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {\r
+       var x = args[0];\r
+       var y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setX(this.element, x, true);\r
+       \r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "y" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {\r
+       var x = this.cfg.getProperty("x");\r
+       var y = args[0];\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setY(this.element, y, true);\r
+\r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "iframe" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {\r
+\r
+       var val = args[0];\r
+\r
+       var el = this.element;\r
+       \r
+       var showIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "block";\r
+               }\r
+       }\r
+\r
+       var hideIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+       }\r
+\r
+       if (val) { // IFRAME shim is enabled\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, showIframe, this)) {\r
+                       this.showEvent.subscribe(showIframe, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, hideIframe, this)) {\r
+                       this.hideEvent.subscribe(hideIframe, this, true);\r
+               }\r
+\r
+               var x = this.cfg.getProperty("x");\r
+               var y = this.cfg.getProperty("y");\r
+\r
+               if (! x || ! y) {\r
+                       this.syncPosition();\r
+                       x = this.cfg.getProperty("x");\r
+                       y = this.cfg.getProperty("y");\r
+               }\r
+\r
+               if (! isNaN(x) && ! isNaN(y)) {\r
+                       if (! this.iframe) {\r
+                               this.iframe = document.createElement("iframe");\r
+                               if (this.isSecure) {\r
+                                       this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC;\r
+                               }\r
+                               \r
+                               var parent = el.parentNode;\r
+                               if (parent) {\r
+                                       parent.appendChild(this.iframe);\r
+                               } else {\r
+                                       document.body.appendChild(this.iframe);\r
+                               }\r
+\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "border", "none");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");\r
+                               if (this.cfg.getProperty("visible")) {\r
+                                       showIframe.call(this);\r
+                               } else {\r
+                                       hideIframe.call(this);\r
+                               }\r
+                       }\r
+                       \r
+                       var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "block";\r
+                       }\r
+\r
+                       YAHOO.util.Dom.setXY(this.iframe, [x,y]);\r
+\r
+                       var width = el.clientWidth;\r
+                       var height = el.clientHeight;\r
+\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "none";\r
+                       }\r
+               }\r
+       } else {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+               this.showEvent.unsubscribe(showIframe, this);\r
+               this.hideEvent.unsubscribe(hideIframe, this);\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* The default event handler fired when the "constraintoviewport" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {\r
+                       this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);\r
+               }\r
+       } else {\r
+               this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {\r
+       var contextArgs = args[0];\r
+\r
+       if (contextArgs) {\r
+               var contextEl = contextArgs[0];\r
+               var elementMagnetCorner = contextArgs[1];\r
+               var contextMagnetCorner = contextArgs[2];\r
+\r
+               if (contextEl) {\r
+                       if (typeof contextEl == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);\r
+                       }\r
+                       \r
+                       if (elementMagnetCorner && contextMagnetCorner) {\r
+                               this.align(elementMagnetCorner, contextMagnetCorner);\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.\r
+* @param {string} elementAlign         The string representing the corner of the Overlay that should be aligned to the context element\r
+* @param {string} contextAlign         The corner of the context element that the elementAlign corner should stick to.\r
+*/\r
+YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {\r
+       var contextArgs = this.cfg.getProperty("context");\r
+       if (contextArgs) {\r
+               var context = contextArgs[0];\r
+               \r
+               var element = this.element;\r
+               var me = this;\r
+\r
+               if (! elementAlign) {\r
+                       elementAlign = contextArgs[1];\r
+               }\r
+\r
+               if (! contextAlign) {\r
+                       contextAlign = contextArgs[2];\r
+               }\r
+\r
+               if (element && context) {\r
+                       var elementRegion = YAHOO.util.Dom.getRegion(element);\r
+                       var contextRegion = YAHOO.util.Dom.getRegion(context);\r
+\r
+                       var doAlign = function(v,h) {\r
+                               switch (elementAlign) {\r
+                                       case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                               me.moveTo(h,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                               me.moveTo(h,v-element.offsetHeight);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v-element.offsetHeight);\r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       switch (contextAlign) {\r
+                               case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                       doAlign(contextRegion.top, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                       doAlign(contextRegion.top, contextRegion.right);\r
+                                       break;          \r
+                               case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.right);\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.\r
+*/\r
+YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {\r
+       var pos = args[0];\r
+\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       var width = parseInt(this.cfg.getProperty("width"));\r
+\r
+       if (isNaN(width)) {\r
+               width = 0;\r
+       }\r
+\r
+       var offsetHeight = this.element.offsetHeight;\r
+       var offsetWidth = (width>0?width:this.element.offsetWidth); //this.element.offsetWidth;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+       var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+       var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+       var topConstraint = scrollY + 10;\r
+       var leftConstraint = scrollX + 10;\r
+       var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+       var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+       \r
+       if (x < leftConstraint) {\r
+               x = leftConstraint;\r
+       } else if (x > rightConstraint) {\r
+               x = rightConstraint;\r
+       }\r
+\r
+       if (y < topConstraint) {\r
+               y = topConstraint;\r
+       } else if (y > bottomConstraint) {\r
+               y = bottomConstraint;\r
+       }\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+       this.cfg.setProperty("xy", [x,y], true);\r
+}\r
+\r
+/**\r
+* Centers the container in the viewport.\r
+*/\r
+YAHOO.widget.Overlay.prototype.center = function() {\r
+       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getClientWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getClientHeight();\r
+\r
+       var elementWidth = this.element.offsetWidth;\r
+       var elementHeight = this.element.offsetHeight;\r
+\r
+       var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;\r
+       var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;\r
+       \r
+       this.element.style.left = parseInt(x) + "px";\r
+       this.element.style.top = parseInt(y) + "px";\r
+       this.syncPosition();\r
+\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.\r
+*/\r
+YAHOO.widget.Overlay.prototype.syncPosition = function() {\r
+       var pos = YAHOO.util.Dom.getXY(this.element);\r
+       this.cfg.setProperty("x", pos[0], true);\r
+       this.cfg.setProperty("y", pos[1], true);\r
+       this.cfg.setProperty("xy", pos, true);\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {\r
+       YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Removes the Overlay element from the DOM and sets all child elements to null.\r
+*/\r
+YAHOO.widget.Overlay.prototype.destroy = function() {\r
+       if (this.iframe) {\r
+               this.iframe.parentNode.removeChild(this.iframe);\r
+       }\r
+       \r
+       this.iframe = null;\r
+\r
+       YAHOO.widget.Overlay.superclass.destroy.call(this);  \r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Overlay.prototype.toString = function() {\r
+       return "Overlay " + this.id;\r
+}\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window scroll\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window resize\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window scroll\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowScrollEvent.fire();\r
+}\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window resize\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowResizeEvent.fire();\r
+}\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Overlay._initialized == null;\r
+\r
+if (YAHOO.widget.Overlay._initialized == null) {\r
+       YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);\r
+       YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);\r
+\r
+       YAHOO.widget.Overlay._initialized = true;\r
+}\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* OverlayManager is used for maintaining the focus status of multiple Overlays.\r
+* @param {Array}       overlays        Optional. A collection of Overlays to register with the manager.\r
+* @param {object}      userConfig              The object literal representing the user configuration of the OverlayManager\r
+* @constructor\r
+*/\r
+YAHOO.widget.OverlayManager = function(userConfig) {\r
+       this.init(userConfig);\r
+}\r
+\r
+/**\r
+* The CSS class representing a focused Overlay\r
+* @type string\r
+*/\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";\r
+\r
+YAHOO.widget.OverlayManager.prototype = {\r
+\r
+       constructor : YAHOO.widget.OverlayManager,\r
+\r
+       /**\r
+       * The array of Overlays that are currently registered\r
+       * @type Array\r
+       */\r
+       overlays : null,\r
+\r
+       /**\r
+       * Initializes the default configuration of the OverlayManager\r
+       */      \r
+       initDefaultConfig : function() {\r
+               this.cfg.addProperty("overlays", { suppressEvent:true } );\r
+               this.cfg.addProperty("focusevent", { value:"mousedown" } );\r
+       }, \r
+\r
+       /**\r
+       * Returns the currently focused Overlay\r
+       * @return {Overlay}     The currently focused Overlay\r
+       */\r
+       getActive : function() {},\r
+\r
+       /**\r
+       * Focuses the specified Overlay\r
+       * @param {Overlay}      The Overlay to focus\r
+       * @param {string}       The id of the Overlay to focus\r
+       */\r
+       focus : function(overlay) {},\r
+\r
+       /**\r
+       * Removes the specified Overlay from the manager\r
+       * @param {Overlay}      The Overlay to remove\r
+       * @param {string}       The id of the Overlay to remove\r
+       */\r
+       remove: function(overlay) {},\r
+\r
+       /**\r
+       * Removes focus from all registered Overlays in the manager\r
+       */\r
+       blurAll : function() {},\r
+\r
+       /**\r
+       * Initializes the OverlayManager\r
+       * @param {Array}        overlays        Optional. A collection of Overlays to register with the manager.\r
+       * @param {object}       userConfig              The object literal representing the user configuration of the OverlayManager\r
+       */\r
+       init : function(userConfig) {\r
+               this.cfg = new YAHOO.util.Config(this);\r
+\r
+               this.initDefaultConfig();\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               this.cfg.fireQueue();\r
+\r
+               var activeOverlay = null;\r
+\r
+               this.getActive = function() {\r
+                       return activeOverlay;\r
+               }\r
+\r
+               this.focus = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               this.blurAll();\r
+                               activeOverlay = o;\r
+                               YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");\r
+                               if (! isNaN(topZIndex) && this.overlays[0] != overlay) {\r
+                                       activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex) + 1));\r
+                               }\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                       }\r
+               }\r
+\r
+               this.remove = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");\r
+                               o.cfg.setProperty("zIndex", -1000, true);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               this.overlays = this.overlays.slice(0, this.overlays.length-1);\r
+                               o.cfg.setProperty("zIndex", originalZ, true);\r
+\r
+                               o.cfg.setProperty("manager", null);\r
+                               o.focusEvent = null\r
+                               o.blurEvent = null;\r
+                               o.focus = null;\r
+                               o.blur = null;\r
+                       }\r
+               }\r
+\r
+               this.blurAll = function() {\r
+                       activeOverlay = null;\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               YAHOO.util.Dom.removeClass(this.overlays[o].element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                       }               \r
+               }\r
+\r
+               var overlays = this.cfg.getProperty("overlays");\r
+               \r
+               if (! this.overlays) {\r
+                       this.overlays = new Array();\r
+               }\r
+\r
+               if (overlays) {\r
+                       this.register(overlays);\r
+                       this.overlays.sort(this.compareZIndexDesc);\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.\r
+       * @param {Overlay}      overlay         An Overlay to register with the manager.\r
+       * @param {Overlay[]}    overlay         An array of Overlays to register with the manager.\r
+       * @return       {boolean}       True if any Overlays are registered.\r
+       */\r
+       register : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       overlay.cfg.addProperty("manager", { value:this } );\r
+\r
+                       overlay.focusEvent = new YAHOO.util.CustomEvent("focus");\r
+                       overlay.blurEvent = new YAHOO.util.CustomEvent("blur");\r
+                       \r
+                       var mgr=this;\r
+\r
+                       overlay.focus = function() {\r
+                               mgr.focus(this);\r
+                               this.focusEvent.fire();\r
+                       } \r
+\r
+                       overlay.blur = function() {\r
+                               mgr.blurAll();\r
+                               this.blurEvent.fire();\r
+                       }\r
+\r
+                       var focusOnDomEvent = function(e,obj) {\r
+                               overlay.focus();\r
+                       }\r
+                       \r
+                       var focusevent = this.cfg.getProperty("focusevent");\r
+                       YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);\r
+\r
+                       var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex");\r
+                       if (! isNaN(zIndex)) {\r
+                               overlay.cfg.setProperty("zIndex", parseInt(zIndex));\r
+                       } else {\r
+                               overlay.cfg.setProperty("zIndex", 0);\r
+                       }\r
+                       \r
+                       this.overlays.push(overlay);\r
+                       return true;\r
+               } else if (overlay instanceof Array) {\r
+                       var regcount = 0;\r
+                       for (var i=0;i<overlay.length;i++) {\r
+                               if (this.register(overlay[i])) {\r
+                                       regcount++;\r
+                               }\r
+                       }\r
+                       if (regcount > 0) {\r
+                               return true;\r
+                       }\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Attempts to locate an Overlay by instance or ID.\r
+       * @param {Overlay}      overlay         An Overlay to locate within the manager\r
+       * @param {string}       overlay         An Overlay id to locate within the manager\r
+       * @return       {Overlay}       The requested Overlay, if found, or null if it cannot be located.\r
+       */\r
+       find : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o] == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }\r
+               } else if (typeof overlay == "string") {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o].id == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }                       \r
+               }\r
+               return null;\r
+       },\r
+\r
+       /**\r
+       * Used for sorting the manager's Overlays by z-index.\r
+       * @private\r
+       */\r
+       compareZIndexDesc : function(o1, o2) {\r
+               var zIndex1 = o1.cfg.getProperty("zIndex");\r
+               var zIndex2 = o2.cfg.getProperty("zIndex");\r
+\r
+               if (zIndex1 > zIndex2) {\r
+                       return -1;\r
+               } else if (zIndex1 < zIndex2) {\r
+                       return 1;\r
+               } else {\r
+                       return 0;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Shows all Overlays in the manager.\r
+       */\r
+       showAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].show();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Hides all Overlays in the manager.\r
+       */\r
+       hideAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].hide();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       toString : function() {\r
+               return "OverlayManager";\r
+       }\r
+\r
+}/**\r
+* Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+* Code licensed under the BSD License:\r
+* http://developer.yahoo.net/yui/license.txt\r
+* KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.\r
+* @param {Element}     attachTo        The element or element ID to which the key event should be attached\r
+* @param {string}      attachTo        The element or element ID to which the key event should be attached\r
+* @param {object}      keyData         The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).\r
+* @param {function}    handler         The CustomEvent handler to fire when the key event is detected\r
+* @param {object}      handler         An object literal representing the handler. \r
+* @param {string}      event           Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.\r
+* @constructor\r
+*/\r
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {\r
+       if (! event) {\r
+               event = YAHOO.util.KeyListener.KEYDOWN;\r
+       }\r
+\r
+       var keyEvent = new YAHOO.util.CustomEvent("keyPressed");\r
+       \r
+       this.enabledEvent = new YAHOO.util.CustomEvent("enabled");\r
+       this.disabledEvent = new YAHOO.util.CustomEvent("disabled");\r
+\r
+       if (typeof attachTo == 'string') {\r
+               attachTo = document.getElementById(attachTo);\r
+       }\r
+\r
+       if (typeof handler == 'function') {\r
+               keyEvent.subscribe(handler);\r
+       } else {\r
+               keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);\r
+       }\r
+\r
+       /**\r
+       * Handles the key event when a key is pressed.\r
+       * @private\r
+       */\r
+       function handleKeyPress(e, obj) {\r
+               var keyPressed = e.charCode || e.keyCode;\r
+               \r
+               if (! keyData.shift)    keyData.shift = false;\r
+               if (! keyData.alt)              keyData.alt = false;\r
+               if (! keyData.ctrl)             keyData.ctrl = false;\r
+\r
+               // check held down modifying keys first\r
+               if (e.shiftKey == keyData.shift && \r
+                       e.altKey   == keyData.alt &&\r
+                       e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match\r
+\r
+                       if (keyData.keys instanceof Array) {\r
+                               for (var i=0;i<keyData.keys.length;i++) {\r
+                                       if (keyPressed == keyData.keys[i]) {\r
+                                               keyEvent.fire(keyPressed, e);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               if (keyPressed == keyData.keys) {\r
+                                       keyEvent.fire(keyPressed, e);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.enable = function() {\r
+               if (! this.enabled) {\r
+                       YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);\r
+                       this.enabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = true;\r
+       }\r
+\r
+       this.disable = function() {\r
+               if (this.enabled) {\r
+                       YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);\r
+                       this.disabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = false;\r
+       }\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       this.toString = function() {\r
+               return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + (attachTo.id ? "[" + attachTo.id + "]" : "");\r
+       }\r
+\r
+}\r
+\r
+/**\r
+* Constant representing the DOM "keydown" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYDOWN = "keydown";\r
+\r
+/**\r
+* Constant representing the DOM "keyup" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYUP = "keyup";\r
+\r
+/**\r
+* Boolean indicating the enabled/disabled state of the Tooltip\r
+* @type Booleam\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabled = null;\r
+\r
+/**\r
+* Enables the KeyListener, by dynamically attaching the key event to the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.enable = function() {};\r
+\r
+/**\r
+* Disables the KeyListener, by dynamically removing the key event from the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.disable = function() {};\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is enabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabledEvent = null;\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is disabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.disabledEvent = null;\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Tooltip is an implementation of Overlay that behaves like an OS tooltip, displaying when the user mouses over a particular element, and disappearing on mouse out.\r
+* @param {string}      el      The element ID representing the Tooltip <em>OR</em>\r
+* @param {Element}     el      The element representing the Tooltip\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Tooltip = function(el, userConfig) {\r
+       YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Tooltip, YAHOO.widget.Overlay);\r
+\r
+/**\r
+* Constant representing the Tooltip CSS class\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Tooltip.CSS_TOOLTIP = "tt";\r
+\r
+/**\r
+* The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.\r
+* @param {string}      el      The element ID representing the Tooltip <em>OR</em>\r
+* @param {Element}     el      The element representing the Tooltip\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.init = function(el, userConfig) {\r
+       if (document.readyState && document.readyState != "complete") {\r
+               var deferredInit = function() {\r
+                       this.init(el, userConfig);\r
+               }\r
+               YAHOO.util.Event.addListener(window, "load", deferredInit, this, true);\r
+       } else {\r
+               YAHOO.widget.Tooltip.superclass.init.call(this, el);\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Tooltip);\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Tooltip.CSS_TOOLTIP);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               \r
+               this.cfg.queueProperty("visible",false);\r
+               this.cfg.queueProperty("constraintoviewport",true);\r
+\r
+               this.setBody("");\r
+               this.render(this.cfg.getProperty("container"));\r
+\r
+               this.initEvent.fire(YAHOO.widget.Tooltip);\r
+       }\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Tooltip.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);\r
+\r
+       this.cfg.addProperty("preventoverlap",          { value:true, validator:this.cfg.checkBoolean, supercedes:["x","y","xy"] } );\r
+\r
+       this.cfg.addProperty("showdelay",                       { value:200, handler:this.configShowDelay, validator:this.cfg.checkNumber } );\r
+       this.cfg.addProperty("autodismissdelay",        { value:5000, handler:this.configAutoDismissDelay, validator:this.cfg.checkNumber } );\r
+       this.cfg.addProperty("hidedelay",                       { value:250, handler:this.configHideDelay, validator:this.cfg.checkNumber } );\r
+\r
+       this.cfg.addProperty("text",                            { handler:this.configText, suppressEvent:true } );\r
+       this.cfg.addProperty("container",                       { value:document.body, handler:this.configContainer } );\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "text" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configText = function(type, args, obj) {\r
+       var text = args[0];\r
+       if (text) {\r
+               this.setBody(text);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "container" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configContainer = function(type, args, obj) {\r
+       var container = args[0];\r
+       if (typeof container == 'string') {\r
+               this.cfg.setProperty("container", document.getElementById(container), true);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.configContext = function(type, args, obj) {\r
+       var context = args[0];\r
+       if (context) {\r
+               \r
+               // Normalize parameter into an array\r
+               if (! (context instanceof Array)) {\r
+                       if (typeof context == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(context)], true);\r
+                       } else { // Assuming this is an element\r
+                               this.cfg.setProperty("context", [context], true);\r
+                       }\r
+                       context = this.cfg.getProperty("context");\r
+               }\r
+\r
+\r
+               // Remove any existing mouseover/mouseout listeners\r
+               if (this._context) {\r
+                       for (var c=0;c<this._context.length;++c) {\r
+                               var el = this._context[c];\r
+                               YAHOO.util.Event.removeListener(el, "mouseover", this.onContextMouseOver);\r
+                               YAHOO.util.Event.removeListener(el, "mousemove", this.onContextMouseMove);\r
+                               YAHOO.util.Event.removeListener(el, "mouseout", this.onContextMouseOut);\r
+                       }\r
+               }\r
+\r
+               // Add mouseover/mouseout listeners to context elements\r
+               this._context = context;\r
+               for (var c=0;c<this._context.length;++c) {\r
+                       var el = this._context[c];\r
+                       YAHOO.util.Event.addListener(el, "mouseover", this.onContextMouseOver, this);\r
+                       YAHOO.util.Event.addListener(el, "mousemove", this.onContextMouseMove, this);\r
+                       YAHOO.util.Event.addListener(el, "mouseout", this.onContextMouseOut, this);\r
+               }\r
+       }\r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+// BEGIN BUILT-IN DOM EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the user moves the mouse while over the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseMove = function(e, obj) {\r
+       obj.pageX = YAHOO.util.Event.getPageX(e);\r
+       obj.pageY = YAHOO.util.Event.getPageY(e);\r
+\r
+}\r
+\r
+/**\r
+* The default event handler fired when the user mouses over the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOver = function(e, obj) {\r
+\r
+       if (obj.hideProcId) {\r
+               clearTimeout(obj.hideProcId);\r
+               obj.hideProcId = null;\r
+       }\r
+       \r
+       var context = this;\r
+       YAHOO.util.Event.addListener(context, "mousemove", obj.onContextMouseMove, obj);\r
+\r
+       if (context.title) {\r
+               obj._tempTitle = context.title;\r
+               context.title = "";\r
+       }\r
+\r
+       /**\r
+       * The unique process ID associated with the thread responsible for showing the Tooltip.\r
+       * @type int\r
+       */\r
+       obj.showProcId = obj.doShow(e, context);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the user mouses out of the context element.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @param {object}      obj     The object argument\r
+*/\r
+YAHOO.widget.Tooltip.prototype.onContextMouseOut = function(e, obj) {\r
+       var el = this;\r
+\r
+       if (obj._tempTitle) {\r
+               el.title = obj._tempTitle;\r
+               obj._tempTitle = null;\r
+       }\r
+       \r
+       if (obj.showProcId) {\r
+               clearTimeout(obj.showProcId);\r
+               obj.showProcId = null;\r
+       }\r
+\r
+       if (obj.hideProcId) {\r
+               clearTimeout(obj.hideProcId);\r
+               obj.hideProcId = null;\r
+       }\r
+\r
+\r
+       obj.hideProcId = setTimeout(function() {\r
+                               obj.hide();\r
+                               }, obj.cfg.getProperty("hidedelay"));\r
+}\r
+\r
+// END BUILT-IN DOM EVENT HANDLERS //\r
+\r
+/**\r
+* Processes the showing of the Tooltip by setting the timeout delay and offset of the Tooltip.\r
+* @param {DOMEvent} e  The current DOM event\r
+* @return {int}        The process ID of the timeout function associated with doShow\r
+*/\r
+YAHOO.widget.Tooltip.prototype.doShow = function(e, context) {\r
+       \r
+       var yOffset = 25;\r
+       if (this.browser == "opera" && context.tagName == "A") {\r
+               yOffset += 12;\r
+       }\r
+\r
+       var me = this;\r
+       return setTimeout(\r
+               function() {\r
+                       if (me._tempTitle) {\r
+                               me.setBody(me._tempTitle);\r
+                       } else {\r
+                               me.cfg.refireEvent("text");\r
+                       }\r
+\r
+                       me.moveTo(me.pageX, me.pageY + yOffset);\r
+                       if (me.cfg.getProperty("preventoverlap")) {\r
+                               me.preventOverlap(me.pageX, me.pageY);\r
+                       }\r
+                       \r
+                       YAHOO.util.Event.removeListener(context, "mousemove", me.onContextMouseMove);\r
+\r
+                       me.show();\r
+                       me.hideProcId = me.doHide();\r
+               },\r
+       this.cfg.getProperty("showdelay"));\r
+}\r
+\r
+/**\r
+* Sets the timeout for the auto-dismiss delay, which by default is 5 seconds, meaning that a tooltip will automatically dismiss itself after 5 seconds of being displayed.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.doHide = function() {\r
+       var me = this;\r
+       return setTimeout(\r
+               function() {\r
+                       me.hide();\r
+               },\r
+               this.cfg.getProperty("autodismissdelay"));\r
+}\r
+\r
+/**\r
+* Fired when the Tooltip is moved, this event handler is used to prevent the Tooltip from overlapping with its context element.\r
+*/\r
+YAHOO.widget.Tooltip.prototype.preventOverlap = function(pageX, pageY) {\r
+       \r
+       var height = this.element.offsetHeight;\r
+       \r
+       var elementRegion = YAHOO.util.Dom.getRegion(this.element);\r
+\r
+       elementRegion.top -= 5;\r
+       elementRegion.left -= 5;\r
+       elementRegion.right += 5;\r
+       elementRegion.bottom += 5;\r
+\r
+       var mousePoint = new YAHOO.util.Point(pageX, pageY);\r
+       \r
+       if (elementRegion.contains(mousePoint)) {\r
+               this.logger.log("OVERLAP", "warn");\r
+               this.cfg.setProperty("y", (pageY-height-5))\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Tooltip.prototype.toString = function() {\r
+       return "Tooltip " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Panel is an implementation of Overlay that behaves like an OS window, with a draggable header and an optional close icon at the top right.\r
+* @param {string}      el      The element ID representing the Panel <em>OR</em>\r
+* @param {Element}     el      The element representing the Panel\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Panel = function(el, userConfig) {\r
+       YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Panel, YAHOO.widget.Overlay);\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Panel\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Panel.CSS_PANEL = "panel";\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Panel's wrapping container\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Panel.CSS_PANEL_CONTAINER = "panel-container";\r
+\r
+/**\r
+* CustomEvent fired after the modality mask is shown\r
+* args: none\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Panel.prototype.showMaskEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the modality mask is hidden\r
+* args: none\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Panel.prototype.hideMaskEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Panel.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Panel.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Panel);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Panel.CSS_PANEL);\r
+\r
+       this.buildWrapper();                    \r
+       \r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               var draggable = this.cfg.getProperty("draggable");\r
+               if (draggable) {\r
+                       if (! this.header) {\r
+                               this.setHeader("&nbsp;");\r
+                       }\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.Panel);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+*/\r
+YAHOO.widget.Panel.prototype.initEvents = function() {\r
+       YAHOO.widget.Panel.superclass.initEvents.call(this);\r
+\r
+       this.showMaskEvent = new YAHOO.util.CustomEvent("showMask");\r
+       this.hideMaskEvent = new YAHOO.util.CustomEvent("hideMask");\r
+\r
+       this.dragEvent = new YAHOO.util.CustomEvent("drag");\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Panel's Config object (cfg).\r
+*/\r
+YAHOO.widget.Panel.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add panel config properties //\r
+\r
+       this.cfg.addProperty("close", { value:true, handler:this.configClose, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+       this.cfg.addProperty("draggable", { value:true, handler:this.configDraggable, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+\r
+       this.cfg.addProperty("underlay", { value:"shadow", handler:this.configUnderlay, supercedes:["visible"] } );\r
+       this.cfg.addProperty("modal",   { value:false, handler:this.configModal, validator:this.cfg.checkBoolean, supercedes:["visible"] } );\r
+\r
+       this.cfg.addProperty("keylisteners", { handler:this.configKeyListeners, suppressEvent:true, supercedes:["visible"] } );\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "close" property is changed. The method controls the appending or hiding of the close icon at the top right of the Panel.\r
+*/\r
+YAHOO.widget.Panel.prototype.configClose = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       var doHide = function(e, obj) {\r
+               obj.hide();\r
+       }\r
+\r
+       if (val) {\r
+               if (! this.close) {\r
+                       this.close = document.createElement("DIV");\r
+                       YAHOO.util.Dom.addClass(this.close, "close");\r
+\r
+                       if (this.isSecure) {\r
+                               YAHOO.util.Dom.addClass(this.close, "secure");\r
+                       } else {\r
+                               YAHOO.util.Dom.addClass(this.close, "nonsecure");\r
+                       }\r
+\r
+                       this.close.innerHTML = "&nbsp;";\r
+                       this.innerElement.appendChild(this.close);\r
+                       YAHOO.util.Event.addListener(this.close, "click", doHide, this);        \r
+               } else {\r
+                       this.close.style.display = "block";\r
+               }\r
+       } else {\r
+               if (this.close) {\r
+                       this.close.style.display = "none";\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "draggable" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configDraggable = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (this.header) {\r
+                       YAHOO.util.Dom.setStyle(this.header,"cursor","move");\r
+                       this.registerDragDrop();\r
+               }\r
+       } else {\r
+               if (this.dd) {\r
+                       this.dd.unreg();\r
+               }\r
+               if (this.header) {\r
+                       YAHOO.util.Dom.setStyle(this.header,"cursor","auto");\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "underlay" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configUnderlay = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       switch (val.toLowerCase()) {\r
+               case "shadow":\r
+                       YAHOO.util.Dom.removeClass(this.element, "matte");\r
+                       YAHOO.util.Dom.addClass(this.element, "shadow");\r
+\r
+                       if (! this.underlay) { // create if not already in DOM\r
+                               this.underlay = document.createElement("DIV");\r
+                               this.underlay.className = "underlay";\r
+                               this.underlay.innerHTML = "&nbsp;";\r
+                               this.element.appendChild(this.underlay);\r
+                       } \r
+\r
+                       this.sizeUnderlay();\r
+                       break;\r
+               case "matte":\r
+                       YAHOO.util.Dom.removeClass(this.element, "shadow");\r
+                       YAHOO.util.Dom.addClass(this.element, "matte");\r
+                       break;\r
+               case "none":\r
+               default:\r
+                       YAHOO.util.Dom.removeClass(this.element, "shadow");\r
+                       YAHOO.util.Dom.removeClass(this.element, "matte");\r
+                       break;\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "modal" property is changed. This handler subscribes or unsubscribes to the show and hide events to handle the display or hide of the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.configModal = function(type, args, obj) {\r
+       var modal = args[0];\r
+\r
+       if (modal) {\r
+               this.buildMask();\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed( this.showEvent, this.showMask, this ) ) {\r
+                       this.showEvent.subscribe(this.showMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( this.hideEvent, this.hideMask, this) ) {\r
+                       this.hideEvent.subscribe(this.hideMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( YAHOO.widget.Overlay.windowResizeEvent, this.sizeMask, this ) ) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed( YAHOO.widget.Overlay.windowScrollEvent, this.sizeMask, this ) ) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.sizeMask, this, true);\r
+               }\r
+       } else {\r
+               this.beforeShowEvent.unsubscribe(this.showMask, this);\r
+               this.hideEvent.unsubscribe(this.hideMask, this);\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.sizeMask);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "keylisteners" property is changed. \r
+*/\r
+YAHOO.widget.Panel.prototype.configKeyListeners = function(type, args, obj) {\r
+       var listeners = args[0];\r
+\r
+       if (listeners) {\r
+               if (listeners instanceof Array) {\r
+                       for (var i=0;i<listeners.length;i++) {\r
+                               var listener = listeners[i];\r
+\r
+                               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, listener.enable, listener)) {\r
+                                       this.showEvent.subscribe(listener.enable, listener, true);\r
+                               }\r
+                               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, listener.disable, listener)) {\r
+                                       this.hideEvent.subscribe(listener.disable, listener, true);\r
+                                       this.destroyEvent.subscribe(listener.disable, listener, true);\r
+                               }\r
+                       }\r
+               } else {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, listeners.enable, listeners)) {\r
+                               this.showEvent.subscribe(listeners.enable, listeners, true);\r
+                       }\r
+                       if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, listeners.disable, listeners)) {\r
+                               this.hideEvent.subscribe(listeners.disable, listeners, true);\r
+                               this.destroyEvent.subscribe(listeners.disable, listeners, true); \r
+                       }\r
+               }\r
+       } \r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+\r
+/**\r
+* Builds the wrapping container around the Panel that is used for positioning the shadow and matte underlays. The container element is assigned to a  local instance variable called container, and the element is reinserted inside of it.\r
+*/\r
+YAHOO.widget.Panel.prototype.buildWrapper = function() {\r
+       var elementParent = this.element.parentNode;\r
+\r
+       var elementClone = this.element.cloneNode(true);\r
+       this.innerElement = elementClone;\r
+       this.innerElement.style.visibility = "inherit";\r
+\r
+       YAHOO.util.Dom.addClass(this.innerElement, YAHOO.widget.Panel.CSS_PANEL);\r
+\r
+       var wrapper = document.createElement("DIV");\r
+       wrapper.className = YAHOO.widget.Panel.CSS_PANEL_CONTAINER;\r
+       wrapper.id = elementClone.id + "_c";\r
+       \r
+       wrapper.appendChild(elementClone);\r
+       \r
+       if (elementParent) {\r
+               elementParent.replaceChild(wrapper, this.element);\r
+       }\r
+\r
+       this.element = wrapper;\r
+\r
+       // Resynchronize the local field references\r
+\r
+       var childNodes = this.innerElement.childNodes;\r
+       if (childNodes) {\r
+               for (var i=0;i<childNodes.length;i++) {\r
+                       var child = childNodes[i];\r
+                       switch (child.className) {\r
+                               case YAHOO.widget.Module.CSS_HEADER:\r
+                                       this.header = child;\r
+                                       break;\r
+                               case YAHOO.widget.Module.CSS_BODY:\r
+                                       this.body = child;\r
+                                       break;\r
+                               case YAHOO.widget.Module.CSS_FOOTER:\r
+                                       this.footer = child;\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.initDefaultConfig(); // We've changed the DOM, so the configuration must be re-tooled to get the DOM references right\r
+}\r
+\r
+/**\r
+* Adjusts the size of the shadow based on the size of the element.\r
+*/\r
+YAHOO.widget.Panel.prototype.sizeUnderlay = function() {\r
+       if (this.underlay && this.browser != "gecko" && this.browser != "safari") {\r
+               this.underlay.style.width = this.innerElement.offsetWidth + "px";\r
+               this.underlay.style.height = this.innerElement.offsetHeight + "px";\r
+       }\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Panel.prototype.onDomResize = function(e, obj) { \r
+       YAHOO.widget.Panel.superclass.onDomResize.call(this, e, obj);\r
+       var me = this;\r
+       setTimeout(function() {\r
+               me.sizeUnderlay();\r
+       }, 0);\r
+};\r
+\r
+/**\r
+* Registers the Panel's header for drag & drop capability.\r
+*/\r
+YAHOO.widget.Panel.prototype.registerDragDrop = function() {\r
+       if (this.header) {\r
+               this.dd = new YAHOO.util.DD(this.element.id, this.id);\r
+\r
+               if (! this.header.id) {\r
+                       this.header.id = this.id + "_h";\r
+               }\r
+               \r
+               var me = this;\r
+\r
+               this.dd.startDrag = function() {\r
+\r
+                       if (me.browser == "ie") {\r
+                               YAHOO.util.Dom.addClass(me.element,"drag");\r
+                       }\r
+\r
+                       if (me.cfg.getProperty("constraintoviewport")) {\r
+                               var offsetHeight = me.element.offsetHeight;\r
+                               var offsetWidth = me.element.offsetWidth;\r
+\r
+                               var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+                               var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+                               var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+                               var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+                               var topConstraint = scrollY + 10;\r
+                               var leftConstraint = scrollX + 10;\r
+                               var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+                               var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+\r
+                               this.minX = leftConstraint\r
+                               this.maxX = rightConstraint;\r
+                               this.constrainX = true;\r
+\r
+                               this.minY = topConstraint;\r
+                               this.maxY = bottomConstraint;\r
+                               this.constrainY = true;\r
+                       } else {\r
+                               this.constrainX = false;\r
+                               this.constrainY = false;\r
+                       }\r
+\r
+                       me.dragEvent.fire("startDrag", arguments);\r
+               }\r
+               \r
+               this.dd.onDrag = function() {\r
+                       me.syncPosition();\r
+                       me.cfg.refireEvent("iframe");\r
+                       if (this.platform == "mac" && this.browser == "gecko") {\r
+                               this.showMacGeckoScrollbars();\r
+                       }\r
+\r
+                       me.dragEvent.fire("onDrag", arguments);\r
+               }\r
+\r
+               this.dd.endDrag = function() {\r
+                       if (me.browser == "ie") {\r
+                               YAHOO.util.Dom.removeClass(me.element,"drag");\r
+                       }\r
+\r
+                       me.dragEvent.fire("endDrag", arguments);\r
+               }\r
+\r
+               this.dd.setHandleElId(this.header.id);\r
+               this.dd.addInvalidHandleType("INPUT");\r
+               this.dd.addInvalidHandleType("SELECT");\r
+               this.dd.addInvalidHandleType("TEXTAREA");\r
+       }\r
+}\r
+\r
+/**\r
+* Builds the mask that is laid over the document when the Panel is configured to be modal.\r
+*/\r
+YAHOO.widget.Panel.prototype.buildMask = function() {\r
+       if (! this.mask) {\r
+               this.mask = document.createElement("DIV");\r
+               this.mask.id = this.id + "_mask";\r
+               this.mask.className = "mask";\r
+               this.mask.innerHTML = "&nbsp;";\r
+\r
+               var maskClick = function(e, obj) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+\r
+               YAHOO.util.Event.addListener(this.mask, maskClick, this);\r
+\r
+               document.body.appendChild(this.mask);\r
+       }\r
+}\r
+\r
+/**\r
+* Hides the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.hideMask = function() {\r
+       if (this.cfg.getProperty("modal") && this.mask) {\r
+               this.mask.style.display = "none";\r
+               this.hideMaskEvent.fire();\r
+               YAHOO.util.Dom.removeClass(document.body, "masked");\r
+       }\r
+}\r
+\r
+/**\r
+* Shows the modality mask.\r
+*/\r
+YAHOO.widget.Panel.prototype.showMask = function() {\r
+       if (this.cfg.getProperty("modal") && this.mask) {\r
+               YAHOO.util.Dom.addClass(document.body, "masked");\r
+               this.sizeMask();\r
+               this.mask.style.display = "block";\r
+               this.showMaskEvent.fire();\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the size of the modality mask to cover the entire scrollable area of the document\r
+*/\r
+YAHOO.widget.Panel.prototype.sizeMask = function() {\r
+       if (this.mask) {\r
+               this.mask.style.height = YAHOO.util.Dom.getDocumentHeight()+"px";\r
+               this.mask.style.width = YAHOO.util.Dom.getDocumentWidth()+"px";\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.innerElement;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("underlay");\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Panel.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.innerElement;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("underlay");\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Renders the Panel by inserting the elements that are not already in the main Panel into their correct places. Optionally appends the Panel to the specified node prior to the render's execution. NOTE: For Panels without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+* @param {string}      appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+* @param {Element}     appendToNode    The element to which the Module should be appended to prior to rendering        \r
+* @return {boolean} Success or failure of the render\r
+*/\r
+YAHOO.widget.Panel.prototype.render = function(appendToNode) {\r
+       return YAHOO.widget.Panel.superclass.render.call(this, appendToNode, this.innerElement);\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Panel.prototype.toString = function() {\r
+       return "Panel " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* Dialog is an implementation of Panel that can be used to submit form data. Built-in functionality for buttons with event handlers is included, and button sets can be build dynamically, or the preincluded ones for Submit/Cancel and OK/Cancel can be utilized. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.\r
+* @param {string}      el      The element ID representing the Dialog <em>OR</em>\r
+* @param {Element}     el      The element representing the Dialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Dialog = function(el, userConfig) {\r
+       YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Dialog, YAHOO.widget.Panel);\r
+\r
+/**\r
+* Constant representing the default CSS class used for a Dialog\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Dialog.CSS_DIALOG = "dialog";\r
+\r
+\r
+/**\r
+* CustomEvent fired prior to submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.beforeSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.submitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to manual submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.manualSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to asynchronous submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.asyncSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired prior to form-based submission\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.formSubmitEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after cancel\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Dialog.prototype.cancelEvent = null;\r
+\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Dialog's Config object (cfg).\r
+*/\r
+YAHOO.widget.Dialog.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);\r
+\r
+       /**\r
+       * The internally maintained callback object for use with the Connection utility\r
+       * @type object\r
+       * @private\r
+       */\r
+       this.callback = {\r
+               success : null,\r
+               failure : null,\r
+               argument: null,\r
+               scope : this\r
+       }\r
+\r
+       this.doSubmit = function() {\r
+               var method = this.cfg.getProperty("postmethod");\r
+               switch (method) {\r
+                       case "async":\r
+                               YAHOO.util.Connect.setForm(this.form.name);\r
+                               var cObj = YAHOO.util.Connect.asyncRequest('POST', this.form.action, this.callback);\r
+                               this.asyncSubmitEvent.fire();\r
+                               break;\r
+                       case "form":\r
+                               this.form.submit();\r
+                               this.formSubmitEvent.fire();\r
+                               break;\r
+                       case "none":\r
+                       case "manual":\r
+                               this.manualSubmitEvent.fire();\r
+                               break;\r
+               }\r
+       }\r
+\r
+       // Add form dialog config properties //\r
+       this.cfg.addProperty("postmethod", { value:"async", validator:function(val) { \r
+                                                                                                       if (val != "form" && val != "async" && val != "none" && val != "manual") {\r
+                                                                                                               return false;\r
+                                                                                                       } else {\r
+                                                                                                               return true;\r
+                                                                                                       }\r
+                                                                                               } });\r
+\r
+       this.cfg.addProperty("buttons",         { value:"none", handler:this.configButtons } );\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Dialog which are fired automatically at appropriate times by the Dialog class.\r
+*/\r
+YAHOO.widget.Dialog.prototype.initEvents = function() {\r
+       YAHOO.widget.Dialog.superclass.initEvents.call(this);\r
+       \r
+       this.beforeSubmitEvent  = new YAHOO.util.CustomEvent("beforeSubmit");\r
+       this.submitEvent                = new YAHOO.util.CustomEvent("submit");\r
+\r
+       this.manualSubmitEvent  = new YAHOO.util.CustomEvent("manualSubmit");\r
+       this.asyncSubmitEvent   = new YAHOO.util.CustomEvent("asyncSubmit");\r
+       this.formSubmitEvent    = new YAHOO.util.CustomEvent("formSubmit");\r
+\r
+       this.cancelEvent                = new YAHOO.util.CustomEvent("cancel");\r
+}\r
+\r
+/**\r
+* The Dialog initialization method, which is executed for Dialog and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Dialog <em>OR</em>\r
+* @param {Element}     el      The element representing the Dialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Dialog. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Dialog.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Dialog.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Dialog);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Dialog.CSS_DIALOG);\r
+\r
+       this.cfg.setProperty("visible", false);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.renderEvent.subscribe(this.registerForm, this, true);\r
+\r
+       this.showEvent.subscribe(this.focusFirst, this, true);\r
+       this.beforeHideEvent.subscribe(this.blurButtons, this, true);\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               var buttonCfg = this.cfg.getProperty("buttons");\r
+               if (buttonCfg && buttonCfg != "none") {\r
+                       if (! this.footer) {\r
+                               this.setFooter("");\r
+                       }\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.Dialog);\r
+}\r
+\r
+/**\r
+* Prepares the Dialog's internal FORM object, creating one if one is not currently present.\r
+*/\r
+YAHOO.widget.Dialog.prototype.registerForm = function() {\r
+       var form = this.element.getElementsByTagName("FORM")[0];\r
+\r
+       if (! form) {\r
+               var formHTML = "<form name=\"frm_" + this.id + "\" action=\"\"></form>";\r
+               this.body.innerHTML += formHTML;\r
+               form = this.element.getElementsByTagName("FORM")[0];\r
+       }\r
+\r
+       this.firstFormElement = function() {\r
+               for (var f=0;f<form.elements.length;f++ ) {\r
+                       var el = form.elements[f];\r
+                       if (el.focus) {\r
+                               if (el.type && el.type != "hidden") {\r
+                                       return el;\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+               return null;\r
+       }();\r
+\r
+       this.lastFormElement = function() {\r
+               for (var f=form.elements.length-1;f>=0;f-- ) {\r
+                       var el = form.elements[f];\r
+                       if (el.focus) {\r
+                               if (el.type && el.type != "hidden") {\r
+                                       return el;\r
+                                       break;\r
+                               }\r
+                       }\r
+               }\r
+               return null;\r
+       }();\r
+\r
+       this.form = form;\r
+\r
+       if (this.cfg.getProperty("modal") && this.form) {\r
+\r
+               var me = this;\r
+               \r
+               var firstElement = this.firstFormElement || this.firstButton;\r
+               if (firstElement) {\r
+                       this.preventBackTab = new YAHOO.util.KeyListener(firstElement, { shift:true, keys:9 }, {fn:me.focusLast, scope:me, correctScope:true} );\r
+                       this.showEvent.subscribe(this.preventBackTab.enable, this.preventBackTab, true);\r
+                       this.hideEvent.subscribe(this.preventBackTab.disable, this.preventBackTab, true);\r
+               }\r
+\r
+               var lastElement = this.lastButton || this.lastFormElement;\r
+               if (lastElement) {\r
+                       this.preventTabOut = new YAHOO.util.KeyListener(lastElement, { shift:false, keys:9 }, {fn:me.focusFirst, scope:me, correctScope:true} );\r
+                       this.showEvent.subscribe(this.preventTabOut.enable, this.preventTabOut, true);\r
+                       this.hideEvent.subscribe(this.preventTabOut.disable, this.preventTabOut, true);\r
+               }\r
+       }\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler for the "buttons" configuration property\r
+*/\r
+YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {\r
+       var buttons = args[0];\r
+       if (buttons != "none") {\r
+               this.buttonSpan = null;\r
+               this.buttonSpan = document.createElement("SPAN");\r
+               this.buttonSpan.className = "button-group";\r
+\r
+               for (var b=0;b<buttons.length;b++) {\r
+                       var button = buttons[b];\r
+\r
+                       var htmlButton = document.createElement("BUTTON");\r
+\r
+                       if (button.isDefault) {\r
+                               htmlButton.className = "default";\r
+                               this.defaultHtmlButton = htmlButton;\r
+                       }\r
+\r
+                       htmlButton.appendChild(document.createTextNode(button.text));\r
+                       YAHOO.util.Event.addListener(htmlButton, "click", button.handler, this, true);\r
+\r
+                       this.buttonSpan.appendChild(htmlButton);                \r
+                       button.htmlButton = htmlButton;\r
+\r
+                       if (b == 0) {\r
+                               this.firstButton = button.htmlButton;\r
+                       }\r
+\r
+                       if (b == (buttons.length-1)) {\r
+                               this.lastButton = button.htmlButton;\r
+                       }\r
+\r
+               }\r
+\r
+               this.setFooter(this.buttonSpan);\r
+\r
+               this.cfg.refireEvent("iframe");\r
+               this.cfg.refireEvent("underlay");\r
+       } else { // Do cleanup\r
+               if (this.buttonSpan) {\r
+                       if (this.buttonSpan.parentNode) {\r
+                               this.buttonSpan.parentNode.removeChild(this.buttonSpan);\r
+                       }\r
+\r
+                       this.buttonSpan = null;\r
+                       this.firstButtom = null;\r
+                       this.lastButton = null;\r
+                       this.defaultHtmlButton = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default handler fired when the "success" property is changed. Used for asynchronous submission only.\r
+*/ \r
+YAHOO.widget.Dialog.prototype.configOnSuccess = function(type,args,obj){};\r
+\r
+/**\r
+* The default handler fired when the "failure" property is changed. Used for asynchronous submission only.\r
+*/ \r
+YAHOO.widget.Dialog.prototype.configOnFailure = function(type,args,obj){};\r
+\r
+/**\r
+* Executes a submission of the form based on the value of the postmethod property.\r
+*/\r
+YAHOO.widget.Dialog.prototype.doSubmit = function() {};\r
+\r
+/**\r
+* The default event handler used to focus the first field of the form when the Dialog is shown.\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusFirst = function(type,args,obj) {\r
+       if (args) {\r
+               var e = args[1];\r
+               if (e) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+       }\r
+\r
+       if (this.firstFormElement) {\r
+               this.firstFormElement.focus();\r
+       } else {\r
+               this.focusDefaultButton();\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the last button in the button or form element in the Dialog\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusLast = function(type,args,obj) {\r
+       if (args) {\r
+               var e = args[1];\r
+               if (e) {\r
+                       YAHOO.util.Event.stopEvent(e);\r
+               }\r
+       }\r
+\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               this.focusLastButton();\r
+       } else {\r
+               if (this.lastFormElement) {\r
+                       this.lastFormElement.focus();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the button that is designated as the default. By default, his handler is executed when the show event is fired.\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusDefaultButton = function() {\r
+       if (this.defaultHtmlButton) {\r
+               this.defaultHtmlButton.focus();\r
+       }\r
+}\r
+\r
+/**\r
+* Blurs all the html buttons\r
+*/\r
+YAHOO.widget.Dialog.prototype.blurButtons = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[0].htmlButton;\r
+               if (html) {\r
+                       html.blur();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the first button in the button list\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusFirstButton = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[0].htmlButton;\r
+               if (html) {\r
+                       html.focus();\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Sets the focus to the first button in the button list\r
+*/\r
+YAHOO.widget.Dialog.prototype.focusLastButton = function() {\r
+       var buttons = this.cfg.getProperty("buttons");\r
+       if (buttons && buttons instanceof Array) {\r
+               var html = buttons[buttons.length-1].htmlButton;\r
+               if (html) {\r
+                       html.focus();\r
+               }\r
+       }\r
+}\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Built-in function hook for writing a validation function that will be checked for a "true" value prior to a submit. This function, as implemented by default, always returns true, so it should be overridden if validation is necessary.\r
+*/\r
+YAHOO.widget.Dialog.prototype.validate = function() {\r
+       return true;\r
+}\r
+\r
+/**\r
+* Executes a submit of the Dialog followed by a hide, if validation is successful.\r
+*/\r
+YAHOO.widget.Dialog.prototype.submit = function() {\r
+       if (this.validate()) {\r
+               this.beforeSubmitEvent.fire();\r
+               this.doSubmit();\r
+               this.submitEvent.fire();\r
+               this.hide();\r
+               return true;\r
+       } else {\r
+               return false;\r
+       }\r
+}\r
+\r
+/**\r
+* Executes the cancel of the Dialog followed by a hide.\r
+*/\r
+YAHOO.widget.Dialog.prototype.cancel = function() {\r
+       this.cancelEvent.fire();\r
+       this.hide();    \r
+}\r
+\r
+/**\r
+* Returns a JSON-compatible data structure representing the data currently contained in the form.\r
+* @return {object} A JSON object reprsenting the data of the current form.\r
+*/\r
+YAHOO.widget.Dialog.prototype.getData = function() {\r
+       var form = this.form;\r
+       var data = {};\r
+\r
+       if (form) {\r
+               for (var i in this.form) {\r
+                       var formItem = form[i];\r
+                       if (formItem) {\r
+                               if (formItem.tagName) { // Got a single form item\r
+                                       switch (formItem.tagName) {\r
+                                               case "INPUT":\r
+                                                       switch (formItem.type) {\r
+                                                               case "checkbox": \r
+                                                                       data[i] = formItem.checked;\r
+                                                                       break;\r
+                                                               case "textbox":\r
+                                                               case "text":\r
+                                                               case "hidden":\r
+                                                                       data[i] = formItem.value;\r
+                                                                       break;\r
+                                                       }\r
+                                                       break;\r
+                                               case "TEXTAREA":\r
+                                                       data[i] = formItem.value;\r
+                                                       break;\r
+                                               case "SELECT":\r
+                                                       var val = new Array();\r
+                                                       for (var x=0;x<formItem.options.length;x++)     {\r
+                                                               var option = formItem.options[x];\r
+                                                               if (option.selected) {\r
+                                                                       var selval = option.value;\r
+                                                                       if (! selval || selval == "") {\r
+                                                                               selval = option.text;\r
+                                                                       }\r
+                                                                       val[val.length] = selval;\r
+                                                               }\r
+                                                       }\r
+                                                       data[i] = val;\r
+                                                       break;\r
+                                       }\r
+                               } else if (formItem[0] && formItem[0].tagName) { // this is an array of form items\r
+                                       switch (formItem[0].tagName) {\r
+                                               case "INPUT" :\r
+                                                       switch (formItem[0].type) {\r
+                                                               case "radio":\r
+                                                                       for (var r=0; r<formItem.length; r++) {\r
+                                                                               var radio = formItem[r];\r
+                                                                               if (radio.checked) {\r
+                                                                                       data[radio.name] = radio.value;\r
+                                                                                       break;\r
+                                                                               }\r
+                                                                       }\r
+                                                                       break;\r
+                                                               case "checkbox":\r
+                                                                       var cbArray = new Array();\r
+                                                                       for (var c=0; c<formItem.length; c++) {\r
+                                                                               var check = formItem[c];\r
+                                                                               if (check.checked) {\r
+                                                                                       cbArray[cbArray.length] = check.value;\r
+                                                                               }\r
+                                                                       }\r
+                                                                       data[formItem[0].name] = cbArray;\r
+                                                                       break;\r
+                                                       }\r
+                                       }\r
+                               }\r
+                       }\r
+               }       \r
+       }\r
+       return data;\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Dialog.prototype.toString = function() {\r
+       return "Dialog " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* SimpleDialog is a simple implementation of Dialog that can be used to submit a single value. Forms can be processed in 3 ways -- via an asynchronous Connection utility call, a simple form POST or GET, or manually.\r
+* @param {string}      el      The element ID representing the SimpleDialog <em>OR</em>\r
+* @param {Element}     el      The element representing the SimpleDialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.SimpleDialog = function(el, userConfig) {\r
+       YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.SimpleDialog, YAHOO.widget.Dialog);\r
+\r
+/**\r
+* Constant for the standard network icon for a blocking action\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_BLOCK = "nt/ic/ut/bsc/blck16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for alarm\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_ALARM = "nt/ic/ut/bsc/alrt16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for help\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_HELP  = "nt/ic/ut/bsc/hlp16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for info\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_INFO  = "nt/ic/ut/bsc/info16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for warn\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_WARN  = "nt/ic/ut/bsc/warn16_1.gif";\r
+\r
+/**\r
+* Constant for the standard network icon for a tip\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.ICON_TIP   = "nt/ic/ut/bsc/tip16_1.gif";\r
+\r
+/**\r
+* Constant representing the default CSS class used for a SimpleDialog\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG = "simple-dialog";\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the SimpleDialog's Config object (cfg).\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add dialog config properties //\r
+       this.cfg.addProperty("icon",    { value:"none", handler:this.configIcon, suppressEvent:true } );\r
+       this.cfg.addProperty("text",    { value:"", handler:this.configText, suppressEvent:true, supercedes:["icon"] } );\r
+}\r
+\r
+\r
+/**\r
+* The SimpleDialog initialization method, which is executed for SimpleDialog and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the SimpleDialog <em>OR</em>\r
+* @param {Element}     el      The element representing the SimpleDialog\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this SimpleDialog. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.SimpleDialog.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+\r
+       this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);\r
+\r
+       this.cfg.queueProperty("postmethod", "manual");\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       this.beforeRenderEvent.subscribe(function() {\r
+               if (! this.body) {\r
+                       this.setBody("");\r
+               }\r
+       }, this, true);\r
+\r
+       this.initEvent.fire(YAHOO.widget.SimpleDialog);\r
+\r
+}\r
+/**\r
+* Prepares the SimpleDialog's internal FORM object, creating one if one is not currently present, and adding the value hidden field.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.registerForm = function() {\r
+       YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);\r
+       this.form.innerHTML += "<input type=\"hidden\" name=\"" + this.id + "\" value=\"\"/>";\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Fired when the "icon" property is set.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.configIcon = function(type,args,obj) {\r
+       var icon = args[0];\r
+       if (icon && icon != "none") {\r
+               var iconHTML = "<img src=\"" + this.imageRoot + icon + "\" class=\"icon\" />";\r
+               this.body.innerHTML = iconHTML + this.body.innerHTML;\r
+       }\r
+}\r
+\r
+/**\r
+* Fired when the "text" property is set.\r
+*/\r
+YAHOO.widget.SimpleDialog.prototype.configText = function(type,args,obj) {\r
+       var text = args[0];\r
+       if (text) {\r
+               this.setBody(text);\r
+               this.cfg.refireEvent("icon");\r
+       }\r
+}\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.SimpleDialog.prototype.toString = function() {\r
+       return "SimpleDialog " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.\r
+* @param {Overlay}     overlay         The Overlay that the animation should be associated with\r
+* @param {object}      attrIn          The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(float), and method(i.e. YAHOO.util.Easing.easeIn).\r
+* @param {object}      attrOut         The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(float), and method(i.e. YAHOO.util.Easing.easeIn).\r
+* @param {Element}     targetElement   Optional. The target element that should be animated during the transition. Defaults to overlay.element.\r
+* @param {class}       Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.\r
+* @constructor\r
+*/\r
+YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {\r
+       if (! animClass) {\r
+               animClass = YAHOO.util.Anim;\r
+       }\r
+\r
+       /**\r
+       * The overlay to animate\r
+       */\r
+       this.overlay = overlay;\r
+       /**\r
+       * The animation attributes to use when transitioning into view\r
+       */\r
+       this.attrIn = attrIn;\r
+       /**\r
+       * The animation attributes to use when transitioning out of view\r
+       */\r
+       this.attrOut = attrOut;\r
+       /**\r
+       * The target element to be animated\r
+       */\r
+       this.targetElement = targetElement || overlay.element;\r
+       /**\r
+       * The animation class to use for animating the overlay\r
+       */\r
+       this.animClass = animClass;\r
+}\r
+\r
+/**\r
+* Initializes the animation classes and events.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.init = function() {\r
+       this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");\r
+       this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");\r
+\r
+       this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");\r
+       this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");\r
+\r
+       this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);\r
+       this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);\r
+       this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);\r
+       this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);\r
+\r
+       this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);\r
+       this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);\r
+       this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);\r
+       this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);\r
+}\r
+\r
+/**\r
+* Triggers the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.animateIn = function() {\r
+       this.beforeAnimateInEvent.fire();\r
+       this.animIn.animate();\r
+}\r
+\r
+/**\r
+* Triggers the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.animateOut = function() {\r
+       this.beforeAnimateOutEvent.fire();\r
+       this.animOut.animate();\r
+}\r
+\r
+/**\r
+* The default onStart handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { }\r
+/**\r
+* The default onTween handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { }\r
+/**\r
+* The default onComplete handler for the in-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { }\r
+\r
+/**\r
+* The default onStart handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { }\r
+/**\r
+* The default onTween handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { }\r
+/**\r
+* The default onComplete handler for the out-animation.\r
+*/\r
+YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { }\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.ContainerEffect.prototype.toString = function() {\r
+       var output = "ContainerEffect";\r
+       if (this.overlay) {\r
+               output += " [" + this.overlay.toString() + "]";\r
+       }\r
+       return output;\r
+}\r
+\r
+/**\r
+* A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.\r
+* @param {Overlay}     The Overlay object to animate\r
+* @param {float}       The duration of the animation\r
+* @type ContainerEffect\r
+*/\r
+YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {\r
+       var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );\r
+\r
+       fade.handleStartAnimateIn = function(type,args,obj) {\r
+               YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");\r
+               \r
+               if (! obj.overlay.underlay) {\r
+                       obj.overlay.cfg.refireEvent("underlay");\r
+               }\r
+\r
+               if (obj.overlay.underlay) {\r
+                       obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");\r
+                       obj.overlay.underlay.style.filter = null;\r
+               }\r
+\r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible"); \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);\r
+       }\r
+\r
+       fade.handleCompleteAnimateIn = function(type,args,obj) {\r
+               YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");\r
+\r
+               if (obj.overlay.element.style.filter) {\r
+                       obj.overlay.element.style.filter = null;\r
+               }                       \r
+               \r
+               if (obj.overlay.underlay) {\r
+                       YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);\r
+               }\r
+\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+               obj.animateInCompleteEvent.fire();\r
+       }\r
+\r
+       fade.handleStartAnimateOut = function(type, args, obj) {\r
+               YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");\r
+\r
+               if (obj.overlay.underlay) {\r
+                       obj.overlay.underlay.style.filter = null;\r
+               }\r
+       }\r
+\r
+       fade.handleCompleteAnimateOut =  function(type, args, obj) { \r
+               YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");\r
+               if (obj.overlay.element.style.filter) {\r
+                       obj.overlay.element.style.filter = null;\r
+               }                               \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");\r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1); \r
+\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+\r
+               obj.animateOutCompleteEvent.fire();\r
+       };      \r
+\r
+       fade.init();\r
+       return fade;\r
+};\r
+\r
+\r
+/**\r
+* A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.\r
+* @param {Overlay}     The Overlay object to animate\r
+* @param {float}       The duration of the animation\r
+* @type ContainerEffect\r
+*/\r
+YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {\r
+       var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);\r
+       var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);\r
+\r
+       var clientWidth = YAHOO.util.Dom.getClientWidth();\r
+       var offsetWidth = overlay.element.offsetWidth;\r
+\r
+       var slide = new YAHOO.widget.ContainerEffect(overlay, { \r
+                                                                                                                       attributes:{ points: { to:[x, y] } }, \r
+                                                                                                                       duration:dur, \r
+                                                                                                                       method:YAHOO.util.Easing.easeIn \r
+                                                                                                               }, \r
+                                                                                                               { \r
+                                                                                                                       attributes:{ points: { to:[(clientWidth+25), y] } },\r
+                                                                                                                       duration:dur, \r
+                                                                                                                       method:YAHOO.util.Easing.easeOut\r
+                                                                                                               },\r
+                                                                                                               overlay.element,\r
+                                                                                                               YAHOO.util.Motion\r
+                                                                                               );\r
+\r
+       slide.handleStartAnimateIn = function(type,args,obj) {\r
+               obj.overlay.element.style.left = (-25-offsetWidth) + "px";\r
+               obj.overlay.element.style.top  = y + "px";\r
+       }\r
+       \r
+       slide.handleTweenAnimateIn = function(type, args, obj) {\r
+\r
+\r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var currentX = pos[0];\r
+               var currentY = pos[1];\r
+\r
+               if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {\r
+                       YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");\r
+               }\r
+\r
+               obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+       }\r
+       \r
+       slide.handleCompleteAnimateIn = function(type, args, obj) {\r
+               obj.overlay.cfg.setProperty("xy", [x,y], true);\r
+               obj.startX = x;\r
+               obj.startY = y;\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+               obj.animateInCompleteEvent.fire();\r
+       }\r
+\r
+       slide.handleStartAnimateOut = function(type, args, obj) {\r
+               var clientWidth = YAHOO.util.Dom.getViewportWidth();\r
+               \r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var x = pos[0];\r
+               var y = pos[1];\r
+\r
+               var currentTo = obj.animOut.attributes.points.to;\r
+               obj.animOut.attributes.points.to = [(clientWidth+25), y];\r
+       }\r
+\r
+       slide.handleTweenAnimateOut = function(type, args, obj) {\r
+               var pos = YAHOO.util.Dom.getXY(obj.overlay.element);\r
+\r
+               var x = pos[0];\r
+               var y = pos[1];\r
+\r
+               obj.overlay.cfg.setProperty("xy", [x,y], true);\r
+               obj.overlay.cfg.refireEvent("iframe");\r
+       }\r
+\r
+       slide.handleCompleteAnimateOut = function(type, args, obj) { \r
+               YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");           \r
+               var offsetWidth = obj.overlay.element.offsetWidth;\r
+\r
+               obj.overlay.cfg.setProperty("xy", [x,y]);\r
+               obj.animateOutCompleteEvent.fire();\r
+       };      \r
+\r
+       slide.init();\r
+       return slide;\r
+}
\ No newline at end of file
diff --git a/lib/yui/container/container_core-debug.js b/lib/yui/container/container_core-debug.js
new file mode 100755 (executable)
index 0000000..67d056d
--- /dev/null
@@ -0,0 +1,2279 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+/**\r
+* @class \r
+* Config is a utility used within an object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+* @constructor\r
+*/\r
+YAHOO.util.Config = function(owner) {\r
+       if (owner) {\r
+               this.init(owner);\r
+       } else {\r
+               YAHOO.log("No owner specified for Config object", "error");\r
+       }\r
+}\r
+\r
+YAHOO.util.Config.prototype = {\r
+       \r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * @type object\r
+       */\r
+       owner : null,\r
+\r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * args: key, value\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       configChangedEvent : null,\r
+\r
+       /**\r
+       * Boolean flag that specifies whether a queue is currently being executed\r
+       * @type boolean\r
+       */\r
+       queueInProgress : false,\r
+\r
+       /**\r
+       * Adds a property to the Config object's private config hash. \r
+       * @param {string}       key     The configuration property's name\r
+       * @param {object}       propertyObject  The object containing all of this property's arguments\r
+       */\r
+       addProperty : function(key, propertyObject){},\r
+\r
+       /**\r
+       * Returns a key-value configuration map of the values currently set in the Config object.\r
+       * @return {object} The current config, represented in a key-value map\r
+       */\r
+       getConfig : function(){},\r
+\r
+       /**\r
+       * Returns the value of specified property.\r
+       * @param {key}          The name of the property\r
+       * @return {object}      The value of the specified property\r
+       */\r
+       getProperty : function(key){},\r
+\r
+       /**\r
+       * Resets the specified property's value to its initial value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       resetProperty : function(key){},\r
+\r
+       /**\r
+       * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @param {boolean}      Whether the value should be set silently, without firing the property event.\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */\r
+       setProperty : function(key,value,silent){},\r
+\r
+       /**\r
+       * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is\r
+       * moved from its current position to the end of the queue.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */      \r
+       queueProperty : function(key,value){},\r
+\r
+       /**\r
+       * Fires the event for a property using the property's current value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       refireEvent : function(key){},\r
+\r
+       /**\r
+       * Applies a key-value object literal to the configuration, replacing any existing values, and queueing the property events.\r
+       * Although the values will be set, fireQueue() must be called for their associated events to execute.\r
+       * @param {object}       userConfig      The configuration object literal\r
+       * @param {boolean}      init            When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.\r
+       */\r
+       applyConfig : function(userConfig,init){},\r
+\r
+       /**\r
+       * Refires the events for all configuration properties using their current values.\r
+       */\r
+       refresh : function(){},\r
+\r
+       /**\r
+       * Fires the normalized list of queued property change events\r
+       */\r
+       fireQueue : function(){},\r
+\r
+       /**\r
+       * Subscribes an external handler to the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       * @param {boolean}      override        Optional. If true, will override "this" within the handler to map to the scope object passed into the method.\r
+       */      \r
+       subscribeToConfigEvent : function(key,handler,obj,override){},\r
+\r
+       /**\r
+       * Unsubscribes an external handler from the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       */\r
+       unsubscribeFromConfigEvent: function(key,handler,obj){},\r
+\r
+       /**\r
+       * Validates that the value passed in is a boolean.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */      \r
+       checkBoolean: function(val) {\r
+               if (typeof val == 'boolean') {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Validates that the value passed in is a number.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */\r
+       checkNumber: function(val) {\r
+               if (isNaN(val)) {\r
+                       return false;\r
+               } else {\r
+                       return true;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* Initializes the configuration object and all of its local members.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+*/\r
+YAHOO.util.Config.prototype.init = function(owner) {\r
+\r
+       this.owner = owner;\r
+       this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");\r
+       this.queueInProgress = false;\r
+\r
+       /* Private Members */\r
+\r
+       var config = {};\r
+       var initialConfig = {};\r
+       var eventQueue = [];\r
+\r
+       /**\r
+       * @private\r
+       * Fires a configuration property event using the specified value. \r
+       * @param {string}       key                     The configuration property's name\r
+       * @param {value}        object          The value of the correct type for the property\r
+       */ \r
+       var fireEvent = function( key, value ) {\r
+               YAHOO.log("Firing Config event: " + key + "=" + value, "info");\r
+               \r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       property.event.fire(value);\r
+               }       \r
+       }\r
+       /* End Private Members */\r
+\r
+       this.addProperty = function( key, propertyObject ) {\r
+               key = key.toLowerCase();\r
+               \r
+               YAHOO.log("Added property: " + key, "info");\r
+\r
+               config[key] = propertyObject;\r
+\r
+               propertyObject.event = new YAHOO.util.CustomEvent(key);\r
+               propertyObject.key = key;\r
+\r
+               if (propertyObject.handler) {\r
+                       propertyObject.event.subscribe(propertyObject.handler, this.owner, true);\r
+               }\r
+\r
+               this.setProperty(key, propertyObject.value, true);\r
+               \r
+               if (! propertyObject.suppressEvent) {\r
+                       this.queueProperty(key, propertyObject.value);\r
+               }\r
+       }\r
+\r
+       this.getConfig = function() {\r
+               var cfg = {};\r
+                       \r
+               for (var prop in config) {\r
+                       var property = config[prop]\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               cfg[prop] = property.value;\r
+                       }\r
+               }\r
+               \r
+               return cfg;\r
+       }\r
+\r
+       this.getProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.value;\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.resetProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       this.setProperty(key, initialConfig[key].value);\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.setProperty = function(key, value, silent) {\r
+               key = key.toLowerCase();\r
+               \r
+               YAHOO.log("setProperty: " + key + "=" + value, "info");\r
+\r
+               if (this.queueInProgress && ! silent) {\r
+                       this.queueProperty(key,value); // Currently running through a queue... \r
+                       return true;\r
+               } else {\r
+                       var property = config[key];\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               if (property.validator && ! property.validator(value)) { // validator\r
+                                       return false;\r
+                               } else {\r
+                                       property.value = value;\r
+                                       if (! silent) {\r
+                                               fireEvent(key, value);\r
+                                               this.configChangedEvent.fire([key, value]);\r
+                                       }\r
+                                       return true;\r
+                               }\r
+                       } else {\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.queueProperty = function(key, value) {\r
+               key = key.toLowerCase();\r
+\r
+               YAHOO.log("queueProperty: " + key + "=" + value, "info");\r
+\r
+               var property = config[key];\r
+                                                       \r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator\r
+                               return false;\r
+                       } else {\r
+\r
+                               if (typeof value != 'undefined') {\r
+                                       property.value = value;\r
+                               } else {\r
+                                       value = property.value;\r
+                               }\r
+\r
+                               var foundDuplicate = false;\r
+\r
+                               for (var i=0;i<eventQueue.length;i++) {\r
+                                       var queueItem = eventQueue[i];\r
+\r
+                                       if (queueItem) {\r
+                                               var queueItemKey = queueItem[0];\r
+                                               var queueItemValue = queueItem[1];\r
+                                               \r
+                                               if (queueItemKey.toLowerCase() == key) {\r
+                                                       // found a dupe... push to end of queue, null current item, and break\r
+                                                       eventQueue[i] = null;\r
+                                                       eventQueue.push([key, (typeof value != 'undefined' ? value : queueItemValue)]);\r
+                                                       foundDuplicate = true;\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+                               \r
+                               if (! foundDuplicate && typeof value != 'undefined') { // this is a refire, or a new property in the queue\r
+                                       eventQueue.push([key, value]);\r
+                               }\r
+                       }\r
+\r
+                       if (property.supercedes) {\r
+                               for (var s=0;s<property.supercedes.length;s++) {\r
+                                       var supercedesCheck = property.supercedes[s];\r
+\r
+                                       for (var q=0;q<eventQueue.length;q++) {\r
+                                               var queueItemCheck = eventQueue[q];\r
+\r
+                                               if (queueItemCheck) {\r
+                                                       var queueItemCheckKey = queueItemCheck[0];\r
+                                                       var queueItemCheckValue = queueItemCheck[1];\r
+                                                       \r
+                                                       if ( queueItemCheckKey.toLowerCase() == supercedesCheck.toLowerCase() ) {\r
+                                                               eventQueue.push([queueItemCheckKey, queueItemCheckValue]);\r
+                                                               eventQueue[q] = null;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+       \r
+                       YAHOO.log("Config event queue: " + this.outputEventQueue(), "info");\r
+\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.refireEvent = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event && typeof property.value != 'undefined') {\r
+                       if (this.queueInProgress) {\r
+                               this.queueProperty(key);\r
+                       } else {\r
+                               fireEvent(key, property.value);\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.applyConfig = function(userConfig, init) {\r
+               if (init) {\r
+                       initialConfig = userConfig;\r
+               }\r
+               for (var prop in userConfig) {\r
+                       this.queueProperty(prop, userConfig[prop]);\r
+               }\r
+       }\r
+\r
+       this.refresh = function() {\r
+               for (var prop in config) {\r
+                       this.refireEvent(prop);\r
+               }\r
+       }\r
+\r
+       this.fireQueue = function() {\r
+               this.queueInProgress = true;\r
+               for (var i=0;i<eventQueue.length;i++) {\r
+                       var queueItem = eventQueue[i];\r
+                       if (queueItem) {\r
+                               var key = queueItem[0];\r
+                               var value = queueItem[1];\r
+                               \r
+                               var property = config[key];\r
+                               property.value = value;\r
+\r
+                               fireEvent(key,value);\r
+                       }\r
+               }\r
+               \r
+               this.queueInProgress = false;\r
+               eventQueue = new Array();\r
+       }\r
+\r
+       this.subscribeToConfigEvent = function(key, handler, obj, override) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {\r
+                               property.event.subscribe(handler, obj, override);\r
+                       }\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+\r
+       this.unsubscribeFromConfigEvent = function(key, handler, obj) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.event.unsubscribe(handler, obj);\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.toString = function() {\r
+               var output = "Config";\r
+               if (this.owner) {\r
+                       output += " [" + this.owner.toString() + "]";\r
+               }\r
+               return output;\r
+       }\r
+\r
+       this.outputEventQueue = function() {\r
+               var output = "";\r
+               for (var q=0;q<eventQueue.length;q++) {\r
+                       var queueItem = eventQueue[q];\r
+                       if (queueItem) {\r
+                               output += queueItem[0] + "=" + queueItem[1] + ", ";\r
+                       }\r
+               }\r
+               return output;\r
+       }\r
+}\r
+\r
+/**\r
+* Checks to determine if a particular function/object pair are already subscribed to the specified CustomEvent\r
+* @param {YAHOO.util.CustomEvent} evt  The CustomEvent for which to check the subscriptions\r
+* @param {Function}    fn      The function to look for in the subscribers list\r
+* @param {object}      obj     The execution scope object for the subscription\r
+* @return {boolean}    true, if the function/object pair is already subscribed to the CustomEvent passed in\r
+*/\r
+YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {\r
+       for (var e=0;e<evt.subscribers.length;e++) {\r
+               var subsc = evt.subscribers[e];\r
+               if (subsc && subsc.obj == obj && subsc.fn == fn) {\r
+                       return true;\r
+                       break;\r
+               }\r
+       }\r
+       return false;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class \r
+* Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.\r
+* @param {string}      el      The element ID representing the Module <em>OR</em>\r
+* @param {Element}     el      The element representing the Module\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Module = function(el, userConfig) {\r
+       if (el) { \r
+               this.init(el, userConfig); \r
+       } else {\r
+               YAHOO.log("No element or element ID specified for Module instantiation", "error");\r
+       }\r
+}\r
+\r
+/**\r
+* Constant representing the prefix path to use for non-secure images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";\r
+\r
+/**\r
+* Constant representing the prefix path to use for securely served images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";\r
+\r
+/**\r
+* Constant for the default CSS class name that represents a Module\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_MODULE = "module";\r
+\r
+/**\r
+* Constant representing the module header\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_HEADER = "hd";\r
+\r
+/**\r
+* Constant representing the module body\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_BODY = "bd";\r
+\r
+/**\r
+* Constant representing the module footer\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_FOOTER = "ft";\r
+\r
+/**\r
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = null;\r
+\r
+YAHOO.widget.Module.prototype = {\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type function\r
+       */\r
+       constructor : YAHOO.widget.Module,\r
+\r
+       /**\r
+       * The main module element that contains the header, body, and footer\r
+       * @type Element\r
+       */\r
+       element : null, \r
+\r
+       /**\r
+       * The header element, denoted with CSS class "hd"\r
+       * @type Element\r
+       */\r
+       header : null,\r
+\r
+       /**\r
+       * The body element, denoted with CSS class "bd"\r
+       * @type Element\r
+       */\r
+       body : null,\r
+\r
+       /**\r
+       * The footer element, denoted with CSS class "ft"\r
+       * @type Element\r
+       */\r
+       footer : null,\r
+\r
+       /**\r
+       * The id of the element\r
+       * @type string\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * Array of elements\r
+       * @type Element[]\r
+       */\r
+       childNodesInDOM : null,\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot : YAHOO.widget.Module.IMG_ROOT,\r
+\r
+       /**\r
+       * CustomEvent fired prior to class initalization.\r
+       * args: class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeInitEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after class initalization.\r
+       * args: class reference of the initializing class, such as this.initEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       initEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is appended to the DOM\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       appendEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeRenderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       renderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the header content of the Module is modified\r
+       * args: string/element representing the new header content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeHeaderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the body content of the Module is modified\r
+       * args: string/element representing the new body content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeBodyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the footer content of the Module is modified\r
+       * args: string/element representing the new footer content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeFooterEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the content of the Module is modified\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeContentEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is destroyed\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       destroyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeShowEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       showEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeHideEvent : null,\r
+       \r
+       /**\r
+       * CustomEvent fired after the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       hideEvent : null,\r
+               \r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initEvents : function() {\r
+\r
+               this.beforeInitEvent            = new YAHOO.util.CustomEvent("beforeInit");\r
+               this.initEvent                          = new YAHOO.util.CustomEvent("init");\r
+\r
+               this.appendEvent                        = new YAHOO.util.CustomEvent("append");\r
+\r
+               this.beforeRenderEvent          = new YAHOO.util.CustomEvent("beforeRender");\r
+               this.renderEvent                        = new YAHOO.util.CustomEvent("render");\r
+\r
+               this.changeHeaderEvent          = new YAHOO.util.CustomEvent("changeHeader");\r
+               this.changeBodyEvent            = new YAHOO.util.CustomEvent("changeBody");\r
+               this.changeFooterEvent          = new YAHOO.util.CustomEvent("changeFooter");\r
+\r
+               this.changeContentEvent         = new YAHOO.util.CustomEvent("changeContent");\r
+\r
+               this.destroyEvent                       = new YAHOO.util.CustomEvent("destroy");\r
+               this.beforeShowEvent            = new YAHOO.util.CustomEvent("beforeShow");\r
+               this.showEvent                          = new YAHOO.util.CustomEvent("show");\r
+               this.beforeHideEvent            = new YAHOO.util.CustomEvent("beforeHide");\r
+               this.hideEvent                          = new YAHOO.util.CustomEvent("hide");\r
+       }, \r
+\r
+       /**\r
+       * String representing the current user-agent platform\r
+       * @type string\r
+       */\r
+       platform : function() {\r
+                                       var ua = navigator.userAgent.toLowerCase();\r
+                                       if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {\r
+                                               return "windows";\r
+                                       } else if (ua.indexOf("macintosh") != -1) {\r
+                                               return "mac";\r
+                                       } else {\r
+                                               return false;\r
+                                       }\r
+                               }(),\r
+\r
+       /**\r
+       * String representing the current user-agent browser\r
+       * @type string\r
+       */\r
+       browser : function() {\r
+                       var ua = navigator.userAgent.toLowerCase();\r
+                                 if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)\r
+                                        return 'opera';\r
+                                 } else if (ua.indexOf('msie 7')!=-1) { // IE7\r
+                                        return 'ie7';\r
+                                 } else if (ua.indexOf('msie') !=-1) { // IE\r
+                                        return 'ie';\r
+                                 } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")\r
+                                        return 'safari';\r
+                                 } else if (ua.indexOf('gecko') != -1) { // Gecko\r
+                                        return 'gecko';\r
+                                 } else {\r
+                                        return false;\r
+                                 }\r
+                       }(),\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure : function() {\r
+               if (window.location.href.toLowerCase().indexOf("https") == 0) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }(),\r
+\r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initDefaultConfig : function() {\r
+               // Add properties //\r
+\r
+               this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );\r
+               this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );\r
+               this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );\r
+       },\r
+\r
+       /**\r
+       * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+       * @param {string}       el      The element ID representing the Module <em>OR</em>\r
+       * @param {Element}      el      The element representing the Module\r
+       * @param {object}       userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+       */\r
+       init : function(el, userConfig) {\r
+\r
+               this.initEvents();\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Module);\r
+\r
+               this.cfg = new YAHOO.util.Config(this);\r
+               \r
+               if (this.isSecure) {\r
+                       this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;\r
+               }\r
+\r
+               if (typeof el == "string") {\r
+                       var elId = el;\r
+\r
+                       el = document.getElementById(el);\r
+                       if (! el) {\r
+                               el = document.createElement("DIV");\r
+                               el.id = elId;\r
+                       }\r
+               }\r
+\r
+               this.element = el;\r
+               \r
+               if (el.id) {\r
+                       this.id = el.id;\r
+               } \r
+\r
+               var childNodes = this.element.childNodes;\r
+\r
+               if (childNodes) {\r
+                       for (var i=0;i<childNodes.length;i++) {\r
+                               var child = childNodes[i];\r
+                               switch (child.className) {\r
+                                       case YAHOO.widget.Module.CSS_HEADER:\r
+                                               this.header = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_BODY:\r
+                                               this.body = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_FOOTER:\r
+                                               this.footer = child;\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               this.initDefaultConfig();\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+\r
+               // Subscribe to the fireQueue() method of Config so that any queued configuration changes are\r
+               // excecuted upon render of the Module\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {\r
+                       this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);\r
+               }\r
+\r
+               this.initEvent.fire(YAHOO.widget.Module);\r
+       },\r
+\r
+       /**\r
+       * Initialized an empty DOM element that is placed out of the visible area that can be used to detect text resize.\r
+       */\r
+       initResizeMonitor : function() {\r
+\r
+        if(this.browser != "opera") {\r
+\r
+            var resizeMonitor = document.getElementById("_yuiResizeMonitor");\r
+    \r
+            if (! resizeMonitor) {\r
+    \r
+                resizeMonitor = document.createElement("iframe");\r
+    \r
+                var bIE = (this.browser.indexOf("ie") === 0);\r
+    \r
+                if(this.isSecure && this.RESIZE_MONITOR_SECURE_URL && bIE) {\r
+    \r
+                    resizeMonitor.src = this.RESIZE_MONITOR_SECURE_URL;\r
+    \r
+                }\r
+                \r
+                resizeMonitor.id = "_yuiResizeMonitor";\r
+                resizeMonitor.style.visibility = "hidden";\r
+                \r
+                document.body.appendChild(resizeMonitor);\r
+    \r
+                resizeMonitor.style.width = "10em";\r
+                resizeMonitor.style.height = "10em";\r
+                resizeMonitor.style.position = "absolute";\r
+                \r
+                var nLeft = -1 * resizeMonitor.offsetWidth,\r
+                    nTop = -1 * resizeMonitor.offsetHeight;\r
+    \r
+                resizeMonitor.style.top = nTop + "px";\r
+                resizeMonitor.style.left =  nLeft + "px";\r
+                resizeMonitor.style.borderStyle = "none";\r
+                resizeMonitor.style.borderWidth = "0";\r
+                YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0");\r
+                \r
+                resizeMonitor.style.visibility = "visible";\r
+    \r
+                if(!bIE) {\r
+    \r
+                    var doc = resizeMonitor.contentWindow.document;\r
+    \r
+                    doc.open();\r
+                    doc.close();\r
+                \r
+                }\r
+    \r
+            }\r
+    \r
+            if(resizeMonitor && resizeMonitor.contentWindow) {\r
+    \r
+                this.resizeMonitor = resizeMonitor;\r
+    \r
+                YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true);\r
+    \r
+            }\r
+        \r
+        }\r
+\r
+       },\r
+\r
+       /**\r
+       * Event handler fired when the resize monitor element is resized.\r
+       */\r
+       onDomResize : function(e, obj) { \r
+\r
+        var nLeft = -1 * this.resizeMonitor.offsetWidth,\r
+            nTop = -1 * this.resizeMonitor.offsetHeight;\r
+        \r
+        this.resizeMonitor.style.top = nTop + "px";\r
+        this.resizeMonitor.style.left =  nLeft + "px";\r
+       \r
+       },\r
+\r
+       /**\r
+       * Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {string}       headerContent   The HTML used to set the header <em>OR</em>\r
+       * @param {Element}      headerContent   The Element to append to the header\r
+       */      \r
+       setHeader : function(headerContent) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               if (typeof headerContent == "string") {\r
+                       this.header.innerHTML = headerContent;\r
+               } else {\r
+                       this.header.innerHTML = "";\r
+                       this.header.appendChild(headerContent);\r
+               }\r
+\r
+               this.changeHeaderEvent.fire(headerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the header\r
+       */      \r
+       appendToHeader : function(element) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               this.header.appendChild(element);\r
+               this.changeHeaderEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {string}       bodyContent     The HTML used to set the body <em>OR</em>\r
+       * @param {Element}      bodyContent     The Element to append to the body\r
+       */              \r
+       setBody : function(bodyContent) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               if (typeof bodyContent == "string")\r
+               {\r
+                       this.body.innerHTML = bodyContent;\r
+               } else {\r
+                       this.body.innerHTML = "";\r
+                       this.body.appendChild(bodyContent);\r
+               }\r
+\r
+               this.changeBodyEvent.fire(bodyContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the body\r
+       */\r
+       appendToBody : function(element) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               this.body.appendChild(element);\r
+               this.changeBodyEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {string}       footerContent   The HTML used to set the footer <em>OR</em>\r
+       * @param {Element}      footerContent   The Element to append to the footer\r
+       */      \r
+       setFooter : function(footerContent) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               if (typeof footerContent == "string") {\r
+                       this.footer.innerHTML = footerContent;\r
+               } else {\r
+                       this.footer.innerHTML = "";\r
+                       this.footer.appendChild(footerContent);\r
+               }\r
+\r
+               this.changeFooterEvent.fire(footerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the footer\r
+       */\r
+       appendToFooter : function(element) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               this.footer.appendChild(element);\r
+               this.changeFooterEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+       * @param {string}       appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+       * @param {Element}      appendToNode    The element to which the Module should be appended to prior to rendering        \r
+       * @param {Element}      moduleElement   OPTIONAL. The element that represents the actual Standard Module container. \r
+       * @return {boolean} Success or failure of the render\r
+       */\r
+       render : function(appendToNode, moduleElement) {\r
+               this.beforeRenderEvent.fire();\r
+\r
+               if (! moduleElement) {\r
+                       moduleElement = this.element;\r
+               }\r
+\r
+               var me = this;\r
+               var appendTo = function(element) {\r
+                       if (typeof element == "string") {\r
+                               element = document.getElementById(element);\r
+                       }\r
+                       \r
+                       if (element) {\r
+                               element.appendChild(me.element);\r
+                               me.appendEvent.fire();\r
+                       }\r
+               }\r
+\r
+               if (appendToNode) {\r
+                       appendTo(appendToNode);\r
+               } else { // No node was passed in. If the element is not pre-marked up, this fails\r
+                       if (! YAHOO.util.Dom.inDocument(this.element)) {\r
+                               YAHOO.log("Render failed. Must specify appendTo node if Module isn't already in the DOM.", "error");\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               // Need to get everything into the DOM if it isn't already\r
+               \r
+               if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {\r
+                       // There is a header, but it's not in the DOM yet... need to add it\r
+                       var firstChild = moduleElement.firstChild;\r
+                       if (firstChild) { // Insert before first child if exists\r
+                               moduleElement.insertBefore(this.header, firstChild);\r
+                       } else { // Append to empty body because there are no children\r
+                               moduleElement.appendChild(this.header);\r
+                       }\r
+               }\r
+\r
+               if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {\r
+                       // There is a body, but it's not in the DOM yet... need to add it\r
+                       if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM\r
+                               moduleElement.insertBefore(this.body, this.footer);\r
+                       } else { // Append to element because there is no footer\r
+                               moduleElement.appendChild(this.body);\r
+                       }\r
+               }\r
+\r
+               if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {\r
+                       // There is a footer, but it's not in the DOM yet... need to add it\r
+                       moduleElement.appendChild(this.footer);\r
+               }\r
+\r
+               this.renderEvent.fire();\r
+               return true;\r
+       },\r
+\r
+       /**\r
+       * Removes the Module element from the DOM and sets all child elements to null.\r
+       */\r
+       destroy : function() {\r
+               if (this.element) {\r
+                       var parent = this.element.parentNode;\r
+               }\r
+               if (parent) {\r
+                       parent.removeChild(this.element);\r
+               }\r
+\r
+               this.element = null;\r
+               this.header = null;\r
+               this.body = null;\r
+               this.footer = null;\r
+\r
+               this.destroyEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.\r
+       */\r
+       show : function() {\r
+               this.cfg.setProperty("visible", true);\r
+       },\r
+\r
+       /**\r
+       * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.\r
+       */\r
+       hide : function() {\r
+               this.cfg.setProperty("visible", false);\r
+       },\r
+\r
+       // BUILT-IN EVENT HANDLERS FOR MODULE //\r
+\r
+       /**\r
+       * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".\r
+       * This method is responsible for firing showEvent and hideEvent.\r
+       */\r
+       configVisible : function(type, args, obj) {\r
+               var visible = args[0];\r
+               if (visible) {\r
+                       this.beforeShowEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "block");\r
+                       this.showEvent.fire();\r
+               } else {\r
+                       this.beforeHideEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "none");\r
+                       this.hideEvent.fire();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Default event handler for the "monitorresize" configuration property\r
+       */\r
+       configMonitorResize : function(type, args, obj) {\r
+               var monitor = args[0];\r
+               if (monitor) {\r
+                       this.initResizeMonitor();\r
+               } else {\r
+                       YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);\r
+                       this.resizeMonitor = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Module.prototype.toString = function() {\r
+       return "Module " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Overlay = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);\r
+\r
+/**\r
+* The URL of the blank image that will be placed in the iframe\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.IFRAME_SRC = "promo/m/irs/blank.gif";\r
+\r
+/**\r
+* Constant representing the top left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_LEFT = "tl";\r
+\r
+/**\r
+* Constant representing the top right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";\r
+\r
+/**\r
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";\r
+\r
+/**\r
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";\r
+\r
+/**\r
+* Constant representing the default CSS class used for an Overlay\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";\r
+\r
+/**\r
+* CustomEvent fired before the Overlay is moved.\r
+* args: x,y that the Overlay will be moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.beforeMoveEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the Overlay is moved.\r
+* args: x,y that the Overlay was moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Overlay);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       if (this.platform == "mac" && this.browser == "gecko") {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {\r
+                       this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {\r
+                       this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);\r
+               }\r
+       }\r
+\r
+       this.initEvent.fire(YAHOO.widget.Overlay);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.\r
+*/\r
+YAHOO.widget.Overlay.prototype.initEvents = function() {\r
+       YAHOO.widget.Overlay.superclass.initEvents.call(this);\r
+\r
+       this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);\r
+       this.moveEvent = new YAHOO.util.CustomEvent("move", this);\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add overlay config properties //\r
+       this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );\r
+\r
+       this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );\r
+\r
+       this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );\r
+       this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );\r
+}\r
+\r
+/**\r
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);\r
+* @param {int} x       The Overlay's new x position\r
+* @param {int} y       The Overlay's new y position\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {\r
+       this.cfg.setProperty("xy",[x,y]);\r
+}\r
+\r
+/**\r
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");\r
+}\r
+\r
+/**\r
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "show-scrollbars");\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {\r
+       var visible = args[0];\r
+       var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");\r
+\r
+       var effect = this.cfg.getProperty("effect");\r
+\r
+       var effectInstances = new Array();\r
+       if (effect) {\r
+               if (effect instanceof Array) {\r
+                       for (var i=0;i<effect.length;i++) {\r
+                               var eff = effect[i];\r
+                               effectInstances[effectInstances.length] = eff.effect(this, eff.duration);\r
+                       }\r
+               } else {\r
+                       effectInstances[effectInstances.length] = effect.effect(this, effect.duration);\r
+               }\r
+       }\r
+\r
+       var isMacGecko = (this.platform == "mac" && this.browser == "gecko");\r
+\r
+       if (visible) { // Show\r
+               if (isMacGecko) {\r
+                       this.showMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate in\r
+                       if (visible) { // Animate in if not showing\r
+                               if (currentVis != "visible") {\r
+                                       this.beforeShowEvent.fire();\r
+                                       for (var i=0;i<effectInstances.length;i++) {\r
+                                               var e = effectInstances[i];\r
+                                               if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)) {\r
+                                                       e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true); // Delegate showEvent until end of animateInComplete\r
+                                               }\r
+                                               e.animateIn();\r
+                                       }\r
+                               }\r
+                       }\r
+               } else { // Show\r
+                       if (currentVis != "visible") {\r
+                               this.beforeShowEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "visible");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.showEvent.fire();\r
+                       }\r
+               }\r
+\r
+       } else { // Hide\r
+               if (isMacGecko) {\r
+                       this.hideMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate out if showing\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               for (var i=0;i<effectInstances.length;i++) {\r
+                                       var e = effectInstances[i];\r
+                                       if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)) {                            \r
+                                               e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true); // Delegate hideEvent until end of animateOutComplete\r
+                                       }\r
+                                       e.animateOut();\r
+                               }\r
+                       }\r
+               } else { // Simple hide\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.hideEvent.fire();\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+/**\r
+* Center event handler used for centering on scroll/resize, but only if the Overlay is visible\r
+*/\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function() {\r
+       if (this.cfg.getProperty("visible")) {\r
+               this.center();\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "fixedcenter" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configFixedCenter = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       if (val) {\r
+               this.center();\r
+                       \r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) {\r
+                       this.beforeShowEvent.subscribe(this.center, this, true);\r
+               }\r
+               \r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);\r
+               }\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe( this.doCenterOnDOMEvent, this, true);\r
+               }\r
+       } else {\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "zIndex" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {\r
+       var zIndex = args[0];\r
+\r
+       var el = this.element;\r
+\r
+       if (! zIndex) {\r
+               zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");\r
+               if (! zIndex || isNaN(zIndex)) {\r
+                       zIndex = 0;\r
+               }\r
+       }\r
+\r
+       if (this.iframe) {\r
+               if (zIndex <= 0) {\r
+                       zIndex = 1;\r
+               }\r
+               YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));\r
+       }\r
+\r
+       YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);\r
+       this.cfg.setProperty("zIndex", zIndex, true);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "xy" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {\r
+       var pos = args[0];\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       this.cfg.setProperty("x", x);\r
+       this.cfg.setProperty("y", y);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.log("xy: " + [x,y], "iframe");\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x,y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "x" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {\r
+       var x = args[0];\r
+       var y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setX(this.element, x, true);\r
+       \r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "y" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {\r
+       var x = this.cfg.getProperty("x");\r
+       var y = args[0];\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setY(this.element, y, true);\r
+\r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "iframe" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {\r
+\r
+       var val = args[0];\r
+\r
+       var el = this.element;\r
+       \r
+       var showIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "block";\r
+               }\r
+       }\r
+\r
+       var hideIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+       }\r
+\r
+       if (val) { // IFRAME shim is enabled\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, showIframe, this)) {\r
+                       this.showEvent.subscribe(showIframe, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, hideIframe, this)) {\r
+                       this.hideEvent.subscribe(hideIframe, this, true);\r
+               }\r
+\r
+               var x = this.cfg.getProperty("x");\r
+               var y = this.cfg.getProperty("y");\r
+\r
+               if (! x || ! y) {\r
+                       YAHOO.log("syncPosition needed for iframe", "iframe");\r
+                       this.syncPosition();\r
+                       x = this.cfg.getProperty("x");\r
+                       y = this.cfg.getProperty("y");\r
+               }\r
+\r
+               YAHOO.log("iframe positioning to: " + [x,y], "iframe");\r
+\r
+               if (! isNaN(x) && ! isNaN(y)) {\r
+                       if (! this.iframe) {\r
+                               this.iframe = document.createElement("iframe");\r
+                               if (this.isSecure) {\r
+                                       this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC;\r
+                               }\r
+                               \r
+                               var parent = el.parentNode;\r
+                               if (parent) {\r
+                                       parent.appendChild(this.iframe);\r
+                               } else {\r
+                                       document.body.appendChild(this.iframe);\r
+                               }\r
+\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "border", "none");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");\r
+                               if (this.cfg.getProperty("visible")) {\r
+                                       showIframe.call(this);\r
+                               } else {\r
+                                       hideIframe.call(this);\r
+                               }\r
+                       }\r
+                       \r
+                       var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "block";\r
+                       }\r
+\r
+                       YAHOO.util.Dom.setXY(this.iframe, [x,y]);\r
+\r
+                       var width = el.clientWidth;\r
+                       var height = el.clientHeight;\r
+\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "none";\r
+                       }\r
+               }\r
+       } else {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+               this.showEvent.unsubscribe(showIframe, this);\r
+               this.hideEvent.unsubscribe(hideIframe, this);\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* The default event handler fired when the "constraintoviewport" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {\r
+                       this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);\r
+               }\r
+       } else {\r
+               this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {\r
+       var contextArgs = args[0];\r
+\r
+       if (contextArgs) {\r
+               var contextEl = contextArgs[0];\r
+               var elementMagnetCorner = contextArgs[1];\r
+               var contextMagnetCorner = contextArgs[2];\r
+\r
+               if (contextEl) {\r
+                       if (typeof contextEl == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);\r
+                       }\r
+                       \r
+                       if (elementMagnetCorner && contextMagnetCorner) {\r
+                               this.align(elementMagnetCorner, contextMagnetCorner);\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.\r
+* @param {string} elementAlign         The string representing the corner of the Overlay that should be aligned to the context element\r
+* @param {string} contextAlign         The corner of the context element that the elementAlign corner should stick to.\r
+*/\r
+YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {\r
+       var contextArgs = this.cfg.getProperty("context");\r
+       if (contextArgs) {\r
+               var context = contextArgs[0];\r
+               \r
+               var element = this.element;\r
+               var me = this;\r
+\r
+               if (! elementAlign) {\r
+                       elementAlign = contextArgs[1];\r
+               }\r
+\r
+               if (! contextAlign) {\r
+                       contextAlign = contextArgs[2];\r
+               }\r
+\r
+               if (element && context) {\r
+                       var elementRegion = YAHOO.util.Dom.getRegion(element);\r
+                       var contextRegion = YAHOO.util.Dom.getRegion(context);\r
+\r
+                       var doAlign = function(v,h) {\r
+                               switch (elementAlign) {\r
+                                       case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                               me.moveTo(h,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                               me.moveTo(h,v-element.offsetHeight);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v-element.offsetHeight);\r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       switch (contextAlign) {\r
+                               case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                       doAlign(contextRegion.top, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                       doAlign(contextRegion.top, contextRegion.right);\r
+                                       break;          \r
+                               case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.right);\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.\r
+*/\r
+YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {\r
+       var pos = args[0];\r
+\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       var width = parseInt(this.cfg.getProperty("width"));\r
+\r
+       if (isNaN(width)) {\r
+               width = 0;\r
+       }\r
+\r
+       var offsetHeight = this.element.offsetHeight;\r
+       var offsetWidth = (width>0?width:this.element.offsetWidth); //this.element.offsetWidth;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+       var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+       var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+       var topConstraint = scrollY + 10;\r
+       var leftConstraint = scrollX + 10;\r
+       var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+       var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+       \r
+       if (x < leftConstraint) {\r
+               x = leftConstraint;\r
+       } else if (x > rightConstraint) {\r
+               x = rightConstraint;\r
+       }\r
+\r
+       if (y < topConstraint) {\r
+               y = topConstraint;\r
+       } else if (y > bottomConstraint) {\r
+               y = bottomConstraint;\r
+       }\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+       this.cfg.setProperty("xy", [x,y], true);\r
+}\r
+\r
+/**\r
+* Centers the container in the viewport.\r
+*/\r
+YAHOO.widget.Overlay.prototype.center = function() {\r
+       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getClientWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getClientHeight();\r
+\r
+       var elementWidth = this.element.offsetWidth;\r
+       var elementHeight = this.element.offsetHeight;\r
+\r
+       var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;\r
+       var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;\r
+       \r
+       this.element.style.left = parseInt(x) + "px";\r
+       this.element.style.top = parseInt(y) + "px";\r
+       this.syncPosition();\r
+\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.\r
+*/\r
+YAHOO.widget.Overlay.prototype.syncPosition = function() {\r
+       var pos = YAHOO.util.Dom.getXY(this.element);\r
+       this.cfg.setProperty("x", pos[0], true);\r
+       this.cfg.setProperty("y", pos[1], true);\r
+       this.cfg.setProperty("xy", pos, true);\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {\r
+       YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Removes the Overlay element from the DOM and sets all child elements to null.\r
+*/\r
+YAHOO.widget.Overlay.prototype.destroy = function() {\r
+       if (this.iframe) {\r
+               this.iframe.parentNode.removeChild(this.iframe);\r
+       }\r
+       \r
+       this.iframe = null;\r
+\r
+       YAHOO.widget.Overlay.superclass.destroy.call(this);  \r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Overlay.prototype.toString = function() {\r
+       return "Overlay " + this.id;\r
+}\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window scroll\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window resize\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window scroll\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowScrollEvent.fire();\r
+}\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window resize\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowResizeEvent.fire();\r
+}\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Overlay._initialized == null;\r
+\r
+if (YAHOO.widget.Overlay._initialized == null) {\r
+       YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);\r
+       YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);\r
+\r
+       YAHOO.widget.Overlay._initialized = true;\r
+}\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* OverlayManager is used for maintaining the focus status of multiple Overlays.\r
+* @param {Array}       overlays        Optional. A collection of Overlays to register with the manager.\r
+* @param {object}      userConfig              The object literal representing the user configuration of the OverlayManager\r
+* @constructor\r
+*/\r
+YAHOO.widget.OverlayManager = function(userConfig) {\r
+       this.init(userConfig);\r
+}\r
+\r
+/**\r
+* The CSS class representing a focused Overlay\r
+* @type string\r
+*/\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";\r
+\r
+YAHOO.widget.OverlayManager.prototype = {\r
+\r
+       constructor : YAHOO.widget.OverlayManager,\r
+\r
+       /**\r
+       * The array of Overlays that are currently registered\r
+       * @type Array\r
+       */\r
+       overlays : null,\r
+\r
+       /**\r
+       * Initializes the default configuration of the OverlayManager\r
+       */      \r
+       initDefaultConfig : function() {\r
+               this.cfg.addProperty("overlays", { suppressEvent:true } );\r
+               this.cfg.addProperty("focusevent", { value:"mousedown" } );\r
+       }, \r
+\r
+       /**\r
+       * Returns the currently focused Overlay\r
+       * @return {Overlay}     The currently focused Overlay\r
+       */\r
+       getActive : function() {},\r
+\r
+       /**\r
+       * Focuses the specified Overlay\r
+       * @param {Overlay}      The Overlay to focus\r
+       * @param {string}       The id of the Overlay to focus\r
+       */\r
+       focus : function(overlay) {},\r
+\r
+       /**\r
+       * Removes the specified Overlay from the manager\r
+       * @param {Overlay}      The Overlay to remove\r
+       * @param {string}       The id of the Overlay to remove\r
+       */\r
+       remove: function(overlay) {},\r
+\r
+       /**\r
+       * Removes focus from all registered Overlays in the manager\r
+       */\r
+       blurAll : function() {},\r
+\r
+       /**\r
+       * Initializes the OverlayManager\r
+       * @param {Array}        overlays        Optional. A collection of Overlays to register with the manager.\r
+       * @param {object}       userConfig              The object literal representing the user configuration of the OverlayManager\r
+       */\r
+       init : function(userConfig) {\r
+               this.cfg = new YAHOO.util.Config(this);\r
+\r
+               this.initDefaultConfig();\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               this.cfg.fireQueue();\r
+\r
+               var activeOverlay = null;\r
+\r
+               this.getActive = function() {\r
+                       return activeOverlay;\r
+               }\r
+\r
+               this.focus = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               this.blurAll();\r
+                               activeOverlay = o;\r
+                               YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");\r
+                               if (! isNaN(topZIndex) && this.overlays[0] != overlay) {\r
+                                       activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex) + 1));\r
+                               }\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                       }\r
+               }\r
+\r
+               this.remove = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");\r
+                               o.cfg.setProperty("zIndex", -1000, true);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               this.overlays = this.overlays.slice(0, this.overlays.length-1);\r
+                               o.cfg.setProperty("zIndex", originalZ, true);\r
+\r
+                               o.cfg.setProperty("manager", null);\r
+                               o.focusEvent = null\r
+                               o.blurEvent = null;\r
+                               o.focus = null;\r
+                               o.blur = null;\r
+                       }\r
+               }\r
+\r
+               this.blurAll = function() {\r
+                       activeOverlay = null;\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               YAHOO.util.Dom.removeClass(this.overlays[o].element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                       }               \r
+               }\r
+\r
+               var overlays = this.cfg.getProperty("overlays");\r
+               \r
+               if (! this.overlays) {\r
+                       this.overlays = new Array();\r
+               }\r
+\r
+               if (overlays) {\r
+                       this.register(overlays);\r
+                       this.overlays.sort(this.compareZIndexDesc);\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.\r
+       * @param {Overlay}      overlay         An Overlay to register with the manager.\r
+       * @param {Overlay[]}    overlay         An array of Overlays to register with the manager.\r
+       * @return       {boolean}       True if any Overlays are registered.\r
+       */\r
+       register : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       overlay.cfg.addProperty("manager", { value:this } );\r
+\r
+                       overlay.focusEvent = new YAHOO.util.CustomEvent("focus");\r
+                       overlay.blurEvent = new YAHOO.util.CustomEvent("blur");\r
+                       \r
+                       var mgr=this;\r
+\r
+                       overlay.focus = function() {\r
+                               mgr.focus(this);\r
+                               this.focusEvent.fire();\r
+                       } \r
+\r
+                       overlay.blur = function() {\r
+                               mgr.blurAll();\r
+                               this.blurEvent.fire();\r
+                       }\r
+\r
+                       var focusOnDomEvent = function(e,obj) {\r
+                               overlay.focus();\r
+                       }\r
+                       \r
+                       var focusevent = this.cfg.getProperty("focusevent");\r
+                       YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);\r
+\r
+                       var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex");\r
+                       if (! isNaN(zIndex)) {\r
+                               overlay.cfg.setProperty("zIndex", parseInt(zIndex));\r
+                       } else {\r
+                               overlay.cfg.setProperty("zIndex", 0);\r
+                       }\r
+                       \r
+                       this.overlays.push(overlay);\r
+                       return true;\r
+               } else if (overlay instanceof Array) {\r
+                       var regcount = 0;\r
+                       for (var i=0;i<overlay.length;i++) {\r
+                               if (this.register(overlay[i])) {\r
+                                       regcount++;\r
+                               }\r
+                       }\r
+                       if (regcount > 0) {\r
+                               return true;\r
+                       }\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Attempts to locate an Overlay by instance or ID.\r
+       * @param {Overlay}      overlay         An Overlay to locate within the manager\r
+       * @param {string}       overlay         An Overlay id to locate within the manager\r
+       * @return       {Overlay}       The requested Overlay, if found, or null if it cannot be located.\r
+       */\r
+       find : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o] == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }\r
+               } else if (typeof overlay == "string") {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o].id == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }                       \r
+               }\r
+               return null;\r
+       },\r
+\r
+       /**\r
+       * Used for sorting the manager's Overlays by z-index.\r
+       * @private\r
+       */\r
+       compareZIndexDesc : function(o1, o2) {\r
+               var zIndex1 = o1.cfg.getProperty("zIndex");\r
+               var zIndex2 = o2.cfg.getProperty("zIndex");\r
+\r
+               if (zIndex1 > zIndex2) {\r
+                       return -1;\r
+               } else if (zIndex1 < zIndex2) {\r
+                       return 1;\r
+               } else {\r
+                       return 0;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Shows all Overlays in the manager.\r
+       */\r
+       showAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].show();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Hides all Overlays in the manager.\r
+       */\r
+       hideAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].hide();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       toString : function() {\r
+               return "OverlayManager";\r
+       }\r
+\r
+}/**\r
+* Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+* Code licensed under the BSD License:\r
+* http://developer.yahoo.net/yui/license.txt\r
+* KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.\r
+* @param {Element}     attachTo        The element or element ID to which the key event should be attached\r
+* @param {string}      attachTo        The element or element ID to which the key event should be attached\r
+* @param {object}      keyData         The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).\r
+* @param {function}    handler         The CustomEvent handler to fire when the key event is detected\r
+* @param {object}      handler         An object literal representing the handler. \r
+* @param {string}      event           Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.\r
+* @constructor\r
+*/\r
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {\r
+       if (! attachTo) {\r
+               YAHOO.log("No attachTo element specified", "error");\r
+       }\r
+       if (! keyData) {\r
+               YAHOO.log("No keyData specified", "error");\r
+       }\r
+       if (! handler) {\r
+               YAHOO.log("No handler specified", "error");\r
+       }\r
+\r
+       if (! event) {\r
+               event = YAHOO.util.KeyListener.KEYDOWN;\r
+       }\r
+\r
+       var keyEvent = new YAHOO.util.CustomEvent("keyPressed");\r
+       \r
+       this.enabledEvent = new YAHOO.util.CustomEvent("enabled");\r
+       this.disabledEvent = new YAHOO.util.CustomEvent("disabled");\r
+\r
+       if (typeof attachTo == 'string') {\r
+               attachTo = document.getElementById(attachTo);\r
+       }\r
+\r
+       if (typeof handler == 'function') {\r
+               keyEvent.subscribe(handler);\r
+       } else {\r
+               keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);\r
+       }\r
+\r
+       /**\r
+       * Handles the key event when a key is pressed.\r
+       * @private\r
+       */\r
+       function handleKeyPress(e, obj) {\r
+               var keyPressed = e.charCode || e.keyCode;\r
+               \r
+               if (! keyData.shift)    keyData.shift = false;\r
+               if (! keyData.alt)              keyData.alt = false;\r
+               if (! keyData.ctrl)             keyData.ctrl = false;\r
+\r
+               // check held down modifying keys first\r
+               if (e.shiftKey == keyData.shift && \r
+                       e.altKey   == keyData.alt &&\r
+                       e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match\r
+\r
+                       if (keyData.keys instanceof Array) {\r
+                               for (var i=0;i<keyData.keys.length;i++) {\r
+                                       if (keyPressed == keyData.keys[i]) {\r
+                                               keyEvent.fire(keyPressed, e);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               if (keyPressed == keyData.keys) {\r
+                                       keyEvent.fire(keyPressed, e);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.enable = function() {\r
+               if (! this.enabled) {\r
+                       YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);\r
+                       this.enabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = true;\r
+       }\r
+\r
+       this.disable = function() {\r
+               if (this.enabled) {\r
+                       YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);\r
+                       this.disabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = false;\r
+       }\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       this.toString = function() {\r
+               return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + (attachTo.id ? "[" + attachTo.id + "]" : "");\r
+       }\r
+\r
+}\r
+\r
+/**\r
+* Constant representing the DOM "keydown" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYDOWN = "keydown";\r
+\r
+/**\r
+* Constant representing the DOM "keyup" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYUP = "keyup";\r
+\r
+/**\r
+* Boolean indicating the enabled/disabled state of the Tooltip\r
+* @type Booleam\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabled = null;\r
+\r
+/**\r
+* Enables the KeyListener, by dynamically attaching the key event to the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.enable = function() {};\r
+\r
+/**\r
+* Disables the KeyListener, by dynamically removing the key event from the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.disable = function() {};\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is enabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabledEvent = null;\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is disabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.disabledEvent = null;
\ No newline at end of file
diff --git a/lib/yui/container/container_core-min.js b/lib/yui/container/container_core-min.js
new file mode 100755 (executable)
index 0000000..1b62d14
--- /dev/null
@@ -0,0 +1,153 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+YAHOO.util.Config=function(owner){if(owner){this.init(owner);}}\r
+YAHOO.util.Config.prototype={owner:null,configChangedEvent:null,queueInProgress:false,addProperty:function(key,propertyObject){},getConfig:function(){},getProperty:function(key){},resetProperty:function(key){},setProperty:function(key,value,silent){},queueProperty:function(key,value){},refireEvent:function(key){},applyConfig:function(userConfig,init){},refresh:function(){},fireQueue:function(){},subscribeToConfigEvent:function(key,handler,obj,override){},unsubscribeFromConfigEvent:function(key,handler,obj){},checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}}\r
+YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}}\r
+this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);}\r
+this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}}\r
+this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop]\r
+if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}}\r
+return cfg;}\r
+this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}}\r
+this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){this.setProperty(key,initialConfig[key].value);}else{return undefined;}}\r
+this.setProperty=function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=config[key];if(typeof property!='undefined'&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){fireEvent(key,value);this.configChangedEvent.fire([key,value]);}\r
+return true;}}else{return false;}}}\r
+this.queueProperty=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(typeof value!='undefined'&&property.validator&&!property.validator(value)){return false;}else{if(typeof value!='undefined'){property.value=value;}else{value=property.value;}\r
+var foundDuplicate=false;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey.toLowerCase()==key){eventQueue[i]=null;eventQueue.push([key,(typeof value!='undefined'?value:queueItemValue)]);foundDuplicate=true;break;}}}\r
+if(!foundDuplicate&&typeof value!='undefined'){eventQueue.push([key,value]);}}\r
+if(property.supercedes){for(var s=0;s<property.supercedes.length;s++){var supercedesCheck=property.supercedes[s];for(var q=0;q<eventQueue.length;q++){var queueItemCheck=eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey.toLowerCase()==supercedesCheck.toLowerCase()){eventQueue.push([queueItemCheckKey,queueItemCheckValue]);eventQueue[q]=null;break;}}}}}\r
+return true;}else{return false;}}\r
+this.refireEvent=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event&&typeof property.value!='undefined'){if(this.queueInProgress){this.queueProperty(key);}else{fireEvent(key,property.value);}}}\r
+this.applyConfig=function(userConfig,init){if(init){initialConfig=userConfig;}\r
+for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}}\r
+this.refresh=function(){for(var prop in config){this.refireEvent(prop);}}\r
+this.fireQueue=function(){this.queueInProgress=true;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=config[key];property.value=value;fireEvent(key,value);}}\r
+this.queueInProgress=false;eventQueue=new Array();}\r
+this.subscribeToConfigEvent=function(key,handler,obj,override){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}\r
+return true;}else{return false;}}\r
+this.unsubscribeFromConfigEvent=function(key,handler,obj){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}}\r
+this.toString=function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}\r
+return output;}\r
+this.outputEventQueue=function(){var output="";for(var q=0;q<eventQueue.length;q++){var queueItem=eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}\r
+return output;}}\r
+YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;break;}}\r
+return false;}\r
+YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}}\r
+YAHOO.widget.Module.IMG_ROOT="http://us.i1.yimg.com/us.yimg.com/i/";YAHOO.widget.Module.IMG_ROOT_SSL="https://a248.e.akamai.net/sec.yimg.com/i/";YAHOO.widget.Module.CSS_MODULE="module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL=null;YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,childNodesInDOM:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,beforeInitEvent:null,initEvent:null,appendEvent:null,beforeRenderEvent:null,renderEvent:null,changeHeaderEvent:null,changeBodyEvent:null,changeFooterEvent:null,changeContentEvent:null,destroyEvent:null,beforeShowEvent:null,showEvent:null,beforeHideEvent:null,hideEvent:null,initEvents:function(){this.beforeInitEvent=new YAHOO.util.CustomEvent("beforeInit");this.initEvent=new YAHOO.util.CustomEvent("init");this.appendEvent=new YAHOO.util.CustomEvent("append");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.changeHeaderEvent=new YAHOO.util.CustomEvent("changeHeader");this.changeBodyEvent=new YAHOO.util.CustomEvent("changeBody");this.changeFooterEvent=new YAHOO.util.CustomEvent("changeFooter");this.changeContentEvent=new YAHOO.util.CustomEvent("changeContent");this.destroyEvent=new YAHOO.util.CustomEvent("destroy");this.beforeShowEvent=new YAHOO.util.CustomEvent("beforeShow");this.showEvent=new YAHOO.util.CustomEvent("show");this.beforeHideEvent=new YAHOO.util.CustomEvent("beforeHide");this.hideEvent=new YAHOO.util.CustomEvent("hide");},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")==0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty("visible",{value:true,handler:this.configVisible,validator:this.cfg.checkBoolean});this.cfg.addProperty("effect",{suppressEvent:true,supercedes:["visible"]});this.cfg.addProperty("monitorresize",{value:true,handler:this.configMonitorResize});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(this.isSecure){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;}\r
+if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("DIV");el.id=elId;}}\r
+this.element=el;if(el.id){this.id=el.id;}\r
+var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}\r
+this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}\r
+this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){if(this.browser!="opera"){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("iframe");var bIE=(this.browser.indexOf("ie")===0);if(this.isSecure&&this.RESIZE_MONITOR_SECURE_URL&&bIE){resizeMonitor.src=this.RESIZE_MONITOR_SECURE_URL;}\r
+resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.visibility="hidden";document.body.appendChild(resizeMonitor);resizeMonitor.style.width="10em";resizeMonitor.style.height="10em";resizeMonitor.style.position="absolute";var nLeft=-1*resizeMonitor.offsetWidth,nTop=-1*resizeMonitor.offsetHeight;resizeMonitor.style.top=nTop+"px";resizeMonitor.style.left=nLeft+"px";resizeMonitor.style.borderStyle="none";resizeMonitor.style.borderWidth="0";YAHOO.util.Dom.setStyle(resizeMonitor,"opacity","0");resizeMonitor.style.visibility="visible";if(!bIE){var doc=resizeMonitor.contentWindow.document;doc.open();doc.close();}}\r
+if(resizeMonitor&&resizeMonitor.contentWindow){this.resizeMonitor=resizeMonitor;YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow,"resize",this.onDomResize,this,true);}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}\r
+if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}\r
+this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}\r
+this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}\r
+if(typeof bodyContent=="string")\r
+{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}\r
+this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}\r
+this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}\r
+if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}\r
+this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}\r
+this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}\r
+var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}\r
+if(element){element.appendChild(me.element);me.appendEvent.fire();}}\r
+if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}\r
+if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}\r
+if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}\r
+if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}\r
+this.renderEvent.fire();return true;},destroy:function(){if(this.element){var parent=this.element.parentNode;}\r
+if(parent){parent.removeChild(this.element);}\r
+this.element=null;this.header=null;this.body=null;this.footer=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.util.Event.removeListener(this.resizeMonitor,"resize",this.onDomResize);this.resizeMonitor=null;}}}\r
+YAHOO.widget.Module.prototype.toString=function(){return"Module "+this.id;}\r
+YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}\r
+YAHOO.extend(YAHOO.widget.Overlay,YAHOO.widget.Module);YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}\r
+this.initEvent.fire(YAHOO.widget.Overlay);}\r
+YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);}\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});}\r
+YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);}\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");}\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");}\r
+YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}\r
+var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}\r
+if(effect){if(visible){if(currentVis!="visible"){this.beforeShowEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}\r
+e.animateIn();}}}}else{if(currentVis!="visible"){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}\r
+if(effect){if(currentVis!="hidden"){this.beforeHideEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}\r
+e.animateOut();}}}else{if(currentVis!="hidden"){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}}\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}}\r
+YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}}\r
+YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}\r
+if(this.iframe){if(zIndex<=0){zIndex=1;}\r
+YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}\r
+YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);}\r
+YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}\r
+YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];var el=this.element;var showIframe=function(){if(this.iframe){this.iframe.style.display="block";}}\r
+var hideIframe=function(){if(this.iframe){this.iframe.style.display="none";}}\r
+if(val){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,showIframe,this)){this.showEvent.subscribe(showIframe,this,true);}\r
+if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,hideIframe,this)){this.hideEvent.subscribe(hideIframe,this,true);}\r
+var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}\r
+if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");if(this.isSecure){this.iframe.src=this.imageRoot+YAHOO.widget.Overlay.IFRAME_SRC;}\r
+var parent=el.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}\r
+YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(this.cfg.getProperty("visible")){showIframe.call(this);}else{hideIframe.call(this);}}\r
+var iframeDisplay=YAHOO.util.Dom.getStyle(this.iframe,"display");if(iframeDisplay=="none"){this.iframe.style.display="block";}\r
+YAHOO.util.Dom.setXY(this.iframe,[x,y]);var width=el.clientWidth;var height=el.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(iframeDisplay=="none"){this.iframe.style.display="none";}}}else{if(this.iframe){this.iframe.style.display="none";}\r
+this.showEvent.unsubscribe(showIframe,this);this.hideEvent.unsubscribe(hideIframe,this);}}\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}}\r
+YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}\r
+if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}}\r
+YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}\r
+if(!contextAlign){contextAlign=contextArgs[2];}\r
+if(element&&context){var elementRegion=YAHOO.util.Dom.getRegion(element);var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}}\r
+switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}}\r
+YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var width=parseInt(this.cfg.getProperty("width"));if(isNaN(width)){width=0;}\r
+var offsetHeight=this.element.offsetHeight;var offsetWidth=(width>0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}\r
+if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}\r
+this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);}\r
+YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);}\r
+YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");}\r
+YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}\r
+this.iframe=null;YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;}\r
+YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();}\r
+YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();}\r
+YAHOO.widget.Overlay._initialized==null;if(YAHOO.widget.Overlay._initialized==null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}\r
+YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);}\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}\r
+this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;}\r
+this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));}\r
+this.overlays.sort(this.compareZIndexDesc);}}\r
+this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null\r
+o.blurEvent=null;o.focus=null;o.blur=null;}}\r
+this.blurAll=function(){activeOverlay=null;for(var o=0;o<this.overlays.length;o++){YAHOO.util.Dom.removeClass(this.overlays[o].element,YAHOO.widget.OverlayManager.CSS_FOCUSED);}}\r
+var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=new Array();}\r
+if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus");overlay.blurEvent=new YAHOO.util.CustomEvent("blur");var mgr=this;overlay.focus=function(){mgr.focus(this);this.focusEvent.fire();}\r
+overlay.blur=function(){mgr.blurAll();this.blurEvent.fire();}\r
+var focusOnDomEvent=function(e,obj){overlay.focus();}\r
+var focusevent=this.cfg.getProperty("focusevent");YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex));}else{overlay.cfg.setProperty("zIndex",0);}\r
+this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}\r
+if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o].id==overlay){return this.overlays[o];}}}\r
+return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}},toString:function(){return"OverlayManager";}}\r
+YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}\r
+var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}\r
+if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}\r
+function handleKeyPress(e,obj){var keyPressed=e.charCode||e.keyCode;if(!keyData.shift)keyData.shift=false;if(!keyData.alt)keyData.alt=false;if(!keyData.ctrl)keyData.ctrl=false;if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){if(keyPressed==keyData.keys[i]){keyEvent.fire(keyPressed,e);break;}}}else{if(keyPressed==keyData.keys){keyEvent.fire(keyPressed,e);}}}}\r
+this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}\r
+this.enabled=true;}\r
+this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}\r
+this.enabled=false;}\r
+this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+(attachTo.id?"["+attachTo.id+"]":"");}}\r
+YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.prototype.enabled=null;YAHOO.util.KeyListener.prototype.enable=function(){};YAHOO.util.KeyListener.prototype.disable=function(){};YAHOO.util.KeyListener.prototype.enabledEvent=null;YAHOO.util.KeyListener.prototype.disabledEvent=null;\r
diff --git a/lib/yui/container/container_core.js b/lib/yui/container/container_core.js
new file mode 100755 (executable)
index 0000000..834a642
--- /dev/null
@@ -0,0 +1,2248 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+/**\r
+* Config is a utility used within an object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+* @constructor\r
+*/\r
+YAHOO.util.Config = function(owner) {\r
+       if (owner) {\r
+               this.init(owner);\r
+       }\r
+}\r
+\r
+YAHOO.util.Config.prototype = {\r
+       \r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * @type object\r
+       */\r
+       owner : null,\r
+\r
+       /**\r
+       * Object reference to the owner of this Config object\r
+       * args: key, value\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       configChangedEvent : null,\r
+\r
+       /**\r
+       * Boolean flag that specifies whether a queue is currently being executed\r
+       * @type boolean\r
+       */\r
+       queueInProgress : false,\r
+\r
+       /**\r
+       * Adds a property to the Config object's private config hash. \r
+       * @param {string}       key     The configuration property's name\r
+       * @param {object}       propertyObject  The object containing all of this property's arguments\r
+       */\r
+       addProperty : function(key, propertyObject){},\r
+\r
+       /**\r
+       * Returns a key-value configuration map of the values currently set in the Config object.\r
+       * @return {object} The current config, represented in a key-value map\r
+       */\r
+       getConfig : function(){},\r
+\r
+       /**\r
+       * Returns the value of specified property.\r
+       * @param {key}          The name of the property\r
+       * @return {object}      The value of the specified property\r
+       */\r
+       getProperty : function(key){},\r
+\r
+       /**\r
+       * Resets the specified property's value to its initial value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       resetProperty : function(key){},\r
+\r
+       /**\r
+       * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @param {boolean}      Whether the value should be set silently, without firing the property event.\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */\r
+       setProperty : function(key,value,silent){},\r
+\r
+       /**\r
+       * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is\r
+       * moved from its current position to the end of the queue.\r
+       * @param {key}          The name of the property\r
+       * @param {value}        The value to set the property to\r
+       * @return {boolean}     true, if the set was successful, false if it failed.\r
+       */      \r
+       queueProperty : function(key,value){},\r
+\r
+       /**\r
+       * Fires the event for a property using the property's current value.\r
+       * @param {key}          The name of the property\r
+       */\r
+       refireEvent : function(key){},\r
+\r
+       /**\r
+       * Applies a key-value object literal to the configuration, replacing any existing values, and queueing the property events.\r
+       * Although the values will be set, fireQueue() must be called for their associated events to execute.\r
+       * @param {object}       userConfig      The configuration object literal\r
+       * @param {boolean}      init            When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.\r
+       */\r
+       applyConfig : function(userConfig,init){},\r
+\r
+       /**\r
+       * Refires the events for all configuration properties using their current values.\r
+       */\r
+       refresh : function(){},\r
+\r
+       /**\r
+       * Fires the normalized list of queued property change events\r
+       */\r
+       fireQueue : function(){},\r
+\r
+       /**\r
+       * Subscribes an external handler to the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       * @param {boolean}      override        Optional. If true, will override "this" within the handler to map to the scope object passed into the method.\r
+       */      \r
+       subscribeToConfigEvent : function(key,handler,obj,override){},\r
+\r
+       /**\r
+       * Unsubscribes an external handler from the change event for any given property. \r
+       * @param {string}       key                     The property name\r
+       * @param {Function}     handler         The handler function to use subscribe to the property's event\r
+       * @param {object}       obj                     The object to use for scoping the event handler (see CustomEvent documentation)\r
+       */\r
+       unsubscribeFromConfigEvent: function(key,handler,obj){},\r
+\r
+       /**\r
+       * Validates that the value passed in is a boolean.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */      \r
+       checkBoolean: function(val) {\r
+               if (typeof val == 'boolean') {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Validates that the value passed in is a number.\r
+       * @param        {object}        val     The value to validate\r
+       * @return       {boolean}       true, if the value is valid\r
+       */\r
+       checkNumber: function(val) {\r
+               if (isNaN(val)) {\r
+                       return false;\r
+               } else {\r
+                       return true;\r
+               }\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* Initializes the configuration object and all of its local members.\r
+* @param {object}      owner   The owner object to which this Config object belongs\r
+*/\r
+YAHOO.util.Config.prototype.init = function(owner) {\r
+\r
+       this.owner = owner;\r
+       this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");\r
+       this.queueInProgress = false;\r
+\r
+       /* Private Members */\r
+\r
+       var config = {};\r
+       var initialConfig = {};\r
+       var eventQueue = [];\r
+\r
+       /**\r
+       * @private\r
+       * Fires a configuration property event using the specified value. \r
+       * @param {string}       key                     The configuration property's name\r
+       * @param {value}        object          The value of the correct type for the property\r
+       */ \r
+       var fireEvent = function( key, value ) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       property.event.fire(value);\r
+               }       \r
+       }\r
+       /* End Private Members */\r
+\r
+       this.addProperty = function( key, propertyObject ) {\r
+               key = key.toLowerCase();\r
+\r
+               config[key] = propertyObject;\r
+\r
+               propertyObject.event = new YAHOO.util.CustomEvent(key);\r
+               propertyObject.key = key;\r
+\r
+               if (propertyObject.handler) {\r
+                       propertyObject.event.subscribe(propertyObject.handler, this.owner, true);\r
+               }\r
+\r
+               this.setProperty(key, propertyObject.value, true);\r
+               \r
+               if (! propertyObject.suppressEvent) {\r
+                       this.queueProperty(key, propertyObject.value);\r
+               }\r
+       }\r
+\r
+       this.getConfig = function() {\r
+               var cfg = {};\r
+                       \r
+               for (var prop in config) {\r
+                       var property = config[prop]\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               cfg[prop] = property.value;\r
+                       }\r
+               }\r
+               \r
+               return cfg;\r
+       }\r
+\r
+       this.getProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.value;\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.resetProperty = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       this.setProperty(key, initialConfig[key].value);\r
+               } else {\r
+                       return undefined;\r
+               }\r
+       }\r
+\r
+       this.setProperty = function(key, value, silent) {\r
+               key = key.toLowerCase();\r
+\r
+               if (this.queueInProgress && ! silent) {\r
+                       this.queueProperty(key,value); // Currently running through a queue... \r
+                       return true;\r
+               } else {\r
+                       var property = config[key];\r
+                       if (typeof property != 'undefined' && property.event) {\r
+                               if (property.validator && ! property.validator(value)) { // validator\r
+                                       return false;\r
+                               } else {\r
+                                       property.value = value;\r
+                                       if (! silent) {\r
+                                               fireEvent(key, value);\r
+                                               this.configChangedEvent.fire([key, value]);\r
+                                       }\r
+                                       return true;\r
+                               }\r
+                       } else {\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.queueProperty = function(key, value) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+                                                       \r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator\r
+                               return false;\r
+                       } else {\r
+\r
+                               if (typeof value != 'undefined') {\r
+                                       property.value = value;\r
+                               } else {\r
+                                       value = property.value;\r
+                               }\r
+\r
+                               var foundDuplicate = false;\r
+\r
+                               for (var i=0;i<eventQueue.length;i++) {\r
+                                       var queueItem = eventQueue[i];\r
+\r
+                                       if (queueItem) {\r
+                                               var queueItemKey = queueItem[0];\r
+                                               var queueItemValue = queueItem[1];\r
+                                               \r
+                                               if (queueItemKey.toLowerCase() == key) {\r
+                                                       // found a dupe... push to end of queue, null current item, and break\r
+                                                       eventQueue[i] = null;\r
+                                                       eventQueue.push([key, (typeof value != 'undefined' ? value : queueItemValue)]);\r
+                                                       foundDuplicate = true;\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+                               \r
+                               if (! foundDuplicate && typeof value != 'undefined') { // this is a refire, or a new property in the queue\r
+                                       eventQueue.push([key, value]);\r
+                               }\r
+                       }\r
+\r
+                       if (property.supercedes) {\r
+                               for (var s=0;s<property.supercedes.length;s++) {\r
+                                       var supercedesCheck = property.supercedes[s];\r
+\r
+                                       for (var q=0;q<eventQueue.length;q++) {\r
+                                               var queueItemCheck = eventQueue[q];\r
+\r
+                                               if (queueItemCheck) {\r
+                                                       var queueItemCheckKey = queueItemCheck[0];\r
+                                                       var queueItemCheckValue = queueItemCheck[1];\r
+                                                       \r
+                                                       if ( queueItemCheckKey.toLowerCase() == supercedesCheck.toLowerCase() ) {\r
+                                                               eventQueue.push([queueItemCheckKey, queueItemCheckValue]);\r
+                                                               eventQueue[q] = null;\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.refireEvent = function(key) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event && typeof property.value != 'undefined') {\r
+                       if (this.queueInProgress) {\r
+                               this.queueProperty(key);\r
+                       } else {\r
+                               fireEvent(key, property.value);\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.applyConfig = function(userConfig, init) {\r
+               if (init) {\r
+                       initialConfig = userConfig;\r
+               }\r
+               for (var prop in userConfig) {\r
+                       this.queueProperty(prop, userConfig[prop]);\r
+               }\r
+       }\r
+\r
+       this.refresh = function() {\r
+               for (var prop in config) {\r
+                       this.refireEvent(prop);\r
+               }\r
+       }\r
+\r
+       this.fireQueue = function() {\r
+               this.queueInProgress = true;\r
+               for (var i=0;i<eventQueue.length;i++) {\r
+                       var queueItem = eventQueue[i];\r
+                       if (queueItem) {\r
+                               var key = queueItem[0];\r
+                               var value = queueItem[1];\r
+                               \r
+                               var property = config[key];\r
+                               property.value = value;\r
+\r
+                               fireEvent(key,value);\r
+                       }\r
+               }\r
+               \r
+               this.queueInProgress = false;\r
+               eventQueue = new Array();\r
+       }\r
+\r
+       this.subscribeToConfigEvent = function(key, handler, obj, override) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {\r
+                               property.event.subscribe(handler, obj, override);\r
+                       }\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+\r
+       this.unsubscribeFromConfigEvent = function(key, handler, obj) {\r
+               key = key.toLowerCase();\r
+\r
+               var property = config[key];\r
+               if (typeof property != 'undefined' && property.event) {\r
+                       return property.event.unsubscribe(handler, obj);\r
+               } else {\r
+                       return false;\r
+               }\r
+       }\r
+\r
+       this.toString = function() {\r
+               var output = "Config";\r
+               if (this.owner) {\r
+                       output += " [" + this.owner.toString() + "]";\r
+               }\r
+               return output;\r
+       }\r
+\r
+       this.outputEventQueue = function() {\r
+               var output = "";\r
+               for (var q=0;q<eventQueue.length;q++) {\r
+                       var queueItem = eventQueue[q];\r
+                       if (queueItem) {\r
+                               output += queueItem[0] + "=" + queueItem[1] + ", ";\r
+                       }\r
+               }\r
+               return output;\r
+       }\r
+}\r
+\r
+/**\r
+* Checks to determine if a particular function/object pair are already subscribed to the specified CustomEvent\r
+* @param {YAHOO.util.CustomEvent} evt  The CustomEvent for which to check the subscriptions\r
+* @param {Function}    fn      The function to look for in the subscribers list\r
+* @param {object}      obj     The execution scope object for the subscription\r
+* @return {boolean}    true, if the function/object pair is already subscribed to the CustomEvent passed in\r
+*/\r
+YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {\r
+       for (var e=0;e<evt.subscribers.length;e++) {\r
+               var subsc = evt.subscribers[e];\r
+               if (subsc && subsc.obj == obj && subsc.fn == fn) {\r
+                       return true;\r
+                       break;\r
+               }\r
+       }\r
+       return false;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class \r
+* Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.\r
+* @param {string}      el      The element ID representing the Module <em>OR</em>\r
+* @param {Element}     el      The element representing the Module\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Module = function(el, userConfig) {\r
+       if (el) { \r
+               this.init(el, userConfig); \r
+       }\r
+}\r
+\r
+/**\r
+* Constant representing the prefix path to use for non-secure images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";\r
+\r
+/**\r
+* Constant representing the prefix path to use for securely served images\r
+* @type string\r
+*/\r
+YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";\r
+\r
+/**\r
+* Constant for the default CSS class name that represents a Module\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_MODULE = "module";\r
+\r
+/**\r
+* Constant representing the module header\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_HEADER = "hd";\r
+\r
+/**\r
+* Constant representing the module body\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_BODY = "bd";\r
+\r
+/**\r
+* Constant representing the module footer\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.CSS_FOOTER = "ft";\r
+\r
+/**\r
+* Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = null;\r
+\r
+YAHOO.widget.Module.prototype = {\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type function\r
+       */\r
+       constructor : YAHOO.widget.Module,\r
+\r
+       /**\r
+       * The main module element that contains the header, body, and footer\r
+       * @type Element\r
+       */\r
+       element : null, \r
+\r
+       /**\r
+       * The header element, denoted with CSS class "hd"\r
+       * @type Element\r
+       */\r
+       header : null,\r
+\r
+       /**\r
+       * The body element, denoted with CSS class "bd"\r
+       * @type Element\r
+       */\r
+       body : null,\r
+\r
+       /**\r
+       * The footer element, denoted with CSS class "ft"\r
+       * @type Element\r
+       */\r
+       footer : null,\r
+\r
+       /**\r
+       * The id of the element\r
+       * @type string\r
+       */\r
+       id : null,\r
+\r
+       /**\r
+       * Array of elements\r
+       * @type Element[]\r
+       */\r
+       childNodesInDOM : null,\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot : YAHOO.widget.Module.IMG_ROOT,\r
+\r
+       /**\r
+       * CustomEvent fired prior to class initalization.\r
+       * args: class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeInitEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after class initalization.\r
+       * args: class reference of the initializing class, such as this.initEvent.fire(YAHOO.widget.Module)\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       initEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is appended to the DOM\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       appendEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeRenderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is rendered\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       renderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the header content of the Module is modified\r
+       * args: string/element representing the new header content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeHeaderEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the body content of the Module is modified\r
+       * args: string/element representing the new body content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeBodyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the footer content of the Module is modified\r
+       * args: string/element representing the new footer content\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeFooterEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the content of the Module is modified\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       changeContentEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired when the Module is destroyed\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       destroyEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeShowEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired after the Module is shown\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       showEvent : null,\r
+\r
+       /**\r
+       * CustomEvent fired before the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       beforeHideEvent : null,\r
+       \r
+       /**\r
+       * CustomEvent fired after the Module is hidden\r
+       * args: none\r
+       * @type YAHOO.util.CustomEvent\r
+       */\r
+       hideEvent : null,\r
+               \r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initEvents : function() {\r
+\r
+               this.beforeInitEvent            = new YAHOO.util.CustomEvent("beforeInit");\r
+               this.initEvent                          = new YAHOO.util.CustomEvent("init");\r
+\r
+               this.appendEvent                        = new YAHOO.util.CustomEvent("append");\r
+\r
+               this.beforeRenderEvent          = new YAHOO.util.CustomEvent("beforeRender");\r
+               this.renderEvent                        = new YAHOO.util.CustomEvent("render");\r
+\r
+               this.changeHeaderEvent          = new YAHOO.util.CustomEvent("changeHeader");\r
+               this.changeBodyEvent            = new YAHOO.util.CustomEvent("changeBody");\r
+               this.changeFooterEvent          = new YAHOO.util.CustomEvent("changeFooter");\r
+\r
+               this.changeContentEvent         = new YAHOO.util.CustomEvent("changeContent");\r
+\r
+               this.destroyEvent                       = new YAHOO.util.CustomEvent("destroy");\r
+               this.beforeShowEvent            = new YAHOO.util.CustomEvent("beforeShow");\r
+               this.showEvent                          = new YAHOO.util.CustomEvent("show");\r
+               this.beforeHideEvent            = new YAHOO.util.CustomEvent("beforeHide");\r
+               this.hideEvent                          = new YAHOO.util.CustomEvent("hide");\r
+       }, \r
+\r
+       /**\r
+       * String representing the current user-agent platform\r
+       * @type string\r
+       */\r
+       platform : function() {\r
+                                       var ua = navigator.userAgent.toLowerCase();\r
+                                       if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {\r
+                                               return "windows";\r
+                                       } else if (ua.indexOf("macintosh") != -1) {\r
+                                               return "mac";\r
+                                       } else {\r
+                                               return false;\r
+                                       }\r
+                               }(),\r
+\r
+       /**\r
+       * String representing the current user-agent browser\r
+       * @type string\r
+       */\r
+       browser : function() {\r
+                       var ua = navigator.userAgent.toLowerCase();\r
+                                 if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)\r
+                                        return 'opera';\r
+                                 } else if (ua.indexOf('msie 7')!=-1) { // IE7\r
+                                        return 'ie7';\r
+                                 } else if (ua.indexOf('msie') !=-1) { // IE\r
+                                        return 'ie';\r
+                                 } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")\r
+                                        return 'safari';\r
+                                 } else if (ua.indexOf('gecko') != -1) { // Gecko\r
+                                        return 'gecko';\r
+                                 } else {\r
+                                        return false;\r
+                                 }\r
+                       }(),\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure : function() {\r
+               if (window.location.href.toLowerCase().indexOf("https") == 0) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       }(),\r
+\r
+       /**\r
+       * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.\r
+       */\r
+       initDefaultConfig : function() {\r
+               // Add properties //\r
+\r
+               this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );\r
+               this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );\r
+               this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );\r
+       },\r
+\r
+       /**\r
+       * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+       * @param {string}       el      The element ID representing the Module <em>OR</em>\r
+       * @param {Element}      el      The element representing the Module\r
+       * @param {object}       userConfig      The configuration object literal containing the configuration that should be set for this module. See configuration documentation for more details.\r
+       */\r
+       init : function(el, userConfig) {\r
+\r
+               this.initEvents();\r
+\r
+               this.beforeInitEvent.fire(YAHOO.widget.Module);\r
+\r
+               this.cfg = new YAHOO.util.Config(this);\r
+               \r
+               if (this.isSecure) {\r
+                       this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;\r
+               }\r
+\r
+               if (typeof el == "string") {\r
+                       var elId = el;\r
+\r
+                       el = document.getElementById(el);\r
+                       if (! el) {\r
+                               el = document.createElement("DIV");\r
+                               el.id = elId;\r
+                       }\r
+               }\r
+\r
+               this.element = el;\r
+               \r
+               if (el.id) {\r
+                       this.id = el.id;\r
+               } \r
+\r
+               var childNodes = this.element.childNodes;\r
+\r
+               if (childNodes) {\r
+                       for (var i=0;i<childNodes.length;i++) {\r
+                               var child = childNodes[i];\r
+                               switch (child.className) {\r
+                                       case YAHOO.widget.Module.CSS_HEADER:\r
+                                               this.header = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_BODY:\r
+                                               this.body = child;\r
+                                               break;\r
+                                       case YAHOO.widget.Module.CSS_FOOTER:\r
+                                               this.footer = child;\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               this.initDefaultConfig();\r
+\r
+               YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE);\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+\r
+               // Subscribe to the fireQueue() method of Config so that any queued configuration changes are\r
+               // excecuted upon render of the Module\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {\r
+                       this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);\r
+               }\r
+\r
+               this.initEvent.fire(YAHOO.widget.Module);\r
+       },\r
+\r
+       /**\r
+       * Initialized an empty DOM element that is placed out of the visible area that can be used to detect text resize.\r
+       */\r
+       initResizeMonitor : function() {\r
+\r
+        if(this.browser != "opera") {\r
+\r
+            var resizeMonitor = document.getElementById("_yuiResizeMonitor");\r
+    \r
+            if (! resizeMonitor) {\r
+    \r
+                resizeMonitor = document.createElement("iframe");\r
+    \r
+                var bIE = (this.browser.indexOf("ie") === 0);\r
+    \r
+                if(this.isSecure && this.RESIZE_MONITOR_SECURE_URL && bIE) {\r
+    \r
+                    resizeMonitor.src = this.RESIZE_MONITOR_SECURE_URL;\r
+    \r
+                }\r
+                \r
+                resizeMonitor.id = "_yuiResizeMonitor";\r
+                resizeMonitor.style.visibility = "hidden";\r
+                \r
+                document.body.appendChild(resizeMonitor);\r
+    \r
+                resizeMonitor.style.width = "10em";\r
+                resizeMonitor.style.height = "10em";\r
+                resizeMonitor.style.position = "absolute";\r
+                \r
+                var nLeft = -1 * resizeMonitor.offsetWidth,\r
+                    nTop = -1 * resizeMonitor.offsetHeight;\r
+    \r
+                resizeMonitor.style.top = nTop + "px";\r
+                resizeMonitor.style.left =  nLeft + "px";\r
+                resizeMonitor.style.borderStyle = "none";\r
+                resizeMonitor.style.borderWidth = "0";\r
+                YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0");\r
+                \r
+                resizeMonitor.style.visibility = "visible";\r
+    \r
+                if(!bIE) {\r
+    \r
+                    var doc = resizeMonitor.contentWindow.document;\r
+    \r
+                    doc.open();\r
+                    doc.close();\r
+                \r
+                }\r
+    \r
+            }\r
+    \r
+            if(resizeMonitor && resizeMonitor.contentWindow) {\r
+    \r
+                this.resizeMonitor = resizeMonitor;\r
+    \r
+                YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", this.onDomResize, this, true);\r
+    \r
+            }\r
+        \r
+        }\r
+\r
+       },\r
+\r
+       /**\r
+       * Event handler fired when the resize monitor element is resized.\r
+       */\r
+       onDomResize : function(e, obj) { \r
+\r
+        var nLeft = -1 * this.resizeMonitor.offsetWidth,\r
+            nTop = -1 * this.resizeMonitor.offsetHeight;\r
+        \r
+        this.resizeMonitor.style.top = nTop + "px";\r
+        this.resizeMonitor.style.left =  nLeft + "px";\r
+       \r
+       },\r
+\r
+       /**\r
+       * Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {string}       headerContent   The HTML used to set the header <em>OR</em>\r
+       * @param {Element}      headerContent   The Element to append to the header\r
+       */      \r
+       setHeader : function(headerContent) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               if (typeof headerContent == "string") {\r
+                       this.header.innerHTML = headerContent;\r
+               } else {\r
+                       this.header.innerHTML = "";\r
+                       this.header.appendChild(headerContent);\r
+               }\r
+\r
+               this.changeHeaderEvent.fire(headerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the header. If no header is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the header\r
+       */      \r
+       appendToHeader : function(element) {\r
+               if (! this.header) {\r
+                       this.header = document.createElement("DIV");\r
+                       this.header.className = YAHOO.widget.Module.CSS_HEADER;\r
+               }\r
+               \r
+               this.header.appendChild(element);\r
+               this.changeHeaderEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {string}       bodyContent     The HTML used to set the body <em>OR</em>\r
+       * @param {Element}      bodyContent     The Element to append to the body\r
+       */              \r
+       setBody : function(bodyContent) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               if (typeof bodyContent == "string")\r
+               {\r
+                       this.body.innerHTML = bodyContent;\r
+               } else {\r
+                       this.body.innerHTML = "";\r
+                       this.body.appendChild(bodyContent);\r
+               }\r
+\r
+               this.changeBodyEvent.fire(bodyContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the body. If no body is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the body\r
+       */\r
+       appendToBody : function(element) {\r
+               if (! this.body) {\r
+                       this.body = document.createElement("DIV");\r
+                       this.body.className = YAHOO.widget.Module.CSS_BODY;\r
+               }\r
+\r
+               this.body.appendChild(element);\r
+               this.changeBodyEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {string}       footerContent   The HTML used to set the footer <em>OR</em>\r
+       * @param {Element}      footerContent   The Element to append to the footer\r
+       */      \r
+       setFooter : function(footerContent) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               if (typeof footerContent == "string") {\r
+                       this.footer.innerHTML = footerContent;\r
+               } else {\r
+                       this.footer.innerHTML = "";\r
+                       this.footer.appendChild(footerContent);\r
+               }\r
+\r
+               this.changeFooterEvent.fire(footerContent);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Appends the passed element to the footer. If no footer is present, one will be automatically created.\r
+       * @param {Element}      element The element to append to the footer\r
+       */\r
+       appendToFooter : function(element) {\r
+               if (! this.footer) {\r
+                       this.footer = document.createElement("DIV");\r
+                       this.footer.className = YAHOO.widget.Module.CSS_FOOTER;\r
+               }\r
+\r
+               this.footer.appendChild(element);\r
+               this.changeFooterEvent.fire(element);\r
+               this.changeContentEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.\r
+       * @param {string}       appendToNode    The element id to which the Module should be appended to prior to rendering <em>OR</em>\r
+       * @param {Element}      appendToNode    The element to which the Module should be appended to prior to rendering        \r
+       * @param {Element}      moduleElement   OPTIONAL. The element that represents the actual Standard Module container. \r
+       * @return {boolean} Success or failure of the render\r
+       */\r
+       render : function(appendToNode, moduleElement) {\r
+               this.beforeRenderEvent.fire();\r
+\r
+               if (! moduleElement) {\r
+                       moduleElement = this.element;\r
+               }\r
+\r
+               var me = this;\r
+               var appendTo = function(element) {\r
+                       if (typeof element == "string") {\r
+                               element = document.getElementById(element);\r
+                       }\r
+                       \r
+                       if (element) {\r
+                               element.appendChild(me.element);\r
+                               me.appendEvent.fire();\r
+                       }\r
+               }\r
+\r
+               if (appendToNode) {\r
+                       appendTo(appendToNode);\r
+               } else { // No node was passed in. If the element is not pre-marked up, this fails\r
+                       if (! YAHOO.util.Dom.inDocument(this.element)) {\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               // Need to get everything into the DOM if it isn't already\r
+               \r
+               if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {\r
+                       // There is a header, but it's not in the DOM yet... need to add it\r
+                       var firstChild = moduleElement.firstChild;\r
+                       if (firstChild) { // Insert before first child if exists\r
+                               moduleElement.insertBefore(this.header, firstChild);\r
+                       } else { // Append to empty body because there are no children\r
+                               moduleElement.appendChild(this.header);\r
+                       }\r
+               }\r
+\r
+               if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {\r
+                       // There is a body, but it's not in the DOM yet... need to add it\r
+                       if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM\r
+                               moduleElement.insertBefore(this.body, this.footer);\r
+                       } else { // Append to element because there is no footer\r
+                               moduleElement.appendChild(this.body);\r
+                       }\r
+               }\r
+\r
+               if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {\r
+                       // There is a footer, but it's not in the DOM yet... need to add it\r
+                       moduleElement.appendChild(this.footer);\r
+               }\r
+\r
+               this.renderEvent.fire();\r
+               return true;\r
+       },\r
+\r
+       /**\r
+       * Removes the Module element from the DOM and sets all child elements to null.\r
+       */\r
+       destroy : function() {\r
+               if (this.element) {\r
+                       var parent = this.element.parentNode;\r
+               }\r
+               if (parent) {\r
+                       parent.removeChild(this.element);\r
+               }\r
+\r
+               this.element = null;\r
+               this.header = null;\r
+               this.body = null;\r
+               this.footer = null;\r
+\r
+               this.destroyEvent.fire();\r
+       },\r
+\r
+       /**\r
+       * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.\r
+       */\r
+       show : function() {\r
+               this.cfg.setProperty("visible", true);\r
+       },\r
+\r
+       /**\r
+       * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.\r
+       */\r
+       hide : function() {\r
+               this.cfg.setProperty("visible", false);\r
+       },\r
+\r
+       // BUILT-IN EVENT HANDLERS FOR MODULE //\r
+\r
+       /**\r
+       * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".\r
+       * This method is responsible for firing showEvent and hideEvent.\r
+       */\r
+       configVisible : function(type, args, obj) {\r
+               var visible = args[0];\r
+               if (visible) {\r
+                       this.beforeShowEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "block");\r
+                       this.showEvent.fire();\r
+               } else {\r
+                       this.beforeHideEvent.fire();\r
+                       YAHOO.util.Dom.setStyle(this.element, "display", "none");\r
+                       this.hideEvent.fire();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Default event handler for the "monitorresize" configuration property\r
+       */\r
+       configMonitorResize : function(type, args, obj) {\r
+               var monitor = args[0];\r
+               if (monitor) {\r
+                       this.initResizeMonitor();\r
+               } else {\r
+                       YAHOO.util.Event.removeListener(this.resizeMonitor, "resize", this.onDomResize);\r
+                       this.resizeMonitor = null;\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Module.prototype.toString = function() {\r
+       return "Module " + this.id;\r
+}/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+* @constructor\r
+*/\r
+YAHOO.widget.Overlay = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);\r
+}\r
+\r
+YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);\r
+\r
+/**\r
+* The URL of the blank image that will be placed in the iframe\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.IFRAME_SRC = "promo/m/irs/blank.gif";\r
+\r
+/**\r
+* Constant representing the top left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_LEFT = "tl";\r
+\r
+/**\r
+* Constant representing the top right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.TOP_RIGHT = "tr";\r
+\r
+/**\r
+* Constant representing the top bottom left corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";\r
+\r
+/**\r
+* Constant representing the bottom right corner of an element, used for configuring the context element alignment\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";\r
+\r
+/**\r
+* Constant representing the default CSS class used for an Overlay\r
+* @type string\r
+* @final\r
+*/\r
+YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";\r
+\r
+/**\r
+* CustomEvent fired before the Overlay is moved.\r
+* args: x,y that the Overlay will be moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.beforeMoveEvent = null;\r
+\r
+/**\r
+* CustomEvent fired after the Overlay is moved.\r
+* args: x,y that the Overlay was moved to\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveEvent = null;\r
+\r
+/**\r
+* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.\r
+* @param {string}      el      The element ID representing the Overlay <em>OR</em>\r
+* @param {Element}     el      The element representing the Overlay\r
+* @param {object}      userConfig      The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.\r
+*/\r
+YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {\r
+       YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/);  // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level\r
+       \r
+       this.beforeInitEvent.fire(YAHOO.widget.Overlay);\r
+\r
+       YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);\r
+\r
+       if (userConfig) {\r
+               this.cfg.applyConfig(userConfig, true);\r
+       }\r
+\r
+       if (this.platform == "mac" && this.browser == "gecko") {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {\r
+                       this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {\r
+                       this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);\r
+               }\r
+       }\r
+\r
+       this.initEvent.fire(YAHOO.widget.Overlay);\r
+\r
+}\r
+\r
+/**\r
+* Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.\r
+*/\r
+YAHOO.widget.Overlay.prototype.initEvents = function() {\r
+       YAHOO.widget.Overlay.superclass.initEvents.call(this);\r
+\r
+       this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);\r
+       this.moveEvent = new YAHOO.util.CustomEvent("move", this);\r
+}\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).\r
+*/\r
+YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {\r
+       YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add overlay config properties //\r
+       this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );\r
+\r
+       this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );\r
+       this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );\r
+\r
+       this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );\r
+\r
+       this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );\r
+       this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );\r
+}\r
+\r
+/**\r
+* Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);\r
+* @param {int} x       The Overlay's new x position\r
+* @param {int} y       The Overlay's new y position\r
+*/\r
+YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {\r
+       this.cfg.setProperty("xy",[x,y]);\r
+}\r
+\r
+/**\r
+* Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");\r
+}\r
+\r
+/**\r
+* Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where\r
+* scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435\r
+*/\r
+YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {\r
+       YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");\r
+       YAHOO.util.Dom.addClass(this.element, "show-scrollbars");\r
+}\r
+\r
+// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {\r
+       var visible = args[0];\r
+       var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");\r
+\r
+       var effect = this.cfg.getProperty("effect");\r
+\r
+       var effectInstances = new Array();\r
+       if (effect) {\r
+               if (effect instanceof Array) {\r
+                       for (var i=0;i<effect.length;i++) {\r
+                               var eff = effect[i];\r
+                               effectInstances[effectInstances.length] = eff.effect(this, eff.duration);\r
+                       }\r
+               } else {\r
+                       effectInstances[effectInstances.length] = effect.effect(this, effect.duration);\r
+               }\r
+       }\r
+\r
+       var isMacGecko = (this.platform == "mac" && this.browser == "gecko");\r
+\r
+       if (visible) { // Show\r
+               if (isMacGecko) {\r
+                       this.showMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate in\r
+                       if (visible) { // Animate in if not showing\r
+                               if (currentVis != "visible") {\r
+                                       this.beforeShowEvent.fire();\r
+                                       for (var i=0;i<effectInstances.length;i++) {\r
+                                               var e = effectInstances[i];\r
+                                               if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)) {\r
+                                                       e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true); // Delegate showEvent until end of animateInComplete\r
+                                               }\r
+                                               e.animateIn();\r
+                                       }\r
+                               }\r
+                       }\r
+               } else { // Show\r
+                       if (currentVis != "visible") {\r
+                               this.beforeShowEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "visible");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.showEvent.fire();\r
+                       }\r
+               }\r
+\r
+       } else { // Hide\r
+               if (isMacGecko) {\r
+                       this.hideMacGeckoScrollbars();\r
+               }       \r
+\r
+               if (effect) { // Animate out if showing\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               for (var i=0;i<effectInstances.length;i++) {\r
+                                       var e = effectInstances[i];\r
+                                       if (i == 0 && ! YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)) {                            \r
+                                               e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true); // Delegate hideEvent until end of animateOutComplete\r
+                                       }\r
+                                       e.animateOut();\r
+                               }\r
+                       }\r
+               } else { // Simple hide\r
+                       if (currentVis != "hidden") {\r
+                               this.beforeHideEvent.fire();\r
+                               YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");\r
+                               this.cfg.refireEvent("iframe");\r
+                               this.hideEvent.fire();\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+/**\r
+* Center event handler used for centering on scroll/resize, but only if the Overlay is visible\r
+*/\r
+YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function() {\r
+       if (this.cfg.getProperty("visible")) {\r
+               this.center();\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "fixedcenter" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configFixedCenter = function(type, args, obj) {\r
+       var val = args[0];\r
+\r
+       if (val) {\r
+               this.center();\r
+                       \r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) {\r
+                       this.beforeShowEvent.subscribe(this.center, this, true);\r
+               }\r
+               \r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);\r
+               }\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) {\r
+                       YAHOO.widget.Overlay.windowScrollEvent.subscribe( this.doCenterOnDOMEvent, this, true);\r
+               }\r
+       } else {\r
+               YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+               YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "height" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configHeight = function(type, args, obj) {\r
+       var height = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "height", height);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "width" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configWidth = function(type, args, obj) {\r
+       var width = args[0];\r
+       var el = this.element;\r
+       YAHOO.util.Dom.setStyle(el, "width", width);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "zIndex" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {\r
+       var zIndex = args[0];\r
+\r
+       var el = this.element;\r
+\r
+       if (! zIndex) {\r
+               zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");\r
+               if (! zIndex || isNaN(zIndex)) {\r
+                       zIndex = 0;\r
+               }\r
+       }\r
+\r
+       if (this.iframe) {\r
+               if (zIndex <= 0) {\r
+                       zIndex = 1;\r
+               }\r
+               YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));\r
+       }\r
+\r
+       YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);\r
+       this.cfg.setProperty("zIndex", zIndex, true);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "xy" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {\r
+       var pos = args[0];\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       this.cfg.setProperty("x", x);\r
+       this.cfg.setProperty("y", y);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x,y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "x" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {\r
+       var x = args[0];\r
+       var y = this.cfg.getProperty("y");\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setX(this.element, x, true);\r
+       \r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "y" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {\r
+       var x = this.cfg.getProperty("x");\r
+       var y = args[0];\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+\r
+       this.beforeMoveEvent.fire([x,y]);\r
+\r
+       x = this.cfg.getProperty("x");\r
+       y = this.cfg.getProperty("y");\r
+\r
+       YAHOO.util.Dom.setY(this.element, y, true);\r
+\r
+       this.cfg.setProperty("xy", [x, y], true);\r
+\r
+       this.cfg.refireEvent("iframe");\r
+       this.moveEvent.fire([x, y]);\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "iframe" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {\r
+\r
+       var val = args[0];\r
+\r
+       var el = this.element;\r
+       \r
+       var showIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "block";\r
+               }\r
+       }\r
+\r
+       var hideIframe = function() {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+       }\r
+\r
+       if (val) { // IFRAME shim is enabled\r
+\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, showIframe, this)) {\r
+                       this.showEvent.subscribe(showIframe, this, true);\r
+               }\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, hideIframe, this)) {\r
+                       this.hideEvent.subscribe(hideIframe, this, true);\r
+               }\r
+\r
+               var x = this.cfg.getProperty("x");\r
+               var y = this.cfg.getProperty("y");\r
+\r
+               if (! x || ! y) {\r
+                       this.syncPosition();\r
+                       x = this.cfg.getProperty("x");\r
+                       y = this.cfg.getProperty("y");\r
+               }\r
+\r
+               if (! isNaN(x) && ! isNaN(y)) {\r
+                       if (! this.iframe) {\r
+                               this.iframe = document.createElement("iframe");\r
+                               if (this.isSecure) {\r
+                                       this.iframe.src = this.imageRoot + YAHOO.widget.Overlay.IFRAME_SRC;\r
+                               }\r
+                               \r
+                               var parent = el.parentNode;\r
+                               if (parent) {\r
+                                       parent.appendChild(this.iframe);\r
+                               } else {\r
+                                       document.body.appendChild(this.iframe);\r
+                               }\r
+\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "border", "none");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");\r
+                               YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");\r
+                               if (this.cfg.getProperty("visible")) {\r
+                                       showIframe.call(this);\r
+                               } else {\r
+                                       hideIframe.call(this);\r
+                               }\r
+                       }\r
+                       \r
+                       var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "block";\r
+                       }\r
+\r
+                       YAHOO.util.Dom.setXY(this.iframe, [x,y]);\r
+\r
+                       var width = el.clientWidth;\r
+                       var height = el.clientHeight;\r
+\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");\r
+                       YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");\r
+\r
+                       if (iframeDisplay == "none") {\r
+                               this.iframe.style.display = "none";\r
+                       }\r
+               }\r
+       } else {\r
+               if (this.iframe) {\r
+                       this.iframe.style.display = "none";\r
+               }\r
+               this.showEvent.unsubscribe(showIframe, this);\r
+               this.hideEvent.unsubscribe(hideIframe, this);\r
+       }\r
+}\r
+\r
+\r
+/**\r
+* The default event handler fired when the "constraintoviewport" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {\r
+       var val = args[0];\r
+       if (val) {\r
+               if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {\r
+                       this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);\r
+               }\r
+       } else {\r
+               this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler fired when the "context" property is changed.\r
+*/\r
+YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {\r
+       var contextArgs = args[0];\r
+\r
+       if (contextArgs) {\r
+               var contextEl = contextArgs[0];\r
+               var elementMagnetCorner = contextArgs[1];\r
+               var contextMagnetCorner = contextArgs[2];\r
+\r
+               if (contextEl) {\r
+                       if (typeof contextEl == "string") {\r
+                               this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);\r
+                       }\r
+                       \r
+                       if (elementMagnetCorner && contextMagnetCorner) {\r
+                               this.align(elementMagnetCorner, contextMagnetCorner);\r
+                       }\r
+               }       \r
+       }\r
+}\r
+\r
+\r
+// END BUILT-IN PROPERTY EVENT HANDLERS //\r
+\r
+/**\r
+* Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.\r
+* @param {string} elementAlign         The string representing the corner of the Overlay that should be aligned to the context element\r
+* @param {string} contextAlign         The corner of the context element that the elementAlign corner should stick to.\r
+*/\r
+YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {\r
+       var contextArgs = this.cfg.getProperty("context");\r
+       if (contextArgs) {\r
+               var context = contextArgs[0];\r
+               \r
+               var element = this.element;\r
+               var me = this;\r
+\r
+               if (! elementAlign) {\r
+                       elementAlign = contextArgs[1];\r
+               }\r
+\r
+               if (! contextAlign) {\r
+                       contextAlign = contextArgs[2];\r
+               }\r
+\r
+               if (element && context) {\r
+                       var elementRegion = YAHOO.util.Dom.getRegion(element);\r
+                       var contextRegion = YAHOO.util.Dom.getRegion(context);\r
+\r
+                       var doAlign = function(v,h) {\r
+                               switch (elementAlign) {\r
+                                       case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                               me.moveTo(h,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                               me.moveTo(h,v-element.offsetHeight);\r
+                                               break;\r
+                                       case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                               me.moveTo(h-element.offsetWidth,v-element.offsetHeight);\r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       switch (contextAlign) {\r
+                               case YAHOO.widget.Overlay.TOP_LEFT:\r
+                                       doAlign(contextRegion.top, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.TOP_RIGHT:\r
+                                       doAlign(contextRegion.top, contextRegion.right);\r
+                                       break;          \r
+                               case YAHOO.widget.Overlay.BOTTOM_LEFT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.left);\r
+                                       break;\r
+                               case YAHOO.widget.Overlay.BOTTOM_RIGHT:\r
+                                       doAlign(contextRegion.bottom, contextRegion.right);\r
+                                       break;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.\r
+*/\r
+YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {\r
+       var pos = args[0];\r
+\r
+       var x = pos[0];\r
+       var y = pos[1];\r
+\r
+       var width = parseInt(this.cfg.getProperty("width"));\r
+\r
+       if (isNaN(width)) {\r
+               width = 0;\r
+       }\r
+\r
+       var offsetHeight = this.element.offsetHeight;\r
+       var offsetWidth = (width>0?width:this.element.offsetWidth); //this.element.offsetWidth;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getViewportWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getViewportHeight();\r
+\r
+       var scrollX = window.scrollX || document.documentElement.scrollLeft;\r
+       var scrollY = window.scrollY || document.documentElement.scrollTop;\r
+\r
+       var topConstraint = scrollY + 10;\r
+       var leftConstraint = scrollX + 10;\r
+       var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+       var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+       \r
+       if (x < leftConstraint) {\r
+               x = leftConstraint;\r
+       } else if (x > rightConstraint) {\r
+               x = rightConstraint;\r
+       }\r
+\r
+       if (y < topConstraint) {\r
+               y = topConstraint;\r
+       } else if (y > bottomConstraint) {\r
+               y = bottomConstraint;\r
+       }\r
+\r
+       this.cfg.setProperty("x", x, true);\r
+       this.cfg.setProperty("y", y, true);\r
+       this.cfg.setProperty("xy", [x,y], true);\r
+}\r
+\r
+/**\r
+* Centers the container in the viewport.\r
+*/\r
+YAHOO.widget.Overlay.prototype.center = function() {\r
+       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+\r
+       var viewPortWidth = YAHOO.util.Dom.getClientWidth();\r
+       var viewPortHeight = YAHOO.util.Dom.getClientHeight();\r
+\r
+       var elementWidth = this.element.offsetWidth;\r
+       var elementHeight = this.element.offsetHeight;\r
+\r
+       var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;\r
+       var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;\r
+       \r
+       this.element.style.left = parseInt(x) + "px";\r
+       this.element.style.top = parseInt(y) + "px";\r
+       this.syncPosition();\r
+\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.\r
+*/\r
+YAHOO.widget.Overlay.prototype.syncPosition = function() {\r
+       var pos = YAHOO.util.Dom.getXY(this.element);\r
+       this.cfg.setProperty("x", pos[0], true);\r
+       this.cfg.setProperty("y", pos[1], true);\r
+       this.cfg.setProperty("xy", pos, true);\r
+}\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {\r
+       YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);\r
+       this.cfg.refireEvent("iframe");\r
+}\r
+\r
+/**\r
+* Removes the Overlay element from the DOM and sets all child elements to null.\r
+*/\r
+YAHOO.widget.Overlay.prototype.destroy = function() {\r
+       if (this.iframe) {\r
+               this.iframe.parentNode.removeChild(this.iframe);\r
+       }\r
+       \r
+       this.iframe = null;\r
+\r
+       YAHOO.widget.Overlay.superclass.destroy.call(this);  \r
+};\r
+\r
+/**\r
+* Returns a string representation of the object.\r
+* @type string\r
+*/ \r
+YAHOO.widget.Overlay.prototype.toString = function() {\r
+       return "Overlay " + this.id;\r
+}\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window scroll\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");\r
+\r
+/**\r
+* A singleton CustomEvent used for reacting to the DOM event for window resize\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window scroll\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowScrollHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowScrollEvent.fire();\r
+}\r
+\r
+/**\r
+* The DOM event handler used to fire the CustomEvent for window resize\r
+* @type Function\r
+*/\r
+YAHOO.widget.Overlay.windowResizeHandler = function(e) {\r
+       YAHOO.widget.Overlay.windowResizeEvent.fire();\r
+}\r
+\r
+/**\r
+* @private\r
+*/\r
+YAHOO.widget.Overlay._initialized == null;\r
+\r
+if (YAHOO.widget.Overlay._initialized == null) {\r
+       YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);\r
+       YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);\r
+\r
+       YAHOO.widget.Overlay._initialized = true;\r
+}\r
+/**\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+* @class\r
+* OverlayManager is used for maintaining the focus status of multiple Overlays.\r
+* @param {Array}       overlays        Optional. A collection of Overlays to register with the manager.\r
+* @param {object}      userConfig              The object literal representing the user configuration of the OverlayManager\r
+* @constructor\r
+*/\r
+YAHOO.widget.OverlayManager = function(userConfig) {\r
+       this.init(userConfig);\r
+}\r
+\r
+/**\r
+* The CSS class representing a focused Overlay\r
+* @type string\r
+*/\r
+YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";\r
+\r
+YAHOO.widget.OverlayManager.prototype = {\r
+\r
+       constructor : YAHOO.widget.OverlayManager,\r
+\r
+       /**\r
+       * The array of Overlays that are currently registered\r
+       * @type Array\r
+       */\r
+       overlays : null,\r
+\r
+       /**\r
+       * Initializes the default configuration of the OverlayManager\r
+       */      \r
+       initDefaultConfig : function() {\r
+               this.cfg.addProperty("overlays", { suppressEvent:true } );\r
+               this.cfg.addProperty("focusevent", { value:"mousedown" } );\r
+       }, \r
+\r
+       /**\r
+       * Returns the currently focused Overlay\r
+       * @return {Overlay}     The currently focused Overlay\r
+       */\r
+       getActive : function() {},\r
+\r
+       /**\r
+       * Focuses the specified Overlay\r
+       * @param {Overlay}      The Overlay to focus\r
+       * @param {string}       The id of the Overlay to focus\r
+       */\r
+       focus : function(overlay) {},\r
+\r
+       /**\r
+       * Removes the specified Overlay from the manager\r
+       * @param {Overlay}      The Overlay to remove\r
+       * @param {string}       The id of the Overlay to remove\r
+       */\r
+       remove: function(overlay) {},\r
+\r
+       /**\r
+       * Removes focus from all registered Overlays in the manager\r
+       */\r
+       blurAll : function() {},\r
+\r
+       /**\r
+       * Initializes the OverlayManager\r
+       * @param {Array}        overlays        Optional. A collection of Overlays to register with the manager.\r
+       * @param {object}       userConfig              The object literal representing the user configuration of the OverlayManager\r
+       */\r
+       init : function(userConfig) {\r
+               this.cfg = new YAHOO.util.Config(this);\r
+\r
+               this.initDefaultConfig();\r
+\r
+               if (userConfig) {\r
+                       this.cfg.applyConfig(userConfig, true);\r
+               }\r
+               this.cfg.fireQueue();\r
+\r
+               var activeOverlay = null;\r
+\r
+               this.getActive = function() {\r
+                       return activeOverlay;\r
+               }\r
+\r
+               this.focus = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               this.blurAll();\r
+                               activeOverlay = o;\r
+                               YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");\r
+                               if (! isNaN(topZIndex) && this.overlays[0] != overlay) {\r
+                                       activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex) + 1));\r
+                               }\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                       }\r
+               }\r
+\r
+               this.remove = function(overlay) {\r
+                       var o = this.find(overlay);\r
+                       if (o) {\r
+                               var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");\r
+                               o.cfg.setProperty("zIndex", -1000, true);\r
+                               this.overlays.sort(this.compareZIndexDesc);\r
+                               this.overlays = this.overlays.slice(0, this.overlays.length-1);\r
+                               o.cfg.setProperty("zIndex", originalZ, true);\r
+\r
+                               o.cfg.setProperty("manager", null);\r
+                               o.focusEvent = null\r
+                               o.blurEvent = null;\r
+                               o.focus = null;\r
+                               o.blur = null;\r
+                       }\r
+               }\r
+\r
+               this.blurAll = function() {\r
+                       activeOverlay = null;\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               YAHOO.util.Dom.removeClass(this.overlays[o].element, YAHOO.widget.OverlayManager.CSS_FOCUSED);\r
+                       }               \r
+               }\r
+\r
+               var overlays = this.cfg.getProperty("overlays");\r
+               \r
+               if (! this.overlays) {\r
+                       this.overlays = new Array();\r
+               }\r
+\r
+               if (overlays) {\r
+                       this.register(overlays);\r
+                       this.overlays.sort(this.compareZIndexDesc);\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.\r
+       * @param {Overlay}      overlay         An Overlay to register with the manager.\r
+       * @param {Overlay[]}    overlay         An array of Overlays to register with the manager.\r
+       * @return       {boolean}       True if any Overlays are registered.\r
+       */\r
+       register : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       overlay.cfg.addProperty("manager", { value:this } );\r
+\r
+                       overlay.focusEvent = new YAHOO.util.CustomEvent("focus");\r
+                       overlay.blurEvent = new YAHOO.util.CustomEvent("blur");\r
+                       \r
+                       var mgr=this;\r
+\r
+                       overlay.focus = function() {\r
+                               mgr.focus(this);\r
+                               this.focusEvent.fire();\r
+                       } \r
+\r
+                       overlay.blur = function() {\r
+                               mgr.blurAll();\r
+                               this.blurEvent.fire();\r
+                       }\r
+\r
+                       var focusOnDomEvent = function(e,obj) {\r
+                               overlay.focus();\r
+                       }\r
+                       \r
+                       var focusevent = this.cfg.getProperty("focusevent");\r
+                       YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);\r
+\r
+                       var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex");\r
+                       if (! isNaN(zIndex)) {\r
+                               overlay.cfg.setProperty("zIndex", parseInt(zIndex));\r
+                       } else {\r
+                               overlay.cfg.setProperty("zIndex", 0);\r
+                       }\r
+                       \r
+                       this.overlays.push(overlay);\r
+                       return true;\r
+               } else if (overlay instanceof Array) {\r
+                       var regcount = 0;\r
+                       for (var i=0;i<overlay.length;i++) {\r
+                               if (this.register(overlay[i])) {\r
+                                       regcount++;\r
+                               }\r
+                       }\r
+                       if (regcount > 0) {\r
+                               return true;\r
+                       }\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Attempts to locate an Overlay by instance or ID.\r
+       * @param {Overlay}      overlay         An Overlay to locate within the manager\r
+       * @param {string}       overlay         An Overlay id to locate within the manager\r
+       * @return       {Overlay}       The requested Overlay, if found, or null if it cannot be located.\r
+       */\r
+       find : function(overlay) {\r
+               if (overlay instanceof YAHOO.widget.Overlay) {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o] == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }\r
+               } else if (typeof overlay == "string") {\r
+                       for (var o=0;o<this.overlays.length;o++) {\r
+                               if (this.overlays[o].id == overlay) {\r
+                                       return this.overlays[o];\r
+                               }\r
+                       }                       \r
+               }\r
+               return null;\r
+       },\r
+\r
+       /**\r
+       * Used for sorting the manager's Overlays by z-index.\r
+       * @private\r
+       */\r
+       compareZIndexDesc : function(o1, o2) {\r
+               var zIndex1 = o1.cfg.getProperty("zIndex");\r
+               var zIndex2 = o2.cfg.getProperty("zIndex");\r
+\r
+               if (zIndex1 > zIndex2) {\r
+                       return -1;\r
+               } else if (zIndex1 < zIndex2) {\r
+                       return 1;\r
+               } else {\r
+                       return 0;\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Shows all Overlays in the manager.\r
+       */\r
+       showAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].show();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Hides all Overlays in the manager.\r
+       */\r
+       hideAll : function() {\r
+               for (var o=0;o<this.overlays.length;o++) {\r
+                       this.overlays[o].hide();\r
+               }\r
+       },\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       toString : function() {\r
+               return "OverlayManager";\r
+       }\r
+\r
+}/**\r
+* Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+* Code licensed under the BSD License:\r
+* http://developer.yahoo.net/yui/license.txt\r
+* KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.\r
+* @param {Element}     attachTo        The element or element ID to which the key event should be attached\r
+* @param {string}      attachTo        The element or element ID to which the key event should be attached\r
+* @param {object}      keyData         The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).\r
+* @param {function}    handler         The CustomEvent handler to fire when the key event is detected\r
+* @param {object}      handler         An object literal representing the handler. \r
+* @param {string}      event           Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.\r
+* @constructor\r
+*/\r
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {\r
+       if (! event) {\r
+               event = YAHOO.util.KeyListener.KEYDOWN;\r
+       }\r
+\r
+       var keyEvent = new YAHOO.util.CustomEvent("keyPressed");\r
+       \r
+       this.enabledEvent = new YAHOO.util.CustomEvent("enabled");\r
+       this.disabledEvent = new YAHOO.util.CustomEvent("disabled");\r
+\r
+       if (typeof attachTo == 'string') {\r
+               attachTo = document.getElementById(attachTo);\r
+       }\r
+\r
+       if (typeof handler == 'function') {\r
+               keyEvent.subscribe(handler);\r
+       } else {\r
+               keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);\r
+       }\r
+\r
+       /**\r
+       * Handles the key event when a key is pressed.\r
+       * @private\r
+       */\r
+       function handleKeyPress(e, obj) {\r
+               var keyPressed = e.charCode || e.keyCode;\r
+               \r
+               if (! keyData.shift)    keyData.shift = false;\r
+               if (! keyData.alt)              keyData.alt = false;\r
+               if (! keyData.ctrl)             keyData.ctrl = false;\r
+\r
+               // check held down modifying keys first\r
+               if (e.shiftKey == keyData.shift && \r
+                       e.altKey   == keyData.alt &&\r
+                       e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match\r
+\r
+                       if (keyData.keys instanceof Array) {\r
+                               for (var i=0;i<keyData.keys.length;i++) {\r
+                                       if (keyPressed == keyData.keys[i]) {\r
+                                               keyEvent.fire(keyPressed, e);\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               if (keyPressed == keyData.keys) {\r
+                                       keyEvent.fire(keyPressed, e);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       this.enable = function() {\r
+               if (! this.enabled) {\r
+                       YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);\r
+                       this.enabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = true;\r
+       }\r
+\r
+       this.disable = function() {\r
+               if (this.enabled) {\r
+                       YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);\r
+                       this.disabledEvent.fire(keyData);\r
+               }\r
+               this.enabled = false;\r
+       }\r
+\r
+       /**\r
+       * Returns a string representation of the object.\r
+       * @type string\r
+       */ \r
+       this.toString = function() {\r
+               return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + (attachTo.id ? "[" + attachTo.id + "]" : "");\r
+       }\r
+\r
+}\r
+\r
+/**\r
+* Constant representing the DOM "keydown" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYDOWN = "keydown";\r
+\r
+/**\r
+* Constant representing the DOM "keyup" event.\r
+* @final\r
+*/\r
+YAHOO.util.KeyListener.KEYUP = "keyup";\r
+\r
+/**\r
+* Boolean indicating the enabled/disabled state of the Tooltip\r
+* @type Booleam\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabled = null;\r
+\r
+/**\r
+* Enables the KeyListener, by dynamically attaching the key event to the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.enable = function() {};\r
+\r
+/**\r
+* Disables the KeyListener, by dynamically removing the key event from the appropriate DOM element.\r
+*/\r
+YAHOO.util.KeyListener.prototype.disable = function() {};\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is enabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.enabledEvent = null;\r
+\r
+/**\r
+* CustomEvent fired when the KeyListener is disabled\r
+* args: keyData\r
+* @type YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.util.KeyListener.prototype.disabledEvent = null;
\ No newline at end of file
diff --git a/lib/yui/dom/README b/lib/yui/dom/README
new file mode 100755 (executable)
index 0000000..e4e1941
--- /dev/null
@@ -0,0 +1,37 @@
+Dom Release Notes\r
+\r
+*** version 0.11.0 ***\r
+* Work around Opera 9 broken currentStyle\r
+* Removed timeout wrapper from setXY retry\r
+* Tagname tests now case-insensitive\r
+* Internal "this" references changed to allow for method shorthand\r
+* get/setStyle now accept both camel and hyphen case\r
+* Gecko reverted to crawling offsets for getXY\r
\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Safari now fails gracefully when querying computedStyle of an unavailable element \r
+\r
+* Class management functions added (hasClass, addClass, removeClass, replaceClass, getElementsByClassName) \r
+\r
+* All methods that accept HTMLElements or IDs now also accept arrays of HTMLElements and/or IDs\r
+\r
+* GenerateId method added\r
+\r
+* isAncestor method added\r
+\r
+* inDocument method added\r
+\r
+* getElementsBy method added\r
+\r
+* batch method added\r
+\r
+* getClientHeight/Width deprecated in favor of getViewportHeight/Width\r
+\r
+* getDocumentHeight/Width methods added \r
+\r
+*** version 0.9.0 ***\r
+\r
+* Initial release\r
+\r
diff --git a/lib/yui/dom/dom-debug.js b/lib/yui/dom/dom-debug.js
new file mode 100755 (executable)
index 0000000..d1886f0
--- /dev/null
@@ -0,0 +1,917 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+/**\r
+ * @class Provides helper methods for DOM elements.\r
+ */\r
+YAHOO.util.Dom = function() {\r
+   var ua = navigator.userAgent.toLowerCase();\r
+   var isOpera = (ua.indexOf('opera') > -1);\r
+   var isSafari = (ua.indexOf('safari') > -1);\r
+   var isIE = (window.ActiveXObject);\r
+\r
+   var id_counter = 0;\r
+   var util = YAHOO.util; // internal shorthand\r
+   var property_cache = {}; // to cache case conversion for set/getStyle\r
+   var logger = {};\r
+   logger.log = function() {YAHOO.log.apply(window, arguments)};\r
+\r
+   var toCamel = function(property) {\r
+      var convert = function(prop) {\r
+         var test = /(-[a-z])/i.exec(prop);\r
+         return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());\r
+      };\r
+\r
+      while(property.indexOf('-') > -1) {\r
+         property = convert(property);\r
+      }\r
+\r
+      return property;\r
+      //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug\r
+   };\r
+\r
+   var toHyphen = function(property) {\r
+      if (property.indexOf('-') > -1) { // assume hyphen\r
+         return property;\r
+      }\r
+\r
+      var converted = '';\r
+      for (var i = 0, len = property.length;i < len; ++i) {\r
+         if (property.charAt(i) == property.charAt(i).toUpperCase()) {\r
+            converted = converted + '-' + property.charAt(i).toLowerCase();\r
+         } else {\r
+            converted = converted + property.charAt(i);\r
+         }\r
+      }\r
+\r
+      return converted;\r
+      //return property.replace(/([a-z])([A-Z]+)/g, function(m0, m1, m2) {return (m1 + '-' + m2.toLowerCase())});\r
+   };\r
+\r
+   // improve performance by only looking up once\r
+   var cacheConvertedProperties = function(property) {\r
+      property_cache[property] = {\r
+         camel: toCamel(property),\r
+         hyphen: toHyphen(property)\r
+      };\r
+   };\r
+\r
+   return {\r
+      /**\r
+       * Returns an HTMLElement reference\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @return {HTMLElement/Array} A DOM reference to an HTML element or an array of HTMLElements.\r
+       */\r
+      get: function(el) {\r
+         if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is\r
+            logger.log('get(' + el + ') returning ' + el, 'info', 'Dom');\r
+            return el;\r
+         }\r
+\r
+         if (typeof el == 'string') { // ID\r
+            logger.log('get("' + el + '") returning ' + document.getElementById(el), 'info', 'Dom');\r
+            return document.getElementById(el);\r
+         }\r
+         else { // array of ID's and/or elements\r
+            var collection = [];\r
+            for (var i = 0, len = el.length; i < len; ++i) {\r
+               collection[collection.length] = util.Dom.get(el[i]);\r
+            }\r
+\r
+            logger.log('get("' + el + '") returning ' + collection, 'info', 'Dom');\r
+            return collection;\r
+         }\r
+\r
+         logger.log('element ' + el + ' not found', 'error', 'Dom');\r
+         return null; // safety, should never happen\r
+      },\r
+\r
+      /**\r
+       * Normalizes currentStyle and ComputedStyle.\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {String} property The style property whose value is returned.\r
+       * @return {String/Array} The current value of the style property for the element(s).\r
+       */\r
+      getStyle: function(el, property) {\r
+         var f = function(el) {\r
+            var value = null;\r
+            var dv = document.defaultView;\r
+\r
+            if (!property_cache[property]) {\r
+               cacheConvertedProperties(property);\r
+            }\r
+\r
+            var camel = property_cache[property]['camel'];\r
+            var hyphen = property_cache[property]['hyphen'];\r
+\r
+            if (property == 'opacity' && el.filters) {// IE opacity\r
+               value = 1;\r
+               try {\r
+                  value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;\r
+               } catch(e) {\r
+                  try {\r
+                     value = el.filters.item('alpha').opacity / 100;\r
+                  } catch(e) {}\r
+               }\r
+            } else if (el.style[camel]) { // camelCase for valid styles\r
+               value = el.style[camel];\r
+            }\r
+            else if (isIE && el.currentStyle && el.currentStyle[camel]) { // camelCase for currentStyle; isIE to workaround broken Opera 9 currentStyle\r
+               value = el.currentStyle[camel];\r
+            }\r
+            else if ( dv && dv.getComputedStyle ) { // hyphen-case for computedStyle\r
+               var computed = dv.getComputedStyle(el, '');\r
+\r
+               if (computed && computed.getPropertyValue(hyphen)) {\r
+                  value = computed.getPropertyValue(hyphen);\r
+               }\r
+            }\r
+\r
+            logger.log('getStyle ' + property + ' returning ' + value, 'info', 'Dom');\r
+            return value;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {String} property The style property to be set.\r
+       * @param {String} val The value to apply to the given property.\r
+       */\r
+      setStyle: function(el, property, val) {\r
+         if (!property_cache[property]) {\r
+            cacheConvertedProperties(property);\r
+         }\r
+\r
+         var camel = property_cache[property]['camel'];\r
+\r
+         var f = function(el) {\r
+            switch(property) {\r
+               case 'opacity' :\r
+                  if (isIE && typeof el.style.filter == 'string') { // in case not appended\r
+                     el.style.filter = 'alpha(opacity=' + val * 100 + ')';\r
+\r
+                     if (!el.currentStyle || !el.currentStyle.hasLayout) {\r
+                        el.style.zoom = 1; // when no layout or cant tell\r
+                     }\r
+                  } else {\r
+                     el.style.opacity = val;\r
+                     el.style['-moz-opacity'] = val;\r
+                     el.style['-khtml-opacity'] = val;\r
+                  }\r
+\r
+                  break;\r
+               default :\r
+                  el.style[camel] = val;\r
+            }\r
+\r
+            logger.log('setStyle setting ' + property + ' to ' + val, 'info', 'Dom');\r
+\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Gets the current position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       @ return {Array} The XY position of the element(s)\r
+       */\r
+      getXY: function(el) {\r
+         var f = function(el) {\r
+\r
+         // has to be part of document to have pageXY\r
+            if (el.parentNode === null || this.getStyle(el, 'display') == 'none') {\r
+               logger.log('getXY failed: element not available', 'error', 'Dom');\r
+               return false;\r
+            }\r
+\r
+            var parentNode = null;\r
+            var pos = [];\r
+            var box;\r
+\r
+            if (el.getBoundingClientRect) { // IE\r
+               box = el.getBoundingClientRect();\r
+               var doc = document;\r
+               if ( !this.inDocument(el) ) {// might be in a frame, need to get its scroll\r
+                  var doc = parent.document;\r
+                  while ( doc && !this.isAncestor(doc.documentElement, el) ) {\r
+                     doc = parent.document;\r
+                  }\r
+               }\r
+\r
+               var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);\r
+               var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);\r
+\r
+               return [box.left + scrollLeft, box.top + scrollTop];\r
+            }\r
+            else { // safari, opera, & gecko\r
+               pos = [el.offsetLeft, el.offsetTop];\r
+               parentNode = el.offsetParent;\r
+               if (parentNode != el) {\r
+                  while (parentNode) {\r
+                     pos[0] += parentNode.offsetLeft;\r
+                     pos[1] += parentNode.offsetTop;\r
+                     parentNode = parentNode.offsetParent;\r
+                  }\r
+               }\r
+               if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases\r
+                  pos[0] -= document.body.offsetLeft;\r
+                  pos[1] -= document.body.offsetTop;\r
+               }\r
+            }\r
+\r
+            if (el.parentNode) { parentNode = el.parentNode; }\r
+            else { parentNode = null; }\r
+\r
+            while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')\r
+            { // account for any scrolled ancestors\r
+               pos[0] -= parentNode.scrollLeft;\r
+               pos[1] -= parentNode.scrollTop;\r
+\r
+               if (parentNode.parentNode) { parentNode = parentNode.parentNode; }\r
+               else { parentNode = null; }\r
+            }\r
+\r
+            logger.log('getXY returning ' + pos, 'info', 'Dom');\r
+\r
+            return pos;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @return {String/Array} The X position of the element(s)\r
+       */\r
+      getX: function(el) {\r
+         return util.Dom.getXY(el)[0];\r
+      },\r
+\r
+      /**\r
+       * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @return {String/Array} The Y position of the element(s)\r
+       */\r
+      getY: function(el) {\r
+         return util.Dom.getXY(el)[1];\r
+      },\r
+\r
+      /**\r
+       * Set the position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)\r
+       * @param {Boolean} noRetry By default we try and set the position a second time if the first fails\r
+       */\r
+      setXY: function(el, pos, noRetry) {\r
+         var f = function(el) {\r
+            var style_pos = this.getStyle(el, 'position');\r
+            if (style_pos == 'static') { // default to relative\r
+               this.setStyle(el, 'position', 'relative');\r
+               style_pos = 'relative';\r
+            }\r
+\r
+            var pageXY = this.getXY(el);\r
+            if (pageXY === false) { // has to be part of doc to have pageXY\r
+               logger.log('setXY failed: element not available', 'error', 'Dom');\r
+               return false;\r
+            }\r
+\r
+            var delta = [ // assuming pixels; if not we will have to retry\r
+               parseInt( this.getStyle(el, 'left'), 10 ),\r
+               parseInt( this.getStyle(el, 'top'), 10 )\r
+            ];\r
+\r
+            if ( isNaN(delta[0]) ) {// in case of 'auto'\r
+               delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;\r
+            }\r
+            if ( isNaN(delta[1]) ) { // in case of 'auto'\r
+               delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;\r
+            }\r
+\r
+            if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }\r
+            if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }\r
+\r
+            var newXY = this.getXY(el);\r
+\r
+            // if retry is true, try one more time if we miss\r
+            if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {\r
+               this.setXY(el, pos, true);\r
+            }\r
+\r
+            logger.log('setXY setting position to ' + pos, 'info', 'Dom');\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Set the X position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {Int} x to use as the X coordinate for the element(s).\r
+       */\r
+      setX: function(el, x) {\r
+         util.Dom.setXY(el, [x, null]);\r
+      },\r
+\r
+      /**\r
+       * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {Int} x to use as the Y coordinate for the element(s).\r
+       */\r
+      setY: function(el, y) {\r
+         util.Dom.setXY(el, [null, y]);\r
+      },\r
+\r
+      /**\r
+       * Returns the region position of the given element.\r
+       * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @return {Region/Array} A Region or array of Region instances containing "top, left, bottom, right" member data.\r
+       */\r
+      getRegion: function(el) {\r
+         var f = function(el) {\r
+            var region = new YAHOO.util.Region.getRegion(el);\r
+            logger.log('getRegion returning ' + region, 'info', 'Dom');\r
+            return region;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Returns the width of the client (viewport).\r
+       * Now using getViewportWidth.  This interface left intact for back compat.\r
+       * @return {Int} The width of the viewable area of the page.\r
+       */\r
+      getClientWidth: function() {\r
+         return util.Dom.getViewportWidth();\r
+      },\r
+\r
+      /**\r
+       * Returns the height of the client (viewport).\r
+       * Now using getViewportHeight.  This interface left intact for back compat.\r
+       * @return {Int} The height of the viewable area of the page.\r
+       */\r
+      getClientHeight: function() {\r
+         return util.Dom.getViewportHeight();\r
+      },\r
+\r
+      /**\r
+       * Returns a array of HTMLElements with the given class\r
+       * For optimized performance, include a tag and/or root node if possible\r
+       * @param {String} className The class name to match against\r
+       * @param {String} tag (optional) The tag name of the elements being collected\r
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point\r
+       * @return {Array} An array of elements that have the given class name\r
+       */\r
+      getElementsByClassName: function(className, tag, root) {\r
+         var method = function(el) { return util.Dom.hasClass(el, className) };\r
+         return util.Dom.getElementsBy(method, tag, root);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement has the given className\r
+       * @param {String/HTMLElement/Array} el The element or collection to test\r
+       * @param {String} className the class name to search for\r
+       * @return {Boolean/Array} A boolean value or array of boolean values\r
+       */\r
+      hasClass: function(el, className) {\r
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');\r
+\r
+         var f = function(el) {\r
+            logger.log('hasClass returning ' + re.test(el['className']), 'info', 'Dom');\r
+            return re.test(el['className']);\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Adds a class name to a given element or collection of elements\r
+       * @param {String/HTMLElement/Array} el The element or collection to add the class to\r
+       * @param {String} className the class name to add to the class attribute\r
+       */\r
+      addClass: function(el, className) {\r
+         var f = function(el) {\r
+            if (this.hasClass(el, className)) { return; } // already present\r
+\r
+            logger.log('addClass adding ' + className, 'info', 'Dom');\r
+\r
+            el['className'] = [el['className'], className].join(' ');\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Removes a class name from a given element or collection of elements\r
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from\r
+       * @param {String} className the class name to remove from the class attribute\r
+       */\r
+      removeClass: function(el, className) {\r
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');\r
+\r
+         var f = function(el) {\r
+            if (!this.hasClass(el, className)) { return; } // not present\r
+\r
+            logger.log('removeClass removing ' + className, 'info', 'Dom');\r
+\r
+            var c = el['className'];\r
+            el['className'] = c.replace(re, ' ');\r
+            if ( this.hasClass(el, className) ) { // in case of multiple adjacent\r
+               this.removeClass(el, className);\r
+            }\r
+\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Replace a class with another class for a given element or collection of elements.\r
+       * If no oldClassName is present, the newClassName is simply added.\r
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from\r
+       * @param {String} oldClassName the class name to be replaced\r
+       * @param {String} newClassName the class name that will be replacing the old class name\r
+       */\r
+      replaceClass: function(el, oldClassName, newClassName) {\r
+         var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');\r
+\r
+         var f = function(el) {\r
+            logger.log('replaceClass replacing ' + oldClassName + ' with ' + newClassName, 'info', 'Dom');\r
+\r
+            el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');\r
+\r
+            if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent\r
+               this.replaceClass(el, oldClassName, newClassName);\r
+            }\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Generates a unique ID\r
+       * @param {String/HTMLElement/Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present)\r
+       * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen")\r
+       * @return {String/Array} The generated ID, or array of generated IDs (or original ID if already present on an element)\r
+       */\r
+      generateId: function(el, prefix) {\r
+         prefix = prefix || 'yui-gen';\r
+         el = el || {};\r
+\r
+         var f = function(el) {\r
+            if (el) {\r
+               el = util.Dom.get(el);\r
+            } else {\r
+               el = {}; // just generating ID in this case\r
+            }\r
+\r
+            if (!el.id) {\r
+               el.id = prefix + id_counter++;\r
+               logger.log('generateId generating ' + el.id, 'info', 'Dom');\r
+            } // dont override existing\r
+\r
+            logger.log('generateId returning ' + el.id, 'info', 'Dom');\r
+\r
+            return el.id;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy\r
+       * @param {String/HTMLElement} haystack The possible ancestor\r
+       * @param {String/HTMLElement} needle The possible descendent\r
+       * @return {Boolean} Whether or not the haystack is an ancestor of needle\r
+       */\r
+      isAncestor: function(haystack, needle) {\r
+         haystack = util.Dom.get(haystack);\r
+         if (!haystack || !needle) { return false; }\r
+\r
+         var f = function(needle) {\r
+            if (haystack.contains && !isSafari) { // safari "contains" is broken\r
+               logger.log('isAncestor returning ' + haystack.contains(needle), 'info', 'Dom');\r
+               return haystack.contains(needle);\r
+            }\r
+            else if ( haystack.compareDocumentPosition ) {\r
+               logger.log('isAncestor returning ' + !!(haystack.compareDocumentPosition(needle) & 16), 'info', 'Dom');\r
+               return !!(haystack.compareDocumentPosition(needle) & 16);\r
+            }\r
+            else { // loop up and test each parent\r
+               var parent = needle.parentNode;\r
+\r
+               while (parent) {\r
+                  if (parent == haystack) {\r
+                     logger.log('isAncestor returning true', 'info', 'Dom');\r
+                     return true;\r
+                  }\r
+                  else if (parent.tagName.toUpperCase() == 'HTML') {\r
+                     logger.log('isAncestor returning false', 'info', 'Dom');\r
+                     return false;\r
+                  }\r
+\r
+                  parent = parent.parentNode;\r
+               }\r
+               logger.log('isAncestor returning false', 'info', 'Dom');\r
+               return false;\r
+            }\r
+         };\r
+\r
+         return util.Dom.batch(needle, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement is present in the current document\r
+       * @param {String/HTMLElement} el The element to search for\r
+       * @return {Boolean} Whether or not the element is present in the current document\r
+       */\r
+      inDocument: function(el) {\r
+         var f = function(el) {\r
+            return this.isAncestor(document.documentElement, el);\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Returns a array of HTMLElements that pass the test applied by supplied boolean method\r
+       * For optimized performance, include a tag and/or root node if possible\r
+       * @param {Function} method A boolean method to test elements with\r
+       * @param {String} tag (optional) The tag name of the elements being collected\r
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point\r
+       */\r
+      getElementsBy: function(method, tag, root) {\r
+         tag = tag || '*';\r
+         root = util.Dom.get(root) || document;\r
+\r
+         var nodes = [];\r
+         var elements = root.getElementsByTagName(tag);\r
+\r
+         if ( !elements.length && (tag == '*' && root.all) ) {\r
+            elements = root.all; // IE < 6\r
+         }\r
+\r
+         for (var i = 0, len = elements.length; i < len; ++i)\r
+         {\r
+            if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }\r
+         }\r
+\r
+         logger.log('getElementsBy returning ' + nodes, 'info', 'Dom');\r
+\r
+         return nodes;\r
+      },\r
+\r
+      /**\r
+       * Returns an array of elements that have had the supplied method applied.\r
+       * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) )\r
+       * @param {String/HTMLElement/Array} el (optional) An element or array of elements to apply the method to\r
+       * @param {Function} method The method to apply to the element(s)\r
+       * @param {Generic} (optional) o An optional arg that is passed to the supplied method\r
+       * @param {Boolean} (optional) override Whether or not to override the scope of "method" with "o"\r
+       * @return {HTMLElement/Array} The element(s) with the method applied\r
+       */\r
+      batch: function(el, method, o, override) {\r
+         var id = el;\r
+         el = util.Dom.get(el);\r
+\r
+         var scope = (override) ? o : window;\r
+\r
+         if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)\r
+            if (!el) {\r
+               logger.log(id + ' not available', 'error', 'Dom');\r
+               return false;\r
+            }\r
+            return method.call(scope, el, o);\r
+         }\r
+\r
+         var collection = [];\r
+\r
+         for (var i = 0, len = el.length; i < len; ++i) {\r
+            if (!el[i]) {\r
+               id = id[i];\r
+               logger.log(id + ' not available', 'error', 'Dom');\r
+            }\r
+            collection[collection.length] = method.call(scope, el[i], o);\r
+         }\r
+\r
+         return collection;\r
+      },\r
+\r
+      /**\r
+       * Returns the height of the document.\r
+       * @return {Int} The height of the actual document (which includes the body and its margin).\r
+       */\r
+      getDocumentHeight: function() {\r
+         var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;\r
+         var marginTop = parseInt(util.Dom.getStyle(document.body, 'marginTop'), 10);\r
+         var marginBottom = parseInt(util.Dom.getStyle(document.body, 'marginBottom'), 10);\r
+\r
+         var mode = document.compatMode;\r
+\r
+         if ( (mode || isIE) && !isOpera ) { // (IE, Gecko)\r
+            switch (mode) {\r
+               case 'CSS1Compat': // Standards mode\r
+                  scrollHeight = ((window.innerHeight && window.scrollMaxY) ?  window.innerHeight+window.scrollMaxY : -1);\r
+                  windowHeight = [document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a, b){return(a-b);})[1];\r
+                  bodyHeight = document.body.offsetHeight + marginTop + marginBottom;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  scrollHeight = document.body.scrollHeight;\r
+                  bodyHeight = document.body.clientHeight;\r
+            }\r
+         } else { // Safari & Opera\r
+            scrollHeight = document.documentElement.scrollHeight;\r
+            windowHeight = self.innerHeight;\r
+            bodyHeight = document.documentElement.clientHeight;\r
+         }\r
+\r
+         var h = [scrollHeight,windowHeight,bodyHeight].sort(function(a, b){return(a-b);});\r
+         logger.log('getDocumentHeight returning ' + h[2], 'info', 'Dom');\r
+         return h[2];\r
+      },\r
+\r
+      /**\r
+       * Returns the width of the document.\r
+       * @return {Int} The width of the actual document (which includes the body and its margin).\r
+       */\r
+      getDocumentWidth: function() {\r
+         var docWidth=-1,bodyWidth=-1,winWidth=-1;\r
+         var marginRight = parseInt(util.Dom.getStyle(document.body, 'marginRight'), 10);\r
+         var marginLeft = parseInt(util.Dom.getStyle(document.body, 'marginLeft'), 10);\r
+\r
+         var mode = document.compatMode;\r
+\r
+         if (mode || isIE) { // (IE, Gecko, Opera)\r
+            switch (mode) {\r
+               case 'CSS1Compat': // Standards mode\r
+                  docWidth = document.documentElement.clientWidth;\r
+                  bodyWidth = document.body.offsetWidth + marginLeft + marginRight;\r
+                  winWidth = self.innerWidth || -1;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  bodyWidth = document.body.clientWidth;\r
+                  winWidth = document.body.scrollWidth;\r
+                  break;\r
+            }\r
+         } else { // Safari\r
+            docWidth = document.documentElement.clientWidth;\r
+            bodyWidth = document.body.offsetWidth + marginLeft + marginRight;\r
+            winWidth = self.innerWidth;\r
+         }\r
+\r
+         var w = [docWidth,bodyWidth,winWidth].sort(function(a, b){return(a-b);});\r
+         logger.log('getDocumentWidth returning ' + w[2], 'info', 'Dom');\r
+         return w[2];\r
+      },\r
+\r
+      /**\r
+       * Returns the current height of the viewport.\r
+       * @return {Int} The height of the viewable area of the page (excludes scrollbars).\r
+       */\r
+      getViewportHeight: function() {\r
+         var height = -1;\r
+         var mode = document.compatMode;\r
+\r
+         if ( (mode || isIE) && !isOpera ) {\r
+            switch (mode) { // (IE, Gecko)\r
+               case 'CSS1Compat': // Standards mode\r
+                  height = document.documentElement.clientHeight;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  height = document.body.clientHeight;\r
+            }\r
+         } else { // Safari, Opera\r
+            height = self.innerHeight;\r
+         }\r
+\r
+         logger.log('getViewportHeight returning ' + height, 'info', 'Dom');\r
+         return height;\r
+      },\r
+\r
+      /**\r
+       * Returns the current width of the viewport.\r
+       * @return {Int} The width of the viewable area of the page (excludes scrollbars).\r
+       */\r
+\r
+      getViewportWidth: function() {\r
+         var width = -1;\r
+         var mode = document.compatMode;\r
+\r
+         if (mode || isIE) { // (IE, Gecko, Opera)\r
+            switch (mode) {\r
+            case 'CSS1Compat': // Standards mode\r
+               width = document.documentElement.clientWidth;\r
+               break;\r
+\r
+            default: // Quirks\r
+               width = document.body.clientWidth;\r
+            }\r
+         } else { // Safari\r
+            width = self.innerWidth;\r
+         }\r
+         logger.log('getViewportWidth returning ' + width, 'info', 'Dom');\r
+         return width;\r
+      }\r
+   };\r
+}();\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+*/\r
+\r
+/**\r
+ * @class A region is a representation of an object on a grid.  It is defined\r
+ * by the top, right, bottom, left extents, so is rectangular by default.  If\r
+ * other shapes are required, this class could be extended to support it.\r
+ *\r
+ * @param {int} t the top extent\r
+ * @param {int} r the right extent\r
+ * @param {int} b the bottom extent\r
+ * @param {int} l the left extent\r
+ * @constructor\r
+ */\r
+YAHOO.util.Region = function(t, r, b, l) {\r
+\r
+    /**\r
+     * The region's top extent\r
+     * @type int\r
+     */\r
+    this.top = t;\r
+\r
+    /**\r
+     * The region's top extent as index, for symmetry with set/getXY\r
+     * @type int\r
+     */\r
+    this[1] = t;\r
+\r
+    /**\r
+     * The region's right extent\r
+     * @type int\r
+     */\r
+    this.right = r;\r
+\r
+    /**\r
+     * The region's bottom extent\r
+     * @type int\r
+     */\r
+    this.bottom = b;\r
+\r
+    /**\r
+     * The region's left extent\r
+     * @type int\r
+     */\r
+    this.left = l;\r
+\r
+    /**\r
+     * The region's left extent as index, for symmetry with set/getXY\r
+     * @type int\r
+     */\r
+    this[0] = l;\r
+};\r
+\r
+/**\r
+ * Returns true if this region contains the region passed in\r
+ *\r
+ * @param  {Region}  region The region to evaluate\r
+ * @return {boolean}        True if the region is contained with this region,\r
+ *                          else false\r
+ */\r
+YAHOO.util.Region.prototype.contains = function(region) {\r
+    return ( region.left   >= this.left   &&\r
+             region.right  <= this.right  &&\r
+             region.top    >= this.top    &&\r
+             region.bottom <= this.bottom    );\r
+\r
+    // this.logger.debug("does " + this + " contain " + region + " ... " + ret);\r
+};\r
+\r
+/**\r
+ * Returns the area of the region\r
+ *\r
+ * @return {int} the region's area\r
+ */\r
+YAHOO.util.Region.prototype.getArea = function() {\r
+    return ( (this.bottom - this.top) * (this.right - this.left) );\r
+};\r
+\r
+/**\r
+ * Returns the region where the passed in region overlaps with this one\r
+ *\r
+ * @param  {Region} region The region that intersects\r
+ * @return {Region}        The overlap region, or null if there is no overlap\r
+ */\r
+YAHOO.util.Region.prototype.intersect = function(region) {\r
+    var t = Math.max( this.top,    region.top    );\r
+    var r = Math.min( this.right,  region.right  );\r
+    var b = Math.min( this.bottom, region.bottom );\r
+    var l = Math.max( this.left,   region.left   );\r
+\r
+    if (b >= t && r >= l) {\r
+        return new YAHOO.util.Region(t, r, b, l);\r
+    } else {\r
+        return null;\r
+    }\r
+};\r
+\r
+/**\r
+ * Returns the region representing the smallest region that can contain both\r
+ * the passed in region and this region.\r
+ *\r
+ * @param  {Region} region The region that to create the union with\r
+ * @return {Region}        The union region\r
+ */\r
+YAHOO.util.Region.prototype.union = function(region) {\r
+    var t = Math.min( this.top,    region.top    );\r
+    var r = Math.max( this.right,  region.right  );\r
+    var b = Math.max( this.bottom, region.bottom );\r
+    var l = Math.min( this.left,   region.left   );\r
+\r
+    return new YAHOO.util.Region(t, r, b, l);\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return string the region properties\r
+ */\r
+YAHOO.util.Region.prototype.toString = function() {\r
+    return ( "Region {"    +\r
+             "top: "       + this.top    +\r
+             ", right: "   + this.right  +\r
+             ", bottom: "  + this.bottom +\r
+             ", left: "    + this.left   +\r
+             "}" );\r
+};\r
+\r
+/**\r
+ * Returns a region that is occupied by the DOM element\r
+ *\r
+ * @param  {HTMLElement} el The element\r
+ * @return {Region}         The region that the element occupies\r
+ * @static\r
+ */\r
+YAHOO.util.Region.getRegion = function(el) {\r
+    var p = YAHOO.util.Dom.getXY(el);\r
+\r
+    var t = p[1];\r
+    var r = p[0] + el.offsetWidth;\r
+    var b = p[1] + el.offsetHeight;\r
+    var l = p[0];\r
+\r
+    return new YAHOO.util.Region(t, r, b, l);\r
+};\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+/**\r
+ * @class\r
+ *\r
+ * A point is a region that is special in that it represents a single point on\r
+ * the grid.\r
+ *\r
+ * @param {int} x The X position of the point\r
+ * @param {int} y The Y position of the point\r
+ * @constructor\r
+ * @extends Region\r
+ */\r
+YAHOO.util.Point = function(x, y) {\r
+   if (x instanceof Array) { // accept output from Dom.getXY\r
+      y = x[1];\r
+      x = x[0];\r
+   }\r
+\r
+    /**\r
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)\r
+     * @type int\r
+     */\r
+\r
+    this.x = this.right = this.left = this[0] = x;\r
+\r
+    /**\r
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)\r
+     * @type int\r
+     */\r
+    this.y = this.top = this.bottom = this[1] = y;\r
+};\r
+\r
+YAHOO.util.Point.prototype = new YAHOO.util.Region();\r
+\r
diff --git a/lib/yui/dom/dom-min.js b/lib/yui/dom/dom-min.js
new file mode 100755 (executable)
index 0000000..7035bd9
--- /dev/null
@@ -0,0 +1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.11.0 */YAHOO.util.Dom=function(){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isSafari=(ua.indexOf('safari')>-1);var isIE=(window.ActiveXObject);var id_counter=0;var util=YAHOO.util;var property_cache={};var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);}return property;};var toHyphen=function(property){if(property.indexOf('-')>-1){return property;}var converted='';for(var i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}return converted;};var cacheConvertedProperties=function(property){property_cache[property]={camel:toCamel(property),hyphen:toHyphen(property)};};return{get:function(el){if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=util.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){var f=function(el){var value=null;var dv=document.defaultView;if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var hyphen=property_cache[property]['hyphen'];if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}else if(el.style[camel]){value=el.style[camel];}else if(isIE&&el.currentStyle&&el.currentStyle[camel]){value=el.currentStyle[camel];}else if(dv&&dv.getComputedStyle){var computed=dv.getComputedStyle(el,'');if(computed&&computed.getPropertyValue(hyphen)){value=computed.getPropertyValue(hyphen);}}return value;};return util.Dom.batch(el,f,util.Dom,true);},setStyle:function(el,property,val){if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var f=function(el){switch(property){case'opacity':if(isIE&&typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}break;default:el.style[camel]=val;}};util.Dom.batch(el,f,util.Dom,true);},getXY:function(el){var f=function(el){if(el.parentNode===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)){var doc=parent.document;while(doc&&!this.isAncestor(doc.documentElement,el)){doc=parent.document;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return util.Dom.batch(el,f,util.Dom,true);},getX:function(el){return util.Dom.getXY(el)[0];},getY:function(el){return util.Dom.getXY(el)[1];},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};util.Dom.batch(el,f,util.Dom,true);},setX:function(el,x){util.Dom.setXY(el,[x,null]);},setY:function(el,y){util.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new YAHOO.util.Region.getRegion(el);return region;};return util.Dom.batch(el,f,util.Dom,true);},getClientWidth:function(){return util.Dom.getViewportWidth();},getClientHeight:function(){return util.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return util.Dom.hasClass(el,className)};return util.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return util.Dom.batch(el,f,util.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};util.Dom.batch(el,f,util.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};util.Dom.batch(el,f,util.Dom,true);},replaceClass:function(el,oldClassName,newClassName){var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};util.Dom.batch(el,f,util.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=util.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return util.Dom.batch(el,f,util.Dom,true);},isAncestor:function(haystack,needle){haystack=util.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return util.Dom.batch(needle,f,util.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return util.Dom.batch(el,f,util.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=util.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=util.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=id[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;var marginTop=parseInt(util.Dom.getStyle(document.body,'marginTop'),10);var marginBottom=parseInt(util.Dom.getStyle(document.body,'marginBottom'),10);var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':scrollHeight=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);windowHeight=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){return(a-b);})[1];bodyHeight=document.body.offsetHeight+marginTop+marginBottom;break;default:scrollHeight=document.body.scrollHeight;bodyHeight=document.body.clientHeight;}}else{scrollHeight=document.documentElement.scrollHeight;windowHeight=self.innerHeight;bodyHeight=document.documentElement.clientHeight;}var h=[scrollHeight,windowHeight,bodyHeight].sort(function(a,b){return(a-b);});return h[2];},getDocumentWidth:function(){var docWidth=-1,bodyWidth=-1,winWidth=-1;var marginRight=parseInt(util.Dom.getStyle(document.body,'marginRight'),10);var marginLeft=parseInt(util.Dom.getStyle(document.body,'marginLeft'),10);var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;winWidth=self.innerWidth||-1;break;default:bodyWidth=document.body.clientWidth;winWidth=document.body.scrollWidth;break;}}else{docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;winWidth=self.innerWidth;}var w=[docWidth,bodyWidth,winWidth].sort(function(a,b){return(a-b);});return w[2];},getViewportHeight:function(){var height=-1;var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':height=document.documentElement.clientHeight;break;default:height=document.body.clientHeight;}}else{height=self.innerHeight;}return height;},getViewportWidth:function(){var width=-1;var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':width=document.documentElement.clientWidth;break;default:width=document.body.clientWidth;}}else{width=self.innerWidth;}return width;}};}();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();\r
diff --git a/lib/yui/dom/dom.js b/lib/yui/dom/dom.js
new file mode 100755 (executable)
index 0000000..3427cb8
--- /dev/null
@@ -0,0 +1,884 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+/**\r
+ * @class Provides helper methods for DOM elements.\r
+ */\r
+YAHOO.util.Dom = function() {\r
+   var ua = navigator.userAgent.toLowerCase();\r
+   var isOpera = (ua.indexOf('opera') > -1);\r
+   var isSafari = (ua.indexOf('safari') > -1);\r
+   var isIE = (window.ActiveXObject);\r
+\r
+   var id_counter = 0;\r
+   var util = YAHOO.util; // internal shorthand\r
+   var property_cache = {}; // to cache case conversion for set/getStyle\r
+\r
+   var toCamel = function(property) {\r
+      var convert = function(prop) {\r
+         var test = /(-[a-z])/i.exec(prop);\r
+         return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());\r
+      };\r
+\r
+      while(property.indexOf('-') > -1) {\r
+         property = convert(property);\r
+      }\r
+\r
+      return property;\r
+      //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug\r
+   };\r
+\r
+   var toHyphen = function(property) {\r
+      if (property.indexOf('-') > -1) { // assume hyphen\r
+         return property;\r
+      }\r
+\r
+      var converted = '';\r
+      for (var i = 0, len = property.length;i < len; ++i) {\r
+         if (property.charAt(i) == property.charAt(i).toUpperCase()) {\r
+            converted = converted + '-' + property.charAt(i).toLowerCase();\r
+         } else {\r
+            converted = converted + property.charAt(i);\r
+         }\r
+      }\r
+\r
+      return converted;\r
+      //return property.replace(/([a-z])([A-Z]+)/g, function(m0, m1, m2) {return (m1 + '-' + m2.toLowerCase())});\r
+   };\r
+\r
+   // improve performance by only looking up once\r
+   var cacheConvertedProperties = function(property) {\r
+      property_cache[property] = {\r
+         camel: toCamel(property),\r
+         hyphen: toHyphen(property)\r
+      };\r
+   };\r
+\r
+   return {\r
+      /**\r
+       * Returns an HTMLElement reference\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @return {HTMLElement/Array} A DOM reference to an HTML element or an array of HTMLElements.\r
+       */\r
+      get: function(el) {\r
+         if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is\r
+            return el;\r
+         }\r
+\r
+         if (typeof el == 'string') { // ID\r
+            return document.getElementById(el);\r
+         }\r
+         else { // array of ID's and/or elements\r
+            var collection = [];\r
+            for (var i = 0, len = el.length; i < len; ++i) {\r
+               collection[collection.length] = util.Dom.get(el[i]);\r
+            }\r
+\r
+            return collection;\r
+         }\r
+\r
+         return null; // safety, should never happen\r
+      },\r
+\r
+      /**\r
+       * Normalizes currentStyle and ComputedStyle.\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {String} property The style property whose value is returned.\r
+       * @return {String/Array} The current value of the style property for the element(s).\r
+       */\r
+      getStyle: function(el, property) {\r
+         var f = function(el) {\r
+            var value = null;\r
+            var dv = document.defaultView;\r
+\r
+            if (!property_cache[property]) {\r
+               cacheConvertedProperties(property);\r
+            }\r
+\r
+            var camel = property_cache[property]['camel'];\r
+            var hyphen = property_cache[property]['hyphen'];\r
+\r
+            if (property == 'opacity' && el.filters) {// IE opacity\r
+               value = 1;\r
+               try {\r
+                  value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;\r
+               } catch(e) {\r
+                  try {\r
+                     value = el.filters.item('alpha').opacity / 100;\r
+                  } catch(e) {}\r
+               }\r
+            } else if (el.style[camel]) { // camelCase for valid styles\r
+               value = el.style[camel];\r
+            }\r
+            else if (isIE && el.currentStyle && el.currentStyle[camel]) { // camelCase for currentStyle; isIE to workaround broken Opera 9 currentStyle\r
+               value = el.currentStyle[camel];\r
+            }\r
+            else if ( dv && dv.getComputedStyle ) { // hyphen-case for computedStyle\r
+               var computed = dv.getComputedStyle(el, '');\r
+\r
+               if (computed && computed.getPropertyValue(hyphen)) {\r
+                  value = computed.getPropertyValue(hyphen);\r
+               }\r
+            }\r
+\r
+            return value;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {String} property The style property to be set.\r
+       * @param {String} val The value to apply to the given property.\r
+       */\r
+      setStyle: function(el, property, val) {\r
+         if (!property_cache[property]) {\r
+            cacheConvertedProperties(property);\r
+         }\r
+\r
+         var camel = property_cache[property]['camel'];\r
+\r
+         var f = function(el) {\r
+            switch(property) {\r
+               case 'opacity' :\r
+                  if (isIE && typeof el.style.filter == 'string') { // in case not appended\r
+                     el.style.filter = 'alpha(opacity=' + val * 100 + ')';\r
+\r
+                     if (!el.currentStyle || !el.currentStyle.hasLayout) {\r
+                        el.style.zoom = 1; // when no layout or cant tell\r
+                     }\r
+                  } else {\r
+                     el.style.opacity = val;\r
+                     el.style['-moz-opacity'] = val;\r
+                     el.style['-khtml-opacity'] = val;\r
+                  }\r
+\r
+                  break;\r
+               default :\r
+                  el.style[camel] = val;\r
+            }\r
+\r
+\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Gets the current position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       @ return {Array} The XY position of the element(s)\r
+       */\r
+      getXY: function(el) {\r
+         var f = function(el) {\r
+\r
+         // has to be part of document to have pageXY\r
+            if (el.parentNode === null || this.getStyle(el, 'display') == 'none') {\r
+               return false;\r
+            }\r
+\r
+            var parentNode = null;\r
+            var pos = [];\r
+            var box;\r
+\r
+            if (el.getBoundingClientRect) { // IE\r
+               box = el.getBoundingClientRect();\r
+               var doc = document;\r
+               if ( !this.inDocument(el) ) {// might be in a frame, need to get its scroll\r
+                  var doc = parent.document;\r
+                  while ( doc && !this.isAncestor(doc.documentElement, el) ) {\r
+                     doc = parent.document;\r
+                  }\r
+               }\r
+\r
+               var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);\r
+               var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);\r
+\r
+               return [box.left + scrollLeft, box.top + scrollTop];\r
+            }\r
+            else { // safari, opera, & gecko\r
+               pos = [el.offsetLeft, el.offsetTop];\r
+               parentNode = el.offsetParent;\r
+               if (parentNode != el) {\r
+                  while (parentNode) {\r
+                     pos[0] += parentNode.offsetLeft;\r
+                     pos[1] += parentNode.offsetTop;\r
+                     parentNode = parentNode.offsetParent;\r
+                  }\r
+               }\r
+               if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases\r
+                  pos[0] -= document.body.offsetLeft;\r
+                  pos[1] -= document.body.offsetTop;\r
+               }\r
+            }\r
+\r
+            if (el.parentNode) { parentNode = el.parentNode; }\r
+            else { parentNode = null; }\r
+\r
+            while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')\r
+            { // account for any scrolled ancestors\r
+               pos[0] -= parentNode.scrollLeft;\r
+               pos[1] -= parentNode.scrollTop;\r
+\r
+               if (parentNode.parentNode) { parentNode = parentNode.parentNode; }\r
+               else { parentNode = null; }\r
+            }\r
+\r
+\r
+            return pos;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @return {String/Array} The X position of the element(s)\r
+       */\r
+      getX: function(el) {\r
+         return util.Dom.getXY(el)[0];\r
+      },\r
+\r
+      /**\r
+       * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @return {String/Array} The Y position of the element(s)\r
+       */\r
+      getY: function(el) {\r
+         return util.Dom.getXY(el)[1];\r
+      },\r
+\r
+      /**\r
+       * Set the position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements\r
+       * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)\r
+       * @param {Boolean} noRetry By default we try and set the position a second time if the first fails\r
+       */\r
+      setXY: function(el, pos, noRetry) {\r
+         var f = function(el) {\r
+            var style_pos = this.getStyle(el, 'position');\r
+            if (style_pos == 'static') { // default to relative\r
+               this.setStyle(el, 'position', 'relative');\r
+               style_pos = 'relative';\r
+            }\r
+\r
+            var pageXY = this.getXY(el);\r
+            if (pageXY === false) { // has to be part of doc to have pageXY\r
+               return false;\r
+            }\r
+\r
+            var delta = [ // assuming pixels; if not we will have to retry\r
+               parseInt( this.getStyle(el, 'left'), 10 ),\r
+               parseInt( this.getStyle(el, 'top'), 10 )\r
+            ];\r
+\r
+            if ( isNaN(delta[0]) ) {// in case of 'auto'\r
+               delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;\r
+            }\r
+            if ( isNaN(delta[1]) ) { // in case of 'auto'\r
+               delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;\r
+            }\r
+\r
+            if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }\r
+            if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }\r
+\r
+            var newXY = this.getXY(el);\r
+\r
+            // if retry is true, try one more time if we miss\r
+            if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {\r
+               this.setXY(el, pos, true);\r
+            }\r
+\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Set the X position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {Int} x to use as the X coordinate for the element(s).\r
+       */\r
+      setX: function(el, x) {\r
+         util.Dom.setXY(el, [x, null]);\r
+      },\r
+\r
+      /**\r
+       * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.\r
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @param {Int} x to use as the Y coordinate for the element(s).\r
+       */\r
+      setY: function(el, y) {\r
+         util.Dom.setXY(el, [null, y]);\r
+      },\r
+\r
+      /**\r
+       * Returns the region position of the given element.\r
+       * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).\r
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.\r
+       * @return {Region/Array} A Region or array of Region instances containing "top, left, bottom, right" member data.\r
+       */\r
+      getRegion: function(el) {\r
+         var f = function(el) {\r
+            var region = new YAHOO.util.Region.getRegion(el);\r
+            return region;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Returns the width of the client (viewport).\r
+       * Now using getViewportWidth.  This interface left intact for back compat.\r
+       * @return {Int} The width of the viewable area of the page.\r
+       */\r
+      getClientWidth: function() {\r
+         return util.Dom.getViewportWidth();\r
+      },\r
+\r
+      /**\r
+       * Returns the height of the client (viewport).\r
+       * Now using getViewportHeight.  This interface left intact for back compat.\r
+       * @return {Int} The height of the viewable area of the page.\r
+       */\r
+      getClientHeight: function() {\r
+         return util.Dom.getViewportHeight();\r
+      },\r
+\r
+      /**\r
+       * Returns a array of HTMLElements with the given class\r
+       * For optimized performance, include a tag and/or root node if possible\r
+       * @param {String} className The class name to match against\r
+       * @param {String} tag (optional) The tag name of the elements being collected\r
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point\r
+       * @return {Array} An array of elements that have the given class name\r
+       */\r
+      getElementsByClassName: function(className, tag, root) {\r
+         var method = function(el) { return util.Dom.hasClass(el, className) };\r
+         return util.Dom.getElementsBy(method, tag, root);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement has the given className\r
+       * @param {String/HTMLElement/Array} el The element or collection to test\r
+       * @param {String} className the class name to search for\r
+       * @return {Boolean/Array} A boolean value or array of boolean values\r
+       */\r
+      hasClass: function(el, className) {\r
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');\r
+\r
+         var f = function(el) {\r
+            return re.test(el['className']);\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Adds a class name to a given element or collection of elements\r
+       * @param {String/HTMLElement/Array} el The element or collection to add the class to\r
+       * @param {String} className the class name to add to the class attribute\r
+       */\r
+      addClass: function(el, className) {\r
+         var f = function(el) {\r
+            if (this.hasClass(el, className)) { return; } // already present\r
+\r
+\r
+            el['className'] = [el['className'], className].join(' ');\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Removes a class name from a given element or collection of elements\r
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from\r
+       * @param {String} className the class name to remove from the class attribute\r
+       */\r
+      removeClass: function(el, className) {\r
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');\r
+\r
+         var f = function(el) {\r
+            if (!this.hasClass(el, className)) { return; } // not present\r
+\r
+\r
+            var c = el['className'];\r
+            el['className'] = c.replace(re, ' ');\r
+            if ( this.hasClass(el, className) ) { // in case of multiple adjacent\r
+               this.removeClass(el, className);\r
+            }\r
+\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Replace a class with another class for a given element or collection of elements.\r
+       * If no oldClassName is present, the newClassName is simply added.\r
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from\r
+       * @param {String} oldClassName the class name to be replaced\r
+       * @param {String} newClassName the class name that will be replacing the old class name\r
+       */\r
+      replaceClass: function(el, oldClassName, newClassName) {\r
+         var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');\r
+\r
+         var f = function(el) {\r
+\r
+            el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');\r
+\r
+            if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent\r
+               this.replaceClass(el, oldClassName, newClassName);\r
+            }\r
+         };\r
+\r
+         util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Generates a unique ID\r
+       * @param {String/HTMLElement/Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present)\r
+       * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen")\r
+       * @return {String/Array} The generated ID, or array of generated IDs (or original ID if already present on an element)\r
+       */\r
+      generateId: function(el, prefix) {\r
+         prefix = prefix || 'yui-gen';\r
+         el = el || {};\r
+\r
+         var f = function(el) {\r
+            if (el) {\r
+               el = util.Dom.get(el);\r
+            } else {\r
+               el = {}; // just generating ID in this case\r
+            }\r
+\r
+            if (!el.id) {\r
+               el.id = prefix + id_counter++;\r
+            } // dont override existing\r
+\r
+\r
+            return el.id;\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy\r
+       * @param {String/HTMLElement} haystack The possible ancestor\r
+       * @param {String/HTMLElement} needle The possible descendent\r
+       * @return {Boolean} Whether or not the haystack is an ancestor of needle\r
+       */\r
+      isAncestor: function(haystack, needle) {\r
+         haystack = util.Dom.get(haystack);\r
+         if (!haystack || !needle) { return false; }\r
+\r
+         var f = function(needle) {\r
+            if (haystack.contains && !isSafari) { // safari "contains" is broken\r
+               return haystack.contains(needle);\r
+            }\r
+            else if ( haystack.compareDocumentPosition ) {\r
+               return !!(haystack.compareDocumentPosition(needle) & 16);\r
+            }\r
+            else { // loop up and test each parent\r
+               var parent = needle.parentNode;\r
+\r
+               while (parent) {\r
+                  if (parent == haystack) {\r
+                     return true;\r
+                  }\r
+                  else if (parent.tagName.toUpperCase() == 'HTML') {\r
+                     return false;\r
+                  }\r
+\r
+                  parent = parent.parentNode;\r
+               }\r
+               return false;\r
+            }\r
+         };\r
+\r
+         return util.Dom.batch(needle, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Determines whether an HTMLElement is present in the current document\r
+       * @param {String/HTMLElement} el The element to search for\r
+       * @return {Boolean} Whether or not the element is present in the current document\r
+       */\r
+      inDocument: function(el) {\r
+         var f = function(el) {\r
+            return this.isAncestor(document.documentElement, el);\r
+         };\r
+\r
+         return util.Dom.batch(el, f, util.Dom, true);\r
+      },\r
+\r
+      /**\r
+       * Returns a array of HTMLElements that pass the test applied by supplied boolean method\r
+       * For optimized performance, include a tag and/or root node if possible\r
+       * @param {Function} method A boolean method to test elements with\r
+       * @param {String} tag (optional) The tag name of the elements being collected\r
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point\r
+       */\r
+      getElementsBy: function(method, tag, root) {\r
+         tag = tag || '*';\r
+         root = util.Dom.get(root) || document;\r
+\r
+         var nodes = [];\r
+         var elements = root.getElementsByTagName(tag);\r
+\r
+         if ( !elements.length && (tag == '*' && root.all) ) {\r
+            elements = root.all; // IE < 6\r
+         }\r
+\r
+         for (var i = 0, len = elements.length; i < len; ++i)\r
+         {\r
+            if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }\r
+         }\r
+\r
+\r
+         return nodes;\r
+      },\r
+\r
+      /**\r
+       * Returns an array of elements that have had the supplied method applied.\r
+       * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) )\r
+       * @param {String/HTMLElement/Array} el (optional) An element or array of elements to apply the method to\r
+       * @param {Function} method The method to apply to the element(s)\r
+       * @param {Generic} (optional) o An optional arg that is passed to the supplied method\r
+       * @param {Boolean} (optional) override Whether or not to override the scope of "method" with "o"\r
+       * @return {HTMLElement/Array} The element(s) with the method applied\r
+       */\r
+      batch: function(el, method, o, override) {\r
+         var id = el;\r
+         el = util.Dom.get(el);\r
+\r
+         var scope = (override) ? o : window;\r
+\r
+         if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)\r
+            if (!el) {\r
+               return false;\r
+            }\r
+            return method.call(scope, el, o);\r
+         }\r
+\r
+         var collection = [];\r
+\r
+         for (var i = 0, len = el.length; i < len; ++i) {\r
+            if (!el[i]) {\r
+               id = id[i];\r
+            }\r
+            collection[collection.length] = method.call(scope, el[i], o);\r
+         }\r
+\r
+         return collection;\r
+      },\r
+\r
+      /**\r
+       * Returns the height of the document.\r
+       * @return {Int} The height of the actual document (which includes the body and its margin).\r
+       */\r
+      getDocumentHeight: function() {\r
+         var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;\r
+         var marginTop = parseInt(util.Dom.getStyle(document.body, 'marginTop'), 10);\r
+         var marginBottom = parseInt(util.Dom.getStyle(document.body, 'marginBottom'), 10);\r
+\r
+         var mode = document.compatMode;\r
+\r
+         if ( (mode || isIE) && !isOpera ) { // (IE, Gecko)\r
+            switch (mode) {\r
+               case 'CSS1Compat': // Standards mode\r
+                  scrollHeight = ((window.innerHeight && window.scrollMaxY) ?  window.innerHeight+window.scrollMaxY : -1);\r
+                  windowHeight = [document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a, b){return(a-b);})[1];\r
+                  bodyHeight = document.body.offsetHeight + marginTop + marginBottom;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  scrollHeight = document.body.scrollHeight;\r
+                  bodyHeight = document.body.clientHeight;\r
+            }\r
+         } else { // Safari & Opera\r
+            scrollHeight = document.documentElement.scrollHeight;\r
+            windowHeight = self.innerHeight;\r
+            bodyHeight = document.documentElement.clientHeight;\r
+         }\r
+\r
+         var h = [scrollHeight,windowHeight,bodyHeight].sort(function(a, b){return(a-b);});\r
+         return h[2];\r
+      },\r
+\r
+      /**\r
+       * Returns the width of the document.\r
+       * @return {Int} The width of the actual document (which includes the body and its margin).\r
+       */\r
+      getDocumentWidth: function() {\r
+         var docWidth=-1,bodyWidth=-1,winWidth=-1;\r
+         var marginRight = parseInt(util.Dom.getStyle(document.body, 'marginRight'), 10);\r
+         var marginLeft = parseInt(util.Dom.getStyle(document.body, 'marginLeft'), 10);\r
+\r
+         var mode = document.compatMode;\r
+\r
+         if (mode || isIE) { // (IE, Gecko, Opera)\r
+            switch (mode) {\r
+               case 'CSS1Compat': // Standards mode\r
+                  docWidth = document.documentElement.clientWidth;\r
+                  bodyWidth = document.body.offsetWidth + marginLeft + marginRight;\r
+                  winWidth = self.innerWidth || -1;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  bodyWidth = document.body.clientWidth;\r
+                  winWidth = document.body.scrollWidth;\r
+                  break;\r
+            }\r
+         } else { // Safari\r
+            docWidth = document.documentElement.clientWidth;\r
+            bodyWidth = document.body.offsetWidth + marginLeft + marginRight;\r
+            winWidth = self.innerWidth;\r
+         }\r
+\r
+         var w = [docWidth,bodyWidth,winWidth].sort(function(a, b){return(a-b);});\r
+         return w[2];\r
+      },\r
+\r
+      /**\r
+       * Returns the current height of the viewport.\r
+       * @return {Int} The height of the viewable area of the page (excludes scrollbars).\r
+       */\r
+      getViewportHeight: function() {\r
+         var height = -1;\r
+         var mode = document.compatMode;\r
+\r
+         if ( (mode || isIE) && !isOpera ) {\r
+            switch (mode) { // (IE, Gecko)\r
+               case 'CSS1Compat': // Standards mode\r
+                  height = document.documentElement.clientHeight;\r
+                  break;\r
+\r
+               default: // Quirks\r
+                  height = document.body.clientHeight;\r
+            }\r
+         } else { // Safari, Opera\r
+            height = self.innerHeight;\r
+         }\r
+\r
+         return height;\r
+      },\r
+\r
+      /**\r
+       * Returns the current width of the viewport.\r
+       * @return {Int} The width of the viewable area of the page (excludes scrollbars).\r
+       */\r
+\r
+      getViewportWidth: function() {\r
+         var width = -1;\r
+         var mode = document.compatMode;\r
+\r
+         if (mode || isIE) { // (IE, Gecko, Opera)\r
+            switch (mode) {\r
+            case 'CSS1Compat': // Standards mode\r
+               width = document.documentElement.clientWidth;\r
+               break;\r
+\r
+            default: // Quirks\r
+               width = document.body.clientWidth;\r
+            }\r
+         } else { // Safari\r
+            width = self.innerWidth;\r
+         }\r
+         return width;\r
+      }\r
+   };\r
+}();\r
+\r
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+*/\r
+\r
+/**\r
+ * @class A region is a representation of an object on a grid.  It is defined\r
+ * by the top, right, bottom, left extents, so is rectangular by default.  If\r
+ * other shapes are required, this class could be extended to support it.\r
+ *\r
+ * @param {int} t the top extent\r
+ * @param {int} r the right extent\r
+ * @param {int} b the bottom extent\r
+ * @param {int} l the left extent\r
+ * @constructor\r
+ */\r
+YAHOO.util.Region = function(t, r, b, l) {\r
+\r
+    /**\r
+     * The region's top extent\r
+     * @type int\r
+     */\r
+    this.top = t;\r
+\r
+    /**\r
+     * The region's top extent as index, for symmetry with set/getXY\r
+     * @type int\r
+     */\r
+    this[1] = t;\r
+\r
+    /**\r
+     * The region's right extent\r
+     * @type int\r
+     */\r
+    this.right = r;\r
+\r
+    /**\r
+     * The region's bottom extent\r
+     * @type int\r
+     */\r
+    this.bottom = b;\r
+\r
+    /**\r
+     * The region's left extent\r
+     * @type int\r
+     */\r
+    this.left = l;\r
+\r
+    /**\r
+     * The region's left extent as index, for symmetry with set/getXY\r
+     * @type int\r
+     */\r
+    this[0] = l;\r
+};\r
+\r
+/**\r
+ * Returns true if this region contains the region passed in\r
+ *\r
+ * @param  {Region}  region The region to evaluate\r
+ * @return {boolean}        True if the region is contained with this region,\r
+ *                          else false\r
+ */\r
+YAHOO.util.Region.prototype.contains = function(region) {\r
+    return ( region.left   >= this.left   &&\r
+             region.right  <= this.right  &&\r
+             region.top    >= this.top    &&\r
+             region.bottom <= this.bottom    );\r
+\r
+};\r
+\r
+/**\r
+ * Returns the area of the region\r
+ *\r
+ * @return {int} the region's area\r
+ */\r
+YAHOO.util.Region.prototype.getArea = function() {\r
+    return ( (this.bottom - this.top) * (this.right - this.left) );\r
+};\r
+\r
+/**\r
+ * Returns the region where the passed in region overlaps with this one\r
+ *\r
+ * @param  {Region} region The region that intersects\r
+ * @return {Region}        The overlap region, or null if there is no overlap\r
+ */\r
+YAHOO.util.Region.prototype.intersect = function(region) {\r
+    var t = Math.max( this.top,    region.top    );\r
+    var r = Math.min( this.right,  region.right  );\r
+    var b = Math.min( this.bottom, region.bottom );\r
+    var l = Math.max( this.left,   region.left   );\r
+\r
+    if (b >= t && r >= l) {\r
+        return new YAHOO.util.Region(t, r, b, l);\r
+    } else {\r
+        return null;\r
+    }\r
+};\r
+\r
+/**\r
+ * Returns the region representing the smallest region that can contain both\r
+ * the passed in region and this region.\r
+ *\r
+ * @param  {Region} region The region that to create the union with\r
+ * @return {Region}        The union region\r
+ */\r
+YAHOO.util.Region.prototype.union = function(region) {\r
+    var t = Math.min( this.top,    region.top    );\r
+    var r = Math.max( this.right,  region.right  );\r
+    var b = Math.max( this.bottom, region.bottom );\r
+    var l = Math.min( this.left,   region.left   );\r
+\r
+    return new YAHOO.util.Region(t, r, b, l);\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return string the region properties\r
+ */\r
+YAHOO.util.Region.prototype.toString = function() {\r
+    return ( "Region {"    +\r
+             "top: "       + this.top    +\r
+             ", right: "   + this.right  +\r
+             ", bottom: "  + this.bottom +\r
+             ", left: "    + this.left   +\r
+             "}" );\r
+};\r
+\r
+/**\r
+ * Returns a region that is occupied by the DOM element\r
+ *\r
+ * @param  {HTMLElement} el The element\r
+ * @return {Region}         The region that the element occupies\r
+ * @static\r
+ */\r
+YAHOO.util.Region.getRegion = function(el) {\r
+    var p = YAHOO.util.Dom.getXY(el);\r
+\r
+    var t = p[1];\r
+    var r = p[0] + el.offsetWidth;\r
+    var b = p[1] + el.offsetHeight;\r
+    var l = p[0];\r
+\r
+    return new YAHOO.util.Region(t, r, b, l);\r
+};\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+/**\r
+ * @class\r
+ *\r
+ * A point is a region that is special in that it represents a single point on\r
+ * the grid.\r
+ *\r
+ * @param {int} x The X position of the point\r
+ * @param {int} y The Y position of the point\r
+ * @constructor\r
+ * @extends Region\r
+ */\r
+YAHOO.util.Point = function(x, y) {\r
+   if (x instanceof Array) { // accept output from Dom.getXY\r
+      y = x[1];\r
+      x = x[0];\r
+   }\r
+\r
+    /**\r
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)\r
+     * @type int\r
+     */\r
+\r
+    this.x = this.right = this.left = this[0] = x;\r
+\r
+    /**\r
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)\r
+     * @type int\r
+     */\r
+    this.y = this.top = this.bottom = this[1] = y;\r
+};\r
+\r
+YAHOO.util.Point.prototype = new YAHOO.util.Region();\r
+\r
diff --git a/lib/yui/dragdrop/README b/lib/yui/dragdrop/README
new file mode 100755 (executable)
index 0000000..af7a2d6
--- /dev/null
@@ -0,0 +1,48 @@
+Drag and Drop Release Notes\r
+\r
+0.11.0\r
+\r
+   * The Dom.util.setXY calculation for the initial placement of the dragged\r
+     element is cached during the drag, enhancing the drag performance.\r
+\r
+   * DDProxy no longer enforces having a single proxy element for all instances.\r
+     dragElId can be set in the config object in the constructor.  If the\r
+     element already exists it will use that element, otherwise a new one will\r
+     be created with that id.\r
+\r
+   * DDProxy->borderWidth has been removed. The value is calculated on the fly\r
+     instead.\r
+\r
+   * Added DragDrop->clearTicks and DragDrop->clearConstraints\r
+\r
+   * All drag and drop constructors now have an additional, optional parameter\r
+     call "config".  It is an object that can contain properties for a\r
+     number of configuration settings.\r
+\r
+   * Drag and drop will not be disabled for elements that cannot have their\r
+     location determined.\r
+\r
+   * isLegalTarget won't return dd objects that are not targetable.\r
+\r
+   * Added DragDrop->removeFromGroup.\r
+\r
+   * Constraints are now applied properly when determining which drag and drop\r
+     events should fire.\r
+\r
+\r
+0.10.0\r
+\r
+   * Improved the performance in intersect mode\r
+\r
+   * It was possible for the drag and drop initialization to be skipped\r
+     for very slow loading pages.  This was fixed.\r
+\r
+   * New methods to exclude regions within your drag and drop element: \r
+     addInvalidHandleId(), addInvalidHandleClass()\r
+\r
+   * Added an onAvailable handler that is executed after the initial state is set.\r
+\r
+   * Drag and drop is more forgiving when the implementer attempts to create the\r
+     instance prior to the element being in the document, but after the window\r
+     load event has fired.\r
+\r
diff --git a/lib/yui/dragdrop/dragdrop-debug.js b/lib/yui/dragdrop/dragdrop-debug.js
new file mode 100755 (executable)
index 0000000..ce4013e
--- /dev/null
@@ -0,0 +1,2820 @@
+\r
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * Defines the interface and base operation of items that that can be \r
+ * dragged or can be drop targets.  It was designed to be extended, overriding\r
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.\r
+ * Up to three html elements can be associated with a DragDrop instance:\r
+ * <ul>\r
+ * <li>linked element: the element that is passed into the constructor.\r
+ * This is the element which defines the boundaries for interaction with \r
+ * other DragDrop objects.</li>\r
+ * <li>handle element(s): The drag operation only occurs if the element that \r
+ * was clicked matches a handle element.  By default this is the linked \r
+ * element, but there are times that you will want only a portion of the \r
+ * linked element to initiate the drag operation, and the setHandleElId() \r
+ * method provides a way to define this.</li>\r
+ * <li>drag element: this represents an the element that would be moved along\r
+ * with the cursor during a drag operation.  By default, this is the linked\r
+ * element itself as in {@link YAHOO.util.DD}.  setDragElId() lets you define\r
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}\r
+ * </li>\r
+ * </ul>\r
+ * This class should not be instantiated until the onload event to ensure that\r
+ * the associated elements are available.\r
+ * The following would define a DragDrop obj that would interact with any \r
+ * other * DragDrop obj in the "group1" group:\r
+ * <pre>\r
+ *  dd = new YAHOO.util.DragDrop("div1", "group1");\r
+ * </pre>\r
+ * Since none of the event handlers have been implemented, nothing would \r
+ * actually happen if you were to run the code above.  Normally you would \r
+ * override this class or one of the default implementations, but you can \r
+ * also override the methods you want on an instance of the class...\r
+ * <pre>\r
+ *  dd.onDragDrop = function(e, id) {\r
+ *   alert("dd was dropped on " + id);\r
+ *  }\r
+ * </pre>\r
+ * @constructor\r
+ * @param {String} id of the element that is linked to this instance\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DragDrop: \r
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly\r
+ */\r
+YAHOO.util.DragDrop = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config); \r
+    }\r
+};\r
+\r
+YAHOO.util.DragDrop.prototype = {\r
+\r
+    /**\r
+     * The id of the element associated with this object.  This is what we \r
+     * refer to as the "linked element" because the size and position of \r
+     * this element is used to determine when the drag and drop objects have \r
+     * interacted.\r
+     *\r
+     * @type String\r
+     */\r
+    id: null,\r
+\r
+    /**\r
+     * Configuration attributes passed into the constructor\r
+     * @type object\r
+     */\r
+    config: null,\r
+\r
+    /**\r
+     * The id of the element that will be dragged.  By default this is same \r
+     * as the linked element , but could be changed to another element. Ex: \r
+     * YAHOO.util.DDProxy\r
+     *\r
+     * @type String\r
+     * @private\r
+     */\r
+    dragElId: null, \r
+\r
+    /**\r
+     * the id of the element that initiates the drag operation.  By default \r
+     * this is the linked element, but could be changed to be a child of this\r
+     * element.  This lets us do things like only starting the drag when the \r
+     * header element within the linked html element is clicked.\r
+     *\r
+     * @type String\r
+     * @private\r
+     */\r
+    handleElId: null, \r
+\r
+    /**\r
+     * An associative array of HTML tags that will be ignored if clicked.\r
+     * @type {string: string}\r
+     */\r
+    invalidHandleTypes: null, \r
+\r
+    /**\r
+     * An associative array of ids for elements that will be ignored if clicked\r
+     * @type {string: string}\r
+     */\r
+    invalidHandleIds: null, \r
+\r
+    /**\r
+     * An indexted array of css class names for elements that will be ignored\r
+     * if clicked.\r
+     * @type string[]\r
+     */\r
+    invalidHandleClasses: null, \r
+\r
+    /**\r
+     * The linked element's absolute X position at the time the drag was \r
+     * started\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    startPageX: 0,\r
+\r
+    /**\r
+     * The linked element's absolute X position at the time the drag was \r
+     * started\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    startPageY: 0,\r
+\r
+    /**\r
+     * The group defines a logical collection of DragDrop objects that are \r
+     * related.  Instances only get events when interacting with other \r
+     * DragDrop object in the same group.  This lets us define multiple \r
+     * groups using a single DragDrop subclass if we want.\r
+     * @type {string: string}\r
+     */\r
+    groups: null,\r
+\r
+    /**\r
+     * Individual drag/drop instances can be locked.  This will prevent \r
+     * onmousedown start drag.\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    locked: false,\r
+\r
+    /**\r
+     * Lock this instance\r
+     */\r
+    lock: function() { this.locked = true; },\r
+\r
+    /**\r
+     * Unlock this instace\r
+     */\r
+    unlock: function() { this.locked = false; },\r
+\r
+    /**\r
+     * By default, all insances can be a drop target.  This can be disabled by\r
+     * setting isTarget to false.\r
+     *\r
+     * @type boolean\r
+     */\r
+    isTarget: true,\r
+\r
+    /**\r
+     * The padding configured for this drag and drop object for calculating\r
+     * the drop zone intersection with this object.\r
+     * @type int[]\r
+     */\r
+    padding: null,\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    _domRef: null,\r
+\r
+    /**\r
+     * Internal typeof flag\r
+     * @private\r
+     */\r
+    __ygDragDrop: true,\r
+\r
+    /**\r
+     * Set to true when horizontal contraints are applied\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    constrainX: false,\r
+\r
+    /**\r
+     * Set to true when vertical contraints are applied\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    constrainY: false,\r
+\r
+    /**\r
+     * The left constraint\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    minX: 0,\r
+\r
+    /**\r
+     * The right constraint\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    maxX: 0,\r
+\r
+    /**\r
+     * The up constraint \r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    minY: 0,\r
+\r
+    /**\r
+     * The down constraint \r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    maxY: 0,\r
+\r
+    /**\r
+     * Maintain offsets when we resetconstraints.  Used to maintain the \r
+     * slider thumb value, and this needs to be fixed.\r
+     * @type boolean\r
+     */\r
+    maintainOffset: false,\r
+\r
+    /**\r
+     * Array of pixel locations the element will snap to if we specified a \r
+     * horizontal graduation/interval.  This array is generated automatically\r
+     * when you define a tick interval.\r
+     * @type int[]\r
+     */\r
+    xTicks: null,\r
+\r
+    /**\r
+     * Array of pixel locations the element will snap to if we specified a \r
+     * vertical graduation/interval.  This array is generated automatically \r
+     * when you define a tick interval.\r
+     * @type int[]\r
+     */\r
+    yTicks: null,\r
+\r
+    /**\r
+     * By default the drag and drop instance will only respond to the primary\r
+     * button click (left button for a right-handed mouse).  Set to true to\r
+     * allow drag and drop to start with any mouse click that is propogated\r
+     * by the browser\r
+     * @type boolean\r
+     */\r
+    primaryButtonOnly: true,\r
+\r
+    /**\r
+     * The availabe property is false until the linked dom element is accessible.\r
+     * @type boolean\r
+     */\r
+    available: false,\r
+\r
+    /**\r
+     * Code that executes immediately before the startDrag event\r
+     * @private\r
+     */\r
+    b4StartDrag: function(x, y) { },\r
+\r
+    /**\r
+     * Abstract method called after a drag/drop object is clicked\r
+     * and the drag or mousedown time thresholds have beeen met.\r
+     *\r
+     * @param {int} X click location\r
+     * @param {int} Y click location\r
+     */\r
+    startDrag: function(x, y) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDrag event\r
+     * @private\r
+     */\r
+    b4Drag: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called during the onMouseMove event while dragging an \r
+     * object.\r
+     *\r
+     * @param {Event} e\r
+     */\r
+    onDrag: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragEnter event\r
+     * @private\r
+     */\r
+    // b4DragEnter: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this element fist begins hovering over \r
+     * another DragDrop obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this is hovering over.  In INTERSECT mode, an array of one or more \r
+     * dragdrop items being hovered over.\r
+     */\r
+    onDragEnter: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragOver event\r
+     * @private\r
+     */\r
+    b4DragOver: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this element is hovering over another \r
+     * DragDrop obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this is hovering over.  In INTERSECT mode, an array of dd items \r
+     * being hovered over.\r
+     */\r
+    onDragOver: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragOut event\r
+     * @private\r
+     */\r
+    b4DragOut: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when we are no longer hovering over an element\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this was hovering over.  In INTERSECT mode, an array of dd items \r
+     * that the mouse is no longer over.\r
+     */\r
+    onDragOut: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragDrop event\r
+     * @private\r
+     */\r
+    b4DragDrop: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this item is dropped on another DragDrop \r
+     * obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this \r
+     * was dropped on.\r
+     */\r
+    onDragDrop: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the endDrag event\r
+     * @private\r
+     */\r
+    b4EndDrag: function(e) { },\r
+\r
+    /**\r
+     * Fired when we are done dragging the object\r
+     *\r
+     * @param {Event} e\r
+     */\r
+    endDrag: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Code executed immediately before the onMouseDown event\r
+\r
+     * @param {Event} e\r
+     * @private\r
+     */\r
+    b4MouseDown: function(e) {  },\r
+\r
+    /**\r
+     * Event handler that fires when a drag/drop obj gets a mousedown\r
+     * @param {Event} e\r
+     */\r
+    onMouseDown: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Event handler that fires when a drag/drop obj gets a mouseup\r
+     * @param {Event} e\r
+     */\r
+    onMouseUp: function(e) { /* override this */ },\r
+   \r
+    /**\r
+     * Override the onAvailable method to do what is needed after the initial\r
+     * position was determined.\r
+     */\r
+    onAvailable: function () { \r
+        this.logger.log("onAvailable (base)"); \r
+    },\r
+\r
+    /**\r
+     * Returns a reference to the linked element\r
+     *\r
+     * @return {HTMLElement} the html element \r
+     */\r
+    getEl: function() { \r
+        if (!this._domRef) {\r
+            this._domRef = YAHOO.util.Dom.get(this.id); \r
+        }\r
+\r
+        return this._domRef;\r
+    },\r
+\r
+    /**\r
+     * Returns a reference to the actual element to drag.  By default this is\r
+     * the same as the html element, but it can be assigned to another \r
+     * element. An example of this can be found in YAHOO.util.DDProxy\r
+     *\r
+     * @return {HTMLElement} the html element \r
+     */\r
+    getDragEl: function() {\r
+        return YAHOO.util.Dom.get(this.dragElId);\r
+    },\r
+\r
+    /**\r
+     * Sets up the DragDrop object.  Must be called in the constructor of any\r
+     * YAHOO.util.DragDrop subclass\r
+     *\r
+     * @param id the id of the linked element\r
+     * @param {String} sGroup the group of related items\r
+     * @param {object} config configuration attributes\r
+     */\r
+    init: function(id, sGroup, config) {\r
+        this.initTarget(id, sGroup, config);\r
+        YAHOO.util.Event.addListener(this.id, "mousedown", \r
+                                          this.handleMouseDown, this, true);\r
+    },\r
+\r
+    /**\r
+     * Initializes Targeting functionality only... the object does not\r
+     * get a mousedown handler.\r
+     *\r
+     * @param id the id of the linked element\r
+     * @param {String} sGroup the group of related items\r
+     * @param {object} config configuration attributes\r
+     */\r
+    initTarget: function(id, sGroup, config) {\r
+\r
+        // configuration attributes \r
+        this.config = config || {};\r
+\r
+        // create a local reference to the drag and drop manager\r
+        this.DDM = YAHOO.util.DDM;\r
+        // initialize the groups array\r
+        this.groups = {};\r
+\r
+        // set the id\r
+        this.id = id;\r
+\r
+        // add to an interaction group\r
+        this.addToGroup((sGroup) ? sGroup : "default");\r
+\r
+        // We don't want to register this as the handle with the manager\r
+        // so we just set the id rather than calling the setter.\r
+        this.handleElId = id;\r
+\r
+        YAHOO.util.Event.onAvailable(id, this.handleOnAvailable, this, true);\r
+\r
+        // create a logger instance\r
+        this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+        // the linked element is the element that gets dragged by default\r
+        this.setDragElId(id); \r
+\r
+        // by default, clicked anchors will not start drag operations. \r
+        // @TODO what else should be here?  Probably form fields.\r
+        this.invalidHandleTypes = { A: "A" };\r
+        this.invalidHandleIds = {};\r
+        this.invalidHandleClasses = [];\r
+\r
+        this.applyConfig();\r
+    },\r
+\r
+    /**\r
+     * Applies the configuration parameters that were passed into the constructor.\r
+     * This is supposed to happen at each level through the inheritance chain.  So\r
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and \r
+     * DragDrop in order to get all of the parameters that are available in\r
+     * each object.\r
+     */\r
+    applyConfig: function() {\r
+\r
+        // configurable properties: \r
+        //    padding, isTarget, maintainOffset, primaryButtonOnly\r
+        this.padding           = this.config.padding || [0, 0, 0, 0];\r
+        this.isTarget          = (this.config.isTarget !== false);\r
+        this.maintainOffset    = (this.config.maintainOffset);\r
+        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);\r
+\r
+    },\r
+\r
+    /**\r
+     * Executed when the linked element is available\r
+     * @private\r
+     */\r
+    handleOnAvailable: function() {\r
+        this.logger.log("handleOnAvailable");\r
+        this.available = true;\r
+        this.resetConstraints();\r
+        this.onAvailable();\r
+    },\r
+\r
+     /**\r
+     * Configures the padding for the target zone in px.  Effectively expands\r
+     * (or reduces) the virtual object size for targeting calculations.  \r
+     * Supports css-style shorthand; if only one parameter is passed, all sides\r
+     * will have that padding, and if only two are passed, the top and bottom\r
+     * will have the first param, the left and right the second.\r
+     * @param {int} iTop    Top pad\r
+     * @param {int} iRight  Right pad\r
+     * @param {int} iBot    Bot pad\r
+     * @param {int} iLeft   Left pad\r
+     */\r
+    setPadding: function(iTop, iRight, iBot, iLeft) {\r
+        // this.padding = [iLeft, iRight, iTop, iBot];\r
+        if (!iRight && 0 !== iRight) {\r
+            this.padding = [iTop, iTop, iTop, iTop];\r
+        } else if (!iBot && 0 !== iBot) {\r
+            this.padding = [iTop, iRight, iTop, iRight];\r
+        } else {\r
+            this.padding = [iTop, iRight, iBot, iLeft];\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Stores the initial placement of the dd element\r
+     */\r
+    setInitPosition: function(diffX, diffY) {\r
+        var el = this.getEl();\r
+\r
+        if (!this.DDM.verifyEl(el)) {\r
+            this.logger.log(this.id + " element is broken");\r
+            return;\r
+        }\r
+\r
+        var dx = diffX || 0;\r
+        var dy = diffY || 0;\r
+\r
+        var p = YAHOO.util.Dom.getXY( el );\r
+\r
+        this.initPageX = p[0] - dx;\r
+        this.initPageY = p[1] - dy;\r
+\r
+        this.lastPageX = p[0];\r
+        this.lastPageY = p[1];\r
+\r
+        this.logger.log(this.id + " inital position: " + this.initPageX + \r
+                ", " + this.initPageY);\r
+\r
+        this.deltaSetXY = null;\r
+\r
+        this.setStartPosition(p);\r
+    },\r
+\r
+    /**\r
+     * Sets the start position of the element.  This is set when the obj\r
+     * is initialized, the reset when a drag is started.\r
+     * @param pos current position (from previous lookup)\r
+     * @private\r
+     */\r
+    setStartPosition: function(pos) {\r
+        var p = pos || YAHOO.util.Dom.getXY( this.getEl() );\r
+\r
+        this.startPageX = p[0];\r
+        this.startPageY = p[1];\r
+    },\r
+\r
+    /**\r
+     * Add this instance to a group of related drag/drop objects.  All \r
+     * instances belong to at least one group, and can belong to as many \r
+     * groups as needed.\r
+     *\r
+     * @param sGroup {string} the name of the group\r
+     */\r
+    addToGroup: function(sGroup) {\r
+        this.groups[sGroup] = true;\r
+        this.DDM.regDragDrop(this, sGroup);\r
+    },\r
+\r
+    /**\r
+     * Remove's this instance from the supplied interaction group\r
+     * @param {string}  sGroup  The group to drop\r
+     */\r
+    removeFromGroup: function(sGroup) {\r
+        this.logger.log("Removing from group: " + sGroup);\r
+        if (this.groups[sGroup]) {\r
+            delete this.groups[sGroup];\r
+        }\r
+\r
+        this.DDM.removeDDFromGroup(this, sGroup);\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify that an element other than the linked element \r
+     * will be moved with the cursor during a drag\r
+     *\r
+     * @param id the id of the element that will be used to initiate the drag\r
+     */\r
+    setDragElId: function(id) {\r
+        this.dragElId = id;\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify a child of the linked element that should be \r
+     * used to initiate the drag operation.  An example of this would be if \r
+     * you have a content div with text and links.  Clicking anywhere in the \r
+     * content area would normally start the drag operation.  Use this method\r
+     * to specify that an element inside of the content div is the element \r
+     * that starts the drag operation.\r
+     *\r
+     * @param id the id of the element that will be used to initiate the drag\r
+     */\r
+    setHandleElId: function(id) {\r
+        this.handleElId = id;\r
+        this.DDM.regHandle(this.id, id);\r
+    },\r
+\r
+    /**\r
+     * Allows you to set an element outside of the linked element as a drag \r
+     * handle\r
+     */\r
+    setOuterHandleElId: function(id) {\r
+        this.logger.log("Adding outer handle event: " + id);\r
+        YAHOO.util.Event.addListener(id, "mousedown", \r
+                this.handleMouseDown, this, true);\r
+        this.setHandleElId(id);\r
+    },\r
+\r
+    /**\r
+     * Remove all drag and drop hooks for this element\r
+     */\r
+    unreg: function() {\r
+        this.logger.log("DragDrop obj cleanup " + this.id);\r
+        YAHOO.util.Event.removeListener(this.id, "mousedown", \r
+                this.handleMouseDown);\r
+        this._domRef = null;\r
+        this.DDM._remove(this);\r
+    },\r
+\r
+    /**\r
+     * Returns true if this instance is locked, or the drag drop mgr is locked\r
+     * (meaning that all drag/drop is disabled on the page.)\r
+     *\r
+     * @return {boolean} true if this obj or all drag/drop is locked, else \r
+     * false\r
+     */\r
+    isLocked: function() {\r
+        return (this.DDM.isLocked() || this.locked);\r
+    },\r
+\r
+    /**\r
+     * Fired when this object is clicked\r
+     *\r
+     * @param {Event} e \r
+     * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)\r
+     * @private\r
+     */\r
+    handleMouseDown: function(e, oDD) {\r
+\r
+        this.logger.log("isLocked: " + this.isLocked());\r
+\r
+        var EU = YAHOO.util.Event;\r
+\r
+        var button = e.which || e.button;\r
+        this.logger.log("button: " + button);\r
+\r
+        if (this.primaryButtonOnly && button > 1) {\r
+            this.logger.log("Mousedown was not produced by the primary button");\r
+            return;\r
+        }\r
+\r
+        if (this.isLocked()) {\r
+            this.logger.log("Drag and drop is disabled, aborting");\r
+            return;\r
+        }\r
+\r
+        this.logger.log("mousedown " + this.id);\r
+        this.DDM.refreshCache(this.groups);\r
+        // var self = this;\r
+        // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);\r
+\r
+        // Only process the event if we really clicked within the linked \r
+        // element.  The reason we make this check is that in the case that \r
+        // another element was moved between the clicked element and the \r
+        // cursor in the time between the mousedown and mouseup events. When \r
+        // this happens, the element gets the next mousedown event \r
+        // regardless of where on the screen it happened.  \r
+        var pt = new YAHOO.util.Point(EU.getPageX(e), EU.getPageY(e));\r
+        if ( this.DDM.isOverTarget(pt, this) )  {\r
+\r
+            this.logger.log("click is over target");\r
+\r
+            //  check to see if the handle was clicked\r
+            var srcEl = EU.getTarget(e);\r
+\r
+            if (this.isValidHandleChild(srcEl) &&\r
+                    (this.id == this.handleElId || \r
+                     this.DDM.handleWasClicked(srcEl, this.id)) ) {\r
+\r
+                this.logger.log("click was a valid handle");\r
+\r
+                // set the initial element position\r
+                this.setStartPosition();\r
+\r
+                this.logger.log("firing onMouseDown events");\r
+\r
+\r
+                this.b4MouseDown(e);\r
+                this.onMouseDown(e);\r
+                this.DDM.handleMouseDown(e, this);\r
+\r
+                this.DDM.stopEvent(e);\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify a tag name that should not start a drag operation\r
+     * when clicked.  This is designed to facilitate embedding links within a\r
+     * drag handle that do something other than start the drag.\r
+     * \r
+     * @param {string} tagName the type of element to exclude\r
+     */\r
+    addInvalidHandleType: function(tagName) {\r
+        var type = tagName.toUpperCase();\r
+        this.invalidHandleTypes[type] = type;\r
+    },\r
+\r
+    /**\r
+     * Lets you to specify an element id for a child of a drag handle\r
+     * that should not initiate a drag\r
+     * @param {string} id the element id of the element you wish to ignore\r
+     */\r
+    addInvalidHandleId: function(id) {\r
+        this.invalidHandleIds[id] = id;\r
+    },\r
+\r
+\r
+    /**\r
+     * Lets you specify a css class of elements that will not initiate a drag\r
+     * @param {string} cssClass the class of the elements you wish to ignore\r
+     */\r
+    addInvalidHandleClass: function(cssClass) {\r
+        this.invalidHandleClasses.push(cssClass);\r
+    },\r
+\r
+    /**\r
+     * Unsets an excluded tag name set by addInvalidHandleType\r
+     * \r
+     * @param {string} tagName the type of element to unexclude\r
+     */\r
+    removeInvalidHandleType: function(tagName) {\r
+        var type = tagName.toUpperCase();\r
+        // this.invalidHandleTypes[type] = null;\r
+        delete this.invalidHandleTypes[type];\r
+    },\r
+    \r
+    /**\r
+     * Unsets an invalid handle id\r
+     * @param {string} the id of the element to re-enable\r
+     */\r
+    removeInvalidHandleId: function(id) {\r
+        delete this.invalidHandleIds[id];\r
+    },\r
+\r
+    /**\r
+     * Unsets an invalid css class\r
+     * @param {string} the class of the element(s) you wish to re-enable\r
+     */\r
+    removeInvalidHandleClass: function(cssClass) {\r
+        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {\r
+            if (this.invalidHandleClasses[i] == cssClass) {\r
+                delete this.invalidHandleClasses[i];\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Checks the tag exclusion list to see if this click should be ignored\r
+     *\r
+     * @param {ygNode} node\r
+     * @return {boolean} true if this is a valid tag type, false if not\r
+     */\r
+    isValidHandleChild: function(node) {\r
+\r
+        var valid = true;\r
+        // var n = (node.nodeName == "#text") ? node.parentNode : node;\r
+        var nodeName;\r
+        try {\r
+            nodeName = node.nodeName.toUpperCase();\r
+        } catch(e) {\r
+            nodeName = node.nodeName;\r
+        }\r
+        valid = valid && !this.invalidHandleTypes[nodeName];\r
+        valid = valid && !this.invalidHandleIds[node.id];\r
+\r
+        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {\r
+            valid = !YAHOO.util.Dom.hasClass(node, this.invalidHandleClasses[i]);\r
+        }\r
+\r
+        this.logger.log("Valid handle? ... " + valid);\r
+\r
+        return valid;\r
+\r
+    },\r
+\r
+    /**\r
+     * Create the array of horizontal tick marks if an interval was specified\r
+     * in setXConstraint().\r
+     *\r
+     * @private\r
+     */\r
+    setXTicks: function(iStartX, iTickSize) {\r
+        this.xTicks = [];\r
+        this.xTickSize = iTickSize;\r
+        \r
+        var tickMap = {};\r
+\r
+        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.xTicks[this.xTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.xTicks[this.xTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        this.xTicks.sort(this.DDM.numericSort) ;\r
+        this.logger.log("xTicks: " + this.xTicks.join());\r
+    },\r
+\r
+    /**\r
+     * Create the array of vertical tick marks if an interval was specified in \r
+     * setYConstraint().\r
+     *\r
+     * @private\r
+     */\r
+    setYTicks: function(iStartY, iTickSize) {\r
+        // this.logger.log("setYTicks: " + iStartY + ", " + iTickSize\r
+               // + ", " + this.initPageY + ", " + this.minY + ", " + this.maxY );\r
+        this.yTicks = [];\r
+        this.yTickSize = iTickSize;\r
+\r
+        var tickMap = {};\r
+\r
+        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.yTicks[this.yTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.yTicks[this.yTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        this.yTicks.sort(this.DDM.numericSort) ;\r
+        this.logger.log("yTicks: " + this.yTicks.join());\r
+    },\r
+\r
+    /**\r
+     * By default, the element can be dragged any place on the screen.  Use \r
+     * this method to limit the horizontal travel of the element.  Pass in \r
+     * 0,0 for the parameters if you want to lock the drag to the y axis.\r
+     *\r
+     * @param {int} iLeft the number of pixels the element can move to the left\r
+     * @param {int} iRight the number of pixels the element can move to the \r
+     * right\r
+     * @param {int} iTickSize optional parameter for specifying that the \r
+     * element\r
+     * should move iTickSize pixels at a time.\r
+     */\r
+    setXConstraint: function(iLeft, iRight, iTickSize) {\r
+        this.leftConstraint = iLeft;\r
+        this.rightConstraint = iRight;\r
+\r
+        this.minX = this.initPageX - iLeft;\r
+        this.maxX = this.initPageX + iRight;\r
+        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }\r
+\r
+        this.constrainX = true;\r
+        this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX + \r
+                " maxX:" + this.maxX);\r
+    },\r
+\r
+    /**\r
+     * Clears any constraints applied to this instance.  Also clears ticks\r
+     * since they can't exist independent of a constraint at this time.\r
+     */\r
+    clearConstraints: function() {\r
+        this.logger.log("Clearing constraints");\r
+        this.constrainX = false;\r
+        this.constrainY = false;\r
+        this.clearTicks();\r
+    },\r
+\r
+    /**\r
+     * Clears any tick interval defined for this instance\r
+     */\r
+    clearTicks: function() {\r
+        this.logger.log("Clearing ticks");\r
+        this.xTicks = null;\r
+        this.yTicks = null;\r
+        this.xTickSize = 0;\r
+        this.yTickSize = 0;\r
+    },\r
+\r
+    /**\r
+     * By default, the element can be dragged any place on the screen.  Set \r
+     * this to limit the vertical travel of the element.  Pass in 0,0 for the\r
+     * parameters if you want to lock the drag to the x axis.\r
+     *\r
+     * @param {int} iUp the number of pixels the element can move up\r
+     * @param {int} iDown the number of pixels the element can move down\r
+     * @param {int} iTickSize optional parameter for specifying that the \r
+     * element should move iTickSize pixels at a time.\r
+     */\r
+    setYConstraint: function(iUp, iDown, iTickSize) {\r
+        this.logger.log("setYConstraint: " + iUp + "," + iDown + "," + iTickSize);\r
+        this.topConstraint = iUp;\r
+        this.bottomConstraint = iDown;\r
+\r
+        this.minY = this.initPageY - iUp;\r
+        this.maxY = this.initPageY + iDown;\r
+        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }\r
+\r
+        this.constrainY = true;\r
+        \r
+        this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY + \r
+                " maxY:" + this.maxY);\r
+    },\r
+\r
+    /**\r
+     * resetConstraints must be called if you manually reposition a dd element.\r
+     * @param {boolean} maintainOffset\r
+     */\r
+    resetConstraints: function() {\r
+\r
+        this.logger.log("resetConstraints");\r
+\r
+        // Maintain offsets if necessary\r
+        if (this.initPageX || this.initPageX === 0) {\r
+            this.logger.log("init pagexy: " + this.initPageX + ", " + \r
+                               this.initPageY);\r
+            this.logger.log("last pagexy: " + this.lastPageX + ", " + \r
+                               this.lastPageY);\r
+            // figure out how much this thing has moved\r
+            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;\r
+            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;\r
+\r
+            this.setInitPosition(dx, dy);\r
+\r
+        // This is the first time we have detected the element's position\r
+        } else {\r
+            this.setInitPosition();\r
+        }\r
+\r
+        if (this.constrainX) {\r
+            this.setXConstraint( this.leftConstraint, \r
+                                 this.rightConstraint, \r
+                                 this.xTickSize        );\r
+        }\r
+\r
+        if (this.constrainY) {\r
+            this.setYConstraint( this.topConstraint, \r
+                                 this.bottomConstraint, \r
+                                 this.yTickSize         );\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Normally the drag element is moved pixel by pixel, but we can specify \r
+     * that it move a number of pixels at a time.  This method resolves the \r
+     * location when we have it set up like this.\r
+     *\r
+     * @param {int} val where we want to place the object\r
+     * @param {int[]} tickArray sorted array of valid points\r
+     * @return {int} the closest tick\r
+     * @private\r
+     */\r
+    getTick: function(val, tickArray) {\r
+\r
+        if (!tickArray) {\r
+            // If tick interval is not defined, it is effectively 1 pixel, \r
+            // so we return the value passed to us.\r
+            return val; \r
+        } else if (tickArray[0] >= val) {\r
+            // The value is lower than the first tick, so we return the first\r
+            // tick.\r
+            return tickArray[0];\r
+        } else {\r
+            for (var i=0, len=tickArray.length; i<len; ++i) {\r
+                var next = i + 1;\r
+                if (tickArray[next] && tickArray[next] >= val) {\r
+                    var diff1 = val - tickArray[i];\r
+                    var diff2 = tickArray[next] - val;\r
+                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];\r
+                }\r
+            }\r
+\r
+            // The value is larger than the last tick, so we return the last\r
+            // tick.\r
+            return tickArray[tickArray.length - 1];\r
+        }\r
+    },\r
+\r
+    /**\r
+     * toString method\r
+     * @return {string} string representation of the dd obj\r
+     */\r
+    toString: function() {\r
+        return ("DragDrop " + this.id);\r
+    }\r
+\r
+};\r
+\r
+// Only load the library once.  Rewriting the manager class would orphan \r
+// existing drag and drop instances.\r
+if (!YAHOO.util.DragDropMgr) {\r
+\r
+    /**\r
+     * Handles the element interaction for all DragDrop items in the \r
+     * window.  Generally, you will not call this class directly, but it does\r
+     * have helper methods that could be useful in your DragDrop \r
+     * implementations.  This class should not be instantiated; all methods \r
+     * are are static.\r
+     *\r
+     * @constructor\r
+     */\r
+    YAHOO.util.DragDropMgr = new function() {\r
+\r
+        /**\r
+         * Two dimensional Array of registered DragDrop objects.  The first \r
+         * dimension is the DragDrop item group, the second the DragDrop \r
+         * object.\r
+         *\r
+         * @type {string: string}\r
+         * @private\r
+         */\r
+        this.ids = {};\r
+\r
+        /**\r
+         * Array of element ids defined as drag handles.  Used to determine \r
+         * if the element that generated the mousedown event is actually the \r
+         * handle and not the html element itself.\r
+         *\r
+         * @type {string: string}\r
+         * @private\r
+         */\r
+        this.handleIds = {};\r
+\r
+        /**\r
+         * the DragDrop object that is currently being dragged\r
+         *\r
+         * @type DragDrop\r
+         * @private\r
+         **/\r
+        this.dragCurrent = null;\r
+\r
+        /**\r
+         * the DragDrop object(s) that are being hovered over\r
+         *\r
+         * @type Array\r
+         * @private\r
+         */\r
+        this.dragOvers = {};\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this.logger = null;\r
+\r
+        /**\r
+         * the X distance between the cursor and the object being dragged\r
+         *\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.deltaX = 0;\r
+\r
+        /**\r
+         * the Y distance between the cursor and the object being dragged\r
+         *\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.deltaY = 0;\r
+\r
+        /**\r
+         * Flag to determine if we should prevent the default behavior of the\r
+         * events we define. By default this is true, but this can be set to \r
+         * false if you need the default behavior (not recommended)\r
+         *\r
+         * @type boolean\r
+         */\r
+        this.preventDefault = true;\r
+\r
+        /**\r
+         * Flag to determine if we should stop the propagation of the events \r
+         * we generate. This is true by default but you may want to set it to\r
+         * false if the html element contains other features that require the\r
+         * mouse click.\r
+         *\r
+         * @type boolean\r
+         */\r
+        this.stopPropagation = true;\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this.initalized = false;\r
+\r
+        /**\r
+         * All drag and drop can be disabled.\r
+         *\r
+         * @private\r
+         */\r
+        this.locked = false;\r
+        \r
+        /**\r
+         * Called the first time an element is registered.\r
+         *\r
+         * @private\r
+         */\r
+        this.init = function() {\r
+            this.logger = this.logger || new YAHOO.widget.LogWriter("DragDropMgr");\r
+            this.initialized = true;\r
+        };\r
+\r
+        /**\r
+         * In point mode, drag and drop interaction is defined by the \r
+         * location of the cursor during the drag/drop\r
+         * @type int\r
+         */\r
+        this.POINT     = 0;\r
+\r
+        /**\r
+         * In intersect mode, drag and drop interactio nis defined by the \r
+         * overlap of two or more drag and drop objects.\r
+         * @type int\r
+         */\r
+        this.INTERSECT = 1;\r
+\r
+        /**\r
+         * The current drag and drop mode.  Default it point mode\r
+         * @type int\r
+         */\r
+        this.mode = this.POINT;\r
+\r
+        /**\r
+         * Runs method on all drag and drop objects\r
+         * @private\r
+         */\r
+        this._execOnAll = function(sMethod, args) {\r
+            for (var i in this.ids) {\r
+                for (var j in this.ids[i]) {\r
+                    var oDD = this.ids[i][j];\r
+                    if (! this.isTypeOfDD(oDD)) {\r
+                        continue;\r
+                    }\r
+                    oDD[sMethod].apply(oDD, args);\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Drag and drop initialization.  Sets up the global event handlers\r
+         * @private\r
+         */\r
+        this._onLoad = function() {\r
+\r
+            this.init();\r
+\r
+            this.logger.log("DDM onload");\r
+\r
+            var EU = YAHOO.util.Event;\r
+\r
+            EU.on(document, "mouseup",   this.handleMouseUp, this, true);\r
+            EU.on(document, "mousemove", this.handleMouseMove, this, true);\r
+            EU.on(window,   "unload",    this._onUnload, this, true);\r
+            EU.on(window,   "resize",    this._onResize, this, true);\r
+            // EU.on(window,   "mouseout",    this._test);\r
+\r
+        };\r
+\r
+        /**\r
+         * Reset constraints on all drag and drop objs\r
+         * @private\r
+         */\r
+        this._onResize = function(e) {\r
+            this.logger.log("window resize");\r
+            this._execOnAll("resetConstraints", []);\r
+        };\r
+\r
+        /**\r
+         * Lock all drag and drop functionality\r
+         */\r
+        this.lock = function() { this.locked = true; };\r
+\r
+        /**\r
+         * Unlock all drag and drop functionality\r
+         */\r
+        this.unlock = function() { this.locked = false; };\r
+\r
+        /**\r
+         * Is drag and drop locked?\r
+         *\r
+         * @return {boolean} True if drag and drop is locked, false otherwise.\r
+         */\r
+        this.isLocked = function() { return this.locked; };\r
+\r
+        /**\r
+         * Location cache that is set for all drag drop objects when a drag is\r
+         * initiated, cleared when the drag is finished.\r
+         *\r
+         * @private\r
+         */\r
+        this.locationCache = {};\r
+\r
+        /**\r
+         * Set useCache to false if you want to force object the lookup of each\r
+         * drag and drop linked element constantly during a drag.\r
+         * @type boolean\r
+         */\r
+        this.useCache = true;\r
+\r
+        /**\r
+         * The number of pixels that the mouse needs to move after the \r
+         * mousedown before the drag is initiated.  Default=3;\r
+         * @type int\r
+         */\r
+        this.clickPixelThresh = 3;\r
+\r
+        /**\r
+         * The number of milliseconds after the mousedown event to initiate the\r
+         * drag if we don't get a mouseup event. Default=1000\r
+         * @type int\r
+         */\r
+        this.clickTimeThresh = 1000;\r
+\r
+        /**\r
+         * Flag that indicates that either the drag pixel threshold or the \r
+         * mousdown time threshold has been met\r
+         * @type boolean\r
+         * @private\r
+         */\r
+        this.dragThreshMet = false;\r
+\r
+        /**\r
+         * Timeout used for the click time threshold\r
+         * @type Object\r
+         * @private\r
+         */\r
+        this.clickTimeout = null;\r
+\r
+        /**\r
+         * The X position of the mousedown event stored for later use when a \r
+         * drag threshold is met.\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.startX = 0;\r
+\r
+        /**\r
+         * The Y position of the mousedown event stored for later use when a \r
+         * drag threshold is met.\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.startY = 0;\r
+\r
+        /**\r
+         * Each DragDrop instance must be registered with the DragDropMgr.  \r
+         * This is executed in DragDrop.init()\r
+         *\r
+         * @param {DragDrop} oDD the DragDrop object to register\r
+         * @param {String} sGroup the name of the group this element belongs to\r
+         */\r
+        this.regDragDrop = function(oDD, sGroup) {\r
+            if (!this.initialized) { this.init(); }\r
+            \r
+            if (!this.ids[sGroup]) {\r
+                this.ids[sGroup] = {};\r
+            }\r
+            this.ids[sGroup][oDD.id] = oDD;\r
+        };\r
+\r
+        /**\r
+         * Removes the supplied dd instance from the supplied group. Executed\r
+         * by DragDrop.removeFromGroup.\r
+         * @private\r
+         */\r
+        this.removeDDFromGroup = function(oDD, sGroup) {\r
+            if (!this.ids[sGroup]) {\r
+                this.ids[sGroup] = {};\r
+            }\r
+\r
+            var obj = this.ids[sGroup];\r
+            if (obj && obj[oDD.id]) {\r
+                delete obj[oDD.id];\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Unregisters a drag and drop item.  This is executed in \r
+         * DragDrop.unreg, use that method instead of calling this directly.\r
+         * @private\r
+         */\r
+        this._remove = function(oDD) {\r
+            for (var g in oDD.groups) {\r
+                if (g && this.ids[g][oDD.id]) {\r
+                    delete this.ids[g][oDD.id];\r
+                }\r
+            }\r
+            delete this.handleIds[oDD.id];\r
+        };\r
+\r
+        /**\r
+         * Each DragDrop handle element must be registered.  This is done\r
+         * automatically when executing DragDrop.setHandleElId()\r
+         *\r
+         * @param {String} sDDId the DragDrop id this element is a handle for\r
+         * @param {String} sHandleId the id of the element that is the drag \r
+         * handle\r
+         */\r
+        this.regHandle = function(sDDId, sHandleId) {\r
+            if (!this.handleIds[sDDId]) {\r
+                this.handleIds[sDDId] = {};\r
+            }\r
+            this.handleIds[sDDId][sHandleId] = sHandleId;\r
+        };\r
+\r
+        /**\r
+         * Utility function to determine if a given element has been \r
+         * registered as a drag drop item.\r
+         *\r
+         * @param {String} id the element id to check\r
+         * @return {boolean} true if this element is a DragDrop item, \r
+         * false otherwise\r
+         */\r
+        this.isDragDrop = function(id) {\r
+            return ( this.getDDById(id) ) ? true : false;\r
+        };\r
+\r
+        /**\r
+         * Returns the drag and drop instances that are in all groups the\r
+         * passed in instance belongs to.\r
+         *\r
+         * @param {DragDrop} p_oDD the obj to get related data for\r
+         * @param {boolean} bTargetsOnly if true, only return targetable objs\r
+         * @return {DragDrop[]} the related instances\r
+         */\r
+        this.getRelated = function(p_oDD, bTargetsOnly) {\r
+            var oDDs = [];\r
+            for (var i in p_oDD.groups) {\r
+                for (j in this.ids[i]) {\r
+                    var dd = this.ids[i][j];\r
+                    if (! this.isTypeOfDD(dd)) {\r
+                        continue;\r
+                    }\r
+                    if (!bTargetsOnly || dd.isTarget) {\r
+                        oDDs[oDDs.length] = dd;\r
+                    }\r
+                }\r
+            }\r
+\r
+            return oDDs;\r
+        };\r
+\r
+        /**\r
+         * Returns true if the specified dd target is a legal target for \r
+         * the specifice drag obj\r
+         *\r
+         * @param {DragDrop} the drag obj\r
+         * @param {DragDrop) the target\r
+         * @return {boolean} true if the target is a legal target for the \r
+         * dd obj\r
+         */\r
+        this.isLegalTarget = function (oDD, oTargetDD) {\r
+            var targets = this.getRelated(oDD, true);\r
+            for (var i=0, len=targets.length;i<len;++i) {\r
+                if (targets[i].id == oTargetDD.id) {\r
+                    return true;\r
+                }\r
+            }\r
+\r
+            return false;\r
+        };\r
+\r
+        /**\r
+         * My goal is to be able to transparently determine if an object is\r
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof \r
+         * returns "object", oDD.constructor.toString() always returns\r
+         * "DragDrop" and not the name of the subclass.  So for now it just\r
+         * evaluates a well-known variable in DragDrop.\r
+         *\r
+         * @param {Object} the object to evaluate\r
+         * @return {boolean} true if typeof oDD = DragDrop\r
+         */\r
+        this.isTypeOfDD = function (oDD) {\r
+            return (oDD && oDD.__ygDragDrop);\r
+        };\r
+\r
+        /**\r
+         * Utility function to determine if a given element has been \r
+         * registered as a drag drop handle for the given Drag Drop object.\r
+         *\r
+         * @param {String} id the element id to check\r
+         * @return {boolean} true if this element is a DragDrop handle, false \r
+         * otherwise\r
+         */\r
+        this.isHandle = function(sDDId, sHandleId) {\r
+            return ( this.handleIds[sDDId] && \r
+                            this.handleIds[sDDId][sHandleId] );\r
+        };\r
+\r
+        /**\r
+         * Returns the DragDrop instance for a given id\r
+         *\r
+         * @param {String} id the id of the DragDrop object\r
+         * @return {DragDrop} the drag drop object, null if it is not found\r
+         */\r
+        this.getDDById = function(id) {\r
+            for (var i in this.ids) {\r
+                if (this.ids[i][id]) {\r
+                    return this.ids[i][id];\r
+                }\r
+            }\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * Fired after a registered DragDrop object gets the mousedown event.\r
+         * Sets up the events required to track the object being dragged\r
+         *\r
+         * @param {Event} e the event\r
+         * @param oDD the DragDrop object being dragged\r
+         * @private\r
+         */\r
+        this.handleMouseDown = function(e, oDD) {\r
+\r
+            this.currentTarget = YAHOO.util.Event.getTarget(e);\r
+\r
+            this.logger.log("mousedown - adding event handlers");\r
+            this.dragCurrent = oDD;\r
+\r
+            var el = oDD.getEl();\r
+\r
+            // track start position\r
+            this.startX = YAHOO.util.Event.getPageX(e);\r
+            this.startY = YAHOO.util.Event.getPageY(e);\r
+\r
+            this.deltaX = this.startX - el.offsetLeft;\r
+            this.deltaY = this.startY - el.offsetTop;\r
+\r
+            this.dragThreshMet = false;\r
+\r
+            this.clickTimeout = setTimeout( \r
+                    function() { \r
+                        var DDM = YAHOO.util.DDM;\r
+                        DDM.startDrag(DDM.startX, DDM.startY); \r
+                    }, \r
+                    this.clickTimeThresh );\r
+        };\r
+\r
+        /**\r
+         * Fired when either the drag pixel threshol or the mousedown hold \r
+         * time threshold has been met.\r
+         * \r
+         * @param x {int} the X position of the original mousedown\r
+         * @param y {int} the Y position of the original mousedown\r
+         */\r
+        this.startDrag = function(x, y) {\r
+            this.logger.log("firing drag start events");\r
+            clearTimeout(this.clickTimeout);\r
+            if (this.dragCurrent) {\r
+                this.dragCurrent.b4StartDrag(x, y);\r
+                this.dragCurrent.startDrag(x, y);\r
+            }\r
+            this.dragThreshMet = true;\r
+        };\r
+\r
+        /**\r
+         * Internal function to handle the mouseup event.  Will be invoked \r
+         * from the context of the document.\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.handleMouseUp = function(e) {\r
+\r
+            if (! this.dragCurrent) {\r
+                return;\r
+            }\r
+\r
+            clearTimeout(this.clickTimeout);\r
+\r
+            if (this.dragThreshMet) {\r
+                this.logger.log("mouseup detected - completing drag");\r
+                this.fireEvents(e, true);\r
+            } else {\r
+                this.logger.log("drag threshold not met");\r
+            }\r
+\r
+            this.stopDrag(e);\r
+\r
+            this.stopEvent(e);\r
+        };\r
+\r
+        /**\r
+         * Utility to stop event propagation and event default, if these \r
+         * features are turned on.\r
+         *\r
+         * @param {Event} e the event as returned by this.getEvent()\r
+         */\r
+        this.stopEvent = function(e) {\r
+            if (this.stopPropagation) {\r
+                YAHOO.util.Event.stopPropagation(e);\r
+            }\r
+\r
+            if (this.preventDefault) {\r
+                YAHOO.util.Event.preventDefault(e);\r
+            }\r
+        };\r
+\r
+        /** \r
+         * Internal function to clean up event handlers after the drag \r
+         * operation is complete\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.stopDrag = function(e) {\r
+            // this.logger.log("mouseup - removing event handlers");\r
+\r
+            // Fire the drag end event for the item that was dragged\r
+            if (this.dragCurrent) {\r
+                if (this.dragThreshMet) {\r
+                    this.logger.log("firing endDrag events");\r
+                    this.dragCurrent.b4EndDrag(e);\r
+                    this.dragCurrent.endDrag(e);\r
+                }\r
+\r
+                this.logger.log("firing mouseUp event");\r
+                this.dragCurrent.onMouseUp(e);\r
+            }\r
+\r
+            this.dragCurrent = null;\r
+            this.dragOvers = {};\r
+        };\r
+\r
+\r
+        /** \r
+         * Internal function to handle the mousemove event.  Will be invoked \r
+         * from the context of the html element.\r
+         *\r
+         * @TODO figure out what we can do about mouse events lost when the \r
+         * user drags objects beyond the window boundary.  Currently we can \r
+         * detect this in internet explorer by verifying that the mouse is \r
+         * down during the mousemove event.  Firefox doesn't give us the \r
+         * button state on the mousemove event.\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.handleMouseMove = function(e) {\r
+            if (! this.dragCurrent) {\r
+                // this.logger.log("no current drag obj");\r
+                return false;\r
+            }\r
+\r
+            // var button = e.which || e.button;\r
+            // this.logger.log("which: " + e.which + ", button: "+ e.button);\r
+\r
+            // check for IE mouseup outside of page boundary\r
+            if (YAHOO.util.Event.isIE && !e.button) {\r
+                this.logger.log("button failure");\r
+                this.stopEvent(e);\r
+                return this.handleMouseUp(e);\r
+            }\r
+\r
+            if (!this.dragThreshMet) {\r
+                var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));\r
+                var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));\r
+                // this.logger.log("diffX: " + diffX + "diffY: " + diffY);\r
+                if (diffX > this.clickPixelThresh || \r
+                            diffY > this.clickPixelThresh) {\r
+                    this.logger.log("pixel threshold met");\r
+                    this.startDrag(this.startX, this.startY);\r
+                }\r
+            }\r
+\r
+            if (this.dragThreshMet) {\r
+                this.dragCurrent.b4Drag(e);\r
+                this.dragCurrent.onDrag(e);\r
+                this.fireEvents(e, false);\r
+            }\r
+\r
+            this.stopEvent(e);\r
+\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Iterates over all of the DragDrop elements to find ones we are \r
+         * hovering over or dropping on\r
+         *\r
+         * @param {Event} e the event\r
+         * @param {boolean} isDrop is this a drop op or a mouseover op?\r
+         * @private\r
+         */\r
+        this.fireEvents = function(e, isDrop) {\r
+            var dc = this.dragCurrent;\r
+\r
+            // If the user did the mouse up outside of the window, we could \r
+            // get here even though we have ended the drag.\r
+            if (!dc || dc.isLocked()) {\r
+                return;\r
+            }\r
+\r
+            var x = YAHOO.util.Event.getPageX(e);\r
+            var y = YAHOO.util.Event.getPageY(e);\r
+            var pt = new YAHOO.util.Point(x,y);\r
+\r
+            // cache the previous dragOver array\r
+            var oldOvers = [];\r
+\r
+            var outEvts   = [];\r
+            var overEvts  = [];\r
+            var dropEvts  = [];\r
+            var enterEvts = [];\r
+\r
+            // Check to see if the object(s) we were hovering over is no longer \r
+            // being hovered over so we can fire the onDragOut event\r
+            for (var i in this.dragOvers) {\r
+\r
+                var ddo = this.dragOvers[i];\r
+\r
+                if (! this.isTypeOfDD(ddo)) {\r
+                    continue;\r
+                }\r
+\r
+                if (! this.isOverTarget(pt, ddo, this.mode)) {\r
+                    outEvts.push( ddo );\r
+                }\r
+\r
+                oldOvers[i] = true;\r
+                delete this.dragOvers[i];\r
+            }\r
+\r
+            for (var sGroup in dc.groups) {\r
+                // this.logger.log("Processing group " + sGroup);\r
+                \r
+                if ("string" != typeof sGroup) {\r
+                    continue;\r
+                }\r
+\r
+                for (i in this.ids[sGroup]) {\r
+                    var oDD = this.ids[sGroup][i];\r
+                    if (! this.isTypeOfDD(oDD)) {\r
+                        continue;\r
+                    }\r
+\r
+                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {\r
+                        if (this.isOverTarget(pt, oDD, this.mode)) {\r
+                            // look for drop interactions\r
+                            if (isDrop) {\r
+                                dropEvts.push( oDD );\r
+                            // look for drag enter and drag over interactions\r
+                            } else {\r
+\r
+                                // initial drag over: dragEnter fires\r
+                                if (!oldOvers[oDD.id]) {\r
+                                    enterEvts.push( oDD );\r
+                                // subsequent drag overs: dragOver fires\r
+                                } else {\r
+                                    overEvts.push( oDD );\r
+                                }\r
+\r
+                                this.dragOvers[oDD.id] = oDD;\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            if (this.mode) {\r
+                if (outEvts.length) {\r
+                    this.logger.log(dc.id+" onDragOut: " + outEvts);\r
+                    dc.b4DragOut(e, outEvts);\r
+                    dc.onDragOut(e, outEvts);\r
+                }\r
+\r
+                if (enterEvts.length) {\r
+                    this.logger.log(dc.id+" onDragEnter: " + enterEvts);\r
+                    dc.onDragEnter(e, enterEvts);\r
+                }\r
+\r
+                if (overEvts.length) {\r
+                    this.logger.log(dc.id+" onDragOver: " + overEvts);\r
+                    dc.b4DragOver(e, overEvts);\r
+                    dc.onDragOver(e, overEvts);\r
+                }\r
+\r
+                if (dropEvts.length) {\r
+                    this.logger.log(dc.id+" onDragDrop: " + dropEvts);\r
+                    dc.b4DragDrop(e, dropEvts);\r
+                    dc.onDragDrop(e, dropEvts);\r
+                }\r
+\r
+            } else {\r
+                // fire dragout events\r
+                var len = 0;\r
+                for (i=0, len=outEvts.length; i<len; ++i) {\r
+                    this.logger.log(dc.id+" onDragOut: " + outEvts[i].id);\r
+                    dc.b4DragOut(e, outEvts[i].id);\r
+                    dc.onDragOut(e, outEvts[i].id);\r
+                }\r
+                 \r
+                // fire enter events\r
+                for (i=0,len=enterEvts.length; i<len; ++i) {\r
+                    this.logger.log(dc.id + " onDragEnter " + enterEvts[i].id);\r
+                    // dc.b4DragEnter(e, oDD.id);\r
+                    dc.onDragEnter(e, enterEvts[i].id);\r
+                }\r
+         \r
+                // fire over events\r
+                for (i=0,len=overEvts.length; i<len; ++i) {\r
+                    this.logger.log(dc.id + " onDragOver " + overEvts[i].id);\r
+                    dc.b4DragOver(e, overEvts[i].id);\r
+                    dc.onDragOver(e, overEvts[i].id);\r
+                }\r
+\r
+                // fire drop events\r
+                for (i=0, len=dropEvts.length; i<len; ++i) {\r
+                    this.logger.log(dc.id + " dropped on " + dropEvts[i].id);\r
+                    dc.b4DragDrop(e, dropEvts[i].id);\r
+                    dc.onDragDrop(e, dropEvts[i].id);\r
+                }\r
+\r
+            }\r
+\r
+        };\r
+\r
+        /**\r
+         * Helper function for getting the best match from the list of drag \r
+         * and drop objects returned by the drag and drop events when we are \r
+         * in INTERSECT mode.  It returns either the first object that the \r
+         * cursor is over, or the object that has the greatest overlap with \r
+         * the dragged element.\r
+         *\r
+         * @param  {DragDrop[]} dds The array of drag and drop objects \r
+         * targeted\r
+         * @return {DragDrop}       The best single match\r
+         */\r
+        this.getBestMatch = function(dds) {\r
+            var winner = null;\r
+            // Return null if the input is not what we expect\r
+            //if (!dds || !dds.length || dds.length == 0) {\r
+               // winner = null;\r
+            // If there is only one item, it wins\r
+            //} else if (dds.length == 1) {\r
+\r
+            var len = dds.length;\r
+\r
+            if (len == 1) {\r
+                winner = dds[0];\r
+            } else {\r
+                // Loop through the targeted items\r
+                for (var i=0; i<len; ++i) {\r
+                    var dd = dds[i];\r
+                    // If the cursor is over the object, it wins.  If the \r
+                    // cursor is over multiple matches, the first one we come\r
+                    // to wins.\r
+                    if (dd.cursorIsOver) {\r
+                        winner = dd;\r
+                        break;\r
+                    // Otherwise the object with the most overlap wins\r
+                    } else {\r
+                        if (!winner || \r
+                            winner.overlap.getArea() < dd.overlap.getArea()) {\r
+                            winner = dd;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            return winner;\r
+        };\r
+\r
+        /**\r
+         * Refreshes the cache of the top-left and bottom-right points of the \r
+         * drag and drop objects in the specified groups\r
+         *\r
+         * @param {Object} groups an associative array of groups to refresh\r
+         */\r
+        this.refreshCache = function(groups) {\r
+            this.logger.log("refreshing element location cache");\r
+            for (sGroup in groups) {\r
+                if ("string" != typeof sGroup) {\r
+                    continue;\r
+                }\r
+                for (i in this.ids[sGroup]) {\r
+                    var oDD = this.ids[sGroup][i];\r
+\r
+                    if (this.isTypeOfDD(oDD)) {\r
+                    // if (this.isTypeOfDD(oDD) && oDD.isTarget) {\r
+                        var loc = this.getLocation(oDD);\r
+                        if (loc) {\r
+                            this.locationCache[oDD.id] = loc;\r
+                        } else {\r
+                            delete this.locationCache[oDD.id];\r
+                            this.logger.log("Could not get the loc for " + oDD.id,\r
+                                    "warn");\r
+                            // this will unregister the drag and drop object if\r
+                            // the element is not in a usable state\r
+                            // oDD.unreg();\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * This checks to make sure an element exists and is in the DOM.  The\r
+         * main purpose is to handle cases where innerHTML is used to remove\r
+         * drag and drop objects from the DOM.  IE provides an 'unspecified\r
+         * error' when trying to access the offsetParent of such an element\r
+         * @param {HTMLElement} el the element to check\r
+         * @return {boolean} true if the element looks usable\r
+         */\r
+        this.verifyEl = function(el) {\r
+            try {\r
+                if (el) {\r
+                    var parent = el.offsetParent;\r
+                    if (parent) {\r
+                        return true;\r
+                    }\r
+                }\r
+            } catch(e) {\r
+                this.logger.log("detected problem with an element");\r
+            }\r
+\r
+            return false;\r
+        };\r
+        \r
+        /**\r
+         * Returns the an array containing the drag and drop element's position\r
+         * and size, including the DragDrop.padding configured for it\r
+         *\r
+         * @param {DragDrop} oDD the drag and drop object to get the \r
+         * location for\r
+         * @return array containing the top left and bottom right points of the \r
+         * element \r
+         */\r
+        this.getLocation = function(oDD) {\r
+            if (! this.isTypeOfDD(oDD)) {\r
+                this.logger.log(oDD + " is not a DD obj");\r
+                return null;\r
+            }\r
+\r
+            var el = oDD.getEl();\r
+\r
+            // element will not have an offsetparent if it was removed from the\r
+            // document or display=none\r
+            // if (!this.verifyEl(el)) {\r
+                // this.logger.log(oDD + " element is not usable");\r
+                // return null;\r
+            // }\r
+\r
+            // this.logger.log(oDD.id + " padding: " + oDD.padding);\r
+\r
+            // var aPos = ygPos.getPos(el);\r
+            var aPos = null;\r
+            try {\r
+                aPos= YAHOO.util.Dom.getXY(el);\r
+            } catch (e) { }\r
+\r
+            if (!aPos) {\r
+                return null;\r
+            }\r
+\r
+            x1 = aPos[0];\r
+            x2 = x1 + el.offsetWidth;\r
+\r
+            y1 = aPos[1];\r
+            y2 = y1 + el.offsetHeight;\r
+\r
+            var t = y1 - oDD.padding[0];\r
+            var r = x2 + oDD.padding[1];\r
+            var b = y2 + oDD.padding[2];\r
+            var l = x1 - oDD.padding[3];\r
+\r
+            return new YAHOO.util.Region( t, r, b, l );\r
+\r
+        };\r
+\r
+        /**\r
+         * Checks the cursor location to see if it over the target\r
+         * \r
+         * @param {YAHOO.util.Point} pt The point to evaluate\r
+         * @param {DragDrop} oTarget the DragDrop object we are inspecting\r
+         * @return {boolean} true if the mouse is over the target\r
+         * @private\r
+         */\r
+        this.isOverTarget = function(pt, oTarget, intersect) {\r
+            // use cache if available\r
+            var loc = this.locationCache[oTarget.id];\r
+            if (!loc || !this.useCache) {\r
+                this.logger.log("cache not populated");\r
+                loc = this.getLocation(oTarget);\r
+                this.locationCache[oTarget.id] = loc;\r
+\r
+                this.logger.log("cache: " + loc);\r
+            }\r
+\r
+            if (!loc) {\r
+                return false;\r
+            }\r
+\r
+            oTarget.cursorIsOver = loc.contains( pt );\r
+\r
+            // DragDrop is using this as a sanity check for the initial mousedown\r
+            // in this case we are done.  In POINT mode, if the drag obj has no\r
+            // contraints, we are also done. Otherwise we need to evaluate the \r
+            // location of the target as related to the actual location of the\r
+            // dragged element.\r
+            var dc = this.dragCurrent;\r
+            if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {\r
+                return oTarget.cursorIsOver;\r
+            }\r
+\r
+            oTarget.overlap = null;\r
+\r
+            // Get the current location of the drag element, this is the\r
+            // location of the mouse event less the delta that represents\r
+            // where the original mousedown happened on the element.  We\r
+            // need to consider constraints and ticks as well.\r
+            var pos = dc.getTargetCoord(pt.x, pt.y);\r
+\r
+            var el = dc.getDragEl();\r
+            var curRegion = new YAHOO.util.Region( pos.y, \r
+                                                   pos.x + el.offsetWidth,\r
+                                                   pos.y + el.offsetHeight, \r
+                                                   pos.x );\r
+\r
+            var overlap = curRegion.intersect(loc);\r
+\r
+            if (overlap) {\r
+                oTarget.overlap = overlap;\r
+                return (intersect) ? true : oTarget.cursorIsOver;\r
+            } else {\r
+                return false;\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this._onUnload = function(e, me) {\r
+            this.unregAll();\r
+        };\r
+\r
+        /**\r
+         * Cleans up the drag and drop events and objects.\r
+         * @private\r
+         */\r
+        this.unregAll = function() {\r
+            this.logger.log("unregister all");\r
+\r
+            if (this.dragCurrent) {\r
+                this.stopDrag();\r
+                this.dragCurrent = null;\r
+            }\r
+\r
+            this._execOnAll("unreg", []);\r
+\r
+            for (i in this.elementCache) {\r
+                delete this.elementCache[i];\r
+            }\r
+\r
+            this.elementCache = {};\r
+            this.ids = {};\r
+        };\r
+\r
+        /**\r
+         * A cache of DOM elements\r
+         * @private\r
+         */\r
+        this.elementCache = {};\r
+        \r
+        /**\r
+         * Get the wrapper for the DOM element specified\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element\r
+         * @private\r
+         * @deprecated\r
+         */\r
+        this.getElWrapper = function(id) {\r
+            var oWrapper = this.elementCache[id];\r
+            if (!oWrapper || !oWrapper.el) {\r
+                oWrapper = this.elementCache[id] = \r
+                    new this.ElementWrapper(YAHOO.util.Dom.get(id));\r
+            }\r
+            return oWrapper;\r
+        };\r
+\r
+        /**\r
+         * Returns the actual DOM element\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {Object} The element\r
+         * @deprecated\r
+         */\r
+        this.getElement = function(id) {\r
+            return YAHOO.util.Dom.get(id);\r
+        };\r
+        \r
+        /**\r
+         * Returns the style property for the DOM element (i.e., \r
+         * document.getElById(id).style)\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {Object} The style property of the element\r
+         * @deprecated\r
+         */\r
+        this.getCss = function(id) {\r
+            var el = YAHOO.util.Dom.get(id);\r
+            return (el) ? el.style : null;\r
+        };\r
+\r
+        /**\r
+         * Inner class for cached elements\r
+         * @private\r
+         * @deprecated\r
+         */\r
+        this.ElementWrapper = function(el) {\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.el = el || null;\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.id = this.el && el.id;\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.css = this.el && el.style;\r
+            };\r
+\r
+        /**\r
+         * Returns the X position of an html element\r
+         * @param el the element for which to get the position\r
+         * @return {int} the X coordinate\r
+         * @deprecated\r
+         */\r
+        this.getPosX = function(el) {\r
+            return YAHOO.util.Dom.getX(el);\r
+        };\r
+\r
+        /**\r
+         * Returns the Y position of an html element\r
+         * @param el the element for which to get the position\r
+         * @return {int} the Y coordinate\r
+         * @deprecated\r
+         */\r
+        this.getPosY = function(el) {\r
+            return YAHOO.util.Dom.getY(el); \r
+        };\r
+\r
+        /**\r
+         * Swap two nodes.  In IE, we use the native method, for others we \r
+         * emulate the IE behavior\r
+         *\r
+         * @param n1 the first node to swap\r
+         * @param n2 the other node to swap\r
+         */\r
+        this.swapNode = function(n1, n2) {\r
+            if (n1.swapNode) {\r
+                n1.swapNode(n2);\r
+            } else {\r
+                // the node reference order for the swap is a little tricky. \r
+                var p = n2.parentNode;\r
+                var s = n2.nextSibling;\r
+                n1.parentNode.replaceChild(n2, n1);\r
+                p.insertBefore(n1,s);\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this.getScroll = function () {\r
+            var t, l;\r
+            if (document.documentElement && document.documentElement.scrollTop) {\r
+                t = document.documentElement.scrollTop;\r
+                l = document.documentElement.scrollLeft;\r
+            } else if (document.body) {\r
+                t = document.body.scrollTop;\r
+                l = document.body.scrollLeft;\r
+            }\r
+            return { top: t, left: l };\r
+        };\r
+\r
+        /**\r
+         * Returns the specified element style property\r
+         * @param {HTMLElement} el          the element\r
+         * @param {string}      styleProp   the style property\r
+         * @return {string} The value of the style property\r
+         * @deprecated, use YAHOO.util.Dom.getStyle\r
+         */\r
+        this.getStyle = function(el, styleProp) {\r
+            return YAHOO.util.Dom.getStyle(el, styleProp);\r
+        };\r
+\r
+        /**\r
+         * Gets the scrollTop\r
+         * @return {int} the document's scrollTop\r
+         */\r
+        this.getScrollTop = function () { return this.getScroll().top; };\r
+\r
+        /**\r
+         * Gets the scrollLeft\r
+         * @return {int} the document's scrollTop\r
+         */\r
+        this.getScrollLeft = function () { return this.getScroll().left; };\r
+\r
+        /**\r
+         * Sets the x/y position of an element to the location of the\r
+         * target element.\r
+         * @param {HTMLElement} moveEl      The element to move\r
+         * @param {HTMLElement} targetEl    The position reference element\r
+         */\r
+        this.moveToEl = function (moveEl, targetEl) {\r
+            var aCoord = YAHOO.util.Dom.getXY(targetEl);\r
+            this.logger.log("moveToEl: " + aCoord);\r
+            YAHOO.util.Dom.setXY(moveEl, aCoord);\r
+        };\r
+\r
+        /**\r
+         * Gets the client height\r
+         * @return {int} client height in px\r
+         * @deprecated\r
+         */\r
+        this.getClientHeight = function() {\r
+            return YAHOO.util.Dom.getClientHeight();\r
+        };\r
+\r
+        /**\r
+         * Gets the client width\r
+         * @return {int} client width in px\r
+         * @deprecated\r
+         */\r
+        this.getClientWidth = function() {\r
+            return YAHOO.util.Dom.getClientWidth();\r
+        };\r
+\r
+        /**\r
+         * numeric array sort function\r
+         */\r
+        this.numericSort = function(a, b) { return (a - b); };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this._timeoutCount = 0;\r
+\r
+        /**\r
+         * Trying to make the load order less important.  Without this we get\r
+         * an error if this file is loaded before the Event Utility.\r
+         * @private\r
+         */\r
+        this._addListeners = function() {\r
+            if ( YAHOO.util.Event && document ) {\r
+                this._onLoad();\r
+            } else {\r
+                if (this._timeoutCount > 1000) {\r
+                    this.logger.log("DragDrop requires the Event Utility");\r
+                } else {\r
+                    var DDM = YAHOO.util.DDM;\r
+                    setTimeout( function() { DDM._addListeners(); }, 10);\r
+                    if (document && document.body) {\r
+                        this._timeoutCount += 1;\r
+                    }\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Recursively searches the immediate parent and all child nodes for \r
+         * the handle element in order to determine wheter or not it was \r
+         * clicked.\r
+         * @param node the html element to inspect\r
+         */\r
+        this.handleWasClicked = function(node, id) {\r
+            if (this.isHandle(id, node.id)) {\r
+                this.logger.log("clicked node is a handle");\r
+                return true;\r
+            } else {\r
+                // check to see if this is a text node child of the one we want\r
+                var p = node.parentNode;\r
+                // this.logger.log("p: " + p);\r
+\r
+                while (p) {\r
+                    if (this.isHandle(id, p.id)) {\r
+                        return true;\r
+                    } else {\r
+                        this.logger.log(p.id + " is not a handle");\r
+                        p = p.parentNode;\r
+                    }\r
+                }\r
+            }\r
+\r
+            return false;\r
+        };\r
+\r
+    } ();\r
+\r
+    // shorter alias, save a few bytes\r
+    YAHOO.util.DDM = YAHOO.util.DragDropMgr;\r
+    YAHOO.util.DDM._addListeners();\r
+\r
+}\r
+\r
+/**\r
+ * A DragDrop implementation where the linked element follows the \r
+ * mouse cursor during a drag.\r
+ *\r
+ * @extends YAHOO.util.DragDrop\r
+ * @constructor\r
+ * @param {String} id the id of the linked element \r
+ * @param {String} sGroup the group of related DragDrop items\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DD: \r
+ *                    scroll\r
+ */\r
+YAHOO.util.DD = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config);\r
+    }\r
+};\r
+\r
+// YAHOO.util.DD.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop);\r
+\r
+/**\r
+ * When set to true, the utility automatically tries to scroll the browser\r
+ * window wehn a drag and drop element is dragged near the viewport boundary.\r
+ * Defaults to true.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DD.prototype.scroll = true; \r
+\r
+/**\r
+ * Sets the pointer offset to the distance between the linked element's top \r
+ * left corner and the location the element was clicked\r
+ *\r
+ * @param {int} iPageX the X coordinate of the click\r
+ * @param {int} iPageY the Y coordinate of the click\r
+ */\r
+YAHOO.util.DD.prototype.autoOffset = function(iPageX, iPageY) {\r
+    // var el = this.getEl();\r
+    // var aCoord = YAHOO.util.Dom.getXY(el);\r
+    // var x = iPageX - aCoord[0];\r
+    // var y = iPageY - aCoord[1];\r
+    var x = iPageX - this.startPageX;\r
+    var y = iPageY - this.startPageY;\r
+    this.setDelta(x, y);\r
+    // this.logger.log("autoOffset el pos: " + aCoord + ", delta: " + x + "," + y);\r
+};\r
+\r
+/** \r
+ * Sets the pointer offset.  You can call this directly to force the offset to\r
+ * be in a particular location (e.g., pass in 0,0 to set it to the center of the\r
+ * object, as done in YAHOO.widget.Slider)\r
+ *\r
+ * @param {int} iDeltaX the distance from the left\r
+ * @param {int} iDeltaY the distance from the top\r
+ */\r
+YAHOO.util.DD.prototype.setDelta = function(iDeltaX, iDeltaY) {\r
+    this.deltaX = iDeltaX;\r
+    this.deltaY = iDeltaY;\r
+    this.logger.log("deltaX:" + this.deltaX + ", deltaY:" + this.deltaY);\r
+};\r
+\r
+/**\r
+ * Sets the drag element to the location of the mousedown or click event, \r
+ * maintaining the cursor location relative to the location on the element \r
+ * that was clicked.  Override this if you want to place the element in a \r
+ * location other than where the cursor is.\r
+ *\r
+ * @param {int} iPageX the X coordinate of the mousedown or drag event\r
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event\r
+ */\r
+\r
+YAHOO.util.DD.prototype.setDragElPos = function(iPageX, iPageY) {\r
+    // the first time we do this, we are going to check to make sure\r
+    // the element has css positioning\r
+\r
+    var el = this.getDragEl();\r
+\r
+    // if (!this.cssVerified) {\r
+        // var pos = el.style.position;\r
+        // this.logger.log("drag element position: " + pos);\r
+    // }\r
+\r
+    this.alignElWithMouse(el, iPageX, iPageY);\r
+};\r
+\r
+/**\r
+ * Sets the element to the location of the mousedown or click event, \r
+ * maintaining the cursor location relative to the location on the element \r
+ * that was clicked.  Override this if you want to place the element in a \r
+ * location other than where the cursor is.\r
+ *\r
+ * @param {HTMLElement} el the element to move\r
+ * @param {int} iPageX the X coordinate of the mousedown or drag event\r
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event\r
+ */\r
+YAHOO.util.DD.prototype.alignElWithMouse = function(el, iPageX, iPageY) {\r
+    var oCoord = this.getTargetCoord(iPageX, iPageY);\r
+    // this.logger.log("****alignElWithMouse : " + el.id + ", " + aCoord + ", " + el.style.display);\r
+\r
+    // this.deltaSetXY = null;\r
+    if (!this.deltaSetXY) {\r
+        var aCoord = [oCoord.x, oCoord.y];\r
+        YAHOO.util.Dom.setXY(el, aCoord);\r
+        var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );\r
+        var newTop  = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );\r
+\r
+        this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];\r
+\r
+        // this.logger.log("css X: " + YAHOO.util.Dom.getStyle(el, "left"));\r
+        // this.logger.log("css Y: " + YAHOO.util.Dom.getStyle(el, "top"));\r
+        // this.logger.log("deltaSetXY: " + this.deltaSetXY);\r
+    } else {\r
+        YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");\r
+        YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");\r
+    }\r
+    \r
+\r
+    this.cachePosition(oCoord.x, oCoord.y);\r
+\r
+    this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);\r
+};\r
+\r
+/**\r
+ * Saves the most recent position so that we can reset the constraints and\r
+ * tick marks on-demand.  We need to know this so that we can calculate the\r
+ * number of pixels the element is offset from its original position.\r
+ */\r
+YAHOO.util.DD.prototype.cachePosition = function(iPageX, iPageY) {\r
+    if (iPageX) {\r
+        this.lastPageX = iPageX;\r
+        this.lastPageY = iPageY;\r
+    } else {\r
+        var aCoord = YAHOO.util.Dom.getXY(this.getEl());\r
+        this.lastPageX = aCoord[0];\r
+        this.lastPageY = aCoord[1];\r
+    }\r
+};\r
+\r
+/**\r
+ * Auto-scroll the window if the dragged object has been moved beyond the \r
+ * visible window boundary.\r
+ *\r
+ * @param {int} x the drag element's x position\r
+ * @param {int} y the drag element's y position\r
+ * @param {int} h the height of the drag element\r
+ * @param {int} w the width of the drag element\r
+ * @private\r
+ */\r
+YAHOO.util.DD.prototype.autoScroll = function(x, y, h, w) {\r
+\r
+    if (this.scroll) {\r
+        // The client height\r
+        var clientH = this.DDM.getClientHeight();\r
+\r
+        // The client width\r
+        var clientW = this.DDM.getClientWidth();\r
+\r
+        // The amt scrolled down\r
+        var st = this.DDM.getScrollTop();\r
+\r
+        // The amt scrolled right\r
+        var sl = this.DDM.getScrollLeft();\r
+\r
+        // Location of the bottom of the element\r
+        var bot = h + y;\r
+\r
+        // Location of the right of the element\r
+        var right = w + x;\r
+\r
+        // The distance from the cursor to the bottom of the visible area, \r
+        // adjusted so that we don't scroll if the cursor is beyond the\r
+        // element drag constraints\r
+        var toBot = (clientH + st - y - this.deltaY);\r
+\r
+        // The distance from the cursor to the right of the visible area\r
+        var toRight = (clientW + sl - x - this.deltaX);\r
+\r
+        // this.logger.log( " x: " + x + " y: " + y + " h: " + h + \r
+        // " clientH: " + clientH + " clientW: " + clientW + \r
+        // " st: " + st + " sl: " + sl + " bot: " + bot + \r
+        // " right: " + right + " toBot: " + toBot + " toRight: " + toRight);\r
+\r
+        // How close to the edge the cursor must be before we scroll\r
+        // var thresh = (document.all) ? 100 : 40;\r
+        var thresh = 40;\r
+\r
+        // How many pixels to scroll per autoscroll op.  This helps to reduce \r
+        // clunky scrolling. IE is more sensitive about this ... it needs this \r
+        // value to be higher.\r
+        var scrAmt = (document.all) ? 80 : 30;\r
+\r
+        // Scroll down if we are near the bottom of the visible page and the \r
+        // obj extends below the crease\r
+        if ( bot > clientH && toBot < thresh ) { \r
+            window.scrollTo(sl, st + scrAmt); \r
+        }\r
+\r
+        // Scroll up if the window is scrolled down and the top of the object\r
+        // goes above the top border\r
+        if ( y < st && st > 0 && y - st < thresh ) { \r
+            window.scrollTo(sl, st - scrAmt); \r
+        }\r
+\r
+        // Scroll right if the obj is beyond the right border and the cursor is\r
+        // near the border.\r
+        if ( right > clientW && toRight < thresh ) { \r
+            window.scrollTo(sl + scrAmt, st); \r
+        }\r
+\r
+        // Scroll left if the window has been scrolled to the right and the obj\r
+        // extends past the left border\r
+        if ( x < sl && sl > 0 && x - sl < thresh ) { \r
+            window.scrollTo(sl - scrAmt, st);\r
+        }\r
+    }\r
+};\r
+\r
+/**\r
+ * Finds the location the element should be placed if we want to move\r
+ * it to where the mouse location less the click offset would place us.\r
+ *\r
+ * @param {int} iPageX the X coordinate of the click\r
+ * @param {int} iPageY the Y coordinate of the click\r
+ * @return an object that contains the coordinates (Object.x and Object.y)\r
+ * @private\r
+ */\r
+YAHOO.util.DD.prototype.getTargetCoord = function(iPageX, iPageY) {\r
+\r
+    // this.logger.log("getTargetCoord: " + iPageX + ", " + iPageY);\r
+\r
+    var x = iPageX - this.deltaX;\r
+    var y = iPageY - this.deltaY;\r
+\r
+    if (this.constrainX) {\r
+        if (x < this.minX) { x = this.minX; }\r
+        if (x > this.maxX) { x = this.maxX; }\r
+    }\r
+\r
+    if (this.constrainY) {\r
+        if (y < this.minY) { y = this.minY; }\r
+        if (y > this.maxY) { y = this.maxY; }\r
+    }\r
+\r
+    x = this.getTick(x, this.xTicks);\r
+    y = this.getTick(y, this.yTicks);\r
+\r
+    // this.logger.log("getTargetCoord " + \r
+            // " iPageX: " + iPageX +\r
+            // " iPageY: " + iPageY +\r
+            // " x: " + x + ", y: " + y);\r
+\r
+    return {x:x, y:y};\r
+};\r
+\r
+YAHOO.util.DD.prototype.applyConfig = function() {\r
+    YAHOO.util.DD.superclass.applyConfig.call(this);\r
+    this.scroll = (this.config.scroll !== false);\r
+};\r
+\r
+/** \r
+ * Event that fires prior to the onMouseDown event.  Overrides \r
+ * YAHOO.util.DragDrop.\r
+ */\r
+YAHOO.util.DD.prototype.b4MouseDown = function(e) {\r
+    // this.resetConstraints();\r
+    this.autoOffset(YAHOO.util.Event.getPageX(e), \r
+                        YAHOO.util.Event.getPageY(e));\r
+};\r
+\r
+/** \r
+ * Event that fires prior to the onDrag event.  Overrides \r
+ * YAHOO.util.DragDrop.\r
+ */\r
+YAHOO.util.DD.prototype.b4Drag = function(e) {\r
+    this.setDragElPos(YAHOO.util.Event.getPageX(e), \r
+                        YAHOO.util.Event.getPageY(e));\r
+};\r
+\r
+YAHOO.util.DD.prototype.toString = function() {\r
+    return ("DD " + this.id);\r
+};\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+// Debugging ygDragDrop events that can be overridden\r
+///////////////////////////////////////////////////////////////////////////////\r
+/*\r
+YAHOO.util.DD.prototype.startDrag = function(x, y) {\r
+    this.logger.log(this.id.toString()  + " startDrag");\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDrag = function(e) {\r
+    this.logger.log(this.id.toString() + " onDrag");\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragEnter = function(e, id) {\r
+    this.logger.log(this.id.toString() + " onDragEnter: " + id);\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragOver = function(e, id) {\r
+    this.logger.log(this.id.toString() + " onDragOver: " + id);\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragOut = function(e, id) {\r
+    this.logger.log(this.id.toString() + " onDragOut: " + id);\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragDrop = function(e, id) {\r
+    this.logger.log(this.id.toString() + " onDragDrop: " + id);\r
+};\r
+\r
+YAHOO.util.DD.prototype.endDrag = function(e) {\r
+    this.logger.log(this.id.toString() + " endDrag");\r
+};\r
+*/\r
+\r
+/**\r
+ * A DragDrop implementation that inserts an empty, bordered div into\r
+ * the document that follows the cursor during drag operations.  At the time of\r
+ * the click, the frame div is resized to the dimensions of the linked html\r
+ * element, and moved to the exact location of the linked element.\r
+ *\r
+ * References to the "frame" element refer to the single proxy element that\r
+ * was created to be dragged in place of all DDProxy elements on the\r
+ * page.\r
+ *\r
+ * @extends YAHOO.util.DD\r
+ * @constructor\r
+ * @param {String} id the id of the linked html element\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DDProxy in addition to those in DragDrop: \r
+ *                   resizeFrame, centerFrame, dragElId\r
+ */\r
+YAHOO.util.DDProxy = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config);\r
+        this.initFrame(); \r
+    }\r
+};\r
+\r
+YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD);\r
+\r
+/**\r
+ * The default drag frame div id\r
+ * @type String\r
+ */\r
+YAHOO.util.DDProxy.dragElId = "ygddfdiv";\r
+\r
+/**\r
+ * By default we resize the drag frame to be the same size as the element\r
+ * we want to drag (this is to get the frame effect).  We can turn it off\r
+ * if we want a different behavior.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DDProxy.prototype.resizeFrame = true;\r
+\r
+/**\r
+ * By default the frame is positioned exactly where the drag element is, so\r
+ * we use the cursor offset provided by YAHOO.util.DD.  Another option that works only if\r
+ * you do not have constraints on the obj is to have the drag frame centered\r
+ * around the cursor.  Set centerFrame to true for this effect.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DDProxy.prototype.centerFrame = false;\r
+\r
+/**\r
+ * Previous proxy element size.\r
+ * @private\r
+ */\r
+YAHOO.util.DDProxy.prototype._previousSize = [-1, -1];\r
+\r
+/**\r
+ * Create the drag frame if needed\r
+ */\r
+YAHOO.util.DDProxy.prototype.createFrame = function() {\r
+    var self = this;\r
+    var body = document.body;\r
+\r
+    if (!body || !body.firstChild) {\r
+        setTimeout( function() { self.createFrame(); }, 50 );\r
+        return;\r
+    }\r
+\r
+    var div = this.getDragEl();\r
+\r
+    if (!div) {\r
+        div    = document.createElement("div");\r
+        div.id = this.dragElId;\r
+        var s  = div.style;\r
+\r
+        s.position   = "absolute";\r
+        s.visibility = "hidden";\r
+        s.cursor     = "move";\r
+        s.border     = "2px solid #aaa";\r
+        s.zIndex     = 999;\r
+\r
+        // appendChild can blow up IE if invoked prior to the window load event\r
+        // while rendering a table.  It is possible there are other scenarios \r
+        // that would cause this to happen as well.\r
+        body.insertBefore(div, body.firstChild);\r
+    }\r
+};\r
+\r
+/**\r
+ * Initialization for the drag frame element.  Must be called in the\r
+ * constructor of all subclasses\r
+ */\r
+YAHOO.util.DDProxy.prototype.initFrame = function() {\r
+    // YAHOO.util.DDProxy.createFrame();\r
+    // this.setDragElId(YAHOO.util.DDProxy.dragElId);\r
+\r
+    this.createFrame();\r
+\r
+};\r
+\r
+YAHOO.util.DDProxy.prototype.applyConfig = function() {\r
+    this.logger.log("DDProxy applyConfig");\r
+    YAHOO.util.DDProxy.superclass.applyConfig.call(this);\r
+\r
+    this.resizeFrame = (this.config.resizeFrame !== false);\r
+    this.centerFrame = (this.config.centerFrame);\r
+    this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);\r
+\r
+    //this.logger.log("dragElId: " + this.dragElId);\r
+};\r
+\r
+/**\r
+ * Resizes the drag frame to the dimensions of the clicked object, positions \r
+ * it over the object, and finally displays it\r
+ *\r
+ * @param {int} iPageX X click position\r
+ * @param {int} iPageY Y click position\r
+ * @private\r
+ */\r
+YAHOO.util.DDProxy.prototype.showFrame = function(iPageX, iPageY) {\r
+    var el = this.getEl();\r
+    var dragEl = this.getDragEl();\r
+    var s = dragEl.style;\r
+\r
+    this._resizeProxy();\r
+\r
+    if (this.centerFrame) {\r
+        this.setDelta( Math.round(parseInt(s.width,  10)/2), \r
+                       Math.round(parseInt(s.height, 10)/2) );\r
+    }\r
+\r
+    this.setDragElPos(iPageX, iPageY);\r
+\r
+    // s.visibility = "";\r
+    YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); \r
+};\r
+\r
+YAHOO.util.DDProxy.prototype._resizeProxy = function() {\r
+    var DOM    = YAHOO.util.Dom;\r
+    var el     = this.getEl();\r
+    var dragEl = this.getDragEl();\r
+\r
+    if (this.resizeFrame) {\r
+        var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth"    ), 10);\r
+        var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth"  ), 10);\r
+        var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);\r
+        var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth"   ), 10);\r
+\r
+        if (isNaN(bt)) { bt = 0; }\r
+        if (isNaN(br)) { br = 0; }\r
+        if (isNaN(bb)) { bb = 0; }\r
+        if (isNaN(bl)) { bl = 0; }\r
+\r
+        this.logger.log("proxy size: " + bt + "  " + br + " " + bb + " " + bl);\r
+\r
+        var newWidth  = el.offsetWidth - br - bl;\r
+        var newHeight = el.offsetHeight - bt - bb;\r
+\r
+        if (this._previousSize[0] !== newWidth && \r
+                        this._previousSize[1] !== newHeight) {\r
+\r
+            this.logger.log("Resizing proxy element");\r
+\r
+            DOM.setStyle( dragEl, "width",  newWidth  + "px" );\r
+            DOM.setStyle( dragEl, "height", newHeight + "px" );\r
+\r
+            this._previousSize = [newWidth, newHeight];\r
+        }\r
+    }\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4MouseDown = function(e) {\r
+    var x = YAHOO.util.Event.getPageX(e);\r
+    var y = YAHOO.util.Event.getPageY(e);\r
+    this.autoOffset(x, y);\r
+    this.setDragElPos(x, y);\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4StartDrag = function(x, y) {\r
+    // show the drag frame\r
+    this.logger.log("start drag show frame, x: " + x + ", y: " + y);\r
+    this.showFrame(x, y);\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4EndDrag = function(e) {\r
+    this.logger.log(this.id + " b4EndDrag");\r
+    YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); \r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+// By default we try to move the element to the last location of the frame.  \r
+// This is so that the default behavior mirrors that of YAHOO.util.DD.  \r
+YAHOO.util.DDProxy.prototype.endDrag = function(e) {\r
+    var DOM = YAHOO.util.Dom;\r
+    this.logger.log(this.id + " endDrag");\r
+    var lel = this.getEl();\r
+    var del = this.getDragEl();\r
+\r
+    // Show the drag frame briefly so we can get its position\r
+    // del.style.visibility = "";\r
+    DOM.setStyle(del, "visibility", ""); \r
+\r
+    // Hide the linked element before the move to get around a Safari \r
+    // rendering bug.\r
+    //lel.style.visibility = "hidden";\r
+    DOM.setStyle(lel, "visibility", "hidden"); \r
+    YAHOO.util.DDM.moveToEl(lel, del);\r
+    //del.style.visibility = "hidden";\r
+    DOM.setStyle(del, "visibility", "hidden"); \r
+    //lel.style.visibility = "";\r
+    DOM.setStyle(lel, "visibility", ""); \r
+};\r
+\r
+YAHOO.util.DDProxy.prototype.toString = function() {\r
+    return ("DDProxy " + this.id);\r
+};\r
+\r
+/**\r
+ * A DragDrop implementation that does not move, but can be a drop \r
+ * target.  You would get the same result by simply omitting implementation \r
+ * for the event callbacks, but this way we reduce the processing cost of the \r
+ * event listener and the callbacks.\r
+ *\r
+ * @extends YAHOO.util.DragDrop \r
+ * @constructor\r
+ * @param {String} id the id of the element that is a drop target\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DDTarget in addition to those in DragDrop: \r
+ *                  none\r
+ */\r
\r
+YAHOO.util.DDTarget = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.initTarget(id, sGroup, config);\r
+    }\r
+};\r
+\r
+// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop);\r
+\r
+YAHOO.util.DDTarget.prototype.toString = function() {\r
+    return ("DDTarget " + this.id);\r
+};\r
+\r
diff --git a/lib/yui/dragdrop/dragdrop-min.js b/lib/yui/dragdrop/dragdrop-min.js
new file mode 100755 (executable)
index 0000000..4d5c7e6
--- /dev/null
@@ -0,0 +1 @@
+/*                                                                                                                                                      Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    Code licensed under the BSD License:                                                                                                                    http://developer.yahoo.net/yui/license.txt                                                                                                              version: 0.11.0                                                                                                                                         */ YAHOO.util.DragDrop=function(id,_2,_3){if(id){this.init(id,_2,_3);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=YAHOO.util.Dom.get(this.id);}return this._domRef;},getDragEl:function(){return YAHOO.util.Dom.get(this.dragElId);},init:function(id,_7,_8){this.initTarget(id,_7,_8);YAHOO.util.Event.addListener(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,_9,_10){this.config=_10||{};this.DDM=YAHOO.util.DDM;this.groups={};this.id=id;this.addToGroup((_9)?_9:"default");this.handleElId=id;YAHOO.util.Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(_11,_12,_13,_14){if(!_12&&0!==_12){this.padding=[_11,_11,_11,_11];}else{if(!_13&&0!==_13){this.padding=[_11,_12,_11,_12];}else{this.padding=[_11,_12,_13,_14];}}},setInitPosition:function(_15,_16){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=_15||0;var dy=_16||0;var p=YAHOO.util.Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.deltaSetXY=null;this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||YAHOO.util.Dom.getXY(this.getEl());this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(_22){this.groups[_22]=true;this.DDM.regDragDrop(this,_22);},removeFromGroup:function(_23){if(this.groups[_23]){delete this.groups[_23];}this.DDM.removeDDFromGroup(this,_23);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){YAHOO.util.Event.addListener(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);},unreg:function(){YAHOO.util.Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var EU=YAHOO.util.Event;var _26=e.which||e.button;if(this.primaryButtonOnly&&_26>1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(EU.getPageX(e),EU.getPageY(e));if(this.DDM.isOverTarget(pt,this)){var _28=EU.getTarget(e);if(this.isValidHandleChild(_28)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_28,this.id))){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}}},addInvalidHandleType:function(_29){var _30=_29.toUpperCase();this.invalidHandleTypes[_30]=_30;},addInvalidHandleId:function(id){this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_31){this.invalidHandleClasses.push(_31);},removeInvalidHandleType:function(_32){var _33=_32.toUpperCase();delete this.invalidHandleTypes[_33];},removeInvalidHandleId:function(id){delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_34){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==_34){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(_36){var _37=true;var _38;try{_38=_36.nodeName.toUpperCase();}catch(e){_38=_36.nodeName;}_37=_37&&!this.invalidHandleTypes[_38];_37=_37&&!this.invalidHandleIds[_36.id];for(var i=0,len=this.invalidHandleClasses.length;_37&&i<len;++i){_37=!YAHOO.util.Dom.hasClass(_36,this.invalidHandleClasses[i]);}return _37;},setXTicks:function(_39,_40){this.xTicks=[];this.xTickSize=_40;var _41={};for(var i=this.initPageX;i>=this.minX;i=i-_40){if(!_41[i]){this.xTicks[this.xTicks.length]=i;_41[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_40){if(!_41[i]){this.xTicks[this.xTicks.length]=i;_41[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_42,_43){this.yTicks=[];this.yTickSize=_43;var _44={};for(var i=this.initPageY;i>=this.minY;i=i-_43){if(!_44[i]){this.yTicks[this.yTicks.length]=i;_44[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_43){if(!_44[i]){this.yTicks[this.yTicks.length]=i;_44[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_45,_46,_47){this.leftConstraint=_45;this.rightConstraint=_46;this.minX=this.initPageX-_45;this.maxX=this.initPageX+_46;if(_47){this.setXTicks(this.initPageX,_47);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_49,_50){this.topConstraint=iUp;this.bottomConstraint=_49;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_49;if(_50){this.setYTicks(this.initPageY,_50);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_52){if(!_52){return val;}else{if(_52[0]>=val){return _52[0];}else{for(var i=0,len=_52.length;i<len;++i){var _53=i+1;if(_52[_53]&&_52[_53]>=val){var _54=val-_52[i];var _55=_52[_53]-val;return (_55>_54)?_52[i]:_52[_53];}}return _52[_52.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=new function(){this.ids={};this.handleIds={};this.dragCurrent=null;this.dragOvers={};this.deltaX=0;this.deltaY=0;this.preventDefault=true;this.stopPropagation=true;this.initalized=false;this.locked=false;this.init=function(){this.initialized=true;};this.POINT=0;this.INTERSECT=1;this.mode=this.POINT;this._execOnAll=function(_56,_57){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_56].apply(oDD,_57);}}};this._onLoad=function(){this.init();var EU=YAHOO.util.Event;EU.on(document,"mouseup",this.handleMouseUp,this,true);EU.on(document,"mousemove",this.handleMouseMove,this,true);EU.on(window,"unload",this._onUnload,this,true);EU.on(window,"resize",this._onResize,this,true);};this._onResize=function(e){this._execOnAll("resetConstraints",[]);};this.lock=function(){this.locked=true;};this.unlock=function(){this.locked=false;};this.isLocked=function(){return this.locked;};this.locationCache={};this.useCache=true;this.clickPixelThresh=3;this.clickTimeThresh=1000;this.dragThreshMet=false;this.clickTimeout=null;this.startX=0;this.startY=0;this.regDragDrop=function(oDD,_59){if(!this.initialized){this.init();}if(!this.ids[_59]){this.ids[_59]={};}this.ids[_59][oDD.id]=oDD;};this.removeDDFromGroup=function(oDD,_60){if(!this.ids[_60]){this.ids[_60]={};}var obj=this.ids[_60];if(obj&&obj[oDD.id]){delete obj[oDD.id];}};this._remove=function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];};this.regHandle=function(_63,_64){if(!this.handleIds[_63]){this.handleIds[_63]={};}this.handleIds[_63][_64]=_64;};this.isDragDrop=function(id){return (this.getDDById(id))?true:false;};this.getRelated=function(_65,_66){var _67=[];for(var i in _65.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_66||dd.isTarget){_67[_67.length]=dd;}}}return _67;};this.isLegalTarget=function(oDD,_69){var _70=this.getRelated(oDD,true);for(var i=0,len=_70.length;i<len;++i){if(_70[i].id==_69.id){return true;}}return false;};this.isTypeOfDD=function(oDD){return (oDD&&oDD.__ygDragDrop);};this.isHandle=function(_71,_72){return (this.handleIds[_71]&&this.handleIds[_71][_72]);};this.getDDById=function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;};this.handleMouseDown=function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);};this.startDrag=function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}this.dragThreshMet=true;};this.handleMouseUp=function(e){if(!this.dragCurrent){return;}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}this.stopDrag(e);this.stopEvent(e);};this.stopEvent=function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}};this.stopDrag=function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}this.dragCurrent.onMouseUp(e);}this.dragCurrent=null;this.dragOvers={};};this.handleMouseMove=function(e){if(!this.dragCurrent){return false;}if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var _74=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var _75=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(_74>this.clickPixelThresh||_75>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;};this.fireEvents=function(e,_76){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _78=[];var _79=[];var _80=[];var _81=[];var _82=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_79.push(ddo);}_78[i]=true;delete this.dragOvers[i];}for(var _84 in dc.groups){if("string"!=typeof _84){continue;}for(i in this.ids[_84]){var oDD=this.ids[_84][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_76){_81.push(oDD);}else{if(!_78[oDD.id]){_82.push(oDD);}else{_80.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_79.length){dc.b4DragOut(e,_79);dc.onDragOut(e,_79);}if(_82.length){dc.onDragEnter(e,_82);}if(_80.length){dc.b4DragOver(e,_80);dc.onDragOver(e,_80);}if(_81.length){dc.b4DragDrop(e,_81);dc.onDragDrop(e,_81);}}else{var len=0;for(i=0,len=_79.length;i<len;++i){dc.b4DragOut(e,_79[i].id);dc.onDragOut(e,_79[i].id);}for(i=0,len=_82.length;i<len;++i){dc.onDragEnter(e,_82[i].id);}for(i=0,len=_80.length;i<len;++i){dc.b4DragOver(e,_80[i].id);dc.onDragOver(e,_80[i].id);}for(i=0,len=_81.length;i<len;++i){dc.b4DragDrop(e,_81[i].id);dc.onDragDrop(e,_81[i].id);}}};this.getBestMatch=function(dds){var _87=null;var len=dds.length;if(len==1){_87=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(dd.cursorIsOver){_87=dd;break;}else{if(!_87||_87.overlap.getArea()<dd.overlap.getArea()){_87=dd;}}}}return _87;};this.refreshCache=function(_88){for(sGroup in _88){if("string"!=typeof sGroup){continue;}for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}};this.verifyEl=function(el){try{if(el){var _90=el.offsetParent;if(_90){return true;}}}catch(e){}return false;};this.getLocation=function(oDD){if(!this.isTypeOfDD(oDD)){return null;}var el=oDD.getEl();var _91=null;try{_91=YAHOO.util.Dom.getXY(el);}catch(e){}if(!_91){return null;}x1=_91[0];x2=x1+el.offsetWidth;y1=_91[1];y2=y1+el.offsetHeight;var t=y1-oDD.padding[0];var r=x2+oDD.padding[1];var b=y2+oDD.padding[2];var l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);};this.isOverTarget=function(pt,_96,_97){var loc=this.locationCache[_96.id];if(!loc||!this.useCache){loc=this.getLocation(_96);this.locationCache[_96.id]=loc;}if(!loc){return false;}_96.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||(!_97&&!dc.constrainX&&!dc.constrainY)){return _96.cursorIsOver;}_96.overlap=null;var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var _98=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var _99=_98.intersect(loc);if(_99){_96.overlap=_99;return (_97)?true:_96.cursorIsOver;}else{return false;}};this._onUnload=function(e,me){this.unregAll();};this.unregAll=function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}this.elementCache={};this.ids={};};this.elementCache={};this.getElWrapper=function(id){var _101=this.elementCache[id];if(!_101||!_101.el){_101=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}return _101;};this.getElement=function(id){return YAHOO.util.Dom.get(id);};this.getCss=function(id){var el=YAHOO.util.Dom.get(id);return (el)?el.style:null;};this.ElementWrapper=function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;};this.getPosX=function(el){return YAHOO.util.Dom.getX(el);};this.getPosY=function(el){return YAHOO.util.Dom.getY(el);};this.swapNode=function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}};this.getScroll=function(){var t,l;if(document.documentElement&&document.documentElement.scrollTop){t=document.documentElement.scrollTop;l=document.documentElement.scrollLeft;}else{if(document.body){t=document.body.scrollTop;l=document.body.scrollLeft;}}return {top:t,left:l};};this.getStyle=function(el,_105){return YAHOO.util.Dom.getStyle(el,_105);};this.getScrollTop=function(){return this.getScroll().top;};this.getScrollLeft=function(){return this.getScroll().left;};this.moveToEl=function(_106,_107){var _108=YAHOO.util.Dom.getXY(_107);YAHOO.util.Dom.setXY(_106,_108);};this.getClientHeight=function(){return YAHOO.util.Dom.getClientHeight();};this.getClientWidth=function(){return YAHOO.util.Dom.getClientWidth();};this.numericSort=function(a,b){return (a-b);};this._timeoutCount=0;this._addListeners=function(){if(YAHOO.util.Event&&document){this._onLoad();}else{if(this._timeoutCount>1000){}else{var DDM=YAHOO.util.DDM;setTimeout(function(){DDM._addListeners();},10);if(document&&document.body){this._timeoutCount+=1;}}}};this.handleWasClicked=function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_111,_112){if(id){this.init(id,_111,_112);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop);YAHOO.util.DD.prototype.scroll=true;YAHOO.util.DD.prototype.autoOffset=function(_113,_114){var x=_113-this.startPageX;var y=_114-this.startPageY;this.setDelta(x,y);};YAHOO.util.DD.prototype.setDelta=function(_115,_116){this.deltaX=_115;this.deltaY=_116;};YAHOO.util.DD.prototype.setDragElPos=function(_117,_118){var el=this.getDragEl();this.alignElWithMouse(el,_117,_118);};YAHOO.util.DD.prototype.alignElWithMouse=function(el,_119,_120){var _121=this.getTargetCoord(_119,_120);if(!this.deltaSetXY){var _122=[_121.x,_121.y];YAHOO.util.Dom.setXY(el,_122);var _123=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _124=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_123-_121.x,_124-_121.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_121.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_121.y+this.deltaSetXY[1])+"px");}this.cachePosition(_121.x,_121.y);this.autoScroll(_121.x,_121.y,el.offsetHeight,el.offsetWidth);};YAHOO.util.DD.prototype.cachePosition=function(_125,_126){if(_125){this.lastPageX=_125;this.lastPageY=_126;}else{var _127=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_127[0];this.lastPageY=_127[1];}};YAHOO.util.DD.prototype.autoScroll=function(x,y,h,w){if(this.scroll){var _130=this.DDM.getClientHeight();var _131=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _135=w+x;var _136=(_130+st-y-this.deltaY);var _137=(_131+sl-x-this.deltaX);var _138=40;var _139=(document.all)?80:30;if(bot>_130&&_136<_138){window.scrollTo(sl,st+_139);}if(y<st&&st>0&&y-st<_138){window.scrollTo(sl,st-_139);}if(_135>_131&&_137<_138){window.scrollTo(sl+_139,st);}if(x<sl&&sl>0&&x-sl<_138){window.scrollTo(sl-_139,st);}}};YAHOO.util.DD.prototype.getTargetCoord=function(_140,_141){var x=_140-this.deltaX;var y=_141-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};};YAHOO.util.DD.prototype.applyConfig=function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);};YAHOO.util.DD.prototype.b4MouseDown=function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DD.prototype.b4Drag=function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DD.prototype.toString=function(){return ("DD "+this.id);};YAHOO.util.DDProxy=function(id,_142,_143){if(id){this.init(id,_142,_143);this.initFrame();}};YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD);YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.util.DDProxy.prototype.resizeFrame=true;YAHOO.util.DDProxy.prototype.centerFrame=false;YAHOO.util.DDProxy.prototype._previousSize=[-1,-1];YAHOO.util.DDProxy.prototype.createFrame=function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}};YAHOO.util.DDProxy.prototype.initFrame=function(){this.createFrame();};YAHOO.util.DDProxy.prototype.applyConfig=function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);};YAHOO.util.DDProxy.prototype.showFrame=function(_147,_148){var el=this.getEl();var _149=this.getDragEl();var s=_149.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_147,_148);YAHOO.util.Dom.setStyle(_149,"visibility","visible");};YAHOO.util.DDProxy.prototype._resizeProxy=function(){var DOM=YAHOO.util.Dom;var el=this.getEl();var _151=this.getDragEl();if(this.resizeFrame){var bt=parseInt(DOM.getStyle(_151,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_151,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_151,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_151,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _156=el.offsetWidth-br-bl;var _157=el.offsetHeight-bt-bb;if(this._previousSize[0]!==_156&&this._previousSize[1]!==_157){DOM.setStyle(_151,"width",_156+"px");DOM.setStyle(_151,"height",_157+"px");this._previousSize=[_156,_157];}}};YAHOO.util.DDProxy.prototype.b4MouseDown=function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);};YAHOO.util.DDProxy.prototype.b4StartDrag=function(x,y){this.showFrame(x,y);};YAHOO.util.DDProxy.prototype.b4EndDrag=function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");};YAHOO.util.DDProxy.prototype.endDrag=function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");};YAHOO.util.DDProxy.prototype.toString=function(){return ("DDProxy "+this.id);};YAHOO.util.DDTarget=function(id,_160,_161){if(id){this.initTarget(id,_160,_161);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop);YAHOO.util.DDTarget.prototype.toString=function(){return ("DDTarget "+this.id);};
\ No newline at end of file
diff --git a/lib/yui/dragdrop/dragdrop.js b/lib/yui/dragdrop/dragdrop.js
new file mode 100755 (executable)
index 0000000..100de45
--- /dev/null
@@ -0,0 +1,2711 @@
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * Defines the interface and base operation of items that that can be \r
+ * dragged or can be drop targets.  It was designed to be extended, overriding\r
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.\r
+ * Up to three html elements can be associated with a DragDrop instance:\r
+ * <ul>\r
+ * <li>linked element: the element that is passed into the constructor.\r
+ * This is the element which defines the boundaries for interaction with \r
+ * other DragDrop objects.</li>\r
+ * <li>handle element(s): The drag operation only occurs if the element that \r
+ * was clicked matches a handle element.  By default this is the linked \r
+ * element, but there are times that you will want only a portion of the \r
+ * linked element to initiate the drag operation, and the setHandleElId() \r
+ * method provides a way to define this.</li>\r
+ * <li>drag element: this represents an the element that would be moved along\r
+ * with the cursor during a drag operation.  By default, this is the linked\r
+ * element itself as in {@link YAHOO.util.DD}.  setDragElId() lets you define\r
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}\r
+ * </li>\r
+ * </ul>\r
+ * This class should not be instantiated until the onload event to ensure that\r
+ * the associated elements are available.\r
+ * The following would define a DragDrop obj that would interact with any \r
+ * other * DragDrop obj in the "group1" group:\r
+ * <pre>\r
+ *  dd = new YAHOO.util.DragDrop("div1", "group1");\r
+ * </pre>\r
+ * Since none of the event handlers have been implemented, nothing would \r
+ * actually happen if you were to run the code above.  Normally you would \r
+ * override this class or one of the default implementations, but you can \r
+ * also override the methods you want on an instance of the class...\r
+ * <pre>\r
+ *  dd.onDragDrop = function(e, id) {\r
+ *   alert("dd was dropped on " + id);\r
+ *  }\r
+ * </pre>\r
+ * @constructor\r
+ * @param {String} id of the element that is linked to this instance\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DragDrop: \r
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly\r
+ */\r
+YAHOO.util.DragDrop = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config); \r
+    }\r
+};\r
+\r
+YAHOO.util.DragDrop.prototype = {\r
+\r
+    /**\r
+     * The id of the element associated with this object.  This is what we \r
+     * refer to as the "linked element" because the size and position of \r
+     * this element is used to determine when the drag and drop objects have \r
+     * interacted.\r
+     *\r
+     * @type String\r
+     */\r
+    id: null,\r
+\r
+    /**\r
+     * Configuration attributes passed into the constructor\r
+     * @type object\r
+     */\r
+    config: null,\r
+\r
+    /**\r
+     * The id of the element that will be dragged.  By default this is same \r
+     * as the linked element , but could be changed to another element. Ex: \r
+     * YAHOO.util.DDProxy\r
+     *\r
+     * @type String\r
+     * @private\r
+     */\r
+    dragElId: null, \r
+\r
+    /**\r
+     * the id of the element that initiates the drag operation.  By default \r
+     * this is the linked element, but could be changed to be a child of this\r
+     * element.  This lets us do things like only starting the drag when the \r
+     * header element within the linked html element is clicked.\r
+     *\r
+     * @type String\r
+     * @private\r
+     */\r
+    handleElId: null, \r
+\r
+    /**\r
+     * An associative array of HTML tags that will be ignored if clicked.\r
+     * @type {string: string}\r
+     */\r
+    invalidHandleTypes: null, \r
+\r
+    /**\r
+     * An associative array of ids for elements that will be ignored if clicked\r
+     * @type {string: string}\r
+     */\r
+    invalidHandleIds: null, \r
+\r
+    /**\r
+     * An indexted array of css class names for elements that will be ignored\r
+     * if clicked.\r
+     * @type string[]\r
+     */\r
+    invalidHandleClasses: null, \r
+\r
+    /**\r
+     * The linked element's absolute X position at the time the drag was \r
+     * started\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    startPageX: 0,\r
+\r
+    /**\r
+     * The linked element's absolute X position at the time the drag was \r
+     * started\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    startPageY: 0,\r
+\r
+    /**\r
+     * The group defines a logical collection of DragDrop objects that are \r
+     * related.  Instances only get events when interacting with other \r
+     * DragDrop object in the same group.  This lets us define multiple \r
+     * groups using a single DragDrop subclass if we want.\r
+     * @type {string: string}\r
+     */\r
+    groups: null,\r
+\r
+    /**\r
+     * Individual drag/drop instances can be locked.  This will prevent \r
+     * onmousedown start drag.\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    locked: false,\r
+\r
+    /**\r
+     * Lock this instance\r
+     */\r
+    lock: function() { this.locked = true; },\r
+\r
+    /**\r
+     * Unlock this instace\r
+     */\r
+    unlock: function() { this.locked = false; },\r
+\r
+    /**\r
+     * By default, all insances can be a drop target.  This can be disabled by\r
+     * setting isTarget to false.\r
+     *\r
+     * @type boolean\r
+     */\r
+    isTarget: true,\r
+\r
+    /**\r
+     * The padding configured for this drag and drop object for calculating\r
+     * the drop zone intersection with this object.\r
+     * @type int[]\r
+     */\r
+    padding: null,\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    _domRef: null,\r
+\r
+    /**\r
+     * Internal typeof flag\r
+     * @private\r
+     */\r
+    __ygDragDrop: true,\r
+\r
+    /**\r
+     * Set to true when horizontal contraints are applied\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    constrainX: false,\r
+\r
+    /**\r
+     * Set to true when vertical contraints are applied\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    constrainY: false,\r
+\r
+    /**\r
+     * The left constraint\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    minX: 0,\r
+\r
+    /**\r
+     * The right constraint\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    maxX: 0,\r
+\r
+    /**\r
+     * The up constraint \r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    minY: 0,\r
+\r
+    /**\r
+     * The down constraint \r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    maxY: 0,\r
+\r
+    /**\r
+     * Maintain offsets when we resetconstraints.  Used to maintain the \r
+     * slider thumb value, and this needs to be fixed.\r
+     * @type boolean\r
+     */\r
+    maintainOffset: false,\r
+\r
+    /**\r
+     * Array of pixel locations the element will snap to if we specified a \r
+     * horizontal graduation/interval.  This array is generated automatically\r
+     * when you define a tick interval.\r
+     * @type int[]\r
+     */\r
+    xTicks: null,\r
+\r
+    /**\r
+     * Array of pixel locations the element will snap to if we specified a \r
+     * vertical graduation/interval.  This array is generated automatically \r
+     * when you define a tick interval.\r
+     * @type int[]\r
+     */\r
+    yTicks: null,\r
+\r
+    /**\r
+     * By default the drag and drop instance will only respond to the primary\r
+     * button click (left button for a right-handed mouse).  Set to true to\r
+     * allow drag and drop to start with any mouse click that is propogated\r
+     * by the browser\r
+     * @type boolean\r
+     */\r
+    primaryButtonOnly: true,\r
+\r
+    /**\r
+     * The availabe property is false until the linked dom element is accessible.\r
+     * @type boolean\r
+     */\r
+    available: false,\r
+\r
+    /**\r
+     * Code that executes immediately before the startDrag event\r
+     * @private\r
+     */\r
+    b4StartDrag: function(x, y) { },\r
+\r
+    /**\r
+     * Abstract method called after a drag/drop object is clicked\r
+     * and the drag or mousedown time thresholds have beeen met.\r
+     *\r
+     * @param {int} X click location\r
+     * @param {int} Y click location\r
+     */\r
+    startDrag: function(x, y) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDrag event\r
+     * @private\r
+     */\r
+    b4Drag: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called during the onMouseMove event while dragging an \r
+     * object.\r
+     *\r
+     * @param {Event} e\r
+     */\r
+    onDrag: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragEnter event\r
+     * @private\r
+     */\r
+    // b4DragEnter: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this element fist begins hovering over \r
+     * another DragDrop obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this is hovering over.  In INTERSECT mode, an array of one or more \r
+     * dragdrop items being hovered over.\r
+     */\r
+    onDragEnter: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragOver event\r
+     * @private\r
+     */\r
+    b4DragOver: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this element is hovering over another \r
+     * DragDrop obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this is hovering over.  In INTERSECT mode, an array of dd items \r
+     * being hovered over.\r
+     */\r
+    onDragOver: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragOut event\r
+     * @private\r
+     */\r
+    b4DragOut: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when we are no longer hovering over an element\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this was hovering over.  In INTERSECT mode, an array of dd items \r
+     * that the mouse is no longer over.\r
+     */\r
+    onDragOut: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the onDragDrop event\r
+     * @private\r
+     */\r
+    b4DragDrop: function(e) { },\r
+\r
+    /**\r
+     * Abstract method called when this item is dropped on another DragDrop \r
+     * obj\r
+     *\r
+     * @param {Event} e\r
+     * @param {String || YAHOO.util.DragDrop[]} id In POINT mode, the element\r
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this \r
+     * was dropped on.\r
+     */\r
+    onDragDrop: function(e, id) { /* override this */ },\r
+\r
+    /**\r
+     * Code that executes immediately before the endDrag event\r
+     * @private\r
+     */\r
+    b4EndDrag: function(e) { },\r
+\r
+    /**\r
+     * Fired when we are done dragging the object\r
+     *\r
+     * @param {Event} e\r
+     */\r
+    endDrag: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Code executed immediately before the onMouseDown event\r
+\r
+     * @param {Event} e\r
+     * @private\r
+     */\r
+    b4MouseDown: function(e) {  },\r
+\r
+    /**\r
+     * Event handler that fires when a drag/drop obj gets a mousedown\r
+     * @param {Event} e\r
+     */\r
+    onMouseDown: function(e) { /* override this */ },\r
+\r
+    /**\r
+     * Event handler that fires when a drag/drop obj gets a mouseup\r
+     * @param {Event} e\r
+     */\r
+    onMouseUp: function(e) { /* override this */ },\r
+   \r
+    /**\r
+     * Override the onAvailable method to do what is needed after the initial\r
+     * position was determined.\r
+     */\r
+    onAvailable: function () { \r
+    },\r
+\r
+    /**\r
+     * Returns a reference to the linked element\r
+     *\r
+     * @return {HTMLElement} the html element \r
+     */\r
+    getEl: function() { \r
+        if (!this._domRef) {\r
+            this._domRef = YAHOO.util.Dom.get(this.id); \r
+        }\r
+\r
+        return this._domRef;\r
+    },\r
+\r
+    /**\r
+     * Returns a reference to the actual element to drag.  By default this is\r
+     * the same as the html element, but it can be assigned to another \r
+     * element. An example of this can be found in YAHOO.util.DDProxy\r
+     *\r
+     * @return {HTMLElement} the html element \r
+     */\r
+    getDragEl: function() {\r
+        return YAHOO.util.Dom.get(this.dragElId);\r
+    },\r
+\r
+    /**\r
+     * Sets up the DragDrop object.  Must be called in the constructor of any\r
+     * YAHOO.util.DragDrop subclass\r
+     *\r
+     * @param id the id of the linked element\r
+     * @param {String} sGroup the group of related items\r
+     * @param {object} config configuration attributes\r
+     */\r
+    init: function(id, sGroup, config) {\r
+        this.initTarget(id, sGroup, config);\r
+        YAHOO.util.Event.addListener(this.id, "mousedown", \r
+                                          this.handleMouseDown, this, true);\r
+    },\r
+\r
+    /**\r
+     * Initializes Targeting functionality only... the object does not\r
+     * get a mousedown handler.\r
+     *\r
+     * @param id the id of the linked element\r
+     * @param {String} sGroup the group of related items\r
+     * @param {object} config configuration attributes\r
+     */\r
+    initTarget: function(id, sGroup, config) {\r
+\r
+        // configuration attributes \r
+        this.config = config || {};\r
+\r
+        // create a local reference to the drag and drop manager\r
+        this.DDM = YAHOO.util.DDM;\r
+        // initialize the groups array\r
+        this.groups = {};\r
+\r
+        // set the id\r
+        this.id = id;\r
+\r
+        // add to an interaction group\r
+        this.addToGroup((sGroup) ? sGroup : "default");\r
+\r
+        // We don't want to register this as the handle with the manager\r
+        // so we just set the id rather than calling the setter.\r
+        this.handleElId = id;\r
+\r
+        YAHOO.util.Event.onAvailable(id, this.handleOnAvailable, this, true);\r
+\r
+\r
+        // the linked element is the element that gets dragged by default\r
+        this.setDragElId(id); \r
+\r
+        // by default, clicked anchors will not start drag operations. \r
+        // @TODO what else should be here?  Probably form fields.\r
+        this.invalidHandleTypes = { A: "A" };\r
+        this.invalidHandleIds = {};\r
+        this.invalidHandleClasses = [];\r
+\r
+        this.applyConfig();\r
+    },\r
+\r
+    /**\r
+     * Applies the configuration parameters that were passed into the constructor.\r
+     * This is supposed to happen at each level through the inheritance chain.  So\r
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and \r
+     * DragDrop in order to get all of the parameters that are available in\r
+     * each object.\r
+     */\r
+    applyConfig: function() {\r
+\r
+        // configurable properties: \r
+        //    padding, isTarget, maintainOffset, primaryButtonOnly\r
+        this.padding           = this.config.padding || [0, 0, 0, 0];\r
+        this.isTarget          = (this.config.isTarget !== false);\r
+        this.maintainOffset    = (this.config.maintainOffset);\r
+        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);\r
+\r
+    },\r
+\r
+    /**\r
+     * Executed when the linked element is available\r
+     * @private\r
+     */\r
+    handleOnAvailable: function() {\r
+        this.available = true;\r
+        this.resetConstraints();\r
+        this.onAvailable();\r
+    },\r
+\r
+     /**\r
+     * Configures the padding for the target zone in px.  Effectively expands\r
+     * (or reduces) the virtual object size for targeting calculations.  \r
+     * Supports css-style shorthand; if only one parameter is passed, all sides\r
+     * will have that padding, and if only two are passed, the top and bottom\r
+     * will have the first param, the left and right the second.\r
+     * @param {int} iTop    Top pad\r
+     * @param {int} iRight  Right pad\r
+     * @param {int} iBot    Bot pad\r
+     * @param {int} iLeft   Left pad\r
+     */\r
+    setPadding: function(iTop, iRight, iBot, iLeft) {\r
+        // this.padding = [iLeft, iRight, iTop, iBot];\r
+        if (!iRight && 0 !== iRight) {\r
+            this.padding = [iTop, iTop, iTop, iTop];\r
+        } else if (!iBot && 0 !== iBot) {\r
+            this.padding = [iTop, iRight, iTop, iRight];\r
+        } else {\r
+            this.padding = [iTop, iRight, iBot, iLeft];\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Stores the initial placement of the dd element\r
+     */\r
+    setInitPosition: function(diffX, diffY) {\r
+        var el = this.getEl();\r
+\r
+        if (!this.DDM.verifyEl(el)) {\r
+            return;\r
+        }\r
+\r
+        var dx = diffX || 0;\r
+        var dy = diffY || 0;\r
+\r
+        var p = YAHOO.util.Dom.getXY( el );\r
+\r
+        this.initPageX = p[0] - dx;\r
+        this.initPageY = p[1] - dy;\r
+\r
+        this.lastPageX = p[0];\r
+        this.lastPageY = p[1];\r
+\r
+\r
+        this.deltaSetXY = null;\r
+\r
+        this.setStartPosition(p);\r
+    },\r
+\r
+    /**\r
+     * Sets the start position of the element.  This is set when the obj\r
+     * is initialized, the reset when a drag is started.\r
+     * @param pos current position (from previous lookup)\r
+     * @private\r
+     */\r
+    setStartPosition: function(pos) {\r
+        var p = pos || YAHOO.util.Dom.getXY( this.getEl() );\r
+\r
+        this.startPageX = p[0];\r
+        this.startPageY = p[1];\r
+    },\r
+\r
+    /**\r
+     * Add this instance to a group of related drag/drop objects.  All \r
+     * instances belong to at least one group, and can belong to as many \r
+     * groups as needed.\r
+     *\r
+     * @param sGroup {string} the name of the group\r
+     */\r
+    addToGroup: function(sGroup) {\r
+        this.groups[sGroup] = true;\r
+        this.DDM.regDragDrop(this, sGroup);\r
+    },\r
+\r
+    /**\r
+     * Remove's this instance from the supplied interaction group\r
+     * @param {string}  sGroup  The group to drop\r
+     */\r
+    removeFromGroup: function(sGroup) {\r
+        if (this.groups[sGroup]) {\r
+            delete this.groups[sGroup];\r
+        }\r
+\r
+        this.DDM.removeDDFromGroup(this, sGroup);\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify that an element other than the linked element \r
+     * will be moved with the cursor during a drag\r
+     *\r
+     * @param id the id of the element that will be used to initiate the drag\r
+     */\r
+    setDragElId: function(id) {\r
+        this.dragElId = id;\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify a child of the linked element that should be \r
+     * used to initiate the drag operation.  An example of this would be if \r
+     * you have a content div with text and links.  Clicking anywhere in the \r
+     * content area would normally start the drag operation.  Use this method\r
+     * to specify that an element inside of the content div is the element \r
+     * that starts the drag operation.\r
+     *\r
+     * @param id the id of the element that will be used to initiate the drag\r
+     */\r
+    setHandleElId: function(id) {\r
+        this.handleElId = id;\r
+        this.DDM.regHandle(this.id, id);\r
+    },\r
+\r
+    /**\r
+     * Allows you to set an element outside of the linked element as a drag \r
+     * handle\r
+     */\r
+    setOuterHandleElId: function(id) {\r
+        YAHOO.util.Event.addListener(id, "mousedown", \r
+                this.handleMouseDown, this, true);\r
+        this.setHandleElId(id);\r
+    },\r
+\r
+    /**\r
+     * Remove all drag and drop hooks for this element\r
+     */\r
+    unreg: function() {\r
+        YAHOO.util.Event.removeListener(this.id, "mousedown", \r
+                this.handleMouseDown);\r
+        this._domRef = null;\r
+        this.DDM._remove(this);\r
+    },\r
+\r
+    /**\r
+     * Returns true if this instance is locked, or the drag drop mgr is locked\r
+     * (meaning that all drag/drop is disabled on the page.)\r
+     *\r
+     * @return {boolean} true if this obj or all drag/drop is locked, else \r
+     * false\r
+     */\r
+    isLocked: function() {\r
+        return (this.DDM.isLocked() || this.locked);\r
+    },\r
+\r
+    /**\r
+     * Fired when this object is clicked\r
+     *\r
+     * @param {Event} e \r
+     * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)\r
+     * @private\r
+     */\r
+    handleMouseDown: function(e, oDD) {\r
+\r
+\r
+        var EU = YAHOO.util.Event;\r
+\r
+        var button = e.which || e.button;\r
+\r
+        if (this.primaryButtonOnly && button > 1) {\r
+            return;\r
+        }\r
+\r
+        if (this.isLocked()) {\r
+            return;\r
+        }\r
+\r
+        this.DDM.refreshCache(this.groups);\r
+        // var self = this;\r
+        // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);\r
+\r
+        // Only process the event if we really clicked within the linked \r
+        // element.  The reason we make this check is that in the case that \r
+        // another element was moved between the clicked element and the \r
+        // cursor in the time between the mousedown and mouseup events. When \r
+        // this happens, the element gets the next mousedown event \r
+        // regardless of where on the screen it happened.  \r
+        var pt = new YAHOO.util.Point(EU.getPageX(e), EU.getPageY(e));\r
+        if ( this.DDM.isOverTarget(pt, this) )  {\r
+\r
+\r
+            //  check to see if the handle was clicked\r
+            var srcEl = EU.getTarget(e);\r
+\r
+            if (this.isValidHandleChild(srcEl) &&\r
+                    (this.id == this.handleElId || \r
+                     this.DDM.handleWasClicked(srcEl, this.id)) ) {\r
+\r
+\r
+                // set the initial element position\r
+                this.setStartPosition();\r
+\r
+\r
+                this.b4MouseDown(e);\r
+                this.onMouseDown(e);\r
+                this.DDM.handleMouseDown(e, this);\r
+\r
+                this.DDM.stopEvent(e);\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Allows you to specify a tag name that should not start a drag operation\r
+     * when clicked.  This is designed to facilitate embedding links within a\r
+     * drag handle that do something other than start the drag.\r
+     * \r
+     * @param {string} tagName the type of element to exclude\r
+     */\r
+    addInvalidHandleType: function(tagName) {\r
+        var type = tagName.toUpperCase();\r
+        this.invalidHandleTypes[type] = type;\r
+    },\r
+\r
+    /**\r
+     * Lets you to specify an element id for a child of a drag handle\r
+     * that should not initiate a drag\r
+     * @param {string} id the element id of the element you wish to ignore\r
+     */\r
+    addInvalidHandleId: function(id) {\r
+        this.invalidHandleIds[id] = id;\r
+    },\r
+\r
+    /**\r
+     * Lets you specify a css class of elements that will not initiate a drag\r
+     * @param {string} cssClass the class of the elements you wish to ignore\r
+     */\r
+    addInvalidHandleClass: function(cssClass) {\r
+        this.invalidHandleClasses.push(cssClass);\r
+    },\r
+\r
+    /**\r
+     * Unsets an excluded tag name set by addInvalidHandleType\r
+     * \r
+     * @param {string} tagName the type of element to unexclude\r
+     */\r
+    removeInvalidHandleType: function(tagName) {\r
+        var type = tagName.toUpperCase();\r
+        // this.invalidHandleTypes[type] = null;\r
+        delete this.invalidHandleTypes[type];\r
+    },\r
+    \r
+    /**\r
+     * Unsets an invalid handle id\r
+     * @param {string} the id of the element to re-enable\r
+     */\r
+    removeInvalidHandleId: function(id) {\r
+        delete this.invalidHandleIds[id];\r
+    },\r
+\r
+    /**\r
+     * Unsets an invalid css class\r
+     * @param {string} the class of the element(s) you wish to re-enable\r
+     */\r
+    removeInvalidHandleClass: function(cssClass) {\r
+        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {\r
+            if (this.invalidHandleClasses[i] == cssClass) {\r
+                delete this.invalidHandleClasses[i];\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Checks the tag exclusion list to see if this click should be ignored\r
+     *\r
+     * @param {ygNode} node\r
+     * @return {boolean} true if this is a valid tag type, false if not\r
+     */\r
+    isValidHandleChild: function(node) {\r
+\r
+        var valid = true;\r
+        // var n = (node.nodeName == "#text") ? node.parentNode : node;\r
+        var nodeName;\r
+        try {\r
+            nodeName = node.nodeName.toUpperCase();\r
+        } catch(e) {\r
+            nodeName = node.nodeName;\r
+        }\r
+        valid = valid && !this.invalidHandleTypes[nodeName];\r
+        valid = valid && !this.invalidHandleIds[node.id];\r
+\r
+        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {\r
+            valid = !YAHOO.util.Dom.hasClass(node, this.invalidHandleClasses[i]);\r
+        }\r
+\r
+\r
+        return valid;\r
+\r
+    },\r
+\r
+    /**\r
+     * Create the array of horizontal tick marks if an interval was specified\r
+     * in setXConstraint().\r
+     *\r
+     * @private\r
+     */\r
+    setXTicks: function(iStartX, iTickSize) {\r
+        this.xTicks = [];\r
+        this.xTickSize = iTickSize;\r
+        \r
+        var tickMap = {};\r
+\r
+        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.xTicks[this.xTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.xTicks[this.xTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        this.xTicks.sort(this.DDM.numericSort) ;\r
+    },\r
+\r
+    /**\r
+     * Create the array of vertical tick marks if an interval was specified in \r
+     * setYConstraint().\r
+     *\r
+     * @private\r
+     */\r
+    setYTicks: function(iStartY, iTickSize) {\r
+        this.yTicks = [];\r
+        this.yTickSize = iTickSize;\r
+\r
+        var tickMap = {};\r
+\r
+        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.yTicks[this.yTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {\r
+            if (!tickMap[i]) {\r
+                this.yTicks[this.yTicks.length] = i;\r
+                tickMap[i] = true;\r
+            }\r
+        }\r
+\r
+        this.yTicks.sort(this.DDM.numericSort) ;\r
+    },\r
+\r
+    /**\r
+     * By default, the element can be dragged any place on the screen.  Use \r
+     * this method to limit the horizontal travel of the element.  Pass in \r
+     * 0,0 for the parameters if you want to lock the drag to the y axis.\r
+     *\r
+     * @param {int} iLeft the number of pixels the element can move to the left\r
+     * @param {int} iRight the number of pixels the element can move to the \r
+     * right\r
+     * @param {int} iTickSize optional parameter for specifying that the \r
+     * element\r
+     * should move iTickSize pixels at a time.\r
+     */\r
+    setXConstraint: function(iLeft, iRight, iTickSize) {\r
+        this.leftConstraint = iLeft;\r
+        this.rightConstraint = iRight;\r
+\r
+        this.minX = this.initPageX - iLeft;\r
+        this.maxX = this.initPageX + iRight;\r
+        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }\r
+\r
+        this.constrainX = true;\r
+    },\r
+\r
+    /**\r
+     * Clears any constraints applied to this instance.  Also clears ticks\r
+     * since they can't exist independent of a constraint at this time.\r
+     */\r
+    clearConstraints: function() {\r
+        this.constrainX = false;\r
+        this.constrainY = false;\r
+        this.clearTicks();\r
+    },\r
+\r
+    /**\r
+     * Clears any tick interval defined for this instance\r
+     */\r
+    clearTicks: function() {\r
+        this.xTicks = null;\r
+        this.yTicks = null;\r
+        this.xTickSize = 0;\r
+        this.yTickSize = 0;\r
+    },\r
+\r
+    /**\r
+     * By default, the element can be dragged any place on the screen.  Set \r
+     * this to limit the vertical travel of the element.  Pass in 0,0 for the\r
+     * parameters if you want to lock the drag to the x axis.\r
+     *\r
+     * @param {int} iUp the number of pixels the element can move up\r
+     * @param {int} iDown the number of pixels the element can move down\r
+     * @param {int} iTickSize optional parameter for specifying that the \r
+     * element should move iTickSize pixels at a time.\r
+     */\r
+    setYConstraint: function(iUp, iDown, iTickSize) {\r
+        this.topConstraint = iUp;\r
+        this.bottomConstraint = iDown;\r
+\r
+        this.minY = this.initPageY - iUp;\r
+        this.maxY = this.initPageY + iDown;\r
+        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }\r
+\r
+        this.constrainY = true;\r
+        \r
+    },\r
+\r
+    /**\r
+     * resetConstraints must be called if you manually reposition a dd element.\r
+     * @param {boolean} maintainOffset\r
+     */\r
+    resetConstraints: function() {\r
+\r
+\r
+        // Maintain offsets if necessary\r
+        if (this.initPageX || this.initPageX === 0) {\r
+            // figure out how much this thing has moved\r
+            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;\r
+            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;\r
+\r
+            this.setInitPosition(dx, dy);\r
+\r
+        // This is the first time we have detected the element's position\r
+        } else {\r
+            this.setInitPosition();\r
+        }\r
+\r
+        if (this.constrainX) {\r
+            this.setXConstraint( this.leftConstraint, \r
+                                 this.rightConstraint, \r
+                                 this.xTickSize        );\r
+        }\r
+\r
+        if (this.constrainY) {\r
+            this.setYConstraint( this.topConstraint, \r
+                                 this.bottomConstraint, \r
+                                 this.yTickSize         );\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Normally the drag element is moved pixel by pixel, but we can specify \r
+     * that it move a number of pixels at a time.  This method resolves the \r
+     * location when we have it set up like this.\r
+     *\r
+     * @param {int} val where we want to place the object\r
+     * @param {int[]} tickArray sorted array of valid points\r
+     * @return {int} the closest tick\r
+     * @private\r
+     */\r
+    getTick: function(val, tickArray) {\r
+\r
+        if (!tickArray) {\r
+            // If tick interval is not defined, it is effectively 1 pixel, \r
+            // so we return the value passed to us.\r
+            return val; \r
+        } else if (tickArray[0] >= val) {\r
+            // The value is lower than the first tick, so we return the first\r
+            // tick.\r
+            return tickArray[0];\r
+        } else {\r
+            for (var i=0, len=tickArray.length; i<len; ++i) {\r
+                var next = i + 1;\r
+                if (tickArray[next] && tickArray[next] >= val) {\r
+                    var diff1 = val - tickArray[i];\r
+                    var diff2 = tickArray[next] - val;\r
+                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];\r
+                }\r
+            }\r
+\r
+            // The value is larger than the last tick, so we return the last\r
+            // tick.\r
+            return tickArray[tickArray.length - 1];\r
+        }\r
+    },\r
+\r
+    /**\r
+     * toString method\r
+     * @return {string} string representation of the dd obj\r
+     */\r
+    toString: function() {\r
+        return ("DragDrop " + this.id);\r
+    }\r
+\r
+};\r
+\r
+// Only load the library once.  Rewriting the manager class would orphan \r
+// existing drag and drop instances.\r
+if (!YAHOO.util.DragDropMgr) {\r
+\r
+    /**\r
+     * Handles the element interaction for all DragDrop items in the \r
+     * window.  Generally, you will not call this class directly, but it does\r
+     * have helper methods that could be useful in your DragDrop \r
+     * implementations.  This class should not be instantiated; all methods \r
+     * are are static.\r
+     *\r
+     * @constructor\r
+     */\r
+    YAHOO.util.DragDropMgr = new function() {\r
+\r
+        /**\r
+         * Two dimensional Array of registered DragDrop objects.  The first \r
+         * dimension is the DragDrop item group, the second the DragDrop \r
+         * object.\r
+         *\r
+         * @type {string: string}\r
+         * @private\r
+         */\r
+        this.ids = {};\r
+\r
+        /**\r
+         * Array of element ids defined as drag handles.  Used to determine \r
+         * if the element that generated the mousedown event is actually the \r
+         * handle and not the html element itself.\r
+         *\r
+         * @type {string: string}\r
+         * @private\r
+         */\r
+        this.handleIds = {};\r
+\r
+        /**\r
+         * the DragDrop object that is currently being dragged\r
+         *\r
+         * @type DragDrop\r
+         * @private\r
+         **/\r
+        this.dragCurrent = null;\r
+\r
+        /**\r
+         * the DragDrop object(s) that are being hovered over\r
+         *\r
+         * @type Array\r
+         * @private\r
+         */\r
+        this.dragOvers = {};\r
+\r
+        /**\r
+         * @private\r
+         */\r
+\r
+        /**\r
+         * the X distance between the cursor and the object being dragged\r
+         *\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.deltaX = 0;\r
+\r
+        /**\r
+         * the Y distance between the cursor and the object being dragged\r
+         *\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.deltaY = 0;\r
+\r
+        /**\r
+         * Flag to determine if we should prevent the default behavior of the\r
+         * events we define. By default this is true, but this can be set to \r
+         * false if you need the default behavior (not recommended)\r
+         *\r
+         * @type boolean\r
+         */\r
+        this.preventDefault = true;\r
+\r
+        /**\r
+         * Flag to determine if we should stop the propagation of the events \r
+         * we generate. This is true by default but you may want to set it to\r
+         * false if the html element contains other features that require the\r
+         * mouse click.\r
+         *\r
+         * @type boolean\r
+         */\r
+        this.stopPropagation = true;\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this.initalized = false;\r
+\r
+        /**\r
+         * All drag and drop can be disabled.\r
+         *\r
+         * @private\r
+         */\r
+        this.locked = false;\r
+        \r
+        /**\r
+         * Called the first time an element is registered.\r
+         *\r
+         * @private\r
+         */\r
+        this.init = function() {\r
+            this.initialized = true;\r
+        };\r
+\r
+        /**\r
+         * In point mode, drag and drop interaction is defined by the \r
+         * location of the cursor during the drag/drop\r
+         * @type int\r
+         */\r
+        this.POINT     = 0;\r
+\r
+        /**\r
+         * In intersect mode, drag and drop interactio nis defined by the \r
+         * overlap of two or more drag and drop objects.\r
+         * @type int\r
+         */\r
+        this.INTERSECT = 1;\r
+\r
+        /**\r
+         * The current drag and drop mode.  Default it point mode\r
+         * @type int\r
+         */\r
+        this.mode = this.POINT;\r
+\r
+        /**\r
+         * Runs method on all drag and drop objects\r
+         * @private\r
+         */\r
+        this._execOnAll = function(sMethod, args) {\r
+            for (var i in this.ids) {\r
+                for (var j in this.ids[i]) {\r
+                    var oDD = this.ids[i][j];\r
+                    if (! this.isTypeOfDD(oDD)) {\r
+                        continue;\r
+                    }\r
+                    oDD[sMethod].apply(oDD, args);\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Drag and drop initialization.  Sets up the global event handlers\r
+         * @private\r
+         */\r
+        this._onLoad = function() {\r
+\r
+            this.init();\r
+\r
+\r
+            var EU = YAHOO.util.Event;\r
+\r
+            EU.on(document, "mouseup",   this.handleMouseUp, this, true);\r
+            EU.on(document, "mousemove", this.handleMouseMove, this, true);\r
+            EU.on(window,   "unload",    this._onUnload, this, true);\r
+            EU.on(window,   "resize",    this._onResize, this, true);\r
+            // EU.on(window,   "mouseout",    this._test);\r
+\r
+        };\r
+\r
+        /**\r
+         * Reset constraints on all drag and drop objs\r
+         * @private\r
+         */\r
+        this._onResize = function(e) {\r
+            this._execOnAll("resetConstraints", []);\r
+        };\r
+\r
+        /**\r
+         * Lock all drag and drop functionality\r
+         */\r
+        this.lock = function() { this.locked = true; };\r
+\r
+        /**\r
+         * Unlock all drag and drop functionality\r
+         */\r
+        this.unlock = function() { this.locked = false; };\r
+\r
+        /**\r
+         * Is drag and drop locked?\r
+         *\r
+         * @return {boolean} True if drag and drop is locked, false otherwise.\r
+         */\r
+        this.isLocked = function() { return this.locked; };\r
+\r
+        /**\r
+         * Location cache that is set for all drag drop objects when a drag is\r
+         * initiated, cleared when the drag is finished.\r
+         *\r
+         * @private\r
+         */\r
+        this.locationCache = {};\r
+\r
+        /**\r
+         * Set useCache to false if you want to force object the lookup of each\r
+         * drag and drop linked element constantly during a drag.\r
+         * @type boolean\r
+         */\r
+        this.useCache = true;\r
+\r
+        /**\r
+         * The number of pixels that the mouse needs to move after the \r
+         * mousedown before the drag is initiated.  Default=3;\r
+         * @type int\r
+         */\r
+        this.clickPixelThresh = 3;\r
+\r
+        /**\r
+         * The number of milliseconds after the mousedown event to initiate the\r
+         * drag if we don't get a mouseup event. Default=1000\r
+         * @type int\r
+         */\r
+        this.clickTimeThresh = 1000;\r
+\r
+        /**\r
+         * Flag that indicates that either the drag pixel threshold or the \r
+         * mousdown time threshold has been met\r
+         * @type boolean\r
+         * @private\r
+         */\r
+        this.dragThreshMet = false;\r
+\r
+        /**\r
+         * Timeout used for the click time threshold\r
+         * @type Object\r
+         * @private\r
+         */\r
+        this.clickTimeout = null;\r
+\r
+        /**\r
+         * The X position of the mousedown event stored for later use when a \r
+         * drag threshold is met.\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.startX = 0;\r
+\r
+        /**\r
+         * The Y position of the mousedown event stored for later use when a \r
+         * drag threshold is met.\r
+         * @type int\r
+         * @private\r
+         */\r
+        this.startY = 0;\r
+\r
+        /**\r
+         * Each DragDrop instance must be registered with the DragDropMgr.  \r
+         * This is executed in DragDrop.init()\r
+         *\r
+         * @param {DragDrop} oDD the DragDrop object to register\r
+         * @param {String} sGroup the name of the group this element belongs to\r
+         */\r
+        this.regDragDrop = function(oDD, sGroup) {\r
+            if (!this.initialized) { this.init(); }\r
+            \r
+            if (!this.ids[sGroup]) {\r
+                this.ids[sGroup] = {};\r
+            }\r
+            this.ids[sGroup][oDD.id] = oDD;\r
+        };\r
+\r
+        /**\r
+         * Removes the supplied dd instance from the supplied group. Executed\r
+         * by DragDrop.removeFromGroup.\r
+         * @private\r
+         */\r
+        this.removeDDFromGroup = function(oDD, sGroup) {\r
+            if (!this.ids[sGroup]) {\r
+                this.ids[sGroup] = {};\r
+            }\r
+\r
+            var obj = this.ids[sGroup];\r
+            if (obj && obj[oDD.id]) {\r
+                delete obj[oDD.id];\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Unregisters a drag and drop item.  This is executed in \r
+         * DragDrop.unreg, use that method instead of calling this directly.\r
+         * @private\r
+         */\r
+        this._remove = function(oDD) {\r
+            for (var g in oDD.groups) {\r
+                if (g && this.ids[g][oDD.id]) {\r
+                    delete this.ids[g][oDD.id];\r
+                }\r
+            }\r
+            delete this.handleIds[oDD.id];\r
+        };\r
+\r
+        /**\r
+         * Each DragDrop handle element must be registered.  This is done\r
+         * automatically when executing DragDrop.setHandleElId()\r
+         *\r
+         * @param {String} sDDId the DragDrop id this element is a handle for\r
+         * @param {String} sHandleId the id of the element that is the drag \r
+         * handle\r
+         */\r
+        this.regHandle = function(sDDId, sHandleId) {\r
+            if (!this.handleIds[sDDId]) {\r
+                this.handleIds[sDDId] = {};\r
+            }\r
+            this.handleIds[sDDId][sHandleId] = sHandleId;\r
+        };\r
+\r
+        /**\r
+         * Utility function to determine if a given element has been \r
+         * registered as a drag drop item.\r
+         *\r
+         * @param {String} id the element id to check\r
+         * @return {boolean} true if this element is a DragDrop item, \r
+         * false otherwise\r
+         */\r
+        this.isDragDrop = function(id) {\r
+            return ( this.getDDById(id) ) ? true : false;\r
+        };\r
+\r
+        /**\r
+         * Returns the drag and drop instances that are in all groups the\r
+         * passed in instance belongs to.\r
+         *\r
+         * @param {DragDrop} p_oDD the obj to get related data for\r
+         * @param {boolean} bTargetsOnly if true, only return targetable objs\r
+         * @return {DragDrop[]} the related instances\r
+         */\r
+        this.getRelated = function(p_oDD, bTargetsOnly) {\r
+            var oDDs = [];\r
+            for (var i in p_oDD.groups) {\r
+                for (j in this.ids[i]) {\r
+                    var dd = this.ids[i][j];\r
+                    if (! this.isTypeOfDD(dd)) {\r
+                        continue;\r
+                    }\r
+                    if (!bTargetsOnly || dd.isTarget) {\r
+                        oDDs[oDDs.length] = dd;\r
+                    }\r
+                }\r
+            }\r
+\r
+            return oDDs;\r
+        };\r
+\r
+        /**\r
+         * Returns true if the specified dd target is a legal target for \r
+         * the specifice drag obj\r
+         *\r
+         * @param {DragDrop} the drag obj\r
+         * @param {DragDrop) the target\r
+         * @return {boolean} true if the target is a legal target for the \r
+         * dd obj\r
+         */\r
+        this.isLegalTarget = function (oDD, oTargetDD) {\r
+            var targets = this.getRelated(oDD, true);\r
+            for (var i=0, len=targets.length;i<len;++i) {\r
+                if (targets[i].id == oTargetDD.id) {\r
+                    return true;\r
+                }\r
+            }\r
+\r
+            return false;\r
+        };\r
+\r
+        /**\r
+         * My goal is to be able to transparently determine if an object is\r
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof \r
+         * returns "object", oDD.constructor.toString() always returns\r
+         * "DragDrop" and not the name of the subclass.  So for now it just\r
+         * evaluates a well-known variable in DragDrop.\r
+         *\r
+         * @param {Object} the object to evaluate\r
+         * @return {boolean} true if typeof oDD = DragDrop\r
+         */\r
+        this.isTypeOfDD = function (oDD) {\r
+            return (oDD && oDD.__ygDragDrop);\r
+        };\r
+\r
+        /**\r
+         * Utility function to determine if a given element has been \r
+         * registered as a drag drop handle for the given Drag Drop object.\r
+         *\r
+         * @param {String} id the element id to check\r
+         * @return {boolean} true if this element is a DragDrop handle, false \r
+         * otherwise\r
+         */\r
+        this.isHandle = function(sDDId, sHandleId) {\r
+            return ( this.handleIds[sDDId] && \r
+                            this.handleIds[sDDId][sHandleId] );\r
+        };\r
+\r
+        /**\r
+         * Returns the DragDrop instance for a given id\r
+         *\r
+         * @param {String} id the id of the DragDrop object\r
+         * @return {DragDrop} the drag drop object, null if it is not found\r
+         */\r
+        this.getDDById = function(id) {\r
+            for (var i in this.ids) {\r
+                if (this.ids[i][id]) {\r
+                    return this.ids[i][id];\r
+                }\r
+            }\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * Fired after a registered DragDrop object gets the mousedown event.\r
+         * Sets up the events required to track the object being dragged\r
+         *\r
+         * @param {Event} e the event\r
+         * @param oDD the DragDrop object being dragged\r
+         * @private\r
+         */\r
+        this.handleMouseDown = function(e, oDD) {\r
+\r
+            this.currentTarget = YAHOO.util.Event.getTarget(e);\r
+\r
+            this.dragCurrent = oDD;\r
+\r
+            var el = oDD.getEl();\r
+\r
+            // track start position\r
+            this.startX = YAHOO.util.Event.getPageX(e);\r
+            this.startY = YAHOO.util.Event.getPageY(e);\r
+\r
+            this.deltaX = this.startX - el.offsetLeft;\r
+            this.deltaY = this.startY - el.offsetTop;\r
+\r
+            this.dragThreshMet = false;\r
+\r
+            this.clickTimeout = setTimeout( \r
+                    function() { \r
+                        var DDM = YAHOO.util.DDM;\r
+                        DDM.startDrag(DDM.startX, DDM.startY); \r
+                    }, \r
+                    this.clickTimeThresh );\r
+        };\r
+\r
+        /**\r
+         * Fired when either the drag pixel threshol or the mousedown hold \r
+         * time threshold has been met.\r
+         * \r
+         * @param x {int} the X position of the original mousedown\r
+         * @param y {int} the Y position of the original mousedown\r
+         */\r
+        this.startDrag = function(x, y) {\r
+            clearTimeout(this.clickTimeout);\r
+            if (this.dragCurrent) {\r
+                this.dragCurrent.b4StartDrag(x, y);\r
+                this.dragCurrent.startDrag(x, y);\r
+            }\r
+            this.dragThreshMet = true;\r
+        };\r
+\r
+        /**\r
+         * Internal function to handle the mouseup event.  Will be invoked \r
+         * from the context of the document.\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.handleMouseUp = function(e) {\r
+\r
+            if (! this.dragCurrent) {\r
+                return;\r
+            }\r
+\r
+            clearTimeout(this.clickTimeout);\r
+\r
+            if (this.dragThreshMet) {\r
+                this.fireEvents(e, true);\r
+            } else {\r
+            }\r
+\r
+            this.stopDrag(e);\r
+\r
+            this.stopEvent(e);\r
+        };\r
+\r
+        /**\r
+         * Utility to stop event propagation and event default, if these \r
+         * features are turned on.\r
+         *\r
+         * @param {Event} e the event as returned by this.getEvent()\r
+         */\r
+        this.stopEvent = function(e) {\r
+            if (this.stopPropagation) {\r
+                YAHOO.util.Event.stopPropagation(e);\r
+            }\r
+\r
+            if (this.preventDefault) {\r
+                YAHOO.util.Event.preventDefault(e);\r
+            }\r
+        };\r
+\r
+        /** \r
+         * Internal function to clean up event handlers after the drag \r
+         * operation is complete\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.stopDrag = function(e) {\r
+\r
+            // Fire the drag end event for the item that was dragged\r
+            if (this.dragCurrent) {\r
+                if (this.dragThreshMet) {\r
+                    this.dragCurrent.b4EndDrag(e);\r
+                    this.dragCurrent.endDrag(e);\r
+                }\r
+\r
+                this.dragCurrent.onMouseUp(e);\r
+            }\r
+\r
+            this.dragCurrent = null;\r
+            this.dragOvers = {};\r
+        };\r
+\r
+        /** \r
+         * Internal function to handle the mousemove event.  Will be invoked \r
+         * from the context of the html element.\r
+         *\r
+         * @TODO figure out what we can do about mouse events lost when the \r
+         * user drags objects beyond the window boundary.  Currently we can \r
+         * detect this in internet explorer by verifying that the mouse is \r
+         * down during the mousemove event.  Firefox doesn't give us the \r
+         * button state on the mousemove event.\r
+         *\r
+         * @param {Event} e the event\r
+         * @private\r
+         */\r
+        this.handleMouseMove = function(e) {\r
+            if (! this.dragCurrent) {\r
+                return false;\r
+            }\r
+\r
+            // var button = e.which || e.button;\r
+\r
+            // check for IE mouseup outside of page boundary\r
+            if (YAHOO.util.Event.isIE && !e.button) {\r
+                this.stopEvent(e);\r
+                return this.handleMouseUp(e);\r
+            }\r
+\r
+            if (!this.dragThreshMet) {\r
+                var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));\r
+                var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));\r
+                if (diffX > this.clickPixelThresh || \r
+                            diffY > this.clickPixelThresh) {\r
+                    this.startDrag(this.startX, this.startY);\r
+                }\r
+            }\r
+\r
+            if (this.dragThreshMet) {\r
+                this.dragCurrent.b4Drag(e);\r
+                this.dragCurrent.onDrag(e);\r
+                this.fireEvents(e, false);\r
+            }\r
+\r
+            this.stopEvent(e);\r
+\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Iterates over all of the DragDrop elements to find ones we are \r
+         * hovering over or dropping on\r
+         *\r
+         * @param {Event} e the event\r
+         * @param {boolean} isDrop is this a drop op or a mouseover op?\r
+         * @private\r
+         */\r
+        this.fireEvents = function(e, isDrop) {\r
+            var dc = this.dragCurrent;\r
+\r
+            // If the user did the mouse up outside of the window, we could \r
+            // get here even though we have ended the drag.\r
+            if (!dc || dc.isLocked()) {\r
+                return;\r
+            }\r
+\r
+            var x = YAHOO.util.Event.getPageX(e);\r
+            var y = YAHOO.util.Event.getPageY(e);\r
+            var pt = new YAHOO.util.Point(x,y);\r
+\r
+            // cache the previous dragOver array\r
+            var oldOvers = [];\r
+\r
+            var outEvts   = [];\r
+            var overEvts  = [];\r
+            var dropEvts  = [];\r
+            var enterEvts = [];\r
+\r
+            // Check to see if the object(s) we were hovering over is no longer \r
+            // being hovered over so we can fire the onDragOut event\r
+            for (var i in this.dragOvers) {\r
+\r
+                var ddo = this.dragOvers[i];\r
+\r
+                if (! this.isTypeOfDD(ddo)) {\r
+                    continue;\r
+                }\r
+\r
+                if (! this.isOverTarget(pt, ddo, this.mode)) {\r
+                    outEvts.push( ddo );\r
+                }\r
+\r
+                oldOvers[i] = true;\r
+                delete this.dragOvers[i];\r
+            }\r
+\r
+            for (var sGroup in dc.groups) {\r
+                \r
+                if ("string" != typeof sGroup) {\r
+                    continue;\r
+                }\r
+\r
+                for (i in this.ids[sGroup]) {\r
+                    var oDD = this.ids[sGroup][i];\r
+                    if (! this.isTypeOfDD(oDD)) {\r
+                        continue;\r
+                    }\r
+\r
+                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {\r
+                        if (this.isOverTarget(pt, oDD, this.mode)) {\r
+                            // look for drop interactions\r
+                            if (isDrop) {\r
+                                dropEvts.push( oDD );\r
+                            // look for drag enter and drag over interactions\r
+                            } else {\r
+\r
+                                // initial drag over: dragEnter fires\r
+                                if (!oldOvers[oDD.id]) {\r
+                                    enterEvts.push( oDD );\r
+                                // subsequent drag overs: dragOver fires\r
+                                } else {\r
+                                    overEvts.push( oDD );\r
+                                }\r
+\r
+                                this.dragOvers[oDD.id] = oDD;\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            if (this.mode) {\r
+                if (outEvts.length) {\r
+                    dc.b4DragOut(e, outEvts);\r
+                    dc.onDragOut(e, outEvts);\r
+                }\r
+\r
+                if (enterEvts.length) {\r
+                    dc.onDragEnter(e, enterEvts);\r
+                }\r
+\r
+                if (overEvts.length) {\r
+                    dc.b4DragOver(e, overEvts);\r
+                    dc.onDragOver(e, overEvts);\r
+                }\r
+\r
+                if (dropEvts.length) {\r
+                    dc.b4DragDrop(e, dropEvts);\r
+                    dc.onDragDrop(e, dropEvts);\r
+                }\r
+\r
+            } else {\r
+                // fire dragout events\r
+                var len = 0;\r
+                for (i=0, len=outEvts.length; i<len; ++i) {\r
+                    dc.b4DragOut(e, outEvts[i].id);\r
+                    dc.onDragOut(e, outEvts[i].id);\r
+                }\r
+                 \r
+                // fire enter events\r
+                for (i=0,len=enterEvts.length; i<len; ++i) {\r
+                    // dc.b4DragEnter(e, oDD.id);\r
+                    dc.onDragEnter(e, enterEvts[i].id);\r
+                }\r
+         \r
+                // fire over events\r
+                for (i=0,len=overEvts.length; i<len; ++i) {\r
+                    dc.b4DragOver(e, overEvts[i].id);\r
+                    dc.onDragOver(e, overEvts[i].id);\r
+                }\r
+\r
+                // fire drop events\r
+                for (i=0, len=dropEvts.length; i<len; ++i) {\r
+                    dc.b4DragDrop(e, dropEvts[i].id);\r
+                    dc.onDragDrop(e, dropEvts[i].id);\r
+                }\r
+\r
+            }\r
+\r
+        };\r
+\r
+        /**\r
+         * Helper function for getting the best match from the list of drag \r
+         * and drop objects returned by the drag and drop events when we are \r
+         * in INTERSECT mode.  It returns either the first object that the \r
+         * cursor is over, or the object that has the greatest overlap with \r
+         * the dragged element.\r
+         *\r
+         * @param  {DragDrop[]} dds The array of drag and drop objects \r
+         * targeted\r
+         * @return {DragDrop}       The best single match\r
+         */\r
+        this.getBestMatch = function(dds) {\r
+            var winner = null;\r
+            // Return null if the input is not what we expect\r
+            //if (!dds || !dds.length || dds.length == 0) {\r
+               // winner = null;\r
+            // If there is only one item, it wins\r
+            //} else if (dds.length == 1) {\r
+\r
+            var len = dds.length;\r
+\r
+            if (len == 1) {\r
+                winner = dds[0];\r
+            } else {\r
+                // Loop through the targeted items\r
+                for (var i=0; i<len; ++i) {\r
+                    var dd = dds[i];\r
+                    // If the cursor is over the object, it wins.  If the \r
+                    // cursor is over multiple matches, the first one we come\r
+                    // to wins.\r
+                    if (dd.cursorIsOver) {\r
+                        winner = dd;\r
+                        break;\r
+                    // Otherwise the object with the most overlap wins\r
+                    } else {\r
+                        if (!winner || \r
+                            winner.overlap.getArea() < dd.overlap.getArea()) {\r
+                            winner = dd;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            return winner;\r
+        };\r
+\r
+        /**\r
+         * Refreshes the cache of the top-left and bottom-right points of the \r
+         * drag and drop objects in the specified groups\r
+         *\r
+         * @param {Object} groups an associative array of groups to refresh\r
+         */\r
+        this.refreshCache = function(groups) {\r
+            for (sGroup in groups) {\r
+                if ("string" != typeof sGroup) {\r
+                    continue;\r
+                }\r
+                for (i in this.ids[sGroup]) {\r
+                    var oDD = this.ids[sGroup][i];\r
+\r
+                    if (this.isTypeOfDD(oDD)) {\r
+                    // if (this.isTypeOfDD(oDD) && oDD.isTarget) {\r
+                        var loc = this.getLocation(oDD);\r
+                        if (loc) {\r
+                            this.locationCache[oDD.id] = loc;\r
+                        } else {\r
+                            delete this.locationCache[oDD.id];\r
+                            // this will unregister the drag and drop object if\r
+                            // the element is not in a usable state\r
+                            // oDD.unreg();\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * This checks to make sure an element exists and is in the DOM.  The\r
+         * main purpose is to handle cases where innerHTML is used to remove\r
+         * drag and drop objects from the DOM.  IE provides an 'unspecified\r
+         * error' when trying to access the offsetParent of such an element\r
+         * @param {HTMLElement} el the element to check\r
+         * @return {boolean} true if the element looks usable\r
+         */\r
+        this.verifyEl = function(el) {\r
+            try {\r
+                if (el) {\r
+                    var parent = el.offsetParent;\r
+                    if (parent) {\r
+                        return true;\r
+                    }\r
+                }\r
+            } catch(e) {\r
+            }\r
+\r
+            return false;\r
+        };\r
+        \r
+        /**\r
+         * Returns the an array containing the drag and drop element's position\r
+         * and size, including the DragDrop.padding configured for it\r
+         *\r
+         * @param {DragDrop} oDD the drag and drop object to get the \r
+         * location for\r
+         * @return array containing the top left and bottom right points of the \r
+         * element \r
+         */\r
+        this.getLocation = function(oDD) {\r
+            if (! this.isTypeOfDD(oDD)) {\r
+                return null;\r
+            }\r
+\r
+            var el = oDD.getEl();\r
+\r
+            // element will not have an offsetparent if it was removed from the\r
+            // document or display=none\r
+            // if (!this.verifyEl(el)) {\r
+                // return null;\r
+            // }\r
+\r
+\r
+            // var aPos = ygPos.getPos(el);\r
+            var aPos = null;\r
+            try {\r
+                aPos= YAHOO.util.Dom.getXY(el);\r
+            } catch (e) { }\r
+\r
+            if (!aPos) {\r
+                return null;\r
+            }\r
+\r
+            x1 = aPos[0];\r
+            x2 = x1 + el.offsetWidth;\r
+\r
+            y1 = aPos[1];\r
+            y2 = y1 + el.offsetHeight;\r
+\r
+            var t = y1 - oDD.padding[0];\r
+            var r = x2 + oDD.padding[1];\r
+            var b = y2 + oDD.padding[2];\r
+            var l = x1 - oDD.padding[3];\r
+\r
+            return new YAHOO.util.Region( t, r, b, l );\r
+\r
+        };\r
+\r
+        /**\r
+         * Checks the cursor location to see if it over the target\r
+         * \r
+         * @param {YAHOO.util.Point} pt The point to evaluate\r
+         * @param {DragDrop} oTarget the DragDrop object we are inspecting\r
+         * @return {boolean} true if the mouse is over the target\r
+         * @private\r
+         */\r
+        this.isOverTarget = function(pt, oTarget, intersect) {\r
+            // use cache if available\r
+            var loc = this.locationCache[oTarget.id];\r
+            if (!loc || !this.useCache) {\r
+                loc = this.getLocation(oTarget);\r
+                this.locationCache[oTarget.id] = loc;\r
+\r
+            }\r
+\r
+            if (!loc) {\r
+                return false;\r
+            }\r
+\r
+            oTarget.cursorIsOver = loc.contains( pt );\r
+\r
+            // DragDrop is using this as a sanity check for the initial mousedown\r
+            // in this case we are done.  In POINT mode, if the drag obj has no\r
+            // contraints, we are also done. Otherwise we need to evaluate the \r
+            // location of the target as related to the actual location of the\r
+            // dragged element.\r
+            var dc = this.dragCurrent;\r
+            if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {\r
+                return oTarget.cursorIsOver;\r
+            }\r
+\r
+            oTarget.overlap = null;\r
+\r
+            // Get the current location of the drag element, this is the\r
+            // location of the mouse event less the delta that represents\r
+            // where the original mousedown happened on the element.  We\r
+            // need to consider constraints and ticks as well.\r
+            var pos = dc.getTargetCoord(pt.x, pt.y);\r
+\r
+            var el = dc.getDragEl();\r
+            var curRegion = new YAHOO.util.Region( pos.y, \r
+                                                   pos.x + el.offsetWidth,\r
+                                                   pos.y + el.offsetHeight, \r
+                                                   pos.x );\r
+\r
+            var overlap = curRegion.intersect(loc);\r
+\r
+            if (overlap) {\r
+                oTarget.overlap = overlap;\r
+                return (intersect) ? true : oTarget.cursorIsOver;\r
+            } else {\r
+                return false;\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this._onUnload = function(e, me) {\r
+            this.unregAll();\r
+        };\r
+\r
+        /**\r
+         * Cleans up the drag and drop events and objects.\r
+         * @private\r
+         */\r
+        this.unregAll = function() {\r
+\r
+            if (this.dragCurrent) {\r
+                this.stopDrag();\r
+                this.dragCurrent = null;\r
+            }\r
+\r
+            this._execOnAll("unreg", []);\r
+\r
+            for (i in this.elementCache) {\r
+                delete this.elementCache[i];\r
+            }\r
+\r
+            this.elementCache = {};\r
+            this.ids = {};\r
+        };\r
+\r
+        /**\r
+         * A cache of DOM elements\r
+         * @private\r
+         */\r
+        this.elementCache = {};\r
+        \r
+        /**\r
+         * Get the wrapper for the DOM element specified\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element\r
+         * @private\r
+         * @deprecated\r
+         */\r
+        this.getElWrapper = function(id) {\r
+            var oWrapper = this.elementCache[id];\r
+            if (!oWrapper || !oWrapper.el) {\r
+                oWrapper = this.elementCache[id] = \r
+                    new this.ElementWrapper(YAHOO.util.Dom.get(id));\r
+            }\r
+            return oWrapper;\r
+        };\r
+\r
+        /**\r
+         * Returns the actual DOM element\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {Object} The element\r
+         * @deprecated\r
+         */\r
+        this.getElement = function(id) {\r
+            return YAHOO.util.Dom.get(id);\r
+        };\r
+        \r
+        /**\r
+         * Returns the style property for the DOM element (i.e., \r
+         * document.getElById(id).style)\r
+         *\r
+         * @param {String} id the id of the elment to get\r
+         * @return {Object} The style property of the element\r
+         * @deprecated\r
+         */\r
+        this.getCss = function(id) {\r
+            var el = YAHOO.util.Dom.get(id);\r
+            return (el) ? el.style : null;\r
+        };\r
+\r
+        /**\r
+         * Inner class for cached elements\r
+         * @private\r
+         * @deprecated\r
+         */\r
+        this.ElementWrapper = function(el) {\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.el = el || null;\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.id = this.el && el.id;\r
+                /**\r
+                 * @private\r
+                 */\r
+                this.css = this.el && el.style;\r
+            };\r
+\r
+        /**\r
+         * Returns the X position of an html element\r
+         * @param el the element for which to get the position\r
+         * @return {int} the X coordinate\r
+         * @deprecated\r
+         */\r
+        this.getPosX = function(el) {\r
+            return YAHOO.util.Dom.getX(el);\r
+        };\r
+\r
+        /**\r
+         * Returns the Y position of an html element\r
+         * @param el the element for which to get the position\r
+         * @return {int} the Y coordinate\r
+         * @deprecated\r
+         */\r
+        this.getPosY = function(el) {\r
+            return YAHOO.util.Dom.getY(el); \r
+        };\r
+\r
+        /**\r
+         * Swap two nodes.  In IE, we use the native method, for others we \r
+         * emulate the IE behavior\r
+         *\r
+         * @param n1 the first node to swap\r
+         * @param n2 the other node to swap\r
+         */\r
+        this.swapNode = function(n1, n2) {\r
+            if (n1.swapNode) {\r
+                n1.swapNode(n2);\r
+            } else {\r
+                // the node reference order for the swap is a little tricky. \r
+                var p = n2.parentNode;\r
+                var s = n2.nextSibling;\r
+                n1.parentNode.replaceChild(n2, n1);\r
+                p.insertBefore(n1,s);\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this.getScroll = function () {\r
+            var t, l;\r
+            if (document.documentElement && document.documentElement.scrollTop) {\r
+                t = document.documentElement.scrollTop;\r
+                l = document.documentElement.scrollLeft;\r
+            } else if (document.body) {\r
+                t = document.body.scrollTop;\r
+                l = document.body.scrollLeft;\r
+            }\r
+            return { top: t, left: l };\r
+        };\r
+\r
+        /**\r
+         * Returns the specified element style property\r
+         * @param {HTMLElement} el          the element\r
+         * @param {string}      styleProp   the style property\r
+         * @return {string} The value of the style property\r
+         * @deprecated, use YAHOO.util.Dom.getStyle\r
+         */\r
+        this.getStyle = function(el, styleProp) {\r
+            return YAHOO.util.Dom.getStyle(el, styleProp);\r
+        };\r
+\r
+        /**\r
+         * Gets the scrollTop\r
+         * @return {int} the document's scrollTop\r
+         */\r
+        this.getScrollTop = function () { return this.getScroll().top; };\r
+\r
+        /**\r
+         * Gets the scrollLeft\r
+         * @return {int} the document's scrollTop\r
+         */\r
+        this.getScrollLeft = function () { return this.getScroll().left; };\r
+\r
+        /**\r
+         * Sets the x/y position of an element to the location of the\r
+         * target element.\r
+         * @param {HTMLElement} moveEl      The element to move\r
+         * @param {HTMLElement} targetEl    The position reference element\r
+         */\r
+        this.moveToEl = function (moveEl, targetEl) {\r
+            var aCoord = YAHOO.util.Dom.getXY(targetEl);\r
+            YAHOO.util.Dom.setXY(moveEl, aCoord);\r
+        };\r
+\r
+        /**\r
+         * Gets the client height\r
+         * @return {int} client height in px\r
+         * @deprecated\r
+         */\r
+        this.getClientHeight = function() {\r
+            return YAHOO.util.Dom.getClientHeight();\r
+        };\r
+\r
+        /**\r
+         * Gets the client width\r
+         * @return {int} client width in px\r
+         * @deprecated\r
+         */\r
+        this.getClientWidth = function() {\r
+            return YAHOO.util.Dom.getClientWidth();\r
+        };\r
+\r
+        /**\r
+         * numeric array sort function\r
+         */\r
+        this.numericSort = function(a, b) { return (a - b); };\r
+\r
+        /**\r
+         * @private\r
+         */\r
+        this._timeoutCount = 0;\r
+\r
+        /**\r
+         * Trying to make the load order less important.  Without this we get\r
+         * an error if this file is loaded before the Event Utility.\r
+         * @private\r
+         */\r
+        this._addListeners = function() {\r
+            if ( YAHOO.util.Event && document ) {\r
+                this._onLoad();\r
+            } else {\r
+                if (this._timeoutCount > 1000) {\r
+                } else {\r
+                    var DDM = YAHOO.util.DDM;\r
+                    setTimeout( function() { DDM._addListeners(); }, 10);\r
+                    if (document && document.body) {\r
+                        this._timeoutCount += 1;\r
+                    }\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Recursively searches the immediate parent and all child nodes for \r
+         * the handle element in order to determine wheter or not it was \r
+         * clicked.\r
+         * @param node the html element to inspect\r
+         */\r
+        this.handleWasClicked = function(node, id) {\r
+            if (this.isHandle(id, node.id)) {\r
+                return true;\r
+            } else {\r
+                // check to see if this is a text node child of the one we want\r
+                var p = node.parentNode;\r
+\r
+                while (p) {\r
+                    if (this.isHandle(id, p.id)) {\r
+                        return true;\r
+                    } else {\r
+                        p = p.parentNode;\r
+                    }\r
+                }\r
+            }\r
+\r
+            return false;\r
+        };\r
+\r
+    } ();\r
+\r
+    // shorter alias, save a few bytes\r
+    YAHOO.util.DDM = YAHOO.util.DragDropMgr;\r
+    YAHOO.util.DDM._addListeners();\r
+\r
+}\r
+\r
+/**\r
+ * A DragDrop implementation where the linked element follows the \r
+ * mouse cursor during a drag.\r
+ *\r
+ * @extends YAHOO.util.DragDrop\r
+ * @constructor\r
+ * @param {String} id the id of the linked element \r
+ * @param {String} sGroup the group of related DragDrop items\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DD: \r
+ *                    scroll\r
+ */\r
+YAHOO.util.DD = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config);\r
+    }\r
+};\r
+\r
+// YAHOO.util.DD.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop);\r
+\r
+/**\r
+ * When set to true, the utility automatically tries to scroll the browser\r
+ * window wehn a drag and drop element is dragged near the viewport boundary.\r
+ * Defaults to true.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DD.prototype.scroll = true; \r
+\r
+/**\r
+ * Sets the pointer offset to the distance between the linked element's top \r
+ * left corner and the location the element was clicked\r
+ *\r
+ * @param {int} iPageX the X coordinate of the click\r
+ * @param {int} iPageY the Y coordinate of the click\r
+ */\r
+YAHOO.util.DD.prototype.autoOffset = function(iPageX, iPageY) {\r
+    // var el = this.getEl();\r
+    // var aCoord = YAHOO.util.Dom.getXY(el);\r
+    // var x = iPageX - aCoord[0];\r
+    // var y = iPageY - aCoord[1];\r
+    var x = iPageX - this.startPageX;\r
+    var y = iPageY - this.startPageY;\r
+    this.setDelta(x, y);\r
+};\r
+\r
+/** \r
+ * Sets the pointer offset.  You can call this directly to force the offset to\r
+ * be in a particular location (e.g., pass in 0,0 to set it to the center of the\r
+ * object, as done in YAHOO.widget.Slider)\r
+ *\r
+ * @param {int} iDeltaX the distance from the left\r
+ * @param {int} iDeltaY the distance from the top\r
+ */\r
+YAHOO.util.DD.prototype.setDelta = function(iDeltaX, iDeltaY) {\r
+    this.deltaX = iDeltaX;\r
+    this.deltaY = iDeltaY;\r
+};\r
+\r
+/**\r
+ * Sets the drag element to the location of the mousedown or click event, \r
+ * maintaining the cursor location relative to the location on the element \r
+ * that was clicked.  Override this if you want to place the element in a \r
+ * location other than where the cursor is.\r
+ *\r
+ * @param {int} iPageX the X coordinate of the mousedown or drag event\r
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event\r
+ */\r
+\r
+YAHOO.util.DD.prototype.setDragElPos = function(iPageX, iPageY) {\r
+    // the first time we do this, we are going to check to make sure\r
+    // the element has css positioning\r
+\r
+    var el = this.getDragEl();\r
+\r
+    // if (!this.cssVerified) {\r
+        // var pos = el.style.position;\r
+    // }\r
+\r
+    this.alignElWithMouse(el, iPageX, iPageY);\r
+};\r
+\r
+/**\r
+ * Sets the element to the location of the mousedown or click event, \r
+ * maintaining the cursor location relative to the location on the element \r
+ * that was clicked.  Override this if you want to place the element in a \r
+ * location other than where the cursor is.\r
+ *\r
+ * @param {HTMLElement} el the element to move\r
+ * @param {int} iPageX the X coordinate of the mousedown or drag event\r
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event\r
+ */\r
+YAHOO.util.DD.prototype.alignElWithMouse = function(el, iPageX, iPageY) {\r
+    var oCoord = this.getTargetCoord(iPageX, iPageY);\r
+\r
+    // this.deltaSetXY = null;\r
+    if (!this.deltaSetXY) {\r
+        var aCoord = [oCoord.x, oCoord.y];\r
+        YAHOO.util.Dom.setXY(el, aCoord);\r
+        var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );\r
+        var newTop  = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );\r
+\r
+        this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];\r
+\r
+    } else {\r
+        YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");\r
+        YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");\r
+    }\r
+    \r
+\r
+    this.cachePosition(oCoord.x, oCoord.y);\r
+\r
+    this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);\r
+};\r
+\r
+/**\r
+ * Saves the most recent position so that we can reset the constraints and\r
+ * tick marks on-demand.  We need to know this so that we can calculate the\r
+ * number of pixels the element is offset from its original position.\r
+ */\r
+YAHOO.util.DD.prototype.cachePosition = function(iPageX, iPageY) {\r
+    if (iPageX) {\r
+        this.lastPageX = iPageX;\r
+        this.lastPageY = iPageY;\r
+    } else {\r
+        var aCoord = YAHOO.util.Dom.getXY(this.getEl());\r
+        this.lastPageX = aCoord[0];\r
+        this.lastPageY = aCoord[1];\r
+    }\r
+};\r
+\r
+/**\r
+ * Auto-scroll the window if the dragged object has been moved beyond the \r
+ * visible window boundary.\r
+ *\r
+ * @param {int} x the drag element's x position\r
+ * @param {int} y the drag element's y position\r
+ * @param {int} h the height of the drag element\r
+ * @param {int} w the width of the drag element\r
+ * @private\r
+ */\r
+YAHOO.util.DD.prototype.autoScroll = function(x, y, h, w) {\r
+\r
+    if (this.scroll) {\r
+        // The client height\r
+        var clientH = this.DDM.getClientHeight();\r
+\r
+        // The client width\r
+        var clientW = this.DDM.getClientWidth();\r
+\r
+        // The amt scrolled down\r
+        var st = this.DDM.getScrollTop();\r
+\r
+        // The amt scrolled right\r
+        var sl = this.DDM.getScrollLeft();\r
+\r
+        // Location of the bottom of the element\r
+        var bot = h + y;\r
+\r
+        // Location of the right of the element\r
+        var right = w + x;\r
+\r
+        // The distance from the cursor to the bottom of the visible area, \r
+        // adjusted so that we don't scroll if the cursor is beyond the\r
+        // element drag constraints\r
+        var toBot = (clientH + st - y - this.deltaY);\r
+\r
+        // The distance from the cursor to the right of the visible area\r
+        var toRight = (clientW + sl - x - this.deltaX);\r
+\r
+\r
+        // How close to the edge the cursor must be before we scroll\r
+        // var thresh = (document.all) ? 100 : 40;\r
+        var thresh = 40;\r
+\r
+        // How many pixels to scroll per autoscroll op.  This helps to reduce \r
+        // clunky scrolling. IE is more sensitive about this ... it needs this \r
+        // value to be higher.\r
+        var scrAmt = (document.all) ? 80 : 30;\r
+\r
+        // Scroll down if we are near the bottom of the visible page and the \r
+        // obj extends below the crease\r
+        if ( bot > clientH && toBot < thresh ) { \r
+            window.scrollTo(sl, st + scrAmt); \r
+        }\r
+\r
+        // Scroll up if the window is scrolled down and the top of the object\r
+        // goes above the top border\r
+        if ( y < st && st > 0 && y - st < thresh ) { \r
+            window.scrollTo(sl, st - scrAmt); \r
+        }\r
+\r
+        // Scroll right if the obj is beyond the right border and the cursor is\r
+        // near the border.\r
+        if ( right > clientW && toRight < thresh ) { \r
+            window.scrollTo(sl + scrAmt, st); \r
+        }\r
+\r
+        // Scroll left if the window has been scrolled to the right and the obj\r
+        // extends past the left border\r
+        if ( x < sl && sl > 0 && x - sl < thresh ) { \r
+            window.scrollTo(sl - scrAmt, st);\r
+        }\r
+    }\r
+};\r
+\r
+/**\r
+ * Finds the location the element should be placed if we want to move\r
+ * it to where the mouse location less the click offset would place us.\r
+ *\r
+ * @param {int} iPageX the X coordinate of the click\r
+ * @param {int} iPageY the Y coordinate of the click\r
+ * @return an object that contains the coordinates (Object.x and Object.y)\r
+ * @private\r
+ */\r
+YAHOO.util.DD.prototype.getTargetCoord = function(iPageX, iPageY) {\r
+\r
+\r
+    var x = iPageX - this.deltaX;\r
+    var y = iPageY - this.deltaY;\r
+\r
+    if (this.constrainX) {\r
+        if (x < this.minX) { x = this.minX; }\r
+        if (x > this.maxX) { x = this.maxX; }\r
+    }\r
+\r
+    if (this.constrainY) {\r
+        if (y < this.minY) { y = this.minY; }\r
+        if (y > this.maxY) { y = this.maxY; }\r
+    }\r
+\r
+    x = this.getTick(x, this.xTicks);\r
+    y = this.getTick(y, this.yTicks);\r
+\r
+\r
+    return {x:x, y:y};\r
+};\r
+\r
+YAHOO.util.DD.prototype.applyConfig = function() {\r
+    YAHOO.util.DD.superclass.applyConfig.call(this);\r
+    this.scroll = (this.config.scroll !== false);\r
+};\r
+\r
+/** \r
+ * Event that fires prior to the onMouseDown event.  Overrides \r
+ * YAHOO.util.DragDrop.\r
+ */\r
+YAHOO.util.DD.prototype.b4MouseDown = function(e) {\r
+    // this.resetConstraints();\r
+    this.autoOffset(YAHOO.util.Event.getPageX(e), \r
+                        YAHOO.util.Event.getPageY(e));\r
+};\r
+\r
+/** \r
+ * Event that fires prior to the onDrag event.  Overrides \r
+ * YAHOO.util.DragDrop.\r
+ */\r
+YAHOO.util.DD.prototype.b4Drag = function(e) {\r
+    this.setDragElPos(YAHOO.util.Event.getPageX(e), \r
+                        YAHOO.util.Event.getPageY(e));\r
+};\r
+\r
+YAHOO.util.DD.prototype.toString = function() {\r
+    return ("DD " + this.id);\r
+};\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+// Debugging ygDragDrop events that can be overridden\r
+///////////////////////////////////////////////////////////////////////////////\r
+/*\r
+YAHOO.util.DD.prototype.startDrag = function(x, y) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDrag = function(e) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragEnter = function(e, id) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragOver = function(e, id) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragOut = function(e, id) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.onDragDrop = function(e, id) {\r
+};\r
+\r
+YAHOO.util.DD.prototype.endDrag = function(e) {\r
+};\r
+*/\r
+\r
+/**\r
+ * A DragDrop implementation that inserts an empty, bordered div into\r
+ * the document that follows the cursor during drag operations.  At the time of\r
+ * the click, the frame div is resized to the dimensions of the linked html\r
+ * element, and moved to the exact location of the linked element.\r
+ *\r
+ * References to the "frame" element refer to the single proxy element that\r
+ * was created to be dragged in place of all DDProxy elements on the\r
+ * page.\r
+ *\r
+ * @extends YAHOO.util.DD\r
+ * @constructor\r
+ * @param {String} id the id of the linked html element\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DDProxy in addition to those in DragDrop: \r
+ *                   resizeFrame, centerFrame, dragElId\r
+ */\r
+YAHOO.util.DDProxy = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.init(id, sGroup, config);\r
+        this.initFrame(); \r
+    }\r
+};\r
+\r
+YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD);\r
+\r
+/**\r
+ * The default drag frame div id\r
+ * @type String\r
+ */\r
+YAHOO.util.DDProxy.dragElId = "ygddfdiv";\r
+\r
+/**\r
+ * By default we resize the drag frame to be the same size as the element\r
+ * we want to drag (this is to get the frame effect).  We can turn it off\r
+ * if we want a different behavior.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DDProxy.prototype.resizeFrame = true;\r
+\r
+/**\r
+ * By default the frame is positioned exactly where the drag element is, so\r
+ * we use the cursor offset provided by YAHOO.util.DD.  Another option that works only if\r
+ * you do not have constraints on the obj is to have the drag frame centered\r
+ * around the cursor.  Set centerFrame to true for this effect.\r
+ *\r
+ * @type boolean\r
+ */\r
+YAHOO.util.DDProxy.prototype.centerFrame = false;\r
+\r
+/**\r
+ * Previous proxy element size.\r
+ * @private\r
+ */\r
+YAHOO.util.DDProxy.prototype._previousSize = [-1, -1];\r
+\r
+/**\r
+ * Create the drag frame if needed\r
+ */\r
+YAHOO.util.DDProxy.prototype.createFrame = function() {\r
+    var self = this;\r
+    var body = document.body;\r
+\r
+    if (!body || !body.firstChild) {\r
+        setTimeout( function() { self.createFrame(); }, 50 );\r
+        return;\r
+    }\r
+\r
+    var div = this.getDragEl();\r
+\r
+    if (!div) {\r
+        div    = document.createElement("div");\r
+        div.id = this.dragElId;\r
+        var s  = div.style;\r
+\r
+        s.position   = "absolute";\r
+        s.visibility = "hidden";\r
+        s.cursor     = "move";\r
+        s.border     = "2px solid #aaa";\r
+        s.zIndex     = 999;\r
+\r
+        // appendChild can blow up IE if invoked prior to the window load event\r
+        // while rendering a table.  It is possible there are other scenarios \r
+        // that would cause this to happen as well.\r
+        body.insertBefore(div, body.firstChild);\r
+    }\r
+};\r
+\r
+/**\r
+ * Initialization for the drag frame element.  Must be called in the\r
+ * constructor of all subclasses\r
+ */\r
+YAHOO.util.DDProxy.prototype.initFrame = function() {\r
+    // YAHOO.util.DDProxy.createFrame();\r
+    // this.setDragElId(YAHOO.util.DDProxy.dragElId);\r
+\r
+    this.createFrame();\r
+\r
+};\r
+\r
+YAHOO.util.DDProxy.prototype.applyConfig = function() {\r
+    YAHOO.util.DDProxy.superclass.applyConfig.call(this);\r
+\r
+    this.resizeFrame = (this.config.resizeFrame !== false);\r
+    this.centerFrame = (this.config.centerFrame);\r
+    this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);\r
+\r
+};\r
+\r
+/**\r
+ * Resizes the drag frame to the dimensions of the clicked object, positions \r
+ * it over the object, and finally displays it\r
+ *\r
+ * @param {int} iPageX X click position\r
+ * @param {int} iPageY Y click position\r
+ * @private\r
+ */\r
+YAHOO.util.DDProxy.prototype.showFrame = function(iPageX, iPageY) {\r
+    var el = this.getEl();\r
+    var dragEl = this.getDragEl();\r
+    var s = dragEl.style;\r
+\r
+    this._resizeProxy();\r
+\r
+    if (this.centerFrame) {\r
+        this.setDelta( Math.round(parseInt(s.width,  10)/2), \r
+                       Math.round(parseInt(s.height, 10)/2) );\r
+    }\r
+\r
+    this.setDragElPos(iPageX, iPageY);\r
+\r
+    // s.visibility = "";\r
+    YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); \r
+};\r
+\r
+YAHOO.util.DDProxy.prototype._resizeProxy = function() {\r
+    var DOM    = YAHOO.util.Dom;\r
+    var el     = this.getEl();\r
+    var dragEl = this.getDragEl();\r
+\r
+    if (this.resizeFrame) {\r
+        var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth"    ), 10);\r
+        var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth"  ), 10);\r
+        var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);\r
+        var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth"   ), 10);\r
+\r
+        if (isNaN(bt)) { bt = 0; }\r
+        if (isNaN(br)) { br = 0; }\r
+        if (isNaN(bb)) { bb = 0; }\r
+        if (isNaN(bl)) { bl = 0; }\r
+\r
+\r
+        var newWidth  = el.offsetWidth - br - bl;\r
+        var newHeight = el.offsetHeight - bt - bb;\r
+\r
+        if (this._previousSize[0] !== newWidth && \r
+                        this._previousSize[1] !== newHeight) {\r
+\r
+\r
+            DOM.setStyle( dragEl, "width",  newWidth  + "px" );\r
+            DOM.setStyle( dragEl, "height", newHeight + "px" );\r
+\r
+            this._previousSize = [newWidth, newHeight];\r
+        }\r
+    }\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4MouseDown = function(e) {\r
+    var x = YAHOO.util.Event.getPageX(e);\r
+    var y = YAHOO.util.Event.getPageY(e);\r
+    this.autoOffset(x, y);\r
+    this.setDragElPos(x, y);\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4StartDrag = function(x, y) {\r
+    // show the drag frame\r
+    this.showFrame(x, y);\r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+YAHOO.util.DDProxy.prototype.b4EndDrag = function(e) {\r
+    YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); \r
+};\r
+\r
+// overrides YAHOO.util.DragDrop\r
+// By default we try to move the element to the last location of the frame.  \r
+// This is so that the default behavior mirrors that of YAHOO.util.DD.  \r
+YAHOO.util.DDProxy.prototype.endDrag = function(e) {\r
+    var DOM = YAHOO.util.Dom;\r
+    var lel = this.getEl();\r
+    var del = this.getDragEl();\r
+\r
+    // Show the drag frame briefly so we can get its position\r
+    // del.style.visibility = "";\r
+    DOM.setStyle(del, "visibility", ""); \r
+\r
+    // Hide the linked element before the move to get around a Safari \r
+    // rendering bug.\r
+    //lel.style.visibility = "hidden";\r
+    DOM.setStyle(lel, "visibility", "hidden"); \r
+    YAHOO.util.DDM.moveToEl(lel, del);\r
+    //del.style.visibility = "hidden";\r
+    DOM.setStyle(del, "visibility", "hidden"); \r
+    //lel.style.visibility = "";\r
+    DOM.setStyle(lel, "visibility", ""); \r
+};\r
+\r
+YAHOO.util.DDProxy.prototype.toString = function() {\r
+    return ("DDProxy " + this.id);\r
+};\r
+\r
+/**\r
+ * A DragDrop implementation that does not move, but can be a drop \r
+ * target.  You would get the same result by simply omitting implementation \r
+ * for the event callbacks, but this way we reduce the processing cost of the \r
+ * event listener and the callbacks.\r
+ *\r
+ * @extends YAHOO.util.DragDrop \r
+ * @constructor\r
+ * @param {String} id the id of the element that is a drop target\r
+ * @param {String} sGroup the group of related DragDrop objects\r
+ * @param {object} config an object containing configurable attributes\r
+ *                Valid properties for DDTarget in addition to those in DragDrop: \r
+ *                  none\r
+ */\r
\r
+YAHOO.util.DDTarget = function(id, sGroup, config) {\r
+    if (id) {\r
+        this.initTarget(id, sGroup, config);\r
+    }\r
+};\r
+\r
+// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop);\r
+\r
+YAHOO.util.DDTarget.prototype.toString = function() {\r
+    return ("DDTarget " + this.id);\r
+};\r
+\r
diff --git a/lib/yui/event/README b/lib/yui/event/README
new file mode 100755 (executable)
index 0000000..29132d4
--- /dev/null
@@ -0,0 +1,55 @@
+\r
+YUI Library - Event - Release Notes\r
+\r
+0.11.0\r
+\r
+   * Added Event.purgeElement which will remove all listeners added via \r
+     addListener from the supplied element.  If an optional "type" parameter\r
+     is supplied, only events of that type will be removed.  Optionally, the\r
+     purge can be performed recursively on the element's children as well.\r
+\r
+   * Added Event.getListeners which will return all listeners attached to \r
+     a given element.. either all listeners or listeners of a specific type.\r
+\r
+   * getTarget now automatically resolves text nodes.  The optional parameter\r
+     for this feature is now deprecated.\r
+\r
+   * getRelatedTarget now resolves text nodes for the browsers that return the\r
+     text node rather than its host HTML element.\r
+\r
+   * CustomEvent now logs the custom event activity if the logger widget is available\r
+\r
+0.10.0\r
+\r
+   * Added Safari dblclick to the list of legacy events.\r
+\r
+   * When multiple identical event handlers are defined, multiple calls\r
+     to removeListener can now remove all of them.\r
+\r
+   * removeListener works properly for unload events\r
+\r
+   * Legacy event bookkeeping is more efficient, improving the performance for\r
+     adding Safari click events.\r
+\r
+   * _unload() is more efficient, improving the page transition experience in \r
+     Safari in particular.\r
+\r
+   * addListener, removeListener now return false if the function argument is\r
+     not valid.\r
+\r
+   * Fixed an operator precedence issue in getCharCode.\r
+\r
+   * Added Event.getXY, which returns [Event.getPageX(e), Event.getPageY(e)]\r
+\r
+   * Added Event.onAvailable, which will execute the callback when the element\r
+     with the supplied id is found.  Currently searches periodically until the\r
+     window load event or for up to 10 seconds after the onAvailable method \r
+     was executed.\r
+\r
+   * The lazy listener attachment process now will poll beyond the window load\r
+     event in order to better handle the case when a listener is defined\r
+     late in the page but before the element is in the dom.\r
+\r
+   * Fixed browser detection for Opera installations reporting as IE.\r
+\r
+   * It is now possible to remove and re-add legacy events (Safari click event).\r
diff --git a/lib/yui/event/event-debug.js b/lib/yui/event/event-debug.js
new file mode 100755 (executable)
index 0000000..66f5f26
--- /dev/null
@@ -0,0 +1,1232 @@
+\r
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+\r
+/**\r
+ * The CustomEvent class lets you define events for your application\r
+ * that can be subscribed to by one or more independent component.\r
+ *\r
+ * @param {String} type The type of event, which is passed to the callback\r
+ *                 when the event fires\r
+ * @param {Object} oScope The context the event will fire from.  "this" will\r
+ *                 refer to this object in the callback.  Default value: \r
+ *                 the window object.  The listener can override this.\r
+ * @constructor\r
+ */\r
+YAHOO.util.CustomEvent = function(type, oScope, silent) {\r
+\r
+    /**\r
+     * The type of event, returned to subscribers when the event fires\r
+     * @type string\r
+     */\r
+    this.type = type;\r
+\r
+    /**\r
+     * The scope the the event will fire from by default.  Defaults to the window \r
+     * obj\r
+     * @type object\r
+     */\r
+    this.scope = oScope || window;\r
+\r
+    /**\r
+     * By default all custom events are logged in the debug build, set silent\r
+     * to true to disable logging for this event.\r
+     * @type boolean\r
+     */\r
+    this.silent = silent;\r
+\r
+    /**\r
+     * The subscribers to this event\r
+     * @type Subscriber[]\r
+     */\r
+    this.subscribers = [];\r
+\r
+    // Register with the event utility for automatic cleanup.  Made optional\r
+    // so that CustomEvent can be used independently of pe.event\r
+    if (YAHOO.util.Event) { \r
+        YAHOO.util.Event.regCE(this);\r
+    }\r
+\r
+    if (!this.silent) {\r
+        YAHOO.log( "Creating " + this, "info", "Event" );\r
+    }\r
+};\r
+\r
+YAHOO.util.CustomEvent.prototype = {\r
+    /**\r
+     * Subscribes the caller to this event\r
+     * @param {Function} fn       The function to execute\r
+     * @param {Object}   obj      An object to be passed along when the event fires\r
+     * @param {boolean}  bOverride If true, the obj passed in becomes the execution\r
+     *                            scope of the listener\r
+     */\r
+    subscribe: function(fn, obj, bOverride) {\r
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, bOverride) );\r
+    },\r
+\r
+    /**\r
+     * Unsubscribes the caller from this event\r
+     * @param {Function} fn  The function to execute\r
+     * @param {Object}   obj An object to be passed along when the event fires\r
+     * @return {boolean} True if the subscriber was found and detached.\r
+     */\r
+    unsubscribe: function(fn, obj) {\r
+        var found = false;\r
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {\r
+            var s = this.subscribers[i];\r
+            if (s && s.contains(fn, obj)) {\r
+                this._delete(i);\r
+                found = true;\r
+            }\r
+        }\r
+\r
+        return found;\r
+    },\r
+\r
+    /**\r
+     * Notifies the subscribers.  The callback functions will be executed\r
+     * from the scope specified when the event was created, and with the following\r
+     * parameters:\r
+     *   <pre>\r
+     *   - The type of event\r
+     *   - All of the arguments fire() was executed with as an array\r
+     *   - The custom object (if any) that was passed into the subscribe() method\r
+     *   </pre>\r
+     *   \r
+     * @param {Array} an arbitrary set of parameters to pass to the handler\r
+     */\r
+    fire: function() {\r
+        var len=this.subscribers.length;\r
+\r
+        var args = [];\r
+\r
+        for (var i=0; i<arguments.length; ++i) {\r
+            args.push(arguments[i]);\r
+        }\r
+\r
+\r
+        if (!this.silent) {\r
+            YAHOO.log( "Firing "       + this  + ", " + \r
+                       "args: "        + args  + ", " +\r
+                       "subscribers: " + len,                 \r
+                       "info", "Event"                  );\r
+        }\r
+\r
+        for (i=0; i<len; ++i) {\r
+            var s = this.subscribers[i];\r
+            if (s) {\r
+                if (!this.silent) {\r
+                    YAHOO.log( this.type + "->" + (i+1) + ": " +  s, "info", "Event" );\r
+                }\r
+                var scope = (s.override) ? s.obj : this.scope;\r
+                s.fn.call(scope, this.type, args, s.obj);\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Removes all listeners\r
+     */\r
+    unsubscribeAll: function() {\r
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {\r
+            this._delete(i);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    _delete: function(index) {\r
+        var s = this.subscribers[index];\r
+        if (s) {\r
+            delete s.fn;\r
+            delete s.obj;\r
+        }\r
+\r
+        delete this.subscribers[index];\r
+    },\r
+\r
+    toString: function() {\r
+         return "CustomEvent: " + "'" + this.type  + "', " + \r
+             "scope: " + this.scope;\r
+\r
+    }\r
+};\r
+\r
+/////////////////////////////////////////////////////////////////////\r
+\r
+/**\r
+ * @class Stores the subscriber information to be used when the event fires.\r
+ * @param {Function} fn       The function to execute\r
+ * @param {Object}   obj      An object to be passed along when the event fires\r
+ * @param {boolean}  bOverride If true, the obj passed in becomes the execution\r
+ *                            scope of the listener\r
+ * @constructor\r
+ */\r
+YAHOO.util.Subscriber = function(fn, obj, bOverride) {\r
+    /**\r
+     * The callback that will be execute when the event fires\r
+     * @type function\r
+     */\r
+    this.fn = fn;\r
+\r
+    /**\r
+     * An optional custom object that will passed to the callback when\r
+     * the event fires\r
+     * @type object\r
+     */\r
+    this.obj = obj || null;\r
+\r
+    /**\r
+     * The default execution scope for the event listener is defined when the\r
+     * event is created (usually the object which contains the event).\r
+     * By setting override to true, the execution scope becomes the custom\r
+     * object passed in by the subscriber\r
+     * @type boolean\r
+     */\r
+    this.override = (bOverride);\r
+};\r
+\r
+/**\r
+ * Returns true if the fn and obj match this objects properties.\r
+ * Used by the unsubscribe method to match the right subscriber.\r
+ *\r
+ * @param {Function} fn the function to execute\r
+ * @param {Object} obj an object to be passed along when the event fires\r
+ * @return {boolean} true if the supplied arguments match this \r
+ *                   subscriber's signature.\r
+ */\r
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {\r
+    return (this.fn == fn && this.obj == obj);\r
+};\r
+\r
+YAHOO.util.Subscriber.prototype.toString = function() {\r
+    return "Subscriber { obj: " + (this.obj || "")  + \r
+           ", override: " +  (this.override || "no") + " }";\r
+};\r
+// Only load this library once.  If it is loaded a second time, existing\r
+// events cannot be detached.\r
+if (!YAHOO.util.Event) {\r
+\r
+/**\r
+ * @class\r
+ * The event utility provides functions to add and remove event listeners,\r
+ * event cleansing.  It also tries to automatically remove listeners it\r
+ * registers during the unload event.\r
+ * @constructor\r
+ */\r
+    YAHOO.util.Event = function() {\r
+\r
+        /**\r
+         * True after the onload event has fired\r
+         * @type boolean\r
+         * @private\r
+         */\r
+        var loadComplete =  false;\r
+\r
+        /**\r
+         * Cache of wrapped listeners\r
+         * @type array\r
+         * @private\r
+         */\r
+        var listeners = [];\r
+\r
+        /**\r
+         * Listeners that will be attached during the onload event\r
+         * @type array\r
+         * @private\r
+         */\r
+        var delayedListeners = [];\r
+\r
+        /**\r
+         * User-defined unload function that will be fired before all events\r
+         * are detached\r
+         * @type array\r
+         * @private\r
+         */\r
+        var unloadListeners = [];\r
+\r
+        /**\r
+         * Cache of the custom events that have been defined.  Used for\r
+         * automatic cleanup\r
+         * @type array\r
+         * @private\r
+         */\r
+        var customEvents = [];\r
+\r
+        /**\r
+         * Cache of DOM0 event handlers to work around issues with DOM2 events\r
+         * in Safari\r
+         * @private\r
+         */\r
+        var legacyEvents = [];\r
+\r
+        /**\r
+         * Listener stack for DOM0 events\r
+         * @private\r
+         */\r
+        var legacyHandlers = [];\r
+\r
+        /**\r
+         * The number of times to poll after window.onload.  This number is\r
+         * increased if additional late-bound handlers are requested after\r
+         * the page load.\r
+         * @private\r
+         */\r
+        var retryCount = 0;\r
+\r
+        /**\r
+         * onAvailable listeners\r
+         * @private\r
+         */\r
+        var onAvailStack = [];\r
+\r
+        /**\r
+         * Lookup table for legacy events\r
+         * @private\r
+         */\r
+        var legacyMap = [];\r
+\r
+        /**\r
+         * Counter for auto id generation\r
+         * @private\r
+         */\r
+        var counter = 0;\r
+\r
+        return { // PREPROCESS\r
+\r
+            /**\r
+             * The number of times we should look for elements that are not\r
+             * in the DOM at the time the event is requested after the document\r
+             * has been loaded.  The default is 200@50 ms, so it will poll\r
+             * for 10 seconds or until all outstanding handlers are bound\r
+             * (whichever comes first).\r
+             * @type int\r
+             */\r
+            POLL_RETRYS: 200,\r
+\r
+            /**\r
+             * The poll interval in milliseconds\r
+             * @type int\r
+             */\r
+            POLL_INTERVAL: 50,\r
+\r
+            /**\r
+             * Element to bind, int constant\r
+             * @type int\r
+             */\r
+            EL: 0,\r
+\r
+            /**\r
+             * Type of event, int constant\r
+             * @type int\r
+             */\r
+            TYPE: 1,\r
+\r
+            /**\r
+             * Function to execute, int constant\r
+             * @type int\r
+             */\r
+            FN: 2,\r
+\r
+            /**\r
+             * Function wrapped for scope correction and cleanup, int constant\r
+             * @type int\r
+             */\r
+            WFN: 3,\r
+\r
+            /**\r
+             * Object passed in by the user that will be returned as a \r
+             * parameter to the callback, int constant\r
+             * @type int\r
+             */\r
+            SCOPE: 3,\r
+\r
+            /**\r
+             * Adjusted scope, either the element we are registering the event\r
+             * on or the custom object passed in by the listener, int constant\r
+             * @type int\r
+             */\r
+            ADJ_SCOPE: 4,\r
+\r
+            /**\r
+             * Safari detection is necessary to work around the preventDefault\r
+             * bug that makes it so you can't cancel a href click from the \r
+             * handler.  There is not a capabilities check we can use here.\r
+             * @private\r
+             */\r
+            isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),\r
+\r
+            /**\r
+             * IE detection needed to properly calculate pageX and pageY.  \r
+             * capabilities checking didn't seem to work because another \r
+             * browser that does not provide the properties have the values \r
+             * calculated in a different manner than IE.\r
+             * @private\r
+             */\r
+            isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && \r
+                    navigator.userAgent.match(/msie/gi)),\r
+\r
+            /**\r
+             * @private\r
+             */\r
+            addDelayedListener: function(el, sType, fn, oScope, bOverride) {\r
+                delayedListeners[delayedListeners.length] =\r
+                    [el, sType, fn, oScope, bOverride];\r
+\r
+                // If this happens after the inital page load, we need to\r
+                // reset the poll counter so that we continue to search for\r
+                // the element for a fixed period of time.\r
+                if (loadComplete) {\r
+                    retryCount = this.POLL_RETRYS;\r
+                    this.startTimeout(0);\r
+                    // this._tryPreloadAttach();\r
+                }\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             */\r
+            startTimeout: function(interval) {\r
+                var i = (interval || interval === 0) ? interval : this.POLL_INTERVAL;\r
+                var self = this;\r
+                var callback = function() { self._tryPreloadAttach(); };\r
+                this.timeout = setTimeout(callback, i);\r
+            },\r
+\r
+            /**\r
+             * Executes the supplied callback when the item with the supplied\r
+             * id is found.  This is meant to be used to execute behavior as\r
+             * soon as possible as the page loads.  If you use this after the\r
+             * initial page load it will poll for a fixed time for the element.\r
+             * The number of times it will poll and the frequency are\r
+             * configurable.  By default it will poll for 10 seconds.\r
+             * @param {string} p_id the id of the element to look for.\r
+             * @param {function} p_fn what to execute when the element is found.\r
+             * @param {object} p_obj an optional object to be passed back as\r
+             * a parameter to p_fn.\r
+             * @param {boolean} p_override If set to true, p_fn will execute\r
+             * in the scope of p_obj\r
+             *\r
+             */\r
+            onAvailable: function(p_id, p_fn, p_obj, p_override) {\r
+                onAvailStack.push( { id:       p_id, \r
+                                     fn:       p_fn, \r
+                                     obj:      p_obj, \r
+                                     override: p_override } );\r
+\r
+                retryCount = this.POLL_RETRYS;\r
+                this.startTimeout(0);\r
+                // this._tryPreloadAttach();\r
+            },\r
+\r
+            /**\r
+             * Appends an event handler\r
+             *\r
+             * @param {Object}   el        The html element to assign the \r
+             *                             event to\r
+             * @param {String}   sType     The type of event to append\r
+             * @param {Function} fn        The method the event invokes\r
+             * @param {Object}   oScope    An arbitrary object that will be \r
+             *                             passed as a parameter to the handler\r
+             * @param {boolean}  bOverride If true, the obj passed in becomes\r
+             *                             the execution scope of the listener\r
+             * @return {boolean} True if the action was successful or defered,\r
+             *                        false if one or more of the elements \r
+             *                        could not have the event bound to it.\r
+             */\r
+            addListener: function(el, sType, fn, oScope, bOverride) {\r
+\r
+                if (!fn || !fn.call) {\r
+                    // this.logger.debug("Error, function is not valid " + fn);\r
+                    return false;\r
+                }\r
+\r
+                // The el argument can be an array of elements or element ids.\r
+                if ( this._isValidCollection(el)) {\r
+                    var ok = true;\r
+                    for (var i=0,len=el.length; i<len; ++i) {\r
+                        ok = ( this.on(el[i], \r
+                                       sType, \r
+                                       fn, \r
+                                       oScope, \r
+                                       bOverride) && ok );\r
+                    }\r
+                    return ok;\r
+\r
+                } else if (typeof el == "string") {\r
+                    var oEl = this.getEl(el);\r
+                    // If the el argument is a string, we assume it is \r
+                    // actually the id of the element.  If the page is loaded\r
+                    // we convert el to the actual element, otherwise we \r
+                    // defer attaching the event until onload event fires\r
+\r
+                    // check to see if we need to delay hooking up the event \r
+                    // until after the page loads.\r
+                    if (loadComplete && oEl) {\r
+                        el = oEl;\r
+                    } else {\r
+                        // defer adding the event until onload fires\r
+                        this.addDelayedListener(el, \r
+                                                sType, \r
+                                                fn, \r
+                                                oScope, \r
+                                                bOverride);\r
+\r
+                        return true;\r
+                    }\r
+                }\r
+\r
+                // Element should be an html element or an array if we get \r
+                // here.\r
+                if (!el) {\r
+                    // this.logger.debug("unable to attach event " + sType);\r
+                    return false;\r
+                }\r
+\r
+                // we need to make sure we fire registered unload events \r
+                // prior to automatically unhooking them.  So we hang on to \r
+                // these instead of attaching them to the window and fire the\r
+                // handles explicitly during our one unload event.\r
+                if ("unload" == sType && oScope !== this) {\r
+                    unloadListeners[unloadListeners.length] =\r
+                            [el, sType, fn, oScope, bOverride];\r
+                    return true;\r
+                }\r
+\r
+                // this.logger.debug("Adding handler: " + el + ", " + sType);\r
+\r
+                // if the user chooses to override the scope, we use the custom\r
+                // object passed in, otherwise the executing scope will be the\r
+                // HTML element that the event is registered on\r
+                var scope = (bOverride) ? oScope : el;\r
+\r
+                // wrap the function so we can return the oScope object when\r
+                // the event fires;\r
+                var wrappedFn = function(e) {\r
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e), \r
+                                oScope);\r
+                    };\r
+\r
+                var li = [el, sType, fn, wrappedFn, scope];\r
+                var index = listeners.length;\r
+                // cache the listener so we can try to automatically unload\r
+                listeners[index] = li;\r
+\r
+                if (this.useLegacyEvent(el, sType)) {\r
+                    var legacyIndex = this.getLegacyIndex(el, sType);\r
+                    if (legacyIndex == -1) {\r
+\r
+                        legacyIndex = legacyEvents.length;\r
+                        legacyMap[el.id + sType] = legacyIndex;\r
+\r
+                        // cache the signature for the DOM0 event, and \r
+                        // include the existing handler for the event, if any\r
+                        legacyEvents[legacyIndex] = \r
+                            [el, sType, el["on" + sType]];\r
+                        legacyHandlers[legacyIndex] = [];\r
+\r
+                        el["on" + sType] = \r
+                            function(e) {\r
+                                YAHOO.util.Event.fireLegacyEvent(\r
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);\r
+                            };\r
+                    }\r
+\r
+                    // add a reference to the wrapped listener to our custom\r
+                    // stack of events\r
+                    legacyHandlers[legacyIndex].push(index);\r
+\r
+                // DOM2 Event model\r
+                } else if (el.addEventListener) {\r
+                    // this.logger.debug("adding DOM event: " + el.id + \r
+                    // ", " + sType);\r
+                    el.addEventListener(sType, wrappedFn, false);\r
+                // IE\r
+                } else if (el.attachEvent) {\r
+                    el.attachEvent("on" + sType, wrappedFn);\r
+                }\r
+\r
+                return true;\r
+                \r
+            },\r
+\r
+            /**\r
+             * Shorthand for YAHOO.util.Event.addListener\r
+             * @type function\r
+             */\r
+            // on: this.addListener,\r
+\r
+            /**\r
+             * When using legacy events, the handler is routed to this object\r
+             * so we can fire our custom listener stack.\r
+             * @private\r
+             */\r
+            fireLegacyEvent: function(e, legacyIndex) {\r
+                // this.logger.debug("fireLegacyEvent " + legacyIndex);\r
+                var ok = true;\r
+\r
+                var le = legacyHandlers[legacyIndex];\r
+                for (var i=0,len=le.length; i<len; ++i) {\r
+                    var index = le[i];\r
+                    // this.logger.debug(index);\r
+                    if (index) {\r
+                        var li = listeners[index];\r
+                        if ( li && li[this.WFN] ) {\r
+                            var scope = li[this.ADJ_SCOPE];\r
+                            var ret = li[this.WFN].call(scope, e);\r
+                            ok = (ok && ret);\r
+                        } else {\r
+                            // This listener was removed, so delete it from\r
+                            // the array\r
+                            delete le[i];\r
+                        }\r
+                        // this.logger.debug(ok);\r
+                    }\r
+                }\r
+\r
+                return ok;\r
+            },\r
+\r
+            /**\r
+             * Returns the legacy event index that matches the supplied \r
+             * signature\r
+             * @private\r
+             */\r
+            getLegacyIndex: function(el, sType) {\r
+                /*\r
+                for (var i=0,len=legacyEvents.length; i<len; ++i) {\r
+                    var le = legacyEvents[i];\r
+                    if (le && le[0] === el && le[1] === sType) {\r
+                        return i;\r
+                    }\r
+                }\r
+                return -1;\r
+                */\r
+\r
+                var key = this.generateId(el) + sType;\r
+                if (typeof legacyMap[key] == "undefined") { \r
+                    return -1;\r
+                } else {\r
+                    return legacyMap[key];\r
+                }\r
+\r
+            },\r
+\r
+            /**\r
+             * Logic that determines when we should automatically use legacy\r
+             * events instead of DOM2 events.\r
+             * @private\r
+             */\r
+            useLegacyEvent: function(el, sType) {\r
+\r
+                if (!el.addEventListener && !el.attachEvent) {\r
+                    return true;\r
+                } else if (this.isSafari) {\r
+                    if ("click" == sType || "dblclick" == sType) {\r
+                        return true;\r
+                    }\r
+                }\r
+\r
+                return false;\r
+            },\r
+                    \r
+            /**\r
+             * Removes an event handler\r
+             *\r
+             * @param {Object} el the html element or the id of the element to \r
+             * assign the event to.\r
+             * @param {String} sType the type of event to remove\r
+             * @param {Function} fn the method the event invokes\r
+             * @return {boolean} true if the unbind was successful, false \r
+             * otherwise\r
+             */\r
+            removeListener: function(el, sType, fn, index) {\r
+\r
+                if (!fn || !fn.call) {\r
+                    // this.logger.debug("Error, function is not valid " + fn);\r
+                    return false;\r
+                }\r
+\r
+                // The el argument can be a string\r
+                if (typeof el == "string") {\r
+                    el = this.getEl(el);\r
+                // The el argument can be an array of elements or element ids.\r
+                } else if ( this._isValidCollection(el)) {\r
+                    var ok = true;\r
+                    for (var i=0,len=el.length; i<len; ++i) {\r
+                        ok = ( this.removeListener(el[i], sType, fn) && ok );\r
+                    }\r
+                    return ok;\r
+                }\r
+\r
+                if ("unload" == sType) {\r
+\r
+                    for (i=0, len=unloadListeners.length; i<len; i++) {\r
+                        var li = unloadListeners[i];\r
+                        if (li && \r
+                            li[0] == el && \r
+                            li[1] == sType && \r
+                            li[2] == fn) {\r
+                                delete unloadListeners[i];\r
+                                return true;\r
+                        }\r
+                    }\r
+\r
+                    return false;\r
+                }\r
+\r
+                var cacheItem = null;\r
+  \r
+                if ("undefined" == typeof index) {\r
+                    index = this._getCacheIndex(el, sType, fn);\r
+                }\r
+\r
+                if (index >= 0) {\r
+                    cacheItem = listeners[index];\r
+                }\r
+\r
+                if (!el || !cacheItem) {\r
+                    // this.logger.debug("cached listener not found");\r
+                    return false;\r
+                }\r
+\r
+                // this.logger.debug("Removing handler: " + el + ", " + sType);\r
+\r
+                if (el.removeEventListener) {\r
+                    el.removeEventListener(sType, cacheItem[this.WFN], false);\r
+                    // this.logger.debug("adsf");\r
+                } else if (el.detachEvent) {\r
+                    el.detachEvent("on" + sType, cacheItem[this.WFN]);\r
+                }\r
+\r
+                // removed the wrapped handler\r
+                delete listeners[index][this.WFN];\r
+                delete listeners[index][this.FN];\r
+                delete listeners[index];\r
+\r
+                return true;\r
+\r
+            },\r
+\r
+            /**\r
+             * Returns the event's target element\r
+             * @param {Event} ev the event\r
+             * @param {boolean} resolveTextNode when set to true the target's\r
+             *                  parent will be returned if the target is a \r
+             *                  text node.  @deprecated, the text node is\r
+             *                  now resolved automatically\r
+             * @return {HTMLElement} the event's target\r
+             */\r
+            getTarget: function(ev, resolveTextNode) {\r
+                var t = ev.target || ev.srcElement;\r
+                return this.resolveTextNode(t);\r
+            },\r
+\r
+            /**\r
+             * In some cases, some browsers will return a text node inside\r
+             * the actual element that was targeted.  This normalizes the\r
+             * return value for getTarget and getRelatedTarget.\r
+             * @param {HTMLElement} node to resolve\r
+             * @return  the normized node\r
+             */\r
+            resolveTextNode: function(node) {\r
+                if (node && node.nodeName && \r
+                        "#TEXT" == node.nodeName.toUpperCase()) {\r
+                    return node.parentNode;\r
+                } else {\r
+                    return node;\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns the event's pageX\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's pageX\r
+             */\r
+            getPageX: function(ev) {\r
+                var x = ev.pageX;\r
+                if (!x && 0 !== x) {\r
+                    x = ev.clientX || 0;\r
+\r
+                    if ( this.isIE ) {\r
+                        x += this._getScrollLeft();\r
+                    }\r
+                }\r
+\r
+                return x;\r
+            },\r
+\r
+            /**\r
+             * Returns the event's pageY\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's pageY\r
+             */\r
+            getPageY: function(ev) {\r
+                var y = ev.pageY;\r
+                if (!y && 0 !== y) {\r
+                    y = ev.clientY || 0;\r
+\r
+                    if ( this.isIE ) {\r
+                        y += this._getScrollTop();\r
+                    }\r
+                }\r
+\r
+\r
+                return y;\r
+            },\r
+\r
+            /**\r
+             * Returns the pageX and pageY properties as an indexed array.\r
+             * @type int[]\r
+             */\r
+            getXY: function(ev) {\r
+                return [this.getPageX(ev), this.getPageY(ev)];\r
+            },\r
+\r
+            /**\r
+             * Returns the event's related target \r
+             * @param {Event} ev the event\r
+             * @return {HTMLElement} the event's relatedTarget\r
+             */\r
+            getRelatedTarget: function(ev) {\r
+                var t = ev.relatedTarget;\r
+                if (!t) {\r
+                    if (ev.type == "mouseout") {\r
+                        t = ev.toElement;\r
+                    } else if (ev.type == "mouseover") {\r
+                        t = ev.fromElement;\r
+                    }\r
+                }\r
+\r
+                return this.resolveTextNode(t);\r
+            },\r
+\r
+            /**\r
+             * Returns the time of the event.  If the time is not included, the\r
+             * event is modified using the current time.\r
+             * @param {Event} ev the event\r
+             * @return {Date} the time of the event\r
+             */\r
+            getTime: function(ev) {\r
+                if (!ev.time) {\r
+                    var t = new Date().getTime();\r
+                    try {\r
+                        ev.time = t;\r
+                    } catch(e) { \r
+                        // can't set the time property  \r
+                        return t;\r
+                    }\r
+                }\r
+\r
+                return ev.time;\r
+            },\r
+\r
+            /**\r
+             * Convenience method for stopPropagation + preventDefault\r
+             * @param {Event} ev the event\r
+             */\r
+            stopEvent: function(ev) {\r
+                this.stopPropagation(ev);\r
+                this.preventDefault(ev);\r
+            },\r
+\r
+            /**\r
+             * Stops event propagation\r
+             * @param {Event} ev the event\r
+             */\r
+            stopPropagation: function(ev) {\r
+                if (ev.stopPropagation) {\r
+                    ev.stopPropagation();\r
+                } else {\r
+                    ev.cancelBubble = true;\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Prevents the default behavior of the event\r
+             * @param {Event} ev the event\r
+             */\r
+            preventDefault: function(ev) {\r
+                if (ev.preventDefault) {\r
+                    ev.preventDefault();\r
+                } else {\r
+                    ev.returnValue = false;\r
+                }\r
+            },\r
+             \r
+            /**\r
+             * Finds the event in the window object, the caller's arguments, or\r
+             * in the arguments of another method in the callstack.  This is\r
+             * executed automatically for events registered through the event\r
+             * manager, so the implementer should not normally need to execute\r
+             * this function at all.\r
+             * @param {Event} the event parameter from the handler\r
+             * @return {Event} the event \r
+             */\r
+            getEvent: function(e) {\r
+                var ev = e || window.event;\r
+\r
+                if (!ev) {\r
+                    var c = this.getEvent.caller;\r
+                    while (c) {\r
+                        ev = c.arguments[0];\r
+                        if (ev && Event == ev.constructor) {\r
+                            break;\r
+                        }\r
+                        c = c.caller;\r
+                    }\r
+                }\r
+\r
+                return ev;\r
+            },\r
+\r
+            /**\r
+             * Returns the charcode for an event\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's charCode\r
+             */\r
+            getCharCode: function(ev) {\r
+                return ev.charCode || ((ev.type == "keypress") ? ev.keyCode : 0);\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * Locating the saved event handler data by function ref\r
+             */\r
+            _getCacheIndex: function(el, sType, fn) {\r
+                for (var i=0,len=listeners.length; i<len; ++i) {\r
+                    var li = listeners[i];\r
+                    if ( li                 && \r
+                         li[this.FN] == fn  && \r
+                         li[this.EL] == el  && \r
+                         li[this.TYPE] == sType ) {\r
+                        return i;\r
+                    }\r
+                }\r
+\r
+                return -1;\r
+            },\r
+\r
+            /**\r
+             * Generates an unique ID for the element if it does not already \r
+             * have one.\r
+             * @param el the element\r
+             * @return {string} the id of the element\r
+             */\r
+            generateId: function(el) {\r
+                var id = el.id;\r
+\r
+                if (!id) {\r
+                    id = "yuievtautoid-" + counter;\r
+                    ++counter;\r
+                    el.id = id;\r
+                }\r
+\r
+                return id;\r
+            },\r
+\r
+\r
+            /**\r
+             * We want to be able to use getElementsByTagName as a collection\r
+             * to attach a group of events to.  Unfortunately, different \r
+             * browsers return different types of collections.  This function\r
+             * tests to determine if the object is array-like.  It will also \r
+             * fail if the object is an array, but is empty.\r
+             * @param o the object to test\r
+             * @return {boolean} true if the object is array-like and populated\r
+             * @private\r
+             */\r
+            _isValidCollection: function(o) {\r
+                // this.logger.debug(o.constructor.toString())\r
+                // this.logger.debug(typeof o)\r
+\r
+                return ( o                    && // o is something\r
+                         o.length             && // o is indexed\r
+                         typeof o != "string" && // o is not a string\r
+                         !o.tagName           && // o is not an HTML element\r
+                         !o.alert             && // o is not a window\r
+                         typeof o[0] != "undefined" );\r
+\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * DOM element cache\r
+             */\r
+            elCache: {},\r
+\r
+            /**\r
+             * We cache elements bound by id because when the unload event \r
+             * fires, we can no longer use document.getElementById\r
+             * @private\r
+             */\r
+            getEl: function(id) {\r
+                return document.getElementById(id);\r
+            },\r
+\r
+            /**\r
+             * Clears the element cache\r
+             * @deprecated\r
+             * @private\r
+             */\r
+            clearCache: function() { },\r
+\r
+            /**\r
+             * Called by CustomEvent instances to provide a handle to the \r
+             * event * that can be removed later on.  Should be package \r
+             * protected.\r
+             * @private\r
+             */\r
+            regCE: function(ce) {\r
+                customEvents.push(ce);\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * hook up any deferred listeners\r
+             */\r
+            _load: function(e) {\r
+                // me.logger = new ygLogger("pe.Event");\r
+                //me.logger.debug([this.isSafari, this.isOpera, this.isIE]);\r
+                loadComplete = true;\r
+            },\r
+\r
+            /**\r
+             * Polling function that runs before the onload event fires, \r
+             * attempting to attach to DOM Nodes as soon as they are \r
+             * available\r
+             * @private\r
+             */\r
+            _tryPreloadAttach: function() {\r
+\r
+                if (this.locked) {\r
+                    return false;\r
+                }\r
+\r
+                this.locked = true;\r
+\r
+                // this.logger.debug("tryPreloadAttach");\r
+\r
+                // keep trying until after the page is loaded.  We need to \r
+                // check the page load state prior to trying to bind the \r
+                // elements so that we can be certain all elements have been \r
+                // tested appropriately\r
+                var tryAgain = !loadComplete;\r
+                if (!tryAgain) {\r
+                    tryAgain = (retryCount > 0);\r
+                }\r
+\r
+                // Delayed listeners\r
+                var stillDelayed = [];\r
+\r
+                for (var i=0,len=delayedListeners.length; i<len; ++i) {\r
+                    var d = delayedListeners[i];\r
+                    // There may be a race condition here, so we need to \r
+                    // verify the array element is usable.\r
+                    if (d) {\r
+\r
+                        // el will be null if document.getElementById did not\r
+                        // work\r
+                        var el = this.getEl(d[this.EL]);\r
+\r
+                        if (el) {\r
+                            // this.logger.debug("attaching: " + d[this.EL]);\r
+                            this.on(el, d[this.TYPE], d[this.FN], \r
+                                    d[this.SCOPE], d[this.ADJ_SCOPE]);\r
+                            delete delayedListeners[i];\r
+                        } else {\r
+                            stillDelayed.push(d);\r
+                        }\r
+                    }\r
+                }\r
+\r
+                delayedListeners = stillDelayed;\r
+\r
+                // onAvailable\r
+                var notAvail = [];\r
+                for (i=0,len=onAvailStack.length; i<len ; ++i) {\r
+                    var item = onAvailStack[i];\r
+                    if (item) {\r
+                        el = this.getEl(item.id);\r
+\r
+                        if (el) {\r
+                            var scope = (item.override) ? item.obj : el;\r
+                            item.fn.call(scope, item.obj);\r
+                            delete onAvailStack[i];\r
+                        } else {\r
+                            notAvail.push(item);\r
+                        }\r
+                    }\r
+                }\r
+\r
+                retryCount = (stillDelayed.length === 0 && \r
+                                    notAvail.length === 0) ? 0 : retryCount - 1;\r
+\r
+                if (tryAgain) {\r
+                    this.startTimeout();\r
+                }\r
+\r
+                this.locked = false;\r
+\r
+                return true;\r
+\r
+            },\r
+\r
+            /**\r
+             * Removes all listeners attached to the given element via addListener.\r
+             * Optionally, the node's children can also be purged.\r
+             * Optionally, you can specify a specific type of event to remove.\r
+             * @param {HTMLElement} el the element to purge\r
+             * @param {boolean} recurse recursively purge this element's children\r
+             * as well.  Use with caution.\r
+             * @param {string} sType optional type of listener to purge. If\r
+             * left out, all listeners will be removed\r
+             */\r
+            purgeElement: function(el, recurse, sType) {\r
+                var elListeners = this.getListeners(el, sType);\r
+                if (elListeners) {\r
+                    for (var i=0,len=elListeners.length; i<len ; ++i) {\r
+                        var l = elListeners[i];\r
+                        this.removeListener(el, l.type, l.fn, l.index);\r
+                    }\r
+                }\r
+\r
+                if (recurse && el && el.childNodes) {\r
+                    for (i=0,len=el.childNodes.length; i<len ; ++i) {\r
+                        this.purgeElement(el.childNodes[i], recurse, sType);\r
+                    }\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns all listeners attached to the given element via addListener.\r
+             * Optionally, you can specify a specific type of event to return.\r
+             * @param el {HTMLElement} the element to inspect \r
+             * @param sType {string} optional type of listener to return. If\r
+             * left out, all listeners will be returned\r
+             * @return {Object} the listener. Contains the following fields:\r
+             *    type:   (string)   the type of event\r
+             *    fn:     (function) the callback supplied to addListener\r
+             *    obj:    (object)   the custom object supplied to addListener\r
+             *    adjust: (boolean)  whether or not to adjust the default scope\r
+             *    index:  (int)      its position in the Event util listener cache\r
+             */           \r
+            getListeners: function(el, sType) {\r
+                var elListeners = [];\r
+                if (listeners && listeners.length > 0) {\r
+                    for (var i=0,len=listeners.length; i<len ; ++i) {\r
+                        var l = listeners[i];\r
+                        if ( l  && l[this.EL] === el && \r
+                                (!sType || sType === l[this.TYPE]) ) {\r
+                            elListeners.push({\r
+                                type:   l[this.TYPE],\r
+                                fn:     l[this.FN],\r
+                                obj:    l[this.SCOPE],\r
+                                adjust: l[this.ADJ_SCOPE],\r
+                                index:  i\r
+                            });\r
+                        }\r
+                    }\r
+                }\r
+\r
+                return (elListeners.length) ? elListeners : null;\r
+            },\r
+\r
+            /**\r
+             * Removes all listeners registered by pe.event.  Called \r
+             * automatically during the unload event.\r
+             * @private\r
+             */\r
+            _unload: function(e, me) {\r
+                for (var i=0,len=unloadListeners.length; i<len; ++i) {\r
+                    var l = unloadListeners[i];\r
+                    if (l) {\r
+                        var scope = (l[this.ADJ_SCOPE]) ? l[this.SCOPE]: window;\r
+                        l[this.FN].call(scope, this.getEvent(e), l[this.SCOPE] );\r
+                    }\r
+                }\r
+\r
+                if (listeners && listeners.length > 0) {\r
+                    for (i=0,len=listeners.length; i<len ; ++i) {\r
+                        l = listeners[i];\r
+                        if (l) {\r
+                            this.removeListener(l[this.EL], l[this.TYPE], \r
+                                    l[this.FN], i);\r
+                        }\r
+                    }\r
+\r
+                    this.clearCache();\r
+                }\r
+\r
+                for (i=0,len=customEvents.length; i<len; ++i) {\r
+                    customEvents[i].unsubscribeAll();\r
+                    delete customEvents[i];\r
+                }\r
+\r
+                for (i=0,len=legacyEvents.length; i<len; ++i) {\r
+                    // dereference the element\r
+                    delete legacyEvents[i][0];\r
+                    // delete the array item\r
+                    delete legacyEvents[i];\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns scrollLeft\r
+             * @private\r
+             */\r
+            _getScrollLeft: function() {\r
+                return this._getScroll()[1];\r
+            },\r
+\r
+            /**\r
+             * Returns scrollTop\r
+             * @private\r
+             */\r
+            _getScrollTop: function() {\r
+                return this._getScroll()[0];\r
+            },\r
+\r
+            /**\r
+             * Returns the scrollTop and scrollLeft.  Used to calculate the \r
+             * pageX and pageY in Internet Explorer\r
+             * @private\r
+             */\r
+            _getScroll: function() {\r
+                var dd = document.documentElement; db = document.body;\r
+                if (dd && dd.scrollTop) {\r
+                    return [dd.scrollTop, dd.scrollLeft];\r
+                } else if (db) {\r
+                    return [db.scrollTop, db.scrollLeft];\r
+                } else {\r
+                    return [0, 0];\r
+                }\r
+            }\r
+        };\r
+    } ();\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    YAHOO.util.Event.on = YAHOO.util.Event.addListener;\r
+\r
+    if (document && document.body) {\r
+        YAHOO.util.Event._load();\r
+    } else {\r
+        YAHOO.util.Event.on(window, "load", YAHOO.util.Event._load, \r
+                YAHOO.util.Event, true);\r
+    }\r
+\r
+    YAHOO.util.Event.on(window, "unload", YAHOO.util.Event._unload, \r
+                YAHOO.util.Event, true);\r
+\r
+    YAHOO.util.Event._tryPreloadAttach();\r
+\r
+}\r
+\r
diff --git a/lib/yui/event/event-min.js b/lib/yui/event/event-min.js
new file mode 100755 (executable)
index 0000000..cc8b0d6
--- /dev/null
@@ -0,0 +1 @@
+/*                                                                                                                                                      Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    Code licensed under the BSD License:                                                                                                                    http://developer.yahoo.net/yui/license.txt                                                                                                              version: 0.11.0                                                                                                                                         */ YAHOO.util.CustomEvent=function(_1,_2,_3){this.type=_1;this.scope=_2||window;this.silent=_3;this.subscribers=[];if(YAHOO.util.Event){YAHOO.util.Event.regCE(this);}if(!this.silent){}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_5,_6){this.subscribers.push(new YAHOO.util.Subscriber(fn,_5,_6));},unsubscribe:function(fn,_7){var _8=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_7)){this._delete(i);_8=true;}}return _8;},fire:function(){var len=this.subscribers.length;var _12=[];for(var i=0;i<arguments.length;++i){_12.push(arguments[i]);}if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _13=(s.override)?s.obj:this.scope;s.fn.call(_13,this.type,_12,s.obj);}}},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(i);}},_delete:function(_14){var s=this.subscribers[_14];if(s){delete s.fn;delete s.obj;}delete this.subscribers[_14];},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_16){this.fn=fn;this.obj=obj||null;this.override=(_16);};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){return (this.fn==fn&&this.obj==obj);};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _17=false;var _18=[];var _19=[];var _20=[];var _21=[];var _22=[];var _23=[];var _24=0;var _25=[];var _26=[];var _27=0;return {POLL_RETRYS:200,POLL_INTERVAL:50,EL:0,TYPE:1,FN:2,WFN:3,SCOPE:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),addDelayedListener:function(el,_29,fn,_30,_31){_19[_19.length]=[el,_29,fn,_30,_31];if(_17){_24=this.POLL_RETRYS;this.startTimeout(0);}},startTimeout:function(_32){var i=(_32||_32===0)?_32:this.POLL_INTERVAL;var _33=this;var _34=function(){_33._tryPreloadAttach();};this.timeout=setTimeout(_34,i);},onAvailable:function(_35,_36,_37,_38){_25.push({id:_35,fn:_36,obj:_37,override:_38});_24=this.POLL_RETRYS;this.startTimeout(0);},addListener:function(el,_39,fn,_40,_41){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.on(el[i],_39,fn,_40,_41)&&ok);}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(_17&&oEl){el=oEl;}else{this.addDelayedListener(el,_39,fn,_40,_41);return true;}}}if(!el){return false;}if("unload"==_39&&_40!==this){_20[_20.length]=[el,_39,fn,_40,_41];return true;}var _44=(_41)?_40:el;var _45=function(e){return fn.call(_44,YAHOO.util.Event.getEvent(e),_40);};var li=[el,_39,fn,_45,_44];var _48=_18.length;_18[_48]=li;if(this.useLegacyEvent(el,_39)){var _49=this.getLegacyIndex(el,_39);if(_49==-1){_49=_22.length;_26[el.id+_39]=_49;_22[_49]=[el,_39,el["on"+_39]];_23[_49]=[];el["on"+_39]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_49);};}_23[_49].push(_48);}else{if(el.addEventListener){el.addEventListener(_39,_45,false);}else{if(el.attachEvent){el.attachEvent("on"+_39,_45);}}}return true;},fireLegacyEvent:function(e,_50){var ok=true;var le=_23[_50];for(var i=0,len=le.length;i<len;++i){var _52=le[i];if(_52){var li=_18[_52];if(li&&li[this.WFN]){var _53=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_53,e);ok=(ok&&ret);}else{delete le[i];}}}return ok;},getLegacyIndex:function(el,_55){var key=this.generateId(el)+_55;if(typeof _26[key]=="undefined"){return -1;}else{return _26[key];}},useLegacyEvent:function(el,_57){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_57||"dblclick"==_57){return true;}}}return false;},removeListener:function(el,_58,fn,_59){if(!fn||!fn.call){return false;}if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_58,fn)&&ok);}return ok;}}if("unload"==_58){for(i=0,len=_20.length;i<len;i++){var li=_20[i];if(li&&li[0]==el&&li[1]==_58&&li[2]==fn){delete _20[i];return true;}}return false;}var _60=null;if("undefined"==typeof _59){_59=this._getCacheIndex(el,_58,fn);}if(_59>=0){_60=_18[_59];}if(!el||!_60){return false;}if(el.removeEventListener){el.removeEventListener(_58,_60[this.WFN],false);}else{if(el.detachEvent){el.detachEvent("on"+_58,_60[this.WFN]);}}delete _18[_59][this.WFN];delete _18[_59][this.FN];delete _18[_59];return true;},getTarget:function(ev,_62){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_64){if(_64&&_64.nodeName&&"#TEXT"==_64.nodeName.toUpperCase()){return _64.parentNode;}else{return _64;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||((ev.type=="keypress")?ev.keyCode:0);},_getCacheIndex:function(el,_68,fn){for(var i=0,len=_18.length;i<len;++i){var li=_18[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_68){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_27;++_27;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},regCE:function(ce){_21.push(ce);},_load:function(e){_17=true;},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _72=!_17;if(!_72){_72=(_24>0);}var _73=[];for(var i=0,len=_19.length;i<len;++i){var d=_19[i];if(d){var el=this.getEl(d[this.EL]);if(el){this.on(el,d[this.TYPE],d[this.FN],d[this.SCOPE],d[this.ADJ_SCOPE]);delete _19[i];}else{_73.push(d);}}}_19=_73;var _75=[];for(i=0,len=_25.length;i<len;++i){var _76=_25[i];if(_76){el=this.getEl(_76.id);if(el){var _77=(_76.override)?_76.obj:el;_76.fn.call(_77,_76.obj);delete _25[i];}else{_75.push(_76);}}}_24=(_73.length===0&&_75.length===0)?0:_24-1;if(_72){this.startTimeout();}this.locked=false;return true;},purgeElement:function(el,_78,_79){var _80=this.getListeners(el,_79);if(_80){for(var i=0,len=_80.length;i<len;++i){var l=_80[i];this.removeListener(el,l.type,l.fn,l.index);}}if(_78&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_78,_79);}}},getListeners:function(el,_82){var _83=[];if(_18&&_18.length>0){for(var i=0,len=_18.length;i<len;++i){var l=_18[i];if(l&&l[this.EL]===el&&(!_82||_82===l[this.TYPE])){_83.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.SCOPE],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_83.length)?_83:null;},_unload:function(e,me){for(var i=0,len=_20.length;i<len;++i){var l=_20[i];if(l){var _85=(l[this.ADJ_SCOPE])?l[this.SCOPE]:window;l[this.FN].call(_85,this.getEvent(e),l[this.SCOPE]);}}if(_18&&_18.length>0){for(i=0,len=_18.length;i<len;++i){l=_18[i];if(l){this.removeListener(l[this.EL],l[this.TYPE],l[this.FN],i);}}this.clearCache();}for(i=0,len=_21.length;i<len;++i){_21[i].unsubscribeAll();delete _21[i];}for(i=0,len=_22.length;i<len;++i){delete _22[i][0];delete _22[i];}},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement;db=document.body;if(dd&&dd.scrollTop){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}}};}();YAHOO.util.Event.on=YAHOO.util.Event.addListener;if(document&&document.body){YAHOO.util.Event._load();}else{YAHOO.util.Event.on(window,"load",YAHOO.util.Event._load,YAHOO.util.Event,true);}YAHOO.util.Event.on(window,"unload",YAHOO.util.Event._unload,YAHOO.util.Event,true);YAHOO.util.Event._tryPreloadAttach();}
\ No newline at end of file
diff --git a/lib/yui/event/event.js b/lib/yui/event/event.js
new file mode 100755 (executable)
index 0000000..78ddd08
--- /dev/null
@@ -0,0 +1,1200 @@
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * The CustomEvent class lets you define events for your application\r
+ * that can be subscribed to by one or more independent component.\r
+ *\r
+ * @param {String} type The type of event, which is passed to the callback\r
+ *                 when the event fires\r
+ * @param {Object} oScope The context the event will fire from.  "this" will\r
+ *                 refer to this object in the callback.  Default value: \r
+ *                 the window object.  The listener can override this.\r
+ * @constructor\r
+ */\r
+YAHOO.util.CustomEvent = function(type, oScope, silent) {\r
+\r
+    /**\r
+     * The type of event, returned to subscribers when the event fires\r
+     * @type string\r
+     */\r
+    this.type = type;\r
+\r
+    /**\r
+     * The scope the the event will fire from by default.  Defaults to the window \r
+     * obj\r
+     * @type object\r
+     */\r
+    this.scope = oScope || window;\r
+\r
+    /**\r
+     * By default all custom events are logged in the debug build, set silent\r
+     * to true to disable logging for this event.\r
+     * @type boolean\r
+     */\r
+    this.silent = silent;\r
+\r
+    /**\r
+     * The subscribers to this event\r
+     * @type Subscriber[]\r
+     */\r
+    this.subscribers = [];\r
+\r
+    // Register with the event utility for automatic cleanup.  Made optional\r
+    // so that CustomEvent can be used independently of pe.event\r
+    if (YAHOO.util.Event) { \r
+        YAHOO.util.Event.regCE(this);\r
+    }\r
+\r
+    if (!this.silent) {\r
+    }\r
+};\r
+\r
+YAHOO.util.CustomEvent.prototype = {\r
+    /**\r
+     * Subscribes the caller to this event\r
+     * @param {Function} fn       The function to execute\r
+     * @param {Object}   obj      An object to be passed along when the event fires\r
+     * @param {boolean}  bOverride If true, the obj passed in becomes the execution\r
+     *                            scope of the listener\r
+     */\r
+    subscribe: function(fn, obj, bOverride) {\r
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, bOverride) );\r
+    },\r
+\r
+    /**\r
+     * Unsubscribes the caller from this event\r
+     * @param {Function} fn  The function to execute\r
+     * @param {Object}   obj An object to be passed along when the event fires\r
+     * @return {boolean} True if the subscriber was found and detached.\r
+     */\r
+    unsubscribe: function(fn, obj) {\r
+        var found = false;\r
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {\r
+            var s = this.subscribers[i];\r
+            if (s && s.contains(fn, obj)) {\r
+                this._delete(i);\r
+                found = true;\r
+            }\r
+        }\r
+\r
+        return found;\r
+    },\r
+\r
+    /**\r
+     * Notifies the subscribers.  The callback functions will be executed\r
+     * from the scope specified when the event was created, and with the following\r
+     * parameters:\r
+     *   <pre>\r
+     *   - The type of event\r
+     *   - All of the arguments fire() was executed with as an array\r
+     *   - The custom object (if any) that was passed into the subscribe() method\r
+     *   </pre>\r
+     *   \r
+     * @param {Array} an arbitrary set of parameters to pass to the handler\r
+     */\r
+    fire: function() {\r
+        var len=this.subscribers.length;\r
+\r
+        var args = [];\r
+\r
+        for (var i=0; i<arguments.length; ++i) {\r
+            args.push(arguments[i]);\r
+        }\r
+\r
+        if (!this.silent) {\r
+        }\r
+\r
+        for (i=0; i<len; ++i) {\r
+            var s = this.subscribers[i];\r
+            if (s) {\r
+                if (!this.silent) {\r
+                }\r
+                var scope = (s.override) ? s.obj : this.scope;\r
+                s.fn.call(scope, this.type, args, s.obj);\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Removes all listeners\r
+     */\r
+    unsubscribeAll: function() {\r
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {\r
+            this._delete(i);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    _delete: function(index) {\r
+        var s = this.subscribers[index];\r
+        if (s) {\r
+            delete s.fn;\r
+            delete s.obj;\r
+        }\r
+\r
+        delete this.subscribers[index];\r
+    },\r
+\r
+    toString: function() {\r
+         return "CustomEvent: " + "'" + this.type  + "', " + \r
+             "scope: " + this.scope;\r
+\r
+    }\r
+};\r
+\r
+/////////////////////////////////////////////////////////////////////\r
+\r
+/**\r
+ * @class Stores the subscriber information to be used when the event fires.\r
+ * @param {Function} fn       The function to execute\r
+ * @param {Object}   obj      An object to be passed along when the event fires\r
+ * @param {boolean}  bOverride If true, the obj passed in becomes the execution\r
+ *                            scope of the listener\r
+ * @constructor\r
+ */\r
+YAHOO.util.Subscriber = function(fn, obj, bOverride) {\r
+    /**\r
+     * The callback that will be execute when the event fires\r
+     * @type function\r
+     */\r
+    this.fn = fn;\r
+\r
+    /**\r
+     * An optional custom object that will passed to the callback when\r
+     * the event fires\r
+     * @type object\r
+     */\r
+    this.obj = obj || null;\r
+\r
+    /**\r
+     * The default execution scope for the event listener is defined when the\r
+     * event is created (usually the object which contains the event).\r
+     * By setting override to true, the execution scope becomes the custom\r
+     * object passed in by the subscriber\r
+     * @type boolean\r
+     */\r
+    this.override = (bOverride);\r
+};\r
+\r
+/**\r
+ * Returns true if the fn and obj match this objects properties.\r
+ * Used by the unsubscribe method to match the right subscriber.\r
+ *\r
+ * @param {Function} fn the function to execute\r
+ * @param {Object} obj an object to be passed along when the event fires\r
+ * @return {boolean} true if the supplied arguments match this \r
+ *                   subscriber's signature.\r
+ */\r
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {\r
+    return (this.fn == fn && this.obj == obj);\r
+};\r
+\r
+YAHOO.util.Subscriber.prototype.toString = function() {\r
+    return "Subscriber { obj: " + (this.obj || "")  + \r
+           ", override: " +  (this.override || "no") + " }";\r
+};\r
+// Only load this library once.  If it is loaded a second time, existing\r
+// events cannot be detached.\r
+if (!YAHOO.util.Event) {\r
+\r
+/**\r
+ * @class\r
+ * The event utility provides functions to add and remove event listeners,\r
+ * event cleansing.  It also tries to automatically remove listeners it\r
+ * registers during the unload event.\r
+ * @constructor\r
+ */\r
+    YAHOO.util.Event = function() {\r
+\r
+        /**\r
+         * True after the onload event has fired\r
+         * @type boolean\r
+         * @private\r
+         */\r
+        var loadComplete =  false;\r
+\r
+        /**\r
+         * Cache of wrapped listeners\r
+         * @type array\r
+         * @private\r
+         */\r
+        var listeners = [];\r
+\r
+        /**\r
+         * Listeners that will be attached during the onload event\r
+         * @type array\r
+         * @private\r
+         */\r
+        var delayedListeners = [];\r
+\r
+        /**\r
+         * User-defined unload function that will be fired before all events\r
+         * are detached\r
+         * @type array\r
+         * @private\r
+         */\r
+        var unloadListeners = [];\r
+\r
+        /**\r
+         * Cache of the custom events that have been defined.  Used for\r
+         * automatic cleanup\r
+         * @type array\r
+         * @private\r
+         */\r
+        var customEvents = [];\r
+\r
+        /**\r
+         * Cache of DOM0 event handlers to work around issues with DOM2 events\r
+         * in Safari\r
+         * @private\r
+         */\r
+        var legacyEvents = [];\r
+\r
+        /**\r
+         * Listener stack for DOM0 events\r
+         * @private\r
+         */\r
+        var legacyHandlers = [];\r
+\r
+        /**\r
+         * The number of times to poll after window.onload.  This number is\r
+         * increased if additional late-bound handlers are requested after\r
+         * the page load.\r
+         * @private\r
+         */\r
+        var retryCount = 0;\r
+\r
+        /**\r
+         * onAvailable listeners\r
+         * @private\r
+         */\r
+        var onAvailStack = [];\r
+\r
+        /**\r
+         * Lookup table for legacy events\r
+         * @private\r
+         */\r
+        var legacyMap = [];\r
+\r
+        /**\r
+         * Counter for auto id generation\r
+         * @private\r
+         */\r
+        var counter = 0;\r
+\r
+        return { // PREPROCESS\r
+\r
+            /**\r
+             * The number of times we should look for elements that are not\r
+             * in the DOM at the time the event is requested after the document\r
+             * has been loaded.  The default is 200@50 ms, so it will poll\r
+             * for 10 seconds or until all outstanding handlers are bound\r
+             * (whichever comes first).\r
+             * @type int\r
+             */\r
+            POLL_RETRYS: 200,\r
+\r
+            /**\r
+             * The poll interval in milliseconds\r
+             * @type int\r
+             */\r
+            POLL_INTERVAL: 50,\r
+\r
+            /**\r
+             * Element to bind, int constant\r
+             * @type int\r
+             */\r
+            EL: 0,\r
+\r
+            /**\r
+             * Type of event, int constant\r
+             * @type int\r
+             */\r
+            TYPE: 1,\r
+\r
+            /**\r
+             * Function to execute, int constant\r
+             * @type int\r
+             */\r
+            FN: 2,\r
+\r
+            /**\r
+             * Function wrapped for scope correction and cleanup, int constant\r
+             * @type int\r
+             */\r
+            WFN: 3,\r
+\r
+            /**\r
+             * Object passed in by the user that will be returned as a \r
+             * parameter to the callback, int constant\r
+             * @type int\r
+             */\r
+            SCOPE: 3,\r
+\r
+            /**\r
+             * Adjusted scope, either the element we are registering the event\r
+             * on or the custom object passed in by the listener, int constant\r
+             * @type int\r
+             */\r
+            ADJ_SCOPE: 4,\r
+\r
+            /**\r
+             * Safari detection is necessary to work around the preventDefault\r
+             * bug that makes it so you can't cancel a href click from the \r
+             * handler.  There is not a capabilities check we can use here.\r
+             * @private\r
+             */\r
+            isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),\r
+\r
+            /**\r
+             * IE detection needed to properly calculate pageX and pageY.  \r
+             * capabilities checking didn't seem to work because another \r
+             * browser that does not provide the properties have the values \r
+             * calculated in a different manner than IE.\r
+             * @private\r
+             */\r
+            isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && \r
+                    navigator.userAgent.match(/msie/gi)),\r
+\r
+            /**\r
+             * @private\r
+             */\r
+            addDelayedListener: function(el, sType, fn, oScope, bOverride) {\r
+                delayedListeners[delayedListeners.length] =\r
+                    [el, sType, fn, oScope, bOverride];\r
+\r
+                // If this happens after the inital page load, we need to\r
+                // reset the poll counter so that we continue to search for\r
+                // the element for a fixed period of time.\r
+                if (loadComplete) {\r
+                    retryCount = this.POLL_RETRYS;\r
+                    this.startTimeout(0);\r
+                    // this._tryPreloadAttach();\r
+                }\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             */\r
+            startTimeout: function(interval) {\r
+                var i = (interval || interval === 0) ? interval : this.POLL_INTERVAL;\r
+                var self = this;\r
+                var callback = function() { self._tryPreloadAttach(); };\r
+                this.timeout = setTimeout(callback, i);\r
+            },\r
+\r
+            /**\r
+             * Executes the supplied callback when the item with the supplied\r
+             * id is found.  This is meant to be used to execute behavior as\r
+             * soon as possible as the page loads.  If you use this after the\r
+             * initial page load it will poll for a fixed time for the element.\r
+             * The number of times it will poll and the frequency are\r
+             * configurable.  By default it will poll for 10 seconds.\r
+             * @param {string} p_id the id of the element to look for.\r
+             * @param {function} p_fn what to execute when the element is found.\r
+             * @param {object} p_obj an optional object to be passed back as\r
+             * a parameter to p_fn.\r
+             * @param {boolean} p_override If set to true, p_fn will execute\r
+             * in the scope of p_obj\r
+             *\r
+             */\r
+            onAvailable: function(p_id, p_fn, p_obj, p_override) {\r
+                onAvailStack.push( { id:       p_id, \r
+                                     fn:       p_fn, \r
+                                     obj:      p_obj, \r
+                                     override: p_override } );\r
+\r
+                retryCount = this.POLL_RETRYS;\r
+                this.startTimeout(0);\r
+                // this._tryPreloadAttach();\r
+            },\r
+\r
+            /**\r
+             * Appends an event handler\r
+             *\r
+             * @param {Object}   el        The html element to assign the \r
+             *                             event to\r
+             * @param {String}   sType     The type of event to append\r
+             * @param {Function} fn        The method the event invokes\r
+             * @param {Object}   oScope    An arbitrary object that will be \r
+             *                             passed as a parameter to the handler\r
+             * @param {boolean}  bOverride If true, the obj passed in becomes\r
+             *                             the execution scope of the listener\r
+             * @return {boolean} True if the action was successful or defered,\r
+             *                        false if one or more of the elements \r
+             *                        could not have the event bound to it.\r
+             */\r
+            addListener: function(el, sType, fn, oScope, bOverride) {\r
+\r
+                if (!fn || !fn.call) {\r
+                    return false;\r
+                }\r
+\r
+                // The el argument can be an array of elements or element ids.\r
+                if ( this._isValidCollection(el)) {\r
+                    var ok = true;\r
+                    for (var i=0,len=el.length; i<len; ++i) {\r
+                        ok = ( this.on(el[i], \r
+                                       sType, \r
+                                       fn, \r
+                                       oScope, \r
+                                       bOverride) && ok );\r
+                    }\r
+                    return ok;\r
+\r
+                } else if (typeof el == "string") {\r
+                    var oEl = this.getEl(el);\r
+                    // If the el argument is a string, we assume it is \r
+                    // actually the id of the element.  If the page is loaded\r
+                    // we convert el to the actual element, otherwise we \r
+                    // defer attaching the event until onload event fires\r
+\r
+                    // check to see if we need to delay hooking up the event \r
+                    // until after the page loads.\r
+                    if (loadComplete && oEl) {\r
+                        el = oEl;\r
+                    } else {\r
+                        // defer adding the event until onload fires\r
+                        this.addDelayedListener(el, \r
+                                                sType, \r
+                                                fn, \r
+                                                oScope, \r
+                                                bOverride);\r
+\r
+                        return true;\r
+                    }\r
+                }\r
+\r
+                // Element should be an html element or an array if we get \r
+                // here.\r
+                if (!el) {\r
+                    return false;\r
+                }\r
+\r
+                // we need to make sure we fire registered unload events \r
+                // prior to automatically unhooking them.  So we hang on to \r
+                // these instead of attaching them to the window and fire the\r
+                // handles explicitly during our one unload event.\r
+                if ("unload" == sType && oScope !== this) {\r
+                    unloadListeners[unloadListeners.length] =\r
+                            [el, sType, fn, oScope, bOverride];\r
+                    return true;\r
+                }\r
+\r
+                // if the user chooses to override the scope, we use the custom\r
+                // object passed in, otherwise the executing scope will be the\r
+                // HTML element that the event is registered on\r
+                var scope = (bOverride) ? oScope : el;\r
+\r
+                // wrap the function so we can return the oScope object when\r
+                // the event fires;\r
+                var wrappedFn = function(e) {\r
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e), \r
+                                oScope);\r
+                    };\r
+\r
+                var li = [el, sType, fn, wrappedFn, scope];\r
+                var index = listeners.length;\r
+                // cache the listener so we can try to automatically unload\r
+                listeners[index] = li;\r
+\r
+                if (this.useLegacyEvent(el, sType)) {\r
+                    var legacyIndex = this.getLegacyIndex(el, sType);\r
+                    if (legacyIndex == -1) {\r
+\r
+                        legacyIndex = legacyEvents.length;\r
+                        legacyMap[el.id + sType] = legacyIndex;\r
+\r
+                        // cache the signature for the DOM0 event, and \r
+                        // include the existing handler for the event, if any\r
+                        legacyEvents[legacyIndex] = \r
+                            [el, sType, el["on" + sType]];\r
+                        legacyHandlers[legacyIndex] = [];\r
+\r
+                        el["on" + sType] = \r
+                            function(e) {\r
+                                YAHOO.util.Event.fireLegacyEvent(\r
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);\r
+                            };\r
+                    }\r
+\r
+                    // add a reference to the wrapped listener to our custom\r
+                    // stack of events\r
+                    legacyHandlers[legacyIndex].push(index);\r
+\r
+                // DOM2 Event model\r
+                } else if (el.addEventListener) {\r
+                    el.addEventListener(sType, wrappedFn, false);\r
+                // IE\r
+                } else if (el.attachEvent) {\r
+                    el.attachEvent("on" + sType, wrappedFn);\r
+                }\r
+\r
+                return true;\r
+                \r
+            },\r
+\r
+            /**\r
+             * Shorthand for YAHOO.util.Event.addListener\r
+             * @type function\r
+             */\r
+            // on: this.addListener,\r
+\r
+            /**\r
+             * When using legacy events, the handler is routed to this object\r
+             * so we can fire our custom listener stack.\r
+             * @private\r
+             */\r
+            fireLegacyEvent: function(e, legacyIndex) {\r
+                var ok = true;\r
+\r
+                var le = legacyHandlers[legacyIndex];\r
+                for (var i=0,len=le.length; i<len; ++i) {\r
+                    var index = le[i];\r
+                    if (index) {\r
+                        var li = listeners[index];\r
+                        if ( li && li[this.WFN] ) {\r
+                            var scope = li[this.ADJ_SCOPE];\r
+                            var ret = li[this.WFN].call(scope, e);\r
+                            ok = (ok && ret);\r
+                        } else {\r
+                            // This listener was removed, so delete it from\r
+                            // the array\r
+                            delete le[i];\r
+                        }\r
+                    }\r
+                }\r
+\r
+                return ok;\r
+            },\r
+\r
+            /**\r
+             * Returns the legacy event index that matches the supplied \r
+             * signature\r
+             * @private\r
+             */\r
+            getLegacyIndex: function(el, sType) {\r
+                /*\r
+                for (var i=0,len=legacyEvents.length; i<len; ++i) {\r
+                    var le = legacyEvents[i];\r
+                    if (le && le[0] === el && le[1] === sType) {\r
+                        return i;\r
+                    }\r
+                }\r
+                return -1;\r
+                */\r
+\r
+                var key = this.generateId(el) + sType;\r
+                if (typeof legacyMap[key] == "undefined") { \r
+                    return -1;\r
+                } else {\r
+                    return legacyMap[key];\r
+                }\r
+\r
+            },\r
+\r
+            /**\r
+             * Logic that determines when we should automatically use legacy\r
+             * events instead of DOM2 events.\r
+             * @private\r
+             */\r
+            useLegacyEvent: function(el, sType) {\r
+\r
+                if (!el.addEventListener && !el.attachEvent) {\r
+                    return true;\r
+                } else if (this.isSafari) {\r
+                    if ("click" == sType || "dblclick" == sType) {\r
+                        return true;\r
+                    }\r
+                }\r
+\r
+                return false;\r
+            },\r
+                    \r
+            /**\r
+             * Removes an event handler\r
+             *\r
+             * @param {Object} el the html element or the id of the element to \r
+             * assign the event to.\r
+             * @param {String} sType the type of event to remove\r
+             * @param {Function} fn the method the event invokes\r
+             * @return {boolean} true if the unbind was successful, false \r
+             * otherwise\r
+             */\r
+            removeListener: function(el, sType, fn, index) {\r
+\r
+                if (!fn || !fn.call) {\r
+                    return false;\r
+                }\r
+\r
+                // The el argument can be a string\r
+                if (typeof el == "string") {\r
+                    el = this.getEl(el);\r
+                // The el argument can be an array of elements or element ids.\r
+                } else if ( this._isValidCollection(el)) {\r
+                    var ok = true;\r
+                    for (var i=0,len=el.length; i<len; ++i) {\r
+                        ok = ( this.removeListener(el[i], sType, fn) && ok );\r
+                    }\r
+                    return ok;\r
+                }\r
+\r
+                if ("unload" == sType) {\r
+\r
+                    for (i=0, len=unloadListeners.length; i<len; i++) {\r
+                        var li = unloadListeners[i];\r
+                        if (li && \r
+                            li[0] == el && \r
+                            li[1] == sType && \r
+                            li[2] == fn) {\r
+                                delete unloadListeners[i];\r
+                                return true;\r
+                        }\r
+                    }\r
+\r
+                    return false;\r
+                }\r
+\r
+                var cacheItem = null;\r
+  \r
+                if ("undefined" == typeof index) {\r
+                    index = this._getCacheIndex(el, sType, fn);\r
+                }\r
+\r
+                if (index >= 0) {\r
+                    cacheItem = listeners[index];\r
+                }\r
+\r
+                if (!el || !cacheItem) {\r
+                    return false;\r
+                }\r
+\r
+                if (el.removeEventListener) {\r
+                    el.removeEventListener(sType, cacheItem[this.WFN], false);\r
+                } else if (el.detachEvent) {\r
+                    el.detachEvent("on" + sType, cacheItem[this.WFN]);\r
+                }\r
+\r
+                // removed the wrapped handler\r
+                delete listeners[index][this.WFN];\r
+                delete listeners[index][this.FN];\r
+                delete listeners[index];\r
+\r
+                return true;\r
+\r
+            },\r
+\r
+            /**\r
+             * Returns the event's target element\r
+             * @param {Event} ev the event\r
+             * @param {boolean} resolveTextNode when set to true the target's\r
+             *                  parent will be returned if the target is a \r
+             *                  text node.  @deprecated, the text node is\r
+             *                  now resolved automatically\r
+             * @return {HTMLElement} the event's target\r
+             */\r
+            getTarget: function(ev, resolveTextNode) {\r
+                var t = ev.target || ev.srcElement;\r
+                return this.resolveTextNode(t);\r
+            },\r
+\r
+            /**\r
+             * In some cases, some browsers will return a text node inside\r
+             * the actual element that was targeted.  This normalizes the\r
+             * return value for getTarget and getRelatedTarget.\r
+             * @param {HTMLElement} node to resolve\r
+             * @return  the normized node\r
+             */\r
+            resolveTextNode: function(node) {\r
+                if (node && node.nodeName && \r
+                        "#TEXT" == node.nodeName.toUpperCase()) {\r
+                    return node.parentNode;\r
+                } else {\r
+                    return node;\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns the event's pageX\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's pageX\r
+             */\r
+            getPageX: function(ev) {\r
+                var x = ev.pageX;\r
+                if (!x && 0 !== x) {\r
+                    x = ev.clientX || 0;\r
+\r
+                    if ( this.isIE ) {\r
+                        x += this._getScrollLeft();\r
+                    }\r
+                }\r
+\r
+                return x;\r
+            },\r
+\r
+            /**\r
+             * Returns the event's pageY\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's pageY\r
+             */\r
+            getPageY: function(ev) {\r
+                var y = ev.pageY;\r
+                if (!y && 0 !== y) {\r
+                    y = ev.clientY || 0;\r
+\r
+                    if ( this.isIE ) {\r
+                        y += this._getScrollTop();\r
+                    }\r
+                }\r
+\r
+                return y;\r
+            },\r
+\r
+            /**\r
+             * Returns the pageX and pageY properties as an indexed array.\r
+             * @type int[]\r
+             */\r
+            getXY: function(ev) {\r
+                return [this.getPageX(ev), this.getPageY(ev)];\r
+            },\r
+\r
+            /**\r
+             * Returns the event's related target \r
+             * @param {Event} ev the event\r
+             * @return {HTMLElement} the event's relatedTarget\r
+             */\r
+            getRelatedTarget: function(ev) {\r
+                var t = ev.relatedTarget;\r
+                if (!t) {\r
+                    if (ev.type == "mouseout") {\r
+                        t = ev.toElement;\r
+                    } else if (ev.type == "mouseover") {\r
+                        t = ev.fromElement;\r
+                    }\r
+                }\r
+\r
+                return this.resolveTextNode(t);\r
+            },\r
+\r
+            /**\r
+             * Returns the time of the event.  If the time is not included, the\r
+             * event is modified using the current time.\r
+             * @param {Event} ev the event\r
+             * @return {Date} the time of the event\r
+             */\r
+            getTime: function(ev) {\r
+                if (!ev.time) {\r
+                    var t = new Date().getTime();\r
+                    try {\r
+                        ev.time = t;\r
+                    } catch(e) { \r
+                        // can't set the time property  \r
+                        return t;\r
+                    }\r
+                }\r
+\r
+                return ev.time;\r
+            },\r
+\r
+            /**\r
+             * Convenience method for stopPropagation + preventDefault\r
+             * @param {Event} ev the event\r
+             */\r
+            stopEvent: function(ev) {\r
+                this.stopPropagation(ev);\r
+                this.preventDefault(ev);\r
+            },\r
+\r
+            /**\r
+             * Stops event propagation\r
+             * @param {Event} ev the event\r
+             */\r
+            stopPropagation: function(ev) {\r
+                if (ev.stopPropagation) {\r
+                    ev.stopPropagation();\r
+                } else {\r
+                    ev.cancelBubble = true;\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Prevents the default behavior of the event\r
+             * @param {Event} ev the event\r
+             */\r
+            preventDefault: function(ev) {\r
+                if (ev.preventDefault) {\r
+                    ev.preventDefault();\r
+                } else {\r
+                    ev.returnValue = false;\r
+                }\r
+            },\r
+             \r
+            /**\r
+             * Finds the event in the window object, the caller's arguments, or\r
+             * in the arguments of another method in the callstack.  This is\r
+             * executed automatically for events registered through the event\r
+             * manager, so the implementer should not normally need to execute\r
+             * this function at all.\r
+             * @param {Event} the event parameter from the handler\r
+             * @return {Event} the event \r
+             */\r
+            getEvent: function(e) {\r
+                var ev = e || window.event;\r
+\r
+                if (!ev) {\r
+                    var c = this.getEvent.caller;\r
+                    while (c) {\r
+                        ev = c.arguments[0];\r
+                        if (ev && Event == ev.constructor) {\r
+                            break;\r
+                        }\r
+                        c = c.caller;\r
+                    }\r
+                }\r
+\r
+                return ev;\r
+            },\r
+\r
+            /**\r
+             * Returns the charcode for an event\r
+             * @param {Event} ev the event\r
+             * @return {int} the event's charCode\r
+             */\r
+            getCharCode: function(ev) {\r
+                return ev.charCode || ((ev.type == "keypress") ? ev.keyCode : 0);\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * Locating the saved event handler data by function ref\r
+             */\r
+            _getCacheIndex: function(el, sType, fn) {\r
+                for (var i=0,len=listeners.length; i<len; ++i) {\r
+                    var li = listeners[i];\r
+                    if ( li                 && \r
+                         li[this.FN] == fn  && \r
+                         li[this.EL] == el  && \r
+                         li[this.TYPE] == sType ) {\r
+                        return i;\r
+                    }\r
+                }\r
+\r
+                return -1;\r
+            },\r
+\r
+            /**\r
+             * Generates an unique ID for the element if it does not already \r
+             * have one.\r
+             * @param el the element\r
+             * @return {string} the id of the element\r
+             */\r
+            generateId: function(el) {\r
+                var id = el.id;\r
+\r
+                if (!id) {\r
+                    id = "yuievtautoid-" + counter;\r
+                    ++counter;\r
+                    el.id = id;\r
+                }\r
+\r
+                return id;\r
+            },\r
+\r
+            /**\r
+             * We want to be able to use getElementsByTagName as a collection\r
+             * to attach a group of events to.  Unfortunately, different \r
+             * browsers return different types of collections.  This function\r
+             * tests to determine if the object is array-like.  It will also \r
+             * fail if the object is an array, but is empty.\r
+             * @param o the object to test\r
+             * @return {boolean} true if the object is array-like and populated\r
+             * @private\r
+             */\r
+            _isValidCollection: function(o) {\r
+\r
+                return ( o                    && // o is something\r
+                         o.length             && // o is indexed\r
+                         typeof o != "string" && // o is not a string\r
+                         !o.tagName           && // o is not an HTML element\r
+                         !o.alert             && // o is not a window\r
+                         typeof o[0] != "undefined" );\r
+\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * DOM element cache\r
+             */\r
+            elCache: {},\r
+\r
+            /**\r
+             * We cache elements bound by id because when the unload event \r
+             * fires, we can no longer use document.getElementById\r
+             * @private\r
+             */\r
+            getEl: function(id) {\r
+                return document.getElementById(id);\r
+            },\r
+\r
+            /**\r
+             * Clears the element cache\r
+             * @deprecated\r
+             * @private\r
+             */\r
+            clearCache: function() { },\r
+\r
+            /**\r
+             * Called by CustomEvent instances to provide a handle to the \r
+             * event * that can be removed later on.  Should be package \r
+             * protected.\r
+             * @private\r
+             */\r
+            regCE: function(ce) {\r
+                customEvents.push(ce);\r
+            },\r
+\r
+            /**\r
+             * @private\r
+             * hook up any deferred listeners\r
+             */\r
+            _load: function(e) {\r
+                loadComplete = true;\r
+            },\r
+\r
+            /**\r
+             * Polling function that runs before the onload event fires, \r
+             * attempting to attach to DOM Nodes as soon as they are \r
+             * available\r
+             * @private\r
+             */\r
+            _tryPreloadAttach: function() {\r
+\r
+                if (this.locked) {\r
+                    return false;\r
+                }\r
+\r
+                this.locked = true;\r
+\r
+                // keep trying until after the page is loaded.  We need to \r
+                // check the page load state prior to trying to bind the \r
+                // elements so that we can be certain all elements have been \r
+                // tested appropriately\r
+                var tryAgain = !loadComplete;\r
+                if (!tryAgain) {\r
+                    tryAgain = (retryCount > 0);\r
+                }\r
+\r
+                // Delayed listeners\r
+                var stillDelayed = [];\r
+\r
+                for (var i=0,len=delayedListeners.length; i<len; ++i) {\r
+                    var d = delayedListeners[i];\r
+                    // There may be a race condition here, so we need to \r
+                    // verify the array element is usable.\r
+                    if (d) {\r
+\r
+                        // el will be null if document.getElementById did not\r
+                        // work\r
+                        var el = this.getEl(d[this.EL]);\r
+\r
+                        if (el) {\r
+                            this.on(el, d[this.TYPE], d[this.FN], \r
+                                    d[this.SCOPE], d[this.ADJ_SCOPE]);\r
+                            delete delayedListeners[i];\r
+                        } else {\r
+                            stillDelayed.push(d);\r
+                        }\r
+                    }\r
+                }\r
+\r
+                delayedListeners = stillDelayed;\r
+\r
+                // onAvailable\r
+                var notAvail = [];\r
+                for (i=0,len=onAvailStack.length; i<len ; ++i) {\r
+                    var item = onAvailStack[i];\r
+                    if (item) {\r
+                        el = this.getEl(item.id);\r
+\r
+                        if (el) {\r
+                            var scope = (item.override) ? item.obj : el;\r
+                            item.fn.call(scope, item.obj);\r
+                            delete onAvailStack[i];\r
+                        } else {\r
+                            notAvail.push(item);\r
+                        }\r
+                    }\r
+                }\r
+\r
+                retryCount = (stillDelayed.length === 0 && \r
+                                    notAvail.length === 0) ? 0 : retryCount - 1;\r
+\r
+                if (tryAgain) {\r
+                    this.startTimeout();\r
+                }\r
+\r
+                this.locked = false;\r
+\r
+                return true;\r
+\r
+            },\r
+\r
+            /**\r
+             * Removes all listeners attached to the given element via addListener.\r
+             * Optionally, the node's children can also be purged.\r
+             * Optionally, you can specify a specific type of event to remove.\r
+             * @param {HTMLElement} el the element to purge\r
+             * @param {boolean} recurse recursively purge this element's children\r
+             * as well.  Use with caution.\r
+             * @param {string} sType optional type of listener to purge. If\r
+             * left out, all listeners will be removed\r
+             */\r
+            purgeElement: function(el, recurse, sType) {\r
+                var elListeners = this.getListeners(el, sType);\r
+                if (elListeners) {\r
+                    for (var i=0,len=elListeners.length; i<len ; ++i) {\r
+                        var l = elListeners[i];\r
+                        this.removeListener(el, l.type, l.fn, l.index);\r
+                    }\r
+                }\r
+\r
+                if (recurse && el && el.childNodes) {\r
+                    for (i=0,len=el.childNodes.length; i<len ; ++i) {\r
+                        this.purgeElement(el.childNodes[i], recurse, sType);\r
+                    }\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns all listeners attached to the given element via addListener.\r
+             * Optionally, you can specify a specific type of event to return.\r
+             * @param el {HTMLElement} the element to inspect \r
+             * @param sType {string} optional type of listener to return. If\r
+             * left out, all listeners will be returned\r
+             * @return {Object} the listener. Contains the following fields:\r
+             *    type:   (string)   the type of event\r
+             *    fn:     (function) the callback supplied to addListener\r
+             *    obj:    (object)   the custom object supplied to addListener\r
+             *    adjust: (boolean)  whether or not to adjust the default scope\r
+             *    index:  (int)      its position in the Event util listener cache\r
+             */           \r
+            getListeners: function(el, sType) {\r
+                var elListeners = [];\r
+                if (listeners && listeners.length > 0) {\r
+                    for (var i=0,len=listeners.length; i<len ; ++i) {\r
+                        var l = listeners[i];\r
+                        if ( l  && l[this.EL] === el && \r
+                                (!sType || sType === l[this.TYPE]) ) {\r
+                            elListeners.push({\r
+                                type:   l[this.TYPE],\r
+                                fn:     l[this.FN],\r
+                                obj:    l[this.SCOPE],\r
+                                adjust: l[this.ADJ_SCOPE],\r
+                                index:  i\r
+                            });\r
+                        }\r
+                    }\r
+                }\r
+\r
+                return (elListeners.length) ? elListeners : null;\r
+            },\r
+\r
+            /**\r
+             * Removes all listeners registered by pe.event.  Called \r
+             * automatically during the unload event.\r
+             * @private\r
+             */\r
+            _unload: function(e, me) {\r
+                for (var i=0,len=unloadListeners.length; i<len; ++i) {\r
+                    var l = unloadListeners[i];\r
+                    if (l) {\r
+                        var scope = (l[this.ADJ_SCOPE]) ? l[this.SCOPE]: window;\r
+                        l[this.FN].call(scope, this.getEvent(e), l[this.SCOPE] );\r
+                    }\r
+                }\r
+\r
+                if (listeners && listeners.length > 0) {\r
+                    for (i=0,len=listeners.length; i<len ; ++i) {\r
+                        l = listeners[i];\r
+                        if (l) {\r
+                            this.removeListener(l[this.EL], l[this.TYPE], \r
+                                    l[this.FN], i);\r
+                        }\r
+                    }\r
+\r
+                    this.clearCache();\r
+                }\r
+\r
+                for (i=0,len=customEvents.length; i<len; ++i) {\r
+                    customEvents[i].unsubscribeAll();\r
+                    delete customEvents[i];\r
+                }\r
+\r
+                for (i=0,len=legacyEvents.length; i<len; ++i) {\r
+                    // dereference the element\r
+                    delete legacyEvents[i][0];\r
+                    // delete the array item\r
+                    delete legacyEvents[i];\r
+                }\r
+            },\r
+\r
+            /**\r
+             * Returns scrollLeft\r
+             * @private\r
+             */\r
+            _getScrollLeft: function() {\r
+                return this._getScroll()[1];\r
+            },\r
+\r
+            /**\r
+             * Returns scrollTop\r
+             * @private\r
+             */\r
+            _getScrollTop: function() {\r
+                return this._getScroll()[0];\r
+            },\r
+\r
+            /**\r
+             * Returns the scrollTop and scrollLeft.  Used to calculate the \r
+             * pageX and pageY in Internet Explorer\r
+             * @private\r
+             */\r
+            _getScroll: function() {\r
+                var dd = document.documentElement; db = document.body;\r
+                if (dd && dd.scrollTop) {\r
+                    return [dd.scrollTop, dd.scrollLeft];\r
+                } else if (db) {\r
+                    return [db.scrollTop, db.scrollLeft];\r
+                } else {\r
+                    return [0, 0];\r
+                }\r
+            }\r
+        };\r
+    } ();\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    YAHOO.util.Event.on = YAHOO.util.Event.addListener;\r
+\r
+    if (document && document.body) {\r
+        YAHOO.util.Event._load();\r
+    } else {\r
+        YAHOO.util.Event.on(window, "load", YAHOO.util.Event._load, \r
+                YAHOO.util.Event, true);\r
+    }\r
+\r
+    YAHOO.util.Event.on(window, "unload", YAHOO.util.Event._unload, \r
+                YAHOO.util.Event, true);\r
+\r
+    YAHOO.util.Event._tryPreloadAttach();\r
+\r
+}\r
+\r
diff --git a/lib/yui/fonts/README b/lib/yui/fonts/README
new file mode 100755 (executable)
index 0000000..18261a4
--- /dev/null
@@ -0,0 +1,9 @@
+CSS Fonts Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* No changes.\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Initial release.\r
diff --git a/lib/yui/fonts/fonts-min.css b/lib/yui/fonts/fonts-min.css
new file mode 100755 (executable)
index 0000000..cdb152b
--- /dev/null
@@ -0,0 +1,7 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}\r
diff --git a/lib/yui/fonts/fonts.css b/lib/yui/fonts/fonts.css
new file mode 100755 (executable)
index 0000000..59808b1
--- /dev/null
@@ -0,0 +1,31 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+/**\r
+ * 84.5% for !IE, keywords for IE\r
+ * Percents could work for IE, but for backCompat purposes, we are using keywords.\r
+ * x-small is for IE < 6 and IE6 quirks mode.\r
+ * \r
+ */\r
+body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}\r
+table {font-size:inherit;font:100%;}\r
+\r
+/**\r
+ * 99% for safari; 100% is too large\r
+ */\r
+select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}\r
+\r
+/**\r
+ * Bump up !IE to get to 13px equivalent\r
+ */\r
+pre, code {font:115% monospace;*font-size:100%;}\r
+\r
+/**\r
+ * Default line-height based on font-size rather than "computed-value"\r
+ * see: http://www.w3.org/TR/CSS21/visudet.html#line-height\r
+ */\r
+body * {line-height:1.22em;}\r
diff --git a/lib/yui/grids/README b/lib/yui/grids/README
new file mode 100755 (executable)
index 0000000..16fe8fb
--- /dev/null
@@ -0,0 +1,10 @@
+CSS Grids Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* Removed line #43 because it set an already-set value. \r
+  Was: ".yui-t7  #main .yui-b{min-width:750px;}"\r
+  \r
+*** version 0.10.0 ***\r
+\r
+* Initial release.
\ No newline at end of file
diff --git a/lib/yui/grids/grids-min.css b/lib/yui/grids/grids-min.css
new file mode 100755 (executable)
index 0000000..b3f2853
--- /dev/null
@@ -0,0 +1,7 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+body{text-align:center;}#doc{width:57.69em;*width:56.3em;min-width:750px;margin:auto;text-align:left;}#hd,#bd{margin-bottom:1em;text-align:left;}#ft{font-size:77%;font-family:verdana;clear:both;}.yui-t1 #yui-main .yui-b, .yui-t2 #yui-main .yui-b, .yui-t3 #yui-main .yui-b, .yui-t4 .yui-b, .yui-t5 .yui-b, .yui-t6 .yui-b{float:right;}.yui-t1 .yui-b, .yui-t2 .yui-b, .yui-t3 .yui-b, .yui-t4 #yui-main .yui-b, .yui-t5 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{float:left;}.yui-t1 #yui-main .yui-b{width:76%;min-width:570px;}.yui-t1 .yui-b{width:21.33%;min-width:160px;}.yui-t2 #yui-main .yui-b, .yui-t4 #yui-main .yui-b{width:73.4%;min-width:550px;}.yui-t2 .yui-b, .yui-t4 .yui-b{width:24%;min-width:180px;}.yui-t3 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{width:57.6%;min-width:430px;}.yui-t3 .yui-b, .yui-t6 .yui-b{width:40%;min-width:300px;}.yui-t5 #yui-main .yui-b{width:65.4%;min-width:490px;}.yui-t5 .yui-b{width:32%;min-width:240px;}.yui-g .yui-u, .yui-g .yui-g, .yui-ge .yui-u, .yui-gf .yui-u{float:right;display:inline;}.yui-g .first, .yui-gd .first, .yui-ge .first, .yui-gf .first{float:left;}.yui-g .yui-u, .yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u, .yui-gc .yui-u, .yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb .first, .yui-gc .first, .yui-gd .first{margin-left:0;}.yui-gc .first, .yui-gd .yui-u{width:66%;}.yui-gd .first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge .first, .yui-gf .yui-u{width:74.2%;}.yui-gf .first{width:24%;}.yui-ge .first{width:74.2%;}#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf{zoom:1;}
\ No newline at end of file
diff --git a/lib/yui/grids/grids.css b/lib/yui/grids/grids.css
new file mode 100755 (executable)
index 0000000..2af0f6a
--- /dev/null
@@ -0,0 +1,82 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+body {\r
+   text-align:center;\r
+}\r
+\r
+#doc {\r
+   width:57.69em;\r
+   *width:56.3em; /* IE */\r
+   min-width:750px;\r
+   margin:auto;\r
+   text-align:left;\r
+}\r
+\r
+#hd,#bd {margin-bottom:1em;text-align:left;}\r
+#ft {font-size:77%;font-family:verdana;clear:both;}\r
+\r
+/* rules for main templates */\r
+.yui-t1 #yui-main .yui-b, .yui-t2 #yui-main .yui-b, .yui-t3 #yui-main .yui-b, .yui-t4 .yui-b, .yui-t5 .yui-b, .yui-t6 .yui-b {float:right;}\r
+.yui-t1 .yui-b, .yui-t2 .yui-b, .yui-t3 .yui-b, .yui-t4 #yui-main .yui-b, .yui-t5 #yui-main .yui-b, .yui-t6 #yui-main .yui-b {float:left;}\r
+\r
+/* t1: L160 */\r
+.yui-t1 #yui-main .yui-b {width:76%;min-width:570px;}\r
+.yui-t1 .yui-b {width:21.33%;min-width:160px;}\r
+\r
+/* t2 & t4: L180 & R180 */\r
+.yui-t2 #yui-main .yui-b, .yui-t4 #yui-main .yui-b {width:73.4%;min-width:550px;}\r
+.yui-t2 .yui-b, .yui-t4 .yui-b {width:24%;min-width:180px;}\r
+\r
+/* t3 & t6: L300 & R300 */\r
+.yui-t3 #yui-main .yui-b, .yui-t6 #yui-main .yui-b {width:57.6%;min-width:430px;}\r
+.yui-t3 .yui-b, .yui-t6 .yui-b {width:40%;min-width:300px;}\r
+\r
+/* t5: R240 */\r
+.yui-t5 #yui-main .yui-b {width:65.4%;min-width:490px;}\r
+.yui-t5 .yui-b {width:32%;min-width:240px;}\r
+\r
+/* t7: 750 */\r
+\r
+\r
+\r
+/*     grid-generic rules for all templates */\r
+\r
+/* all modules and grids nested in a grid get floated */\r
+.yui-g .yui-u, .yui-g .yui-g, .yui-ge .yui-u, .yui-gf .yui-u {\r
+   float:right; \r
+   display:inline;   /* IE */ \r
+}\r
+\r
+/* float left and kill margin on first for added flex */\r
+.yui-g .first, .yui-gd .first, .yui-ge .first, .yui-gf .first {float:left; }\r
+\r
+/* 2 col */\r
+.yui-g .yui-u, .yui-g .yui-g {width:49.1%;}\r
+.yui-g .yui-g .yui-u {width:48.1%;} /* smaller for nested to preserve margins */\r
+\r
+/* 3 col */\r
+.yui-gb .yui-u, .yui-gc .yui-u, .yui-gd .yui-u {\r
+   float:left; /* need to reverse the order for 3 */\r
+   margin-left:2%; *margin-left:1.895%;   \r
+   width:32%;\r
+}\r
+\r
+.yui-gb .first, .yui-gc .first, .yui-gd .first {margin-left:0;}\r
+\r
+/* colspan 2 */\r
+.yui-gc .first, .yui-gd .yui-u {width:66%;}\r
+.yui-gd .first {width:32%;}\r
+\r
+/* colspan 3 */\r
+.yui-ge .yui-u {width:24%;}\r
+.yui-ge .first, .yui-gf .yui-u {width:74.2%;}\r
+.yui-gf .first {width:24%;}\r
+.yui-ge .first {width:74.2%;}\r
+\r
+/* self clear floated parent containers */\r
+#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after {content:".";display:block;height:0;clear:both;visibility:hidden;}  \r
+#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf {zoom:1;} /* IE */
\ No newline at end of file
diff --git a/lib/yui/logger/README b/lib/yui/logger/README
new file mode 100755 (executable)
index 0000000..1099a2b
--- /dev/null
@@ -0,0 +1,6 @@
+Logger Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* Initial release\r
+\r
diff --git a/lib/yui/logger/assets/logger.css b/lib/yui/logger/assets/logger.css
new file mode 100755 (executable)
index 0000000..a7e9a50
--- /dev/null
@@ -0,0 +1,20 @@
+/* logger default styles */\r\r
+/* font size is controlled here: default 77% */\r\r
+#yui-log {position:absolute;top:1em;right:1em;font-size:77%;text-align:left;}\r\r
+/* width is controlled here: default 31em */\r\r
+.yui-log {padding:1em;width:31em;background-color:#AAA;border:1px solid black;font-family:monospace;z-index:9000;}\r\r
+.yui-log p {margin:1px;padding:.1em;}\r\r
+.yui-log button {font-family:monospace;}\r\r
+.yui-log .yui-log-hd {margin-top:1em;padding:.5em;background-color:#575757;color:#FFF;}\r\r
+/* height is controlled here: default 20em*/\r\r
+.yui-log .yui-log-bd {width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}\r\r
+.yui-log .yui-log-ft {margin-top:.5em;margin-bottom:1em;}\r\r
+.yui-log .yui-log-ft .yui-log-categoryfilters {}\r\r
+.yui-log .yui-log-ft .yui-log-sourcefilters {width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}\r\r
+.yui-log .yui-log-btns {position:relative;float:right;bottom:.25em;}\r\r
+.yui-log .yui-log-filtergrp {margin-right:.5em;}\r\r
+.yui-log .info {background-color:#A7CC25;} /* A7CC25 green */\r\r
+.yui-log .warn {background-color:#F58516;} /* F58516 orange */\r\r
+.yui-log .error {background-color:#E32F0B;} /* E32F0B red */\r\r
+.yui-log .time {background-color:#A6C9D7;} /* A6C9D7 blue */\r\r
+.yui-log .window {background-color:#F2E886;} /* F2E886 tan */\r\r
diff --git a/lib/yui/logger/logger-debug.js b/lib/yui/logger/logger-debug.js
new file mode 100755 (executable)
index 0000000..bbd42f5
--- /dev/null
@@ -0,0 +1,1186 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/**\r\r
+ * Singleton providing core logging functionality. Saves logs written through the\r\r
+ * global YAHOO.log function or written by LogWriter. Provides access to logs\r\r
+ * for reading by LogReader. Log messages are automatically output to Firebug,\r\r
+ * if present.\r\r
+ *\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ */\r\r
+YAHOO.widget.Logger = {\r\r
+    // Initialize members\r\r
+    loggerEnabled: true,\r\r
+    _firebugEnabled: true,\r\r
+    categories: ["info","warn","error","time","window"],\r\r
+    sources: ["global"],\r\r
+    _stack: [], // holds all log msgs\r\r
+    _startTime: new Date().getTime(), // static start timestamp\r\r
+    _lastTime: null // timestamp of last logged message\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when a new category has been created. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The category name\r\r
+ */\r\r
+YAHOO.widget.Logger.categoryCreateEvent = new YAHOO.util.CustomEvent("categoryCreate", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when a new source has been named. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The source name\r\r
+ */\r\r
+YAHOO.widget.Logger.sourceCreateEvent = new YAHOO.util.CustomEvent("sourceCreate", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when a new log message has been created. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The log message\r\r
+ */\r\r
+YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when the Logger has been reset has been created.\r\r
+ */\r\r
+YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset", this, true);\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Saves a log message to the stack and fires newLogEvent. If the log message is\r\r
+ * assigned to an unknown category, creates a new category. If the log message is\r\r
+ * from an unknown source, creates a new source.  If Firebug is enabled,\r\r
+ * outputs the log message to Firebug.\r\r
+ *\r\r
+ * @param {string} sMsg The log message\r\r
+ * @param {string} sCategory Category of log message, or null\r\r
+ * @param {string} sSource Source of LogWriter, or null if global\r\r
+ */\r\r
+YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {\r\r
+    if(this.loggerEnabled) {\r\r
+        if(!sCategory) {\r\r
+            sCategory = "info"; // default category\r\r
+        }\r\r
+        else if(this._isNewCategory(sCategory)) {\r\r
+            this._createNewCategory(sCategory);\r\r
+        }\r\r
+        var sClass = "global"; // default source\r\r
+        var sDetail = null;\r\r
+        if(sSource) {\r\r
+            var spaceIndex = sSource.indexOf(" ");\r\r
+            if(spaceIndex > 0) {\r\r
+                sClass = sSource.substring(0,spaceIndex);// substring until first space\r\r
+                sDetail = sSource.substring(spaceIndex,sSource.length);// the rest of the source\r\r
+            }\r\r
+            else {\r\r
+                sClass = sSource;\r\r
+            }\r\r
+            if(this._isNewSource(sClass)) {\r\r
+                this._createNewSource(sClass);\r\r
+            }\r\r
+        }\r\r
+\r\r
+        var timestamp = new Date();\r\r
+        var logEntry = {\r\r
+            time: timestamp,\r\r
+            category: sCategory,\r\r
+            source: sClass,\r\r
+            sourceDetail: sDetail,\r\r
+            msg: sMsg\r\r
+        };\r\r
+\r\r
+        this._stack.push(logEntry);\r\r
+        this.newLogEvent.fire(logEntry);\r\r
+\r\r
+        if(this._firebugEnabled) {\r\r
+            this._printToFirebug(logEntry);\r\r
+        }\r\r
+        return true;\r\r
+    }\r\r
+    else {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Resets internal stack and startTime, enables Logger, and fires logResetEvent.\r\r
+ *\r\r
+ */\r\r
+YAHOO.widget.Logger.reset = function() {\r\r
+    this._stack = [];\r\r
+    this._startTime = new Date().getTime();\r\r
+    this.loggerEnabled = true;\r\r
+    this.log(null, "Logger reset");\r\r
+    this.logResetEvent.fire();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to internal stack of log messages.\r\r
+ *\r\r
+ * @return {array} Array of log messages.\r\r
+ */\r\r
+YAHOO.widget.Logger.getStack = function() {\r\r
+    return this._stack;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to internal start time.\r\r
+ *\r\r
+ * @return {date} Internal date of when Logger singleton was initialized.\r\r
+ */\r\r
+YAHOO.widget.Logger.getStartTime = function() {\r\r
+    return this._startTime;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Disables output to the Firebug Firefox extension.\r\r
+ */\r\r
+YAHOO.widget.Logger.disableFirebug = function() {\r\r
+    YAHOO.log("YAHOO.Logger output to Firebug has been disabled.");\r\r
+    this._firebugEnabled = false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Enables output to the Firebug Firefox extension.\r\r
+ */\r\r
+YAHOO.widget.Logger.enableFirebug = function() {\r\r
+    this._firebugEnabled = true;\r\r
+    YAHOO.log("YAHOO.Logger output to Firebug has been enabled.");\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Creates a new category of log messages and fires categoryCreateEvent.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._createNewCategory = function(category) {\r\r
+    this.categories.push(category);\r\r
+    this.categoryCreateEvent.fire(category);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Checks to see if a category has already been created.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @return {boolean} Returns true if category is unknown, else returns false\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._isNewCategory = function(category) {\r\r
+    for(var i=0; i < this.categories.length; i++) {\r\r
+        if(category == this.categories[i]) {\r\r
+            return false;\r\r
+        }\r\r
+    }\r\r
+    return true;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Creates a new source of log messages and fires sourceCreateEvent.\r\r
+ *\r\r
+ * @param {string} source Source name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._createNewSource = function(source) {\r\r
+    this.sources.push(source);\r\r
+    this.sourceCreateEvent.fire(source);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Checks to see if a source has already been created.\r\r
+ *\r\r
+ * @param {string} source Source name\r\r
+ * @return {boolean} Returns true if source is unknown, else returns false\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._isNewSource = function(source) {\r\r
+    if(source) {\r\r
+        for(var i=0; i < this.sources.length; i++) {\r\r
+            if(source == this.sources[i]) {\r\r
+                return false;\r\r
+            }\r\r
+        }\r\r
+        return true;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Outputs a log message to Firebug.\r\r
+ *\r\r
+ * @param {object} entry Log entry object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._printToFirebug = function(entry) {\r\r
+    if(window.console && console.log) {\r\r
+        var category = entry.category;\r\r
+        var label = entry.category.substring(0,4).toUpperCase();\r\r
+\r\r
+        var time = entry.time;\r\r
+        if (time.toLocaleTimeString) {\r\r
+            var localTime  = time.toLocaleTimeString();\r\r
+        }\r\r
+        else {\r\r
+            localTime = time.toString();\r\r
+        }\r\r
+\r\r
+        var msecs = time.getTime();\r\r
+        var elapsedTime = (YAHOO.widget.Logger._lastTime) ?\r\r
+            (msecs - YAHOO.widget.Logger._lastTime) : 0;\r\r
+        YAHOO.widget.Logger._lastTime = msecs;\r\r
+\r\r
+        var output = //Firebug doesn't support HTML "<span class='"+category+"'>"+label+"</span> " +\r\r
+            localTime + " (" +\r\r
+            elapsedTime + "ms): " +\r\r
+            entry.source + ": " +\r\r
+            entry.msg;\r\r
+\r\r
+        \r\r
+        console.log(output);\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private event handlers\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Handles logging of messages due to window error events.\r\r
+ *\r\r
+ * @param {string} msg The error message\r\r
+ * @param {string} url URL of the error\r\r
+ * @param {string} line Line number of the error\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._onWindowError = function(msg,url,line) {\r\r
+    // Logger is not in scope of this event handler\r\r
+    try {\r\r
+        YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')', "window");\r\r
+        if(YAHOO.widget.Logger._origOnWindowError) {\r\r
+            YAHOO.widget.Logger._origOnWindowError();\r\r
+        }\r\r
+    }\r\r
+    catch(e) {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handle native JavaScript errors\r\r
+ */\r\r
+//NB: Not all browsers support the window.onerror event\r\r
+if(window.onerror) {\r\r
+    // Save any previously defined handler to call\r\r
+    YAHOO.widget.Logger._origOnWindowError = window.onerror;\r\r
+}\r\r
+window.onerror = YAHOO.widget.Logger._onWindowError;\r\r
+\r\r
+/**\r\r
+ * First log\r\r
+ */\r\r
+YAHOO.widget.Logger.log("Logger initialized");\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/**\r\r
+ * Class providing ability to log messages through YAHOO.widget.Logger from a\r\r
+ * named source.\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {string} sSource Source of LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter = function(sSource) {\r\r
+    if(!sSource) {\r\r
+        YAHOO.log("Could not instantiate LogWriter due to invalid source.", "error", "LogWriter");\r\r
+        return;\r\r
+    }\r\r
+    this._source = sSource;\r\r
+ };\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the LogWriter instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.toString = function() {\r\r
+    return "LogWriter " + this._sSource;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Logs a message attached to the source of the LogWriter.\r\r
+ *\r\r
+ * @param {string} sMsg The log message\r\r
+ * @param {string} sCategory Category name\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {\r\r
+    YAHOO.widget.Logger.log(sMsg, sCategory, this._source);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to get the source name.\r\r
+ *\r\r
+ * @return {string} The LogWriter source\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.getSource = function() {\r\r
+    return this._sSource;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to set the source name.\r\r
+ *\r\r
+ * @param {string} sSource Source of LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.setSource = function(sSource) {\r\r
+    if(!sSource) {\r\r
+        YAHOO.log("Could not set source due to invalid source.", "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this._sSource = sSource;\r\r
+    }\r\r
+};\r\r
+/***************************************************************************\r\r
+ * Private members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Source of the log writer instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype._source = null;\r\r
+\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing UI to read messages logged to YAHOO.widget.Logger.\r\r
+ *\r\r
+ * requires YAHOO.util.Dom DOM utility\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ * optional YAHOO.util.DragDrop Drag and drop utility\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {el or ID} containerEl DOM element object or ID of container to wrap reader UI\r\r
+ * @param {object} oConfig Optional object literal of configuration params\r\r
+ */\r\r
+YAHOO.widget.LogReader = function(containerEl, oConfig) {\r\r
+    var oSelf = this;\r\r
+\r\r
+    // Parse config vars here\r\r
+    if (typeof oConfig == "object") {\r\r
+        for(var param in oConfig) {\r\r
+            this[param] = oConfig[param];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Attach container...\r\r
+    if(containerEl) {\r\r
+        if(typeof containerEl == "string") {\r\r
+            this._containerEl = document.getElementById(containerEl);\r\r
+        }\r\r
+        else if(containerEl.tagName) {\r\r
+            this._containerEl = containerEl;\r\r
+        }\r\r
+        this._containerEl.className = "yui-log";\r\r
+    }\r\r
+    // ...or create container from scratch\r\r
+    if(!this._containerEl) {\r\r
+        if(YAHOO.widget.LogReader._defaultContainerEl) {\r\r
+            this._containerEl =  YAHOO.widget.LogReader._defaultContainerEl;\r\r
+        }\r\r
+        else {\r\r
+            this._containerEl = document.body.appendChild(document.createElement("div"));\r\r
+            this._containerEl.id = "yui-log";\r\r
+            this._containerEl.className = "yui-log";\r\r
+\r\r
+            YAHOO.widget.LogReader._defaultContainerEl = this._containerEl;\r\r
+        }\r\r
+\r\r
+        // If implementer has provided container values, trust and set those\r\r
+        var containerStyle = this._containerEl.style;\r\r
+        if(this.width) {\r\r
+            containerStyle.width = this.width;\r\r
+        }\r\r
+        if(this.left) {\r\r
+            containerStyle.left = this.left;\r\r
+        }\r\r
+        if(this.right) {\r\r
+            containerStyle.right = this.right;\r\r
+        }\r\r
+        if(this.bottom) {\r\r
+            containerStyle.bottom = this.bottom;\r\r
+        }\r\r
+        if(this.top) {\r\r
+            containerStyle.top = this.top;\r\r
+        }\r\r
+        if(this.fontSize) {\r\r
+            containerStyle.fontSize = this.fontSize;\r\r
+        }\r\r
+    }\r\r
+\r\r
+    if(this._containerEl) {\r\r
+        // Create header\r\r
+        if(!this._hdEl) {\r\r
+            this._hdEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._hdEl.id = "yui-log-hd" + YAHOO.widget.LogReader._index;\r\r
+            this._hdEl.className = "yui-log-hd";\r\r
+\r\r
+            this._collapseEl = this._hdEl.appendChild(document.createElement("div"));\r\r
+            this._collapseEl.className = "yui-log-btns";\r\r
+\r\r
+            this._collapseBtn = document.createElement("input");\r\r
+            this._collapseBtn.type = "button";\r\r
+            this._collapseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._collapseBtn.className = "yui-log-button";\r\r
+            this._collapseBtn.value = "Collapse";\r\r
+            this._collapseBtn = this._collapseEl.appendChild(this._collapseBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);\r\r
+\r\r
+            this._title = this._hdEl.appendChild(document.createElement("h4"));\r\r
+            this._title.innerHTML = "Logger Console";\r\r
+\r\r
+            // If Drag and Drop utility is available...\r\r
+            // ...and this container was created from scratch...\r\r
+            // ...then make the header draggable\r\r
+            if(YAHOO.util.DD &&\r\r
+            (YAHOO.widget.LogReader._defaultContainerEl == this._containerEl)) {\r\r
+                var ylog_dd = new YAHOO.util.DD(this._containerEl.id);\r\r
+                ylog_dd.setHandleElId(this._hdEl.id);\r\r
+                this._hdEl.style.cursor = "move";\r\r
+            }\r\r
+        }\r\r
+        // Ceate console\r\r
+        if(!this._consoleEl) {\r\r
+            this._consoleEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._consoleEl.className = "yui-log-bd";\r\r
+            \r\r
+            // If implementer has provided console, trust and set those\r\r
+            if(this.height) {\r\r
+                this._consoleEl.style.height = this.height;\r\r
+            }\r\r
+        }\r\r
+        // Don't create footer if disabled\r\r
+        if(!this._ftEl && this.footerEnabled) {\r\r
+            this._ftEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._ftEl.className = "yui-log-ft";\r\r
+\r\r
+            this._btnsEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._btnsEl.className = "yui-log-btns";\r\r
+\r\r
+            this._pauseBtn = document.createElement("input");\r\r
+            this._pauseBtn.type = "button";\r\r
+            this._pauseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._pauseBtn.className = "yui-log-button";\r\r
+            this._pauseBtn.value = "Pause";\r\r
+            this._pauseBtn = this._btnsEl.appendChild(this._pauseBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);\r\r
+\r\r
+            this._clearBtn = document.createElement("input");\r\r
+            this._clearBtn.type = "button";\r\r
+            this._clearBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._clearBtn.className = "yui-log-button";\r\r
+            this._clearBtn.value = "Clear";\r\r
+            this._clearBtn = this._btnsEl.appendChild(this._clearBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);\r\r
+\r\r
+            this._categoryFiltersEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._categoryFiltersEl.className = "yui-log-categoryfilters";\r\r
+            this._sourceFiltersEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._sourceFiltersEl.className = "yui-log-sourcefilters";\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialize buffer\r\r
+    if(!this._buffer) {\r\r
+        this._buffer = []; // output buffer\r\r
+    }\r\r
+    YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);\r\r
+    this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last log message to console\r\r
+\r\r
+    // Initialize category filters\r\r
+    this._categoryFilters = [];\r\r
+    var catsLen = YAHOO.widget.Logger.categories.length;\r\r
+    if(this._categoryFiltersEl) {\r\r
+        for(var i=0; i < catsLen; i++) {\r\r
+            this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);\r\r
+        }\r\r
+    }\r\r
+    // Initialize source filters\r\r
+    this._sourceFilters = [];\r\r
+    var sourcesLen = YAHOO.widget.Logger.sources.length;\r\r
+    if(this._sourceFiltersEl) {\r\r
+        for(var j=0; j < sourcesLen; j++) {\r\r
+            this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);\r\r
+        }\r\r
+    }\r\r
+    YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate, this);\r\r
+    YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate, this);\r\r
+\r\r
+    YAHOO.widget.LogReader._index++;\r\r
+    this._filterLogs();\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Whether or not the log reader is enabled to output log messages. Default:\r\r
+ * true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS width of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.width = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS height of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.height = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS top position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.top = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS left position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.left = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS right position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.right = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS bottom position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.bottom = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS font size of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.fontSize = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the footer UI is enabled for the log reader. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.footerEnabled = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not output is verbose (more readable). Setting to true will make\r\r
+ * output more compact (less readable). Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.verboseOutput = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not newest message is printed on top. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.newestOnTop = true;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Pauses output of log messages. While paused, log messages are not lost, but\r\r
+ * get saved to a buffer and then output upon resume of log reader.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.pause = function() {\r\r
+    this._timeout = null;\r\r
+    this.logReaderEnabled = false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Resumes output of log messages, including outputting any log messages that\r\r
+ * have been saved to buffer while paused.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.resume = function() {\r\r
+    this.logReaderEnabled = true;\r\r
+    this._printBuffer();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Hides UI of log reader. Logging functionality is not disrupted.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.hide = function() {\r\r
+    this._containerEl.style.display = "none";\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Shows UI of log reader. Logging functionality is not disrupted.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.show = function() {\r\r
+    this._containerEl.style.display = "block";\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates title to given string.\r\r
+ *\r\r
+ * @param {string} sTitle String to display in log reader's title bar.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {\r\r
+    var regEx = />/g;\r\r
+    sTitle = sTitle.replace(regEx,"&gt;");\r\r
+    regEx = /</g;\r\r
+    sTitle = sTitle.replace(regEx,"&lt;");\r\r
+    this._title.innerHTML = (sTitle);\r\r
+};\r\r
+ /***************************************************************************\r\r
+ * Private members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class member to index multiple log reader instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader._index = 0;\r\r
+\r\r
+/**\r\r
+ * A class member shared by all log readers if a container needs to be\r\r
+ * created during instantiation. Will be null if a container element never needs to\r\r
+ * be created on the fly, such as when the implementer passes in their own element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader._defaultContainerEl = null;\r\r
+\r\r
+/**\r\r
+ * Buffer of log messages for batch output.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._buffer = null;\r\r
+\r\r
+/**\r\r
+ * Date of last output log message.\r\r
+ *\r\r
+ * @type date\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._lastTime = null;\r\r
+\r\r
+/**\r\r
+ * Batched output timeout ID.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._timeout = null;\r\r
+\r\r
+/**\r\r
+ * Array of filters for log message categories.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._categoryFilters = null;\r\r
+\r\r
+/**\r\r
+ * Array of filters for log message sources.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._sourceFilters = null;\r\r
+\r\r
+/**\r\r
+ * Log reader container element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._containerEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader header element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._hdEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader collapse element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._collapseEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader collapse button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._collapseBtn = null;\r\r
+\r\r
+/**\r\r
+ * Log reader title header element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._title = null;\r\r
+\r\r
+/**\r\r
+ * Log reader console element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._consoleEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader footer element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._ftEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader buttons container element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._btnsEl = null;\r\r
+\r\r
+/**\r\r
+ * Container element for log reader category filter checkboxes.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._categoryFiltersEl = null;\r\r
+\r\r
+/**\r\r
+ * Container element for log reader source filter checkboxes.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._sourceFiltersEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader pause button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._pauseBtn = null;\r\r
+\r\r
+/**\r\r
+ * lear button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._clearBtn = null;\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Creates the UI for a category filter in the log reader footer element.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(category) {\r\r
+    var oSelf = this;\r\r
+    \r\r
+    if(this._ftEl) {\r\r
+        var parentEl = this._categoryFiltersEl;\r\r
+        var filters = this._categoryFilters;\r\r
+\r\r
+        var filterEl = parentEl.appendChild(document.createElement("span"));\r\r
+        filterEl.className = "yui-log-filtergrp";\r\r
+            // Append el at the end so IE 5.5 can set "type" attribute\r\r
+            // and THEN set checked property\r\r
+            var categoryChk = document.createElement("input");\r\r
+            categoryChk.id = "yui-log-filter-" + category + YAHOO.widget.LogReader._index;\r\r
+            categoryChk.className = "yui-log-filter-" + category;\r\r
+            categoryChk.type = "checkbox";\r\r
+            categoryChk.category = category;\r\r
+            categoryChk = filterEl.appendChild(categoryChk);\r\r
+            categoryChk.checked = true;\r\r
+\r\r
+            // Add this checked filter to the internal array of filters\r\r
+            filters.push(category);\r\r
+            // Subscribe to the click event\r\r
+            YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);\r\r
+\r\r
+            // Create and class the text label\r\r
+            var categoryChkLbl = filterEl.appendChild(document.createElement("label"));\r\r
+            categoryChkLbl.htmlFor = categoryChk.id;\r\r
+            categoryChkLbl.className = category;\r\r
+            categoryChkLbl.innerHTML = category;\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(source) {\r\r
+    var oSelf = this;\r\r
+\r\r
+    if(this._ftEl) {\r\r
+        var parentEl = this._sourceFiltersEl;\r\r
+        var filters = this._sourceFilters;\r\r
+\r\r
+        var filterEl = parentEl.appendChild(document.createElement("span"));\r\r
+        filterEl.className = "yui-log-filtergrp";\r\r
+\r\r
+        // Append el at the end so IE 5.5 can set "type" attribute\r\r
+        // and THEN set checked property\r\r
+        var sourceChk = document.createElement("input");\r\r
+        sourceChk.id = "yui-log-filter" + source + YAHOO.widget.LogReader._index;\r\r
+        sourceChk.className = "yui-log-filter" + source;\r\r
+        sourceChk.type = "checkbox";\r\r
+        sourceChk.source = source;\r\r
+        sourceChk = filterEl.appendChild(sourceChk);\r\r
+        sourceChk.checked = true;\r\r
+\r\r
+        // Add this checked filter to the internal array of filters\r\r
+        filters.push(source);\r\r
+        // Subscribe to the click event\r\r
+        YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);\r\r
+\r\r
+        // Create and class the text label\r\r
+        var sourceChkLbl = filterEl.appendChild(document.createElement("label"));\r\r
+        sourceChkLbl.htmlFor = sourceChk.id;\r\r
+        sourceChkLbl.className = source;\r\r
+        sourceChkLbl.innerHTML = source;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Reprints all log messages in the stack through filters.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._filterLogs = function() {\r\r
+    // Reprint stack with new filters\r\r
+    if (this._consoleEl !== null) {\r\r
+        this._clearConsole();\r\r
+        this._printToConsole(YAHOO.widget.Logger.getStack());\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Clears all outputted log messages from the console and resets the time of the\r\r
+ * last output log message.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._clearConsole = function() {\r\r
+    // Clear the buffer of any pending messages\r\r
+    this._timeout = null;\r\r
+    this._buffer = [];\r\r
+\r\r
+    // Reset the rolling timer\r\r
+    this._lastTime = YAHOO.widget.Logger.getStartTime();\r\r
+\r\r
+    var consoleEl = this._consoleEl;\r\r
+    while(consoleEl.hasChildNodes()) {\r\r
+        consoleEl.removeChild(consoleEl.firstChild);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sends buffer of log messages to output and clears buffer.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._printBuffer = function() {\r\r
+    this._timeout = null;\r\r
+\r\r
+    if (this._consoleEl !== null) {\r\r
+        var entries = [];\r\r
+        for (var i=0; i<this._buffer.length; i++) {\r\r
+            entries[i] = this._buffer[i];\r\r
+        }\r\r
+        this._buffer = [];\r\r
+        this._printToConsole(entries);\r\r
+        if(!this.newestOnTop) {\r\r
+            this._consoleEl.scrollTop = this._consoleEl.scrollHeight;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Cycles through an array of log messages, and outputs each one to the console\r\r
+ * if its category has not been filtered out.\r\r
+ *\r\r
+ * @param {array} aEntries\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {\r\r
+    var entriesLen = aEntries.length;\r\r
+    var sourceFiltersLen = this._sourceFilters.length;\r\r
+    var categoryFiltersLen = this._categoryFilters.length;\r\r
+    // Iterate through all log entries to print the ones that filter through\r\r
+    for(var i=0; i<entriesLen; i++) {\r\r
+        var entry = aEntries[i];\r\r
+        var category = entry.category;\r\r
+        var source = entry.source;\r\r
+        var sourceDetail = entry.sourceDetail;\r\r
+        var okToPrint = false;\r\r
+        var okToFilterCats = false;\r\r
+\r\r
+        for(var j=0; j<sourceFiltersLen; j++) {\r\r
+            if(source == this._sourceFilters[j]) {\r\r
+                okToFilterCats = true;\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+        if(okToFilterCats) {\r\r
+            for(var k=0; k<categoryFiltersLen; k++) {\r\r
+                if(category == this._categoryFilters[k]) {\r\r
+                    okToPrint = true;\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        if(okToPrint) {\r\r
+            // To format for console, calculate the elapsed time\r\r
+            // to be from the last item that passed through the filter,\r\r
+            // not the absolute previous item in the stack\r\r
+            var label = entry.category.substring(0,4).toUpperCase();\r\r
+\r\r
+            var time = entry.time;\r\r
+            if (time.toLocaleTimeString) {\r\r
+                var localTime  = time.toLocaleTimeString();\r\r
+            }\r\r
+            else {\r\r
+                localTime = time.toString();\r\r
+            }\r\r
+\r\r
+            var msecs = time.getTime();\r\r
+            var startTime = YAHOO.widget.Logger.getStartTime();\r\r
+            var totalTime = msecs - startTime;\r\r
+            var elapsedTime = msecs - this._lastTime;\r\r
+            this._lastTime = msecs;\r\r
+            \r\r
+            var verboseOutput = (this.verboseOutput) ? "<br>" : "";\r\r
+            var sourceAndDetail = (sourceDetail) ?\r\r
+                source + " " + sourceDetail : source;\r\r
+\r\r
+            var output =  "<span class='"+category+"'>"+label+"</span> " +\r\r
+                totalTime + "ms (+" +\r\r
+                elapsedTime + ") " + localTime + ": " +\r\r
+                sourceAndDetail + ": " +\r\r
+                verboseOutput +\r\r
+                entry.msg;\r\r
+\r\r
+            var oNewElement = (this.newestOnTop) ?\r\r
+                this._consoleEl.insertBefore(document.createElement("p"),this._consoleEl.firstChild):\r\r
+                this._consoleEl.appendChild(document.createElement("p"));\r\r
+            oNewElement.innerHTML = output;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private event handlers\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Handles Logger's categoryCreateEvent.\r\r
+ *\r\r
+ * @param {string} type The event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(type, args, oSelf) {\r\r
+    var category = args[0];\r\r
+    if(oSelf._ftEl) {\r\r
+        oSelf._createCategoryCheckbox(category);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles Logger's sourceCreateEvent.\r\r
+ *\r\r
+ * @param {string} type The event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(type, args, oSelf) {\r\r
+    var source = args[0];\r\r
+    if(oSelf._ftEl) {\r\r
+        oSelf._createSourceCheckbox(source);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles check events on the category filter checkboxes.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {\r\r
+    var newFilter = this.category;\r\r
+    var filtersArray = oSelf._categoryFilters;\r\r
+\r\r
+    if(!this.checked) { // Remove category from filters\r\r
+        for(var i=0; i<filtersArray.length; i++) {\r\r
+            if(newFilter == filtersArray[i]) {\r\r
+                filtersArray.splice(i, 1);\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+    }\r\r
+    else { // Add category to filters\r\r
+        filtersArray.push(newFilter);\r\r
+    }\r\r
+    oSelf._filterLogs();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles check events on the category filter checkboxes.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {\r\r
+    var newFilter = this.source;\r\r
+    var filtersArray = oSelf._sourceFilters;\r\r
+    \r\r
+    if(!this.checked) { // Remove category from filters\r\r
+        for(var i=0; i<filtersArray.length; i++) {\r\r
+            if(newFilter == filtersArray[i]) {\r\r
+                filtersArray.splice(i, 1);\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+    }\r\r
+    else { // Add category to filters\r\r
+        filtersArray.push(newFilter);\r\r
+    }\r\r
+    oSelf._filterLogs();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the collapse button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {\r\r
+    var btn = oSelf._collapseBtn;\r\r
+    if(btn.value == "Expand") {\r\r
+        oSelf._consoleEl.style.display = "block";\r\r
+        if(oSelf._ftEl) {\r\r
+            oSelf._ftEl.style.display = "block";\r\r
+        }\r\r
+        btn.value = "Collapse";\r\r
+    }\r\r
+    else {\r\r
+        oSelf._consoleEl.style.display = "none";\r\r
+        if(oSelf._ftEl) {\r\r
+            oSelf._ftEl.style.display = "none";\r\r
+        }\r\r
+        btn.value = "Expand";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the pause button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {\r\r
+    var btn = oSelf._pauseBtn;\r\r
+    if(btn.value == "Resume") {\r\r
+        oSelf.resume();\r\r
+        btn.value = "Pause";\r\r
+    }\r\r
+    else {\r\r
+        oSelf.pause();\r\r
+        btn.value = "Resume";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the clear button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {\r\r
+    oSelf._clearConsole();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles Logger's onNewEvent.\r\r
+ *\r\r
+ * @param {string} type The click event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onNewLog = function(type, args, oSelf) {\r\r
+    var logEntry = args[0];\r\r
+    oSelf._buffer.push(logEntry);\r\r
+\r\r
+    if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {\r\r
+        oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, 100);\r\r
+    }\r\r
+};\r\r
+\r\r
+\r\r
diff --git a/lib/yui/logger/logger-min.js b/lib/yui/logger/logger-min.js
new file mode 100755 (executable)
index 0000000..04cada5
--- /dev/null
@@ -0,0 +1,63 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+\r\r
+YAHOO.widget.Logger={loggerEnabled:true,_firebugEnabled:true,categories:["info","warn","error","time","window"],sources:["global"],_stack:[],_startTime:new Date().getTime(),_lastTime:null};YAHOO.widget.Logger.categoryCreateEvent=new YAHOO.util.CustomEvent("categoryCreate",this,true);YAHOO.widget.Logger.sourceCreateEvent=new YAHOO.util.CustomEvent("sourceCreate",this,true);YAHOO.widget.Logger.newLogEvent=new YAHOO.util.CustomEvent("newLog",this,true);YAHOO.widget.Logger.logResetEvent=new YAHOO.util.CustomEvent("logReset",this,true);YAHOO.widget.Logger.log=function(sMsg,sCategory,sSource){if(this.loggerEnabled){if(!sCategory){sCategory="info";}\r\r
+else if(this._isNewCategory(sCategory)){this._createNewCategory(sCategory);}\r\r
+var sClass="global";var sDetail=null;if(sSource){var spaceIndex=sSource.indexOf(" ");if(spaceIndex>0){sClass=sSource.substring(0,spaceIndex);sDetail=sSource.substring(spaceIndex,sSource.length);}\r\r
+else{sClass=sSource;}\r\r
+if(this._isNewSource(sClass)){this._createNewSource(sClass);}}\r\r
+var timestamp=new Date();var logEntry={time:timestamp,category:sCategory,source:sClass,sourceDetail:sDetail,msg:sMsg};this._stack.push(logEntry);this.newLogEvent.fire(logEntry);if(this._firebugEnabled){this._printToFirebug(logEntry);}\r\r
+return true;}\r\r
+else{return false;}};YAHOO.widget.Logger.reset=function(){this._stack=[];this._startTime=new Date().getTime();this.loggerEnabled=true;this.log(null,"Logger reset");this.logResetEvent.fire();};YAHOO.widget.Logger.getStack=function(){return this._stack;};YAHOO.widget.Logger.getStartTime=function(){return this._startTime;};YAHOO.widget.Logger.disableFirebug=function(){YAHOO.log("YAHOO.Logger output to Firebug has been disabled.");this._firebugEnabled=false;};YAHOO.widget.Logger.enableFirebug=function(){this._firebugEnabled=true;YAHOO.log("YAHOO.Logger output to Firebug has been enabled.");};YAHOO.widget.Logger._createNewCategory=function(category){this.categories.push(category);this.categoryCreateEvent.fire(category);};YAHOO.widget.Logger._isNewCategory=function(category){for(var i=0;i<this.categories.length;i++){if(category==this.categories[i]){return false;}}\r\r
+return true;};YAHOO.widget.Logger._createNewSource=function(source){this.sources.push(source);this.sourceCreateEvent.fire(source);};YAHOO.widget.Logger._isNewSource=function(source){if(source){for(var i=0;i<this.sources.length;i++){if(source==this.sources[i]){return false;}}\r\r
+return true;}};YAHOO.widget.Logger._printToFirebug=function(entry){if(window.console&&console.log){var category=entry.category;var label=entry.category.substring(0,4).toUpperCase();var time=entry.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}\r\r
+else{localTime=time.toString();}\r\r
+var msecs=time.getTime();var elapsedTime=(YAHOO.widget.Logger._lastTime)?(msecs-YAHOO.widget.Logger._lastTime):0;YAHOO.widget.Logger._lastTime=msecs;var output=localTime+" ("+\r\r
+elapsedTime+"ms): "+\r\r
+entry.source+": "+\r\r
+entry.msg;console.log(output);}};YAHOO.widget.Logger._onWindowError=function(msg,url,line){try{YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')',"window");if(YAHOO.widget.Logger._origOnWindowError){YAHOO.widget.Logger._origOnWindowError();}}\r\r
+catch(e){return false;}};if(window.onerror){YAHOO.widget.Logger._origOnWindowError=window.onerror;}\r\r
+window.onerror=YAHOO.widget.Logger._onWindowError;YAHOO.widget.Logger.log("Logger initialized");YAHOO.widget.LogWriter=function(sSource){if(!sSource){YAHOO.log("Could not instantiate LogWriter due to invalid source.","error","LogWriter");return;}\r\r
+this._source=sSource;};YAHOO.widget.LogWriter.prototype.toString=function(){return"LogWriter "+this._sSource;};YAHOO.widget.LogWriter.prototype.log=function(sMsg,sCategory){YAHOO.widget.Logger.log(sMsg,sCategory,this._source);};YAHOO.widget.LogWriter.prototype.getSource=function(){return this._sSource;};YAHOO.widget.LogWriter.prototype.setSource=function(sSource){if(!sSource){YAHOO.log("Could not set source due to invalid source.","error",this.toString());return;}\r\r
+else{this._sSource=sSource;}};YAHOO.widget.LogWriter.prototype._source=null;YAHOO.widget.LogReader=function(containerEl,oConfig){var oSelf=this;if(typeof oConfig=="object"){for(var param in oConfig){this[param]=oConfig[param];}}\r\r
+if(containerEl){if(typeof containerEl=="string"){this._containerEl=document.getElementById(containerEl);}\r\r
+else if(containerEl.tagName){this._containerEl=containerEl;}\r\r
+this._containerEl.className="yui-log";}\r\r
+if(!this._containerEl){if(YAHOO.widget.LogReader._defaultContainerEl){this._containerEl=YAHOO.widget.LogReader._defaultContainerEl;}\r\r
+else{this._containerEl=document.body.appendChild(document.createElement("div"));this._containerEl.id="yui-log";this._containerEl.className="yui-log";YAHOO.widget.LogReader._defaultContainerEl=this._containerEl;}\r\r
+var containerStyle=this._containerEl.style;if(this.width){containerStyle.width=this.width;}\r\r
+if(this.left){containerStyle.left=this.left;}\r\r
+if(this.right){containerStyle.right=this.right;}\r\r
+if(this.bottom){containerStyle.bottom=this.bottom;}\r\r
+if(this.top){containerStyle.top=this.top;}\r\r
+if(this.fontSize){containerStyle.fontSize=this.fontSize;}}\r\r
+if(this._containerEl){if(!this._hdEl){this._hdEl=this._containerEl.appendChild(document.createElement("div"));this._hdEl.id="yui-log-hd"+YAHOO.widget.LogReader._index;this._hdEl.className="yui-log-hd";this._collapseEl=this._hdEl.appendChild(document.createElement("div"));this._collapseEl.className="yui-log-btns";this._collapseBtn=document.createElement("input");this._collapseBtn.type="button";this._collapseBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._collapseBtn.className="yui-log-button";this._collapseBtn.value="Collapse";this._collapseBtn=this._collapseEl.appendChild(this._collapseBtn);YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);this._title=this._hdEl.appendChild(document.createElement("h4"));this._title.innerHTML="Logger Console";if(YAHOO.util.DD&&(YAHOO.widget.LogReader._defaultContainerEl==this._containerEl)){var ylog_dd=new YAHOO.util.DD(this._containerEl.id);ylog_dd.setHandleElId(this._hdEl.id);this._hdEl.style.cursor="move";}}\r\r
+if(!this._consoleEl){this._consoleEl=this._containerEl.appendChild(document.createElement("div"));this._consoleEl.className="yui-log-bd";if(this.height){this._consoleEl.style.height=this.height;}}\r\r
+if(!this._ftEl&&this.footerEnabled){this._ftEl=this._containerEl.appendChild(document.createElement("div"));this._ftEl.className="yui-log-ft";this._btnsEl=this._ftEl.appendChild(document.createElement("div"));this._btnsEl.className="yui-log-btns";this._pauseBtn=document.createElement("input");this._pauseBtn.type="button";this._pauseBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._pauseBtn.className="yui-log-button";this._pauseBtn.value="Pause";this._pauseBtn=this._btnsEl.appendChild(this._pauseBtn);YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);this._clearBtn=document.createElement("input");this._clearBtn.type="button";this._clearBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._clearBtn.className="yui-log-button";this._clearBtn.value="Clear";this._clearBtn=this._btnsEl.appendChild(this._clearBtn);YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);this._categoryFiltersEl=this._ftEl.appendChild(document.createElement("div"));this._categoryFiltersEl.className="yui-log-categoryfilters";this._sourceFiltersEl=this._ftEl.appendChild(document.createElement("div"));this._sourceFiltersEl.className="yui-log-sourcefilters";}}\r\r
+if(!this._buffer){this._buffer=[];}\r\r
+YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog,this);this._lastTime=YAHOO.widget.Logger.getStartTime();this._categoryFilters=[];var catsLen=YAHOO.widget.Logger.categories.length;if(this._categoryFiltersEl){for(var i=0;i<catsLen;i++){this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);}}\r\r
+this._sourceFilters=[];var sourcesLen=YAHOO.widget.Logger.sources.length;if(this._sourceFiltersEl){for(var j=0;j<sourcesLen;j++){this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);}}\r\r
+YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate,this);YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate,this);YAHOO.widget.LogReader._index++;this._filterLogs();};YAHOO.widget.LogReader.prototype.logReaderEnabled=true;YAHOO.widget.LogReader.prototype.width=null;YAHOO.widget.LogReader.prototype.height=null;YAHOO.widget.LogReader.prototype.top=null;YAHOO.widget.LogReader.prototype.left=null;YAHOO.widget.LogReader.prototype.right=null;YAHOO.widget.LogReader.prototype.bottom=null;YAHOO.widget.LogReader.prototype.fontSize=null;YAHOO.widget.LogReader.prototype.footerEnabled=true;YAHOO.widget.LogReader.prototype.verboseOutput=true;YAHOO.widget.LogReader.prototype.newestOnTop=true;YAHOO.widget.LogReader.prototype.pause=function(){this._timeout=null;this.logReaderEnabled=false;};YAHOO.widget.LogReader.prototype.resume=function(){this.logReaderEnabled=true;this._printBuffer();};YAHOO.widget.LogReader.prototype.hide=function(){this._containerEl.style.display="none";};YAHOO.widget.LogReader.prototype.show=function(){this._containerEl.style.display="block";};YAHOO.widget.LogReader.prototype.setTitle=function(sTitle){var regEx=/>/g;sTitle=sTitle.replace(regEx,"&gt;");regEx=/</g;sTitle=sTitle.replace(regEx,"&lt;");this._title.innerHTML=(sTitle);};YAHOO.widget.LogReader._index=0;YAHOO.widget.LogReader._defaultContainerEl=null;YAHOO.widget.LogReader.prototype._buffer=null;YAHOO.widget.LogReader.prototype._lastTime=null;YAHOO.widget.LogReader.prototype._timeout=null;YAHOO.widget.LogReader.prototype._categoryFilters=null;YAHOO.widget.LogReader.prototype._sourceFilters=null;YAHOO.widget.LogReader.prototype._containerEl=null;YAHOO.widget.LogReader.prototype._hdEl=null;YAHOO.widget.LogReader.prototype._collapseEl=null;YAHOO.widget.LogReader.prototype._collapseBtn=null;YAHOO.widget.LogReader.prototype._title=null;YAHOO.widget.LogReader.prototype._consoleEl=null;YAHOO.widget.LogReader.prototype._ftEl=null;YAHOO.widget.LogReader.prototype._btnsEl=null;YAHOO.widget.LogReader.prototype._categoryFiltersEl=null;YAHOO.widget.LogReader.prototype._sourceFiltersEl=null;YAHOO.widget.LogReader.prototype._pauseBtn=null;YAHOO.widget.LogReader.prototype._clearBtn=null;YAHOO.widget.LogReader.prototype._createCategoryCheckbox=function(category){var oSelf=this;if(this._ftEl){var parentEl=this._categoryFiltersEl;var filters=this._categoryFilters;var filterEl=parentEl.appendChild(document.createElement("span"));filterEl.className="yui-log-filtergrp";var categoryChk=document.createElement("input");categoryChk.id="yui-log-filter-"+category+YAHOO.widget.LogReader._index;categoryChk.className="yui-log-filter-"+category;categoryChk.type="checkbox";categoryChk.category=category;categoryChk=filterEl.appendChild(categoryChk);categoryChk.checked=true;filters.push(category);YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);var categoryChkLbl=filterEl.appendChild(document.createElement("label"));categoryChkLbl.htmlFor=categoryChk.id;categoryChkLbl.className=category;categoryChkLbl.innerHTML=category;}};YAHOO.widget.LogReader.prototype._createSourceCheckbox=function(source){var oSelf=this;if(this._ftEl){var parentEl=this._sourceFiltersEl;var filters=this._sourceFilters;var filterEl=parentEl.appendChild(document.createElement("span"));filterEl.className="yui-log-filtergrp";var sourceChk=document.createElement("input");sourceChk.id="yui-log-filter"+source+YAHOO.widget.LogReader._index;sourceChk.className="yui-log-filter"+source;sourceChk.type="checkbox";sourceChk.source=source;sourceChk=filterEl.appendChild(sourceChk);sourceChk.checked=true;filters.push(source);YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);var sourceChkLbl=filterEl.appendChild(document.createElement("label"));sourceChkLbl.htmlFor=sourceChk.id;sourceChkLbl.className=source;sourceChkLbl.innerHTML=source;}};YAHOO.widget.LogReader.prototype._filterLogs=function(){if(this._consoleEl!==null){this._clearConsole();this._printToConsole(YAHOO.widget.Logger.getStack());}};YAHOO.widget.LogReader.prototype._clearConsole=function(){this._timeout=null;this._buffer=[];this._lastTime=YAHOO.widget.Logger.getStartTime();var consoleEl=this._consoleEl;while(consoleEl.hasChildNodes()){consoleEl.removeChild(consoleEl.firstChild);}};YAHOO.widget.LogReader.prototype._printBuffer=function(){this._timeout=null;if(this._consoleEl!==null){var entries=[];for(var i=0;i<this._buffer.length;i++){entries[i]=this._buffer[i];}\r\r
+this._buffer=[];this._printToConsole(entries);if(!this.newestOnTop){this._consoleEl.scrollTop=this._consoleEl.scrollHeight;}}};YAHOO.widget.LogReader.prototype._printToConsole=function(aEntries){var entriesLen=aEntries.length;var sourceFiltersLen=this._sourceFilters.length;var categoryFiltersLen=this._categoryFilters.length;for(var i=0;i<entriesLen;i++){var entry=aEntries[i];var category=entry.category;var source=entry.source;var sourceDetail=entry.sourceDetail;var okToPrint=false;var okToFilterCats=false;for(var j=0;j<sourceFiltersLen;j++){if(source==this._sourceFilters[j]){okToFilterCats=true;break;}}\r\r
+if(okToFilterCats){for(var k=0;k<categoryFiltersLen;k++){if(category==this._categoryFilters[k]){okToPrint=true;break;}}}\r\r
+if(okToPrint){var label=entry.category.substring(0,4).toUpperCase();var time=entry.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}\r\r
+else{localTime=time.toString();}\r\r
+var msecs=time.getTime();var startTime=YAHOO.widget.Logger.getStartTime();var totalTime=msecs-startTime;var elapsedTime=msecs-this._lastTime;this._lastTime=msecs;var verboseOutput=(this.verboseOutput)?"<br>":"";var sourceAndDetail=(sourceDetail)?source+" "+sourceDetail:source;var output="<span class='"+category+"'>"+label+"</span> "+\r\r
+totalTime+"ms (+"+\r\r
+elapsedTime+") "+localTime+": "+\r\r
+sourceAndDetail+": "+\r\r
+verboseOutput+\r\r
+entry.msg;var oNewElement=(this.newestOnTop)?this._consoleEl.insertBefore(document.createElement("p"),this._consoleEl.firstChild):this._consoleEl.appendChild(document.createElement("p"));oNewElement.innerHTML=output;}}};YAHOO.widget.LogReader.prototype._onCategoryCreate=function(type,args,oSelf){var category=args[0];if(oSelf._ftEl){oSelf._createCategoryCheckbox(category);}};YAHOO.widget.LogReader.prototype._onSourceCreate=function(type,args,oSelf){var source=args[0];if(oSelf._ftEl){oSelf._createSourceCheckbox(source);}};YAHOO.widget.LogReader.prototype._onCheckCategory=function(v,oSelf){var newFilter=this.category;var filtersArray=oSelf._categoryFilters;if(!this.checked){for(var i=0;i<filtersArray.length;i++){if(newFilter==filtersArray[i]){filtersArray.splice(i,1);break;}}}\r\r
+else{filtersArray.push(newFilter);}\r\r
+oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onCheckSource=function(v,oSelf){var newFilter=this.source;var filtersArray=oSelf._sourceFilters;if(!this.checked){for(var i=0;i<filtersArray.length;i++){if(newFilter==filtersArray[i]){filtersArray.splice(i,1);break;}}}\r\r
+else{filtersArray.push(newFilter);}\r\r
+oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onClickCollapseBtn=function(v,oSelf){var btn=oSelf._collapseBtn;if(btn.value=="Expand"){oSelf._consoleEl.style.display="block";if(oSelf._ftEl){oSelf._ftEl.style.display="block";}\r\r
+btn.value="Collapse";}\r\r
+else{oSelf._consoleEl.style.display="none";if(oSelf._ftEl){oSelf._ftEl.style.display="none";}\r\r
+btn.value="Expand";}};YAHOO.widget.LogReader.prototype._onClickPauseBtn=function(v,oSelf){var btn=oSelf._pauseBtn;if(btn.value=="Resume"){oSelf.resume();btn.value="Pause";}\r\r
+else{oSelf.pause();btn.value="Resume";}};YAHOO.widget.LogReader.prototype._onClickClearBtn=function(v,oSelf){oSelf._clearConsole();};YAHOO.widget.LogReader.prototype._onNewLog=function(type,args,oSelf){var logEntry=args[0];oSelf._buffer.push(logEntry);if(oSelf.logReaderEnabled===true&&oSelf._timeout===null){oSelf._timeout=setTimeout(function(){oSelf._printBuffer();},100);}};
\ No newline at end of file
diff --git a/lib/yui/logger/logger.js b/lib/yui/logger/logger.js
new file mode 100755 (executable)
index 0000000..bbd42f5
--- /dev/null
@@ -0,0 +1,1186 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/**\r\r
+ * Singleton providing core logging functionality. Saves logs written through the\r\r
+ * global YAHOO.log function or written by LogWriter. Provides access to logs\r\r
+ * for reading by LogReader. Log messages are automatically output to Firebug,\r\r
+ * if present.\r\r
+ *\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ */\r\r
+YAHOO.widget.Logger = {\r\r
+    // Initialize members\r\r
+    loggerEnabled: true,\r\r
+    _firebugEnabled: true,\r\r
+    categories: ["info","warn","error","time","window"],\r\r
+    sources: ["global"],\r\r
+    _stack: [], // holds all log msgs\r\r
+    _startTime: new Date().getTime(), // static start timestamp\r\r
+    _lastTime: null // timestamp of last logged message\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Events\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Fired when a new category has been created. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The category name\r\r
+ */\r\r
+YAHOO.widget.Logger.categoryCreateEvent = new YAHOO.util.CustomEvent("categoryCreate", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when a new source has been named. Subscribers receive the following\r\r
+ * array:<br>\r\r
+ *     - args[0] The source name\r\r
+ */\r\r
+YAHOO.widget.Logger.sourceCreateEvent = new YAHOO.util.CustomEvent("sourceCreate", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when a new log message has been created. Subscribers receive the\r\r
+ * following array:<br>\r\r
+ *     - args[0] The log message\r\r
+ */\r\r
+YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this, true);\r\r
+\r\r
+/**\r\r
+ * Fired when the Logger has been reset has been created.\r\r
+ */\r\r
+YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset", this, true);\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Saves a log message to the stack and fires newLogEvent. If the log message is\r\r
+ * assigned to an unknown category, creates a new category. If the log message is\r\r
+ * from an unknown source, creates a new source.  If Firebug is enabled,\r\r
+ * outputs the log message to Firebug.\r\r
+ *\r\r
+ * @param {string} sMsg The log message\r\r
+ * @param {string} sCategory Category of log message, or null\r\r
+ * @param {string} sSource Source of LogWriter, or null if global\r\r
+ */\r\r
+YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {\r\r
+    if(this.loggerEnabled) {\r\r
+        if(!sCategory) {\r\r
+            sCategory = "info"; // default category\r\r
+        }\r\r
+        else if(this._isNewCategory(sCategory)) {\r\r
+            this._createNewCategory(sCategory);\r\r
+        }\r\r
+        var sClass = "global"; // default source\r\r
+        var sDetail = null;\r\r
+        if(sSource) {\r\r
+            var spaceIndex = sSource.indexOf(" ");\r\r
+            if(spaceIndex > 0) {\r\r
+                sClass = sSource.substring(0,spaceIndex);// substring until first space\r\r
+                sDetail = sSource.substring(spaceIndex,sSource.length);// the rest of the source\r\r
+            }\r\r
+            else {\r\r
+                sClass = sSource;\r\r
+            }\r\r
+            if(this._isNewSource(sClass)) {\r\r
+                this._createNewSource(sClass);\r\r
+            }\r\r
+        }\r\r
+\r\r
+        var timestamp = new Date();\r\r
+        var logEntry = {\r\r
+            time: timestamp,\r\r
+            category: sCategory,\r\r
+            source: sClass,\r\r
+            sourceDetail: sDetail,\r\r
+            msg: sMsg\r\r
+        };\r\r
+\r\r
+        this._stack.push(logEntry);\r\r
+        this.newLogEvent.fire(logEntry);\r\r
+\r\r
+        if(this._firebugEnabled) {\r\r
+            this._printToFirebug(logEntry);\r\r
+        }\r\r
+        return true;\r\r
+    }\r\r
+    else {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Resets internal stack and startTime, enables Logger, and fires logResetEvent.\r\r
+ *\r\r
+ */\r\r
+YAHOO.widget.Logger.reset = function() {\r\r
+    this._stack = [];\r\r
+    this._startTime = new Date().getTime();\r\r
+    this.loggerEnabled = true;\r\r
+    this.log(null, "Logger reset");\r\r
+    this.logResetEvent.fire();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to internal stack of log messages.\r\r
+ *\r\r
+ * @return {array} Array of log messages.\r\r
+ */\r\r
+YAHOO.widget.Logger.getStack = function() {\r\r
+    return this._stack;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to internal start time.\r\r
+ *\r\r
+ * @return {date} Internal date of when Logger singleton was initialized.\r\r
+ */\r\r
+YAHOO.widget.Logger.getStartTime = function() {\r\r
+    return this._startTime;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Disables output to the Firebug Firefox extension.\r\r
+ */\r\r
+YAHOO.widget.Logger.disableFirebug = function() {\r\r
+    YAHOO.log("YAHOO.Logger output to Firebug has been disabled.");\r\r
+    this._firebugEnabled = false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Enables output to the Firebug Firefox extension.\r\r
+ */\r\r
+YAHOO.widget.Logger.enableFirebug = function() {\r\r
+    this._firebugEnabled = true;\r\r
+    YAHOO.log("YAHOO.Logger output to Firebug has been enabled.");\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Creates a new category of log messages and fires categoryCreateEvent.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._createNewCategory = function(category) {\r\r
+    this.categories.push(category);\r\r
+    this.categoryCreateEvent.fire(category);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Checks to see if a category has already been created.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @return {boolean} Returns true if category is unknown, else returns false\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._isNewCategory = function(category) {\r\r
+    for(var i=0; i < this.categories.length; i++) {\r\r
+        if(category == this.categories[i]) {\r\r
+            return false;\r\r
+        }\r\r
+    }\r\r
+    return true;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Creates a new source of log messages and fires sourceCreateEvent.\r\r
+ *\r\r
+ * @param {string} source Source name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._createNewSource = function(source) {\r\r
+    this.sources.push(source);\r\r
+    this.sourceCreateEvent.fire(source);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Checks to see if a source has already been created.\r\r
+ *\r\r
+ * @param {string} source Source name\r\r
+ * @return {boolean} Returns true if source is unknown, else returns false\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._isNewSource = function(source) {\r\r
+    if(source) {\r\r
+        for(var i=0; i < this.sources.length; i++) {\r\r
+            if(source == this.sources[i]) {\r\r
+                return false;\r\r
+            }\r\r
+        }\r\r
+        return true;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Outputs a log message to Firebug.\r\r
+ *\r\r
+ * @param {object} entry Log entry object\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._printToFirebug = function(entry) {\r\r
+    if(window.console && console.log) {\r\r
+        var category = entry.category;\r\r
+        var label = entry.category.substring(0,4).toUpperCase();\r\r
+\r\r
+        var time = entry.time;\r\r
+        if (time.toLocaleTimeString) {\r\r
+            var localTime  = time.toLocaleTimeString();\r\r
+        }\r\r
+        else {\r\r
+            localTime = time.toString();\r\r
+        }\r\r
+\r\r
+        var msecs = time.getTime();\r\r
+        var elapsedTime = (YAHOO.widget.Logger._lastTime) ?\r\r
+            (msecs - YAHOO.widget.Logger._lastTime) : 0;\r\r
+        YAHOO.widget.Logger._lastTime = msecs;\r\r
+\r\r
+        var output = //Firebug doesn't support HTML "<span class='"+category+"'>"+label+"</span> " +\r\r
+            localTime + " (" +\r\r
+            elapsedTime + "ms): " +\r\r
+            entry.source + ": " +\r\r
+            entry.msg;\r\r
+\r\r
+        \r\r
+        console.log(output);\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private event handlers\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Handles logging of messages due to window error events.\r\r
+ *\r\r
+ * @param {string} msg The error message\r\r
+ * @param {string} url URL of the error\r\r
+ * @param {string} line Line number of the error\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.Logger._onWindowError = function(msg,url,line) {\r\r
+    // Logger is not in scope of this event handler\r\r
+    try {\r\r
+        YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')', "window");\r\r
+        if(YAHOO.widget.Logger._origOnWindowError) {\r\r
+            YAHOO.widget.Logger._origOnWindowError();\r\r
+        }\r\r
+    }\r\r
+    catch(e) {\r\r
+        return false;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handle native JavaScript errors\r\r
+ */\r\r
+//NB: Not all browsers support the window.onerror event\r\r
+if(window.onerror) {\r\r
+    // Save any previously defined handler to call\r\r
+    YAHOO.widget.Logger._origOnWindowError = window.onerror;\r\r
+}\r\r
+window.onerror = YAHOO.widget.Logger._onWindowError;\r\r
+\r\r
+/**\r\r
+ * First log\r\r
+ */\r\r
+YAHOO.widget.Logger.log("Logger initialized");\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/**\r\r
+ * Class providing ability to log messages through YAHOO.widget.Logger from a\r\r
+ * named source.\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {string} sSource Source of LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter = function(sSource) {\r\r
+    if(!sSource) {\r\r
+        YAHOO.log("Could not instantiate LogWriter due to invalid source.", "error", "LogWriter");\r\r
+        return;\r\r
+    }\r\r
+    this._source = sSource;\r\r
+ };\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+ /**\r\r
+ * Public accessor to the unique name of the LogWriter instance.\r\r
+ *\r\r
+ * @return {string} Unique name of the LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.toString = function() {\r\r
+    return "LogWriter " + this._sSource;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Logs a message attached to the source of the LogWriter.\r\r
+ *\r\r
+ * @param {string} sMsg The log message\r\r
+ * @param {string} sCategory Category name\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {\r\r
+    YAHOO.widget.Logger.log(sMsg, sCategory, this._source);\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to get the source name.\r\r
+ *\r\r
+ * @return {string} The LogWriter source\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.getSource = function() {\r\r
+    return this._sSource;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Public accessor to set the source name.\r\r
+ *\r\r
+ * @param {string} sSource Source of LogWriter instance\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype.setSource = function(sSource) {\r\r
+    if(!sSource) {\r\r
+        YAHOO.log("Could not set source due to invalid source.", "error", this.toString());\r\r
+        return;\r\r
+    }\r\r
+    else {\r\r
+        this._sSource = sSource;\r\r
+    }\r\r
+};\r\r
+/***************************************************************************\r\r
+ * Private members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Source of the log writer instance.\r\r
+ *\r\r
+ * @type string\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogWriter.prototype._source = null;\r\r
+\r\r
+\r\r
+\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+/****************************************************************************/\r\r
+\r\r
+/**\r\r
+ * Class providing UI to read messages logged to YAHOO.widget.Logger.\r\r
+ *\r\r
+ * requires YAHOO.util.Dom DOM utility\r\r
+ * requires YAHOO.util.Event Event utility\r\r
+ * optional YAHOO.util.DragDrop Drag and drop utility\r\r
+ *\r\r
+ * @constructor\r\r
+ * @param {el or ID} containerEl DOM element object or ID of container to wrap reader UI\r\r
+ * @param {object} oConfig Optional object literal of configuration params\r\r
+ */\r\r
+YAHOO.widget.LogReader = function(containerEl, oConfig) {\r\r
+    var oSelf = this;\r\r
+\r\r
+    // Parse config vars here\r\r
+    if (typeof oConfig == "object") {\r\r
+        for(var param in oConfig) {\r\r
+            this[param] = oConfig[param];\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Attach container...\r\r
+    if(containerEl) {\r\r
+        if(typeof containerEl == "string") {\r\r
+            this._containerEl = document.getElementById(containerEl);\r\r
+        }\r\r
+        else if(containerEl.tagName) {\r\r
+            this._containerEl = containerEl;\r\r
+        }\r\r
+        this._containerEl.className = "yui-log";\r\r
+    }\r\r
+    // ...or create container from scratch\r\r
+    if(!this._containerEl) {\r\r
+        if(YAHOO.widget.LogReader._defaultContainerEl) {\r\r
+            this._containerEl =  YAHOO.widget.LogReader._defaultContainerEl;\r\r
+        }\r\r
+        else {\r\r
+            this._containerEl = document.body.appendChild(document.createElement("div"));\r\r
+            this._containerEl.id = "yui-log";\r\r
+            this._containerEl.className = "yui-log";\r\r
+\r\r
+            YAHOO.widget.LogReader._defaultContainerEl = this._containerEl;\r\r
+        }\r\r
+\r\r
+        // If implementer has provided container values, trust and set those\r\r
+        var containerStyle = this._containerEl.style;\r\r
+        if(this.width) {\r\r
+            containerStyle.width = this.width;\r\r
+        }\r\r
+        if(this.left) {\r\r
+            containerStyle.left = this.left;\r\r
+        }\r\r
+        if(this.right) {\r\r
+            containerStyle.right = this.right;\r\r
+        }\r\r
+        if(this.bottom) {\r\r
+            containerStyle.bottom = this.bottom;\r\r
+        }\r\r
+        if(this.top) {\r\r
+            containerStyle.top = this.top;\r\r
+        }\r\r
+        if(this.fontSize) {\r\r
+            containerStyle.fontSize = this.fontSize;\r\r
+        }\r\r
+    }\r\r
+\r\r
+    if(this._containerEl) {\r\r
+        // Create header\r\r
+        if(!this._hdEl) {\r\r
+            this._hdEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._hdEl.id = "yui-log-hd" + YAHOO.widget.LogReader._index;\r\r
+            this._hdEl.className = "yui-log-hd";\r\r
+\r\r
+            this._collapseEl = this._hdEl.appendChild(document.createElement("div"));\r\r
+            this._collapseEl.className = "yui-log-btns";\r\r
+\r\r
+            this._collapseBtn = document.createElement("input");\r\r
+            this._collapseBtn.type = "button";\r\r
+            this._collapseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._collapseBtn.className = "yui-log-button";\r\r
+            this._collapseBtn.value = "Collapse";\r\r
+            this._collapseBtn = this._collapseEl.appendChild(this._collapseBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);\r\r
+\r\r
+            this._title = this._hdEl.appendChild(document.createElement("h4"));\r\r
+            this._title.innerHTML = "Logger Console";\r\r
+\r\r
+            // If Drag and Drop utility is available...\r\r
+            // ...and this container was created from scratch...\r\r
+            // ...then make the header draggable\r\r
+            if(YAHOO.util.DD &&\r\r
+            (YAHOO.widget.LogReader._defaultContainerEl == this._containerEl)) {\r\r
+                var ylog_dd = new YAHOO.util.DD(this._containerEl.id);\r\r
+                ylog_dd.setHandleElId(this._hdEl.id);\r\r
+                this._hdEl.style.cursor = "move";\r\r
+            }\r\r
+        }\r\r
+        // Ceate console\r\r
+        if(!this._consoleEl) {\r\r
+            this._consoleEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._consoleEl.className = "yui-log-bd";\r\r
+            \r\r
+            // If implementer has provided console, trust and set those\r\r
+            if(this.height) {\r\r
+                this._consoleEl.style.height = this.height;\r\r
+            }\r\r
+        }\r\r
+        // Don't create footer if disabled\r\r
+        if(!this._ftEl && this.footerEnabled) {\r\r
+            this._ftEl = this._containerEl.appendChild(document.createElement("div"));\r\r
+            this._ftEl.className = "yui-log-ft";\r\r
+\r\r
+            this._btnsEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._btnsEl.className = "yui-log-btns";\r\r
+\r\r
+            this._pauseBtn = document.createElement("input");\r\r
+            this._pauseBtn.type = "button";\r\r
+            this._pauseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._pauseBtn.className = "yui-log-button";\r\r
+            this._pauseBtn.value = "Pause";\r\r
+            this._pauseBtn = this._btnsEl.appendChild(this._pauseBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);\r\r
+\r\r
+            this._clearBtn = document.createElement("input");\r\r
+            this._clearBtn.type = "button";\r\r
+            this._clearBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");\r\r
+            this._clearBtn.className = "yui-log-button";\r\r
+            this._clearBtn.value = "Clear";\r\r
+            this._clearBtn = this._btnsEl.appendChild(this._clearBtn);\r\r
+            YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);\r\r
+\r\r
+            this._categoryFiltersEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._categoryFiltersEl.className = "yui-log-categoryfilters";\r\r
+            this._sourceFiltersEl = this._ftEl.appendChild(document.createElement("div"));\r\r
+            this._sourceFiltersEl.className = "yui-log-sourcefilters";\r\r
+        }\r\r
+    }\r\r
+\r\r
+    // Initialize buffer\r\r
+    if(!this._buffer) {\r\r
+        this._buffer = []; // output buffer\r\r
+    }\r\r
+    YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);\r\r
+    this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last log message to console\r\r
+\r\r
+    // Initialize category filters\r\r
+    this._categoryFilters = [];\r\r
+    var catsLen = YAHOO.widget.Logger.categories.length;\r\r
+    if(this._categoryFiltersEl) {\r\r
+        for(var i=0; i < catsLen; i++) {\r\r
+            this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);\r\r
+        }\r\r
+    }\r\r
+    // Initialize source filters\r\r
+    this._sourceFilters = [];\r\r
+    var sourcesLen = YAHOO.widget.Logger.sources.length;\r\r
+    if(this._sourceFiltersEl) {\r\r
+        for(var j=0; j < sourcesLen; j++) {\r\r
+            this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);\r\r
+        }\r\r
+    }\r\r
+    YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate, this);\r\r
+    YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate, this);\r\r
+\r\r
+    YAHOO.widget.LogReader._index++;\r\r
+    this._filterLogs();\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Whether or not the log reader is enabled to output log messages. Default:\r\r
+ * true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS width of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.width = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS height of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.height = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS top position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.top = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS left position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.left = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS right position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.right = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS bottom position of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.bottom = null;\r\r
+\r\r
+/**\r\r
+ * Public member to access CSS font size of the log reader container.\r\r
+ *\r\r
+ * @type string\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.fontSize = null;\r\r
+\r\r
+/**\r\r
+ * Whether or not the footer UI is enabled for the log reader. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.footerEnabled = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not output is verbose (more readable). Setting to true will make\r\r
+ * output more compact (less readable). Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.verboseOutput = true;\r\r
+\r\r
+/**\r\r
+ * Whether or not newest message is printed on top. Default: true.\r\r
+ *\r\r
+ * @type boolean\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.newestOnTop = true;\r\r
+\r\r
+/***************************************************************************\r\r
+ * Public methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Pauses output of log messages. While paused, log messages are not lost, but\r\r
+ * get saved to a buffer and then output upon resume of log reader.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.pause = function() {\r\r
+    this._timeout = null;\r\r
+    this.logReaderEnabled = false;\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Resumes output of log messages, including outputting any log messages that\r\r
+ * have been saved to buffer while paused.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.resume = function() {\r\r
+    this.logReaderEnabled = true;\r\r
+    this._printBuffer();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Hides UI of log reader. Logging functionality is not disrupted.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.hide = function() {\r\r
+    this._containerEl.style.display = "none";\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Shows UI of log reader. Logging functionality is not disrupted.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.show = function() {\r\r
+    this._containerEl.style.display = "block";\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Updates title to given string.\r\r
+ *\r\r
+ * @param {string} sTitle String to display in log reader's title bar.\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {\r\r
+    var regEx = />/g;\r\r
+    sTitle = sTitle.replace(regEx,"&gt;");\r\r
+    regEx = /</g;\r\r
+    sTitle = sTitle.replace(regEx,"&lt;");\r\r
+    this._title.innerHTML = (sTitle);\r\r
+};\r\r
+ /***************************************************************************\r\r
+ * Private members\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Internal class member to index multiple log reader instances.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader._index = 0;\r\r
+\r\r
+/**\r\r
+ * A class member shared by all log readers if a container needs to be\r\r
+ * created during instantiation. Will be null if a container element never needs to\r\r
+ * be created on the fly, such as when the implementer passes in their own element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader._defaultContainerEl = null;\r\r
+\r\r
+/**\r\r
+ * Buffer of log messages for batch output.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._buffer = null;\r\r
+\r\r
+/**\r\r
+ * Date of last output log message.\r\r
+ *\r\r
+ * @type date\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._lastTime = null;\r\r
+\r\r
+/**\r\r
+ * Batched output timeout ID.\r\r
+ *\r\r
+ * @type number\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._timeout = null;\r\r
+\r\r
+/**\r\r
+ * Array of filters for log message categories.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._categoryFilters = null;\r\r
+\r\r
+/**\r\r
+ * Array of filters for log message sources.\r\r
+ *\r\r
+ * @type array\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._sourceFilters = null;\r\r
+\r\r
+/**\r\r
+ * Log reader container element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._containerEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader header element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._hdEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader collapse element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._collapseEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader collapse button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._collapseBtn = null;\r\r
+\r\r
+/**\r\r
+ * Log reader title header element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._title = null;\r\r
+\r\r
+/**\r\r
+ * Log reader console element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._consoleEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader footer element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._ftEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader buttons container element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._btnsEl = null;\r\r
+\r\r
+/**\r\r
+ * Container element for log reader category filter checkboxes.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._categoryFiltersEl = null;\r\r
+\r\r
+/**\r\r
+ * Container element for log reader source filter checkboxes.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._sourceFiltersEl = null;\r\r
+\r\r
+/**\r\r
+ * Log reader pause button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._pauseBtn = null;\r\r
+\r\r
+/**\r\r
+ * lear button element.\r\r
+ *\r\r
+ * @type HTMLElement\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._clearBtn = null;\r\r
+/***************************************************************************\r\r
+ * Private methods\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Creates the UI for a category filter in the log reader footer element.\r\r
+ *\r\r
+ * @param {string} category Category name\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(category) {\r\r
+    var oSelf = this;\r\r
+    \r\r
+    if(this._ftEl) {\r\r
+        var parentEl = this._categoryFiltersEl;\r\r
+        var filters = this._categoryFilters;\r\r
+\r\r
+        var filterEl = parentEl.appendChild(document.createElement("span"));\r\r
+        filterEl.className = "yui-log-filtergrp";\r\r
+            // Append el at the end so IE 5.5 can set "type" attribute\r\r
+            // and THEN set checked property\r\r
+            var categoryChk = document.createElement("input");\r\r
+            categoryChk.id = "yui-log-filter-" + category + YAHOO.widget.LogReader._index;\r\r
+            categoryChk.className = "yui-log-filter-" + category;\r\r
+            categoryChk.type = "checkbox";\r\r
+            categoryChk.category = category;\r\r
+            categoryChk = filterEl.appendChild(categoryChk);\r\r
+            categoryChk.checked = true;\r\r
+\r\r
+            // Add this checked filter to the internal array of filters\r\r
+            filters.push(category);\r\r
+            // Subscribe to the click event\r\r
+            YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);\r\r
+\r\r
+            // Create and class the text label\r\r
+            var categoryChkLbl = filterEl.appendChild(document.createElement("label"));\r\r
+            categoryChkLbl.htmlFor = categoryChk.id;\r\r
+            categoryChkLbl.className = category;\r\r
+            categoryChkLbl.innerHTML = category;\r\r
+    }\r\r
+};\r\r
+\r\r
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(source) {\r\r
+    var oSelf = this;\r\r
+\r\r
+    if(this._ftEl) {\r\r
+        var parentEl = this._sourceFiltersEl;\r\r
+        var filters = this._sourceFilters;\r\r
+\r\r
+        var filterEl = parentEl.appendChild(document.createElement("span"));\r\r
+        filterEl.className = "yui-log-filtergrp";\r\r
+\r\r
+        // Append el at the end so IE 5.5 can set "type" attribute\r\r
+        // and THEN set checked property\r\r
+        var sourceChk = document.createElement("input");\r\r
+        sourceChk.id = "yui-log-filter" + source + YAHOO.widget.LogReader._index;\r\r
+        sourceChk.className = "yui-log-filter" + source;\r\r
+        sourceChk.type = "checkbox";\r\r
+        sourceChk.source = source;\r\r
+        sourceChk = filterEl.appendChild(sourceChk);\r\r
+        sourceChk.checked = true;\r\r
+\r\r
+        // Add this checked filter to the internal array of filters\r\r
+        filters.push(source);\r\r
+        // Subscribe to the click event\r\r
+        YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);\r\r
+\r\r
+        // Create and class the text label\r\r
+        var sourceChkLbl = filterEl.appendChild(document.createElement("label"));\r\r
+        sourceChkLbl.htmlFor = sourceChk.id;\r\r
+        sourceChkLbl.className = source;\r\r
+        sourceChkLbl.innerHTML = source;\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Reprints all log messages in the stack through filters.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._filterLogs = function() {\r\r
+    // Reprint stack with new filters\r\r
+    if (this._consoleEl !== null) {\r\r
+        this._clearConsole();\r\r
+        this._printToConsole(YAHOO.widget.Logger.getStack());\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Clears all outputted log messages from the console and resets the time of the\r\r
+ * last output log message.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._clearConsole = function() {\r\r
+    // Clear the buffer of any pending messages\r\r
+    this._timeout = null;\r\r
+    this._buffer = [];\r\r
+\r\r
+    // Reset the rolling timer\r\r
+    this._lastTime = YAHOO.widget.Logger.getStartTime();\r\r
+\r\r
+    var consoleEl = this._consoleEl;\r\r
+    while(consoleEl.hasChildNodes()) {\r\r
+        consoleEl.removeChild(consoleEl.firstChild);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Sends buffer of log messages to output and clears buffer.\r\r
+ *\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._printBuffer = function() {\r\r
+    this._timeout = null;\r\r
+\r\r
+    if (this._consoleEl !== null) {\r\r
+        var entries = [];\r\r
+        for (var i=0; i<this._buffer.length; i++) {\r\r
+            entries[i] = this._buffer[i];\r\r
+        }\r\r
+        this._buffer = [];\r\r
+        this._printToConsole(entries);\r\r
+        if(!this.newestOnTop) {\r\r
+            this._consoleEl.scrollTop = this._consoleEl.scrollHeight;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Cycles through an array of log messages, and outputs each one to the console\r\r
+ * if its category has not been filtered out.\r\r
+ *\r\r
+ * @param {array} aEntries\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {\r\r
+    var entriesLen = aEntries.length;\r\r
+    var sourceFiltersLen = this._sourceFilters.length;\r\r
+    var categoryFiltersLen = this._categoryFilters.length;\r\r
+    // Iterate through all log entries to print the ones that filter through\r\r
+    for(var i=0; i<entriesLen; i++) {\r\r
+        var entry = aEntries[i];\r\r
+        var category = entry.category;\r\r
+        var source = entry.source;\r\r
+        var sourceDetail = entry.sourceDetail;\r\r
+        var okToPrint = false;\r\r
+        var okToFilterCats = false;\r\r
+\r\r
+        for(var j=0; j<sourceFiltersLen; j++) {\r\r
+            if(source == this._sourceFilters[j]) {\r\r
+                okToFilterCats = true;\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+        if(okToFilterCats) {\r\r
+            for(var k=0; k<categoryFiltersLen; k++) {\r\r
+                if(category == this._categoryFilters[k]) {\r\r
+                    okToPrint = true;\r\r
+                    break;\r\r
+                }\r\r
+            }\r\r
+        }\r\r
+        if(okToPrint) {\r\r
+            // To format for console, calculate the elapsed time\r\r
+            // to be from the last item that passed through the filter,\r\r
+            // not the absolute previous item in the stack\r\r
+            var label = entry.category.substring(0,4).toUpperCase();\r\r
+\r\r
+            var time = entry.time;\r\r
+            if (time.toLocaleTimeString) {\r\r
+                var localTime  = time.toLocaleTimeString();\r\r
+            }\r\r
+            else {\r\r
+                localTime = time.toString();\r\r
+            }\r\r
+\r\r
+            var msecs = time.getTime();\r\r
+            var startTime = YAHOO.widget.Logger.getStartTime();\r\r
+            var totalTime = msecs - startTime;\r\r
+            var elapsedTime = msecs - this._lastTime;\r\r
+            this._lastTime = msecs;\r\r
+            \r\r
+            var verboseOutput = (this.verboseOutput) ? "<br>" : "";\r\r
+            var sourceAndDetail = (sourceDetail) ?\r\r
+                source + " " + sourceDetail : source;\r\r
+\r\r
+            var output =  "<span class='"+category+"'>"+label+"</span> " +\r\r
+                totalTime + "ms (+" +\r\r
+                elapsedTime + ") " + localTime + ": " +\r\r
+                sourceAndDetail + ": " +\r\r
+                verboseOutput +\r\r
+                entry.msg;\r\r
+\r\r
+            var oNewElement = (this.newestOnTop) ?\r\r
+                this._consoleEl.insertBefore(document.createElement("p"),this._consoleEl.firstChild):\r\r
+                this._consoleEl.appendChild(document.createElement("p"));\r\r
+            oNewElement.innerHTML = output;\r\r
+        }\r\r
+    }\r\r
+};\r\r
+\r\r
+/***************************************************************************\r\r
+ * Private event handlers\r\r
+ ***************************************************************************/\r\r
+/**\r\r
+ * Handles Logger's categoryCreateEvent.\r\r
+ *\r\r
+ * @param {string} type The event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(type, args, oSelf) {\r\r
+    var category = args[0];\r\r
+    if(oSelf._ftEl) {\r\r
+        oSelf._createCategoryCheckbox(category);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles Logger's sourceCreateEvent.\r\r
+ *\r\r
+ * @param {string} type The event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(type, args, oSelf) {\r\r
+    var source = args[0];\r\r
+    if(oSelf._ftEl) {\r\r
+        oSelf._createSourceCheckbox(source);\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles check events on the category filter checkboxes.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {\r\r
+    var newFilter = this.category;\r\r
+    var filtersArray = oSelf._categoryFilters;\r\r
+\r\r
+    if(!this.checked) { // Remove category from filters\r\r
+        for(var i=0; i<filtersArray.length; i++) {\r\r
+            if(newFilter == filtersArray[i]) {\r\r
+                filtersArray.splice(i, 1);\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+    }\r\r
+    else { // Add category to filters\r\r
+        filtersArray.push(newFilter);\r\r
+    }\r\r
+    oSelf._filterLogs();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles check events on the category filter checkboxes.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {\r\r
+    var newFilter = this.source;\r\r
+    var filtersArray = oSelf._sourceFilters;\r\r
+    \r\r
+    if(!this.checked) { // Remove category from filters\r\r
+        for(var i=0; i<filtersArray.length; i++) {\r\r
+            if(newFilter == filtersArray[i]) {\r\r
+                filtersArray.splice(i, 1);\r\r
+                break;\r\r
+            }\r\r
+        }\r\r
+    }\r\r
+    else { // Add category to filters\r\r
+        filtersArray.push(newFilter);\r\r
+    }\r\r
+    oSelf._filterLogs();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the collapse button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {\r\r
+    var btn = oSelf._collapseBtn;\r\r
+    if(btn.value == "Expand") {\r\r
+        oSelf._consoleEl.style.display = "block";\r\r
+        if(oSelf._ftEl) {\r\r
+            oSelf._ftEl.style.display = "block";\r\r
+        }\r\r
+        btn.value = "Collapse";\r\r
+    }\r\r
+    else {\r\r
+        oSelf._consoleEl.style.display = "none";\r\r
+        if(oSelf._ftEl) {\r\r
+            oSelf._ftEl.style.display = "none";\r\r
+        }\r\r
+        btn.value = "Expand";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the pause button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {\r\r
+    var btn = oSelf._pauseBtn;\r\r
+    if(btn.value == "Resume") {\r\r
+        oSelf.resume();\r\r
+        btn.value = "Pause";\r\r
+    }\r\r
+    else {\r\r
+        oSelf.pause();\r\r
+        btn.value = "Resume";\r\r
+    }\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles click events on the clear button.\r\r
+ *\r\r
+ * @param {event} v The click event\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {\r\r
+    oSelf._clearConsole();\r\r
+};\r\r
+\r\r
+/**\r\r
+ * Handles Logger's onNewEvent.\r\r
+ *\r\r
+ * @param {string} type The click event\r\r
+ * @param {array} args Data passed from event firer\r\r
+ * @param {object} oSelf The log reader instance\r\r
+ * @private\r\r
+ */\r\r
+YAHOO.widget.LogReader.prototype._onNewLog = function(type, args, oSelf) {\r\r
+    var logEntry = args[0];\r\r
+    oSelf._buffer.push(logEntry);\r\r
+\r\r
+    if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {\r\r
+        oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, 100);\r\r
+    }\r\r
+};\r\r
+\r\r
+\r\r
diff --git a/lib/yui/menu/README b/lib/yui/menu/README
new file mode 100755 (executable)
index 0000000..846ae95
--- /dev/null
@@ -0,0 +1,82 @@
+Menu Release Notes\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Initial release\r
+\r
+* Known issues:\r
+\r
+      * Some Firefox extensions disable the ability for JavaScript to prevent  \r
+        the display of the browser's default context menu.  These extensions\r
+        can cause the YUI ContextMenu to stop working.  If you encounter this \r
+        problem, you can reset the context menu preference in Firefox back to \r
+        the default by making sure the "Disable or replace context menus" \r
+        preference is checked:\r
+\r
+            Mac Firefox 1.0: \r
+            -------------------\r
+            Preferences > Web Features > \r
+                Advanced... > Disable or replace context menus\r
+\r
+            Mac Firefox 1.5\r
+            -------------------\r
+            Preferences > Context > \r
+                Advanced... > Disable or replace context menus\r
+\r
+            Windows Firefox 1.0\r
+            -------------------\r
+            Tools > Options > Web Features > \r
+                Advanced... > Disable or replace context menus\r
+\r
+            Windows Firefox 1.5\r
+            -------------------\r
+            Tools > Options > Context > \r
+                Advanced... > Disable or replace context menus\r
+                \r
+\r
+*** version 0.11.0 ***\r
+\r
+Added the following features:\r
+-----------------------------\r
+* Overloaded the "addItem" and "insertItem" methods of MenuModule to accept a \r
+  string or a MenuModuleItem instance\r
+\r
+* Added the ability to define a MenuItem instance as being "checked"\r
+\r
+\r
+Fixed the following bugs:\r
+-------------------------\r
+* Changing the path for the submenu indicator image of one MenuModuleItem \r
+  subclass will no longer affect other subclasses\r
+\r
+* MenuItem instances built from existing markup without anchor tags will no \r
+  longer trigger a JavaScript error when clicked\r
+\r
+* Modified the implementation of the "imageRoot" property for the \r
+  MenuModuleItem class so that it is set to a secure/non-secure path when the\r
+  object is instantiated\r
+\r
+* Menu instances now resize in response to changes to the browser's font size\r
+\r
+* Modified the propagation of the MenuModule class's "submenualignment" \r
+  configuration property so that it only applies to instances of the same type\r
+\r
+* Adjusted the specificity of the style rule that controls the position of a \r
+  MenuItem instance's submenu indicator image to prevent it from wrapping in IE\r
+\r
+* Specified a width and height for submenu indicator images in the Menu \r
+  stylesheet to ensure that Menu instances are always rendered at the correct \r
+  width\r
+\r
+* Clicking a MenuItem instance will no longer trigger two HTTP GET requests\r
+\r
+* Users can now control or shift-click on MenuItem links\r
+\r
+\r
+Changes\r
+-------\r
+* In the Menu stylesheet (menu.css), switched from using "first" class to\r
+  "first-of-type" class\r
+\r
+* Changed case of MenuModuleItem class's "subMenuIndicator" property \r
+  to "submenuIndicator"
\ No newline at end of file
diff --git a/lib/yui/menu/assets/menu.css b/lib/yui/menu/assets/menu.css
new file mode 100755 (executable)
index 0000000..c73ef77
--- /dev/null
@@ -0,0 +1,288 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+\r
+/* Menu styles */\r
+\r
+div.yuimenu {\r
+\r
+    z-index:1;\r
+    visibility:hidden;\r
+    background-color:#f6f7ee;\r
+    border:solid 1px #c4c4be;\r
+    padding:1px;\r
+    \r
+}\r
+\r
+\r
+/* MenuBar Styles */\r
+\r
+div.yuimenubar {\r
+\r
+    background-color:#f6f7ee;\r
+    \r
+}\r
+\r
+/*\r
+    Application of "zoom:1" triggers "haslayout" in IE so that the module's\r
+    body clears its floated elements\r
+*/\r
+div.yuimenubar div.bd {\r
+\r
+    zoom:1;\r
+\r
+}\r
+\r
+/*\r
+    Clear the module body for other browsers\r
+*/\r
+div.yuimenubar div.bd:after {\r
+\r
+    content:'.';\r
+    display:block;\r
+    clear:both;\r
+    visibility:hidden;\r
+    height:0;\r
+\r
+}\r
+\r
+\r
+/* Matches the group title (H6) inside a Menu or MenuBar instance */\r
+\r
+div.yuimenu h6,\r
+div.yuimenubar h6 { \r
+\r
+    font-size:100%;\r
+    font-weight:normal;    \r
+    margin:0;\r
+    border:solid 1px #c4c4be;\r
+    color:#b9b9b9;    \r
+\r
+}\r
+\r
+div.yuimenubar h6 {\r
+\r
+    float:left;\r
+    display:inline; /* Prevent margin doubling in IE */\r
+    padding:4px 12px;\r
+    border-width:0 1px 0 0;\r
+    \r
+}\r
+\r
+div.yuimenu h6 {\r
+\r
+    float:none;\r
+    display:block;\r
+    border-width:1px 0 0 0;\r
+    padding:5px 10px 0 10px;\r
+\r
+}\r
+\r
+\r
+/* Matches the UL inside a Menu or MenuBar instance */\r
+\r
+div.yuimenubar ul {\r
+\r
+    list-style-type:none;\r
+    margin:0;\r
+    padding:0;\r
+    overflow:hidden;\r
+\r
+}\r
+\r
+div.yuimenu ul {\r
+\r
+    list-style-type:none;\r
+    border:solid 1px #c4c4be;\r
+    border-width:1px 0 0 0;\r
+    margin:0;\r
+    padding:10px 0;\r
+\r
+}\r
+\r
+\r
+div.yuimenu ul.first-of-type, \r
+div.yuimenu ul.hastitle,\r
+div.yuimenu h6.first-of-type {\r
+\r
+    border-width:0;\r
+\r
+}\r
+\r
+\r
+/* MenuItem and MenuBarItem styles */\r
+\r
+div.yuimenu li,\r
+div.yuimenubar li {\r
+\r
+    font-size:85%;\r
+    cursor:pointer;\r
+    cursor:hand;\r
+    white-space:nowrap;\r
+    text-align:left;\r
+\r
+}\r
+\r
+div.yuimenu li.yuimenuitem {\r
+\r
+    padding:2px 24px;\r
+    \r
+}\r
+\r
+div.yuimenu li li,\r
+div.yuimenubar li li {\r
+\r
+    font-size:100%;\r
+\r
+}\r
+\r
+\r
+/* Matches the help text for a menu item */\r
+\r
+div.yuimenu li em {\r
+\r
+    font-style:normal;\r
+    margin:0 0 0 40px;\r
+\r
+}\r
+\r
+div.yuimenu li a em {\r
+\r
+    margin:0;\r
+\r
+}\r
+\r
+div.yuimenu li a,\r
+div.yuimenubar li a {\r
+    \r
+    /*\r
+        "zoom:1" triggers "haslayout" in IE to ensure that the mouseover and \r
+        mouseout events bubble to the parent LI in IE.\r
+    */\r
+    zoom:1;\r
+    color:#000;\r
+    text-decoration:none;\r
+    \r
+}\r
+\r
+div.yuimenu li.hassubmenu,\r
+div.yuimenu li.hashelptext {\r
+\r
+    text-align:right;\r
+\r
+}\r
+\r
+div.yuimenu li.hassubmenu a.hassubmenu,\r
+div.yuimenu li.hashelptext a.hashelptext {\r
+\r
+    float:left;\r
+    display:inline; /* Prevent margin doubling in IE */\r
+    text-align:left;\r
+\r
+}\r
+\r
+\r
+/* Matches focused and selected menu items */\r
+\r
+div.yuimenu li.selected,\r
+div.yuimenubar li.selected {\r
+\r
+    background-color:#8c8ad0;\r
+\r
+}\r
+\r
+div.yuimenu li.selected a.selected,\r
+div.yuimenubar li.selected a.selected {\r
+\r
+    text-decoration:underline;\r
+\r
+}\r
+\r
+div.yuimenu li.selected a.selected,\r
+div.yuimenu li.selected em.selected, \r
+div.yuimenubar li.selected a.selected {\r
+\r
+    color:#fff;\r
+\r
+}\r
+\r
+\r
+/* Matches disabled menu items */\r
+\r
+div.yuimenu li.disabled, \r
+div.yuimenubar li.disabled {\r
+\r
+    cursor:default;\r
+\r
+}\r
+\r
+div.yuimenu li.disabled a.disabled,\r
+div.yuimenu li.disabled em.disabled,\r
+div.yuimenubar li.disabled a.disabled {\r
+\r
+    color:#b9b9b9;\r
+    cursor:default;\r
+    \r
+}\r
+\r
+div.yuimenubar li.yuimenubaritem {\r
+\r
+    float:left;\r
+    display:inline; /* Prevent margin doubling in IE */\r
+    border-width:0 0 0 1px;\r
+    border-style:solid;\r
+    border-color:#c4c4be;\r
+    padding:4px 24px;\r
+    margin:0;\r
+\r
+}\r
+\r
+div.yuimenubar li.yuimenubaritem.first-of-type {\r
+\r
+    border-width:0;\r
+\r
+}\r
+\r
+\r
+/* Matches the submenu indicator for menu items */\r
+\r
+div.yuimenubar li.yuimenubaritem img {\r
+\r
+    height:8px;\r
+    width:8px;\r
+    margin:0 0 0 10px;\r
+    vertical-align:middle;\r
+\r
+}\r
+\r
+div.yuimenu li.yuimenuitem img {\r
+\r
+    height:8px;\r
+    width:8px;\r
+    margin:0 -16px 0 10px;\r
+    border:0;\r
+\r
+}\r
+\r
+div.yuimenu li.checked {\r
+\r
+    position:relative;\r
+\r
+}\r
+\r
+div.yuimenu li.checked img.checked {\r
+\r
+    height:8px;\r
+    width:8px;\r
+    margin:0;\r
+    border:0;\r
+    position:absolute;\r
+    left:6px;\r
+    _left:-16px; /* Underscore hack b/c this is for IE 5.5 and IE 6 only */\r
+    top:.5em;\r
+    \r
+}
\ No newline at end of file
diff --git a/lib/yui/menu/assets/menuarodwn8_dim_1.gif b/lib/yui/menu/assets/menuarodwn8_dim_1.gif
new file mode 100755 (executable)
index 0000000..60b3836
Binary files /dev/null and b/lib/yui/menu/assets/menuarodwn8_dim_1.gif differ
diff --git a/lib/yui/menu/assets/menuarodwn8_hov_1.gif b/lib/yui/menu/assets/menuarodwn8_hov_1.gif
new file mode 100755 (executable)
index 0000000..66632e8
Binary files /dev/null and b/lib/yui/menu/assets/menuarodwn8_hov_1.gif differ
diff --git a/lib/yui/menu/assets/menuarodwn8_nrm_1.gif b/lib/yui/menu/assets/menuarodwn8_nrm_1.gif
new file mode 100755 (executable)
index 0000000..bf5d3f1
Binary files /dev/null and b/lib/yui/menu/assets/menuarodwn8_nrm_1.gif differ
diff --git a/lib/yui/menu/assets/menuarorght8_dim_1.gif b/lib/yui/menu/assets/menuarorght8_dim_1.gif
new file mode 100755 (executable)
index 0000000..0780b66
Binary files /dev/null and b/lib/yui/menu/assets/menuarorght8_dim_1.gif differ
diff --git a/lib/yui/menu/assets/menuarorght8_hov_1.gif b/lib/yui/menu/assets/menuarorght8_hov_1.gif
new file mode 100755 (executable)
index 0000000..0d87f1a
Binary files /dev/null and b/lib/yui/menu/assets/menuarorght8_hov_1.gif differ
diff --git a/lib/yui/menu/assets/menuarorght8_nrm_1.gif b/lib/yui/menu/assets/menuarorght8_nrm_1.gif
new file mode 100755 (executable)
index 0000000..3cdc2a9
Binary files /dev/null and b/lib/yui/menu/assets/menuarorght8_nrm_1.gif differ
diff --git a/lib/yui/menu/assets/menuchk8_dim_1.gif b/lib/yui/menu/assets/menuchk8_dim_1.gif
new file mode 100755 (executable)
index 0000000..d282a6c
Binary files /dev/null and b/lib/yui/menu/assets/menuchk8_dim_1.gif differ
diff --git a/lib/yui/menu/assets/menuchk8_hov_1.gif b/lib/yui/menu/assets/menuchk8_hov_1.gif
new file mode 100755 (executable)
index 0000000..2fabaef
Binary files /dev/null and b/lib/yui/menu/assets/menuchk8_hov_1.gif differ
diff --git a/lib/yui/menu/assets/menuchk8_nrm_1.gif b/lib/yui/menu/assets/menuchk8_nrm_1.gif
new file mode 100755 (executable)
index 0000000..9732837
Binary files /dev/null and b/lib/yui/menu/assets/menuchk8_nrm_1.gif differ
diff --git a/lib/yui/menu/menu-debug.js b/lib/yui/menu/menu-debug.js
new file mode 100755 (executable)
index 0000000..d7e0f1b
--- /dev/null
@@ -0,0 +1,5414 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+\r
+/**\r
+* @class The superclass of all menu containers.\r
+* @constructor\r
+* @extends YAHOO.widget.Overlay\r
+* @base YAHOO.widget.Overlay\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuModule instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModule = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuModule.superclass.constructor.call(\r
+        this, \r
+        p_oElement, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuModule, YAHOO.widget.Overlay);\r
+\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLDivElement of the MenuModule instance.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuModule.prototype.CSS_CLASS_NAME = "yuimenu";\r
+\r
+\r
+/**\r
+* Constant representing the type of item to instantiate and add when parsing \r
+* the child nodes (either HTMLLIElement, HTMLOptGroupElement or \r
+* HTMLOptionElement) of a menu's DOM.  The default \r
+* is YAHOO.widget.MenuModuleItem.\r
+* @final\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.ITEM_TYPE = null;\r
+\r
+\r
+/**\r
+* Constant representing the tagname of the HTMLElement used to title \r
+* a group of items.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuModule.prototype.GROUP_TITLE_TAG_NAME = "H6";\r
+\r
+\r
+// Private properties\r
+\r
+/**\r
+* Array of HTMLElements used to title groups of items.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aGroupTitleElements = null;\r
+\r
+\r
+/**\r
+* Multi-dimensional array of items.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aItemGroups = null;\r
+\r
+\r
+/**\r
+* An array of HTMLUListElements, each of which is the parent node of each \r
+* items's HTMLLIElement node.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aListElements = null;\r
+\r
+\r
+/**\r
+* Reference to the Event utility singleton.\r
+* @private\r
+* @type {YAHOO.util.Event}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oEventUtil = YAHOO.util.Event;\r
+\r
+\r
+/**\r
+* Reference to the Dom utility singleton.\r
+* @private\r
+* @type {YAHOO.util.Dom}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oDom = YAHOO.util.Dom;\r
+\r
+\r
+/**\r
+* Reference to the item the mouse is currently over.\r
+* @private\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oCurrentItem = null;\r
+\r
+\r
+/** \r
+* The current state of a MenuModule instance's "mouseover" event\r
+* @private\r
+* @type {Boolean}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._bFiredMouseOverEvent = false;\r
+\r
+\r
+/** \r
+* The current state of a MenuModule instance's "mouseout" event\r
+* @private\r
+* @type {Boolean}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._bFiredMouseOutEvent = false;\r
+\r
+\r
+// Public properties\r
+\r
+/**\r
+* Reference to the item that has focus.\r
+* @private\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.activeItem = null;\r
+\r
+\r
+/**\r
+* Returns a MenuModule instance's parent object.\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.parent = null;\r
+\r
+\r
+/**\r
+* Returns the HTMLElement (either HTMLSelectElement or HTMLDivElement)\r
+* used create the MenuModule instance.\r
+* @type {HTMLSelectElement/HTMLDivElement}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.srcElement = null;\r
+\r
+\r
+// Events\r
+\r
+/**\r
+* Fires when the mouse has entered a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseOverEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the mouse has left a MenuModule instance.  Passes back the DOM \r
+* Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseOutEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user mouses down on a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseDownEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user releases a mouse button while the mouse is over \r
+* a MenuModule instance.  Passes back the DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseUpEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user clicks the on a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.clickEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user presses an alphanumeric key.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyPressEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user presses a key.  Passes back the DOM Event \r
+* object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyDownEvent = null;\r
+\r
+\r
+/**\r
+* Fires when the user releases a key.  Passes back the DOM Event \r
+* object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyUpEvent = null;\r
+\r
+\r
+/**\r
+* The MenuModule class's initialization method. This method is automatically \r
+* called  by the constructor, and sets up all DOM references for \r
+* pre-existing markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuModule instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    var Dom = this._oDom;\r
+    var Event = this._oEventUtil;\r
+\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuModuleItem;\r
+\r
+    }\r
+\r
+\r
+    this._aItemGroups = [];\r
+    this._aListElements = [];\r
+    this._aGroupTitleElements = [];\r
+\r
+\r
+    var oElement;\r
+\r
+    if(typeof p_oElement == "string") {\r
+\r
+        oElement = document.getElementById(p_oElement);\r
+\r
+    }\r
+    else if(p_oElement.tagName) {\r
+\r
+        oElement = p_oElement;\r
+\r
+    }\r
+\r
+\r
+    if(oElement) {\r
+\r
+        switch(oElement.tagName) {\r
+    \r
+            case "DIV":\r
+\r
+                this.srcElement = oElement;\r
+\r
+                /* \r
+                    Note: we don't pass the user config in here yet \r
+                    because we only want it executed once, at the lowest \r
+                    subclass level.\r
+                */ \r
+            \r
+                YAHOO.widget.MenuModule.superclass.init.call(this, oElement);\r
+\r
+                this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+\r
+                /*\r
+                    Populate the collection of item groups and item\r
+                    group titles\r
+                */\r
+\r
+                var oNode = this.body.firstChild;\r
+                var i = 0;\r
+\r
+                do {\r
+\r
+                    switch(oNode.tagName) {\r
+\r
+                        case this.GROUP_TITLE_TAG_NAME:\r
+                        \r
+                            this._aGroupTitleElements[i] = oNode;\r
+\r
+                        break;\r
+\r
+                        case "UL":\r
+\r
+                            this._aListElements[i] = oNode;\r
+                            this._aItemGroups[i] = [];\r
+                            i++;\r
+\r
+                        break;\r
+\r
+                    }\r
+\r
+                }\r
+                while((oNode = oNode.nextSibling));\r
+\r
+\r
+                /*\r
+                    Apply the "first-of-type" class to the first UL to mimic \r
+                    the "first-of-type" CSS3 psuedo class.\r
+                */\r
+\r
+                if(this._aListElements[0]) {\r
+\r
+                    Dom.addClass(this._aListElements[0], "first-of-type");\r
+\r
+                }\r
+\r
+                this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+                this.logger.log("Source element: " + this.srcElement.tagName);\r
+    \r
+            break;\r
+    \r
+            case "SELECT":\r
+    \r
+                this.srcElement = oElement;\r
+    \r
+    \r
+                /*\r
+                    The source element is not something that we can use \r
+                    outright, so we need to create a new Overlay\r
+                */\r
+    \r
+                var sId = Dom.generateId();\r
+\r
+                /* \r
+                    Note: we don't pass the user config in here yet \r
+                    because we only want it executed once, at the lowest \r
+                    subclass level.\r
+                */ \r
+            \r
+                YAHOO.widget.MenuModule.superclass.init.call(this, sId); \r
+\r
+                this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+                this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+                this.logger.log("Source element: " + this.srcElement.tagName);\r
+\r
+            break;\r
+    \r
+        }\r
+\r
+    }\r
+    else {\r
+\r
+        /* \r
+            Note: we don't pass the user config in here yet \r
+            because we only want it executed once, at the lowest \r
+            subclass level.\r
+        */ \r
+    \r
+        YAHOO.widget.MenuModule.superclass.init.call(this, p_oElement);\r
+\r
+        this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+        this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+        this.logger.log("No source element found.  " +\r
+            "Created element with id: " + this.id);\r
+\r
+    }\r
+\r
+\r
+    if(this.element) {\r
+\r
+        var oEl = this.element;\r
+        var CustomEvent = YAHOO.util.CustomEvent;\r
+\r
+        Dom.addClass(oEl, this.CSS_CLASS_NAME);\r
+\r
+        // Assign DOM event handlers\r
+\r
+        Event.addListener(\r
+                oEl, \r
+                "mouseover", \r
+                this._onElementMouseOver, \r
+                this, \r
+                true\r
+            );\r
+\r
+        Event.addListener(oEl, "mouseout", this._onElementMouseOut, this, true);\r
+        Event.addListener(oEl, "mousedown", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "mouseup", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "click", this._onElementClick, this, true);\r
+        Event.addListener(oEl, "keydown", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "keyup", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "keypress", this._onDOMEvent, this, true);\r
+\r
+\r
+        // Create custom events\r
+\r
+        this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);\r
+        this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);\r
+        this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);\r
+        this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);\r
+        this.clickEvent = new CustomEvent("clickEvent", this);\r
+        this.keyPressEvent = new CustomEvent("keyPressEvent", this);\r
+        this.keyDownEvent = new CustomEvent("keyDownEvent", this);\r
+        this.keyUpEvent = new CustomEvent("keyUpEvent", this);\r
+\r
+\r
+        // Subscribe to Custom Events\r
+\r
+        this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);\r
+        this.renderEvent.subscribe(this._onRender, this, true);\r
+        this.showEvent.subscribe(this._onShow, this, true);\r
+        this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);\r
+\r
+\r
+        if(p_oConfig) {\r
+    \r
+            this.cfg.applyConfig(p_oConfig, true);\r
+    \r
+        }\r
+\r
+\r
+        this.cfg.queueProperty("visible", false);\r
+\r
+\r
+        if(this.srcElement) {\r
+\r
+            this._initSubTree();\r
+\r
+        }\r
+\r
+    }\r
+\r
+\r
+    this.initEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+};\r
+\r
+\r
+// Private methods\r
+\r
+/**\r
+* Iterates the source element's childNodes collection and uses the child \r
+* nodes to instantiate MenuModule and MenuModuleItem instances.\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._initSubTree = function() {\r
+\r
+    var oNode;\r
+\r
+    this.logger.log("Searching DOM for items to initialize.");\r
+\r
+    switch(this.srcElement.tagName) {\r
+\r
+        case "DIV":\r
+\r
+            if(this._aListElements.length > 0) {\r
+\r
+                this.logger.log("Found " + \r
+                    this._aListElements.length + " item groups to initialize.");\r
+\r
+                var i = this._aListElements.length - 1;\r
+\r
+                do {\r
+\r
+                    oNode = this._aListElements[i].firstChild;\r
+    \r
+                    this.logger.log("Scanning " + \r
+                        this._aListElements[i].childNodes.length + \r
+                        " child nodes for items to initialize.");\r
+\r
+                    do {\r
+    \r
+                        switch(oNode.tagName) {\r
+        \r
+                            case "LI":\r
+\r
+                                this.logger.log("Initializing " + \r
+                                    oNode.tagName + " node.");\r
+\r
+                                this.addItem(new this.ITEM_TYPE(oNode), i);\r
+        \r
+                            break;\r
+        \r
+                        }\r
+            \r
+                    }\r
+                    while((oNode = oNode.nextSibling));\r
+            \r
+                }\r
+                while(i--);\r
+\r
+            }\r
+\r
+        break;\r
+\r
+        case "SELECT":\r
+\r
+            this.logger.log("Scanning " +  this.srcElement.childNodes.length + \r
+                " child nodes for items to initialize.");\r
+\r
+            oNode = this.srcElement.firstChild;\r
+\r
+            do {\r
+\r
+                switch(oNode.tagName) {\r
+\r
+                    case "OPTGROUP":\r
+                    case "OPTION":\r
+\r
+                        this.logger.log("Initializing " +  \r
+                            oNode.tagName + " node.");\r
+\r
+                        this.addItem(new this.ITEM_TYPE(oNode));\r
+\r
+                    break;\r
+\r
+                }\r
+\r
+            }\r
+            while((oNode = oNode.nextSibling));\r
+\r
+        break;\r
+\r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Returns the first enabled item in a menu instance.\r
+* @return Returns a MenuModuleItem instance.\r
+* @type YAHOO.widget.MenuModuleItem\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getFirstEnabledItem = function() {\r
+\r
+    var nGroups = this._aItemGroups.length;\r
+    var oItem;\r
+    var aItemGroup;\r
+\r
+    for(var i=0; i<nGroups; i++) {\r
+\r
+        aItemGroup = this._aItemGroups[i];\r
+        \r
+        if(aItemGroup) {\r
+\r
+            var nItems = aItemGroup.length;\r
+            \r
+            for(var n=0; n<nItems; n++) {\r
+            \r
+                oItem = aItemGroup[n];\r
+                \r
+                if(!oItem.cfg.getProperty("disabled")) {\r
+                \r
+                    return oItem;\r
+                \r
+                }\r
+    \r
+                oItem = null;\r
+    \r
+            }\r
+        \r
+        }\r
+    \r
+    }\r
+    \r
+};\r
+\r
+\r
+/**\r
+* Determines if the value is one of the supported positions.\r
+* @private\r
+* @param {Object} p_sPosition The object to be evaluated.\r
+* @return Returns true if the position is supported.\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.MenuModule.prototype._checkPosition = function(p_sPosition) {\r
+\r
+    if(typeof p_sPosition == "string") {\r
+\r
+        var sPosition = p_sPosition.toLowerCase();\r
+\r
+        return ("dynamic,static".indexOf(sPosition) != -1);\r
+\r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Adds an item to a group.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be added.\r
+* @param {Number} p_nItemIndex Optional. Index at which the item \r
+* should be added.\r
+* @return The item that was added.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype._addItemToGroup = \r
+\r
+    function(p_nGroupIndex, p_oItem, p_nItemIndex) {\r
+\r
+        var Dom = this._oDom;\r
+        var oItem;\r
+\r
+        if(p_oItem instanceof this.ITEM_TYPE) {\r
+\r
+            oItem = p_oItem;     \r
+\r
+        }\r
+        else if(typeof p_oItem == "string") {\r
+\r
+            oItem = new this.ITEM_TYPE(p_oItem);\r
+        \r
+        }\r
+\r
+\r
+        if(oItem) {\r
+        \r
+            var nGroupIndex = typeof p_nGroupIndex == "number" ? \r
+                    p_nGroupIndex : 0;\r
+            \r
+            var aGroup = this._getItemGroup(nGroupIndex);\r
+            \r
+            var oGroupItem;\r
+    \r
+\r
+            if(!aGroup) {\r
+    \r
+                aGroup = this._createItemGroup(nGroupIndex);\r
+    \r
+            }\r
+\r
+\r
+            if(typeof p_nItemIndex == "number") {\r
+    \r
+                var bAppend = (p_nItemIndex >= aGroup.length);            \r
+    \r
+\r
+                if(aGroup[p_nItemIndex]) {\r
+        \r
+                    aGroup.splice(p_nItemIndex, 0, oItem);\r
+        \r
+                }\r
+                else {\r
+        \r
+                    aGroup[p_nItemIndex] = oItem;\r
+        \r
+                }\r
+    \r
+    \r
+                oGroupItem = aGroup[p_nItemIndex];\r
+    \r
+                if(oGroupItem) {\r
+    \r
+                    if(bAppend && !oGroupItem.element.parentNode) {\r
+            \r
+                        this._aListElements[nGroupIndex].appendChild(\r
+                            oGroupItem.element\r
+                        );\r
+        \r
+                    }\r
+                    else {\r
+      \r
+        \r
+                        /**\r
+                        * Returns the next sibling of an item in an array \r
+                        * @param {p_aArray} An array\r
+                        * @param {p_nStartIndex} The index to start searching\r
+                        * the array \r
+                        * @ignore\r
+                        * @return Returns an item in an array\r
+                        * @type Object \r
+                        */\r
+                        function getNextItemSibling(p_aArray, p_nStartIndex) {\r
+                \r
+                            return (\r
+                                    p_aArray[p_nStartIndex] || \r
+                                    getNextItemSibling(\r
+                                        p_aArray, \r
+                                        (p_nStartIndex+1)\r
+                                    )\r
+                                );\r
+                \r
+                        }\r
+        \r
+        \r
+                        var oNextItemSibling = \r
+                                getNextItemSibling(aGroup, (p_nItemIndex+1));\r
+        \r
+                        if(oNextItemSibling && !oGroupItem.element.parentNode) {\r
+                \r
+                            this._aListElements[nGroupIndex].insertBefore(\r
+                                    oGroupItem.element, \r
+                                    oNextItemSibling.element\r
+                                );\r
+            \r
+                        }\r
+        \r
+                    }\r
+        \r
+    \r
+                    oGroupItem.parent = this;\r
+            \r
+                    this._subscribeToItemEvents(oGroupItem);\r
+        \r
+                    this._configureItemSubmenuModule(oGroupItem);\r
+                    \r
+                    this._updateItemProperties(nGroupIndex);\r
+            \r
+                    this.logger.log("Item inserted." + \r
+                        " Text: " + oGroupItem.cfg.getProperty("text") + ", " + \r
+                        " Index: " + oGroupItem.index + ", " + \r
+                        " Group Index: " + oGroupItem.groupIndex);\r
+\r
+                    return oGroupItem;\r
+        \r
+                }\r
+    \r
+            }\r
+            else {\r
+        \r
+                var nItemIndex = aGroup.length;\r
+        \r
+                aGroup[nItemIndex] = oItem;\r
+        \r
+        \r
+                oGroupItem = aGroup[nItemIndex];\r
+        \r
+                if(oGroupItem) {\r
+        \r
+                    if(\r
+                        !Dom.isAncestor(\r
+                            this._aListElements[nGroupIndex], \r
+                            oGroupItem.element\r
+                        )\r
+                    ) {\r
+        \r
+                        this._aListElements[nGroupIndex].appendChild(\r
+                            oGroupItem.element\r
+                        );\r
+        \r
+                    }\r
+        \r
+                    oGroupItem.element.setAttribute("groupindex", nGroupIndex);\r
+                    oGroupItem.element.setAttribute("index", nItemIndex);\r
+            \r
+                    oGroupItem.parent = this;\r
+        \r
+                    oGroupItem.index = nItemIndex;\r
+                    oGroupItem.groupIndex = nGroupIndex;\r
+            \r
+                    this._subscribeToItemEvents(oGroupItem);\r
+        \r
+                    this._configureItemSubmenuModule(oGroupItem);\r
+        \r
+                    if(nItemIndex === 0) {\r
+            \r
+                        Dom.addClass(oGroupItem.element, "first-of-type");\r
+            \r
+                    }\r
+\r
+                    this.logger.log("Item added." + \r
+                        " Text: " + oGroupItem.cfg.getProperty("text") + ", " + \r
+                        " Index: " + oGroupItem.index + ", " + \r
+                        " Group Index: " + oGroupItem.groupIndex);\r
+            \r
+                    return oGroupItem;\r
+        \r
+                }\r
+        \r
+            }\r
+\r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Removes an item from a group by index.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {Number} p_nItemIndex Number indicating the index of the item to  \r
+* be removed.\r
+* @return The item that was removed.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/    \r
+YAHOO.widget.MenuModule.prototype._removeItemFromGroupByIndex = \r
+\r
+    function(p_nGroupIndex, p_nItemIndex) {\r
+\r
+        var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;\r
+        var aGroup = this._getItemGroup(nGroupIndex);\r
+    \r
+        if(aGroup) {\r
+    \r
+            var aArray = aGroup.splice(p_nItemIndex, 1);\r
+            var oItem = aArray[0];\r
+        \r
+            if(oItem) {\r
+        \r
+                // Update the index and className properties of each member        \r
+                \r
+                this._updateItemProperties(nGroupIndex);\r
+        \r
+                if(aGroup.length === 0) {\r
+        \r
+                    // Remove the UL\r
+        \r
+                    var oUL = this._aListElements[nGroupIndex];\r
+        \r
+                    if(this.body && oUL) {\r
+        \r
+                        this.body.removeChild(oUL);\r
+        \r
+                    }\r
+        \r
+                    // Remove the group from the array of items\r
+        \r
+                    this._aItemGroups.splice(nGroupIndex, 1);\r
+        \r
+        \r
+                    // Remove the UL from the array of ULs\r
+        \r
+                    this._aListElements.splice(nGroupIndex, 1);\r
+        \r
+        \r
+                    /*\r
+                         Assign the "first-of-type" class to the new first UL \r
+                         in the collection\r
+                    */\r
+        \r
+                    oUL = this._aListElements[0];\r
+        \r
+                    if(oUL) {\r
+        \r
+                        this._oDom.addClass(oUL, "first-of-type");\r
+        \r
+                    }            \r
+        \r
+                }\r
+        \r
+        \r
+                // Return a reference to the item that was removed\r
+            \r
+                return oItem;\r
+        \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Removes a item from a group by reference.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be removed.\r
+* @return The item that was removed.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/    \r
+YAHOO.widget.MenuModule.prototype._removeItemFromGroupByValue =\r
+\r
+    function(p_nGroupIndex, p_oItem) {\r
+\r
+        var aGroup = this._getItemGroup(p_nGroupIndex);\r
+\r
+        if(aGroup) {\r
+\r
+            var nItems = aGroup.length;\r
+            var nItemIndex = -1;\r
+        \r
+            if(nItems > 0) {\r
+        \r
+                var i = nItems-1;\r
+            \r
+                do {\r
+            \r
+                    if(aGroup[i] == p_oItem) {\r
+            \r
+                        nItemIndex = i;\r
+                        break;    \r
+            \r
+                    }\r
+            \r
+                }\r
+                while(i--);\r
+            \r
+                if(nItemIndex > -1) {\r
+            \r
+                    return this._removeItemFromGroupByIndex(\r
+                                p_nGroupIndex, \r
+                                nItemIndex\r
+                            );\r
+            \r
+                }\r
+        \r
+            }\r
+        \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Updates the index, groupindex, and className properties of the items\r
+* in the specified group. \r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group of items to update.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._updateItemProperties = \r
+\r
+    function(p_nGroupIndex) {\r
+\r
+        var aGroup = this._getItemGroup(p_nGroupIndex);\r
+        var nItems = aGroup.length;\r
+    \r
+        if(nItems > 0) {\r
+    \r
+            var Dom = this._oDom;\r
+            var i = nItems - 1;\r
+            var oItem;\r
+            var oLI;\r
+    \r
+            // Update the index and className properties of each member        \r
+        \r
+            do {\r
+    \r
+                oItem = aGroup[i];\r
+    \r
+                if(oItem) {\r
+        \r
+                    oLI = oItem.element;\r
+    \r
+                    oItem.index = i;\r
+                    oItem.groupIndex = p_nGroupIndex;\r
+    \r
+                    oLI.setAttribute("groupindex", p_nGroupIndex);\r
+                    oLI.setAttribute("index", i);\r
+    \r
+                    Dom.removeClass(oLI, "first-of-type");\r
+    \r
+                }\r
+        \r
+            }\r
+            while(i--);\r
+    \r
+    \r
+            if(oLI) {\r
+    \r
+                Dom.addClass(oLI, "first-of-type");\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Creates a new item group (array) and it's associated HTMLUlElement node \r
+* @private\r
+* @param {Number} p_nIndex Number indicating the group to create.\r
+* @return An item group.\r
+* @type Array\r
+*/\r
+YAHOO.widget.MenuModule.prototype._createItemGroup = function(p_nIndex) {\r
+\r
+    if(!this._aItemGroups[p_nIndex]) {\r
+\r
+        this._aItemGroups[p_nIndex] = [];\r
+\r
+        var oUL = document.createElement("ul");\r
+\r
+        this._aListElements[p_nIndex] = oUL;\r
+\r
+        return this._aItemGroups[p_nIndex];\r
+\r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Returns the item group at the specified index.\r
+* @private\r
+* @param {Number} p_nIndex Number indicating the index of the item group to\r
+* be retrieved.\r
+* @return An array of items.\r
+* @type Array\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getItemGroup = function(p_nIndex) {\r
+\r
+    var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);\r
+\r
+    return this._aItemGroups[nIndex];\r
+\r
+};\r
+\r
+\r
+/**\r
+* Subscribe's a MenuModule instance to it's parent MenuModule instance's events.\r
+* @private\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to listen\r
+* for events on.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._configureItemSubmenuModule = \r
+\r
+    function(p_oItem) {\r
+\r
+        var oSubmenu = p_oItem.cfg.getProperty("submenu");\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            /*\r
+                Listen for configuration changes to the parent MenuModule \r
+                instance so they they can be applied to the submenu.\r
+            */\r
+    \r
+            this.cfg.configChangedEvent.subscribe(\r
+                this._onParentMenuModuleConfigChange, \r
+                oSubmenu, \r
+                true\r
+            );\r
+            \r
+            this.renderEvent.subscribe(\r
+                this._onParentMenuModuleRender,\r
+                oSubmenu, \r
+                true\r
+            );\r
+    \r
+            oSubmenu.beforeShowEvent.subscribe(\r
+                this._onSubmenuBeforeShow, \r
+                oSubmenu, \r
+                true\r
+            );\r
+    \r
+            oSubmenu.showEvent.subscribe(this._onSubmenuShow, oSubmenu, true);\r
+    \r
+            oSubmenu.hideEvent.subscribe(this._onSubmenuHide, oSubmenu, true);\r
+    \r
+        }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Subscribes a MenuModule instance to the specified item's Custom Events.\r
+* @private\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to listen for events on.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._subscribeToItemEvents = function(p_oItem) {\r
+\r
+    var aArguments = [this, p_oItem];\r
+\r
+    p_oItem.focusEvent.subscribe(this._onItemFocus, aArguments);\r
+\r
+    p_oItem.blurEvent.subscribe(this._onItemBlur, aArguments);\r
+\r
+    p_oItem.cfg.configChangedEvent.subscribe(\r
+        this._onItemConfigChange,\r
+        aArguments\r
+    );\r
+\r
+};\r
+\r
+\r
+/**\r
+* Returns the offset width of a MenuModule instance.\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getOffsetWidth = function() {\r
+\r
+    var oClone = this.element.cloneNode(true);\r
+\r
+    this._oDom.setStyle(oClone, "width", "");\r
+\r
+    document.body.appendChild(oClone);\r
+\r
+    var sWidth = oClone.offsetWidth;\r
+\r
+    document.body.removeChild(oClone);\r
+\r
+    return sWidth;\r
+\r
+};\r
+\r
+\r
+/**\r
+* Determines if a DOM event was fired on an item and (if so) fires the item's\r
+* associated Custom Event\r
+* @private\r
+* @param {HTMLElement} p_oElement The original target of the event.\r
+* @param {String} p_sEventType The type/name of the Custom Event to fire.\r
+* @param {Event} p_oDOMEvent The DOM event to pass back when firing the \r
+* Custom Event.\r
+* @return An item.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype._fireItemEvent = \r
+\r
+    function(p_oElement, p_sEventType, p_oDOMEvent) {\r
+\r
+        var me = this;\r
+    \r
+        /**\r
+        * Returns the specified element's parent HTMLLIElement (&#60;LI&#60;)\r
+        * @param {p_oElement} An HTMLElement node\r
+        * @ignore\r
+        * @return Returns an HTMLElement node\r
+        * @type HTMLElement \r
+        */\r
+        function getItemElement(p_oElement) {\r
+        \r
+            if(p_oElement == me.element) {\r
+    \r
+                return;\r
+            \r
+            }\r
+            else if(p_oElement.tagName == "LI") {\r
+        \r
+                return p_oElement;\r
+        \r
+            }\r
+            else if(p_oElement.parentNode) {\r
+    \r
+                return getItemElement(p_oElement.parentNode);\r
+        \r
+            }\r
+        \r
+        }\r
+    \r
+    \r
+        var oElement = getItemElement(p_oElement);\r
+    \r
+        if(oElement) {\r
+    \r
+            /*\r
+                Retrieve the item that corresponds to the \r
+                HTMLLIElement (&#60;LI&#60;) and fire the Custom Event        \r
+            */\r
+    \r
+            var nGroupIndex = parseInt(oElement.getAttribute("groupindex"), 10);\r
+            var nIndex = parseInt(oElement.getAttribute("index"), 10);\r
+            var oItem = this._aItemGroups[nGroupIndex][nIndex];\r
+    \r
+            if(!oItem.cfg.getProperty("disabled")) {\r
+    \r
+                oItem[p_sEventType].fire(p_oDOMEvent);\r
+    \r
+                return oItem;\r
+    \r
+            }\r
+    \r
+        }\r
+\r
+    };\r
+\r
+\r
+// Private DOM event handlers\r
+\r
+/**\r
+* Generic event handler for the MenuModule's root HTMLDivElement node.  Used \r
+* to handle "mousedown," "mouseup," "keydown," "keyup," and "keypress" events.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event \r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onDOMEvent = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+\r
+        // Map of DOM event types to Custom Event types\r
+\r
+        var oEventTypes =  {\r
+                "mousedown": "mouseDownEvent",\r
+                "mouseup": "mouseUpEvent",\r
+                "keydown": "keyDownEvent",\r
+                "keyup": "keyUpEvent",\r
+                "keypress": "keyPressEvent"\r
+            };\r
+    \r
+        var sCustomEventType = oEventTypes[p_oEvent.type];\r
+        \r
+        var oTarget = Event.getTarget(p_oEvent);\r
+    \r
+        /*\r
+            Check if the target was an element that is a part of a \r
+            an item and (if so), fire the associated custom event.\r
+        */\r
+    \r
+        this._fireItemEvent(oTarget, sCustomEventType, p_oEvent);\r
+\r
+    \r
+        // Fire the associated custom event for the MenuModule\r
+    \r
+        this[sCustomEventType].fire(p_oEvent);\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+            \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "mouseover" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event\r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onElementMouseOver = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+        var oTarget = Event.getTarget(p_oEvent);\r
+    \r
+        if(\r
+            (\r
+                oTarget == this.element || \r
+                this._oDom.isAncestor(this.element, oTarget)\r
+            )  && \r
+            !this._bFiredMouseOverEvent\r
+        ) {\r
+    \r
+            // Fire the "mouseover" Custom Event for the MenuModule instance\r
+    \r
+            this.mouseOverEvent.fire(p_oEvent);\r
+    \r
+            this._bFiredMouseOverEvent = true;\r
+            this._bFiredMouseOutEvent = false;\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Check if the target was an element that is a part of an item\r
+            and (if so), fire the "mouseover" Custom Event.\r
+        */\r
+    \r
+        if(!this._oCurrentItem) {\r
+    \r
+            this._oCurrentItem = \r
+                this._fireItemEvent(oTarget, "mouseOverEvent", p_oEvent);\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+    \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "mouseout" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event\r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onElementMouseOut = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Dom = this._oDom;\r
+        var Event = this._oEventUtil;\r
+        var oRelatedTarget = Event.getRelatedTarget(p_oEvent);\r
+        var bLIMouseOut = true;\r
+        var bMovingToSubmenu = false;\r
+            \r
+    \r
+        // Determine where the mouse is going\r
+    \r
+        if(this._oCurrentItem && oRelatedTarget) {\r
+    \r
+            if(\r
+                oRelatedTarget == this._oCurrentItem.element || \r
+                Dom.isAncestor(this._oCurrentItem.element, oRelatedTarget)\r
+            ) {\r
+    \r
+                bLIMouseOut = false;\r
+    \r
+            }\r
+    \r
+    \r
+            var oSubmenu = this._oCurrentItem.cfg.getProperty("submenu");\r
+    \r
+            if(\r
+                oSubmenu && \r
+                (\r
+                    oRelatedTarget == oSubmenu.element ||\r
+                    Dom.isAncestor(oSubmenu.element, oRelatedTarget)\r
+                )\r
+            ) {\r
+    \r
+                bMovingToSubmenu = true;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    \r
+        if(this._oCurrentItem && (bLIMouseOut || bMovingToSubmenu)) {\r
+    \r
+            // Fire the "mouseout" Custom Event for the item\r
+    \r
+            this._oCurrentItem.mouseOutEvent.fire(p_oEvent);\r
+    \r
+            this._oCurrentItem = null;\r
+    \r
+        }\r
+    \r
+    \r
+        if(\r
+            !this._bFiredMouseOutEvent && \r
+            (\r
+                !Dom.isAncestor(this.element, oRelatedTarget) ||\r
+                bMovingToSubmenu\r
+            )\r
+        ) {\r
+    \r
+            // Fire the "mouseout" Custom Event for the MenuModule instance\r
+    \r
+            this.mouseOutEvent.fire(p_oEvent);\r
+    \r
+            this._bFiredMouseOutEvent = true;\r
+            this._bFiredMouseOverEvent = false;\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+    \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "click" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/         \r
+YAHOO.widget.MenuModule.prototype._onElementClick = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+        \r
+        var oTarget = Event.getTarget(p_oEvent);\r
+        \r
+        /*\r
+            Check if the target was a DOM element that is a part of an\r
+            item and (if so), fire the associated "click" \r
+            Custom Event.\r
+        */\r
+        \r
+        var oItem = this._fireItemEvent(oTarget, "clickEvent", p_oEvent);\r
+        \r
+        var bCurrentPageURL; // Indicates if the URL points to the current page\r
+    \r
+    \r
+        if(oItem) {\r
+    \r
+            var sURL = oItem.cfg.getProperty("url");\r
+            var oSubmenu = oItem.cfg.getProperty("submenu");\r
+            \r
+            bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");\r
+    \r
+            /*\r
+                ACCESSIBILITY FEATURE FOR SCREEN READERS: Expand/collapse the\r
+                submenu when the user clicks on the submenu indicator image.\r
+            */        \r
+    \r
+            if(oTarget == oItem.submenuIndicator && oSubmenu) {\r
+\r
+                if(oSubmenu.cfg.getProperty("visible")) {\r
+        \r
+                    oSubmenu.hide();\r
+        \r
+                }\r
+                else {\r
+\r
+                    var oActiveItem = this.activeItem;\r
+               \r
+\r
+                    // Hide any other submenus that might be visible\r
+                \r
+                    if(oActiveItem && oActiveItem != this) {\r
+                \r
+                        this.clearActiveItem();\r
+                \r
+                    }\r
+\r
+                    this.activeItem = oItem;\r
+        \r
+                    oItem.cfg.setProperty("selected", true);\r
+\r
+                    oSubmenu.show();\r
+        \r
+                }\r
+        \r
+            }\r
+            else if(oTarget.tagName != "A" && !bCurrentPageURL) {\r
+                \r
+                /*\r
+                    Follow the URL of the item regardless of whether or \r
+                    not the user clicked specifically on the\r
+                    HTMLAnchorElement (&#60;A&#60;) node.\r
+                */\r
+    \r
+                document.location = sURL;\r
+        \r
+            }\r
+        \r
+        }\r
+            \r
+    \r
+        switch(oTarget.tagName) {\r
+        \r
+            case "A":\r
+            \r
+                if(bCurrentPageURL) {\r
+    \r
+                    // Don't follow URLs that are equal to "#"\r
+    \r
+                    Event.preventDefault(p_oEvent);\r
+                \r
+                }\r
+                else {\r
+    \r
+                    /*\r
+                        Break if the anchor's URL is something other than "#" \r
+                        to prevent the call to "stopPropagation" from be \r
+                        executed.  This is required for Safari to be able to \r
+                        follow the URL.\r
+                    */\r
+                \r
+                    break;\r
+                \r
+                }\r
+            \r
+            default:\r
+    \r
+                /*\r
+                    Stop the propagation of the event at each MenuModule \r
+                    instance since Menus can be embedded in eachother.\r
+                */\r
+    \r
+                Event.stopPropagation(p_oEvent);\r
+            \r
+            break;\r
+        \r
+        }\r
+    \r
+    \r
+        // Fire the associated "click" Custom Event for the MenuModule instance\r
+    \r
+        this.clickEvent.fire(p_oEvent);\r
+\r
+    };\r
+\r
+\r
+// Private Custom Event handlers\r
+\r
+\r
+/**\r
+* "beforerender" Custom Event handler for a MenuModule instance.  Appends all \r
+* of the HTMLUListElement (&#60;UL&#60;s) nodes (and their child \r
+* HTMLLIElement (&#60;LI&#60;)) nodes and their accompanying title nodes to  \r
+* the body of the MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onBeforeRender = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var Dom = this._oDom;\r
+        var oConfig = this.cfg;\r
+        var oEl = this.element;\r
+        var nListElements = this._aListElements.length;\r
+    \r
+\r
+        if(oConfig.getProperty("position") == "static") {\r
+    \r
+            oConfig.queueProperty("iframe", false);\r
+            oConfig.queueProperty("visible", true);\r
+            \r
+        }\r
+    \r
+    \r
+        if(nListElements > 0) {\r
+    \r
+            var i = 0;\r
+            var bFirstList = true;\r
+            var oUL;\r
+            var oGroupTitle;\r
+    \r
+    \r
+            do {\r
+    \r
+                oUL = this._aListElements[i];\r
+    \r
+                if(oUL) {\r
+    \r
+                    if(bFirstList) {\r
+            \r
+                        Dom.addClass(oUL, "first-of-type");\r
+                        bFirstList = false;\r
+            \r
+                    }\r
+    \r
+    \r
+                    if(!Dom.isAncestor(oEl, oUL)) {\r
+    \r
+                        this.appendToBody(oUL);\r
+    \r
+                    }\r
+    \r
+    \r
+                    oGroupTitle = this._aGroupTitleElements[i];\r
+    \r
+                    if(oGroupTitle) {\r
+    \r
+                        if(!Dom.isAncestor(oEl, oGroupTitle)) {\r
+    \r
+                            oUL.parentNode.insertBefore(oGroupTitle, oUL);\r
+    \r
+                        }\r
+    \r
+    \r
+                        Dom.addClass(oUL, "hastitle");\r
+    \r
+                    }\r
+    \r
+                }\r
+    \r
+                i++;\r
+    \r
+            }\r
+            while(i < nListElements);\r
+    \r
+        }\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "render" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onRender = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        if(this.cfg.getProperty("position") == "dynamic") {\r
+    \r
+            var sWidth = this.element.parentNode.tagName == "BODY" ? \r
+                    this.element.offsetWidth : this._getOffsetWidth();\r
+        \r
+            this.cfg.setProperty("width", (sWidth + "px"));\r
+    \r
+        }\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "show" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onShow = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+    \r
+        /*\r
+            Setting focus to an item in the newly visible submenu alerts the \r
+            contents of the submenu to the screen reader.\r
+        */\r
+\r
+        this.setInitialFocus();\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "hide" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onBeforeHide = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var oActiveItem = this.activeItem;\r
+\r
+        if(oActiveItem) {\r
+    \r
+            oActiveItem.blur();\r
+\r
+            if(oActiveItem.cfg.getProperty("selected")) {\r
+    \r
+                oActiveItem.cfg.setProperty("selected", false);\r
+    \r
+            }\r
+    \r
+            var oSubmenu = oActiveItem.cfg.getProperty("submenu");\r
+    \r
+            if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {\r
+    \r
+                oSubmenu.hide();\r
+    \r
+            }\r
+    \r
+        }\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "configchange" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that subscribed\r
+* to the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onParentMenuModuleConfigChange = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var sPropertyName = p_aArgs[0][0];\r
+        var oPropertyValue = p_aArgs[0][1];\r
+    \r
+        switch(sPropertyName) {\r
+    \r
+            case "iframe":\r
+            case "constraintoviewport":\r
+    \r
+                p_oSubmenu.cfg.setProperty(sPropertyName, oPropertyValue);\r
+                    \r
+            break;        \r
+            \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "render" Custom Event handler for a MenuModule instance.  Renders a  \r
+* submenu in response to the firing of it's parent's "render" event.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that subscribed\r
+* to the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onParentMenuModuleRender = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+\r
+        /*\r
+            Set the "iframe" and "constraintoviewport" configuration \r
+            properties to match the parent MenuModule\r
+        */ \r
+    \r
+        var oParentMenu = p_oSubmenu.parent.parent;\r
+    \r
+        p_oSubmenu.cfg.applyConfig(\r
+        \r
+            {\r
+                constraintoviewport: \r
+                    oParentMenu.cfg.getProperty("constraintoviewport"),\r
+    \r
+                xy: [0,0],\r
+    \r
+                iframe: oParentMenu.cfg.getProperty("iframe")\r
+    \r
+            }\r
+        \r
+        );\r
+    \r
+    \r
+        if(this._oDom.inDocument(this.element)) {\r
+    \r
+            this.render();\r
+    \r
+        }\r
+        else {\r
+    \r
+            this.render(this.parent.element);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "beforeshow" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuBeforeShow = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+        var aAlignment = oParent.parent.cfg.getProperty("submenualignment");\r
+\r
+        this.cfg.setProperty(\r
+            "context", \r
+            [\r
+                oParent.element, \r
+                aAlignment[0], \r
+                aAlignment[1]\r
+            ]\r
+        );\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "show" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuShow = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "hide" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuHide = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+\r
+        if(oParent.parent.cfg.getProperty("visible")) {\r
+\r
+            oParent.cfg.setProperty("selected", false);\r
+    \r
+            oParent.focus();\r
+        \r
+        }\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "focus" YAHOO.util.CustomEvent handler for a MenuModule instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemFocus = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+    \r
+        var me = p_aObjects[0];\r
+        var oItem = p_aObjects[1];\r
+    \r
+        me.activeItem = oItem;\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "blur" YAHOO.util.CustomEvent handler for a MenuModule instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemBlur = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+    \r
+        var me = p_aObjects[0];\r
+        var oItem = p_aObjects[1];\r
+        var oSubmenu = oItem.cfg.getProperty("submenu");\r
+    \r
+        if(!oSubmenu || (oSubmenu && !oSubmenu.cfg.getProperty("visible"))) {\r
+    \r
+            me.activeItem = null;\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "configchange" YAHOO.util.CustomEvent handler for the MenuModule \r
+* instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemConfigChange = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+\r
+        var me = p_aObjects[0];    \r
+        var sProperty = p_aArgs[0][0];\r
+        var oItem = p_aObjects[1];\r
+    \r
+        switch(sProperty) {\r
+    \r
+            case "submenu":\r
+    \r
+                var oSubmenu = p_aArgs[0][1];\r
+    \r
+                if(oSubmenu) {\r
+    \r
+                    me._configureItemSubmenuModule(oItem);\r
+    \r
+                }\r
+    \r
+            break;\r
+    \r
+            case "text":\r
+            case "helptext":\r
+    \r
+                /*\r
+                    A change to an item's "text" or "helptext"\r
+                    configuration properties requires the width of the parent\r
+                    MenuModule instance to be recalculated.\r
+                */\r
+    \r
+                if(me.element.style.width) {\r
+        \r
+                    var sWidth = me._getOffsetWidth() + "px";\r
+    \r
+                    me._oDom.setStyle(me.element, "width", sWidth);\r
+    \r
+                }\r
+    \r
+            break;\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the \r
+* "constraintoviewport" configuration property is set to true.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.enforceConstraints = \r
+\r
+    function(type, args, obj) {\r
+\r
+        var Dom = this._oDom;\r
+        var oConfig = this.cfg;\r
+    \r
+        var pos = args[0];\r
+            \r
+        var x = pos[0];\r
+        var y = pos[1];\r
+        \r
+        var bod = document.getElementsByTagName('body')[0];\r
+        var htm = document.getElementsByTagName('html')[0];\r
+        \r
+        var bodyOverflow = Dom.getStyle(bod, "overflow");\r
+        var htmOverflow = Dom.getStyle(htm, "overflow");\r
+        \r
+        var offsetHeight = this.element.offsetHeight;\r
+        var offsetWidth = this.element.offsetWidth;\r
+        \r
+        var viewPortWidth = Dom.getClientWidth();\r
+        var viewPortHeight = Dom.getClientHeight();\r
+        \r
+        var scrollX = window.scrollX || document.body.scrollLeft;\r
+        var scrollY = window.scrollY || document.body.scrollTop;\r
+        \r
+        var topConstraint = scrollY + 10;\r
+        var leftConstraint = scrollX + 10;\r
+        var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+        var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+        \r
+        var aContext = oConfig.getProperty("context");\r
+        var oContextElement = aContext ? aContext[0] : null;\r
+    \r
+    \r
+        if (x < 10) {\r
+    \r
+            x = leftConstraint;\r
+    \r
+        } else if ((x + offsetWidth) > viewPortWidth) {\r
+    \r
+            if(\r
+                oContextElement && \r
+                ((x - oContextElement.offsetWidth) > offsetWidth)\r
+            ) {\r
+    \r
+                x = (x - (oContextElement.offsetWidth + offsetWidth));\r
+    \r
+            }\r
+            else {\r
+    \r
+                x = rightConstraint;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+        if (y < 10) {\r
+    \r
+            y = topConstraint;\r
+    \r
+        } else if (y > bottomConstraint) {\r
+    \r
+            if(oContextElement && (y > offsetHeight)) {\r
+    \r
+                y = ((y + oContextElement.offsetHeight) - offsetHeight);\r
+    \r
+            }\r
+            else {\r
+    \r
+                y = bottomConstraint;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+        oConfig.setProperty("x", x, true);\r
+        oConfig.setProperty("y", y, true);\r
+    \r
+    };\r
+\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "position" configuration property of a\r
+* MenuModule changes.\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance fired\r
+* the event.\r
+* @see YAHOO.widget.Overlay#configIframe\r
+*/\r
+YAHOO.widget.MenuModule.prototype.configPosition = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";\r
+    \r
+        this._oDom.setStyle(this.element, "position", sCSSPosition);\r
+    \r
+    };\r
+\r
+\r
+// Public methods\r
+\r
+YAHOO.widget.MenuModule.prototype.toString = function() {\r
+\r
+    return ("Menu " + this.id);\r
+\r
+};\r
+\r
+\r
+/**\r
+* Sets the title of a group of items.\r
+* @param {String} p_sGroupTitle The title of the group.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the title belongs.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setItemGroupTitle = \r
+\r
+    function(p_sGroupTitle, p_nGroupIndex) {\r
+        \r
+        if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {\r
+    \r
+            var Dom = this._oDom;\r
+\r
+            var nGroupIndex = \r
+                    typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;\r
+    \r
+            var oTitle = this._aGroupTitleElements[nGroupIndex];\r
+    \r
+    \r
+            if(oTitle) {\r
+    \r
+                oTitle.innerHTML = p_sGroupTitle;\r
+                \r
+            }\r
+            else {\r
+    \r
+                oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);\r
+                        \r
+                oTitle.innerHTML = p_sGroupTitle;\r
+    \r
+                this._aGroupTitleElements[nGroupIndex] = oTitle;\r
+    \r
+            }\r
+    \r
+    \r
+            var i = this._aGroupTitleElements.length - 1;\r
+            var nFirstIndex;\r
+    \r
+            do {\r
+    \r
+                if(this._aGroupTitleElements[i]) {\r
+    \r
+                    Dom.removeClass(\r
+                        this._aGroupTitleElements[i],\r
+                        "first-of-type"\r
+                    );\r
+\r
+                    nFirstIndex = i;\r
+    \r
+                }\r
+    \r
+            }\r
+            while(i--);\r
+    \r
+    \r
+            if(nFirstIndex !== null) {\r
+    \r
+                Dom.addClass(\r
+                    this._aGroupTitleElements[nFirstIndex], \r
+                    "first-of-type"\r
+                );\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Appends the specified item to a MenuModule instance.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be added.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was added to the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.addItem = function(p_oItem, p_nGroupIndex) {\r
+\r
+    if(p_oItem) {\r
+\r
+        return this._addItemToGroup(p_nGroupIndex, p_oItem);\r
+        \r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Inserts an item into a MenuModule instance at the specified index.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be inserted.\r
+* @param {Number} p_nItemIndex Number indicating the ordinal position \r
+* at which the item should be added.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was inserted into the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.insertItem = \r
+\r
+    function(p_oItem, p_nItemIndex, p_nGroupIndex) {\r
+    \r
+        if(p_oItem) {\r
+    \r
+            return this._addItemToGroup(p_nGroupIndex, p_oItem, p_nItemIndex);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Removes the specified item from a MenuModule instance.\r
+* @param {YAHOO.widget.MenuModuleItem/Number} p_oObject The item or index of \r
+* the item to be removed.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was removed from the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.removeItem =\r
+\r
+    function(p_oObject, p_nGroupIndex) {\r
+    \r
+        if(typeof p_oObject != "undefined") {\r
+    \r
+            var oItem;\r
+    \r
+            if(p_oObject instanceof YAHOO.widget.MenuModuleItem) {\r
+    \r
+                oItem = \r
+                    this._removeItemFromGroupByValue(p_nGroupIndex, p_oObject);           \r
+    \r
+            }\r
+            else if(typeof p_oObject == "number") {\r
+    \r
+                oItem = \r
+                    this._removeItemFromGroupByIndex(p_nGroupIndex, p_oObject);\r
+    \r
+            }\r
+    \r
+            if(oItem) {\r
+    \r
+                oItem.destroy();\r
+\r
+                this.logger.log("Item removed." + \r
+                    " Text: " + oItem.cfg.getProperty("text") + ", " + \r
+                    " Index: " + oItem.index + ", " + \r
+                    " Group Index: " + oItem.groupIndex);\r
+    \r
+                return oItem;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Returns a multi-dimensional array of all of a MenuModule's items.\r
+* @return An array of items.\r
+* @type Array\r
+*/        \r
+YAHOO.widget.MenuModule.prototype.getItemGroups = function() {\r
+\r
+    return this._aItemGroups;\r
+\r
+};\r
+\r
+\r
+/**\r
+* Returns the item at the specified index.\r
+* @param {Number} p_nItemIndex Number indicating the ordinal position of the \r
+* item to be retrieved.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return An item.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.getItem = \r
+\r
+    function(p_nItemIndex, p_nGroupIndex) {\r
+    \r
+        if(typeof p_nItemIndex == "number") {\r
+    \r
+            var aGroup = this._getItemGroup(p_nGroupIndex);\r
+    \r
+            if(aGroup) {\r
+    \r
+                return aGroup[p_nItemIndex];\r
+            \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Removes the MenuModule instance's element from the DOM and sets all child \r
+* elements to null.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.destroy = function() {\r
+\r
+    // Remove DOM event handlers\r
+\r
+    this._oEventUtil.purgeElement(this.element);\r
+\r
+\r
+    // Remove Custom Event listeners\r
+\r
+    this.mouseOverEvent.unsubscribeAll();\r
+    this.mouseOutEvent.unsubscribeAll();\r
+    this.mouseDownEvent.unsubscribeAll();\r
+    this.mouseUpEvent.unsubscribeAll();\r
+    this.clickEvent.unsubscribeAll();\r
+    this.keyPressEvent.unsubscribeAll();\r
+    this.keyDownEvent.unsubscribeAll();\r
+    this.keyUpEvent.unsubscribeAll();\r
+    this.beforeMoveEvent.unsubscribeAll();\r
+\r
+\r
+    var nItemGroups = this._aItemGroups.length;\r
+    var nItems;\r
+    var oItemGroup;\r
+    var oItem;\r
+    var i;\r
+    var n;\r
+\r
+\r
+    // Remove all items\r
+\r
+    if(nItemGroups > 0) {\r
+\r
+        i = nItemGroups - 1;\r
+\r
+        do {\r
+\r
+            oItemGroup = this._aItemGroups[i];\r
+\r
+            if(oItemGroup) {\r
+\r
+                nItems = oItemGroup.length;\r
+    \r
+                if(nItems > 0) {\r
+    \r
+                    n = nItems - 1;\r
+        \r
+                    do {\r
+\r
+                        oItem = this._aItemGroups[i][n];\r
+\r
+                        if(oItem) {\r
+        \r
+                            oItem.destroy();\r
+                        }\r
+        \r
+                    }\r
+                    while(n--);\r
+    \r
+                }\r
+\r
+            }\r
+\r
+        }\r
+        while(i--);\r
+\r
+    }        \r
+\r
+\r
+    // Continue with the superclass implementation of this method\r
+\r
+    YAHOO.widget.MenuModule.superclass.destroy.call(this);\r
+    \r
+    this.logger.log("Destroyed.");\r
+\r
+};\r
+\r
+\r
+\r
+\r
+/**\r
+* Sets focus to a MenuModule instance's first enabled item.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setInitialFocus = function() {\r
+\r
+    var oItem = this._getFirstEnabledItem();\r
+    \r
+    if(oItem) {\r
+    \r
+        oItem.focus();\r
+    }\r
+    \r
+};\r
+\r
+\r
+/**\r
+* Sets the "selected" configuration property of a MenuModule instance's first\r
+* enabled item to "true."\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setInitialSelection = function() {\r
+\r
+    var oItem = this._getFirstEnabledItem();\r
+    \r
+    if(oItem) {\r
+    \r
+        oItem.cfg.setProperty("selected", true);\r
+    }        \r
+\r
+};\r
+\r
+\r
+/**\r
+* Sets the "selected" configuration property of a MenuModule instance's active \r
+* item to "false," blurs the item and hide's the item's submenu.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.clearActiveItem = function () {\r
+\r
+    if(this.activeItem) {\r
+\r
+        var oConfig = this.activeItem.cfg;\r
+\r
+        oConfig.setProperty("selected", false);\r
+\r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+\r
+        if(oSubmenu) {\r
+\r
+            oSubmenu.hide();\r
+\r
+        }\r
+\r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* the MenuModule's Config object (cfg).\r
+*/\r
+YAHOO.widget.MenuModule.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.MenuModule.superclass.initDefaultConfig.call(this);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+       // Add configuration properties\r
+\r
+    oConfig.addProperty(\r
+        "position", \r
+        {\r
+            value: "dynamic", \r
+            handler: this.configPosition, \r
+            validator: this._checkPosition \r
+        } \r
+    );\r
+\r
+    oConfig.refireEvent("position");\r
+\r
+    oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );\r
+\r
+};\r
+\r
+\r
+\r
+/**\r
+* @class The MenuModuleItem class allows you to create and modify an item for a\r
+* MenuModule instance.\r
+* @constructor\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuModuleItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModuleItem = function(p_oObject, p_oConfig) {\r
+\r
+    if(p_oObject) {\r
+\r
+        this.init(p_oObject, p_oConfig);\r
+\r
+    }\r
+\r
+};\r
+\r
+YAHOO.widget.MenuModuleItem.prototype = {\r
+\r
+    // Constants\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator.\r
+    * @final\r
+    * @type String\r
+    */\r
+    SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",\r
+\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator when a MenuModuleItem instance is selected.\r
+    * @final\r
+    * @type String\r
+    */\r
+    SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: \r
+        "nt/ic/ut/alt1/menuarorght8_hov_1.gif",\r
+\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator when a MenuModuleItem instance is disabled.\r
+    * @final\r
+    * @type String\r
+    */\r
+    DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: \r
+        "nt/ic/ut/alt1/menuarorght8_dim_1.gif",\r
+\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator.\r
+    * @final\r
+    * @type String\r
+    */\r
+    COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed.  Click to expand.",\r
+\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator when the submenu is visible.\r
+    * @final\r
+    * @type String\r
+    */\r
+    EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded.  Click to collapse.",\r
+\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator when a MenuModuleItem instance is disabled.\r
+    * @final\r
+    * @type String\r
+    */\r
+    DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",\r
+\r
+\r
+    /**\r
+    * Constant representing the CSS class(es) to be applied to the root \r
+    * HTMLLIElement of the MenuModuleItem.\r
+    * @final\r
+    * @type String\r
+    */\r
+    CSS_CLASS_NAME: "yuimenuitem",\r
+\r
+\r
+    /**\r
+    * Constant representing the type of menu to instantiate when creating \r
+    * submenu instances from parsing the child nodes (either HTMLSelectElement \r
+    * or HTMLDivElement) of the item's DOM.  The default \r
+    * is YAHOO.widget.MenuModule.\r
+    * @final\r
+    * @type YAHOO.widget.MenuModule\r
+    */\r
+    SUBMENU_TYPE: null,\r
+\r
+\r
+    /**\r
+    * Constant representing the type of item to instantiate when \r
+    * creating item instances from parsing the child nodes (either \r
+    * HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+    * submenu's DOM.  \r
+    * The default is YAHOO.widget.MenuModuleItem.\r
+    * @final\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    SUBMENU_ITEM_TYPE: null,\r
+\r
+\r
+    /**\r
+    * Constant representing the prefix path to use for non-secure images\r
+    * @type string\r
+    */\r
+    IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",\r
+    \r
+\r
+    /**\r
+    * Constant representing the prefix path to use for securely served images\r
+    * @type string\r
+    */\r
+    IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",\r
+\r
+\r
+    // Private member variables\r
+    \r
+    /**\r
+    * Reference to the HTMLAnchorElement of the MenuModuleItem's core internal\r
+    * DOM structure.\r
+    * @private\r
+    * @type {HTMLAnchorElement}\r
+    */\r
+    _oAnchor: null,\r
+    \r
+\r
+    /**\r
+    * Reference to the text node of the MenuModuleItem's core internal\r
+    * DOM structure.\r
+    * @private\r
+    * @type {Text}\r
+    */\r
+    _oText: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the HTMLElement (&#60;EM&#60;) used to create the optional\r
+    * help text for a MenuModuleItem instance.\r
+    * @private\r
+    * @type {HTMLElement}\r
+    */\r
+    _oHelpTextEM: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the submenu for a MenuModuleItem instance.\r
+    * @private\r
+    * @type {YAHOO.widget.MenuModule}\r
+    */\r
+    _oSubmenu: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the Dom utility singleton.\r
+    * @private\r
+    * @type {YAHOO.util.Dom}\r
+    */\r
+    _oDom: YAHOO.util.Dom,\r
+\r
+\r
+    // Public properties\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type YAHOO.widget.MenuModuleItem\r
+       */\r
+       constructor: YAHOO.widget.MenuModuleItem,\r
+\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot: null,\r
+\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context \r
+       * is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure: YAHOO.widget.Module.prototype.isSecure,\r
+\r
+\r
+    /**\r
+    * Returns the ordinal position of a MenuModuleItem instance in a group.\r
+    * @type Number\r
+    */\r
+    index: null,\r
+\r
+\r
+    /**\r
+    * Returns the index of the group to which a MenuModuleItem instance belongs.\r
+    * @type Number\r
+    */\r
+    groupIndex: null,\r
+\r
+\r
+    /**\r
+    * Returns the parent object for a MenuModuleItem instance.\r
+    * @type {YAHOO.widget.MenuModule}\r
+    */\r
+    parent: null,\r
+\r
+\r
+    /**\r
+    * Returns the HTMLLIElement for a MenuModuleItem instance.\r
+    * @type {HTMLLIElement}\r
+    */\r
+    element: null,\r
+\r
+\r
+    /**\r
+    * Returns the HTMLElement (either HTMLLIElement, HTMLOptGroupElement or\r
+    * HTMLOptionElement) used create the MenuModuleItem instance.\r
+    * @type {HTMLLIElement/HTMLOptGroupElement/HTMLOptionElement}\r
+    */\r
+    srcElement: null,\r
+\r
+\r
+    /**\r
+    * Specifies an arbitrary value for a MenuModuleItem instance.\r
+    * @type {Object}\r
+    */\r
+    value: null,\r
+\r
+\r
+    /**\r
+    * Reference to the HTMLImageElement used to create the submenu\r
+    * indicator for a MenuModuleItem instance.\r
+    * @type {HTMLImageElement}\r
+    */\r
+    submenuIndicator: null,\r
+\r
+\r
+       /**\r
+       * String representing the browser\r
+       * @type string\r
+       */\r
+       browser: YAHOO.widget.Module.prototype.browser,\r
+\r
+\r
+    // Events\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instances's HTMLLIElement is removed from\r
+    * it's parent HTMLUListElement node.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    destroyEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the mouse has entered a MenuModuleItem instance.  Passes\r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseOverEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the mouse has left a MenuModuleItem instance.  Passes back  \r
+    * the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseOutEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user mouses down on a MenuModuleItem instance.  Passes \r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseDownEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user releases a mouse button while the mouse is \r
+    * over a MenuModuleItem instance.  Passes back the DOM Event object as\r
+    * an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseUpEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user clicks the on a MenuModuleItem instance.  Passes \r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    clickEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user presses an alphanumeric key.  Passes back the \r
+    * DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyPressEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user presses a key.  Passes back the DOM Event \r
+    * object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyDownEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when the user releases a key.  Passes back the DOM Event \r
+    * object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyUpEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instance receives focus.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    focusEvent: null,\r
+\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instance loses the input focus.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    blurEvent: null,\r
+\r
+\r
+    /**\r
+    * The MenuModuleItem class's initialization method. This method is \r
+    * automatically called by the constructor, and sets up all DOM references \r
+    * for pre-existing markup, and creates required markup if it is not\r
+    * already present.\r
+    * @param {String or HTMLElement} p_oObject String or HTMLElement \r
+    * (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+    * source HTMLElement node.\r
+    * @param {Object} p_oConfig The configuration object literal containing \r
+    * the configuration for a MenuModuleItem instance. See the configuration \r
+    * class documentation for more details.\r
+    */\r
+    init: function(p_oObject, p_oConfig) {\r
+\r
+        this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;\r
+\r
+\r
+        if(!this.SUBMENU_TYPE) {\r
+    \r
+            this.SUBMENU_TYPE = YAHOO.widget.MenuModule;\r
+    \r
+        }\r
+\r
+        if(!this.SUBMENU_ITEM_TYPE) {\r
+    \r
+            this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuModuleItem;\r
+    \r
+        }\r
+\r
+\r
+        // Create the config object\r
+\r
+        this.cfg = new YAHOO.util.Config(this);\r
+\r
+        this.initDefaultConfig();\r
+\r
+        var oConfig = this.cfg;\r
+\r
+\r
+        if(this._checkString(p_oObject)) {\r
+\r
+            this._createRootNodeStructure();\r
+\r
+            oConfig.setProperty("text", p_oObject);\r
+\r
+        }\r
+        else if(this._checkDOMNode(p_oObject)) {\r
+\r
+            switch(p_oObject.tagName) {\r
+\r
+                case "OPTION":\r
+\r
+                    this._createRootNodeStructure();\r
+\r
+                    oConfig.setProperty("text", p_oObject.text);\r
+\r
+                    this.srcElement = p_oObject;\r
+\r
+                break;\r
+\r
+                case "OPTGROUP":\r
+\r
+                    this._createRootNodeStructure();\r
+\r
+                    oConfig.setProperty("text", p_oObject.label);\r
+\r
+                    this.srcElement = p_oObject;\r
+\r
+                    this._initSubTree();\r
+\r
+                break;\r
+\r
+                case "LI":\r
+\r
+                    // Get the anchor node (if it exists)\r
+\r
+                    var oAnchor = this._getFirstElement(p_oObject, "A");\r
+                    var sURL = "#";\r
+                    var sText = null;\r
+\r
+\r
+                    // Capture the "text" and/or the "URL"\r
+\r
+                    if(oAnchor) {\r
+\r
+                        sURL = oAnchor.getAttribute("href");\r
+\r
+                        if(oAnchor.innerText) {\r
+                \r
+                            sText = oAnchor.innerText;\r
+                \r
+                        }\r
+                        else {\r
+                \r
+                            var oRange = oAnchor.ownerDocument.createRange();\r
+                \r
+                            oRange.selectNodeContents(oAnchor);\r
+                \r
+                            sText = oRange.toString();             \r
+                \r
+                        }\r
+\r
+                    }\r
+                    else {\r
+\r
+                        var oText = p_oObject.firstChild;\r
+\r
+                        sText = oText.nodeValue;\r
+\r
+                        oAnchor = document.createElement("a");\r
+                        \r
+                        oAnchor.setAttribute("href", sURL);\r
+\r
+                        p_oObject.replaceChild(oAnchor, oText);\r
+                        \r
+                        oAnchor.appendChild(oText);\r
+\r
+                    }\r
+\r
+\r
+                    this.srcElement = p_oObject;\r
+                    this.element = p_oObject;\r
+                    this._oAnchor = oAnchor;\r
+    \r
+\r
+                    // Check if emphasis has been applied to the MenuModuleItem\r
+\r
+                    var oEmphasisNode = this._getFirstElement(oAnchor);\r
+                    var bEmphasis = false;\r
+                    var bStrongEmphasis = false;\r
+\r
+                    if(oEmphasisNode) {\r
+\r
+                        // Set a reference to the text node \r
+\r
+                        this._oText = oEmphasisNode.firstChild;\r
+\r
+                        switch(oEmphasisNode.tagName) {\r
+\r
+                            case "EM":\r
+\r
+                                bEmphasis = true;\r
+\r
+                            break;\r
+\r
+                            case "STRONG":\r
+\r
+                                bStrongEmphasis = true;\r
+\r
+                            break;\r
+\r
+                        }\r
+\r
+                    }\r
+                    else {\r
+\r
+                        // Set a reference to the text node \r
+\r
+                        this._oText = oAnchor.firstChild;\r
+\r
+                    }\r
+\r
+\r
+                    /*\r
+                        Set these properties silently to sync up the \r
+                        configuration object without making changes to the \r
+                        element's DOM\r
+                    */ \r
+\r
+                    oConfig.setProperty("text", sText, true);\r
+                    oConfig.setProperty("url", sURL, true);\r
+                    oConfig.setProperty("emphasis", bEmphasis, true);\r
+                    oConfig.setProperty(\r
+                        "strongemphasis", \r
+                        bStrongEmphasis, \r
+                        true\r
+                    );\r
+\r
+                    this._initSubTree();\r
+\r
+                break;\r
+\r
+            }            \r
+\r
+        }\r
+\r
+\r
+        if(this.element) {\r
+\r
+\r
+            this._oDom.addClass(this.element, this.CSS_CLASS_NAME);\r
+\r
+\r
+            // Create custom events\r
+    \r
+            var CustomEvent = YAHOO.util.CustomEvent;\r
+    \r
+            this.destroyEvent = new CustomEvent("destroyEvent", this);\r
+            this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);\r
+            this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);\r
+            this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);\r
+            this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);\r
+            this.clickEvent = new CustomEvent("clickEvent", this);\r
+            this.keyPressEvent = new CustomEvent("keyPressEvent", this);\r
+            this.keyDownEvent = new CustomEvent("keyDownEvent", this);\r
+            this.keyUpEvent = new CustomEvent("keyUpEvent", this);\r
+            this.focusEvent = new CustomEvent("focusEvent", this);\r
+            this.blurEvent = new CustomEvent("blurEvent", this);\r
+\r
+\r
+            if(p_oConfig) {\r
+    \r
+                oConfig.applyConfig(p_oConfig);\r
+    \r
+            }        \r
+\r
+            oConfig.fireQueue();\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    // Private methods\r
+\r
+    /**\r
+    * Returns an HTMLElement's first HTMLElement node\r
+    * @private\r
+    * @param {HTMLElement} p_oElement The element to be evaluated.\r
+    * @param {String} p_sTagName Optional. The tagname of the element.\r
+    * @return Returns an HTMLElement node.\r
+    * @type Boolean\r
+    */\r
+    _getFirstElement: function(p_oElement, p_sTagName) {\r
+\r
+        var oElement;\r
+\r
+        if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {\r
+\r
+            oElement = p_oElement.firstChild;\r
+\r
+        }\r
+        else if(\r
+            p_oElement.firstChild && \r
+            p_oElement.firstChild.nextSibling && \r
+            p_oElement.firstChild.nextSibling.nodeType == 1\r
+        ) {\r
+\r
+            oElement = p_oElement.firstChild.nextSibling;\r
+\r
+        }\r
+\r
+\r
+        if(p_sTagName) {\r
+\r
+            return (oElement && oElement.tagName == p_sTagName) ? \r
+                oElement : false;\r
+\r
+        }\r
+\r
+        return oElement;\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Determines if an object is a string\r
+    * @private\r
+    * @param {Object} p_oObject The object to be evaluated.\r
+    * @return Returns true if the object is a string.\r
+    * @type Boolean\r
+    */\r
+    _checkString: function(p_oObject) {\r
+\r
+        return (typeof p_oObject == "string");\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Determines if an object is an HTMLElement.\r
+    * @private\r
+    * @param {Object} p_oObject The object to be evaluated.\r
+    * @return Returns true if the object is an HTMLElement.\r
+    * @type Boolean\r
+    */\r
+    _checkDOMNode: function(p_oObject) {\r
+\r
+        return (p_oObject && p_oObject.tagName);\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Creates the core DOM structure for a MenuModuleItem instance.\r
+    * @private\r
+    */\r
+    _createRootNodeStructure: function () {\r
+\r
+        this.element = document.createElement("li");\r
+\r
+        this._oText = document.createTextNode("");\r
+\r
+        this._oAnchor = document.createElement("a");\r
+        this._oAnchor.appendChild(this._oText);\r
+        \r
+        this.cfg.refireEvent("url");\r
+\r
+        this.element.appendChild(this._oAnchor);            \r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Iterates the source element's childNodes collection and uses the  \r
+    * child nodes to instantiate other menus.\r
+    * @private\r
+    */\r
+    _initSubTree: function() {\r
+\r
+        var Menu = this.SUBMENU_TYPE;\r
+        var MenuModuleItem = this.SUBMENU_ITEM_TYPE;\r
+        var oSrcEl = this.srcElement;\r
+        var oConfig = this.cfg;\r
+\r
+\r
+        if(oSrcEl.childNodes.length > 0) {\r
+\r
+            var oNode = oSrcEl.firstChild;\r
+            var aOptions = [];\r
+\r
+            do {\r
+\r
+                switch(oNode.tagName) {\r
+        \r
+                    case "DIV":\r
+        \r
+                        oConfig.setProperty("submenu", (new Menu(oNode)));\r
+        \r
+                    break;\r
\r
+                    case "OPTION":\r
+\r
+                        aOptions[aOptions.length] = oNode;\r
+\r
+                    break;\r
+       \r
+                }\r
+            \r
+            }        \r
+            while((oNode = oNode.nextSibling));\r
+\r
+\r
+            var nOptions = aOptions.length;\r
+\r
+            if(nOptions > 0) {\r
+    \r
+                oConfig.setProperty(\r
+                    "submenu", \r
+                    (new Menu(this._oDom.generateId()))\r
+                );\r
+    \r
+                for(var n=0; n<nOptions; n++) {\r
+    \r
+                    this._oSubmenu.addItem((new MenuModuleItem(aOptions[n])));\r
+    \r
+                }\r
+    \r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    // Event handlers for configuration properties\r
+\r
+    /**\r
+    * Event handler for when the "text" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */\r
+    configText: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var sText = p_aArgs[0];\r
+\r
+\r
+        if(this._oText) {\r
+\r
+            this._oText.nodeValue = sText;\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "helptext" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configHelpText: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var me = this;\r
+        var Dom = this._oDom;\r
+        var oHelpText = p_aArgs[0];\r
+        var oEl = this.element;\r
+        var oConfig = this.cfg;\r
+        var aNodes = [oEl, this._oAnchor];\r
+        var oImg = this.submenuIndicator;\r
+\r
+\r
+        /**\r
+        * Adds the "hashelptext" class to the necessary nodes and refires the \r
+        * "selected" and "disabled" configuration events\r
+        * @ignore\r
+        */\r
+        function initHelpText() {\r
+\r
+            Dom.addClass(aNodes, "hashelptext");\r
+\r
+            if(oConfig.getProperty("disabled")) {\r
+\r
+                oConfig.refireEvent("disabled");\r
+\r
+            }\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.refireEvent("selected");\r
+\r
+            }                \r
+\r
+        }\r
+\r
+\r
+        /**\r
+        * Removes the "hashelptext" class and corresponding DOM element (EM)\r
+        * @ignore\r
+        */\r
+        function removeHelpText() {\r
+\r
+            Dom.removeClass(aNodes, "hashelptext");\r
+\r
+            oEl.removeChild(me._oHelpTextEM);\r
+            me._oHelpTextEM = null;\r
+\r
+        }\r
+\r
+\r
+        if(this._checkDOMNode(oHelpText)) {\r
+\r
+            if(this._oHelpTextEM) {\r
+\r
+                this._oHelpTextEM.parentNode.replaceChild(\r
+                    oHelpText, \r
+                    this._oHelpTextEM\r
+                );\r
+\r
+            }\r
+            else {\r
+\r
+                this._oHelpTextEM = oHelpText;\r
+\r
+                oEl.insertBefore(this._oHelpTextEM, oImg);\r
+\r
+            }\r
+\r
+            initHelpText();\r
+\r
+        }\r
+        else if(this._checkString(oHelpText)) {\r
+\r
+            if(oHelpText.length === 0) {\r
+\r
+                removeHelpText();\r
+\r
+            }\r
+            else {\r
+\r
+                if(!this._oHelpTextEM) {\r
+\r
+                    this._oHelpTextEM = document.createElement("em");\r
+\r
+                    oEl.insertBefore(this._oHelpTextEM, oImg);\r
+\r
+                }\r
+\r
+                this._oHelpTextEM.innerHTML = oHelpText;\r
+\r
+                initHelpText();\r
+\r
+            }\r
+\r
+        }\r
+        else if(!oHelpText && this._oHelpTextEM) {\r
+\r
+            removeHelpText();\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "url" configuration property of\r
+    * a MenuModuleItem instance changes.  \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configURL: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var sURL = p_aArgs[0];\r
+\r
+        if(!sURL) {\r
+\r
+            sURL = "#";\r
+\r
+        }\r
+\r
+        this._oAnchor.setAttribute("href", sURL);\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "emphasis" configuration property of\r
+    * a MenuModuleItem instance changes.  \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configEmphasis: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bEmphasis = p_aArgs[0];\r
+        var oAnchor = this._oAnchor;\r
+        var oText = this._oText;\r
+        var oConfig = this.cfg;\r
+        var oEM;\r
+\r
+\r
+        if(bEmphasis && oConfig.getProperty("strongemphasis")) {\r
+\r
+            oConfig.setProperty("strongemphasis", false);\r
+\r
+        }\r
+\r
+\r
+        if(oAnchor) {\r
+\r
+            if(bEmphasis) {\r
+\r
+                oEM = document.createElement("em");\r
+                oEM.appendChild(oText);\r
+\r
+                oAnchor.appendChild(oEM);\r
+\r
+            }\r
+            else {\r
+\r
+                oEM = this._getFirstElement(oAnchor, "EM");\r
+\r
+                oAnchor.removeChild(oEM);\r
+                oAnchor.appendChild(oText);\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "strongemphasis" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bStrongEmphasis = p_aArgs[0];\r
+        var oAnchor = this._oAnchor;\r
+        var oText = this._oText;\r
+        var oConfig = this.cfg;\r
+        var oStrong;\r
+\r
+        if(bStrongEmphasis && oConfig.getProperty("emphasis")) {\r
+\r
+            oConfig.setProperty("emphasis", false);\r
+\r
+        }\r
+\r
+        if(oAnchor) {\r
+\r
+            if(bStrongEmphasis) {\r
+\r
+                oStrong = document.createElement("strong");\r
+                oStrong.appendChild(oText);\r
+\r
+                oAnchor.appendChild(oStrong);\r
+\r
+            }\r
+            else {\r
+\r
+                oStrong = this._getFirstElement(oAnchor, "STRONG");\r
+\r
+                oAnchor.removeChild(oStrong);\r
+                oAnchor.appendChild(oText);\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "disabled" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configDisabled: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bDisabled = p_aArgs[0];\r
+        var Dom = this._oDom;\r
+        var oAnchor = this._oAnchor;\r
+        var aNodes = [this.element, oAnchor];\r
+        var oEM = this._oHelpTextEM;\r
+        var oConfig = this.cfg;\r
+        var oImg = this.submenuIndicator;\r
+        var sImageSrc;\r
+        var sImageAlt;\r
+\r
+\r
+        if(oEM) {\r
+\r
+            aNodes[2] = oEM;\r
+\r
+        }\r
+\r
+        if(bDisabled) {\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.setProperty("selected", false);\r
+\r
+            }\r
+\r
+            oAnchor.removeAttribute("href");\r
+\r
+            Dom.addClass(aNodes, "disabled");\r
+\r
+            sImageSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;\r
+            sImageAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+        }\r
+        else {\r
+\r
+            oAnchor.setAttribute("href", oConfig.getProperty("url"));\r
+\r
+            Dom.removeClass(aNodes, "disabled");\r
+\r
+            sImageSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;\r
+            sImageAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+        }\r
+\r
+\r
+        if(oImg) {\r
+\r
+            oImg.src = this.imageRoot + sImageSrc;\r
+            oImg.alt = sImageAlt;\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "selected" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configSelected: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        if(!this.cfg.getProperty("disabled")) {\r
+\r
+            var Dom = this._oDom;\r
+            var bSelected = p_aArgs[0];\r
+            var oEM = this._oHelpTextEM;\r
+            var aNodes = [this.element, this._oAnchor];\r
+            var oImg = this.submenuIndicator;\r
+            var sImageSrc;\r
+\r
+\r
+            if(oEM) {\r
+    \r
+                aNodes[2] = oEM;  \r
+    \r
+            }\r
+    \r
+            if(bSelected) {\r
+    \r
+                Dom.addClass(aNodes, "selected");\r
+                sImageSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;\r
+    \r
+            }\r
+            else {\r
+    \r
+                Dom.removeClass(aNodes, "selected");\r
+                sImageSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;\r
+    \r
+            }\r
+    \r
+            if(oImg) {\r
+    \r
+                oImg.src = document.images[(this.imageRoot + sImageSrc)].src;\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Event handler for when the "submenu" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */\r
+    configSubmenu: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var Dom = this._oDom;\r
+        var oEl = this.element;\r
+        var oSubmenu = p_aArgs[0];\r
+        var oImg = this.submenuIndicator;\r
+        var oConfig = this.cfg;\r
+        var aNodes = [this.element, this._oAnchor];\r
+\r
+\r
+        if(oSubmenu) {\r
+\r
+            // Set the submenu's parent to this MenuModuleItem instance\r
+\r
+            oSubmenu.parent = this;\r
+\r
+            this._oSubmenu = oSubmenu;\r
+\r
+\r
+            if(!oImg) { \r
+\r
+                var me = this;\r
+\r
+                function preloadImage(p_sPath) {\r
+\r
+                    var sPath = me.imageRoot + p_sPath;\r
+\r
+                    if(!document.images[sPath]) {\r
+\r
+                        var oImg = document.createElement("img");\r
+                        oImg.src = sPath;\r
+                        oImg.name = sPath;\r
+                        oImg.id = sPath;\r
+                        oImg.style.display = "none";\r
+                        \r
+                        document.body.appendChild(oImg);\r
+\r
+                    }\r
+                \r
+                }\r
+\r
+                preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);\r
+                preloadImage(this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);\r
+                preloadImage(this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);\r
+\r
+                oImg = document.createElement("img");\r
+                oImg.src = (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);\r
+                oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+                oEl.appendChild(oImg);\r
+\r
+                this.submenuIndicator = oImg;\r
+\r
+                Dom.addClass(aNodes, "hassubmenu");\r
+\r
+\r
+                if(oConfig.getProperty("disabled")) {\r
+\r
+                    oConfig.refireEvent("disabled");\r
+\r
+                }\r
+\r
+                if(oConfig.getProperty("selected")) {\r
+\r
+                    oConfig.refireEvent("selected");\r
+\r
+                }                \r
+\r
+            }\r
+\r
+        }\r
+        else {\r
+\r
+            Dom.removeClass(aNodes, "hassubmenu");\r
+\r
+            if(oImg) {\r
+\r
+                oEl.removeChild(oImg);\r
+\r
+            }\r
+\r
+            if(this._oSubmenu) {\r
+\r
+                this._oSubmenu.destroy();\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    // Public methods\r
+\r
+       /**\r
+       * Initializes an item's configurable properties.\r
+       */\r
+       initDefaultConfig : function() {\r
+\r
+        var oConfig = this.cfg;\r
+        var CheckBoolean = oConfig.checkBoolean;\r
+\r
+\r
+        // Define the config properties\r
+\r
+        oConfig.addProperty(\r
+            "text", \r
+            { \r
+                value: "", \r
+                handler: this.configText, \r
+                validator: this._checkString, \r
+                suppressEvent: true \r
+            }\r
+        );\r
+        \r
+        oConfig.addProperty("helptext", { handler: this.configHelpText });\r
+        \r
+        oConfig.addProperty(\r
+            "url", \r
+            { value: "#", handler: this.configURL, suppressEvent: true }\r
+        );\r
+        \r
+        oConfig.addProperty(\r
+            "emphasis", \r
+            { \r
+                value: false, \r
+                handler: this.configEmphasis, \r
+                validator: CheckBoolean, \r
+                suppressEvent: true \r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "strongemphasis",\r
+            {\r
+                value: false,\r
+                handler: this.configStrongEmphasis,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "disabled",\r
+            {\r
+                value: false,\r
+                handler: this.configDisabled,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "selected",\r
+            {\r
+                value: false,\r
+                handler: this.configSelected,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty("submenu", { handler: this.configSubmenu });\r
+\r
+       },\r
+\r
+\r
+    /**\r
+    * Finds the next enabled MenuModuleItem instance in a MenuModule instance \r
+    * @return Returns a MenuModuleItem instance.\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    getNextEnabledSibling: function() {\r
+\r
+        if(this.parent instanceof YAHOO.widget.MenuModule) {\r
+\r
+            var nGroupIndex = this.groupIndex;\r
+\r
+            /**\r
+            * Returns the next item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */\r
+            function getNextArrayItem(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] || \r
+                    getNextArrayItem(p_aArray, (p_nStartIndex+1));\r
+    \r
+            }\r
+    \r
+    \r
+            var aItemGroups = this.parent.getItemGroups();\r
+            var oNextItem;\r
+    \r
+    \r
+            if(this.index < (aItemGroups[nGroupIndex].length - 1)) {\r
+    \r
+                oNextItem = getNextArrayItem(\r
+                        aItemGroups[nGroupIndex], \r
+                        (this.index+1)\r
+                    );\r
+    \r
+            }\r
+            else {\r
+    \r
+                var nNextGroupIndex;\r
+    \r
+                if(nGroupIndex < (aItemGroups.length - 1)) {\r
+    \r
+                    nNextGroupIndex = nGroupIndex + 1;\r
+    \r
+                }\r
+                else {\r
+    \r
+                    nNextGroupIndex = 0;\r
+    \r
+                }\r
+    \r
+                var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);\r
+    \r
+                // Retrieve the first MenuModuleItem instance in the next group\r
+    \r
+                oNextItem = getNextArrayItem(aNextGroup, 0);\r
+    \r
+            }\r
+    \r
+            return oNextItem.cfg.getProperty("disabled") ? \r
+                        oNextItem.getNextEnabledSibling() : oNextItem;\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Finds the previous enabled MenuModuleItem instance in a \r
+    * MenuModule instance \r
+    * @return Returns a MenuModuleItem instance.\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    getPreviousEnabledSibling: function() {\r
+\r
+        if(this.parent instanceof YAHOO.widget.MenuModule) {\r
+\r
+            var nGroupIndex = this.groupIndex;\r
+\r
+            /**\r
+            * Returns the previous item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */\r
+            function getPreviousArrayItem(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] || \r
+                    getPreviousArrayItem(p_aArray, (p_nStartIndex-1));\r
+    \r
+            }\r
+\r
+\r
+            /**\r
+            * Get the index of the first item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */    \r
+            function getFirstItemIndex(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] ? \r
+                    p_nStartIndex : \r
+                    getFirstItemIndex(p_aArray, (p_nStartIndex+1));\r
+    \r
+            }\r
+    \r
+            var aItemGroups = this.parent.getItemGroups();\r
+            var oPreviousItem;\r
+    \r
+            if(\r
+                this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)\r
+            ) {\r
+    \r
+                oPreviousItem = \r
+                    getPreviousArrayItem(\r
+                        aItemGroups[nGroupIndex], \r
+                        (this.index-1)\r
+                    );\r
+    \r
+            }\r
+            else {\r
+    \r
+                var nPreviousGroupIndex;\r
+    \r
+                if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {\r
+    \r
+                    nPreviousGroupIndex = nGroupIndex - 1;\r
+    \r
+                }\r
+                else {\r
+    \r
+                    nPreviousGroupIndex = aItemGroups.length - 1;\r
+    \r
+                }\r
+    \r
+                var aPreviousGroup = \r
+                        getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);\r
+    \r
+                oPreviousItem = \r
+                    getPreviousArrayItem(\r
+                        aPreviousGroup, \r
+                        (aPreviousGroup.length - 1)\r
+                    );\r
+    \r
+            }\r
+    \r
+            return oPreviousItem.cfg.getProperty("disabled") ? \r
+                    oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Causes a MenuModuleItem instance to receive the focus and fires the\r
+    * focus event.\r
+    */\r
+    focus: function() {\r
+\r
+        var oParent = this.parent;\r
+        var oAnchor = this._oAnchor;\r
+        var oActiveItem = oParent.activeItem;\r
+\r
+        if(\r
+            !this.cfg.getProperty("disabled") && \r
+            oParent && \r
+            oParent.cfg.getProperty("visible")\r
+        ) {\r
+\r
+            if(oActiveItem) {\r
+\r
+                oActiveItem.blur();\r
+\r
+            }\r
+\r
+            oAnchor.focus();\r
+\r
+            /*\r
+                Opera 8.5 doesn't always focus the anchor if a MenuModuleItem\r
+                instance has a submenu, this is fixed by calling "focus"\r
+                twice.\r
+            */\r
+            if(oParent && this.browser == "opera" && this._oSubmenu) {\r
+\r
+                oAnchor.focus();\r
+\r
+            }\r
+\r
+            this.focusEvent.fire();\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+    /**\r
+    * Causes a MenuModuleItem instance to lose focus and fires the onblur event.\r
+    */    \r
+    blur: function() {\r
+\r
+        var oParent = this.parent;\r
+\r
+        if(\r
+            !this.cfg.getProperty("disabled") && \r
+            oParent && \r
+            this._oDom.getStyle(oParent.element, "visibility") == "visible"\r
+        ) {\r
+\r
+            this._oAnchor.blur();\r
+\r
+            this.blurEvent.fire();\r
+\r
+        }\r
+\r
+    },\r
+\r
+\r
+       /**\r
+       * Removes a MenuModuleItem instance's HTMLLIElement from it's parent\r
+    * HTMLUListElement node.\r
+       */\r
+    destroy: function() {\r
+\r
+        var oEl = this.element;\r
+\r
+        if(oEl) {\r
+\r
+            // Remove CustomEvent listeners\r
+    \r
+            this.mouseOverEvent.unsubscribeAll();\r
+            this.mouseOutEvent.unsubscribeAll();\r
+            this.mouseDownEvent.unsubscribeAll();\r
+            this.mouseUpEvent.unsubscribeAll();\r
+            this.clickEvent.unsubscribeAll();\r
+            this.keyPressEvent.unsubscribeAll();\r
+            this.keyDownEvent.unsubscribeAll();\r
+            this.keyUpEvent.unsubscribeAll();\r
+            this.focusEvent.unsubscribeAll();\r
+            this.blurEvent.unsubscribeAll();\r
+            this.cfg.configChangedEvent.unsubscribeAll();\r
+\r
+\r
+            // Remove the element from the parent node\r
+\r
+            var oParentNode = oEl.parentNode;\r
+\r
+            if(oParentNode) {\r
+\r
+                oParentNode.removeChild(oEl);\r
+\r
+                this.destroyEvent.fire();\r
+\r
+            }\r
+\r
+            this.destroyEvent.unsubscribeAll();\r
+\r
+        }\r
+\r
+    }\r
+\r
+};\r
+\r
+\r
+/**\r
+* @class Extends YAHOO.widget.MenuModule to provide a set of default mouse and \r
+* key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModule\r
+* @base YAHOO.widget.MenuModule\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a Menu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.Menu = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.Menu.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.MenuModule);\r
+\r
+\r
+/**\r
+* The Menu class's initialization method. This method is automatically \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a Menu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.Menu.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+\r
+    // Call the init of the superclass (YAHOO.widget.Menu)\r
+\r
+    YAHOO.widget.Menu.superclass.init.call(this, p_oElement);\r
+\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.Menu);\r
+\r
+\r
+    // Add event handlers\r
+\r
+    this.showEvent.subscribe(this._onMenuShow, this, true);\r
+    this.mouseOverEvent.subscribe(this._onMenuMouseOver, this, true);\r
+    this.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);\r
+\r
+\r
+    if(p_oConfig) {\r
+\r
+        this.cfg.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    this.initEvent.fire(YAHOO.widget.Menu);\r
+\r
+};\r
+\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "show" Custom Event handler for a menu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The menu that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuShow = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+\r
+        var oParent = this.parent;\r
+\r
+        if(oParent && oParent.parent instanceof YAHOO.widget.Menu) {\r
+\r
+            var aAlignment = oParent.parent.cfg.getProperty("submenualignment");\r
+    \r
+            this.cfg.setProperty(\r
+                "submenualignment", \r
+                [ aAlignment[0], aAlignment[1] ]\r
+            );\r
+        \r
+        }\r
+\r
+    };\r
+\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a Menu instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuMouseOver = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        /*\r
+            If the menu is a submenu, then select the menu's parent\r
+            MenuItem instance\r
+        */\r
+    \r
+        if(this.parent) {\r
+    \r
+            this.parent.cfg.setProperty("selected", true);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a Menu instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuKeyDown = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        if(this.cfg.getProperty("position") == "dynamic") {\r
+    \r
+            var oDOMEvent = p_aArgs[0];\r
+            var oParent = this.parent;\r
+        \r
+            if(oDOMEvent.keyCode == 27) { // Esc key\r
+        \r
+                this.hide();\r
+        \r
+                // Set focus to the parent MenuItem if one exists\r
+        \r
+                if(oParent) {\r
+        \r
+                    oParent.focus();\r
+\r
+                    if(oParent.parent instanceof YAHOO.widget.Menu) {\r
+\r
+                        oParent.cfg.setProperty("selected", true);\r
+        \r
+                    }\r
+\r
+                    YAHOO.util.Event.preventDefault(oDOMEvent);\r
+        \r
+                }\r
+            \r
+            }\r
+        \r
+        }\r
+    \r
+    };\r
+    \r
+\r
+// Public event handlers\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Menu.prototype.onDomResize = function(e, obj) {\r
+\r
+    if(!this._handleResize) {\r
+    \r
+        this._handleResize = true;\r
+        return;\r
+    \r
+    }\r
+\r
+    this.logger.log("Browser font sized changed.");\r
+\r
+    var me = this;\r
+    var oConfig = this.cfg;\r
+\r
+    if(oConfig.getProperty("position") == "dynamic") {\r
+\r
+        oConfig.setProperty("width", (this._getOffsetWidth() + "px"));\r
+        \r
+        if(this.parent && oConfig.getProperty("visible")) {\r
+\r
+            function align() {\r
+\r
+                me.align();\r
+            \r
+            }\r
+\r
+            window.setTimeout(align, 0);\r
+            \r
+        }\r
+\r
+    }\r
+\r
+    YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);\r
+\r
+};    \r
+\r
+\r
+/**\r
+* @class The MenuItem class allows you to create and modify an item for a\r
+* Menu instance.  MenuItem extends YAHOO.widget.MenuModuleItem to provide a \r
+* set of default mouse and key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModuleItem\r
+* @base YAHOO.widget.MenuModuleItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuItem, YAHOO.widget.MenuModuleItem);\r
+\r
+\r
+/**\r
+* The MenuItem class's initialization method. This method is automatically\r
+* called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuItem.prototype.init = function(p_oObject, p_oConfig) {\r
+\r
+    if(!this.SUBMENU_TYPE) {\r
+\r
+        this.SUBMENU_TYPE = YAHOO.widget.Menu;\r
+\r
+    }\r
+\r
+    if(!this.SUBMENU_ITEM_TYPE) {\r
+\r
+        this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+\r
+    /* \r
+        Call the init of the superclass (YAHOO.widget.MenuModuleItem)\r
+        Note: We don't pass the user config in here yet \r
+        because we only want it executed once, at the lowest \r
+        subclass level.\r
+    */ \r
+\r
+    YAHOO.widget.MenuItem.superclass.init.call(this, p_oObject);  \r
+\r
+\r
+    // Add event handlers to each "MenuItem" instance\r
+\r
+    this.keyDownEvent.subscribe(this._onKeyDown, this, true);\r
+    this.mouseOverEvent.subscribe(this._onMouseOver, this, true);\r
+    this.mouseOutEvent.subscribe(this._onMouseOut, this, true);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+\r
+    oConfig.fireQueue();\r
+\r
+};\r
+\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_nrm_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the selected \r
+* checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.SELECTED_CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_hov_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the disabled \r
+* checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_dim_1.gif";\r
+\r
+/**\r
+* Constant representing the alt text for the image to be used for the \r
+* checked image.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_ALT_TEXT = "Checked.";\r
+\r
+\r
+/**\r
+* Constant representing the alt text for the image to be used for the \r
+* checked image when the item is disabled.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_ALT_TEXT = \r
+    "Checked. (Item disabled.)";\r
+\r
+\r
+// Private properties\r
+\r
+/**\r
+* Reference to the HTMLImageElement used to create the checked\r
+* indicator for a MenuItem instance.\r
+* @private\r
+* @type {HTMLImageElement}\r
+*/\r
+YAHOO.widget.MenuItem.prototype._checkImage = null;\r
+\r
+\r
+// Private event handlers\r
+\r
+\r
+/**\r
+* "keydown" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onKeyDown = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oDOMEvent = p_aArgs[0];\r
+        var oParent = this.parent;\r
+        var oConfig = this.cfg;\r
+        var oMenuItem;\r
+    \r
+\r
+        switch(oDOMEvent.keyCode) {\r
+    \r
+            case 38:    // Up arrow\r
+            case 40:    // Down arrow\r
+    \r
+                if(\r
+                    this == oParent.activeItem && \r
+                    !oConfig.getProperty("selected")\r
+                ) {\r
+    \r
+                    oConfig.setProperty("selected", true);\r
+    \r
+                }\r
+                else {\r
+    \r
+                    var oNextItem = (oDOMEvent.keyCode == 38) ? \r
+                            this.getPreviousEnabledSibling() : \r
+                            this.getNextEnabledSibling();\r
+            \r
+                    if(oNextItem) {\r
+\r
+                        oParent.clearActiveItem();\r
+\r
+                        oNextItem.cfg.setProperty("selected", true);\r
+            \r
+                        oNextItem.focus();\r
+    \r
+                    }\r
+    \r
+                }\r
+    \r
+                Event.preventDefault(oDOMEvent);\r
+\r
+            break;\r
+            \r
+    \r
+            case 39:    // Right arrow\r
+\r
+                oParent.clearActiveItem();\r
+\r
+                oConfig.setProperty("selected", true);\r
+                \r
+                this.focus();\r
+\r
+\r
+                var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+                if(oSubmenu) {\r
+\r
+                    oSubmenu.show();\r
+                    oSubmenu.setInitialSelection();                    \r
+    \r
+                }\r
+                else if(\r
+                    YAHOO.widget.MenuBarItem && \r
+                    oParent.parent && \r
+                    oParent.parent instanceof YAHOO.widget.MenuBarItem\r
+                ) {\r
+\r
+                    oParent.hide();\r
+    \r
+                    // Set focus to the parent MenuItem if one exists\r
+    \r
+                    oMenuItem = oParent.parent;\r
+    \r
+                    if(oMenuItem) {\r
+    \r
+                        oMenuItem.focus();\r
+                        oMenuItem.cfg.setProperty("selected", true);\r
+    \r
+                    }                    \r
+                \r
+                }\r
+    \r
+                Event.preventDefault(oDOMEvent);\r
+\r
+            break;\r
+    \r
+    \r
+            case 37:    // Left arrow\r
+    \r
+                // Only hide if this this is a MenuItem of a submenu\r
+    \r
+                if(oParent.parent) {\r
+    \r
+                    oParent.hide();\r
+    \r
+                    // Set focus to the parent MenuItem if one exists\r
+    \r
+                    oMenuItem = oParent.parent;\r
+    \r
+                    if(oMenuItem) {\r
+    \r
+                        oMenuItem.focus();\r
+                        oMenuItem.cfg.setProperty("selected", true);\r
+    \r
+                    }\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;        \r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onMouseOver = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var oParent = this.parent;\r
+        var oConfig = this.cfg;\r
+        var oActiveItem = oParent.activeItem;\r
+    \r
+    \r
+        // Hide any other submenus that might be visible\r
+    \r
+        if(oActiveItem && oActiveItem != this) {\r
+    \r
+            oParent.clearActiveItem();\r
+    \r
+        }\r
+    \r
+    \r
+        // Select and focus the current MenuItem instance\r
+    \r
+        oConfig.setProperty("selected", true);\r
+        this.focus();\r
+    \r
+    \r
+        // Show the submenu for this instance\r
+    \r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            oSubmenu.show();\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "mouseout" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onMouseOut = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+    \r
+        var oConfig = this.cfg;\r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+\r
+        oConfig.setProperty("selected", false);\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            var oDOMEvent = p_aArgs[0];\r
+            var oRelatedTarget = YAHOO.util.Event.getRelatedTarget(oDOMEvent);\r
+    \r
+            if(\r
+                !(\r
+                    oRelatedTarget == oSubmenu.element || \r
+                    YAHOO.util.Dom.isAncestor(oSubmenu.element, oRelatedTarget)\r
+                )\r
+            ) {\r
+    \r
+                oSubmenu.hide();\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "checked" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configChecked =\r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+    \r
+        var Dom = YAHOO.util.Dom;\r
+        var bChecked = p_aArgs[0];\r
+        var oEl = this.element;\r
+        var oConfig = this.cfg;\r
+        var oImg;\r
+        \r
+\r
+        if(bChecked) {\r
+\r
+            var me = this;\r
+\r
+            function preloadImage(p_sPath) {\r
+\r
+                var sPath = me.imageRoot + p_sPath;\r
+\r
+                if(!document.images[sPath]) {\r
+\r
+                    var oImg = document.createElement("img");\r
+                    oImg.src = sPath;\r
+                    oImg.name = sPath;\r
+                    oImg.id = sPath;\r
+                    oImg.style.display = "none";\r
+                    \r
+                    document.body.appendChild(oImg);\r
+\r
+                }\r
+            \r
+            }\r
+\r
+            preloadImage(this.CHECKED_IMAGE_PATH);\r
+            preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);\r
+            preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);\r
+\r
+\r
+            oImg = document.createElement("img");\r
+            oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);\r
+            oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;\r
+\r
+            var oSubmenu = this.cfg.getProperty("submenu");\r
+\r
+            if(oSubmenu) {\r
+\r
+                oEl.insertBefore(oImg, oSubmenu.element);\r
+\r
+            }\r
+            else {\r
+\r
+                oEl.appendChild(oImg);            \r
+\r
+            }\r
+\r
+\r
+            Dom.addClass([oEl, oImg], "checked");\r
+\r
+            this._checkImage = oImg;\r
+\r
+            if(oConfig.getProperty("disabled")) {\r
+\r
+                oConfig.refireEvent("disabled");\r
+\r
+            }\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.refireEvent("selected");\r
+\r
+            }\r
+        \r
+        }\r
+        else {\r
+\r
+            oImg = this._checkImage;\r
+\r
+            Dom.removeClass([oEl, oImg], "checked");\r
+\r
+            if(oImg) {\r
+\r
+                oEl.removeChild(oImg);\r
+\r
+            }\r
+\r
+            this._checkImage = null;\r
+        \r
+        }\r
+\r
+    };\r
+    \r
+\r
+/**\r
+* Event handler for when the "selected" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configSelected = \r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        YAHOO.widget.MenuItem.superclass.configSelected.call(\r
+                this, p_sType, p_aArgs, p_oItem\r
+            );        \r
+    \r
+        var oConfig = this.cfg;\r
+\r
+        if(!oConfig.getProperty("disabled") && oConfig.getProperty("checked")) {\r
+\r
+            var bSelected = p_aArgs[0];\r
+\r
+            var sSrc = this.imageRoot + (bSelected ? \r
+                this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);\r
+\r
+            this._checkImage.src = document.images[sSrc].src;\r
+            \r
+        }            \r
+    \r
+    };\r
+\r
+\r
+/**\r
+* Event handler for when the "disabled" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configDisabled = \r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+    \r
+        YAHOO.widget.MenuItem.superclass.configDisabled.call(\r
+                this, p_sType, p_aArgs, p_oItem\r
+            );        \r
+    \r
+        if(this.cfg.getProperty("checked")) {\r
+    \r
+            var bDisabled = p_aArgs[0];\r
+            var sAlt = this.CHECKED_IMAGE_ALT_TEXT;\r
+            var sSrc = this.CHECKED_IMAGE_PATH;\r
+            var oImg = this._checkImage;\r
+            \r
+            if(bDisabled) {\r
+    \r
+                sAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;\r
+                sSrc = this.DISABLED_CHECKED_IMAGE_PATH;\r
+            \r
+            }\r
+\r
+            oImg.src = document.images[(this.imageRoot + sSrc)].src;\r
+            oImg.alt = sAlt;\r
+            \r
+        }    \r
+            \r
+    };\r
+\r
+\r
+// Public methods\r
+    \r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* the MenuModule's Config object (cfg).\r
+*/\r
+YAHOO.widget.MenuItem.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.MenuItem.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add configuration properties\r
+\r
+    this.cfg.addProperty(\r
+        "checked", \r
+        {\r
+            value: false, \r
+            handler: this.configChecked, \r
+            validator: this.cfg.checkBoolean, \r
+            suppressEvent: true \r
+        } \r
+    );\r
+\r
+};\r
+\r
+\r
+/**\r
+* @class Creates a list of options which vary depending on the context in \r
+* which the menu is invoked.\r
+* @constructor\r
+* @extends YAHOO.widget.Menu\r
+* @base YAHOO.widget.Menu\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a ContextMenu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.ContextMenu.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu);\r
+\r
+\r
+YAHOO.widget.ContextMenu.prototype._oTrigger = null;\r
+\r
+\r
+/**\r
+* The ContextMenu class's initialization method. This method is automatically  \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a ContextMenu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;\r
+\r
+    }\r
+\r
+\r
+    // Call the init of the superclass (YAHOO.widget.Menu)\r
+\r
+    YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);\r
+\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);\r
+\r
+\r
+    if(p_oConfig) {\r
+\r
+        this.cfg.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    \r
+    this.initEvent.fire(YAHOO.widget.ContextMenu);\r
+\r
+\r
+};\r
+\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "mousedown" event handler for the document object.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onDocumentMouseDown = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+    \r
+        var oTarget = YAHOO.util.Event.getTarget(p_oEvent);\r
+        var oTargetEl = this._oTargetElement;\r
+    \r
+        if(\r
+            oTarget != oTargetEl || \r
+            !YAHOO.util.Dom.isAncestor(oTargetEl, oTarget)\r
+        ) {\r
+    \r
+            this.hide();\r
+        \r
+        }\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* "click" event handler for the HTMLElement node that triggered the event. \r
+* Used to cancel default behaviors in Opera.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onTriggerClick = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+\r
+        if(p_oEvent.ctrlKey) {\r
+        \r
+            YAHOO.util.Event.stopEvent(p_oEvent);\r
+    \r
+        }\r
+        \r
+    };\r
+\r
+\r
+/**\r
+* "contextmenu" event handler ("mousedown" for Opera) for the HTMLElement \r
+* node that triggered the event.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onTriggerContextMenu = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oConfig = this.cfg;\r
+\r
+        if(p_oEvent.type == "mousedown") {\r
+        \r
+            if(!p_oEvent.ctrlKey) {\r
+    \r
+                return;\r
+            \r
+            }\r
+        \r
+            Event.stopEvent(p_oEvent);\r
+    \r
+        }\r
+    \r
+    \r
+        this.contextEventTarget = Event.getTarget(p_oEvent);\r
+    \r
+    \r
+        // Position and display the context menu\r
+    \r
+        var nX = Event.getPageX(p_oEvent);\r
+        var nY = Event.getPageY(p_oEvent);\r
+    \r
+    \r
+        oConfig.applyConfig( { x:nX, y:nY, visible:true } );\r
+        oConfig.fireQueue();\r
+    \r
+    \r
+        // Prevent the browser's default context menu from appearing\r
+    \r
+        Event.preventDefault(p_oEvent);\r
+    \r
+    };\r
+\r
+\r
+// Public properties\r
+\r
+/**\r
+* Returns the HTMLElement node that was the target of the "contextmenu" \r
+* DOM event.\r
+* @type HTMLElement\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.contextEventTarget = null;\r
+\r
+\r
+// Public methods\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* a ContextMenu instance's Config object (cfg).\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);\r
+\r
+\r
+       // Add a configuration property\r
+\r
+    this.cfg.addProperty("trigger", { handler: this.configTrigger });\r
+\r
+};\r
+\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "trigger" configuration property of\r
+* a MenuItem instance. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu that instance fired\r
+* the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.configTrigger = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        var Event = YAHOO.util.Event;\r
+        var oTrigger = p_aArgs[0];\r
+    \r
+        if(oTrigger) {\r
+    \r
+\r
+            /*\r
+                If there is a current "trigger" - remove the event handlers \r
+                from that element(s) before assigning new ones\r
+            */\r
+            if(this._oTrigger) {\r
+            \r
+                Event.purgeElement(this._oTrigger);\r
+\r
+            }\r
+\r
+\r
+            this._oTrigger = oTrigger;\r
+\r
+\r
+            /*\r
+                Listen for the "mousedown" event in Opera b/c it does not \r
+                support the "contextmenu" event\r
+            */ \r
+      \r
+            var bOpera = (this.browser == "opera");\r
+    \r
+            Event.addListener(\r
+                oTrigger, \r
+                (bOpera ? "mousedown" : "contextmenu"), \r
+                this._onTriggerContextMenu,\r
+                this,\r
+                true\r
+            );\r
+    \r
+    \r
+            /*\r
+                Assign a "click" event handler to the trigger element(s) for\r
+                Opera to prevent default browser behaviors.\r
+            */\r
+    \r
+            if(bOpera) {\r
+            \r
+                Event.addListener(\r
+                    oTrigger, \r
+                    "click", \r
+                    this._onTriggerClick,\r
+                    this,\r
+                    true\r
+                );\r
+    \r
+            }\r
+    \r
+    \r
+            // Assign a "mousedown" event handler to the document\r
+        \r
+            Event.addListener(\r
+                document, \r
+                "mousedown", \r
+                this._onDocumentMouseDown,\r
+                this,\r
+                true\r
+            );        \r
+    \r
+        }\r
+        \r
+    };\r
+\r
+\r
+/**\r
+* @class Creates an item for a context menu instance.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuItem\r
+* @base YAHOO.widget.MenuItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a ContextMenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.ContextMenuItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem);\r
+\r
+\r
+/**\r
+* The ContextMenuItem class's initialization method. This method is\r
+* automatically called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a ContextMenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenuItem.prototype.init = \r
+\r
+    function(p_oObject, p_oConfig) {\r
+    \r
+        if(!this.SUBMENU_TYPE) {\r
+    \r
+            this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;\r
+    \r
+        }\r
+    \r
+        if(!this.SUBMENU_ITEM_TYPE) {\r
+    \r
+            this.SUBMENU_ITEM_TYPE = YAHOO.widget.ContextMenuItem;\r
+    \r
+        }\r
+    \r
+    \r
+        /* \r
+            Call the init of the superclass (YAHOO.widget.MenuItem)\r
+            Note: We don't pass the user config in here yet \r
+            because we only want it executed once, at the lowest \r
+            subclass level.\r
+        */ \r
+    \r
+        YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);\r
+\r
+        var oConfig = this.cfg;\r
+    \r
+        if(p_oConfig) {\r
+    \r
+            oConfig.applyConfig(p_oConfig, true);\r
+    \r
+        }\r
+    \r
+        oConfig.fireQueue();\r
+    \r
+    };\r
+\r
+\r
+/**\r
+* @class Horizontal collection of items, each of which can contain a submenu.\r
+* Extends YAHOO.widget.MenuModule to provide a set of default mouse and \r
+* key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModule\r
+* @base YAHOO.widget.MenuModule\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuBar instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuBar.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.MenuModule);\r
+\r
+\r
+/**\r
+* The MenuBar class's initialization method. This method is automatically \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuBar instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBar.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuBarItem;\r
+\r
+    }\r
+\r
+\r
+    // Call the init of the superclass (YAHOO.widget.MenuModule)\r
+\r
+    YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);\r
+\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.MenuBar);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    /*\r
+        Set the default value for the "position" configuration property\r
+        to "static" \r
+    */\r
+    if(!p_oConfig || (p_oConfig && !p_oConfig.position)) {\r
+\r
+        oConfig.queueProperty("position", "static");\r
+\r
+    }\r
+\r
+    /*\r
+        Set the default value for the "submenualignment" configuration property\r
+        to "tl" and "bl" \r
+    */\r
+    if(!p_oConfig || (p_oConfig && !p_oConfig.submenualignment)) {\r
+\r
+        oConfig.queueProperty("submenualignment", ["tl","bl"]);\r
+\r
+    }\r
+\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    this.initEvent.fire(YAHOO.widget.MenuBar);\r
+\r
+};\r
+\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLDivElement of the MenuBar instance.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBar.prototype.CSS_CLASS_NAME = "yuimenubar";\r
+\r
+\r
+/**\r
+* @class The MenuBarItem class allows you to create and modify an item for a\r
+* MenuBar instance.  MenuBarItem extends YAHOO.widget.MenuModuleItem to provide \r
+* a set of default mouse and key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModuleItem\r
+* @base YAHOO.widget.MenuModuleItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuBarItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuBarItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuModuleItem);\r
+\r
+\r
+/**\r
+* The MenuBarItem class's initialization method. This method is automatically\r
+* called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuBarItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.init = function(p_oObject, p_oConfig) {\r
+\r
+    if(!this.SUBMENU_TYPE) {\r
+\r
+        this.SUBMENU_TYPE = YAHOO.widget.Menu;\r
+\r
+    }\r
+\r
+    if(!this.SUBMENU_ITEM_TYPE) {\r
+\r
+        this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+\r
+    /* \r
+        Call the init of the superclass (YAHOO.widget.MenuModuleItem)\r
+        Note: We don't pass the user config in here yet \r
+        because we only want it executed once, at the lowest \r
+        subclass level.\r
+    */ \r
+\r
+    YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);  \r
+\r
+\r
+    // Add event handlers to each "MenuBarItem" instance\r
+\r
+    this.keyDownEvent.subscribe(this._onKeyDown, this, true);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+\r
+    oConfig.fireQueue();\r
+\r
+};\r
+\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLLIElement of the MenuBarItem.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.CSS_CLASS_NAME = "yuimenubaritem";\r
+\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.SUBMENU_INDICATOR_IMAGE_PATH =\r
+    "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif";\r
+\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator when a MenuBarItem instance is selected.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH =\r
+    "nt/ic/ut/alt1/menuarodwn8_hov_1.gif";\r
+\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator when a MenuBarItem instance is disabled.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH = \r
+    "nt/ic/ut/alt1/menuarodwn8_dim_1.gif";\r
+\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "keydown" Custom Event handler for a MenuBarItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype._onKeyDown =\r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oDOMEvent = p_aArgs[0];\r
+        var oConfig = this.cfg;\r
+        var oParent = this.parent;\r
+    \r
+        switch(oDOMEvent.keyCode) {\r
+    \r
+            case 37:    // Left arrow\r
+            case 39:    // Right arrow\r
+    \r
+                if(\r
+                    this == oParent.activeItem && \r
+                    !oConfig.getProperty("selected")\r
+                ) {\r
+    \r
+                    oConfig.setProperty("selected", true);\r
+    \r
+                }\r
+                else {\r
+    \r
+                    var oNextItem = (oDOMEvent.keyCode == 37) ? \r
+                            this.getPreviousEnabledSibling() : \r
+                            this.getNextEnabledSibling();\r
+            \r
+                    if(oNextItem) {\r
+\r
+                        oParent.clearActiveItem();\r
+\r
+                        oNextItem.cfg.setProperty("selected", true);\r
+            \r
+                        oNextItem.focus();\r
+    \r
+                    }\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;\r
+    \r
+            case 40:    // Down arrow\r
+\r
+                oParent.clearActiveItem();\r
+                        \r
+                oConfig.setProperty("selected", true);\r
+                \r
+                this.focus();\r
+\r
+                var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+                if(oSubmenu) {\r
+        \r
+                    oSubmenu.show();\r
+                    oSubmenu.setInitialSelection();\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;\r
+    \r
+        }\r
+    \r
+    };
\ No newline at end of file
diff --git a/lib/yui/menu/menu-min.js b/lib/yui/menu/menu-min.js
new file mode 100755 (executable)
index 0000000..4ead33f
--- /dev/null
@@ -0,0 +1,9 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+\r
+YAHOO.widget.MenuModule=function(_1,_2){YAHOO.widget.MenuModule.superclass.constructor.call(this,_1,_2);};YAHOO.extend(YAHOO.widget.MenuModule,YAHOO.widget.Overlay);YAHOO.widget.MenuModule.prototype.CSS_CLASS_NAME="yuimenu";YAHOO.widget.MenuModule.prototype.ITEM_TYPE=null;YAHOO.widget.MenuModule.prototype.GROUP_TITLE_TAG_NAME="H6";YAHOO.widget.MenuModule.prototype._aGroupTitleElements=null;YAHOO.widget.MenuModule.prototype._aItemGroups=null;YAHOO.widget.MenuModule.prototype._aListElements=null;YAHOO.widget.MenuModule.prototype._oEventUtil=YAHOO.util.Event;YAHOO.widget.MenuModule.prototype._oDom=YAHOO.util.Dom;YAHOO.widget.MenuModule.prototype._oCurrentItem=null;YAHOO.widget.MenuModule.prototype._bFiredMouseOverEvent=false;YAHOO.widget.MenuModule.prototype._bFiredMouseOutEvent=false;YAHOO.widget.MenuModule.prototype.activeItem=null;YAHOO.widget.MenuModule.prototype.parent=null;YAHOO.widget.MenuModule.prototype.srcElement=null;YAHOO.widget.MenuModule.prototype.mouseOverEvent=null;YAHOO.widget.MenuModule.prototype.mouseOutEvent=null;YAHOO.widget.MenuModule.prototype.mouseDownEvent=null;YAHOO.widget.MenuModule.prototype.mouseUpEvent=null;YAHOO.widget.MenuModule.prototype.clickEvent=null;YAHOO.widget.MenuModule.prototype.keyPressEvent=null;YAHOO.widget.MenuModule.prototype.keyDownEvent=null;YAHOO.widget.MenuModule.prototype.keyUpEvent=null;YAHOO.widget.MenuModule.prototype.init=function(_3,_4){var _5=this._oDom;var _6=this._oEventUtil;if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuModuleItem;}this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];var _7;if(typeof _3=="string"){_7=document.getElementById(_3);}else{if(_3.tagName){_7=_3;}}if(_7){switch(_7.tagName){case "DIV":this.srcElement=_7;YAHOO.widget.MenuModule.superclass.init.call(this,_7);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);var _8=this.body.firstChild;var i=0;do{switch(_8.tagName){case this.GROUP_TITLE_TAG_NAME:this._aGroupTitleElements[i]=_8;break;case "UL":this._aListElements[i]=_8;this._aItemGroups[i]=[];i++;break;}}while((_8=_8.nextSibling));if(this._aListElements[0]){_5.addClass(this._aListElements[0],"first-of-type");}break;case "SELECT":this.srcElement=_7;var _a=_5.generateId();YAHOO.widget.MenuModule.superclass.init.call(this,_a);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);break;}}else{YAHOO.widget.MenuModule.superclass.init.call(this,_3);this.beforeInitEvent.fire(YAHOO.widget.MenuModule);}if(this.element){var _b=this.element;var _c=YAHOO.util.CustomEvent;_5.addClass(_b,this.CSS_CLASS_NAME);_6.addListener(_b,"mouseover",this._onElementMouseOver,this,true);_6.addListener(_b,"mouseout",this._onElementMouseOut,this,true);_6.addListener(_b,"mousedown",this._onDOMEvent,this,true);_6.addListener(_b,"mouseup",this._onDOMEvent,this,true);_6.addListener(_b,"click",this._onElementClick,this,true);_6.addListener(_b,"keydown",this._onDOMEvent,this,true);_6.addListener(_b,"keyup",this._onDOMEvent,this,true);_6.addListener(_b,"keypress",this._onDOMEvent,this,true);this.mouseOverEvent=new _c("mouseOverEvent",this);this.mouseOutEvent=new _c("mouseOutEvent",this);this.mouseDownEvent=new _c("mouseDownEvent",this);this.mouseUpEvent=new _c("mouseUpEvent",this);this.clickEvent=new _c("clickEvent",this);this.keyPressEvent=new _c("keyPressEvent",this);this.keyDownEvent=new _c("keyDownEvent",this);this.keyUpEvent=new _c("keyUpEvent",this);this.beforeRenderEvent.subscribe(this._onBeforeRender,this,true);this.renderEvent.subscribe(this._onRender,this,true);this.showEvent.subscribe(this._onShow,this,true);this.beforeHideEvent.subscribe(this._onBeforeHide,this,true);if(_4){this.cfg.applyConfig(_4,true);}this.cfg.queueProperty("visible",false);if(this.srcElement){this._initSubTree();}}this.initEvent.fire(YAHOO.widget.MenuModule);};YAHOO.widget.MenuModule.prototype._initSubTree=function(){var _d;switch(this.srcElement.tagName){case "DIV":if(this._aListElements.length>0){var i=this._aListElements.length-1;do{_d=this._aListElements[i].firstChild;do{switch(_d.tagName){case "LI":this.addItem(new this.ITEM_TYPE(_d),i);break;}}while((_d=_d.nextSibling));}while(i--);}break;case "SELECT":_d=this.srcElement.firstChild;do{switch(_d.tagName){case "OPTGROUP":case "OPTION":this.addItem(new this.ITEM_TYPE(_d));break;}}while((_d=_d.nextSibling));break;}};YAHOO.widget.MenuModule.prototype._getFirstEnabledItem=function(){var _f=this._aItemGroups.length;var _10;var _11;for(var i=0;i<_f;i++){_11=this._aItemGroups[i];if(_11){var _13=_11.length;for(var n=0;n<_13;n++){_10=_11[n];if(!_10.cfg.getProperty("disabled")){return _10;}_10=null;}}}};YAHOO.widget.MenuModule.prototype._checkPosition=function(_15){if(typeof _15=="string"){var _16=_15.toLowerCase();return ("dynamic,static".indexOf(_16)!=-1);}};YAHOO.widget.MenuModule.prototype._addItemToGroup=function(_17,_18,_19){var Dom=this._oDom;var _1b;if(_18 instanceof this.ITEM_TYPE){_1b=_18;}else{if(typeof _18=="string"){_1b=new this.ITEM_TYPE(_18);}}if(_1b){var _1c=typeof _17=="number"?_17:0;var _1d=this._getItemGroup(_1c);var _1e;if(!_1d){_1d=this._createItemGroup(_1c);}if(typeof _19=="number"){var _1f=(_19>=_1d.length);if(_1d[_19]){_1d.splice(_19,0,_1b);}else{_1d[_19]=_1b;}_1e=_1d[_19];if(_1e){if(_1f&&!_1e.element.parentNode){this._aListElements[_1c].appendChild(_1e.element);}else{function getNextItemSibling(_20,_21){return (_20[_21]||getNextItemSibling(_20,(_21+1)));}var _22=getNextItemSibling(_1d,(_19+1));if(_22&&!_1e.element.parentNode){this._aListElements[_1c].insertBefore(_1e.element,_22.element);}}_1e.parent=this;this._subscribeToItemEvents(_1e);this._configureItemSubmenuModule(_1e);this._updateItemProperties(_1c);return _1e;}}else{var _23=_1d.length;_1d[_23]=_1b;_1e=_1d[_23];if(_1e){if(!Dom.isAncestor(this._aListElements[_1c],_1e.element)){this._aListElements[_1c].appendChild(_1e.element);}_1e.element.setAttribute("groupindex",_1c);_1e.element.setAttribute("index",_23);_1e.parent=this;_1e.index=_23;_1e.groupIndex=_1c;this._subscribeToItemEvents(_1e);this._configureItemSubmenuModule(_1e);if(_23===0){Dom.addClass(_1e.element,"first-of-type");}return _1e;}}}};YAHOO.widget.MenuModule.prototype._removeItemFromGroupByIndex=function(_24,_25){var _26=typeof _24=="number"?_24:0;var _27=this._getItemGroup(_26);if(_27){var _28=_27.splice(_25,1);var _29=_28[0];if(_29){this._updateItemProperties(_26);if(_27.length===0){var oUL=this._aListElements[_26];if(this.body&&oUL){this.body.removeChild(oUL);}this._aItemGroups.splice(_26,1);this._aListElements.splice(_26,1);oUL=this._aListElements[0];if(oUL){this._oDom.addClass(oUL,"first-of-type");}}return _29;}}};YAHOO.widget.MenuModule.prototype._removeItemFromGroupByValue=function(_2b,_2c){var _2d=this._getItemGroup(_2b);if(_2d){var _2e=_2d.length;var _2f=-1;if(_2e>0){var i=_2e-1;do{if(_2d[i]==_2c){_2f=i;break;}}while(i--);if(_2f>-1){return this._removeItemFromGroupByIndex(_2b,_2f);}}}};YAHOO.widget.MenuModule.prototype._updateItemProperties=function(_31){var _32=this._getItemGroup(_31);var _33=_32.length;if(_33>0){var Dom=this._oDom;var i=_33-1;var _36;var oLI;do{_36=_32[i];if(_36){oLI=_36.element;_36.index=i;_36.groupIndex=_31;oLI.setAttribute("groupindex",_31);oLI.setAttribute("index",i);Dom.removeClass(oLI,"first-of-type");}}while(i--);if(oLI){Dom.addClass(oLI,"first-of-type");}}};YAHOO.widget.MenuModule.prototype._createItemGroup=function(_38){if(!this._aItemGroups[_38]){this._aItemGroups[_38]=[];var oUL=document.createElement("ul");this._aListElements[_38]=oUL;return this._aItemGroups[_38];}};YAHOO.widget.MenuModule.prototype._getItemGroup=function(_3a){var _3b=((typeof _3a=="number")?_3a:0);return this._aItemGroups[_3b];};YAHOO.widget.MenuModule.prototype._configureItemSubmenuModule=function(_3c){var _3d=_3c.cfg.getProperty("submenu");if(_3d){this.cfg.configChangedEvent.subscribe(this._onParentMenuModuleConfigChange,_3d,true);this.renderEvent.subscribe(this._onParentMenuModuleRender,_3d,true);_3d.beforeShowEvent.subscribe(this._onSubmenuBeforeShow,_3d,true);_3d.showEvent.subscribe(this._onSubmenuShow,_3d,true);_3d.hideEvent.subscribe(this._onSubmenuHide,_3d,true);}};YAHOO.widget.MenuModule.prototype._subscribeToItemEvents=function(_3e){var _3f=[this,_3e];_3e.focusEvent.subscribe(this._onItemFocus,_3f);_3e.blurEvent.subscribe(this._onItemBlur,_3f);_3e.cfg.configChangedEvent.subscribe(this._onItemConfigChange,_3f);};YAHOO.widget.MenuModule.prototype._getOffsetWidth=function(){var _40=this.element.cloneNode(true);this._oDom.setStyle(_40,"width","");document.body.appendChild(_40);var _41=_40.offsetWidth;document.body.removeChild(_40);return _41;};YAHOO.widget.MenuModule.prototype._fireItemEvent=function(_42,_43,_44){var me=this;function getItemElement(_46){if(_46==me.element){return;}else{if(_46.tagName=="LI"){return _46;}else{if(_46.parentNode){return getItemElement(_46.parentNode);}}}}var _47=getItemElement(_42);if(_47){var _48=parseInt(_47.getAttribute("groupindex"),10);var _49=parseInt(_47.getAttribute("index"),10);var _4a=this._aItemGroups[_48][_49];if(!_4a.cfg.getProperty("disabled")){_4a[_43].fire(_44);return _4a;}}};YAHOO.widget.MenuModule.prototype._onDOMEvent=function(_4b,_4c){var _4d=this._oEventUtil;var _4e={"mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent"};var _4f=_4e[_4b.type];var _50=_4d.getTarget(_4b);this._fireItemEvent(_50,_4f,_4b);this[_4f].fire(_4b);_4d.stopPropagation(_4b);};YAHOO.widget.MenuModule.prototype._onElementMouseOver=function(_51,_52){var _53=this._oEventUtil;var _54=_53.getTarget(_51);if((_54==this.element||this._oDom.isAncestor(this.element,_54))&&!this._bFiredMouseOverEvent){this.mouseOverEvent.fire(_51);this._bFiredMouseOverEvent=true;this._bFiredMouseOutEvent=false;}if(!this._oCurrentItem){this._oCurrentItem=this._fireItemEvent(_54,"mouseOverEvent",_51);}_53.stopPropagation(_51);};YAHOO.widget.MenuModule.prototype._onElementMouseOut=function(_55,_56){var Dom=this._oDom;var _58=this._oEventUtil;var _59=_58.getRelatedTarget(_55);var _5a=true;var _5b=false;if(this._oCurrentItem&&_59){if(_59==this._oCurrentItem.element||Dom.isAncestor(this._oCurrentItem.element,_59)){_5a=false;}var _5c=this._oCurrentItem.cfg.getProperty("submenu");if(_5c&&(_59==_5c.element||Dom.isAncestor(_5c.element,_59))){_5b=true;}}if(this._oCurrentItem&&(_5a||_5b)){this._oCurrentItem.mouseOutEvent.fire(_55);this._oCurrentItem=null;}if(!this._bFiredMouseOutEvent&&(!Dom.isAncestor(this.element,_59)||_5b)){this.mouseOutEvent.fire(_55);this._bFiredMouseOutEvent=true;this._bFiredMouseOverEvent=false;}_58.stopPropagation(_55);};YAHOO.widget.MenuModule.prototype._onElementClick=function(_5d,_5e){var _5f=this._oEventUtil;var _60=_5f.getTarget(_5d);var _61=this._fireItemEvent(_60,"clickEvent",_5d);var _62;if(_61){var _63=_61.cfg.getProperty("url");var _64=_61.cfg.getProperty("submenu");_62=(_63.substr((_63.length-1),1)=="#");if(_60==_61.submenuIndicator&&_64){if(_64.cfg.getProperty("visible")){_64.hide();}else{var _65=this.activeItem;if(_65&&_65!=this){this.clearActiveItem();}this.activeItem=_61;_61.cfg.setProperty("selected",true);_64.show();}}else{if(_60.tagName!="A"&&!_62){document.location=_63;}}}switch(_60.tagName){case "A":if(_62){_5f.preventDefault(_5d);}else{break;}default:_5f.stopPropagation(_5d);break;}this.clickEvent.fire(_5d);};YAHOO.widget.MenuModule.prototype._onBeforeRender=function(_66,_67,_68){var Dom=this._oDom;var _6a=this.cfg;var oEl=this.element;var _6c=this._aListElements.length;if(_6a.getProperty("position")=="static"){_6a.queueProperty("iframe",false);_6a.queueProperty("visible",true);}if(_6c>0){var i=0;var _6e=true;var oUL;var _70;do{oUL=this._aListElements[i];if(oUL){if(_6e){Dom.addClass(oUL,"first-of-type");_6e=false;}if(!Dom.isAncestor(oEl,oUL)){this.appendToBody(oUL);}_70=this._aGroupTitleElements[i];if(_70){if(!Dom.isAncestor(oEl,_70)){oUL.parentNode.insertBefore(_70,oUL);}Dom.addClass(oUL,"hastitle");}}i++;}while(i<_6c);}};YAHOO.widget.MenuModule.prototype._onRender=function(_71,_72,_73){if(this.cfg.getProperty("position")=="dynamic"){var _74=this.element.parentNode.tagName=="BODY"?this.element.offsetWidth:this._getOffsetWidth();this.cfg.setProperty("width",(_74+"px"));}};YAHOO.widget.MenuModule.prototype._onShow=function(_75,_76,_77){this.setInitialFocus();};YAHOO.widget.MenuModule.prototype._onBeforeHide=function(_78,_79,_7a){var _7b=this.activeItem;if(_7b){_7b.blur();if(_7b.cfg.getProperty("selected")){_7b.cfg.setProperty("selected",false);}var _7c=_7b.cfg.getProperty("submenu");if(_7c&&_7c.cfg.getProperty("visible")){_7c.hide();}}};YAHOO.widget.MenuModule.prototype._onParentMenuModuleConfigChange=function(_7d,_7e,_7f){var _80=_7e[0][0];var _81=_7e[0][1];switch(_80){case "iframe":case "constraintoviewport":_7f.cfg.setProperty(_80,_81);break;}};YAHOO.widget.MenuModule.prototype._onParentMenuModuleRender=function(_82,_83,_84){var _85=_84.parent.parent;_84.cfg.applyConfig({constraintoviewport:_85.cfg.getProperty("constraintoviewport"),xy:[0,0],iframe:_85.cfg.getProperty("iframe")});if(this._oDom.inDocument(this.element)){this.render();}else{this.render(this.parent.element);}};YAHOO.widget.MenuModule.prototype._onSubmenuBeforeShow=function(_86,_87,_88){var _89=this.parent;var _8a=_89.parent.cfg.getProperty("submenualignment");this.cfg.setProperty("context",[_89.element,_8a[0],_8a[1]]);_89.submenuIndicator.alt=_89.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onSubmenuShow=function(_8b,_8c,_8d){var _8e=this.parent;_8e.submenuIndicator.alt=_8e.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onSubmenuHide=function(_8f,_90,_91){var _92=this.parent;if(_92.parent.cfg.getProperty("visible")){_92.cfg.setProperty("selected",false);_92.focus();}_92.submenuIndicator.alt=_92.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;};YAHOO.widget.MenuModule.prototype._onItemFocus=function(_93,_94,_95){var me=_95[0];var _97=_95[1];me.activeItem=_97;};YAHOO.widget.MenuModule.prototype._onItemBlur=function(_98,_99,_9a){var me=_9a[0];var _9c=_9a[1];var _9d=_9c.cfg.getProperty("submenu");if(!_9d||(_9d&&!_9d.cfg.getProperty("visible"))){me.activeItem=null;}};YAHOO.widget.MenuModule.prototype._onItemConfigChange=function(_9e,_9f,_a0){var me=_a0[0];var _a2=_9f[0][0];var _a3=_a0[1];switch(_a2){case "submenu":var _a4=_9f[0][1];if(_a4){me._configureItemSubmenuModule(_a3);}break;case "text":case "helptext":if(me.element.style.width){var _a5=me._getOffsetWidth()+"px";me._oDom.setStyle(me.element,"width",_a5);}break;}};YAHOO.widget.MenuModule.prototype.enforceConstraints=function(_a6,_a7,obj){var Dom=this._oDom;var _aa=this.cfg;var pos=_a7[0];var x=pos[0];var y=pos[1];var bod=document.getElementsByTagName("body")[0];var htm=document.getElementsByTagName("html")[0];var _b0=Dom.getStyle(bod,"overflow");var _b1=Dom.getStyle(htm,"overflow");var _b2=this.element.offsetHeight;var _b3=this.element.offsetWidth;var _b4=Dom.getClientWidth();var _b5=Dom.getClientHeight();var _b6=window.scrollX||document.body.scrollLeft;var _b7=window.scrollY||document.body.scrollTop;var _b8=_b7+10;var _b9=_b6+10;var _ba=_b7+_b5-_b2-10;var _bb=_b6+_b4-_b3-10;var _bc=_aa.getProperty("context");var _bd=_bc?_bc[0]:null;if(x<10){x=_b9;}else{if((x+_b3)>_b4){if(_bd&&((x-_bd.offsetWidth)>_b3)){x=(x-(_bd.offsetWidth+_b3));}else{x=_bb;}}}if(y<10){y=_b8;}else{if(y>_ba){if(_bd&&(y>_b2)){y=((y+_bd.offsetHeight)-_b2);}else{y=_ba;}}}_aa.setProperty("x",x,true);_aa.setProperty("y",y,true);};YAHOO.widget.MenuModule.prototype.configPosition=function(_be,_bf,_c0){var _c1=_bf[0]=="static"?"static":"absolute";this._oDom.setStyle(this.element,"position",_c1);};YAHOO.widget.MenuModule.prototype.toString=function(){return ("Menu "+this.id);};YAHOO.widget.MenuModule.prototype.setItemGroupTitle=function(_c2,_c3){if(typeof _c2=="string"&&_c2.length>0){var Dom=this._oDom;var _c5=typeof _c3=="number"?_c3:0;var _c6=this._aGroupTitleElements[_c5];if(_c6){_c6.innerHTML=_c2;}else{_c6=document.createElement(this.GROUP_TITLE_TAG_NAME);_c6.innerHTML=_c2;this._aGroupTitleElements[_c5]=_c6;}var i=this._aGroupTitleElements.length-1;var _c8;do{if(this._aGroupTitleElements[i]){Dom.removeClass(this._aGroupTitleElements[i],"first-of-type");_c8=i;}}while(i--);if(_c8!==null){Dom.addClass(this._aGroupTitleElements[_c8],"first-of-type");}}};YAHOO.widget.MenuModule.prototype.addItem=function(_c9,_ca){if(_c9){return this._addItemToGroup(_ca,_c9);}};YAHOO.widget.MenuModule.prototype.insertItem=function(_cb,_cc,_cd){if(_cb){return this._addItemToGroup(_cd,_cb,_cc);}};YAHOO.widget.MenuModule.prototype.removeItem=function(_ce,_cf){if(typeof _ce!="undefined"){var _d0;if(_ce instanceof YAHOO.widget.MenuModuleItem){_d0=this._removeItemFromGroupByValue(_cf,_ce);}else{if(typeof _ce=="number"){_d0=this._removeItemFromGroupByIndex(_cf,_ce);}}if(_d0){_d0.destroy();return _d0;}}};YAHOO.widget.MenuModule.prototype.getItemGroups=function(){return this._aItemGroups;};YAHOO.widget.MenuModule.prototype.getItem=function(_d1,_d2){if(typeof _d1=="number"){var _d3=this._getItemGroup(_d2);if(_d3){return _d3[_d1];}}};YAHOO.widget.MenuModule.prototype.destroy=function(){this._oEventUtil.purgeElement(this.element);this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.beforeMoveEvent.unsubscribeAll();var _d4=this._aItemGroups.length;var _d5;var _d6;var _d7;var i;var n;if(_d4>0){i=_d4-1;do{_d6=this._aItemGroups[i];if(_d6){_d5=_d6.length;if(_d5>0){n=_d5-1;do{_d7=this._aItemGroups[i][n];if(_d7){_d7.destroy();}}while(n--);}}}while(i--);}YAHOO.widget.MenuModule.superclass.destroy.call(this);};YAHOO.widget.MenuModule.prototype.setInitialFocus=function(){var _da=this._getFirstEnabledItem();if(_da){_da.focus();}};YAHOO.widget.MenuModule.prototype.setInitialSelection=function(){var _db=this._getFirstEnabledItem();if(_db){_db.cfg.setProperty("selected",true);}};YAHOO.widget.MenuModule.prototype.clearActiveItem=function(){if(this.activeItem){var _dc=this.activeItem.cfg;_dc.setProperty("selected",false);var _dd=_dc.getProperty("submenu");if(_dd){_dd.hide();}}};YAHOO.widget.MenuModule.prototype.initDefaultConfig=function(){YAHOO.widget.MenuModule.superclass.initDefaultConfig.call(this);var _de=this.cfg;_de.addProperty("position",{value:"dynamic",handler:this.configPosition,validator:this._checkPosition});_de.refireEvent("position");_de.addProperty("submenualignment",{value:["tl","tr"]});};YAHOO.widget.MenuModuleItem=function(_df,_e0){if(_df){this.init(_df,_e0);}};YAHOO.widget.MenuModuleItem.prototype={SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_nrm_1.gif",SELECTED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_hov_1.gif",DISABLED_SUBMENU_INDICATOR_IMAGE_PATH:"nt/ic/ut/alt1/menuarorght8_dim_1.gif",COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT:"Collapsed.  Click to expand.",EXPANDED_SUBMENU_INDICATOR_ALT_TEXT:"Expanded.  Click to collapse.",DISABLED_SUBMENU_INDICATOR_ALT_TEXT:"Disabled.",CSS_CLASS_NAME:"yuimenuitem",SUBMENU_TYPE:null,SUBMENU_ITEM_TYPE:null,IMG_ROOT:"http://us.i1.yimg.com/us.yimg.com/i/",IMG_ROOT_SSL:"https://a248.e.akamai.net/sec.yimg.com/i/",_oAnchor:null,_oText:null,_oHelpTextEM:null,_oSubmenu:null,_oDom:YAHOO.util.Dom,constructor:YAHOO.widget.MenuModuleItem,imageRoot:null,isSecure:YAHOO.widget.Module.prototype.isSecure,index:null,groupIndex:null,parent:null,element:null,srcElement:null,value:null,submenuIndicator:null,browser:YAHOO.widget.Module.prototype.browser,destroyEvent:null,mouseOverEvent:null,mouseOutEvent:null,mouseDownEvent:null,mouseUpEvent:null,clickEvent:null,keyPressEvent:null,keyDownEvent:null,keyUpEvent:null,focusEvent:null,blurEvent:null,init:function(_e1,_e2){this.imageRoot=(this.isSecure)?this.IMG_ROOT_SSL:this.IMG_ROOT;if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.MenuModule;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuModuleItem;}this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();var _e3=this.cfg;if(this._checkString(_e1)){this._createRootNodeStructure();_e3.setProperty("text",_e1);}else{if(this._checkDOMNode(_e1)){switch(_e1.tagName){case "OPTION":this._createRootNodeStructure();_e3.setProperty("text",_e1.text);this.srcElement=_e1;break;case "OPTGROUP":this._createRootNodeStructure();_e3.setProperty("text",_e1.label);this.srcElement=_e1;this._initSubTree();break;case "LI":var _e4=this._getFirstElement(_e1,"A");var _e5="#";var _e6=null;if(_e4){_e5=_e4.getAttribute("href");if(_e4.innerText){_e6=_e4.innerText;}else{var _e7=_e4.ownerDocument.createRange();_e7.selectNodeContents(_e4);_e6=_e7.toString();}}else{var _e8=_e1.firstChild;_e6=_e8.nodeValue;_e4=document.createElement("a");_e4.setAttribute("href",_e5);_e1.replaceChild(_e4,_e8);_e4.appendChild(_e8);}this.srcElement=_e1;this.element=_e1;this._oAnchor=_e4;var _e9=this._getFirstElement(_e4);var _ea=false;var _eb=false;if(_e9){this._oText=_e9.firstChild;switch(_e9.tagName){case "EM":_ea=true;break;case "STRONG":_eb=true;break;}}else{this._oText=_e4.firstChild;}_e3.setProperty("text",_e6,true);_e3.setProperty("url",_e5,true);_e3.setProperty("emphasis",_ea,true);_e3.setProperty("strongemphasis",_eb,true);this._initSubTree();break;}}}if(this.element){this._oDom.addClass(this.element,this.CSS_CLASS_NAME);var _ec=YAHOO.util.CustomEvent;this.destroyEvent=new _ec("destroyEvent",this);this.mouseOverEvent=new _ec("mouseOverEvent",this);this.mouseOutEvent=new _ec("mouseOutEvent",this);this.mouseDownEvent=new _ec("mouseDownEvent",this);this.mouseUpEvent=new _ec("mouseUpEvent",this);this.clickEvent=new _ec("clickEvent",this);this.keyPressEvent=new _ec("keyPressEvent",this);this.keyDownEvent=new _ec("keyDownEvent",this);this.keyUpEvent=new _ec("keyUpEvent",this);this.focusEvent=new _ec("focusEvent",this);this.blurEvent=new _ec("blurEvent",this);if(_e2){_e3.applyConfig(_e2);}_e3.fireQueue();}},_getFirstElement:function(_ed,_ee){var _ef;if(_ed.firstChild&&_ed.firstChild.nodeType==1){_ef=_ed.firstChild;}else{if(_ed.firstChild&&_ed.firstChild.nextSibling&&_ed.firstChild.nextSibling.nodeType==1){_ef=_ed.firstChild.nextSibling;}}if(_ee){return (_ef&&_ef.tagName==_ee)?_ef:false;}return _ef;},_checkString:function(_f0){return (typeof _f0=="string");},_checkDOMNode:function(_f1){return (_f1&&_f1.tagName);},_createRootNodeStructure:function(){this.element=document.createElement("li");this._oText=document.createTextNode("");this._oAnchor=document.createElement("a");this._oAnchor.appendChild(this._oText);this.cfg.refireEvent("url");this.element.appendChild(this._oAnchor);},_initSubTree:function(){var _f2=this.SUBMENU_TYPE;var _f3=this.SUBMENU_ITEM_TYPE;var _f4=this.srcElement;var _f5=this.cfg;if(_f4.childNodes.length>0){var _f6=_f4.firstChild;var _f7=[];do{switch(_f6.tagName){case "DIV":_f5.setProperty("submenu",(new _f2(_f6)));break;case "OPTION":_f7[_f7.length]=_f6;break;}}while((_f6=_f6.nextSibling));var _f8=_f7.length;if(_f8>0){_f5.setProperty("submenu",(new _f2(this._oDom.generateId())));for(var n=0;n<_f8;n++){this._oSubmenu.addItem((new _f3(_f7[n])));}}}},configText:function(_fa,_fb,_fc){var _fd=_fb[0];if(this._oText){this._oText.nodeValue=_fd;}},configHelpText:function(_fe,_ff,_100){var me=this;var Dom=this._oDom;var _103=_ff[0];var oEl=this.element;var _105=this.cfg;var _106=[oEl,this._oAnchor];var oImg=this.submenuIndicator;function initHelpText(){Dom.addClass(_106,"hashelptext");if(_105.getProperty("disabled")){_105.refireEvent("disabled");}if(_105.getProperty("selected")){_105.refireEvent("selected");}}function removeHelpText(){Dom.removeClass(_106,"hashelptext");oEl.removeChild(me._oHelpTextEM);me._oHelpTextEM=null;}if(this._checkDOMNode(_103)){if(this._oHelpTextEM){this._oHelpTextEM.parentNode.replaceChild(_103,this._oHelpTextEM);}else{this._oHelpTextEM=_103;oEl.insertBefore(this._oHelpTextEM,oImg);}initHelpText();}else{if(this._checkString(_103)){if(_103.length===0){removeHelpText();}else{if(!this._oHelpTextEM){this._oHelpTextEM=document.createElement("em");oEl.insertBefore(this._oHelpTextEM,oImg);}this._oHelpTextEM.innerHTML=_103;initHelpText();}}else{if(!_103&&this._oHelpTextEM){removeHelpText();}}}},configURL:function(_108,_109,_10a){var sURL=_109[0];if(!sURL){sURL="#";}this._oAnchor.setAttribute("href",sURL);},configEmphasis:function(_10c,_10d,_10e){var _10f=_10d[0];var _110=this._oAnchor;var _111=this._oText;var _112=this.cfg;var oEM;if(_10f&&_112.getProperty("strongemphasis")){_112.setProperty("strongemphasis",false);}if(_110){if(_10f){oEM=document.createElement("em");oEM.appendChild(_111);_110.appendChild(oEM);}else{oEM=this._getFirstElement(_110,"EM");_110.removeChild(oEM);_110.appendChild(_111);}}},configStrongEmphasis:function(_114,_115,_116){var _117=_115[0];var _118=this._oAnchor;var _119=this._oText;var _11a=this.cfg;var _11b;if(_117&&_11a.getProperty("emphasis")){_11a.setProperty("emphasis",false);}if(_118){if(_117){_11b=document.createElement("strong");_11b.appendChild(_119);_118.appendChild(_11b);}else{_11b=this._getFirstElement(_118,"STRONG");_118.removeChild(_11b);_118.appendChild(_119);}}},configDisabled:function(_11c,_11d,_11e){var _11f=_11d[0];var Dom=this._oDom;var _121=this._oAnchor;var _122=[this.element,_121];var oEM=this._oHelpTextEM;var _124=this.cfg;var oImg=this.submenuIndicator;var _126;var _127;if(oEM){_122[2]=oEM;}if(_11f){if(_124.getProperty("selected")){_124.setProperty("selected",false);}_121.removeAttribute("href");Dom.addClass(_122,"disabled");_126=this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;_127=this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;}else{_121.setAttribute("href",_124.getProperty("url"));Dom.removeClass(_122,"disabled");_126=this.SUBMENU_INDICATOR_IMAGE_PATH;_127=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;}if(oImg){oImg.src=this.imageRoot+_126;oImg.alt=_127;}},configSelected:function(_128,_129,_12a){if(!this.cfg.getProperty("disabled")){var Dom=this._oDom;var _12c=_129[0];var oEM=this._oHelpTextEM;var _12e=[this.element,this._oAnchor];var oImg=this.submenuIndicator;var _130;if(oEM){_12e[2]=oEM;}if(_12c){Dom.addClass(_12e,"selected");_130=this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;}else{Dom.removeClass(_12e,"selected");_130=this.SUBMENU_INDICATOR_IMAGE_PATH;}if(oImg){oImg.src=document.images[(this.imageRoot+_130)].src;}}},configSubmenu:function(_131,_132,_133){var Dom=this._oDom;var oEl=this.element;var _136=_132[0];var oImg=this.submenuIndicator;var _138=this.cfg;var _139=[this.element,this._oAnchor];if(_136){_136.parent=this;this._oSubmenu=_136;if(!oImg){var me=this;function preloadImage(_13b){var _13c=me.imageRoot+_13b;if(!document.images[_13c]){var oImg=document.createElement("img");oImg.src=_13c;oImg.name=_13c;oImg.id=_13c;oImg.style.display="none";document.body.appendChild(oImg);}}preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);preloadImage(this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);preloadImage(this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.SUBMENU_INDICATOR_IMAGE_PATH);oImg.alt=this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;oEl.appendChild(oImg);this.submenuIndicator=oImg;Dom.addClass(_139,"hassubmenu");if(_138.getProperty("disabled")){_138.refireEvent("disabled");}if(_138.getProperty("selected")){_138.refireEvent("selected");}}}else{Dom.removeClass(_139,"hassubmenu");if(oImg){oEl.removeChild(oImg);}if(this._oSubmenu){this._oSubmenu.destroy();}}},initDefaultConfig:function(){var _13e=this.cfg;var _13f=_13e.checkBoolean;_13e.addProperty("text",{value:"",handler:this.configText,validator:this._checkString,suppressEvent:true});_13e.addProperty("helptext",{handler:this.configHelpText});_13e.addProperty("url",{value:"#",handler:this.configURL,suppressEvent:true});_13e.addProperty("emphasis",{value:false,handler:this.configEmphasis,validator:_13f,suppressEvent:true});_13e.addProperty("strongemphasis",{value:false,handler:this.configStrongEmphasis,validator:_13f,suppressEvent:true});_13e.addProperty("disabled",{value:false,handler:this.configDisabled,validator:_13f,suppressEvent:true});_13e.addProperty("selected",{value:false,handler:this.configSelected,validator:_13f,suppressEvent:true});_13e.addProperty("submenu",{handler:this.configSubmenu});},getNextEnabledSibling:function(){if(this.parent instanceof YAHOO.widget.MenuModule){var _140=this.groupIndex;function getNextArrayItem(_141,_142){return _141[_142]||getNextArrayItem(_141,(_142+1));}var _143=this.parent.getItemGroups();var _144;if(this.index<(_143[_140].length-1)){_144=getNextArrayItem(_143[_140],(this.index+1));}else{var _145;if(_140<(_143.length-1)){_145=_140+1;}else{_145=0;}var _146=getNextArrayItem(_143,_145);_144=getNextArrayItem(_146,0);}return _144.cfg.getProperty("disabled")?_144.getNextEnabledSibling():_144;}},getPreviousEnabledSibling:function(){if(this.parent instanceof YAHOO.widget.MenuModule){var _147=this.groupIndex;function getPreviousArrayItem(_148,_149){return _148[_149]||getPreviousArrayItem(_148,(_149-1));}function getFirstItemIndex(_14a,_14b){return _14a[_14b]?_14b:getFirstItemIndex(_14a,(_14b+1));}var _14c=this.parent.getItemGroups();var _14d;if(this.index>getFirstItemIndex(_14c[_147],0)){_14d=getPreviousArrayItem(_14c[_147],(this.index-1));}else{var _14e;if(_147>getFirstItemIndex(_14c,0)){_14e=_147-1;}else{_14e=_14c.length-1;}var _14f=getPreviousArrayItem(_14c,_14e);_14d=getPreviousArrayItem(_14f,(_14f.length-1));}return _14d.cfg.getProperty("disabled")?_14d.getPreviousEnabledSibling():_14d;}},focus:function(){var _150=this.parent;var _151=this._oAnchor;var _152=_150.activeItem;if(!this.cfg.getProperty("disabled")&&_150&&_150.cfg.getProperty("visible")){if(_152){_152.blur();}_151.focus();if(_150&&this.browser=="opera"&&this._oSubmenu){_151.focus();}this.focusEvent.fire();}},blur:function(){var _153=this.parent;if(!this.cfg.getProperty("disabled")&&_153&&this._oDom.getStyle(_153.element,"visibility")=="visible"){this._oAnchor.blur();this.blurEvent.fire();}},destroy:function(){var oEl=this.element;if(oEl){this.mouseOverEvent.unsubscribeAll();this.mouseOutEvent.unsubscribeAll();this.mouseDownEvent.unsubscribeAll();this.mouseUpEvent.unsubscribeAll();this.clickEvent.unsubscribeAll();this.keyPressEvent.unsubscribeAll();this.keyDownEvent.unsubscribeAll();this.keyUpEvent.unsubscribeAll();this.focusEvent.unsubscribeAll();this.blurEvent.unsubscribeAll();this.cfg.configChangedEvent.unsubscribeAll();var _155=oEl.parentNode;if(_155){_155.removeChild(oEl);this.destroyEvent.fire();}this.destroyEvent.unsubscribeAll();}}};YAHOO.widget.Menu=function(_156,_157){YAHOO.widget.Menu.superclass.constructor.call(this,_156,_157);};YAHOO.extend(YAHOO.widget.Menu,YAHOO.widget.MenuModule);YAHOO.widget.Menu.prototype.init=function(_158,_159){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.Menu.superclass.init.call(this,_158);this.beforeInitEvent.fire(YAHOO.widget.Menu);this.showEvent.subscribe(this._onMenuShow,this,true);this.mouseOverEvent.subscribe(this._onMenuMouseOver,this,true);this.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);if(_159){this.cfg.applyConfig(_159,true);}this.initEvent.fire(YAHOO.widget.Menu);};YAHOO.widget.Menu.prototype._onMenuShow=function(_15a,_15b,_15c){var _15d=this.parent;if(_15d&&_15d.parent instanceof YAHOO.widget.Menu){var _15e=_15d.parent.cfg.getProperty("submenualignment");this.cfg.setProperty("submenualignment",[_15e[0],_15e[1]]);}};YAHOO.widget.Menu.prototype._onMenuMouseOver=function(_15f,_160,_161){if(this.parent){this.parent.cfg.setProperty("selected",true);}};YAHOO.widget.Menu.prototype._onMenuKeyDown=function(_162,_163,_164){if(this.cfg.getProperty("position")=="dynamic"){var _165=_163[0];var _166=this.parent;if(_165.keyCode==27){this.hide();if(_166){_166.focus();if(_166.parent instanceof YAHOO.widget.Menu){_166.cfg.setProperty("selected",true);}YAHOO.util.Event.preventDefault(_165);}}}};YAHOO.widget.Menu.prototype.onDomResize=function(e,obj){if(!this._handleResize){this._handleResize=true;return;}var me=this;var _16a=this.cfg;if(_16a.getProperty("position")=="dynamic"){_16a.setProperty("width",(this._getOffsetWidth()+"px"));if(this.parent&&_16a.getProperty("visible")){function align(){me.align();}window.setTimeout(align,0);}}YAHOO.widget.Menu.superclass.onDomResize.call(this,e,obj);};YAHOO.widget.MenuItem=function(_16b,_16c){YAHOO.widget.MenuItem.superclass.constructor.call(this,_16b,_16c);};YAHOO.extend(YAHOO.widget.MenuItem,YAHOO.widget.MenuModuleItem);YAHOO.widget.MenuItem.prototype.init=function(_16d,_16e){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.MenuItem.superclass.init.call(this,_16d);this.keyDownEvent.subscribe(this._onKeyDown,this,true);this.mouseOverEvent.subscribe(this._onMouseOver,this,true);this.mouseOutEvent.subscribe(this._onMouseOut,this,true);var _16f=this.cfg;if(_16e){_16f.applyConfig(_16e,true);}_16f.fireQueue();};YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_PATH="nt/ic/ut/bsc/menuchk8_nrm_1.gif";YAHOO.widget.MenuItem.prototype.SELECTED_CHECKED_IMAGE_PATH="nt/ic/ut/bsc/menuchk8_hov_1.gif";YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_PATH="nt/ic/ut/bsc/menuchk8_dim_1.gif";YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_ALT_TEXT="Checked.";YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_ALT_TEXT="Checked. (Item disabled.)";YAHOO.widget.MenuItem.prototype._checkImage=null;YAHOO.widget.MenuItem.prototype._onKeyDown=function(_170,_171,_172){var _173=YAHOO.util.Event;var _174=_171[0];var _175=this.parent;var _176=this.cfg;var _177;switch(_174.keyCode){case 38:case 40:if(this==_175.activeItem&&!_176.getProperty("selected")){_176.setProperty("selected",true);}else{var _178=(_174.keyCode==38)?this.getPreviousEnabledSibling():this.getNextEnabledSibling();if(_178){_175.clearActiveItem();_178.cfg.setProperty("selected",true);_178.focus();}}_173.preventDefault(_174);break;case 39:_175.clearActiveItem();_176.setProperty("selected",true);this.focus();var _179=_176.getProperty("submenu");if(_179){_179.show();_179.setInitialSelection();}else{if(YAHOO.widget.MenuBarItem&&_175.parent&&_175.parent instanceof YAHOO.widget.MenuBarItem){_175.hide();_177=_175.parent;if(_177){_177.focus();_177.cfg.setProperty("selected",true);}}}_173.preventDefault(_174);break;case 37:if(_175.parent){_175.hide();_177=_175.parent;if(_177){_177.focus();_177.cfg.setProperty("selected",true);}}_173.preventDefault(_174);break;}};YAHOO.widget.MenuItem.prototype._onMouseOver=function(_17a,_17b,_17c){var _17d=this.parent;var _17e=this.cfg;var _17f=_17d.activeItem;if(_17f&&_17f!=this){_17d.clearActiveItem();}_17e.setProperty("selected",true);this.focus();var _180=_17e.getProperty("submenu");if(_180){_180.show();}};YAHOO.widget.MenuItem.prototype._onMouseOut=function(_181,_182,_183){var _184=this.cfg;var _185=_184.getProperty("submenu");_184.setProperty("selected",false);if(_185){var _186=_182[0];var _187=YAHOO.util.Event.getRelatedTarget(_186);if(!(_187==_185.element||YAHOO.util.Dom.isAncestor(_185.element,_187))){_185.hide();}}};YAHOO.widget.MenuItem.prototype.configChecked=function(_188,_189,_18a){var Dom=YAHOO.util.Dom;var _18c=_189[0];var oEl=this.element;var _18e=this.cfg;var oImg;if(_18c){var me=this;function preloadImage(_191){var _192=me.imageRoot+_191;if(!document.images[_192]){var oImg=document.createElement("img");oImg.src=_192;oImg.name=_192;oImg.id=_192;oImg.style.display="none";document.body.appendChild(oImg);}}preloadImage(this.CHECKED_IMAGE_PATH);preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);oImg=document.createElement("img");oImg.src=(this.imageRoot+this.CHECKED_IMAGE_PATH);oImg.alt=this.CHECKED_IMAGE_ALT_TEXT;var _194=this.cfg.getProperty("submenu");if(_194){oEl.insertBefore(oImg,_194.element);}else{oEl.appendChild(oImg);}Dom.addClass([oEl,oImg],"checked");this._checkImage=oImg;if(_18e.getProperty("disabled")){_18e.refireEvent("disabled");}if(_18e.getProperty("selected")){_18e.refireEvent("selected");}}else{oImg=this._checkImage;Dom.removeClass([oEl,oImg],"checked");if(oImg){oEl.removeChild(oImg);}this._checkImage=null;}};YAHOO.widget.MenuItem.prototype.configSelected=function(_195,_196,_197){YAHOO.widget.MenuItem.superclass.configSelected.call(this,_195,_196,_197);var _198=this.cfg;if(!_198.getProperty("disabled")&&_198.getProperty("checked")){var _199=_196[0];var sSrc=this.imageRoot+(_199?this.SELECTED_CHECKED_IMAGE_PATH:this.CHECKED_IMAGE_PATH);this._checkImage.src=document.images[sSrc].src;}};YAHOO.widget.MenuItem.prototype.configDisabled=function(_19b,_19c,_19d){YAHOO.widget.MenuItem.superclass.configDisabled.call(this,_19b,_19c,_19d);if(this.cfg.getProperty("checked")){var _19e=_19c[0];var sAlt=this.CHECKED_IMAGE_ALT_TEXT;var sSrc=this.CHECKED_IMAGE_PATH;var oImg=this._checkImage;if(_19e){sAlt=this.DISABLED_CHECKED_IMAGE_ALT_TEXT;sSrc=this.DISABLED_CHECKED_IMAGE_PATH;}oImg.src=document.images[(this.imageRoot+sSrc)].src;oImg.alt=sAlt;}};YAHOO.widget.MenuItem.prototype.initDefaultConfig=function(){YAHOO.widget.MenuItem.superclass.initDefaultConfig.call(this);this.cfg.addProperty("checked",{value:false,handler:this.configChecked,validator:this.cfg.checkBoolean,suppressEvent:true});};YAHOO.widget.ContextMenu=function(_1a2,_1a3){YAHOO.widget.ContextMenu.superclass.constructor.call(this,_1a2,_1a3);};YAHOO.extend(YAHOO.widget.ContextMenu,YAHOO.widget.Menu);YAHOO.widget.ContextMenu.prototype._oTrigger=null;YAHOO.widget.ContextMenu.prototype.init=function(_1a4,_1a5){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.ContextMenuItem;}YAHOO.widget.ContextMenu.superclass.init.call(this,_1a4);this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);if(_1a5){this.cfg.applyConfig(_1a5,true);}this.initEvent.fire(YAHOO.widget.ContextMenu);};YAHOO.widget.ContextMenu.prototype._onDocumentMouseDown=function(_1a6,_1a7){var _1a8=YAHOO.util.Event.getTarget(_1a6);var _1a9=this._oTargetElement;if(_1a8!=_1a9||!YAHOO.util.Dom.isAncestor(_1a9,_1a8)){this.hide();}};YAHOO.widget.ContextMenu.prototype._onTriggerClick=function(_1aa,_1ab){if(_1aa.ctrlKey){YAHOO.util.Event.stopEvent(_1aa);}};YAHOO.widget.ContextMenu.prototype._onTriggerContextMenu=function(_1ac,_1ad){var _1ae=YAHOO.util.Event;var _1af=this.cfg;if(_1ac.type=="mousedown"){if(!_1ac.ctrlKey){return;}_1ae.stopEvent(_1ac);}this.contextEventTarget=_1ae.getTarget(_1ac);var nX=_1ae.getPageX(_1ac);var nY=_1ae.getPageY(_1ac);_1af.applyConfig({x:nX,y:nY,visible:true});_1af.fireQueue();_1ae.preventDefault(_1ac);};YAHOO.widget.ContextMenu.prototype.contextEventTarget=null;YAHOO.widget.ContextMenu.prototype.initDefaultConfig=function(){YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);this.cfg.addProperty("trigger",{handler:this.configTrigger});};YAHOO.widget.ContextMenu.prototype.configTrigger=function(_1b2,_1b3,_1b4){var _1b5=YAHOO.util.Event;var _1b6=_1b3[0];if(_1b6){if(this._oTrigger){_1b5.purgeElement(this._oTrigger);}this._oTrigger=_1b6;var _1b7=(this.browser=="opera");_1b5.addListener(_1b6,(_1b7?"mousedown":"contextmenu"),this._onTriggerContextMenu,this,true);if(_1b7){_1b5.addListener(_1b6,"click",this._onTriggerClick,this,true);}_1b5.addListener(document,"mousedown",this._onDocumentMouseDown,this,true);}};YAHOO.widget.ContextMenuItem=function(_1b8,_1b9){YAHOO.widget.ContextMenuItem.superclass.constructor.call(this,_1b8,_1b9);};YAHOO.extend(YAHOO.widget.ContextMenuItem,YAHOO.widget.MenuItem);YAHOO.widget.ContextMenuItem.prototype.init=function(_1ba,_1bb){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.ContextMenu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.ContextMenuItem;}YAHOO.widget.ContextMenuItem.superclass.init.call(this,_1ba);var _1bc=this.cfg;if(_1bb){_1bc.applyConfig(_1bb,true);}_1bc.fireQueue();};YAHOO.widget.MenuBar=function(_1bd,_1be){YAHOO.widget.MenuBar.superclass.constructor.call(this,_1bd,_1be);};YAHOO.extend(YAHOO.widget.MenuBar,YAHOO.widget.MenuModule);YAHOO.widget.MenuBar.prototype.init=function(_1bf,_1c0){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuBarItem;}YAHOO.widget.MenuBar.superclass.init.call(this,_1bf);this.beforeInitEvent.fire(YAHOO.widget.MenuBar);var _1c1=this.cfg;if(!_1c0||(_1c0&&!_1c0.position)){_1c1.queueProperty("position","static");}if(!_1c0||(_1c0&&!_1c0.submenualignment)){_1c1.queueProperty("submenualignment",["tl","bl"]);}if(_1c0){_1c1.applyConfig(_1c0,true);}this.initEvent.fire(YAHOO.widget.MenuBar);};YAHOO.widget.MenuBar.prototype.CSS_CLASS_NAME="yuimenubar";YAHOO.widget.MenuBarItem=function(_1c2,_1c3){YAHOO.widget.MenuBarItem.superclass.constructor.call(this,_1c2,_1c3);};YAHOO.extend(YAHOO.widget.MenuBarItem,YAHOO.widget.MenuModuleItem);YAHOO.widget.MenuBarItem.prototype.init=function(_1c4,_1c5){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}if(!this.SUBMENU_ITEM_TYPE){this.SUBMENU_ITEM_TYPE=YAHOO.widget.MenuItem;}YAHOO.widget.MenuBarItem.superclass.init.call(this,_1c4);this.keyDownEvent.subscribe(this._onKeyDown,this,true);var _1c6=this.cfg;if(_1c5){_1c6.applyConfig(_1c5,true);}_1c6.fireQueue();};YAHOO.widget.MenuBarItem.prototype.CSS_CLASS_NAME="yuimenubaritem";YAHOO.widget.MenuBarItem.prototype.SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/alt1/menuarodwn8_nrm_1.gif";YAHOO.widget.MenuBarItem.prototype.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/alt1/menuarodwn8_hov_1.gif";YAHOO.widget.MenuBarItem.prototype.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH="nt/ic/ut/alt1/menuarodwn8_dim_1.gif";YAHOO.widget.MenuBarItem.prototype._onKeyDown=function(_1c7,_1c8,_1c9){var _1ca=YAHOO.util.Event;var _1cb=_1c8[0];var _1cc=this.cfg;var _1cd=this.parent;switch(_1cb.keyCode){case 37:case 39:if(this==_1cd.activeItem&&!_1cc.getProperty("selected")){_1cc.setProperty("selected",true);}else{var _1ce=(_1cb.keyCode==37)?this.getPreviousEnabledSibling():this.getNextEnabledSibling();if(_1ce){_1cd.clearActiveItem();_1ce.cfg.setProperty("selected",true);_1ce.focus();}}_1ca.preventDefault(_1cb);break;case 40:_1cd.clearActiveItem();_1cc.setProperty("selected",true);this.focus();var _1cf=_1cc.getProperty("submenu");if(_1cf){_1cf.show();_1cf.setInitialSelection();}_1ca.preventDefault(_1cb);break;}};
\ No newline at end of file
diff --git a/lib/yui/menu/menu.js b/lib/yui/menu/menu.js
new file mode 100755 (executable)
index 0000000..47bc52f
--- /dev/null
@@ -0,0 +1,5152 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+Version 0.11.0\r
+*/\r
+\r
+\r
+/**\r
+* @class The superclass of all menu containers.\r
+* @constructor\r
+* @extends YAHOO.widget.Overlay\r
+* @base YAHOO.widget.Overlay\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuModule instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModule = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuModule.superclass.constructor.call(\r
+        this, \r
+        p_oElement, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuModule, YAHOO.widget.Overlay);\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLDivElement of the MenuModule instance.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuModule.prototype.CSS_CLASS_NAME = "yuimenu";\r
+\r
+/**\r
+* Constant representing the type of item to instantiate and add when parsing \r
+* the child nodes (either HTMLLIElement, HTMLOptGroupElement or \r
+* HTMLOptionElement) of a menu's DOM.  The default \r
+* is YAHOO.widget.MenuModuleItem.\r
+* @final\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.ITEM_TYPE = null;\r
+\r
+/**\r
+* Constant representing the tagname of the HTMLElement used to title \r
+* a group of items.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuModule.prototype.GROUP_TITLE_TAG_NAME = "H6";\r
+\r
+// Private properties\r
+\r
+/**\r
+* Array of HTMLElements used to title groups of items.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aGroupTitleElements = null;\r
+\r
+/**\r
+* Multi-dimensional array of items.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aItemGroups = null;\r
+\r
+/**\r
+* An array of HTMLUListElements, each of which is the parent node of each \r
+* items's HTMLLIElement node.\r
+* @private\r
+* @type {Array}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._aListElements = null;\r
+\r
+/**\r
+* Reference to the Event utility singleton.\r
+* @private\r
+* @type {YAHOO.util.Event}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oEventUtil = YAHOO.util.Event;\r
+\r
+/**\r
+* Reference to the Dom utility singleton.\r
+* @private\r
+* @type {YAHOO.util.Dom}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oDom = YAHOO.util.Dom;\r
+\r
+/**\r
+* Reference to the item the mouse is currently over.\r
+* @private\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._oCurrentItem = null;\r
+\r
+/** \r
+* The current state of a MenuModule instance's "mouseover" event\r
+* @private\r
+* @type {Boolean}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._bFiredMouseOverEvent = false;\r
+\r
+/** \r
+* The current state of a MenuModule instance's "mouseout" event\r
+* @private\r
+* @type {Boolean}\r
+*/\r
+YAHOO.widget.MenuModule.prototype._bFiredMouseOutEvent = false;\r
+\r
+// Public properties\r
+\r
+/**\r
+* Reference to the item that has focus.\r
+* @private\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.activeItem = null;\r
+\r
+/**\r
+* Returns a MenuModule instance's parent object.\r
+* @type {YAHOO.widget.MenuModuleItem}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.parent = null;\r
+\r
+/**\r
+* Returns the HTMLElement (either HTMLSelectElement or HTMLDivElement)\r
+* used create the MenuModule instance.\r
+* @type {HTMLSelectElement/HTMLDivElement}\r
+*/\r
+YAHOO.widget.MenuModule.prototype.srcElement = null;\r
+\r
+// Events\r
+\r
+/**\r
+* Fires when the mouse has entered a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseOverEvent = null;\r
+\r
+/**\r
+* Fires when the mouse has left a MenuModule instance.  Passes back the DOM \r
+* Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseOutEvent = null;\r
+\r
+/**\r
+* Fires when the user mouses down on a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseDownEvent = null;\r
+\r
+/**\r
+* Fires when the user releases a mouse button while the mouse is over \r
+* a MenuModule instance.  Passes back the DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.mouseUpEvent = null;\r
+\r
+/**\r
+* Fires when the user clicks the on a MenuModule instance.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.clickEvent = null;\r
+\r
+/**\r
+* Fires when the user presses an alphanumeric key.  Passes back the \r
+* DOM Event object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyPressEvent = null;\r
+\r
+/**\r
+* Fires when the user presses a key.  Passes back the DOM Event \r
+* object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyDownEvent = null;\r
+\r
+/**\r
+* Fires when the user releases a key.  Passes back the DOM Event \r
+* object as an argument.\r
+* @type {YAHOO.util.CustomEvent}\r
+* @see YAHOO.util.CustomEvent\r
+*/\r
+YAHOO.widget.MenuModule.prototype.keyUpEvent = null;\r
+\r
+/**\r
+* The MenuModule class's initialization method. This method is automatically \r
+* called  by the constructor, and sets up all DOM references for \r
+* pre-existing markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuModule instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    var Dom = this._oDom;\r
+    var Event = this._oEventUtil;\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuModuleItem;\r
+\r
+    }\r
+\r
+    this._aItemGroups = [];\r
+    this._aListElements = [];\r
+    this._aGroupTitleElements = [];\r
+\r
+    var oElement;\r
+\r
+    if(typeof p_oElement == "string") {\r
+\r
+        oElement = document.getElementById(p_oElement);\r
+\r
+    }\r
+    else if(p_oElement.tagName) {\r
+\r
+        oElement = p_oElement;\r
+\r
+    }\r
+\r
+    if(oElement) {\r
+\r
+        switch(oElement.tagName) {\r
+    \r
+            case "DIV":\r
+\r
+                this.srcElement = oElement;\r
+\r
+                /* \r
+                    Note: we don't pass the user config in here yet \r
+                    because we only want it executed once, at the lowest \r
+                    subclass level.\r
+                */ \r
+            \r
+                YAHOO.widget.MenuModule.superclass.init.call(this, oElement);\r
+\r
+                this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+                /*\r
+                    Populate the collection of item groups and item\r
+                    group titles\r
+                */\r
+\r
+                var oNode = this.body.firstChild;\r
+                var i = 0;\r
+\r
+                do {\r
+\r
+                    switch(oNode.tagName) {\r
+\r
+                        case this.GROUP_TITLE_TAG_NAME:\r
+                        \r
+                            this._aGroupTitleElements[i] = oNode;\r
+\r
+                        break;\r
+\r
+                        case "UL":\r
+\r
+                            this._aListElements[i] = oNode;\r
+                            this._aItemGroups[i] = [];\r
+                            i++;\r
+\r
+                        break;\r
+\r
+                    }\r
+\r
+                }\r
+                while((oNode = oNode.nextSibling));\r
+\r
+                /*\r
+                    Apply the "first-of-type" class to the first UL to mimic \r
+                    the "first-of-type" CSS3 psuedo class.\r
+                */\r
+\r
+                if(this._aListElements[0]) {\r
+\r
+                    Dom.addClass(this._aListElements[0], "first-of-type");\r
+\r
+                }\r
+\r
+\r
+    \r
+            break;\r
+    \r
+            case "SELECT":\r
+    \r
+                this.srcElement = oElement;\r
+    \r
+    \r
+                /*\r
+                    The source element is not something that we can use \r
+                    outright, so we need to create a new Overlay\r
+                */\r
+    \r
+                var sId = Dom.generateId();\r
+\r
+                /* \r
+                    Note: we don't pass the user config in here yet \r
+                    because we only want it executed once, at the lowest \r
+                    subclass level.\r
+                */ \r
+            \r
+                YAHOO.widget.MenuModule.superclass.init.call(this, sId); \r
+\r
+                this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+\r
+\r
+            break;\r
+    \r
+        }\r
+\r
+    }\r
+    else {\r
+\r
+        /* \r
+            Note: we don't pass the user config in here yet \r
+            because we only want it executed once, at the lowest \r
+            subclass level.\r
+        */ \r
+    \r
+        YAHOO.widget.MenuModule.superclass.init.call(this, p_oElement);\r
+\r
+        this.beforeInitEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+\r
+\r
+    }\r
+\r
+    if(this.element) {\r
+\r
+        var oEl = this.element;\r
+        var CustomEvent = YAHOO.util.CustomEvent;\r
+\r
+        Dom.addClass(oEl, this.CSS_CLASS_NAME);\r
+\r
+        // Assign DOM event handlers\r
+\r
+        Event.addListener(\r
+                oEl, \r
+                "mouseover", \r
+                this._onElementMouseOver, \r
+                this, \r
+                true\r
+            );\r
+\r
+        Event.addListener(oEl, "mouseout", this._onElementMouseOut, this, true);\r
+        Event.addListener(oEl, "mousedown", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "mouseup", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "click", this._onElementClick, this, true);\r
+        Event.addListener(oEl, "keydown", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "keyup", this._onDOMEvent, this, true);\r
+        Event.addListener(oEl, "keypress", this._onDOMEvent, this, true);\r
+\r
+        // Create custom events\r
+\r
+        this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);\r
+        this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);\r
+        this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);\r
+        this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);\r
+        this.clickEvent = new CustomEvent("clickEvent", this);\r
+        this.keyPressEvent = new CustomEvent("keyPressEvent", this);\r
+        this.keyDownEvent = new CustomEvent("keyDownEvent", this);\r
+        this.keyUpEvent = new CustomEvent("keyUpEvent", this);\r
+\r
+        // Subscribe to Custom Events\r
+\r
+        this.beforeRenderEvent.subscribe(this._onBeforeRender, this, true);\r
+        this.renderEvent.subscribe(this._onRender, this, true);\r
+        this.showEvent.subscribe(this._onShow, this, true);\r
+        this.beforeHideEvent.subscribe(this._onBeforeHide, this, true);\r
+\r
+        if(p_oConfig) {\r
+    \r
+            this.cfg.applyConfig(p_oConfig, true);\r
+    \r
+        }\r
+\r
+        this.cfg.queueProperty("visible", false);\r
+\r
+        if(this.srcElement) {\r
+\r
+            this._initSubTree();\r
+\r
+        }\r
+\r
+    }\r
+\r
+    this.initEvent.fire(YAHOO.widget.MenuModule);\r
+\r
+};\r
+\r
+// Private methods\r
+\r
+/**\r
+* Iterates the source element's childNodes collection and uses the child \r
+* nodes to instantiate MenuModule and MenuModuleItem instances.\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._initSubTree = function() {\r
+\r
+    var oNode;\r
+\r
+\r
+    switch(this.srcElement.tagName) {\r
+\r
+        case "DIV":\r
+\r
+            if(this._aListElements.length > 0) {\r
+\r
+\r
+                var i = this._aListElements.length - 1;\r
+\r
+                do {\r
+\r
+                    oNode = this._aListElements[i].firstChild;\r
+    \r
+\r
+                    do {\r
+    \r
+                        switch(oNode.tagName) {\r
+        \r
+                            case "LI":\r
+\r
+\r
+                                this.addItem(new this.ITEM_TYPE(oNode), i);\r
+        \r
+                            break;\r
+        \r
+                        }\r
+            \r
+                    }\r
+                    while((oNode = oNode.nextSibling));\r
+            \r
+                }\r
+                while(i--);\r
+\r
+            }\r
+\r
+        break;\r
+\r
+        case "SELECT":\r
+\r
+\r
+            oNode = this.srcElement.firstChild;\r
+\r
+            do {\r
+\r
+                switch(oNode.tagName) {\r
+\r
+                    case "OPTGROUP":\r
+                    case "OPTION":\r
+\r
+\r
+                        this.addItem(new this.ITEM_TYPE(oNode));\r
+\r
+                    break;\r
+\r
+                }\r
+\r
+            }\r
+            while((oNode = oNode.nextSibling));\r
+\r
+        break;\r
+\r
+    }\r
+\r
+};\r
+\r
+/**\r
+* Returns the first enabled item in a menu instance.\r
+* @return Returns a MenuModuleItem instance.\r
+* @type YAHOO.widget.MenuModuleItem\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getFirstEnabledItem = function() {\r
+\r
+    var nGroups = this._aItemGroups.length;\r
+    var oItem;\r
+    var aItemGroup;\r
+\r
+    for(var i=0; i<nGroups; i++) {\r
+\r
+        aItemGroup = this._aItemGroups[i];\r
+        \r
+        if(aItemGroup) {\r
+\r
+            var nItems = aItemGroup.length;\r
+            \r
+            for(var n=0; n<nItems; n++) {\r
+            \r
+                oItem = aItemGroup[n];\r
+                \r
+                if(!oItem.cfg.getProperty("disabled")) {\r
+                \r
+                    return oItem;\r
+                \r
+                }\r
+    \r
+                oItem = null;\r
+    \r
+            }\r
+        \r
+        }\r
+    \r
+    }\r
+    \r
+};\r
+\r
+/**\r
+* Determines if the value is one of the supported positions.\r
+* @private\r
+* @param {Object} p_sPosition The object to be evaluated.\r
+* @return Returns true if the position is supported.\r
+* @type Boolean\r
+*/\r
+YAHOO.widget.MenuModule.prototype._checkPosition = function(p_sPosition) {\r
+\r
+    if(typeof p_sPosition == "string") {\r
+\r
+        var sPosition = p_sPosition.toLowerCase();\r
+\r
+        return ("dynamic,static".indexOf(sPosition) != -1);\r
+\r
+    }\r
+\r
+};\r
+\r
+/**\r
+* Adds an item to a group.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be added.\r
+* @param {Number} p_nItemIndex Optional. Index at which the item \r
+* should be added.\r
+* @return The item that was added.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype._addItemToGroup = \r
+\r
+    function(p_nGroupIndex, p_oItem, p_nItemIndex) {\r
+\r
+        var Dom = this._oDom;\r
+        var oItem;\r
+\r
+        if(p_oItem instanceof this.ITEM_TYPE) {\r
+\r
+            oItem = p_oItem;     \r
+\r
+        }\r
+        else if(typeof p_oItem == "string") {\r
+\r
+            oItem = new this.ITEM_TYPE(p_oItem);\r
+        \r
+        }\r
+\r
+        if(oItem) {\r
+        \r
+            var nGroupIndex = typeof p_nGroupIndex == "number" ? \r
+                    p_nGroupIndex : 0;\r
+            \r
+            var aGroup = this._getItemGroup(nGroupIndex);\r
+            \r
+            var oGroupItem;\r
+    \r
+\r
+            if(!aGroup) {\r
+    \r
+                aGroup = this._createItemGroup(nGroupIndex);\r
+    \r
+            }\r
+\r
+            if(typeof p_nItemIndex == "number") {\r
+    \r
+                var bAppend = (p_nItemIndex >= aGroup.length);            \r
+    \r
+\r
+                if(aGroup[p_nItemIndex]) {\r
+        \r
+                    aGroup.splice(p_nItemIndex, 0, oItem);\r
+        \r
+                }\r
+                else {\r
+        \r
+                    aGroup[p_nItemIndex] = oItem;\r
+        \r
+                }\r
+    \r
+    \r
+                oGroupItem = aGroup[p_nItemIndex];\r
+    \r
+                if(oGroupItem) {\r
+    \r
+                    if(bAppend && !oGroupItem.element.parentNode) {\r
+            \r
+                        this._aListElements[nGroupIndex].appendChild(\r
+                            oGroupItem.element\r
+                        );\r
+        \r
+                    }\r
+                    else {\r
+      \r
+        \r
+                        /**\r
+                        * Returns the next sibling of an item in an array \r
+                        * @param {p_aArray} An array\r
+                        * @param {p_nStartIndex} The index to start searching\r
+                        * the array \r
+                        * @ignore\r
+                        * @return Returns an item in an array\r
+                        * @type Object \r
+                        */\r
+                        function getNextItemSibling(p_aArray, p_nStartIndex) {\r
+                \r
+                            return (\r
+                                    p_aArray[p_nStartIndex] || \r
+                                    getNextItemSibling(\r
+                                        p_aArray, \r
+                                        (p_nStartIndex+1)\r
+                                    )\r
+                                );\r
+                \r
+                        }\r
+        \r
+        \r
+                        var oNextItemSibling = \r
+                                getNextItemSibling(aGroup, (p_nItemIndex+1));\r
+        \r
+                        if(oNextItemSibling && !oGroupItem.element.parentNode) {\r
+                \r
+                            this._aListElements[nGroupIndex].insertBefore(\r
+                                    oGroupItem.element, \r
+                                    oNextItemSibling.element\r
+                                );\r
+            \r
+                        }\r
+        \r
+                    }\r
+        \r
+    \r
+                    oGroupItem.parent = this;\r
+            \r
+                    this._subscribeToItemEvents(oGroupItem);\r
+        \r
+                    this._configureItemSubmenuModule(oGroupItem);\r
+                    \r
+                    this._updateItemProperties(nGroupIndex);\r
+            \r
+\r
+                    return oGroupItem;\r
+        \r
+                }\r
+    \r
+            }\r
+            else {\r
+        \r
+                var nItemIndex = aGroup.length;\r
+        \r
+                aGroup[nItemIndex] = oItem;\r
+        \r
+        \r
+                oGroupItem = aGroup[nItemIndex];\r
+        \r
+                if(oGroupItem) {\r
+        \r
+                    if(\r
+                        !Dom.isAncestor(\r
+                            this._aListElements[nGroupIndex], \r
+                            oGroupItem.element\r
+                        )\r
+                    ) {\r
+        \r
+                        this._aListElements[nGroupIndex].appendChild(\r
+                            oGroupItem.element\r
+                        );\r
+        \r
+                    }\r
+        \r
+                    oGroupItem.element.setAttribute("groupindex", nGroupIndex);\r
+                    oGroupItem.element.setAttribute("index", nItemIndex);\r
+            \r
+                    oGroupItem.parent = this;\r
+        \r
+                    oGroupItem.index = nItemIndex;\r
+                    oGroupItem.groupIndex = nGroupIndex;\r
+            \r
+                    this._subscribeToItemEvents(oGroupItem);\r
+        \r
+                    this._configureItemSubmenuModule(oGroupItem);\r
+        \r
+                    if(nItemIndex === 0) {\r
+            \r
+                        Dom.addClass(oGroupItem.element, "first-of-type");\r
+            \r
+                    }\r
+\r
+            \r
+                    return oGroupItem;\r
+        \r
+                }\r
+        \r
+            }\r
+\r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Removes an item from a group by index.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {Number} p_nItemIndex Number indicating the index of the item to  \r
+* be removed.\r
+* @return The item that was removed.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/    \r
+YAHOO.widget.MenuModule.prototype._removeItemFromGroupByIndex = \r
+\r
+    function(p_nGroupIndex, p_nItemIndex) {\r
+\r
+        var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;\r
+        var aGroup = this._getItemGroup(nGroupIndex);\r
+    \r
+        if(aGroup) {\r
+    \r
+            var aArray = aGroup.splice(p_nItemIndex, 1);\r
+            var oItem = aArray[0];\r
+        \r
+            if(oItem) {\r
+        \r
+                // Update the index and className properties of each member        \r
+                \r
+                this._updateItemProperties(nGroupIndex);\r
+        \r
+                if(aGroup.length === 0) {\r
+        \r
+                    // Remove the UL\r
+        \r
+                    var oUL = this._aListElements[nGroupIndex];\r
+        \r
+                    if(this.body && oUL) {\r
+        \r
+                        this.body.removeChild(oUL);\r
+        \r
+                    }\r
+        \r
+                    // Remove the group from the array of items\r
+        \r
+                    this._aItemGroups.splice(nGroupIndex, 1);\r
+        \r
+        \r
+                    // Remove the UL from the array of ULs\r
+        \r
+                    this._aListElements.splice(nGroupIndex, 1);\r
+        \r
+        \r
+                    /*\r
+                         Assign the "first-of-type" class to the new first UL \r
+                         in the collection\r
+                    */\r
+        \r
+                    oUL = this._aListElements[0];\r
+        \r
+                    if(oUL) {\r
+        \r
+                        this._oDom.addClass(oUL, "first-of-type");\r
+        \r
+                    }            \r
+        \r
+                }\r
+        \r
+        \r
+                // Return a reference to the item that was removed\r
+            \r
+                return oItem;\r
+        \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Removes a item from a group by reference.\r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group to which\r
+* the item belongs.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be removed.\r
+* @return The item that was removed.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/    \r
+YAHOO.widget.MenuModule.prototype._removeItemFromGroupByValue =\r
+\r
+    function(p_nGroupIndex, p_oItem) {\r
+\r
+        var aGroup = this._getItemGroup(p_nGroupIndex);\r
+\r
+        if(aGroup) {\r
+\r
+            var nItems = aGroup.length;\r
+            var nItemIndex = -1;\r
+        \r
+            if(nItems > 0) {\r
+        \r
+                var i = nItems-1;\r
+            \r
+                do {\r
+            \r
+                    if(aGroup[i] == p_oItem) {\r
+            \r
+                        nItemIndex = i;\r
+                        break;    \r
+            \r
+                    }\r
+            \r
+                }\r
+                while(i--);\r
+            \r
+                if(nItemIndex > -1) {\r
+            \r
+                    return this._removeItemFromGroupByIndex(\r
+                                p_nGroupIndex, \r
+                                nItemIndex\r
+                            );\r
+            \r
+                }\r
+        \r
+            }\r
+        \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Updates the index, groupindex, and className properties of the items\r
+* in the specified group. \r
+* @private\r
+* @param {Number} p_nGroupIndex Number indicating the group of items to update.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._updateItemProperties = \r
+\r
+    function(p_nGroupIndex) {\r
+\r
+        var aGroup = this._getItemGroup(p_nGroupIndex);\r
+        var nItems = aGroup.length;\r
+    \r
+        if(nItems > 0) {\r
+    \r
+            var Dom = this._oDom;\r
+            var i = nItems - 1;\r
+            var oItem;\r
+            var oLI;\r
+    \r
+            // Update the index and className properties of each member        \r
+        \r
+            do {\r
+    \r
+                oItem = aGroup[i];\r
+    \r
+                if(oItem) {\r
+        \r
+                    oLI = oItem.element;\r
+    \r
+                    oItem.index = i;\r
+                    oItem.groupIndex = p_nGroupIndex;\r
+    \r
+                    oLI.setAttribute("groupindex", p_nGroupIndex);\r
+                    oLI.setAttribute("index", i);\r
+    \r
+                    Dom.removeClass(oLI, "first-of-type");\r
+    \r
+                }\r
+        \r
+            }\r
+            while(i--);\r
+    \r
+    \r
+            if(oLI) {\r
+    \r
+                Dom.addClass(oLI, "first-of-type");\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Creates a new item group (array) and it's associated HTMLUlElement node \r
+* @private\r
+* @param {Number} p_nIndex Number indicating the group to create.\r
+* @return An item group.\r
+* @type Array\r
+*/\r
+YAHOO.widget.MenuModule.prototype._createItemGroup = function(p_nIndex) {\r
+\r
+    if(!this._aItemGroups[p_nIndex]) {\r
+\r
+        this._aItemGroups[p_nIndex] = [];\r
+\r
+        var oUL = document.createElement("ul");\r
+\r
+        this._aListElements[p_nIndex] = oUL;\r
+\r
+        return this._aItemGroups[p_nIndex];\r
+\r
+    }\r
+\r
+};\r
+\r
+/**\r
+* Returns the item group at the specified index.\r
+* @private\r
+* @param {Number} p_nIndex Number indicating the index of the item group to\r
+* be retrieved.\r
+* @return An array of items.\r
+* @type Array\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getItemGroup = function(p_nIndex) {\r
+\r
+    var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);\r
+\r
+    return this._aItemGroups[nIndex];\r
+\r
+};\r
+\r
+/**\r
+* Subscribe's a MenuModule instance to it's parent MenuModule instance's events.\r
+* @private\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to listen\r
+* for events on.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._configureItemSubmenuModule = \r
+\r
+    function(p_oItem) {\r
+\r
+        var oSubmenu = p_oItem.cfg.getProperty("submenu");\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            /*\r
+                Listen for configuration changes to the parent MenuModule \r
+                instance so they they can be applied to the submenu.\r
+            */\r
+    \r
+            this.cfg.configChangedEvent.subscribe(\r
+                this._onParentMenuModuleConfigChange, \r
+                oSubmenu, \r
+                true\r
+            );\r
+            \r
+            this.renderEvent.subscribe(\r
+                this._onParentMenuModuleRender,\r
+                oSubmenu, \r
+                true\r
+            );\r
+    \r
+            oSubmenu.beforeShowEvent.subscribe(\r
+                this._onSubmenuBeforeShow, \r
+                oSubmenu, \r
+                true\r
+            );\r
+    \r
+            oSubmenu.showEvent.subscribe(this._onSubmenuShow, oSubmenu, true);\r
+    \r
+            oSubmenu.hideEvent.subscribe(this._onSubmenuHide, oSubmenu, true);\r
+    \r
+        }\r
+\r
+};\r
+\r
+/**\r
+* Subscribes a MenuModule instance to the specified item's Custom Events.\r
+* @private\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to listen for events on.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._subscribeToItemEvents = function(p_oItem) {\r
+\r
+    var aArguments = [this, p_oItem];\r
+\r
+    p_oItem.focusEvent.subscribe(this._onItemFocus, aArguments);\r
+\r
+    p_oItem.blurEvent.subscribe(this._onItemBlur, aArguments);\r
+\r
+    p_oItem.cfg.configChangedEvent.subscribe(\r
+        this._onItemConfigChange,\r
+        aArguments\r
+    );\r
+\r
+};\r
+\r
+/**\r
+* Returns the offset width of a MenuModule instance.\r
+* @private\r
+*/\r
+YAHOO.widget.MenuModule.prototype._getOffsetWidth = function() {\r
+\r
+    var oClone = this.element.cloneNode(true);\r
+\r
+    this._oDom.setStyle(oClone, "width", "");\r
+\r
+    document.body.appendChild(oClone);\r
+\r
+    var sWidth = oClone.offsetWidth;\r
+\r
+    document.body.removeChild(oClone);\r
+\r
+    return sWidth;\r
+\r
+};\r
+\r
+/**\r
+* Determines if a DOM event was fired on an item and (if so) fires the item's\r
+* associated Custom Event\r
+* @private\r
+* @param {HTMLElement} p_oElement The original target of the event.\r
+* @param {String} p_sEventType The type/name of the Custom Event to fire.\r
+* @param {Event} p_oDOMEvent The DOM event to pass back when firing the \r
+* Custom Event.\r
+* @return An item.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype._fireItemEvent = \r
+\r
+    function(p_oElement, p_sEventType, p_oDOMEvent) {\r
+\r
+        var me = this;\r
+    \r
+        /**\r
+        * Returns the specified element's parent HTMLLIElement (&#60;LI&#60;)\r
+        * @param {p_oElement} An HTMLElement node\r
+        * @ignore\r
+        * @return Returns an HTMLElement node\r
+        * @type HTMLElement \r
+        */\r
+        function getItemElement(p_oElement) {\r
+        \r
+            if(p_oElement == me.element) {\r
+    \r
+                return;\r
+            \r
+            }\r
+            else if(p_oElement.tagName == "LI") {\r
+        \r
+                return p_oElement;\r
+        \r
+            }\r
+            else if(p_oElement.parentNode) {\r
+    \r
+                return getItemElement(p_oElement.parentNode);\r
+        \r
+            }\r
+        \r
+        }\r
+    \r
+    \r
+        var oElement = getItemElement(p_oElement);\r
+    \r
+        if(oElement) {\r
+    \r
+            /*\r
+                Retrieve the item that corresponds to the \r
+                HTMLLIElement (&#60;LI&#60;) and fire the Custom Event        \r
+            */\r
+    \r
+            var nGroupIndex = parseInt(oElement.getAttribute("groupindex"), 10);\r
+            var nIndex = parseInt(oElement.getAttribute("index"), 10);\r
+            var oItem = this._aItemGroups[nGroupIndex][nIndex];\r
+    \r
+            if(!oItem.cfg.getProperty("disabled")) {\r
+    \r
+                oItem[p_sEventType].fire(p_oDOMEvent);\r
+    \r
+                return oItem;\r
+    \r
+            }\r
+    \r
+        }\r
+\r
+    };\r
+\r
+// Private DOM event handlers\r
+\r
+/**\r
+* Generic event handler for the MenuModule's root HTMLDivElement node.  Used \r
+* to handle "mousedown," "mouseup," "keydown," "keyup," and "keypress" events.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event \r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onDOMEvent = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+\r
+        // Map of DOM event types to Custom Event types\r
+\r
+        var oEventTypes =  {\r
+                "mousedown": "mouseDownEvent",\r
+                "mouseup": "mouseUpEvent",\r
+                "keydown": "keyDownEvent",\r
+                "keyup": "keyUpEvent",\r
+                "keypress": "keyPressEvent"\r
+            };\r
+    \r
+        var sCustomEventType = oEventTypes[p_oEvent.type];\r
+        \r
+        var oTarget = Event.getTarget(p_oEvent);\r
+    \r
+        /*\r
+            Check if the target was an element that is a part of a \r
+            an item and (if so), fire the associated custom event.\r
+        */\r
+    \r
+        this._fireItemEvent(oTarget, sCustomEventType, p_oEvent);\r
+\r
+    \r
+        // Fire the associated custom event for the MenuModule\r
+    \r
+        this[sCustomEventType].fire(p_oEvent);\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+            \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+/**\r
+* "mouseover" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event\r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onElementMouseOver = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+        var oTarget = Event.getTarget(p_oEvent);\r
+    \r
+        if(\r
+            (\r
+                oTarget == this.element || \r
+                this._oDom.isAncestor(this.element, oTarget)\r
+            )  && \r
+            !this._bFiredMouseOverEvent\r
+        ) {\r
+    \r
+            // Fire the "mouseover" Custom Event for the MenuModule instance\r
+    \r
+            this.mouseOverEvent.fire(p_oEvent);\r
+    \r
+            this._bFiredMouseOverEvent = true;\r
+            this._bFiredMouseOutEvent = false;\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Check if the target was an element that is a part of an item\r
+            and (if so), fire the "mouseover" Custom Event.\r
+        */\r
+    \r
+        if(!this._oCurrentItem) {\r
+    \r
+            this._oCurrentItem = \r
+                this._fireItemEvent(oTarget, "mouseOverEvent", p_oEvent);\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+    \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+/**\r
+* "mouseout" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the event\r
+* utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onElementMouseOut = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Dom = this._oDom;\r
+        var Event = this._oEventUtil;\r
+        var oRelatedTarget = Event.getRelatedTarget(p_oEvent);\r
+        var bLIMouseOut = true;\r
+        var bMovingToSubmenu = false;\r
+            \r
+    \r
+        // Determine where the mouse is going\r
+    \r
+        if(this._oCurrentItem && oRelatedTarget) {\r
+    \r
+            if(\r
+                oRelatedTarget == this._oCurrentItem.element || \r
+                Dom.isAncestor(this._oCurrentItem.element, oRelatedTarget)\r
+            ) {\r
+    \r
+                bLIMouseOut = false;\r
+    \r
+            }\r
+    \r
+    \r
+            var oSubmenu = this._oCurrentItem.cfg.getProperty("submenu");\r
+    \r
+            if(\r
+                oSubmenu && \r
+                (\r
+                    oRelatedTarget == oSubmenu.element ||\r
+                    Dom.isAncestor(oSubmenu.element, oRelatedTarget)\r
+                )\r
+            ) {\r
+    \r
+                bMovingToSubmenu = true;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    \r
+        if(this._oCurrentItem && (bLIMouseOut || bMovingToSubmenu)) {\r
+    \r
+            // Fire the "mouseout" Custom Event for the item\r
+    \r
+            this._oCurrentItem.mouseOutEvent.fire(p_oEvent);\r
+    \r
+            this._oCurrentItem = null;\r
+    \r
+        }\r
+    \r
+    \r
+        if(\r
+            !this._bFiredMouseOutEvent && \r
+            (\r
+                !Dom.isAncestor(this.element, oRelatedTarget) ||\r
+                bMovingToSubmenu\r
+            )\r
+        ) {\r
+    \r
+            // Fire the "mouseout" Custom Event for the MenuModule instance\r
+    \r
+            this.mouseOutEvent.fire(p_oEvent);\r
+    \r
+            this._bFiredMouseOutEvent = true;\r
+            this._bFiredMouseOverEvent = false;\r
+    \r
+        }\r
+    \r
+    \r
+        /*\r
+            Stop the propagation of the event at each MenuModule instance\r
+            since menus can be embedded in eachother.\r
+        */\r
+    \r
+        Event.stopPropagation(p_oEvent);\r
+\r
+    };\r
+\r
+/**\r
+* "click" event handler for the MenuModule's root HTMLDivElement node.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance \r
+* corresponding to the HTMLDivElement that fired the event.\r
+*/         \r
+YAHOO.widget.MenuModule.prototype._onElementClick = \r
+\r
+    function(p_oEvent, p_oMenuModule) {\r
+\r
+        var Event = this._oEventUtil;\r
+        \r
+        var oTarget = Event.getTarget(p_oEvent);\r
+        \r
+        /*\r
+            Check if the target was a DOM element that is a part of an\r
+            item and (if so), fire the associated "click" \r
+            Custom Event.\r
+        */\r
+        \r
+        var oItem = this._fireItemEvent(oTarget, "clickEvent", p_oEvent);\r
+        \r
+        var bCurrentPageURL; // Indicates if the URL points to the current page\r
+    \r
+    \r
+        if(oItem) {\r
+    \r
+            var sURL = oItem.cfg.getProperty("url");\r
+            var oSubmenu = oItem.cfg.getProperty("submenu");\r
+            \r
+            bCurrentPageURL = (sURL.substr((sURL.length-1),1) == "#");\r
+    \r
+            /*\r
+                ACCESSIBILITY FEATURE FOR SCREEN READERS: Expand/collapse the\r
+                submenu when the user clicks on the submenu indicator image.\r
+            */        \r
+    \r
+            if(oTarget == oItem.submenuIndicator && oSubmenu) {\r
+\r
+                if(oSubmenu.cfg.getProperty("visible")) {\r
+        \r
+                    oSubmenu.hide();\r
+        \r
+                }\r
+                else {\r
+\r
+                    var oActiveItem = this.activeItem;\r
+               \r
+\r
+                    // Hide any other submenus that might be visible\r
+                \r
+                    if(oActiveItem && oActiveItem != this) {\r
+                \r
+                        this.clearActiveItem();\r
+                \r
+                    }\r
+\r
+                    this.activeItem = oItem;\r
+        \r
+                    oItem.cfg.setProperty("selected", true);\r
+\r
+                    oSubmenu.show();\r
+        \r
+                }\r
+        \r
+            }\r
+            else if(oTarget.tagName != "A" && !bCurrentPageURL) {\r
+                \r
+                /*\r
+                    Follow the URL of the item regardless of whether or \r
+                    not the user clicked specifically on the\r
+                    HTMLAnchorElement (&#60;A&#60;) node.\r
+                */\r
+    \r
+                document.location = sURL;\r
+        \r
+            }\r
+        \r
+        }\r
+            \r
+    \r
+        switch(oTarget.tagName) {\r
+        \r
+            case "A":\r
+            \r
+                if(bCurrentPageURL) {\r
+    \r
+                    // Don't follow URLs that are equal to "#"\r
+    \r
+                    Event.preventDefault(p_oEvent);\r
+                \r
+                }\r
+                else {\r
+    \r
+                    /*\r
+                        Break if the anchor's URL is something other than "#" \r
+                        to prevent the call to "stopPropagation" from be \r
+                        executed.  This is required for Safari to be able to \r
+                        follow the URL.\r
+                    */\r
+                \r
+                    break;\r
+                \r
+                }\r
+            \r
+            default:\r
+    \r
+                /*\r
+                    Stop the propagation of the event at each MenuModule \r
+                    instance since Menus can be embedded in eachother.\r
+                */\r
+    \r
+                Event.stopPropagation(p_oEvent);\r
+            \r
+            break;\r
+        \r
+        }\r
+    \r
+    \r
+        // Fire the associated "click" Custom Event for the MenuModule instance\r
+    \r
+        this.clickEvent.fire(p_oEvent);\r
+\r
+    };\r
+\r
+// Private Custom Event handlers\r
+\r
+/**\r
+* "beforerender" Custom Event handler for a MenuModule instance.  Appends all \r
+* of the HTMLUListElement (&#60;UL&#60;s) nodes (and their child \r
+* HTMLLIElement (&#60;LI&#60;)) nodes and their accompanying title nodes to  \r
+* the body of the MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onBeforeRender = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var Dom = this._oDom;\r
+        var oConfig = this.cfg;\r
+        var oEl = this.element;\r
+        var nListElements = this._aListElements.length;\r
+    \r
+\r
+        if(oConfig.getProperty("position") == "static") {\r
+    \r
+            oConfig.queueProperty("iframe", false);\r
+            oConfig.queueProperty("visible", true);\r
+            \r
+        }\r
+    \r
+    \r
+        if(nListElements > 0) {\r
+    \r
+            var i = 0;\r
+            var bFirstList = true;\r
+            var oUL;\r
+            var oGroupTitle;\r
+    \r
+    \r
+            do {\r
+    \r
+                oUL = this._aListElements[i];\r
+    \r
+                if(oUL) {\r
+    \r
+                    if(bFirstList) {\r
+            \r
+                        Dom.addClass(oUL, "first-of-type");\r
+                        bFirstList = false;\r
+            \r
+                    }\r
+    \r
+    \r
+                    if(!Dom.isAncestor(oEl, oUL)) {\r
+    \r
+                        this.appendToBody(oUL);\r
+    \r
+                    }\r
+    \r
+    \r
+                    oGroupTitle = this._aGroupTitleElements[i];\r
+    \r
+                    if(oGroupTitle) {\r
+    \r
+                        if(!Dom.isAncestor(oEl, oGroupTitle)) {\r
+    \r
+                            oUL.parentNode.insertBefore(oGroupTitle, oUL);\r
+    \r
+                        }\r
+    \r
+    \r
+                        Dom.addClass(oUL, "hastitle");\r
+    \r
+                    }\r
+    \r
+                }\r
+    \r
+                i++;\r
+    \r
+            }\r
+            while(i < nListElements);\r
+    \r
+        }\r
+\r
+    };\r
+\r
+/**\r
+* "render" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onRender = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        if(this.cfg.getProperty("position") == "dynamic") {\r
+    \r
+            var sWidth = this.element.parentNode.tagName == "BODY" ? \r
+                    this.element.offsetWidth : this._getOffsetWidth();\r
+        \r
+            this.cfg.setProperty("width", (sWidth + "px"));\r
+    \r
+        }\r
+\r
+    };\r
+\r
+/**\r
+* "show" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onShow = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+    \r
+        /*\r
+            Setting focus to an item in the newly visible submenu alerts the \r
+            contents of the submenu to the screen reader.\r
+        */\r
+\r
+        this.setInitialFocus();\r
+    \r
+    };\r
+\r
+/**\r
+* "hide" Custom Event handler for a MenuModule instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onBeforeHide = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var oActiveItem = this.activeItem;\r
+\r
+        if(oActiveItem) {\r
+    \r
+            oActiveItem.blur();\r
+\r
+            if(oActiveItem.cfg.getProperty("selected")) {\r
+    \r
+                oActiveItem.cfg.setProperty("selected", false);\r
+    \r
+            }\r
+    \r
+            var oSubmenu = oActiveItem.cfg.getProperty("submenu");\r
+    \r
+            if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {\r
+    \r
+                oSubmenu.hide();\r
+    \r
+            }\r
+    \r
+        }\r
+\r
+    };\r
+\r
+/**\r
+* "configchange" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that subscribed\r
+* to the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onParentMenuModuleConfigChange = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var sPropertyName = p_aArgs[0][0];\r
+        var oPropertyValue = p_aArgs[0][1];\r
+    \r
+        switch(sPropertyName) {\r
+    \r
+            case "iframe":\r
+            case "constraintoviewport":\r
+    \r
+                p_oSubmenu.cfg.setProperty(sPropertyName, oPropertyValue);\r
+                    \r
+            break;        \r
+            \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "render" Custom Event handler for a MenuModule instance.  Renders a  \r
+* submenu in response to the firing of it's parent's "render" event.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that subscribed\r
+* to the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onParentMenuModuleRender = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+\r
+        /*\r
+            Set the "iframe" and "constraintoviewport" configuration \r
+            properties to match the parent MenuModule\r
+        */ \r
+    \r
+        var oParentMenu = p_oSubmenu.parent.parent;\r
+    \r
+        p_oSubmenu.cfg.applyConfig(\r
+        \r
+            {\r
+                constraintoviewport: \r
+                    oParentMenu.cfg.getProperty("constraintoviewport"),\r
+    \r
+                xy: [0,0],\r
+    \r
+                iframe: oParentMenu.cfg.getProperty("iframe")\r
+    \r
+            }\r
+        \r
+        );\r
+    \r
+    \r
+        if(this._oDom.inDocument(this.element)) {\r
+    \r
+            this.render();\r
+    \r
+        }\r
+        else {\r
+    \r
+            this.render(this.parent.element);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "beforeshow" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuBeforeShow = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+        var aAlignment = oParent.parent.cfg.getProperty("submenualignment");\r
+\r
+        this.cfg.setProperty(\r
+            "context", \r
+            [\r
+                oParent.element, \r
+                aAlignment[0], \r
+                aAlignment[1]\r
+            ]\r
+        );\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+/**\r
+* "show" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuShow = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+/**\r
+* "hide" Custom Event handler for a submenu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oSubmenu The submenu that fired\r
+* the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onSubmenuHide = \r
+\r
+    function(p_sType, p_aArgs, p_oSubmenu) {\r
+    \r
+        var oParent = this.parent;\r
+\r
+        if(oParent.parent.cfg.getProperty("visible")) {\r
+\r
+            oParent.cfg.setProperty("selected", false);\r
+    \r
+            oParent.focus();\r
+        \r
+        }\r
+\r
+        oParent.submenuIndicator.alt = \r
+            oParent.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+    \r
+    };\r
+\r
+/**\r
+* "focus" YAHOO.util.CustomEvent handler for a MenuModule instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemFocus = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+    \r
+        var me = p_aObjects[0];\r
+        var oItem = p_aObjects[1];\r
+    \r
+        me.activeItem = oItem;\r
+    \r
+    };\r
+\r
+/**\r
+* "blur" YAHOO.util.CustomEvent handler for a MenuModule instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemBlur = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+    \r
+        var me = p_aObjects[0];\r
+        var oItem = p_aObjects[1];\r
+        var oSubmenu = oItem.cfg.getProperty("submenu");\r
+    \r
+        if(!oSubmenu || (oSubmenu && !oSubmenu.cfg.getProperty("visible"))) {\r
+    \r
+            me.activeItem = null;\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "configchange" YAHOO.util.CustomEvent handler for the MenuModule \r
+* instance's items.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {Array} p_aObjects Array containing the current MenuModule instance \r
+* and the item that fired the event.\r
+*/\r
+YAHOO.widget.MenuModule.prototype._onItemConfigChange = \r
+\r
+    function(p_sType, p_aArgs, p_aObjects) {\r
+\r
+        var me = p_aObjects[0];    \r
+        var sProperty = p_aArgs[0][0];\r
+        var oItem = p_aObjects[1];\r
+    \r
+        switch(sProperty) {\r
+    \r
+            case "submenu":\r
+    \r
+                var oSubmenu = p_aArgs[0][1];\r
+    \r
+                if(oSubmenu) {\r
+    \r
+                    me._configureItemSubmenuModule(oItem);\r
+    \r
+                }\r
+    \r
+            break;\r
+    \r
+            case "text":\r
+            case "helptext":\r
+    \r
+                /*\r
+                    A change to an item's "text" or "helptext"\r
+                    configuration properties requires the width of the parent\r
+                    MenuModule instance to be recalculated.\r
+                */\r
+    \r
+                if(me.element.style.width) {\r
+        \r
+                    var sWidth = me._getOffsetWidth() + "px";\r
+    \r
+                    me._oDom.setStyle(me.element, "width", sWidth);\r
+    \r
+                }\r
+    \r
+            break;\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* The default event handler executed when the moveEvent is fired, if the \r
+* "constraintoviewport" configuration property is set to true.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.enforceConstraints = \r
+\r
+    function(type, args, obj) {\r
+\r
+        var Dom = this._oDom;\r
+        var oConfig = this.cfg;\r
+    \r
+        var pos = args[0];\r
+            \r
+        var x = pos[0];\r
+        var y = pos[1];\r
+        \r
+        var bod = document.getElementsByTagName('body')[0];\r
+        var htm = document.getElementsByTagName('html')[0];\r
+        \r
+        var bodyOverflow = Dom.getStyle(bod, "overflow");\r
+        var htmOverflow = Dom.getStyle(htm, "overflow");\r
+        \r
+        var offsetHeight = this.element.offsetHeight;\r
+        var offsetWidth = this.element.offsetWidth;\r
+        \r
+        var viewPortWidth = Dom.getClientWidth();\r
+        var viewPortHeight = Dom.getClientHeight();\r
+        \r
+        var scrollX = window.scrollX || document.body.scrollLeft;\r
+        var scrollY = window.scrollY || document.body.scrollTop;\r
+        \r
+        var topConstraint = scrollY + 10;\r
+        var leftConstraint = scrollX + 10;\r
+        var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;\r
+        var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;\r
+        \r
+        var aContext = oConfig.getProperty("context");\r
+        var oContextElement = aContext ? aContext[0] : null;\r
+    \r
+    \r
+        if (x < 10) {\r
+    \r
+            x = leftConstraint;\r
+    \r
+        } else if ((x + offsetWidth) > viewPortWidth) {\r
+    \r
+            if(\r
+                oContextElement && \r
+                ((x - oContextElement.offsetWidth) > offsetWidth)\r
+            ) {\r
+    \r
+                x = (x - (oContextElement.offsetWidth + offsetWidth));\r
+    \r
+            }\r
+            else {\r
+    \r
+                x = rightConstraint;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+        if (y < 10) {\r
+    \r
+            y = topConstraint;\r
+    \r
+        } else if (y > bottomConstraint) {\r
+    \r
+            if(oContextElement && (y > offsetHeight)) {\r
+    \r
+                y = ((y + oContextElement.offsetHeight) - offsetHeight);\r
+    \r
+            }\r
+            else {\r
+    \r
+                y = bottomConstraint;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+        oConfig.setProperty("x", x, true);\r
+        oConfig.setProperty("y", y, true);\r
+    \r
+    };\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "position" configuration property of a\r
+* MenuModule changes.\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance fired\r
+* the event.\r
+* @see YAHOO.widget.Overlay#configIframe\r
+*/\r
+YAHOO.widget.MenuModule.prototype.configPosition = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuModule) {\r
+\r
+        var sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute";\r
+    \r
+        this._oDom.setStyle(this.element, "position", sCSSPosition);\r
+    \r
+    };\r
+\r
+// Public methods\r
+\r
+YAHOO.widget.MenuModule.prototype.toString = function() {\r
+\r
+    return ("Menu " + this.id);\r
+\r
+};\r
+\r
+/**\r
+* Sets the title of a group of items.\r
+* @param {String} p_sGroupTitle The title of the group.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the title belongs.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setItemGroupTitle = \r
+\r
+    function(p_sGroupTitle, p_nGroupIndex) {\r
+        \r
+        if(typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {\r
+    \r
+            var Dom = this._oDom;\r
+\r
+            var nGroupIndex = \r
+                    typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;\r
+    \r
+            var oTitle = this._aGroupTitleElements[nGroupIndex];\r
+    \r
+    \r
+            if(oTitle) {\r
+    \r
+                oTitle.innerHTML = p_sGroupTitle;\r
+                \r
+            }\r
+            else {\r
+    \r
+                oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);\r
+                        \r
+                oTitle.innerHTML = p_sGroupTitle;\r
+    \r
+                this._aGroupTitleElements[nGroupIndex] = oTitle;\r
+    \r
+            }\r
+    \r
+    \r
+            var i = this._aGroupTitleElements.length - 1;\r
+            var nFirstIndex;\r
+    \r
+            do {\r
+    \r
+                if(this._aGroupTitleElements[i]) {\r
+    \r
+                    Dom.removeClass(\r
+                        this._aGroupTitleElements[i],\r
+                        "first-of-type"\r
+                    );\r
+\r
+                    nFirstIndex = i;\r
+    \r
+                }\r
+    \r
+            }\r
+            while(i--);\r
+    \r
+    \r
+            if(nFirstIndex !== null) {\r
+    \r
+                Dom.addClass(\r
+                    this._aGroupTitleElements[nFirstIndex], \r
+                    "first-of-type"\r
+                );\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Appends the specified item to a MenuModule instance.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be added.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was added to the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.addItem = function(p_oItem, p_nGroupIndex) {\r
+\r
+    if(p_oItem) {\r
+\r
+        return this._addItemToGroup(p_nGroupIndex, p_oItem);\r
+        \r
+    }\r
+\r
+};\r
+\r
+/**\r
+* Inserts an item into a MenuModule instance at the specified index.\r
+* @param {YAHOO.widget.MenuModuleItem} p_oItem The item to be inserted.\r
+* @param {Number} p_nItemIndex Number indicating the ordinal position \r
+* at which the item should be added.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was inserted into the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.insertItem = \r
+\r
+    function(p_oItem, p_nItemIndex, p_nGroupIndex) {\r
+    \r
+        if(p_oItem) {\r
+    \r
+            return this._addItemToGroup(p_nGroupIndex, p_oItem, p_nItemIndex);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Removes the specified item from a MenuModule instance.\r
+* @param {YAHOO.widget.MenuModuleItem/Number} p_oObject The item or index of \r
+* the item to be removed.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return The item that was removed from the MenuModule.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.removeItem =\r
+\r
+    function(p_oObject, p_nGroupIndex) {\r
+    \r
+        if(typeof p_oObject != "undefined") {\r
+    \r
+            var oItem;\r
+    \r
+            if(p_oObject instanceof YAHOO.widget.MenuModuleItem) {\r
+    \r
+                oItem = \r
+                    this._removeItemFromGroupByValue(p_nGroupIndex, p_oObject);           \r
+    \r
+            }\r
+            else if(typeof p_oObject == "number") {\r
+    \r
+                oItem = \r
+                    this._removeItemFromGroupByIndex(p_nGroupIndex, p_oObject);\r
+    \r
+            }\r
+    \r
+            if(oItem) {\r
+    \r
+                oItem.destroy();\r
+\r
+    \r
+                return oItem;\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Returns a multi-dimensional array of all of a MenuModule's items.\r
+* @return An array of items.\r
+* @type Array\r
+*/        \r
+YAHOO.widget.MenuModule.prototype.getItemGroups = function() {\r
+\r
+    return this._aItemGroups;\r
+\r
+};\r
+\r
+/**\r
+* Returns the item at the specified index.\r
+* @param {Number} p_nItemIndex Number indicating the ordinal position of the \r
+* item to be retrieved.\r
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which\r
+* the item belongs.\r
+* @return An item.\r
+* @type YAHOO.widget.MenuModuleItem\r
+*/\r
+YAHOO.widget.MenuModule.prototype.getItem = \r
+\r
+    function(p_nItemIndex, p_nGroupIndex) {\r
+    \r
+        if(typeof p_nItemIndex == "number") {\r
+    \r
+            var aGroup = this._getItemGroup(p_nGroupIndex);\r
+    \r
+            if(aGroup) {\r
+    \r
+                return aGroup[p_nItemIndex];\r
+            \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* Removes the MenuModule instance's element from the DOM and sets all child \r
+* elements to null.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.destroy = function() {\r
+\r
+    // Remove DOM event handlers\r
+\r
+    this._oEventUtil.purgeElement(this.element);\r
+\r
+    // Remove Custom Event listeners\r
+\r
+    this.mouseOverEvent.unsubscribeAll();\r
+    this.mouseOutEvent.unsubscribeAll();\r
+    this.mouseDownEvent.unsubscribeAll();\r
+    this.mouseUpEvent.unsubscribeAll();\r
+    this.clickEvent.unsubscribeAll();\r
+    this.keyPressEvent.unsubscribeAll();\r
+    this.keyDownEvent.unsubscribeAll();\r
+    this.keyUpEvent.unsubscribeAll();\r
+    this.beforeMoveEvent.unsubscribeAll();\r
+\r
+    var nItemGroups = this._aItemGroups.length;\r
+    var nItems;\r
+    var oItemGroup;\r
+    var oItem;\r
+    var i;\r
+    var n;\r
+\r
+    // Remove all items\r
+\r
+    if(nItemGroups > 0) {\r
+\r
+        i = nItemGroups - 1;\r
+\r
+        do {\r
+\r
+            oItemGroup = this._aItemGroups[i];\r
+\r
+            if(oItemGroup) {\r
+\r
+                nItems = oItemGroup.length;\r
+    \r
+                if(nItems > 0) {\r
+    \r
+                    n = nItems - 1;\r
+        \r
+                    do {\r
+\r
+                        oItem = this._aItemGroups[i][n];\r
+\r
+                        if(oItem) {\r
+        \r
+                            oItem.destroy();\r
+                        }\r
+        \r
+                    }\r
+                    while(n--);\r
+    \r
+                }\r
+\r
+            }\r
+\r
+        }\r
+        while(i--);\r
+\r
+    }        \r
+\r
+    // Continue with the superclass implementation of this method\r
+\r
+    YAHOO.widget.MenuModule.superclass.destroy.call(this);\r
+    \r
+\r
+};\r
+\r
+/**\r
+* Sets focus to a MenuModule instance's first enabled item.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setInitialFocus = function() {\r
+\r
+    var oItem = this._getFirstEnabledItem();\r
+    \r
+    if(oItem) {\r
+    \r
+        oItem.focus();\r
+    }\r
+    \r
+};\r
+\r
+/**\r
+* Sets the "selected" configuration property of a MenuModule instance's first\r
+* enabled item to "true."\r
+*/\r
+YAHOO.widget.MenuModule.prototype.setInitialSelection = function() {\r
+\r
+    var oItem = this._getFirstEnabledItem();\r
+    \r
+    if(oItem) {\r
+    \r
+        oItem.cfg.setProperty("selected", true);\r
+    }        \r
+\r
+};\r
+\r
+/**\r
+* Sets the "selected" configuration property of a MenuModule instance's active \r
+* item to "false," blurs the item and hide's the item's submenu.\r
+*/\r
+YAHOO.widget.MenuModule.prototype.clearActiveItem = function () {\r
+\r
+    if(this.activeItem) {\r
+\r
+        var oConfig = this.activeItem.cfg;\r
+\r
+        oConfig.setProperty("selected", false);\r
+\r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+\r
+        if(oSubmenu) {\r
+\r
+            oSubmenu.hide();\r
+\r
+        }\r
+\r
+    }\r
+\r
+};\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* the MenuModule's Config object (cfg).\r
+*/\r
+YAHOO.widget.MenuModule.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.MenuModule.superclass.initDefaultConfig.call(this);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+       // Add configuration properties\r
+\r
+    oConfig.addProperty(\r
+        "position", \r
+        {\r
+            value: "dynamic", \r
+            handler: this.configPosition, \r
+            validator: this._checkPosition \r
+        } \r
+    );\r
+\r
+    oConfig.refireEvent("position");\r
+\r
+    oConfig.addProperty("submenualignment", { value: ["tl","tr"] } );\r
+\r
+};\r
+\r
+/**\r
+* @class The MenuModuleItem class allows you to create and modify an item for a\r
+* MenuModule instance.\r
+* @constructor\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuModuleItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuModuleItem = function(p_oObject, p_oConfig) {\r
+\r
+    if(p_oObject) {\r
+\r
+        this.init(p_oObject, p_oConfig);\r
+\r
+    }\r
+\r
+};\r
+\r
+YAHOO.widget.MenuModuleItem.prototype = {\r
+\r
+    // Constants\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator.\r
+    * @final\r
+    * @type String\r
+    */\r
+    SUBMENU_INDICATOR_IMAGE_PATH: "nt/ic/ut/alt1/menuarorght8_nrm_1.gif",\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator when a MenuModuleItem instance is selected.\r
+    * @final\r
+    * @type String\r
+    */\r
+    SELECTED_SUBMENU_INDICATOR_IMAGE_PATH: \r
+        "nt/ic/ut/alt1/menuarorght8_hov_1.gif",\r
+\r
+    /**\r
+    * Constant representing the path to the image to be used for the submenu\r
+    * arrow indicator when a MenuModuleItem instance is disabled.\r
+    * @final\r
+    * @type String\r
+    */\r
+    DISABLED_SUBMENU_INDICATOR_IMAGE_PATH: \r
+        "nt/ic/ut/alt1/menuarorght8_dim_1.gif",\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator.\r
+    * @final\r
+    * @type String\r
+    */\r
+    COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT: "Collapsed.  Click to expand.",\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator when the submenu is visible.\r
+    * @final\r
+    * @type String\r
+    */\r
+    EXPANDED_SUBMENU_INDICATOR_ALT_TEXT: "Expanded.  Click to collapse.",\r
+\r
+    /**\r
+    * Constant representing the alt text for the image to be used for the \r
+    * submenu arrow indicator when a MenuModuleItem instance is disabled.\r
+    * @final\r
+    * @type String\r
+    */\r
+    DISABLED_SUBMENU_INDICATOR_ALT_TEXT: "Disabled.",\r
+\r
+    /**\r
+    * Constant representing the CSS class(es) to be applied to the root \r
+    * HTMLLIElement of the MenuModuleItem.\r
+    * @final\r
+    * @type String\r
+    */\r
+    CSS_CLASS_NAME: "yuimenuitem",\r
+\r
+    /**\r
+    * Constant representing the type of menu to instantiate when creating \r
+    * submenu instances from parsing the child nodes (either HTMLSelectElement \r
+    * or HTMLDivElement) of the item's DOM.  The default \r
+    * is YAHOO.widget.MenuModule.\r
+    * @final\r
+    * @type YAHOO.widget.MenuModule\r
+    */\r
+    SUBMENU_TYPE: null,\r
+\r
+    /**\r
+    * Constant representing the type of item to instantiate when \r
+    * creating item instances from parsing the child nodes (either \r
+    * HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+    * submenu's DOM.  \r
+    * The default is YAHOO.widget.MenuModuleItem.\r
+    * @final\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    SUBMENU_ITEM_TYPE: null,\r
+\r
+    /**\r
+    * Constant representing the prefix path to use for non-secure images\r
+    * @type string\r
+    */\r
+    IMG_ROOT: "http://us.i1.yimg.com/us.yimg.com/i/",\r
+    \r
+\r
+    /**\r
+    * Constant representing the prefix path to use for securely served images\r
+    * @type string\r
+    */\r
+    IMG_ROOT_SSL: "https://a248.e.akamai.net/sec.yimg.com/i/",\r
+\r
+    // Private member variables\r
+    \r
+    /**\r
+    * Reference to the HTMLAnchorElement of the MenuModuleItem's core internal\r
+    * DOM structure.\r
+    * @private\r
+    * @type {HTMLAnchorElement}\r
+    */\r
+    _oAnchor: null,\r
+    \r
+\r
+    /**\r
+    * Reference to the text node of the MenuModuleItem's core internal\r
+    * DOM structure.\r
+    * @private\r
+    * @type {Text}\r
+    */\r
+    _oText: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the HTMLElement (&#60;EM&#60;) used to create the optional\r
+    * help text for a MenuModuleItem instance.\r
+    * @private\r
+    * @type {HTMLElement}\r
+    */\r
+    _oHelpTextEM: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the submenu for a MenuModuleItem instance.\r
+    * @private\r
+    * @type {YAHOO.widget.MenuModule}\r
+    */\r
+    _oSubmenu: null,\r
+    \r
+    \r
+    /**\r
+    * Reference to the Dom utility singleton.\r
+    * @private\r
+    * @type {YAHOO.util.Dom}\r
+    */\r
+    _oDom: YAHOO.util.Dom,\r
+\r
+    // Public properties\r
+\r
+       /**\r
+       * The class's constructor function\r
+       * @type YAHOO.widget.MenuModuleItem\r
+       */\r
+       constructor: YAHOO.widget.MenuModuleItem,\r
+\r
+       /**\r
+       * The string representing the image root\r
+       * @type string\r
+       */\r
+       imageRoot: null,\r
+\r
+       /**\r
+       * Boolean representing whether or not the current browsing context \r
+       * is secure (https)\r
+       * @type boolean\r
+       */\r
+       isSecure: YAHOO.widget.Module.prototype.isSecure,\r
+\r
+    /**\r
+    * Returns the ordinal position of a MenuModuleItem instance in a group.\r
+    * @type Number\r
+    */\r
+    index: null,\r
+\r
+    /**\r
+    * Returns the index of the group to which a MenuModuleItem instance belongs.\r
+    * @type Number\r
+    */\r
+    groupIndex: null,\r
+\r
+    /**\r
+    * Returns the parent object for a MenuModuleItem instance.\r
+    * @type {YAHOO.widget.MenuModule}\r
+    */\r
+    parent: null,\r
+\r
+    /**\r
+    * Returns the HTMLLIElement for a MenuModuleItem instance.\r
+    * @type {HTMLLIElement}\r
+    */\r
+    element: null,\r
+\r
+    /**\r
+    * Returns the HTMLElement (either HTMLLIElement, HTMLOptGroupElement or\r
+    * HTMLOptionElement) used create the MenuModuleItem instance.\r
+    * @type {HTMLLIElement/HTMLOptGroupElement/HTMLOptionElement}\r
+    */\r
+    srcElement: null,\r
+\r
+    /**\r
+    * Specifies an arbitrary value for a MenuModuleItem instance.\r
+    * @type {Object}\r
+    */\r
+    value: null,\r
+\r
+    /**\r
+    * Reference to the HTMLImageElement used to create the submenu\r
+    * indicator for a MenuModuleItem instance.\r
+    * @type {HTMLImageElement}\r
+    */\r
+    submenuIndicator: null,\r
+\r
+       /**\r
+       * String representing the browser\r
+       * @type string\r
+       */\r
+       browser: YAHOO.widget.Module.prototype.browser,\r
+\r
+    // Events\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instances's HTMLLIElement is removed from\r
+    * it's parent HTMLUListElement node.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    destroyEvent: null,\r
+\r
+    /**\r
+    * Fires when the mouse has entered a MenuModuleItem instance.  Passes\r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseOverEvent: null,\r
+\r
+    /**\r
+    * Fires when the mouse has left a MenuModuleItem instance.  Passes back  \r
+    * the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseOutEvent: null,\r
+\r
+    /**\r
+    * Fires when the user mouses down on a MenuModuleItem instance.  Passes \r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseDownEvent: null,\r
+\r
+    /**\r
+    * Fires when the user releases a mouse button while the mouse is \r
+    * over a MenuModuleItem instance.  Passes back the DOM Event object as\r
+    * an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    mouseUpEvent: null,\r
+\r
+    /**\r
+    * Fires when the user clicks the on a MenuModuleItem instance.  Passes \r
+    * back the DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    clickEvent: null,\r
+\r
+    /**\r
+    * Fires when the user presses an alphanumeric key.  Passes back the \r
+    * DOM Event object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyPressEvent: null,\r
+\r
+    /**\r
+    * Fires when the user presses a key.  Passes back the DOM Event \r
+    * object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyDownEvent: null,\r
+\r
+    /**\r
+    * Fires when the user releases a key.  Passes back the DOM Event \r
+    * object as an argument.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    keyUpEvent: null,\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instance receives focus.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    focusEvent: null,\r
+\r
+    /**\r
+    * Fires when a MenuModuleItem instance loses the input focus.\r
+    * @type {YAHOO.util.CustomEvent}\r
+    * @see YAHOO.util.CustomEvent\r
+    */\r
+    blurEvent: null,\r
+\r
+    /**\r
+    * The MenuModuleItem class's initialization method. This method is \r
+    * automatically called by the constructor, and sets up all DOM references \r
+    * for pre-existing markup, and creates required markup if it is not\r
+    * already present.\r
+    * @param {String or HTMLElement} p_oObject String or HTMLElement \r
+    * (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+    * source HTMLElement node.\r
+    * @param {Object} p_oConfig The configuration object literal containing \r
+    * the configuration for a MenuModuleItem instance. See the configuration \r
+    * class documentation for more details.\r
+    */\r
+    init: function(p_oObject, p_oConfig) {\r
+\r
+        this.imageRoot = (this.isSecure) ? this.IMG_ROOT_SSL : this.IMG_ROOT;\r
+\r
+        if(!this.SUBMENU_TYPE) {\r
+    \r
+            this.SUBMENU_TYPE = YAHOO.widget.MenuModule;\r
+    \r
+        }\r
+\r
+        if(!this.SUBMENU_ITEM_TYPE) {\r
+    \r
+            this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuModuleItem;\r
+    \r
+        }\r
+\r
+        // Create the config object\r
+\r
+        this.cfg = new YAHOO.util.Config(this);\r
+\r
+        this.initDefaultConfig();\r
+\r
+        var oConfig = this.cfg;\r
+\r
+        if(this._checkString(p_oObject)) {\r
+\r
+            this._createRootNodeStructure();\r
+\r
+            oConfig.setProperty("text", p_oObject);\r
+\r
+        }\r
+        else if(this._checkDOMNode(p_oObject)) {\r
+\r
+            switch(p_oObject.tagName) {\r
+\r
+                case "OPTION":\r
+\r
+                    this._createRootNodeStructure();\r
+\r
+                    oConfig.setProperty("text", p_oObject.text);\r
+\r
+                    this.srcElement = p_oObject;\r
+\r
+                break;\r
+\r
+                case "OPTGROUP":\r
+\r
+                    this._createRootNodeStructure();\r
+\r
+                    oConfig.setProperty("text", p_oObject.label);\r
+\r
+                    this.srcElement = p_oObject;\r
+\r
+                    this._initSubTree();\r
+\r
+                break;\r
+\r
+                case "LI":\r
+\r
+                    // Get the anchor node (if it exists)\r
+\r
+                    var oAnchor = this._getFirstElement(p_oObject, "A");\r
+                    var sURL = "#";\r
+                    var sText = null;\r
+\r
+                    // Capture the "text" and/or the "URL"\r
+\r
+                    if(oAnchor) {\r
+\r
+                        sURL = oAnchor.getAttribute("href");\r
+\r
+                        if(oAnchor.innerText) {\r
+                \r
+                            sText = oAnchor.innerText;\r
+                \r
+                        }\r
+                        else {\r
+                \r
+                            var oRange = oAnchor.ownerDocument.createRange();\r
+                \r
+                            oRange.selectNodeContents(oAnchor);\r
+                \r
+                            sText = oRange.toString();             \r
+                \r
+                        }\r
+\r
+                    }\r
+                    else {\r
+\r
+                        var oText = p_oObject.firstChild;\r
+\r
+                        sText = oText.nodeValue;\r
+\r
+                        oAnchor = document.createElement("a");\r
+                        \r
+                        oAnchor.setAttribute("href", sURL);\r
+\r
+                        p_oObject.replaceChild(oAnchor, oText);\r
+                        \r
+                        oAnchor.appendChild(oText);\r
+\r
+                    }\r
+\r
+                    this.srcElement = p_oObject;\r
+                    this.element = p_oObject;\r
+                    this._oAnchor = oAnchor;\r
+    \r
+\r
+                    // Check if emphasis has been applied to the MenuModuleItem\r
+\r
+                    var oEmphasisNode = this._getFirstElement(oAnchor);\r
+                    var bEmphasis = false;\r
+                    var bStrongEmphasis = false;\r
+\r
+                    if(oEmphasisNode) {\r
+\r
+                        // Set a reference to the text node \r
+\r
+                        this._oText = oEmphasisNode.firstChild;\r
+\r
+                        switch(oEmphasisNode.tagName) {\r
+\r
+                            case "EM":\r
+\r
+                                bEmphasis = true;\r
+\r
+                            break;\r
+\r
+                            case "STRONG":\r
+\r
+                                bStrongEmphasis = true;\r
+\r
+                            break;\r
+\r
+                        }\r
+\r
+                    }\r
+                    else {\r
+\r
+                        // Set a reference to the text node \r
+\r
+                        this._oText = oAnchor.firstChild;\r
+\r
+                    }\r
+\r
+                    /*\r
+                        Set these properties silently to sync up the \r
+                        configuration object without making changes to the \r
+                        element's DOM\r
+                    */ \r
+\r
+                    oConfig.setProperty("text", sText, true);\r
+                    oConfig.setProperty("url", sURL, true);\r
+                    oConfig.setProperty("emphasis", bEmphasis, true);\r
+                    oConfig.setProperty(\r
+                        "strongemphasis", \r
+                        bStrongEmphasis, \r
+                        true\r
+                    );\r
+\r
+                    this._initSubTree();\r
+\r
+                break;\r
+\r
+            }            \r
+\r
+        }\r
+\r
+        if(this.element) {\r
+\r
+            this._oDom.addClass(this.element, this.CSS_CLASS_NAME);\r
+\r
+            // Create custom events\r
+    \r
+            var CustomEvent = YAHOO.util.CustomEvent;\r
+    \r
+            this.destroyEvent = new CustomEvent("destroyEvent", this);\r
+            this.mouseOverEvent = new CustomEvent("mouseOverEvent", this);\r
+            this.mouseOutEvent = new CustomEvent("mouseOutEvent", this);\r
+            this.mouseDownEvent = new CustomEvent("mouseDownEvent", this);\r
+            this.mouseUpEvent = new CustomEvent("mouseUpEvent", this);\r
+            this.clickEvent = new CustomEvent("clickEvent", this);\r
+            this.keyPressEvent = new CustomEvent("keyPressEvent", this);\r
+            this.keyDownEvent = new CustomEvent("keyDownEvent", this);\r
+            this.keyUpEvent = new CustomEvent("keyUpEvent", this);\r
+            this.focusEvent = new CustomEvent("focusEvent", this);\r
+            this.blurEvent = new CustomEvent("blurEvent", this);\r
+\r
+            if(p_oConfig) {\r
+    \r
+                oConfig.applyConfig(p_oConfig);\r
+    \r
+            }        \r
+\r
+            oConfig.fireQueue();\r
+\r
+        }\r
+\r
+    },\r
+\r
+    // Private methods\r
+\r
+    /**\r
+    * Returns an HTMLElement's first HTMLElement node\r
+    * @private\r
+    * @param {HTMLElement} p_oElement The element to be evaluated.\r
+    * @param {String} p_sTagName Optional. The tagname of the element.\r
+    * @return Returns an HTMLElement node.\r
+    * @type Boolean\r
+    */\r
+    _getFirstElement: function(p_oElement, p_sTagName) {\r
+\r
+        var oElement;\r
+\r
+        if(p_oElement.firstChild && p_oElement.firstChild.nodeType == 1) {\r
+\r
+            oElement = p_oElement.firstChild;\r
+\r
+        }\r
+        else if(\r
+            p_oElement.firstChild && \r
+            p_oElement.firstChild.nextSibling && \r
+            p_oElement.firstChild.nextSibling.nodeType == 1\r
+        ) {\r
+\r
+            oElement = p_oElement.firstChild.nextSibling;\r
+\r
+        }\r
+\r
+        if(p_sTagName) {\r
+\r
+            return (oElement && oElement.tagName == p_sTagName) ? \r
+                oElement : false;\r
+\r
+        }\r
+\r
+        return oElement;\r
+\r
+    },\r
+\r
+    /**\r
+    * Determines if an object is a string\r
+    * @private\r
+    * @param {Object} p_oObject The object to be evaluated.\r
+    * @return Returns true if the object is a string.\r
+    * @type Boolean\r
+    */\r
+    _checkString: function(p_oObject) {\r
+\r
+        return (typeof p_oObject == "string");\r
+\r
+    },\r
+\r
+    /**\r
+    * Determines if an object is an HTMLElement.\r
+    * @private\r
+    * @param {Object} p_oObject The object to be evaluated.\r
+    * @return Returns true if the object is an HTMLElement.\r
+    * @type Boolean\r
+    */\r
+    _checkDOMNode: function(p_oObject) {\r
+\r
+        return (p_oObject && p_oObject.tagName);\r
+\r
+    },\r
+\r
+    /**\r
+    * Creates the core DOM structure for a MenuModuleItem instance.\r
+    * @private\r
+    */\r
+    _createRootNodeStructure: function () {\r
+\r
+        this.element = document.createElement("li");\r
+\r
+        this._oText = document.createTextNode("");\r
+\r
+        this._oAnchor = document.createElement("a");\r
+        this._oAnchor.appendChild(this._oText);\r
+        \r
+        this.cfg.refireEvent("url");\r
+\r
+        this.element.appendChild(this._oAnchor);            \r
+\r
+    },\r
+\r
+    /**\r
+    * Iterates the source element's childNodes collection and uses the  \r
+    * child nodes to instantiate other menus.\r
+    * @private\r
+    */\r
+    _initSubTree: function() {\r
+\r
+        var Menu = this.SUBMENU_TYPE;\r
+        var MenuModuleItem = this.SUBMENU_ITEM_TYPE;\r
+        var oSrcEl = this.srcElement;\r
+        var oConfig = this.cfg;\r
+\r
+        if(oSrcEl.childNodes.length > 0) {\r
+\r
+            var oNode = oSrcEl.firstChild;\r
+            var aOptions = [];\r
+\r
+            do {\r
+\r
+                switch(oNode.tagName) {\r
+        \r
+                    case "DIV":\r
+        \r
+                        oConfig.setProperty("submenu", (new Menu(oNode)));\r
+        \r
+                    break;\r
\r
+                    case "OPTION":\r
+\r
+                        aOptions[aOptions.length] = oNode;\r
+\r
+                    break;\r
+       \r
+                }\r
+            \r
+            }        \r
+            while((oNode = oNode.nextSibling));\r
+\r
+            var nOptions = aOptions.length;\r
+\r
+            if(nOptions > 0) {\r
+    \r
+                oConfig.setProperty(\r
+                    "submenu", \r
+                    (new Menu(this._oDom.generateId()))\r
+                );\r
+    \r
+                for(var n=0; n<nOptions; n++) {\r
+    \r
+                    this._oSubmenu.addItem((new MenuModuleItem(aOptions[n])));\r
+    \r
+                }\r
+    \r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+    // Event handlers for configuration properties\r
+\r
+    /**\r
+    * Event handler for when the "text" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */\r
+    configText: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var sText = p_aArgs[0];\r
+\r
+        if(this._oText) {\r
+\r
+            this._oText.nodeValue = sText;\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "helptext" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configHelpText: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var me = this;\r
+        var Dom = this._oDom;\r
+        var oHelpText = p_aArgs[0];\r
+        var oEl = this.element;\r
+        var oConfig = this.cfg;\r
+        var aNodes = [oEl, this._oAnchor];\r
+        var oImg = this.submenuIndicator;\r
+\r
+        /**\r
+        * Adds the "hashelptext" class to the necessary nodes and refires the \r
+        * "selected" and "disabled" configuration events\r
+        * @ignore\r
+        */\r
+        function initHelpText() {\r
+\r
+            Dom.addClass(aNodes, "hashelptext");\r
+\r
+            if(oConfig.getProperty("disabled")) {\r
+\r
+                oConfig.refireEvent("disabled");\r
+\r
+            }\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.refireEvent("selected");\r
+\r
+            }                \r
+\r
+        }\r
+\r
+        /**\r
+        * Removes the "hashelptext" class and corresponding DOM element (EM)\r
+        * @ignore\r
+        */\r
+        function removeHelpText() {\r
+\r
+            Dom.removeClass(aNodes, "hashelptext");\r
+\r
+            oEl.removeChild(me._oHelpTextEM);\r
+            me._oHelpTextEM = null;\r
+\r
+        }\r
+\r
+        if(this._checkDOMNode(oHelpText)) {\r
+\r
+            if(this._oHelpTextEM) {\r
+\r
+                this._oHelpTextEM.parentNode.replaceChild(\r
+                    oHelpText, \r
+                    this._oHelpTextEM\r
+                );\r
+\r
+            }\r
+            else {\r
+\r
+                this._oHelpTextEM = oHelpText;\r
+\r
+                oEl.insertBefore(this._oHelpTextEM, oImg);\r
+\r
+            }\r
+\r
+            initHelpText();\r
+\r
+        }\r
+        else if(this._checkString(oHelpText)) {\r
+\r
+            if(oHelpText.length === 0) {\r
+\r
+                removeHelpText();\r
+\r
+            }\r
+            else {\r
+\r
+                if(!this._oHelpTextEM) {\r
+\r
+                    this._oHelpTextEM = document.createElement("em");\r
+\r
+                    oEl.insertBefore(this._oHelpTextEM, oImg);\r
+\r
+                }\r
+\r
+                this._oHelpTextEM.innerHTML = oHelpText;\r
+\r
+                initHelpText();\r
+\r
+            }\r
+\r
+        }\r
+        else if(!oHelpText && this._oHelpTextEM) {\r
+\r
+            removeHelpText();\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "url" configuration property of\r
+    * a MenuModuleItem instance changes.  \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configURL: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var sURL = p_aArgs[0];\r
+\r
+        if(!sURL) {\r
+\r
+            sURL = "#";\r
+\r
+        }\r
+\r
+        this._oAnchor.setAttribute("href", sURL);\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "emphasis" configuration property of\r
+    * a MenuModuleItem instance changes.  \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configEmphasis: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bEmphasis = p_aArgs[0];\r
+        var oAnchor = this._oAnchor;\r
+        var oText = this._oText;\r
+        var oConfig = this.cfg;\r
+        var oEM;\r
+\r
+        if(bEmphasis && oConfig.getProperty("strongemphasis")) {\r
+\r
+            oConfig.setProperty("strongemphasis", false);\r
+\r
+        }\r
+\r
+        if(oAnchor) {\r
+\r
+            if(bEmphasis) {\r
+\r
+                oEM = document.createElement("em");\r
+                oEM.appendChild(oText);\r
+\r
+                oAnchor.appendChild(oEM);\r
+\r
+            }\r
+            else {\r
+\r
+                oEM = this._getFirstElement(oAnchor, "EM");\r
+\r
+                oAnchor.removeChild(oEM);\r
+                oAnchor.appendChild(oText);\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "strongemphasis" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bStrongEmphasis = p_aArgs[0];\r
+        var oAnchor = this._oAnchor;\r
+        var oText = this._oText;\r
+        var oConfig = this.cfg;\r
+        var oStrong;\r
+\r
+        if(bStrongEmphasis && oConfig.getProperty("emphasis")) {\r
+\r
+            oConfig.setProperty("emphasis", false);\r
+\r
+        }\r
+\r
+        if(oAnchor) {\r
+\r
+            if(bStrongEmphasis) {\r
+\r
+                oStrong = document.createElement("strong");\r
+                oStrong.appendChild(oText);\r
+\r
+                oAnchor.appendChild(oStrong);\r
+\r
+            }\r
+            else {\r
+\r
+                oStrong = this._getFirstElement(oAnchor, "STRONG");\r
+\r
+                oAnchor.removeChild(oStrong);\r
+                oAnchor.appendChild(oText);\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "disabled" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configDisabled: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var bDisabled = p_aArgs[0];\r
+        var Dom = this._oDom;\r
+        var oAnchor = this._oAnchor;\r
+        var aNodes = [this.element, oAnchor];\r
+        var oEM = this._oHelpTextEM;\r
+        var oConfig = this.cfg;\r
+        var oImg = this.submenuIndicator;\r
+        var sImageSrc;\r
+        var sImageAlt;\r
+\r
+        if(oEM) {\r
+\r
+            aNodes[2] = oEM;\r
+\r
+        }\r
+\r
+        if(bDisabled) {\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.setProperty("selected", false);\r
+\r
+            }\r
+\r
+            oAnchor.removeAttribute("href");\r
+\r
+            Dom.addClass(aNodes, "disabled");\r
+\r
+            sImageSrc = this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH;\r
+            sImageAlt = this.DISABLED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+        }\r
+        else {\r
+\r
+            oAnchor.setAttribute("href", oConfig.getProperty("url"));\r
+\r
+            Dom.removeClass(aNodes, "disabled");\r
+\r
+            sImageSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;\r
+            sImageAlt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+        }\r
+\r
+        if(oImg) {\r
+\r
+            oImg.src = this.imageRoot + sImageSrc;\r
+            oImg.alt = sImageAlt;\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "selected" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */    \r
+    configSelected: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        if(!this.cfg.getProperty("disabled")) {\r
+\r
+            var Dom = this._oDom;\r
+            var bSelected = p_aArgs[0];\r
+            var oEM = this._oHelpTextEM;\r
+            var aNodes = [this.element, this._oAnchor];\r
+            var oImg = this.submenuIndicator;\r
+            var sImageSrc;\r
+\r
+            if(oEM) {\r
+    \r
+                aNodes[2] = oEM;  \r
+    \r
+            }\r
+    \r
+            if(bSelected) {\r
+    \r
+                Dom.addClass(aNodes, "selected");\r
+                sImageSrc = this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH;\r
+    \r
+            }\r
+            else {\r
+    \r
+                Dom.removeClass(aNodes, "selected");\r
+                sImageSrc = this.SUBMENU_INDICATOR_IMAGE_PATH;\r
+    \r
+            }\r
+    \r
+            if(oImg) {\r
+    \r
+                oImg.src = document.images[(this.imageRoot + sImageSrc)].src;\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Event handler for when the "submenu" configuration property of\r
+    * a MenuModuleItem instance changes. \r
+    * @param {String} p_sType The name of the event that was fired.\r
+    * @param {Array} p_aArgs Collection of arguments sent when the \r
+    * event was fired.\r
+    * @param {YAHOO.widget.MenuModuleItem} p_oItem The MenuModuleItem instance \r
+    * that fired the event.\r
+    */\r
+    configSubmenu: function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        var Dom = this._oDom;\r
+        var oEl = this.element;\r
+        var oSubmenu = p_aArgs[0];\r
+        var oImg = this.submenuIndicator;\r
+        var oConfig = this.cfg;\r
+        var aNodes = [this.element, this._oAnchor];\r
+\r
+        if(oSubmenu) {\r
+\r
+            // Set the submenu's parent to this MenuModuleItem instance\r
+\r
+            oSubmenu.parent = this;\r
+\r
+            this._oSubmenu = oSubmenu;\r
+\r
+            if(!oImg) { \r
+\r
+                var me = this;\r
+\r
+                function preloadImage(p_sPath) {\r
+\r
+                    var sPath = me.imageRoot + p_sPath;\r
+\r
+                    if(!document.images[sPath]) {\r
+\r
+                        var oImg = document.createElement("img");\r
+                        oImg.src = sPath;\r
+                        oImg.name = sPath;\r
+                        oImg.id = sPath;\r
+                        oImg.style.display = "none";\r
+                        \r
+                        document.body.appendChild(oImg);\r
+\r
+                    }\r
+                \r
+                }\r
+\r
+                preloadImage(this.SUBMENU_INDICATOR_IMAGE_PATH);\r
+                preloadImage(this.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH);\r
+                preloadImage(this.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH);\r
+\r
+                oImg = document.createElement("img");\r
+                oImg.src = (this.imageRoot + this.SUBMENU_INDICATOR_IMAGE_PATH);\r
+                oImg.alt = this.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT;\r
+\r
+                oEl.appendChild(oImg);\r
+\r
+                this.submenuIndicator = oImg;\r
+\r
+                Dom.addClass(aNodes, "hassubmenu");\r
+\r
+                if(oConfig.getProperty("disabled")) {\r
+\r
+                    oConfig.refireEvent("disabled");\r
+\r
+                }\r
+\r
+                if(oConfig.getProperty("selected")) {\r
+\r
+                    oConfig.refireEvent("selected");\r
+\r
+                }                \r
+\r
+            }\r
+\r
+        }\r
+        else {\r
+\r
+            Dom.removeClass(aNodes, "hassubmenu");\r
+\r
+            if(oImg) {\r
+\r
+                oEl.removeChild(oImg);\r
+\r
+            }\r
+\r
+            if(this._oSubmenu) {\r
+\r
+                this._oSubmenu.destroy();\r
+\r
+            }\r
+\r
+        }\r
+\r
+    },\r
+\r
+    // Public methods\r
+\r
+       /**\r
+       * Initializes an item's configurable properties.\r
+       */\r
+       initDefaultConfig : function() {\r
+\r
+        var oConfig = this.cfg;\r
+        var CheckBoolean = oConfig.checkBoolean;\r
+\r
+        // Define the config properties\r
+\r
+        oConfig.addProperty(\r
+            "text", \r
+            { \r
+                value: "", \r
+                handler: this.configText, \r
+                validator: this._checkString, \r
+                suppressEvent: true \r
+            }\r
+        );\r
+        \r
+        oConfig.addProperty("helptext", { handler: this.configHelpText });\r
+        \r
+        oConfig.addProperty(\r
+            "url", \r
+            { value: "#", handler: this.configURL, suppressEvent: true }\r
+        );\r
+        \r
+        oConfig.addProperty(\r
+            "emphasis", \r
+            { \r
+                value: false, \r
+                handler: this.configEmphasis, \r
+                validator: CheckBoolean, \r
+                suppressEvent: true \r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "strongemphasis",\r
+            {\r
+                value: false,\r
+                handler: this.configStrongEmphasis,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "disabled",\r
+            {\r
+                value: false,\r
+                handler: this.configDisabled,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty(\r
+            "selected",\r
+            {\r
+                value: false,\r
+                handler: this.configSelected,\r
+                validator: CheckBoolean,\r
+                suppressEvent: true\r
+            }\r
+        );\r
+\r
+        oConfig.addProperty("submenu", { handler: this.configSubmenu });\r
+\r
+       },\r
+\r
+    /**\r
+    * Finds the next enabled MenuModuleItem instance in a MenuModule instance \r
+    * @return Returns a MenuModuleItem instance.\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    getNextEnabledSibling: function() {\r
+\r
+        if(this.parent instanceof YAHOO.widget.MenuModule) {\r
+\r
+            var nGroupIndex = this.groupIndex;\r
+\r
+            /**\r
+            * Returns the next item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */\r
+            function getNextArrayItem(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] || \r
+                    getNextArrayItem(p_aArray, (p_nStartIndex+1));\r
+    \r
+            }\r
+    \r
+    \r
+            var aItemGroups = this.parent.getItemGroups();\r
+            var oNextItem;\r
+    \r
+    \r
+            if(this.index < (aItemGroups[nGroupIndex].length - 1)) {\r
+    \r
+                oNextItem = getNextArrayItem(\r
+                        aItemGroups[nGroupIndex], \r
+                        (this.index+1)\r
+                    );\r
+    \r
+            }\r
+            else {\r
+    \r
+                var nNextGroupIndex;\r
+    \r
+                if(nGroupIndex < (aItemGroups.length - 1)) {\r
+    \r
+                    nNextGroupIndex = nGroupIndex + 1;\r
+    \r
+                }\r
+                else {\r
+    \r
+                    nNextGroupIndex = 0;\r
+    \r
+                }\r
+    \r
+                var aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);\r
+    \r
+                // Retrieve the first MenuModuleItem instance in the next group\r
+    \r
+                oNextItem = getNextArrayItem(aNextGroup, 0);\r
+    \r
+            }\r
+    \r
+            return oNextItem.cfg.getProperty("disabled") ? \r
+                        oNextItem.getNextEnabledSibling() : oNextItem;\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Finds the previous enabled MenuModuleItem instance in a \r
+    * MenuModule instance \r
+    * @return Returns a MenuModuleItem instance.\r
+    * @type YAHOO.widget.MenuModuleItem\r
+    */\r
+    getPreviousEnabledSibling: function() {\r
+\r
+        if(this.parent instanceof YAHOO.widget.MenuModule) {\r
+\r
+            var nGroupIndex = this.groupIndex;\r
+\r
+            /**\r
+            * Returns the previous item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */\r
+            function getPreviousArrayItem(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] || \r
+                    getPreviousArrayItem(p_aArray, (p_nStartIndex-1));\r
+    \r
+            }\r
+\r
+            /**\r
+            * Get the index of the first item in an array \r
+            * @param {p_aArray} An array\r
+            * @param {p_nStartIndex} The index to start searching the array \r
+            * @ignore\r
+            * @return Returns an item in an array\r
+            * @type Object \r
+            */    \r
+            function getFirstItemIndex(p_aArray, p_nStartIndex) {\r
+    \r
+                return p_aArray[p_nStartIndex] ? \r
+                    p_nStartIndex : \r
+                    getFirstItemIndex(p_aArray, (p_nStartIndex+1));\r
+    \r
+            }\r
+    \r
+            var aItemGroups = this.parent.getItemGroups();\r
+            var oPreviousItem;\r
+    \r
+            if(\r
+                this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)\r
+            ) {\r
+    \r
+                oPreviousItem = \r
+                    getPreviousArrayItem(\r
+                        aItemGroups[nGroupIndex], \r
+                        (this.index-1)\r
+                    );\r
+    \r
+            }\r
+            else {\r
+    \r
+                var nPreviousGroupIndex;\r
+    \r
+                if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {\r
+    \r
+                    nPreviousGroupIndex = nGroupIndex - 1;\r
+    \r
+                }\r
+                else {\r
+    \r
+                    nPreviousGroupIndex = aItemGroups.length - 1;\r
+    \r
+                }\r
+    \r
+                var aPreviousGroup = \r
+                        getPreviousArrayItem(aItemGroups, nPreviousGroupIndex);\r
+    \r
+                oPreviousItem = \r
+                    getPreviousArrayItem(\r
+                        aPreviousGroup, \r
+                        (aPreviousGroup.length - 1)\r
+                    );\r
+    \r
+            }\r
+    \r
+            return oPreviousItem.cfg.getProperty("disabled") ? \r
+                    oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Causes a MenuModuleItem instance to receive the focus and fires the\r
+    * focus event.\r
+    */\r
+    focus: function() {\r
+\r
+        var oParent = this.parent;\r
+        var oAnchor = this._oAnchor;\r
+        var oActiveItem = oParent.activeItem;\r
+\r
+        if(\r
+            !this.cfg.getProperty("disabled") && \r
+            oParent && \r
+            oParent.cfg.getProperty("visible")\r
+        ) {\r
+\r
+            if(oActiveItem) {\r
+\r
+                oActiveItem.blur();\r
+\r
+            }\r
+\r
+            oAnchor.focus();\r
+\r
+            /*\r
+                Opera 8.5 doesn't always focus the anchor if a MenuModuleItem\r
+                instance has a submenu, this is fixed by calling "focus"\r
+                twice.\r
+            */\r
+            if(oParent && this.browser == "opera" && this._oSubmenu) {\r
+\r
+                oAnchor.focus();\r
+\r
+            }\r
+\r
+            this.focusEvent.fire();\r
+\r
+        }\r
+\r
+    },\r
+\r
+    /**\r
+    * Causes a MenuModuleItem instance to lose focus and fires the onblur event.\r
+    */    \r
+    blur: function() {\r
+\r
+        var oParent = this.parent;\r
+\r
+        if(\r
+            !this.cfg.getProperty("disabled") && \r
+            oParent && \r
+            this._oDom.getStyle(oParent.element, "visibility") == "visible"\r
+        ) {\r
+\r
+            this._oAnchor.blur();\r
+\r
+            this.blurEvent.fire();\r
+\r
+        }\r
+\r
+    },\r
+\r
+       /**\r
+       * Removes a MenuModuleItem instance's HTMLLIElement from it's parent\r
+    * HTMLUListElement node.\r
+       */\r
+    destroy: function() {\r
+\r
+        var oEl = this.element;\r
+\r
+        if(oEl) {\r
+\r
+            // Remove CustomEvent listeners\r
+    \r
+            this.mouseOverEvent.unsubscribeAll();\r
+            this.mouseOutEvent.unsubscribeAll();\r
+            this.mouseDownEvent.unsubscribeAll();\r
+            this.mouseUpEvent.unsubscribeAll();\r
+            this.clickEvent.unsubscribeAll();\r
+            this.keyPressEvent.unsubscribeAll();\r
+            this.keyDownEvent.unsubscribeAll();\r
+            this.keyUpEvent.unsubscribeAll();\r
+            this.focusEvent.unsubscribeAll();\r
+            this.blurEvent.unsubscribeAll();\r
+            this.cfg.configChangedEvent.unsubscribeAll();\r
+\r
+            // Remove the element from the parent node\r
+\r
+            var oParentNode = oEl.parentNode;\r
+\r
+            if(oParentNode) {\r
+\r
+                oParentNode.removeChild(oEl);\r
+\r
+                this.destroyEvent.fire();\r
+\r
+            }\r
+\r
+            this.destroyEvent.unsubscribeAll();\r
+\r
+        }\r
+\r
+    }\r
+\r
+};\r
+\r
+/**\r
+* @class Extends YAHOO.widget.MenuModule to provide a set of default mouse and \r
+* key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModule\r
+* @base YAHOO.widget.MenuModule\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a Menu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.Menu = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.Menu.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.Menu, YAHOO.widget.MenuModule);\r
+\r
+/**\r
+* The Menu class's initialization method. This method is automatically \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a Menu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.Menu.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+    // Call the init of the superclass (YAHOO.widget.Menu)\r
+\r
+    YAHOO.widget.Menu.superclass.init.call(this, p_oElement);\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.Menu);\r
+\r
+    // Add event handlers\r
+\r
+    this.showEvent.subscribe(this._onMenuShow, this, true);\r
+    this.mouseOverEvent.subscribe(this._onMenuMouseOver, this, true);\r
+    this.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);\r
+\r
+    if(p_oConfig) {\r
+\r
+        this.cfg.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    this.initEvent.fire(YAHOO.widget.Menu);\r
+\r
+};\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "show" Custom Event handler for a menu.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The menu that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuShow = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+\r
+        var oParent = this.parent;\r
+\r
+        if(oParent && oParent.parent instanceof YAHOO.widget.Menu) {\r
+\r
+            var aAlignment = oParent.parent.cfg.getProperty("submenualignment");\r
+    \r
+            this.cfg.setProperty(\r
+                "submenualignment", \r
+                [ aAlignment[0], aAlignment[1] ]\r
+            );\r
+        \r
+        }\r
+\r
+    };\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a Menu instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuMouseOver = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        /*\r
+            If the menu is a submenu, then select the menu's parent\r
+            MenuItem instance\r
+        */\r
+    \r
+        if(this.parent) {\r
+    \r
+            this.parent.cfg.setProperty("selected", true);\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a Menu instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance that fired the event.\r
+*/\r
+YAHOO.widget.Menu.prototype._onMenuKeyDown = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        if(this.cfg.getProperty("position") == "dynamic") {\r
+    \r
+            var oDOMEvent = p_aArgs[0];\r
+            var oParent = this.parent;\r
+        \r
+            if(oDOMEvent.keyCode == 27) { // Esc key\r
+        \r
+                this.hide();\r
+        \r
+                // Set focus to the parent MenuItem if one exists\r
+        \r
+                if(oParent) {\r
+        \r
+                    oParent.focus();\r
+\r
+                    if(oParent.parent instanceof YAHOO.widget.Menu) {\r
+\r
+                        oParent.cfg.setProperty("selected", true);\r
+        \r
+                    }\r
+\r
+                    YAHOO.util.Event.preventDefault(oDOMEvent);\r
+        \r
+                }\r
+            \r
+            }\r
+        \r
+        }\r
+    \r
+    };\r
+    \r
+\r
+// Public event handlers\r
+\r
+/**\r
+* Event handler fired when the resize monitor element is resized.\r
+*/\r
+YAHOO.widget.Menu.prototype.onDomResize = function(e, obj) {\r
+\r
+    if(!this._handleResize) {\r
+    \r
+        this._handleResize = true;\r
+        return;\r
+    \r
+    }\r
+\r
+\r
+    var me = this;\r
+    var oConfig = this.cfg;\r
+\r
+    if(oConfig.getProperty("position") == "dynamic") {\r
+\r
+        oConfig.setProperty("width", (this._getOffsetWidth() + "px"));\r
+        \r
+        if(this.parent && oConfig.getProperty("visible")) {\r
+\r
+            function align() {\r
+\r
+                me.align();\r
+            \r
+            }\r
+\r
+            window.setTimeout(align, 0);\r
+            \r
+        }\r
+\r
+    }\r
+\r
+    YAHOO.widget.Menu.superclass.onDomResize.call(this, e, obj);\r
+\r
+};    \r
+\r
+/**\r
+* @class The MenuItem class allows you to create and modify an item for a\r
+* Menu instance.  MenuItem extends YAHOO.widget.MenuModuleItem to provide a \r
+* set of default mouse and key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModuleItem\r
+* @base YAHOO.widget.MenuModuleItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuItem, YAHOO.widget.MenuModuleItem);\r
+\r
+/**\r
+* The MenuItem class's initialization method. This method is automatically\r
+* called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuItem.prototype.init = function(p_oObject, p_oConfig) {\r
+\r
+    if(!this.SUBMENU_TYPE) {\r
+\r
+        this.SUBMENU_TYPE = YAHOO.widget.Menu;\r
+\r
+    }\r
+\r
+    if(!this.SUBMENU_ITEM_TYPE) {\r
+\r
+        this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+    /* \r
+        Call the init of the superclass (YAHOO.widget.MenuModuleItem)\r
+        Note: We don't pass the user config in here yet \r
+        because we only want it executed once, at the lowest \r
+        subclass level.\r
+    */ \r
+\r
+    YAHOO.widget.MenuItem.superclass.init.call(this, p_oObject);  \r
+\r
+    // Add event handlers to each "MenuItem" instance\r
+\r
+    this.keyDownEvent.subscribe(this._onKeyDown, this, true);\r
+    this.mouseOverEvent.subscribe(this._onMouseOver, this, true);\r
+    this.mouseOutEvent.subscribe(this._onMouseOut, this, true);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+\r
+    oConfig.fireQueue();\r
+\r
+};\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_nrm_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the selected \r
+* checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.SELECTED_CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_hov_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the disabled \r
+* checked state.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_PATH = \r
+    "nt/ic/ut/bsc/menuchk8_dim_1.gif";\r
+\r
+/**\r
+* Constant representing the alt text for the image to be used for the \r
+* checked image.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.CHECKED_IMAGE_ALT_TEXT = "Checked.";\r
+\r
+/**\r
+* Constant representing the alt text for the image to be used for the \r
+* checked image when the item is disabled.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuItem.prototype.DISABLED_CHECKED_IMAGE_ALT_TEXT = \r
+    "Checked. (Item disabled.)";\r
+\r
+// Private properties\r
+\r
+/**\r
+* Reference to the HTMLImageElement used to create the checked\r
+* indicator for a MenuItem instance.\r
+* @private\r
+* @type {HTMLImageElement}\r
+*/\r
+YAHOO.widget.MenuItem.prototype._checkImage = null;\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "keydown" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onKeyDown = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oDOMEvent = p_aArgs[0];\r
+        var oParent = this.parent;\r
+        var oConfig = this.cfg;\r
+        var oMenuItem;\r
+    \r
+\r
+        switch(oDOMEvent.keyCode) {\r
+    \r
+            case 38:    // Up arrow\r
+            case 40:    // Down arrow\r
+    \r
+                if(\r
+                    this == oParent.activeItem && \r
+                    !oConfig.getProperty("selected")\r
+                ) {\r
+    \r
+                    oConfig.setProperty("selected", true);\r
+    \r
+                }\r
+                else {\r
+    \r
+                    var oNextItem = (oDOMEvent.keyCode == 38) ? \r
+                            this.getPreviousEnabledSibling() : \r
+                            this.getNextEnabledSibling();\r
+            \r
+                    if(oNextItem) {\r
+\r
+                        oParent.clearActiveItem();\r
+\r
+                        oNextItem.cfg.setProperty("selected", true);\r
+            \r
+                        oNextItem.focus();\r
+    \r
+                    }\r
+    \r
+                }\r
+    \r
+                Event.preventDefault(oDOMEvent);\r
+\r
+            break;\r
+            \r
+    \r
+            case 39:    // Right arrow\r
+\r
+                oParent.clearActiveItem();\r
+\r
+                oConfig.setProperty("selected", true);\r
+                \r
+                this.focus();\r
+\r
+                var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+                if(oSubmenu) {\r
+\r
+                    oSubmenu.show();\r
+                    oSubmenu.setInitialSelection();                    \r
+    \r
+                }\r
+                else if(\r
+                    YAHOO.widget.MenuBarItem && \r
+                    oParent.parent && \r
+                    oParent.parent instanceof YAHOO.widget.MenuBarItem\r
+                ) {\r
+\r
+                    oParent.hide();\r
+    \r
+                    // Set focus to the parent MenuItem if one exists\r
+    \r
+                    oMenuItem = oParent.parent;\r
+    \r
+                    if(oMenuItem) {\r
+    \r
+                        oMenuItem.focus();\r
+                        oMenuItem.cfg.setProperty("selected", true);\r
+    \r
+                    }                    \r
+                \r
+                }\r
+    \r
+                Event.preventDefault(oDOMEvent);\r
+\r
+            break;\r
+    \r
+    \r
+            case 37:    // Left arrow\r
+    \r
+                // Only hide if this this is a MenuItem of a submenu\r
+    \r
+                if(oParent.parent) {\r
+    \r
+                    oParent.hide();\r
+    \r
+                    // Set focus to the parent MenuItem if one exists\r
+    \r
+                    oMenuItem = oParent.parent;\r
+    \r
+                    if(oMenuItem) {\r
+    \r
+                        oMenuItem.focus();\r
+                        oMenuItem.cfg.setProperty("selected", true);\r
+    \r
+                    }\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;        \r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "mouseover" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onMouseOver = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var oParent = this.parent;\r
+        var oConfig = this.cfg;\r
+        var oActiveItem = oParent.activeItem;\r
+    \r
+    \r
+        // Hide any other submenus that might be visible\r
+    \r
+        if(oActiveItem && oActiveItem != this) {\r
+    \r
+            oParent.clearActiveItem();\r
+    \r
+        }\r
+    \r
+    \r
+        // Select and focus the current MenuItem instance\r
+    \r
+        oConfig.setProperty("selected", true);\r
+        this.focus();\r
+    \r
+    \r
+        // Show the submenu for this instance\r
+    \r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            oSubmenu.show();\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "mouseout" Custom Event handler for a MenuItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuItem.prototype._onMouseOut = \r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+    \r
+        var oConfig = this.cfg;\r
+        var oSubmenu = oConfig.getProperty("submenu");\r
+\r
+        oConfig.setProperty("selected", false);\r
+    \r
+        if(oSubmenu) {\r
+    \r
+            var oDOMEvent = p_aArgs[0];\r
+            var oRelatedTarget = YAHOO.util.Event.getRelatedTarget(oDOMEvent);\r
+    \r
+            if(\r
+                !(\r
+                    oRelatedTarget == oSubmenu.element || \r
+                    YAHOO.util.Dom.isAncestor(oSubmenu.element, oRelatedTarget)\r
+                )\r
+            ) {\r
+    \r
+                oSubmenu.hide();\r
+    \r
+            }\r
+    \r
+        }\r
+    \r
+    };\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "checked" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configChecked =\r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+    \r
+        var Dom = YAHOO.util.Dom;\r
+        var bChecked = p_aArgs[0];\r
+        var oEl = this.element;\r
+        var oConfig = this.cfg;\r
+        var oImg;\r
+        \r
+\r
+        if(bChecked) {\r
+\r
+            var me = this;\r
+\r
+            function preloadImage(p_sPath) {\r
+\r
+                var sPath = me.imageRoot + p_sPath;\r
+\r
+                if(!document.images[sPath]) {\r
+\r
+                    var oImg = document.createElement("img");\r
+                    oImg.src = sPath;\r
+                    oImg.name = sPath;\r
+                    oImg.id = sPath;\r
+                    oImg.style.display = "none";\r
+                    \r
+                    document.body.appendChild(oImg);\r
+\r
+                }\r
+            \r
+            }\r
+\r
+            preloadImage(this.CHECKED_IMAGE_PATH);\r
+            preloadImage(this.SELECTED_CHECKED_IMAGE_PATH);\r
+            preloadImage(this.DISABLED_CHECKED_IMAGE_PATH);\r
+\r
+            oImg = document.createElement("img");\r
+            oImg.src = (this.imageRoot + this.CHECKED_IMAGE_PATH);\r
+            oImg.alt = this.CHECKED_IMAGE_ALT_TEXT;\r
+\r
+            var oSubmenu = this.cfg.getProperty("submenu");\r
+\r
+            if(oSubmenu) {\r
+\r
+                oEl.insertBefore(oImg, oSubmenu.element);\r
+\r
+            }\r
+            else {\r
+\r
+                oEl.appendChild(oImg);            \r
+\r
+            }\r
+\r
+            Dom.addClass([oEl, oImg], "checked");\r
+\r
+            this._checkImage = oImg;\r
+\r
+            if(oConfig.getProperty("disabled")) {\r
+\r
+                oConfig.refireEvent("disabled");\r
+\r
+            }\r
+\r
+            if(oConfig.getProperty("selected")) {\r
+\r
+                oConfig.refireEvent("selected");\r
+\r
+            }\r
+        \r
+        }\r
+        else {\r
+\r
+            oImg = this._checkImage;\r
+\r
+            Dom.removeClass([oEl, oImg], "checked");\r
+\r
+            if(oImg) {\r
+\r
+                oEl.removeChild(oImg);\r
+\r
+            }\r
+\r
+            this._checkImage = null;\r
+        \r
+        }\r
+\r
+    };\r
+    \r
+\r
+/**\r
+* Event handler for when the "selected" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configSelected = \r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+\r
+        YAHOO.widget.MenuItem.superclass.configSelected.call(\r
+                this, p_sType, p_aArgs, p_oItem\r
+            );        \r
+    \r
+        var oConfig = this.cfg;\r
+\r
+        if(!oConfig.getProperty("disabled") && oConfig.getProperty("checked")) {\r
+\r
+            var bSelected = p_aArgs[0];\r
+\r
+            var sSrc = this.imageRoot + (bSelected ? \r
+                this.SELECTED_CHECKED_IMAGE_PATH : this.CHECKED_IMAGE_PATH);\r
+\r
+            this._checkImage.src = document.images[sSrc].src;\r
+            \r
+        }            \r
+    \r
+    };\r
+\r
+/**\r
+* Event handler for when the "disabled" configuration property of\r
+* a MenuItem instance changes. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.MenuItem} p_oItem The MenuItem instance \r
+* that fired the event.\r
+*/    \r
+YAHOO.widget.MenuItem.prototype.configDisabled = \r
+\r
+    function(p_sType, p_aArgs, p_oItem) {\r
+    \r
+        YAHOO.widget.MenuItem.superclass.configDisabled.call(\r
+                this, p_sType, p_aArgs, p_oItem\r
+            );        \r
+    \r
+        if(this.cfg.getProperty("checked")) {\r
+    \r
+            var bDisabled = p_aArgs[0];\r
+            var sAlt = this.CHECKED_IMAGE_ALT_TEXT;\r
+            var sSrc = this.CHECKED_IMAGE_PATH;\r
+            var oImg = this._checkImage;\r
+            \r
+            if(bDisabled) {\r
+    \r
+                sAlt = this.DISABLED_CHECKED_IMAGE_ALT_TEXT;\r
+                sSrc = this.DISABLED_CHECKED_IMAGE_PATH;\r
+            \r
+            }\r
+\r
+            oImg.src = document.images[(this.imageRoot + sSrc)].src;\r
+            oImg.alt = sAlt;\r
+            \r
+        }    \r
+            \r
+    };\r
+\r
+// Public methods\r
+    \r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* the MenuModule's Config object (cfg).\r
+*/\r
+YAHOO.widget.MenuItem.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.MenuItem.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add configuration properties\r
+\r
+    this.cfg.addProperty(\r
+        "checked", \r
+        {\r
+            value: false, \r
+            handler: this.configChecked, \r
+            validator: this.cfg.checkBoolean, \r
+            suppressEvent: true \r
+        } \r
+    );\r
+\r
+};\r
+\r
+/**\r
+* @class Creates a list of options which vary depending on the context in \r
+* which the menu is invoked.\r
+* @constructor\r
+* @extends YAHOO.widget.Menu\r
+* @base YAHOO.widget.Menu\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a ContextMenu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.ContextMenu.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.ContextMenu, YAHOO.widget.Menu);\r
+\r
+YAHOO.widget.ContextMenu.prototype._oTrigger = null;\r
+\r
+/**\r
+* The ContextMenu class's initialization method. This method is automatically  \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a ContextMenu instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;\r
+\r
+    }\r
+\r
+    // Call the init of the superclass (YAHOO.widget.Menu)\r
+\r
+    YAHOO.widget.ContextMenu.superclass.init.call(this, p_oElement);\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.ContextMenu);\r
+\r
+    if(p_oConfig) {\r
+\r
+        this.cfg.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    \r
+    this.initEvent.fire(YAHOO.widget.ContextMenu);\r
+\r
+};\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "mousedown" event handler for the document object.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onDocumentMouseDown = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+    \r
+        var oTarget = YAHOO.util.Event.getTarget(p_oEvent);\r
+        var oTargetEl = this._oTargetElement;\r
+    \r
+        if(\r
+            oTarget != oTargetEl || \r
+            !YAHOO.util.Dom.isAncestor(oTargetEl, oTarget)\r
+        ) {\r
+    \r
+            this.hide();\r
+        \r
+        }\r
+    \r
+    };\r
+\r
+/**\r
+* "click" event handler for the HTMLElement node that triggered the event. \r
+* Used to cancel default behaviors in Opera.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onTriggerClick = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+\r
+        if(p_oEvent.ctrlKey) {\r
+        \r
+            YAHOO.util.Event.stopEvent(p_oEvent);\r
+    \r
+        }\r
+        \r
+    };\r
+\r
+/**\r
+* "contextmenu" event handler ("mousedown" for Opera) for the HTMLElement \r
+* node that triggered the event.\r
+* @private\r
+* @param {Event} p_oEvent Event object passed back by the \r
+* event utility (YAHOO.util.Event).\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu instance \r
+* handling the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype._onTriggerContextMenu = \r
+\r
+    function(p_oEvent, p_oMenu) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oConfig = this.cfg;\r
+\r
+        if(p_oEvent.type == "mousedown") {\r
+        \r
+            if(!p_oEvent.ctrlKey) {\r
+    \r
+                return;\r
+            \r
+            }\r
+        \r
+            Event.stopEvent(p_oEvent);\r
+    \r
+        }\r
+    \r
+    \r
+        this.contextEventTarget = Event.getTarget(p_oEvent);\r
+    \r
+    \r
+        // Position and display the context menu\r
+    \r
+        var nX = Event.getPageX(p_oEvent);\r
+        var nY = Event.getPageY(p_oEvent);\r
+    \r
+    \r
+        oConfig.applyConfig( { x:nX, y:nY, visible:true } );\r
+        oConfig.fireQueue();\r
+    \r
+    \r
+        // Prevent the browser's default context menu from appearing\r
+    \r
+        Event.preventDefault(p_oEvent);\r
+    \r
+    };\r
+\r
+// Public properties\r
+\r
+/**\r
+* Returns the HTMLElement node that was the target of the "contextmenu" \r
+* DOM event.\r
+* @type HTMLElement\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.contextEventTarget = null;\r
+\r
+// Public methods\r
+\r
+/**\r
+* Initializes the class's configurable properties which can be changed using \r
+* a ContextMenu instance's Config object (cfg).\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.initDefaultConfig = function() {\r
+\r
+    YAHOO.widget.ContextMenu.superclass.initDefaultConfig.call(this);\r
+\r
+       // Add a configuration property\r
+\r
+    this.cfg.addProperty("trigger", { handler: this.configTrigger });\r
+\r
+};\r
+\r
+// Event handlers for configuration properties\r
+\r
+/**\r
+* Event handler for when the "trigger" configuration property of\r
+* a MenuItem instance. \r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the \r
+* event was fired.\r
+* @param {YAHOO.widget.ContextMenu} p_oMenu The ContextMenu that instance fired\r
+* the event.\r
+*/\r
+YAHOO.widget.ContextMenu.prototype.configTrigger = \r
+\r
+    function(p_sType, p_aArgs, p_oMenu) {\r
+    \r
+        var Event = YAHOO.util.Event;\r
+        var oTrigger = p_aArgs[0];\r
+    \r
+        if(oTrigger) {\r
+    \r
+\r
+            /*\r
+                If there is a current "trigger" - remove the event handlers \r
+                from that element(s) before assigning new ones\r
+            */\r
+            if(this._oTrigger) {\r
+            \r
+                Event.purgeElement(this._oTrigger);\r
+\r
+            }\r
+\r
+            this._oTrigger = oTrigger;\r
+\r
+            /*\r
+                Listen for the "mousedown" event in Opera b/c it does not \r
+                support the "contextmenu" event\r
+            */ \r
+      \r
+            var bOpera = (this.browser == "opera");\r
+    \r
+            Event.addListener(\r
+                oTrigger, \r
+                (bOpera ? "mousedown" : "contextmenu"), \r
+                this._onTriggerContextMenu,\r
+                this,\r
+                true\r
+            );\r
+    \r
+    \r
+            /*\r
+                Assign a "click" event handler to the trigger element(s) for\r
+                Opera to prevent default browser behaviors.\r
+            */\r
+    \r
+            if(bOpera) {\r
+            \r
+                Event.addListener(\r
+                    oTrigger, \r
+                    "click", \r
+                    this._onTriggerClick,\r
+                    this,\r
+                    true\r
+                );\r
+    \r
+            }\r
+    \r
+    \r
+            // Assign a "mousedown" event handler to the document\r
+        \r
+            Event.addListener(\r
+                document, \r
+                "mousedown", \r
+                this._onDocumentMouseDown,\r
+                this,\r
+                true\r
+            );        \r
+    \r
+        }\r
+        \r
+    };\r
+\r
+/**\r
+* @class Creates an item for a context menu instance.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuItem\r
+* @base YAHOO.widget.MenuItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a ContextMenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.ContextMenuItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem);\r
+\r
+/**\r
+* The ContextMenuItem class's initialization method. This method is\r
+* automatically called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a ContextMenuItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.ContextMenuItem.prototype.init = \r
+\r
+    function(p_oObject, p_oConfig) {\r
+    \r
+        if(!this.SUBMENU_TYPE) {\r
+    \r
+            this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;\r
+    \r
+        }\r
+    \r
+        if(!this.SUBMENU_ITEM_TYPE) {\r
+    \r
+            this.SUBMENU_ITEM_TYPE = YAHOO.widget.ContextMenuItem;\r
+    \r
+        }\r
+    \r
+    \r
+        /* \r
+            Call the init of the superclass (YAHOO.widget.MenuItem)\r
+            Note: We don't pass the user config in here yet \r
+            because we only want it executed once, at the lowest \r
+            subclass level.\r
+        */ \r
+    \r
+        YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);\r
+\r
+        var oConfig = this.cfg;\r
+    \r
+        if(p_oConfig) {\r
+    \r
+            oConfig.applyConfig(p_oConfig, true);\r
+    \r
+        }\r
+    \r
+        oConfig.fireQueue();\r
+    \r
+    };\r
+\r
+/**\r
+* @class Horizontal collection of items, each of which can contain a submenu.\r
+* Extends YAHOO.widget.MenuModule to provide a set of default mouse and \r
+* key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModule\r
+* @base YAHOO.widget.MenuModule\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuBar instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuBar.superclass.constructor.call(\r
+            this, \r
+            p_oElement,\r
+            p_oConfig\r
+        );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuBar, YAHOO.widget.MenuModule);\r
+\r
+/**\r
+* The MenuBar class's initialization method. This method is automatically \r
+* called by the constructor, and sets up all DOM references for pre-existing \r
+* markup, and creates required markup if it is not already present.\r
+* @param {String or HTMLElement} p_oElement String id or HTMLElement \r
+* (either HTMLSelectElement or HTMLDivElement) of the source HTMLElement node.\r
+* @param {Object} p_oConfig Optional. The configuration object literal \r
+* containing the configuration for a MenuBar instance. See \r
+* configuration class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBar.prototype.init = function(p_oElement, p_oConfig) {\r
+\r
+    if(!this.ITEM_TYPE) {\r
+\r
+        this.ITEM_TYPE = YAHOO.widget.MenuBarItem;\r
+\r
+    }\r
+\r
+    // Call the init of the superclass (YAHOO.widget.MenuModule)\r
+\r
+    YAHOO.widget.MenuBar.superclass.init.call(this, p_oElement);\r
+\r
+    this.beforeInitEvent.fire(YAHOO.widget.MenuBar);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    /*\r
+        Set the default value for the "position" configuration property\r
+        to "static" \r
+    */\r
+    if(!p_oConfig || (p_oConfig && !p_oConfig.position)) {\r
+\r
+        oConfig.queueProperty("position", "static");\r
+\r
+    }\r
+\r
+    /*\r
+        Set the default value for the "submenualignment" configuration property\r
+        to "tl" and "bl" \r
+    */\r
+    if(!p_oConfig || (p_oConfig && !p_oConfig.submenualignment)) {\r
+\r
+        oConfig.queueProperty("submenualignment", ["tl","bl"]);\r
+\r
+    }\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+    \r
+    this.initEvent.fire(YAHOO.widget.MenuBar);\r
+\r
+};\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLDivElement of the MenuBar instance.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBar.prototype.CSS_CLASS_NAME = "yuimenubar";\r
+\r
+/**\r
+* @class The MenuBarItem class allows you to create and modify an item for a\r
+* MenuBar instance.  MenuBarItem extends YAHOO.widget.MenuModuleItem to provide \r
+* a set of default mouse and key event behaviors.\r
+* @constructor\r
+* @extends YAHOO.widget.MenuModuleItem\r
+* @base YAHOO.widget.MenuModuleItem\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuBarItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {\r
+\r
+    YAHOO.widget.MenuBarItem.superclass.constructor.call(\r
+        this, \r
+        p_oObject, \r
+        p_oConfig\r
+    );\r
+\r
+};\r
+\r
+YAHOO.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuModuleItem);\r
+\r
+/**\r
+* The MenuBarItem class's initialization method. This method is automatically\r
+* called by the constructor, and sets up all DOM references for\r
+* pre-existing markup, and creates required markup if it is not\r
+* already present.\r
+* @param {String or HTMLElement} p_oObject String or HTMLElement \r
+* (either HTMLLIElement, HTMLOptGroupElement or HTMLOptionElement) of the \r
+* source HTMLElement node.\r
+* @param {Object} p_oConfig The configuration object literal containing \r
+* the configuration for a MenuBarItem instance. See the configuration \r
+* class documentation for more details.\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.init = function(p_oObject, p_oConfig) {\r
+\r
+    if(!this.SUBMENU_TYPE) {\r
+\r
+        this.SUBMENU_TYPE = YAHOO.widget.Menu;\r
+\r
+    }\r
+\r
+    if(!this.SUBMENU_ITEM_TYPE) {\r
+\r
+        this.SUBMENU_ITEM_TYPE = YAHOO.widget.MenuItem;\r
+\r
+    }\r
+\r
+    /* \r
+        Call the init of the superclass (YAHOO.widget.MenuModuleItem)\r
+        Note: We don't pass the user config in here yet \r
+        because we only want it executed once, at the lowest \r
+        subclass level.\r
+    */ \r
+\r
+    YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);  \r
+\r
+    // Add event handlers to each "MenuBarItem" instance\r
+\r
+    this.keyDownEvent.subscribe(this._onKeyDown, this, true);\r
+\r
+    var oConfig = this.cfg;\r
+\r
+    if(p_oConfig) {\r
+\r
+        oConfig.applyConfig(p_oConfig, true);\r
+\r
+    }\r
+\r
+    oConfig.fireQueue();\r
+\r
+};\r
+\r
+// Constants\r
+\r
+/**\r
+* Constant representing the CSS class(es) to be applied to the root \r
+* HTMLLIElement of the MenuBarItem.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.CSS_CLASS_NAME = "yuimenubaritem";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.SUBMENU_INDICATOR_IMAGE_PATH =\r
+    "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator when a MenuBarItem instance is selected.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH =\r
+    "nt/ic/ut/alt1/menuarodwn8_hov_1.gif";\r
+\r
+/**\r
+* Constant representing the path to the image to be used for the submenu\r
+* arrow indicator when a MenuBarItem instance is disabled.\r
+* @final\r
+* @type String\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH = \r
+    "nt/ic/ut/alt1/menuarodwn8_dim_1.gif";\r
+\r
+// Private event handlers\r
+\r
+/**\r
+* "keydown" Custom Event handler for a MenuBarItem instance.\r
+* @private\r
+* @param {String} p_sType The name of the event that was fired.\r
+* @param {Array} p_aArgs Collection of arguments sent when the event \r
+* was fired.\r
+* @param {YAHOO.widget.MenuModule} p_oMenuModule The MenuModule instance that \r
+* fired the event.\r
+*/\r
+YAHOO.widget.MenuBarItem.prototype._onKeyDown =\r
+\r
+    function(p_sType, p_aArgs, p_oMenuItem) {\r
+\r
+        var Event = YAHOO.util.Event;\r
+        var oDOMEvent = p_aArgs[0];\r
+        var oConfig = this.cfg;\r
+        var oParent = this.parent;\r
+    \r
+        switch(oDOMEvent.keyCode) {\r
+    \r
+            case 37:    // Left arrow\r
+            case 39:    // Right arrow\r
+    \r
+                if(\r
+                    this == oParent.activeItem && \r
+                    !oConfig.getProperty("selected")\r
+                ) {\r
+    \r
+                    oConfig.setProperty("selected", true);\r
+    \r
+                }\r
+                else {\r
+    \r
+                    var oNextItem = (oDOMEvent.keyCode == 37) ? \r
+                            this.getPreviousEnabledSibling() : \r
+                            this.getNextEnabledSibling();\r
+            \r
+                    if(oNextItem) {\r
+\r
+                        oParent.clearActiveItem();\r
+\r
+                        oNextItem.cfg.setProperty("selected", true);\r
+            \r
+                        oNextItem.focus();\r
+    \r
+                    }\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;\r
+    \r
+            case 40:    // Down arrow\r
+\r
+                oParent.clearActiveItem();\r
+                        \r
+                oConfig.setProperty("selected", true);\r
+                \r
+                this.focus();\r
+\r
+                var oSubmenu = oConfig.getProperty("submenu");\r
+    \r
+                if(oSubmenu) {\r
+        \r
+                    oSubmenu.show();\r
+                    oSubmenu.setInitialSelection();\r
+    \r
+                }\r
+\r
+                Event.preventDefault(oDOMEvent);\r
+    \r
+            break;\r
+    \r
+        }\r
+    \r
+    };\r
diff --git a/lib/yui/reset/README b/lib/yui/reset/README
new file mode 100755 (executable)
index 0000000..f593c8f
--- /dev/null
@@ -0,0 +1,9 @@
+CSS Reset Release Notes\r
+\r
+*** version 0.11.0 ***\r
+\r
+* No changes.\r
+\r
+*** version 0.10.0 ***\r
+\r
+* Initial release
\ No newline at end of file
diff --git a/lib/yui/reset/reset-min.css b/lib/yui/reset/reset-min.css
new file mode 100755 (executable)
index 0000000..b820331
--- /dev/null
@@ -0,0 +1,7 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';}
\ No newline at end of file
diff --git a/lib/yui/reset/reset.css b/lib/yui/reset/reset.css
new file mode 100755 (executable)
index 0000000..b1e706e
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.\r
+Code licensed under the BSD License:\r
+http://developer.yahoo.net/yui/license.txt\r
+version: 0.11.0\r
+*/\r
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}\r
+table{border-collapse:collapse;border-spacing:0;}\r
+fieldset,img{border:0;}\r
+address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}\r
+ol,ul {list-style:none;}\r
+caption,th {text-align:left;}\r
+h1,h2,h3,h4,h5,h6{font-size:100%;}\r
+q:before,q:after{content:'';}
\ No newline at end of file
diff --git a/lib/yui/slider/README b/lib/yui/slider/README
new file mode 100755 (executable)
index 0000000..bde704e
--- /dev/null
@@ -0,0 +1,29 @@
+Slider - Release Notes\r
+\r
+0.11.0\r
+\r
+   * When the thumb is clicked and dragged, the click position delta is properly\r
+     applied.\r
+\r
+   * The slider background can be disabled by setting backgroundEnabled to false.\r
+\r
+   * Added SliderThumb->clearTicks\r
+\r
+   * Incorporated updated drag and drop performance improvements\r
+\r
+0.10.0\r
+\r
+   * Drag and drop's autoscroll feature is now turned off by default\r
+     in the slider.\r
+\r
+   * The slider no longer sets its initial value upon initialization\r
+\r
+   * RGB slider example fixed for IE7.\r
+\r
+   * Updated to work with the onAvailable feature in Drag and Drop.\r
+\r
+   * Updated the basic slider example page to make the control more\r
+     accessible to non-FF1.5 browsers.\r
+\r
+   * Split the examples into separate pages\r
+\r
diff --git a/lib/yui/slider/slider-debug.js b/lib/yui/slider/slider-debug.js
new file mode 100755 (executable)
index 0000000..dacc380
--- /dev/null
@@ -0,0 +1,945 @@
+\r
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * A DragDrop implementation that can be used as a background for a\r
+ * slider.  It takes a reference to the thumb instance \r
+ * so it can delegate some of the events to it.  The goal is to make the \r
+ * thumb jump to the location on the background when the background is \r
+ * clicked.  \r
+ *\r
+ * @extends YAHOO.util.DragDrop\r
+ * @constructor\r
+ * @param {String} id     The id of the element linked to this instance\r
+ * @param {String} sGroup The group of related DragDrop items\r
+ * @param {String} sType  The type of slider (horiz, vert, region)\r
+ */\r
+YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {\r
+       if (sElementId) {\r
+\r
+        /**\r
+         * The type of the slider (horiz, vert, region)\r
+         * @type string\r
+         */\r
+        this.type = sType;\r
+\r
+               this.init(sElementId, sGroup, true);\r
+\r
+        this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+               var self = this;\r
+\r
+               /**\r
+                * a YAHOO.widget.SliderThumb instance that we will use to \r
+                * reposition the thumb when the background is clicked\r
+                *\r
+                * @type Slider \r
+                */\r
+               this.thumb = oThumb;\r
+\r
+               // add handler for the handle onchange event\r
+               oThumb.onChange = function() { \r
+                       self.onThumbChange(); \r
+               };\r
+\r
+\r
+               /**\r
+                * Overrides the isTarget property in YAHOO.util.DragDrop\r
+                * @private\r
+                */\r
+               this.isTarget = false;\r
+       \r
+               /**\r
+                * Flag that determines if the thumb will animate when moved\r
+                * @type boolean\r
+                */\r
+               this.animate = YAHOO.widget.Slider.ANIM_AVAIL;\r
+\r
+        /**\r
+         * Set to false to disable a background click thumb move\r
+         */\r
+        this.backgroundEnabled = true;\r
+\r
+               /**\r
+                * Adjustment factor for tick animation, the more ticks, the\r
+                * faster the animation (by default)\r
+                *\r
+                * @type int\r
+                */\r
+               this.tickPause = 40;\r
+               if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {\r
+                       this.tickPause = Math.round(360 / oThumb.xTicks.length);\r
+               } else if (oThumb.yTicks && oThumb.yTicks.length) {\r
+                       this.tickPause = Math.round(360 / oThumb.yTicks.length);\r
+               }\r
+\r
+        this.logger.log("tickPause: " + this.tickPause);\r
+\r
+               // delegate thumb methods\r
+               oThumb.onMouseDown = function () { return self.focus(); };\r
+               //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };\r
+               // oThumb.lock = function() { self.lock(); };\r
+               // oThumb.unlock = function() { self.unlock(); };\r
+               oThumb.onMouseUp = function() { self.thumbMouseUp(); };\r
+               oThumb.onDrag = function() { self.fireEvents(); };\r
+               oThumb.onAvailable = function() { return self.setStartSliderState(); };\r
+       }\r
+};\r
+\r
+//YAHOO.widget.Slider.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop);\r
+\r
+// YAHOO.widget.Slider.prototype.onAvailable = function() {\r
+    // this.logger.log("bg avail");\r
+// };\r
+\r
+/**\r
+ * Factory method for creating a horizontal slider\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a horizontal slider control\r
+ */\r
+YAHOO.widget.Slider.getHorizSlider = \r
+       function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, \r
+                                                          iLeft, iRight, 0, 0, iTickSize), "horiz");\r
+};\r
+\r
+/**\r
+ * Factory method for creating a vertical slider\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a vertical slider control\r
+ */\r
+YAHOO.widget.Slider.getVertSlider = \r
+       function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, \r
+                                                          iUp, iDown, iTickSize), "vert");\r
+};\r
+\r
+/**\r
+ * Factory method for creating a slider region like the one in the color\r
+ * picker example\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a slider region control\r
+ */\r
+YAHOO.widget.Slider.getSliderRegion = \r
+       function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, \r
+                                                          iUp, iDown, iTickSize), "region");\r
+};\r
+\r
+/**\r
+ * By default, animation is available if the animation library is detected.\r
+ * @type boolean\r
+ */\r
+YAHOO.widget.Slider.ANIM_AVAIL = true;\r
+\r
+YAHOO.widget.Slider.prototype.setStartSliderState = function() {\r
+\r
+    this.logger.log("Fixing state");\r
+\r
+    this.setThumbCenterPoint();\r
+\r
+    /**\r
+     * The basline position of the background element, used\r
+     * to determine if the background has moved since the last\r
+     * operation.\r
+     * @type int[]\r
+     */\r
+    this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());\r
+\r
+    this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);\r
+\r
+    if (this.thumb._isRegion) {\r
+        if (this.deferredSetRegionValue) {\r
+            this.setRegionValue.apply(this, this.deferredSetRegionValue, true);\r
+        } else {\r
+            this.setRegionValue(0, 0, true);\r
+        }\r
+    } else {\r
+        if (this.deferredSetValue) {\r
+            this.setValue.apply(this, this.deferredSetValue, true);\r
+        } else {\r
+            this.setValue(0, true, true);\r
+        }\r
+    }\r
+};\r
+\r
+YAHOO.widget.Slider.prototype.setThumbCenterPoint = function() {\r
+\r
+    var el = this.thumb.getEl();\r
+\r
+    if (el) {\r
+        /**\r
+         * the center of the slider element is stored so we can position \r
+         * place it in the correct position when the background is clicked\r
+         *\r
+         * @type Coordinate\r
+         */\r
+        this.thumbCenterPoint = { \r
+                x: parseInt(el.offsetWidth/2, 10), \r
+                y: parseInt(el.offsetHeight/2, 10) \r
+        };\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * Lock the slider, overrides YAHOO.util.DragDrop\r
+ */\r
+YAHOO.widget.Slider.prototype.lock = function() {\r
+       this.logger.log("locking");\r
+       this.thumb.lock();\r
+       this.locked = true;\r
+};\r
+\r
+/**\r
+ * Unlock the slider, overrides YAHOO.util.DragDrop\r
+ */\r
+YAHOO.widget.Slider.prototype.unlock = function() {\r
+       this.logger.log("unlocking");\r
+       this.thumb.unlock();\r
+       this.locked = false;\r
+};\r
+\r
+/**\r
+ * handles mouseup event on the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.thumbMouseUp = function() {\r
+       this.logger.log("bg mouseup");\r
+    if (!this.isLocked() && !this.moveComplete) {\r
+           this.endMove();\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * Returns a reference to this slider's thumb\r
+ */\r
+YAHOO.widget.Slider.prototype.getThumb = function() {\r
+    return this.thumb;\r
+};\r
+\r
+/**\r
+ * Try to focus the element when clicked so we can add\r
+ * accessibility features\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.focus = function() {\r
+    this.logger.log("focus");\r
+\r
+    // Focus the background element if possible\r
+    var el = this.getEl();\r
+\r
+    if (el.focus) {\r
+        el.focus();\r
+    }\r
+\r
+    this.verifyOffset();\r
+\r
+    if (this.isLocked()) {\r
+        return false;\r
+    } else {\r
+        this.onSlideStart();\r
+           return true;\r
+    }\r
+};\r
+\r
+/**\r
+ * Event that fires when the value of the slider has changed\r
+ *\r
+ * @param {int} offsetFromStart the number of pixels the thumb has moved\r
+ * from its start position. Normal horizontal and vertical sliders will only\r
+ * have the firstOffset.  Regions will have both, the first is the horizontal\r
+ * offset, the second the vertical.\r
+ */\r
+YAHOO.widget.Slider.prototype.onChange = function (firstOffset, secondOffset) { \r
+       /* override me */ \r
+       this.logger.log("onChange: " + firstOffset + ", " + secondOffset);\r
+};\r
+\r
+/**\r
+ * Event that fires when the at the beginning of the slider thumb move\r
+ */\r
+YAHOO.widget.Slider.prototype.onSlideStart = function () { \r
+       /* override me */ \r
+       this.logger.log("onSlideStart");\r
+};\r
+\r
+/**\r
+ * Event that fires at the end of a slider thumb move\r
+ */\r
+YAHOO.widget.Slider.prototype.onSlideEnd = function () { \r
+       /* override me */ \r
+       this.logger.log("onSlideEnd");\r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb offset from the start position\r
+ *\r
+ * @return {int} the current value\r
+ */\r
+YAHOO.widget.Slider.prototype.getValue = function () { \r
+       return this.thumb.getValue();\r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb X offset from the start position\r
+ *\r
+ * @return {int} the current horizontal offset\r
+ */\r
+YAHOO.widget.Slider.prototype.getXValue = function () { \r
+       return this.thumb.getXValue();\r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb Y offset from the start position\r
+ *\r
+ * @return {int} the current vertical offset\r
+ */\r
+YAHOO.widget.Slider.prototype.getYValue = function () { \r
+       return this.thumb.getYValue();\r
+};\r
+\r
+/**\r
+ * Internal handler for the slider thumb's onChange event\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onThumbChange = function () { \r
+       var t = this.thumb;\r
+       if (t._isRegion) {\r
+               t.onChange(t.getXValue(), t.getYValue());\r
+       } else {\r
+               t.onChange(t.getValue());\r
+       }\r
+\r
+};\r
+\r
+/**\r
+ * Provides a way to set the value of the slider in code.\r
+ *\r
+ * @param {int} newOffset the number of pixels the thumb should be\r
+ * positioned away from the initial start point \r
+ * @param {boolean} skipAnim set to true to disable the animation\r
+ * for this move action (but not others).\r
+ * @param {boolean} force ignore the locked setting and set value anyway\r
+ * @return {boolean} true if the move was performed, false if it failed\r
+ */\r
+YAHOO.widget.Slider.prototype.setValue = function(newOffset, skipAnim, force) {\r
+    this.logger.log("setValue " + newOffset);\r
+\r
+    if (!this.thumb.available) {\r
+        this.logger.log("defer setValue until after onAvailble");\r
+        this.deferredSetValue = arguments;\r
+        return false;\r
+    }\r
+\r
+    if (this.isLocked() && !force) {\r
+        this.logger.log("Can't set the value, the control is locked");\r
+        return false;\r
+    }\r
+\r
+       if ( isNaN(newOffset) ) {\r
+               this.logger.log("setValue, Illegal argument: " + newOffset);\r
+               return false;\r
+       }\r
+\r
+       var t = this.thumb;\r
+       var newX, newY;\r
+    this.verifyOffset();\r
+       if (t._isRegion) {\r
+        return false;\r
+       } else if (t._isHoriz) {\r
+        this.onSlideStart();\r
+               newX = t.initPageX + newOffset + this.thumbCenterPoint.x;\r
+               this.moveThumb(newX, t.initPageY, skipAnim);\r
+       } else {\r
+        this.onSlideStart();\r
+               newY = t.initPageY + newOffset + this.thumbCenterPoint.y;\r
+               this.moveThumb(t.initPageX, newY, skipAnim);\r
+       }\r
+\r
+       return true;\r
+};\r
+\r
+/**\r
+ * Provides a way to set the value of the region slider in code.\r
+ *\r
+ * @param {int} newOffset the number of pixels the thumb should be\r
+ * positioned away from the initial start point \r
+ * @param {int} newOffset2 the number of pixels the thumb should be\r
+ * positioned away from the initial start point (y axis for region)\r
+ * @param {boolean} skipAnim set to true to disable the animation\r
+ * for this move action (but not others).\r
+ * @param {boolean} force ignore the locked setting and set value anyway\r
+ * @return {boolean} true if the move was performed, false if it failed\r
+ */\r
+YAHOO.widget.Slider.prototype.setRegionValue = function(newOffset, newOffset2, skipAnim) {\r
+\r
+    if (!this.thumb.available) {\r
+        this.logger.log("defer setRegionValue until after onAvailble");\r
+        this.deferredSetRegionValue = arguments;\r
+        return false;\r
+    }\r
+\r
+    if (this.isLocked() && !force) {\r
+        this.logger.log("Can't set the value, the control is locked");\r
+        return false;\r
+    }\r
+\r
+       if ( isNaN(newOffset) ) {\r
+               this.logger.log("setRegionValue, Illegal argument: " + newOffset);\r
+               return false;\r
+       }\r
+\r
+       var t = this.thumb;\r
+       if (t._isRegion) {\r
+        this.onSlideStart();\r
+               var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;\r
+               var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;\r
+               this.moveThumb(newX, newY, skipAnim);\r
+           return true;\r
+       }\r
+\r
+    return false;\r
+\r
+};\r
+\r
+/**\r
+ * Checks the background position element position.  If it has moved from the\r
+ * baseline position, the constraints for the thumb are reset\r
+ * @return {boolean} True if the offset is the same as the baseline.\r
+ */\r
+YAHOO.widget.Slider.prototype.verifyOffset = function() {\r
+\r
+    var newPos = YAHOO.util.Dom.getXY(this.getEl());\r
+    this.logger.log("newPos: " + newPos);\r
+\r
+    if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {\r
+        this.logger.log("background moved, resetting constraints");\r
+        this.thumb.resetConstraints();\r
+        this.baselinePos = newPos;\r
+        return false;\r
+    }\r
+\r
+    return true;\r
+};\r
+\r
+/**\r
+ * Move the associated slider moved to a timeout to try to get around the \r
+ * mousedown stealing moz does when I move the slider element between the \r
+ * cursor and the background during the mouseup event\r
+ *\r
+ * @param {int} x the X coordinate of the click\r
+ * @param {int} y the Y coordinate of the click\r
+ * @param {boolean} skipAnim don't animate if the move happend onDrag\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.moveThumb = function(x, y, skipAnim) {\r
+\r
+        this.logger.log("move thumb", "warn");\r
+\r
+       var t = this.thumb;\r
+       var self = this;\r
+\r
+    if (!t.available) {\r
+        this.logger.log("thumb is not available yet, aborting move");\r
+        return;\r
+    }\r
+\r
+       this.logger.log("move thumb, x: "  + x + ", y: " + y);\r
+\r
+    // this.verifyOffset();\r
+\r
+       t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);\r
+\r
+       var _p = t.getTargetCoord(x, y);\r
+    var p = [_p.x, _p.y];\r
+\r
+\r
+       if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {\r
+               this.logger.log("graduated");\r
+               // this.thumb._animating = true;\r
+               this.lock();\r
+               \r
+               setTimeout( function() { self.moveOneTick(p); }, this.tickPause );\r
+\r
+       } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {\r
+               this.logger.log("animating to " + p);\r
+\r
+               // this.thumb._animating = true;\r
+               this.lock();\r
+\r
+               var oAnim = new YAHOO.util.Motion( \r
+                t.id, { points: { to: p } }, 0.4, YAHOO.util.Easing.easeOut );\r
+\r
+               oAnim.onComplete.subscribe( function() { self.endMove(); } );\r
+               oAnim.animate();\r
+       } else {\r
+               t.setDragElPos(x, y);\r
+               // this.fireEvents();\r
+               this.endMove();\r
+       }\r
+};\r
+\r
+/**\r
+ * Move the slider one tick mark towards its final coordinate.  Used\r
+ * for the animation when tick marks are defined\r
+ *\r
+ * @param {int[]} the destination coordinate\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.moveOneTick = function(finalCoord) {\r
+\r
+       var t = this.thumb;\r
+       var curCoord = YAHOO.util.Dom.getXY(t.getEl());\r
+       var tmp;\r
+\r
+    // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);\r
+    // var thresh = 10;\r
+    // var thresh = t.tickSize + (Math.floor(t.tickSize/2));\r
+\r
+       var nextCoord = null;\r
+\r
+       if (t._isRegion) {\r
+        nextCoord = this._getNextX(curCoord, finalCoord);\r
+               var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];\r
+        nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);\r
+\r
+       } else if (t._isHoriz) {\r
+        nextCoord = this._getNextX(curCoord, finalCoord);\r
+       } else {\r
+        nextCoord = this._getNextY(curCoord, finalCoord);\r
+       }\r
+\r
+       this.logger.log("moveOneTick: " + \r
+                       " finalCoord: " + finalCoord +\r
+                       " curCoord: " + curCoord +\r
+                       " nextCoord: " + nextCoord);\r
+\r
+       if (nextCoord) {\r
+\r
+               // move to the next coord\r
+               // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);\r
+\r
+        // var el = t.getEl();\r
+        // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");\r
+        // YAHOO.util.Dom.setStyle(el, "top",  (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");\r
+\r
+        this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);\r
+               \r
+               // check if we are in the final position, if not make a recursive call\r
+               if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {\r
+                       var self = this;\r
+                       setTimeout(function() { self.moveOneTick(finalCoord); }, \r
+                                       this.tickPause);\r
+               } else {\r
+            this.endMove();\r
+               }\r
+       } else {\r
+        this.endMove();\r
+       }\r
+\r
+       //this.tickPause = Math.round(this.tickPause/2);\r
+};\r
+\r
+/**\r
+ * Returns the next X tick value based on the current coord and the target coord.\r
+ * @private/\r
+ */\r
+YAHOO.widget.Slider.prototype._getNextX = function(curCoord, finalCoord) {\r
+    this.logger.log("getNextX: " + curCoord + ", " + finalCoord);\r
+    var t = this.thumb;\r
+    var thresh;\r
+    var tmp = [];\r
+    var nextCoord = null;\r
+    if (curCoord[0] > finalCoord[0]) {\r
+        thresh = t.tickSize - this.thumbCenterPoint.x;\r
+        tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else if (curCoord[0] < finalCoord[0]) {\r
+        thresh = t.tickSize + this.thumbCenterPoint.x;\r
+        tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else {\r
+        // equal, do nothing\r
+    }\r
+\r
+    return nextCoord;\r
+};\r
+\r
+/**\r
+ * Returns the next Y tick value based on the current coord and the target coord.\r
+ * @private/\r
+ */\r
+YAHOO.widget.Slider.prototype._getNextY = function(curCoord, finalCoord) {\r
+    var t = this.thumb;\r
+    // var thresh = t.tickSize;\r
+    // var thresh = t.tickSize + this.thumbCenterPoint.y;\r
+    var thresh;\r
+    var tmp = [];\r
+    var nextCoord = null;\r
+\r
+    if (curCoord[1] > finalCoord[1]) {\r
+        thresh = t.tickSize - this.thumbCenterPoint.y;\r
+        tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else if (curCoord[1] < finalCoord[1]) {\r
+        thresh = t.tickSize + this.thumbCenterPoint.y;\r
+        tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else {\r
+        // equal, do nothing\r
+    }\r
+\r
+    return nextCoord;\r
+};\r
+\r
+/**\r
+ * Resets the constraints before moving the thumb.\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.b4MouseDown = function(e) {\r
+    this.thumb.autoOffset();\r
+    this.thumb.resetConstraints();\r
+};\r
+\r
+\r
+/**\r
+ * Handles the mousedown event for the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onMouseDown = function(e) {\r
+    // this.resetConstraints(true);\r
+    // this.thumb.resetConstraints(true);\r
+\r
+       if (! this.isLocked() && this.backgroundEnabled) {\r
+               var x = YAHOO.util.Event.getPageX(e);\r
+               var y = YAHOO.util.Event.getPageY(e);\r
+               this.logger.log("bg mousedown: " + x + "," + y);\r
+\r
+               this.focus();\r
+               this.moveThumb(x, y);\r
+       }\r
+       \r
+};\r
+\r
+/**\r
+ * Handles the onDrag event for the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onDrag = function(e) {\r
+       if (! this.isLocked()) {\r
+               var x = YAHOO.util.Event.getPageX(e);\r
+               var y = YAHOO.util.Event.getPageY(e);\r
+               this.moveThumb(x, y, true);\r
+       }\r
+};\r
+\r
+/**\r
+ * Fired when the slider movement ends\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.endMove = function () {\r
+       // this._animating = false;\r
+       this.unlock();\r
+       this.moveComplete = true;\r
+       this.fireEvents();\r
+       \r
+};\r
+\r
+/**\r
+ * Fires the change event if the value has been changed.  Ignored if we are in\r
+ * the middle of an animation as the event will fire when the animation is\r
+ * complete\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.fireEvents = function () {\r
+\r
+       var t = this.thumb;\r
+       // this.logger.log("FireEvents: " + t._isRegion);\r
+\r
+       t.cachePosition();\r
+\r
+       if (! this.isLocked()) {\r
+               if (t._isRegion) {\r
+                       this.logger.log("region");\r
+                       var newX = t.getXValue();\r
+                       var newY = t.getYValue();\r
+\r
+                       if (newX != this.previousX || newY != this.previousY) {\r
+                               // this.logger.log("Firing onchange");\r
+                               this.onChange( newX, newY );\r
+                       }\r
+\r
+                       this.previousX = newX;\r
+                       this.previousY = newY;\r
+\r
+               } else {\r
+                       var newVal = t.getValue();\r
+                       if (newVal != this.previousVal) {\r
+                               this.logger.log("Firing onchange: " + newVal);\r
+                               this.onChange( newVal );\r
+                       }\r
+                       this.previousVal = newVal;\r
+               }\r
+\r
+               if (this.moveComplete) {\r
+                       this.onSlideEnd();\r
+                       this.moveComplete = false;\r
+               }\r
+\r
+       }\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return {string} string representation of the instance\r
+ */\r
+YAHOO.widget.Slider.prototype.toString = function () { \r
+    return ("Slider (" + this.type +") " + this.id);\r
+};\r
+\r
+/**\r
+ * A drag and drop implementation to be used as the thumb of a slider.\r
+ *\r
+ * @extends YAHOO.util.DD\r
+ * @constructor\r
+ * @param {String} id the id of the slider html element\r
+ * @param {String} sGroup the group of related DragDrop items\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ */\r
+YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {\r
+\r
+       if (id) {\r
+               this.init(id, sGroup);\r
+\r
+        /**\r
+         * The id of the thumbs parent HTML element (the slider background element).\r
+         * @type string\r
+         */\r
+        this.parentElId = sGroup;\r
+       }\r
+\r
+    this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+       /**\r
+        * Overrides the isTarget property in YAHOO.util.DragDrop\r
+        * @private\r
+        */\r
+       this.isTarget = false;\r
+\r
+    /**\r
+     * The tick size for this slider\r
+     * @type int\r
+     */\r
+       this.tickSize = iTickSize;\r
+\r
+    /**\r
+     * Informs the drag and drop util that the offsets should remain when\r
+     * resetting the constraints.  This preserves the slider value when\r
+     * the constraints are reset\r
+     * @type boolean\r
+     */\r
+    this.maintainOffset = true;\r
+\r
+       this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);\r
+\r
+    this.scroll = false;\r
+\r
+};\r
+\r
+// YAHOO.widget.SliderThumb.prototype = new YAHOO.util.DD();\r
+YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD);\r
+\r
+/**\r
+ * Returns the difference between the location of the thumb and its parent.\r
+ * @param {Array} Optionally accepts the position of the parent\r
+ * @type int[]\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getOffsetFromParent = function(parentPos) {\r
+    var myPos = YAHOO.util.Dom.getXY(this.getEl());\r
+    var ppos  = parentPos || YAHOO.util.Dom.getXY(this.parentElId);\r
+\r
+    return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];\r
+};\r
+\r
+/**\r
+ * The (X and Y) difference between the thumb location and its parent \r
+ * (the slider background) when the control is instantiated.  \r
+ * @type int[]\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.startOffset = null;\r
+\r
+/**\r
+ * Flag used to figure out if this is a horizontal or vertical slider\r
+ *\r
+ * @type boolean\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._isHoriz = false;\r
+\r
+/**\r
+ * Cache the last value so we can check for change\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._prevVal = 0;\r
+\r
+/**\r
+ * initial element X\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+// YAHOO.widget.SliderThumb.prototype._initX = 0;\r
+\r
+/**\r
+ * initial element Y\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+// YAHOO.widget.SliderThumb.prototype._initY = 0;\r
+\r
+/**\r
+ * The slider is _graduated if there is a tick interval defined\r
+ *\r
+ * @type boolean\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._graduated = false;\r
+\r
+/**\r
+ * Set up the slider, must be called in the constructor of all subclasses\r
+ *\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize the width of the tick interval.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.initSlider = function (iLeft, iRight, iUp, iDown, \r
+               iTickSize) {\r
+\r
+       this.setXConstraint(iLeft, iRight, iTickSize);\r
+       this.setYConstraint(iUp, iDown, iTickSize);\r
+\r
+       if (iTickSize && iTickSize > 1) {\r
+               this._graduated = true;\r
+       }\r
+\r
+       this._isHoriz = (iLeft > 0 || iRight > 0); \r
+       this._isVert   = (iUp > 0 ||  iDown > 0);\r
+       this._isRegion = (this._isHoriz && this._isVert); \r
+\r
+};\r
+\r
+/**\r
+ * Clear's the slider's ticks\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.clearTicks = function () {\r
+    YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);\r
+    this._graduated = false;\r
+};\r
+\r
+/**\r
+ * Gets the current offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var val = (this._isHoriz) ? this.getXValue() : this.getYValue();\r
+    this.logger.log("getVal: " + val);\r
+    return val;\r
+};\r
+\r
+/**\r
+ * Gets the current X offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved horizontally from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getXValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var newOffset = this.getOffsetFromParent();\r
+       return (newOffset[0] - this.startOffset[0]);\r
+};\r
+\r
+/**\r
+ * Gets the current Y offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved vertically from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getYValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var newOffset = this.getOffsetFromParent();\r
+       return (newOffset[1] - this.startOffset[1]);\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return {string} string representation of the instance\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.toString = function () { \r
+    return "SliderThumb " + this.id;\r
+};\r
+\r
+/**\r
+ * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider\r
+ * instance it belongs to.\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.onChange = function (x, y) { };\r
+\r
+if ("undefined" == typeof YAHOO.util.Anim) {\r
+       YAHOO.widget.Slider.ANIM_AVAIL = false;\r
+}\r
+\r
diff --git a/lib/yui/slider/slider-min.js b/lib/yui/slider/slider-min.js
new file mode 100755 (executable)
index 0000000..10a6c0b
--- /dev/null
@@ -0,0 +1 @@
+/*                                                                                                                                                      Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    Code licensed under the BSD License:                                                                                                                    http://developer.yahoo.net/yui/license.txt                                                                                                              version: 0.11.0                                                                                                                                         */ YAHOO.widget.Slider=function(_1,_2,_3,_4){if(_1){this.type=_4;this.init(_1,_2,true);var _5=this;this.thumb=_3;_3.onChange=function(){_5.onThumbChange();};this.isTarget=false;this.animate=YAHOO.widget.Slider.ANIM_AVAIL;this.backgroundEnabled=true;this.tickPause=40;if(_3._isHoriz&&_3.xTicks&&_3.xTicks.length){this.tickPause=Math.round(360/_3.xTicks.length);}else{if(_3.yTicks&&_3.yTicks.length){this.tickPause=Math.round(360/_3.yTicks.length);}}_3.onMouseDown=function(){return _5.focus();};_3.onMouseUp=function(){_5.thumbMouseUp();};_3.onDrag=function(){_5.fireEvents();};_3.onAvailable=function(){return _5.setStartSliderState();};}};YAHOO.extend(YAHOO.widget.Slider,YAHOO.util.DragDrop);YAHOO.widget.Slider.getHorizSlider=function(_6,_7,_8,_9,_10){return new YAHOO.widget.Slider(_6,_6,new YAHOO.widget.SliderThumb(_7,_6,_8,_9,0,0,_10),"horiz");};YAHOO.widget.Slider.getVertSlider=function(_11,_12,iUp,_14,_15){return new YAHOO.widget.Slider(_11,_11,new YAHOO.widget.SliderThumb(_12,_11,0,0,iUp,_14,_15),"vert");};YAHOO.widget.Slider.getSliderRegion=function(_16,_17,_18,_19,iUp,_20,_21){return new YAHOO.widget.Slider(_16,_16,new YAHOO.widget.SliderThumb(_17,_16,_18,_19,iUp,_20,_21),"region");};YAHOO.widget.Slider.ANIM_AVAIL=true;YAHOO.widget.Slider.prototype.setStartSliderState=function(){this.setThumbCenterPoint();this.baselinePos=YAHOO.util.Dom.getXY(this.getEl());this.thumb.startOffset=this.thumb.getOffsetFromParent(this.baselinePos);if(this.thumb._isRegion){if(this.deferredSetRegionValue){this.setRegionValue.apply(this,this.deferredSetRegionValue,true);}else{this.setRegionValue(0,0,true);}}else{if(this.deferredSetValue){this.setValue.apply(this,this.deferredSetValue,true);}else{this.setValue(0,true,true);}}};YAHOO.widget.Slider.prototype.setThumbCenterPoint=function(){var el=this.thumb.getEl();if(el){this.thumbCenterPoint={x:parseInt(el.offsetWidth/2,10),y:parseInt(el.offsetHeight/2,10)};}};YAHOO.widget.Slider.prototype.lock=function(){this.thumb.lock();this.locked=true;};YAHOO.widget.Slider.prototype.unlock=function(){this.thumb.unlock();this.locked=false;};YAHOO.widget.Slider.prototype.thumbMouseUp=function(){if(!this.isLocked()&&!this.moveComplete){this.endMove();}};YAHOO.widget.Slider.prototype.getThumb=function(){return this.thumb;};YAHOO.widget.Slider.prototype.focus=function(){var el=this.getEl();if(el.focus){el.focus();}this.verifyOffset();if(this.isLocked()){return false;}else{this.onSlideStart();return true;}};YAHOO.widget.Slider.prototype.onChange=function(_23,_24){};YAHOO.widget.Slider.prototype.onSlideStart=function(){};YAHOO.widget.Slider.prototype.onSlideEnd=function(){};YAHOO.widget.Slider.prototype.getValue=function(){return this.thumb.getValue();};YAHOO.widget.Slider.prototype.getXValue=function(){return this.thumb.getXValue();};YAHOO.widget.Slider.prototype.getYValue=function(){return this.thumb.getYValue();};YAHOO.widget.Slider.prototype.onThumbChange=function(){var t=this.thumb;if(t._isRegion){t.onChange(t.getXValue(),t.getYValue());}else{t.onChange(t.getValue());}};YAHOO.widget.Slider.prototype.setValue=function(_26,_27,_28){if(!this.thumb.available){this.deferredSetValue=arguments;return false;}if(this.isLocked()&&!_28){return false;}if(isNaN(_26)){return false;}var t=this.thumb;var _29,newY;this.verifyOffset();if(t._isRegion){return false;}else{if(t._isHoriz){this.onSlideStart();_29=t.initPageX+_26+this.thumbCenterPoint.x;this.moveThumb(_29,t.initPageY,_27);}else{this.onSlideStart();newY=t.initPageY+_26+this.thumbCenterPoint.y;this.moveThumb(t.initPageX,newY,_27);}}return true;};YAHOO.widget.Slider.prototype.setRegionValue=function(_30,_31,_32){if(!this.thumb.available){this.deferredSetRegionValue=arguments;return false;}if(this.isLocked()&&!force){return false;}if(isNaN(_30)){return false;}var t=this.thumb;if(t._isRegion){this.onSlideStart();var _33=t.initPageX+_30+this.thumbCenterPoint.x;var _34=t.initPageY+_31+this.thumbCenterPoint.y;this.moveThumb(_33,_34,_32);return true;}return false;};YAHOO.widget.Slider.prototype.verifyOffset=function(){var _35=YAHOO.util.Dom.getXY(this.getEl());if(_35[0]!=this.baselinePos[0]||_35[1]!=this.baselinePos[1]){this.thumb.resetConstraints();this.baselinePos=_35;return false;}return true;};YAHOO.widget.Slider.prototype.moveThumb=function(x,y,_38){var t=this.thumb;var _39=this;if(!t.available){return;}t.setDelta(this.thumbCenterPoint.x,this.thumbCenterPoint.y);var _p=t.getTargetCoord(x,y);var p=[_p.x,_p.y];if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&t._graduated&&!_38){this.lock();setTimeout(function(){_39.moveOneTick(p);},this.tickPause);}else{if(this.animate&&YAHOO.widget.Slider.ANIM_AVAIL&&!_38){this.lock();var _42=new YAHOO.util.Motion(t.id,{points:{to:p}},0.4,YAHOO.util.Easing.easeOut);_42.onComplete.subscribe(function(){_39.endMove();});_42.animate();}else{t.setDragElPos(x,y);this.endMove();}}};YAHOO.widget.Slider.prototype.moveOneTick=function(_43){var t=this.thumb;var _44=YAHOO.util.Dom.getXY(t.getEl());var tmp;var _46=null;if(t._isRegion){_46=this._getNextX(_44,_43);var _47=(_46)?_46[0]:_44[0];_46=this._getNextY([_47,_44[1]],_43);}else{if(t._isHoriz){_46=this._getNextX(_44,_43);}else{_46=this._getNextY(_44,_43);}}if(_46){this.thumb.alignElWithMouse(t.getEl(),_46[0],_46[1]);if(!(_46[0]==_43[0]&&_46[1]==_43[1])){var _48=this;setTimeout(function(){_48.moveOneTick(_43);},this.tickPause);}else{this.endMove();}}else{this.endMove();}};YAHOO.widget.Slider.prototype._getNextX=function(_49,_50){var t=this.thumb;var _51;var tmp=[];var _52=null;if(_49[0]>_50[0]){_51=t.tickSize-this.thumbCenterPoint.x;tmp=t.getTargetCoord(_49[0]-_51,_49[1]);_52=[tmp.x,tmp.y];}else{if(_49[0]<_50[0]){_51=t.tickSize+this.thumbCenterPoint.x;tmp=t.getTargetCoord(_49[0]+_51,_49[1]);_52=[tmp.x,tmp.y];}else{}}return _52;};YAHOO.widget.Slider.prototype._getNextY=function(_53,_54){var t=this.thumb;var _55;var tmp=[];var _56=null;if(_53[1]>_54[1]){_55=t.tickSize-this.thumbCenterPoint.y;tmp=t.getTargetCoord(_53[0],_53[1]-_55);_56=[tmp.x,tmp.y];}else{if(_53[1]<_54[1]){_55=t.tickSize+this.thumbCenterPoint.y;tmp=t.getTargetCoord(_53[0],_53[1]+_55);_56=[tmp.x,tmp.y];}else{}}return _56;};YAHOO.widget.Slider.prototype.b4MouseDown=function(e){this.thumb.autoOffset();this.thumb.resetConstraints();};YAHOO.widget.Slider.prototype.onMouseDown=function(e){if(!this.isLocked()&&this.backgroundEnabled){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.focus();this.moveThumb(x,y);}};YAHOO.widget.Slider.prototype.onDrag=function(e){if(!this.isLocked()){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.moveThumb(x,y,true);}};YAHOO.widget.Slider.prototype.endMove=function(){this.unlock();this.moveComplete=true;this.fireEvents();};YAHOO.widget.Slider.prototype.fireEvents=function(){var t=this.thumb;t.cachePosition();if(!this.isLocked()){if(t._isRegion){var _58=t.getXValue();var _59=t.getYValue();if(_58!=this.previousX||_59!=this.previousY){this.onChange(_58,_59);}this.previousX=_58;this.previousY=_59;}else{var _60=t.getValue();if(_60!=this.previousVal){this.onChange(_60);}this.previousVal=_60;}if(this.moveComplete){this.onSlideEnd();this.moveComplete=false;}}};YAHOO.widget.Slider.prototype.toString=function(){return ("Slider ("+this.type+") "+this.id);};YAHOO.widget.SliderThumb=function(id,_62,_63,_64,iUp,_65,_66){if(id){this.init(id,_62);this.parentElId=_62;}this.isTarget=false;this.tickSize=_66;this.maintainOffset=true;this.initSlider(_63,_64,iUp,_65,_66);this.scroll=false;};YAHOO.extend(YAHOO.widget.SliderThumb,YAHOO.util.DD);YAHOO.widget.SliderThumb.prototype.getOffsetFromParent=function(_67){var _68=YAHOO.util.Dom.getXY(this.getEl());var _69=_67||YAHOO.util.Dom.getXY(this.parentElId);return [(_68[0]-_69[0]),(_68[1]-_69[1])];};YAHOO.widget.SliderThumb.prototype.startOffset=null;YAHOO.widget.SliderThumb.prototype._isHoriz=false;YAHOO.widget.SliderThumb.prototype._prevVal=0;YAHOO.widget.SliderThumb.prototype._graduated=false;YAHOO.widget.SliderThumb.prototype.initSlider=function(_70,_71,iUp,_72,_73){this.setXConstraint(_70,_71,_73);this.setYConstraint(iUp,_72,_73);if(_73&&_73>1){this._graduated=true;}this._isHoriz=(_70>0||_71>0);this._isVert=(iUp>0||_72>0);this._isRegion=(this._isHoriz&&this._isVert);};YAHOO.widget.SliderThumb.prototype.clearTicks=function(){YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);this._graduated=false;};YAHOO.widget.SliderThumb.prototype.getValue=function(){if(!this.available){return 0;}var val=(this._isHoriz)?this.getXValue():this.getYValue();return val;};YAHOO.widget.SliderThumb.prototype.getXValue=function(){if(!this.available){return 0;}var _75=this.getOffsetFromParent();return (_75[0]-this.startOffset[0]);};YAHOO.widget.SliderThumb.prototype.getYValue=function(){if(!this.available){return 0;}var _76=this.getOffsetFromParent();return (_76[1]-this.startOffset[1]);};YAHOO.widget.SliderThumb.prototype.toString=function(){return "SliderThumb "+this.id;};YAHOO.widget.SliderThumb.prototype.onChange=function(x,y){};if("undefined"==typeof YAHOO.util.Anim){YAHOO.widget.Slider.ANIM_AVAIL=false;}
\ No newline at end of file
diff --git a/lib/yui/slider/slider.js b/lib/yui/slider/slider.js
new file mode 100755 (executable)
index 0000000..14fa5f5
--- /dev/null
@@ -0,0 +1,904 @@
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * A DragDrop implementation that can be used as a background for a\r
+ * slider.  It takes a reference to the thumb instance \r
+ * so it can delegate some of the events to it.  The goal is to make the \r
+ * thumb jump to the location on the background when the background is \r
+ * clicked.  \r
+ *\r
+ * @extends YAHOO.util.DragDrop\r
+ * @constructor\r
+ * @param {String} id     The id of the element linked to this instance\r
+ * @param {String} sGroup The group of related DragDrop items\r
+ * @param {String} sType  The type of slider (horiz, vert, region)\r
+ */\r
+YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {\r
+       if (sElementId) {\r
+\r
+        /**\r
+         * The type of the slider (horiz, vert, region)\r
+         * @type string\r
+         */\r
+        this.type = sType;\r
+\r
+               this.init(sElementId, sGroup, true);\r
+\r
+\r
+               var self = this;\r
+\r
+               /**\r
+                * a YAHOO.widget.SliderThumb instance that we will use to \r
+                * reposition the thumb when the background is clicked\r
+                *\r
+                * @type Slider \r
+                */\r
+               this.thumb = oThumb;\r
+\r
+               // add handler for the handle onchange event\r
+               oThumb.onChange = function() { \r
+                       self.onThumbChange(); \r
+               };\r
+\r
+               /**\r
+                * Overrides the isTarget property in YAHOO.util.DragDrop\r
+                * @private\r
+                */\r
+               this.isTarget = false;\r
+       \r
+               /**\r
+                * Flag that determines if the thumb will animate when moved\r
+                * @type boolean\r
+                */\r
+               this.animate = YAHOO.widget.Slider.ANIM_AVAIL;\r
+\r
+        /**\r
+         * Set to false to disable a background click thumb move\r
+         */\r
+        this.backgroundEnabled = true;\r
+\r
+               /**\r
+                * Adjustment factor for tick animation, the more ticks, the\r
+                * faster the animation (by default)\r
+                *\r
+                * @type int\r
+                */\r
+               this.tickPause = 40;\r
+               if (oThumb._isHoriz && oThumb.xTicks && oThumb.xTicks.length) {\r
+                       this.tickPause = Math.round(360 / oThumb.xTicks.length);\r
+               } else if (oThumb.yTicks && oThumb.yTicks.length) {\r
+                       this.tickPause = Math.round(360 / oThumb.yTicks.length);\r
+               }\r
+\r
+\r
+               // delegate thumb methods\r
+               oThumb.onMouseDown = function () { return self.focus(); };\r
+               //oThumb.b4MouseDown = function () { return self.b4MouseDown(); };\r
+               // oThumb.lock = function() { self.lock(); };\r
+               // oThumb.unlock = function() { self.unlock(); };\r
+               oThumb.onMouseUp = function() { self.thumbMouseUp(); };\r
+               oThumb.onDrag = function() { self.fireEvents(); };\r
+               oThumb.onAvailable = function() { return self.setStartSliderState(); };\r
+       }\r
+};\r
+\r
+//YAHOO.widget.Slider.prototype = new YAHOO.util.DragDrop();\r
+YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop);\r
+\r
+// YAHOO.widget.Slider.prototype.onAvailable = function() {\r
+// };\r
+\r
+/**\r
+ * Factory method for creating a horizontal slider\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a horizontal slider control\r
+ */\r
+YAHOO.widget.Slider.getHorizSlider = \r
+       function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, \r
+                                                          iLeft, iRight, 0, 0, iTickSize), "horiz");\r
+};\r
+\r
+/**\r
+ * Factory method for creating a vertical slider\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a vertical slider control\r
+ */\r
+YAHOO.widget.Slider.getVertSlider = \r
+       function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, \r
+                                                          iUp, iDown, iTickSize), "vert");\r
+};\r
+\r
+/**\r
+ * Factory method for creating a slider region like the one in the color\r
+ * picker example\r
+ *\r
+ * @param {String} sBGElId the id of the slider's background element\r
+ * @param {String} sHandleElId the id of the thumb element\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ * @return {Slider} a slider region control\r
+ */\r
+YAHOO.widget.Slider.getSliderRegion = \r
+       function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {\r
+               return new YAHOO.widget.Slider(sBGElId, sBGElId, \r
+                       new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, \r
+                                                          iUp, iDown, iTickSize), "region");\r
+};\r
+\r
+/**\r
+ * By default, animation is available if the animation library is detected.\r
+ * @type boolean\r
+ */\r
+YAHOO.widget.Slider.ANIM_AVAIL = true;\r
+\r
+YAHOO.widget.Slider.prototype.setStartSliderState = function() {\r
+\r
+\r
+    this.setThumbCenterPoint();\r
+\r
+    /**\r
+     * The basline position of the background element, used\r
+     * to determine if the background has moved since the last\r
+     * operation.\r
+     * @type int[]\r
+     */\r
+    this.baselinePos = YAHOO.util.Dom.getXY(this.getEl());\r
+\r
+    this.thumb.startOffset = this.thumb.getOffsetFromParent(this.baselinePos);\r
+\r
+    if (this.thumb._isRegion) {\r
+        if (this.deferredSetRegionValue) {\r
+            this.setRegionValue.apply(this, this.deferredSetRegionValue, true);\r
+        } else {\r
+            this.setRegionValue(0, 0, true);\r
+        }\r
+    } else {\r
+        if (this.deferredSetValue) {\r
+            this.setValue.apply(this, this.deferredSetValue, true);\r
+        } else {\r
+            this.setValue(0, true, true);\r
+        }\r
+    }\r
+};\r
+\r
+YAHOO.widget.Slider.prototype.setThumbCenterPoint = function() {\r
+\r
+    var el = this.thumb.getEl();\r
+\r
+    if (el) {\r
+        /**\r
+         * the center of the slider element is stored so we can position \r
+         * place it in the correct position when the background is clicked\r
+         *\r
+         * @type Coordinate\r
+         */\r
+        this.thumbCenterPoint = { \r
+                x: parseInt(el.offsetWidth/2, 10), \r
+                y: parseInt(el.offsetHeight/2, 10) \r
+        };\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * Lock the slider, overrides YAHOO.util.DragDrop\r
+ */\r
+YAHOO.widget.Slider.prototype.lock = function() {\r
+       this.thumb.lock();\r
+       this.locked = true;\r
+};\r
+\r
+/**\r
+ * Unlock the slider, overrides YAHOO.util.DragDrop\r
+ */\r
+YAHOO.widget.Slider.prototype.unlock = function() {\r
+       this.thumb.unlock();\r
+       this.locked = false;\r
+};\r
+\r
+/**\r
+ * handles mouseup event on the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.thumbMouseUp = function() {\r
+    if (!this.isLocked() && !this.moveComplete) {\r
+           this.endMove();\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * Returns a reference to this slider's thumb\r
+ */\r
+YAHOO.widget.Slider.prototype.getThumb = function() {\r
+    return this.thumb;\r
+};\r
+\r
+/**\r
+ * Try to focus the element when clicked so we can add\r
+ * accessibility features\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.focus = function() {\r
+\r
+    // Focus the background element if possible\r
+    var el = this.getEl();\r
+\r
+    if (el.focus) {\r
+        el.focus();\r
+    }\r
+\r
+    this.verifyOffset();\r
+\r
+    if (this.isLocked()) {\r
+        return false;\r
+    } else {\r
+        this.onSlideStart();\r
+           return true;\r
+    }\r
+};\r
+\r
+/**\r
+ * Event that fires when the value of the slider has changed\r
+ *\r
+ * @param {int} offsetFromStart the number of pixels the thumb has moved\r
+ * from its start position. Normal horizontal and vertical sliders will only\r
+ * have the firstOffset.  Regions will have both, the first is the horizontal\r
+ * offset, the second the vertical.\r
+ */\r
+YAHOO.widget.Slider.prototype.onChange = function (firstOffset, secondOffset) { \r
+       /* override me */ \r
+};\r
+\r
+/**\r
+ * Event that fires when the at the beginning of the slider thumb move\r
+ */\r
+YAHOO.widget.Slider.prototype.onSlideStart = function () { \r
+       /* override me */ \r
+};\r
+\r
+/**\r
+ * Event that fires at the end of a slider thumb move\r
+ */\r
+YAHOO.widget.Slider.prototype.onSlideEnd = function () { \r
+       /* override me */ \r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb offset from the start position\r
+ *\r
+ * @return {int} the current value\r
+ */\r
+YAHOO.widget.Slider.prototype.getValue = function () { \r
+       return this.thumb.getValue();\r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb X offset from the start position\r
+ *\r
+ * @return {int} the current horizontal offset\r
+ */\r
+YAHOO.widget.Slider.prototype.getXValue = function () { \r
+       return this.thumb.getXValue();\r
+};\r
+\r
+/**\r
+ * Returns the slider's thumb Y offset from the start position\r
+ *\r
+ * @return {int} the current vertical offset\r
+ */\r
+YAHOO.widget.Slider.prototype.getYValue = function () { \r
+       return this.thumb.getYValue();\r
+};\r
+\r
+/**\r
+ * Internal handler for the slider thumb's onChange event\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onThumbChange = function () { \r
+       var t = this.thumb;\r
+       if (t._isRegion) {\r
+               t.onChange(t.getXValue(), t.getYValue());\r
+       } else {\r
+               t.onChange(t.getValue());\r
+       }\r
+\r
+};\r
+\r
+/**\r
+ * Provides a way to set the value of the slider in code.\r
+ *\r
+ * @param {int} newOffset the number of pixels the thumb should be\r
+ * positioned away from the initial start point \r
+ * @param {boolean} skipAnim set to true to disable the animation\r
+ * for this move action (but not others).\r
+ * @param {boolean} force ignore the locked setting and set value anyway\r
+ * @return {boolean} true if the move was performed, false if it failed\r
+ */\r
+YAHOO.widget.Slider.prototype.setValue = function(newOffset, skipAnim, force) {\r
+\r
+    if (!this.thumb.available) {\r
+        this.deferredSetValue = arguments;\r
+        return false;\r
+    }\r
+\r
+    if (this.isLocked() && !force) {\r
+        return false;\r
+    }\r
+\r
+       if ( isNaN(newOffset) ) {\r
+               return false;\r
+       }\r
+\r
+       var t = this.thumb;\r
+       var newX, newY;\r
+    this.verifyOffset();\r
+       if (t._isRegion) {\r
+        return false;\r
+       } else if (t._isHoriz) {\r
+        this.onSlideStart();\r
+               newX = t.initPageX + newOffset + this.thumbCenterPoint.x;\r
+               this.moveThumb(newX, t.initPageY, skipAnim);\r
+       } else {\r
+        this.onSlideStart();\r
+               newY = t.initPageY + newOffset + this.thumbCenterPoint.y;\r
+               this.moveThumb(t.initPageX, newY, skipAnim);\r
+       }\r
+\r
+       return true;\r
+};\r
+\r
+/**\r
+ * Provides a way to set the value of the region slider in code.\r
+ *\r
+ * @param {int} newOffset the number of pixels the thumb should be\r
+ * positioned away from the initial start point \r
+ * @param {int} newOffset2 the number of pixels the thumb should be\r
+ * positioned away from the initial start point (y axis for region)\r
+ * @param {boolean} skipAnim set to true to disable the animation\r
+ * for this move action (but not others).\r
+ * @param {boolean} force ignore the locked setting and set value anyway\r
+ * @return {boolean} true if the move was performed, false if it failed\r
+ */\r
+YAHOO.widget.Slider.prototype.setRegionValue = function(newOffset, newOffset2, skipAnim) {\r
+\r
+    if (!this.thumb.available) {\r
+        this.deferredSetRegionValue = arguments;\r
+        return false;\r
+    }\r
+\r
+    if (this.isLocked() && !force) {\r
+        return false;\r
+    }\r
+\r
+       if ( isNaN(newOffset) ) {\r
+               return false;\r
+       }\r
+\r
+       var t = this.thumb;\r
+       if (t._isRegion) {\r
+        this.onSlideStart();\r
+               var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;\r
+               var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;\r
+               this.moveThumb(newX, newY, skipAnim);\r
+           return true;\r
+       }\r
+\r
+    return false;\r
+\r
+};\r
+\r
+/**\r
+ * Checks the background position element position.  If it has moved from the\r
+ * baseline position, the constraints for the thumb are reset\r
+ * @return {boolean} True if the offset is the same as the baseline.\r
+ */\r
+YAHOO.widget.Slider.prototype.verifyOffset = function() {\r
+\r
+    var newPos = YAHOO.util.Dom.getXY(this.getEl());\r
+\r
+    if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {\r
+        this.thumb.resetConstraints();\r
+        this.baselinePos = newPos;\r
+        return false;\r
+    }\r
+\r
+    return true;\r
+};\r
+\r
+/**\r
+ * Move the associated slider moved to a timeout to try to get around the \r
+ * mousedown stealing moz does when I move the slider element between the \r
+ * cursor and the background during the mouseup event\r
+ *\r
+ * @param {int} x the X coordinate of the click\r
+ * @param {int} y the Y coordinate of the click\r
+ * @param {boolean} skipAnim don't animate if the move happend onDrag\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.moveThumb = function(x, y, skipAnim) {\r
+\r
+\r
+       var t = this.thumb;\r
+       var self = this;\r
+\r
+    if (!t.available) {\r
+        return;\r
+    }\r
+\r
+\r
+    // this.verifyOffset();\r
+\r
+       t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);\r
+\r
+       var _p = t.getTargetCoord(x, y);\r
+    var p = [_p.x, _p.y];\r
+\r
+       if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {\r
+               // this.thumb._animating = true;\r
+               this.lock();\r
+               \r
+               setTimeout( function() { self.moveOneTick(p); }, this.tickPause );\r
+\r
+       } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {\r
+\r
+               // this.thumb._animating = true;\r
+               this.lock();\r
+\r
+               var oAnim = new YAHOO.util.Motion( \r
+                t.id, { points: { to: p } }, 0.4, YAHOO.util.Easing.easeOut );\r
+\r
+               oAnim.onComplete.subscribe( function() { self.endMove(); } );\r
+               oAnim.animate();\r
+       } else {\r
+               t.setDragElPos(x, y);\r
+               // this.fireEvents();\r
+               this.endMove();\r
+       }\r
+};\r
+\r
+/**\r
+ * Move the slider one tick mark towards its final coordinate.  Used\r
+ * for the animation when tick marks are defined\r
+ *\r
+ * @param {int[]} the destination coordinate\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.moveOneTick = function(finalCoord) {\r
+\r
+       var t = this.thumb;\r
+       var curCoord = YAHOO.util.Dom.getXY(t.getEl());\r
+       var tmp;\r
+\r
+    // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);\r
+    // var thresh = 10;\r
+    // var thresh = t.tickSize + (Math.floor(t.tickSize/2));\r
+\r
+       var nextCoord = null;\r
+\r
+       if (t._isRegion) {\r
+        nextCoord = this._getNextX(curCoord, finalCoord);\r
+               var tmpX = (nextCoord) ? nextCoord[0] : curCoord[0];\r
+        nextCoord = this._getNextY([tmpX, curCoord[1]], finalCoord);\r
+\r
+       } else if (t._isHoriz) {\r
+        nextCoord = this._getNextX(curCoord, finalCoord);\r
+       } else {\r
+        nextCoord = this._getNextY(curCoord, finalCoord);\r
+       }\r
+\r
+\r
+       if (nextCoord) {\r
+\r
+               // move to the next coord\r
+               // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);\r
+\r
+        // var el = t.getEl();\r
+        // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");\r
+        // YAHOO.util.Dom.setStyle(el, "top",  (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");\r
+\r
+        this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);\r
+               \r
+               // check if we are in the final position, if not make a recursive call\r
+               if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {\r
+                       var self = this;\r
+                       setTimeout(function() { self.moveOneTick(finalCoord); }, \r
+                                       this.tickPause);\r
+               } else {\r
+            this.endMove();\r
+               }\r
+       } else {\r
+        this.endMove();\r
+       }\r
+\r
+       //this.tickPause = Math.round(this.tickPause/2);\r
+};\r
+\r
+/**\r
+ * Returns the next X tick value based on the current coord and the target coord.\r
+ * @private/\r
+ */\r
+YAHOO.widget.Slider.prototype._getNextX = function(curCoord, finalCoord) {\r
+    var t = this.thumb;\r
+    var thresh;\r
+    var tmp = [];\r
+    var nextCoord = null;\r
+    if (curCoord[0] > finalCoord[0]) {\r
+        thresh = t.tickSize - this.thumbCenterPoint.x;\r
+        tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else if (curCoord[0] < finalCoord[0]) {\r
+        thresh = t.tickSize + this.thumbCenterPoint.x;\r
+        tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else {\r
+        // equal, do nothing\r
+    }\r
+\r
+    return nextCoord;\r
+};\r
+\r
+/**\r
+ * Returns the next Y tick value based on the current coord and the target coord.\r
+ * @private/\r
+ */\r
+YAHOO.widget.Slider.prototype._getNextY = function(curCoord, finalCoord) {\r
+    var t = this.thumb;\r
+    // var thresh = t.tickSize;\r
+    // var thresh = t.tickSize + this.thumbCenterPoint.y;\r
+    var thresh;\r
+    var tmp = [];\r
+    var nextCoord = null;\r
+\r
+    if (curCoord[1] > finalCoord[1]) {\r
+        thresh = t.tickSize - this.thumbCenterPoint.y;\r
+        tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else if (curCoord[1] < finalCoord[1]) {\r
+        thresh = t.tickSize + this.thumbCenterPoint.y;\r
+        tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );\r
+        nextCoord = [tmp.x, tmp.y];\r
+    } else {\r
+        // equal, do nothing\r
+    }\r
+\r
+    return nextCoord;\r
+};\r
+\r
+/**\r
+ * Resets the constraints before moving the thumb.\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.b4MouseDown = function(e) {\r
+    this.thumb.autoOffset();\r
+    this.thumb.resetConstraints();\r
+};\r
+\r
+/**\r
+ * Handles the mousedown event for the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onMouseDown = function(e) {\r
+    // this.resetConstraints(true);\r
+    // this.thumb.resetConstraints(true);\r
+\r
+       if (! this.isLocked() && this.backgroundEnabled) {\r
+               var x = YAHOO.util.Event.getPageX(e);\r
+               var y = YAHOO.util.Event.getPageY(e);\r
+\r
+               this.focus();\r
+               this.moveThumb(x, y);\r
+       }\r
+       \r
+};\r
+\r
+/**\r
+ * Handles the onDrag event for the slider background\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.onDrag = function(e) {\r
+       if (! this.isLocked()) {\r
+               var x = YAHOO.util.Event.getPageX(e);\r
+               var y = YAHOO.util.Event.getPageY(e);\r
+               this.moveThumb(x, y, true);\r
+       }\r
+};\r
+\r
+/**\r
+ * Fired when the slider movement ends\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.endMove = function () {\r
+       // this._animating = false;\r
+       this.unlock();\r
+       this.moveComplete = true;\r
+       this.fireEvents();\r
+       \r
+};\r
+\r
+/**\r
+ * Fires the change event if the value has been changed.  Ignored if we are in\r
+ * the middle of an animation as the event will fire when the animation is\r
+ * complete\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.Slider.prototype.fireEvents = function () {\r
+\r
+       var t = this.thumb;\r
+\r
+       t.cachePosition();\r
+\r
+       if (! this.isLocked()) {\r
+               if (t._isRegion) {\r
+                       var newX = t.getXValue();\r
+                       var newY = t.getYValue();\r
+\r
+                       if (newX != this.previousX || newY != this.previousY) {\r
+                               this.onChange( newX, newY );\r
+                       }\r
+\r
+                       this.previousX = newX;\r
+                       this.previousY = newY;\r
+\r
+               } else {\r
+                       var newVal = t.getValue();\r
+                       if (newVal != this.previousVal) {\r
+                               this.onChange( newVal );\r
+                       }\r
+                       this.previousVal = newVal;\r
+               }\r
+\r
+               if (this.moveComplete) {\r
+                       this.onSlideEnd();\r
+                       this.moveComplete = false;\r
+               }\r
+\r
+       }\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return {string} string representation of the instance\r
+ */\r
+YAHOO.widget.Slider.prototype.toString = function () { \r
+    return ("Slider (" + this.type +") " + this.id);\r
+};\r
+\r
+/**\r
+ * A drag and drop implementation to be used as the thumb of a slider.\r
+ *\r
+ * @extends YAHOO.util.DD\r
+ * @constructor\r
+ * @param {String} id the id of the slider html element\r
+ * @param {String} sGroup the group of related DragDrop items\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize optional parameter for specifying that the element \r
+ * should move a certain number pixels at a time.\r
+ */\r
+YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {\r
+\r
+       if (id) {\r
+               this.init(id, sGroup);\r
+\r
+        /**\r
+         * The id of the thumbs parent HTML element (the slider background element).\r
+         * @type string\r
+         */\r
+        this.parentElId = sGroup;\r
+       }\r
+\r
+\r
+       /**\r
+        * Overrides the isTarget property in YAHOO.util.DragDrop\r
+        * @private\r
+        */\r
+       this.isTarget = false;\r
+\r
+    /**\r
+     * The tick size for this slider\r
+     * @type int\r
+     */\r
+       this.tickSize = iTickSize;\r
+\r
+    /**\r
+     * Informs the drag and drop util that the offsets should remain when\r
+     * resetting the constraints.  This preserves the slider value when\r
+     * the constraints are reset\r
+     * @type boolean\r
+     */\r
+    this.maintainOffset = true;\r
+\r
+       this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);\r
+\r
+    this.scroll = false;\r
+\r
+};\r
+\r
+// YAHOO.widget.SliderThumb.prototype = new YAHOO.util.DD();\r
+YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD);\r
+\r
+/**\r
+ * Returns the difference between the location of the thumb and its parent.\r
+ * @param {Array} Optionally accepts the position of the parent\r
+ * @type int[]\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getOffsetFromParent = function(parentPos) {\r
+    var myPos = YAHOO.util.Dom.getXY(this.getEl());\r
+    var ppos  = parentPos || YAHOO.util.Dom.getXY(this.parentElId);\r
+\r
+    return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];\r
+};\r
+\r
+/**\r
+ * The (X and Y) difference between the thumb location and its parent \r
+ * (the slider background) when the control is instantiated.  \r
+ * @type int[]\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.startOffset = null;\r
+\r
+/**\r
+ * Flag used to figure out if this is a horizontal or vertical slider\r
+ *\r
+ * @type boolean\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._isHoriz = false;\r
+\r
+/**\r
+ * Cache the last value so we can check for change\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._prevVal = 0;\r
+\r
+/**\r
+ * initial element X\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+// YAHOO.widget.SliderThumb.prototype._initX = 0;\r
+\r
+/**\r
+ * initial element Y\r
+ *\r
+ * @type int\r
+ * @private\r
+ */\r
+// YAHOO.widget.SliderThumb.prototype._initY = 0;\r
+\r
+/**\r
+ * The slider is _graduated if there is a tick interval defined\r
+ *\r
+ * @type boolean\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype._graduated = false;\r
+\r
+/**\r
+ * Set up the slider, must be called in the constructor of all subclasses\r
+ *\r
+ * @param {int} iLeft the number of pixels the element can move left\r
+ * @param {int} iRight the number of pixels the element can move right\r
+ * @param {int} iUp the number of pixels the element can move up\r
+ * @param {int} iDown the number of pixels the element can move down\r
+ * @param {int} iTickSize the width of the tick interval.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.initSlider = function (iLeft, iRight, iUp, iDown, \r
+               iTickSize) {\r
+\r
+       this.setXConstraint(iLeft, iRight, iTickSize);\r
+       this.setYConstraint(iUp, iDown, iTickSize);\r
+\r
+       if (iTickSize && iTickSize > 1) {\r
+               this._graduated = true;\r
+       }\r
+\r
+       this._isHoriz = (iLeft > 0 || iRight > 0); \r
+       this._isVert   = (iUp > 0 ||  iDown > 0);\r
+       this._isRegion = (this._isHoriz && this._isVert); \r
+\r
+};\r
+\r
+/**\r
+ * Clear's the slider's ticks\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.clearTicks = function () {\r
+    YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);\r
+    this._graduated = false;\r
+};\r
+\r
+/**\r
+ * Gets the current offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var val = (this._isHoriz) ? this.getXValue() : this.getYValue();\r
+    return val;\r
+};\r
+\r
+/**\r
+ * Gets the current X offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved horizontally from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getXValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var newOffset = this.getOffsetFromParent();\r
+       return (newOffset[0] - this.startOffset[0]);\r
+};\r
+\r
+/**\r
+ * Gets the current Y offset from the element's start position in\r
+ * pixels.\r
+ *\r
+ * @return {int} the number of pixels (positive or negative) the\r
+ * slider has moved vertically from the start position.\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.getYValue = function () {\r
+    if (!this.available) { return 0; }\r
+    var newOffset = this.getOffsetFromParent();\r
+       return (newOffset[1] - this.startOffset[1]);\r
+};\r
+\r
+/**\r
+ * toString\r
+ * @return {string} string representation of the instance\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.toString = function () { \r
+    return "SliderThumb " + this.id;\r
+};\r
+\r
+/**\r
+ * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider\r
+ * instance it belongs to.\r
+ *\r
+ * @private\r
+ */\r
+YAHOO.widget.SliderThumb.prototype.onChange = function (x, y) { };\r
+\r
+if ("undefined" == typeof YAHOO.util.Anim) {\r
+       YAHOO.widget.Slider.ANIM_AVAIL = false;\r
+}\r
+\r
diff --git a/lib/yui/treeview/README b/lib/yui/treeview/README
new file mode 100755 (executable)
index 0000000..5624915
--- /dev/null
@@ -0,0 +1,82 @@
+TreeView - Release Notes\r
+\r
+0.11.0\r
+\r
+   * Added TreeView -> popNode, which differs from removeNode in that the\r
+     node's children are preserved so the entire branch can be re-inserted\r
+     into another part of the tree, or another tree.\r
+\r
+   * Added TreeView -> getNodesByProperty, which differs from \r
+     getNodeByProperty by returning an array of all nodes that have the\r
+     specified property rather than just the first one.\r
+\r
+   * Added Node -> insertBefore, insertAfter, and appendTo.  These method\r
+     can be used to reorganize the tree.\r
+\r
+   * removeChildren properly resets the node icon when executed against a \r
+     collpased node.\r
+     \r
+   * Moved depth assignment from the constructor to appendChild so that the\r
+     value is set properly if the node is moved within the tree.\r
+\r
+   * Fixed broken loop in removeChildren.\r
+\r
+   * RootNode -> loadComplete calls tree.draw for hot-wiring the dynamic load\r
+     feature for the top level nodes.\r
+\r
+   * The treeview constructor will accept an element instead of an id.\r
+\r
+0.10.0\r
+\r
+   * If the child collection changes prior to a refresh(), the icon is now\r
+     changed appropriately.\r
+\r
+   * Added TreeView removeChildren(node).  This will recursively purge the node's\r
+     children, and reset its dynamic load state.  \r
+\r
+   * previousSibling and nextSibling are now adjusted correctly when a\r
+     node is deleted.\r
+\r
+   * expand()/collapse() now will not expand/collapse the node if false is\r
+     returned from the onExpand/onCollapse event handlers.\r
+\r
+   * The onExpand and onCollapse events now fire before the node is expanded\r
+     or collapsed so that the implementer can modify the node's child collection\r
+     prior to display.\r
+\r
+   * The childrenRendered property previous was used to indicate both that\r
+     a dynamically loaded node has received its data, and also to indicate\r
+     that the children html has been created.  This has been split into\r
+     two properties.  dynamicLoadComplete and childrenRendered.\r
+\r
+   * Implemented the renderHidden flag.  If set to true, the html for the entire\r
+     tree will be created when tree.draw() is called, not just the html for the\r
+     visible nodes.\r
+\r
+   * Added an onLabelClick listener to TextNode\r
+\r
+   * TreeView.removeNode no longer automatically refreshes the tree.  It has an\r
+     optional parameter to perform the refresh.\r
+\r
+   * removeNode can now be executed on nodes that have not been rendered.\r
+\r
+   * You can now delete top-level nodes.\r
+\r
+   * Added onCheckClick listener to the TaskNode example\r
+\r
+   * Added Node.iconMode, which is a property that configures the way \r
+     dynamically loaded nodes are displayed when they are expanded and contain \r
+     no children.\r
+\r
+   * TreeView/Node.setDynamicLoad now accepts an optional second parameter to \r
+     set the iconMode property.\r
+\r
+   * Fixed an issue in the TaskNode.js example that prevented setting the checked\r
+     state of a node through the constructor.\r
+\r
+   * Fixed an issue in HTMLNode that caused rendering issues when hasIcon was \r
+     set to true.\r
+\r
+   * Added TreeView.removeNode\r
+\r
+   * Added Node.refresh\r
diff --git a/lib/yui/treeview/assets/lm.gif b/lib/yui/treeview/assets/lm.gif
new file mode 100755 (executable)
index 0000000..e7d0a3c
Binary files /dev/null and b/lib/yui/treeview/assets/lm.gif differ
diff --git a/lib/yui/treeview/assets/lmh.gif b/lib/yui/treeview/assets/lmh.gif
new file mode 100755 (executable)
index 0000000..3ff6302
Binary files /dev/null and b/lib/yui/treeview/assets/lmh.gif differ
diff --git a/lib/yui/treeview/assets/ln.gif b/lib/yui/treeview/assets/ln.gif
new file mode 100755 (executable)
index 0000000..b7b3e55
Binary files /dev/null and b/lib/yui/treeview/assets/ln.gif differ
diff --git a/lib/yui/treeview/assets/loading.gif b/lib/yui/treeview/assets/loading.gif
new file mode 100755 (executable)
index 0000000..0bbf3bc
Binary files /dev/null and b/lib/yui/treeview/assets/loading.gif differ
diff --git a/lib/yui/treeview/assets/lp.gif b/lib/yui/treeview/assets/lp.gif
new file mode 100755 (executable)
index 0000000..b87f003
Binary files /dev/null and b/lib/yui/treeview/assets/lp.gif differ
diff --git a/lib/yui/treeview/assets/lph.gif b/lib/yui/treeview/assets/lph.gif
new file mode 100755 (executable)
index 0000000..e3478d8
Binary files /dev/null and b/lib/yui/treeview/assets/lph.gif differ
diff --git a/lib/yui/treeview/assets/tm.gif b/lib/yui/treeview/assets/tm.gif
new file mode 100755 (executable)
index 0000000..e30abad
Binary files /dev/null and b/lib/yui/treeview/assets/tm.gif differ
diff --git a/lib/yui/treeview/assets/tmh.gif b/lib/yui/treeview/assets/tmh.gif
new file mode 100755 (executable)
index 0000000..ad7e557
Binary files /dev/null and b/lib/yui/treeview/assets/tmh.gif differ
diff --git a/lib/yui/treeview/assets/tn.gif b/lib/yui/treeview/assets/tn.gif
new file mode 100755 (executable)
index 0000000..4a28039
Binary files /dev/null and b/lib/yui/treeview/assets/tn.gif differ
diff --git a/lib/yui/treeview/assets/tp.gif b/lib/yui/treeview/assets/tp.gif
new file mode 100755 (executable)
index 0000000..d6d0ed0
Binary files /dev/null and b/lib/yui/treeview/assets/tp.gif differ
diff --git a/lib/yui/treeview/assets/tph.gif b/lib/yui/treeview/assets/tph.gif
new file mode 100755 (executable)
index 0000000..e4d7d99
Binary files /dev/null and b/lib/yui/treeview/assets/tph.gif differ
diff --git a/lib/yui/treeview/assets/tree.css b/lib/yui/treeview/assets/tree.css
new file mode 100755 (executable)
index 0000000..dffca1e
--- /dev/null
@@ -0,0 +1,98 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */\r
+\r
+/* first or middle sibling, no children */\r
+.ygtvtn {\r
+       width:16px; height:22px; \r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/tn.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* first or middle sibling, collapsable */\r
+.ygtvtm {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/tm.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* first or middle sibling, collapsable, hover */\r
+.ygtvtmh {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/tmh.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* first or middle sibling, expandable */\r
+.ygtvtp {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/tp.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* first or middle sibling, expandable, hover */\r
+.ygtvtph {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/tph.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* last sibling, no children */\r
+.ygtvln {\r
+       width:16px; height:22px; \r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/ln.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* Last sibling, collapsable */\r
+.ygtvlm {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/lm.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* Last sibling, collapsable, hover */\r
+.ygtvlmh {\r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/lmh.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* Last sibling, expandable */\r
+.ygtvlp { \r
+       width:16px; height:22px; \r
+       cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/lp.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* Last sibling, expandable, hover */\r
+.ygtvlph { \r
+       width:16px; height:22px; cursor:pointer ;\r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/lph.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* Loading icon */\r
+.ygtvloading { \r
+       width:16px; height:22px; \r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/loading.gif) 0 0 no-repeat; \r
+}\r
+\r
+/* the style for the empty cells that are used for rendering the depth \r
+ * of the node */\r
+.ygtvdepthcell { \r
+       width:16px; height:22px; \r
+       background: url(../../../../../../../i/us/nt/widg/tree/dflt/vline.gif) 0 0 no-repeat; \r
+}\r
+\r
+.ygtvblankdepthcell { width:16px; height:22px; }\r
+\r
+/* the style of the div around each node */\r
+.ygtvitem { }  \r
+\r
+/* the style of the div around each node's collection of children */\r
+.ygtvchildren { }  \r
+* html .ygtvchildren { height:2%; }  \r
+\r
+/* the style of the text label in ygTextNode */\r
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { \r
+       margin-left:2px;\r
+       text-decoration: none;\r
+}\r
+\r
+.ygtvspacer { height: 10px; width: 10px; margin: 2px; }\r
diff --git a/lib/yui/treeview/assets/vline.gif b/lib/yui/treeview/assets/vline.gif
new file mode 100755 (executable)
index 0000000..1fb0de8
Binary files /dev/null and b/lib/yui/treeview/assets/vline.gif differ
diff --git a/lib/yui/treeview/treeview-debug.js b/lib/yui/treeview/treeview-debug.js
new file mode 100755 (executable)
index 0000000..69efa95
--- /dev/null
@@ -0,0 +1,2004 @@
+\r
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * Contains the tree view state data and the root node.  This is an\r
+ * ordered tree; child nodes will be displayed in the order created, and\r
+ * there currently is no way to change this.\r
+ *\r
+ * @constructor\r
+ * @param {string|HTMLElement} id The id of the element, or the element\r
+ * itself that the tree will be inserted into.\r
+ */\r
+YAHOO.widget.TreeView = function(id) {\r
+    if (id) { this.init(id); }\r
+};\r
+\r
+/**\r
+ * Count of all nodes in all trees\r
+ * @type int\r
+ */\r
+YAHOO.widget.TreeView.nodeCount = 0;\r
+\r
+YAHOO.widget.TreeView.prototype = {\r
+\r
+    /**\r
+     * The id of tree container element\r
+     *\r
+     * @type String\r
+     */\r
+    id: null,\r
+\r
+    /**\r
+     * The host element for this tree\r
+     * @private\r
+     */\r
+    _el: null,\r
+\r
+     /**\r
+     * Flat collection of all nodes in this tree\r
+     *\r
+     * @type Node[]\r
+     * @private\r
+     */\r
+    _nodes: null,\r
+\r
+    /**\r
+     * We lock the tree control while waiting for the dynamic loader to return\r
+     *\r
+     * @type boolean\r
+     */\r
+    locked: false,\r
+\r
+    /**\r
+     * The animation to use for expanding children, if any\r
+     *\r
+     * @type string\r
+     * @private\r
+     */\r
+    _expandAnim: null,\r
+\r
+    /**\r
+     * The animation to use for collapsing children, if any\r
+     *\r
+     * @type string\r
+     * @private\r
+     */\r
+    _collapseAnim: null,\r
+\r
+    /**\r
+     * The current number of animations that are executing\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    _animCount: 0,\r
+\r
+    /**\r
+     * The maximum number of animations to run at one time.\r
+     *\r
+     * @type int\r
+     */\r
+    maxAnim: 2,\r
+\r
+    /**\r
+     * Sets up the animation for expanding children\r
+     *\r
+     * @param {string} the type of animation (acceptable values defined in \r
+     * YAHOO.widget.TVAnim)\r
+     */\r
+    setExpandAnim: function(type) {\r
+        if (YAHOO.widget.TVAnim.isValid(type)) {\r
+            this._expandAnim = type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Sets up the animation for collapsing children\r
+     *\r
+     * @param {string} the type of animation (acceptable values defined in \r
+     * YAHOO.widget.TVAnim)\r
+     */\r
+    setCollapseAnim: function(type) {\r
+        if (YAHOO.widget.TVAnim.isValid(type)) {\r
+            this._collapseAnim = type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Perform the expand animation if configured, or just show the\r
+     * element if not configured or too many animations are in progress\r
+     *\r
+     * @param el {HTMLElement} the element to animate\r
+     * @return {boolean} true if animation could be invoked, false otherwise\r
+     */\r
+    animateExpand: function(el) {\r
+        this.logger.log("animating expand");\r
+\r
+        if (this._expandAnim && this._animCount < this.maxAnim) {\r
+            // this.locked = true;\r
+            var tree = this;\r
+            var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el, \r
+                            function() { tree.expandComplete(); });\r
+            if (a) { \r
+                ++this._animCount;\r
+                a.animate();\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+        return false;\r
+    },\r
+\r
+    /**\r
+     * Perform the collapse animation if configured, or just show the\r
+     * element if not configured or too many animations are in progress\r
+     *\r
+     * @param el {HTMLElement} the element to animate\r
+     * @return {boolean} true if animation could be invoked, false otherwise\r
+     */\r
+    animateCollapse: function(el) {\r
+        this.logger.log("animating collapse");\r
+\r
+        if (this._collapseAnim && this._animCount < this.maxAnim) {\r
+            // this.locked = true;\r
+            var tree = this;\r
+            var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el, \r
+                            function() { tree.collapseComplete(); });\r
+            if (a) { \r
+                ++this._animCount;\r
+                a.animate();\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+        return false;\r
+    },\r
+\r
+    /**\r
+     * Function executed when the expand animation completes\r
+     */\r
+    expandComplete: function() {\r
+        this.logger.log("expand complete: " + this.id);\r
+        --this._animCount;\r
+        // this.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Function executed when the collapse animation completes\r
+     */\r
+    collapseComplete: function() {\r
+        this.logger.log("collapse complete: " + this.id);\r
+        --this._animCount;\r
+        // this.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Initializes the tree\r
+     *\r
+     * @parm {string|HTMLElement} id the id of the element that will hold the tree\r
+     * @private\r
+     */\r
+    init: function(id) {\r
+\r
+        this.id = id;\r
+\r
+        if ("string" !== typeof id) {\r
+            this._el = id;\r
+            this.id = this.generateId(id);\r
+        }\r
+\r
+        this._nodes = [];\r
+\r
+        // store a global reference\r
+        YAHOO.widget.TreeView.trees[this.id] = this;\r
+\r
+        // Set up the root node\r
+        this.root = new YAHOO.widget.RootNode(this);\r
+\r
+        this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+        this.logger.log("tree init: " + this.id);\r
+    },\r
+\r
+    /**\r
+     * Renders the tree boilerplate and visible nodes\r
+     */\r
+    draw: function() {\r
+        var html = this.root.getHtml();\r
+        this.getEl().innerHTML = html;\r
+        this.firstDraw = false;\r
+    },\r
+\r
+    /**\r
+     * Returns the tree's host element\r
+     * @return {HTMLElement} the host element\r
+     */\r
+    getEl: function() {\r
+        if (! this._el) {\r
+            this._el = document.getElementById(this.id);\r
+        }\r
+        return this._el;\r
+    },\r
+\r
+    /**\r
+     * Nodes register themselves with the tree instance when they are created.\r
+     *\r
+     * @param node {Node} the node to register\r
+     * @private\r
+     */\r
+    regNode: function(node) {\r
+        this._nodes[node.index] = node;\r
+    },\r
+\r
+    /**\r
+     * Returns the root node of this tree\r
+     *\r
+     * @return {Node} the root node\r
+     */\r
+    getRoot: function() {\r
+        return this.root;\r
+    },\r
+\r
+    /**\r
+     * Configures this tree to dynamically load all child data\r
+     *\r
+     * @param {function} fnDataLoader the function that will be called to get the data\r
+     * @param iconMode {int} configures the icon that is displayed when a dynamic\r
+     * load node is expanded the first time without children.  By default, the \r
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be\r
+     * displayed.\r
+     */\r
+    setDynamicLoad: function(fnDataLoader, iconMode) { \r
+        this.root.setDynamicLoad(fnDataLoader, iconMode);\r
+    },\r
+\r
+    /**\r
+     * Expands all child nodes.  Note: this conflicts with the "multiExpand"\r
+     * node property.  If expand all is called in a tree with nodes that\r
+     * do not allow multiple siblings to be displayed, only the last sibling\r
+     * will be expanded.\r
+     */\r
+    expandAll: function() { \r
+        if (!this.locked) {\r
+            this.root.expandAll(); \r
+        }\r
+    },\r
+\r
+    /**\r
+     * Collapses all expanded child nodes in the entire tree.\r
+     */\r
+    collapseAll: function() { \r
+        if (!this.locked) {\r
+            this.root.collapseAll(); \r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns a node in the tree that has the specified index (this index\r
+     * is created internally, so this function probably will only be used\r
+     * in html generated for a given node.)\r
+     *\r
+     * @param {int} nodeIndex the index of the node wanted\r
+     * @return {Node} the node with index=nodeIndex, null if no match\r
+     */\r
+    getNodeByIndex: function(nodeIndex) {\r
+        var n = this._nodes[nodeIndex];\r
+        return (n) ? n : null;\r
+    },\r
+\r
+    /**\r
+     * Returns a node that has a matching property and value in the data\r
+     * object that was passed into its constructor.\r
+     *\r
+     * @param {object} property the property to search (usually a string)\r
+     * @param {object} value the value we want to find (usuall an int or string)\r
+     * @return {Node} the matching node, null if no match\r
+     */\r
+    getNodeByProperty: function(property, value) {\r
+        for (var i in this._nodes) {\r
+            var n = this._nodes[i];\r
+            if (n.data && value == n.data[property]) {\r
+                return n;\r
+            }\r
+        }\r
+\r
+        return null;\r
+    },\r
+\r
+    /**\r
+     * Returns a collection of nodes that have a matching property \r
+     * and value in the data object that was passed into its constructor.  \r
+     *\r
+     * @param {object} property the property to search (usually a string)\r
+     * @param {object} value the value we want to find (usuall an int or string)\r
+     * @return {Array} the matching collection of nodes, null if no match\r
+     */\r
+    getNodesByProperty: function(property, value) {\r
+        var values = [];\r
+        for (var i in this._nodes) {\r
+            var n = this._nodes[i];\r
+            if (n.data && value == n.data[property]) {\r
+                values.push(n);\r
+            }\r
+        }\r
+\r
+        return (values.length) ? values : null;\r
+    },\r
+\r
+    /**\r
+     * Removes the node and its children, and optionally refreshes the branch \r
+     * of the tree that was affected.\r
+     * @param {Node} The node to remove\r
+     * @param {boolean} autoRefresh automatically refreshes branch if true\r
+     * @return {boolean} False is there was a problem, true otherwise.\r
+     */\r
+    removeNode: function(node, autoRefresh) { \r
+\r
+        // Don't delete the root node\r
+        if (node.isRoot()) {\r
+            return false;\r
+        }\r
+\r
+        // Get the branch that we may need to refresh\r
+        var p = node.parent;\r
+        if (p.parent) {\r
+            p = p.parent;\r
+        }\r
+\r
+        // Delete the node and its children\r
+        this._deleteNode(node);\r
+\r
+        // Refresh the parent of the parent\r
+        if (autoRefresh && p && p.childrenRendered) {\r
+            p.refresh();\r
+        }\r
+\r
+        return true;\r
+    },\r
+\r
+    /**\r
+     * Deletes this nodes child collection, recursively.  Also collapses\r
+     * the node, and resets the dynamic load flag.  The primary use for\r
+     * this method is to purge a node and allow it to fetch its data\r
+     * dynamically again.\r
+     * @param {Node} node the node to purge\r
+     */\r
+    removeChildren: function(node) { \r
+        this.logger.log("Removing children for " + node);\r
+        while (node.children.length) {\r
+             this._deleteNode(node.children[0]);\r
+        }\r
+\r
+        node.childrenRendered = false;\r
+        node.dynamicLoadComplete = false;\r
+        // node.collapse();\r
+        node.expand();\r
+        node.collapse();\r
+    },\r
+\r
+    /**\r
+     * Deletes the node and recurses children\r
+     * @private\r
+     */\r
+    _deleteNode: function(node) { \r
+        // Remove all the child nodes first\r
+        this.removeChildren(node);\r
+\r
+        // Remove the node from the tree\r
+        this.popNode(node);\r
+    },\r
+\r
+    /**\r
+     * Removes the branch from the tree.  This differs from removeNode in\r
+     * that the child collection is preserved to make it possible to\r
+     * insert the branch into another part of the tree, or another tree.\r
+     * @param {Node} the node to remove\r
+     */\r
+    popNode: function(node) { \r
+        var p = node.parent;\r
+\r
+        // Update the parent's collection of children\r
+        var a = [];\r
+\r
+        for (var i=0, len=p.children.length;i<len;++i) {\r
+            if (p.children[i] != node) {\r
+                a[a.length] = p.children[i];\r
+            }\r
+        }\r
+\r
+        p.children = a;\r
+\r
+        // reset the childrenRendered flag for the parent\r
+        p.childrenRendered = false;\r
+\r
+         // Update the sibling relationship\r
+        if (node.previousSibling) {\r
+            node.previousSibling.nextSibling = node.nextSibling;\r
+        }\r
+\r
+        if (node.nextSibling) {\r
+            node.nextSibling.previousSibling = node.previousSibling;\r
+        }\r
+\r
+        // Update the tree's node collection \r
+        delete this._nodes[node.index];\r
+    },\r
+\r
+\r
+    /**\r
+     * toString\r
+     * @return {string} string representation of the tree\r
+     */\r
+    toString: function() {\r
+        return "TreeView " + this.id;\r
+    },\r
+\r
+    /**\r
+     * private\r
+     */\r
+    generateId: function(el) {\r
+        var id = el.id;\r
+\r
+        if (!id) {\r
+            id = "yui-tv-auto-id-" + YAHOO.widget.TreeView.counter;\r
+            YAHOO.widget.TreeView.counter++;\r
+        }\r
+\r
+        return id;\r
+    },\r
+\r
+    /**\r
+     * Abstract method that is executed when a node is expanded\r
+     * @param node {Node} the node that was expanded\r
+     */\r
+    onExpand: function(node) { },\r
+\r
+    /**\r
+     * Abstract method that is executed when a node is collapsed\r
+     * @param node {Node} the node that was collapsed.\r
+     */\r
+    onCollapse: function(node) { }\r
+\r
+};\r
+\r
+/**\r
+ * Global cache of tree instances\r
+ *\r
+ * @type Array\r
+ * @private\r
+ */\r
+YAHOO.widget.TreeView.trees = [];\r
+\r
+/**\r
+ * @private\r
+ */\r
+YAHOO.widget.TreeView.counter = 0;\r
+\r
+/**\r
+ * Global method for getting a tree by its id.  Used in the generated\r
+ * tree html.\r
+ *\r
+ * @param treeId {String} the id of the tree instance\r
+ * @return {TreeView} the tree instance requested, null if not found.\r
+ */\r
+YAHOO.widget.TreeView.getTree = function(treeId) {\r
+    var t = YAHOO.widget.TreeView.trees[treeId];\r
+    return (t) ? t : null;\r
+};\r
+\r
+\r
+/**\r
+ * Global method for getting a node by its id.  Used in the generated\r
+ * tree html.\r
+ *\r
+ * @param treeId {String} the id of the tree instance\r
+ * @param nodeIndex {String} the index of the node to return\r
+ * @return {Node} the node instance requested, null if not found\r
+ */\r
+YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) {\r
+    var t = YAHOO.widget.TreeView.getTree(treeId);\r
+    return (t) ? t.getNodeByIndex(nodeIndex) : null;\r
+};\r
+\r
+/**\r
+ * Adds an event.  Replace with event manager when available\r
+ *\r
+ * @param el the elment to bind the handler to\r
+ * @param {string} sType the type of event handler\r
+ * @param {function} fn the callback to invoke\r
+ * @param {boolean} capture if true event is capture phase, bubble otherwise\r
+ */\r
+YAHOO.widget.TreeView.addHandler = function (el, sType, fn, capture) {\r
+    capture = (capture) ? true : false;\r
+    if (el.addEventListener) {\r
+        el.addEventListener(sType, fn, capture);\r
+    } else if (el.attachEvent) {\r
+        el.attachEvent("on" + sType, fn);\r
+    } else {\r
+        el["on" + sType] = fn;\r
+    }\r
+};\r
+\r
+/**\r
+ * Attempts to preload the images defined in the styles used to draw the tree by\r
+ * rendering off-screen elements that use the styles.\r
+ */\r
+YAHOO.widget.TreeView.preload = function(prefix) {\r
+    prefix = prefix || "ygtv";\r
+    var styles = ["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];\r
+\r
+    var sb = [];\r
+    \r
+    for (var i = 0; i < styles.length; ++i) { \r
+        sb[sb.length] = '<span class="' + prefix + styles[i] + '">&#160;</span>';\r
+    }\r
+\r
+    var f = document.createElement("DIV");\r
+    var s = f.style;\r
+    s.position = "absolute";\r
+    s.top = "-1000px";\r
+    s.left = "-1000px";\r
+    f.innerHTML = sb.join("");\r
+\r
+    document.body.appendChild(f);\r
+};\r
+\r
+YAHOO.widget.TreeView.addHandler(window, \r
+                "load", YAHOO.widget.TreeView.preload);\r
+\r
+/**\r
+ * The base class for all tree nodes.  The node's presentation and behavior in\r
+ * response to mouse events is handled in Node subclasses.\r
+ *\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ * @constructor\r
+ */\r
+YAHOO.widget.Node = function(oData, oParent, expanded) {\r
+    if (oData) { this.init(oData, oParent, expanded); }\r
+};\r
+\r
+YAHOO.widget.Node.prototype = {\r
+\r
+    /**\r
+     * The index for this instance obtained from global counter in YAHOO.widget.TreeView.\r
+     *\r
+     * @type int\r
+     */\r
+    index: 0,\r
+\r
+    /**\r
+     * This node's child node collection.\r
+     *\r
+     * @type Node[] \r
+     */\r
+    children: null,\r
+\r
+    /**\r
+     * Tree instance this node is part of\r
+     *\r
+     * @type TreeView\r
+     */\r
+    tree: null,\r
+\r
+    /**\r
+     * The data linked to this node.  This can be any object or primitive\r
+     * value, and the data can be used in getNodeHtml().\r
+     *\r
+     * @type object\r
+     */\r
+    data: null,\r
+\r
+    /**\r
+     * Parent node\r
+     *\r
+     * @type Node\r
+     */\r
+    parent: null,\r
+\r
+    /**\r
+     * The depth of this node.  We start at -1 for the root node.\r
+     *\r
+     * @type int\r
+     */\r
+    depth: -1,\r
+\r
+    /**\r
+     * The href for the node's label.  If one is not specified, the href will\r
+     * be set so that it toggles the node.\r
+     *\r
+     * @type string\r
+     */\r
+    href: null,\r
+\r
+    /**\r
+     * The label href target, defaults to current window\r
+     *\r
+     * @type string\r
+     */\r
+    target: "_self",\r
+\r
+    /**\r
+     * The node's expanded/collapsed state\r
+     *\r
+     * @type boolean\r
+     */\r
+    expanded: false,\r
+\r
+    /**\r
+     * Can multiple children be expanded at once?\r
+     *\r
+     * @type boolean\r
+     */\r
+    multiExpand: true,\r
+\r
+    /**\r
+     * Should we render children for a collapsed node?  It is possible that the\r
+     * implementer will want to render the hidden data...  @todo verify that we \r
+     * need this, and implement it if we do.\r
+     *\r
+     * @type boolean\r
+     */\r
+    renderHidden: false,\r
+\r
+    /**\r
+     * This flag is set to true when the html is generated for this node's\r
+     * children, and set to false when new children are added.\r
+     * @type boolean\r
+     */\r
+    childrenRendered: false,\r
+\r
+    /**\r
+     * Dynamically loaded nodes only fetch the data the first time they are\r
+     * expanded.  This flag is set to true once the data has been fetched.\r
+     * @type boolean\r
+     */\r
+    dynamicLoadComplete: false,\r
+\r
+    /**\r
+     * This node's previous sibling\r
+     *\r
+     * @type Node\r
+     */\r
+    previousSibling: null,\r
+\r
+    /**\r
+     * This node's next sibling\r
+     *\r
+     * @type Node\r
+     */\r
+    nextSibling: null,\r
+\r
+    /**\r
+     * We can set the node up to call an external method to get the child\r
+     * data dynamically.\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    _dynLoad: false,\r
+\r
+    /**\r
+     * Function to execute when we need to get this node's child data.\r
+     *\r
+     * @type function\r
+     */\r
+    dataLoader: null,\r
+\r
+    /**\r
+     * This is true for dynamically loading nodes while waiting for the\r
+     * callback to return.\r
+     *\r
+     * @type boolean\r
+     */\r
+    isLoading: false,\r
+\r
+    /**\r
+     * The toggle/branch icon will not show if this is set to false.  This\r
+     * could be useful if the implementer wants to have the child contain\r
+     * extra info about the parent, rather than an actual node.\r
+     *\r
+     * @type boolean\r
+     */\r
+    hasIcon: true,\r
+\r
+    /**\r
+     * Used to configure what happens when a dynamic load node is expanded\r
+     * and we discover that it does not have children.  By default, it is\r
+     * treated as if it still could have children (plus/minus icon).  Set\r
+     * iconMode to have it display like a leaf node instead.\r
+     * @type int\r
+     */\r
+    iconMode: 0,\r
+\r
+    /**\r
+     * The node type\r
+     * @private\r
+     */\r
+    _type: "Node",\r
+\r
+    /*\r
+    spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",\r
+    expandedText: "Expanded",\r
+    collapsedText: "Collapsed",\r
+    loadingText: "Loading",\r
+    */\r
+\r
+    /**\r
+     * Initializes this node, gets some of the properties from the parent\r
+     *\r
+     * @param oData {object} a string or object containing the data that will\r
+     * be used to render this node\r
+     * @param oParent {Node} this node's parent node\r
+     * @param expanded {boolean} the initial expanded/collapsed state\r
+     */\r
+    init: function(oData, oParent, expanded) {\r
+        this.data       = oData;\r
+        this.children   = [];\r
+        this.index      = YAHOO.widget.TreeView.nodeCount;\r
+        ++YAHOO.widget.TreeView.nodeCount;\r
+        this.expanded   = expanded;\r
+        this.logger     = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+        // oParent should never be null except when we create the root node.\r
+        if (oParent) {\r
+            oParent.appendChild(this);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Certain properties for the node cannot be set until the parent\r
+     * is known. This is called after the node is inserted into a tree.\r
+     * the parent is also applied to this node's children in order to\r
+     * make it possible to move a branch from one tree to another.\r
+     * @param {Node} parentNode this node's parent node\r
+     */\r
+    applyParent: function(parentNode) {\r
+        if (!parentNode) {\r
+            return false;\r
+        }\r
+\r
+        this.tree   = parentNode.tree;\r
+        this.parent = parentNode;\r
+        this.depth  = parentNode.depth + 1;\r
+\r
+        if (! this.href) {\r
+            this.href = "javascript:" + this.getToggleLink();\r
+        }\r
+\r
+        if (! this.multiExpand) {\r
+            this.multiExpand = parentNode.multiExpand;\r
+        }\r
+\r
+        this.tree.regNode(this);\r
+        parentNode.childrenRendered = false;\r
+\r
+        // cascade update existing children\r
+        for (var i=0, len=this.children.length;i<len;++i) {\r
+            this.children[i].applyParent(this);\r
+        }\r
+\r
+        return true;\r
+    },\r
+\r
+    /**\r
+     * Appends a node to the child collection.\r
+     *\r
+     * @param childNode {Node} the new node\r
+     * @return {Node} the child node\r
+     * @private\r
+     */\r
+    appendChild: function(childNode) {\r
+        if (this.hasChildren()) {\r
+            var sib = this.children[this.children.length - 1];\r
+            sib.nextSibling = childNode;\r
+            childNode.previousSibling = sib;\r
+        }\r
+        this.children[this.children.length] = childNode;\r
+        childNode.applyParent(this);\r
+\r
+        return childNode;\r
+    },\r
+\r
+    /**\r
+     * Appends this node to the supplied node's child collection\r
+     * @param parentNode {Node} the node to append to.\r
+     */\r
+    appendTo: function(parentNode) {\r
+        return parentNode.appendChild(this);\r
+    },\r
+\r
+    /**\r
+    * Inserts this node before this supplied node\r
+    *\r
+    * @param node {Node} the node to insert this node before\r
+    * @return {Node} the inserted node\r
+    */\r
+    insertBefore: function(node) {\r
+        this.logger.log("insertBefore: " + node);\r
+        var p = node.parent;\r
+        if (p) {\r
+\r
+            if (this.tree) {\r
+                this.tree.popNode(this);\r
+            }\r
+\r
+            var refIndex = node.isChildOf(p);\r
+            this.logger.log(refIndex);\r
+            p.children.splice(refIndex, 0, this);\r
+            if (node.previousSibling) {\r
+                node.previousSibling.nextSibling = this;\r
+            }\r
+            this.previousSibling = node.previousSibling;\r
+            this.nextSibling = node;\r
+            node.previousSibling = this;\r
+\r
+            this.applyParent(p);\r
+        }\r
+\r
+        return this;\r
+    },\r
\r
+    /**\r
+    * Inserts this node after the supplied node\r
+    *\r
+    * @param node {Node} the node to insert after\r
+    * @return {Node} the inserted node\r
+    */\r
+    insertAfter: function(node) {\r
+        this.logger.log("insertAfter: " + node);\r
+        var p = node.parent;\r
+        if (p) {\r
+\r
+            if (this.tree) {\r
+                this.tree.popNode(this);\r
+            }\r
+\r
+            var refIndex = node.isChildOf(p);\r
+            this.logger.log(refIndex);\r
+\r
+            if (!node.nextSibling) {\r
+                return this.appendTo(p);\r
+            }\r
+\r
+            p.children.splice(refIndex + 1, 0, this);\r
+\r
+            node.nextSibling.previousSibling = this;\r
+            this.previousSibling = node;\r
+            this.nextSibling = node.nextSibling;\r
+            node.nextSibling = this;\r
+\r
+            this.applyParent(p);\r
+        }\r
+\r
+        return this;\r
+    },\r
+\r
+    /**\r
+    * Returns true if the Node is a child of supplied Node\r
+    *\r
+    * @param parentNode {Node} the Node to check\r
+    * @return {boolean} The node index if this Node is a child of \r
+    *                   supplied Node, else -1.\r
+    * @private\r
+    */\r
+    isChildOf: function(parentNode) {\r
+        if (parentNode && parentNode.children) {\r
+            for (var i=0, len=parentNode.children.length; i<len ; ++i) {\r
+                if (parentNode.children[i] === this) {\r
+                    return i;\r
+                }\r
+            }\r
+        }\r
+\r
+        return -1;\r
+    },\r
+\r
+    /**\r
+     * Returns a node array of this node's siblings, null if none.\r
+     *\r
+     * @return Node[]\r
+     */\r
+    getSiblings: function() {\r
+        return this.parent.children;\r
+    },\r
+\r
+    /**\r
+     * Shows this node's children\r
+     */\r
+    showChildren: function() {\r
+        if (!this.tree.animateExpand(this.getChildrenEl())) {\r
+            if (this.hasChildren()) {\r
+                this.getChildrenEl().style.display = "";\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Hides this node's children\r
+     */\r
+    hideChildren: function() {\r
+        this.logger.log("hiding " + this.index);\r
+\r
+        if (!this.tree.animateCollapse(this.getChildrenEl())) {\r
+            this.getChildrenEl().style.display = "none";\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's container div\r
+     *\r
+     * @return {string} the element id\r
+     */\r
+    getElId: function() {\r
+        return "ygtv" + this.index;\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's children div\r
+     *\r
+     * @return {string} the element id for this node's children div\r
+     */\r
+    getChildrenElId: function() {\r
+        return "ygtvc" + this.index;\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's toggle element\r
+     *\r
+     * @return {string} the toggel element id\r
+     */\r
+    getToggleElId: function() {\r
+        return "ygtvt" + this.index;\r
+    },\r
+\r
+\r
+    /**\r
+     * Returns the id for this node's spacer image.  The spacer is positioned\r
+     * over the toggle and provides feedback for screen readers.\r
+     * @return {string} the id for the spacer image\r
+     */\r
+    /*\r
+    getSpacerId: function() {\r
+        return "ygtvspacer" + this.index;\r
+    }, \r
+    */\r
+\r
+    /**\r
+     * Returns this node's container html element\r
+     * @return {HTMLElement} the container html element\r
+     */\r
+    getEl: function() {\r
+        return document.getElementById(this.getElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the div that was generated for this node's children\r
+     * @return {HTMLElement} this node's children div\r
+     */\r
+    getChildrenEl: function() {\r
+        return document.getElementById(this.getChildrenElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the element that is being used for this node's toggle.\r
+     * @return {HTMLElement} this node's toggle html element\r
+     */\r
+    getToggleEl: function() {\r
+        return document.getElementById(this.getToggleElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the element that is being used for this node's spacer.\r
+     * @return {HTMLElement} this node's spacer html element\r
+     */\r
+    /*\r
+    getSpacer: function() {\r
+        return document.getElementById( this.getSpacerId() ) || {};\r
+    },\r
+    */\r
+\r
+    /*\r
+    getStateText: function() {\r
+        if (this.isLoading) {\r
+            return this.loadingText;\r
+        } else if (this.hasChildren(true)) {\r
+            if (this.expanded) {\r
+                return this.expandedText;\r
+            } else {\r
+                return this.collapsedText;\r
+            }\r
+        } else {\r
+            return "";\r
+        }\r
+    },\r
+    */\r
+\r
+    /**\r
+     * Generates the link that will invoke this node's toggle method\r
+     * @return {string} the javascript url for toggling this node\r
+     */\r
+    getToggleLink: function() {\r
+        return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + \r
+            this.index + ").toggle()";\r
+    },\r
+\r
+    /**\r
+     * Hides this nodes children (creating them if necessary), changes the\r
+     * toggle style.\r
+     */\r
+    collapse: function() {\r
+        // Only collapse if currently expanded\r
+        if (!this.expanded) { return; }\r
+\r
+        // fire the collapse event handler\r
+        var ret = this.tree.onCollapse(this);\r
+\r
+        if ("undefined" != typeof ret && !ret) {\r
+            this.logger.log("Collapse was stopped by the event handler");\r
+            return;\r
+        }\r
+\r
+        if (!this.getEl()) {\r
+            this.expanded = false;\r
+            return;\r
+        }\r
+\r
+        // hide the child div\r
+        this.hideChildren();\r
+        this.expanded = false;\r
+\r
+        if (this.hasIcon) {\r
+            this.getToggleEl().className = this.getStyle();\r
+        }\r
+\r
+        // this.getSpacer().title = this.getStateText();\r
+\r
+    },\r
+\r
+    /**\r
+     * Shows this nodes children (creating them if necessary), changes the\r
+     * toggle style, and collapses its siblings if multiExpand is not set.\r
+     */\r
+    expand: function() {\r
+        // Only expand if currently collapsed.\r
+        if (this.expanded) { return; }\r
+\r
+        // fire the expand event handler\r
+        var ret = this.tree.onExpand(this);\r
+\r
+        if ("undefined" != typeof ret && !ret) {\r
+            this.logger.log("Expand was stopped by the event handler");\r
+            return;\r
+        }\r
+\r
+        if (!this.getEl()) {\r
+            this.expanded = true;\r
+            return;\r
+        }\r
+\r
+        if (! this.childrenRendered) {\r
+            this.logger.log("children not rendered yet");\r
+            this.getChildrenEl().innerHTML = this.renderChildren();\r
+        } else {\r
+            this.logger.log("CHILDREN RENDERED");\r
+        }\r
+\r
+        this.expanded = true;\r
+        if (this.hasIcon) {\r
+            this.getToggleEl().className = this.getStyle();\r
+        }\r
+\r
+        // this.getSpacer().title = this.getStateText();\r
+\r
+        // We do an extra check for children here because the lazy\r
+        // load feature can expose nodes that have no children.\r
+\r
+        // if (!this.hasChildren()) {\r
+        if (this.isLoading) {\r
+            this.expanded = false;\r
+            return;\r
+        }\r
+\r
+        if (! this.multiExpand) {\r
+            var sibs = this.getSiblings();\r
+            for (var i=0; i<sibs.length; ++i) {\r
+                if (sibs[i] != this && sibs[i].expanded) { \r
+                    sibs[i].collapse(); \r
+                }\r
+            }\r
+        }\r
+\r
+        this.showChildren();\r
+    },\r
+\r
+    /**\r
+     * Returns the css style name for the toggle\r
+     *\r
+     * @return {string} the css class for this node's toggle\r
+     */\r
+    getStyle: function() {\r
+        // this.logger.log("No children, " + " isDyanmic: " + this.isDynamic() + " expanded: " + this.expanded);\r
+        if (this.isLoading) {\r
+            this.logger.log("returning the loading icon");\r
+            return "ygtvloading";\r
+        } else {\r
+            // location top or bottom, middle nodes also get the top style\r
+            var loc = (this.nextSibling) ? "t" : "l";\r
+\r
+            // type p=plus(expand), m=minus(collapase), n=none(no children)\r
+            var type = "n";\r
+            if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {\r
+            // if (this.hasChildren(true)) {\r
+                type = (this.expanded) ? "m" : "p";\r
+            }\r
+\r
+            // this.logger.log("ygtv" + loc + type);\r
+            return "ygtv" + loc + type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the hover style for the icon\r
+     * @return {string} the css class hover state\r
+     */\r
+    getHoverStyle: function() { \r
+        var s = this.getStyle();\r
+        if (this.hasChildren(true) && !this.isLoading) { \r
+            s += "h"; \r
+        }\r
+        return s;\r
+    },\r
+\r
+    /**\r
+     * Recursively expands all of this node's children.\r
+     */\r
+    expandAll: function() { \r
+        for (var i=0;i<this.children.length;++i) {\r
+            var c = this.children[i];\r
+            if (c.isDynamic()) {\r
+                alert("Not supported (lazy load + expand all)");\r
+                break;\r
+            } else if (! c.multiExpand) {\r
+                alert("Not supported (no multi-expand + expand all)");\r
+                break;\r
+            } else {\r
+                c.expand();\r
+                c.expandAll();\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Recursively collapses all of this node's children.\r
+     */\r
+    collapseAll: function() { \r
+        for (var i=0;i<this.children.length;++i) {\r
+            this.children[i].collapse();\r
+            this.children[i].collapseAll();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Configures this node for dynamically obtaining the child data\r
+     * when the node is first expanded.  Calling it without the callback\r
+     * will turn off dynamic load for the node.\r
+     *\r
+     * @param fmDataLoader {function} the function that will be used to get the data.\r
+     * @param iconMode {int} configures the icon that is displayed when a dynamic\r
+     * load node is expanded the first time without children.  By default, the \r
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be\r
+     * displayed.\r
+     */\r
+    setDynamicLoad: function(fnDataLoader, iconMode) { \r
+        if (fnDataLoader) {\r
+            this.dataLoader = fnDataLoader;\r
+            this._dynLoad = true;\r
+        } else {\r
+            this.dataLoader = null;\r
+            this._dynLoad = false;\r
+        }\r
+\r
+        if (iconMode) {\r
+            this.iconMode = iconMode;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Evaluates if this node is the root node of the tree\r
+     *\r
+     * @return {boolean} true if this is the root node\r
+     */\r
+    isRoot: function() { \r
+        return (this == this.tree.root);\r
+    },\r
+\r
+    /**\r
+     * Evaluates if this node's children should be loaded dynamically.  Looks for\r
+     * the property both in this instance and the root node.  If the tree is\r
+     * defined to load all children dynamically, the data callback function is\r
+     * defined in the root node\r
+     *\r
+     * @return {boolean} true if this node's children are to be loaded dynamically\r
+     */\r
+    isDynamic: function() { \r
+        var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));\r
+        // this.logger.log("isDynamic: " + lazy);\r
+        return lazy;\r
+    },\r
+\r
+    getIconMode: function() {\r
+        return (this.iconMode || this.tree.root.iconMode);\r
+    },\r
+\r
+    /**\r
+     * Checks if this node has children.  If this node is lazy-loading and the\r
+     * children have not been rendered, we do not know whether or not there\r
+     * are actual children.  In most cases, we need to assume that there are\r
+     * children (for instance, the toggle needs to show the expandable \r
+     * presentation state).  In other times we want to know if there are rendered\r
+     * children.  For the latter, "checkForLazyLoad" should be false.\r
+     *\r
+     * @param checkForLazyLoad {boolean} should we check for unloaded children?\r
+     * @return {boolean} true if this has children or if it might and we are\r
+     * checking for this condition.\r
+     */\r
+    hasChildren: function(checkForLazyLoad) { \r
+        return ( this.children.length > 0 || \r
+                (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );\r
+    },\r
+\r
+    /**\r
+     * Expands if node is collapsed, collapses otherwise.\r
+     */\r
+    toggle: function() {\r
+        if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {\r
+            if (this.expanded) { this.collapse(); } else { this.expand(); }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the markup for this node and its children.\r
+     *\r
+     * @return {string} the markup for this node and its expanded children.\r
+     */\r
+    getHtml: function() {\r
+        var sb = [];\r
+        sb[sb.length] = '<div class="ygtvitem" id="' + this.getElId() + '">';\r
+        sb[sb.length] = this.getNodeHtml();\r
+        sb[sb.length] = this.getChildrenHtml();\r
+        sb[sb.length] = '</div>';\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Called when first rendering the tree.  We always build the div that will\r
+     * contain this nodes children, but we don't render the children themselves\r
+     * unless this node is expanded.\r
+     *\r
+     * @return {string} the children container div html and any expanded children\r
+     * @private\r
+     */\r
+    getChildrenHtml: function() {\r
+\r
+        var sb = [];\r
+        sb[sb.length] = '<div class="ygtvchildren"';\r
+        sb[sb.length] = ' id="' + this.getChildrenElId() + '"';\r
+        if (!this.expanded) {\r
+            sb[sb.length] = ' style="display:none;"';\r
+        }\r
+        sb[sb.length] = '>';\r
+\r
+        // Don't render the actual child node HTML unless this node is expanded.\r
+        if ( (this.hasChildren(true) && this.expanded) ||\r
+                (this.renderHidden && !this.isDynamic()) ) {\r
+            sb[sb.length] = this.renderChildren();\r
+        }\r
+\r
+        sb[sb.length] = '</div>';\r
+\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Generates the markup for the child nodes.  This is not done until the node\r
+     * is expanded.\r
+     *\r
+     * @return {string} the html for this node's children\r
+     * @private\r
+     */\r
+    renderChildren: function() {\r
+\r
+        this.logger.log("rendering children for " + this.index);\r
+\r
+        var node = this;\r
+\r
+        if (this.isDynamic() && !this.dynamicLoadComplete) {\r
+            this.isLoading = true;\r
+            this.tree.locked = true;\r
+\r
+            if (this.dataLoader) {\r
+                this.logger.log("Using dynamic loader defined for this node");\r
+\r
+                setTimeout( \r
+                    function() {\r
+                        node.dataLoader(node, \r
+                            function() { \r
+                                node.loadComplete(); \r
+                            });\r
+                    }, 10);\r
+                \r
+            } else if (this.tree.root.dataLoader) {\r
+                this.logger.log("Using the tree-level dynamic loader");\r
+\r
+                setTimeout( \r
+                    function() {\r
+                        node.tree.root.dataLoader(node, \r
+                            function() { \r
+                                node.loadComplete(); \r
+                            });\r
+                    }, 10);\r
+\r
+            } else {\r
+                this.logger.log("no loader found");\r
+                return "Error: data loader not found or not specified.";\r
+            }\r
+\r
+            return "";\r
+\r
+        } else {\r
+            return this.completeRender();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Called when we know we have all the child data.\r
+     * @return {string} children html\r
+     */\r
+    completeRender: function() {\r
+        this.logger.log("completeRender: " + this.index + ", # of children: " + this.children.length);\r
+        var sb = [];\r
+\r
+        for (var i=0; i < this.children.length; ++i) {\r
+            this.children[i].childrenRendered = false;\r
+            sb[sb.length] = this.children[i].getHtml();\r
+        }\r
+        \r
+        this.childrenRendered = true;\r
+\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Load complete is the callback function we pass to the data provider\r
+     * in dynamic load situations.\r
+     */\r
+    loadComplete: function() {\r
+        this.logger.log("loadComplete: " + this.index);\r
+        this.getChildrenEl().innerHTML = this.completeRender();\r
+        this.dynamicLoadComplete = true;\r
+        this.isLoading = false;\r
+        this.expand();\r
+        this.tree.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Returns this node's ancestor at the specified depth.\r
+     *\r
+     * @param {int} depth the depth of the ancestor.\r
+     * @return {Node} the ancestor\r
+     */\r
+    getAncestor: function(depth) {\r
+        if (depth >= this.depth || depth < 0)  {\r
+            this.logger.log("illegal getAncestor depth: " + depth);\r
+            return null;\r
+        }\r
+\r
+        var p = this.parent;\r
+        \r
+        while (p.depth > depth) {\r
+            p = p.parent;\r
+        }\r
+\r
+        return p;\r
+    },\r
+\r
+    /**\r
+     * Returns the css class for the spacer at the specified depth for\r
+     * this node.  If this node's ancestor at the specified depth\r
+     * has a next sibling the presentation is different than if it\r
+     * does not have a next sibling\r
+     *\r
+     * @param {int} depth the depth of the ancestor.\r
+     * @return {string} the css class for the spacer\r
+     */\r
+    getDepthStyle: function(depth) {\r
+        return (this.getAncestor(depth).nextSibling) ? \r
+            "ygtvdepthcell" : "ygtvblankdepthcell";\r
+    },\r
+\r
+    /**\r
+     * Get the markup for the node.  This is designed to be overrided so that we can\r
+     * support different types of nodes.\r
+     *\r
+     * @return {string} The HTML that will render this node.\r
+     */\r
+    getNodeHtml: function() { \r
+        this.logger.log("Generating html");\r
+        return ""; \r
+    },\r
+\r
+    /**\r
+     * Regenerates the html for this node and its children.  To be used when the\r
+     * node is expanded and new children have been added.\r
+     */\r
+    refresh: function() {\r
+        // this.loadComplete();\r
+        this.getChildrenEl().innerHTML = this.completeRender();\r
+\r
+        if (this.hasIcon) {\r
+            var el = this.getToggleEl();\r
+            if (el) {\r
+                el.className = this.getStyle();\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * toString\r
+     * @return {string} string representation of the node\r
+     */\r
+    toString: function() {\r
+        return "Node (" + this.index + ")";\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * A custom YAHOO.widget.Node that handles the unique nature of \r
+ * the virtual, presentationless root node.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ */\r
+YAHOO.widget.RootNode = function(oTree) {\r
+       // Initialize the node with null params.  The root node is a\r
+       // special case where the node has no presentation.  So we have\r
+       // to alter the standard properties a bit.\r
+       this.init(null, null, true);\r
+       \r
+       /**\r
+        * For the root node, we get the tree reference from as a param\r
+        * to the constructor instead of from the parent element.\r
+        *\r
+        * @type TreeView\r
+        */\r
+       this.tree = oTree;\r
+};\r
+\r
+YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node();\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.RootNode.prototype.getNodeHtml = function() { \r
+       return ""; \r
+};\r
+\r
+YAHOO.widget.RootNode.prototype.toString = function() { \r
+    return "RootNode";\r
+};\r
+\r
+YAHOO.widget.RootNode.prototype.loadComplete = function() { \r
+    this.tree.draw();\r
+};\r
+/**\r
+ * The default node presentation.  The first parameter should be\r
+ * either a string that will be used as the node's label, or an object\r
+ * that has a string propery called label.  By default, the clicking the\r
+ * label will toggle the expanded/collapsed state of the node.  By\r
+ * changing the href property of the instance, this behavior can be\r
+ * changed so that the label will go to the specified href.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {YAHOO.widget.Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ */\r
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {\r
+    // this.type = "TextNode";\r
+\r
+    if (oData) { \r
+        this.init(oData, oParent, expanded);\r
+        this.setUpLabel(oData);\r
+    }\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    this.logger     = new YAHOO.widget.LogWriter(this.toString());\r
+};\r
+\r
+YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node();\r
+\r
+/**\r
+ * The CSS class for the label href.  Defaults to ygtvlabel, but can be\r
+ * overridden to provide a custom presentation for a specific node.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel";\r
+\r
+/**\r
+ * The derived element id of the label for this node\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.labelElId = null;\r
+\r
+/**\r
+ * The text for the label.  It is assumed that the oData parameter will\r
+ * either be a string that will be used as the label, or an object that\r
+ * has a property called "label" that we will use.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.label = null;\r
+\r
+/**\r
+ * Sets up the node label\r
+ * \r
+ * @param oData string containing the label, or an object with a label property\r
+ */\r
+YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { \r
+    if (typeof oData == "string") {\r
+        oData = { label: oData };\r
+    }\r
+    this.label = oData.label;\r
+    \r
+    // update the link\r
+    if (oData.href) {\r
+        this.href = oData.href;\r
+    }\r
+\r
+    // set the target\r
+    if (oData.target) {\r
+        this.target = oData.target;\r
+    }\r
+\r
+    if (oData.style) {\r
+        this.labelStyle = oData.style;\r
+    }\r
+\r
+    this.labelElId = "ygtvlabelel" + this.index;\r
+};\r
+\r
+/**\r
+ * Returns the label element\r
+ *\r
+ * @return {object} the element\r
+ */\r
+YAHOO.widget.TextNode.prototype.getLabelEl = function() { \r
+    return document.getElementById(this.labelElId);\r
+};\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.TextNode.prototype.getNodeHtml = function() { \r
+    this.logger.log("Generating html");\r
+    var sb = [];\r
+\r
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';\r
+    sb[sb.length] = '<tr>';\r
+    \r
+    for (i=0;i<this.depth;++i) {\r
+        // sb[sb.length] = '<td class="ygtvdepthcell">&#160;</td>';\r
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';\r
+    }\r
+\r
+    var getNode = 'YAHOO.widget.TreeView.getNode(\'' +\r
+                    this.tree.id + '\',' + this.index + ')';\r
+\r
+    sb[sb.length] = '<td';\r
+    // sb[sb.length] = ' onselectstart="return false"';\r
+    sb[sb.length] = ' id="' + this.getToggleElId() + '"';\r
+    sb[sb.length] = ' class="' + this.getStyle() + '"';\r
+    if (this.hasChildren(true)) {\r
+        sb[sb.length] = ' onmouseover="this.className=';\r
+        sb[sb.length] = getNode + '.getHoverStyle()"';\r
+        sb[sb.length] = ' onmouseout="this.className=';\r
+        sb[sb.length] = getNode + '.getStyle()"';\r
+    }\r
+    sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">';\r
+\r
+    /*\r
+    sb[sb.length] = '<img id="' + this.getSpacerId() + '"';\r
+    sb[sb.length] = ' alt=""';\r
+    sb[sb.length] = ' tabindex=0';\r
+    sb[sb.length] = ' src="' + this.spacerPath + '"';\r
+    sb[sb.length] = ' title="' + this.getStateText() + '"';\r
+    sb[sb.length] = ' class="ygtvspacer"';\r
+    // sb[sb.length] = ' onkeypress="return ' + getNode + '".onKeyPress()"';\r
+    sb[sb.length] = ' />';\r
+    */\r
+\r
+    sb[sb.length] = '&#160;';\r
+\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '<td>';\r
+    sb[sb.length] = '<a';\r
+    sb[sb.length] = ' id="' + this.labelElId + '"';\r
+    sb[sb.length] = ' class="' + this.labelStyle + '"';\r
+    sb[sb.length] = ' href="' + this.href + '"';\r
+    sb[sb.length] = ' target="' + this.target + '"';\r
+    sb[sb.length] = ' onclick="return ' + getNode + '.onLabelClick(' + getNode +')"';\r
+    if (this.hasChildren(true)) {\r
+        sb[sb.length] = ' onmouseover="document.getElementById(\'';\r
+        sb[sb.length] = this.getToggleElId() + '\').className=';\r
+        sb[sb.length] = getNode + '.getHoverStyle()"';\r
+        sb[sb.length] = ' onmouseout="document.getElementById(\'';\r
+        sb[sb.length] = this.getToggleElId() + '\').className=';\r
+        sb[sb.length] = getNode + '.getStyle()"';\r
+    }\r
+    sb[sb.length] = ' >';\r
+    sb[sb.length] = this.label;\r
+    sb[sb.length] = '</a>';\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '</tr>';\r
+    sb[sb.length] = '</table>';\r
+\r
+    return sb.join("");\r
+};\r
+\r
+\r
+/**\r
+ * Executed when the label is clicked\r
+ * @param me {Node} this node\r
+ * @scope the anchor tag clicked\r
+ * @return false to cancel the anchor click\r
+ */\r
+YAHOO.widget.TextNode.prototype.onLabelClick = function(me) { \r
+    me.logger.log("onLabelClick " + this.label);\r
+    //return true;\r
+};\r
+\r
+YAHOO.widget.TextNode.prototype.toString = function() { \r
+    return "TextNode (" + this.index + ") " + this.label;\r
+};\r
+\r
+/**\r
+ * A menu-specific implementation that differs from TextNode in that only \r
+ * one sibling can be expanded at a time.\r
+ * @extends YAHOO.widget.TextNode\r
+ * @constructor\r
+ */\r
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {\r
+       if (oData) { \r
+               this.init(oData, oParent, expanded);\r
+               this.setUpLabel(oData);\r
+       }\r
+\r
+    /**\r
+     * Menus usually allow only one branch to be open at a time.\r
+     * @type boolean\r
+     */\r
+       this.multiExpand = false;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    this.logger     = new YAHOO.widget.LogWriter(this.toString());\r
+\r
+};\r
+\r
+YAHOO.widget.MenuNode.prototype = new YAHOO.widget.TextNode();\r
+\r
+YAHOO.widget.MenuNode.prototype.toString = function() { \r
+    return "MenuNode (" + this.index + ") " + this.label;\r
+};\r
+\r
+/**\r
+ * This implementation takes either a string or object for the\r
+ * oData argument.  If is it a string, we will use it for the display\r
+ * of this node (and it can contain any html code).  If the parameter\r
+ * is an object, we look for a parameter called "html" that will be\r
+ * used for this node's display.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {YAHOO.widget.Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should\r
+ * have an icon\r
+ */\r
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {\r
+    if (oData) { \r
+        this.init(oData, oParent, expanded);\r
+        this.initContent(oData, hasIcon);\r
+    }\r
+};\r
+\r
+YAHOO.widget.HTMLNode.prototype = new YAHOO.widget.Node();\r
+\r
+/**\r
+ * The CSS class for the html content container.  Defaults to ygtvhtml, but \r
+ * can be overridden to provide a custom presentation for a specific node.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.contentStyle = "ygtvhtml";\r
+\r
+/**\r
+ * The generated id that will contain the data passed in by the implementer.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.contentElId = null;\r
+\r
+/**\r
+ * The HTML content to use for this node's display\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.content = null;\r
+\r
+/**\r
+ * Sets up the node label\r
+ *\r
+ * @param {object} An html string or object containing an html property\r
+ * @param {boolean} hasIcon determines if the node will be rendered with an\r
+ * icon or not\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.initContent = function(oData, hasIcon) { \r
+    if (typeof oData == "string") {\r
+        oData = { html: oData };\r
+    }\r
+\r
+    this.html = oData.html;\r
+    this.contentElId = "ygtvcontentel" + this.index;\r
+    this.hasIcon = hasIcon;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+};\r
+\r
+/**\r
+ * Returns the outer html element for this node's content\r
+ *\r
+ * @return {HTMLElement} the element\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.getContentEl = function() { \r
+    return document.getElementById(this.contentElId);\r
+};\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.HTMLNode.prototype.getNodeHtml = function() { \r
+    this.logger.log("Generating html");\r
+    var sb = [];\r
+\r
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';\r
+    sb[sb.length] = '<tr>';\r
+    \r
+    for (i=0;i<this.depth;++i) {\r
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';\r
+    }\r
+\r
+    if (this.hasIcon) {\r
+        sb[sb.length] = '<td';\r
+        sb[sb.length] = ' id="' + this.getToggleElId() + '"';\r
+        sb[sb.length] = ' class="' + this.getStyle() + '"';\r
+        sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '"';\r
+        if (this.hasChildren(true)) {\r
+            sb[sb.length] = ' onmouseover="this.className=';\r
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';\r
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';\r
+            sb[sb.length] = ' onmouseout="this.className=';\r
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';\r
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';\r
+        }\r
+        sb[sb.length] = '>&#160;</td>';\r
+    }\r
+\r
+    sb[sb.length] = '<td';\r
+    sb[sb.length] = ' id="' + this.contentElId + '"';\r
+    sb[sb.length] = ' class="' + this.contentStyle + '"';\r
+    sb[sb.length] = ' >';\r
+    sb[sb.length] = this.html;\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '</tr>';\r
+    sb[sb.length] = '</table>';\r
+\r
+    return sb.join("");\r
+};\r
+\r
+YAHOO.widget.HTMLNode.prototype.toString = function() { \r
+    return "HTMLNode (" + this.index + ")";\r
+};\r
+\r
+/**\r
+ * A static factory class for tree view expand/collapse animations\r
+ *\r
+ * @constructor\r
+ */\r
+YAHOO.widget.TVAnim = function() {\r
+    return {\r
+        /**\r
+         * Constant for the fade in animation\r
+         * \r
+         * @type string\r
+         */\r
+        FADE_IN: "TVFadeIn",\r
+\r
+        /**\r
+         * Constant for the fade out animation\r
+         * \r
+         * @type string\r
+         */\r
+        FADE_OUT: "TVFadeOut",\r
+\r
+        /**\r
+         * Returns a ygAnim instance of the given type\r
+         *\r
+         * @param type {string} the type of animation\r
+         * @param el {HTMLElement} the element to element (probably the children div)\r
+         * @param callback {function} function to invoke when the animation is done.\r
+         * @return {YAHOO.util.Animation} the animation instance\r
+         */\r
+        getAnim: function(type, el, callback) {\r
+            if (YAHOO.widget[type]) {\r
+                return new YAHOO.widget[type](el, callback);\r
+            } else {\r
+                return null;\r
+            }\r
+        },\r
+\r
+        /**\r
+         * Returns true if the specified animation class is available\r
+         *\r
+         * @param type {string} the type of animation\r
+         * @return {boolean} true if valid, false if not\r
+         */\r
+        isValid: function(type) {\r
+            return (YAHOO.widget[type]);\r
+        }\r
+    };\r
+} ();\r
+\r
+/**\r
+ * A 1/2 second fade-in animation.\r
+ *\r
+ * @constructor\r
+ * @param el {HTMLElement} the element to animate\r
+ * @param callback {function} function to invoke when the animation is finished\r
+ */\r
+YAHOO.widget.TVFadeIn = function(el, callback) {\r
+    /**\r
+     * The element to animate\r
+     * @type HTMLElement\r
+     */\r
+    this.el = el;\r
+\r
+    /**\r
+     * the callback to invoke when the animation is complete\r
+     *\r
+     * @type function\r
+     */\r
+    this.callback = callback;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+};\r
+\r
+/**\r
+ * Performs the animation\r
+ */\r
+YAHOO.widget.TVFadeIn.prototype = {\r
+    animate: function() {\r
+        var tvanim = this;\r
+\r
+        var s = this.el.style;\r
+        s.opacity = 0.1;\r
+        s.filter = "alpha(opacity=10)";\r
+        s.display = "";\r
+\r
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;\r
+        var dur = 0.4; \r
+        // this.logger.log("duration: " + dur);\r
+        // var a = new ygAnim_Fade(this.el, dur, 1);\r
+        // a.setStart(0.1);\r
+        // a.onComplete = function() { tvanim.onComplete(); };\r
+\r
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 0.1, 1);\r
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);\r
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );\r
+        a.animate();\r
+    },\r
+\r
+    /**\r
+     * Clean up and invoke callback\r
+     */\r
+    onComplete: function() {\r
+        this.callback();\r
+    },\r
+\r
+    toString: function() {\r
+        return "TVFadeIn";\r
+    }\r
+};\r
+\r
+/**\r
+ * A 1/2 second fade out animation.\r
+ *\r
+ * @constructor\r
+ * @param el {HTMLElement} the element to animate\r
+ * @param callback {Function} function to invoke when the animation is finished\r
+ */\r
+YAHOO.widget.TVFadeOut = function(el, callback) {\r
+    /**\r
+     * The element to animate\r
+     * @type HTMLElement\r
+     */\r
+    this.el = el;\r
+\r
+    /**\r
+     * the callback to invoke when the animation is complete\r
+     *\r
+     * @type function\r
+     */\r
+    this.callback = callback;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+    this.logger = new YAHOO.widget.LogWriter(this.toString());\r
+};\r
+\r
+/**\r
+ * Performs the animation\r
+ */\r
+YAHOO.widget.TVFadeOut.prototype = {\r
+    animate: function() {\r
+        var tvanim = this;\r
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;\r
+        var dur = 0.4;\r
+        // this.logger.log("duration: " + dur);\r
+        // var a = new ygAnim_Fade(this.el, dur, 0.1);\r
+        // a.onComplete = function() { tvanim.onComplete(); };\r
+\r
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 1, 0.1);\r
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);\r
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );\r
+        a.animate();\r
+    },\r
+\r
+    /**\r
+     * Clean up and invoke callback\r
+     */\r
+    onComplete: function() {\r
+        var s = this.el.style;\r
+        s.display = "none";\r
+        // s.opacity = 1;\r
+        s.filter = "alpha(opacity=100)";\r
+        this.callback();\r
+    },\r
+\r
+    toString: function() {\r
+        return "TVFadeOut";\r
+    }\r
+};\r
+\r
diff --git a/lib/yui/treeview/treeview-min.js b/lib/yui/treeview/treeview-min.js
new file mode 100755 (executable)
index 0000000..1cac0b6
--- /dev/null
@@ -0,0 +1 @@
+/*                                                                                                                                                      Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    Code licensed under the BSD License:                                                                                                                    http://developer.yahoo.net/yui/license.txt                                                                                                              version: 0.11.0                                                                                                                                         */ YAHOO.widget.TreeView=function(id){if(id){this.init(id);}};YAHOO.widget.TreeView.nodeCount=0;YAHOO.widget.TreeView.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,setExpandAnim:function(_2){if(YAHOO.widget.TVAnim.isValid(_2)){this._expandAnim=_2;}},setCollapseAnim:function(_3){if(YAHOO.widget.TVAnim.isValid(_3)){this._collapseAnim=_3;}},animateExpand:function(el){if(this._expandAnim&&this._animCount<this.maxAnim){var _5=this;var a=YAHOO.widget.TVAnim.getAnim(this._expandAnim,el,function(){_5.expandComplete();});if(a){++this._animCount;a.animate();}return true;}return false;},animateCollapse:function(el){if(this._collapseAnim&&this._animCount<this.maxAnim){var _7=this;var a=YAHOO.widget.TVAnim.getAnim(this._collapseAnim,el,function(){_7.collapseComplete();});if(a){++this._animCount;a.animate();}return true;}return false;},expandComplete:function(){--this._animCount;},collapseComplete:function(){--this._animCount;},init:function(id){this.id=id;if("string"!==typeof id){this._el=id;this.id=this.generateId(id);}this._nodes=[];YAHOO.widget.TreeView.trees[this.id]=this;this.root=new YAHOO.widget.RootNode(this);},draw:function(){var _8=this.root.getHtml();this.getEl().innerHTML=_8;this.firstDraw=false;},getEl:function(){if(!this._el){this._el=document.getElementById(this.id);}return this._el;},regNode:function(_9){this._nodes[_9.index]=_9;},getRoot:function(){return this.root;},setDynamicLoad:function(_10,_11){this.root.setDynamicLoad(_10,_11);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(_12){var n=this._nodes[_12];return (n)?n:null;},getNodeByProperty:function(_14,_15){for(var i in this._nodes){var n=this._nodes[i];if(n.data&&_15==n.data[_14]){return n;}}return null;},getNodesByProperty:function(_17,_18){var _19=[];for(var i in this._nodes){var n=this._nodes[i];if(n.data&&_18==n.data[_17]){_19.push(n);}}return (_19.length)?_19:null;},removeNode:function(_20,_21){if(_20.isRoot()){return false;}var p=_20.parent;if(p.parent){p=p.parent;}this._deleteNode(_20);if(_21&&p&&p.childrenRendered){p.refresh();}return true;},removeChildren:function(_23){while(_23.children.length){this._deleteNode(_23.children[0]);}_23.childrenRendered=false;_23.dynamicLoadComplete=false;_23.expand();_23.collapse();},_deleteNode:function(_24){this.removeChildren(_24);this.popNode(_24);},popNode:function(_25){var p=_25.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=_25){a[a.length]=p.children[i];}}p.children=a;p.childrenRendered=false;if(_25.previousSibling){_25.previousSibling.nextSibling=_25.nextSibling;}if(_25.nextSibling){_25.nextSibling.previousSibling=_25.previousSibling;}delete this._nodes[_25.index];},toString:function(){return "TreeView "+this.id;},generateId:function(el){var id=el.id;if(!id){id="yui-tv-auto-id-"+YAHOO.widget.TreeView.counter;YAHOO.widget.TreeView.counter++;}return id;},onExpand:function(_26){},onCollapse:function(_27){}};YAHOO.widget.TreeView.trees=[];YAHOO.widget.TreeView.counter=0;YAHOO.widget.TreeView.getTree=function(_28){var t=YAHOO.widget.TreeView.trees[_28];return (t)?t:null;};YAHOO.widget.TreeView.getNode=function(_30,_31){var t=YAHOO.widget.TreeView.getTree(_30);return (t)?t.getNodeByIndex(_31):null;};YAHOO.widget.TreeView.addHandler=function(el,_32,fn,_34){_34=(_34)?true:false;if(el.addEventListener){el.addEventListener(_32,fn,_34);}else{if(el.attachEvent){el.attachEvent("on"+_32,fn);}else{el["on"+_32]=fn;}}};YAHOO.widget.TreeView.preload=function(_35){_35=_35||"ygtv";var _36=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=0;i<_36.length;++i){sb[sb.length]="<span class=\""+_35+_36[i]+"\">&#160;</span>";}var f=document.createElement("DIV");var s=f.style;s.position="absolute";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(_40,_41,_42){if(_40){this.init(_40,_41,_42);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,_type:"Node",init:function(_43,_44,_45){this.data=_43;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=_45;if(_44){_44.appendChild(this);}},applyParent:function(_46){if(!_46){return false;}this.tree=_46.tree;this.parent=_46;this.depth=_46.depth+1;if(!this.href){this.href="javascript:"+this.getToggleLink();}if(!this.multiExpand){this.multiExpand=_46.multiExpand;}this.tree.regNode(this);_46.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}return true;},appendChild:function(_47){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=_47;_47.previousSibling=sib;}this.children[this.children.length]=_47;_47.applyParent(this);return _47;},appendTo:function(_49){return _49.appendChild(this);},insertBefore:function(_50){var p=_50.parent;if(p){if(this.tree){this.tree.popNode(this);}var _51=_50.isChildOf(p);p.children.splice(_51,0,this);if(_50.previousSibling){_50.previousSibling.nextSibling=this;}this.previousSibling=_50.previousSibling;this.nextSibling=_50;_50.previousSibling=this;this.applyParent(p);}return this;},insertAfter:function(_52){var p=_52.parent;if(p){if(this.tree){this.tree.popNode(this);}var _53=_52.isChildOf(p);if(!_52.nextSibling){return this.appendTo(p);}p.children.splice(_53+1,0,this);_52.nextSibling.previousSibling=this;this.previousSibling=_52;this.nextSibling=_52.nextSibling;_52.nextSibling=this;this.applyParent(p);}return this;},isChildOf:function(_54){if(_54&&_54.children){for(var i=0,len=_54.children.length;i<len;++i){if(_54.children[i]===this){return i;}}}return -1;},getSiblings:function(){return this.parent.children;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl())){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl())){this.getChildrenEl().style.display="none";}},getElId:function(){return "ygtv"+this.index;},getChildrenElId:function(){return "ygtvc"+this.index;},getToggleElId:function(){return "ygtvt"+this.index;},getEl:function(){return document.getElementById(this.getElId());},getChildrenEl:function(){return document.getElementById(this.getChildrenElId());},getToggleEl:function(){return document.getElementById(this.getToggleElId());},getToggleLink:function(){return "YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").toggle()";},collapse:function(){if(!this.expanded){return;}var ret=this.tree.onCollapse(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=false;return;}this.hideChildren();this.expanded=false;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}},expand:function(){if(this.expanded){return;}var ret=this.tree.onExpand(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=true;return;}if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}this.expanded=true;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}if(this.isLoading){this.expanded=false;return;}if(!this.multiExpand){var _56=this.getSiblings();for(var i=0;i<_56.length;++i){if(_56[i]!=this&&_56[i].expanded){_56[i].collapse();}}}this.showChildren();},getStyle:function(){if(this.isLoading){return "ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var _58="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){_58=(this.expanded)?"m":"p";}return "ygtv"+loc+_58;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}return s;},expandAll:function(){for(var i=0;i<this.children.length;++i){var c=this.children[i];if(c.isDynamic()){alert("Not supported (lazy load + expand all)");break;}else{if(!c.multiExpand){alert("Not supported (no multi-expand + expand all)");break;}else{c.expand();c.expandAll();}}}},collapseAll:function(){for(var i=0;i<this.children.length;++i){this.children[i].collapse();this.children[i].collapseAll();}},setDynamicLoad:function(_60,_61){if(_60){this.dataLoader=_60;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}if(_61){this.iconMode=_61;}},isRoot:function(){return (this==this.tree.root);},isDynamic:function(){var _62=(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));return _62;},getIconMode:function(){return (this.iconMode||this.tree.root.iconMode);},hasChildren:function(_63){return (this.children.length>0||(_63&&this.isDynamic()&&!this.dynamicLoadComplete));},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){var sb=[];sb[sb.length]="<div class=\"ygtvitem\" id=\""+this.getElId()+"\">";sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]="</div>";return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]="<div class=\"ygtvchildren\"";sb[sb.length]=" id=\""+this.getChildrenElId()+"\"";if(!this.expanded){sb[sb.length]=" style=\"display:none;\"";}sb[sb.length]=">";if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}sb[sb.length]="</div>";return sb.join("");},renderChildren:function(){var _64=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){_64.dataLoader(_64,function(){_64.loadComplete();});},10);}else{if(this.tree.root.dataLoader){setTimeout(function(){_64.tree.root.dataLoader(_64,function(){_64.loadComplete();});},10);}else{return "Error: data loader not found or not specified.";}}return "";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i<this.children.length;++i){this.children[i].childrenRendered=false;sb[sb.length]=this.children[i].getHtml();}this.childrenRendered=true;return sb.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.dynamicLoadComplete=true;this.isLoading=false;this.expand();this.tree.locked=false;},getAncestor:function(_65){if(_65>=this.depth||_65<0){return null;}var p=this.parent;while(p.depth>_65){p=p.parent;}return p;},getDepthStyle:function(_66){return (this.getAncestor(_66).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){return "";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return "Node ("+this.index+")";}};YAHOO.widget.RootNode=function(_67){this.init(null,null,true);this.tree=_67;};YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node();YAHOO.widget.RootNode.prototype.getNodeHtml=function(){return "";};YAHOO.widget.RootNode.prototype.toString=function(){return "RootNode";};YAHOO.widget.RootNode.prototype.loadComplete=function(){this.tree.draw();};YAHOO.widget.TextNode=function(_68,_69,_70){if(_68){this.init(_68,_69,_70);this.setUpLabel(_68);}};YAHOO.widget.TextNode.prototype=new YAHOO.widget.Node();YAHOO.widget.TextNode.prototype.labelStyle="ygtvlabel";YAHOO.widget.TextNode.prototype.labelElId=null;YAHOO.widget.TextNode.prototype.label=null;YAHOO.widget.TextNode.prototype.setUpLabel=function(_71){if(typeof _71=="string"){_71={label:_71};}this.label=_71.label;if(_71.href){this.href=_71.href;}if(_71.target){this.target=_71.target;}if(_71.style){this.labelStyle=_71.style;}this.labelElId="ygtvlabelel"+this.index;};YAHOO.widget.TextNode.prototype.getLabelEl=function(){return document.getElementById(this.labelElId);};YAHOO.widget.TextNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";sb[sb.length]="<tr>";for(i=0;i<this.depth;++i){sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&#160;</td>";}var _72="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";sb[sb.length]="<td";sb[sb.length]=" id=\""+this.getToggleElId()+"\"";sb[sb.length]=" class=\""+this.getStyle()+"\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"this.className=";sb[sb.length]=_72+".getHoverStyle()\"";sb[sb.length]=" onmouseout=\"this.className=";sb[sb.length]=_72+".getStyle()\"";}sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\">";sb[sb.length]="&#160;";sb[sb.length]="</td>";sb[sb.length]="<td>";sb[sb.length]="<a";sb[sb.length]=" id=\""+this.labelElId+"\"";sb[sb.length]=" class=\""+this.labelStyle+"\"";sb[sb.length]=" href=\""+this.href+"\"";sb[sb.length]=" target=\""+this.target+"\"";sb[sb.length]=" onclick=\"return "+_72+".onLabelClick("+_72+")\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"document.getElementById('";sb[sb.length]=this.getToggleElId()+"').className=";sb[sb.length]=_72+".getHoverStyle()\"";sb[sb.length]=" onmouseout=\"document.getElementById('";sb[sb.length]=this.getToggleElId()+"').className=";sb[sb.length]=_72+".getStyle()\"";}sb[sb.length]=" >";sb[sb.length]=this.label;sb[sb.length]="</a>";sb[sb.length]="</td>";sb[sb.length]="</tr>";sb[sb.length]="</table>";return sb.join("");};YAHOO.widget.TextNode.prototype.onLabelClick=function(me){};YAHOO.widget.TextNode.prototype.toString=function(){return "TextNode ("+this.index+") "+this.label;};YAHOO.widget.MenuNode=function(_74,_75,_76){if(_74){this.init(_74,_75,_76);this.setUpLabel(_74);}this.multiExpand=false;};YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode();YAHOO.widget.MenuNode.prototype.toString=function(){return "MenuNode ("+this.index+") "+this.label;};YAHOO.widget.HTMLNode=function(_77,_78,_79,_80){if(_77){this.init(_77,_78,_79);this.initContent(_77,_80);}};YAHOO.widget.HTMLNode.prototype=new YAHOO.widget.Node();YAHOO.widget.HTMLNode.prototype.contentStyle="ygtvhtml";YAHOO.widget.HTMLNode.prototype.contentElId=null;YAHOO.widget.HTMLNode.prototype.content=null;YAHOO.widget.HTMLNode.prototype.initContent=function(_81,_82){if(typeof _81=="string"){_81={html:_81};}this.html=_81.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=_82;};YAHOO.widget.HTMLNode.prototype.getContentEl=function(){return document.getElementById(this.contentElId);};YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";sb[sb.length]="<tr>";for(i=0;i<this.depth;++i){sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&#160;</td>";}if(this.hasIcon){sb[sb.length]="<td";sb[sb.length]=" id=\""+this.getToggleElId()+"\"";sb[sb.length]=" class=\""+this.getStyle()+"\"";sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"this.className=";sb[sb.length]="YAHOO.widget.TreeView.getNode('";sb[sb.length]=this.tree.id+"',"+this.index+").getHoverStyle()\"";sb[sb.length]=" onmouseout=\"this.className=";sb[sb.length]="YAHOO.widget.TreeView.getNode('";sb[sb.length]=this.tree.id+"',"+this.index+").getStyle()\"";}sb[sb.length]=">&#160;</td>";}sb[sb.length]="<td";sb[sb.length]=" id=\""+this.contentElId+"\"";sb[sb.length]=" class=\""+this.contentStyle+"\"";sb[sb.length]=" >";sb[sb.length]=this.html;sb[sb.length]="</td>";sb[sb.length]="</tr>";sb[sb.length]="</table>";return sb.join("");};YAHOO.widget.HTMLNode.prototype.toString=function(){return "HTMLNode ("+this.index+")";};YAHOO.widget.TVAnim=function(){return {FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(_83,el,_84){if(YAHOO.widget[_83]){return new YAHOO.widget[_83](el,_84);}else{return null;}},isValid:function(_85){return (YAHOO.widget[_85]);}};}();YAHOO.widget.TVFadeIn=function(el,_86){this.el=el;this.callback=_86;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var _87=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){_87.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return "TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,_89){this.el=el;this.callback=_89;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var _90=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){_90.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return "TVFadeOut";}};
\ No newline at end of file
diff --git a/lib/yui/treeview/treeview.js b/lib/yui/treeview/treeview.js
new file mode 100755 (executable)
index 0000000..62d9a77
--- /dev/null
@@ -0,0 +1,1960 @@
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * Contains the tree view state data and the root node.  This is an\r
+ * ordered tree; child nodes will be displayed in the order created, and\r
+ * there currently is no way to change this.\r
+ *\r
+ * @constructor\r
+ * @param {string|HTMLElement} id The id of the element, or the element\r
+ * itself that the tree will be inserted into.\r
+ */\r
+YAHOO.widget.TreeView = function(id) {\r
+    if (id) { this.init(id); }\r
+};\r
+\r
+/**\r
+ * Count of all nodes in all trees\r
+ * @type int\r
+ */\r
+YAHOO.widget.TreeView.nodeCount = 0;\r
+\r
+YAHOO.widget.TreeView.prototype = {\r
+\r
+    /**\r
+     * The id of tree container element\r
+     *\r
+     * @type String\r
+     */\r
+    id: null,\r
+\r
+    /**\r
+     * The host element for this tree\r
+     * @private\r
+     */\r
+    _el: null,\r
+\r
+     /**\r
+     * Flat collection of all nodes in this tree\r
+     *\r
+     * @type Node[]\r
+     * @private\r
+     */\r
+    _nodes: null,\r
+\r
+    /**\r
+     * We lock the tree control while waiting for the dynamic loader to return\r
+     *\r
+     * @type boolean\r
+     */\r
+    locked: false,\r
+\r
+    /**\r
+     * The animation to use for expanding children, if any\r
+     *\r
+     * @type string\r
+     * @private\r
+     */\r
+    _expandAnim: null,\r
+\r
+    /**\r
+     * The animation to use for collapsing children, if any\r
+     *\r
+     * @type string\r
+     * @private\r
+     */\r
+    _collapseAnim: null,\r
+\r
+    /**\r
+     * The current number of animations that are executing\r
+     *\r
+     * @type int\r
+     * @private\r
+     */\r
+    _animCount: 0,\r
+\r
+    /**\r
+     * The maximum number of animations to run at one time.\r
+     *\r
+     * @type int\r
+     */\r
+    maxAnim: 2,\r
+\r
+    /**\r
+     * Sets up the animation for expanding children\r
+     *\r
+     * @param {string} the type of animation (acceptable values defined in \r
+     * YAHOO.widget.TVAnim)\r
+     */\r
+    setExpandAnim: function(type) {\r
+        if (YAHOO.widget.TVAnim.isValid(type)) {\r
+            this._expandAnim = type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Sets up the animation for collapsing children\r
+     *\r
+     * @param {string} the type of animation (acceptable values defined in \r
+     * YAHOO.widget.TVAnim)\r
+     */\r
+    setCollapseAnim: function(type) {\r
+        if (YAHOO.widget.TVAnim.isValid(type)) {\r
+            this._collapseAnim = type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Perform the expand animation if configured, or just show the\r
+     * element if not configured or too many animations are in progress\r
+     *\r
+     * @param el {HTMLElement} the element to animate\r
+     * @return {boolean} true if animation could be invoked, false otherwise\r
+     */\r
+    animateExpand: function(el) {\r
+\r
+        if (this._expandAnim && this._animCount < this.maxAnim) {\r
+            // this.locked = true;\r
+            var tree = this;\r
+            var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el, \r
+                            function() { tree.expandComplete(); });\r
+            if (a) { \r
+                ++this._animCount;\r
+                a.animate();\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+        return false;\r
+    },\r
+\r
+    /**\r
+     * Perform the collapse animation if configured, or just show the\r
+     * element if not configured or too many animations are in progress\r
+     *\r
+     * @param el {HTMLElement} the element to animate\r
+     * @return {boolean} true if animation could be invoked, false otherwise\r
+     */\r
+    animateCollapse: function(el) {\r
+\r
+        if (this._collapseAnim && this._animCount < this.maxAnim) {\r
+            // this.locked = true;\r
+            var tree = this;\r
+            var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el, \r
+                            function() { tree.collapseComplete(); });\r
+            if (a) { \r
+                ++this._animCount;\r
+                a.animate();\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+        return false;\r
+    },\r
+\r
+    /**\r
+     * Function executed when the expand animation completes\r
+     */\r
+    expandComplete: function() {\r
+        --this._animCount;\r
+        // this.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Function executed when the collapse animation completes\r
+     */\r
+    collapseComplete: function() {\r
+        --this._animCount;\r
+        // this.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Initializes the tree\r
+     *\r
+     * @parm {string|HTMLElement} id the id of the element that will hold the tree\r
+     * @private\r
+     */\r
+    init: function(id) {\r
+\r
+        this.id = id;\r
+\r
+        if ("string" !== typeof id) {\r
+            this._el = id;\r
+            this.id = this.generateId(id);\r
+        }\r
+\r
+        this._nodes = [];\r
+\r
+        // store a global reference\r
+        YAHOO.widget.TreeView.trees[this.id] = this;\r
+\r
+        // Set up the root node\r
+        this.root = new YAHOO.widget.RootNode(this);\r
+\r
+\r
+    },\r
+\r
+    /**\r
+     * Renders the tree boilerplate and visible nodes\r
+     */\r
+    draw: function() {\r
+        var html = this.root.getHtml();\r
+        this.getEl().innerHTML = html;\r
+        this.firstDraw = false;\r
+    },\r
+\r
+    /**\r
+     * Returns the tree's host element\r
+     * @return {HTMLElement} the host element\r
+     */\r
+    getEl: function() {\r
+        if (! this._el) {\r
+            this._el = document.getElementById(this.id);\r
+        }\r
+        return this._el;\r
+    },\r
+\r
+    /**\r
+     * Nodes register themselves with the tree instance when they are created.\r
+     *\r
+     * @param node {Node} the node to register\r
+     * @private\r
+     */\r
+    regNode: function(node) {\r
+        this._nodes[node.index] = node;\r
+    },\r
+\r
+    /**\r
+     * Returns the root node of this tree\r
+     *\r
+     * @return {Node} the root node\r
+     */\r
+    getRoot: function() {\r
+        return this.root;\r
+    },\r
+\r
+    /**\r
+     * Configures this tree to dynamically load all child data\r
+     *\r
+     * @param {function} fnDataLoader the function that will be called to get the data\r
+     * @param iconMode {int} configures the icon that is displayed when a dynamic\r
+     * load node is expanded the first time without children.  By default, the \r
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be\r
+     * displayed.\r
+     */\r
+    setDynamicLoad: function(fnDataLoader, iconMode) { \r
+        this.root.setDynamicLoad(fnDataLoader, iconMode);\r
+    },\r
+\r
+    /**\r
+     * Expands all child nodes.  Note: this conflicts with the "multiExpand"\r
+     * node property.  If expand all is called in a tree with nodes that\r
+     * do not allow multiple siblings to be displayed, only the last sibling\r
+     * will be expanded.\r
+     */\r
+    expandAll: function() { \r
+        if (!this.locked) {\r
+            this.root.expandAll(); \r
+        }\r
+    },\r
+\r
+    /**\r
+     * Collapses all expanded child nodes in the entire tree.\r
+     */\r
+    collapseAll: function() { \r
+        if (!this.locked) {\r
+            this.root.collapseAll(); \r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns a node in the tree that has the specified index (this index\r
+     * is created internally, so this function probably will only be used\r
+     * in html generated for a given node.)\r
+     *\r
+     * @param {int} nodeIndex the index of the node wanted\r
+     * @return {Node} the node with index=nodeIndex, null if no match\r
+     */\r
+    getNodeByIndex: function(nodeIndex) {\r
+        var n = this._nodes[nodeIndex];\r
+        return (n) ? n : null;\r
+    },\r
+\r
+    /**\r
+     * Returns a node that has a matching property and value in the data\r
+     * object that was passed into its constructor.\r
+     *\r
+     * @param {object} property the property to search (usually a string)\r
+     * @param {object} value the value we want to find (usuall an int or string)\r
+     * @return {Node} the matching node, null if no match\r
+     */\r
+    getNodeByProperty: function(property, value) {\r
+        for (var i in this._nodes) {\r
+            var n = this._nodes[i];\r
+            if (n.data && value == n.data[property]) {\r
+                return n;\r
+            }\r
+        }\r
+\r
+        return null;\r
+    },\r
+\r
+    /**\r
+     * Returns a collection of nodes that have a matching property \r
+     * and value in the data object that was passed into its constructor.  \r
+     *\r
+     * @param {object} property the property to search (usually a string)\r
+     * @param {object} value the value we want to find (usuall an int or string)\r
+     * @return {Array} the matching collection of nodes, null if no match\r
+     */\r
+    getNodesByProperty: function(property, value) {\r
+        var values = [];\r
+        for (var i in this._nodes) {\r
+            var n = this._nodes[i];\r
+            if (n.data && value == n.data[property]) {\r
+                values.push(n);\r
+            }\r
+        }\r
+\r
+        return (values.length) ? values : null;\r
+    },\r
+\r
+    /**\r
+     * Removes the node and its children, and optionally refreshes the branch \r
+     * of the tree that was affected.\r
+     * @param {Node} The node to remove\r
+     * @param {boolean} autoRefresh automatically refreshes branch if true\r
+     * @return {boolean} False is there was a problem, true otherwise.\r
+     */\r
+    removeNode: function(node, autoRefresh) { \r
+\r
+        // Don't delete the root node\r
+        if (node.isRoot()) {\r
+            return false;\r
+        }\r
+\r
+        // Get the branch that we may need to refresh\r
+        var p = node.parent;\r
+        if (p.parent) {\r
+            p = p.parent;\r
+        }\r
+\r
+        // Delete the node and its children\r
+        this._deleteNode(node);\r
+\r
+        // Refresh the parent of the parent\r
+        if (autoRefresh && p && p.childrenRendered) {\r
+            p.refresh();\r
+        }\r
+\r
+        return true;\r
+    },\r
+\r
+    /**\r
+     * Deletes this nodes child collection, recursively.  Also collapses\r
+     * the node, and resets the dynamic load flag.  The primary use for\r
+     * this method is to purge a node and allow it to fetch its data\r
+     * dynamically again.\r
+     * @param {Node} node the node to purge\r
+     */\r
+    removeChildren: function(node) { \r
+        while (node.children.length) {\r
+             this._deleteNode(node.children[0]);\r
+        }\r
+\r
+        node.childrenRendered = false;\r
+        node.dynamicLoadComplete = false;\r
+        // node.collapse();\r
+        node.expand();\r
+        node.collapse();\r
+    },\r
+\r
+    /**\r
+     * Deletes the node and recurses children\r
+     * @private\r
+     */\r
+    _deleteNode: function(node) { \r
+        // Remove all the child nodes first\r
+        this.removeChildren(node);\r
+\r
+        // Remove the node from the tree\r
+        this.popNode(node);\r
+    },\r
+\r
+    /**\r
+     * Removes the branch from the tree.  This differs from removeNode in\r
+     * that the child collection is preserved to make it possible to\r
+     * insert the branch into another part of the tree, or another tree.\r
+     * @param {Node} the node to remove\r
+     */\r
+    popNode: function(node) { \r
+        var p = node.parent;\r
+\r
+        // Update the parent's collection of children\r
+        var a = [];\r
+\r
+        for (var i=0, len=p.children.length;i<len;++i) {\r
+            if (p.children[i] != node) {\r
+                a[a.length] = p.children[i];\r
+            }\r
+        }\r
+\r
+        p.children = a;\r
+\r
+        // reset the childrenRendered flag for the parent\r
+        p.childrenRendered = false;\r
+\r
+         // Update the sibling relationship\r
+        if (node.previousSibling) {\r
+            node.previousSibling.nextSibling = node.nextSibling;\r
+        }\r
+\r
+        if (node.nextSibling) {\r
+            node.nextSibling.previousSibling = node.previousSibling;\r
+        }\r
+\r
+        // Update the tree's node collection \r
+        delete this._nodes[node.index];\r
+    },\r
+\r
+    /**\r
+     * toString\r
+     * @return {string} string representation of the tree\r
+     */\r
+    toString: function() {\r
+        return "TreeView " + this.id;\r
+    },\r
+\r
+    /**\r
+     * private\r
+     */\r
+    generateId: function(el) {\r
+        var id = el.id;\r
+\r
+        if (!id) {\r
+            id = "yui-tv-auto-id-" + YAHOO.widget.TreeView.counter;\r
+            YAHOO.widget.TreeView.counter++;\r
+        }\r
+\r
+        return id;\r
+    },\r
+\r
+    /**\r
+     * Abstract method that is executed when a node is expanded\r
+     * @param node {Node} the node that was expanded\r
+     */\r
+    onExpand: function(node) { },\r
+\r
+    /**\r
+     * Abstract method that is executed when a node is collapsed\r
+     * @param node {Node} the node that was collapsed.\r
+     */\r
+    onCollapse: function(node) { }\r
+\r
+};\r
+\r
+/**\r
+ * Global cache of tree instances\r
+ *\r
+ * @type Array\r
+ * @private\r
+ */\r
+YAHOO.widget.TreeView.trees = [];\r
+\r
+/**\r
+ * @private\r
+ */\r
+YAHOO.widget.TreeView.counter = 0;\r
+\r
+/**\r
+ * Global method for getting a tree by its id.  Used in the generated\r
+ * tree html.\r
+ *\r
+ * @param treeId {String} the id of the tree instance\r
+ * @return {TreeView} the tree instance requested, null if not found.\r
+ */\r
+YAHOO.widget.TreeView.getTree = function(treeId) {\r
+    var t = YAHOO.widget.TreeView.trees[treeId];\r
+    return (t) ? t : null;\r
+};\r
+\r
+/**\r
+ * Global method for getting a node by its id.  Used in the generated\r
+ * tree html.\r
+ *\r
+ * @param treeId {String} the id of the tree instance\r
+ * @param nodeIndex {String} the index of the node to return\r
+ * @return {Node} the node instance requested, null if not found\r
+ */\r
+YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) {\r
+    var t = YAHOO.widget.TreeView.getTree(treeId);\r
+    return (t) ? t.getNodeByIndex(nodeIndex) : null;\r
+};\r
+\r
+/**\r
+ * Adds an event.  Replace with event manager when available\r
+ *\r
+ * @param el the elment to bind the handler to\r
+ * @param {string} sType the type of event handler\r
+ * @param {function} fn the callback to invoke\r
+ * @param {boolean} capture if true event is capture phase, bubble otherwise\r
+ */\r
+YAHOO.widget.TreeView.addHandler = function (el, sType, fn, capture) {\r
+    capture = (capture) ? true : false;\r
+    if (el.addEventListener) {\r
+        el.addEventListener(sType, fn, capture);\r
+    } else if (el.attachEvent) {\r
+        el.attachEvent("on" + sType, fn);\r
+    } else {\r
+        el["on" + sType] = fn;\r
+    }\r
+};\r
+\r
+/**\r
+ * Attempts to preload the images defined in the styles used to draw the tree by\r
+ * rendering off-screen elements that use the styles.\r
+ */\r
+YAHOO.widget.TreeView.preload = function(prefix) {\r
+    prefix = prefix || "ygtv";\r
+    var styles = ["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];\r
+\r
+    var sb = [];\r
+    \r
+    for (var i = 0; i < styles.length; ++i) { \r
+        sb[sb.length] = '<span class="' + prefix + styles[i] + '">&#160;</span>';\r
+    }\r
+\r
+    var f = document.createElement("DIV");\r
+    var s = f.style;\r
+    s.position = "absolute";\r
+    s.top = "-1000px";\r
+    s.left = "-1000px";\r
+    f.innerHTML = sb.join("");\r
+\r
+    document.body.appendChild(f);\r
+};\r
+\r
+YAHOO.widget.TreeView.addHandler(window, \r
+                "load", YAHOO.widget.TreeView.preload);\r
+\r
+/**\r
+ * The base class for all tree nodes.  The node's presentation and behavior in\r
+ * response to mouse events is handled in Node subclasses.\r
+ *\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ * @constructor\r
+ */\r
+YAHOO.widget.Node = function(oData, oParent, expanded) {\r
+    if (oData) { this.init(oData, oParent, expanded); }\r
+};\r
+\r
+YAHOO.widget.Node.prototype = {\r
+\r
+    /**\r
+     * The index for this instance obtained from global counter in YAHOO.widget.TreeView.\r
+     *\r
+     * @type int\r
+     */\r
+    index: 0,\r
+\r
+    /**\r
+     * This node's child node collection.\r
+     *\r
+     * @type Node[] \r
+     */\r
+    children: null,\r
+\r
+    /**\r
+     * Tree instance this node is part of\r
+     *\r
+     * @type TreeView\r
+     */\r
+    tree: null,\r
+\r
+    /**\r
+     * The data linked to this node.  This can be any object or primitive\r
+     * value, and the data can be used in getNodeHtml().\r
+     *\r
+     * @type object\r
+     */\r
+    data: null,\r
+\r
+    /**\r
+     * Parent node\r
+     *\r
+     * @type Node\r
+     */\r
+    parent: null,\r
+\r
+    /**\r
+     * The depth of this node.  We start at -1 for the root node.\r
+     *\r
+     * @type int\r
+     */\r
+    depth: -1,\r
+\r
+    /**\r
+     * The href for the node's label.  If one is not specified, the href will\r
+     * be set so that it toggles the node.\r
+     *\r
+     * @type string\r
+     */\r
+    href: null,\r
+\r
+    /**\r
+     * The label href target, defaults to current window\r
+     *\r
+     * @type string\r
+     */\r
+    target: "_self",\r
+\r
+    /**\r
+     * The node's expanded/collapsed state\r
+     *\r
+     * @type boolean\r
+     */\r
+    expanded: false,\r
+\r
+    /**\r
+     * Can multiple children be expanded at once?\r
+     *\r
+     * @type boolean\r
+     */\r
+    multiExpand: true,\r
+\r
+    /**\r
+     * Should we render children for a collapsed node?  It is possible that the\r
+     * implementer will want to render the hidden data...  @todo verify that we \r
+     * need this, and implement it if we do.\r
+     *\r
+     * @type boolean\r
+     */\r
+    renderHidden: false,\r
+\r
+    /**\r
+     * This flag is set to true when the html is generated for this node's\r
+     * children, and set to false when new children are added.\r
+     * @type boolean\r
+     */\r
+    childrenRendered: false,\r
+\r
+    /**\r
+     * Dynamically loaded nodes only fetch the data the first time they are\r
+     * expanded.  This flag is set to true once the data has been fetched.\r
+     * @type boolean\r
+     */\r
+    dynamicLoadComplete: false,\r
+\r
+    /**\r
+     * This node's previous sibling\r
+     *\r
+     * @type Node\r
+     */\r
+    previousSibling: null,\r
+\r
+    /**\r
+     * This node's next sibling\r
+     *\r
+     * @type Node\r
+     */\r
+    nextSibling: null,\r
+\r
+    /**\r
+     * We can set the node up to call an external method to get the child\r
+     * data dynamically.\r
+     *\r
+     * @type boolean\r
+     * @private\r
+     */\r
+    _dynLoad: false,\r
+\r
+    /**\r
+     * Function to execute when we need to get this node's child data.\r
+     *\r
+     * @type function\r
+     */\r
+    dataLoader: null,\r
+\r
+    /**\r
+     * This is true for dynamically loading nodes while waiting for the\r
+     * callback to return.\r
+     *\r
+     * @type boolean\r
+     */\r
+    isLoading: false,\r
+\r
+    /**\r
+     * The toggle/branch icon will not show if this is set to false.  This\r
+     * could be useful if the implementer wants to have the child contain\r
+     * extra info about the parent, rather than an actual node.\r
+     *\r
+     * @type boolean\r
+     */\r
+    hasIcon: true,\r
+\r
+    /**\r
+     * Used to configure what happens when a dynamic load node is expanded\r
+     * and we discover that it does not have children.  By default, it is\r
+     * treated as if it still could have children (plus/minus icon).  Set\r
+     * iconMode to have it display like a leaf node instead.\r
+     * @type int\r
+     */\r
+    iconMode: 0,\r
+\r
+    /**\r
+     * The node type\r
+     * @private\r
+     */\r
+    _type: "Node",\r
+\r
+    /*\r
+    spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",\r
+    expandedText: "Expanded",\r
+    collapsedText: "Collapsed",\r
+    loadingText: "Loading",\r
+    */\r
+\r
+    /**\r
+     * Initializes this node, gets some of the properties from the parent\r
+     *\r
+     * @param oData {object} a string or object containing the data that will\r
+     * be used to render this node\r
+     * @param oParent {Node} this node's parent node\r
+     * @param expanded {boolean} the initial expanded/collapsed state\r
+     */\r
+    init: function(oData, oParent, expanded) {\r
+        this.data       = oData;\r
+        this.children   = [];\r
+        this.index      = YAHOO.widget.TreeView.nodeCount;\r
+        ++YAHOO.widget.TreeView.nodeCount;\r
+        this.expanded   = expanded;\r
+\r
+        // oParent should never be null except when we create the root node.\r
+        if (oParent) {\r
+            oParent.appendChild(this);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Certain properties for the node cannot be set until the parent\r
+     * is known. This is called after the node is inserted into a tree.\r
+     * the parent is also applied to this node's children in order to\r
+     * make it possible to move a branch from one tree to another.\r
+     * @param {Node} parentNode this node's parent node\r
+     */\r
+    applyParent: function(parentNode) {\r
+        if (!parentNode) {\r
+            return false;\r
+        }\r
+\r
+        this.tree   = parentNode.tree;\r
+        this.parent = parentNode;\r
+        this.depth  = parentNode.depth + 1;\r
+\r
+        if (! this.href) {\r
+            this.href = "javascript:" + this.getToggleLink();\r
+        }\r
+\r
+        if (! this.multiExpand) {\r
+            this.multiExpand = parentNode.multiExpand;\r
+        }\r
+\r
+        this.tree.regNode(this);\r
+        parentNode.childrenRendered = false;\r
+\r
+        // cascade update existing children\r
+        for (var i=0, len=this.children.length;i<len;++i) {\r
+            this.children[i].applyParent(this);\r
+        }\r
+\r
+        return true;\r
+    },\r
+\r
+    /**\r
+     * Appends a node to the child collection.\r
+     *\r
+     * @param childNode {Node} the new node\r
+     * @return {Node} the child node\r
+     * @private\r
+     */\r
+    appendChild: function(childNode) {\r
+        if (this.hasChildren()) {\r
+            var sib = this.children[this.children.length - 1];\r
+            sib.nextSibling = childNode;\r
+            childNode.previousSibling = sib;\r
+        }\r
+        this.children[this.children.length] = childNode;\r
+        childNode.applyParent(this);\r
+\r
+        return childNode;\r
+    },\r
+\r
+    /**\r
+     * Appends this node to the supplied node's child collection\r
+     * @param parentNode {Node} the node to append to.\r
+     */\r
+    appendTo: function(parentNode) {\r
+        return parentNode.appendChild(this);\r
+    },\r
+\r
+    /**\r
+    * Inserts this node before this supplied node\r
+    *\r
+    * @param node {Node} the node to insert this node before\r
+    * @return {Node} the inserted node\r
+    */\r
+    insertBefore: function(node) {\r
+        var p = node.parent;\r
+        if (p) {\r
+\r
+            if (this.tree) {\r
+                this.tree.popNode(this);\r
+            }\r
+\r
+            var refIndex = node.isChildOf(p);\r
+            p.children.splice(refIndex, 0, this);\r
+            if (node.previousSibling) {\r
+                node.previousSibling.nextSibling = this;\r
+            }\r
+            this.previousSibling = node.previousSibling;\r
+            this.nextSibling = node;\r
+            node.previousSibling = this;\r
+\r
+            this.applyParent(p);\r
+        }\r
+\r
+        return this;\r
+    },\r
\r
+    /**\r
+    * Inserts this node after the supplied node\r
+    *\r
+    * @param node {Node} the node to insert after\r
+    * @return {Node} the inserted node\r
+    */\r
+    insertAfter: function(node) {\r
+        var p = node.parent;\r
+        if (p) {\r
+\r
+            if (this.tree) {\r
+                this.tree.popNode(this);\r
+            }\r
+\r
+            var refIndex = node.isChildOf(p);\r
+\r
+            if (!node.nextSibling) {\r
+                return this.appendTo(p);\r
+            }\r
+\r
+            p.children.splice(refIndex + 1, 0, this);\r
+\r
+            node.nextSibling.previousSibling = this;\r
+            this.previousSibling = node;\r
+            this.nextSibling = node.nextSibling;\r
+            node.nextSibling = this;\r
+\r
+            this.applyParent(p);\r
+        }\r
+\r
+        return this;\r
+    },\r
+\r
+    /**\r
+    * Returns true if the Node is a child of supplied Node\r
+    *\r
+    * @param parentNode {Node} the Node to check\r
+    * @return {boolean} The node index if this Node is a child of \r
+    *                   supplied Node, else -1.\r
+    * @private\r
+    */\r
+    isChildOf: function(parentNode) {\r
+        if (parentNode && parentNode.children) {\r
+            for (var i=0, len=parentNode.children.length; i<len ; ++i) {\r
+                if (parentNode.children[i] === this) {\r
+                    return i;\r
+                }\r
+            }\r
+        }\r
+\r
+        return -1;\r
+    },\r
+\r
+    /**\r
+     * Returns a node array of this node's siblings, null if none.\r
+     *\r
+     * @return Node[]\r
+     */\r
+    getSiblings: function() {\r
+        return this.parent.children;\r
+    },\r
+\r
+    /**\r
+     * Shows this node's children\r
+     */\r
+    showChildren: function() {\r
+        if (!this.tree.animateExpand(this.getChildrenEl())) {\r
+            if (this.hasChildren()) {\r
+                this.getChildrenEl().style.display = "";\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Hides this node's children\r
+     */\r
+    hideChildren: function() {\r
+\r
+        if (!this.tree.animateCollapse(this.getChildrenEl())) {\r
+            this.getChildrenEl().style.display = "none";\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's container div\r
+     *\r
+     * @return {string} the element id\r
+     */\r
+    getElId: function() {\r
+        return "ygtv" + this.index;\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's children div\r
+     *\r
+     * @return {string} the element id for this node's children div\r
+     */\r
+    getChildrenElId: function() {\r
+        return "ygtvc" + this.index;\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's toggle element\r
+     *\r
+     * @return {string} the toggel element id\r
+     */\r
+    getToggleElId: function() {\r
+        return "ygtvt" + this.index;\r
+    },\r
+\r
+    /**\r
+     * Returns the id for this node's spacer image.  The spacer is positioned\r
+     * over the toggle and provides feedback for screen readers.\r
+     * @return {string} the id for the spacer image\r
+     */\r
+    /*\r
+    getSpacerId: function() {\r
+        return "ygtvspacer" + this.index;\r
+    }, \r
+    */\r
+\r
+    /**\r
+     * Returns this node's container html element\r
+     * @return {HTMLElement} the container html element\r
+     */\r
+    getEl: function() {\r
+        return document.getElementById(this.getElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the div that was generated for this node's children\r
+     * @return {HTMLElement} this node's children div\r
+     */\r
+    getChildrenEl: function() {\r
+        return document.getElementById(this.getChildrenElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the element that is being used for this node's toggle.\r
+     * @return {HTMLElement} this node's toggle html element\r
+     */\r
+    getToggleEl: function() {\r
+        return document.getElementById(this.getToggleElId());\r
+    },\r
+\r
+    /**\r
+     * Returns the element that is being used for this node's spacer.\r
+     * @return {HTMLElement} this node's spacer html element\r
+     */\r
+    /*\r
+    getSpacer: function() {\r
+        return document.getElementById( this.getSpacerId() ) || {};\r
+    },\r
+    */\r
+\r
+    /*\r
+    getStateText: function() {\r
+        if (this.isLoading) {\r
+            return this.loadingText;\r
+        } else if (this.hasChildren(true)) {\r
+            if (this.expanded) {\r
+                return this.expandedText;\r
+            } else {\r
+                return this.collapsedText;\r
+            }\r
+        } else {\r
+            return "";\r
+        }\r
+    },\r
+    */\r
+\r
+    /**\r
+     * Generates the link that will invoke this node's toggle method\r
+     * @return {string} the javascript url for toggling this node\r
+     */\r
+    getToggleLink: function() {\r
+        return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + \r
+            this.index + ").toggle()";\r
+    },\r
+\r
+    /**\r
+     * Hides this nodes children (creating them if necessary), changes the\r
+     * toggle style.\r
+     */\r
+    collapse: function() {\r
+        // Only collapse if currently expanded\r
+        if (!this.expanded) { return; }\r
+\r
+        // fire the collapse event handler\r
+        var ret = this.tree.onCollapse(this);\r
+\r
+        if ("undefined" != typeof ret && !ret) {\r
+            return;\r
+        }\r
+\r
+        if (!this.getEl()) {\r
+            this.expanded = false;\r
+            return;\r
+        }\r
+\r
+        // hide the child div\r
+        this.hideChildren();\r
+        this.expanded = false;\r
+\r
+        if (this.hasIcon) {\r
+            this.getToggleEl().className = this.getStyle();\r
+        }\r
+\r
+        // this.getSpacer().title = this.getStateText();\r
+\r
+    },\r
+\r
+    /**\r
+     * Shows this nodes children (creating them if necessary), changes the\r
+     * toggle style, and collapses its siblings if multiExpand is not set.\r
+     */\r
+    expand: function() {\r
+        // Only expand if currently collapsed.\r
+        if (this.expanded) { return; }\r
+\r
+        // fire the expand event handler\r
+        var ret = this.tree.onExpand(this);\r
+\r
+        if ("undefined" != typeof ret && !ret) {\r
+            return;\r
+        }\r
+\r
+        if (!this.getEl()) {\r
+            this.expanded = true;\r
+            return;\r
+        }\r
+\r
+        if (! this.childrenRendered) {\r
+            this.getChildrenEl().innerHTML = this.renderChildren();\r
+        } else {\r
+        }\r
+\r
+        this.expanded = true;\r
+        if (this.hasIcon) {\r
+            this.getToggleEl().className = this.getStyle();\r
+        }\r
+\r
+        // this.getSpacer().title = this.getStateText();\r
+\r
+        // We do an extra check for children here because the lazy\r
+        // load feature can expose nodes that have no children.\r
+\r
+        // if (!this.hasChildren()) {\r
+        if (this.isLoading) {\r
+            this.expanded = false;\r
+            return;\r
+        }\r
+\r
+        if (! this.multiExpand) {\r
+            var sibs = this.getSiblings();\r
+            for (var i=0; i<sibs.length; ++i) {\r
+                if (sibs[i] != this && sibs[i].expanded) { \r
+                    sibs[i].collapse(); \r
+                }\r
+            }\r
+        }\r
+\r
+        this.showChildren();\r
+    },\r
+\r
+    /**\r
+     * Returns the css style name for the toggle\r
+     *\r
+     * @return {string} the css class for this node's toggle\r
+     */\r
+    getStyle: function() {\r
+        if (this.isLoading) {\r
+            return "ygtvloading";\r
+        } else {\r
+            // location top or bottom, middle nodes also get the top style\r
+            var loc = (this.nextSibling) ? "t" : "l";\r
+\r
+            // type p=plus(expand), m=minus(collapase), n=none(no children)\r
+            var type = "n";\r
+            if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {\r
+            // if (this.hasChildren(true)) {\r
+                type = (this.expanded) ? "m" : "p";\r
+            }\r
+\r
+            return "ygtv" + loc + type;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the hover style for the icon\r
+     * @return {string} the css class hover state\r
+     */\r
+    getHoverStyle: function() { \r
+        var s = this.getStyle();\r
+        if (this.hasChildren(true) && !this.isLoading) { \r
+            s += "h"; \r
+        }\r
+        return s;\r
+    },\r
+\r
+    /**\r
+     * Recursively expands all of this node's children.\r
+     */\r
+    expandAll: function() { \r
+        for (var i=0;i<this.children.length;++i) {\r
+            var c = this.children[i];\r
+            if (c.isDynamic()) {\r
+                alert("Not supported (lazy load + expand all)");\r
+                break;\r
+            } else if (! c.multiExpand) {\r
+                alert("Not supported (no multi-expand + expand all)");\r
+                break;\r
+            } else {\r
+                c.expand();\r
+                c.expandAll();\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Recursively collapses all of this node's children.\r
+     */\r
+    collapseAll: function() { \r
+        for (var i=0;i<this.children.length;++i) {\r
+            this.children[i].collapse();\r
+            this.children[i].collapseAll();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Configures this node for dynamically obtaining the child data\r
+     * when the node is first expanded.  Calling it without the callback\r
+     * will turn off dynamic load for the node.\r
+     *\r
+     * @param fmDataLoader {function} the function that will be used to get the data.\r
+     * @param iconMode {int} configures the icon that is displayed when a dynamic\r
+     * load node is expanded the first time without children.  By default, the \r
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be\r
+     * displayed.\r
+     */\r
+    setDynamicLoad: function(fnDataLoader, iconMode) { \r
+        if (fnDataLoader) {\r
+            this.dataLoader = fnDataLoader;\r
+            this._dynLoad = true;\r
+        } else {\r
+            this.dataLoader = null;\r
+            this._dynLoad = false;\r
+        }\r
+\r
+        if (iconMode) {\r
+            this.iconMode = iconMode;\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Evaluates if this node is the root node of the tree\r
+     *\r
+     * @return {boolean} true if this is the root node\r
+     */\r
+    isRoot: function() { \r
+        return (this == this.tree.root);\r
+    },\r
+\r
+    /**\r
+     * Evaluates if this node's children should be loaded dynamically.  Looks for\r
+     * the property both in this instance and the root node.  If the tree is\r
+     * defined to load all children dynamically, the data callback function is\r
+     * defined in the root node\r
+     *\r
+     * @return {boolean} true if this node's children are to be loaded dynamically\r
+     */\r
+    isDynamic: function() { \r
+        var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));\r
+        return lazy;\r
+    },\r
+\r
+    getIconMode: function() {\r
+        return (this.iconMode || this.tree.root.iconMode);\r
+    },\r
+\r
+    /**\r
+     * Checks if this node has children.  If this node is lazy-loading and the\r
+     * children have not been rendered, we do not know whether or not there\r
+     * are actual children.  In most cases, we need to assume that there are\r
+     * children (for instance, the toggle needs to show the expandable \r
+     * presentation state).  In other times we want to know if there are rendered\r
+     * children.  For the latter, "checkForLazyLoad" should be false.\r
+     *\r
+     * @param checkForLazyLoad {boolean} should we check for unloaded children?\r
+     * @return {boolean} true if this has children or if it might and we are\r
+     * checking for this condition.\r
+     */\r
+    hasChildren: function(checkForLazyLoad) { \r
+        return ( this.children.length > 0 || \r
+                (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );\r
+    },\r
+\r
+    /**\r
+     * Expands if node is collapsed, collapses otherwise.\r
+     */\r
+    toggle: function() {\r
+        if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {\r
+            if (this.expanded) { this.collapse(); } else { this.expand(); }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Returns the markup for this node and its children.\r
+     *\r
+     * @return {string} the markup for this node and its expanded children.\r
+     */\r
+    getHtml: function() {\r
+        var sb = [];\r
+        sb[sb.length] = '<div class="ygtvitem" id="' + this.getElId() + '">';\r
+        sb[sb.length] = this.getNodeHtml();\r
+        sb[sb.length] = this.getChildrenHtml();\r
+        sb[sb.length] = '</div>';\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Called when first rendering the tree.  We always build the div that will\r
+     * contain this nodes children, but we don't render the children themselves\r
+     * unless this node is expanded.\r
+     *\r
+     * @return {string} the children container div html and any expanded children\r
+     * @private\r
+     */\r
+    getChildrenHtml: function() {\r
+\r
+        var sb = [];\r
+        sb[sb.length] = '<div class="ygtvchildren"';\r
+        sb[sb.length] = ' id="' + this.getChildrenElId() + '"';\r
+        if (!this.expanded) {\r
+            sb[sb.length] = ' style="display:none;"';\r
+        }\r
+        sb[sb.length] = '>';\r
+\r
+        // Don't render the actual child node HTML unless this node is expanded.\r
+        if ( (this.hasChildren(true) && this.expanded) ||\r
+                (this.renderHidden && !this.isDynamic()) ) {\r
+            sb[sb.length] = this.renderChildren();\r
+        }\r
+\r
+        sb[sb.length] = '</div>';\r
+\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Generates the markup for the child nodes.  This is not done until the node\r
+     * is expanded.\r
+     *\r
+     * @return {string} the html for this node's children\r
+     * @private\r
+     */\r
+    renderChildren: function() {\r
+\r
+\r
+        var node = this;\r
+\r
+        if (this.isDynamic() && !this.dynamicLoadComplete) {\r
+            this.isLoading = true;\r
+            this.tree.locked = true;\r
+\r
+            if (this.dataLoader) {\r
+\r
+                setTimeout( \r
+                    function() {\r
+                        node.dataLoader(node, \r
+                            function() { \r
+                                node.loadComplete(); \r
+                            });\r
+                    }, 10);\r
+                \r
+            } else if (this.tree.root.dataLoader) {\r
+\r
+                setTimeout( \r
+                    function() {\r
+                        node.tree.root.dataLoader(node, \r
+                            function() { \r
+                                node.loadComplete(); \r
+                            });\r
+                    }, 10);\r
+\r
+            } else {\r
+                return "Error: data loader not found or not specified.";\r
+            }\r
+\r
+            return "";\r
+\r
+        } else {\r
+            return this.completeRender();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Called when we know we have all the child data.\r
+     * @return {string} children html\r
+     */\r
+    completeRender: function() {\r
+        var sb = [];\r
+\r
+        for (var i=0; i < this.children.length; ++i) {\r
+            this.children[i].childrenRendered = false;\r
+            sb[sb.length] = this.children[i].getHtml();\r
+        }\r
+        \r
+        this.childrenRendered = true;\r
+\r
+        return sb.join("");\r
+    },\r
+\r
+    /**\r
+     * Load complete is the callback function we pass to the data provider\r
+     * in dynamic load situations.\r
+     */\r
+    loadComplete: function() {\r
+        this.getChildrenEl().innerHTML = this.completeRender();\r
+        this.dynamicLoadComplete = true;\r
+        this.isLoading = false;\r
+        this.expand();\r
+        this.tree.locked = false;\r
+    },\r
+\r
+    /**\r
+     * Returns this node's ancestor at the specified depth.\r
+     *\r
+     * @param {int} depth the depth of the ancestor.\r
+     * @return {Node} the ancestor\r
+     */\r
+    getAncestor: function(depth) {\r
+        if (depth >= this.depth || depth < 0)  {\r
+            return null;\r
+        }\r
+\r
+        var p = this.parent;\r
+        \r
+        while (p.depth > depth) {\r
+            p = p.parent;\r
+        }\r
+\r
+        return p;\r
+    },\r
+\r
+    /**\r
+     * Returns the css class for the spacer at the specified depth for\r
+     * this node.  If this node's ancestor at the specified depth\r
+     * has a next sibling the presentation is different than if it\r
+     * does not have a next sibling\r
+     *\r
+     * @param {int} depth the depth of the ancestor.\r
+     * @return {string} the css class for the spacer\r
+     */\r
+    getDepthStyle: function(depth) {\r
+        return (this.getAncestor(depth).nextSibling) ? \r
+            "ygtvdepthcell" : "ygtvblankdepthcell";\r
+    },\r
+\r
+    /**\r
+     * Get the markup for the node.  This is designed to be overrided so that we can\r
+     * support different types of nodes.\r
+     *\r
+     * @return {string} The HTML that will render this node.\r
+     */\r
+    getNodeHtml: function() { \r
+        return ""; \r
+    },\r
+\r
+    /**\r
+     * Regenerates the html for this node and its children.  To be used when the\r
+     * node is expanded and new children have been added.\r
+     */\r
+    refresh: function() {\r
+        // this.loadComplete();\r
+        this.getChildrenEl().innerHTML = this.completeRender();\r
+\r
+        if (this.hasIcon) {\r
+            var el = this.getToggleEl();\r
+            if (el) {\r
+                el.className = this.getStyle();\r
+            }\r
+        }\r
+    },\r
+\r
+    /**\r
+     * toString\r
+     * @return {string} string representation of the node\r
+     */\r
+    toString: function() {\r
+        return "Node (" + this.index + ")";\r
+    }\r
+\r
+};\r
+\r
+/**\r
+ * A custom YAHOO.widget.Node that handles the unique nature of \r
+ * the virtual, presentationless root node.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ */\r
+YAHOO.widget.RootNode = function(oTree) {\r
+       // Initialize the node with null params.  The root node is a\r
+       // special case where the node has no presentation.  So we have\r
+       // to alter the standard properties a bit.\r
+       this.init(null, null, true);\r
+       \r
+       /**\r
+        * For the root node, we get the tree reference from as a param\r
+        * to the constructor instead of from the parent element.\r
+        *\r
+        * @type TreeView\r
+        */\r
+       this.tree = oTree;\r
+};\r
+\r
+YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node();\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.RootNode.prototype.getNodeHtml = function() { \r
+       return ""; \r
+};\r
+\r
+YAHOO.widget.RootNode.prototype.toString = function() { \r
+    return "RootNode";\r
+};\r
+\r
+YAHOO.widget.RootNode.prototype.loadComplete = function() { \r
+    this.tree.draw();\r
+};\r
+/**\r
+ * The default node presentation.  The first parameter should be\r
+ * either a string that will be used as the node's label, or an object\r
+ * that has a string propery called label.  By default, the clicking the\r
+ * label will toggle the expanded/collapsed state of the node.  By\r
+ * changing the href property of the instance, this behavior can be\r
+ * changed so that the label will go to the specified href.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {YAHOO.widget.Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ */\r
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {\r
+    // this.type = "TextNode";\r
+\r
+    if (oData) { \r
+        this.init(oData, oParent, expanded);\r
+        this.setUpLabel(oData);\r
+    }\r
+\r
+    /**\r
+     * @private\r
+     */\r
+};\r
+\r
+YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node();\r
+\r
+/**\r
+ * The CSS class for the label href.  Defaults to ygtvlabel, but can be\r
+ * overridden to provide a custom presentation for a specific node.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel";\r
+\r
+/**\r
+ * The derived element id of the label for this node\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.labelElId = null;\r
+\r
+/**\r
+ * The text for the label.  It is assumed that the oData parameter will\r
+ * either be a string that will be used as the label, or an object that\r
+ * has a property called "label" that we will use.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.TextNode.prototype.label = null;\r
+\r
+/**\r
+ * Sets up the node label\r
+ * \r
+ * @param oData string containing the label, or an object with a label property\r
+ */\r
+YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { \r
+    if (typeof oData == "string") {\r
+        oData = { label: oData };\r
+    }\r
+    this.label = oData.label;\r
+    \r
+    // update the link\r
+    if (oData.href) {\r
+        this.href = oData.href;\r
+    }\r
+\r
+    // set the target\r
+    if (oData.target) {\r
+        this.target = oData.target;\r
+    }\r
+\r
+    if (oData.style) {\r
+        this.labelStyle = oData.style;\r
+    }\r
+\r
+    this.labelElId = "ygtvlabelel" + this.index;\r
+};\r
+\r
+/**\r
+ * Returns the label element\r
+ *\r
+ * @return {object} the element\r
+ */\r
+YAHOO.widget.TextNode.prototype.getLabelEl = function() { \r
+    return document.getElementById(this.labelElId);\r
+};\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.TextNode.prototype.getNodeHtml = function() { \r
+    var sb = [];\r
+\r
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';\r
+    sb[sb.length] = '<tr>';\r
+    \r
+    for (i=0;i<this.depth;++i) {\r
+        // sb[sb.length] = '<td class="ygtvdepthcell">&#160;</td>';\r
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';\r
+    }\r
+\r
+    var getNode = 'YAHOO.widget.TreeView.getNode(\'' +\r
+                    this.tree.id + '\',' + this.index + ')';\r
+\r
+    sb[sb.length] = '<td';\r
+    // sb[sb.length] = ' onselectstart="return false"';\r
+    sb[sb.length] = ' id="' + this.getToggleElId() + '"';\r
+    sb[sb.length] = ' class="' + this.getStyle() + '"';\r
+    if (this.hasChildren(true)) {\r
+        sb[sb.length] = ' onmouseover="this.className=';\r
+        sb[sb.length] = getNode + '.getHoverStyle()"';\r
+        sb[sb.length] = ' onmouseout="this.className=';\r
+        sb[sb.length] = getNode + '.getStyle()"';\r
+    }\r
+    sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">';\r
+\r
+    /*\r
+    sb[sb.length] = '<img id="' + this.getSpacerId() + '"';\r
+    sb[sb.length] = ' alt=""';\r
+    sb[sb.length] = ' tabindex=0';\r
+    sb[sb.length] = ' src="' + this.spacerPath + '"';\r
+    sb[sb.length] = ' title="' + this.getStateText() + '"';\r
+    sb[sb.length] = ' class="ygtvspacer"';\r
+    // sb[sb.length] = ' onkeypress="return ' + getNode + '".onKeyPress()"';\r
+    sb[sb.length] = ' />';\r
+    */\r
+\r
+    sb[sb.length] = '&#160;';\r
+\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '<td>';\r
+    sb[sb.length] = '<a';\r
+    sb[sb.length] = ' id="' + this.labelElId + '"';\r
+    sb[sb.length] = ' class="' + this.labelStyle + '"';\r
+    sb[sb.length] = ' href="' + this.href + '"';\r
+    sb[sb.length] = ' target="' + this.target + '"';\r
+    sb[sb.length] = ' onclick="return ' + getNode + '.onLabelClick(' + getNode +')"';\r
+    if (this.hasChildren(true)) {\r
+        sb[sb.length] = ' onmouseover="document.getElementById(\'';\r
+        sb[sb.length] = this.getToggleElId() + '\').className=';\r
+        sb[sb.length] = getNode + '.getHoverStyle()"';\r
+        sb[sb.length] = ' onmouseout="document.getElementById(\'';\r
+        sb[sb.length] = this.getToggleElId() + '\').className=';\r
+        sb[sb.length] = getNode + '.getStyle()"';\r
+    }\r
+    sb[sb.length] = ' >';\r
+    sb[sb.length] = this.label;\r
+    sb[sb.length] = '</a>';\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '</tr>';\r
+    sb[sb.length] = '</table>';\r
+\r
+    return sb.join("");\r
+};\r
+\r
+/**\r
+ * Executed when the label is clicked\r
+ * @param me {Node} this node\r
+ * @scope the anchor tag clicked\r
+ * @return false to cancel the anchor click\r
+ */\r
+YAHOO.widget.TextNode.prototype.onLabelClick = function(me) { \r
+    //return true;\r
+};\r
+\r
+YAHOO.widget.TextNode.prototype.toString = function() { \r
+    return "TextNode (" + this.index + ") " + this.label;\r
+};\r
+\r
+/**\r
+ * A menu-specific implementation that differs from TextNode in that only \r
+ * one sibling can be expanded at a time.\r
+ * @extends YAHOO.widget.TextNode\r
+ * @constructor\r
+ */\r
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {\r
+       if (oData) { \r
+               this.init(oData, oParent, expanded);\r
+               this.setUpLabel(oData);\r
+       }\r
+\r
+    /**\r
+     * Menus usually allow only one branch to be open at a time.\r
+     * @type boolean\r
+     */\r
+       this.multiExpand = false;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+\r
+};\r
+\r
+YAHOO.widget.MenuNode.prototype = new YAHOO.widget.TextNode();\r
+\r
+YAHOO.widget.MenuNode.prototype.toString = function() { \r
+    return "MenuNode (" + this.index + ") " + this.label;\r
+};\r
+\r
+/**\r
+ * This implementation takes either a string or object for the\r
+ * oData argument.  If is it a string, we will use it for the display\r
+ * of this node (and it can contain any html code).  If the parameter\r
+ * is an object, we look for a parameter called "html" that will be\r
+ * used for this node's display.\r
+ *\r
+ * @extends YAHOO.widget.Node\r
+ * @constructor\r
+ * @param oData {object} a string or object containing the data that will\r
+ * be used to render this node\r
+ * @param oParent {YAHOO.widget.Node} this node's parent node\r
+ * @param expanded {boolean} the initial expanded/collapsed state\r
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should\r
+ * have an icon\r
+ */\r
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {\r
+    if (oData) { \r
+        this.init(oData, oParent, expanded);\r
+        this.initContent(oData, hasIcon);\r
+    }\r
+};\r
+\r
+YAHOO.widget.HTMLNode.prototype = new YAHOO.widget.Node();\r
+\r
+/**\r
+ * The CSS class for the html content container.  Defaults to ygtvhtml, but \r
+ * can be overridden to provide a custom presentation for a specific node.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.contentStyle = "ygtvhtml";\r
+\r
+/**\r
+ * The generated id that will contain the data passed in by the implementer.\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.contentElId = null;\r
+\r
+/**\r
+ * The HTML content to use for this node's display\r
+ *\r
+ * @type string\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.content = null;\r
+\r
+/**\r
+ * Sets up the node label\r
+ *\r
+ * @param {object} An html string or object containing an html property\r
+ * @param {boolean} hasIcon determines if the node will be rendered with an\r
+ * icon or not\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.initContent = function(oData, hasIcon) { \r
+    if (typeof oData == "string") {\r
+        oData = { html: oData };\r
+    }\r
+\r
+    this.html = oData.html;\r
+    this.contentElId = "ygtvcontentel" + this.index;\r
+    this.hasIcon = hasIcon;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+};\r
+\r
+/**\r
+ * Returns the outer html element for this node's content\r
+ *\r
+ * @return {HTMLElement} the element\r
+ */\r
+YAHOO.widget.HTMLNode.prototype.getContentEl = function() { \r
+    return document.getElementById(this.contentElId);\r
+};\r
+\r
+// overrides YAHOO.widget.Node\r
+YAHOO.widget.HTMLNode.prototype.getNodeHtml = function() { \r
+    var sb = [];\r
+\r
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';\r
+    sb[sb.length] = '<tr>';\r
+    \r
+    for (i=0;i<this.depth;++i) {\r
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';\r
+    }\r
+\r
+    if (this.hasIcon) {\r
+        sb[sb.length] = '<td';\r
+        sb[sb.length] = ' id="' + this.getToggleElId() + '"';\r
+        sb[sb.length] = ' class="' + this.getStyle() + '"';\r
+        sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '"';\r
+        if (this.hasChildren(true)) {\r
+            sb[sb.length] = ' onmouseover="this.className=';\r
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';\r
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';\r
+            sb[sb.length] = ' onmouseout="this.className=';\r
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';\r
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';\r
+        }\r
+        sb[sb.length] = '>&#160;</td>';\r
+    }\r
+\r
+    sb[sb.length] = '<td';\r
+    sb[sb.length] = ' id="' + this.contentElId + '"';\r
+    sb[sb.length] = ' class="' + this.contentStyle + '"';\r
+    sb[sb.length] = ' >';\r
+    sb[sb.length] = this.html;\r
+    sb[sb.length] = '</td>';\r
+    sb[sb.length] = '</tr>';\r
+    sb[sb.length] = '</table>';\r
+\r
+    return sb.join("");\r
+};\r
+\r
+YAHOO.widget.HTMLNode.prototype.toString = function() { \r
+    return "HTMLNode (" + this.index + ")";\r
+};\r
+\r
+/**\r
+ * A static factory class for tree view expand/collapse animations\r
+ *\r
+ * @constructor\r
+ */\r
+YAHOO.widget.TVAnim = function() {\r
+    return {\r
+        /**\r
+         * Constant for the fade in animation\r
+         * \r
+         * @type string\r
+         */\r
+        FADE_IN: "TVFadeIn",\r
+\r
+        /**\r
+         * Constant for the fade out animation\r
+         * \r
+         * @type string\r
+         */\r
+        FADE_OUT: "TVFadeOut",\r
+\r
+        /**\r
+         * Returns a ygAnim instance of the given type\r
+         *\r
+         * @param type {string} the type of animation\r
+         * @param el {HTMLElement} the element to element (probably the children div)\r
+         * @param callback {function} function to invoke when the animation is done.\r
+         * @return {YAHOO.util.Animation} the animation instance\r
+         */\r
+        getAnim: function(type, el, callback) {\r
+            if (YAHOO.widget[type]) {\r
+                return new YAHOO.widget[type](el, callback);\r
+            } else {\r
+                return null;\r
+            }\r
+        },\r
+\r
+        /**\r
+         * Returns true if the specified animation class is available\r
+         *\r
+         * @param type {string} the type of animation\r
+         * @return {boolean} true if valid, false if not\r
+         */\r
+        isValid: function(type) {\r
+            return (YAHOO.widget[type]);\r
+        }\r
+    };\r
+} ();\r
+\r
+/**\r
+ * A 1/2 second fade-in animation.\r
+ *\r
+ * @constructor\r
+ * @param el {HTMLElement} the element to animate\r
+ * @param callback {function} function to invoke when the animation is finished\r
+ */\r
+YAHOO.widget.TVFadeIn = function(el, callback) {\r
+    /**\r
+     * The element to animate\r
+     * @type HTMLElement\r
+     */\r
+    this.el = el;\r
+\r
+    /**\r
+     * the callback to invoke when the animation is complete\r
+     *\r
+     * @type function\r
+     */\r
+    this.callback = callback;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+};\r
+\r
+/**\r
+ * Performs the animation\r
+ */\r
+YAHOO.widget.TVFadeIn.prototype = {\r
+    animate: function() {\r
+        var tvanim = this;\r
+\r
+        var s = this.el.style;\r
+        s.opacity = 0.1;\r
+        s.filter = "alpha(opacity=10)";\r
+        s.display = "";\r
+\r
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;\r
+        var dur = 0.4; \r
+        // var a = new ygAnim_Fade(this.el, dur, 1);\r
+        // a.setStart(0.1);\r
+        // a.onComplete = function() { tvanim.onComplete(); };\r
+\r
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 0.1, 1);\r
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);\r
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );\r
+        a.animate();\r
+    },\r
+\r
+    /**\r
+     * Clean up and invoke callback\r
+     */\r
+    onComplete: function() {\r
+        this.callback();\r
+    },\r
+\r
+    toString: function() {\r
+        return "TVFadeIn";\r
+    }\r
+};\r
+\r
+/**\r
+ * A 1/2 second fade out animation.\r
+ *\r
+ * @constructor\r
+ * @param el {HTMLElement} the element to animate\r
+ * @param callback {Function} function to invoke when the animation is finished\r
+ */\r
+YAHOO.widget.TVFadeOut = function(el, callback) {\r
+    /**\r
+     * The element to animate\r
+     * @type HTMLElement\r
+     */\r
+    this.el = el;\r
+\r
+    /**\r
+     * the callback to invoke when the animation is complete\r
+     *\r
+     * @type function\r
+     */\r
+    this.callback = callback;\r
+\r
+    /**\r
+     * @private\r
+     */\r
+};\r
+\r
+/**\r
+ * Performs the animation\r
+ */\r
+YAHOO.widget.TVFadeOut.prototype = {\r
+    animate: function() {\r
+        var tvanim = this;\r
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;\r
+        var dur = 0.4;\r
+        // var a = new ygAnim_Fade(this.el, dur, 0.1);\r
+        // a.onComplete = function() { tvanim.onComplete(); };\r
+\r
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 1, 0.1);\r
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);\r
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );\r
+        a.animate();\r
+    },\r
+\r
+    /**\r
+     * Clean up and invoke callback\r
+     */\r
+    onComplete: function() {\r
+        var s = this.el.style;\r
+        s.display = "none";\r
+        // s.opacity = 1;\r
+        s.filter = "alpha(opacity=100)";\r
+        this.callback();\r
+    },\r
+\r
+    toString: function() {\r
+        return "TVFadeOut";\r
+    }\r
+};\r
+\r
diff --git a/lib/yui/yahoo/README b/lib/yui/yahoo/README
new file mode 100755 (executable)
index 0000000..44207c1
--- /dev/null
@@ -0,0 +1,10 @@
+YAHOO Global Namespace - Release Notes\r
+\r
+0.11.0\r
+   * Added YAHOO.extend, which provides an easy way to assign the prototype,\r
+     constructor, and superclass properties inheritance properties.  It also\r
+     prevents the constructor of the superclass from being exectuted twice.\r
+\r
+0.10.0\r
+   * Added YAHOO.log that provides a safe way to plumb logging statements in\r
+     code that will work if the logging component isn't available.\r
diff --git a/lib/yui/yahoo/yahoo-debug.js b/lib/yui/yahoo/yahoo-debug.js
new file mode 100755 (executable)
index 0000000..0bf2365
--- /dev/null
@@ -0,0 +1,85 @@
+\r
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * The Yahoo global namespace\r
+ * @constructor\r
+ */\r
+var YAHOO = window.YAHOO || {};\r
+\r
+/**\r
+ * Returns the namespace specified and creates it if it doesn't exist\r
+ *\r
+ * YAHOO.namespace("property.package");\r
+ * YAHOO.namespace("YAHOO.property.package");\r
+ *\r
+ * Either of the above would create YAHOO.property, then\r
+ * YAHOO.property.package\r
+ *\r
+ * @param  {String} ns The name of the namespace\r
+ * @return {Object}    A reference to the namespace object\r
+ */\r
+YAHOO.namespace = function(ns) {\r
+\r
+    if (!ns || !ns.length) {\r
+        return null;\r
+    }\r
+\r
+    var levels = ns.split(".");\r
+    var nsobj = YAHOO;\r
+\r
+    // YAHOO is implied, so it is ignored if it is included\r
+    for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {\r
+        nsobj[levels[i]] = nsobj[levels[i]] || {};\r
+        nsobj = nsobj[levels[i]];\r
+    }\r
+\r
+    return nsobj;\r
+};\r
+\r
+/**\r
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is available.\r
+ *\r
+ * @param  {string}  sMsg       The message to log.\r
+ * @param  {string}  sCategory  The log category for the message.  Default\r
+ *                              categories are "info", "warn", "error", time".\r
+ *                              Custom categories can be used as well. (opt)\r
+ * @param  {string}  sSource    The source of the the message (opt)\r
+ * @return {boolean}            True if the log operation was successful.\r
+ */\r
+YAHOO.log = function(sMsg, sCategory, sSource) {\r
+    var l = YAHOO.widget.Logger;\r
+    if(l && l.log) {\r
+        return l.log(sMsg, sCategory, sSource);\r
+    } else {\r
+        return false;\r
+    }\r
+};\r
+\r
+/**\r
+ * Utility to set up the prototype, constructor and superclass properties to\r
+ * support an inheritance strategy that can chain constructors and methods.\r
+ *\r
+ * @param {Function} subclass   the object to modify\r
+ * @param {Function} superclass the object to inherit\r
+ */\r
+YAHOO.extend = function(subclass, superclass) {\r
+    var f = function() {};\r
+    f.prototype = superclass.prototype;\r
+    subclass.prototype = new f();\r
+    subclass.prototype.constructor = subclass;\r
+    subclass.superclass = superclass.prototype;\r
+    if (superclass.prototype.constructor == Object.prototype.constructor) {\r
+        superclass.prototype.constructor = superclass;\r
+    }\r
+};\r
+\r
+YAHOO.namespace("util");\r
+YAHOO.namespace("widget");\r
+YAHOO.namespace("example");\r
+\r
diff --git a/lib/yui/yahoo/yahoo-min.js b/lib/yui/yahoo/yahoo-min.js
new file mode 100755 (executable)
index 0000000..a2ef7c6
--- /dev/null
@@ -0,0 +1 @@
+/*                                                                                                                                                      Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    Code licensed under the BSD License:                                                                                                                    http://developer.yahoo.net/yui/license.txt                                                                                                              version: 0.11.0                                                                                                                                         */ var YAHOO=window.YAHOO||{};YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");
\ No newline at end of file
diff --git a/lib/yui/yahoo/yahoo.js b/lib/yui/yahoo/yahoo.js
new file mode 100755 (executable)
index 0000000..74aed95
--- /dev/null
@@ -0,0 +1,84 @@
+/*                                                                                                                                                      \r
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.                                                                                                    \r
+Code licensed under the BSD License:                                                                                                                    \r
+http://developer.yahoo.net/yui/license.txt                                                                                                              \r
+version: 0.11.0                                                                                                                                         \r
+*/ \r
+\r
+/**\r
+ * The Yahoo global namespace\r
+ * @constructor\r
+ */\r
+var YAHOO = window.YAHOO || {};\r
+\r
+/**\r
+ * Returns the namespace specified and creates it if it doesn't exist\r
+ *\r
+ * YAHOO.namespace("property.package");\r
+ * YAHOO.namespace("YAHOO.property.package");\r
+ *\r
+ * Either of the above would create YAHOO.property, then\r
+ * YAHOO.property.package\r
+ *\r
+ * @param  {String} ns The name of the namespace\r
+ * @return {Object}    A reference to the namespace object\r
+ */\r
+YAHOO.namespace = function(ns) {\r
+\r
+    if (!ns || !ns.length) {\r
+        return null;\r
+    }\r
+\r
+    var levels = ns.split(".");\r
+    var nsobj = YAHOO;\r
+\r
+    // YAHOO is implied, so it is ignored if it is included\r
+    for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {\r
+        nsobj[levels[i]] = nsobj[levels[i]] || {};\r
+        nsobj = nsobj[levels[i]];\r
+    }\r
+\r
+    return nsobj;\r
+};\r
+\r
+/**\r
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is available.\r
+ *\r
+ * @param  {string}  sMsg       The message to log.\r
+ * @param  {string}  sCategory  The log category for the message.  Default\r
+ *                              categories are "info", "warn", "error", time".\r
+ *                              Custom categories can be used as well. (opt)\r
+ * @param  {string}  sSource    The source of the the message (opt)\r
+ * @return {boolean}            True if the log operation was successful.\r
+ */\r
+YAHOO.log = function(sMsg, sCategory, sSource) {\r
+    var l = YAHOO.widget.Logger;\r
+    if(l && l.log) {\r
+        return l.log(sMsg, sCategory, sSource);\r
+    } else {\r
+        return false;\r
+    }\r
+};\r
+\r
+/**\r
+ * Utility to set up the prototype, constructor and superclass properties to\r
+ * support an inheritance strategy that can chain constructors and methods.\r
+ *\r
+ * @param {Function} subclass   the object to modify\r
+ * @param {Function} superclass the object to inherit\r
+ */\r
+YAHOO.extend = function(subclass, superclass) {\r
+    var f = function() {};\r
+    f.prototype = superclass.prototype;\r
+    subclass.prototype = new f();\r
+    subclass.prototype.constructor = subclass;\r
+    subclass.superclass = superclass.prototype;\r
+    if (superclass.prototype.constructor == Object.prototype.constructor) {\r
+        superclass.prototype.constructor = superclass;\r
+    }\r
+};\r
+\r
+YAHOO.namespace("util");\r
+YAHOO.namespace("widget");\r
+YAHOO.namespace("example");\r
+\r