[Catalyst-commits] r7186 - in trunk/examples/RestYUI: db lib/AdventREST/Controller lib/AdventREST/View root root/static root/static/yui t

jshirley at dev.catalyst.perl.org jshirley at dev.catalyst.perl.org
Wed Nov 28 19:55:11 GMT 2007


Author: jshirley
Date: 2007-11-28 19:55:11 +0000 (Wed, 28 Nov 2007)
New Revision: 7186

Added:
   trunk/examples/RestYUI/lib/AdventREST/View/TT.pm
   trunk/examples/RestYUI/root/index.tt
   trunk/examples/RestYUI/root/static/yui/
   trunk/examples/RestYUI/root/static/yui/animation.js
   trunk/examples/RestYUI/root/static/yui/autocomplete.js
   trunk/examples/RestYUI/root/static/yui/button-beta.js
   trunk/examples/RestYUI/root/static/yui/calendar.js
   trunk/examples/RestYUI/root/static/yui/colorpicker-beta.js
   trunk/examples/RestYUI/root/static/yui/connection.js
   trunk/examples/RestYUI/root/static/yui/container.js
   trunk/examples/RestYUI/root/static/yui/datasource-beta.js
   trunk/examples/RestYUI/root/static/yui/datatable-beta.js
   trunk/examples/RestYUI/root/static/yui/dom.js
   trunk/examples/RestYUI/root/static/yui/dragdrop.js
   trunk/examples/RestYUI/root/static/yui/editor-beta.js
   trunk/examples/RestYUI/root/static/yui/element-beta.js
   trunk/examples/RestYUI/root/static/yui/event.js
   trunk/examples/RestYUI/root/static/yui/history-beta.js
   trunk/examples/RestYUI/root/static/yui/logger.js
   trunk/examples/RestYUI/root/static/yui/menu.js
   trunk/examples/RestYUI/root/static/yui/slider.js
   trunk/examples/RestYUI/root/static/yui/tabview.js
   trunk/examples/RestYUI/root/static/yui/treeview.js
   trunk/examples/RestYUI/root/static/yui/utilities.js
   trunk/examples/RestYUI/root/static/yui/yahoo-dom-event.js
   trunk/examples/RestYUI/root/static/yui/yahoo.js
   trunk/examples/RestYUI/root/static/yui/yuiloader-beta.js
   trunk/examples/RestYUI/root/static/yui/yuitest-beta.js
   trunk/examples/RestYUI/t/view_TT.t
Modified:
   trunk/examples/RestYUI/db/adventrest.db
   trunk/examples/RestYUI/lib/AdventREST/Controller/Root.pm
   trunk/examples/RestYUI/lib/AdventREST/Controller/User.pm
Log:
Adding TT view and YUI files

Modified: trunk/examples/RestYUI/db/adventrest.db
===================================================================
(Binary files differ)

Modified: trunk/examples/RestYUI/lib/AdventREST/Controller/Root.pm
===================================================================
--- trunk/examples/RestYUI/lib/AdventREST/Controller/Root.pm	2007-11-28 19:55:03 UTC (rev 7185)
+++ trunk/examples/RestYUI/lib/AdventREST/Controller/Root.pm	2007-11-28 19:55:11 UTC (rev 7186)
@@ -33,9 +33,20 @@
 
     $c->response->status(404);
     $c->response->content_type('text/plain');
-    $c->response->body("Try going to " . $c->uri_for('/user'));
+    $c->response->body("Try going to " . $c->uri_for('index'));
 }
 
+=head2 index
+
+Displays a TT page for bootstraping the YUI DataTable components
+
+=cut
+
+sub index : Private {
+    my ( $self, $c ) = @_;
+    $c->forward( $c->view('TT') );
+}
+
 =head1 AUTHOR
 
 Adam Jacob

Modified: trunk/examples/RestYUI/lib/AdventREST/Controller/User.pm
===================================================================
--- trunk/examples/RestYUI/lib/AdventREST/Controller/User.pm	2007-11-28 19:55:03 UTC (rev 7185)
+++ trunk/examples/RestYUI/lib/AdventREST/Controller/User.pm	2007-11-28 19:55:11 UTC (rev 7186)
@@ -38,6 +38,9 @@
 sub user_list_GET {
     my ( $self, $c ) = @_;
 
+    $c->log->debug( $c->req->content_type );
+    $c->log->debug( $c->req->headers->as_string );
+
     my %user_list;
     my $user_rs = $c->model('DB::User')->search;
     while ( my $user_row = $user_rs->next ) {
@@ -45,6 +48,29 @@
           $c->uri_for( '/user/' . $user_row->user_id )->as_string;
     }
     $self->status_ok( $c, entity => \%user_list );
+
+    my $page     = $c->req->params->{page} || 1;
+    my $per_page = $c->req->params->{per_page} || 10;
+
+    # We'll use an array now:
+    my @user_list;
+    my $rs = $c->model('DB::User')
+        ->search(undef, { rows => $per_page })->page( $page );
+    while ( my $user_row = $rs->next ) {
+        push @user_list, {
+            $user_row->get_columns,
+            uri => $c->uri_for( '/user/' . $user_row->user_id )->as_string
+        };
+    }
+
+    $self->status_ok( $c, entity => {
+        result_set => {
+            totalResultsAvailable => $rs->pager->total_entries,
+            totalResultsReturned  => $rs->pager->entries_on_this_page,
+            firstResultPosition   => $rs->pager->current_page,
+            result => [ @user_list ]
+        }
+    });
 }
 
 =head2 single_user :Path('/user') :Args(1) :ActionClass('REST')

Added: trunk/examples/RestYUI/lib/AdventREST/View/TT.pm
===================================================================
--- trunk/examples/RestYUI/lib/AdventREST/View/TT.pm	                        (rev 0)
+++ trunk/examples/RestYUI/lib/AdventREST/View/TT.pm	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,31 @@
+package AdventREST::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+
+=head1 NAME
+
+AdventREST::View::TT - TT View for AdventREST
+
+=head1 DESCRIPTION
+
+TT View for AdventREST. 
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+L<AdventREST>
+
+J. Shirley,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;

Added: trunk/examples/RestYUI/root/index.tt
===================================================================
--- trunk/examples/RestYUI/root/index.tt	                        (rev 0)
+++ trunk/examples/RestYUI/root/index.tt	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+  <title>Advent!  Now with more AJAX</title>
+  <script type="text/javascript" src=""></script>
+ </head>
+ <body>
+  <div id="user_list"></div>
+  <script type="text/javascript">
+    /* Create the YAHOO.util.DataSource object, the parameter is the
+       URI to your REST service
+    */
+    this.myDataSource = new YAHOO.util.DataSource("[%
+         c.uri_for( c.controller('User').action_for('user_list') ) %]");
+    this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+    this.myDataSource.connXhrMode = "queueRequests";
+    this.myDataSource.responseSchema = {
+        resultsList: "result_set.result",
+        /* We have to define the fields for usage elsewhere */
+        fields: [
+            "pk1", "token", "default_lang", "languages",
+            "url", "t_created", "t_updated", "actions"
+        ]
+     };
+     
+     myDataTable = new YAHOO.widget.DataTable(
+        "user_list", myColumnDefs,
+        this.myDataSource, {
+            /* The initialRequest is appended to the URI to set params */
+            initialRequest: "page=1&content-type=text/x-json"
+        }
+     );
+  </script>
+ </body>
+</html>

Added: trunk/examples/RestYUI/root/static/yui/animation.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/animation.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/animation.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1375 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+*/
+
+/**
+ * The animation module provides allows effects to be added to HTMLElements.
+ * @module animation
+ * @requires yahoo, event, dom
+ */
+
+/**
+ *
+ * Base animation class that provides the interface for building animated effects.
+ * <p>Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);</p>
+ * @class Anim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent
+ * @constructor
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.  
+ * Each attribute is an object with at minimum a "to" or "by" member defined.  
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").  
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @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)
+ */
+
+YAHOO.util.Anim = function(el, attributes, duration, method) {
+    if (!el) {
+    }
+    this.init(el, attributes, duration, method); 
+};
+
+YAHOO.util.Anim.prototype = {
+    /**
+     * Provides a readable name for the Anim instance.
+     * @method toString
+     * @return {String}
+     */
+    toString: function() {
+        var el = this.getEl();
+        var id = el.id || el.tagName || el;
+        return ("Anim " + id);
+    },
+    
+    patterns: { // cached for performance
+        noNegatives:        /width|height|opacity|padding/i, // keep at zero or above
+        offsetAttribute:  /^((width|height)|(top|left))$/, // use offsetValue as default
+        defaultUnit:        /width|height|top$|bottom$|left$|right$/i, // use 'px' by default
+        offsetUnit:         /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset
+    },
+    
+    /**
+     * Returns the value computed by the animation's "method".
+     * @method doMethod
+     * @param {String} attr The name of the attribute.
+     * @param {Number} start The value this attribute should start from for this animation.
+     * @param {Number} end  The value this attribute should end at for this animation.
+     * @return {Number} The Value to be applied to the attribute.
+     */
+    doMethod: function(attr, start, end) {
+        return this.method(this.currentFrame, start, end - start, this.totalFrames);
+    },
+    
+    /**
+     * Applies a value to an attribute.
+     * @method setAttribute
+     * @param {String} attr The name of the attribute.
+     * @param {Number} val The value to be applied to the attribute.
+     * @param {String} unit The unit ('px', '%', etc.) of the value.
+     */
+    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);
+    },                        
+    
+    /**
+     * Returns current value of the attribute.
+     * @method getAttribute
+     * @param {String} attr The name of the attribute.
+     * @return {Number} val The current value of the attribute.
+     */
+    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] ); // top or left
+        var box = !!( a[2] ); // width or height
+        
+        // use offsets for width/height and abs pos top/left
+        if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
+            val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
+        } else { // default to zero for other 'auto'
+            val = 0;
+        }
+
+        return val;
+    },
+    
+    /**
+     * Returns the unit to use when none is supplied.
+     * @method getDefaultUnit
+     * @param {attr} attr The name of the attribute.
+     * @return {String} The default unit to be used.
+     */
+    getDefaultUnit: function(attr) {
+         if ( this.patterns.defaultUnit.test(attr) ) {
+            return 'px';
+         }
+         
+         return '';
+    },
+        
+    /**
+     * Sets the actual values to be used during the animation.  Should only be needed for subclass use.
+     * @method setRuntimeAttribute
+     * @param {Object} attr The attribute object
+     * @private 
+     */
+    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; // note return; nothing to animate to
+        }
+        
+        start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);
+
+        // To beats by, per SMIL 2.1 spec
+        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] * 1; // times 1 to cast "by" 
+                }
+            } else {
+                end = start + attributes[attr]['by'] * 1;
+            }
+        }
+        
+        this.runtimeAttributes[attr].start = start;
+        this.runtimeAttributes[attr].end = end;
+
+        // set units if needed
+        this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ?
+                attributes[attr]['unit'] : this.getDefaultUnit(attr);
+        return true;
+    },
+
+    /**
+     * Constructor for Anim instance.
+     * @method init
+     * @param {String | HTMLElement} el Reference to the element that will be animated
+     * @param {Object} attributes The attribute(s) to be animated.  
+     * Each attribute is an object with at minimum a "to" or "by" member defined.  
+     * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").  
+     * All attribute names use camelCase.
+     * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+     * @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)
+     */ 
+    init: function(el, attributes, duration, method) {
+        /**
+         * Whether or not the animation is running.
+         * @property isAnimated
+         * @private
+         * @type Boolean
+         */
+        var isAnimated = false;
+        
+        /**
+         * A Date object that is created when the animation begins.
+         * @property startTime
+         * @private
+         * @type Date
+         */
+        var startTime = null;
+        
+        /**
+         * The number of frames this animation was able to execute.
+         * @property actualFrames
+         * @private
+         * @type Int
+         */
+        var actualFrames = 0; 
+
+        /**
+         * The element to be animated.
+         * @property el
+         * @private
+         * @type HTMLElement
+         */
+        el = YAHOO.util.Dom.get(el);
+        
+        /**
+         * The collection of attributes to be animated.  
+         * Each attribute must have at least a "to" or "by" defined in order to animate.  
+         * If "to" is supplied, the animation will end with the attribute at that value.  
+         * If "by" is supplied, the animation will end at that value plus its starting value. 
+         * If both are supplied, "to" is used, and "by" is ignored. 
+         * 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).
+         * @property attributes
+         * @type Object
+         */
+        this.attributes = attributes || {};
+        
+        /**
+         * The length of the animation.  Defaults to "1" (second).
+         * @property duration
+         * @type Number
+         */
+        this.duration = !YAHOO.lang.isUndefined(duration) ? duration : 1;
+        
+        /**
+         * The method that will provide values to the attribute(s) during the animation. 
+         * Defaults to "YAHOO.util.Easing.easeNone".
+         * @property method
+         * @type Function
+         */
+        this.method = method || YAHOO.util.Easing.easeNone;
+
+        /**
+         * Whether or not the duration should be treated as seconds.
+         * Defaults to true.
+         * @property useSeconds
+         * @type Boolean
+         */
+        this.useSeconds = true; // default to seconds
+        
+        /**
+         * The location of the current animation on the timeline.
+         * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+         * @property currentFrame
+         * @type Int
+         */
+        this.currentFrame = 0;
+        
+        /**
+         * The total number of frames to be executed.
+         * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time.
+         * @property totalFrames
+         * @type Int
+         */
+        this.totalFrames = YAHOO.util.AnimMgr.fps;
+        
+        /**
+         * Changes the animated element
+         * @method setEl
+         */
+        this.setEl = function(element) {
+            el = YAHOO.util.Dom.get(element);
+        };
+        
+        /**
+         * Returns a reference to the animated element.
+         * @method getEl
+         * @return {HTMLElement}
+         */
+        this.getEl = function() { return el; };
+        
+        /**
+         * Checks whether the element is currently animated.
+         * @method isAnimated
+         * @return {Boolean} current value of isAnimated.     
+         */
+        this.isAnimated = function() {
+            return isAnimated;
+        };
+        
+        /**
+         * Returns the animation start time.
+         * @method getStartTime
+         * @return {Date} current value of startTime.      
+         */
+        this.getStartTime = function() {
+            return startTime;
+        };        
+        
+        this.runtimeAttributes = {};
+        
+        
+        
+        /**
+         * Starts the animation by registering it with the animation manager. 
+         * @method animate  
+         */
+        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;
+    
+            if (this.duration === 0 && this.useSeconds) {
+                this.totalFrames = 1; // jump to last frame if no duration
+            }
+            YAHOO.util.AnimMgr.registerElement(this);
+            return true;
+        };
+          
+        /**
+         * Stops the animation.  Normally called by AnimMgr when animation completes.
+         * @method stop
+         * @param {Boolean} finish (optional) If true, animation will jump to final frame.
+         */ 
+        this.stop = function(finish) {
+            if (finish) {
+                 this.currentFrame = this.totalFrames;
+                 this._onTween.fire();
+            }
+            YAHOO.util.AnimMgr.stop(this);
+        };
+        
+        var onStart = function() {            
+            this.onStart.fire();
+            
+            this.runtimeAttributes = {};
+            for (var attr in this.attributes) {
+                this.setRuntimeAttribute(attr);
+            }
+            
+            isAnimated = true;
+            actualFrames = 0;
+            startTime = new Date(); 
+        };
+        
+        /**
+         * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s).
+         * @private
+         */
+         
+        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);
+        };
+        
+        /**
+         * Custom event that fires after onStart, useful in subclassing
+         * @private
+         */    
+        this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
+
+        /**
+         * Custom event that fires when animation begins
+         * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction)
+         * @event onStart
+         */    
+        this.onStart = new YAHOO.util.CustomEvent('start', this);
+        
+        /**
+         * Custom event that fires between each frame
+         * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction)
+         * @event onTween
+         */
+        this.onTween = new YAHOO.util.CustomEvent('tween', this);
+        
+        /**
+         * Custom event that fires after onTween
+         * @private
+         */
+        this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
+        
+        /**
+         * Custom event that fires when animation ends
+         * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction)
+         * @event onComplete
+         */
+        this.onComplete = new YAHOO.util.CustomEvent('complete', this);
+        /**
+         * Custom event that fires after onComplete
+         * @private
+         */
+        this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);
+
+        this._onStart.subscribe(onStart);
+        this._onTween.subscribe(onTween);
+        this._onComplete.subscribe(onComplete);
+    }
+};
+
+/**
+ * Handles animation queueing and threading.
+ * Used by Anim and subclasses.
+ * @class AnimMgr
+ * @namespace YAHOO.util
+ */
+YAHOO.util.AnimMgr = new function() {
+    /** 
+     * Reference to the animation Interval.
+     * @property thread
+     * @private
+     * @type Int
+     */
+    var thread = null;
+    
+    /** 
+     * The current queue of registered animation objects.
+     * @property queue
+     * @private
+     * @type Array
+     */    
+    var queue = [];
+
+    /** 
+     * The number of active animations.
+     * @property tweenCount
+     * @private
+     * @type Int
+     */        
+    var tweenCount = 0;
+
+    /** 
+     * Base frame rate (frames per second). 
+     * Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
+     * @property fps
+     * @type Int
+     * 
+     */
+    this.fps = 1000;
+
+    /** 
+     * Interval delay in milliseconds, defaults to fastest possible.
+     * @property delay
+     * @type Int
+     * 
+     */
+    this.delay = 1;
+
+    /**
+     * Adds an animation instance to the animation queue.
+     * All animation instances must be registered in order to animate.
+     * @method registerElement
+     * @param {object} tween The Anim instance to be be registered
+     */
+    this.registerElement = function(tween) {
+        queue[queue.length] = tween;
+        tweenCount += 1;
+        tween._onStart.fire();
+        this.start();
+    };
+    
+    /**
+     * removes an animation instance from the animation queue.
+     * All animation instances must be registered in order to animate.
+     * @method unRegister
+     * @param {object} tween The Anim instance to be be registered
+     * @param {Int} index The index of the Anim instance
+     * @private
+     */
+    this.unRegister = function(tween, index) {
+        tween._onComplete.fire();
+        index = index || getIndex(tween);
+        if (index == -1) {
+            return false;
+        }
+        
+        queue.splice(index, 1);
+
+        tweenCount -= 1;
+        if (tweenCount <= 0) {
+            this.stop();
+        }
+
+        return true;
+    };
+    
+    /**
+     * Starts the animation thread.
+	* Only one thread can run at a time.
+     * @method start
+     */    
+    this.start = function() {
+        if (thread === null) {
+            thread = setInterval(this.run, this.delay);
+        }
+    };
+
+    /**
+     * Stops the animation thread or a specific animation instance.
+     * @method stop
+     * @param {object} tween A specific Anim instance to stop (optional)
+     * If no instance given, Manager stops thread and all animations.
+     */    
+    this.stop = function(tween) {
+        if (!tween) {
+            clearInterval(thread);
+            
+            for (var i = 0, len = queue.length; i < len; ++i) {
+                if ( queue[0].isAnimated() ) {
+                    this.unRegister(queue[0], 0);  
+                }
+            }
+
+            queue = [];
+            thread = null;
+            tweenCount = 0;
+        }
+        else {
+            this.unRegister(tween);
+        }
+    };
+    
+    /**
+     * Called per Interval to handle each animation frame.
+     * @method run
+     */    
+    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; // note return;
+            }
+        }
+        return -1;
+    };
+    
+    /**
+     * On the fly frame correction to keep animation on time.
+     * @method correctFrame
+     * @private
+     * @param {Object} tween The Anim instance being corrected.
+     */
+    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) { // check if falling behind
+            tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
+        } else { // went over duration, so jump to end
+            tweak = frames - (frame + 1); 
+        }
+        if (tweak > 0 && isFinite(tweak)) { // adjust if needed
+            if (tween.currentFrame + tweak >= frames) {// dont go past last frame
+                tweak = frames - (frame + 1);
+            }
+            
+            tween.currentFrame += tweak;      
+        }
+    };
+};
+/**
+ * Used to calculate Bezier splines for any number of control points.
+ * @class Bezier
+ * @namespace YAHOO.util
+ *
+ */
+YAHOO.util.Bezier = new function() {
+    /**
+     * Get the current position of the animated element based on t.
+     * Each point is an array of "x" and "y" values (0 = x, 1 = y)
+     * At least 2 points are required (start and end).
+     * First point is start. Last point is end.
+     * Additional control points are optional.     
+     * @method getPosition
+     * @param {Array} points An array containing Bezier points
+     * @param {Number} t A number between 0 and 1 which is the basis for determining current position
+     * @return {Array} An array containing int x and y member data
+     */
+    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]]; // save input
+        }
+        
+        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() {
+/**
+ * Anim subclass for color transitions.
+ * <p>Usage: <code>var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);</code> Color values can be specified with either 112233, #112233, 
+ * [255,255,255], or rgb(255,255,255)</p>
+ * @class ColorAnim
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {HTMLElement | String} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.
+ * Each attribute is an object with at minimum a "to" or "by" member defined.
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @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)
+ */
+    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);
+    
+    // shorthand
+    var Y = YAHOO.util;
+    var superclass = Y.ColorAnim.superclass;
+    var proto = Y.ColorAnim.prototype;
+    
+    proto.toString = function() {
+        var el = this.getEl();
+        var id = el.id || el.tagName;
+        return ("ColorAnim " + id);
+    };
+
+    proto.patterns.color = /color$/i;
+    proto.patterns.rgb            = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
+    proto.patterns.hex            = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
+    proto.patterns.hex3          = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
+    proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari
+    
+    /**
+     * Attempts to parse the given string and return a 3-tuple.
+     * @method parseColor
+     * @param {String} s The string to parse.
+     * @return {Array} The 3-tuple of rgb values.
+     */
+    proto.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;
+    };
+
+    proto.getAttribute = function(attr) {
+        var el = this.getEl();
+        if (  this.patterns.color.test(attr) ) {
+            var val = YAHOO.util.Dom.getStyle(el, attr);
+            
+            if (this.patterns.transparent.test(val)) { // bgcolor default
+                var parent = el.parentNode; // try and get from an ancestor
+                val = Y.Dom.getStyle(parent, attr);
+            
+                while (parent && this.patterns.transparent.test(val)) {
+                    parent = parent.parentNode;
+                    val = Y.Dom.getStyle(parent, attr);
+                    if (parent.tagName.toUpperCase() == 'HTML') {
+                        val = '#fff';
+                    }
+                }
+            }
+        } else {
+            val = superclass.getAttribute.call(this, attr);
+        }
+
+        return val;
+    };
+    
+    proto.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;
+    };
+
+    proto.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);
+            // fix colors if going "by"
+            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;
+        }
+    };
+})();
+/*
+TERMS OF USE - EASING EQUATIONS
+Open source under the BSD License.
+Copyright 2001 Robert Penner All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 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.
+
+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.
+*/
+
+/**
+ * Singleton that determines how an animation proceeds from start to end.
+ * @class Easing
+ * @namespace YAHOO.util
+*/
+
+YAHOO.util.Easing = {
+
+    /**
+     * Uniform speed between points.
+     * @method easeNone
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    easeNone: function (t, b, c, d) {
+    	return c*t/d + b;
+    },
+    
+    /**
+     * Begins slowly and accelerates towards end. (quadratic)
+     * @method easeIn
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    easeIn: function (t, b, c, d) {
+    	return c*(t/=d)*t + b;
+    },
+
+    /**
+     * Begins quickly and decelerates towards end.  (quadratic)
+     * @method easeOut
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    easeOut: function (t, b, c, d) {
+    	return -c *(t/=d)*(t-2) + b;
+    },
+    
+    /**
+     * Begins slowly and decelerates towards end. (quadratic)
+     * @method easeBoth
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+    
+    /**
+     * Begins slowly and accelerates towards end. (quartic)
+     * @method easeInStrong
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    easeInStrong: function (t, b, c, d) {
+    	return c*(t/=d)*t*t*t + b;
+    },
+    
+    /**
+     * Begins quickly and decelerates towards end.  (quartic)
+     * @method easeOutStrong
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    easeOutStrong: function (t, b, c, d) {
+    	return -c * ((t=t/d-1)*t*t*t - 1) + b;
+    },
+    
+    /**
+     * Begins slowly and decelerates towards end. (quartic)
+     * @method easeBothStrong
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+
+    /**
+     * Snap in elastic effect.
+     * @method elasticIn
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} a Amplitude (optional)
+     * @param {Number} p Period (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+
+    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;
+    },
+
+    /**
+     * Snap out elastic effect.
+     * @method elasticOut
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} a Amplitude (optional)
+     * @param {Number} p Period (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+    
+    /**
+     * Snap both elastic effect.
+     * @method elasticBoth
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} a Amplitude (optional)
+     * @param {Number} p Period (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+
+
+    /**
+     * Backtracks slightly, then reverses direction and moves to end.
+     * @method backIn
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} s Overshoot (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+    backIn: function (t, b, c, d, s) {
+    	if (typeof s == 'undefined') {
+            s = 1.70158;
+        }
+    	return c*(t/=d)*t*((s+1)*t - s) + b;
+    },
+
+    /**
+     * Overshoots end, then reverses and comes back to end.
+     * @method backOut
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} s Overshoot (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+    
+    /**
+     * Backtracks slightly, then reverses direction, overshoots end, 
+     * then reverses and comes back to end.
+     * @method backBoth
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @param {Number} s Overshoot (optional)
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    },
+
+    /**
+     * Bounce off of start.
+     * @method bounceIn
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    bounceIn: function (t, b, c, d) {
+    	return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
+    },
+    
+    /**
+     * Bounces off end.
+     * @method bounceOut
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    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;
+    	}
+        return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+    },
+    
+    /**
+     * Bounces off start and end.
+     * @method bounceBoth
+     * @param {Number} t Time value used to compute current value
+     * @param {Number} b Starting value
+     * @param {Number} c Delta between start and end values
+     * @param {Number} d Total length of animation
+     * @return {Number} The computed value for the current animation frame
+     */
+    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() {
+/**
+ * Anim subclass for moving elements along a path defined by the "points" 
+ * member of "attributes".  All "points" are arrays with x, y coordinates.
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>
+ * @class Motion
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent 
+ * @constructor
+ * @extends YAHOO.util.Anim
+ * @param {String | HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.  
+ * Each attribute is an object with at minimum a "to" or "by" member defined.  
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").  
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @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)
+ */
+    YAHOO.util.Motion = function(el, attributes, duration,  method) {
+        if (el) { // dont break existing subclasses not using YAHOO.extend
+            YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
+        }
+    };
+
+    YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);
+    
+    // shorthand
+    var Y = YAHOO.util;
+    var superclass = Y.Motion.superclass;
+    var proto = Y.Motion.prototype;
+
+    proto.toString = function() {
+        var el = this.getEl();
+        var id = el.id || el.tagName;
+        return ("Motion " + id);
+    };
+    
+    proto.patterns.points = /^points$/i;
+    
+    proto.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);
+        }
+    };
+
+    proto.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;
+    };
+
+    proto.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;
+    };
+
+    proto.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) ) { // could be single point or array of points
+                control = [control];
+            } else { // break reference to attributes.points.control
+                var tmp = []; 
+                for (i = 0, len = control.length; i< len; ++i) {
+                    tmp[i] = control[i];
+                }
+                control = tmp;
+            }
+
+            if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative
+                Y.Dom.setStyle(el, 'position', 'relative');
+            }
+    
+            if ( isset(attributes['points']['from']) ) {
+                Y.Dom.setXY(el, attributes['points']['from']); // set position to from point
+            } 
+            else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position
+            
+            start = this.getAttribute('points'); // get actual top & left
+            
+            // TO beats BY, per SMIL 2.1 spec
+            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() {
+/**
+ * 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.
+ * <p>Usage: <code>var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p>
+ * @class Scroll
+ * @namespace YAHOO.util
+ * @requires YAHOO.util.Anim
+ * @requires YAHOO.util.AnimMgr
+ * @requires YAHOO.util.Easing
+ * @requires YAHOO.util.Bezier
+ * @requires YAHOO.util.Dom
+ * @requires YAHOO.util.Event
+ * @requires YAHOO.util.CustomEvent 
+ * @extends YAHOO.util.Anim
+ * @constructor
+ * @param {String or HTMLElement} el Reference to the element that will be animated
+ * @param {Object} attributes The attribute(s) to be animated.  
+ * Each attribute is an object with at minimum a "to" or "by" member defined.  
+ * Additional optional members are "from" (defaults to current value), "units" (defaults to "px").  
+ * All attribute names use camelCase.
+ * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
+ * @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)
+ */
+    YAHOO.util.Scroll = function(el, attributes, duration,  method) {
+        if (el) { // dont break existing subclasses not using YAHOO.extend
+            YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
+        }
+    };
+
+    YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
+    
+    // shorthand
+    var Y = YAHOO.util;
+    var superclass = Y.Scroll.superclass;
+    var proto = Y.Scroll.prototype;
+
+    proto.toString = function() {
+        var el = this.getEl();
+        var id = el.id || el.tagName;
+        return ("Scroll " + id);
+    };
+
+    proto.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;
+    };
+
+    proto.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;
+    };
+
+    proto.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);
+        }
+    };
+})();
+YAHOO.register("animation", YAHOO.util.Anim, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/autocomplete.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/autocomplete.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/autocomplete.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,3194 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+ /**
+ * The AutoComplete control provides the front-end logic for text-entry suggestion and
+ * completion functionality.
+ *
+ * @module autocomplete
+ * @requires yahoo, dom, event, datasource
+ * @optional animation, connection
+ * @namespace YAHOO.widget
+ * @title AutoComplete Widget
+ */
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The AutoComplete class provides the customizable functionality of a plug-and-play DHTML
+ * auto completion widget.  Some key features:
+ * <ul>
+ * <li>Navigate with up/down arrow keys and/or mouse to pick a selection</li>
+ * <li>The drop down container can "roll down" or "fly out" via configurable
+ * animation</li>
+ * <li>UI look-and-feel customizable through CSS, including container
+ * attributes, borders, position, fonts, etc</li>
+ * </ul>
+ *
+ * @class AutoComplete
+ * @constructor
+ * @param elInput {HTMLElement} DOM element reference of an input field.
+ * @param elInput {String} String ID of an input field.
+ * @param elContainer {HTMLElement} DOM element reference of an existing DIV.
+ * @param elContainer {String} String ID of an existing DIV.
+ * @param oDataSource {YAHOO.widget.DataSource} DataSource instance.
+ * @param oConfigs {Object} (optional) Object literal of configuration params.
+ */
+YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) {
+    if(elInput && elContainer && oDataSource) {
+        // Validate DataSource
+        if(oDataSource instanceof YAHOO.widget.DataSource) {
+            this.dataSource = oDataSource;
+        }
+        else {
+            return;
+        }
+
+        // Validate input element
+        if(YAHOO.util.Dom.inDocument(elInput)) {
+            if(YAHOO.lang.isString(elInput)) {
+                    this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput;
+                    this._oTextbox = document.getElementById(elInput);
+            }
+            else {
+                this._sName = (elInput.id) ?
+                    "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput.id:
+                    "instance" + YAHOO.widget.AutoComplete._nIndex;
+                this._oTextbox = elInput;
+            }
+            YAHOO.util.Dom.addClass(this._oTextbox, "yui-ac-input");
+        }
+        else {
+            return;
+        }
+
+        // Validate container element
+        if(YAHOO.util.Dom.inDocument(elContainer)) {
+            if(YAHOO.lang.isString(elContainer)) {
+                    this._oContainer = document.getElementById(elContainer);
+            }
+            else {
+                this._oContainer = elContainer;
+            }
+            if(this._oContainer.style.display == "none") {
+            }
+            
+            // For skinning
+            var elParent = this._oContainer.parentNode;
+            var elTag = elParent.tagName.toLowerCase();
+            if(elTag == "div") {
+                YAHOO.util.Dom.addClass(elParent, "yui-ac");
+            }
+            else {
+            }
+        }
+        else {
+            return;
+        }
+
+        // Set any config params passed in to override defaults
+        if(oConfigs && (oConfigs.constructor == Object)) {
+            for(var sConfig in oConfigs) {
+                if(sConfig) {
+                    this[sConfig] = oConfigs[sConfig];
+                }
+            }
+        }
+
+        // Initialization sequence
+        this._initContainer();
+        this._initProps();
+        this._initList();
+        this._initContainerHelpers();
+
+        // Set up events
+        var oSelf = this;
+        var oTextbox = this._oTextbox;
+        // Events are actually for the content module within the container
+        var oContent = this._oContainer._oContent;
+
+        // Dom events
+        YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);
+        YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,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);
+        }
+        YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);
+
+        // Custom events
+        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);
+        
+        // Finish up
+        oTextbox.setAttribute("autocomplete","off");
+        YAHOO.widget.AutoComplete._nIndex++;
+    }
+    // Required arguments were not found
+    else {
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * The DataSource object that encapsulates the data used for auto completion.
+ * This object should be an inherited object from YAHOO.widget.DataSource.
+ *
+ * @property dataSource
+ * @type YAHOO.widget.DataSource
+ */
+YAHOO.widget.AutoComplete.prototype.dataSource = null;
+
+/**
+ * Number of characters that must be entered before querying for results. A negative value
+ * effectively turns off the widget. A value of 0 allows queries of null or empty string
+ * values.
+ *
+ * @property minQueryLength
+ * @type Number
+ * @default 1
+ */
+YAHOO.widget.AutoComplete.prototype.minQueryLength = 1;
+
+/**
+ * Maximum number of results to display in results container.
+ *
+ * @property maxResultsDisplayed
+ * @type Number
+ * @default 10
+ */
+YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 10;
+
+/**
+ * Number of seconds to delay before submitting a query request.  If a query
+ * request is received before a previous one has completed its delay, the
+ * previous request is cancelled and the new request is set to the delay.
+ * Implementers should take care when setting this value very low (i.e., less
+ * than 0.2) with low latency DataSources and the typeAhead feature enabled, as
+ * fast typers may see unexpected behavior.
+ *
+ * @property queryDelay
+ * @type Number
+ * @default 0.2
+ */
+YAHOO.widget.AutoComplete.prototype.queryDelay = 0.2;
+
+/**
+ * Class name of a highlighted item within results container.
+ *
+ * @property highlightClassName
+ * @type String
+ * @default "yui-ac-highlight"
+ */
+YAHOO.widget.AutoComplete.prototype.highlightClassName = "yui-ac-highlight";
+
+/**
+ * Class name of a pre-highlighted item within results container.
+ *
+ * @property prehighlightClassName
+ * @type String
+ */
+YAHOO.widget.AutoComplete.prototype.prehighlightClassName = null;
+
+/**
+ * Query delimiter. A single character separator for multiple delimited
+ * selections. Multiple delimiter characteres may be defined as an array of
+ * strings. A null value or empty string indicates that query results cannot
+ * be delimited. This feature is not recommended if you need forceSelection to
+ * be true.
+ *
+ * @property delimChar
+ * @type String | String[]
+ */
+YAHOO.widget.AutoComplete.prototype.delimChar = null;
+
+/**
+ * Whether or not the first item in results container should be automatically highlighted
+ * on expand.
+ *
+ * @property autoHighlight
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.autoHighlight = true;
+
+/**
+ * Whether or not the input field should be automatically updated
+ * with the first query result as the user types, auto-selecting the substring
+ * that the user has not typed.
+ *
+ * @property typeAhead
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.typeAhead = false;
+
+/**
+ * Whether or not to animate the expansion/collapse of the results container in the
+ * horizontal direction.
+ *
+ * @property animHoriz
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.animHoriz = false;
+
+/**
+ * Whether or not to animate the expansion/collapse of the results container in the
+ * vertical direction.
+ *
+ * @property animVert
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.animVert = true;
+
+/**
+ * Speed of container expand/collapse animation, in seconds..
+ *
+ * @property animSpeed
+ * @type Number
+ * @default 0.3
+ */
+YAHOO.widget.AutoComplete.prototype.animSpeed = 0.3;
+
+/**
+ * Whether or not to force the user's selection to match one of the query
+ * results. Enabling this feature essentially transforms the input field into a
+ * &lt;select&gt; field. This feature is not recommended with delimiter character(s)
+ * defined.
+ *
+ * @property forceSelection
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.forceSelection = false;
+
+/**
+ * Whether or not to allow browsers to cache user-typed input in the input
+ * field. Disabling this feature will prevent the widget from setting the
+ * autocomplete="off" on the input field. When autocomplete="off"
+ * and users click the back button after form submission, user-typed input can
+ * be prefilled by the browser from its cache. This caching of user input may
+ * not be desired for sensitive data, such as credit card numbers, in which
+ * case, implementers should consider setting allowBrowserAutocomplete to false.
+ *
+ * @property allowBrowserAutocomplete
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete = true;
+
+/**
+ * Whether or not the results container should always be displayed.
+ * Enabling this feature displays the container when the widget is instantiated
+ * and prevents the toggling of the container to a collapsed state.
+ *
+ * @property alwaysShowContainer
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.alwaysShowContainer = false;
+
+/**
+ * Whether or not to use an iFrame to layer over Windows form elements in
+ * IE. Set to true only when the results container will be on top of a
+ * &lt;select&gt; field in IE and thus exposed to the IE z-index bug (i.e.,
+ * 5.5 < IE < 7).
+ *
+ * @property useIFrame
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.useIFrame = false;
+
+/**
+ * Whether or not the results container should have a shadow.
+ *
+ * @property useShadow
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.useShadow = false;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Public accessor to the unique name of the AutoComplete instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.toString = function() {
+    return "AutoComplete " + this._sName;
+};
+
+ /**
+ * Returns true if container is in an expanded state, false otherwise.
+ *
+ * @method isContainerOpen
+ * @return {Boolean} Returns true if container is in an expanded state, false otherwise.
+ */
+YAHOO.widget.AutoComplete.prototype.isContainerOpen = function() {
+    return this._bContainerOpen;
+};
+
+/**
+ * Public accessor to the internal array of DOM &lt;li&gt; elements that
+ * display query results within the results container.
+ *
+ * @method getListItems
+ * @return {HTMLElement[]} Array of &lt;li&gt; elements within the results container.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItems = function() {
+    return this._aListItems;
+};
+
+/**
+ * Public accessor to the data held in an &lt;li&gt; element of the
+ * results container.
+ *
+ * @method getListItemData
+ * @return {Object | Object[]} Object or array of result data or null
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemData = function(oListItem) {
+    if(oListItem._oResultData) {
+        return oListItem._oResultData;
+    }
+    else {
+        return false;
+    }
+};
+
+/**
+ * Sets HTML markup for the results container header. This markup will be
+ * inserted within a &lt;div&gt; tag with a class of "yui-ac-hd".
+ *
+ * @method setHeader
+ * @param sHeader {String} HTML markup for results container header.
+ */
+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";
+        }
+    }
+    else {
+        this._oContainer._oContent._oHeader.innerHTML = "";
+        this._oContainer._oContent._oHeader.style.display = "none";
+    }
+};
+
+/**
+ * Sets HTML markup for the results container footer. This markup will be
+ * inserted within a &lt;div&gt; tag with a class of "yui-ac-ft".
+ *
+ * @method setFooter
+ * @param sFooter {String} HTML markup for results container footer.
+ */
+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";
+        }
+    }
+    else {
+        this._oContainer._oContent._oFooter.innerHTML = "";
+        this._oContainer._oContent._oFooter.style.display = "none";
+    }
+};
+
+/**
+ * Sets HTML markup for the results container body. This markup will be
+ * inserted within a &lt;div&gt; tag with a class of "yui-ac-bd".
+ *
+ * @method setBody
+ * @param sBody {String} HTML markup for results container body.
+ */
+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";
+        }
+    }
+    else {
+        this._oContainer._oContent._oBody.innerHTML = "";
+        this._oContainer._oContent.style.display = "none";
+    }
+    this._maxResultsDisplayed = 0;
+};
+
+/**
+ * Overridable method that converts a result item object into HTML markup
+ * for display. Return data values are accessible via the oResultItem object,
+ * and the key return value will always be oResultItem[0]. Markup will be
+ * displayed within &lt;li&gt; element tags in the container.
+ *
+ * @method formatResult
+ * @param oResultItem {Object} Result item representing one query result. Data is held in an array.
+ * @param sQuery {String} The current query string.
+ * @return {String} HTML markup of formatted result data.
+ */
+YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultItem, sQuery) {
+    var sResult = oResultItem[0];
+    if(sResult) {
+        return sResult;
+    }
+    else {
+        return "";
+    }
+};
+
+/**
+ * Overridable method called before container expands allows implementers to access data
+ * and DOM elements.
+ *
+ * @method doBeforeExpandContainer
+ * @param oTextbox {HTMLElement} The text input box.
+ * @param oContainer {HTMLElement} The container element.
+ * @param sQuery {String} The query string.
+ * @param aResults {Object[]}  An array of query results.
+ * @return {Boolean} Return true to continue expanding container, false to cancel the expand.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {
+    return true;
+};
+
+/**
+ * Makes query request to the DataSource.
+ *
+ * @method sendQuery
+ * @param sQuery {String} Query string.
+ */
+YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {
+    this._sendQuery(sQuery);
+};
+
+/**
+ * Overridable method gives implementers access to the query before it gets sent.
+ *
+ * @method doBeforeSendQuery
+ * @param sQuery {String} Query string.
+ * @return {String} Query string.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery = function(sQuery) {
+    return sQuery;
+};
+
+/**
+ * Nulls out the entire AutoComplete instance and related objects, removes attached
+ * event listeners, and clears out DOM elements inside the container. After
+ * calling this method, the instance reference should be expliclitly nulled by
+ * implementer, as in myDataTable = null. Use with caution!
+ *
+ * @method destroy
+ */
+YAHOO.widget.AutoComplete.prototype.destroy = function() {
+    var instanceName = this.toString();
+    var elInput = this._oTextbox;
+    var elContainer = this._oContainer;
+
+    // Unhook custom events
+    this.textboxFocusEvent.unsubscribe();
+    this.textboxKeyEvent.unsubscribe();
+    this.dataRequestEvent.unsubscribe();
+    this.dataReturnEvent.unsubscribe();
+    this.dataErrorEvent.unsubscribe();
+    this.containerExpandEvent.unsubscribe();
+    this.typeAheadEvent.unsubscribe();
+    this.itemMouseOverEvent.unsubscribe();
+    this.itemMouseOutEvent.unsubscribe();
+    this.itemArrowToEvent.unsubscribe();
+    this.itemArrowFromEvent.unsubscribe();
+    this.itemSelectEvent.unsubscribe();
+    this.unmatchedItemSelectEvent.unsubscribe();
+    this.selectionEnforceEvent.unsubscribe();
+    this.containerCollapseEvent.unsubscribe();
+    this.textboxBlurEvent.unsubscribe();
+
+    // Unhook DOM events
+    YAHOO.util.Event.purgeElement(elInput, true);
+    YAHOO.util.Event.purgeElement(elContainer, true);
+
+    // Remove DOM elements
+    elContainer.innerHTML = "";
+
+    // Null out objects
+    for(var key in this) {
+        if(YAHOO.lang.hasOwnProperty(this, key)) {
+            this[key] = null;
+        }
+    }
+
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public events
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Fired when the input field receives focus.
+ *
+ * @event textboxFocusEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.textboxFocusEvent = null;
+
+/**
+ * Fired when the input field receives key input.
+ *
+ * @event textboxKeyEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param nKeycode {Number} The keycode number.
+ */
+YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null;
+
+/**
+ * Fired when the AutoComplete instance makes a query to the DataSource.
+ * 
+ * @event dataRequestEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ */
+YAHOO.widget.AutoComplete.prototype.dataRequestEvent = null;
+
+/**
+ * Fired when the AutoComplete instance receives query results from the data
+ * source.
+ *
+ * @event dataReturnEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ * @param aResults {Object[]} Results array.
+ */
+YAHOO.widget.AutoComplete.prototype.dataReturnEvent = null;
+
+/**
+ * Fired when the AutoComplete instance does not receive query results from the
+ * DataSource due to an error.
+ *
+ * @event dataErrorEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ */
+YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;
+
+/**
+ * Fired when the results container is expanded.
+ *
+ * @event containerExpandEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null;
+
+/**
+ * Fired when the input field has been prefilled by the type-ahead
+ * feature. 
+ *
+ * @event typeAheadEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ * @param sPrefill {String} The prefill string.
+ */
+YAHOO.widget.AutoComplete.prototype.typeAheadEvent = null;
+
+/**
+ * Fired when result item has been moused over.
+ *
+ * @event itemMouseOverEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param elItem {HTMLElement} The &lt;li&gt element item moused to.
+ */
+YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null;
+
+/**
+ * Fired when result item has been moused out.
+ *
+ * @event itemMouseOutEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param elItem {HTMLElement} The &lt;li&gt; element item moused from.
+ */
+YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null;
+
+/**
+ * Fired when result item has been arrowed to. 
+ *
+ * @event itemArrowToEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param elItem {HTMLElement} The &lt;li&gt; element item arrowed to.
+ */
+YAHOO.widget.AutoComplete.prototype.itemArrowToEvent = null;
+
+/**
+ * Fired when result item has been arrowed away from.
+ *
+ * @event itemArrowFromEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param elItem {HTMLElement} The &lt;li&gt; element item arrowed from.
+ */
+YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent = null;
+
+/**
+ * Fired when an item is selected via mouse click, ENTER key, or TAB key.
+ *
+ * @event itemSelectEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param elItem {HTMLElement} The selected &lt;li&gt; element item.
+ * @param oData {Object} The data returned for the item, either as an object,
+ * or mapped from the schema into an array.
+ */
+YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null;
+
+/**
+ * Fired when a user selection does not match any of the displayed result items.
+ *
+ * @event unmatchedItemSelectEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent = null;
+
+/**
+ * Fired if forceSelection is enabled and the user's input has been cleared
+ * because it did not match one of the returned query results.
+ *
+ * @event selectionEnforceEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent = null;
+
+/**
+ * Fired when the results container is collapsed.
+ *
+ * @event containerCollapseEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.containerCollapseEvent = null;
+
+/**
+ * Fired when the input field loses focus.
+ *
+ * @event textboxBlurEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.textboxBlurEvent = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to index multiple AutoComplete instances.
+ *
+ * @property _nIndex
+ * @type Number
+ * @default 0
+ * @private
+ */
+YAHOO.widget.AutoComplete._nIndex = 0;
+
+/**
+ * Name of AutoComplete instance.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sName = null;
+
+/**
+ * Text input field DOM element.
+ *
+ * @property _oTextbox
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oTextbox = null;
+
+/**
+ * Whether or not the input field is currently in focus. If query results come back
+ * but the user has already moved on, do not proceed with auto complete behavior.
+ *
+ * @property _bFocused
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._bFocused = true;
+
+/**
+ * Animation instance for container expand/collapse.
+ *
+ * @property _oAnim
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oAnim = null;
+
+/**
+ * Container DOM element.
+ *
+ * @property _oContainer
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oContainer = null;
+
+/**
+ * Whether or not the results container is currently open.
+ *
+ * @property _bContainerOpen
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._bContainerOpen = false;
+
+/**
+ * Whether or not the mouse is currently over the results
+ * container. This is necessary in order to prevent clicks on container items
+ * from being text input field blur events.
+ *
+ * @property _bOverContainer
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._bOverContainer = false;
+
+/**
+ * Array of &lt;li&gt; elements references that contain query results within the
+ * results container.
+ *
+ * @property _aListItems
+ * @type HTMLElement[]
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._aListItems = null;
+
+/**
+ * Number of &lt;li&gt; elements currently displayed in results container.
+ *
+ * @property _nDisplayedItems
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;
+
+/**
+ * Internal count of &lt;li&gt; elements displayed and hidden in results container.
+ *
+ * @property _maxResultsDisplayed
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0;
+
+/**
+ * Current query string
+ *
+ * @property _sCurQuery
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sCurQuery = null;
+
+/**
+ * Past queries this session (for saving delimited queries).
+ *
+ * @property _sSavedQuery
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sSavedQuery = null;
+
+/**
+ * Pointer to the currently highlighted &lt;li&gt; element in the container.
+ *
+ * @property _oCurItem
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oCurItem = null;
+
+/**
+ * Whether or not an item has been selected since the container was populated
+ * with results. Reset to false by _populateList, and set to true when item is
+ * selected.
+ *
+ * @property _bItemSelected
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._bItemSelected = false;
+
+/**
+ * Key code of the last key pressed in textbox.
+ *
+ * @property _nKeyCode
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nKeyCode = null;
+
+/**
+ * Delay timeout ID.
+ *
+ * @property _nDelayID
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nDelayID = -1;
+
+/**
+ * Src to iFrame used when useIFrame = true. Supports implementations over SSL
+ * as well.
+ *
+ * @property _iFrameSrc
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._iFrameSrc = "javascript:false;";
+
+/**
+ * For users typing via certain IMEs, queries must be triggered by intervals,
+ * since key events yet supported across all browsers for all IMEs.
+ *
+ * @property _queryInterval
+ * @type Object
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._queryInterval = null;
+
+/**
+ * Internal tracker to last known textbox value, used to determine whether or not
+ * to trigger a query via interval for certain IME users.
+ *
+ * @event _sLastTextboxValue
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sLastTextboxValue = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Updates and validates latest public config properties.
+ *
+ * @method __initProps
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initProps = function() {
+    // Correct any invalid values
+    var minQueryLength = this.minQueryLength;
+    if(!YAHOO.lang.isNumber(minQueryLength)) {
+        this.minQueryLength = 1;
+    }
+    var maxResultsDisplayed = this.maxResultsDisplayed;
+    if(!YAHOO.lang.isNumber(maxResultsDisplayed) || (maxResultsDisplayed < 1)) {
+        this.maxResultsDisplayed = 10;
+    }
+    var queryDelay = this.queryDelay;
+    if(!YAHOO.lang.isNumber(queryDelay) || (queryDelay < 0)) {
+        this.queryDelay = 0.2;
+    }
+    var delimChar = this.delimChar;
+    if(YAHOO.lang.isString(delimChar) && (delimChar.length > 0)) {
+        this.delimChar = [delimChar];
+    }
+    else if(!YAHOO.lang.isArray(delimChar)) {
+        this.delimChar = null;
+    }
+    var animSpeed = this.animSpeed;
+    if((this.animHoriz || this.animVert) && YAHOO.util.Anim) {
+        if(!YAHOO.lang.isNumber(animSpeed) || (animSpeed < 0)) {
+            this.animSpeed = 0.3;
+        }
+        if(!this._oAnim ) {
+            this._oAnim = new YAHOO.util.Anim(this._oContainer._oContent, {}, this.animSpeed);
+        }
+        else {
+            this._oAnim.duration = this.animSpeed;
+        }
+    }
+    if(this.forceSelection && delimChar) {
+    }
+};
+
+/**
+ * Initializes the results container helpers if they are enabled and do
+ * not exist
+ *
+ * @method _initContainerHelpers
+ * @private
+ */
+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);
+    }
+    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%";
+        oIFrame.tabIndex = -1;
+        this._oContainer._oIFrame = this._oContainer.appendChild(oIFrame);
+    }
+};
+
+/**
+ * Initializes the results container once at object creation
+ *
+ * @method _initContainer
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initContainer = function() {
+    YAHOO.util.Dom.addClass(this._oContainer, "yui-ac-container");
+    
+    if(!this._oContainer._oContent) {
+        // The oContent div helps size the iframe and shadow properly
+        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);
+    }
+    else {
+    }
+};
+
+/**
+ * Clears out contents of container body and creates up to
+ * YAHOO.widget.AutoComplete#maxResultsDisplayed &lt;li&gt; elements in an
+ * &lt;ul&gt; element.
+ *
+ * @method _initList
+ * @private
+ */
+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; oldi--) {
+                oldListItems[oldi] = null;
+            }
+        }
+        this._oContainer._oContent._oBody.innerHTML = "";
+    }
+
+    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);
+    }
+    this._maxResultsDisplayed = this.maxResultsDisplayed;
+};
+
+/**
+ * Initializes each &lt;li&gt; element in the container list.
+ *
+ * @method _initListItem
+ * @param oItem {HTMLElement} The &lt;li&gt; DOM element.
+ * @param nItemIndex {Number} The index of the element.
+ * @private
+ */
+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);
+};
+
+/**
+ * Enables interval detection for  Korean IME support.
+ *
+ * @method _onIMEDetected
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onIMEDetected = function(oSelf) {
+    oSelf._enableIntervalDetection();
+};
+
+/**
+ * Enables query triggers based on text input detection by intervals (rather
+ * than by key events).
+ *
+ * @method _enableIntervalDetection
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._enableIntervalDetection = function() {
+    var currValue = this._oTextbox.value;
+    var lastValue = this._sLastTextboxValue;
+    if(currValue != lastValue) {
+        this._sLastTextboxValue = currValue;
+        this._sendQuery(currValue);
+    }
+};
+
+
+/**
+ * Cancels text input detection by intervals.
+ *
+ * @method _cancelIntervalDetection
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection = function(oSelf) {
+    if(oSelf._queryInterval) {
+        clearInterval(oSelf._queryInterval);
+    }
+};
+
+
+/**
+ * Whether or not key is functional or should be ignored. Note that the right
+ * arrow key is NOT an ignored key since it triggers queries for certain intl
+ * charsets.
+ *
+ * @method _isIgnoreKey
+ * @param nKeycode {Number} Code of key pressed.
+ * @return {Boolean} True if key should be ignored, false otherwise.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._isIgnoreKey = function(nKeyCode) {
+    if((nKeyCode == 9) || (nKeyCode == 13)  || // tab, enter
+            (nKeyCode == 16) || (nKeyCode == 17) || // shift, ctl
+            (nKeyCode >= 18 && nKeyCode <= 20) || // alt,pause/break,caps lock
+            (nKeyCode == 27) || // esc
+            (nKeyCode >= 33 && nKeyCode <= 35) || // page up,page down,end
+            /*(nKeyCode >= 36 && nKeyCode <= 38) || // home,left,up
+            (nKeyCode == 40) || // down*/
+            (nKeyCode >= 36 && nKeyCode <= 40) || // home,left,up, right, down
+            (nKeyCode >= 44 && nKeyCode <= 45)) { // print screen,insert
+        return true;
+    }
+    return false;
+};
+
+/**
+ * Makes query request to the DataSource.
+ *
+ * @method _sendQuery
+ * @param sQuery {String} Query string.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sendQuery = function(sQuery) {
+    // Widget has been effectively turned off
+    if(this.minQueryLength == -1) {
+        this._toggleContainer(false);
+        return;
+    }
+    // Delimiter has been enabled
+    var aDelimChar = (this.delimChar) ? this.delimChar : null;
+    if(aDelimChar) {
+        // Loop through all possible delimiters and find the latest one
+        // A " " may be a false positive if they are defined as delimiters AND
+        // are used to separate delimited queries
+        var nDelimIndex = -1;
+        for(var i = aDelimChar.length-1; i >= 0; i--) {
+            var nNewIndex = sQuery.lastIndexOf(aDelimChar[i]);
+            if(nNewIndex > nDelimIndex) {
+                nDelimIndex = nNewIndex;
+            }
+        }
+        // If we think the last delimiter is a space (" "), make sure it is NOT
+        // a false positive by also checking the char directly before it
+        if(aDelimChar[i] == " ") {
+            for (var j = aDelimChar.length-1; j >= 0; j--) {
+                if(sQuery[nDelimIndex - 1] == aDelimChar[j]) {
+                    nDelimIndex--;
+                    break;
+                }
+            }
+        }
+        // A delimiter has been found so extract the latest query
+        if(nDelimIndex > -1) {
+            var nQueryStart = nDelimIndex + 1;
+            // Trim any white space from the beginning...
+            while(sQuery.charAt(nQueryStart) == " ") {
+                nQueryStart += 1;
+            }
+            // ...and save the rest of the string for later
+            this._sSavedQuery = sQuery.substring(0,nQueryStart);
+            // Here is the query itself
+            sQuery = sQuery.substr(nQueryStart);
+        }
+        else if(sQuery.indexOf(this._sSavedQuery) < 0){
+            this._sSavedQuery = null;
+        }
+    }
+
+    // Don't search queries that are too short
+    if((sQuery && (sQuery.length < this.minQueryLength)) || (!sQuery && this.minQueryLength > 0)) {
+        if(this._nDelayID != -1) {
+            clearTimeout(this._nDelayID);
+        }
+        this._toggleContainer(false);
+        return;
+    }
+
+    sQuery = encodeURIComponent(sQuery);
+    this._nDelayID = -1;    // Reset timeout ID because request has been made
+    sQuery = this.doBeforeSendQuery(sQuery);
+    this.dataRequestEvent.fire(this, sQuery);
+    this.dataSource.getResults(this._populateList, sQuery, this);
+};
+
+/**
+ * Populates the array of &lt;li&gt; elements in the container with query
+ * results. This method is passed to YAHOO.widget.DataSource#getResults as a
+ * callback function so results from the DataSource instance are returned to the
+ * AutoComplete instance.
+ *
+ * @method _populateList
+ * @param sQuery {String} The query string.
+ * @param aResults {Object[]} An array of query result objects from the DataSource.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, aResults, oSelf) {
+    if(aResults === null) {
+        oSelf.dataErrorEvent.fire(oSelf, sQuery);
+    }
+    if(!oSelf._bFocused || !aResults) {
+        return;
+    }
+
+    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();
+    }
+
+    var nItems = Math.min(aResults.length,oSelf.maxResultsDisplayed);
+    oSelf._nDisplayedItems = nItems;
+    if(nItems > 0) {
+        oSelf._initContainerHelpers();
+        var aItems = oSelf._aListItems;
+
+        // Fill items with data
+        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;
+
+        }
+
+        // Empty out remaining items if any
+        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;
+        }
+
+        // Expand the container
+        var ok = oSelf.doBeforeExpandContainer(oSelf._oTextbox, oSelf._oContainer, sQuery, aResults);
+        oSelf._toggleContainer(ok);
+        
+        if(oSelf.autoHighlight) {
+            // Go to the first item
+            var oFirstItem = aItems[0];
+            oSelf._toggleHighlight(oFirstItem,"to");
+            oSelf.itemArrowToEvent.fire(oSelf, oFirstItem);
+            oSelf._typeAhead(oFirstItem,sQuery);
+        }
+        else {
+            oSelf._oCurItem = null;
+        }
+    }
+    else {
+        oSelf._toggleContainer(false);
+    }
+    oSelf.dataReturnEvent.fire(oSelf, sQuery, aResults);
+    
+};
+
+/**
+ * When forceSelection is true and the user attempts
+ * leave the text input box without selecting an item from the query results,
+ * the user selection is cleared.
+ *
+ * @method _clearSelection
+ * @private
+ */
+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);
+    }
+    else {
+         this._oTextbox.value = "";
+    }
+    this._sSavedQuery = this._oTextbox.value;
+
+    // Fire custom event
+    this.selectionEnforceEvent.fire(this);
+};
+
+/**
+ * Whether or not user-typed value in the text input box matches any of the
+ * query results.
+ *
+ * @method _textMatchesOption
+ * @return {HTMLElement} Matching list item element if user-input text matches
+ * a result, null otherwise.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() {
+    var foundMatch = null;
+
+    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 = oItem;
+            break;
+        }
+    }
+    return(foundMatch);
+};
+
+/**
+ * Updates in the text input box with the first query result as the user types,
+ * selecting the substring that the user has not typed.
+ *
+ * @method _typeAhead
+ * @param oItem {HTMLElement} The &lt;li&gt; element item whose data populates the input field.
+ * @param sQuery {String} Query string.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._typeAhead = function(oItem, sQuery) {
+    // Don't update if turned off
+    if(!this.typeAhead || (this._nKeyCode == 8)) {
+        return;
+    }
+
+    var oTextbox = this._oTextbox;
+    var sValue = this._oTextbox.value; // any saved queries plus what user has typed
+
+    // Don't update with type-ahead if text selection is not supported
+    if(!oTextbox.setSelectionRange && !oTextbox.createTextRange) {
+        return;
+    }
+
+    // Select the portion of text that the user has not typed
+    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);
+};
+
+/**
+ * Selects text in the input field.
+ *
+ * @method _selectText
+ * @param oTextbox {HTMLElement} Text input box element in which to select text.
+ * @param nStart {Number} Starting index of text string to select.
+ * @param nEnd {Number} Ending index of text selection.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._selectText = function(oTextbox, nStart, nEnd) {
+    if(oTextbox.setSelectionRange) { // For Mozilla
+        oTextbox.setSelectionRange(nStart,nEnd);
+    }
+    else if(oTextbox.createTextRange) { // For IE
+        var oTextRange = oTextbox.createTextRange();
+        oTextRange.moveStart("character", nStart);
+        oTextRange.moveEnd("character", nEnd-oTextbox.value.length);
+        oTextRange.select();
+    }
+    else {
+        oTextbox.select();
+    }
+};
+
+/**
+ * Syncs results container with its helpers.
+ *
+ * @method _toggleContainerHelpers
+ * @param bShow {Boolean} True if container is expanded, false if collapsed
+ * @private
+ */
+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(bShow) {
+            this._oContainer._oIFrame.style.width = width;
+            this._oContainer._oIFrame.style.height = height;
+        }
+        else {
+            this._oContainer._oIFrame.style.width = 0;
+            this._oContainer._oIFrame.style.height = 0;
+        }
+    }
+    if(this.useShadow && this._oContainer._oShadow) {
+        bFireEvent = true;
+        if(bShow) {
+            this._oContainer._oShadow.style.width = width;
+            this._oContainer._oShadow.style.height = height;
+        }
+        else {
+           this._oContainer._oShadow.style.width = 0;
+            this._oContainer._oShadow.style.height = 0;
+        }
+    }
+};
+
+/**
+ * Animates expansion or collapse of the container.
+ *
+ * @method _toggleContainer
+ * @param bShow {Boolean} True if container should be expanded, false if container should be collapsed
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) {
+    var oContainer = this._oContainer;
+
+    // Implementer has container always open so don't mess with it
+    if(this.alwaysShowContainer && this._bContainerOpen) {
+        return;
+    }
+    
+    // Clear contents of container
+    if(!bShow) {
+        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";
+            }
+        }
+
+        if(this._oCurItem) {
+            this._toggleHighlight(this._oCurItem,"from");
+        }
+
+        this._oCurItem = null;
+        this._nDisplayedItems = 0;
+        this._sCurQuery = null;
+    }
+
+    // Container is already closed
+    if(!bShow && !this._bContainerOpen) {
+        oContainer._oContent.style.display = "none";
+        return;
+    }
+
+    // If animation is enabled...
+    var oAnim = this._oAnim;
+    if(oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) {
+        // If helpers need to be collapsed, do it right away...
+        // but if helpers need to be expanded, wait until after the container expands
+        if(!bShow) {
+            this._toggleContainerHelpers(bShow);
+        }
+
+        if(oAnim.isAnimated()) {
+            oAnim.stop();
+        }
+
+        // Clone container to grab current size offscreen
+        var oClone = oContainer._oContent.cloneNode(true);
+        oContainer.appendChild(oClone);
+        oClone.style.top = "-9000px";
+        oClone.style.display = "block";
+
+        // Current size of the container is the EXPANDED size
+        var wExp = oClone.offsetWidth;
+        var hExp = oClone.offsetHeight;
+
+        // Calculate COLLAPSED sizes based on horiz and vert anim
+        var wColl = (this.animHoriz) ? 0 : wExp;
+        var hColl = (this.animVert) ? 0 : hExp;
+
+        // Set animation sizes
+        oAnim.attributes = (bShow) ?
+            {width: { to: wExp }, height: { to: hExp }} :
+            {width: { to: wColl}, height: { to: hColl }};
+
+        // If opening anew, set to a collapsed size...
+        if(bShow && !this._bContainerOpen) {
+            oContainer._oContent.style.width = wColl+"px";
+            oContainer._oContent.style.height = hColl+"px";
+        }
+        // Else, set it to its last known size.
+        else {
+            oContainer._oContent.style.width = wExp+"px";
+            oContainer._oContent.style.height = hExp+"px";
+        }
+
+        oContainer.removeChild(oClone);
+        oClone = null;
+
+    	var oSelf = this;
+    	var onAnimComplete = function() {
+            // Finish the collapse
+    		oAnim.onComplete.unsubscribeAll();
+
+            if(bShow) {
+                oSelf.containerExpandEvent.fire(oSelf);
+            }
+            else {
+                oContainer._oContent.style.display = "none";
+                oSelf.containerCollapseEvent.fire(oSelf);
+            }
+            oSelf._toggleContainerHelpers(bShow);
+     	};
+
+        // Display container and animate it
+        oContainer._oContent.style.display = "block";
+        oAnim.onComplete.subscribe(onAnimComplete);
+        oAnim.animate();
+        this._bContainerOpen = bShow;
+    }
+    // Else don't animate, just show or hide
+    else {
+        if(bShow) {
+            oContainer._oContent.style.display = "block";
+            this.containerExpandEvent.fire(this);
+        }
+        else {
+            oContainer._oContent.style.display = "none";
+            this.containerCollapseEvent.fire(this);
+        }
+        this._toggleContainerHelpers(bShow);
+        this._bContainerOpen = bShow;
+   }
+
+};
+
+/**
+ * Toggles the highlight on or off for an item in the container, and also cleans
+ * up highlighting of any previous item.
+ *
+ * @method _toggleHighlight
+ * @param oNewItem {HTMLElement} The &lt;li&gt; element item to receive highlight behavior.
+ * @param sType {String} Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._toggleHighlight = function(oNewItem, sType) {
+    var sHighlight = this.highlightClassName;
+    if(this._oCurItem) {
+        // Remove highlight from old item
+        YAHOO.util.Dom.removeClass(this._oCurItem, sHighlight);
+    }
+
+    if((sType == "to") && sHighlight) {
+        // Apply highlight to new item
+        YAHOO.util.Dom.addClass(oNewItem, sHighlight);
+        this._oCurItem = oNewItem;
+    }
+};
+
+/**
+ * Toggles the pre-highlight on or off for an item in the container.
+ *
+ * @method _togglePrehighlight
+ * @param oNewItem {HTMLElement} The &lt;li&gt; element item to receive highlight behavior.
+ * @param sType {String} Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._togglePrehighlight = function(oNewItem, sType) {
+    if(oNewItem == this._oCurItem) {
+        return;
+    }
+
+    var sPrehighlight = this.prehighlightClassName;
+    if((sType == "mouseover") && sPrehighlight) {
+        // Apply prehighlight to new item
+        YAHOO.util.Dom.addClass(oNewItem, sPrehighlight);
+    }
+    else {
+        // Remove prehighlight from old item
+        YAHOO.util.Dom.removeClass(oNewItem, sPrehighlight);
+    }
+};
+
+/**
+ * Updates the text input box value with selected query result. If a delimiter
+ * has been defined, then the value gets appended with the delimiter.
+ *
+ * @method _updateValue
+ * @param oItem {HTMLElement} The &lt;li&gt; element item with which to update the value.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._updateValue = function(oItem) {
+    var oTextbox = this._oTextbox;
+    var sDelimChar = (this.delimChar) ? (this.delimChar[0] || this.delimChar) : null;
+    var sSavedQuery = this._sSavedQuery;
+    var sResultKey = oItem._sResultKey;
+    oTextbox.focus();
+
+    // First clear text field
+    oTextbox.value = "";
+    // Grab data to put into text field
+    if(sDelimChar) {
+        if(sSavedQuery) {
+            oTextbox.value = sSavedQuery;
+        }
+        oTextbox.value += sResultKey + sDelimChar;
+        if(sDelimChar != " ") {
+            oTextbox.value += " ";
+        }
+    }
+    else { oTextbox.value = sResultKey; }
+
+    // scroll to bottom of textarea if necessary
+    if(oTextbox.type == "textarea") {
+        oTextbox.scrollTop = oTextbox.scrollHeight;
+    }
+
+    // move cursor to end
+    var end = oTextbox.value.length;
+    this._selectText(oTextbox,end,end);
+
+    this._oCurItem = oItem;
+};
+
+/**
+ * Selects a result item from the container
+ *
+ * @method _selectItem
+ * @param oItem {HTMLElement} The selected &lt;li&gt; element item.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._selectItem = function(oItem) {
+    this._bItemSelected = true;
+    this._updateValue(oItem);
+    this._cancelIntervalDetection(this);
+    this.itemSelectEvent.fire(this, oItem, oItem._oResultData);
+    this._toggleContainer(false);
+};
+
+/**
+ * If an item is highlighted in the container, the right arrow key jumps to the
+ * end of the textbox and selects the highlighted item, otherwise the container
+ * is closed.
+ *
+ * @method _jumpSelection
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._jumpSelection = function() {
+    if(this._oCurItem) {
+        this._selectItem(this._oCurItem);
+    }
+    else {
+        this._toggleContainer(false);
+    }
+};
+
+/**
+ * Triggered by up and down arrow keys, changes the current highlighted
+ * &lt;li&gt; element item. Scrolls container if necessary.
+ *
+ * @method _moveSelection
+ * @param nKeyCode {Number} Code of key pressed.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._moveSelection = function(nKeyCode) {
+    if(this._bContainerOpen) {
+        // Determine current item's id number
+        var oCurItem = this._oCurItem;
+        var nCurItemIndex = -1;
+
+        if(oCurItem) {
+            nCurItemIndex = oCurItem._nItemIndex;
+        }
+
+        var nNewItemIndex = (nKeyCode == 40) ?
+                (nCurItemIndex + 1) : (nCurItemIndex - 1);
+
+        // Out of bounds
+        if(nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) {
+            return;
+        }
+
+        if(oCurItem) {
+            // Unhighlight current item
+            this._toggleHighlight(oCurItem, "from");
+            this.itemArrowFromEvent.fire(this, oCurItem);
+        }
+        if(nNewItemIndex == -1) {
+           // Go back to query (remove type-ahead string)
+            if(this.delimChar && this._sSavedQuery) {
+                if(!this._textMatchesOption()) {
+                    this._oTextbox.value = this._sSavedQuery;
+                }
+                else {
+                    this._oTextbox.value = this._sSavedQuery + this._sCurQuery;
+                }
+            }
+            else {
+                this._oTextbox.value = this._sCurQuery;
+            }
+            this._oCurItem = null;
+            return;
+        }
+        if(nNewItemIndex == -2) {
+            // Close container
+            this._toggleContainer(false);
+            return;
+        }
+
+        var oNewItem = this._aListItems[nNewItemIndex];
+
+        // Scroll the container if necessary
+        var oContent = this._oContainer._oContent;
+        var scrollOn = ((YAHOO.util.Dom.getStyle(oContent,"overflow") == "auto") ||
+            (YAHOO.util.Dom.getStyle(oContent,"overflowY") == "auto"));
+        if(scrollOn && (nNewItemIndex > -1) &&
+        (nNewItemIndex < this._nDisplayedItems)) {
+            // User is keying down
+            if(nKeyCode == 40) {
+                // Bottom of selected item is below scroll area...
+                if((oNewItem.offsetTop+oNewItem.offsetHeight) > (oContent.scrollTop + oContent.offsetHeight)) {
+                    // Set bottom of scroll area to bottom of selected item
+                    oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - oContent.offsetHeight;
+                }
+                // Bottom of selected item is above scroll area...
+                else if((oNewItem.offsetTop+oNewItem.offsetHeight) < oContent.scrollTop) {
+                    // Set top of selected item to top of scroll area
+                    oContent.scrollTop = oNewItem.offsetTop;
+
+                }
+            }
+            // User is keying up
+            else {
+                // Top of selected item is above scroll area
+                if(oNewItem.offsetTop < oContent.scrollTop) {
+                    // Set top of scroll area to top of selected item
+                    this._oContainer._oContent.scrollTop = oNewItem.offsetTop;
+                }
+                // Top of selected item is below scroll area
+                else if(oNewItem.offsetTop > (oContent.scrollTop + oContent.offsetHeight)) {
+                    // Set bottom of selected item to bottom of scroll area
+                    this._oContainer._oContent.scrollTop = (oNewItem.offsetTop+oNewItem.offsetHeight) - oContent.offsetHeight;
+                }
+            }
+        }
+
+        this._toggleHighlight(oNewItem, "to");
+        this.itemArrowToEvent.fire(this, oNewItem);
+        if(this.typeAhead) {
+            this._updateValue(oNewItem);
+        }
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private event handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Handles &lt;li&gt; element mouseover events in the container.
+ *
+ * @method _onItemMouseover
+ * @param v {HTMLEvent} The mouseover event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onItemMouseover = function(v,oSelf) {
+    if(oSelf.prehighlightClassName) {
+        oSelf._togglePrehighlight(this,"mouseover");
+    }
+    else {
+        oSelf._toggleHighlight(this,"to");
+    }
+
+    oSelf.itemMouseOverEvent.fire(oSelf, this);
+};
+
+/**
+ * Handles &lt;li&gt; element mouseout events in the container.
+ *
+ * @method _onItemMouseout
+ * @param v {HTMLEvent} The mouseout event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onItemMouseout = function(v,oSelf) {
+    if(oSelf.prehighlightClassName) {
+        oSelf._togglePrehighlight(this,"mouseout");
+    }
+    else {
+        oSelf._toggleHighlight(this,"from");
+    }
+
+    oSelf.itemMouseOutEvent.fire(oSelf, this);
+};
+
+/**
+ * Handles &lt;li&gt; element click events in the container.
+ *
+ * @method _onItemMouseclick
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onItemMouseclick = function(v,oSelf) {
+    // In case item has not been moused over
+    oSelf._toggleHighlight(this,"to");
+    oSelf._selectItem(this);
+};
+
+/**
+ * Handles container mouseover events.
+ *
+ * @method _onContainerMouseover
+ * @param v {HTMLEvent} The mouseover event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerMouseover = function(v,oSelf) {
+    oSelf._bOverContainer = true;
+};
+
+/**
+ * Handles container mouseout events.
+ *
+ * @method _onContainerMouseout
+ * @param v {HTMLEvent} The mouseout event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerMouseout = function(v,oSelf) {
+    oSelf._bOverContainer = false;
+    // If container is still active
+    if(oSelf._oCurItem) {
+        oSelf._toggleHighlight(oSelf._oCurItem,"to");
+    }
+};
+
+/**
+ * Handles container scroll events.
+ *
+ * @method _onContainerScroll
+ * @param v {HTMLEvent} The scroll event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerScroll = function(v,oSelf) {
+    oSelf._oTextbox.focus();
+};
+
+/**
+ * Handles container resize events.
+ *
+ * @method _onContainerResize
+ * @param v {HTMLEvent} The resize event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerResize = function(v,oSelf) {
+    oSelf._toggleContainerHelpers(oSelf._bContainerOpen);
+};
+
+
+/**
+ * Handles textbox keydown events of functional keys, mainly for UI behavior.
+ *
+ * @method _onTextboxKeyDown
+ * @param v {HTMLEvent} The keydown event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown = function(v,oSelf) {
+    var nKeyCode = v.keyCode;
+
+    switch (nKeyCode) {
+        case 9: // tab
+            // select an item or clear out
+            if(oSelf._oCurItem) {
+                if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {
+                    if(oSelf._bContainerOpen) {
+                        YAHOO.util.Event.stopEvent(v);
+                    }
+                }
+                oSelf._selectItem(oSelf._oCurItem);
+            }
+            else {
+                oSelf._toggleContainer(false);
+            }
+            break;
+        case 13: // enter
+            if(oSelf._oCurItem) {
+                if(oSelf._nKeyCode != nKeyCode) {
+                    if(oSelf._bContainerOpen) {
+                        YAHOO.util.Event.stopEvent(v);
+                    }
+                }
+                oSelf._selectItem(oSelf._oCurItem);
+            }
+            else {
+                oSelf._toggleContainer(false);
+            }
+            break;
+        case 27: // esc
+            oSelf._toggleContainer(false);
+            return;
+        case 39: // right
+            oSelf._jumpSelection();
+            break;
+        case 38: // up
+            YAHOO.util.Event.stopEvent(v);
+            oSelf._moveSelection(nKeyCode);
+            break;
+        case 40: // down
+            YAHOO.util.Event.stopEvent(v);
+            oSelf._moveSelection(nKeyCode);
+            break;
+        default:
+            break;
+    }
+};
+
+/**
+ * Handles textbox keypress events.
+ * @method _onTextboxKeyPress
+ * @param v {HTMLEvent} The keypress event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress = function(v,oSelf) {
+    var nKeyCode = v.keyCode;
+
+        //Expose only to Mac browsers, where stopEvent is ineffective on keydown events (bug 790337)
+        var isMac = (navigator.userAgent.toLowerCase().indexOf("mac") != -1);
+        if(isMac) {
+            switch (nKeyCode) {
+            case 9: // tab
+                if(oSelf._oCurItem) {
+                    if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {
+                        YAHOO.util.Event.stopEvent(v);
+                    }
+                }
+                break;
+            case 13: // enter
+                if(oSelf._oCurItem) {
+                    if(oSelf._nKeyCode != nKeyCode) {
+                        if(oSelf._bContainerOpen) {
+                            YAHOO.util.Event.stopEvent(v);
+                        }
+                    }
+                }
+                break;
+            case 38: // up
+            case 40: // down
+                YAHOO.util.Event.stopEvent(v);
+                break;
+            default:
+                break;
+            }
+        }
+
+        //TODO: (?) limit only to non-IE, non-Mac-FF for Korean IME support (bug 811948)
+        // Korean IME detected
+        else if(nKeyCode == 229) {
+            oSelf._queryInterval = setInterval(function() { oSelf._onIMEDetected(oSelf); },500);
+        }
+};
+
+/**
+ * Handles textbox keyup events that trigger queries.
+ *
+ * @method _onTextboxKeyUp
+ * @param v {HTMLEvent} The keyup event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp = function(v,oSelf) {
+    // Check to see if any of the public properties have been updated
+    oSelf._initProps();
+
+    var nKeyCode = v.keyCode;
+    oSelf._nKeyCode = nKeyCode;
+    var sText = this.value; //string in textbox
+
+    // Filter out chars that don't trigger queries
+    if(oSelf._isIgnoreKey(nKeyCode) || (sText.toLowerCase() == oSelf._sCurQuery)) {
+        return;
+    }
+    else {
+        oSelf._bItemSelected = false;
+        YAHOO.util.Dom.removeClass(oSelf._oCurItem,  oSelf.highlightClassName);
+        oSelf._oCurItem = null;
+
+        oSelf.textboxKeyEvent.fire(oSelf, nKeyCode);
+    }
+
+    // Set timeout on the request
+    if(oSelf.queryDelay > 0) {
+        var nDelayID =
+            setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay * 1000));
+
+        if(oSelf._nDelayID != -1) {
+            clearTimeout(oSelf._nDelayID);
+        }
+
+        oSelf._nDelayID = nDelayID;
+    }
+    else {
+        // No delay so send request immediately
+        oSelf._sendQuery(sText);
+    }
+};
+
+/**
+ * Handles text input box receiving focus.
+ *
+ * @method _onTextboxFocus
+ * @param v {HTMLEvent} The focus event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onTextboxFocus = function (v,oSelf) {
+    oSelf._oTextbox.setAttribute("autocomplete","off");
+    oSelf._bFocused = true;
+    if(!oSelf._bItemSelected) {
+        oSelf.textboxFocusEvent.fire(oSelf);
+    }
+};
+
+/**
+ * Handles text input box losing focus.
+ *
+ * @method _onTextboxBlur
+ * @param v {HTMLEvent} The focus event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onTextboxBlur = function (v,oSelf) {
+    // Don't treat as a blur if it was a selection via mouse click
+    if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) {
+        // Current query needs to be validated as a selection
+        if(!oSelf._bItemSelected) {
+            var oMatch = oSelf._textMatchesOption();
+            // Container is closed or current query doesn't match any result
+            if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && (oMatch === null))) {
+                // Force selection is enabled so clear the current query
+                if(oSelf.forceSelection) {
+                    oSelf._clearSelection();
+                }
+                // Treat current query as a valid selection
+                else {
+                    oSelf.unmatchedItemSelectEvent.fire(oSelf);
+                }
+            }
+            // Container is open and current query matches a result
+            else {
+                // Force a selection when textbox is blurred with a match
+                if(oSelf.forceSelection) {
+                    oSelf._selectItem(oMatch);
+                }
+            }
+        }
+
+        if(oSelf._bContainerOpen) {
+            oSelf._toggleContainer(false);
+        }
+        oSelf._cancelIntervalDetection(oSelf);
+        oSelf._bFocused = false;
+        oSelf.textboxBlurEvent.fire(oSelf);
+    }
+};
+
+/**
+ * Handles form submission event.
+ *
+ * @method _onFormSubmit
+ * @param v {HTMLEvent} The submit event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onFormSubmit = function(v,oSelf) {
+    if(oSelf.allowBrowserAutocomplete) {
+        oSelf._oTextbox.setAttribute("autocomplete","on");
+    }
+    else {
+        oSelf._oTextbox.setAttribute("autocomplete","off");
+    }
+};
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The DataSource classes manages sending a request and returning response from a live
+ * database. Supported data include local JavaScript arrays and objects and databases
+ * accessible via XHR connections. Supported response formats include JavaScript arrays,
+ * JSON, XML, and flat-file textual data.
+ *  
+ * @class DataSource
+ * @constructor
+ */
+YAHOO.widget.DataSource = function() { 
+    /* abstract class */
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public constants
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Error message for null data responses.
+ *
+ * @property ERROR_DATANULL
+ * @type String
+ * @static
+ * @final
+ */
+YAHOO.widget.DataSource.ERROR_DATANULL = "Response data was null";
+
+/**
+ * Error message for data responses with parsing errors.
+ *
+ * @property ERROR_DATAPARSE
+ * @type String
+ * @static
+ * @final
+ */
+YAHOO.widget.DataSource.ERROR_DATAPARSE = "Response data could not be parsed";
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Max size of the local cache.  Set to 0 to turn off caching.  Caching is
+ * useful to reduce the number of server connections.  Recommended only for data
+ * sources that return comprehensive results for queries or when stale data is
+ * not an issue.
+ *
+ * @property maxCacheEntries
+ * @type Number
+ * @default 15
+ */
+YAHOO.widget.DataSource.prototype.maxCacheEntries = 15;
+
+/**
+ * Use this to fine-tune the matching algorithm used against JS Array types of
+ * DataSource and DataSource caches. If queryMatchContains is true, then the JS
+ * Array or cache returns results that "contain" the query string. By default,
+ * queryMatchContains is set to false, so that only results that "start with"
+ * the query string are returned.
+ *
+ * @property queryMatchContains
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.DataSource.prototype.queryMatchContains = false;
+
+/**
+ * Enables query subset matching. If caching is on and queryMatchSubset is
+ * true, substrings of queries will return matching cached results. For
+ * instance, if the first query is for "abc" susequent queries that start with
+ * "abc", like "abcd", will be queried against the cache, and not the live data
+ * source. Recommended only for DataSources that return comprehensive results
+ * for queries with very few characters.
+ *
+ * @property queryMatchSubset
+ * @type Boolean
+ * @default false
+ *
+ */
+YAHOO.widget.DataSource.prototype.queryMatchSubset = false;
+
+/**
+ * Enables case-sensitivity in the matching algorithm used against JS Array
+ * types of DataSources and DataSource caches. If queryMatchCase is true, only
+ * case-sensitive matches will return.
+ *
+ * @property queryMatchCase
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.DataSource.prototype.queryMatchCase = false;
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Public accessor to the unique name of the DataSource instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the DataSource instance
+ */
+YAHOO.widget.DataSource.prototype.toString = function() {
+    return "DataSource " + this._sName;
+};
+
+/**
+ * Retrieves query results, first checking the local cache, then making the
+ * query request to the live data source as defined by the function doQuery.
+ *
+ * @method getResults
+ * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ */
+YAHOO.widget.DataSource.prototype.getResults = function(oCallbackFn, sQuery, oParent) {
+    
+    // First look in cache
+    var aResults = this._doQueryCache(oCallbackFn,sQuery,oParent);
+    // Not in cache, so get results from server
+    if(aResults.length === 0) {
+        this.queryEvent.fire(this, oParent, sQuery);
+        this.doQuery(oCallbackFn, sQuery, oParent);
+    }
+};
+
+/**
+ * Abstract method implemented by subclasses to make a query to the live data
+ * source. Must call the callback function with the response returned from the
+ * query. Populates cache (if enabled).
+ *
+ * @method doQuery
+ * @param oCallbackFn {HTMLFunction} Callback function implemented by oParent to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ */
+YAHOO.widget.DataSource.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {
+    /* override this */ 
+};
+
+/**
+ * Flushes cache.
+ *
+ * @method flushCache
+ */
+YAHOO.widget.DataSource.prototype.flushCache = function() {
+    if(this._aCache) {
+        this._aCache = [];
+    }
+    if(this._aCacheHelper) {
+        this._aCacheHelper = [];
+    }
+    this.cacheFlushEvent.fire(this);
+
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public events
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Fired when a query is made to the live data source.
+ *
+ * @event queryEvent
+ * @param oSelf {Object} The DataSource instance.
+ * @param oParent {Object} The requesting object.
+ * @param sQuery {String} The query string.
+ */
+YAHOO.widget.DataSource.prototype.queryEvent = null;
+
+/**
+ * Fired when a query is made to the local cache.
+ *
+ * @event cacheQueryEvent
+ * @param oSelf {Object} The DataSource instance.
+ * @param oParent {Object} The requesting object.
+ * @param sQuery {String} The query string.
+ */
+YAHOO.widget.DataSource.prototype.cacheQueryEvent = null;
+
+/**
+ * Fired when data is retrieved from the live data source.
+ *
+ * @event getResultsEvent
+ * @param oSelf {Object} The DataSource instance.
+ * @param oParent {Object} The requesting object.
+ * @param sQuery {String} The query string.
+ * @param aResults {Object[]} Array of result objects.
+ */
+YAHOO.widget.DataSource.prototype.getResultsEvent = null;
+    
+/**
+ * Fired when data is retrieved from the local cache.
+ *
+ * @event getCachedResultsEvent
+ * @param oSelf {Object} The DataSource instance.
+ * @param oParent {Object} The requesting object.
+ * @param sQuery {String} The query string.
+ * @param aResults {Object[]} Array of result objects.
+ */
+YAHOO.widget.DataSource.prototype.getCachedResultsEvent = null;
+
+/**
+ * Fired when an error is encountered with the live data source.
+ *
+ * @event dataErrorEvent
+ * @param oSelf {Object} The DataSource instance.
+ * @param oParent {Object} The requesting object.
+ * @param sQuery {String} The query string.
+ * @param sMsg {String} Error message string
+ */
+YAHOO.widget.DataSource.prototype.dataErrorEvent = null;
+
+/**
+ * Fired when the local cache is flushed.
+ *
+ * @event cacheFlushEvent
+ * @param oSelf {Object} The DataSource instance
+ */
+YAHOO.widget.DataSource.prototype.cacheFlushEvent = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to index multiple DataSource instances.
+ *
+ * @property _nIndex
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.widget.DataSource._nIndex = 0;
+
+/**
+ * Name of DataSource instance.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataSource.prototype._sName = null;
+
+/**
+ * Local cache of data result objects indexed chronologically.
+ *
+ * @property _aCache
+ * @type Object[]
+ * @private
+ */
+YAHOO.widget.DataSource.prototype._aCache = null;
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Initializes DataSource instance.
+ *  
+ * @method _init
+ * @private
+ */
+YAHOO.widget.DataSource.prototype._init = function() {
+    // Validate and initialize public configs
+    var maxCacheEntries = this.maxCacheEntries;
+    if(!YAHOO.lang.isNumber(maxCacheEntries) || (maxCacheEntries < 0)) {
+        maxCacheEntries = 0;
+    }
+    // Initialize local cache
+    if(maxCacheEntries > 0 && !this._aCache) {
+        this._aCache = [];
+    }
+    
+    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);
+};
+
+/**
+ * Adds a result object to the local cache, evicting the oldest element if the 
+ * cache is full. Newer items will have higher indexes, the oldest item will have
+ * index of 0. 
+ *
+ * @method _addCacheElem
+ * @param oResult {Object} Data result object, including array of results.
+ * @private
+ */
+YAHOO.widget.DataSource.prototype._addCacheElem = function(oResult) {
+    var aCache = this._aCache;
+    // Don't add if anything important is missing.
+    if(!aCache || !oResult || !oResult.query || !oResult.results) {
+        return;
+    }
+    
+    // If the cache is full, make room by removing from index=0
+    if(aCache.length >= this.maxCacheEntries) {
+        aCache.shift();
+    }
+        
+    // Add to cache, at the end of the array
+    aCache.push(oResult);
+};
+
+/**
+ * Queries the local cache for results. If query has been cached, the callback
+ * function is called with the results, and the cached is refreshed so that it
+ * is now the newest element.  
+ *
+ * @method _doQueryCache
+ * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ * @return aResults {Object[]} Array of results from local cache if found, otherwise null.
+ * @private 
+ */
+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;
+    var sOrigQuery;
+    
+    // If cache is enabled...
+    if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) {
+        this.cacheQueryEvent.fire(this, oParent, sQuery);
+        // If case is unimportant, normalize query now instead of in loops
+        if(!this.queryMatchCase) {
+            sOrigQuery = sQuery;
+            sQuery = sQuery.toLowerCase();
+        }
+
+        // Loop through each cached element's query property...
+        for(var i = nCacheLength-1; i >= 0; i--) {
+            var resultObj = aCache[i];
+            var aAllResultItems = resultObj.results;
+            // If case is unimportant, normalize match key for comparison
+            var matchKey = (!this.queryMatchCase) ?
+                encodeURIComponent(resultObj.query).toLowerCase():
+                encodeURIComponent(resultObj.query);
+            
+            // If a cached match key exactly matches the query...
+            if(matchKey == sQuery) {
+                    // Stash all result objects into aResult[] and stop looping through the cache.
+                    bMatchFound = true;
+                    aResults = aAllResultItems;
+                    
+                    // The matching cache element was not the most recent,
+                    // so now we need to refresh the cache.
+                    if(i != nCacheLength-1) {                        
+                        // Remove element from its original location
+                        aCache.splice(i,1);
+                        // Add element as newest
+                        this._addCacheElem(resultObj);
+                    }
+                    break;
+            }
+            // Else if this query is not an exact match and subset matching is enabled...
+            else if(this.queryMatchSubset) {
+                // Loop through substrings of each cached element's query property...
+                for(var j = sQuery.length-1; j >= 0 ; j--) {
+                    var subQuery = sQuery.substr(0,j);
+                    
+                    // If a substring of a cached sQuery exactly matches the query...
+                    if(matchKey == subQuery) {                    
+                        bMatchFound = true;
+                        
+                        // Go through each cached result object to match against the query...
+                        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);
+                            
+                            // A STARTSWITH match is when the query is found at the beginning of the key string...
+                            if((!bMatchContains && (sKeyIndex === 0)) ||
+                            // A CONTAINS match is when the query is found anywhere within the key string...
+                            (bMatchContains && (sKeyIndex > -1))) {
+                                // Stash a match into aResults[].
+                                aResults.unshift(aRecord);
+                            }
+                        }
+                        
+                        // Add the subset match result set object as the newest element to cache,
+                        // and stop looping through the cache.
+                        resultObj = {};
+                        resultObj.query = sQuery;
+                        resultObj.results = aResults;
+                        this._addCacheElem(resultObj);
+                        break;
+                    }
+                }
+                if(bMatchFound) {
+                    break;
+                }
+            }
+        }
+        
+        // If there was a match, send along the results.
+        if(bMatchFound) {
+            this.getCachedResultsEvent.fire(this, oParent, sOrigQuery, aResults);
+            oCallbackFn(sOrigQuery, aResults, oParent);
+        }
+    }
+    return aResults;
+};
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Implementation of YAHOO.widget.DataSource using XML HTTP requests that return
+ * query results.
+ *  
+ * @class DS_XHR
+ * @extends YAHOO.widget.DataSource
+ * @requires connection
+ * @constructor
+ * @param sScriptURI {String} Absolute or relative URI to script that returns query
+ * results as JSON, XML, or delimited flat-file data.
+ * @param aSchema {String[]} Data schema definition of results.
+ * @param oConfigs {Object} (optional) Object literal of config params.
+ */
+YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) {
+    // Set any config params passed in to override defaults
+    if(oConfigs && (oConfigs.constructor == Object)) {
+        for(var sConfig in oConfigs) {
+            this[sConfig] = oConfigs[sConfig];
+        }
+    }
+
+    // Initialization sequence
+    if(!YAHOO.lang.isArray(aSchema) || !YAHOO.lang.isString(sScriptURI)) {
+        return;
+    }
+
+    this.schema = aSchema;
+    this.scriptURI = sScriptURI;
+    
+    this._init();
+};
+
+YAHOO.widget.DS_XHR.prototype = new YAHOO.widget.DataSource();
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public constants
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * JSON data type.
+ *
+ * @property TYPE_JSON
+ * @type Number
+ * @static
+ * @final
+ */
+YAHOO.widget.DS_XHR.TYPE_JSON = 0;
+
+/**
+ * XML data type.
+ *
+ * @property TYPE_XML
+ * @type Number
+ * @static
+ * @final
+ */
+YAHOO.widget.DS_XHR.TYPE_XML = 1;
+
+/**
+ * Flat-file data type.
+ *
+ * @property TYPE_FLAT
+ * @type Number
+ * @static
+ * @final
+ */
+YAHOO.widget.DS_XHR.TYPE_FLAT = 2;
+
+/**
+ * Error message for XHR failure.
+ *
+ * @property ERROR_DATAXHR
+ * @type String
+ * @static
+ * @final
+ */
+YAHOO.widget.DS_XHR.ERROR_DATAXHR = "XHR response failed";
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Alias to YUI Connection Manager. Allows implementers to specify their own
+ * subclasses of the YUI Connection Manager utility.
+ *
+ * @property connMgr
+ * @type Object
+ * @default YAHOO.util.Connect
+ */
+YAHOO.widget.DS_XHR.prototype.connMgr = YAHOO.util.Connect;
+
+/**
+ * Number of milliseconds the XHR connection will wait for a server response. A
+ * a value of zero indicates the XHR connection will wait forever. Any value
+ * greater than zero will use the Connection utility's Auto-Abort feature.
+ *
+ * @property connTimeout
+ * @type Number
+ * @default 0
+ */
+YAHOO.widget.DS_XHR.prototype.connTimeout = 0;
+
+/**
+ * Absolute or relative URI to script that returns query results. For instance,
+ * queries will be sent to &#60;scriptURI&#62;?&#60;scriptQueryParam&#62;=userinput
+ *
+ * @property scriptURI
+ * @type String
+ */
+YAHOO.widget.DS_XHR.prototype.scriptURI = null;
+
+/**
+ * Query string parameter name sent to scriptURI. For instance, queries will be
+ * sent to &#60;scriptURI&#62;?&#60;scriptQueryParam&#62;=userinput
+ *
+ * @property scriptQueryParam
+ * @type String
+ * @default "query"
+ */
+YAHOO.widget.DS_XHR.prototype.scriptQueryParam = "query";
+
+/**
+ * String of key/value pairs to append to requests made to scriptURI. Define
+ * this string when you want to send additional query parameters to your script.
+ * When defined, queries will be sent to
+ * &#60;scriptURI&#62;?&#60;scriptQueryParam&#62;=userinput&#38;&#60;scriptQueryAppend&#62;
+ *
+ * @property scriptQueryAppend
+ * @type String
+ * @default ""
+ */
+YAHOO.widget.DS_XHR.prototype.scriptQueryAppend = "";
+
+/**
+ * XHR response data type. Other types that may be defined are YAHOO.widget.DS_XHR.TYPE_XML
+ * and YAHOO.widget.DS_XHR.TYPE_FLAT.
+ *
+ * @property responseType
+ * @type String
+ * @default YAHOO.widget.DS_XHR.TYPE_JSON
+ */
+YAHOO.widget.DS_XHR.prototype.responseType = YAHOO.widget.DS_XHR.TYPE_JSON;
+
+/**
+ * String after which to strip results. If the results from the XHR are sent
+ * back as HTML, the gzip HTML comment appears at the end of the data and should
+ * be ignored.
+ *
+ * @property responseStripAfter
+ * @type String
+ * @default "\n&#60;!-"
+ */
+YAHOO.widget.DS_XHR.prototype.responseStripAfter = "\n<!-";
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Queries the live data source defined by scriptURI for results. Results are
+ * passed back to a callback function.
+ *  
+ * @method doQuery
+ * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ */
+YAHOO.widget.DS_XHR.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {
+    var isXML = (this.responseType == YAHOO.widget.DS_XHR.TYPE_XML);
+    var sUri = this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;
+    if(this.scriptQueryAppend.length > 0) {
+        sUri += "&" + this.scriptQueryAppend;
+    }
+    var oResponse = null;
+    
+    var oSelf = this;
+    /*
+     * Sets up ajax request callback
+     *
+     * @param {object} oReq          HTTPXMLRequest object
+     * @private
+     */
+    var responseSuccess = function(oResp) {
+        // Response ID does not match last made request ID.
+        if(!oSelf._oConn || (oResp.tId != oSelf._oConn.tId)) {
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, YAHOO.widget.DataSource.ERROR_DATANULL);
+            return;
+        }
+//DEBUG
+for(var foo in oResp) {
+}
+        if(!isXML) {
+            oResp = oResp.responseText;
+        }
+        else { 
+            oResp = oResp.responseXML;
+        }
+        if(oResp === null) {
+            oSelf.dataErrorEvent.fire(oSelf, oParent, sQuery, YAHOO.widget.DataSource.ERROR_DATANULL);
+            return;
+        }
+
+        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, YAHOO.widget.DataSource.ERROR_DATAPARSE);
+            aResults = [];
+        }
+        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, YAHOO.widget.DS_XHR.ERROR_DATAXHR);
+        return;
+    };
+    
+    var oCallback = {
+        success:responseSuccess,
+        failure:responseFailure
+    };
+    
+    if(YAHOO.lang.isNumber(this.connTimeout) && (this.connTimeout > 0)) {
+        oCallback.timeout = this.connTimeout;
+    }
+    
+    if(this._oConn) {
+        this.connMgr.abort(this._oConn);
+    }
+    
+    oSelf._oConn = this.connMgr.asyncRequest("GET", sUri, oCallback, null);
+};
+
+/**
+ * Parses raw response data into an array of result objects. The result data key
+ * is always stashed in the [0] element of each result object. 
+ *
+ * @method parseResponse
+ * @param sQuery {String} Query string.
+ * @param oResponse {Object} The raw response data to parse.
+ * @param oParent {Object} The object instance that has requested data.
+ * @returns {Object[]} Array of result objects.
+ */
+YAHOO.widget.DS_XHR.prototype.parseResponse = function(sQuery, oResponse, oParent) {
+    var aSchema = this.schema;
+    var aResults = [];
+    var bError = false;
+
+    // Strip out comment at the end of results
+    var nEnd = ((this.responseStripAfter !== "") && (oResponse.indexOf)) ?
+        oResponse.indexOf(this.responseStripAfter) : -1;
+    if(nEnd != -1) {
+        oResponse = oResponse.substring(0,nEnd);
+    }
+
+    switch (this.responseType) {
+        case YAHOO.widget.DS_XHR.TYPE_JSON:
+            var jsonList, jsonObjParsed;
+            // Check for JSON lib but divert KHTML clients
+            var isNotMac = (navigator.userAgent.toLowerCase().indexOf('khtml')== -1);
+            if(oResponse.parseJSON && isNotMac) {
+                // Use the new JSON utility if available
+                jsonObjParsed = oResponse.parseJSON();
+                if(!jsonObjParsed) {
+                    bError = true;
+                }
+                else {
+                    try {
+                        // eval is necessary here since aSchema[0] is of unknown depth
+                        jsonList = eval("jsonObjParsed." + aSchema[0]);
+                    }
+                    catch(e) {
+                        bError = true;
+                        break;
+                   }
+                }
+            }
+            else if(window.JSON && isNotMac) {
+                // Use older JSON lib if available
+                jsonObjParsed = JSON.parse(oResponse);
+                if(!jsonObjParsed) {
+                    bError = true;
+                    break;
+                }
+                else {
+                    try {
+                        // eval is necessary here since aSchema[0] is of unknown depth
+                        jsonList = eval("jsonObjParsed." + aSchema[0]);
+                    }
+                    catch(e) {
+                        bError = true;
+                        break;
+                   }
+                }
+            }
+            else {
+                // Parse the JSON response as a string
+                try {
+                    // Trim leading spaces
+                    while (oResponse.substring(0,1) == " ") {
+                        oResponse = oResponse.substring(1, oResponse.length);
+                    }
+
+                    // Invalid JSON response
+                    if(oResponse.indexOf("{") < 0) {
+                        bError = true;
+                        break;
+                    }
+
+                    // Empty (but not invalid) JSON response
+                    if(oResponse.indexOf("{}") === 0) {
+                        break;
+                    }
+
+                    // Turn the string into an object literal...
+                    // ...eval is necessary here
+                    var jsonObjRaw = eval("(" + oResponse + ")");
+                    if(!jsonObjRaw) {
+                        bError = true;
+                        break;
+                    }
+
+                    // Grab the object member that contains an array of all reponses...
+                    // ...eval is necessary here since aSchema[0] is of unknown depth
+                    jsonList = eval("(jsonObjRaw." + aSchema[0]+")");
+                }
+                catch(e) {
+                    bError = true;
+                    break;
+               }
+            }
+
+            if(!jsonList) {
+                bError = true;
+                break;
+            }
+
+            if(!YAHOO.lang.isArray(jsonList)) {
+                jsonList = [jsonList];
+            }
+            
+            // Loop through the array of all responses...
+            for(var i = jsonList.length-1; i >= 0 ; i--) {
+                var aResultItem = [];
+                var jsonResult = jsonList[i];
+                // ...and loop through each data field value of each response
+                for(var j = aSchema.length-1; j >= 1 ; j--) {
+                    // ...and capture data into an array mapped according to the schema...
+                    var dataFieldValue = jsonResult[aSchema[j]];
+                    if(!dataFieldValue) {
+                        dataFieldValue = "";
+                    }
+                    aResultItem.unshift(dataFieldValue);
+                }
+                // If schema isn't well defined, pass along the entire result object
+                if(aResultItem.length == 1) {
+                    aResultItem.push(jsonResult);
+                }
+                // Capture the array of data field values in an array of results
+                aResults.unshift(aResultItem);
+            }
+            break;
+        case YAHOO.widget.DS_XHR.TYPE_XML:
+            // Get the collection of results
+            var xmlList = oResponse.getElementsByTagName(aSchema[0]);
+            if(!xmlList) {
+                bError = true;
+                break;
+            }
+            // Loop through each result
+            for(var k = xmlList.length-1; k >= 0 ; k--) {
+                var result = xmlList.item(k);
+                var aFieldSet = [];
+                // Loop through each data field in each result using the schema
+                for(var m = aSchema.length-1; m >= 1 ; m--) {
+                    var sValue = null;
+                    // Values may be held in an attribute...
+                    var xmlAttr = result.attributes.getNamedItem(aSchema[m]);
+                    if(xmlAttr) {
+                        sValue = xmlAttr.value;
+                    }
+                    // ...or in a node
+                    else{
+                        var xmlNode = result.getElementsByTagName(aSchema[m]);
+                        if(xmlNode && xmlNode.item(0) && xmlNode.item(0).firstChild) {
+                            sValue = xmlNode.item(0).firstChild.nodeValue;
+                        }
+                        else {
+                            sValue = "";
+                        }
+                    }
+                    // Capture the schema-mapped data field values into an array
+                    aFieldSet.unshift(sValue);
+                }
+                // Capture each array of values into an array of results
+                aResults.unshift(aFieldSet);
+            }
+            break;
+        case YAHOO.widget.DS_XHR.TYPE_FLAT:
+            if(oResponse.length > 0) {
+                // Delete the last line delimiter at the end of the data if it exists
+                var newLength = oResponse.length-aSchema[0].length;
+                if(oResponse.substr(newLength) == aSchema[0]) {
+                    oResponse = oResponse.substr(0, newLength);
+                }
+                var aRecords = oResponse.split(aSchema[0]);
+                for(var n = aRecords.length-1; n >= 0; n--) {
+                    aResults[n] = aRecords[n].split(aSchema[1]);
+                }
+            }
+            break;
+        default:
+            break;
+    }
+    sQuery = null;
+    oResponse = null;
+    oParent = null;
+    if(bError) {
+        return null;
+    }
+    else {
+        return aResults;
+    }
+};            
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * XHR connection object.
+ *
+ * @property _oConn
+ * @type Object
+ * @private
+ */
+YAHOO.widget.DS_XHR.prototype._oConn = null;
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Implementation of YAHOO.widget.DataSource using a native Javascript function as
+ * its live data source.
+ *  
+ * @class DS_JSFunction
+ * @constructor
+ * @extends YAHOO.widget.DataSource
+ * @param oFunction {HTMLFunction} In-memory Javascript function that returns query results as an array of objects.
+ * @param oConfigs {Object} (optional) Object literal of config params.
+ */
+YAHOO.widget.DS_JSFunction = function(oFunction, oConfigs) {
+    // Set any config params passed in to override defaults
+    if(oConfigs && (oConfigs.constructor == Object)) {
+        for(var sConfig in oConfigs) {
+            this[sConfig] = oConfigs[sConfig];
+        }
+    }
+
+    // Initialization sequence
+    if(!YAHOO.lang.isFunction(oFunction)) {
+        return;
+    }
+    else {
+        this.dataFunction = oFunction;
+        this._init();
+    }
+};
+
+YAHOO.widget.DS_JSFunction.prototype = new YAHOO.widget.DataSource();
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * In-memory Javascript function that returns query results.
+ *
+ * @property dataFunction
+ * @type HTMLFunction
+ */
+YAHOO.widget.DS_JSFunction.prototype.dataFunction = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Queries the live data source defined by function for results. Results are
+ * passed back to a callback function.
+ *  
+ * @method doQuery
+ * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ */
+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, YAHOO.widget.DataSource.ERROR_DATANULL);
+        return;
+    }
+    
+    var resultObj = {};
+    resultObj.query = decodeURIComponent(sQuery);
+    resultObj.results = aResults;
+    this._addCacheElem(resultObj);
+    
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);
+    oCallbackFn(sQuery, aResults, oParent);
+    return;
+};
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Implementation of YAHOO.widget.DataSource using a native Javascript array as
+ * its live data source.
+ *
+ * @class DS_JSArray
+ * @constructor
+ * @extends YAHOO.widget.DataSource
+ * @param aData {String[]} In-memory Javascript array of simple string data.
+ * @param oConfigs {Object} (optional) Object literal of config params.
+ */
+YAHOO.widget.DS_JSArray = function(aData, oConfigs) {
+    // Set any config params passed in to override defaults
+    if(oConfigs && (oConfigs.constructor == Object)) {
+        for(var sConfig in oConfigs) {
+            this[sConfig] = oConfigs[sConfig];
+        }
+    }
+
+    // Initialization sequence
+    if(!YAHOO.lang.isArray(aData)) {
+        return;
+    }
+    else {
+        this.data = aData;
+        this._init();
+    }
+};
+
+YAHOO.widget.DS_JSArray.prototype = new YAHOO.widget.DataSource();
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * In-memory Javascript array of strings.
+ *
+ * @property data
+ * @type Array
+ */
+YAHOO.widget.DS_JSArray.prototype.data = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Queries the live data source defined by data for results. Results are passed
+ * back to a callback function.
+ *
+ * @method doQuery
+ * @param oCallbackFn {HTMLFunction} Callback function defined by oParent object to which to return results.
+ * @param sQuery {String} Query string.
+ * @param oParent {Object} The object instance that has requested data.
+ */
+YAHOO.widget.DS_JSArray.prototype.doQuery = function(oCallbackFn, sQuery, oParent) {
+    var i;
+    var aData = this.data; // the array
+    var aResults = []; // container for results
+    var bMatchFound = false;
+    var bMatchContains = this.queryMatchContains;
+    if(sQuery) {
+        if(!this.queryMatchCase) {
+            sQuery = sQuery.toLowerCase();
+        }
+
+        // Loop through each element of the array...
+        // which can be a string or an array of strings
+        for(i = aData.length-1; i >= 0; i--) {
+            var aDataset = [];
+
+            if(YAHOO.lang.isString(aData[i])) {
+                aDataset[0] = aData[i];
+            }
+            else if(YAHOO.lang.isArray(aData[i])) {
+                aDataset = aData[i];
+            }
+
+            if(YAHOO.lang.isString(aDataset[0])) {
+                var sKeyIndex = (this.queryMatchCase) ?
+                encodeURIComponent(aDataset[0]).indexOf(sQuery):
+                encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);
+
+                // A STARTSWITH match is when the query is found at the beginning of the key string...
+                if((!bMatchContains && (sKeyIndex === 0)) ||
+                // A CONTAINS match is when the query is found anywhere within the key string...
+                (bMatchContains && (sKeyIndex > -1))) {
+                    // Stash a match into aResults[].
+                    aResults.unshift(aDataset);
+                }
+            }
+        }
+    }
+    else {
+        for(i = aData.length-1; i >= 0; i--) {
+            if(YAHOO.lang.isString(aData[i])) {
+                aResults.unshift([aData[i]]);
+            }
+            else if(YAHOO.lang.isArray(aData[i])) {
+                aResults.unshift(aData[i]);
+            }
+        }
+    }
+    
+    this.getResultsEvent.fire(this, oParent, sQuery, aResults);
+    oCallbackFn(sQuery, aResults, oParent);
+};
+
+YAHOO.register("autocomplete", YAHOO.widget.AutoComplete, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/button-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/button-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/button-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,4534 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+* @module button
+* @description <p>The Button Control enables the creation of rich, graphical 
+* buttons that function like traditional HTML form buttons.  <em>Unlike</em> 
+* tradition HTML form buttons, buttons created with the Button Control can have 
+* a label that is different from its value.  With the inclusion of the optional 
+* <a href="module_menu.html">Menu Control</a>, the Button Control can also be
+* used to create menu buttons and split buttons, controls that are not 
+* available natively in HTML.  The Button Control can also be thought of as a 
+* way to create more visually engaging implementations of the browser's 
+* default radio-button and check-box controls.</p>
+* <p>The Button Control supports the following types:</p>
+* <dl>
+* <dt>push</dt>
+* <dd>Basic push button that can execute a user-specified command when 
+* pressed.</dd>
+* <dt>link</dt>
+* <dd>Navigates to a specified url when pressed.</dd>
+* <dt>submit</dt>
+* <dd>Submits the parent form when pressed.</dd>
+* <dt>reset</dt>
+* <dd>Resets the parent form when pressed.</dd>
+* <dt>checkbox</dt>
+* <dd>Maintains a "checked" state that can be toggled on and off.</dd>
+* <dt>radio</dt>
+* <dd>Maintains a "checked" state that can be toggled on and off.  Use with 
+* the ButtonGroup class to create a set of controls that are mutually 
+* exclusive; checking one button in the set will uncheck all others in 
+* the group.</dd>
+* <dt>menu</dt>
+* <dd>When pressed will show/hide a menu.</dd>
+* <dt>split</dt>
+* <dd>Can execute a user-specified command or display a menu when pressed.</dd>
+* </dl>
+* @title Button
+* @namespace YAHOO.widget
+* @requires yahoo, dom, element, event
+* @optional container, menu
+* @beta
+*/
+
+
+(function () {
+
+
+    /**
+    * The Button class creates a rich, graphical button.
+    * @param {String} p_oElement String specifying the id attribute of the 
+    * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>,
+    * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to 
+    * be used to create the button.
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://www.w3.org
+    * /TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-34812697">
+    * HTMLButtonElement</a>|<a href="
+    * http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#
+    * ID-33759296">HTMLElement</a>} p_oElement Object reference for the 
+    * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>, 
+    * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to be 
+    * used to create the button.
+    * @param {Object} p_oElement Object literal specifying a set of   
+    * configuration attributes used to create the button.
+    * @param {Object} p_oAttributes Optional. Object literal specifying a set  
+    * of configuration attributes used to create the button.
+    * @namespace YAHOO.widget
+    * @class Button
+    * @constructor
+    * @extends YAHOO.util.Element
+    */
+
+
+
+    // Shorthard for utilities
+
+    var Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event,
+        Lang = YAHOO.lang,
+        Overlay = YAHOO.widget.Overlay,
+        Menu = YAHOO.widget.Menu,
+    
+    
+        // Private member variables
+    
+        m_oButtons = {},    // Collection of all Button instances
+        m_oOverlayManager = null,   // YAHOO.widget.OverlayManager instance
+        m_oSubmitTrigger = null,    // The button that submitted the form 
+        m_oFocusedButton = null;    // The button that has focus
+
+
+
+    // Private methods
+
+    
+    
+    /**
+    * @method createInputElement
+    * @description Creates an <code>&#60;input&#62;</code> element of the 
+    * specified type.
+    * @private
+    * @param {String} p_sType String specifying the type of 
+    * <code>&#60;input&#62;</code> element to create.
+    * @param {String} p_sName String specifying the name of 
+    * <code>&#60;input&#62;</code> element to create.
+    * @param {String} p_sValue String specifying the value of 
+    * <code>&#60;input&#62;</code> element to create.
+    * @param {String} p_bChecked Boolean specifying if the  
+    * <code>&#60;input&#62;</code> element is to be checked.
+    * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-6043025">HTMLInputElement</a>}
+    */
+    function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) {
+    
+        var oInput,
+            sInput;
+    
+        if (Lang.isString(p_sType) && Lang.isString(p_sName)) {
+        
+            if (YAHOO.env.ua.ie) {
+        
+                /*
+                    For IE it is necessary to create the element with the 
+                    "type," "name," "value," and "checked" properties set all 
+                    at once.
+                */
+            
+                sInput = "<input type=\"" + p_sType + "\" name=\"" + 
+                    p_sName + "\"";
+        
+                if (p_bChecked) {
+        
+                    sInput += " checked";
+                
+                }
+                
+                sInput += ">";
+        
+                oInput = document.createElement(sInput);
+        
+            }
+            else {
+            
+                oInput = document.createElement("input");
+                oInput.name = p_sName;
+                oInput.type = p_sType;
+        
+                if (p_bChecked) {
+        
+                    oInput.checked = true;
+                
+                }
+        
+            }
+        
+            oInput.value = p_sValue;
+            
+            return oInput;
+        
+        }
+    
+    }
+    
+    
+    /**
+    * @method setAttributesFromSrcElement
+    * @description Gets the values for all the attributes of the source element 
+    * (either <code>&#60;input&#62;</code> or <code>&#60;a&#62;</code>) that 
+    * map to Button configuration attributes and sets them into a collection 
+    * that is passed to the Button constructor.
+    * @private
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://www.w3.org/
+    * TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-
+    * 48250443">HTMLAnchorElement</a>} p_oElement Object reference to the HTML 
+    * element (either <code>&#60;input&#62;</code> or <code>&#60;span&#62;
+    * </code>) used to create the button.
+    * @param {Object} p_oAttributes Object reference for the collection of 
+    * configuration attributes used to create the button.
+    */
+    function setAttributesFromSrcElement(p_oElement, p_oAttributes) {
+    
+        var sSrcElementNodeName = p_oElement.nodeName.toUpperCase(),
+            me = this,
+            oAttribute,
+            oRootNode,
+            sText;
+            
+    
+        /**
+        * @method setAttributeFromDOMAttribute
+        * @description Gets the value of the specified DOM attribute and sets it 
+        * into the collection of configuration attributes used to configure 
+        * the button.
+        * @private
+        * @param {String} p_sAttribute String representing the name of the 
+        * attribute to retrieve from the DOM element.
+        */
+        function setAttributeFromDOMAttribute(p_sAttribute) {
+    
+            if (!(p_sAttribute in p_oAttributes)) {
+    
+                /*
+                    Need to use "getAttributeNode" instead of "getAttribute" 
+                    because using "getAttribute," IE will return the innerText 
+                    of a <code>&#60;button&#62;</code> for the value attribute  
+                    rather than the value of the "value" attribute.
+                */
+        
+                oAttribute = p_oElement.getAttributeNode(p_sAttribute);
+        
+    
+                if (oAttribute && ("value" in oAttribute)) {
+    
+    
+                    p_oAttributes[p_sAttribute] = oAttribute.value;
+    
+                }
+    
+            }
+        
+        }
+    
+    
+        /**
+        * @method setFormElementProperties
+        * @description Gets the value of the attributes from the form element  
+        * and sets them into the collection of configuration attributes used to 
+        * configure the button.
+        * @private
+        */
+        function setFormElementProperties() {
+    
+            setAttributeFromDOMAttribute("type");
+    
+            if (p_oAttributes.type == "button") {
+            
+                p_oAttributes.type = "push";
+            
+            }
+    
+            if (!("disabled" in p_oAttributes)) {
+    
+                p_oAttributes.disabled = p_oElement.disabled;
+    
+            }
+    
+            setAttributeFromDOMAttribute("name");
+            setAttributeFromDOMAttribute("value");
+            setAttributeFromDOMAttribute("title");
+    
+        }
+
+    
+        switch (sSrcElementNodeName) {
+        
+        case "A":
+            
+            p_oAttributes.type = "link";
+            
+            setAttributeFromDOMAttribute("href");
+            setAttributeFromDOMAttribute("target");
+        
+            break;
+    
+        case "INPUT":
+
+            setFormElementProperties();
+
+            if (!("checked" in p_oAttributes)) {
+    
+                p_oAttributes.checked = p_oElement.checked;
+    
+            }
+
+            break;
+
+        case "BUTTON":
+
+            setFormElementProperties();
+
+            oRootNode = p_oElement.parentNode.parentNode;
+
+            if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-checked")) {
+            
+                p_oAttributes.checked = true;
+            
+            }
+
+            if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-disabled")) {
+
+                p_oAttributes.disabled = true;
+            
+            }
+
+            p_oElement.removeAttribute("value");
+
+            p_oElement.setAttribute("type", "button");
+
+            break;
+        
+        }
+
+        p_oElement.removeAttribute("id");
+        p_oElement.removeAttribute("name");
+        
+        if (!("tabindex" in p_oAttributes)) {
+
+            p_oAttributes.tabindex = p_oElement.tabIndex;
+
+        }
+    
+        if (!("label" in p_oAttributes)) {
+    
+            // Set the "label" property
+        
+            sText = sSrcElementNodeName == "INPUT" ? 
+                            p_oElement.value : p_oElement.innerHTML;
+        
+    
+            if (sText && sText.length > 0) {
+                
+                p_oAttributes.label = sText;
+                
+            } 
+    
+        }
+    
+    }
+    
+    
+    /**
+    * @method initConfig
+    * @description Initializes the set of configuration attributes that are 
+    * used to instantiate the button.
+    * @private
+    * @param {Object} Object representing the button's set of 
+    * configuration attributes.
+    */
+    function initConfig(p_oConfig) {
+    
+        var oAttributes = p_oConfig.attributes,
+            oSrcElement = oAttributes.srcelement,
+            sSrcElementNodeName = oSrcElement.nodeName.toUpperCase(),
+            me = this;
+    
+    
+        if (sSrcElementNodeName == this.NODE_NAME) {
+    
+            p_oConfig.element = oSrcElement;
+            p_oConfig.id = oSrcElement.id;
+
+            Dom.getElementsBy(function (p_oElement) {
+            
+                switch (p_oElement.nodeName.toUpperCase()) {
+                
+                case "BUTTON":
+                case "A":
+                case "INPUT":
+
+                    setAttributesFromSrcElement.call(me, p_oElement, 
+                        oAttributes);
+
+                    break;                        
+                
+                }
+            
+            }, "*", oSrcElement);
+        
+        }
+        else {
+    
+            switch (sSrcElementNodeName) {
+
+            case "BUTTON":
+            case "A":
+            case "INPUT":
+
+                setAttributesFromSrcElement.call(this, oSrcElement, 
+                    oAttributes);
+
+                break;
+
+            }
+        
+        }
+    
+    }
+
+
+
+    //  Constructor
+
+    YAHOO.widget.Button = function (p_oElement, p_oAttributes) {
+    
+        var fnSuperClass = YAHOO.widget.Button.superclass.constructor,
+            oConfig,
+            oElement;
+    
+        if (arguments.length == 1 && !Lang.isString(p_oElement) && 
+            !p_oElement.nodeName) {
+    
+            if (!p_oElement.id) {
+    
+                p_oElement.id = Dom.generateId();
+    
+    
+            }
+    
+    
+    
+            fnSuperClass.call(this, 
+                (this.createButtonElement(p_oElement.type)),
+                p_oElement);
+    
+        }
+        else {
+    
+            oConfig = { element: null, attributes: (p_oAttributes || {}) };
+    
+    
+            if (Lang.isString(p_oElement)) {
+    
+                oElement = Dom.get(p_oElement);
+    
+                if (oElement) {
+
+                    if (!oConfig.attributes.id) {
+                    
+                        oConfig.attributes.id = p_oElement;
+                    
+                    }
+    
+                
+                
+                
+                    oConfig.attributes.srcelement = oElement;
+                
+                    initConfig.call(this, oConfig);
+                
+                
+                    if (!oConfig.element) {
+                
+                
+                        oConfig.element = 
+                            this.createButtonElement(oConfig.attributes.type);
+                
+                    }
+                
+                    fnSuperClass.call(this, oConfig.element, 
+                        oConfig.attributes);
+    
+                }
+    
+            }
+            else if (p_oElement.nodeName) {
+    
+                if (!oConfig.attributes.id) {
+    
+                    if (p_oElement.id) {
+        
+                        oConfig.attributes.id = p_oElement.id;
+                    
+                    }
+                    else {
+        
+                        oConfig.attributes.id = Dom.generateId();
+        
+        
+                    }
+    
+                }
+    
+    
+    
+    
+    
+                oConfig.attributes.srcelement = p_oElement;
+        
+                initConfig.call(this, oConfig);
+        
+        
+                if (!oConfig.element) {
+    
+            
+                    oConfig.element = 
+                        this.createButtonElement(oConfig.attributes.type);
+            
+                }
+            
+                fnSuperClass.call(this, oConfig.element, oConfig.attributes);
+            
+            }
+    
+        }
+    
+    };
+
+
+
+    YAHOO.extend(YAHOO.widget.Button, YAHOO.util.Element, {
+    
+    
+        // Protected properties
+        
+        
+        /** 
+        * @property _button
+        * @description Object reference to the button's internal 
+        * <code>&#60;a&#62;</code> or <code>&#60;button&#62;</code> element.
+        * @default null
+        * @protected
+        * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-48250443">HTMLAnchorElement</a>|<a href="
+        * http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html
+        * #ID-34812697">HTMLButtonElement</a>
+        */
+        _button: null,
+        
+        
+        /** 
+        * @property _menu
+        * @description Object reference to the button's menu.
+        * @default null
+        * @protected
+        * @type {<a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>|
+        * <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>}
+        */
+        _menu: null,
+        
+        
+        /** 
+        * @property _hiddenFields
+        * @description Object reference to the <code>&#60;input&#62;</code>  
+        * element, or array of HTML form elements used to represent the button
+        *  when its parent form is submitted.
+        * @default null
+        * @protected
+        * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array
+        */
+        _hiddenFields: null,
+        
+        
+        /** 
+        * @property _onclickAttributeValue
+        * @description Object reference to the button's current value for the 
+        * "onclick" configuration attribute.
+        * @default null
+        * @protected
+        * @type Object
+        */
+        _onclickAttributeValue: null,
+        
+        
+        /** 
+        * @property _activationKeyPressed
+        * @description Boolean indicating if the key(s) that toggle the button's 
+        * "active" state have been pressed.
+        * @default false
+        * @protected
+        * @type Boolean
+        */
+        _activationKeyPressed: false,
+        
+        
+        /** 
+        * @property _activationButtonPressed
+        * @description Boolean indicating if the mouse button that toggles 
+        * the button's "active" state has been pressed.
+        * @default false
+        * @protected
+        * @type Boolean
+        */
+        _activationButtonPressed: false,
+        
+        
+        /** 
+        * @property _hasKeyEventHandlers
+        * @description Boolean indicating if the button's "blur", "keydown" and 
+        * "keyup" event handlers are assigned
+        * @default false
+        * @protected
+        * @type Boolean
+        */
+        _hasKeyEventHandlers: false,
+        
+        
+        /** 
+        * @property _hasMouseEventHandlers
+        * @description Boolean indicating if the button's "mouseout," 
+        * "mousedown," and "mouseup" event handlers are assigned
+        * @default false
+        * @protected
+        * @type Boolean
+        */
+        _hasMouseEventHandlers: false,
+        
+        
+        
+        // Constants
+        
+        
+        /**
+        * @property NODE_NAME
+        * @description The name of the node to be used for the button's 
+        * root element.
+        * @default "SPAN"
+        * @final
+        * @type String
+        */
+        NODE_NAME: "SPAN",
+        
+        
+        /**
+        * @property CHECK_ACTIVATION_KEYS
+        * @description Array of numbers representing keys that (when pressed) 
+        * toggle the button's "checked" attribute.
+        * @default [32]
+        * @final
+        * @type Array
+        */
+        CHECK_ACTIVATION_KEYS: [32],
+        
+        
+        /**
+        * @property ACTIVATION_KEYS
+        * @description Array of numbers representing keys that (when presed) 
+        * toggle the button's "active" state.
+        * @default [13, 32]
+        * @final
+        * @type Array
+        */
+        ACTIVATION_KEYS: [13, 32],
+        
+        
+        /**
+        * @property OPTION_AREA_WIDTH
+        * @description Width (in pixels) of the area of a split button that  
+        * when pressed will display a menu.
+        * @default 20
+        * @final
+        * @type Number
+        */
+        OPTION_AREA_WIDTH: 20,
+        
+        
+        /**
+        * @property CSS_CLASS_NAME
+        * @description String representing the CSS class(es) to be applied to  
+        * the button's root element.
+        * @default "yui-button"
+        * @final
+        * @type String
+        */
+        CSS_CLASS_NAME: "yui-button",
+        
+        
+        /**
+        * @property RADIO_DEFAULT_TITLE
+        * @description String representing the default title applied to buttons 
+        * of type "radio." 
+        * @default "Unchecked.  Click to check."
+        * @final
+        * @type String
+        */
+        RADIO_DEFAULT_TITLE: "Unchecked.  Click to check.",
+        
+        
+        /**
+        * @property RADIO_CHECKED_TITLE
+        * @description String representing the title applied to buttons of 
+        * type "radio" when checked.
+        * @default "Checked.  Click to uncheck."
+        * @final
+        * @type String
+        */
+        RADIO_CHECKED_TITLE: "Checked.  Click to uncheck.",
+        
+        
+        /**
+        * @property CHECKBOX_DEFAULT_TITLE
+        * @description String representing the default title applied to 
+        * buttons of type "checkbox." 
+        * @default "Unchecked.  Click to check."
+        * @final
+        * @type String
+        */
+        CHECKBOX_DEFAULT_TITLE: "Unchecked.  Click to check.",
+        
+        
+        /**
+        * @property CHECKBOX_CHECKED_TITLE
+        * @description String representing the title applied to buttons of type 
+        * "checkbox" when checked.
+        * @default "Checked.  Click to uncheck."
+        * @final
+        * @type String
+        */
+        CHECKBOX_CHECKED_TITLE: "Checked.  Click to uncheck.",
+        
+        
+        /**
+        * @property MENUBUTTON_DEFAULT_TITLE
+        * @description String representing the default title applied to 
+        * buttons of type "menu." 
+        * @default "Menu collapsed.  Click to expand."
+        * @final
+        * @type String
+        */
+        MENUBUTTON_DEFAULT_TITLE: "Menu collapsed.  Click to expand.",
+        
+        
+        /**
+        * @property MENUBUTTON_MENU_VISIBLE_TITLE
+        * @description String representing the title applied to buttons of type 
+        * "menu" when the button's menu is visible. 
+        * @default "Menu expanded.  Click or press Esc to collapse."
+        * @final
+        * @type String
+        */
+        MENUBUTTON_MENU_VISIBLE_TITLE: 
+            "Menu expanded.  Click or press Esc to collapse.",
+        
+        
+        /**
+        * @property SPLITBUTTON_DEFAULT_TITLE
+        * @description  String representing the default title applied to 
+        * buttons of type "split." 
+        * @default "Menu collapsed.  Click inside option region or press 
+        * Ctrl + Shift + M to show the menu."
+        * @final
+        * @type String
+        */
+        SPLITBUTTON_DEFAULT_TITLE: ("Menu collapsed.  Click inside option " + 
+            "region or press Ctrl + Shift + M to show the menu."),
+        
+        
+        /**
+        * @property SPLITBUTTON_OPTION_VISIBLE_TITLE
+        * @description String representing the title applied to buttons of type 
+        * "split" when the button's menu is visible. 
+        * @default "Menu expanded.  Press Esc or Ctrl + Shift + M to hide 
+        * the menu."
+        * @final
+        * @type String
+        */
+        SPLITBUTTON_OPTION_VISIBLE_TITLE: 
+            "Menu expanded.  Press Esc or Ctrl + Shift + M to hide the menu.",
+        
+        
+        /**
+        * @property SUBMIT_TITLE
+        * @description String representing the title applied to buttons of 
+        * type "submit." 
+        * @default "Click to submit form."
+        * @final
+        * @type String
+        */
+        SUBMIT_TITLE: "Click to submit form.",
+        
+        
+        
+        // Protected attribute setter methods
+        
+        
+        /**
+        * @method _setType
+        * @description Sets the value of the button's "type" attribute.
+        * @protected
+        * @param {String} p_sType String indicating the value for the button's 
+        * "type" attribute.
+        */
+        _setType: function (p_sType) {
+        
+            if (p_sType == "split") {
+        
+                this.on("option", this._onOption);
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setLabel
+        * @description Sets the value of the button's "label" attribute.
+        * @protected
+        * @param {String} p_sLabel String indicating the value for the button's 
+        * "label" attribute.
+        */
+        _setLabel: function (p_sLabel) {
+
+            this._button.innerHTML = p_sLabel;
+            
+            /*
+                Remove and add the default class name from the root element
+                for Gecko to ensure that the button shrinkwraps to the label.
+                Without this the button will not be rendered at the correct 
+                width when the label changes.  The most likely cause for this 
+                bug is button's use of the Gecko-specific CSS display type of 
+                "-moz-inline-box" to simulate "inline-block" supported by IE, 
+                Safari and Opera.
+            */
+            
+            var sClass,
+                me;
+            
+            if (YAHOO.env.ua.gecko && Dom.inDocument(this.get("element"))) {
+            
+                me = this;
+                sClass = this.CSS_CLASS_NAME;                
+
+                this.removeClass(sClass);
+                
+                window.setTimeout(function () {
+                
+                    me.addClass(sClass);
+                
+                }, 0);
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setTabIndex
+        * @description Sets the value of the button's "tabindex" attribute.
+        * @protected
+        * @param {Number} p_nTabIndex Number indicating the value for the 
+        * button's "tabindex" attribute.
+        */
+        _setTabIndex: function (p_nTabIndex) {
+        
+            this._button.tabIndex = p_nTabIndex;
+        
+        },
+        
+        
+        /**
+        * @method _setTitle
+        * @description Sets the value of the button's "title" attribute.
+        * @protected
+        * @param {String} p_nTabIndex Number indicating the value for 
+        * the button's "title" attribute.
+        */
+        _setTitle: function (p_sTitle) {
+        
+            var sTitle = p_sTitle;
+        
+            if (this.get("type") != "link") {
+        
+                if (!sTitle) {
+        
+                    switch (this.get("type")) {
+        
+                    case "radio":
+    
+                        sTitle = this.RADIO_DEFAULT_TITLE;
+    
+                        break;
+    
+                    case "checkbox":
+    
+                        sTitle = this.CHECKBOX_DEFAULT_TITLE;
+    
+                        break;
+                    
+                    case "menu":
+    
+                        sTitle = this.MENUBUTTON_DEFAULT_TITLE;
+    
+                        break;
+    
+                    case "split":
+    
+                        sTitle = this.SPLITBUTTON_DEFAULT_TITLE;
+    
+                        break;
+    
+                    case "submit":
+    
+                        sTitle = this.SUBMIT_TITLE;
+    
+                        break;
+        
+                    }
+        
+                }
+        
+                this._button.title = sTitle;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setDisabled
+        * @description Sets the value of the button's "disabled" attribute.
+        * @protected
+        * @param {Boolean} p_bDisabled Boolean indicating the value for 
+        * the button's "disabled" attribute.
+        */
+        _setDisabled: function (p_bDisabled) {
+        
+            if (this.get("type") != "link") {
+        
+                if (p_bDisabled) {
+        
+                    if (this._menu) {
+        
+                        this._menu.hide();
+        
+                    }
+        
+                    if (this.hasFocus()) {
+                    
+                        this.blur();
+                    
+                    }
+        
+                    this._button.setAttribute("disabled", "disabled");
+        
+                    this.addStateCSSClasses("disabled");
+
+                    this.removeStateCSSClasses("hover");
+                    this.removeStateCSSClasses("active");
+                    this.removeStateCSSClasses("focus");
+        
+                }
+                else {
+        
+                    this._button.removeAttribute("disabled");
+        
+                    this.removeStateCSSClasses("disabled");
+                
+                }
+        
+            }
+        
+        },
+
+        
+        /**
+        * @method _setHref
+        * @description Sets the value of the button's "href" attribute.
+        * @protected
+        * @param {String} p_sHref String indicating the value for the button's 
+        * "href" attribute.
+        */
+        _setHref: function (p_sHref) {
+        
+            if (this.get("type") == "link") {
+        
+                this._button.href = p_sHref;
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setTarget
+        * @description Sets the value of the button's "target" attribute.
+        * @protected
+        * @param {String} p_sTarget String indicating the value for the button's 
+        * "target" attribute.
+        */
+        _setTarget: function (p_sTarget) {
+        
+            if (this.get("type") == "link") {
+        
+                this._button.setAttribute("target", p_sTarget);
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setChecked
+        * @description Sets the value of the button's "target" attribute.
+        * @protected
+        * @param {Boolean} p_bChecked Boolean indicating the value for  
+        * the button's "checked" attribute.
+        */
+        _setChecked: function (p_bChecked) {
+        
+            var sType = this.get("type"),
+                sTitle;
+        
+            if (sType == "checkbox" || sType == "radio") {
+        
+                if (p_bChecked) {
+        
+                    this.addStateCSSClasses("checked");
+                    
+                    sTitle = (sType == "radio") ? 
+                                this.RADIO_CHECKED_TITLE : 
+                                this.CHECKBOX_CHECKED_TITLE;
+                
+                }
+                else {
+
+                    this.removeStateCSSClasses("checked");
+        
+                    sTitle = (sType == "radio") ? 
+                                this.RADIO_DEFAULT_TITLE : 
+                                this.CHECKBOX_DEFAULT_TITLE;
+                
+                }
+        
+                this.set("title", sTitle);
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setMenu
+        * @description Sets the value of the button's "menu" attribute.
+        * @protected
+        * @param {Object} p_oMenu Object indicating the value for the button's 
+        * "menu" attribute.
+        */
+        _setMenu: function (p_oMenu) {
+
+            var bLazyLoad = this.get("lazyloadmenu"),
+                oButtonElement = this.get("element"),
+                sMenuCSSClassName = Menu.prototype.CSS_CLASS_NAME,
+        
+                /*
+                    Boolean indicating if the value of p_oMenu is an instance 
+                    of YAHOO.widget.Menu or YAHOO.widget.Overlay.
+                */
+        
+                bInstance = false,
+        
+
+                oMenu,
+                oMenuElement,
+                oSrcElement,
+                aItems,
+                nItems,
+                oItem,
+                i;
+        
+        
+            if (!Overlay) {
+        
+        
+                return false;
+            
+            }
+        
+        
+            if (!Menu) {
+        
+        
+                return false;
+            
+            }
+        
+        
+            function onAppendTo() {
+
+                oMenu.render(oButtonElement.parentNode);
+                
+                this.removeListener("appendTo", onAppendTo);
+            
+            }
+        
+        
+            function initMenu() {
+        
+                if (oMenu) {
+
+                    Dom.addClass(oMenu.element, this.get("menuclassname"));
+                    Dom.addClass(oMenu.element, 
+                            "yui-" + this.get("type") + "-button-menu");
+
+                    oMenu.showEvent.subscribe(this._onMenuShow, null, this);
+                    oMenu.hideEvent.subscribe(this._onMenuHide, null, this);
+                    oMenu.renderEvent.subscribe(this._onMenuRender, null, this);
+        
+        
+                    if (oMenu instanceof Menu) {
+        
+                        oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, 
+                            this, true);
+
+                        oMenu.subscribe("click", this._onMenuClick, 
+                            this, true);
+
+                        oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded, 
+                            this, true);
+        
+                        oSrcElement = oMenu.srcElement;
+        
+                        if (oSrcElement && 
+                            oSrcElement.nodeName.toUpperCase() == "SELECT") {
+                
+                            oSrcElement.style.display = "none";
+                            oSrcElement.parentNode.removeChild(oSrcElement);
+        
+                        }
+        
+                    }
+                    else if (oMenu instanceof Overlay) {
+        
+                        if (!m_oOverlayManager) {
+        
+                            m_oOverlayManager = 
+                                new YAHOO.widget.OverlayManager();
+                        
+                        }
+                        
+                        m_oOverlayManager.register(oMenu);
+                        
+                    }
+        
+        
+                    this._menu = oMenu;
+
+        
+                    if (!bInstance) {
+        
+                        if (bLazyLoad && !(oMenu instanceof Menu)) {
+        
+                            /*
+                                Mimic Menu's "lazyload" functionality by adding  
+                                a "beforeshow" event listener that renders the 
+                                Overlay instance before it is made visible by  
+                                the button.
+                            */
+        
+                            oMenu.beforeShowEvent.subscribe(
+                                this._onOverlayBeforeShow, null, this);
+            
+                        }
+                        else if (!bLazyLoad) {
+        
+                            if (Dom.inDocument(oButtonElement)) {
+        
+                                oMenu.render(oButtonElement.parentNode);
+                            
+                            }
+                            else {
+            
+                                this.on("appendTo", onAppendTo);
+                            
+                            }
+                        
+                        }
+                    
+                    }
+        
+                }
+        
+            }
+        
+        
+            if (p_oMenu && (p_oMenu instanceof Menu)) {
+        
+                oMenu = p_oMenu;
+                aItems = oMenu.getItems();
+                nItems = aItems.length;
+                bInstance = true;
+        
+        
+                if (nItems > 0) {
+        
+                    i = nItems - 1;
+        
+                    do {
+        
+                        oItem = aItems[i];
+        
+                        if (oItem) {
+        
+                            oItem.cfg.subscribeToConfigEvent("selected", 
+                                this._onMenuItemSelected, 
+                                oItem, 
+                                this);
+        
+                        }
+        
+                    }
+                    while (i--);
+        
+                }
+        
+                initMenu.call(this);
+        
+            }
+            else if (p_oMenu && (p_oMenu instanceof Overlay)) {
+        
+                oMenu = p_oMenu;
+                bInstance = true;
+        
+                oMenu.cfg.setProperty("visible", false);
+                oMenu.cfg.setProperty("context", [oButtonElement, "tl", "bl"]);
+        
+                initMenu.call(this);
+        
+            }
+            else if (Lang.isArray(p_oMenu)) {
+        
+                this.on("appendTo", function () {
+        
+                    oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, 
+                        itemdata: p_oMenu });
+        
+                    initMenu.call(this);
+        
+                });
+        
+            }
+            else if (Lang.isString(p_oMenu)) {
+        
+                oMenuElement = Dom.get(p_oMenu);
+        
+                if (oMenuElement) {
+        
+                    if (Dom.hasClass(oMenuElement, sMenuCSSClassName) || 
+                        oMenuElement.nodeName.toUpperCase() == "SELECT") {
+            
+                        oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+            
+                        initMenu.call(this);
+            
+                    }
+                    else {
+        
+                        oMenu = new Overlay(p_oMenu, { visible: false, 
+                            context: [oButtonElement, "tl", "bl"] });
+            
+                        initMenu.call(this);
+            
+                    }
+        
+                }
+        
+            }
+            else if (p_oMenu && p_oMenu.nodeName) {
+        
+                if (Dom.hasClass(p_oMenu, sMenuCSSClassName) || 
+                        p_oMenu.nodeName.toUpperCase() == "SELECT") {
+        
+                    oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+                
+                    initMenu.call(this);
+        
+                }
+                else {
+        
+                    if (!p_oMenu.id) {
+                    
+                        Dom.generateId(p_oMenu);
+                    
+                    }
+        
+                    oMenu = new Overlay(p_oMenu, { visible: false, 
+                                    context: [oButtonElement, "tl", "bl"] });
+        
+                    initMenu.call(this);
+                
+                }
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setOnClick
+        * @description Sets the value of the button's "onclick" attribute.
+        * @protected
+        * @param {Object} p_oObject Object indicating the value for the button's 
+        * "onclick" attribute.
+        */
+        _setOnClick: function (p_oObject) {
+        
+            /*
+                Remove any existing listeners if a "click" event handler 
+                has already been specified.
+            */
+        
+            if (this._onclickAttributeValue && 
+                (this._onclickAttributeValue != p_oObject)) {
+        
+                this.removeListener("click", this._onclickAttributeValue.fn);
+        
+                this._onclickAttributeValue = null;
+        
+            }
+        
+        
+            if (!this._onclickAttributeValue && 
+                Lang.isObject(p_oObject) && 
+                Lang.isFunction(p_oObject.fn)) {
+        
+                this.on("click", p_oObject.fn, p_oObject.obj, p_oObject.scope);
+        
+                this._onclickAttributeValue = p_oObject;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _setSelectedMenuItem
+        * @description Sets the value of the button's 
+        * "selectedMenuItem" attribute.
+        * @protected
+        * @param {Number} p_nIndex Number representing the index of the item 
+        * in the button's menu that is currently selected.
+        */
+        _setSelectedMenuItem: function (p_nIndex) {
+
+            var oMenu = this._menu,
+                oMenuItem;
+
+
+            if (oMenu && oMenu instanceof Menu) {
+
+                oMenuItem = oMenu.getItem(p_nIndex);
+                
+
+                if (oMenuItem && !oMenuItem.cfg.getProperty("selected")) {
+                
+                    oMenuItem.cfg.setProperty("selected", true);
+                
+                }
+            
+            }
+
+        },
+        
+        
+        // Protected methods
+
+        
+        
+        /**
+        * @method _isActivationKey
+        * @description Determines if the specified keycode is one that toggles  
+        * the button's "active" state.
+        * @protected
+        * @param {Number} p_nKeyCode Number representing the keycode to 
+        * be evaluated.
+        * @return {Boolean}
+        */
+        _isActivationKey: function (p_nKeyCode) {
+        
+            var sType = this.get("type"),
+                aKeyCodes = (sType == "checkbox" || sType == "radio") ? 
+                    this.CHECK_ACTIVATION_KEYS : this.ACTIVATION_KEYS,
+        
+                nKeyCodes = aKeyCodes.length,
+                i;
+        
+            if (nKeyCodes > 0) {
+        
+                i = nKeyCodes - 1;
+        
+                do {
+        
+                    if (p_nKeyCode == aKeyCodes[i]) {
+        
+                        return true;
+        
+                    }
+        
+                }
+                while (i--);
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _isSplitButtonOptionKey
+        * @description Determines if the specified keycode is one that toggles  
+        * the display of the split button's menu.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        * @return {Boolean}
+        */
+        _isSplitButtonOptionKey: function (p_oEvent) {
+        
+            return (p_oEvent.ctrlKey && p_oEvent.shiftKey && 
+                Event.getCharCode(p_oEvent) == 77);
+        
+        },
+        
+        
+        /**
+        * @method _addListenersToForm
+        * @description Adds event handlers to the button's form.
+        * @protected
+        */
+        _addListenersToForm: function () {
+        
+            var oForm = this.getForm(),
+                onFormKeyPress = YAHOO.widget.Button.onFormKeyPress,
+                bHasKeyPressListener,
+                oSrcElement,
+                aListeners,
+                nListeners,
+                i;
+        
+        
+            if (oForm) {
+        
+                Event.on(oForm, "reset", this._onFormReset, null, this);
+                Event.on(oForm, "submit", this.createHiddenFields, null, this);
+        
+                oSrcElement = this.get("srcelement");
+        
+        
+                if (this.get("type") == "submit" || 
+                    (oSrcElement && oSrcElement.type == "submit")) 
+                {
+                
+                    aListeners = Event.getListeners(oForm, "keypress");
+                    bHasKeyPressListener = false;
+            
+                    if (aListeners) {
+            
+                        nListeners = aListeners.length;
+        
+                        if (nListeners > 0) {
+            
+                            i = nListeners - 1;
+                            
+                            do {
+               
+                                if (aListeners[i].fn == onFormKeyPress) {
+                
+                                    bHasKeyPressListener = true;
+                                    break;
+                                
+                                }
+                
+                            }
+                            while (i--);
+                        
+                        }
+                    
+                    }
+            
+            
+                    if (!bHasKeyPressListener) {
+               
+                        Event.on(oForm, "keypress", onFormKeyPress);
+            
+                    }
+        
+                }
+            
+            }
+        
+        },
+        
+        
+        _originalMaxHeight: -1,
+        
+        
+        /**
+        * @method _showMenu
+        * @description Shows the button's menu.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object 
+        * passed back by the event utility (YAHOO.util.Event) that triggered 
+        * the display of the menu.
+        */
+        _showMenu: function (p_oEvent) {
+        
+            YAHOO.widget.MenuManager.hideVisible();
+        
+            if (m_oOverlayManager) {
+        
+                m_oOverlayManager.hideAll();
+            
+            }
+        
+        
+            var oMenu = this._menu,
+                nViewportHeight = Dom.getViewportHeight(),
+                nMenuHeight,
+                nScrollTop,
+                nY;
+        
+        
+            if (oMenu && (oMenu instanceof Menu)) {
+        
+                oMenu.cfg.applyConfig({ context: [this.get("id"), "tl", "bl"],
+                    constraintoviewport: false,
+                    clicktohide: false,
+                    visible: true });
+                    
+                oMenu.cfg.fireQueue();
+            
+                oMenu.align("tl", "bl");
+        
+                /*
+                    Stop the propagation of the event so that the MenuManager 
+                    doesn't blur the menu after it gets focus.
+                */
+        
+                if (p_oEvent.type == "mousedown") {
+        
+                    Event.stopPropagation(p_oEvent);
+        
+                }
+
+
+                if (this.get("focusmenu")) {
+        
+                    this._menu.focus();
+                
+                }
+        
+                nMenuHeight = oMenu.element.offsetHeight;
+        
+        
+                if ((oMenu.cfg.getProperty("y") + nMenuHeight) > 
+                    nViewportHeight) {
+        
+        
+                    oMenu.align("bl", "tl");
+        
+                    nY = oMenu.cfg.getProperty("y");
+        
+                    nScrollTop = Dom.getDocumentScrollTop();
+        
+        
+                    if (nScrollTop >= nY) {
+        
+                        if (this._originalMaxHeight == -1) {
+        
+                            this._originalMaxHeight = 
+                                    oMenu.cfg.getProperty("maxheight");
+        
+                        }
+        
+                        oMenu.cfg.setProperty("maxheight", 
+                                    (nMenuHeight - ((nScrollTop - nY) + 20)));
+        
+                        oMenu.align("bl", "tl");
+        
+                    }
+        
+                }
+        
+            }
+            else if (oMenu && (oMenu instanceof Overlay)) {
+        
+                oMenu.show();
+                oMenu.align("tl", "bl");
+
+                nMenuHeight = oMenu.element.offsetHeight;
+        
+        
+                if ((oMenu.cfg.getProperty("y") + nMenuHeight) > 
+                    nViewportHeight) {
+        
+        
+                    oMenu.align("bl", "tl");
+                    
+                }
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _hideMenu
+        * @description Hides the button's menu.
+        * @protected
+        */
+        _hideMenu: function () {
+        
+            var oMenu = this._menu;
+        
+            if (oMenu) {
+        
+                oMenu.hide();
+        
+            }
+        
+        },
+        
+        
+        
+        
+        // Protected event handlers
+        
+        
+        /**
+        * @method _onMouseOver
+        * @description "mouseover" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onMouseOver: function (p_oEvent) {
+        
+            if (!this._hasMouseEventHandlers) {
+        
+                this.on("mouseout", this._onMouseOut);
+                this.on("mousedown", this._onMouseDown);
+                this.on("mouseup", this._onMouseUp);
+        
+                this._hasMouseEventHandlers = true;
+        
+            }
+        
+            this.addStateCSSClasses("hover");
+        
+            if (this._activationButtonPressed) {
+        
+                this.addStateCSSClasses("active");
+        
+            }
+        
+        
+            if (this._bOptionPressed) {
+        
+                this.addStateCSSClasses("activeoption");
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onMouseOut
+        * @description "mouseout" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onMouseOut: function (p_oEvent) {
+        
+            this.removeStateCSSClasses("hover");
+        
+            if (this.get("type") != "menu") {
+        
+                this.removeStateCSSClasses("active");
+        
+            }
+        
+            if (this._activationButtonPressed || this._bOptionPressed) {
+        
+                Event.on(document, "mouseup", this._onDocumentMouseUp, 
+                    null, this);
+        
+            }
+            
+        },
+        
+        
+        /**
+        * @method _onDocumentMouseUp
+        * @description "mouseup" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onDocumentMouseUp: function (p_oEvent) {
+        
+            this._activationButtonPressed = false;
+            this._bOptionPressed = false;
+        
+            var sType = this.get("type");
+        
+            if (sType == "menu" || sType == "split") {
+        
+                this.removeStateCSSClasses(
+                    (sType == "menu" ? "active" : "activeoption"));
+        
+                this._hideMenu();
+        
+            }
+        
+            Event.removeListener(document, "mouseup", this._onDocumentMouseUp);
+        
+        },
+        
+        
+        /**
+        * @method _onMouseDown
+        * @description "mousedown" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onMouseDown: function (p_oEvent) {
+        
+            var sType,
+                oElement,
+                nX,
+                me;
+        
+        
+            function onMouseUp() {
+            
+                this._hideMenu();
+                this.removeListener("mouseup", onMouseUp);
+            
+            }
+        
+        
+            if ((p_oEvent.which || p_oEvent.button) == 1) {
+        
+        
+                if (!this.hasFocus()) {
+                
+                    this.focus();
+                
+                }
+        
+        
+                sType = this.get("type");
+        
+        
+                if (sType == "split") {
+                
+                    oElement = this.get("element");
+                    nX = Event.getPageX(p_oEvent) - Dom.getX(oElement);
+        
+                    if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) {
+                        
+                        this.fireEvent("option", p_oEvent);
+        
+                    }
+                    else {
+        
+                        this.addStateCSSClasses("active");
+        
+                        this._activationButtonPressed = true;
+        
+                    }
+        
+                }
+                else if (sType == "menu") {
+        
+                    if (this.isActive()) {
+        
+                        this._hideMenu();
+        
+                        this._activationButtonPressed = false;
+        
+                    }
+                    else {
+        
+                        this._showMenu(p_oEvent);
+        
+                        this._activationButtonPressed = true;
+                    
+                    }
+        
+                }
+                else {
+        
+                    this.addStateCSSClasses("active");
+        
+                    this._activationButtonPressed = true;
+                
+                }
+        
+        
+        
+                if (sType == "split" || sType == "menu") {
+
+                    me = this;
+        
+                    this._hideMenuTimerId = window.setTimeout(function () {
+                    
+                        me.on("mouseup", onMouseUp);
+                    
+                    }, 250);
+        
+                }
+        
+            }
+            
+        },
+        
+        
+        /**
+        * @method _onMouseUp
+        * @description "mouseup" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onMouseUp: function (p_oEvent) {
+        
+            var sType = this.get("type");
+        
+        
+            if (this._hideMenuTimerId) {
+        
+                window.clearTimeout(this._hideMenuTimerId);
+        
+            }
+        
+        
+            if (sType == "checkbox" || sType == "radio") {
+        
+                this.set("checked", !(this.get("checked")));
+            
+            }
+        
+        
+            this._activationButtonPressed = false;
+            
+        
+            if (this.get("type") != "menu") {
+        
+                this.removeStateCSSClasses("active");
+            
+            }
+            
+        },
+        
+        
+        /**
+        * @method _onFocus
+        * @description "focus" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onFocus: function (p_oEvent) {
+        
+            var oElement;
+        
+            this.addStateCSSClasses("focus");
+        
+            if (this._activationKeyPressed) {
+        
+                this.addStateCSSClasses("active");
+           
+            }
+        
+            m_oFocusedButton = this;
+        
+        
+            if (!this._hasKeyEventHandlers) {
+        
+                oElement = this._button;
+        
+                Event.on(oElement, "blur", this._onBlur, null, this);
+                Event.on(oElement, "keydown", this._onKeyDown, null, this);
+                Event.on(oElement, "keyup", this._onKeyUp, null, this);
+        
+                this._hasKeyEventHandlers = true;
+        
+            }
+        
+        
+            this.fireEvent("focus", p_oEvent);
+        
+        },
+        
+        
+        /**
+        * @method _onBlur
+        * @description "blur" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onBlur: function (p_oEvent) {
+        
+            this.removeStateCSSClasses("focus");
+        
+            if (this.get("type") != "menu") {
+        
+                this.removeStateCSSClasses("active");
+
+            }    
+        
+            if (this._activationKeyPressed) {
+        
+                Event.on(document, "keyup", this._onDocumentKeyUp, null, this);
+        
+            }
+        
+        
+            m_oFocusedButton = null;
+        
+            this.fireEvent("blur", p_oEvent);
+           
+        },
+        
+        
+        /**
+        * @method _onDocumentKeyUp
+        * @description "keyup" event handler for the document.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onDocumentKeyUp: function (p_oEvent) {
+        
+            if (this._isActivationKey(Event.getCharCode(p_oEvent))) {
+        
+                this._activationKeyPressed = false;
+                
+                Event.removeListener(document, "keyup", this._onDocumentKeyUp);
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onKeyDown
+        * @description "keydown" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onKeyDown: function (p_oEvent) {
+        
+            var oMenu = this._menu;
+        
+        
+            if (this.get("type") == "split" && 
+                this._isSplitButtonOptionKey(p_oEvent)) {
+        
+                this.fireEvent("option", p_oEvent);
+        
+            }
+            else if (this._isActivationKey(Event.getCharCode(p_oEvent))) {
+        
+                if (this.get("type") == "menu") {
+        
+                    this._showMenu(p_oEvent);
+        
+                }
+                else {
+        
+                    this._activationKeyPressed = true;
+                    
+                    this.addStateCSSClasses("active");
+                
+                }
+            
+            }
+        
+        
+            if (oMenu && oMenu.cfg.getProperty("visible") && 
+                Event.getCharCode(p_oEvent) == 27) {
+            
+                oMenu.hide();
+                this.focus();
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onKeyUp
+        * @description "keyup" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onKeyUp: function (p_oEvent) {
+        
+            var sType;
+        
+            if (this._isActivationKey(Event.getCharCode(p_oEvent))) {
+        
+                sType = this.get("type");
+        
+                if (sType == "checkbox" || sType == "radio") {
+        
+                    this.set("checked", !(this.get("checked")));
+                
+                }
+        
+                this._activationKeyPressed = false;
+        
+                if (this.get("type") != "menu") {
+        
+                    this.removeStateCSSClasses("active");
+        
+                }
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onClick
+        * @description "click" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onClick: function (p_oEvent) {
+        
+            var sType = this.get("type"),
+                sTitle,
+                oForm,
+                oSrcElement,
+                oElement,
+                nX;
+        
+        
+            switch (sType) {
+        
+            case "radio":
+            case "checkbox":
+    
+                if (this.get("checked")) {
+                    
+                    sTitle = (sType == "radio") ? 
+                                this.RADIO_CHECKED_TITLE : 
+                                this.CHECKBOX_CHECKED_TITLE;
+                
+                }
+                else {
+                
+                    sTitle = (sType == "radio") ? 
+                                this.RADIO_DEFAULT_TITLE : 
+                                this.CHECKBOX_DEFAULT_TITLE;
+                
+                }
+                
+                this.set("title", sTitle);
+    
+                break;
+    
+            case "submit":
+    
+                this.submitForm();
+            
+                break;
+    
+            case "reset":
+    
+                oForm = this.getForm();
+    
+                if (oForm) {
+    
+                    oForm.reset();
+                
+                }
+    
+                break;
+    
+            case "menu":
+    
+                sTitle = this._menu.cfg.getProperty("visible") ? 
+                                this.MENUBUTTON_MENU_VISIBLE_TITLE : 
+                                this.MENUBUTTON_DEFAULT_TITLE;
+    
+                this.set("title", sTitle);
+    
+                break;
+    
+            case "split":
+    
+                oElement = this.get("element");
+                nX = Event.getPageX(p_oEvent) - Dom.getX(oElement);
+    
+                if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) {
+    
+                    return false;
+                
+                }
+                else {
+    
+                    this._hideMenu();
+        
+                    oSrcElement = this.get("srcelement");
+        
+                    if (oSrcElement && oSrcElement.type == "submit") {
+    
+                        this.submitForm();
+                    
+                    }
+                
+                }
+    
+                sTitle = this._menu.cfg.getProperty("visible") ? 
+                                this.SPLITBUTTON_OPTION_VISIBLE_TITLE : 
+                                this.SPLITBUTTON_DEFAULT_TITLE;
+    
+                this.set("title", sTitle);
+    
+                break;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onAppendTo
+        * @description "appendTo" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onAppendTo: function (p_oEvent) {
+        
+            /*
+                It is necessary to call "_addListenersToForm" using 
+                "setTimeout" to make sure that the button's "form" property 
+                returns a node reference.  Sometimes, if you try to get the 
+                reference immediately after appending the field, it is null.
+            */
+        
+            var me = this;
+        
+            window.setTimeout(function () {
+        
+                me._addListenersToForm();
+        
+            }, 0);
+        
+        },
+        
+        
+        /**
+        * @method _onFormReset
+        * @description "reset" event handler for the button's form.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event 
+        * object passed back by the event utility (YAHOO.util.Event).
+        */
+        _onFormReset: function (p_oEvent) {
+        
+            var sType = this.get("type"),
+                oMenu = this._menu;
+        
+            if (sType == "checkbox" || sType == "radio") {
+        
+                this.resetValue("checked");
+        
+            }
+        
+        
+            if (oMenu && (oMenu instanceof Menu)) {
+        
+                this.resetValue("selectedMenuItem");
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onDocumentMouseDown
+        * @description "mousedown" event handler for the document.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onDocumentMouseDown: function (p_oEvent) {
+        
+            var oTarget = Event.getTarget(p_oEvent),
+                oButtonElement = this.get("element"),
+                oMenuElement = this._menu.element;
+        
+            if (oTarget != oButtonElement && 
+                !Dom.isAncestor(oButtonElement, oTarget) && 
+                oTarget != oMenuElement && 
+                !Dom.isAncestor(oMenuElement, oTarget)) {
+        
+                this._hideMenu();
+        
+                Event.removeListener(document, "mousedown", 
+                    this._onDocumentMouseDown);    
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onOption
+        * @description "option" event handler for the button.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onOption: function (p_oEvent) {
+        
+            if (this.hasClass("yui-split-button-activeoption")) {
+        
+                this._hideMenu();
+        
+                this._bOptionPressed = false;
+        
+            }
+            else {
+        
+                this._showMenu(p_oEvent);    
+        
+                this._bOptionPressed = true;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onOverlayBeforeShow
+        * @description "beforeshow" event handler for the 
+        * <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a> instance 
+        * serving as the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        */
+        _onOverlayBeforeShow: function (p_sType) {
+        
+            var oMenu = this._menu;
+        
+            oMenu.render(this.get("element").parentNode);
+            
+            oMenu.beforeShowEvent.unsubscribe(this._onOverlayBeforeShow);
+        
+        },
+        
+        
+        /**
+        * @method _onMenuShow
+        * @description "show" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        */
+        _onMenuShow: function (p_sType) {
+        
+            Event.on(document, "mousedown", this._onDocumentMouseDown, 
+                null, this);
+        
+            var sTitle,
+                sState;
+            
+            if (this.get("type") == "split") {
+        
+                sTitle = this.SPLITBUTTON_OPTION_VISIBLE_TITLE;
+                sState = "activeoption";
+            
+            }
+            else {
+        
+                sTitle = this.MENUBUTTON_MENU_VISIBLE_TITLE;        
+                sState = "active";
+        
+            }
+        
+            this.addStateCSSClasses(sState);
+            this.set("title", sTitle);
+        
+        },
+        
+        
+        /**
+        * @method _onMenuHide
+        * @description "hide" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        */
+        _onMenuHide: function (p_sType) {
+            
+            var oMenu = this._menu,
+                sTitle,
+                sState;
+        
+            if (oMenu && (oMenu instanceof Menu) && 
+                this._originalMaxHeight != -1) {
+            
+                this._menu.cfg.setProperty("maxheight", 
+                    this._originalMaxHeight);
+        
+            }
+        
+            
+            if (this.get("type") == "split") {
+        
+                sTitle = this.SPLITBUTTON_DEFAULT_TITLE;
+                sState = "activeoption";
+        
+            }
+            else {
+        
+                sTitle = this.MENUBUTTON_DEFAULT_TITLE;        
+                sState = "active";
+            }
+        
+        
+            this.removeStateCSSClasses(sState);
+            this.set("title", sTitle);
+        
+        
+            if (this.get("type") == "split") {
+        
+                this._bOptionPressed = false;
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onMenuKeyDown
+        * @description "keydown" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        _onMenuKeyDown: function (p_sType, p_aArgs) {
+        
+            var oEvent = p_aArgs[0];
+        
+            if (Event.getCharCode(oEvent) == 27) {
+        
+                this.focus();
+        
+                if (this.get("type") == "split") {
+                
+                    this._bOptionPressed = false;
+                
+                }
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onMenuRender
+        * @description "render" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the  
+        * event thatwas fired.
+        */
+        _onMenuRender: function (p_sType) {
+        
+            var oButtonElement = this.get("element"),
+                oButtonParent = oButtonElement.parentNode,
+                oMenuElement = this._menu.element;
+        
+        
+            if (oButtonParent != oMenuElement.parentNode) {
+        
+                oButtonParent.appendChild(oMenuElement);
+            
+            }
+
+            this.set("selectedMenuItem", this.get("selectedMenuItem"));
+
+        },
+        
+        
+        /**
+        * @method _onMenuItemSelected
+        * @description "selectedchange" event handler for each item in the 
+        * button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        * @param {Number} p_nItem Number representing the index of the menu
+        * item that subscribed to the event.
+        */
+        _onMenuItemSelected: function (p_sType, p_aArgs, p_nItem) {
+
+            var bSelected = p_aArgs[0];
+
+            if (bSelected) {
+            
+                this.set("selectedMenuItem", p_nItem);
+
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onMenuItemAdded
+        * @description "itemadded" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event
+        * was fired.
+        * @param {<a href="YAHOO.widget.MenuItem.html">
+        * YAHOO.widget.MenuItem</a>} p_oItem Object representing the menu 
+        * item that subscribed to the event.
+        */
+        _onMenuItemAdded: function (p_sType, p_aArgs, p_oItem) {
+            
+            var oItem = p_aArgs[0];
+        
+            oItem.cfg.subscribeToConfigEvent("selected", 
+                this._onMenuItemSelected, 
+                oItem.index, 
+                this);
+        
+        },
+        
+        
+        /**
+        * @method _onMenuClick
+        * @description "click" event handler for the button's menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        _onMenuClick: function (p_sType, p_aArgs) {
+
+            var oItem = p_aArgs[1],
+                oSrcElement;
+        
+            if (oItem) {
+        
+                oSrcElement = this.get("srcelement");
+            
+                if (oSrcElement && oSrcElement.type == "submit") {
+        
+                    this.submitForm();
+            
+                }
+            
+                this._hideMenu();
+            
+            }
+        
+        },
+        
+        
+        
+        // Public methods
+        
+        
+        /**
+        * @method createButtonElement
+        * @description Creates the button's HTML elements.
+        * @param {String} p_sType String indicating the type of element 
+        * to create.
+        * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-58190037">HTMLElement</a>}
+        */
+        createButtonElement: function (p_sType) {
+        
+            var sNodeName = this.NODE_NAME,
+                oElement = document.createElement(sNodeName);
+        
+            oElement.innerHTML =  "<" + sNodeName + " class=\"first-child\">" + 
+                (p_sType == "link" ? "<a></a>" : 
+                "<button type=\"button\"></button>") + "</" + sNodeName + ">";
+        
+            return oElement;
+        
+        },
+
+        
+        /**
+        * @method addStateCSSClasses
+        * @description Appends state-specific CSS classes to the button's root 
+        * DOM element.
+        */
+        addStateCSSClasses: function (p_sState) {
+        
+            var sType = this.get("type");
+        
+            if (Lang.isString(p_sState)) {
+        
+                if (p_sState != "activeoption") {
+        
+                    this.addClass(this.CSS_CLASS_NAME + ("-" + p_sState));
+        
+                }
+        
+                this.addClass("yui-" + sType + ("-button-" + p_sState));
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method removeStateCSSClasses
+        * @description Removes state-specific CSS classes to the button's root 
+        * DOM element.
+        */
+        removeStateCSSClasses: function (p_sState) {
+        
+            var sType = this.get("type");
+        
+            if (Lang.isString(p_sState)) {
+        
+                this.removeClass(this.CSS_CLASS_NAME + ("-" + p_sState));
+                this.removeClass("yui-" + sType + ("-button-" + p_sState));
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method createHiddenFields
+        * @description Creates the button's hidden form field and appends it 
+        * to its parent form.
+        * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array}
+        */
+        createHiddenFields: function () {
+        
+            this.removeHiddenFields();
+        
+            var oForm = this.getForm(),
+                oButtonField,
+                sType,     
+                bCheckable,
+                oMenu,
+                oMenuItem,
+                sName,
+                oValue,
+                oMenuField;
+        
+        
+            if (oForm && !this.get("disabled")) {
+        
+                sType = this.get("type");
+                bCheckable = (sType == "checkbox" || sType == "radio");
+        
+        
+                if (bCheckable || (m_oSubmitTrigger == this)) {
+                
+        
+                    oButtonField = createInputElement(
+                                    (bCheckable ? sType : "hidden"),
+                                    this.get("name"),
+                                    this.get("value"),
+                                    this.get("checked"));
+            
+            
+                    if (oButtonField) {
+            
+                        if (bCheckable) {
+            
+                            oButtonField.style.display = "none";
+            
+                        }
+            
+                        oForm.appendChild(oButtonField);
+            
+                    }
+        
+                }
+                    
+        
+                oMenu = this._menu;
+            
+            
+                if (oMenu && (oMenu instanceof Menu)) {
+        
+        
+                    oMenuField = oMenu.srcElement;
+                    oMenuItem = oMenu.getItem(this.get("selectedMenuItem"));
+
+                    if (oMenuItem) {
+
+                        if (oMenuField && 
+                            oMenuField.nodeName.toUpperCase() == "SELECT") {
+            
+                            oForm.appendChild(oMenuField);
+                            oMenuField.selectedIndex = oMenuItem.index;
+            
+                        }
+                        else {
+            
+                            oValue = (oMenuItem.value === null || 
+                                        oMenuItem.value === "") ? 
+                                        oMenuItem.cfg.getProperty("text") : 
+                                        oMenuItem.value;
+            
+                            sName = this.get("name");
+            
+                            if (oValue && sName) {
+            
+                                oMenuField = createInputElement("hidden", 
+                                                    (sName + "_options"),
+                                                    oValue);
+            
+                                oForm.appendChild(oMenuField);
+            
+                            }
+            
+                        }  
+                    
+                    }
+        
+                }
+            
+            
+                if (oButtonField && oMenuField) {
+        
+                    this._hiddenFields = [oButtonField, oMenuField];
+        
+                }
+                else if (!oButtonField && oMenuField) {
+        
+                    this._hiddenFields = oMenuField;
+                
+                }
+                else if (oButtonField && !oMenuField) {
+        
+                    this._hiddenFields = oButtonField;
+                
+                }
+        
+        
+                return this._hiddenFields;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method removeHiddenFields
+        * @description Removes the button's hidden form field(s) from its 
+        * parent form.
+        */
+        removeHiddenFields: function () {
+        
+            var oField = this._hiddenFields,
+                nFields,
+                i;
+        
+            function removeChild(p_oElement) {
+        
+                if (Dom.inDocument(p_oElement)) {
+        
+                    p_oElement.parentNode.removeChild(p_oElement);
+                
+                }
+                
+            }
+            
+        
+            if (oField) {
+        
+                if (Lang.isArray(oField)) {
+        
+                    nFields = oField.length;
+                    
+                    if (nFields > 0) {
+                    
+                        i = nFields - 1;
+                        
+                        do {
+        
+                            removeChild(oField[i]);
+        
+                        }
+                        while (i--);
+                    
+                    }
+                
+                }
+                else {
+        
+                    removeChild(oField);
+        
+                }
+        
+                this._hiddenFields = null;
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method submitForm
+        * @description Submits the form to which the button belongs.  Returns  
+        * true if the form was submitted successfully, false if the submission 
+        * was cancelled.
+        * @protected
+        * @return {Boolean}
+        */
+        submitForm: function () {
+        
+            var oForm = this.getForm(),
+        
+                oSrcElement = this.get("srcelement"),
+        
+                /*
+                    Boolean indicating if the event fired successfully 
+                    (was not cancelled by any handlers)
+                */
+        
+                bSubmitForm = false,
+                
+                oEvent;
+        
+        
+            if (oForm) {
+        
+                if (this.get("type") == "submit" || 
+                    (oSrcElement && oSrcElement.type == "submit")) 
+                {
+        
+                    m_oSubmitTrigger = this;
+                    
+                }
+        
+        
+                if (YAHOO.env.ua.ie) {
+        
+                    bSubmitForm = oForm.fireEvent("onsubmit");
+        
+                }
+                else {  // Gecko, Opera, and Safari
+        
+                    oEvent = document.createEvent("HTMLEvents");
+                    oEvent.initEvent("submit", true, true);
+        
+                    bSubmitForm = oForm.dispatchEvent(oEvent);
+        
+                }
+        
+        
+                /*
+                    In IE and Safari, dispatching a "submit" event to a form 
+                    WILL cause the form's "submit" event to fire, but WILL NOT 
+                    submit the form.  Therefore, we need to call the "submit" 
+                    method as well.
+                */
+              
+                if ((YAHOO.env.ua.ie || YAHOO.env.ua.webkit) && bSubmitForm) {
+        
+                    oForm.submit();
+                
+                }
+            
+            }
+        
+            return bSubmitForm;
+            
+        },
+        
+        
+        /**
+        * @method init
+        * @description The Button class's initialization method.
+        * @param {String} p_oElement String specifying the id attribute of the 
+        * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>,
+        * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to 
+        * be used to create the button.
+        * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://
+        * www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html
+        * #ID-34812697">HTMLButtonElement</a>|<a href="http://www.w3.org/TR
+        * /2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-33759296">
+        * HTMLElement</a>} p_oElement Object reference for the 
+        * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>, 
+        * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to be 
+        * used to create the button.
+        * @param {Object} p_oElement Object literal specifying a set of 
+        * configuration attributes used to create the button.
+        * @param {Object} p_oAttributes Optional. Object literal specifying a 
+        * set of configuration attributes used to create the button.
+        */
+        init: function (p_oElement, p_oAttributes) {
+        
+            var sNodeName = p_oAttributes.type == "link" ? "a" : "button",
+                oSrcElement = p_oAttributes.srcelement,
+                oButton = p_oElement.getElementsByTagName(sNodeName)[0],
+                oInput;
+        
+
+            if (!oButton) {
+
+                oInput = p_oElement.getElementsByTagName("input")[0];
+
+
+                if (oInput) {
+
+                    oButton = document.createElement("button");
+                    oButton.setAttribute("type", "button");
+
+                    oInput.parentNode.replaceChild(oButton, oInput);
+                
+                }
+
+            }
+
+            this._button = oButton;
+        
+
+            YAHOO.widget.Button.superclass.init.call(this, p_oElement, 
+                p_oAttributes);
+        
+        
+            m_oButtons[this.get("id")] = this;
+        
+        
+            this.addClass(this.CSS_CLASS_NAME);
+            
+            this.addClass("yui-" + this.get("type") + "-button");
+        
+            Event.on(this._button, "focus", this._onFocus, null, this);
+            this.on("mouseover", this._onMouseOver);
+            this.on("click", this._onClick);
+            this.on("appendTo", this._onAppendTo);
+            
+        
+            var oContainer = this.get("container"),
+                oElement = this.get("element"),
+                bElInDoc = Dom.inDocument(oElement),
+                oParentNode;
+
+
+            if (oContainer) {
+        
+                if (oSrcElement && oSrcElement != oElement) {
+                
+                    oParentNode = oSrcElement.parentNode;
+
+                    if (oParentNode) {
+                    
+                        oParentNode.removeChild(oSrcElement);
+                    
+                    }
+
+                }
+        
+                if (Lang.isString(oContainer)) {
+        
+                    Event.onContentReady(oContainer, function () {
+        
+                        this.appendTo(oContainer);
+                    
+                    }, null, this);
+        
+                }
+                else {
+        
+                    this.appendTo(oContainer);
+        
+                }
+        
+            }
+            else if (!bElInDoc && oSrcElement && oSrcElement != oElement) {
+
+                oParentNode = oSrcElement.parentNode;
+        
+                if (oParentNode) {
+        
+                    this.fireEvent("beforeAppendTo", {
+                        type: "beforeAppendTo",
+                        target: oParentNode
+                    });
+            
+                    oParentNode.replaceChild(oElement, oSrcElement);
+            
+                    this.fireEvent("appendTo", {
+                        type: "appendTo",
+                        target: oParentNode
+                    });
+                
+                }
+        
+            }
+            else if (this.get("type") != "link" && bElInDoc && oSrcElement && 
+                oSrcElement == oElement) {
+        
+                this._addListenersToForm();
+        
+            }
+        
+        
+        },
+        
+        
+        /**
+        * @method initAttributes
+        * @description Initializes all of the configuration attributes used to  
+        * create the button.
+        * @param {Object} p_oAttributes Object literal specifying a set of 
+        * configuration attributes used to create the button.
+        */
+        initAttributes: function (p_oAttributes) {
+        
+            var oAttributes = p_oAttributes || {};
+        
+            YAHOO.widget.Button.superclass.initAttributes.call(this, 
+                oAttributes);
+        
+        
+            /**
+            * @attribute type
+            * @description String specifying the button's type.  Possible 
+            * values are: "push," "link," "submit," "reset," "checkbox," 
+            * "radio," "menu," and "split."
+            * @default "push"
+            * @type String
+            */
+            this.setAttributeConfig("type", {
+        
+                value: (oAttributes.type || "push"),
+                validator: Lang.isString,
+                writeOnce: true,
+                method: this._setType
+        
+            });
+        
+        
+            /**
+            * @attribute label
+            * @description String specifying the button's text label 
+            * or innerHTML.
+            * @default null
+            * @type String
+            */
+            this.setAttributeConfig("label", {
+        
+                value: oAttributes.label,
+                validator: Lang.isString,
+                method: this._setLabel
+        
+            });
+        
+        
+            /**
+            * @attribute value
+            * @description Object specifying the value for the button.
+            * @default null
+            * @type Object
+            */
+            this.setAttributeConfig("value", {
+        
+                value: oAttributes.value
+        
+            });
+        
+        
+            /**
+            * @attribute name
+            * @description String specifying the name for the button.
+            * @default null
+            * @type String
+            */
+            this.setAttributeConfig("name", {
+        
+                value: oAttributes.name,
+                validator: Lang.isString
+        
+            });
+        
+        
+            /**
+            * @attribute tabindex
+            * @description Number specifying the tabindex for the button.
+            * @default null
+            * @type Number
+            */
+            this.setAttributeConfig("tabindex", {
+        
+                value: oAttributes.tabindex,
+                validator: Lang.isNumber,
+                method: this._setTabIndex
+        
+            });
+        
+        
+            /**
+            * @attribute title
+            * @description String specifying the title for the button.
+            * @default null
+            * @type String
+            */
+            this.configureAttribute("title", {
+        
+                value: oAttributes.title,
+                validator: Lang.isString,
+                method: this._setTitle
+        
+            });
+        
+        
+            /**
+            * @attribute disabled
+            * @description Boolean indicating if the button should be disabled.  
+            * (Disabled buttons are dimmed and will not respond to user input 
+            * or fire events.  Does not apply to button's of type "link.")
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig("disabled", {
+        
+                value: (oAttributes.disabled || false),
+                validator: Lang.isBoolean,
+                method: this._setDisabled
+        
+            });
+        
+        
+            /**
+            * @attribute href
+            * @description String specifying the href for the button.  Applies
+            * only to buttons of type "link."
+            * @type String
+            */
+            this.setAttributeConfig("href", {
+        
+                value: oAttributes.href,
+                validator: Lang.isString,
+                method: this._setHref
+        
+            });
+        
+        
+            /**
+            * @attribute target
+            * @description String specifying the target for the button.  
+            * Applies only to buttons of type "link."
+            * @type String
+            */
+            this.setAttributeConfig("target", {
+        
+                value: oAttributes.target,
+                validator: Lang.isString,
+                method: this._setTarget
+        
+            });
+        
+        
+            /**
+            * @attribute checked
+            * @description Boolean indicating if the button is checked. 
+            * Applies only to buttons of type "radio" and "checkbox."
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig("checked", {
+        
+                value: (oAttributes.checked || false),
+                validator: Lang.isBoolean,
+                method: this._setChecked
+        
+            });
+        
+        
+            /**
+            * @attribute container
+            * @description HTML element reference or string specifying the id 
+            * attribute of the HTML element that the button's markup should be 
+            * rendered into.
+            * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+            * level-one-html.html#ID-58190037">HTMLElement</a>|String
+            * @default null
+            */
+            this.setAttributeConfig("container", {
+        
+                value: oAttributes.container,
+                writeOnce: true
+        
+            });
+        
+        
+            /**
+            * @attribute srcelement
+            * @description Object reference to the HTML element (either 
+            * <code>&#60;input&#62;</code> or <code>&#60;span&#62;</code>) 
+            * used to create the button.
+            * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+            * level-one-html.html#ID-58190037">HTMLElement</a>|String
+            * @default null
+            */
+            this.setAttributeConfig("srcelement", {
+        
+                value: oAttributes.srcelement,
+                writeOnce: true
+        
+            });
+        
+        
+            /**
+            * @attribute menu
+            * @description Object specifying the menu for the button.  
+            * The value can be one of the following:
+            * <ul>
+            * <li>Object specifying a <a href="YAHOO.widget.Menu.html">
+            * YAHOO.widget.Menu</a> instance.</li>
+            * <li>Object specifying a <a href="YAHOO.widget.Overlay.html">
+            * YAHOO.widget.Overlay</a> instance.</li>
+            * <li>String specifying the id attribute of the <code>&#60;div&#62;
+            * </code> element used to create the menu.  By default the menu 
+            * will be created as an instance of 
+            * <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>.  
+            * If the <a href="YAHOO.widget.Menu.html#CSS_CLASS_NAME">
+            * default CSS class name for YAHOO.widget.Menu</a> is applied to 
+            * the <code>&#60;div&#62;</code> element, it will be created as an
+            * instance of <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu
+            * </a>.</li><li>String specifying the id attribute of the 
+            * <code>&#60;select&#62;</code> element used to create the menu.
+            * </li><li>Object specifying the <code>&#60;div&#62;</code> element
+            * used to create the menu.</li>
+            * <li>Object specifying the <code>&#60;select&#62;</code> element
+            * used to create the menu.</li>
+            * <li>Array of object literals, each representing a set of 
+            * <a href="YAHOO.widget.MenuItem.html">YAHOO.widget.MenuItem</a> 
+            * configuration attributes.</li>
+            * <li>Array of strings representing the text labels for each menu 
+            * item in the menu.</li>
+            * </ul>
+            * @type <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>|<a 
+            * href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>|<a 
+            * href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+            * one-html.html#ID-58190037">HTMLElement</a>|String|Array
+            * @default null
+            */
+            this.setAttributeConfig("menu", {
+        
+                value: null,
+                method: this._setMenu,
+                writeOnce: true
+            
+            });
+        
+        
+            /**
+            * @attribute lazyloadmenu
+            * @description Boolean indicating the value to set for the 
+            * <a href="YAHOO.widget.Menu.html#lazyLoad">"lazyload"</a>
+            * configuration property of the button's menu.  Setting 
+            * "lazyloadmenu" to <code>true </code> will defer rendering of 
+            * the button's menu until the first time it is made visible.  
+            * If "lazyloadmenu" is set to <code>false</code>, the button's 
+            * menu will be rendered immediately if the button is in the 
+            * document, or in response to the button's "appendTo" event if 
+            * the button is not yet in the document.  In either case, the 
+            * menu is rendered into the button's parent HTML element.  
+            * <em>This attribute does not apply if a 
+            * <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a> or 
+            * <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a> 
+            * instance is passed as the value of the button's "menu" 
+            * configuration attribute. <a href="YAHOO.widget.Menu.html">
+            * YAHOO.widget.Menu</a> or <a href="YAHOO.widget.Overlay.html">
+            * YAHOO.widget.Overlay</a> instances should be rendered before 
+            * being set as the value for the "menu" configuration 
+            * attribute.</em>
+            * @default true
+            * @type Boolean
+            */
+            this.setAttributeConfig("lazyloadmenu", {
+        
+                value: (oAttributes.lazyloadmenu === false ? false : true),
+                validator: Lang.isBoolean,
+                writeOnce: true
+        
+            });
+
+
+            /**
+            * @attribute menuclassname
+            * @description String representing the CSS class name to be 
+            * applied to the root element of the button's menu.
+            * @type String
+            * @default "yui-button-menu"
+            */
+            this.setAttributeConfig("menuclassname", {
+        
+                value: (oAttributes.menuclassname || "yui-button-menu"),
+                validator: Lang.isString,
+                method: this._setMenuClassName,
+                writeOnce: true
+        
+            });        
+
+
+            /**
+            * @attribute selectedMenuItem
+            * @description Number representing the index of the item in the 
+            * button's menu that is currently selected.
+            * @type Number
+            * @default null
+            */
+            this.setAttributeConfig("selectedMenuItem", {
+        
+                value: 0,
+                validator: Lang.isNumber,
+                method: this._setSelectedMenuItem
+        
+            });
+        
+        
+            /**
+            * @attribute onclick
+            * @description Object literal representing the code to be executed  
+            * when the button is clicked.  Format:<br> <code> {<br> 
+            * <strong>fn:</strong> Function,   &#47;&#47; The handler to call 
+            * when the event fires.<br> <strong>obj:</strong> Object, 
+            * &#47;&#47; An object to pass back to the handler.<br> 
+            * <strong>scope:</strong> Object &#47;&#47;  The object to use 
+            * for the scope of the handler.<br> } </code>
+            * @type Object
+            * @default null
+            */
+            this.setAttributeConfig("onclick", {
+        
+                value: oAttributes.onclick,
+                method: this._setOnClick
+            
+            });
+
+
+            /**
+            * @attribute focusmenu
+            * @description Boolean indicating whether or not the button's menu 
+            * should be focused when it is made visible.
+            * @type Boolean
+            * @default true
+            */
+            this.setAttributeConfig("focusmenu", {
+        
+                value: (oAttributes.focusmenu === false ? false : true),
+                validator: Lang.isBoolean
+        
+            });
+
+        },
+        
+        
+        /**
+        * @method focus
+        * @description Causes the button to receive the focus and fires the 
+        * button's "focus" event.
+        */
+        focus: function () {
+        
+            if (!this.get("disabled")) {
+        
+                this._button.focus();
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method blur
+        * @description Causes the button to lose focus and fires the button's
+        * "blur" event.
+        */
+        blur: function () {
+        
+            if (!this.get("disabled")) {
+        
+                this._button.blur();
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method hasFocus
+        * @description Returns a boolean indicating whether or not the button 
+        * has focus.
+        * @return {Boolean}
+        */
+        hasFocus: function () {
+        
+            return (m_oFocusedButton == this);
+        
+        },
+        
+        
+        /**
+        * @method isActive
+        * @description Returns a boolean indicating whether or not the button 
+        * is active.
+        * @return {Boolean}
+        */
+        isActive: function () {
+        
+            return this.hasClass(this.CSS_CLASS_NAME + "-active");
+        
+        },
+        
+        
+        /**
+        * @method getMenu
+        * @description Returns a reference to the button's menu.
+        * @return {<a href="YAHOO.widget.Overlay.html">
+        * YAHOO.widget.Overlay</a>|<a 
+        * href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>}
+        */
+        getMenu: function () {
+        
+            return this._menu;
+        
+        },
+        
+        
+        /**
+        * @method getForm
+        * @description Returns a reference to the button's parent form.
+        * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-
+        * 20000929/level-one-html.html#ID-40002357">HTMLFormElement</a>}
+        */
+        getForm: function () {
+        
+            return this._button.form;
+        
+        },
+        
+        
+        /** 
+        * @method getHiddenFields
+        * @description Returns an <code>&#60;input&#62;</code> element or 
+        * array of form elements used to represent the button when its parent 
+        * form is submitted.  
+        * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array}
+        */
+        getHiddenFields: function () {
+        
+            return this._hiddenFields;
+        
+        },
+        
+        
+        /**
+        * @method destroy
+        * @description Removes the button's element from its parent element and 
+        * removes all event handlers.
+        */
+        destroy: function () {
+        
+        
+            var oElement = this.get("element"),
+                oParentNode = oElement.parentNode,
+                oMenu = this._menu,
+                aButtons;
+        
+            if (oMenu) {
+        
+
+                if (m_oOverlayManager.find(oMenu)) {
+
+                    m_oOverlayManager.remove(oMenu);
+
+                }
+        
+                oMenu.destroy();
+        
+            }
+        
+        
+            Event.purgeElement(oElement);
+            Event.purgeElement(this._button);
+            Event.removeListener(document, "mouseup", this._onDocumentMouseUp);
+            Event.removeListener(document, "keyup", this._onDocumentKeyUp);
+            Event.removeListener(document, "mousedown", 
+                this._onDocumentMouseDown);
+        
+        
+            var oForm = this.getForm();
+            
+            if (oForm) {
+        
+                Event.removeListener(oForm, "reset", this._onFormReset);
+                Event.removeListener(oForm, "submit", this.createHiddenFields);
+        
+            }
+
+
+            this.unsubscribeAll();
+
+            if (oParentNode) {
+
+                oParentNode.removeChild(oElement);
+            
+            }
+        
+        
+            delete m_oButtons[this.get("id")];
+
+            aButtons = Dom.getElementsByClassName(this.CSS_CLASS_NAME, 
+                                this.NODE_NAME, oForm); 
+
+            if (Lang.isArray(aButtons) && aButtons.length === 0) {
+
+                Event.removeListener(oForm, "keypress", 
+                        YAHOO.widget.Button.onFormKeyPress);
+
+            }
+
+        
+        },
+        
+        
+        fireEvent: function (p_sType , p_aArgs) {
+        
+            //  Disabled buttons should not respond to DOM events
+        
+            if (this.DOM_EVENTS[p_sType] && this.get("disabled")) {
+        
+                return;
+        
+            }
+        
+            YAHOO.widget.Button.superclass.fireEvent.call(this, p_sType, 
+                p_aArgs);
+        
+        },
+        
+        
+        /**
+        * @method toString
+        * @description Returns a string representing the button.
+        * @return {String}
+        */
+        toString: function () {
+        
+            return ("Button " + this.get("id"));
+        
+        }
+    
+    });
+    
+    
+    /**
+    * @method YAHOO.widget.Button.onFormKeyPress
+    * @description "keypress" event handler for the button's form.
+    * @param {Event} p_oEvent Object representing the DOM event object passed 
+    * back by the event utility (YAHOO.util.Event).
+    */
+    YAHOO.widget.Button.onFormKeyPress = function (p_oEvent) {
+    
+        var oTarget = Event.getTarget(p_oEvent),
+            nCharCode = Event.getCharCode(p_oEvent),
+            sNodeName = oTarget.nodeName && oTarget.nodeName.toUpperCase(),
+            sType = oTarget.type,
+    
+            /*
+                Boolean indicating if the form contains any enabled or 
+                disabled YUI submit buttons
+            */
+    
+            bFormContainsYUIButtons = false,
+    
+            oButton,
+    
+            oYUISubmitButton,   // The form's first, enabled YUI submit button
+    
+            /*
+                 The form's first, enabled HTML submit button that precedes any 
+                 YUI submit button
+            */
+    
+            oPrecedingSubmitButton,
+            
+    
+            /*
+                 The form's first, enabled HTML submit button that follows a 
+                 YUI button
+            */
+            
+            oFollowingSubmitButton; 
+    
+    
+        function isSubmitButton(p_oElement) {
+    
+            var sId,
+                oSrcElement;
+    
+            switch (p_oElement.nodeName.toUpperCase()) {
+    
+            case "INPUT":
+            case "BUTTON":
+            
+                if (p_oElement.type == "submit" && !p_oElement.disabled) {
+                    
+                    if (!bFormContainsYUIButtons && 
+                        !oPrecedingSubmitButton) {
+
+                        oPrecedingSubmitButton = p_oElement;
+
+                    }
+                    
+                    if (oYUISubmitButton && !oFollowingSubmitButton) {
+                    
+                        oFollowingSubmitButton = p_oElement;
+                    
+                    }
+                
+                }
+
+                break;
+            
+
+            default:
+            
+                sId = p_oElement.id;
+    
+                if (sId) {
+    
+                    oButton = m_oButtons[sId];
+        
+                    if (oButton) {
+
+                        bFormContainsYUIButtons = true;
+        
+                        if (!oButton.get("disabled")) {
+
+                            oSrcElement = oButton.get("srcelement");
+    
+                            if (!oYUISubmitButton &&
+                                (oButton.get("type") == "submit" || 
+                                (oSrcElement && oSrcElement.type == "submit"))) 
+                            {
+
+                                oYUISubmitButton = oButton;
+                            
+                            }
+                        
+                        }
+                        
+                    }
+                
+                }
+
+                break;
+    
+            }
+    
+        }
+    
+    
+        if (nCharCode == 13 && ((sNodeName == "INPUT" && (sType == "text" || 
+            sType == "password" || sType == "checkbox" || sType == "radio" || 
+            sType == "file")) || sNodeName == "SELECT"))
+        {
+    
+            Dom.getElementsBy(isSubmitButton, "*", this);
+    
+    
+            if (oPrecedingSubmitButton) {
+    
+                /*
+                     Need to set focus to the first enabled submit button
+                     to make sure that IE includes its name and value 
+                     in the form's data set.
+                */
+    
+                oPrecedingSubmitButton.focus();
+            
+            }
+            else if (!oPrecedingSubmitButton && oYUISubmitButton) {
+    
+                if (oFollowingSubmitButton) {
+    
+                    /*
+                        Need to call "preventDefault" to ensure that 
+                        the name and value of the regular submit button 
+                        following the YUI button doesn't get added to the 
+                        form's data set when it is submitted.
+                    */
+    
+                    Event.preventDefault(p_oEvent);
+                
+                }
+    
+                oYUISubmitButton.submitForm();
+    
+            }
+            
+        }
+    
+    };
+    
+    
+    /**
+    * @method YAHOO.widget.Button.addHiddenFieldsToForm
+    * @description Searches the specified form and adds hidden fields for  
+    * instances of YAHOO.widget.Button that are of type "radio," "checkbox," 
+    * "menu," and "split."
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-40002357">HTMLFormElement</a>} p_oForm Object reference 
+    * for the form to search.
+    */
+    YAHOO.widget.Button.addHiddenFieldsToForm = function (p_oForm) {
+    
+        var aButtons = Dom.getElementsByClassName(
+                            YAHOO.widget.Button.prototype.CSS_CLASS_NAME, 
+                            "*", 
+                            p_oForm),
+    
+            nButtons = aButtons.length,
+            oButton,
+            sId,
+            i;
+    
+        if (nButtons > 0) {
+    
+    
+            for (i = 0; i < nButtons; i++) {
+    
+                sId = aButtons[i].id;
+    
+                if (sId) {
+    
+                    oButton = m_oButtons[sId];
+        
+                    if (oButton) {
+           
+                        oButton.createHiddenFields();
+                        
+                    }
+                
+                }
+            
+            }
+    
+        }
+    
+    };
+    
+    
+    
+    // Events
+    
+    
+    /**
+    * @event focus
+    * @description Fires when the menu item receives focus.  Passes back a  
+    * single object representing the original DOM event object passed back by 
+    * the event utility (YAHOO.util.Event) when the event was fired.  See 
+    * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> 
+    * for more information on listening for this event.
+    * @type YAHOO.util.CustomEvent
+    */
+    
+    
+    /**
+    * @event blur
+    * @description Fires when the menu item loses the input focus.  Passes back  
+    * a single object representing the original DOM event object passed back by 
+    * the event utility (YAHOO.util.Event) when the event was fired.  See 
+    * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for  
+    * more information on listening for this event.
+    * @type YAHOO.util.CustomEvent
+    */
+    
+    
+    /**
+    * @event option
+    * @description Fires when the user invokes the button's option.  Passes 
+    * back a single object representing the original DOM event (either 
+    * "mousedown" or "keydown") that caused the "option" event to fire.  See 
+    * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> 
+    * for more information on listening for this event.
+    * @type YAHOO.util.CustomEvent
+    */
+
+})();
+(function () {
+
+    // Shorthard for utilities
+    
+    var Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event,
+        Lang = YAHOO.lang,
+        Button = YAHOO.widget.Button,  
+    
+        // Private collection of radio buttons
+    
+        m_oButtons = {};
+
+
+
+    /**
+    * The ButtonGroup class creates a set of buttons that are mutually 
+    * exclusive; checking one button in the set will uncheck all others in the 
+    * button group.
+    * @param {String} p_oElement String specifying the id attribute of the 
+    * <code>&#60;div&#62;</code> element of the button group.
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object 
+    * specifying the <code>&#60;div&#62;</code> element of the button group.
+    * @param {Object} p_oElement Object literal specifying a set of 
+    * configuration attributes used to create the button group.
+    * @param {Object} p_oAttributes Optional. Object literal specifying a set 
+    * of configuration attributes used to create the button group.
+    * @namespace YAHOO.widget
+    * @class ButtonGroup
+    * @constructor
+    * @extends YAHOO.util.Element
+    */
+    YAHOO.widget.ButtonGroup = function (p_oElement, p_oAttributes) {
+    
+        var fnSuperClass = YAHOO.widget.ButtonGroup.superclass.constructor,
+            sNodeName,
+            oElement,
+            sId;
+    
+        if (arguments.length == 1 && !Lang.isString(p_oElement) && 
+            !p_oElement.nodeName) {
+    
+            if (!p_oElement.id) {
+    
+                sId = Dom.generateId();
+    
+                p_oElement.id = sId;
+    
+    
+            }
+    
+    
+    
+            fnSuperClass.call(this, (this._createGroupElement()), p_oElement);
+    
+        }
+        else if (Lang.isString(p_oElement)) {
+    
+            oElement = Dom.get(p_oElement);
+    
+            if (oElement) {
+            
+                if (oElement.nodeName.toUpperCase() == this.NODE_NAME) {
+    
+            
+                    fnSuperClass.call(this, oElement, p_oAttributes);
+    
+                }
+    
+            }
+        
+        }
+        else {
+    
+            sNodeName = p_oElement.nodeName.toUpperCase();
+    
+            if (sNodeName && sNodeName == this.NODE_NAME) {
+        
+                if (!p_oElement.id) {
+        
+                    p_oElement.id = Dom.generateId();
+        
+        
+                }
+        
+        
+                fnSuperClass.call(this, p_oElement, p_oAttributes);
+    
+            }
+    
+        }
+    
+    };
+    
+    
+    YAHOO.extend(YAHOO.widget.ButtonGroup, YAHOO.util.Element, {
+    
+    
+        // Protected properties
+        
+        
+        /** 
+        * @property _buttons
+        * @description Array of buttons in the button group.
+        * @default null
+        * @protected
+        * @type Array
+        */
+        _buttons: null,
+        
+        
+        
+        // Constants
+        
+        
+        /**
+        * @property NODE_NAME
+        * @description The name of the tag to be used for the button 
+        * group's element. 
+        * @default "DIV"
+        * @final
+        * @type String
+        */
+        NODE_NAME: "DIV",
+        
+        
+        /**
+        * @property CSS_CLASS_NAME
+        * @description String representing the CSS class(es) to be applied  
+        * to the button group's element.
+        * @default "yui-buttongroup"
+        * @final
+        * @type String
+        */
+        CSS_CLASS_NAME: "yui-buttongroup",
+    
+    
+    
+        // Protected methods
+        
+        
+        /**
+        * @method _createGroupElement
+        * @description Creates the button group's element.
+        * @protected
+        * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-22445964">HTMLDivElement</a>}
+        */
+        _createGroupElement: function () {
+        
+            var oElement = document.createElement(this.NODE_NAME);
+        
+            return oElement;
+        
+        },
+        
+        
+        
+        // Protected attribute setter methods
+        
+        
+        /**
+        * @method _setDisabled
+        * @description Sets the value of the button groups's 
+        * "disabled" attribute.
+        * @protected
+        * @param {Boolean} p_bDisabled Boolean indicating the value for
+        * the button group's "disabled" attribute.
+        */
+        _setDisabled: function (p_bDisabled) {
+        
+            var nButtons = this.getCount(),
+                i;
+        
+            if (nButtons > 0) {
+        
+                i = nButtons - 1;
+                
+                do {
+        
+                    this._buttons[i].set("disabled", p_bDisabled);
+                
+                }
+                while (i--);
+        
+            }
+        
+        },
+        
+        
+        
+        // Protected event handlers
+        
+        
+        /**
+        * @method _onKeyDown
+        * @description "keydown" event handler for the button group.
+        * @protected
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        _onKeyDown: function (p_oEvent) {
+        
+            var oTarget = Event.getTarget(p_oEvent),
+                nCharCode = Event.getCharCode(p_oEvent),
+                sId = oTarget.parentNode.parentNode.id,
+                oButton = m_oButtons[sId],
+                nIndex = -1;
+        
+        
+            if (nCharCode == 37 || nCharCode == 38) {
+        
+                nIndex = (oButton.index === 0) ? 
+                            (this._buttons.length - 1) : (oButton.index - 1);
+            
+            }
+            else if (nCharCode == 39 || nCharCode == 40) {
+        
+                nIndex = (oButton.index === (this._buttons.length - 1)) ? 
+                            0 : (oButton.index + 1);
+        
+            }
+        
+        
+            if (nIndex > -1) {
+        
+                this.check(nIndex);
+                this.getButton(nIndex).focus();
+            
+            }        
+        
+        },
+        
+        
+        /**
+        * @method _onAppendTo
+        * @description "appendTo" event handler for the button group.
+        * @protected
+        * @param {Event} p_oEvent Object representing the event that was fired.
+        */
+        _onAppendTo: function (p_oEvent) {
+        
+            var aButtons = this._buttons,
+                nButtons = aButtons.length,
+                i;
+        
+            for (i = 0; i < nButtons; i++) {
+        
+                aButtons[i].appendTo(this.get("element"));
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method _onButtonCheckedChange
+        * @description "checkedChange" event handler for each button in the 
+        * button group.
+        * @protected
+        * @param {Event} p_oEvent Object representing the event that was fired.
+        * @param {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}  
+        * p_oButton Object representing the button that fired the event.
+        */
+        _onButtonCheckedChange: function (p_oEvent, p_oButton) {
+        
+            var bChecked = p_oEvent.newValue,
+                oCheckedButton = this.get("checkedButton");
+        
+            if (bChecked && oCheckedButton != p_oButton) {
+        
+                if (oCheckedButton) {
+        
+                    oCheckedButton.set("checked", false, true);
+        
+                }
+        
+                this.set("checkedButton", p_oButton);
+                this.set("value", p_oButton.get("value"));
+        
+            }
+            else if (oCheckedButton && !oCheckedButton.set("checked")) {
+        
+                oCheckedButton.set("checked", true, true);
+        
+            }
+           
+        },
+        
+        
+        
+        // Public methods
+        
+        
+        /**
+        * @method init
+        * @description The ButtonGroup class's initialization method.
+        * @param {String} p_oElement String specifying the id attribute of the 
+        * <code>&#60;div&#62;</code> element of the button group.
+        * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object 
+        * specifying the <code>&#60;div&#62;</code> element of the button group.
+        * @param {Object} p_oElement Object literal specifying a set of  
+        * configuration attributes used to create the button group.
+        * @param {Object} p_oAttributes Optional. Object literal specifying a
+        * set of configuration attributes used to create the button group.
+        */
+        init: function (p_oElement, p_oAttributes) {
+        
+            this._buttons = [];
+        
+            YAHOO.widget.ButtonGroup.superclass.init.call(this, p_oElement, 
+                    p_oAttributes);
+        
+            this.addClass(this.CSS_CLASS_NAME);
+        
+        
+            var aButtons = this.getElementsByClassName("yui-radio-button");
+        
+        
+            if (aButtons.length > 0) {
+        
+        
+                this.addButtons(aButtons);
+        
+            }
+        
+        
+        
+            function isRadioButton(p_oElement) {
+        
+                return (p_oElement.type == "radio");
+        
+            }
+        
+            aButtons = 
+                Dom.getElementsBy(isRadioButton, "input", this.get("element"));
+        
+        
+            if (aButtons.length > 0) {
+        
+        
+                this.addButtons(aButtons);
+        
+            }
+        
+            this.on("keydown", this._onKeyDown);
+            this.on("appendTo", this._onAppendTo);
+        
+
+            var oContainer = this.get("container");
+
+            if (oContainer) {
+        
+                if (Lang.isString(oContainer)) {
+        
+                    Event.onContentReady(oContainer, function () {
+        
+                        this.appendTo(oContainer);            
+                    
+                    }, null, this);
+        
+                }
+                else {
+        
+                    this.appendTo(oContainer);
+        
+                }
+        
+            }
+        
+        
+        
+        },
+        
+        
+        /**
+        * @method initAttributes
+        * @description Initializes all of the configuration attributes used to  
+        * create the button group.
+        * @param {Object} p_oAttributes Object literal specifying a set of 
+        * configuration attributes used to create the button group.
+        */
+        initAttributes: function (p_oAttributes) {
+        
+            var oAttributes = p_oAttributes || {};
+        
+            YAHOO.widget.ButtonGroup.superclass.initAttributes.call(
+                this, oAttributes);
+        
+        
+            /**
+            * @attribute name
+            * @description String specifying the name for the button group.  
+            * This name will be applied to each button in the button group.
+            * @default null
+            * @type String
+            */
+            this.setAttributeConfig("name", {
+        
+                value: oAttributes.name,
+                validator: Lang.isString
+        
+            });
+        
+        
+            /**
+            * @attribute disabled
+            * @description Boolean indicating if the button group should be 
+            * disabled.  Disabling the button group will disable each button 
+            * in the button group.  Disabled buttons are dimmed and will not 
+            * respond to user input or fire events.
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig("disabled", {
+        
+                value: (oAttributes.disabled || false),
+                validator: Lang.isBoolean,
+                method: this._setDisabled
+        
+            });
+        
+        
+            /**
+            * @attribute value
+            * @description Object specifying the value for the button group.
+            * @default null
+            * @type Object
+            */
+            this.setAttributeConfig("value", {
+        
+                value: oAttributes.value
+        
+            });
+        
+        
+            /**
+            * @attribute container
+            * @description HTML element reference or string specifying the id 
+            * attribute of the HTML element that the button group's markup
+            * should be rendered into.
+            * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+            * level-one-html.html#ID-58190037">HTMLElement</a>|String
+            * @default null
+            */
+            this.setAttributeConfig("container", {
+        
+                value: oAttributes.container,
+                writeOnce: true
+        
+            });
+        
+        
+            /**
+            * @attribute checkedButton
+            * @description Reference for the button in the button group that 
+            * is checked.
+            * @type {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}
+            * @default null
+            */
+            this.setAttributeConfig("checkedButton", {
+        
+                value: null
+        
+            });
+        
+        },
+        
+        
+        /**
+        * @method addButton
+        * @description Adds the button to the button group.
+        * @param {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}  
+        * p_oButton Object reference for the <a href="YAHOO.widget.Button.html">
+        * YAHOO.widget.Button</a> instance to be added to the button group.
+        * @param {String} p_oButton String specifying the id attribute of the 
+        * <code>&#60;input&#62;</code> or <code>&#60;span&#62;</code> element 
+        * to be used to create the button to be added to the button group.
+        * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-6043025">HTMLInputElement</a>|<a href="
+        * http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#
+        * ID-33759296">HTMLElement</a>} p_oButton Object reference for the 
+        * <code>&#60;input&#62;</code> or <code>&#60;span&#62;</code> element 
+        * to be used to create the button to be added to the button group.
+        * @param {Object} p_oButton Object literal specifying a set of 
+        * <a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a> 
+        * configuration attributes used to configure the button to be added to 
+        * the button group.
+        * @return {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>} 
+        */
+        addButton: function (p_oButton) {
+        
+            var oButton,
+                oButtonElement,
+                oGroupElement,
+                nIndex,
+                sButtonName,
+                sGroupName;
+        
+        
+            if (p_oButton instanceof Button && 
+                p_oButton.get("type") == "radio") {
+        
+                oButton = p_oButton;
+        
+            }
+            else if (!Lang.isString(p_oButton) && !p_oButton.nodeName) {
+        
+                p_oButton.type = "radio";
+        
+                oButton = new Button(p_oButton);
+
+            }
+            else {
+        
+                oButton = new Button(p_oButton, { type: "radio" });
+        
+            }
+        
+        
+            if (oButton) {
+        
+                nIndex = this._buttons.length;
+                sButtonName = oButton.get("name");
+                sGroupName = this.get("name");
+        
+                oButton.index = nIndex;
+        
+                this._buttons[nIndex] = oButton;
+                m_oButtons[oButton.get("id")] = oButton;
+        
+        
+                if (sButtonName != sGroupName) {
+        
+                    oButton.set("name", sGroupName);
+                
+                }
+        
+        
+                if (this.get("disabled")) {
+        
+                    oButton.set("disabled", true);
+        
+                }
+        
+        
+                if (oButton.get("checked")) {
+        
+                    this.set("checkedButton", oButton);
+        
+                }
+
+                
+                oButtonElement = oButton.get("element");
+                oGroupElement = this.get("element");
+                
+                if (oButtonElement.parentNode != oGroupElement) {
+                
+                    oGroupElement.appendChild(oButtonElement);
+                
+                }
+        
+                
+                oButton.on("checkedChange", 
+                    this._onButtonCheckedChange, oButton, this);
+        
+        
+                return oButton;
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method addButtons
+        * @description Adds the array of buttons to the button group.
+        * @param {Array} p_aButtons Array of <a href="YAHOO.widget.Button.html">
+        * YAHOO.widget.Button</a> instances to be added 
+        * to the button group.
+        * @param {Array} p_aButtons Array of strings specifying the id 
+        * attribute of the <code>&#60;input&#62;</code> or <code>&#60;span&#62;
+        * </code> elements to be used to create the buttons to be added to the 
+        * button group.
+        * @param {Array} p_aButtons Array of object references for the 
+        * <code>&#60;input&#62;</code> or <code>&#60;span&#62;</code> elements 
+        * to be used to create the buttons to be added to the button group.
+        * @param {Array} p_aButtons Array of object literals, each containing
+        * a set of <a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>  
+        * configuration attributes used to configure each button to be added 
+        * to the button group.
+        * @return {Array}
+        */
+        addButtons: function (p_aButtons) {
+    
+            var nButtons,
+                oButton,
+                aButtons,
+                i;
+        
+            if (Lang.isArray(p_aButtons)) {
+            
+                nButtons = p_aButtons.length;
+                aButtons = [];
+        
+                if (nButtons > 0) {
+        
+                    for (i = 0; i < nButtons; i++) {
+        
+                        oButton = this.addButton(p_aButtons[i]);
+                        
+                        if (oButton) {
+        
+                            aButtons[aButtons.length] = oButton;
+        
+                        }
+                    
+                    }
+        
+                    if (aButtons.length > 0) {
+        
+        
+                        return aButtons;
+        
+                    }
+                
+                }
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method removeButton
+        * @description Removes the button at the specified index from the 
+        * button group.
+        * @param {Number} p_nIndex Number specifying the index of the button 
+        * to be removed from the button group.
+        */
+        removeButton: function (p_nIndex) {
+        
+            var oButton = this.getButton(p_nIndex),
+                nButtons,
+                i;
+            
+            if (oButton) {
+        
+        
+                this._buttons.splice(p_nIndex, 1);
+                delete m_oButtons[oButton.get("id")];
+        
+                oButton.removeListener("checkedChange", 
+                    this._onButtonCheckedChange);
+
+                oButton.destroy();
+        
+        
+                nButtons = this._buttons.length;
+                
+                if (nButtons > 0) {
+        
+                    i = this._buttons.length - 1;
+                    
+                    do {
+        
+                        this._buttons[i].index = i;
+        
+                    }
+                    while (i--);
+                
+                }
+        
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method getButton
+        * @description Returns the button at the specified index.
+        * @param {Number} p_nIndex The index of the button to retrieve from the 
+        * button group.
+        * @return {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}
+        */
+        getButton: function (p_nIndex) {
+        
+            if (Lang.isNumber(p_nIndex)) {
+        
+                return this._buttons[p_nIndex];
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method getButtons
+        * @description Returns an array of the buttons in the button group.
+        * @return {Array}
+        */
+        getButtons: function () {
+        
+            return this._buttons;
+        
+        },
+        
+        
+        /**
+        * @method getCount
+        * @description Returns the number of buttons in the button group.
+        * @return {Number}
+        */
+        getCount: function () {
+        
+            return this._buttons.length;
+        
+        },
+        
+        
+        /**
+        * @method focus
+        * @description Sets focus to the button at the specified index.
+        * @param {Number} p_nIndex Number indicating the index of the button 
+        * to focus. 
+        */
+        focus: function (p_nIndex) {
+        
+            var oButton,
+                nButtons,
+                i;
+        
+            if (Lang.isNumber(p_nIndex)) {
+        
+                oButton = this._buttons[p_nIndex];
+                
+                if (oButton) {
+        
+                    oButton.focus();
+        
+                }
+            
+            }
+            else {
+        
+                nButtons = this.getCount();
+        
+                for (i = 0; i < nButtons; i++) {
+        
+                    oButton = this._buttons[i];
+        
+                    if (!oButton.get("disabled")) {
+        
+                        oButton.focus();
+                        break;
+        
+                    }
+        
+                }
+        
+            }
+        
+        },
+        
+        
+        /**
+        * @method check
+        * @description Checks the button at the specified index.
+        * @param {Number} p_nIndex Number indicating the index of the button 
+        * to check. 
+        */
+        check: function (p_nIndex) {
+        
+            var oButton = this.getButton(p_nIndex);
+            
+            if (oButton) {
+        
+                oButton.set("checked", true);
+            
+            }
+        
+        },
+        
+        
+        /**
+        * @method destroy
+        * @description Removes the button group's element from its parent 
+        * element and removes all event handlers.
+        */
+        destroy: function () {
+        
+        
+            var nButtons = this._buttons.length,
+                oElement = this.get("element"),
+                oParentNode = oElement.parentNode,
+                i;
+            
+            if (nButtons > 0) {
+        
+                i = this._buttons.length - 1;
+        
+                do {
+        
+                    this._buttons[i].destroy();
+        
+                }
+                while (i--);
+            
+            }
+        
+        
+            Event.purgeElement(oElement);
+            
+        
+            oParentNode.removeChild(oElement);
+        
+        },
+        
+        
+        /**
+        * @method toString
+        * @description Returns a string representing the button group.
+        * @return {String}
+        */
+        toString: function () {
+        
+            return ("ButtonGroup " + this.get("id"));
+        
+        }
+    
+    });
+
+})();
+YAHOO.register("button", YAHOO.widget.Button, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/calendar.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/calendar.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/calendar.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,5030 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.util
+    * @class Config
+    * @constructor
+    * @param {Object} owner The owner Object to which this Config Object belongs
+    */
+    YAHOO.util.Config = function (owner) {
+    
+        if (owner) {
+    
+            this.init(owner);
+    
+        }
+    
+        if (!owner) { 
+        
+    
+        }
+    
+    };
+
+
+    var Lang = YAHOO.lang,
+        CustomEvent = YAHOO.util.CustomEvent,        
+        Config = YAHOO.util.Config;
+    
+
+    /**
+     * Constant representing the CustomEvent type for the config changed event.
+     * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
+     * @private
+     * @static
+     * @final
+     */
+    Config.CONFIG_CHANGED_EVENT = "configChanged";
+    
+    /**
+     * Constant representing the boolean type string
+     * @property YAHOO.util.Config.BOOLEAN_TYPE
+     * @private
+     * @static
+     * @final
+     */
+    Config.BOOLEAN_TYPE = "boolean";
+    
+    Config.prototype = {
+     
+        /**
+        * Object reference to the owner of this Config Object
+        * @property owner
+        * @type Object
+        */
+        owner: null,
+        
+        /**
+        * Boolean flag that specifies whether a queue is currently 
+        * being executed
+        * @property queueInProgress
+        * @type Boolean
+        */
+        queueInProgress: false,
+        
+        /**
+        * Maintains the local collection of configuration property objects and 
+        * their specified values
+        * @property config
+        * @private
+        * @type Object
+        */ 
+        config: null,
+        
+        /**
+        * Maintains the local collection of configuration property objects as 
+        * they were initially applied.
+        * This object is used when resetting a property.
+        * @property initialConfig
+        * @private
+        * @type Object
+        */ 
+        initialConfig: null,
+        
+        /**
+        * Maintains the local, normalized CustomEvent queue
+        * @property eventQueue
+        * @private
+        * @type Object
+        */ 
+        eventQueue: null,
+        
+        /**
+        * Custom Event, notifying subscribers when Config properties are set 
+        * (setProperty is called without the silent flag
+        * @event configChangedEvent
+        */
+        configChangedEvent: null,
+    
+        /**
+        * Initializes the configuration Object and all of its local members.
+        * @method init
+        * @param {Object} owner The owner Object to which this Config 
+        * Object belongs
+        */
+        init: function (owner) {
+    
+            this.owner = owner;
+    
+            this.configChangedEvent = 
+                this.createEvent(Config.CONFIG_CHANGED_EVENT);
+    
+            this.configChangedEvent.signature = CustomEvent.LIST;
+            this.queueInProgress = false;
+            this.config = {};
+            this.initialConfig = {};
+            this.eventQueue = [];
+        
+        },
+        
+        /**
+        * Validates that the value passed in is a Boolean.
+        * @method checkBoolean
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */ 
+        checkBoolean: function (val) {
+            return (typeof val == Config.BOOLEAN_TYPE);
+        },
+        
+        /**
+        * Validates that the value passed in is a number.
+        * @method checkNumber
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */
+        checkNumber: function (val) {
+            return (!isNaN(val));
+        },
+        
+        /**
+        * Fires a configuration property event using the specified value. 
+        * @method fireEvent
+        * @private
+        * @param {String} key The configuration property's name
+        * @param {value} Object The value of the correct type for the property
+        */ 
+        fireEvent: function ( key, value ) {
+            var property = this.config[key];
+        
+            if (property && property.event) {
+                property.event.fire(value);
+            } 
+        },
+        
+        /**
+        * Adds a property to the Config Object's private config hash.
+        * @method addProperty
+        * @param {String} key The configuration property's name
+        * @param {Object} propertyObject The Object containing all of this 
+        * property's arguments
+        */
+        addProperty: function ( key, propertyObject ) {
+            key = key.toLowerCase();
+        
+            this.config[key] = propertyObject;
+        
+            propertyObject.event = this.createEvent(key, { scope: this.owner });
+            propertyObject.event.signature = CustomEvent.LIST;
+            
+            
+            propertyObject.key = key;
+        
+            if (propertyObject.handler) {
+                propertyObject.event.subscribe(propertyObject.handler, 
+                    this.owner);
+            }
+        
+            this.setProperty(key, propertyObject.value, true);
+            
+            if (! propertyObject.suppressEvent) {
+                this.queueProperty(key, propertyObject.value);
+            }
+            
+        },
+        
+        /**
+        * Returns a key-value configuration map of the values currently set in  
+        * the Config Object.
+        * @method getConfig
+        * @return {Object} The current config, represented in a key-value map
+        */
+        getConfig: function () {
+        
+            var cfg = {},
+                prop,
+                property;
+                
+            for (prop in this.config) {
+                property = this.config[prop];
+                if (property && property.event) {
+                    cfg[prop] = property.value;
+                }
+            }
+            
+            return cfg;
+        },
+        
+        /**
+        * Returns the value of specified property.
+        * @method getProperty
+        * @param {String} key The name of the property
+        * @return {Object}  The value of the specified property
+        */
+        getProperty: function (key) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.value;
+            } else {
+                return undefined;
+            }
+        },
+        
+        /**
+        * Resets the specified property's value to its initial value.
+        * @method resetProperty
+        * @param {String} key The name of the property
+        * @return {Boolean} True is the property was reset, false if not
+        */
+        resetProperty: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event) {
+    
+                if (this.initialConfig[key] && 
+                    !Lang.isUndefined(this.initialConfig[key])) {
+    
+                    this.setProperty(key, this.initialConfig[key]);
+
+                    return true;
+    
+                }
+    
+            } else {
+    
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Sets the value of a property. If the silent property is passed as 
+        * true, the property's event will not be fired.
+        * @method setProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @param {Boolean} silent Whether the value should be set silently, 
+        * without firing the property event.
+        * @return {Boolean} True, if the set was successful, false if it failed.
+        */
+        setProperty: function (key, value, silent) {
+        
+            var property;
+        
+            key = key.toLowerCase();
+        
+            if (this.queueInProgress && ! silent) {
+                // Currently running through a queue... 
+                this.queueProperty(key,value);
+                return true;
+    
+            } else {
+                property = this.config[key];
+                if (property && property.event) {
+                    if (property.validator && !property.validator(value)) {
+                        return false;
+                    } else {
+                        property.value = value;
+                        if (! silent) {
+                            this.fireEvent(key, value);
+                            this.configChangedEvent.fire([key, value]);
+                        }
+                        return true;
+                    }
+                } else {
+                    return false;
+                }
+            }
+        },
+        
+        /**
+        * Sets the value of a property and queues its event to execute. If the 
+        * event is already scheduled to execute, it is
+        * moved from its current position to the end of the queue.
+        * @method queueProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @return {Boolean}  true, if the set was successful, false if 
+        * it failed.
+        */ 
+        queueProperty: function (key, value) {
+        
+            key = key.toLowerCase();
+        
+            var property = this.config[key],
+                foundDuplicate = false,
+                iLen,
+                queueItem,
+                queueItemKey,
+                queueItemValue,
+                sLen,
+                supercedesCheck,
+                qLen,
+                queueItemCheck,
+                queueItemCheckKey,
+                queueItemCheckValue,
+                i,
+                s,
+                q;
+                                
+            if (property && property.event) {
+    
+                if (!Lang.isUndefined(value) && property.validator && 
+                    !property.validator(value)) { // validator
+                    return false;
+                } else {
+        
+                    if (!Lang.isUndefined(value)) {
+                        property.value = value;
+                    } else {
+                        value = property.value;
+                    }
+        
+                    foundDuplicate = false;
+                    iLen = this.eventQueue.length;
+        
+                    for (i = 0; i < iLen; i++) {
+                        queueItem = this.eventQueue[i];
+        
+                        if (queueItem) {
+                            queueItemKey = queueItem[0];
+                            queueItemValue = queueItem[1];
+                            
+                            if (queueItemKey == key) {
+    
+                                /*
+                                    found a dupe... push to end of queue, null 
+                                    current item, and break
+                                */
+    
+                                this.eventQueue[i] = null;
+    
+                                this.eventQueue.push(
+                                    [key, (!Lang.isUndefined(value) ? 
+                                    value : queueItemValue)]);
+    
+                                foundDuplicate = true;
+                                break;
+                            }
+                        }
+                    }
+                    
+                    // this is a refire, or a new property in the queue
+    
+                    if (! foundDuplicate && !Lang.isUndefined(value)) { 
+                        this.eventQueue.push([key, value]);
+                    }
+                }
+        
+                if (property.supercedes) {
+        
+                    sLen = property.supercedes.length;
+        
+                    for (s = 0; s < sLen; s++) {
+        
+                        supercedesCheck = property.supercedes[s];
+                        qLen = this.eventQueue.length;
+        
+                        for (q = 0; q < qLen; q++) {
+                            queueItemCheck = this.eventQueue[q];
+        
+                            if (queueItemCheck) {
+                                queueItemCheckKey = queueItemCheck[0];
+                                queueItemCheckValue = queueItemCheck[1];
+                                
+                                if (queueItemCheckKey == 
+                                    supercedesCheck.toLowerCase() ) {
+    
+                                    this.eventQueue.push([queueItemCheckKey, 
+                                        queueItemCheckValue]);
+    
+                                    this.eventQueue[q] = null;
+                                    break;
+    
+                                }
+                            }
+                        }
+                    }
+                }
+
+        
+                return true;
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Fires the event for a property using the property's current value.
+        * @method refireEvent
+        * @param {String} key The name of the property
+        */
+        refireEvent: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event && 
+    
+                !Lang.isUndefined(property.value)) {
+    
+                if (this.queueInProgress) {
+    
+                    this.queueProperty(key);
+    
+                } else {
+    
+                    this.fireEvent(key, property.value);
+    
+                }
+    
+            }
+        },
+        
+        /**
+        * Applies a key-value Object literal to the configuration, replacing  
+        * any existing values, and queueing the property events.
+        * Although the values will be set, fireQueue() must be called for their 
+        * associated events to execute.
+        * @method applyConfig
+        * @param {Object} userConfig The configuration Object literal
+        * @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.
+        */
+        applyConfig: function (userConfig, init) {
+        
+            var sKey,
+                oValue,
+                oConfig;
+
+            if (init) {
+
+                oConfig = {};
+
+                for (sKey in userConfig) {
+                
+                    if (Lang.hasOwnProperty(userConfig, sKey)) {
+
+                        oConfig[sKey.toLowerCase()] = userConfig[sKey];
+
+                    }
+                
+                }
+
+                this.initialConfig = oConfig;
+
+            }
+
+            for (sKey in userConfig) {
+            
+                if (Lang.hasOwnProperty(userConfig, sKey)) {
+            
+                    this.queueProperty(sKey, userConfig[sKey]);
+                
+                }
+
+            }
+
+        },
+        
+        /**
+        * Refires the events for all configuration properties using their 
+        * current values.
+        * @method refresh
+        */
+        refresh: function () {
+        
+            var prop;
+        
+            for (prop in this.config) {
+                this.refireEvent(prop);
+            }
+        },
+        
+        /**
+        * Fires the normalized list of queued property change events
+        * @method fireQueue
+        */
+        fireQueue: function () {
+        
+            var i, 
+                queueItem,
+                key,
+                value,
+                property;
+        
+            this.queueInProgress = true;
+            for (i = 0;i < this.eventQueue.length; i++) {
+                queueItem = this.eventQueue[i];
+                if (queueItem) {
+        
+                    key = queueItem[0];
+                    value = queueItem[1];
+                    property = this.config[key];
+        
+                    property.value = value;
+        
+                    this.fireEvent(key,value);
+                }
+            }
+            
+            this.queueInProgress = false;
+            this.eventQueue = [];
+        },
+        
+        /**
+        * Subscribes an external handler to the change event for any 
+        * given property. 
+        * @method subscribeToConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event handler 
+        * (see CustomEvent documentation)
+        * @param {Boolean} override Optional. If true, will override "this"  
+        * within the handler to map to the scope Object passed into the method.
+        * @return {Boolean} True, if the subscription was successful, 
+        * otherwise false.
+        */ 
+        subscribeToConfigEvent: function (key, handler, obj, override) {
+    
+            var property = this.config[key.toLowerCase()];
+    
+            if (property && property.event) {
+    
+                if (!Config.alreadySubscribed(property.event, handler, obj)) {
+    
+                    property.event.subscribe(handler, obj, override);
+    
+                }
+    
+                return true;
+    
+            } else {
+    
+                return false;
+    
+            }
+    
+        },
+        
+        /**
+        * Unsubscribes an external handler from the change event for any 
+        * given property. 
+        * @method unsubscribeFromConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event 
+        * handler (see CustomEvent documentation)
+        * @return {Boolean} True, if the unsubscription was successful, 
+        * otherwise false.
+        */
+        unsubscribeFromConfigEvent: function (key, handler, obj) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.event.unsubscribe(handler, obj);
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Returns a string representation of the Config object
+        * @method toString
+        * @return {String} The Config object in string format.
+        */
+        toString: function () {
+            var output = "Config";
+            if (this.owner) {
+                output += " [" + this.owner.toString() + "]";
+            }
+            return output;
+        },
+        
+        /**
+        * Returns a string representation of the Config object's current 
+        * CustomEvent queue
+        * @method outputEventQueue
+        * @return {String} The string list of CustomEvents currently queued 
+        * for execution
+        */
+        outputEventQueue: function () {
+
+            var output = "",
+                queueItem,
+                q,
+                nQueue = this.eventQueue.length;
+              
+            for (q = 0; q < nQueue; q++) {
+                queueItem = this.eventQueue[q];
+                if (queueItem) {
+                    output += queueItem[0] + "=" + queueItem[1] + ", ";
+                }
+            }
+            return output;
+        },
+
+        /**
+        * Sets all properties to null, unsubscribes all listeners from each 
+        * property's change event and all listeners from the configChangedEvent.
+        * @method destroy
+        */
+        destroy: function () {
+
+            var oConfig = this.config,
+                sProperty,
+                oProperty;
+
+
+            for (sProperty in oConfig) {
+            
+                if (Lang.hasOwnProperty(oConfig, sProperty)) {
+
+                    oProperty = oConfig[sProperty];
+
+                    oProperty.event.unsubscribeAll();
+                    oProperty.event = null;
+
+                }
+            
+            }
+            
+            this.configChangedEvent.unsubscribeAll();
+            
+            this.configChangedEvent = null;
+            this.owner = null;
+            this.config = null;
+            this.initialConfig = null;
+            this.eventQueue = null;
+        
+        }
+
+    };
+    
+    
+    
+    /**
+    * Checks to determine if a particular function/Object pair are already 
+    * subscribed to the specified CustomEvent
+    * @method YAHOO.util.Config.alreadySubscribed
+    * @static
+    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check 
+    * the subscriptions
+    * @param {Function} fn The function to look for in the subscribers list
+    * @param {Object} obj The execution scope Object for the subscription
+    * @return {Boolean} true, if the function/Object pair is already subscribed 
+    * to the CustomEvent passed in
+    */
+    Config.alreadySubscribed = function (evt, fn, obj) {
+    
+        var nSubscribers = evt.subscribers.length,
+            subsc,
+            i;
+
+        if (nSubscribers > 0) {
+
+            i = nSubscribers - 1;
+        
+            do {
+
+                subsc = evt.subscribers[i];
+
+                if (subsc && subsc.obj == obj && subsc.fn == fn) {
+        
+                    return true;
+        
+                }    
+            
+            }
+            while (i--);
+        
+        }
+    
+        return false;
+    
+    };
+    
+    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
+
+}());
+
+/**
+* YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility
+* used for adding, subtracting, and comparing dates.
+* @namespace YAHOO.widget
+* @class DateMath
+*/
+YAHOO.widget.DateMath = {
+	/**
+	* Constant field representing Day
+	* @property DAY
+	* @static
+	* @final
+	* @type String
+	*/
+	DAY : "D",
+
+	/**
+	* Constant field representing Week
+	* @property WEEK
+	* @static
+	* @final
+	* @type String
+	*/
+	WEEK : "W",
+
+	/**
+	* Constant field representing Year
+	* @property YEAR
+	* @static
+	* @final
+	* @type String
+	*/
+	YEAR : "Y",
+
+	/**
+	* Constant field representing Month
+	* @property MONTH
+	* @static
+	* @final
+	* @type String
+	*/
+	MONTH : "M",
+
+	/**
+	* Constant field representing one day, in milliseconds
+	* @property ONE_DAY_MS
+	* @static
+	* @final
+	* @type Number
+	*/
+	ONE_DAY_MS : 1000*60*60*24,
+
+	/**
+	* Adds the specified amount of time to the this instance.
+	* @method add
+	* @param {Date} date	The JavaScript Date object to perform addition on
+	* @param {String} field	The field constant to be used for performing addition.
+	* @param {Number} amount	The number of units (measured in the field constant) to add to the date.
+	* @return {Date} The resulting Date object
+	*/
+	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;
+					}
+				}
+				
+				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;
+		}
+		return d;
+	},
+
+	/**
+	* Subtracts the specified amount of time from the this instance.
+	* @method subtract
+	* @param {Date} date	The JavaScript Date object to perform subtraction on
+	* @param {Number} field	The this field constant to be used for performing subtraction.
+	* @param {Number} amount	The number of units (measured in the field constant) to subtract from the date.
+	* @return {Date} The resulting Date object
+	*/
+	subtract : function(date, field, amount) {
+		return this.add(date, field, (amount*-1));
+	},
+
+	/**
+	* Determines whether a given date is before another date on the calendar.
+	* @method before
+	* @param {Date} date		The Date object to compare with the compare argument
+	* @param {Date} compareTo	The Date object to use for the comparison
+	* @return {Boolean} true if the date occurs before the compared date; false if not.
+	*/
+	before : function(date, compareTo) {
+		var ms = compareTo.getTime();
+		if (date.getTime() < ms) {
+			return true;
+		} else {
+			return false;
+		}
+	},
+
+	/**
+	* Determines whether a given date is after another date on the calendar.
+	* @method after
+	* @param {Date} date		The Date object to compare with the compare argument
+	* @param {Date} compareTo	The Date object to use for the comparison
+	* @return {Boolean} true if the date occurs after the compared date; false if not.
+	*/
+	after : function(date, compareTo) {
+		var ms = compareTo.getTime();
+		if (date.getTime() > ms) {
+			return true;
+		} else {
+			return false;
+		}
+	},
+
+	/**
+	* Determines whether a given date is between two other dates on the calendar.
+	* @method between
+	* @param {Date} date		The date to check for
+	* @param {Date} dateBegin	The start of the range
+	* @param {Date} dateEnd		The end of the range
+	* @return {Boolean} true if the date occurs between the compared dates; false if not.
+	*/
+	between : function(date, dateBegin, dateEnd) {
+		if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
+			return true;
+		} else {
+			return false;
+		}
+	},
+	
+	/**
+	* Retrieves a JavaScript Date object representing January 1 of any given year.
+	* @method getJan1
+	* @param {Number} calendarYear		The calendar year for which to retrieve January 1
+	* @return {Date}	January 1 of the calendar year specified.
+	*/
+	getJan1 : function(calendarYear) {
+		return new Date(calendarYear,0,1); 
+	},
+
+	/**
+	* Calculates the number of days the specified date is from January 1 of the specified calendar year.
+	* Passing January 1 to this function would return an offset value of zero.
+	* @method getDayOffset
+	* @param {Date}	date	The JavaScript date for which to find the offset
+	* @param {Number} calendarYear	The calendar year to use for determining the offset
+	* @return {Number}	The number of days since January 1 of the given year
+	*/
+	getDayOffset : function(date, calendarYear) {
+		var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
+		
+		// Find the number of days the passed in date is away from the calendar year start
+		var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
+		return dayOffset;
+	},
+
+	/**
+	* Calculates the week number for the given date. This function assumes that week 1 is the
+	* week in which January 1 appears, regardless of whether the week consists of a full 7 days.
+	* The calendar year can be specified to help find what a the week number would be for a given
+	* date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
+	* week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
+	* easily.
+	* @method getWeekNumber
+	* @param {Date}	date	The JavaScript date for which to find the week number
+	* @param {Number} calendarYear	OPTIONAL - The calendar year to use for determining the week number. Default is
+	*											the calendar year of parameter "date".
+	* @return {Number}	The week number of the given date.
+	*/
+	getWeekNumber : function(date, calendarYear) {
+		date = this.clearTime(date);
+		var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
+
+		var jan1 = new Date(nearestThurs.getFullYear(),0,1);
+		var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
+
+		var weekNum = Math.ceil((dayOfYear)/ 7);
+		return weekNum;
+	},
+
+	/**
+	* Determines if a given week overlaps two different years.
+	* @method isYearOverlapWeek
+	* @param {Date}	weekBeginDate	The JavaScript Date representing the first day of the week.
+	* @return {Boolean}	true if the date overlaps two different years.
+	*/
+	isYearOverlapWeek : function(weekBeginDate) {
+		var overlaps = false;
+		var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+		if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
+			overlaps = true;
+		}
+		return overlaps;
+	},
+
+	/**
+	* Determines if a given week overlaps two different months.
+	* @method isMonthOverlapWeek
+	* @param {Date}	weekBeginDate	The JavaScript Date representing the first day of the week.
+	* @return {Boolean}	true if the date overlaps two different months.
+	*/
+	isMonthOverlapWeek : function(weekBeginDate) {
+		var overlaps = false;
+		var nextWeek = this.add(weekBeginDate, this.DAY, 6);
+		if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
+			overlaps = true;
+		}
+		return overlaps;
+	},
+
+	/**
+	* Gets the first day of a month containing a given date.
+	* @method findMonthStart
+	* @param {Date}	date	The JavaScript Date used to calculate the month start
+	* @return {Date}		The JavaScript Date representing the first day of the month
+	*/
+	findMonthStart : function(date) {
+		var start = new Date(date.getFullYear(), date.getMonth(), 1);
+		return start;
+	},
+
+	/**
+	* Gets the last day of a month containing a given date.
+	* @method findMonthEnd
+	* @param {Date}	date	The JavaScript Date used to calculate the month end
+	* @return {Date}		The JavaScript Date representing the last day of the month
+	*/
+	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;
+	},
+
+	/**
+	* Clears the time fields from a given date, effectively setting the time to 12 noon.
+	* @method clearTime
+	* @param {Date}	date	The JavaScript Date for which the time fields will be cleared
+	* @return {Date}		The JavaScript Date cleared of all time fields
+	*/
+	clearTime : function(date) {
+		date.setHours(12,0,0,0);
+		return date;
+	}
+};
+
+/**
+* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month  or multi-month interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
+* @module    calendar
+* @title     Calendar
+* @namespace YAHOO.widget
+* @requires  yahoo,dom,event
+*/
+
+/**
+* Calendar is the base class for the Calendar widget. In its most basic
+* implementation, it has the ability to render a calendar widget on the page
+* that can be manipulated to select a single date, move back and forth between
+* months and years.
+* <p>To construct the placeholder for the calendar widget, the code is as
+* follows:
+*	<xmp>
+*		<div id="cal1Container"></div>
+*	</xmp>
+* </p>
+* @namespace YAHOO.widget
+* @class Calendar
+* @constructor
+* @param {String}	id			The id of the table element that will represent the calendar widget
+* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+* @param {Object}	config		The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar = function(id, containerId, config) {
+	this.init(id, containerId, config);
+};
+
+/**
+* The path to be used for images loaded for the Calendar
+* @property YAHOO.widget.Calendar.IMG_ROOT
+* @static
+* @deprecated	You can now customize images by overriding the calclose, calnavleft and calnavright default CSS classes for the close icon, left arrow and right arrow respectively
+* @type String
+*/
+YAHOO.widget.Calendar.IMG_ROOT = null;
+
+/**
+* Type constant used for renderers to represent an individual date (M/D/Y)
+* @property YAHOO.widget.Calendar.DATE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.DATE = "D";
+
+/**
+* Type constant used for renderers to represent an individual date across any year (M/D)
+* @property YAHOO.widget.Calendar.MONTH_DAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH_DAY = "MD";
+
+/**
+* Type constant used for renderers to represent a weekday
+* @property YAHOO.widget.Calendar.WEEKDAY
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.WEEKDAY = "WD";
+
+/**
+* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
+* @property YAHOO.widget.Calendar.RANGE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.RANGE = "R";
+
+/**
+* Type constant used for renderers to represent a month across any year
+* @property YAHOO.widget.Calendar.MONTH
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MONTH = "M";
+
+/**
+* Constant that represents the total number of date cells that are displayed in a given month
+* @property YAHOO.widget.Calendar.DISPLAY_DAYS
+* @static
+* @final
+* @type Number
+*/
+YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
+
+/**
+* Constant used for halting the execution of the remainder of the render stack
+* @property YAHOO.widget.Calendar.STOP_RENDER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.STOP_RENDER = "S";
+
+/**
+* Constant used to represent short date field string formats (e.g. Tu or Feb)
+* @property YAHOO.widget.Calendar.SHORT
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.SHORT = "short";
+
+/**
+* Constant used to represent long date field string formats (e.g. Monday or February)
+* @property YAHOO.widget.Calendar.LONG
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.LONG = "long";
+
+/**
+* Constant used to represent medium date field string formats (e.g. Mon)
+* @property YAHOO.widget.Calendar.MEDIUM
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.MEDIUM = "medium";
+
+/**
+* Constant used to represent single character date field string formats (e.g. M, T, W)
+* @property YAHOO.widget.Calendar.ONE_CHAR
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.Calendar.ONE_CHAR = "1char";
+
+/**
+* The set of default Config property keys and values for the Calendar
+* @property YAHOO.widget.Calendar._DEFAULT_CONFIG
+* @final
+* @static
+* @private
+* @type Object
+*/
+YAHOO.widget.Calendar._DEFAULT_CONFIG = {
+	// Default values for pagedate and selected are not class level constants - they are set during instance creation 
+	PAGEDATE : {key:"pagedate", value:null},
+	SELECTED : {key:"selected", value:null},
+	TITLE : {key:"title", value:""},
+	CLOSE : {key:"close", value:false},
+	IFRAME : {key:"iframe", value:(YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true : false},
+	MINDATE : {key:"mindate", value:null},
+	MAXDATE : {key:"maxdate", value:null},
+	MULTI_SELECT : {key:"multi_select", value:false},
+	START_WEEKDAY : {key:"start_weekday", value:0},
+	SHOW_WEEKDAYS : {key:"show_weekdays", value:true},
+	SHOW_WEEK_HEADER : {key:"show_week_header", value:false},
+	SHOW_WEEK_FOOTER : {key:"show_week_footer", value:false},
+	HIDE_BLANK_WEEKS : {key:"hide_blank_weeks", value:false},
+	NAV_ARROW_LEFT: {key:"nav_arrow_left", value:null} ,
+	NAV_ARROW_RIGHT : {key:"nav_arrow_right", value:null} ,
+	MONTHS_SHORT : {key:"months_short", value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
+	MONTHS_LONG: {key:"months_long", value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]},
+	WEEKDAYS_1CHAR: {key:"weekdays_1char", value:["S", "M", "T", "W", "T", "F", "S"]},
+	WEEKDAYS_SHORT: {key:"weekdays_short", value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]},
+	WEEKDAYS_MEDIUM: {key:"weekdays_medium", value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
+	WEEKDAYS_LONG: {key:"weekdays_long", value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]},
+	LOCALE_MONTHS:{key:"locale_months", value:"long"},
+	LOCALE_WEEKDAYS:{key:"locale_weekdays", value:"short"},
+	DATE_DELIMITER:{key:"date_delimiter", value:","},
+	DATE_FIELD_DELIMITER:{key:"date_field_delimiter", value:"/"},
+	DATE_RANGE_DELIMITER:{key:"date_range_delimiter", value:"-"},
+	MY_MONTH_POSITION:{key:"my_month_position", value:1},
+	MY_YEAR_POSITION:{key:"my_year_position", value:2},
+	MD_MONTH_POSITION:{key:"md_month_position", value:1},
+	MD_DAY_POSITION:{key:"md_day_position", value:2},
+	MDY_MONTH_POSITION:{key:"mdy_month_position", value:1},
+	MDY_DAY_POSITION:{key:"mdy_day_position", value:2},
+	MDY_YEAR_POSITION:{key:"mdy_year_position", value:3},
+	MY_LABEL_MONTH_POSITION:{key:"my_label_month_position", value:1},
+	MY_LABEL_YEAR_POSITION:{key:"my_label_year_position", value:2},
+	MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix", value:" "},
+	MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix", value:""}
+};
+
+/**
+* The set of Custom Event types supported by the Calendar
+* @property YAHOO.widget.Calendar._EVENT_TYPES
+* @final
+* @static
+* @private
+* @type Object
+*/
+YAHOO.widget.Calendar._EVENT_TYPES = {
+	BEFORE_SELECT : "beforeSelect", 
+	SELECT : "select",
+	BEFORE_DESELECT : "beforeDeselect",
+	DESELECT : "deselect",
+	CHANGE_PAGE : "changePage",
+	BEFORE_RENDER : "beforeRender",
+	RENDER : "render",
+	RESET : "reset",
+	CLEAR : "clear"
+};
+
+/**
+* The set of default style constants for the Calendar
+* @property YAHOO.widget.Calendar._STYLES
+* @final
+* @static
+* @private
+* @type Object
+*/
+YAHOO.widget.Calendar._STYLES = {
+	CSS_ROW_HEADER: "calrowhead",
+	CSS_ROW_FOOTER: "calrowfoot",
+	CSS_CELL : "calcell",
+	CSS_CELL_SELECTOR : "selector",
+	CSS_CELL_SELECTED : "selected",
+	CSS_CELL_SELECTABLE : "selectable",
+	CSS_CELL_RESTRICTED : "restricted",
+	CSS_CELL_TODAY : "today",
+	CSS_CELL_OOM : "oom",
+	CSS_CELL_OOB : "previous",
+	CSS_HEADER : "calheader",
+	CSS_HEADER_TEXT : "calhead",
+	CSS_BODY : "calbody",
+	CSS_WEEKDAY_CELL : "calweekdaycell",
+	CSS_WEEKDAY_ROW : "calweekdayrow",
+	CSS_FOOTER : "calfoot",
+	CSS_CALENDAR : "yui-calendar",
+	CSS_SINGLE : "single",
+	CSS_CONTAINER : "yui-calcontainer",
+	CSS_NAV_LEFT : "calnavleft",
+	CSS_NAV_RIGHT : "calnavright",
+	CSS_CLOSE : "calclose",
+	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"
+};
+
+YAHOO.widget.Calendar.prototype = {
+
+	/**
+	* The configuration object used to set up the calendars various locale and style options.
+	* @property Config
+	* @private
+	* @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
+	* @type Object
+	*/
+	Config : null,
+
+	/**
+	* The parent CalendarGroup, only to be set explicitly by the parent group
+	* @property parent
+	* @type CalendarGroup
+	*/	
+	parent : null,
+
+	/**
+	* The index of this item in the parent group
+	* @property index
+	* @type Number
+	*/
+	index : -1,
+
+	/**
+	* The collection of calendar table cells
+	* @property cells
+	* @type HTMLTableCellElement[]
+	*/
+	cells : null,
+	
+	/**
+	* 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].
+	* @property cellDates
+	* @type Array[](Number[])
+	*/
+	cellDates : null,
+
+	/**
+	* The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
+	* @property id
+	* @type String
+	*/
+	id : null,
+
+	/**
+	* 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.
+	* @property oDomContainer
+	* @type HTMLElement
+	*/
+	oDomContainer : null,
+
+	/**
+	* A Date object representing today's date.
+	* @property today
+	* @type Date
+	*/
+	today : null,
+
+	/**
+	* The list of render functions, along with required parameters, used to render cells. 
+	* @property renderStack
+	* @type Array[]
+	*/
+	renderStack : null,
+
+	/**
+	* A copy of the initial render functions created before rendering.
+	* @property _renderStack
+	* @private
+	* @type Array
+	*/
+	_renderStack : null,
+
+	/**
+	* The private list of initially selected dates.
+	* @property _selectedDates
+	* @private
+	* @type Array
+	*/
+	_selectedDates : null,
+
+	/**
+	* A map of DOM event handlers to attach to cells associated with specific CSS class names
+	* @property domEventMap
+	* @type Object
+	*/
+	domEventMap : null
+};
+
+/**
+* Initializes the Calendar widget.
+* @method init
+* @param {String}	id			The id of the table element that will represent the calendar widget
+* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+* @param {Object}	config		The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
+	this.initEvents();
+	this.today = new Date();
+	YAHOO.widget.DateMath.clearTime(this.today);
+
+	this.id = id;
+	this.oDomContainer = document.getElementById(containerId);
+
+	/**
+	* The Config object used to hold the configuration variables for the Calendar
+	* @property cfg
+	* @type YAHOO.util.Config
+	*/
+	this.cfg = new YAHOO.util.Config(this);
+	
+	/**
+	* The local object which contains the Calendar's options
+	* @property Options
+	* @type Object
+	*/
+	this.Options = {};
+
+	/**
+	* The local object which contains the Calendar's locale settings
+	* @property Locale
+	* @type Object
+	*/
+	this.Locale = {};
+
+	this.initStyles();
+
+	YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);	
+	YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
+	
+	this.cellDates = [];
+	this.cells = [];
+	this.renderStack = [];
+	this._renderStack = [];
+
+	this.setupConfig();
+	
+	if (config) {
+		this.cfg.applyConfig(config, true);
+	}
+	
+	this.cfg.fireQueue();
+};
+
+/**
+* Default Config listener for the iframe property. If the iframe config property is set to true, 
+* renders the built-in IFRAME shim if the container is relatively or absolutely positioned.
+* 
+* @method configIframe
+*/
+YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
+	var useIframe = args[0];
+
+	if (!this.parent) {
+		if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
+			if (useIframe) {
+				var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
+				
+				if (pos == "absolute" || pos == "relative") {
+					
+					if (!YAHOO.util.Dom.inDocument(this.iframe)) {
+						this.iframe = document.createElement("iframe");
+						this.iframe.src = "javascript:false;";
+
+						YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
+
+						if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+							YAHOO.util.Dom.addClass(this.iframe, "fixedsize");
+						}
+
+						this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
+					}
+				}
+			} else {
+				if (this.iframe) {
+					if (this.iframe.parentNode) {
+						this.iframe.parentNode.removeChild(this.iframe);
+					}
+					this.iframe = null;
+				}
+			}
+		}
+	}
+};
+/**
+* Default handler for the "title" property
+* @method configTitle
+*/
+YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
+	var title = args[0], tDiv;
+
+	// "" disables title bar
+	if (title) {
+		this.createTitleBar(title);
+	} else {
+		var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);
+		if (!close) {
+			this.removeTitleBar();
+		} else {
+			this.createTitleBar("&#160;");
+		}
+	}
+};
+
+/**
+* Default handler for the "close" property
+* @method configClose
+*/
+YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
+	var close = args[0],
+		title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);
+
+	if (close) {
+		if (!title) {
+			this.createTitleBar("&#160;");
+		}
+		this.createCloseButton();
+	} else {
+		this.removeCloseButton();
+		if (!title) {
+			this.removeTitleBar();
+		}
+	}
+};
+
+/**
+* Initializes Calendar's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.Calendar.prototype.initEvents = function() {
+
+	var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+
+	/**
+	* Fired before a selection is made
+	* @event beforeSelectEvent
+	*/
+	this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT); 
+
+	/**
+	* Fired when a selection is made
+	* @event selectEvent
+	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	*/
+	this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
+
+	/**
+	* Fired before a selection is made
+	* @event beforeDeselectEvent
+	*/
+	this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
+
+	/**
+	* Fired when a selection is made
+	* @event deselectEvent
+	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	*/
+	this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
+
+	/**
+	* Fired when the Calendar page is changed
+	* @event changePageEvent
+	*/
+	this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
+
+	/**
+	* Fired before the Calendar is rendered
+	* @event beforeRenderEvent
+	*/
+	this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
+
+	/**
+	* Fired when the Calendar is rendered
+	* @event renderEvent
+	*/
+	this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
+
+	/**
+	* Fired when the Calendar is reset
+	* @event resetEvent
+	*/
+	this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
+
+	/**
+	* Fired when the Calendar is cleared
+	* @event clearEvent
+	*/
+	this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
+
+	this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
+	this.selectEvent.subscribe(this.onSelect, this, true);
+	this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
+	this.deselectEvent.subscribe(this.onDeselect, this, true);
+	this.changePageEvent.subscribe(this.onChangePage, this, true);
+	this.renderEvent.subscribe(this.onRender, this, true);
+	this.resetEvent.subscribe(this.onReset, this, true);
+	this.clearEvent.subscribe(this.onClear, this, true);
+};
+
+/**
+* The default event function that is attached to a date link within a calendar cell
+* when the calendar is rendered.
+* @method doSelectCell
+* @param {DOMEvent} e	The event
+* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
+	var cell,index,d,date;
+
+	var target = YAHOO.util.Event.getTarget(e);
+	var tagName = target.tagName.toLowerCase();
+	var defSelector = false;
+
+	while (tagName != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+
+		if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
+			defSelector = true;	
+		}
+
+		target = target.parentNode;
+		tagName = target.tagName.toLowerCase(); 
+		if (tagName == "html") {
+			return;
+		}
+	}
+
+	if (defSelector) {
+		// Stop link href navigation for default renderer
+		YAHOO.util.Event.preventDefault(e);
+	}
+
+	cell = target;
+
+	if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+		index = cell.id.split("cell")[1];
+		d = cal.cellDates[index];
+		date = new Date(d[0],d[1]-1,d[2]);
+	
+		var link;
+
+		if (cal.Options.MULTI_SELECT) {
+			link = cell.getElementsByTagName("a")[0];
+			if (link) {
+				link.blur();
+			}
+
+			var cellDate = cal.cellDates[index];
+			var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
+
+			if (cellDateIndex > -1) {	
+				cal.deselectCell(index);
+			} else {
+				cal.selectCell(index);
+			}	
+
+		} else {
+			link = cell.getElementsByTagName("a")[0];
+			if (link) {
+				link.blur();
+			}
+			cal.selectCell(index);
+		}
+	}
+};
+
+/**
+* The event that is executed when the user hovers over a cell
+* @method doCellMouseOver
+* @param {DOMEvent} e	The event
+* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
+	var target;
+	if (e) {
+		target = YAHOO.util.Event.getTarget(e);
+	} else {
+		target = this;
+	}
+
+	while (target.tagName.toLowerCase() != "td") {
+		target = target.parentNode;
+		if (target.tagName.toLowerCase() == "html") {
+			return;
+		}
+	}
+
+	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+		YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
+	}
+};
+
+/**
+* The event that is executed when the user moves the mouse out of a cell
+* @method doCellMouseOut
+* @param {DOMEvent} e	The event
+* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+*/
+YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
+	var target;
+	if (e) {
+		target = YAHOO.util.Event.getTarget(e);
+	} else {
+		target = this;
+	}
+
+	while (target.tagName.toLowerCase() != "td") {
+		target = target.parentNode;
+		if (target.tagName.toLowerCase() == "html") {
+			return;
+		}
+	}
+
+	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+		YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+	}
+};
+
+YAHOO.widget.Calendar.prototype.setupConfig = function() {
+
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+
+	/**
+	* The month/year representing the current visible Calendar date (mm/yyyy)
+	* @config pagedate
+	* @type String
+	* @default today's date
+	*/
+	this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
+
+	/**
+	* The date or range of dates representing the current Calendar selection
+	* @config selected
+	* @type String
+	* @default []
+	*/
+	this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
+
+	/**
+	* The title to display above the Calendar's month header
+	* @config title
+	* @type String
+	* @default ""
+	*/
+	this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
+
+	/**
+	* Whether or not a close button should be displayed for this Calendar
+	* @config close
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
+
+	/**
+	* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+	* This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be 
+	* enabled if required.
+	* 
+	* @config iframe
+	* @type Boolean
+	* @default true for IE6 and below, false for all other browsers
+	*/
+	this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
+
+	/**
+	* The minimum selectable date in the current Calendar (mm/dd/yyyy)
+	* @config mindate
+	* @type String
+	* @default null
+	*/
+	this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.configMinDate } );
+
+	/**
+	* The maximum selectable date in the current Calendar (mm/dd/yyyy)
+	* @config maxdate
+	* @type String
+	* @default null
+	*/
+	this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.configMaxDate } );
+
+
+	// Options properties
+
+	/**
+	* True if the Calendar should allow multiple selections. False by default.
+	* @config MULTI_SELECT
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+	/**
+	* The weekday the week begins on. Default is 0 (Sunday).
+	* @config START_WEEKDAY
+	* @type number
+	* @default 0
+	*/
+	this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.configOptions, validator:this.cfg.checkNumber  } );
+
+	/**
+	* True if the Calendar should show weekday labels. True by default.
+	* @config SHOW_WEEKDAYS
+	* @type Boolean
+	* @default true
+	*/
+	this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:this.cfg.checkBoolean  } );
+
+	/**
+	* True if the Calendar should show week row headers. False by default.
+	* @config SHOW_WEEK_HEADER
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, { value:defCfg.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+	/**
+	* True if the Calendar should show week row footers. False by default.
+	* @config SHOW_WEEK_FOOTER
+	* @type Boolean
+	* @default false
+	*/	
+	this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
+	/**
+	* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+	* @config HIDE_BLANK_WEEKS
+	* @type Boolean
+	* @default false
+	*/	
+	this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, { value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+	
+	/**
+	* The image that should be used for the left navigation arrow.
+	* @config NAV_ARROW_LEFT
+	* @type String
+	* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"  
+	* @default null
+	*/	
+	this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.configOptions } );
+
+	/**
+	* The image that should be used for the right navigation arrow.
+	* @config NAV_ARROW_RIGHT
+	* @type String
+	* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
+	* @default null
+	*/	
+	this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, { value:defCfg.NAV_ARROW_RIGHT.value, handler:this.configOptions } );
+
+	// Locale properties
+
+	/**
+	* The short month labels for the current locale.
+	* @config MONTHS_SHORT
+	* @type String[]
+	* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+	*/
+	this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.configLocale } );
+	
+	/**
+	* The long month labels for the current locale.
+	* @config MONTHS_LONG
+	* @type String[]
+	* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+	*/	
+	this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.configLocale } );
+	
+	/**
+	* The 1-character weekday labels for the current locale.
+	* @config WEEKDAYS_1CHAR
+	* @type String[]
+	* @default ["S", "M", "T", "W", "T", "F", "S"]
+	*/	
+	this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.configLocale } );
+	
+	/**
+	* The short weekday labels for the current locale.
+	* @config WEEKDAYS_SHORT
+	* @type String[]
+	* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+	*/	
+	this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.configLocale } );
+	
+	/**
+	* The medium weekday labels for the current locale.
+	* @config WEEKDAYS_MEDIUM
+	* @type String[]
+	* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+	*/	
+	this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.configLocale } );
+	
+	/**
+	* The long weekday labels for the current locale.
+	* @config WEEKDAYS_LONG
+	* @type String[]
+	* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+	*/	
+	this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.configLocale } );
+
+	/**
+	* Refreshes the locale values used to build the Calendar.
+	* @method refreshLocale
+	* @private
+	*/
+	var refreshLocale = function() {
+		this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
+		this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
+	};
+
+	this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
+	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key, refreshLocale, this, true);
+	
+	/**
+	* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+	* @config LOCALE_MONTHS
+	* @type String
+	* @default "long"
+	*/	
+	this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.configLocaleValues } );
+	
+	/**
+	* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+	* @config LOCALE_WEEKDAYS
+	* @type String
+	* @default "short"
+	*/	
+	this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
+
+	/**
+	* The value used to delimit individual dates in a date string passed to various Calendar functions.
+	* @config DATE_DELIMITER
+	* @type String
+	* @default ","
+	*/	
+	this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.configLocale } );
+
+	/**
+	* The value used to delimit date fields in a date string passed to various Calendar functions.
+	* @config DATE_FIELD_DELIMITER
+	* @type String
+	* @default "/"
+	*/	
+	this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, { value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.configLocale } );
+
+	/**
+	* The value used to delimit date ranges in a date string passed to various Calendar functions.
+	* @config DATE_RANGE_DELIMITER
+	* @type String
+	* @default "-"
+	*/
+	this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, { value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.configLocale } );
+
+	/**
+	* The position of the month in a month/year date string
+	* @config MY_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the year in a month/year date string
+	* @config MY_YEAR_POSITION
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the month in a month/day date string
+	* @config MD_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the day in a month/year date string
+	* @config MD_DAY_POSITION
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the month in a month/day/year date string
+	* @config MDY_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the day in a month/day/year date string
+	* @config MDY_DAY_POSITION
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the year in a month/day/year date string
+	* @config MDY_YEAR_POSITION
+	* @type Number
+	* @default 3
+	*/
+	this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the month in the month year label string used as the Calendar header
+	* @config MY_LABEL_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the year in the month year label string used as the Calendar header
+	* @config MY_LABEL_YEAR_POSITION
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The suffix used after the month when rendering the Calendar header
+	* @config MY_LABEL_MONTH_SUFFIX
+	* @type String
+	* @default " "
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.configLocale } );
+	
+	/**
+	* The suffix used after the year when rendering the Calendar header
+	* @config MY_LABEL_YEAR_SUFFIX
+	* @type String
+	* @default ""
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
+};
+
+/**
+* The default handler for the "pagedate" property
+* @method configPageDate
+*/
+YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
+	this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key, this._parsePageDate(args[0]), true);
+};
+
+/**
+* The default handler for the "mindate" property
+* @method configMinDate
+*/
+YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
+	var val = args[0];
+	if (YAHOO.lang.isString(val)) {
+		val = this._parseDate(val);
+		this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key, new Date(val[0],(val[1]-1),val[2]));
+	}
+};
+
+/**
+* The default handler for the "maxdate" property
+* @method configMaxDate
+*/
+YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
+	var val = args[0];
+	if (YAHOO.lang.isString(val)) {
+		val = this._parseDate(val);
+		this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key, new Date(val[0],(val[1]-1),val[2]));
+	}
+};
+
+/**
+* The default handler for the "selected" property
+* @method configSelected
+*/
+YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
+	var selected = args[0];
+	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+	
+	if (selected) {
+		if (YAHOO.lang.isString(selected)) {
+			this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
+		} 
+	}
+	if (! this._selectedDates) {
+		this._selectedDates = this.cfg.getProperty(cfgSelected);
+	}
+};
+
+/**
+* The default handler for all configuration options properties
+* @method configOptions
+*/
+YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
+	this.Options[type.toUpperCase()] = args[0];
+};
+
+/**
+* The default handler for all configuration locale properties
+* @method configLocale
+*/
+YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	this.Locale[type.toUpperCase()] = args[0];
+
+	this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
+	this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
+};
+
+/**
+* The default handler for all configuration locale field length properties
+* @method configLocaleValues
+*/
+YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG; 
+
+	type = type.toLowerCase();
+	var val = args[0];
+
+	switch (type) {
+		case defCfg.LOCALE_MONTHS.key:
+			switch (val) {
+				case YAHOO.widget.Calendar.SHORT:
+					this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();
+					break;
+				case YAHOO.widget.Calendar.LONG:
+					this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();
+					break;
+			}
+			break;
+		case defCfg.LOCALE_WEEKDAYS.key:
+			switch (val) {
+				case YAHOO.widget.Calendar.ONE_CHAR:
+					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();
+					break;
+				case YAHOO.widget.Calendar.SHORT:
+					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();
+					break;
+				case YAHOO.widget.Calendar.MEDIUM:
+					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();
+					break;
+				case YAHOO.widget.Calendar.LONG:
+					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();
+					break;
+			}
+			
+			var START_WEEKDAY = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
+
+			if (START_WEEKDAY > 0) {
+				for (var w=0;w<START_WEEKDAY;++w) {
+					this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());
+				}
+			}
+			break;
+	}
+};
+
+/**
+* Defines the style constants for the Calendar
+* @method initStyles
+*/
+YAHOO.widget.Calendar.prototype.initStyles = function() {
+
+	var defStyle = YAHOO.widget.Calendar._STYLES;
+
+	this.Style = {
+		/**
+		* @property Style.CSS_ROW_HEADER
+		*/
+		CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
+		/**
+		* @property Style.CSS_ROW_FOOTER
+		*/
+		CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
+		/**
+		* @property Style.CSS_CELL
+		*/
+		CSS_CELL : defStyle.CSS_CELL,
+		/**
+		* @property Style.CSS_CELL_SELECTOR
+		*/
+		CSS_CELL_SELECTOR : defStyle.CSS_CELL_SELECTOR,
+		/**
+		* @property Style.CSS_CELL_SELECTED
+		*/
+		CSS_CELL_SELECTED : defStyle.CSS_CELL_SELECTED,
+		/**
+		* @property Style.CSS_CELL_SELECTABLE
+		*/
+		CSS_CELL_SELECTABLE : defStyle.CSS_CELL_SELECTABLE,
+		/**
+		* @property Style.CSS_CELL_RESTRICTED
+		*/
+		CSS_CELL_RESTRICTED : defStyle.CSS_CELL_RESTRICTED,
+		/**
+		* @property Style.CSS_CELL_TODAY
+		*/
+		CSS_CELL_TODAY : defStyle.CSS_CELL_TODAY,
+		/**
+		* @property Style.CSS_CELL_OOM
+		*/
+		CSS_CELL_OOM : defStyle.CSS_CELL_OOM,
+		/**
+		* @property Style.CSS_CELL_OOB
+		*/
+		CSS_CELL_OOB : defStyle.CSS_CELL_OOB,
+		/**
+		* @property Style.CSS_HEADER
+		*/
+		CSS_HEADER : defStyle.CSS_HEADER,
+		/**
+		* @property Style.CSS_HEADER_TEXT
+		*/
+		CSS_HEADER_TEXT : defStyle.CSS_HEADER_TEXT,
+		/**
+		* @property Style.CSS_BODY
+		*/
+		CSS_BODY : defStyle.CSS_BODY,
+		/**
+		* @property Style.CSS_WEEKDAY_CELL
+		*/
+		CSS_WEEKDAY_CELL : defStyle.CSS_WEEKDAY_CELL,
+		/**
+		* @property Style.CSS_WEEKDAY_ROW
+		*/
+		CSS_WEEKDAY_ROW : defStyle.CSS_WEEKDAY_ROW,
+		/**
+		* @property Style.CSS_FOOTER
+		*/
+		CSS_FOOTER : defStyle.CSS_FOOTER,
+		/**
+		* @property Style.CSS_CALENDAR
+		*/
+		CSS_CALENDAR : defStyle.CSS_CALENDAR,
+		/**
+		* @property Style.CSS_SINGLE
+		*/
+		CSS_SINGLE : defStyle.CSS_SINGLE,
+		/**
+		* @property Style.CSS_CONTAINER
+		*/
+		CSS_CONTAINER : defStyle.CSS_CONTAINER,
+		/**
+		* @property Style.CSS_NAV_LEFT
+		*/
+		CSS_NAV_LEFT : defStyle.CSS_NAV_LEFT,
+		/**
+		* @property Style.CSS_NAV_RIGHT
+		*/
+		CSS_NAV_RIGHT : defStyle.CSS_NAV_RIGHT,
+		/**
+		* @property Style.CSS_CLOSE
+		*/
+		CSS_CLOSE : defStyle.CSS_CLOSE,
+		/**
+		* @property Style.CSS_CELL_TOP
+		*/
+		CSS_CELL_TOP : defStyle.CSS_CELL_TOP,
+		/**
+		* @property Style.CSS_CELL_LEFT
+		*/
+		CSS_CELL_LEFT : defStyle.CSS_CELL_LEFT,
+		/**
+		* @property Style.CSS_CELL_RIGHT
+		*/
+		CSS_CELL_RIGHT : defStyle.CSS_CELL_RIGHT,
+		/**
+		* @property Style.CSS_CELL_BOTTOM
+		*/
+		CSS_CELL_BOTTOM : defStyle.CSS_CELL_BOTTOM,
+		/**
+		* @property Style.CSS_CELL_HOVER
+		*/
+		CSS_CELL_HOVER : defStyle.CSS_CELL_HOVER,
+		/**
+		* @property Style.CSS_CELL_HIGHLIGHT1
+		*/
+		CSS_CELL_HIGHLIGHT1 : defStyle.CSS_CELL_HIGHLIGHT1,
+		/**
+		* @property Style.CSS_CELL_HIGHLIGHT2
+		*/
+		CSS_CELL_HIGHLIGHT2 : defStyle.CSS_CELL_HIGHLIGHT2,
+		/**
+		* @property Style.CSS_CELL_HIGHLIGHT3
+		*/
+		CSS_CELL_HIGHLIGHT3 : defStyle.CSS_CELL_HIGHLIGHT3,
+		/**
+		* @property Style.CSS_CELL_HIGHLIGHT4
+		*/
+		CSS_CELL_HIGHLIGHT4 : defStyle.CSS_CELL_HIGHLIGHT4
+	};
+};
+
+/**
+* Builds the date label that will be displayed in the calendar header or
+* footer, depending on configuration.
+* @method buildMonthLabel
+* @return	{String}	The formatted calendar month label
+*/
+YAHOO.widget.Calendar.prototype.buildMonthLabel = function() {
+	var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
+
+	var monthLabel  = this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
+	var yearLabel = pageDate.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
+
+	if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
+		return yearLabel + monthLabel;
+	} else {
+		return monthLabel + yearLabel;
+	}
+};
+
+/**
+* Builds the date digit that will be displayed in calendar cells
+* @method buildDayLabel
+* @param {Date}	workingDate	The current working date
+* @return	{String}	The formatted day label
+*/
+YAHOO.widget.Calendar.prototype.buildDayLabel = function(workingDate) {
+	return workingDate.getDate();
+};
+
+/**
+ * Creates the title bar element and adds it to Calendar container DIV
+ * 
+ * @method createTitleBar
+ * @param {String} strTitle The title to display in the title bar
+ * @return The title bar element
+ */
+YAHOO.widget.Calendar.prototype.createTitleBar = function(strTitle) {
+	var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
+	tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
+	tDiv.innerHTML = strTitle;
+	this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
+
+	YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
+
+	return tDiv;
+};
+
+/**
+ * Removes the title bar element from the DOM
+ * 
+ * @method removeTitleBar
+ */
+YAHOO.widget.Calendar.prototype.removeTitleBar = function() {
+	var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+	if (tDiv) {
+		YAHOO.util.Event.purgeElement(tDiv);
+		this.oDomContainer.removeChild(tDiv);
+	}
+	YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+};
+
+/**
+ * Creates the close button HTML element and adds it to Calendar container DIV
+ * 
+ * @method createCloseButton
+ * @return The close HTML element created
+ */
+YAHOO.widget.Calendar.prototype.createCloseButton = function() {
+	var Dom = YAHOO.util.Dom,
+		Event = YAHOO.util.Event,
+		cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
+		DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";
+
+	var lnk = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0];
+
+	if (!lnk) {
+		lnk = document.createElement("a");  
+		Event.addListener(lnk, "click", function(e, cal) {
+			cal.hide(); 
+			Event.preventDefault(e);
+		}, this);        
+	}
+
+	lnk.href = "#";
+	lnk.className = "link-close";
+
+	if (YAHOO.widget.Calendar.IMG_ROOT !== null) {
+		var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
+		img.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
+		img.className = cssClose;
+		lnk.appendChild(img);
+	} else {
+		lnk.innerHTML = '<span class="' + cssClose + ' ' + this.Style.CSS_CLOSE + '"></span>';
+	}
+	this.oDomContainer.appendChild(lnk);
+
+	return lnk;
+};
+
+/**
+ * Removes the close button HTML element from the DOM
+ * 
+ * @method removeCloseButton
+ */
+YAHOO.widget.Calendar.prototype.removeCloseButton = function() {
+	var btn = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
+	if (btn) {
+		YAHOO.util.Event.purgeElement(btn);
+		this.oDomContainer.removeChild(btn);
+	}
+};
+
+/**
+* Renders the calendar header.
+* @method renderHeader
+* @param {Array}	html	The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderHeader = function(html) {
+	var colSpan = 7;
+	
+	var DEPR_NAV_LEFT = "us/tr/callt.gif";
+	var DEPR_NAV_RIGHT = "us/tr/calrt.gif";	
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+	if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
+		colSpan += 1;
+	}
+
+	if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
+		colSpan += 1;
+	}
+
+	html[html.length] = "<thead>";
+	html[html.length] =		"<tr>";
+	html[html.length] =			'<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
+	html[html.length] =				'<div class="' + this.Style.CSS_HEADER + '">';
+
+	var renderLeft, renderRight = false;
+
+	if (this.parent) {
+		if (this.index === 0) {
+			renderLeft = true;
+		}
+		if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
+			renderRight = true;
+		}
+	} else {
+		renderLeft = true;
+		renderRight = true;
+	}
+
+	var cal = this.parent || this;
+	
+	if (renderLeft) {
+		var leftArrow = this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);
+		// Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
+		if (leftArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
+			leftArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_LEFT;
+		}
+		var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
+		html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' >&#160;</a>';
+	}
+	
+	html[html.length] = this.buildMonthLabel();
+	
+	if (renderRight) {
+		var rightArrow = this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);
+		if (rightArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
+			rightArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
+		}
+		var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
+		html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' >&#160;</a>';
+	}
+
+	html[html.length] =	'</div>\n</th>\n</tr>';
+
+	if (this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)) {
+		html = this.buildWeekdays(html);
+	}
+	
+	html[html.length] = '</thead>';
+
+	return html;
+};
+
+/**
+* Renders the Calendar's weekday headers.
+* @method buildWeekdays
+* @param {Array}	html	The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
+
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+
+	html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
+
+	if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
+		html[html.length] = '<th>&#160;</th>';
+	}
+
+	for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i) {
+		html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + '</th>';
+	}
+
+	if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
+		html[html.length] = '<th>&#160;</th>';
+	}
+
+	html[html.length] = '</tr>';
+
+	return html;
+};
+
+/**
+* Renders the calendar body.
+* @method renderBody
+* @param {Date}	workingDate	The current working Date being used for the render process
+* @param {Array}	html	The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+
+	var startDay = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
+
+	this.preMonthDays = workingDate.getDay();
+	if (startDay > 0) {
+		this.preMonthDays -= startDay;
+	}
+	if (this.preMonthDays < 0) {
+		this.preMonthDays += 7;
+	}
+	
+	this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
+	this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+	
+	workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
+
+	var weekNum,weekClass;
+	var weekPrefix = "w";
+	var cellPrefix = "_cell";
+	var workingDayPrefix = "wd";
+	var dayPrefix = "d";
+	
+	var cellRenderers;
+	var renderer;
+	
+	var todayYear = this.today.getFullYear();
+	var todayMonth = this.today.getMonth();
+	var todayDate = this.today.getDate();
+	
+	var useDate = this.cfg.getProperty(defCfg.PAGEDATE.key);
+	var hideBlankWeeks = this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key);
+	var showWeekFooter = this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key);
+	var showWeekHeader = this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key);
+	var mindate = this.cfg.getProperty(defCfg.MINDATE.key);
+	var maxdate = this.cfg.getProperty(defCfg.MAXDATE.key);
+
+	if (mindate) {
+		mindate = YAHOO.widget.DateMath.clearTime(mindate);
+	}
+	if (maxdate) {
+		maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
+	}
+	
+	html[html.length] = '<tbody class="m' + (useDate.getMonth()+1) + ' ' + this.Style.CSS_BODY + '">';
+	
+	var i = 0;
+
+	var tempDiv = document.createElement("div");
+	var cell = document.createElement("td");
+	tempDiv.appendChild(cell);
+
+	var jan1 = new Date(useDate.getFullYear(),0,1);
+
+	var cal = this.parent || this;
+
+	for (var r=0;r<6;r++) {
+
+		weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
+		weekClass = weekPrefix + weekNum;
+
+		// Local OOM check for performance, since we already have pagedate
+		if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
+			break;
+		} else {
+
+			html[html.length] = '<tr class="' + weekClass + '">';
+			
+			if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
+			
+			for (var d=0;d<7;d++){ // Render actual days
+
+				cellRenderers = [];
+				renderer = null;
+
+				this.clearElement(cell);
+				cell.className = this.Style.CSS_CELL;
+				cell.id = this.id + cellPrefix + i;
+
+				if (workingDate.getDate()		== todayDate && 
+					workingDate.getMonth()		== todayMonth &&
+					workingDate.getFullYear()	== todayYear) {
+					cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
+				}
+				
+				var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
+				this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates
+				
+				// Local OOM check for performance, since we already have pagedate
+				if (workingDate.getMonth() != useDate.getMonth()) {
+					cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
+				} else {
+					YAHOO.util.Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
+					YAHOO.util.Dom.addClass(cell, dayPrefix + workingDate.getDate());
+				
+					for (var s=0;s<this.renderStack.length;++s) {
+
+						var rArray = this.renderStack[s];
+						var type = rArray[0];
+						
+						var month;
+						var day;
+						var year;
+						
+						switch (type) {
+							case YAHOO.widget.Calendar.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(s,1);
+								}
+								break;
+							case YAHOO.widget.Calendar.MONTH_DAY:
+								month = rArray[1][0];
+								day = rArray[1][1];
+								
+								if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
+									renderer = rArray[2];
+									this.renderStack.splice(s,1);
+								}
+								break;
+							case YAHOO.widget.Calendar.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(s,1);
+									}
+								}
+								break;
+							case YAHOO.widget.Calendar.WEEKDAY:
+								
+								var weekday = rArray[1][0];
+								if (workingDate.getDay()+1 == weekday) {
+									renderer = rArray[2];
+								}
+								break;
+							case YAHOO.widget.Calendar.MONTH:
+								
+								month = rArray[1][0];
+								if (workingDate.getMonth()+1 == month) {
+									renderer = rArray[2];
+								}
+								break;
+						}
+						
+						if (renderer) {
+							cellRenderers[cellRenderers.length]=renderer;
+						}
+					}
+
+				}
+
+				if (this._indexOfSelectedFieldArray(workingArray) > -1) {
+					cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected; 
+				}
+
+				if ((mindate && (workingDate.getTime() < mindate.getTime())) ||
+					(maxdate && (workingDate.getTime() > maxdate.getTime()))
+				) {
+					cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
+				} else {
+					cellRenderers[cellRenderers.length]=cal.styleCellDefault;
+					cellRenderers[cellRenderers.length]=cal.renderCellDefault;	
+				}
+				
+				for (var x=0; x < cellRenderers.length; ++x) {
+					if (cellRenderers[x].call(cal, workingDate, cell) == YAHOO.widget.Calendar.STOP_RENDER) {
+						break;
+					}
+				}
+
+				workingDate.setTime(workingDate.getTime() + YAHOO.widget.DateMath.ONE_DAY_MS);
+
+				if (i >= 0 && i <= 6) {
+					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
+				}
+				if ((i % 7) === 0) {
+					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
+				}
+				if (((i+1) % 7) === 0) {
+					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
+				}
+				
+				var postDays = this.postMonthDays; 
+				if (hideBlankWeeks && postDays >= 7) {
+					var blankWeeks = Math.floor(postDays/7);
+					for (var p=0;p<blankWeeks;++p) {
+						postDays -= 7;
+					}
+				}
+				
+				if (i >= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+				}
+
+				html[html.length] = tempDiv.innerHTML;
+				i++;
+			}
+
+			if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
+
+			html[html.length] = '</tr>';
+		}
+	}
+
+	html[html.length] = '</tbody>';
+
+	return html;
+};
+
+/**
+* Renders the calendar footer. In the default implementation, there is
+* no footer.
+* @method renderFooter
+* @param {Array}	html	The current working HTML array
+* @return {Array} The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
+
+/**
+* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
+* when the method is called: renderHeader, renderBody, renderFooter.
+* Refer to the documentation for those methods for information on 
+* individual render tasks.
+* @method render
+*/
+YAHOO.widget.Calendar.prototype.render = function() {
+	this.beforeRenderEvent.fire();
+
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+
+	// Find starting day of the current month
+	var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));
+
+	this.resetRenderers();
+	this.cellDates.length = 0;
+
+	YAHOO.util.Event.purgeElement(this.oDomContainer, true);
+
+	var html = [];
+
+	html[html.length] = '<table cellSpacing="0" class="' + this.Style.CSS_CALENDAR + ' y' + workingDate.getFullYear() + '" id="' + this.id + '">';
+	html = this.renderHeader(html);
+	html = this.renderBody(workingDate, html);
+	html = this.renderFooter(html);
+	html[html.length] = '</table>';
+
+	this.oDomContainer.innerHTML = html.join("\n");
+
+	this.applyListeners();
+	this.cells = this.oDomContainer.getElementsByTagName("td");
+
+	this.cfg.refireEvent(defCfg.TITLE.key);
+	this.cfg.refireEvent(defCfg.CLOSE.key);
+	this.cfg.refireEvent(defCfg.IFRAME.key);
+
+	this.renderEvent.fire();
+};
+
+/**
+* Applies the Calendar's DOM listeners to applicable elements.
+* @method applyListeners
+*/
+YAHOO.widget.Calendar.prototype.applyListeners = function() {
+	
+	var root = this.oDomContainer;
+	var cal = this.parent || this;
+	
+	var anchor = "a";
+	var mousedown = "mousedown";
+
+	var linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root);
+	var linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
+
+	if (linkLeft && linkLeft.length > 0) {
+		this.linkLeft = linkLeft[0];
+		YAHOO.util.Event.addListener(this.linkLeft, mousedown, cal.previousMonth, cal, true);
+	}
+
+	if (linkRight && linkRight.length > 0) {
+		this.linkRight = linkRight[0];
+		YAHOO.util.Event.addListener(this.linkRight, mousedown, cal.nextMonth, cal, true);
+	}
+
+	if (this.domEventMap) {
+		var el,elements;
+		for (var cls in this.domEventMap) {	
+			if (YAHOO.lang.hasOwnProperty(this.domEventMap, cls)) {
+				var items = this.domEventMap[cls];
+
+				if (! (items instanceof Array)) {
+					items = [items];
+				}
+
+				for (var i=0;i<items.length;i++)	{
+					var item = items[i];
+					elements = YAHOO.util.Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
+
+					for (var c=0;c<elements.length;c++) {
+						el = elements[c];
+						 YAHOO.util.Event.addListener(el, item.event, item.handler, item.scope, item.correct );
+					}
+				}
+			}
+		}
+	}
+
+	YAHOO.util.Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
+	YAHOO.util.Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
+	YAHOO.util.Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
+};
+
+/**
+* Retrieves the Date object for the specified Calendar cell
+* @method getDateByCellId
+* @param {String}	id	The id of the cell
+* @return {Date} The Date object for the specified Calendar cell
+*/
+YAHOO.widget.Calendar.prototype.getDateByCellId = function(id) {
+	var date = this.getDateFieldsByCellId(id);
+	return new Date(date[0],date[1]-1,date[2]);
+};
+
+/**
+* Retrieves the Date object for the specified Calendar cell
+* @method getDateFieldsByCellId
+* @param {String}	id	The id of the cell
+* @return {Array}	The array of Date fields for the specified Calendar cell
+*/
+YAHOO.widget.Calendar.prototype.getDateFieldsByCellId = function(id) {
+	id = id.toLowerCase().split("_cell")[1];
+	id = parseInt(id, 10);
+	return this.cellDates[id];
+};
+
+// BEGIN BUILT-IN TABLE CELL RENDERERS
+
+/**
+* Renders a cell that falls before the minimum date or after the maximum date.
+* widget class.
+* @method renderOutOfBoundsDate
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+*			should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderOutOfBoundsDate = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);
+	cell.innerHTML = workingDate.getDate();
+	return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+/**
+* Renders the row header for a week.
+* @method renderRowHeader
+* @param {Number}	weekNum	The week number of the current row
+* @param {Array}	cell	The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderRowHeader = function(weekNum, html) {
+	html[html.length] = '<th class="calrowhead">' + weekNum + '</th>';
+	return html;
+};
+
+/**
+* Renders the row footer for a week.
+* @method renderRowFooter
+* @param {Number}	weekNum	The week number of the current row
+* @param {Array}	cell	The current working HTML array
+*/
+YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
+	html[html.length] = '<th class="calrowfoot">' + weekNum + '</th>';
+	return html;
+};
+
+/**
+* Renders a single standard calendar cell in the calendar widget table.
+* All logic for determining how a standard default cell will be rendered is 
+* encapsulated in this method, and must be accounted for when extending the
+* widget class.
+* @method renderCellDefault
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
+	cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
+};
+
+/**
+* Styles a selectable cell.
+* @method styleCellDefault
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
+};
+
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight1 style
+* @method renderCellStyleHighlight1
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight2 style
+* @method renderCellStyleHighlight2
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight3 style
+* @method renderCellStyleHighlight3
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
+};
+
+/**
+* Renders a single standard calendar cell using the CSS hightlight4 style
+* @method renderCellStyleHighlight4
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
+};
+
+/**
+* Applies the default style used for rendering today's date to the current calendar cell
+* @method renderCellStyleToday
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
+};
+
+/**
+* Applies the default style used for rendering selected dates to the current calendar cell
+* @method renderCellStyleSelected
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+*			should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
+};
+
+/**
+* Applies the default style used for rendering dates that are not a part of the current
+* month (preceding or trailing the cells for the current month)
+* @method renderCellNotThisMonth
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+*			should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+	cell.innerHTML=workingDate.getDate();
+	return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+/**
+* Renders the current calendar cell as a non-selectable "black-out" date using the default
+* restricted style.
+* @method renderBodyCellRestricted
+* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+*			should not be terminated
+*/
+YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
+	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+	cell.innerHTML=workingDate.getDate();
+	return YAHOO.widget.Calendar.STOP_RENDER;
+};
+
+// END BUILT-IN TABLE CELL RENDERERS
+
+// BEGIN MONTH NAVIGATION METHODS
+
+/**
+* Adds the designated number of months to the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method addMonths
+* @param {Number}	count	The number of months to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addMonths = function(count) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
+	this.resetRenderers();
+	this.changePageEvent.fire();
+};
+
+/**
+* Subtracts the designated number of months from the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method subtractMonths
+* @param {Number}	count	The number of months to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
+	this.resetRenderers();
+	this.changePageEvent.fire();
+};
+
+/**
+* Adds the designated number of years to the current calendar, and sets the current
+* calendar page date to the new month.
+* @method addYears
+* @param {Number}	count	The number of years to add to the current calendar
+*/
+YAHOO.widget.Calendar.prototype.addYears = function(count) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
+	this.resetRenderers();
+	this.changePageEvent.fire();
+};
+
+/**
+* Subtcats the designated number of years from the current calendar, and sets the current
+* calendar page date to the new month.
+* @method subtractYears
+* @param {Number}	count	The number of years to subtract from the current calendar
+*/
+YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
+	this.resetRenderers();
+	this.changePageEvent.fire();
+};
+
+/**
+* Navigates to the next month page in the calendar widget.
+* @method nextMonth
+*/
+YAHOO.widget.Calendar.prototype.nextMonth = function() {
+	this.addMonths(1);
+};
+
+/**
+* Navigates to the previous month page in the calendar widget.
+* @method previousMonth
+*/
+YAHOO.widget.Calendar.prototype.previousMonth = function() {
+	this.subtractMonths(1);
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.Calendar.prototype.nextYear = function() {
+	this.addYears(1);
+};
+
+/**
+* Navigates to the previous year in the currently selected month in the calendar widget.
+* @method previousYear
+*/
+YAHOO.widget.Calendar.prototype.previousYear = function() {
+	this.subtractYears(1);
+};
+
+// END MONTH NAVIGATION METHODS
+
+// BEGIN SELECTION METHODS
+
+/**
+* Resets the calendar widget to the originally selected month and year, and 
+* sets the calendar to the initial selection(s).
+* @method reset
+*/
+YAHOO.widget.Calendar.prototype.reset = function() {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	this.cfg.resetProperty(defCfg.SELECTED.key);
+	this.cfg.resetProperty(defCfg.PAGEDATE.key);
+	this.resetEvent.fire();
+};
+
+/**
+* Clears the selected dates in the current calendar widget and sets the calendar
+* to the current month and year.
+* @method clear
+*/
+YAHOO.widget.Calendar.prototype.clear = function() {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	this.cfg.setProperty(defCfg.SELECTED.key, []);
+	this.cfg.setProperty(defCfg.PAGEDATE.key, new Date(this.today.getTime()));
+	this.clearEvent.fire();
+};
+
+/**
+* Selects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once selection has completed, render must be 
+* called for the changes to be reflected visually.
+*
+* Any dates which are OOB (out of bounds, not selectable) will not be selected and the array of 
+* selected dates passed to the selectEvent will not contain OOB dates.
+* 
+* If all dates are OOB, the no state change will occur; beforeSelect and select events will not be fired.
+*
+* @method select
+* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
+*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+*								This method can also take a JavaScript Date object or an array of Date objects.
+* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.select = function(date) {
+
+	var aToBeSelected = this._toFieldArray(date);
+
+	// Filtered array of valid dates
+	var validDates = [];
+	var selected = [];
+	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+	
+	for (var a=0; a < aToBeSelected.length; ++a) {
+		var toSelect = aToBeSelected[a];
+
+		if (!this.isDateOOB(this._toDate(toSelect))) {
+			
+			if (validDates.length === 0) {
+				this.beforeSelectEvent.fire();
+				selected = this.cfg.getProperty(cfgSelected);
+			}
+
+			validDates.push(toSelect);
+			
+			if (this._indexOfSelectedFieldArray(toSelect) == -1) { 
+				selected[selected.length] = toSelect;
+			}
+		}
+	}
+	
+
+	if (validDates.length > 0) {
+		if (this.parent) {
+			this.parent.cfg.setProperty(cfgSelected, selected);
+		} else {
+			this.cfg.setProperty(cfgSelected, selected);
+		}
+		this.selectEvent.fire(validDates);
+	}
+
+	return this.getSelectedDates();
+};
+
+/**
+* Selects a date on the current calendar by referencing the index of the cell that should be selected.
+* This method is used to easily select a single cell (usually with a mouse click) without having to do
+* a full render. The selected style is applied to the cell directly.
+*
+* If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month 
+* or out of bounds cells), it will not be selected and in such a case beforeSelect and select events will not be fired.
+* 
+* @method selectCell
+* @param	{Number}	cellIndex	The index of the cell to select in the current calendar. 
+* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.selectCell = function(cellIndex) {
+
+	var cell = this.cells[cellIndex];
+	var cellDate = this.cellDates[cellIndex];
+	var dCellDate = this._toDate(cellDate);
+	
+	var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+
+	if (selectable) {
+
+		this.beforeSelectEvent.fire();
+
+		var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+		var selected = this.cfg.getProperty(cfgSelected);
+
+		var selectDate = cellDate.concat();
+
+		if (this._indexOfSelectedFieldArray(selectDate) == -1) {
+			selected[selected.length] = selectDate;
+		}
+		if (this.parent) {
+			this.parent.cfg.setProperty(cfgSelected, selected);
+		} else {
+			this.cfg.setProperty(cfgSelected, selected);
+		}
+		this.renderCellStyleSelected(dCellDate,cell);
+		this.selectEvent.fire([selectDate]);
+
+		this.doCellMouseOut.call(cell, null, this);		
+	}
+
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once deselection has completed, render must be 
+* called for the changes to be reflected visually.
+* 
+* The method will not attempt to deselect any dates which are OOB (out of bounds, and hence not selectable) 
+* and the array of deselected dates passed to the deselectEvent will not contain any OOB dates.
+* 
+* If all dates are OOB, beforeDeselect and deselect events will not be fired.
+* 
+* @method deselect
+* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+*								This method can also take a JavaScript Date object or an array of Date objects.	
+* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.deselect = function(date) {
+
+	var aToBeDeselected = this._toFieldArray(date);
+
+	var validDates = [];
+	var selected = [];
+	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+
+	for (var a=0; a < aToBeDeselected.length; ++a) {
+		var toDeselect = aToBeDeselected[a];
+
+		if (!this.isDateOOB(this._toDate(toDeselect))) {
+
+			if (validDates.length === 0) {
+				this.beforeDeselectEvent.fire();
+				selected = this.cfg.getProperty(cfgSelected);
+			}
+
+			validDates.push(toDeselect);
+
+			var index = this._indexOfSelectedFieldArray(toDeselect);
+			if (index != -1) {	
+				selected.splice(index,1);
+			}
+		}
+	}
+
+
+	if (validDates.length > 0) {
+		if (this.parent) {
+			this.parent.cfg.setProperty(cfgSelected, selected);
+		} else {
+			this.cfg.setProperty(cfgSelected, selected);
+		}
+		this.deselectEvent.fire(validDates);
+	}
+
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
+* This method is used to easily deselect a single cell (usually with a mouse click) without having to do
+* a full render. The selected style is removed from the cell directly.
+* 
+* If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month 
+* or out of bounds cells), the method will not attempt to deselect it and in such a case, beforeDeselect and 
+* deselect events will not be fired.
+* 
+* @method deselectCell
+* @param	{Number}	cellIndex	The index of the cell to deselect in the current calendar. 
+* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.Calendar.prototype.deselectCell = function(cellIndex) {
+	var cell = this.cells[cellIndex];
+	var cellDate = this.cellDates[cellIndex];
+	var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
+	
+	var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+
+	if (selectable) {
+
+		this.beforeDeselectEvent.fire();
+
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		var selected = this.cfg.getProperty(defCfg.SELECTED.key);
+
+		var dCellDate = this._toDate(cellDate);
+		var selectDate = cellDate.concat();
+
+		if (cellDateIndex > -1) {
+			if (this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
+				this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
+				YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+			}
+			selected.splice(cellDateIndex, 1);
+		}
+
+		if (this.parent) {
+			this.parent.cfg.setProperty(defCfg.SELECTED.key, selected);
+		} else {
+			this.cfg.setProperty(defCfg.SELECTED.key, selected);
+		}
+
+		this.deselectEvent.fire(selectDate);
+	}
+
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects all dates on the current calendar.
+* @method deselectAll
+* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
+*						Assuming that this function executes properly, the return value should be an empty array.
+*						However, the empty array is returned for the sake of being able to check the selection status
+*						of the calendar.
+*/
+YAHOO.widget.Calendar.prototype.deselectAll = function() {
+	this.beforeDeselectEvent.fire();
+	
+	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+
+	var selected = this.cfg.getProperty(cfgSelected);
+	var count = selected.length;
+	var sel = selected.concat();
+
+	if (this.parent) {
+		this.parent.cfg.setProperty(cfgSelected, []);
+	} else {
+		this.cfg.setProperty(cfgSelected, []);
+	}
+	
+	if (count > 0) {
+		this.deselectEvent.fire(sel);
+	}
+
+	return this.getSelectedDates();
+};
+
+// END SELECTION METHODS
+
+// BEGIN TYPE CONVERSION METHODS
+
+/**
+* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
+* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
+* @method _toFieldArray
+* @private
+* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+*								This method can also take a JavaScript Date object or an array of Date objects.	
+* @return {Array[](Number[])}	Array of date field arrays
+*/
+YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
+	var returnDate = [];
+
+	if (date instanceof Date) {
+		returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+	} else if (YAHOO.lang.isString(date)) {
+		returnDate = this._parseDates(date);
+	} else if (YAHOO.lang.isArray(date)) {
+		for (var i=0;i<date.length;++i) {
+			var d = date[i];
+			returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];
+		}
+	}
+	
+	return returnDate;
+};
+
+/**
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
+* @method _toDate
+* @private
+* @param	{Number[]}		dateFieldArray	The date field array to convert to a JavaScript Date.
+* @return	{Date}	JavaScript Date object representing the date field array
+*/
+YAHOO.widget.Calendar.prototype._toDate = function(dateFieldArray) {
+	if (dateFieldArray instanceof Date) {
+		return dateFieldArray;
+	} else {
+		return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);
+	}
+};
+
+// END TYPE CONVERSION METHODS 
+
+// BEGIN UTILITY METHODS
+
+/**
+* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
+* @method _fieldArraysAreEqual
+* @private
+* @param	{Number[]}	array1	The first date field array to compare
+* @param	{Number[]}	array2	The first date field array to compare
+* @return	{Boolean}	The boolean that represents the equality of the two arrays
+*/
+YAHOO.widget.Calendar.prototype._fieldArraysAreEqual = function(array1, array2) {
+	var match = false;
+
+	if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {
+		match=true;	
+	}
+
+	return match;
+};
+
+/**
+* Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
+* @method	_indexOfSelectedFieldArray
+* @private
+* @param	{Number[]}		find	The date field array to search for
+* @return	{Number}			The index of the date field array within the collection of selected dates.
+*								-1 will be returned if the date is not found.
+*/
+YAHOO.widget.Calendar.prototype._indexOfSelectedFieldArray = function(find) {
+	var selected = -1;
+	var seldates = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
+
+	for (var s=0;s<seldates.length;++s) {
+		var sArray = seldates[s];
+		if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {
+			selected = s;
+			break;
+		}
+	}
+
+	return selected;
+};
+
+/**
+* Determines whether a given date is OOM (out of month).
+* @method	isDateOOM
+* @param	{Date}	date	The JavaScript Date object for which to check the OOM status
+* @return	{Boolean}	true if the date is OOM
+*/
+YAHOO.widget.Calendar.prototype.isDateOOM = function(date) {
+	return (date.getMonth() != this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
+};
+
+/**
+* Determines whether a given date is OOB (out of bounds - less than the mindate or more than the maxdate).
+*
+* @method	isDateOOB
+* @param	{Date}	date	The JavaScript Date object for which to check the OOB status
+* @return	{Boolean}	true if the date is OOB
+*/
+YAHOO.widget.Calendar.prototype.isDateOOB = function(date) {
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+	var minDate = this.cfg.getProperty(defCfg.MINDATE.key);
+	var maxDate = this.cfg.getProperty(defCfg.MAXDATE.key);
+	var dm = YAHOO.widget.DateMath;
+	
+	if (minDate) {
+		minDate = dm.clearTime(minDate);
+	} 
+	if (maxDate) {
+		maxDate = dm.clearTime(maxDate);
+	}
+
+	var clearedDate = new Date(date.getTime());
+	clearedDate = dm.clearTime(clearedDate);
+
+	return ((minDate && clearedDate.getTime() < minDate.getTime()) || (maxDate && clearedDate.getTime() > maxDate.getTime()));
+};
+
+/**
+ * Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object 
+ * and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object 
+ * @method	_parsePageDate
+ * @private
+ * @param {Date|String}	date	Pagedate value which needs to be parsed
+ * @return {Date}	The Date object representing the pagedate
+ */
+YAHOO.widget.Calendar.prototype._parsePageDate = function(date) {
+	var parsedDate;
+	
+	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+
+	if (date) {
+		if (date instanceof Date) {
+			parsedDate = YAHOO.widget.DateMath.findMonthStart(date);
+		} else {
+			var month, year, aMonthYear;
+			aMonthYear = date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));
+			month = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key)-1], 10)-1;
+			year = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key)-1], 10);
+			
+			parsedDate = new Date(year, month, 1);
+		}
+	} else {
+		parsedDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1);
+	}
+	return parsedDate;
+};
+
+// END UTILITY METHODS
+
+// BEGIN EVENT HANDLERS
+
+/**
+* Event executed before a date is selected in the calendar widget.
+* @deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.
+*/
+YAHOO.widget.Calendar.prototype.onBeforeSelect = function() {
+	if (this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key) === false) {
+		if (this.parent) {
+			this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
+			this.parent.deselectAll();
+		} else {
+			this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
+			this.deselectAll();
+		}
+	}
+};
+
+/**
+* Event executed when a date is selected in the calendar widget.
+* @param	{Array}	selected	An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
+* @deprecated Event handlers for this event should be susbcribed to selectEvent.
+*/
+YAHOO.widget.Calendar.prototype.onSelect = function(selected) { };
+
+/**
+* Event executed before a date is deselected in the calendar widget.
+* @deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.
+*/
+YAHOO.widget.Calendar.prototype.onBeforeDeselect = function() { };
+
+/**
+* Event executed when a date is deselected in the calendar widget.
+* @param	{Array}	selected	An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
+* @deprecated Event handlers for this event should be susbcribed to deselectEvent.
+*/
+YAHOO.widget.Calendar.prototype.onDeselect = function(deselected) { };
+
+/**
+* Event executed when the user navigates to a different calendar page.
+* @deprecated Event handlers for this event should be susbcribed to changePageEvent.
+*/
+YAHOO.widget.Calendar.prototype.onChangePage = function() {
+	this.render();
+};
+
+/**
+* Event executed when the calendar widget is rendered.
+* @deprecated Event handlers for this event should be susbcribed to renderEvent.
+*/
+YAHOO.widget.Calendar.prototype.onRender = function() { };
+
+/**
+* Event executed when the calendar widget is reset to its original state.
+* @deprecated Event handlers for this event should be susbcribed to resetEvemt.
+*/
+YAHOO.widget.Calendar.prototype.onReset = function() { this.render(); };
+
+/**
+* Event executed when the calendar widget is completely cleared to the current month with no selections.
+* @deprecated Event handlers for this event should be susbcribed to clearEvent.
+*/
+YAHOO.widget.Calendar.prototype.onClear = function() { this.render(); };
+
+/**
+* Validates the calendar widget. This method has no default implementation
+* and must be extended by subclassing the widget.
+* @return	Should return true if the widget validates, and false if
+* it doesn't.
+* @type Boolean
+*/
+YAHOO.widget.Calendar.prototype.validate = function() { return true; };
+
+// END EVENT HANDLERS
+
+// BEGIN DATE PARSE METHODS
+
+/**
+* Converts a date string to a date field array
+* @private
+* @param	{String}	sDate			Date string. Valid formats are mm/dd and mm/dd/yyyy.
+* @return				A date field array representing the string passed to the method
+* @type Array[](Number[])
+*/
+YAHOO.widget.Calendar.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.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.DATE;
+	}
+
+	for (var i=0;i<rArray.length;i++) {
+		rArray[i] = parseInt(rArray[i], 10);
+	}
+
+	return rArray;
+};
+
+/**
+* Converts a multi or single-date string to an array of date field arrays
+* @private
+* @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
+* @return							An array of date field arrays
+* @type Array[](Number[])
+*/
+YAHOO.widget.Calendar.prototype._parseDates = function(sDates) {
+	var aReturn = [];
+
+	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) {
+			// This is a range
+			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 {
+			// This is not a range
+			var aDate = this._parseDate(sDate);
+			aReturn.push(aDate);
+		}
+	}
+	return aReturn;
+};
+
+/**
+* Converts a date range to the full list of included dates
+* @private
+* @param	{Number[]}	startDate	Date field array representing the first date in the range
+* @param	{Number[]}	endDate		Date field array representing the last date in the range
+* @return							An array of date field arrays
+* @type Array[](Number[])
+*/
+YAHOO.widget.Calendar.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 = [];
+	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);
+	}
+	return results;
+};
+
+// END DATE PARSE METHODS
+
+// BEGIN RENDERER METHODS
+
+/**
+* Resets the render stack of the current calendar to its original pre-render value.
+*/
+YAHOO.widget.Calendar.prototype.resetRenderers = function() {
+	this.renderStack = this._renderStack.concat();
+};
+
+/**
+* Clears the inner HTML, CSS class and style information from the specified cell.
+* @method clearElement
+* @param	{HTMLTableCellElement}	The cell to clear
+*/ 
+YAHOO.widget.Calendar.prototype.clearElement = function(cell) {
+	cell.innerHTML = "&#160;";
+	cell.className="";
+};
+
+/**
+* Adds a renderer to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the conditions specified in the date string for this renderer.
+* @method addRenderer
+* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
+*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.Calendar.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) { // this is either a range or a month/day combo
+			if (aDate[0] instanceof Array) { // this is a range
+				this._addRenderer(YAHOO.widget.Calendar.RANGE,aDate,fnRender);
+			} else { // this is a month/day combo
+				this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,aDate,fnRender);
+			}
+		} else if (aDate.length == 3) {
+			this._addRenderer(YAHOO.widget.Calendar.DATE,aDate,fnRender);
+		}
+	}
+};
+
+/**
+* The private method used for adding cell renderers to the local render stack.
+* This method is called by other methods that set the renderer type prior to the method call.
+* @method _addRenderer
+* @private
+* @param	{String}	type		The type string that indicates the type of date renderer being added.
+*									Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY,
+*									YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
+* @param	{Array}		aDates		An array of dates used to construct the renderer. The format varies based
+*									on the renderer type
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.Calendar.prototype._addRenderer = function(type, aDates, fnRender) {
+	var add = [type,aDates,fnRender];
+	this.renderStack.unshift(add);	
+	this._renderStack = this.renderStack.concat();
+};
+
+/**
+* Adds a month to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the month passed to this method.
+* @method addMonthRenderer
+* @param	{Number}	month		The month (1-12) to associate with this renderer
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.Calendar.prototype.addMonthRenderer = function(month, fnRender) {
+	this._addRenderer(YAHOO.widget.Calendar.MONTH,[month],fnRender);
+};
+
+/**
+* Adds a weekday to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the weekday passed to this method.
+* @method addWeekdayRenderer
+* @param	{Number}	weekday		The weekday (0-6) to associate with this renderer
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.Calendar.prototype.addWeekdayRenderer = function(weekday, fnRender) {
+	this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[weekday],fnRender);
+};
+
+// END RENDERER METHODS
+
+// BEGIN CSS METHODS
+
+/**
+* Removes all styles from all body cells in the current calendar table.
+* @method clearAllBodyCellStyles
+* @param	{style}		The CSS class name to remove from all calendar body cells
+*/
+YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles = function(style) {
+	for (var c=0;c<this.cells.length;++c) {
+		YAHOO.util.Dom.removeClass(this.cells[c],style);
+	}
+};
+
+// END CSS METHODS
+
+// BEGIN GETTER/SETTER METHODS
+/**
+* Sets the calendar's month explicitly
+* @method setMonth
+* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
+*/
+YAHOO.widget.Calendar.prototype.setMonth = function(month) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	var current = this.cfg.getProperty(cfgPageDate);
+	current.setMonth(parseInt(month, 10));
+	this.cfg.setProperty(cfgPageDate, current);
+};
+
+/**
+* Sets the calendar's year explicitly.
+* @method setYear
+* @param {Number}	year		The numeric 4-digit year
+*/
+YAHOO.widget.Calendar.prototype.setYear = function(year) {
+	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+	var current = this.cfg.getProperty(cfgPageDate);
+	current.setFullYear(parseInt(year, 10));
+	this.cfg.setProperty(cfgPageDate, current);
+};
+
+/**
+* Gets the list of currently selected dates from the calendar.
+* @method getSelectedDates
+* @return {Date[]} An array of currently selected JavaScript Date objects.
+*/
+YAHOO.widget.Calendar.prototype.getSelectedDates = function() {
+	var returnDates = [];
+	var selected = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
+
+	for (var d=0;d<selected.length;++d) {
+		var dateArray = selected[d];
+
+		var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
+		returnDates.push(date);
+	}
+
+	returnDates.sort( function(a,b) { return a-b; } );
+	return returnDates;
+};
+
+/// END GETTER/SETTER METHODS ///
+
+/**
+* Hides the Calendar's outer container from view.
+* @method hide
+*/
+YAHOO.widget.Calendar.prototype.hide = function() {
+	this.oDomContainer.style.display = "none";
+};
+
+/**
+* Shows the Calendar's outer container.
+* @method show
+*/
+YAHOO.widget.Calendar.prototype.show = function() {
+	this.oDomContainer.style.display = "block";
+};
+
+/**
+* Returns a string representing the current browser.
+* @deprecated As of 2.3.0, environment information is available in YAHOO.env.ua
+* @see YAHOO.env.ua
+* @property browser
+* @type String
+*/
+YAHOO.widget.Calendar.prototype.browser = function() {
+			var ua = navigator.userAgent.toLowerCase();
+				  if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+					 return 'opera';
+				  } else if (ua.indexOf('msie 7')!=-1) { // IE7
+					 return 'ie7';
+				  } else if (ua.indexOf('msie') !=-1) { // IE
+					 return 'ie';
+				  } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+					 return 'safari';
+				  } else if (ua.indexOf('gecko') != -1) { // Gecko
+					 return 'gecko';
+				  } else {
+					 return false;
+				  }
+			}();
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String}	A string representation of the Calendar object.
+*/
+YAHOO.widget.Calendar.prototype.toString = function() {
+	return "Calendar " + this.id;
+};
+
+/**
+* @namespace YAHOO.widget
+* @class Calendar_Core
+* @extends YAHOO.widget.Calendar
+* @deprecated The old Calendar_Core class is no longer necessary.
+*/
+YAHOO.widget.Calendar_Core = YAHOO.widget.Calendar;
+
+YAHOO.widget.Cal_Core = YAHOO.widget.Calendar;
+
+/**
+* YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar. This class facilitates
+* the ability to have multi-page calendar views that share a single dataset and are
+* dependent on each other.
+* 
+* The calendar group instance will refer to each of its elements using a 0-based index.
+* For example, to construct the placeholder for a calendar group widget with id "cal1" and
+* containerId of "cal1Container", the markup would be as follows:
+*	<xmp>
+*		<div id="cal1Container_0"></div>
+*		<div id="cal1Container_1"></div>
+*	</xmp>
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+* @namespace YAHOO.widget
+* @class CalendarGroup
+* @constructor
+* @param {String}	id			The id of the table element that will represent the calendar widget
+* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+* @param {Object}	config		The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup = function(id, containerId, config) {
+	if (arguments.length > 0) {
+		this.init(id, containerId, config);
+	}
+};
+
+/**
+* Initializes the calendar group. All subclasses must call this method in order for the
+* group to be initialized properly.
+* @method init
+* @param {String}	id			The id of the table element that will represent the calendar widget
+* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+* @param {Object}	config		The configuration object containing the Calendar's arguments
+*/
+YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
+	this.initEvents();
+	this.initStyles();
+
+	/**
+	* The collection of Calendar pages contained within the CalendarGroup
+	* @property pages
+	* @type YAHOO.widget.Calendar[]
+	*/
+	this.pages = [];
+	
+	/**
+	* The unique id associated with the CalendarGroup
+	* @property id
+	* @type String
+	*/
+	this.id = id;
+
+	/**
+	* The unique id associated with the CalendarGroup container
+	* @property containerId
+	* @type String
+	*/
+	this.containerId = containerId;
+
+	/**
+	* The outer containing element for the CalendarGroup
+	* @property oDomContainer
+	* @type HTMLElement
+	*/
+	this.oDomContainer = document.getElementById(containerId);
+
+	YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
+	YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
+
+	/**
+	* The Config object used to hold the configuration variables for the CalendarGroup
+	* @property cfg
+	* @type YAHOO.util.Config
+	*/
+	this.cfg = new YAHOO.util.Config(this);
+
+	/**
+	* The local object which contains the CalendarGroup's options
+	* @property Options
+	* @type Object
+	*/
+	this.Options = {};
+
+	/**
+	* The local object which contains the CalendarGroup's locale settings
+	* @property Locale
+	* @type Object
+	*/
+	this.Locale = {};
+
+	this.setupConfig();
+
+	if (config) {
+		this.cfg.applyConfig(config, true);
+	}
+
+	this.cfg.fireQueue();
+
+	// OPERA HACK FOR MISWRAPPED FLOATS
+	if (YAHOO.env.ua.opera){
+		this.renderEvent.subscribe(this._fixWidth, this, true);
+	}
+};
+
+
+YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
+	
+	var defCfg = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;
+	
+	/**
+	* The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
+	* @config pages
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.PAGES.key, { value:defCfg.PAGES.value, validator:this.cfg.checkNumber, handler:this.configPages } );
+
+	/**
+	* The month/year representing the current visible Calendar date (mm/yyyy)
+	* @config pagedate
+	* @type String
+	* @default today's date
+	*/
+	this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
+
+	/**
+	* The date or range of dates representing the current Calendar selection
+	* @config selected
+	* @type String
+	* @default []
+	*/
+	this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
+
+	/**
+	* The title to display above the CalendarGroup's month header
+	* @config title
+	* @type String
+	* @default ""
+	*/
+	this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
+
+	/**
+	* Whether or not a close button should be displayed for this CalendarGroup
+	* @config close
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
+
+	/**
+	* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+	* This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be 
+	* enabled if required.
+	* 
+	* @config iframe
+	* @type Boolean
+	* @default true for IE6 and below, false for all other browsers
+	*/
+	this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
+
+	/**
+	* The minimum selectable date in the current Calendar (mm/dd/yyyy)
+	* @config mindate
+	* @type String
+	* @default null
+	*/
+	this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.delegateConfig } );
+
+	/**
+	* The maximum selectable date in the current Calendar (mm/dd/yyyy)
+	* @config maxdate
+	* @type String
+	* @default null
+	*/	
+	this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.delegateConfig  } );
+
+	// Options properties
+
+	/**
+	* True if the Calendar should allow multiple selections. False by default.
+	* @config MULTI_SELECT
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+
+	/**
+	* The weekday the week begins on. Default is 0 (Sunday).
+	* @config START_WEEKDAY
+	* @type number
+	* @default 0
+	*/	
+	this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.delegateConfig, validator:this.cfg.checkNumber  } );
+	
+	/**
+	* True if the Calendar should show weekday labels. True by default.
+	* @config SHOW_WEEKDAYS
+	* @type Boolean
+	* @default true
+	*/	
+	this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	
+	/**
+	* True if the Calendar should show week row headers. False by default.
+	* @config SHOW_WEEK_HEADER
+	* @type Boolean
+	* @default false
+	*/	
+	this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{ value:defCfg.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	
+	/**
+	* True if the Calendar should show week row footers. False by default.
+	* @config SHOW_WEEK_FOOTER
+	* @type Boolean
+	* @default false
+	*/
+	this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	
+	/**
+	* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+	* @config HIDE_BLANK_WEEKS
+	* @type Boolean
+	* @default false
+	*/		
+	this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{ value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	
+	/**
+	* The image that should be used for the left navigation arrow.
+	* @config NAV_ARROW_LEFT
+	* @type String
+	* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
+	* @default null
+	*/		
+	this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.delegateConfig } );
+	
+	/**
+	* The image that should be used for the right navigation arrow.
+	* @config NAV_ARROW_RIGHT
+	* @type String
+	* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
+	* @default null
+	*/		
+	this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,	{ value:defCfg.NAV_ARROW_RIGHT.value, handler:this.delegateConfig } );
+
+	// Locale properties
+	
+	/**
+	* The short month labels for the current locale.
+	* @config MONTHS_SHORT
+	* @type String[]
+	* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+	*/
+	this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.delegateConfig } );
+	
+	/**
+	* The long month labels for the current locale.
+	* @config MONTHS_LONG
+	* @type String[]
+	* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+	*/		
+	this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.delegateConfig } );
+	
+	/**
+	* The 1-character weekday labels for the current locale.
+	* @config WEEKDAYS_1CHAR
+	* @type String[]
+	* @default ["S", "M", "T", "W", "T", "F", "S"]
+	*/		
+	this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.delegateConfig } );
+	
+	/**
+	* The short weekday labels for the current locale.
+	* @config WEEKDAYS_SHORT
+	* @type String[]
+	* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+	*/		
+	this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.delegateConfig } );
+	
+	/**
+	* The medium weekday labels for the current locale.
+	* @config WEEKDAYS_MEDIUM
+	* @type String[]
+	* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+	*/		
+	this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.delegateConfig } );
+	
+	/**
+	* The long weekday labels for the current locale.
+	* @config WEEKDAYS_LONG
+	* @type String[]
+	* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+	*/		
+	this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.delegateConfig } );
+
+	/**
+	* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+	* @config LOCALE_MONTHS
+	* @type String
+	* @default "long"
+	*/
+	this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.delegateConfig } );
+
+	/**
+	* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+	* @config LOCALE_WEEKDAYS
+	* @type String
+	* @default "short"
+	*/	
+	this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.delegateConfig } );
+
+	/**
+	* The value used to delimit individual dates in a date string passed to various Calendar functions.
+	* @config DATE_DELIMITER
+	* @type String
+	* @default ","
+	*/
+	this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.delegateConfig } );
+
+	/**
+	* The value used to delimit date fields in a date string passed to various Calendar functions.
+	* @config DATE_FIELD_DELIMITER
+	* @type String
+	* @default "/"
+	*/	
+	this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{ value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.delegateConfig } );
+
+	/**
+	* The value used to delimit date ranges in a date string passed to various Calendar functions.
+	* @config DATE_RANGE_DELIMITER
+	* @type String
+	* @default "-"
+	*/
+	this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{ value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.delegateConfig } );
+
+	/**
+	* The position of the month in a month/year date string
+	* @config MY_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the year in a month/year date string
+	* @config MY_YEAR_POSITION
+	* @type Number
+	* @default 2
+	*/	
+	this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the month in a month/day date string
+	* @config MD_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/	
+	this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the day in a month/year date string
+	* @config MD_DAY_POSITION
+	* @type Number
+	* @default 2
+	*/	
+	this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the month in a month/day/year date string
+	* @config MDY_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/	
+	this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the day in a month/day/year date string
+	* @config MDY_DAY_POSITION
+	* @type Number
+	* @default 2
+	*/	
+	this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The position of the year in a month/day/year date string
+	* @config MDY_YEAR_POSITION
+	* @type Number
+	* @default 3
+	*/	
+	this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the month in the month year label string used as the Calendar header
+	* @config MY_LABEL_MONTH_POSITION
+	* @type Number
+	* @default 1
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+
+	/**
+	* The position of the year in the month year label string used as the Calendar header
+	* @config MY_LABEL_YEAR_POSITION
+	* @type Number
+	* @default 2
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+	/**
+	* The suffix used after the month when rendering the Calendar header
+	* @config MY_LABEL_MONTH_SUFFIX
+	* @type String
+	* @default " "
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.delegateConfig } );
+	
+	/**
+	* The suffix used after the year when rendering the Calendar header
+	* @config MY_LABEL_YEAR_SUFFIX
+	* @type String
+	* @default ""
+	*/
+	this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
+};
+
+/**
+* Initializes CalendarGroup's built-in CustomEvents
+* @method initEvents
+*/
+YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
+	var me = this;
+	var strEvent = "Event";
+
+	/**
+	* Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
+	* @method sub
+	* @private
+	* @param {Function} fn	The function to subscribe to this CustomEvent
+	* @param {Object}	obj	The CustomEvent's scope object
+	* @param {Boolean}	bOverride	Whether or not to apply scope correction
+	*/
+	var sub = function(fn, obj, bOverride) {
+		for (var p=0;p<me.pages.length;++p) {
+			var cal = me.pages[p];
+			cal[this.type + strEvent].subscribe(fn, obj, bOverride);
+		}
+	};
+
+	/**
+	* Proxy unsubscriber to unsubscribe from the CalendarGroup's child Calendars' CustomEvents
+	* @method unsub
+	* @private
+	* @param {Function} fn	The function to subscribe to this CustomEvent
+	* @param {Object}	obj	The CustomEvent's scope object
+	*/
+	var unsub = function(fn, obj) {
+		for (var p=0;p<me.pages.length;++p) {
+			var cal = me.pages[p];
+			cal[this.type + strEvent].unsubscribe(fn, obj);
+		}
+	};
+	
+	var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+
+	/**
+	* Fired before a selection is made
+	* @event beforeSelectEvent
+	*/
+	this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
+	this.beforeSelectEvent.subscribe = sub; this.beforeSelectEvent.unsubscribe = unsub;
+
+	/**
+	* Fired when a selection is made
+	* @event selectEvent
+	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	*/
+	this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT); 
+	this.selectEvent.subscribe = sub; this.selectEvent.unsubscribe = unsub;
+
+	/**
+	* Fired before a selection is made
+	* @event beforeDeselectEvent
+	*/
+	this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT); 
+	this.beforeDeselectEvent.subscribe = sub; this.beforeDeselectEvent.unsubscribe = unsub;
+
+	/**
+	* Fired when a selection is made
+	* @event deselectEvent
+	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	*/
+	this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT); 
+	this.deselectEvent.subscribe = sub; this.deselectEvent.unsubscribe = unsub;
+	
+	/**
+	* Fired when the Calendar page is changed
+	* @event changePageEvent
+	*/
+	this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE); 
+	this.changePageEvent.subscribe = sub; this.changePageEvent.unsubscribe = unsub;
+
+	/**
+	* Fired before the Calendar is rendered
+	* @event beforeRenderEvent
+	*/
+	this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
+	this.beforeRenderEvent.subscribe = sub; this.beforeRenderEvent.unsubscribe = unsub;
+
+	/**
+	* Fired when the Calendar is rendered
+	* @event renderEvent
+	*/
+	this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
+	this.renderEvent.subscribe = sub; this.renderEvent.unsubscribe = unsub;
+
+	/**
+	* Fired when the Calendar is reset
+	* @event resetEvent
+	*/
+	this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET); 
+	this.resetEvent.subscribe = sub; this.resetEvent.unsubscribe = unsub;
+
+	/**
+	* Fired when the Calendar is cleared
+	* @event clearEvent
+	*/
+	this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
+	this.clearEvent.subscribe = sub; this.clearEvent.unsubscribe = unsub;
+
+};
+
+/**
+* The default Config handler for the "pages" property
+* @method configPages
+* @param {String} type	The CustomEvent type (usually the property name)
+* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.CalendarGroup.prototype.configPages = function(type, args, obj) {
+	var pageCount = args[0];
+
+	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+
+	// Define literals outside loop	
+	var sep = "_";
+	var groupCalClass = "groupcal";
+
+	var firstClass = "first-of-type";
+	var lastClass = "last-of-type";
+
+	for (var p=0;p<pageCount;++p) {
+		var calId = this.id + sep + p;
+		var calContainerId = this.containerId + sep + p;
+
+		var childConfig = this.cfg.getConfig();
+		childConfig.close = false;
+		childConfig.title = false;
+
+		var cal = this.constructChild(calId, calContainerId, childConfig);
+		var caldate = cal.cfg.getProperty(cfgPageDate);
+		this._setMonthOnDate(caldate, caldate.getMonth() + p);
+		cal.cfg.setProperty(cfgPageDate, caldate);
+
+		YAHOO.util.Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
+		YAHOO.util.Dom.addClass(cal.oDomContainer, groupCalClass);
+
+		if (p===0) {
+			YAHOO.util.Dom.addClass(cal.oDomContainer, firstClass);
+		}
+
+		if (p==(pageCount-1)) {
+			YAHOO.util.Dom.addClass(cal.oDomContainer, lastClass);
+		}
+
+		cal.parent = this;
+		cal.index = p; 
+
+		this.pages[this.pages.length] = cal;
+	}
+};
+
+/**
+* The default Config handler for the "pagedate" property
+* @method configPageDate
+* @param {String} type	The CustomEvent type (usually the property name)
+* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.CalendarGroup.prototype.configPageDate = function(type, args, obj) {
+	var val = args[0];
+	var firstPageDate;
+	
+	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+	
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		if (p === 0) {
+			firstPageDate = cal._parsePageDate(val);
+			cal.cfg.setProperty(cfgPageDate, firstPageDate);
+		} else {
+			var pageDate = new Date(firstPageDate);
+			this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
+			cal.cfg.setProperty(cfgPageDate, pageDate);
+		}
+	}
+};
+
+/**
+* The default Config handler for the CalendarGroup "selected" property
+* @method configSelected
+* @param {String} type	The CustomEvent type (usually the property name)
+* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.CalendarGroup.prototype.configSelected = function(type, args, obj) {
+	var cfgSelected = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;
+	this.delegateConfig(type, args, obj);
+	var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : []; 
+	this.cfg.setProperty(cfgSelected, selected, true);
+};
+
+
+/**
+* Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
+* @method delegateConfig
+* @param {String} type	The CustomEvent type (usually the property name)
+* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+*/
+YAHOO.widget.CalendarGroup.prototype.delegateConfig = function(type, args, obj) {
+	var val = args[0];
+	var cal;
+
+	for (var p=0;p<this.pages.length;p++) {
+		cal = this.pages[p];
+		cal.cfg.setProperty(type, val);
+	}
+};
+
+
+/**
+* Adds a function to all child Calendars within this CalendarGroup.
+* @method setChildFunction
+* @param {String}		fnName		The name of the function
+* @param {Function}		fn			The function to apply to each Calendar page object
+*/
+YAHOO.widget.CalendarGroup.prototype.setChildFunction = function(fnName, fn) {
+	var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
+
+	for (var p=0;p<pageCount;++p) {
+		this.pages[p][fnName] = fn;
+	}
+};
+
+/**
+* Calls a function within all child Calendars within this CalendarGroup.
+* @method callChildFunction
+* @param {String}		fnName		The name of the function
+* @param {Array}		args		The arguments to pass to the function
+*/
+YAHOO.widget.CalendarGroup.prototype.callChildFunction = function(fnName, args) {
+	var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
+
+	for (var p=0;p<pageCount;++p) {
+		var page = this.pages[p];
+		if (page[fnName]) {
+			var fn = page[fnName];
+			fn.call(page, args);
+		}
+	}	
+};
+
+/**
+* Constructs a child calendar. This method can be overridden if a subclassed version of the default
+* calendar is to be used.
+* @method constructChild
+* @param {String}	id			The id of the table element that will represent the calendar widget
+* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+* @param {Object}	config		The configuration object containing the Calendar's arguments
+* @return {YAHOO.widget.Calendar}	The YAHOO.widget.Calendar instance that is constructed
+*/
+YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,config) {
+	var container = document.getElementById(containerId);
+	if (! container) {
+		container = document.createElement("div");
+		container.id = containerId;
+		this.oDomContainer.appendChild(container);
+	}
+	return new YAHOO.widget.Calendar(id,containerId,config);
+};
+
+
+/**
+* Sets the calendar group's month explicitly. This month will be set into the first
+* page of the multi-page calendar, and all other months will be iterated appropriately.
+* @method setMonth
+* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
+*/
+YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) {
+	month = parseInt(month, 10);
+	var currYear;
+	
+	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+	
+	for (var p=0; p<this.pages.length; ++p) {
+		var cal = this.pages[p];
+		var pageDate = cal.cfg.getProperty(cfgPageDate);
+		if (p === 0) {
+			currYear = pageDate.getFullYear();
+		} else {
+			pageDate.setYear(currYear);
+		}
+		this._setMonthOnDate(pageDate, month+p); 
+		cal.cfg.setProperty(cfgPageDate, pageDate);
+	}
+};
+
+/**
+* Sets the calendar group's year explicitly. This year will be set into the first
+* page of the multi-page calendar, and all other months will be iterated appropriately.
+* @method setYear
+* @param {Number}	year		The numeric 4-digit year
+*/
+YAHOO.widget.CalendarGroup.prototype.setYear = function(year) {
+
+	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+
+	year = parseInt(year, 10);
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		var pageDate = cal.cfg.getProperty(cfgPageDate);
+
+		if ((pageDate.getMonth()+1) == 1 && p>0) {
+			year+=1;
+		}
+		cal.setYear(year);
+	}
+};
+/**
+* Calls the render function of all child calendars within the group.
+* @method render
+*/
+YAHOO.widget.CalendarGroup.prototype.render = function() {
+	this.renderHeader();
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.render();
+	}
+	this.renderFooter();
+};
+
+/**
+* Selects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once selection has completed, render must be 
+* called for the changes to be reflected visually.
+* @method select
+* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
+*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+*								This method can also take a JavaScript Date object or an array of Date objects.
+* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.CalendarGroup.prototype.select = function(date) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.select(date);
+	}
+	return this.getSelectedDates();
+};
+
+/**
+* Selects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
+* The value of the MULTI_SELECT Configuration attribute will determine the set of dates which get selected. 
+* <ul>
+*    <li>If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.</li>
+*    <li>If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.</li>
+* </ul>
+* @method selectCell
+* @param	{Number}	cellIndex	The index of the cell to be selected. 
+* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.CalendarGroup.prototype.selectCell = function(cellIndex) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.selectCell(cellIndex);
+	}
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects a date or a collection of dates on the current calendar. This method, by default,
+* does not call the render method explicitly. Once deselection has completed, render must be 
+* called for the changes to be reflected visually.
+* @method deselect
+* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+*								This method can also take a JavaScript Date object or an array of Date objects.	
+* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.CalendarGroup.prototype.deselect = function(date) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.deselect(date);
+	}
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects all dates on the current calendar.
+* @method deselectAll
+* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
+*						Assuming that this function executes properly, the return value should be an empty array.
+*						However, the empty array is returned for the sake of being able to check the selection status
+*						of the calendar.
+*/
+YAHOO.widget.CalendarGroup.prototype.deselectAll = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.deselectAll();
+	}
+	return this.getSelectedDates();
+};
+
+/**
+* Deselects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
+* deselectCell will deselect the cell at the specified index on each displayed Calendar page.
+*
+* @method deselectCell
+* @param	{Number}	cellIndex	The index of the cell to deselect. 
+* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+*/
+YAHOO.widget.CalendarGroup.prototype.deselectCell = function(cellIndex) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.deselectCell(cellIndex);
+	}
+	return this.getSelectedDates();
+};
+
+/**
+* Resets the calendar widget to the originally selected month and year, and 
+* sets the calendar to the initial selection(s).
+* @method reset
+*/
+YAHOO.widget.CalendarGroup.prototype.reset = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.reset();
+	}
+};
+
+/**
+* Clears the selected dates in the current calendar widget and sets the calendar
+* to the current month and year.
+* @method clear
+*/
+YAHOO.widget.CalendarGroup.prototype.clear = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.clear();
+	}
+};
+
+/**
+* Navigates to the next month page in the calendar widget.
+* @method nextMonth
+*/
+YAHOO.widget.CalendarGroup.prototype.nextMonth = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.nextMonth();
+	}
+};
+
+/**
+* Navigates to the previous month page in the calendar widget.
+* @method previousMonth
+*/
+YAHOO.widget.CalendarGroup.prototype.previousMonth = function() {
+	for (var p=this.pages.length-1;p>=0;--p) {
+		var cal = this.pages[p];
+		cal.previousMonth();
+	}
+};
+
+/**
+* Navigates to the next year in the currently selected month in the calendar widget.
+* @method nextYear
+*/
+YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.nextYear();
+	}
+};
+
+/**
+* Navigates to the previous year in the currently selected month in the calendar widget.
+* @method previousYear
+*/
+YAHOO.widget.CalendarGroup.prototype.previousYear = function() {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.previousYear();
+	}
+};
+
+
+/**
+* Gets the list of currently selected dates from the calendar.
+* @return			An array of currently selected JavaScript Date objects.
+* @type Date[]
+*/
+YAHOO.widget.CalendarGroup.prototype.getSelectedDates = function() { 
+	var returnDates = [];
+	var selected = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);
+	for (var d=0;d<selected.length;++d) {
+		var dateArray = selected[d];
+
+		var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
+		returnDates.push(date);
+	}
+
+	returnDates.sort( function(a,b) { return a-b; } );
+	return returnDates;
+};
+
+/**
+* Adds a renderer to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the conditions specified in the date string for this renderer.
+* @method addRenderer
+* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
+*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.CalendarGroup.prototype.addRenderer = function(sDates, fnRender) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.addRenderer(sDates, fnRender);
+	}
+};
+
+/**
+* Adds a month to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the month passed to this method.
+* @method addMonthRenderer
+* @param	{Number}	month		The month (1-12) to associate with this renderer
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.CalendarGroup.prototype.addMonthRenderer = function(month, fnRender) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.addMonthRenderer(month, fnRender);
+	}
+};
+
+/**
+* Adds a weekday to the render stack. The function reference passed to this method will be executed
+* when a date cell matches the weekday passed to this method.
+* @method addWeekdayRenderer
+* @param	{Number}	weekday		The weekday (1-7) to associate with this renderer. 1=Sunday, 2=Monday etc.
+* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+*/
+YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer = function(weekday, fnRender) {
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		cal.addWeekdayRenderer(weekday, fnRender);
+	}
+};
+
+/**
+* Renders the header for the CalendarGroup.
+* @method renderHeader
+*/
+YAHOO.widget.CalendarGroup.prototype.renderHeader = function() {};
+
+/**
+* Renders a footer for the 2-up calendar container. By default, this method is
+* unimplemented.
+* @method renderFooter
+*/
+YAHOO.widget.CalendarGroup.prototype.renderFooter = function() {};
+
+/**
+* Adds the designated number of months to the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method addMonths
+* @param {Number}	count	The number of months to add to the current calendar
+*/
+YAHOO.widget.CalendarGroup.prototype.addMonths = function(count) {
+	this.callChildFunction("addMonths", count);
+};
+
+
+/**
+* Subtracts the designated number of months from the current calendar month, and sets the current
+* calendar page date to the new month.
+* @method subtractMonths
+* @param {Number}	count	The number of months to subtract from the current calendar
+*/
+YAHOO.widget.CalendarGroup.prototype.subtractMonths = function(count) {
+	this.callChildFunction("subtractMonths", count);
+};
+
+/**
+* Adds the designated number of years to the current calendar, and sets the current
+* calendar page date to the new month.
+* @method addYears
+* @param {Number}	count	The number of years to add to the current calendar
+*/
+YAHOO.widget.CalendarGroup.prototype.addYears = function(count) {
+	this.callChildFunction("addYears", count);
+};
+
+/**
+* Subtcats the designated number of years from the current calendar, and sets the current
+* calendar page date to the new month.
+* @method subtractYears
+* @param {Number}	count	The number of years to subtract from the current calendar
+*/
+YAHOO.widget.CalendarGroup.prototype.subtractYears = function(count) {
+	this.callChildFunction("subtractYears", count);
+};
+
+/**
+* Shows the CalendarGroup's outer container.
+* @method show
+*/
+YAHOO.widget.CalendarGroup.prototype.show = function() {
+	this.oDomContainer.style.display = "block";
+	if (YAHOO.env.ua.opera) {
+		this._fixWidth();
+	}
+};
+
+/**
+* Sets the month on a Date object, taking into account year rollover if the month is less than 0 or greater than 11.
+* The Date object passed in is modified. It should be cloned before passing it into this method if the original value needs to be maintained
+* @method	_setMonthOnDate
+* @private
+* @param	{Date}	date	The Date object on which to set the month index
+* @param	{Number}	iMonth	The month index to set
+*/
+YAHOO.widget.CalendarGroup.prototype._setMonthOnDate = function(date, iMonth) {
+	// Bug in Safari 1.3, 2.0 (WebKit build < 420), Date.setMonth does not work consistently if iMonth is not 0-11
+	if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
+		var DM = YAHOO.widget.DateMath;
+		var newDate = DM.add(date, DM.MONTH, iMonth-date.getMonth());
+		date.setTime(newDate.getTime());
+	} else {
+		date.setMonth(iMonth);
+	}
+};
+
+/**
+ * Fixes the width of the CalendarGroup container element, to account for miswrapped floats
+ * @method _fixWidth
+ * @private
+ */
+YAHOO.widget.CalendarGroup.prototype._fixWidth = function() {
+	var startW = this.oDomContainer.offsetWidth;
+	var w = 0;
+	for (var p=0;p<this.pages.length;++p) {
+		var cal = this.pages[p];
+		w += cal.oDomContainer.offsetWidth;
+	}
+	if (w > 0) {
+		this.oDomContainer.style.width = w + "px";
+	}
+};
+
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_MULTI_UP
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.CalendarGroup.CSS_MULTI_UP = "multi";
+
+/**
+* CSS class representing the title for the 2-up calendar
+* @property YAHOO.widget.CalendarGroup.CSS_2UPTITLE
+* @static
+* @final
+* @type String
+*/
+YAHOO.widget.CalendarGroup.CSS_2UPTITLE = "title";
+
+/**
+* CSS class representing the close icon for the 2-up calendar
+* @property YAHOO.widget.CalendarGroup.CSS_2UPCLOSE
+* @static
+* @final
+* @deprecated	Along with Calendar.IMG_ROOT and NAV_ARROW_LEFT, NAV_ARROW_RIGHT configuration properties.
+*					Calendar's <a href="YAHOO.widget.Calendar.html#Style.CSS_CLOSE">Style.CSS_CLOSE</a> property now represents the CSS class used to render the close icon
+* @type String
+*/
+YAHOO.widget.CalendarGroup.CSS_2UPCLOSE = "close-icon";
+
+YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup, YAHOO.widget.Calendar, "buildDayLabel",
+																 "buildMonthLabel",
+																 "renderOutOfBoundsDate",
+																 "renderRowHeader",
+																 "renderRowFooter",
+																 "renderCellDefault",
+																 "styleCellDefault",
+																 "renderCellStyleHighlight1",
+																 "renderCellStyleHighlight2",
+																 "renderCellStyleHighlight3",
+																 "renderCellStyleHighlight4",
+																 "renderCellStyleToday",
+																 "renderCellStyleSelected",
+																 "renderCellNotThisMonth",
+																 "renderBodyCellRestricted",
+																 "initStyles",
+																 "configTitle",
+																 "configClose",
+																 "configIframe",
+																 "createTitleBar",
+																 "createCloseButton",
+																 "removeTitleBar",
+																 "removeCloseButton",
+																 "hide",
+																 "browser");
+
+/**
+* The set of default Config property keys and values for the CalendarGroup
+* @property YAHOO.widget.CalendarGroup._DEFAULT_CONFIG
+* @final
+* @static
+* @private
+* @type Object
+*/
+YAHOO.widget.CalendarGroup._DEFAULT_CONFIG = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
+
+/**
+* Returns a string representation of the object.
+* @method toString
+* @return {String}	A string representation of the CalendarGroup object.
+*/
+YAHOO.widget.CalendarGroup.prototype.toString = function() {
+	return "CalendarGroup " + this.id;
+};
+
+YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;
+
+/**
+* @class YAHOO.widget.Calendar2up
+* @extends YAHOO.widget.CalendarGroup
+* @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
+*/
+YAHOO.widget.Calendar2up = function(id, containerId, config) {
+	this.init(id, containerId, config);
+};
+
+YAHOO.extend(YAHOO.widget.Calendar2up, YAHOO.widget.CalendarGroup);
+
+/**
+* @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
+*/
+YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
+
+YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/colorpicker-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/colorpicker-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/colorpicker-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1731 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * Provides color conversion and validation utils
+ * @class YAHOO.util.Color
+ * @namespace YAHOO.util
+ */
+YAHOO.util.Color = function() {
+
+    var HCHARS="0123456789ABCDEF", lang=YAHOO.lang;
+
+    return {
+
+        /**
+         * Converts 0-1 to 0-255
+         * @method real2dec
+         * @param n {float} the number to convert
+         * @return {int} a number 0-255
+         */
+        real2dec: function(n) {
+            return Math.min(255, Math.round(n*256));
+        },
+
+        /**
+         * Converts HSV (h[0-360], s[0-1]), v[0-1] to RGB [255,255,255]
+         * @method hsv2rgb
+         * @param h {int|[int, float, float]} the hue, or an
+         *        array containing all three parameters
+         * @param s {float} the saturation
+         * @param v {float} the value/brightness
+         * @return {[int, int, int]} the red, green, blue values in
+         *          decimal.
+         */
+        hsv2rgb: function(h, s, v) { 
+
+            if (lang.isArray(h)) {
+                return this.hsv2rgb.call(this, h[0], h[1], h[2]);
+            }
+
+            var r, g, b, i, f, p, q, t;
+            i = Math.floor((h/60)%6);
+            f = (h/60)-i;
+            p = v*(1-s);
+            q = v*(1-f*s);
+            t = v*(1-(1-f)*s);
+            switch(i) {
+                case 0: r=v; g=t; b=p; break;
+                case 1: r=q; g=v; b=p; break;
+                case 2: r=p; g=v; b=t; break;
+                case 3: r=p; g=q; b=v; break;
+                case 4: r=t; g=p; b=v; break;
+                case 5: r=v; g=p; b=q; break;
+            }
+
+            var fn=this.real2dec;
+
+            return [fn(r), fn(g), fn(b)];
+        },
+
+        /**
+         * Converts to RGB [255,255,255] to HSV (h[0-360], s[0-1]), v[0-1]
+         * @method rgb2hsv
+         * @param r {int|[int, int, int]} the red value, or an
+         *        array containing all three parameters
+         * @param g {int} the green value
+         * @param b {int} the blue value
+         * @return {[int, float, float]} the value converted to hsv
+         */
+        rgb2hsv: function(r, g, b) {
+
+            if (lang.isArray(r)) {
+                return this.rgb2hsv.call(this, r[0], r[1], r[2]);
+            }
+
+            r=r/255;
+            g=g/255;
+            b=b/255;
+
+            var min,max,delta,h,s,v;
+            min = Math.min(Math.min(r,g),b);
+            max = Math.max(Math.max(r,g),b);
+            delta = max-min;
+
+            switch (max) {
+                case min: h=0; break;
+                case r:   h=60*(g-b)/delta; 
+                          if (g<b) {
+                              h+=360;
+                          }
+                          break;
+                case g:   h=(60*(b-r)/delta)+120; break;
+                case b:   h=(60*(r-g)/delta)+240; break;
+            }
+            
+            s = (max === 0) ? 0 : 1-(min/max);
+
+            var hsv = [Math.round(h), s, max];
+
+            return hsv;
+
+        },
+
+        /**
+         * Converts decimal rgb values into a hex string
+         * 255,255,255 -> FFFFFF
+         * @method rgb2hex
+         * @param r {int|[int, int, int]} the red value, or an
+         *        array containing all three parameters
+         * @param g {int} the green value
+         * @param b {int} the blue value
+         * @return {string} the hex string
+         */
+        rgb2hex: function(r, g, b) {
+            if (lang.isArray(r)) {
+                return this.rgb2hex.call(this, r[0], r[1], r[2]);
+            }
+
+            var f=this.dec2hex;
+            return f(r) + f(g) + f(b);
+        },
+     
+        /**
+         * Converts an int 0...255 to hex pair 00...FF
+         * @method dec2hex
+         * @param n {int} the number to convert
+         * @return {string} the hex equivalent
+         */
+        dec2hex: function(n) {
+            n = parseInt(n, 10);
+            n = (lang.isNumber(n)) ? n : 0;
+            n = (n > 255 || n < 0) ? 0 : n;
+
+            return HCHARS.charAt((n - n % 16) / 16) + HCHARS.charAt(n % 16);
+        },
+
+        /**
+         * Converts a hex pair 00...FF to an int 0...255 
+         * @method hex2dec
+         * @param str {string} the hex pair to convert
+         * @return {int} the decimal
+         */
+        hex2dec: function(str) {
+            var f = function(c) {
+                return HCHARS.indexOf(c.toUpperCase());
+            };
+
+            var s=str.split('');
+            
+            return ((f(s[0]) * 16) + f(s[1]));
+        },
+
+        /**
+         * Converts a hex string to rgb
+         * @method hex2rgb
+         * @param str {string} the hex string
+         * @return {[int, int, int]} an array containing the rgb values
+         */
+        hex2rgb: function(s) { 
+            var f = this.hex2dec;
+            return [f(s.substr(0, 2)), f(s.substr(2, 2)), f(s.substr(4, 2))];
+        },
+
+        /**
+         * Returns the closest websafe color to the supplied rgb value.
+         * @method websafe
+         * @param r {int|[int, int, int]} the red value, or an
+         *        array containing all three parameters
+         * @param g {int} the green value
+         * @param b {int} the blue value
+         * @return {[int, int, int]} an array containing the closes
+         *                           websafe rgb colors.
+         */
+        websafe: function(r, g, b) {
+
+            if (lang.isArray(r)) {
+                return this.websafe.call(this, r[0], r[1], r[2]);
+            }
+
+            // returns the closest match [0, 51, 102, 153, 204, 255]
+            var f = function(v) {
+                if (lang.isNumber(v)) {
+                    v = Math.min(Math.max(0, v), 255);
+                    var i, next;
+                    for (i=0; i<256; i=i+51) {
+                        next = i+51;
+                        if (v >= i && v <= next) {
+                            return (v-i > 25) ? next : i;
+                        }
+                    }
+                }
+
+                return v;
+            };
+
+            return [f(r), f(g), f(b)];
+        }
+    };
+}();
+
+
+(function() {
+
+    var _pickercount = 0;
+
+    /**
+     * The colorpicker module provides a widget for selecting colors
+     * @module colorpicker
+     * @requires yahoo, dom, event, element, slider
+     */
+
+
+    /**
+     * Creates the host element if it doesn't exist
+     * @method _createHostElement
+     * @private
+     */
+    var _createHostElement = function() {
+        var el = document.createElement('div');
+
+        if (this.CSS.BASE) {
+            el.className = this.CSS.BASE;
+        }
+        
+        return el;
+    };
+
+    /**
+     * A widget to select colors
+     * @namespace YAHOO.widget
+     * @class YAHOO.widget.ColorPicker
+     * @extends YAHOO.util.Element
+     * @constructor
+     * @param {HTMLElement | String | Object} el(optional) The html 
+     * element that represents the colorpicker, or the attribute object to use. 
+     * An element will be created if none provided.
+     * @param {Object} attr (optional) A key map of the colorpicker's 
+     * initial attributes.  Ignored if first arg is attributes object.
+     */
+    YAHOO.widget.ColorPicker = function(el, attr) {
+        _pickercount = _pickercount + 1;
+        attr = attr || {};
+        if (arguments.length === 1 && !YAHOO.lang.isString(el) && !el.nodeName) {
+            attr = el; // treat first arg as attr object
+            el = attr.element || null;
+        }
+        
+        if (!el && !attr.element) { // create if we dont have one
+            el = _createHostElement.call(this, attr);
+        }
+
+    	YAHOO.widget.ColorPicker.superclass.constructor.call(this, el, attr); 
+    };
+
+    YAHOO.extend(YAHOO.widget.ColorPicker, YAHOO.util.Element);
+    
+    var proto = YAHOO.widget.ColorPicker.prototype,
+        Slider=YAHOO.widget.Slider,
+        Color=YAHOO.util.Color,
+        Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event,
+        lang = YAHOO.lang,
+        sub = lang.substitute;
+    
+
+    var b = "yui-picker";
+
+    /**
+     * The element ids used by this control
+     * @property ID
+     * @final
+     */
+    proto.ID = {
+
+        /**
+         * The id for the "red" form field
+         * @property ID.R
+         * @type String
+         * @final
+         * @default yui-picker-r
+         */
+        R: b + "-r",
+
+        /**
+         * The id for the "red" hex pair output
+         * @property ID.R_HEX
+         * @type String
+         * @final
+         * @default yui-picker-rhex
+         */
+        R_HEX: b + "-rhex",
+
+        /**
+         * The id for the "green" form field
+         * @property ID.G
+         * @type String
+         * @final
+         * @default yui-picker-g
+         */
+        G: b + "-g",
+
+        /**
+         * The id for the "green" hex pair output
+         * @property ID.G_HEX
+         * @type String
+         * @final
+         * @default yui-picker-ghex
+         */
+        G_HEX: b + "-ghex",
+
+
+        /**
+         * The id for the "blue" form field
+         * @property ID.B
+         * @type String
+         * @final
+         * @default yui-picker-b
+         */
+        B: b + "-b",
+
+        /**
+         * The id for the "blue" hex pair output
+         * @property ID.B_HEX
+         * @type String
+         * @final
+         * @default yui-picker-bhex
+         */
+        B_HEX: b + "-bhex",
+
+        /**
+         * The id for the "hue" form field
+         * @property ID.H
+         * @type String
+         * @final
+         * @default yui-picker-h
+         */
+        H: b + "-h",
+
+        /**
+         * The id for the "saturation" form field
+         * @property ID.S
+         * @type String
+         * @final
+         * @default yui-picker-s
+         */
+        S: b + "-s",
+
+        /**
+         * The id for the "value" form field
+         * @property ID.V
+         * @type String
+         * @final
+         * @default yui-picker-v
+         */
+        V: b + "-v",
+
+        /**
+         * The id for the picker region slider
+         * @property ID.PICKER_BG
+         * @type String
+         * @final
+         * @default yui-picker-bg
+         */
+        PICKER_BG:      b + "-bg",
+
+        /**
+         * The id for the picker region thumb
+         * @property ID.PICKER_THUMB
+         * @type String
+         * @final
+         * @default yui-picker-thumb
+         */
+        PICKER_THUMB:   b + "-thumb",
+
+        /**
+         * The id for the hue slider
+         * @property ID.HUE_BG
+         * @type String
+         * @final
+         * @default yui-picker-hue-bg
+         */
+        HUE_BG:         b + "-hue-bg",
+
+        /**
+         * The id for the hue thumb
+         * @property ID.HUE_THUMB
+         * @type String
+         * @final
+         * @default yui-picker-hue-thumb
+         */
+        HUE_THUMB:      b + "-hue-thumb",
+
+        /**
+         * The id for the hex value form field
+         * @property ID.HEX
+         * @type String
+         * @final
+         * @default yui-picker-hex
+         */
+        HEX:            b + "-hex",
+
+        /**
+         * The id for the color swatch
+         * @property ID.SWATCH
+         * @type String
+         * @final
+         * @default yui-picker-swatch
+         */
+        SWATCH:         b + "-swatch",
+
+        /**
+         * The id for the websafe color swatch
+         * @property ID.WEBSAFE_SWATCH
+         * @type String
+         * @final
+         * @default yui-picker-websafe-swatch
+         */
+        WEBSAFE_SWATCH: b + "-websafe-swatch",
+
+        /**
+         * The id for the control details
+         * @property ID.CONTROLS
+         * @final
+         * @default yui-picker-controls
+         */
+        CONTROLS: b + "-controls",
+
+        /**
+         * The id for the rgb controls
+         * @property ID.RGB_CONTROLS
+         * @final
+         * @default yui-picker-rgb-controls
+         */
+        RGB_CONTROLS: b + "-rgb-controls",
+
+        /**
+         * The id for the hsv controls
+         * @property ID.HSV_CONTROLS
+         * @final
+         * @default yui-picker-hsv-controls
+         */
+        HSV_CONTROLS: b + "-hsv-controls",
+        
+        /**
+         * The id for the hsv controls
+         * @property ID.HEX_CONTROLS
+         * @final
+         * @default yui-picker-hex-controls
+         */
+        HEX_CONTROLS: b + "-hex-controls",
+
+        /**
+         * The id for the hex summary
+         * @property ID.HEX_SUMMARY
+         * @final
+         * @default yui-picker-hex-summary
+         */
+        HEX_SUMMARY: b + "-hex-summary",
+
+        /**
+         * The id for the controls section header
+         * @property ID.CONTROLS_LABEL
+         * @final
+         * @default yui-picker-controls-label
+         */
+        CONTROLS_LABEL: b + "-controls-label"
+    };
+
+    /**
+     * Constants for any script-generated messages.  The values here
+     * are the default messages.  They can be updated by providing
+     * the complete list to the constructor for the "txt" attribute.
+     * @property TXT
+     * @final
+     */
+    proto.TXT = {
+        ILLEGAL_HEX: "Illegal hex value entered",
+        SHOW_CONTROLS: "Show color details",
+        HIDE_CONTROLS: "Hide color details",
+        CURRENT_COLOR: "Currently selected color: {rgb}",
+        CLOSEST_WEBSAFE: "Closest websafe color: {rgb}. Click to select.",
+        R: "R",
+        G: "G",
+        B: "B",
+        H: "H",
+        S: "S",
+        V: "V",
+        HEX: "#",
+        DEG: "\u00B0",
+        PERCENT: "%"
+    };
+
+    /**
+     * Constants for the default image locations for img tags that are
+     * generated by the control.  They can be modified by passing the
+     * complete list to the contructor for the "images" attribute
+     * @property IMAGE
+     * @final
+     */
+    proto.IMAGE = {
+        PICKER_THUMB: "../../build/colorpicker/assets/picker_thumb.png",
+        HUE_THUMB: "../../build/colorpicker/assets/hue_thumb.png"
+    };
+
+    /*
+     * Constants for the control's custom event names.  subscribe
+     * to the rgbChange event instead.
+     * @property EVENT
+     * @final
+     */
+    //proto.EVENT = {
+        //CHANGE: "change"
+    //};
+
+    //proto.CSS = { };
+
+    /**
+     * Constants for the control's default default values
+     * @property DEFAULT
+     * @final
+     */
+    proto.DEFAULT = {
+        PICKER_SIZE: 180
+    };
+
+    /**
+     * Constants for the control's configuration attributes
+     * @property OPT
+     * @final
+     */
+    proto.OPT = {
+        HUE: "hue",
+        SATURATION: "saturation",
+        VALUE: "value",
+        RED: "red",
+        GREEN: "green",
+        BLUE: "blue",
+        HSV: "hsv",
+        RGB: "rgb",
+        WEBSAFE: "websafe",
+        HEX: "hex",
+        PICKER_SIZE: "pickersize",
+        SHOW_CONTROLS: "showcontrols",
+        SHOW_RGB_CONTROLS: "showrgbcontrols",
+        SHOW_HSV_CONTROLS: "showhsvcontrols",
+        SHOW_HEX_CONTROLS: "showhexcontrols",
+        SHOW_HEX_SUMMARY: "showhexsummary",
+        SHOW_WEBSAFE: "showwebsafe",
+        //SHOW_SUBMIT: "showsubmit",
+        CONTAINER: "container",
+        IDS: "ids",
+        ELEMENTS: "elements",
+        TXT: "txt",
+        IMAGES: "images",
+        ANIMATE: "animate"
+    };
+
+    /**
+     * Moves the hue slider into the position dictated by the current state
+     * of the control
+     * @method _updateHueSlider
+     * @private
+     */
+    var _updateHueSlider = function() {
+        var size = this.get(this.OPT.PICKER_SIZE),
+            h = this.get(this.OPT.HUE);
+
+        h = size - Math.round(h / 360 * size);
+        
+        // 0 is at the top and bottom of the hue slider.  Always go to
+        // the top so we don't end up sending the thumb to the bottom
+        // when the value didn't actually change (e.g., a conversion
+        // produced 360 instead of 0 and the value was already 0).
+        if (h === size) {
+            h = 0;
+        }
+
+        this.hueSlider.setValue(h);
+    };
+
+    /**
+     * Moves the picker slider into the position dictated by the current state
+     * of the control
+     * @method _updatePickerSlider
+     * @private
+     */
+    var _updatePickerSlider = function() {
+        var size = this.get(this.OPT.PICKER_SIZE),
+            s = this.get(this.OPT.SATURATION),
+            v = this.get(this.OPT.VALUE);
+
+        s = Math.round(s * size / 100);
+        v = Math.round(size - (v * size / 100));
+
+
+        this.pickerSlider.setRegionValue(s, v);
+    };
+
+    /**
+     * Moves the sliders into the position dictated by the current state
+     * of the control
+     * @method _updateSliders
+     * @private
+     */
+    var _updateSliders = function() {
+        _updateHueSlider.call(this);
+        _updatePickerSlider.call(this);
+    };
+
+    /**
+     * Sets the control to the specified rgb value and
+     * moves the sliders to the proper positions
+     * @method setValue
+     * @param rgb {[int, int, int]} the rgb value
+     * @param silent {boolean} whether or not to fire the change event
+     */
+    proto.setValue = function(rgb, silent) {
+        silent = (silent) || false;
+        this.set(this.OPT.RGB, rgb, silent);
+        _updateSliders.call(this);
+    };
+
+    /**
+     * The hue slider
+     * @property hueSlider
+     * @type YAHOO.widget.Slider
+     */
+    proto.hueSlider = null; 
+    
+    /**
+     * The picker region
+     * @property pickerSlider
+     * @type YAHOO.widget.Slider
+     */
+    proto.pickerSlider = null;
+
+    /**
+     * Translates the slider value into hue, int[0,359]
+     * @method _getH
+     * @private
+     * @return {int} the hue from 0 to 359
+     */
+    var _getH = function() {
+        var size = this.get(this.OPT.PICKER_SIZE),
+            h = (size - this.hueSlider.getValue()) / size;
+        h = Math.round(h*360);
+        return (h === 360) ? 0 : h;
+    };
+
+    /**
+     * Translates the slider value into saturation, int[0,1], left to right
+     * @method _getS
+     * @private
+     * @return {int} the saturation from 0 to 1
+     */
+    var _getS = function() {
+        return this.pickerSlider.getXValue() / this.get(this.OPT.PICKER_SIZE);
+    };
+
+    /**
+     * Translates the slider value into value/brightness, int[0,1], top
+     * to bottom
+     * @method _getV
+     * @private
+     * @return {int} the value from 0 to 1
+     */
+    var _getV = function() {
+        var size = this.get(this.OPT.PICKER_SIZE);
+        return (size - this.pickerSlider.getYValue()) / size;
+    };
+
+    /**
+     * Updates the background of the swatch with the current rbg value.
+     * Also updates the websafe swatch to the closest websafe color
+     * @method _updateSwatch
+     * @private
+     */
+    var _updateSwatch = function() {
+        var rgb = this.get(this.OPT.RGB),
+            websafe = this.get(this.OPT.WEBSAFE),
+            el = this.getElement(this.ID.SWATCH),
+            color = rgb.join(","),
+            txt = this.get(this.OPT.TXT);
+
+        Dom.setStyle(el, "background-color", "rgb(" + color  + ")");
+        el.title = lang.substitute(txt.CURRENT_COLOR, {
+                "rgb": "#" + this.get(this.OPT.HEX)
+            });
+
+
+        el = this.getElement(this.ID.WEBSAFE_SWATCH);
+        color = websafe.join(",");
+
+        Dom.setStyle(el, "background-color", "rgb(" + color + ")");
+        el.title = lang.substitute(txt.CLOSEST_WEBSAFE, {
+                "rgb": "#" + Color.rgb2hex(websafe)
+            });
+
+    };
+
+    /**
+     * Reads the sliders and converts the values to RGB, updating the
+     * internal state for all the individual form fields
+     * @method _getValuesFromSliders
+     * @private
+     */
+    var _getValuesFromSliders = function() {
+        var h=_getH.call(this), s=_getS.call(this), v=_getV.call(this);
+
+        var rgb = Color.hsv2rgb(h, s, v);
+        //var websafe = Color.websafe(rgb);
+        //var hex = Color.rgb2hex(rgb[0], rgb[1], rgb[2]);
+
+        this.set(this.OPT.RGB, rgb);
+    };
+
+    /**
+     * Updates the form field controls with the state data contained
+     * in the control.
+     * @method _updateFormFields
+     * @private
+     */
+    var _updateFormFields = function() {
+        this.getElement(this.ID.H).value = this.get(this.OPT.HUE);
+        this.getElement(this.ID.S).value = this.get(this.OPT.SATURATION);
+        this.getElement(this.ID.V).value = this.get(this.OPT.VALUE);
+        this.getElement(this.ID.R).value = this.get(this.OPT.RED);
+        this.getElement(this.ID.R_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.RED));
+        this.getElement(this.ID.G).value = this.get(this.OPT.GREEN);
+        this.getElement(this.ID.G_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.GREEN));
+        this.getElement(this.ID.B).value = this.get(this.OPT.BLUE);
+        this.getElement(this.ID.B_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.BLUE));
+        this.getElement(this.ID.HEX).value = this.get(this.OPT.HEX);
+    };
+
+    /**
+     * Event handler for the hue slider.
+     * @method _onHueSliderChange
+     * @param newOffset {int} pixels from the start position
+     * @private
+     */
+    var _onHueSliderChange = function(newOffset) {
+
+        var h = _getH.call(this);
+        this.set(this.OPT.HUE, h, true);
+
+        // set picker background to the hue
+        var rgb = Color.hsv2rgb(h, 1, 1);
+        var styleDef = "rgb(" + rgb.join(",") + ")";
+
+        Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef);
+
+        if (this.hueSlider.valueChangeSource === this.hueSlider.SOURCE_UI_EVENT) {
+            _getValuesFromSliders.call(this);
+        }
+
+        _updateFormFields.call(this);
+        _updateSwatch.call(this);
+    };
+
+    /**
+     * Event handler for the picker slider, which controls the
+     * saturation and value/brightness.
+     * @method _onPickerSliderChange
+     * @param newOffset {{x: int, y: int}} x/y pixels from the start position
+     * @private
+     */
+    var _onPickerSliderChange = function(newOffset) {
+
+        var s=_getS.call(this), v=_getV.call(this);
+        this.set(this.OPT.SATURATION, Math.round(s*100), true);
+        this.set(this.OPT.VALUE, Math.round(v*100), true);
+
+        if (this.pickerSlider.valueChangeSource === this.pickerSlider.SOURCE_UI_EVENT) {
+            _getValuesFromSliders.call(this);
+        }
+
+        _updateFormFields.call(this);
+        _updateSwatch.call(this);
+    };
+
+
+    /**
+     * Key map to well-known commands for txt field input
+     * @method _getCommand
+     * @param e {Event} the keypress or keydown event
+     * @return {int} a command code
+     * <ul>
+     * <li>0 = not a number, letter in range, or special key</li>
+     * <li>1 = number</li>
+     * <li>2 = a-fA-F</li>
+     * <li>3 = increment (up arrow)</li>
+     * <li>4 = decrement (down arrow)</li>
+     * <li>5 = special key (tab, delete, return, escape, left, right)</li> 
+     * <li>6 = return</li>
+     * </ul>
+     * @private
+     */
+    var _getCommand = function(e) {
+        var c = Event.getCharCode(e);
+
+        //alert(Event.getCharCode(e) + ", " + e.keyCode + ", " + e.charCode);
+
+        // special keys
+        if (c === 38) { // up arrow
+            return 3;
+        } else if (c === 13) { // return
+            return 6;
+        } else if (c === 40) { // down array
+            return 4;
+        } else if (c >= 48 && c<=57) { // 0-9
+            return 1;
+        } else if (c >= 97 && c<=102) { // a-f
+            return 2;
+        } else if (c >= 65 && c<=70) { // A-F
+            return 2;
+        //} else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1 || 
+        //              (c >= 112 && c <=123)) { // including F-keys
+        // tab, delete, return, escape, left, right
+        } else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1) { // special chars
+            return 5;
+        } else { // something we probably don't want
+            return 0;
+        }
+    };
+
+    /**
+     * Use the value of the text field to update the control
+     * @method _hexFieldKeypress
+     * @param e {Event} an event
+     * @param el {HTMLElement} the field
+     * @param prop {string} the key to the linked property
+     * @private
+     */
+    var _useFieldValue = function(e, el, prop) {
+        var val = el.value;
+
+        if (prop !== this.OPT.HEX) {
+            val = parseInt(val, 10);
+        }
+
+        if (val !== this.get(prop)) {
+            this.set(prop, val);
+        }
+    };
+
+    /**
+     * Handle keypress on one of the rgb or hsv fields.
+     * @method _rgbFieldKeypress
+     * @param e {Event} the keypress event
+     * @param el {HTMLElement} the field
+     * @param prop {string} the key to the linked property
+     * @private
+     */
+    var _rgbFieldKeypress = function(e, el, prop) {
+        var command = _getCommand(e);
+        var inc = (e.shiftKey) ? 10 : 1;
+        switch (command) {
+            case 6: // return, update the value
+                _useFieldValue.apply(this, arguments);
+                break;
+                        
+            case 3: // up arrow, increment
+                this.set(prop, Math.min(this.get(prop)+inc, 255));
+                _updateFormFields.call(this);
+                //Event.stopEvent(e);
+                break;
+            case 4: // down arrow, decrement
+                this.set(prop, Math.max(this.get(prop)-inc, 0));
+                _updateFormFields.call(this);
+                //Event.stopEvent(e);
+                break;
+
+            default:
+        }
+
+    };
+
+    /**
+     * Handle keydown on the hex field
+     * @method _hexFieldKeypress
+     * @param e {Event} the keypress event
+     * @param el {HTMLElement} the field
+     * @param prop {string} the key to the linked property
+     * @private
+     */
+    var _hexFieldKeypress = function(e, el, prop) {
+        var command = _getCommand(e);
+        if (command === 6) { // return, update the value
+            _useFieldValue.apply(this, arguments);
+        }
+    };
+
+    /** 
+     * Allows numbers and special chars, and by default allows a-f.  
+     * Used for the hex field keypress handler.
+     * @method _hexOnly
+     * @param e {Event} the event
+     * @param numbersOnly omits a-f if set to true
+     * @private
+     * @return {boolean} false if we are canceling the event
+     */
+    var _hexOnly = function(e, numbersOnly) {
+        var command = _getCommand(e);
+        switch (command) {
+            case 6: // return
+            case 5: // special char
+            case 1: // number
+                break;
+            case 2: // hex char (a-f)
+                if (numbersOnly !== true) {
+                    break;
+                }
+
+                // fallthrough is intentional
+
+            default: // prevent alpha and punctuation
+                Event.stopEvent(e);
+                return false;
+        }
+    };
+
+    /** 
+     * Allows numbers and special chars only.  Used for the
+     * rgb and hsv fields keypress handler.
+     * @method _numbersOnly
+     * @param e {Event} the event
+     * @private
+     * @return {boolean} false if we are canceling the event
+     */
+    var _numbersOnly = function(e) {
+        return _hexOnly(e, true);
+    };
+
+    /**
+     * Returns the element reference that is saved.  The id can be either
+     * the element id, or the key for this id in the "id" config attribute.
+     * For instance, the host element id can be obtained by passing its
+     * id (default: "yui_picker") or by its key "YUI_PICKER".
+     * @param id {string} the element id, or key 
+     * @return {HTMLElement} a reference to the element
+     */
+    proto.getElement = function(id) { 
+        return this.get(this.OPT.ELEMENTS)[this.get(this.OPT.IDS)[id]]; 
+    };
+
+    var _createElements = function() {
+        var el, child, img, fld, i, 
+            ids = this.get(this.OPT.IDS),
+            txt = this.get(this.OPT.TXT),
+            images = this.get(this.OPT.IMAGES),
+            Elem = function(type, o) {
+                var n = document.createElement(type);
+                if (o) {
+                    lang.augmentObject(n, o, true);
+                }
+                return n;
+            },
+            RGBElem = function(type, obj) {
+                var o = lang.merge({
+                        //type: "txt",
+                        autocomplete: "off",
+                        value: "0",
+                        size: 3,
+                        maxlength: 3
+                    }, obj);
+
+                o.name = o.id;
+                return new Elem(type, o);
+            };
+
+        var p = this.get("element");
+
+        // Picker slider (S and V) ---------------------------------------------
+
+        el = new Elem("div", {
+            id: ids[this.ID.PICKER_BG],
+            className: "yui-picker-bg",
+            tabIndex: -1,
+            hideFocus: true
+        });
+
+        child = new Elem("div", {
+            id: ids[this.ID.PICKER_THUMB],
+            className: "yui-picker-thumb"
+        });
+
+        img = new Elem("img", {
+            src: images.PICKER_THUMB
+        });
+
+        child.appendChild(img);
+        el.appendChild(child);
+        p.appendChild(el);
+        
+        // Hue slider ---------------------------------------------
+        el = new Elem("div", {
+            id: ids[this.ID.HUE_BG],
+            className: "yui-picker-hue-bg",
+            tabIndex: -1,
+            hideFocus: true
+        });
+
+        child = new Elem("div", {
+            id: ids[this.ID.HUE_THUMB],
+            className: "yui-picker-hue-thumb"
+        });
+
+        img = new Elem("img", {
+            src: images.HUE_THUMB
+        });
+
+        child.appendChild(img);
+        el.appendChild(child);
+        p.appendChild(el);
+
+
+        // controls ---------------------------------------------
+
+        el = new Elem("div", {
+            id: ids[this.ID.CONTROLS],
+            className: "yui-picker-controls"
+        });
+
+        p.appendChild(el);
+        p = el;
+
+            // controls header
+            el = new Elem("div", {
+                className: "hd"
+            });
+
+            child = new Elem("a", {
+                id: ids[this.ID.CONTROLS_LABEL],
+                //className: "yui-picker-controls-label",
+                href: "#"
+            });
+            el.appendChild(child);
+            p.appendChild(el);
+
+            // bd
+            el = new Elem("div", {
+                className: "bd"
+            });
+
+            p.appendChild(el);
+            p = el;
+
+                // rgb
+                el = new Elem("ul", {
+                    id: ids[this.ID.RGB_CONTROLS],
+                    className: "yui-picker-rgb-controls"
+                });
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.R + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.R],
+                    className: "yui-picker-r"
+                });
+
+                child.appendChild(fld);
+                el.appendChild(child);
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.G + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.G],
+                    className: "yui-picker-g"
+                });
+
+                child.appendChild(fld);
+                el.appendChild(child);
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.B + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.B],
+                    className: "yui-picker-b"
+                });
+
+                child.appendChild(fld);
+                el.appendChild(child);
+
+                p.appendChild(el);
+
+                // hsv
+                el = new Elem("ul", {
+                    id: ids[this.ID.HSV_CONTROLS],
+                    className: "yui-picker-hsv-controls"
+                });
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.H + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.H],
+                    className: "yui-picker-h"
+                });
+
+                child.appendChild(fld);
+                child.appendChild(document.createTextNode(" " + txt.DEG));
+
+                el.appendChild(child);
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.S + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.S],
+                    className: "yui-picker-s"
+                });
+
+                child.appendChild(fld);
+                child.appendChild(document.createTextNode(" " + txt.PERCENT));
+
+                el.appendChild(child);
+
+                child = new Elem("li");
+                child.appendChild(document.createTextNode(txt.V + " "));
+
+                fld = new RGBElem("input", {
+                    id: ids[this.ID.V],
+                    className: "yui-picker-v"
+                });
+
+                child.appendChild(fld);
+                child.appendChild(document.createTextNode(" " + txt.PERCENT));
+
+                el.appendChild(child);
+                p.appendChild(el);
+
+
+                // hex summary
+
+                el = new Elem("ul", {
+                    id: ids[this.ID.HEX_SUMMARY],
+                    className: "yui-picker-hex_summary"
+                });
+
+                child = new Elem("li", {
+                    id: ids[this.ID.R_HEX]
+                });
+                el.appendChild(child);
+
+                child = new Elem("li", {
+                    id: ids[this.ID.G_HEX]
+                });
+                el.appendChild(child);
+
+                child = new Elem("li", {
+                    id: ids[this.ID.B_HEX]
+                });
+                el.appendChild(child);
+                p.appendChild(el);
+
+                // hex field
+                el = new Elem("div", {
+                    id: ids[this.ID.HEX_CONTROLS],
+                    className: "yui-picker-hex-controls"
+                });
+                el.appendChild(document.createTextNode(txt.HEX + " "));
+
+                child = new RGBElem("input", {
+                    id: ids[this.ID.HEX],
+                    className: "yui-picker-hex",
+                    size: 6,
+                    maxlength: 6
+                });
+
+                el.appendChild(child);
+                p.appendChild(el);
+
+                p = this.get("element");
+
+                // swatch
+                el = new Elem("div", {
+                    id: ids[this.ID.SWATCH],
+                    className: "yui-picker-swatch"
+                });
+
+                p.appendChild(el);
+
+                // websafe swatch
+                el = new Elem("div", {
+                    id: ids[this.ID.WEBSAFE_SWATCH],
+                    className: "yui-picker-websafe-swatch"
+                });
+
+                p.appendChild(el);
+
+    };
+
+    var _attachRGBHSV = function(id, config) {
+        Event.on(this.getElement(id), "keydown", function(e, me) {
+                _rgbFieldKeypress.call(me, e, this, config);
+            }, this);
+        Event.on(this.getElement(id), "keypress", _numbersOnly, this);
+        Event.on(this.getElement(id), "blur", function(e, me) {
+                _useFieldValue.call(me, e, this, config);
+            }, this);
+    };
+
+    /**
+     * Sets the initial state of the sliders
+     * @method initPicker
+     */
+    proto.initPicker = function () {
+
+        // bind all of our elements
+        var o=this.OPT, 
+            ids = this.get(o.IDS), 
+            els = this.get(o.ELEMENTS), 
+                  i, el, id;
+
+        // Add the default value as a key for each element for easier lookup
+        for (i in this.ID) {
+            if (lang.hasOwnProperty(this.ID, i)) {
+                ids[this.ID[i]] = ids[i];
+            }
+        }
+
+        // Check for picker element, if not there, create all of them
+        el = Dom.get(ids[this.ID.PICKER_BG]);
+        if (!el) {
+            _createElements.call(this);
+        } else {
+        }
+
+        for (i in ids) {
+            if (lang.hasOwnProperty(ids, i)) {
+                // look for element
+                el = Dom.get(ids[i]);
+
+                // generate an id if the implementer passed in an element reference,
+                // and the element did not have an id already
+                id = Dom.generateId(el);
+
+                // update the id in case we generated the id
+                ids[i] = id; // key is WEBSAFE_SWATCH
+                ids[ids[i]] = id; // key is websafe_swatch
+
+                // store the dom ref
+                els[id] = el;
+            }
+        }
+
+        // set the initial visibility state of our controls
+            els = [o.SHOW_CONTROLS, 
+                   o.SHOW_RGB_CONTROLS,
+                   o.SHOW_HSV_CONTROLS,
+                   o.SHOW_HEX_CONTROLS,
+                   o.SHOW_HEX_SUMMARY,
+                   o.SHOW_WEBSAFE
+                   ];
+
+        for (i=0; i<els.length; i=i+1) {
+            this.set(els[i], this.get(els[i]));
+        }
+
+        var s = this.get(o.PICKER_SIZE);
+
+        this.hueSlider = Slider.getVertSlider(this.getElement(this.ID.HUE_BG), 
+                                              this.getElement(this.ID.HUE_THUMB), 0, s);
+        this.hueSlider.subscribe("change", _onHueSliderChange, this, true);
+
+        this.pickerSlider = Slider.getSliderRegion(this.getElement(this.ID.PICKER_BG), 
+                                                   this.getElement(this.ID.PICKER_THUMB), 0, s, 0, s);
+        this.pickerSlider.subscribe("change", _onPickerSliderChange, this, true);
+
+        //_onHueSliderChange.call(this, 0);
+
+        Event.on(this.getElement(this.ID.WEBSAFE_SWATCH), "click", function(e) {
+               this.setValue(this.get(o.WEBSAFE));
+               //_updateSliders
+           }, this, true);
+
+        Event.on(this.getElement(this.ID.CONTROLS_LABEL), "click", function(e) {
+               this.set(o.SHOW_CONTROLS, !this.get(o.SHOW_CONTROLS));
+               Event.preventDefault(e);
+           }, this, true);
+
+        _attachRGBHSV.call(this, this.ID.R, this.OPT.RED); 
+        _attachRGBHSV.call(this, this.ID.G, this.OPT.GREEN); 
+        _attachRGBHSV.call(this, this.ID.B, this.OPT.BLUE); 
+        _attachRGBHSV.call(this, this.ID.H, this.OPT.HUE); 
+        _attachRGBHSV.call(this, this.ID.S, this.OPT.SATURATION); 
+        _attachRGBHSV.call(this, this.ID.V, this.OPT.VALUE); 
+
+        Event.on(this.getElement(this.ID.HEX), "keydown", function(e, me) {
+                _hexFieldKeypress.call(me, e, this, me.OPT.HEX);
+            }, this);
+
+        Event.on(this.getElement(this.ID.HEX), "keypress", _hexOnly, this);
+        Event.on(this.getElement(this.ID.HEX), "blur", function(e, me) {
+                _useFieldValue.call(me, e, this, me.OPT.HEX);
+            }, this);
+    };
+
+
+
+    /**
+     * Updates the rgb attribute with the current state of the r,g,b
+     * fields.  This is invoked from change listeners on these
+     * attributes to facilitate updating these values from the
+     * individual form fields
+     * @method _updateRGB
+     * @private
+     */
+    var _updateRGB = function() {
+        var rgb = [this.get(this.OPT.RED), 
+                   this.get(this.OPT.GREEN),
+                   this.get(this.OPT.BLUE)];
+
+        this.set(this.OPT.RGB, rgb);
+
+        _updateSliders.call(this);
+    };
+
+    /**
+     * Updates the RGB values from the current state of the HSV
+     * values.  Executed when the one of the HSV form fields are
+     * updated
+     * _updateRGBFromHSV
+     * @private
+     */
+    var _updateRGBFromHSV = function() {
+        var hsv = [this.get(this.OPT.HUE), 
+                   this.get(this.OPT.SATURATION)/100,
+                   this.get(this.OPT.VALUE)/100];
+
+        var rgb = Color.hsv2rgb(hsv);
+
+        this.set(this.OPT.RGB, rgb);
+
+        _updateSliders.call(this);
+    };
+
+    /**
+     * Parses the hex string to normalize shorthand values, converts
+     * the hex value to rgb and updates the rgb attribute (which
+     * updates the state for all of the other values)
+     * method _updateHex
+     * @private
+     */
+    var _updateHex = function() {
+       
+        var hex = this.get(this.OPT.HEX), l=hex.length;
+
+        // support #369 -> #336699 shorthand
+        if (l === 3) {
+            var c = hex.split(""), i;
+            for (i=0; i<l; i=i+1) {
+                c[i] = c[i] + c[i];
+            }
+
+            hex = c.join("");
+        }
+
+        if (hex.length !== 6) {
+            return false;
+        }
+
+        var rgb = Color.hex2rgb(hex);
+
+
+        this.setValue(rgb);
+
+        //_updateSliders.call(this);
+
+    };
+
+
+
+    /**
+     * Sets up the config attributes and the change listeners for this
+     * properties
+     * @method initAttributes
+     * @param attr An object containing default attribute values
+     */
+    proto.initAttributes = function(attr) {
+
+        attr = attr || {};
+        YAHOO.widget.ColorPicker.superclass.initAttributes.call(this, attr);
+        
+        /**
+         * The size of the picker. Trying to change this is not recommended.
+         * @attribute pickersize
+         * @default 180
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.PICKER_SIZE, {
+                value: attr.size || this.DEFAULT.PICKER_SIZE
+            });
+
+        /**
+         * The current hue value 0-360
+         * @attribute hue
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.HUE, {
+                value: attr.hue || 0,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current saturation value 0-100
+         * @attribute saturation
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.SATURATION, {
+                value: attr.saturation || 0,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current value/brightness value 0-100
+         * @attribute value
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.VALUE, {
+                value: attr.value || 100,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current red value 0-255
+         * @attribute red
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.RED, {
+                value: attr.red || 255,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current green value 0-255
+         * @attribute green 
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.GREEN, {
+                value: attr.red || 255,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current blue value 0-255
+         * @attribute blue
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.BLUE, {
+                value: attr.blue || 255,
+                validator: lang.isNumber
+            });
+
+        /**
+         * The current hex value #000000-#FFFFFF, without the #
+         * @attribute hex
+         * @type string
+         */
+        this.setAttributeConfig(this.OPT.HEX, {
+                value: attr.hex || "FFFFFF",
+                validator: lang.isString
+            });
+
+        /**
+         * The current rgb value.  Updates the state of all of the
+         * other value fields.  Read-only: use setValue to set the
+         * controls rgb value.
+         * @attribute hex
+         * @type [int, int, int]
+         * @readonly
+         */
+        this.setAttributeConfig(this.OPT.RGB, {
+                value: attr.rgb || [255,255,255],
+                method: function(rgb) {
+
+                    this.set(this.OPT.RED, rgb[0], true);
+                    this.set(this.OPT.GREEN, rgb[1], true);
+                    this.set(this.OPT.BLUE, rgb[2], true);
+
+                    var websafe = Color.websafe(rgb);
+                    this.set(this.OPT.WEBSAFE, websafe, true);
+
+                    var hex = Color.rgb2hex(rgb);
+                    this.set(this.OPT.HEX, hex, true);
+
+                    var hsv = Color.rgb2hsv(rgb);
+
+
+                    this.set(this.OPT.HUE, hsv[0], true);
+                    this.set(this.OPT.SATURATION, Math.round(hsv[1]*100), true);
+                    this.set(this.OPT.VALUE, Math.round(hsv[2]*100), true);
+                },
+                readonly: true
+            });
+
+        /**
+         * If the color picker will live inside of a container object,
+         * set, provide a reference to it so the control can use the
+         * container's events.
+         * @attribute container
+         * @type YAHOO.widget.Panel
+         */
+        this.setAttributeConfig(this.OPT.CONTAINER, {
+                    value: null,
+                    method: function(container) {
+                        if (container) {
+                            // Position can get out of sync when the
+                            // control is manipulated while display is
+                            // none.  Resetting the slider constraints
+                            // when it is visible gets the state back in
+                            // order.
+                            container.showEvent.subscribe(function() {
+                                // this.pickerSlider.thumb.resetConstraints();
+                                // this.hueSlider.thumb.resetConstraints();
+                                this.pickerSlider.focus();
+                            }, this, true);
+                        }
+                    }
+                });
+        /**
+         * The closest current websafe value
+         * @attribute websafe
+         * @type int
+         */
+        this.setAttributeConfig(this.OPT.WEBSAFE, {
+                value: attr.websafe || [255,255,255]
+            });
+
+
+        var ids = attr.ids || lang.merge({}, this.ID);
+
+        if (!attr.ids && _pickercount > 1) {
+            for (var i in ids) {
+                if (lang.hasOwnProperty(ids, i)) {
+                    ids[i] = ids[i] + _pickercount;
+                }
+            }
+        }
+
+
+        /**
+         * A list of element ids and/or element references used by the 
+         * control.  The default is the this.ID list, and can be customized
+         * by passing a list in the contructor
+         * @attribute ids
+         * @type {referenceid: realid}
+         * @writeonce
+         */
+        this.setAttributeConfig(this.OPT.IDS, {
+                value: ids,
+                writeonce: true
+            });
+
+        /**
+         * A list of txt strings for internationalization.  Default
+         * is this.TXT
+         * @attribute txt
+         * @type {key: txt}
+         * @writeonce
+         */
+        this.setAttributeConfig(this.OPT.TXT, {
+                value: attr.txt || this.TXT,
+                writeonce: true
+            });
+
+        /**
+         * The img src default list
+         * is this.IMAGES
+         * @attribute images
+         * @type {key: image}
+         * @writeonce
+         */
+        this.setAttributeConfig(this.OPT.IMAGES, {
+                value: attr.images || this.IMAGE,
+                writeonce: true
+            });
+        /**
+         * The element refs used by this control.  Set at initialization
+         * @attribute elements
+         * @type {id: HTMLElement}
+         * @readonly
+         */
+        this.setAttributeConfig(this.OPT.ELEMENTS, {
+                value: {},
+                readonly: true
+            });
+
+        /**
+         * Returns the cached element reference.  If the id is not a string, it
+         * is assumed that it is an element and this is returned.
+         * @param id {string|HTMLElement} the element key, id, or ref
+         * @param on {boolean} hide or show.  If true, show
+         * @private */
+        var _hideShowEl = function(id, on) {
+            var el = (lang.isString(id) ? this.getElement(id) : id);
+            //Dom.setStyle(id, "visibility", (on) ? "" : "hidden");
+            Dom.setStyle(el, "display", (on) ? "" : "none");
+        };
+
+        /**
+         * Hide/show the entire set of controls
+         * @attribute showcontrols
+         * @type boolean
+         * @default true
+         */
+        this.setAttributeConfig(this.OPT.SHOW_CONTROLS, {
+                value: (attr.showcontrols) || true,
+                method: function(on) {
+
+                    var el = Dom.getElementsByClassName("bd", "div", 
+                            this.getElement(this.ID.CONTROLS))[0];
+
+                    _hideShowEl.call(this, el, on);
+
+                    this.getElement(this.ID.CONTROLS_LABEL).innerHTML = 
+                        (on) ? this.get(this.OPT.TXT).HIDE_CONTROLS :
+                               this.get(this.OPT.TXT).SHOW_CONTROLS;
+
+                }
+            });
+
+        /**
+         * Hide/show the rgb controls
+         * @attribute showrgbcontrols
+         * @type boolean
+         * @default true
+         */
+        this.setAttributeConfig(this.OPT.SHOW_RGB_CONTROLS, {
+                value: (attr.showrgbcontrols) || true,
+                method: function(on) {
+                    //Dom.setStyle(this.getElement(this.ID.RBG_CONTROLS), "visibility", (on) ? "" : "hidden");
+                    _hideShowEl.call(this, this.ID.RGB_CONTROLS, on);
+                }
+            });
+
+        /**
+         * Hide/show the hsv controls
+         * @attribute showhsvcontrols
+         * @type boolean
+         * @default false
+         */
+        this.setAttributeConfig(this.OPT.SHOW_HSV_CONTROLS, {
+                value: (attr.showhsvcontrols) || false,
+                method: function(on) {
+                    //Dom.setStyle(this.getElement(this.ID.HSV_CONTROLS), "visibility", (on) ? "" : "hidden");
+                    _hideShowEl.call(this, this.ID.HSV_CONTROLS, on);
+
+                    // can't show both the hsv controls and the rbg hex summary
+                    if (on && this.get(this.OPT.SHOW_HEX_SUMMARY)) {
+                        this.set(this.OPT.SHOW_HEX_SUMMARY, false);
+                    }
+                }
+            });
+
+        /**
+         * Hide/show the hex controls
+         * @attribute showhexcontrols
+         * @type boolean
+         * @default true
+         */
+        this.setAttributeConfig(this.OPT.SHOW_HEX_CONTROLS, {
+                value: (attr.showhexcontrols) || false,
+                method: function(on) {
+                    _hideShowEl.call(this, this.ID.HEX_CONTROLS, on);
+                }
+            });
+
+        /**
+         * Hide/show the websafe swatch
+         * @attribute showwebsafe
+         * @type boolean
+         * @default true
+         */
+        this.setAttributeConfig(this.OPT.SHOW_WEBSAFE, {
+                value: (attr.showwebsafe) || true,
+                method: function(on) {
+                    _hideShowEl.call(this, this.ID.WEBSAFE_SWATCH, on);
+                }
+            });
+
+        /**
+         * Hide/show the hex summary
+         * @attribute showhexsummary
+         * @type boolean
+         * @default true
+         */
+        this.setAttributeConfig(this.OPT.SHOW_HEX_SUMMARY, {
+                value: (attr.showhexsummary) || true,
+                method: function(on) {
+                    _hideShowEl.call(this, this.ID.HEX_SUMMARY, on);
+
+                    // can't show both the hsv controls and the rbg hex summary
+                    if (on && this.get(this.OPT.SHOW_HSV_CONTROLS)) {
+                        this.set(this.OPT.SHOW_HSV_CONTROLS, false);
+                    }
+                }
+            });
+        this.setAttributeConfig(this.OPT.ANIMATE, {
+                value: (attr.animate) || true,
+                method: function(on) {
+                    this.pickerSlider.animate = on;
+                    this.hueSlider.animate = on;
+                }
+            });
+
+        this.on(this.OPT.HUE + "Change", _updateRGBFromHSV, this, true);
+        this.on(this.OPT.SATURATION + "Change", _updateRGBFromHSV, this, true);
+        this.on(this.OPT.VALUE + "Change", _updatePickerSlider, this, true);
+
+        this.on(this.OPT.RED + "Change", _updateRGB, this, true);
+        this.on(this.OPT.GREEN + "Change", _updateRGB, this, true);
+        this.on(this.OPT.BLUE + "Change", _updateRGB, this, true);
+
+        this.on(this.OPT.HEX + "Change", _updateHex, this, true);
+
+        this.initPicker();
+    };
+
+
+
+
+})();
+YAHOO.register("colorpicker", YAHOO.widget.ColorPicker, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/connection.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/connection.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/connection.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1357 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * 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.
+ *
+ * @namespace YAHOO.util
+ * @module connection
+ * @requires yahoo
+ * @requires event
+ */
+
+/**
+ * The Connection Manager singleton provides methods for creating and managing
+ * asynchronous transactions.
+ *
+ * @class Connect
+ */
+
+YAHOO.util.Connect =
+{
+  /**
+   * @description Array of MSFT ActiveX ids for XMLHttpRequest.
+   * @property _msxml_progid
+   * @private
+   * @static
+   * @type array
+   */
+	_msxml_progid:[
+		'Microsoft.XMLHTTP',
+		'MSXML2.XMLHTTP.3.0',
+		'MSXML2.XMLHTTP'
+		],
+
+  /**
+   * @description Object literal of HTTP header(s)
+   * @property _http_header
+   * @private
+   * @static
+   * @type object
+   */
+	_http_headers:{},
+
+  /**
+   * @description Determines if HTTP headers are set.
+   * @property _has_http_headers
+   * @private
+   * @static
+   * @type boolean
+   */
+	_has_http_headers:false,
+
+ /**
+  * @description 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.
+  * @property _use_default_post_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _use_default_post_header:true,
+
+ /**
+  * @description The default header used for POST transactions.
+  * @property _default_post_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',
+
+ /**
+  * @description The default header used for transactions involving the
+  * use of HTML forms.
+  * @property _default_form_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _default_form_header:'application/x-www-form-urlencoded',
+
+ /**
+  * @description Determines if a default header of
+  * 'X-Requested-With: XMLHttpRequest'
+  * will be added to each transaction.
+  * @property _use_default_xhr_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _use_default_xhr_header:true,
+
+ /**
+  * @description The default header value for the label
+  * "X-Requested-With".  This is sent with each
+  * transaction, by default, to identify the
+  * request as being made by YUI Connection Manager.
+  * @property _default_xhr_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _default_xhr_header:'XMLHttpRequest',
+
+ /**
+  * @description Determines if custom, default headers
+  * are set for each transaction.
+  * @property _has_default_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _has_default_headers:true,
+
+ /**
+  * @description Determines if custom, default headers
+  * are set for each transaction.
+  * @property _has_default_header
+  * @private
+  * @static
+  * @type boolean
+  */
+    _default_headers:{},
+
+ /**
+  * @description Property modified by setForm() to determine if the data
+  * should be submitted as an HTML form.
+  * @property _isFormSubmit
+  * @private
+  * @static
+  * @type boolean
+  */
+    _isFormSubmit:false,
+
+ /**
+  * @description Property modified by setForm() to determine if a file(s)
+  * upload is expected.
+  * @property _isFileUpload
+  * @private
+  * @static
+  * @type boolean
+  */
+    _isFileUpload:false,
+
+ /**
+  * @description Property modified by setForm() to set a reference to the HTML
+  * form node if the desired action is file upload.
+  * @property _formNode
+  * @private
+  * @static
+  * @type object
+  */
+    _formNode:null,
+
+ /**
+  * @description Property modified by setForm() to set the HTML form data
+  * for each transaction.
+  * @property _sFormData
+  * @private
+  * @static
+  * @type string
+  */
+    _sFormData:null,
+
+ /**
+  * @description Collection of polling references to the polling mechanism in handleReadyState.
+  * @property _poll
+  * @private
+  * @static
+  * @type object
+  */
+    _poll:{},
+
+ /**
+  * @description Queue of timeout values for each transaction callback with a defined timeout value.
+  * @property _timeOut
+  * @private
+  * @static
+  * @type object
+  */
+    _timeOut:{},
+
+  /**
+   * @description The polling frequency, in milliseconds, for HandleReadyState.
+   * when attempting to determine a transaction's XHR readyState.
+   * The default is 50 milliseconds.
+   * @property _polling_interval
+   * @private
+   * @static
+   * @type int
+   */
+     _polling_interval:50,
+
+  /**
+   * @description A transaction counter that increments the transaction id for each transaction.
+   * @property _transaction_id
+   * @private
+   * @static
+   * @type int
+   */
+     _transaction_id:0,
+
+  /**
+   * @description Tracks the name-value pair of the "clicked" submit button if multiple submit
+   * buttons are present in an HTML form; and, if YAHOO.util.Event is available.
+   * @property _submitElementValue
+   * @private
+   * @static
+   * @type string
+   */
+	 _submitElementValue:null,
+
+  /**
+   * @description Determines whether YAHOO.util.Event is available and returns true or false.
+   * If true, an event listener is bound at the document level to trap click events that
+   * resolve to a target type of "Submit".  This listener will enable setForm() to determine
+   * the clicked "Submit" value in a multi-Submit button, HTML form.
+   * @property _hasSubmitListener
+   * @private
+   * @static
+   */
+	 _hasSubmitListener:(function()
+	 {
+		if(YAHOO.util.Event){
+			YAHOO.util.Event.addListener(
+				document,
+				'click',
+				function(e){
+					try
+					{
+						var obj = YAHOO.util.Event.getTarget(e);
+						if(obj.type.toLowerCase() == 'submit'){
+							YAHOO.util.Connect._submitElementValue = encodeURIComponent(obj.name) + "=" + encodeURIComponent(obj.value);
+						}
+					}
+					catch(e){}
+				});
+			return true;
+	    }
+	    return false;
+	 })(),
+
+  /**
+   * @description Custom event that fires at the start of a transaction
+   * @property startEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	startEvent: new YAHOO.util.CustomEvent('start'),
+
+  /**
+   * @description Custom event that fires when a transaction response has completed.
+   * @property completeEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	completeEvent: new YAHOO.util.CustomEvent('complete'),
+
+  /**
+   * @description Custom event that fires when handleTransactionResponse() determines a
+   * response in the HTTP 2xx range.
+   * @property successEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	successEvent: new YAHOO.util.CustomEvent('success'),
+
+  /**
+   * @description Custom event that fires when handleTransactionResponse() determines a
+   * response in the HTTP 4xx/5xx range.
+   * @property failureEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	failureEvent: new YAHOO.util.CustomEvent('failure'),
+
+  /**
+   * @description Custom event that fires when handleTransactionResponse() determines a
+   * response in the HTTP 4xx/5xx range.
+   * @property failureEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	uploadEvent: new YAHOO.util.CustomEvent('upload'),
+
+  /**
+   * @description Custom event that fires when a transaction is successfully aborted.
+   * @property abortEvent
+   * @private
+   * @static
+   * @type CustomEvent
+   */
+	abortEvent: new YAHOO.util.CustomEvent('abort'),
+
+  /**
+   * @description A reference table that maps callback custom events members to its specific
+   * event name.
+   * @property _customEvents
+   * @private
+   * @static
+   * @type object
+   */
+	_customEvents:
+	{
+		onStart:['startEvent', 'start'],
+		onComplete:['completeEvent', 'complete'],
+		onSuccess:['successEvent', 'success'],
+		onFailure:['failureEvent', 'failure'],
+		onUpload:['uploadEvent', 'upload'],
+		onAbort:['abortEvent', 'abort']
+	},
+
+  /**
+   * @description 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.
+   * @method setProgId
+   * @public
+   * @static
+   * @param {string} id The ActiveX id to be added to initialize the XHR object.
+   * @return void
+   */
+	setProgId:function(id)
+	{
+		this._msxml_progid.unshift(id);
+	},
+
+  /**
+   * @description Member to override the default POST header.
+   * @method setDefaultPostHeader
+   * @public
+   * @static
+   * @param {boolean} b Set and use default header - true or false .
+   * @return void
+   */
+	setDefaultPostHeader:function(b)
+	{
+		if(typeof b == 'string'){
+			this._default_post_header = b;
+		}
+		else if(typeof b == 'boolean'){
+			this._use_default_post_header = b;
+		}
+	},
+
+  /**
+   * @description Member to override the default transaction header..
+   * @method setDefaultXhrHeader
+   * @public
+   * @static
+   * @param {boolean} b Set and use default header - true or false .
+   * @return void
+   */
+	setDefaultXhrHeader:function(b)
+	{
+		if(typeof b == 'string'){
+			this._default_xhr_header = b;
+		}
+		else{
+			this._use_default_xhr_header = b;
+		}
+	},
+
+  /**
+   * @description Member to modify the default polling interval.
+   * @method setPollingInterval
+   * @public
+   * @static
+   * @param {int} i The polling interval in milliseconds.
+   * @return void
+   */
+	setPollingInterval:function(i)
+	{
+		if(typeof i == 'number' && isFinite(i)){
+			this._polling_interval = i;
+		}
+	},
+
+  /**
+   * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
+   * the XMLHttpRequest instance and the transaction id.
+   * @method createXhrObject
+   * @private
+   * @static
+   * @param {int} transactionId Property containing the transaction id for this transaction.
+   * @return 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 conn and tId properties
+					obj = { conn:http, tId:transactionId };
+					break;
+				}
+				catch(e){}
+			}
+		}
+		finally
+		{
+			return obj;
+		}
+	},
+
+  /**
+   * @description 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.
+   * @method getConnectionObject
+   * @private
+   * @static
+   * @return {object}
+   */
+	getConnectionObject:function(isFileUpload)
+	{
+		var o;
+		var tId = this._transaction_id;
+
+		try
+		{
+			if(!isFileUpload){
+				o = this.createXhrObject(tId);
+			}
+			else{
+				o = {};
+				o.tId = tId;
+				o.isUpload = true;
+			}
+
+			if(o){
+				this._transaction_id++;
+			}
+		}
+		catch(e){}
+		finally
+		{
+			return o;
+		}
+	},
+
+  /**
+   * @description Method for initiating an asynchronous request via the XHR object.
+   * @method asyncRequest
+   * @public
+   * @static
+   * @param {string} method HTTP transaction method
+   * @param {string} uri Fully qualified path of resource
+   * @param {callback} 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._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();
+
+		if(!o){
+			return null;
+		}
+		else{
+
+			// Intialize any transaction-specific custom events, if provided.
+			if(callback && callback.customevents){
+				this.initCustomEvents(o, callback);
+			}
+
+			if(this._isFormSubmit){
+				if(this._isFileUpload){
+					this.uploadFile(o, callback, uri, postData);
+					return o;
+				}
+
+				// 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.toUpperCase() == 'GET'){
+					if(this._sFormData.length !== 0){
+						// If the URI already contains a querystring, append an ampersand
+						// and then concatenate _sFormData to the URI.
+						uri += ((uri.indexOf('?') == -1)?'?':'&') + this._sFormData;
+					}
+					else{
+						uri += "?" + this._sFormData;
+					}
+				}
+				else if(method.toUpperCase() == 'POST'){
+					// If POST data exist in addition to the HTML form data,
+					// it will be concatenated to the form data.
+					postData = postData?this._sFormData + "&" + postData:this._sFormData;
+				}
+			}
+
+			o.conn.open(method, uri, true);
+
+			// Each transaction will automatically include a custom header of
+			// "X-Requested-With: XMLHttpRequest" to identify the request as
+			// having originated from Connection Manager.
+			if(this._use_default_xhr_header){
+				if(!this._default_headers['X-Requested-With']){
+					this.initHeader('X-Requested-With', this._default_xhr_header, true);
+				}
+			}
+
+			if(this._isFormSubmit == false && this._use_default_post_header){
+				this.initHeader('Content-Type', this._default_post_header);
+			}
+
+			if(this._has_default_headers || this._has_http_headers){
+				this.setHeader(o);
+			}
+
+			this.handleReadyState(o, callback);
+			o.conn.send(postData || null);
+
+			// Fire global custom event -- startEvent
+			this.startEvent.fire(o);
+
+			if(o.startEvent){
+				// Fire transaction custom event -- startEvent
+				o.startEvent.fire(o);
+			}
+
+			return o;
+		}
+	},
+
+  /**
+   * @description This method creates and subscribes custom events,
+   * specific to each transaction
+   * @method initCustomEvents
+   * @private
+   * @static
+   * @param {object} o The connection object
+   * @param {callback} callback The user-defined callback object
+   * @return {void}
+   */
+	initCustomEvents:function(o, callback)
+	{
+		// Enumerate through callback.customevents members and bind/subscribe
+		// events that match in the _customEvents table.
+		for(var prop in callback.customevents){
+			if(this._customEvents[prop][0]){
+				// Create the custom event
+				o[this._customEvents[prop][0]] = new YAHOO.util.CustomEvent(this._customEvents[prop][1], (callback.scope)?callback.scope:null);
+
+				// Subscribe the custom event
+				o[this._customEvents[prop][0]].subscribe(callback.customevents[prop]);
+			}
+		}
+	},
+
+  /**
+   * @description 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.
+   * @method handleReadyState
+   * @private
+   * @static
+   * @param {object} o The connection object
+   * @param {callback} callback The user-defined callback object
+   * @return {void}
+   */
+
+    handleReadyState:function(o, callback)
+
+    {
+		var oConn = this;
+
+		if(callback && callback.timeout){
+			this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true); }, callback.timeout);
+		}
+
+		this._poll[o.tId] = window.setInterval(
+			function(){
+				if(o.conn && o.conn.readyState === 4){
+
+					// Clear the polling interval for the transaction
+					// and remove the reference from _poll.
+					window.clearInterval(oConn._poll[o.tId]);
+					delete oConn._poll[o.tId];
+
+					if(callback && callback.timeout){
+						window.clearTimeout(oConn._timeOut[o.tId]);
+						delete oConn._timeOut[o.tId];
+					}
+
+					// Fire global custom event -- completeEvent
+					oConn.completeEvent.fire(o);
+
+					if(o.completeEvent){
+						// Fire transaction custom event -- completeEvent
+						o.completeEvent.fire(o);
+					}
+
+					oConn.handleTransactionResponse(o, callback);
+				}
+			}
+		,this._polling_interval);
+    },
+
+  /**
+   * @description This method attempts to interpret the server response and
+   * determine whether the transaction was successful, or if an error or
+   * exception was encountered.
+   * @method handleTransactionResponse
+   * @private
+   * @static
+   * @param {object} o The connection object
+   * @param {object} callback The user-defined callback object
+   * @param {boolean} isAbort Determines if the transaction was terminated via abort().
+   * @return {void}
+   */
+    handleTransactionResponse:function(o, callback, isAbort)
+    {
+
+		var httpStatus, responseObject;
+
+		try
+		{
+			if(o.conn.status !== undefined && o.conn.status !== 0){
+				httpStatus = o.conn.status;
+			}
+			else{
+				httpStatus = 13030;
+			}
+		}
+		catch(e){
+
+			 // 13030 is a custom code to indicate the condition -- in Mozilla/FF --
+			 // when the XHR object's status and statusText properties are
+			 // unavailable, and a query attempt throws an exception.
+			httpStatus = 13030;
+		}
+
+		if(httpStatus >= 200 && httpStatus < 300 || httpStatus === 1223){
+			responseObject = this.createResponseObject(o, (callback && callback.argument)?callback.argument:undefined);
+			if(callback){
+				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]);
+					}
+				}
+			}
+
+			// Fire global custom event -- successEvent
+			this.successEvent.fire(responseObject);
+
+			if(o.successEvent){
+				// Fire transaction custom event -- successEvent
+				o.successEvent.fire(responseObject);
+			}
+		}
+		else{
+			switch(httpStatus){
+				// The following cases are wininet.dll error codes that may be encountered.
+				case 12002: // Server timeout
+				case 12029: // 12029 to 12031 correspond to dropped connections.
+				case 12030:
+				case 12031:
+				case 12152: // Connection closed by server.
+				case 13030: // See above comments for variable status.
+					responseObject = this.createExceptionObject(o.tId, (callback && callback.argument)?callback.argument:undefined, (isAbort?isAbort:false));
+					if(callback){
+						if(callback.failure){
+							if(!callback.scope){
+								callback.failure(responseObject);
+							}
+							else{
+								callback.failure.apply(callback.scope, [responseObject]);
+							}
+						}
+					}
+
+					break;
+				default:
+					responseObject = this.createResponseObject(o, (callback && callback.argument)?callback.argument:undefined);
+					if(callback){
+						if(callback.failure){
+							if(!callback.scope){
+								callback.failure(responseObject);
+							}
+							else{
+								callback.failure.apply(callback.scope, [responseObject]);
+							}
+						}
+					}
+			}
+
+			// Fire global custom event -- failureEvent
+			this.failureEvent.fire(responseObject);
+
+			if(o.failureEvent){
+				// Fire transaction custom event -- failureEvent
+				o.failureEvent.fire(responseObject);
+			}
+
+		}
+
+		this.releaseObject(o);
+		responseObject = null;
+    },
+
+  /**
+   * @description 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.
+   * @method createResponseObject
+   * @private
+   * @static
+   * @param {object} o The connection object
+   * @param {callbackArg} callbackArg The 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+2);
+				}
+			}
+		}
+		catch(e){}
+
+		obj.tId = o.tId;
+		// Normalize IE's response to HTTP 204 when Win error 1223.
+		obj.status = (o.conn.status == 1223)?204:o.conn.status;
+		// Normalize IE's statusText to "No Content" instead of "Unknown".
+		obj.statusText = (o.conn.status == 1223)?"No Content":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;
+    },
+
+  /**
+   * @description 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.
+   *
+   * @method createExceptionObject
+   * @private
+   * @static
+   * @param {int} tId The Transaction Id
+   * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
+   * @param {boolean} isAbort Determines if the exception case is caused by a transaction 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;
+    },
+
+  /**
+   * @description Method that initializes the custom HTTP headers for the each transaction.
+   * @method initHeader
+   * @public
+   * @static
+   * @param {string} label The HTTP header label
+   * @param {string} value The HTTP header value
+   * @param {string} isDefault Determines if the specific header is a default header
+   * automatically sent with each transaction.
+   * @return {void}
+   */
+	initHeader:function(label, value, isDefault)
+	{
+		var headerObj = (isDefault)?this._default_headers:this._http_headers;
+		headerObj[label] = value;
+
+		if(isDefault){
+			this._has_default_headers = true;
+		}
+		else{
+			this._has_http_headers = true;
+		}
+	},
+
+
+  /**
+   * @description Accessor that sets the HTTP headers for each transaction.
+   * @method setHeader
+   * @private
+   * @static
+   * @param {object} o The connection object for the transaction.
+   * @return {void}
+   */
+	setHeader:function(o)
+	{
+		if(this._has_default_headers){
+			for(var prop in this._default_headers){
+				if(YAHOO.lang.hasOwnProperty(this._default_headers, prop)){
+					o.conn.setRequestHeader(prop, this._default_headers[prop]);
+				}
+			}
+		}
+
+		if(this._has_http_headers){
+			for(var prop in this._http_headers){
+				if(YAHOO.lang.hasOwnProperty(this._http_headers, prop)){
+					o.conn.setRequestHeader(prop, this._http_headers[prop]);
+				}
+			}
+			delete this._http_headers;
+
+			this._http_headers = {};
+			this._has_http_headers = false;
+		}
+	},
+
+  /**
+   * @description Resets the default HTTP headers object
+   * @method resetDefaultHeaders
+   * @public
+   * @static
+   * @return {void}
+   */
+	resetDefaultHeaders:function(){
+		delete this._default_headers;
+		this._default_headers = {};
+		this._has_default_headers = false;
+	},
+
+  /**
+   * @description This method assembles the form label and value pairs and
+   * constructs an encoded string.
+   * asyncRequest() will automatically initialize the transaction with a
+   * a HTTP header Content-Type of application/x-www-form-urlencoded.
+   * @method setForm
+   * @public
+   * @static
+   * @param {string || object} form id or name attribute, or form object.
+   * @param {boolean} optional enable file upload.
+   * @param {boolean} optional enable file upload over SSL in IE only.
+   * @return {string} string of the HTML form field name and value pairs..
+   */
+	setForm:function(formId, isUpload, secureUri)
+	{
+		this.resetFormState();
+
+		var oForm;
+		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.
+			oForm = (document.getElementById(formId) || document.forms[formId]);
+		}
+		else if(typeof formId == 'object'){
+			// Treat argument as an HTML form object.
+			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){
+
+			// Create iframe in preparation for file upload.
+			var io = this.createFrame(secureUri?secureUri:null);
+			// Set form reference and file upload properties to true.
+			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++){
+			oElement = oForm.elements[i];
+			oDisabled = oForm.elements[i].disabled;
+			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){
+								if(window.ActiveXObject){
+									this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text) + '&';
+								}
+								else{
+									this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].hasAttribute('value')?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){
+							if(this._hasSubmitListener && this._submitElementValue){
+								this._sFormData += this._submitElementValue + '&';
+							}
+							else{
+								this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+							}
+
+							hasSubmit = true;
+						}
+						break;
+					default:
+						this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
+				}
+			}
+		}
+
+		this._isFormSubmit = true;
+		this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1);
+
+
+		this.initHeader('Content-Type', this._default_form_header);
+
+		return this._sFormData;
+	},
+
+  /**
+   * @description Resets HTML form properties when an HTML form or HTML form
+   * with file upload transaction is sent.
+   * @method resetFormState
+   * @private
+   * @static
+   * @return {void}
+   */
+	resetFormState:function(){
+		this._isFormSubmit = false;
+		this._isFileUpload = false;
+		this._formNode = null;
+		this._sFormData = "";
+	},
+
+  /**
+   * @description Creates an iframe to be used for form file uploads.  It is remove from the
+   * document upon completion of the upload transaction.
+   * @method createFrame
+   * @private
+   * @static
+   * @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 object
+		// properties via createElement().  A different iframe creation
+		// pattern is required for IE.
+		var frameId = 'yuiIO' + this._transaction_id;
+		var io;
+		if(window.ActiveXObject){
+			io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
+
+			// IE will throw a security exception in an SSL environment if the
+			// iframe source is undefined.
+			if(typeof secureUri == 'boolean'){
+				io.src = 'javascript:false';
+			}
+			else if(typeof secureURI == 'string'){
+				// Deprecated
+				io.src = secureUri;
+			}
+		}
+		else{
+			io = document.createElement('iframe');
+			io.id = frameId;
+			io.name = frameId;
+		}
+
+		io.style.position = 'absolute';
+		io.style.top = '-1000px';
+		io.style.left = '-1000px';
+
+		document.body.appendChild(io);
+	},
+
+  /**
+   * @description Parses the POST data and creates hidden form elements
+   * for each key-value, and appends them to the HTML form object.
+   * @method appendPostData
+   * @private
+   * @static
+   * @param {string} postData The HTTP POST data
+   * @return {array} formElements Collection of hidden fields.
+   */
+	appendPostData:function(postData)
+	{
+		var formElements = [];
+		var postMessage = postData.split('&');
+		for(var i=0; i < postMessage.length; i++){
+			var delimitPos = postMessage[i].indexOf('=');
+			if(delimitPos != -1){
+				formElements[i] = document.createElement('input');
+				formElements[i].type = 'hidden';
+				formElements[i].name = postMessage[i].substring(0,delimitPos);
+				formElements[i].value = postMessage[i].substring(delimitPos+1);
+				this._formNode.appendChild(formElements[i]);
+			}
+		}
+
+		return formElements;
+	},
+
+  /**
+   * @description Uploads HTML form, inclusive of files/attachments, using the
+   * iframe created in createFrame to facilitate the transaction.
+   * @method uploadFile
+   * @private
+   * @static
+   * @param {int} id The transaction id.
+   * @param {object} callback User-defined callback object.
+   * @param {string} uri Fully qualified path of resource.
+   * @param {string} postData POST data to be submitted in addition to HTML form.
+   * @return {void}
+   */
+	uploadFile:function(o, callback, uri, postData){
+
+		// Each iframe has an id prefix of "yuiIO" followed
+		// by the unique transaction id.
+		var frameId = 'yuiIO' + o.tId;
+		var uploadEncoding = 'multipart/form-data';
+		var io = document.getElementById(frameId);
+		var oConn = this;
+
+		// Track original HTML form attribute values.
+		var rawFormAttributes =
+		{
+			action:this._formNode.getAttribute('action'),
+			method:this._formNode.getAttribute('method'),
+			target:this._formNode.getAttribute('target')
+		};
+
+		// Initialize the HTML form properties in case they are
+		// not defined in the HTML form.
+		this._formNode.setAttribute('action', uri);
+		this._formNode.setAttribute('method', 'POST');
+		this._formNode.setAttribute('target', frameId);
+
+		if(this._formNode.encoding){
+			// IE does not respect property enctype for HTML forms.
+			// Instead it uses the property - "encoding".
+			this._formNode.setAttribute('encoding', uploadEncoding);
+		}
+		else{
+			this._formNode.setAttribute('enctype', uploadEncoding);
+		}
+
+		if(postData){
+			var oElements = this.appendPostData(postData);
+		}
+
+		// Start file upload.
+		this._formNode.submit();
+
+		// Fire global custom event -- startEvent
+		this.startEvent.fire(o);
+
+		if(o.startEvent){
+			// Fire transaction custom event -- startEvent
+			o.startEvent.fire(o);
+		}
+
+		// Start polling if a callback is present and the timeout
+		// property has been defined.
+		if(callback && callback.timeout){
+			this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true); }, callback.timeout);
+		}
+
+		// Remove HTML elements created by appendPostData
+		if(oElements && oElements.length > 0){
+			for(var i=0; i < oElements.length; i++){
+				this._formNode.removeChild(oElements[i]);
+			}
+		}
+
+		// Restore HTML form attributes to their original
+		// values prior to file upload.
+		for(var prop in rawFormAttributes){
+			if(YAHOO.lang.hasOwnProperty(rawFormAttributes, prop)){
+				if(rawFormAttributes[prop]){
+					this._formNode.setAttribute(prop, rawFormAttributes[prop]);
+				}
+				else{
+					this._formNode.removeAttribute(prop);
+				}
+			}
+		}
+
+		// Reset HTML form state properties.
+		this.resetFormState();
+
+		// 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()
+		{
+			if(callback && callback.timeout){
+				window.clearTimeout(oConn._timeOut[o.tId]);
+				delete oConn._timeOut[o.tId];
+			}
+
+			// Fire global custom event -- completeEvent
+			oConn.completeEvent.fire(o);
+
+			if(o.completeEvent){
+				// Fire transaction custom event -- completeEvent
+				o.completeEvent.fire(o);
+			}
+
+			var obj = {};
+			obj.tId = o.tId;
+			obj.argument = callback.argument;
+
+			try
+			{
+				// responseText and responseXML will be populated with the same data from the iframe.
+				// Since the HTTP headers cannot be read from the iframe
+				obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:io.contentWindow.document.documentElement.textContent;
+				obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
+			}
+			catch(e){}
+
+			if(callback && callback.upload){
+				if(!callback.scope){
+					callback.upload(obj);
+				}
+				else{
+					callback.upload.apply(callback.scope, [obj]);
+				}
+			}
+
+			// Fire global custom event -- uploadEvent
+			oConn.uploadEvent.fire(obj);
+
+			if(o.uploadEvent){
+				// Fire transaction custom event -- uploadEvent
+				o.uploadEvent.fire(obj);
+			}
+
+			YAHOO.util.Event.removeListener(io, "load", uploadCallback);
+
+			setTimeout(
+				function(){
+					document.body.removeChild(io);
+					oConn.releaseObject(o);
+				}, 100);
+		};
+
+		// Bind the onload handler to the iframe to detect the file upload response.
+		YAHOO.util.Event.addListener(io, "load", uploadCallback);
+	},
+
+  /**
+   * @description Method to terminate a transaction, if it has not reached readyState 4.
+   * @method abort
+   * @public
+   * @static
+   * @param {object} o The connection object returned by asyncRequest.
+   * @param {object} callback  User-defined callback object.
+   * @param {string} isTimeout boolean to indicate if abort resulted from a callback timeout.
+   * @return {boolean}
+   */
+	abort:function(o, callback, isTimeout)
+	{
+		var abortStatus;
+
+		if(o.conn){
+			if(this.isCallInProgress(o)){
+				// Issue abort request
+				o.conn.abort();
+
+				window.clearInterval(this._poll[o.tId]);
+				delete this._poll[o.tId];
+
+				if(isTimeout){
+					window.clearTimeout(this._timeOut[o.tId]);
+					delete this._timeOut[o.tId];
+				}
+
+				abortStatus = true;
+			}
+		}
+		else if(o.isUpload === true){
+			var frameId = 'yuiIO' + o.tId;
+			var io = document.getElementById(frameId);
+
+			if(io){
+				// Remove the event listener from the iframe.
+				YAHOO.util.Event.removeListener(io, "load", uploadCallback);
+				// Destroy the iframe facilitating the transaction.
+				document.body.removeChild(io);
+
+				if(isTimeout){
+					window.clearTimeout(this._timeOut[o.tId]);
+					delete this._timeOut[o.tId];
+				}
+
+				abortStatus = true;
+			}
+		}
+		else{
+			abortStatus = false;
+		}
+
+		if(abortStatus === true){
+			// Fire global custom event -- abortEvent
+			this.abortEvent.fire(o);
+
+			if(o.abortEvent){
+				// Fire transaction custom event -- abortEvent
+				o.abortEvent.fire(o);
+			}
+
+			this.handleTransactionResponse(o, callback, true);
+		}
+
+		return abortStatus;
+	},
+
+  /**
+   * @description Determines if the transaction is still being processed.
+   * @method isCallInProgress
+   * @public
+   * @static
+   * @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 && o.conn){
+			return o.conn.readyState !== 4 && o.conn.readyState !== 0;
+		}
+		else if(o && o.isUpload === true){
+			var frameId = 'yuiIO' + o.tId;
+			return document.getElementById(frameId)?true:false;
+		}
+		else{
+			return false;
+		}
+	},
+
+  /**
+   * @description Dereference the XHR instance and the connection object after the transaction is completed.
+   * @method releaseObject
+   * @private
+   * @static
+   * @param {object} o The connection object
+   * @return {void}
+   */
+	releaseObject:function(o)
+	{
+		//dereference the XHR instance.
+		if(o.conn){
+			o.conn = null;
+		}
+		//dereference the connection object.
+		o = null;
+	}
+};
+
+YAHOO.register("connection", YAHOO.util.Connect, {version: "2.3.1", build: "541"});
\ No newline at end of file

Added: trunk/examples/RestYUI/root/static/yui/container.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/container.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/container.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,7809 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.util
+    * @class Config
+    * @constructor
+    * @param {Object} owner The owner Object to which this Config Object belongs
+    */
+    YAHOO.util.Config = function (owner) {
+    
+        if (owner) {
+    
+            this.init(owner);
+    
+        }
+    
+        if (!owner) { 
+        
+    
+        }
+    
+    };
+
+
+    var Lang = YAHOO.lang,
+        CustomEvent = YAHOO.util.CustomEvent,        
+        Config = YAHOO.util.Config;
+    
+
+    /**
+     * Constant representing the CustomEvent type for the config changed event.
+     * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
+     * @private
+     * @static
+     * @final
+     */
+    Config.CONFIG_CHANGED_EVENT = "configChanged";
+    
+    /**
+     * Constant representing the boolean type string
+     * @property YAHOO.util.Config.BOOLEAN_TYPE
+     * @private
+     * @static
+     * @final
+     */
+    Config.BOOLEAN_TYPE = "boolean";
+    
+    Config.prototype = {
+     
+        /**
+        * Object reference to the owner of this Config Object
+        * @property owner
+        * @type Object
+        */
+        owner: null,
+        
+        /**
+        * Boolean flag that specifies whether a queue is currently 
+        * being executed
+        * @property queueInProgress
+        * @type Boolean
+        */
+        queueInProgress: false,
+        
+        /**
+        * Maintains the local collection of configuration property objects and 
+        * their specified values
+        * @property config
+        * @private
+        * @type Object
+        */ 
+        config: null,
+        
+        /**
+        * Maintains the local collection of configuration property objects as 
+        * they were initially applied.
+        * This object is used when resetting a property.
+        * @property initialConfig
+        * @private
+        * @type Object
+        */ 
+        initialConfig: null,
+        
+        /**
+        * Maintains the local, normalized CustomEvent queue
+        * @property eventQueue
+        * @private
+        * @type Object
+        */ 
+        eventQueue: null,
+        
+        /**
+        * Custom Event, notifying subscribers when Config properties are set 
+        * (setProperty is called without the silent flag
+        * @event configChangedEvent
+        */
+        configChangedEvent: null,
+    
+        /**
+        * Initializes the configuration Object and all of its local members.
+        * @method init
+        * @param {Object} owner The owner Object to which this Config 
+        * Object belongs
+        */
+        init: function (owner) {
+    
+            this.owner = owner;
+    
+            this.configChangedEvent = 
+                this.createEvent(Config.CONFIG_CHANGED_EVENT);
+    
+            this.configChangedEvent.signature = CustomEvent.LIST;
+            this.queueInProgress = false;
+            this.config = {};
+            this.initialConfig = {};
+            this.eventQueue = [];
+        
+        },
+        
+        /**
+        * Validates that the value passed in is a Boolean.
+        * @method checkBoolean
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */ 
+        checkBoolean: function (val) {
+            return (typeof val == Config.BOOLEAN_TYPE);
+        },
+        
+        /**
+        * Validates that the value passed in is a number.
+        * @method checkNumber
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */
+        checkNumber: function (val) {
+            return (!isNaN(val));
+        },
+        
+        /**
+        * Fires a configuration property event using the specified value. 
+        * @method fireEvent
+        * @private
+        * @param {String} key The configuration property's name
+        * @param {value} Object The value of the correct type for the property
+        */ 
+        fireEvent: function ( key, value ) {
+            var property = this.config[key];
+        
+            if (property && property.event) {
+                property.event.fire(value);
+            } 
+        },
+        
+        /**
+        * Adds a property to the Config Object's private config hash.
+        * @method addProperty
+        * @param {String} key The configuration property's name
+        * @param {Object} propertyObject The Object containing all of this 
+        * property's arguments
+        */
+        addProperty: function ( key, propertyObject ) {
+            key = key.toLowerCase();
+        
+            this.config[key] = propertyObject;
+        
+            propertyObject.event = this.createEvent(key, { scope: this.owner });
+            propertyObject.event.signature = CustomEvent.LIST;
+            
+            
+            propertyObject.key = key;
+        
+            if (propertyObject.handler) {
+                propertyObject.event.subscribe(propertyObject.handler, 
+                    this.owner);
+            }
+        
+            this.setProperty(key, propertyObject.value, true);
+            
+            if (! propertyObject.suppressEvent) {
+                this.queueProperty(key, propertyObject.value);
+            }
+            
+        },
+        
+        /**
+        * Returns a key-value configuration map of the values currently set in  
+        * the Config Object.
+        * @method getConfig
+        * @return {Object} The current config, represented in a key-value map
+        */
+        getConfig: function () {
+        
+            var cfg = {},
+                prop,
+                property;
+                
+            for (prop in this.config) {
+                property = this.config[prop];
+                if (property && property.event) {
+                    cfg[prop] = property.value;
+                }
+            }
+            
+            return cfg;
+        },
+        
+        /**
+        * Returns the value of specified property.
+        * @method getProperty
+        * @param {String} key The name of the property
+        * @return {Object}  The value of the specified property
+        */
+        getProperty: function (key) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.value;
+            } else {
+                return undefined;
+            }
+        },
+        
+        /**
+        * Resets the specified property's value to its initial value.
+        * @method resetProperty
+        * @param {String} key The name of the property
+        * @return {Boolean} True is the property was reset, false if not
+        */
+        resetProperty: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event) {
+    
+                if (this.initialConfig[key] && 
+                    !Lang.isUndefined(this.initialConfig[key])) {
+    
+                    this.setProperty(key, this.initialConfig[key]);
+
+                    return true;
+    
+                }
+    
+            } else {
+    
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Sets the value of a property. If the silent property is passed as 
+        * true, the property's event will not be fired.
+        * @method setProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @param {Boolean} silent Whether the value should be set silently, 
+        * without firing the property event.
+        * @return {Boolean} True, if the set was successful, false if it failed.
+        */
+        setProperty: function (key, value, silent) {
+        
+            var property;
+        
+            key = key.toLowerCase();
+        
+            if (this.queueInProgress && ! silent) {
+                // Currently running through a queue... 
+                this.queueProperty(key,value);
+                return true;
+    
+            } else {
+                property = this.config[key];
+                if (property && property.event) {
+                    if (property.validator && !property.validator(value)) {
+                        return false;
+                    } else {
+                        property.value = value;
+                        if (! silent) {
+                            this.fireEvent(key, value);
+                            this.configChangedEvent.fire([key, value]);
+                        }
+                        return true;
+                    }
+                } else {
+                    return false;
+                }
+            }
+        },
+        
+        /**
+        * Sets the value of a property and queues its event to execute. If the 
+        * event is already scheduled to execute, it is
+        * moved from its current position to the end of the queue.
+        * @method queueProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @return {Boolean}  true, if the set was successful, false if 
+        * it failed.
+        */ 
+        queueProperty: function (key, value) {
+        
+            key = key.toLowerCase();
+        
+            var property = this.config[key],
+                foundDuplicate = false,
+                iLen,
+                queueItem,
+                queueItemKey,
+                queueItemValue,
+                sLen,
+                supercedesCheck,
+                qLen,
+                queueItemCheck,
+                queueItemCheckKey,
+                queueItemCheckValue,
+                i,
+                s,
+                q;
+                                
+            if (property && property.event) {
+    
+                if (!Lang.isUndefined(value) && property.validator && 
+                    !property.validator(value)) { // validator
+                    return false;
+                } else {
+        
+                    if (!Lang.isUndefined(value)) {
+                        property.value = value;
+                    } else {
+                        value = property.value;
+                    }
+        
+                    foundDuplicate = false;
+                    iLen = this.eventQueue.length;
+        
+                    for (i = 0; i < iLen; i++) {
+                        queueItem = this.eventQueue[i];
+        
+                        if (queueItem) {
+                            queueItemKey = queueItem[0];
+                            queueItemValue = queueItem[1];
+                            
+                            if (queueItemKey == key) {
+    
+                                /*
+                                    found a dupe... push to end of queue, null 
+                                    current item, and break
+                                */
+    
+                                this.eventQueue[i] = null;
+    
+                                this.eventQueue.push(
+                                    [key, (!Lang.isUndefined(value) ? 
+                                    value : queueItemValue)]);
+    
+                                foundDuplicate = true;
+                                break;
+                            }
+                        }
+                    }
+                    
+                    // this is a refire, or a new property in the queue
+    
+                    if (! foundDuplicate && !Lang.isUndefined(value)) { 
+                        this.eventQueue.push([key, value]);
+                    }
+                }
+        
+                if (property.supercedes) {
+        
+                    sLen = property.supercedes.length;
+        
+                    for (s = 0; s < sLen; s++) {
+        
+                        supercedesCheck = property.supercedes[s];
+                        qLen = this.eventQueue.length;
+        
+                        for (q = 0; q < qLen; q++) {
+                            queueItemCheck = this.eventQueue[q];
+        
+                            if (queueItemCheck) {
+                                queueItemCheckKey = queueItemCheck[0];
+                                queueItemCheckValue = queueItemCheck[1];
+                                
+                                if (queueItemCheckKey == 
+                                    supercedesCheck.toLowerCase() ) {
+    
+                                    this.eventQueue.push([queueItemCheckKey, 
+                                        queueItemCheckValue]);
+    
+                                    this.eventQueue[q] = null;
+                                    break;
+    
+                                }
+                            }
+                        }
+                    }
+                }
+
+        
+                return true;
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Fires the event for a property using the property's current value.
+        * @method refireEvent
+        * @param {String} key The name of the property
+        */
+        refireEvent: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event && 
+    
+                !Lang.isUndefined(property.value)) {
+    
+                if (this.queueInProgress) {
+    
+                    this.queueProperty(key);
+    
+                } else {
+    
+                    this.fireEvent(key, property.value);
+    
+                }
+    
+            }
+        },
+        
+        /**
+        * Applies a key-value Object literal to the configuration, replacing  
+        * any existing values, and queueing the property events.
+        * Although the values will be set, fireQueue() must be called for their 
+        * associated events to execute.
+        * @method applyConfig
+        * @param {Object} userConfig The configuration Object literal
+        * @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.
+        */
+        applyConfig: function (userConfig, init) {
+        
+            var sKey,
+                oValue,
+                oConfig;
+
+            if (init) {
+
+                oConfig = {};
+
+                for (sKey in userConfig) {
+                
+                    if (Lang.hasOwnProperty(userConfig, sKey)) {
+
+                        oConfig[sKey.toLowerCase()] = userConfig[sKey];
+
+                    }
+                
+                }
+
+                this.initialConfig = oConfig;
+
+            }
+
+            for (sKey in userConfig) {
+            
+                if (Lang.hasOwnProperty(userConfig, sKey)) {
+            
+                    this.queueProperty(sKey, userConfig[sKey]);
+                
+                }
+
+            }
+
+        },
+        
+        /**
+        * Refires the events for all configuration properties using their 
+        * current values.
+        * @method refresh
+        */
+        refresh: function () {
+        
+            var prop;
+        
+            for (prop in this.config) {
+                this.refireEvent(prop);
+            }
+        },
+        
+        /**
+        * Fires the normalized list of queued property change events
+        * @method fireQueue
+        */
+        fireQueue: function () {
+        
+            var i, 
+                queueItem,
+                key,
+                value,
+                property;
+        
+            this.queueInProgress = true;
+            for (i = 0;i < this.eventQueue.length; i++) {
+                queueItem = this.eventQueue[i];
+                if (queueItem) {
+        
+                    key = queueItem[0];
+                    value = queueItem[1];
+                    property = this.config[key];
+        
+                    property.value = value;
+        
+                    this.fireEvent(key,value);
+                }
+            }
+            
+            this.queueInProgress = false;
+            this.eventQueue = [];
+        },
+        
+        /**
+        * Subscribes an external handler to the change event for any 
+        * given property. 
+        * @method subscribeToConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event handler 
+        * (see CustomEvent documentation)
+        * @param {Boolean} override Optional. If true, will override "this"  
+        * within the handler to map to the scope Object passed into the method.
+        * @return {Boolean} True, if the subscription was successful, 
+        * otherwise false.
+        */ 
+        subscribeToConfigEvent: function (key, handler, obj, override) {
+    
+            var property = this.config[key.toLowerCase()];
+    
+            if (property && property.event) {
+    
+                if (!Config.alreadySubscribed(property.event, handler, obj)) {
+    
+                    property.event.subscribe(handler, obj, override);
+    
+                }
+    
+                return true;
+    
+            } else {
+    
+                return false;
+    
+            }
+    
+        },
+        
+        /**
+        * Unsubscribes an external handler from the change event for any 
+        * given property. 
+        * @method unsubscribeFromConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event 
+        * handler (see CustomEvent documentation)
+        * @return {Boolean} True, if the unsubscription was successful, 
+        * otherwise false.
+        */
+        unsubscribeFromConfigEvent: function (key, handler, obj) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.event.unsubscribe(handler, obj);
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Returns a string representation of the Config object
+        * @method toString
+        * @return {String} The Config object in string format.
+        */
+        toString: function () {
+            var output = "Config";
+            if (this.owner) {
+                output += " [" + this.owner.toString() + "]";
+            }
+            return output;
+        },
+        
+        /**
+        * Returns a string representation of the Config object's current 
+        * CustomEvent queue
+        * @method outputEventQueue
+        * @return {String} The string list of CustomEvents currently queued 
+        * for execution
+        */
+        outputEventQueue: function () {
+
+            var output = "",
+                queueItem,
+                q,
+                nQueue = this.eventQueue.length;
+              
+            for (q = 0; q < nQueue; q++) {
+                queueItem = this.eventQueue[q];
+                if (queueItem) {
+                    output += queueItem[0] + "=" + queueItem[1] + ", ";
+                }
+            }
+            return output;
+        },
+
+        /**
+        * Sets all properties to null, unsubscribes all listeners from each 
+        * property's change event and all listeners from the configChangedEvent.
+        * @method destroy
+        */
+        destroy: function () {
+
+            var oConfig = this.config,
+                sProperty,
+                oProperty;
+
+
+            for (sProperty in oConfig) {
+            
+                if (Lang.hasOwnProperty(oConfig, sProperty)) {
+
+                    oProperty = oConfig[sProperty];
+
+                    oProperty.event.unsubscribeAll();
+                    oProperty.event = null;
+
+                }
+            
+            }
+            
+            this.configChangedEvent.unsubscribeAll();
+            
+            this.configChangedEvent = null;
+            this.owner = null;
+            this.config = null;
+            this.initialConfig = null;
+            this.eventQueue = null;
+        
+        }
+
+    };
+    
+    
+    
+    /**
+    * Checks to determine if a particular function/Object pair are already 
+    * subscribed to the specified CustomEvent
+    * @method YAHOO.util.Config.alreadySubscribed
+    * @static
+    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check 
+    * the subscriptions
+    * @param {Function} fn The function to look for in the subscribers list
+    * @param {Object} obj The execution scope Object for the subscription
+    * @return {Boolean} true, if the function/Object pair is already subscribed 
+    * to the CustomEvent passed in
+    */
+    Config.alreadySubscribed = function (evt, fn, obj) {
+    
+        var nSubscribers = evt.subscribers.length,
+            subsc,
+            i;
+
+        if (nSubscribers > 0) {
+
+            i = nSubscribers - 1;
+        
+            do {
+
+                subsc = evt.subscribers[i];
+
+                if (subsc && subsc.obj == obj && subsc.fn == fn) {
+        
+                    return true;
+        
+                }    
+            
+            }
+            while (i--);
+        
+        }
+    
+        return false;
+    
+    };
+    
+    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
+
+}());
+
+(function () {
+
+    /**
+    * The Container family of components is designed to enable developers to 
+    * create different kinds of content-containing modules on the web. Module 
+    * and Overlay are the most basic containers, and they can be used directly 
+    * or extended to build custom containers. Also part of the Container family 
+    * are four UI controls that extend Module and Overlay: Tooltip, Panel, 
+    * Dialog, and SimpleDialog.
+    * @module container
+    * @title Container
+    * @requires yahoo, dom, event 
+    * @optional dragdrop, animation, button
+    */
+    
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class Module
+    * @constructor
+    * @param {String} el The element ID representing the Module <em>OR</em>
+    * @param {HTMLElement} el The element representing the Module
+    * @param {Object} userConfig The configuration Object literal containing 
+    * the configuration that should be set for this module. See configuration 
+    * documentation for more details.
+    */
+    YAHOO.widget.Module = function (el, userConfig) {
+        if (el) {
+            this.init(el, userConfig);
+        } else {
+        }
+    };
+
+    var Dom = YAHOO.util.Dom,
+        Config = YAHOO.util.Config,
+        Event = YAHOO.util.Event,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Module = YAHOO.widget.Module,
+
+        m_oModuleTemplate,
+        m_oHeaderTemplate,
+        m_oBodyTemplate,
+        m_oFooterTemplate,
+
+        /**
+        * Constant representing the name of the Module's events
+        * @property EVENT_TYPES
+        * @private
+        * @final
+        * @type Object
+        */
+        EVENT_TYPES = {
+        
+            "BEFORE_INIT": "beforeInit",
+            "INIT": "init",
+            "APPEND": "append",
+            "BEFORE_RENDER": "beforeRender",
+            "RENDER": "render",
+            "CHANGE_HEADER": "changeHeader",
+            "CHANGE_BODY": "changeBody",
+            "CHANGE_FOOTER": "changeFooter",
+            "CHANGE_CONTENT": "changeContent",
+            "DESTORY": "destroy",
+            "BEFORE_SHOW": "beforeShow",
+            "SHOW": "show",
+            "BEFORE_HIDE": "beforeHide",
+            "HIDE": "hide"
+        
+        },
+            
+        /**
+        * Constant representing the Module's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+
+            "VISIBLE": { 
+                key: "visible", 
+                value: true, 
+                validator: YAHOO.lang.isBoolean 
+            },
+
+            "EFFECT": { 
+                key: "effect", 
+                suppressEvent: true, 
+                supercedes: ["visible"] 
+            },
+
+            "MONITOR_RESIZE": { 
+                key: "monitorresize", 
+                value: true  
+            },
+
+            "APPEND_TO_DOCUMENT_BODY": { 
+                key: "appendtodocumentbody", 
+                value: false
+            }
+        };
+    
+    /**
+    * Constant representing the prefix path to use for non-secure images
+    * @property YAHOO.widget.Module.IMG_ROOT
+    * @static
+    * @final
+    * @type String
+    */
+    Module.IMG_ROOT = null;
+    
+    /**
+    * Constant representing the prefix path to use for securely served images
+    * @property YAHOO.widget.Module.IMG_ROOT_SSL
+    * @static
+    * @final
+    * @type String
+    */
+    Module.IMG_ROOT_SSL = null;
+    
+    /**
+    * Constant for the default CSS class name that represents a Module
+    * @property YAHOO.widget.Module.CSS_MODULE
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_MODULE = "yui-module";
+    
+    /**
+    * Constant representing the module header
+    * @property YAHOO.widget.Module.CSS_HEADER
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_HEADER = "hd";
+    
+    /**
+    * Constant representing the module body
+    * @property YAHOO.widget.Module.CSS_BODY
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_BODY = "bd";
+    
+    /**
+    * Constant representing the module footer
+    * @property YAHOO.widget.Module.CSS_FOOTER
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_FOOTER = "ft";
+    
+    /**
+    * Constant representing the url for the "src" attribute of the iframe 
+    * used to monitor changes to the browser's base font size
+    * @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+    * @static
+    * @final
+    * @type String
+    */
+    Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+    
+    /**
+    * Singleton CustomEvent fired when the font size is changed in the browser.
+    * Opera's "zoom" functionality currently does not support text 
+    * size detection.
+    * @event YAHOO.widget.Module.textResizeEvent
+    */
+    Module.textResizeEvent = new CustomEvent("textResize");
+
+    function createModuleTemplate() {
+
+        if (!m_oModuleTemplate) {
+            m_oModuleTemplate = document.createElement("div");
+            
+            m_oModuleTemplate.innerHTML = ("<div class=\"" + 
+                Module.CSS_HEADER + "\"></div>" + "<div class=\"" + 
+                Module.CSS_BODY + "\"></div><div class=\"" + 
+                Module.CSS_FOOTER + "\"></div>");
+
+            m_oHeaderTemplate = m_oModuleTemplate.firstChild;
+            m_oBodyTemplate = m_oHeaderTemplate.nextSibling;
+            m_oFooterTemplate = m_oBodyTemplate.nextSibling;
+        }
+
+        return m_oModuleTemplate;
+    }
+
+    function createHeader() {
+        if (!m_oHeaderTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oHeaderTemplate.cloneNode(false));
+    }
+
+    function createBody() {
+        if (!m_oBodyTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oBodyTemplate.cloneNode(false));
+    }
+
+    function createFooter() {
+        if (!m_oFooterTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oFooterTemplate.cloneNode(false));
+    }
+
+    Module.prototype = {
+
+        /**
+        * The class's constructor function
+        * @property contructor
+        * @type Function
+        */
+        constructor: Module,
+        
+        /**
+        * The main module element that contains the header, body, and footer
+        * @property element
+        * @type HTMLElement
+        */
+        element: null,
+
+        /**
+        * The header element, denoted with CSS class "hd"
+        * @property header
+        * @type HTMLElement
+        */
+        header: null,
+
+        /**
+        * The body element, denoted with CSS class "bd"
+        * @property body
+        * @type HTMLElement
+        */
+        body: null,
+
+        /**
+        * The footer element, denoted with CSS class "ft"
+        * @property footer
+        * @type HTMLElement
+        */
+        footer: null,
+
+        /**
+        * The id of the element
+        * @property id
+        * @type String
+        */
+        id: null,
+
+        /**
+        * A string representing the root path for all images created by
+        * a Module instance.
+        * @deprecated It is recommend that any images for a Module be applied
+        * via CSS using the "background-image" property.
+        * @property imageRoot
+        * @type String
+        */
+        imageRoot: Module.IMG_ROOT,
+
+        /**
+        * Initializes the custom events for Module which are fired 
+        * automatically at appropriate times by the Module class.
+        * @method initEvents
+        */
+        initEvents: function () {
+
+            var SIGNATURE = CustomEvent.LIST;
+
+            /**
+            * CustomEvent fired prior to class initalization.
+            * @event beforeInitEvent
+            * @param {class} classRef class reference of the initializing 
+            * class, such as this.beforeInitEvent.fire(Module)
+            */
+            this.beforeInitEvent = this.createEvent(EVENT_TYPES.BEFORE_INIT);
+            this.beforeInitEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after class initalization.
+            * @event initEvent
+            * @param {class} classRef class reference of the initializing 
+            * class, such as this.beforeInitEvent.fire(Module)
+            */  
+            this.initEvent = this.createEvent(EVENT_TYPES.INIT);
+            this.initEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired when the Module is appended to the DOM
+            * @event appendEvent
+            */
+            this.appendEvent = this.createEvent(EVENT_TYPES.APPEND);
+            this.appendEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is rendered
+            * @event beforeRenderEvent
+            */
+            this.beforeRenderEvent = this.createEvent(EVENT_TYPES.BEFORE_RENDER);
+            this.beforeRenderEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired after the Module is rendered
+            * @event renderEvent
+            */
+            this.renderEvent = this.createEvent(EVENT_TYPES.RENDER);
+            this.renderEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired when the header content of the Module 
+            * is modified
+            * @event changeHeaderEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new header content
+            */
+            this.changeHeaderEvent = this.createEvent(EVENT_TYPES.CHANGE_HEADER);
+            this.changeHeaderEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired when the body content of the Module is modified
+            * @event changeBodyEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new body content
+            */  
+            this.changeBodyEvent = this.createEvent(EVENT_TYPES.CHANGE_BODY);
+            this.changeBodyEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired when the footer content of the Module 
+            * is modified
+            * @event changeFooterEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new footer content
+            */
+            this.changeFooterEvent = this.createEvent(EVENT_TYPES.CHANGE_FOOTER);
+            this.changeFooterEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired when the content of the Module is modified
+            * @event changeContentEvent
+            */
+            this.changeContentEvent = this.createEvent(EVENT_TYPES.CHANGE_CONTENT);
+            this.changeContentEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired when the Module is destroyed
+            * @event destroyEvent
+            */
+            this.destroyEvent = this.createEvent(EVENT_TYPES.DESTORY);
+            this.destroyEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is shown
+            * @event beforeShowEvent
+            */
+            this.beforeShowEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW);
+            this.beforeShowEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after the Module is shown
+            * @event showEvent
+            */
+            this.showEvent = this.createEvent(EVENT_TYPES.SHOW);
+            this.showEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is hidden
+            * @event beforeHideEvent
+            */
+            this.beforeHideEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE);
+            this.beforeHideEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after the Module is hidden
+            * @event hideEvent
+            */
+            this.hideEvent = this.createEvent(EVENT_TYPES.HIDE);
+            this.hideEvent.signature = SIGNATURE;
+        }, 
+
+        /**
+        * String representing the current user-agent platform
+        * @property platform
+        * @type String
+        */
+        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;
+            }
+        }(),
+        
+        /**
+        * String representing the user-agent of the browser
+        * @deprecated Use YAHOO.env.ua
+        * @property browser
+        * @type String
+        */
+        browser: function () {
+            var ua = navigator.userAgent.toLowerCase();
+            /*
+                 Check Opera first in case of spoof and check Safari before
+                 Gecko since Safari's user agent string includes "like Gecko"
+            */
+            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;
+            }
+        }(),
+        
+        /**
+        * Boolean representing whether or not the current browsing context is 
+        * secure (https)
+        * @property isSecure
+        * @type Boolean
+        */
+        isSecure: function () {
+            if (window.location.href.toLowerCase().indexOf("https") === 0) {
+                return true;
+            } else {
+                return false;
+            }
+        }(),
+        
+        /**
+        * Initializes the custom events for Module which are fired 
+        * automatically at appropriate times by the Module class.
+        */
+        initDefaultConfig: function () {
+            // Add properties //
+            /**
+            * Specifies whether the Module is visible on the page.
+            * @config visible
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key, {
+                handler: this.configVisible, 
+                value: DEFAULT_CONFIG.VISIBLE.value, 
+                validator: DEFAULT_CONFIG.VISIBLE.validator
+            });
+
+            /**
+            * Object or array of objects representing the ContainerEffect 
+            * classes that are active for animating the container.
+            * @config effect
+            * @type Object
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key, {
+                suppressEvent: DEFAULT_CONFIG.EFFECT.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.EFFECT.supercedes
+            });
+
+            /**
+            * Specifies whether to create a special proxy iframe to monitor 
+            * for user font resizing in the document
+            * @config monitorresize
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key, {
+                handler: this.configMonitorResize,
+                value: DEFAULT_CONFIG.MONITOR_RESIZE.value
+            });
+
+            /**
+            * Specifies if the module should be rendered as the first child 
+            * of document.body or appended as the last child when render is called
+            * with document.body as the "appendToNode".
+            * <p>
+            * Appending to the body while the DOM is still being constructed can 
+            * lead to Operation Aborted errors in IE hence this flag is set to 
+            * false by default.
+            * </p>
+            * 
+            * @config appendtodocumentbody
+            * @type Boolean
+            * @default false
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.key, {
+                value: DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.value
+            });
+        },
+
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the Module <em>OR</em>
+        * @param {HTMLElement} el The element representing the Module
+        * @param {Object} userConfig The configuration Object literal 
+        * containing the configuration that should be set for this module. 
+        * See configuration documentation for more details.
+        */
+        init: function (el, userConfig) {
+
+            var elId, i, child;
+
+            this.initEvents();
+            this.beforeInitEvent.fire(Module);
+
+            /**
+            * The Module's Config object used for monitoring 
+            * configuration properties.
+            * @property cfg
+            * @type YAHOO.util.Config
+            */
+            this.cfg = new Config(this);
+
+            if (this.isSecure) {
+                this.imageRoot = Module.IMG_ROOT_SSL;
+            }
+
+            if (typeof el == "string") {
+                elId = el;
+                el = document.getElementById(el);
+                if (! el) {
+                    el = (createModuleTemplate()).cloneNode(false);
+                    el.id = elId;
+                }
+            }
+
+            this.element = el;
+
+            if (el.id) {
+                this.id = el.id;
+            }
+
+            child = this.element.firstChild;
+
+            if (child) {
+                var fndHd = false, fndBd = false, fndFt = false;
+                do {
+                    // We're looking for elements
+                    if (1 == child.nodeType) {
+                        if (!fndHd && Dom.hasClass(child, Module.CSS_HEADER)) {
+                            this.header = child;
+                            fndHd = true;
+                        } else if (!fndBd && Dom.hasClass(child, Module.CSS_BODY)) {
+                            this.body = child;
+                            fndBd = true;
+                        } else if (!fndFt && Dom.hasClass(child, Module.CSS_FOOTER)){
+                            this.footer = child;
+                            fndFt = true;
+                        }
+                    }
+                } while ((child = child.nextSibling));
+            }
+
+            this.initDefaultConfig();
+
+            Dom.addClass(this.element, Module.CSS_MODULE);
+
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+
+            /*
+                Subscribe to the fireQueue() method of Config so that any 
+                queued configuration changes are excecuted upon render of 
+                the Module
+            */ 
+
+            if (!Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {
+                this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);
+            }
+
+            this.initEvent.fire(Module);
+        },
+
+        /**
+        * Initialized an empty IFRAME that is placed out of the visible area 
+        * that can be used to detect text resize.
+        * @method initResizeMonitor
+        */
+        initResizeMonitor: function () {
+
+            var oDoc, 
+                oIFrame, 
+                sHTML;
+
+            function fireTextResize() {
+                Module.textResizeEvent.fire();
+            }
+
+            if (!YAHOO.env.ua.opera) {
+                oIFrame = Dom.get("_yuiResizeMonitor");
+
+                if (!oIFrame) {
+                    oIFrame = document.createElement("iframe");
+
+                    if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && YAHOO.env.ua.ie) {
+                        oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL;
+                    }
+
+                    /*
+                        Need to set "src" attribute of the iframe to 
+                        prevent the browser from reporting duplicate 
+                        cookies. (See SourceForge bug #1721755)
+                    */
+                    if (YAHOO.env.ua.gecko) {
+                        sHTML = "<html><head><script " +
+                                "type=\"text/javascript\">" + 
+                                "window.onresize=function(){window.parent." +
+                                "YAHOO.widget.Module.textResizeEvent." +
+                                "fire();};window.parent.YAHOO.widget.Module." +
+                                "textResizeEvent.fire();</script></head>" + 
+                                "<body></body></html>";
+
+                        oIFrame.src = "data:text/html;charset=utf-8," + 
+                            encodeURIComponent(sHTML);
+                    }
+
+                    oIFrame.id = "_yuiResizeMonitor";
+                    /*
+                        Need to set "position" property before inserting the 
+                        iframe into the document or Safari's status bar will 
+                        forever indicate the iframe is loading 
+                        (See SourceForge bug #1723064)
+                    */
+                    oIFrame.style.position = "absolute";
+                    oIFrame.style.visibility = "hidden";
+
+                    var fc = document.body.firstChild;
+                    if (fc) {
+                        document.body.insertBefore(oIFrame, fc);
+                    } else {
+                        document.body.appendChild(oIFrame);
+                    }
+
+                    oIFrame.style.width = "10em";
+                    oIFrame.style.height = "10em";
+                    oIFrame.style.top = (-1 * oIFrame.offsetHeight) + "px";
+                    oIFrame.style.left = (-1 * oIFrame.offsetWidth) + "px";
+                    oIFrame.style.borderWidth = "0";
+                    oIFrame.style.visibility = "visible";
+
+                    if (YAHOO.env.ua.webkit) {
+                        oDoc = oIFrame.contentWindow.document;
+                        oDoc.open();
+                        oDoc.close();
+                    }
+                }
+
+                if (oIFrame && oIFrame.contentWindow) {
+                    Module.textResizeEvent.subscribe(this.onDomResize, this, true);
+
+                    if (!Module.textResizeInitialized) {
+                        if (!Event.on(oIFrame.contentWindow, "resize", fireTextResize)) {
+                            /*
+                                 This will fail in IE if document.domain has 
+                                 changed, so we must change the listener to 
+                                 use the oIFrame element instead
+                            */
+                            Event.on(oIFrame, "resize", fireTextResize);
+                        }
+                        Module.textResizeInitialized = true;
+                    }
+                    this.resizeMonitor = oIFrame;
+                }
+            }
+        },
+
+        /**
+        * Event handler fired when the resize monitor element is resized.
+        * @method onDomResize
+        * @param {DOMEvent} e The DOM resize event
+        * @param {Object} obj The scope object passed to the handler
+        */
+        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";
+        
+        },
+        
+        /**
+        * 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.
+        * @method setHeader
+        * @param {String} headerContent The HTML used to set the header 
+        * <em>OR</em>
+        * @param {HTMLElement} headerContent The HTMLElement to append to 
+        * the header
+        */
+        setHeader: function (headerContent) {
+
+            var oHeader = this.header || (this.header = createHeader());
+        
+            if (typeof headerContent == "string") {
+
+                oHeader.innerHTML = headerContent;
+
+            } else {
+
+                oHeader.innerHTML = "";
+                oHeader.appendChild(headerContent);
+
+            }
+        
+            this.changeHeaderEvent.fire(headerContent);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * Appends the passed element to the header. If no header is present, 
+        * one will be automatically created.
+        * @method appendToHeader
+        * @param {HTMLElement} element The element to append to the header
+        */
+        appendToHeader: function (element) {
+
+            var oHeader = this.header || (this.header = createHeader());
+        
+            oHeader.appendChild(element);
+
+            this.changeHeaderEvent.fire(element);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * 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.
+        * @method setBody
+        * @param {String} bodyContent The HTML used to set the body <em>OR</em>
+        * @param {HTMLElement} bodyContent The HTMLElement to append to the body
+        */
+        setBody: function (bodyContent) {
+
+            var oBody = this.body || (this.body = createBody());
+        
+            if (typeof bodyContent == "string") {
+
+                oBody.innerHTML = bodyContent;
+
+            } else {
+
+                oBody.innerHTML = "";
+                oBody.appendChild(bodyContent);
+
+            }
+        
+            this.changeBodyEvent.fire(bodyContent);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * Appends the passed element to the body. If no body is present, one 
+        * will be automatically created.
+        * @method appendToBody
+        * @param {HTMLElement} element The element to append to the body
+        */
+        appendToBody: function (element) {
+
+            var oBody = this.body || (this.body = createBody());
+        
+            oBody.appendChild(element);
+
+            this.changeBodyEvent.fire(element);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * 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.
+        * @method setFooter
+        * @param {String} footerContent The HTML used to set the footer 
+        * <em>OR</em>
+        * @param {HTMLElement} footerContent The HTMLElement to append to 
+        * the footer
+        */
+        setFooter: function (footerContent) {
+
+            var oFooter = this.footer || (this.footer = createFooter());
+        
+            if (typeof footerContent == "string") {
+
+                oFooter.innerHTML = footerContent;
+
+            } else {
+
+                oFooter.innerHTML = "";
+                oFooter.appendChild(footerContent);
+
+            }
+        
+            this.changeFooterEvent.fire(footerContent);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * Appends the passed element to the footer. If no footer is present, 
+        * one will be automatically created.
+        * @method appendToFooter
+        * @param {HTMLElement} element The element to append to the footer
+        */
+        appendToFooter: function (element) {
+
+            var oFooter = this.footer || (this.footer = createFooter());
+        
+            oFooter.appendChild(element);
+
+            this.changeFooterEvent.fire(element);
+            this.changeContentEvent.fire();
+
+        },
+        
+        /**
+        * 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. 
+        * <p>
+        * 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.
+        * </p>
+        * <p>
+        * NOTE: As of 2.3.1, if the appendToNode is the document's body element
+        * then the module is rendered as the first child of the body element, 
+        * and not appended to it, to avoid Operation Aborted errors in IE when 
+        * rendering the module before window's load event is fired. You can 
+        * use the appendtodocumentbody configuration property to change this 
+        * to append to document.body if required.
+        * </p>
+        * @method render
+        * @param {String} appendToNode The element id to which the Module 
+        * should be appended to prior to rendering <em>OR</em>
+        * @param {HTMLElement} appendToNode The element to which the Module 
+        * should be appended to prior to rendering
+        * @param {HTMLElement} moduleElement OPTIONAL. The element that 
+        * represents the actual Standard Module container.
+        * @return {Boolean} Success or failure of the render
+        */
+        render: function (appendToNode, moduleElement) {
+
+            var me = this,
+                firstChild;
+
+            function appendTo(parentNode) {
+                if (typeof parentNode == "string") {
+                    parentNode = document.getElementById(parentNode);
+                }
+
+                if (parentNode) {
+                    me._addToParent(parentNode, me.element);
+                    me.appendEvent.fire();
+                }
+            }
+
+            this.beforeRenderEvent.fire();
+
+            if (! moduleElement) {
+                moduleElement = this.element;
+            }
+
+            if (appendToNode) {
+                appendTo(appendToNode);
+            } else { 
+                // No node was passed in. If the element is not already in the Dom, this fails
+                if (! Dom.inDocument(this.element)) {
+                    return false;
+                }
+            }
+
+            // Need to get everything into the DOM if it isn't already
+            if (this.header && ! Dom.inDocument(this.header)) {
+                // There is a header, but it's not in the DOM yet. Need to add it.
+                firstChild = moduleElement.firstChild;
+                if (firstChild) {
+                    moduleElement.insertBefore(this.header, firstChild);
+                } else {
+                    moduleElement.appendChild(this.header);
+                }
+            }
+
+            if (this.body && ! Dom.inDocument(this.body)) {
+                // There is a body, but it's not in the DOM yet. Need to add it.		
+                if (this.footer && Dom.isAncestor(this.moduleElement, this.footer)) {
+                    moduleElement.insertBefore(this.body, this.footer);
+                } else {
+                    moduleElement.appendChild(this.body);
+                }
+            }
+
+            if (this.footer && ! Dom.inDocument(this.footer)) {
+                // There is a footer, but it's not in the DOM yet. Need to add it.
+                moduleElement.appendChild(this.footer);
+            }
+
+            this.renderEvent.fire();
+            return true;
+        },
+
+        /**
+        * Removes the Module element from the DOM and sets all child elements 
+        * to null.
+        * @method destroy
+        */
+        destroy: function () {
+
+            var parent,
+                e;
+
+            if (this.element) {
+                Event.purgeElement(this.element, true);
+                parent = this.element.parentNode;
+            }
+
+            if (parent) {
+                parent.removeChild(this.element);
+            }
+        
+            this.element = null;
+            this.header = null;
+            this.body = null;
+            this.footer = null;
+
+            Module.textResizeEvent.unsubscribe(this.onDomResize, this);
+
+            this.cfg.destroy();
+            this.cfg = null;
+
+            this.destroyEvent.fire();
+        
+            for (e in this) {
+                if (e instanceof CustomEvent) {
+                    e.unsubscribeAll();
+                }
+            }
+
+        },
+        
+        /**
+        * 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.
+        * @method show
+        */
+        show: function () {
+            this.cfg.setProperty("visible", true);
+        },
+        
+        /**
+        * 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.
+        * @method hide
+        */
+        hide: function () {
+            this.cfg.setProperty("visible", false);
+        },
+        
+        // BUILT-IN EVENT HANDLERS FOR MODULE //
+        /**
+        * 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".
+        * This method is responsible for firing showEvent and hideEvent.
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        * @method configVisible
+        */
+        configVisible: function (type, args, obj) {
+            var visible = args[0];
+            if (visible) {
+                this.beforeShowEvent.fire();
+                Dom.setStyle(this.element, "display", "block");
+                this.showEvent.fire();
+            } else {
+                this.beforeHideEvent.fire();
+                Dom.setStyle(this.element, "display", "none");
+                this.hideEvent.fire();
+            }
+        },
+        
+        /**
+        * Default event handler for the "monitorresize" configuration property
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        * @method configMonitorResize
+        */
+        configMonitorResize: function (type, args, obj) {
+            var monitor = args[0];
+            if (monitor) {
+                this.initResizeMonitor();
+            } else {
+                Module.textResizeEvent.unsubscribe(this.onDomResize, this, true);
+                this.resizeMonitor = null;
+            }
+        },
+
+        /**
+         * This method is a private helper, used when constructing the DOM structure for the module 
+         * to account for situations which may cause Operation Aborted errors in IE. It should not 
+         * be used for general DOM construction.
+         * <p>
+         * If the parentNode is not document.body, the element is appended as the last element.
+         * </p>
+         * <p>
+         * If the parentNode is document.body the element is added as the first child to help
+         * prevent Operation Aborted errors in IE.
+         * </p>
+         *
+         * @param {parentNode} The HTML element to which the element will be added
+         * @param {element} The HTML element to be added to parentNode's children
+         * @method _addToParent
+         * @protected
+         */
+        _addToParent: function(parentNode, element) {
+            if (!this.cfg.getProperty("appendtodocumentbody") && parentNode === document.body && parentNode.firstChild) {
+                parentNode.insertBefore(element, parentNode.firstChild);
+            } else {
+                parentNode.appendChild(element);
+            }
+        },
+
+        /**
+        * Returns a String representation of the Object.
+        * @method toString
+        * @return {String} The string representation of the Module
+        */
+        toString: function () {
+            return "Module " + this.id;
+        }
+    };
+
+    YAHOO.lang.augmentProto(Module, YAHOO.util.EventProvider);
+
+}());
+
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class Overlay
+    * @extends YAHOO.widget.Module
+    * @param {String} el The element ID representing the Overlay <em>OR</em>
+    * @param {HTMLElement} el The element representing the Overlay
+    * @param {Object} userConfig The configuration object literal containing 
+    * the configuration that should be set for this Overlay. See configuration 
+    * documentation for more details.
+    * @constructor
+    */
+    YAHOO.widget.Overlay = function (el, userConfig) {
+        YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
+    };
+
+    var Lang = YAHOO.lang,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Module = YAHOO.widget.Module,
+        Event = YAHOO.util.Event,
+        Dom = YAHOO.util.Dom,
+        Config = YAHOO.util.Config,
+        Overlay = YAHOO.widget.Overlay,
+
+        m_oIFrameTemplate,
+
+        /**
+        * Constant representing the name of the Overlay's events
+        * @property EVENT_TYPES
+        * @private
+        * @final
+        * @type Object
+        */
+        EVENT_TYPES = {
+        
+            "BEFORE_MOVE": "beforeMove",
+            "MOVE": "move"
+        
+        },
+
+        /**
+        * Constant representing the Overlay's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "X": { 
+                key: "x", 
+                validator: Lang.isNumber, 
+                suppressEvent: true, 
+                supercedes: ["iframe"] 
+            },
+        
+            "Y": { 
+                key: "y", 
+                validator: Lang.isNumber, 
+                suppressEvent: true, 
+                supercedes: ["iframe"] 
+            },
+        
+            "XY": { 
+                key: "xy", 
+                suppressEvent: true, 
+                supercedes: ["iframe"] 
+            },
+
+            "CONTEXT": { 
+                key: "context", 
+                suppressEvent: true, 
+                supercedes: ["iframe"] 
+            },
+
+            "FIXED_CENTER": { 
+                key: "fixedcenter", 
+                value: false, 
+                validator: Lang.isBoolean, 
+                supercedes: ["iframe", "visible"] 
+            },
+
+            "WIDTH": { 
+                key: "width", 
+                suppressEvent: true, 
+                supercedes: ["context", "fixedcenter", "iframe"] 
+            }, 
+
+            "HEIGHT": { 
+                key: "height", 
+                suppressEvent: true, 
+                supercedes: ["context", "fixedcenter", "iframe"] 
+            }, 
+
+            "ZINDEX": { 
+                key: "zindex", 
+                value: null 
+            }, 
+
+            "CONSTRAIN_TO_VIEWPORT": { 
+                key: "constraintoviewport", 
+                value: false, 
+                validator: Lang.isBoolean, 
+                supercedes: ["iframe", "x", "y", "xy"] 
+            }, 
+
+            "IFRAME": { 
+                key: "iframe", 
+                value: (YAHOO.env.ua.ie == 6 ? true : false), 
+                validator: Lang.isBoolean, 
+                supercedes: ["zindex"] 
+            }
+        };
+
+    /**
+    * The URL that will be placed in the iframe
+    * @property YAHOO.widget.Overlay.IFRAME_SRC
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.IFRAME_SRC = "javascript:false;";
+
+    /**
+    * Number representing how much the iframe shim should be offset from each 
+    * side of an Overlay instance.
+    * @property YAHOO.widget.Overlay.IFRAME_SRC
+    * @default 3
+    * @static
+    * @final
+    * @type Number
+    */
+    Overlay.IFRAME_OFFSET = 3;
+    
+    /**
+    * Constant representing the top left corner of an element, used for 
+    * configuring the context element alignment
+    * @property YAHOO.widget.Overlay.TOP_LEFT
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.TOP_LEFT = "tl";
+    
+    /**
+    * Constant representing the top right corner of an element, used for 
+    * configuring the context element alignment
+    * @property YAHOO.widget.Overlay.TOP_RIGHT
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.TOP_RIGHT = "tr";
+    
+    /**
+    * Constant representing the top bottom left corner of an element, used for 
+    * configuring the context element alignment
+    * @property YAHOO.widget.Overlay.BOTTOM_LEFT
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.BOTTOM_LEFT = "bl";
+    
+    /**
+    * Constant representing the bottom right corner of an element, used for 
+    * configuring the context element alignment
+    * @property YAHOO.widget.Overlay.BOTTOM_RIGHT
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.BOTTOM_RIGHT = "br";
+    
+    /**
+    * Constant representing the default CSS class used for an Overlay
+    * @property YAHOO.widget.Overlay.CSS_OVERLAY
+    * @static
+    * @final
+    * @type String
+    */
+    Overlay.CSS_OVERLAY = "yui-overlay";
+    
+    
+    /**
+    * A singleton CustomEvent used for reacting to the DOM event for 
+    * window scroll
+    * @event YAHOO.widget.Overlay.windowScrollEvent
+    */
+    Overlay.windowScrollEvent = new CustomEvent("windowScroll");
+    
+    /**
+    * A singleton CustomEvent used for reacting to the DOM event for
+    * window resize
+    * @event YAHOO.widget.Overlay.windowResizeEvent
+    */
+    Overlay.windowResizeEvent = new CustomEvent("windowResize");
+    
+    /**
+    * The DOM event handler used to fire the CustomEvent for window scroll
+    * @method YAHOO.widget.Overlay.windowScrollHandler
+    * @static
+    * @param {DOMEvent} e The DOM scroll event
+    */
+    Overlay.windowScrollHandler = function (e) {
+    
+        if (YAHOO.env.ua.ie) {
+
+            if (! window.scrollEnd) {
+                window.scrollEnd = -1;
+            }
+    
+            clearTimeout(window.scrollEnd);
+    
+            window.scrollEnd = setTimeout(function () { 
+                Overlay.windowScrollEvent.fire(); 
+            }, 1);
+    
+        } else {
+            Overlay.windowScrollEvent.fire();
+        }
+    };
+
+    /**
+    * The DOM event handler used to fire the CustomEvent for window resize
+    * @method YAHOO.widget.Overlay.windowResizeHandler
+    * @static
+    * @param {DOMEvent} e The DOM resize event
+    */
+    Overlay.windowResizeHandler = function (e) {
+
+        if (YAHOO.env.ua.ie) {
+            if (! window.resizeEnd) {
+                window.resizeEnd = -1;
+            }
+
+            clearTimeout(window.resizeEnd);
+
+            window.resizeEnd = setTimeout(function () {
+                Overlay.windowResizeEvent.fire(); 
+            }, 100);
+        } else {
+            Overlay.windowResizeEvent.fire();
+        }
+    };
+    
+    /**
+    * A boolean that indicated whether the window resize and scroll events have 
+    * already been subscribed to.
+    * @property YAHOO.widget.Overlay._initialized
+    * @private
+    * @type Boolean
+    */
+    Overlay._initialized = null;
+    
+    if (Overlay._initialized === null) {
+        Event.on(window, "scroll", Overlay.windowScrollHandler);
+        Event.on(window, "resize", Overlay.windowResizeHandler);
+    
+        Overlay._initialized = true;
+    }
+
+    YAHOO.extend(Overlay, Module, {
+    
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the Overlay <em>OR</em>
+        * @param {HTMLElement} el The element representing the Overlay
+        * @param {Object} userConfig The configuration object literal 
+        * containing the configuration that should be set for this Overlay. 
+        * See configuration documentation for more details.
+        */
+        init: function (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
+            */
+    
+            Overlay.superclass.init.call(this, el/*, userConfig*/);  
+            
+            this.beforeInitEvent.fire(Overlay);
+            
+            Dom.addClass(this.element, Overlay.CSS_OVERLAY);
+            
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+
+            if (this.platform == "mac" && YAHOO.env.ua.gecko) {
+
+                if (! Config.alreadySubscribed(this.showEvent,
+                    this.showMacGeckoScrollbars, this)) {
+
+                    this.showEvent.subscribe(this.showMacGeckoScrollbars, 
+                        this, true);
+
+                }
+
+                if (! Config.alreadySubscribed(this.hideEvent, 
+                    this.hideMacGeckoScrollbars, this)) {
+
+                    this.hideEvent.subscribe(this.hideMacGeckoScrollbars, 
+                        this, true);
+
+                }
+            }
+
+            this.initEvent.fire(Overlay);
+        },
+        
+        /**
+        * Initializes the custom events for Overlay which are fired  
+        * automatically at appropriate times by the Overlay class.
+        * @method initEvents
+        */
+        initEvents: function () {
+    
+            Overlay.superclass.initEvents.call(this);
+            
+            var SIGNATURE = CustomEvent.LIST;
+            
+            /**
+            * CustomEvent fired before the Overlay is moved.
+            * @event beforeMoveEvent
+            * @param {Number} x x coordinate
+            * @param {Number} y y coordinate
+            */
+            this.beforeMoveEvent = this.createEvent(EVENT_TYPES.BEFORE_MOVE);
+            this.beforeMoveEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired after the Overlay is moved.
+            * @event moveEvent
+            * @param {Number} x x coordinate
+            * @param {Number} y y coordinate
+            */
+            this.moveEvent = this.createEvent(EVENT_TYPES.MOVE);
+            this.moveEvent.signature = SIGNATURE;
+        
+        },
+        
+        /**
+        * Initializes the class's configurable properties which can be changed 
+        * using the Overlay's Config object (cfg).
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+    
+            Overlay.superclass.initDefaultConfig.call(this);
+            
+            
+            // Add overlay config properties //
+            
+            /**
+            * The absolute x-coordinate position of the Overlay
+            * @config x
+            * @type Number
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.X.key, { 
+    
+                handler: this.configX, 
+                validator: DEFAULT_CONFIG.X.validator, 
+                suppressEvent: DEFAULT_CONFIG.X.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.X.supercedes
+    
+            });
+    
+            /**
+            * The absolute y-coordinate position of the Overlay
+            * @config y
+            * @type Number
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.Y.key, {
+    
+                handler: this.configY, 
+                validator: DEFAULT_CONFIG.Y.validator, 
+                suppressEvent: DEFAULT_CONFIG.Y.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.Y.supercedes
+    
+            });
+    
+            /**
+            * An array with the absolute x and y positions of the Overlay
+            * @config xy
+            * @type Number[]
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.XY.key, {
+            
+                handler: this.configXY, 
+                suppressEvent: DEFAULT_CONFIG.XY.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.XY.supercedes
+            
+            });
+    
+            /**
+            * The array of context arguments for context-sensitive positioning.  
+            * The format is: [id or element, element corner, context corner]. 
+            * For example, setting this property to ["img1", "tl", "bl"] would 
+            * align the Overlay's top left corner to the context element's 
+            * bottom left corner.
+            * @config context
+            * @type Array
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key, {
+            
+                handler: this.configContext, 
+                suppressEvent: DEFAULT_CONFIG.CONTEXT.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.CONTEXT.supercedes
+            
+            });
+    
+            /**
+            * True if the Overlay should be anchored to the center of 
+            * the viewport.
+            * @config fixedcenter
+            * @type Boolean
+            * @default false
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, {
+            
+                handler: this.configFixedCenter,
+                value: DEFAULT_CONFIG.FIXED_CENTER.value, 
+                validator: DEFAULT_CONFIG.FIXED_CENTER.validator, 
+                supercedes: DEFAULT_CONFIG.FIXED_CENTER.supercedes
+            
+            });
+    
+            /**
+            * CSS width of the Overlay.
+            * @config width
+            * @type String
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key, {
+            
+                handler: this.configWidth, 
+                suppressEvent: DEFAULT_CONFIG.WIDTH.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.WIDTH.supercedes
+            
+            });
+            
+            /**
+            * CSS height of the Overlay.
+            * @config height
+            * @type String
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key, {
+            
+                handler: this.configHeight, 
+                suppressEvent: DEFAULT_CONFIG.HEIGHT.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.HEIGHT.supercedes
+            
+            });
+            
+            /**
+            * CSS z-index of the Overlay.
+            * @config zIndex
+            * @type Number
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key, {
+    
+                handler: this.configzIndex,
+                value: DEFAULT_CONFIG.ZINDEX.value
+    
+            });
+            
+            /**
+            * True if the Overlay should be prevented from being positioned 
+            * out of the viewport.
+            * @config constraintoviewport
+            * @type Boolean
+            * @default false
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key, {
+            
+                handler: this.configConstrainToViewport, 
+                value: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value, 
+                validator: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator, 
+                supercedes: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes
+            
+            });
+            
+            /**
+            * @config iframe
+            * @description Boolean indicating whether or not the Overlay should 
+            * have an IFRAME shim; used to prevent SELECT elements from 
+            * poking through an Overlay instance in IE6.  When set to "true", 
+            * the iframe shim is created when the Overlay instance is intially
+            * made visible.
+            * @type Boolean
+            * @default true for IE6 and below, false for all other browsers.
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key, {
+            
+                handler: this.configIframe, 
+                value: DEFAULT_CONFIG.IFRAME.value, 
+                validator: DEFAULT_CONFIG.IFRAME.validator, 
+                supercedes: DEFAULT_CONFIG.IFRAME.supercedes
+
+            });
+        },
+
+        /**
+        * Moves the Overlay to the specified position. This function is  
+        * identical to calling this.cfg.setProperty("xy", [x,y]);
+        * @method moveTo
+        * @param {Number} x The Overlay's new x position
+        * @param {Number} y The Overlay's new y position
+        */
+        moveTo: function (x, y) {
+    
+            this.cfg.setProperty("xy", [x, y]);
+    
+        },
+
+        /**
+        * Adds a CSS class ("hide-scrollbars") and removes a CSS class 
+        * ("show-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X 
+        * (https://bugzilla.mozilla.org/show_bug.cgi?id=187435)
+        * @method hideMacGeckoScrollbars
+        */
+        hideMacGeckoScrollbars: function () {
+    
+            Dom.removeClass(this.element, "show-scrollbars");
+            Dom.addClass(this.element, "hide-scrollbars");
+    
+        },
+
+        /**
+        * Adds a CSS class ("show-scrollbars") and removes a CSS class 
+        * ("hide-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X 
+        * (https://bugzilla.mozilla.org/show_bug.cgi?id=187435)
+        * @method showMacGeckoScrollbars
+        */
+        showMacGeckoScrollbars: function () {
+    
+            Dom.removeClass(this.element, "hide-scrollbars");
+            Dom.addClass(this.element, "show-scrollbars");
+    
+        },
+
+        // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+        /**
+        * The default event handler fired when the "visible" property is 
+        * changed.  This method is responsible for firing showEvent
+        * and hideEvent.
+        * @method configVisible
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configVisible: function (type, args, obj) {
+
+            var visible = args[0],
+                currentVis = Dom.getStyle(this.element, "visibility"),
+                effect = this.cfg.getProperty("effect"),
+                effectInstances = [],
+                isMacGecko = (this.platform == "mac" && YAHOO.env.ua.gecko),
+                alreadySubscribed = Config.alreadySubscribed,
+                eff, ei, e, i, j, k, h,
+                nEffects,
+                nEffectInstances;
+    
+            if (currentVis == "inherit") {
+                e = this.element.parentNode;
+    
+                while (e.nodeType != 9 && e.nodeType != 11) {
+                    currentVis = Dom.getStyle(e, "visibility");
+    
+                    if (currentVis != "inherit") { 
+                        break; 
+                    }
+    
+                    e = e.parentNode;
+                }
+    
+                if (currentVis == "inherit") {
+                    currentVis = "visible";
+                }
+            }
+    
+            if (effect) {
+                if (effect instanceof Array) {
+                    nEffects = effect.length;
+    
+                    for (i = 0; i < nEffects; i++) {
+                        eff = effect[i];
+                        effectInstances[effectInstances.length] = 
+                            eff.effect(this, eff.duration);
+    
+                    }
+                } else {
+                    effectInstances[effectInstances.length] = 
+                        effect.effect(this, effect.duration);
+                }
+            }
+    
+        
+            if (visible) { // Show
+                if (isMacGecko) {
+                    this.showMacGeckoScrollbars();
+                }
+    
+                if (effect) { // Animate in
+                    if (visible) { // Animate in if not showing
+                        if (currentVis != "visible" || currentVis === "") {
+                            this.beforeShowEvent.fire();
+                            nEffectInstances = effectInstances.length;
+    
+                            for (j = 0; j < nEffectInstances; j++) {
+                                ei = effectInstances[j];
+                                if (j === 0 && !alreadySubscribed(
+                                        ei.animateInCompleteEvent, 
+                                        this.showEvent.fire, this.showEvent)) {
+    
+                                    /*
+                                         Delegate showEvent until end 
+                                         of animateInComplete
+                                    */
+    
+                                    ei.animateInCompleteEvent.subscribe(
+                                     this.showEvent.fire, this.showEvent, true);
+                                }
+                                ei.animateIn();
+                            }
+                        }
+                    }
+                } else { // Show
+                    if (currentVis != "visible" || currentVis === "") {
+                        this.beforeShowEvent.fire();
+    
+                        Dom.setStyle(this.element, "visibility", "visible");
+    
+                        this.cfg.refireEvent("iframe");
+                        this.showEvent.fire();
+                    }
+                }
+            } else { // Hide
+    
+                if (isMacGecko) {
+                    this.hideMacGeckoScrollbars();
+                }
+                    
+                if (effect) { // Animate out if showing
+                    if (currentVis == "visible") {
+                        this.beforeHideEvent.fire();
+
+                        nEffectInstances = effectInstances.length;
+                        for (k = 0; k < nEffectInstances; k++) {
+                            h = effectInstances[k];
+    
+                            if (k === 0 && !alreadySubscribed(
+                                h.animateOutCompleteEvent, this.hideEvent.fire, 
+                                this.hideEvent)) {
+    
+                                /*
+                                     Delegate hideEvent until end 
+                                     of animateOutComplete
+                                */
+    
+                                h.animateOutCompleteEvent.subscribe(
+                                    this.hideEvent.fire, this.hideEvent, true);
+    
+                            }
+                            h.animateOut();
+                        }
+    
+                    } else if (currentVis === "") {
+                        Dom.setStyle(this.element, "visibility", "hidden");
+                    }
+    
+                } else { // Simple hide
+    
+                    if (currentVis == "visible" || currentVis === "") {
+                        this.beforeHideEvent.fire();
+                        Dom.setStyle(this.element, "visibility", "hidden");
+                        this.hideEvent.fire();
+                    }
+                }
+            }
+        },
+
+        /**
+        * Center event handler used for centering on scroll/resize, but only if 
+        * the Overlay is visible
+        * @method doCenterOnDOMEvent
+        */
+        doCenterOnDOMEvent: function () {
+            if (this.cfg.getProperty("visible")) {
+                this.center();
+            }
+        },
+
+        /**
+        * The default event handler fired when the "fixedcenter" property 
+        * is changed.
+        * @method configFixedCenter
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configFixedCenter: function (type, args, obj) {
+    
+            var val = args[0],
+                alreadySubscribed = Config.alreadySubscribed,
+                windowResizeEvent = Overlay.windowResizeEvent,
+                windowScrollEvent = Overlay.windowScrollEvent;
+            
+            if (val) {
+                this.center();
+
+                if (!alreadySubscribed(this.beforeShowEvent, this.center, this)) {
+                    this.beforeShowEvent.subscribe(this.center);
+                }
+            
+                if (!alreadySubscribed(windowResizeEvent, this.doCenterOnDOMEvent, this)) {
+                    windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);
+                }
+            
+                if (!alreadySubscribed(windowScrollEvent, this.doCenterOnDOMEvent, this)) {
+                    windowScrollEvent.subscribe(this.doCenterOnDOMEvent, this, true);
+                }
+    
+            } else {
+                this.beforeShowEvent.unsubscribe(this.center);
+    
+                windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);
+                windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
+            }
+        },
+        
+        /**
+        * The default event handler fired when the "height" property is changed.
+        * @method configHeight
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configHeight: function (type, args, obj) {
+    
+            var height = args[0],
+                el = this.element;
+    
+            Dom.setStyle(el, "height", height);
+            this.cfg.refireEvent("iframe");
+        },
+        
+        /**
+        * The default event handler fired when the "width" property is changed.
+        * @method configWidth
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configWidth: function (type, args, obj) {
+    
+            var width = args[0],
+                el = this.element;
+    
+            Dom.setStyle(el, "width", width);
+            this.cfg.refireEvent("iframe");
+        },
+        
+        /**
+        * The default event handler fired when the "zIndex" property is changed.
+        * @method configzIndex
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configzIndex: function (type, args, obj) {
+
+            var zIndex = args[0],
+                el = this.element;
+
+            if (! zIndex) {
+                zIndex = Dom.getStyle(el, "zIndex");
+                if (! zIndex || isNaN(zIndex)) {
+                    zIndex = 0;
+                }
+            }
+
+            if (this.iframe || this.cfg.getProperty("iframe") === true) {
+                if (zIndex <= 0) {
+                    zIndex = 1;
+                }
+            }
+
+            Dom.setStyle(el, "zIndex", zIndex);
+            this.cfg.setProperty("zIndex", zIndex, true);
+
+            if (this.iframe) {
+                this.stackIframe();
+            }
+        },
+
+        /**
+        * The default event handler fired when the "xy" property is changed.
+        * @method configXY
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configXY: function (type, args, obj) {
+
+            var pos = args[0],
+                x = pos[0],
+                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]);
+        },
+
+        /**
+        * The default event handler fired when the "x" property is changed.
+        * @method configX
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configX: function (type, args, obj) {
+
+            var x = args[0],
+                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");
+            
+            Dom.setX(this.element, x, true);
+            
+            this.cfg.setProperty("xy", [x, y], true);
+           
+            this.cfg.refireEvent("iframe");
+            this.moveEvent.fire([x, y]);
+        },
+        
+        /**
+        * The default event handler fired when the "y" property is changed.
+        * @method configY
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configY: function (type, args, obj) {
+
+            var x = this.cfg.getProperty("x"),
+                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");
+
+            Dom.setY(this.element, y, true);
+
+            this.cfg.setProperty("xy", [x, y], true);
+
+            this.cfg.refireEvent("iframe");
+            this.moveEvent.fire([x, y]);
+        },
+        
+        /**
+        * Shows the iframe shim, if it has been enabled.
+        * @method showIframe
+        */
+        showIframe: function () {
+
+            var oIFrame = this.iframe,
+                oParentNode;
+
+            if (oIFrame) {
+                oParentNode = this.element.parentNode;
+
+                if (oParentNode != oIFrame.parentNode) {
+                    this._addToParent(oParentNode, oIFrame);
+                }
+                oIFrame.style.display = "block";
+            }
+        },
+
+        /**
+        * Hides the iframe shim, if it has been enabled.
+        * @method hideIframe
+        */
+        hideIframe: function () {
+            if (this.iframe) {
+                this.iframe.style.display = "none";
+            }
+        },
+
+        /**
+        * Syncronizes the size and position of iframe shim to that of its 
+        * corresponding Overlay instance.
+        * @method syncIframe
+        */
+        syncIframe: function () {
+
+            var oIFrame = this.iframe,
+                oElement = this.element,
+                nOffset = Overlay.IFRAME_OFFSET,
+                nDimensionOffset = (nOffset * 2),
+                aXY;
+
+            if (oIFrame) {
+                // Size <iframe>
+                oIFrame.style.width = (oElement.offsetWidth + nDimensionOffset + "px");
+                oIFrame.style.height = (oElement.offsetHeight + nDimensionOffset + "px");
+
+                // Position <iframe>
+                aXY = this.cfg.getProperty("xy");
+
+                if (!Lang.isArray(aXY) || (isNaN(aXY[0]) || isNaN(aXY[1]))) {
+                    this.syncPosition();
+                    aXY = this.cfg.getProperty("xy");
+                }
+                Dom.setXY(oIFrame, [(aXY[0] - nOffset), (aXY[1] - nOffset)]);
+            }
+        },
+
+        /**
+         * Sets the zindex of the iframe shim, if it exists, based on the zindex of
+         * the Overlay element. The zindex of the iframe is set to be one less 
+         * than the Overlay element's zindex.
+         * 
+         * <p>NOTE: This method will not bump up the zindex of the Overlay element
+         * to ensure that the iframe shim has a non-negative zindex.
+         * If you require the iframe zindex to be 0 or higher, the zindex of 
+         * the Overlay element should be set to a value greater than 0, before 
+         * this method is called.
+         * </p>
+         * @method stackIframe
+         */
+        stackIframe: function() {
+            if (this.iframe) {
+                var overlayZ = Dom.getStyle(this.element, "zIndex");
+                if (!YAHOO.lang.isUndefined(overlayZ) && !isNaN(overlayZ)) {
+                    Dom.setStyle(this.iframe, "zIndex", (overlayZ - 1));
+                }
+            }
+        },
+
+        /**
+        * The default event handler fired when the "iframe" property is changed.
+        * @method configIframe
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configIframe: function (type, args, obj) {
+
+            var bIFrame = args[0];
+
+            function createIFrame() {
+
+                var oIFrame = this.iframe,
+                    oElement = this.element,
+                    oParent,
+                    aXY;
+
+                if (!oIFrame) {
+                    if (!m_oIFrameTemplate) {
+                        m_oIFrameTemplate = document.createElement("iframe");
+
+                        if (this.isSecure) {
+                            m_oIFrameTemplate.src = Overlay.IFRAME_SRC;
+                        }
+
+                        /*
+                            Set the opacity of the <iframe> to 0 so that it 
+                            doesn't modify the opacity of any transparent 
+                            elements that may be on top of it (like a shadow).
+                        */
+
+                        if (YAHOO.env.ua.ie) {
+                            m_oIFrameTemplate.style.filter = "alpha(opacity=0)";
+                            /*
+                                 Need to set the "frameBorder" property to 0 
+                                 supress the default <iframe> border in IE.  
+                                 Setting the CSS "border" property alone 
+                                 doesn't supress it.
+                            */
+                            m_oIFrameTemplate.frameBorder = 0;
+                        }
+                        else {
+                            m_oIFrameTemplate.style.opacity = "0";
+                        }
+
+                        m_oIFrameTemplate.style.position = "absolute";
+                        m_oIFrameTemplate.style.border = "none";
+                        m_oIFrameTemplate.style.margin = "0";
+                        m_oIFrameTemplate.style.padding = "0";
+                        m_oIFrameTemplate.style.display = "none";
+                    }
+
+                    oIFrame = m_oIFrameTemplate.cloneNode(false);
+                    oParent = oElement.parentNode;
+
+                    var parentNode = oParent || document.body;
+
+                    this._addToParent(parentNode, oIFrame);
+                    this.iframe = oIFrame;
+                }
+
+                /*
+                     Show the <iframe> before positioning it since the "setXY" 
+                     method of DOM requires the element be in the document 
+                     and visible.
+                */
+                this.showIframe();
+
+                /*
+                     Syncronize the size and position of the <iframe> to that 
+                     of the Overlay.
+                */
+                this.syncIframe();
+                this.stackIframe();
+
+                // Add event listeners to update the <iframe> when necessary
+                if (!this._hasIframeEventListeners) {
+                    this.showEvent.subscribe(this.showIframe);
+                    this.hideEvent.subscribe(this.hideIframe);
+                    this.changeContentEvent.subscribe(this.syncIframe);
+
+                    this._hasIframeEventListeners = true;
+                }
+            }
+
+            function onBeforeShow() {
+                createIFrame.call(this);
+                this.beforeShowEvent.unsubscribe(onBeforeShow);
+                this._iframeDeferred = false;
+            }
+
+            if (bIFrame) { // <iframe> shim is enabled
+
+                if (this.cfg.getProperty("visible")) {
+                    createIFrame.call(this);
+                } else {
+                    if (!this._iframeDeferred) {
+                        this.beforeShowEvent.subscribe(onBeforeShow);
+                        this._iframeDeferred = true;
+                    }
+                }
+
+            } else {    // <iframe> shim is disabled
+                this.hideIframe();
+
+                if (this._hasIframeEventListeners) {
+                    this.showEvent.unsubscribe(this.showIframe);
+                    this.hideEvent.unsubscribe(this.hideIframe);
+                    this.changeContentEvent.unsubscribe(this.syncIframe);
+
+                    this._hasIframeEventListeners = false;
+                }
+            }
+        },
+
+        /**
+        * The default event handler fired when the "constraintoviewport" 
+        * property is changed.
+        * @method configConstrainToViewport
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for 
+        * the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configConstrainToViewport: function (type, args, obj) {
+    
+            var val = args[0];
+    
+            if (val) {
+                if (! Config.alreadySubscribed(this.beforeMoveEvent, 
+                    this.enforceConstraints, this)) {
+    
+                    this.beforeMoveEvent.subscribe(this.enforceConstraints, 
+                        this, true);
+    
+                }
+            } else {
+                this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);
+            }
+    
+        },
+        
+        /**
+        * The default event handler fired when the "context" property 
+        * is changed.
+        * @method configContext
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configContext: function (type, args, obj) {
+    
+            var contextArgs = args[0],
+                contextEl,
+                elementMagnetCorner,
+                contextMagnetCorner;
+            
+            if (contextArgs) {
+            
+                contextEl = contextArgs[0];
+                elementMagnetCorner = contextArgs[1];
+                contextMagnetCorner = contextArgs[2];
+                
+                if (contextEl) {
+    
+                    if (typeof contextEl == "string") {
+    
+                        this.cfg.setProperty("context", 
+                            [document.getElementById(contextEl), 
+                                elementMagnetCorner, contextMagnetCorner], 
+                                true);
+    
+                    }
+                    
+                    if (elementMagnetCorner && contextMagnetCorner) {
+    
+                        this.align(elementMagnetCorner, contextMagnetCorner);
+    
+                    }
+    
+                }
+    
+            }
+    
+        },
+        
+        
+        // END BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * 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.
+        * @method align
+        * @param {String} elementAlign  The String representing the corner of 
+        * the Overlay that should be aligned to the context element
+        * @param {String} contextAlign  The corner of the context element 
+        * that the elementAlign corner should stick to.
+        */
+        align: function (elementAlign, contextAlign) {
+    
+            var contextArgs = this.cfg.getProperty("context"),
+                me = this,
+                context,
+                element,
+                contextRegion;
+    
+    
+            function doAlign(v, h) {
+    
+                switch (elementAlign) {
+    
+                case Overlay.TOP_LEFT:
+                    me.moveTo(h, v);
+                    break;
+    
+                case Overlay.TOP_RIGHT:
+                    me.moveTo((h - element.offsetWidth), v);
+                    break;
+    
+                case Overlay.BOTTOM_LEFT:
+                    me.moveTo(h, (v - element.offsetHeight));
+                    break;
+    
+                case Overlay.BOTTOM_RIGHT:
+                    me.moveTo((h - element.offsetWidth), 
+                        (v - element.offsetHeight));
+                    break;
+                }
+            }
+    
+    
+            if (contextArgs) {
+            
+                context = contextArgs[0];
+                element = this.element;
+                me = this;
+                
+                if (! elementAlign) {
+    
+                    elementAlign = contextArgs[1];
+    
+                }
+                
+                if (! contextAlign) {
+    
+                    contextAlign = contextArgs[2];
+    
+                }
+                
+                if (element && context) {
+    
+                    contextRegion = Dom.getRegion(context);
+                    
+                    switch (contextAlign) {
+    
+                    case Overlay.TOP_LEFT:
+    
+                        doAlign(contextRegion.top, contextRegion.left);
+    
+                        break;
+    
+                    case Overlay.TOP_RIGHT:
+    
+                        doAlign(contextRegion.top, contextRegion.right);
+    
+                        break;
+    
+                    case Overlay.BOTTOM_LEFT:
+    
+                        doAlign(contextRegion.bottom, contextRegion.left);
+    
+                        break;
+    
+                    case Overlay.BOTTOM_RIGHT:
+    
+                        doAlign(contextRegion.bottom, contextRegion.right);
+    
+                        break;
+    
+                    }
+    
+                }
+    
+            }
+            
+        },
+        
+        /**
+        * The default event handler executed when the moveEvent is fired, if the 
+        * "constraintoviewport" is set to true.
+        * @method enforceConstraints
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        enforceConstraints: function (type, args, obj) {
+    
+            var pos = args[0],
+                x = pos[0],
+                y = pos[1],
+                offsetHeight = this.element.offsetHeight,
+                offsetWidth = this.element.offsetWidth,
+                viewPortWidth = Dom.getViewportWidth(),
+                viewPortHeight = Dom.getViewportHeight(),
+                scrollX = Dom.getDocumentScrollLeft(),
+                scrollY = Dom.getDocumentScrollTop(),
+                topConstraint = scrollY + 10,
+                leftConstraint = scrollX + 10,
+                bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10,
+                rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
+        
+    
+            if (x < leftConstraint) {
+    
+                x = leftConstraint;
+    
+            } else if (x > rightConstraint) {
+    
+                x = rightConstraint;
+    
+            }
+            
+            if (y < topConstraint) {
+    
+                y = topConstraint;
+    
+            } else if (y > bottomConstraint) {
+    
+                y = bottomConstraint;
+    
+            }
+            
+            this.cfg.setProperty("x", x, true);
+            this.cfg.setProperty("y", y, true);
+            this.cfg.setProperty("xy", [x, y], true);
+    
+        },
+        
+        /**
+        * Centers the container in the viewport.
+        * @method center
+        */
+        center: function () {
+    
+            var scrollX = Dom.getDocumentScrollLeft(),
+                scrollY = Dom.getDocumentScrollTop(),
+    
+                viewPortWidth = Dom.getClientWidth(),
+                viewPortHeight = Dom.getClientHeight(),
+                elementWidth = this.element.offsetWidth,
+                elementHeight = this.element.offsetHeight,
+                x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX,
+                y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
+            
+            this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
+            
+            this.cfg.refireEvent("iframe");
+    
+        },
+        
+        /**
+        * 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.
+        * @method syncPosition
+        */
+        syncPosition: function () {
+    
+            var pos = Dom.getXY(this.element);
+    
+            this.cfg.setProperty("x", pos[0], true);
+            this.cfg.setProperty("y", pos[1], true);
+            this.cfg.setProperty("xy", pos, true);
+    
+        },
+        
+        /**
+        * Event handler fired when the resize monitor element is resized.
+        * @method onDomResize
+        * @param {DOMEvent} e The resize DOM event
+        * @param {Object} obj The scope object
+        */
+        onDomResize: function (e, obj) {
+    
+            var me = this;
+    
+            Overlay.superclass.onDomResize.call(this, e, obj);
+    
+            setTimeout(function () {
+                me.syncPosition();
+                me.cfg.refireEvent("iframe");
+                me.cfg.refireEvent("context");
+            }, 0);
+    
+        },
+
+        /**
+        * Places the Overlay on top of all other instances of 
+        * YAHOO.widget.Overlay.
+        * @method bringToTop
+        */
+        bringToTop: function() {
+    
+            var aOverlays = [],
+                oElement = this.element;
+    
+            function compareZIndexDesc(p_oOverlay1, p_oOverlay2) {
+        
+                var sZIndex1 = Dom.getStyle(p_oOverlay1, "zIndex"),
+        
+                    sZIndex2 = Dom.getStyle(p_oOverlay2, "zIndex"),
+        
+                    nZIndex1 = (!sZIndex1 || isNaN(sZIndex1)) ? 
+                        0 : parseInt(sZIndex1, 10),
+        
+                    nZIndex2 = (!sZIndex2 || isNaN(sZIndex2)) ? 
+                        0 : parseInt(sZIndex2, 10);
+        
+                if (nZIndex1 > nZIndex2) {
+        
+                    return -1;
+        
+                } else if (nZIndex1 < nZIndex2) {
+        
+                    return 1;
+        
+                } else {
+        
+                    return 0;
+        
+                }
+        
+            }
+        
+            function isOverlayElement(p_oElement) {
+        
+                var oOverlay = Dom.hasClass(p_oElement, Overlay.CSS_OVERLAY),
+                    Panel = YAHOO.widget.Panel;
+            
+                if (oOverlay && !Dom.isAncestor(oElement, oOverlay)) {
+                
+                    if (Panel && Dom.hasClass(p_oElement, Panel.CSS_PANEL)) {
+        
+                        aOverlays[aOverlays.length] = p_oElement.parentNode;
+                    
+                    }
+                    else {
+        
+                        aOverlays[aOverlays.length] = p_oElement;
+        
+                    }
+                
+                }
+            
+            }
+            
+            Dom.getElementsBy(isOverlayElement, "DIV", document.body);
+    
+            aOverlays.sort(compareZIndexDesc);
+            
+            var oTopOverlay = aOverlays[0],
+                nTopZIndex;
+            
+            if (oTopOverlay) {
+    
+                nTopZIndex = Dom.getStyle(oTopOverlay, "zIndex");
+    
+                if (!isNaN(nTopZIndex) && oTopOverlay != oElement) {
+    
+                    this.cfg.setProperty("zindex", 
+                        (parseInt(nTopZIndex, 10) + 2));
+    
+                }
+            
+            }
+        
+        },
+        
+        /**
+        * Removes the Overlay element from the DOM and sets all child 
+        * elements to null.
+        * @method destroy
+        */
+        destroy: function () {
+
+            if (this.iframe) {
+    
+                this.iframe.parentNode.removeChild(this.iframe);
+    
+            }
+        
+            this.iframe = null;
+        
+            Overlay.windowResizeEvent.unsubscribe(
+                this.doCenterOnDOMEvent, this);
+    
+            Overlay.windowScrollEvent.unsubscribe(
+                this.doCenterOnDOMEvent, this);
+        
+            Overlay.superclass.destroy.call(this);
+        },
+        
+        /**
+        * Returns a String representation of the object.
+        * @method toString
+        * @return {String} The string representation of the Overlay.
+        */
+        toString: function () {
+            return "Overlay " + this.id;
+        }
+
+    });
+}());
+
+(function () {
+    
+    /**
+    * OverlayManager is used for maintaining the focus status of 
+    * multiple Overlays.
+    * @namespace YAHOO.widget
+    * @namespace YAHOO.widget
+    * @class OverlayManager
+    * @constructor
+    * @param {Array} overlays Optional. A collection of Overlays to register 
+    * with the manager.
+    * @param {Object} userConfig  The object literal representing the user 
+    * configuration of the OverlayManager
+    */
+    YAHOO.widget.OverlayManager = function (userConfig) {
+        this.init(userConfig);
+    };
+
+    var Overlay = YAHOO.widget.Overlay,
+        Event = YAHOO.util.Event,
+        Dom = YAHOO.util.Dom,
+        Config = YAHOO.util.Config,
+        CustomEvent = YAHOO.util.CustomEvent,
+        OverlayManager = YAHOO.widget.OverlayManager;
+    
+    /**
+    * The CSS class representing a focused Overlay
+    * @property OverlayManager.CSS_FOCUSED
+    * @static
+    * @final
+    * @type String
+    */
+    OverlayManager.CSS_FOCUSED = "focused";
+    
+    OverlayManager.prototype = {
+    
+        /**
+        * The class's constructor function
+        * @property contructor
+        * @type Function
+        */
+        constructor: OverlayManager,
+        
+        /**
+        * The array of Overlays that are currently registered
+        * @property overlays
+        * @type YAHOO.widget.Overlay[]
+        */
+        overlays: null,
+        
+        /**
+        * Initializes the default configuration of the OverlayManager
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+        
+            /**
+            * The collection of registered Overlays in use by 
+            * the OverlayManager
+            * @config overlays
+            * @type YAHOO.widget.Overlay[]
+            * @default null
+            */
+            this.cfg.addProperty("overlays", { suppressEvent: true } );
+        
+            /**
+            * The default DOM event that should be used to focus an Overlay
+            * @config focusevent
+            * @type String
+            * @default "mousedown"
+            */
+            this.cfg.addProperty("focusevent", { value: "mousedown" } );
+
+        },
+
+        /**
+        * Initializes the OverlayManager
+        * @method init
+        * @param {Overlay[]} overlays Optional. A collection of Overlays to 
+        * register with the manager.
+        * @param {Object} userConfig  The object literal representing the user 
+        * configuration of the OverlayManager
+        */
+        init: function (userConfig) {
+
+            /**
+            * The OverlayManager's Config object used for monitoring 
+            * configuration properties.
+            * @property cfg
+            * @type Config
+            */
+            this.cfg = new Config(this);
+
+            this.initDefaultConfig();
+
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+            this.cfg.fireQueue();
+
+            /**
+            * The currently activated Overlay
+            * @property activeOverlay
+            * @private
+            * @type YAHOO.widget.Overlay
+            */
+            var activeOverlay = null;
+
+            /**
+            * Returns the currently focused Overlay
+            * @method getActive
+            * @return {Overlay} The currently focused Overlay
+            */
+            this.getActive = function () {
+                return activeOverlay;
+            };
+
+            /**
+            * Focuses the specified Overlay
+            * @method focus
+            * @param {Overlay} overlay The Overlay to focus
+            * @param {String} overlay The id of the Overlay to focus
+            */
+            this.focus = function (overlay) {
+                var o = this.find(overlay);
+                if (o) {
+                    if (activeOverlay != o) {
+                        if (activeOverlay) {
+                            activeOverlay.blur();
+                        }
+                        this.bringToTop(o);
+
+                        activeOverlay = o;
+
+                        Dom.addClass(activeOverlay.element, 
+                            OverlayManager.CSS_FOCUSED);
+
+                        o.focusEvent.fire();
+                    }
+                }
+            };
+        
+            /**
+            * Removes the specified Overlay from the manager
+            * @method remove
+            * @param {Overlay} overlay The Overlay to remove
+            * @param {String} overlay The id of the Overlay to remove
+            */
+            this.remove = function (overlay) {
+                var o = this.find(overlay), 
+                        originalZ;
+                if (o) {
+                    if (activeOverlay == o) {
+                        activeOverlay = null;
+                    }
+
+                    var bDestroyed = (o.element === null && o.cfg === null) ? true : false;
+
+                    if (!bDestroyed) {
+                        // Set it's zindex so that it's sorted to the end.
+                        originalZ = 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.hideEvent.unsubscribe(o.blur);
+                    o.destroyEvent.unsubscribe(this._onOverlayDestroy, o);
+
+                    if (!bDestroyed) {
+                        Event.removeListener(o.element, 
+                                    this.cfg.getProperty("focusevent"), 
+                                    this._onOverlayElementFocus);
+
+                        o.cfg.setProperty("zIndex", originalZ, true);
+                        o.cfg.setProperty("manager", null);
+                    }
+
+                    o.focusEvent.unsubscribeAll();
+                    o.blurEvent.unsubscribeAll();
+
+                    o.focusEvent = null;
+                    o.blurEvent = null;
+
+                    o.focus = null;
+                    o.blur = null;
+                }
+            };
+
+            /**
+            * Removes focus from all registered Overlays in the manager
+            * @method blurAll
+            */
+            this.blurAll = function () {
+    
+                var nOverlays = this.overlays.length,
+                    i;
+
+                if (nOverlays > 0) {
+                    i = nOverlays - 1;
+
+                    do {
+                        this.overlays[i].blur();                    
+                    }
+                    while(i--);
+                }
+            };
+        
+            this._onOverlayBlur = function (p_sType, p_aArgs) {
+                activeOverlay = null;
+            };
+        
+            var overlays = this.cfg.getProperty("overlays");
+        
+            if (! this.overlays) {
+                this.overlays = [];
+            }
+        
+            if (overlays) {
+                this.register(overlays);
+                this.overlays.sort(this.compareZIndexDesc);
+            }
+        },
+        
+        
+        /**
+        * @method _onOverlayElementFocus
+        * @description Event handler for the DOM event that is used to focus 
+        * the Overlay instance as specified by the "focusevent" 
+        * configuration property.
+        * @private
+        * @param {Event} p_oEvent Object representing the DOM event 
+        * object passed back by the event utility (Event).
+        */
+        _onOverlayElementFocus: function (p_oEvent) {
+        
+            var oTarget = Event.getTarget(p_oEvent),
+                oClose = this.close;
+            
+            if (oClose && (oTarget == oClose || Dom.isAncestor(oClose, oTarget))) {
+                this.blur();
+            } else {
+                this.focus();
+            }
+        },
+        
+        
+        /**
+        * @method _onOverlayDestroy
+        * @description "destroy" event handler for the Overlay.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        * @param {Overlay} p_oOverlay Object representing the menu that 
+        * fired the event.
+        */
+        _onOverlayDestroy: function (p_sType, p_aArgs, p_oOverlay) {
+            this.remove(p_oOverlay);
+        },
+        
+        /**
+        * 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.
+        * @method register
+        * @param {Overlay} overlay  An Overlay to register with the manager.
+        * @param {Overlay[]} overlay  An array of Overlays to register with 
+        * the manager.
+        * @return {Boolean} True if any Overlays are registered.
+        */
+        register: function (overlay) {
+        
+            var mgr = this,
+                zIndex,
+                regcount,
+                i,
+                nOverlays;
+        
+            if (overlay instanceof Overlay) {
+
+                overlay.cfg.addProperty("manager", { value: this } );
+
+                overlay.focusEvent = overlay.createEvent("focus");
+                overlay.focusEvent.signature = CustomEvent.LIST;
+
+                overlay.blurEvent = overlay.createEvent("blur");
+                overlay.blurEvent.signature = CustomEvent.LIST;
+        
+                overlay.focus = function () {
+                    mgr.focus(this);
+                };
+        
+                overlay.blur = function () {
+                    if (mgr.getActive() == this) {
+                        Dom.removeClass(this.element, OverlayManager.CSS_FOCUSED);
+                        this.blurEvent.fire();
+                    }
+                };
+        
+                overlay.blurEvent.subscribe(mgr._onOverlayBlur);
+                overlay.hideEvent.subscribe(overlay.blur);
+                
+                overlay.destroyEvent.subscribe(this._onOverlayDestroy, overlay, this);
+        
+                Event.on(overlay.element, this.cfg.getProperty("focusevent"), 
+                            this._onOverlayElementFocus, null, overlay);
+        
+                zIndex = Dom.getStyle(overlay.element, "zIndex");
+
+                if (!isNaN(zIndex)) {
+                    overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10));
+                } else {
+                    overlay.cfg.setProperty("zIndex", 0);
+                }
+
+                this.overlays.push(overlay);
+                this.bringToTop(overlay);
+
+                return true;
+
+            } else if (overlay instanceof Array) {
+
+                regcount = 0;
+                nOverlays = overlay.length;
+
+                for (i = 0; i < nOverlays; i++) {
+                    if (this.register(overlay[i])) {
+                        regcount++;
+                    }
+                }
+
+                if (regcount > 0) {
+                    return true;
+                }
+            } else {
+                return false;
+            }
+        },
+
+        /**
+        * Places the specified Overlay instance on top of all other 
+        * Overlay instances.
+        * @method bringToTop
+        * @param {YAHOO.widget.Overlay} p_oOverlay Object representing an 
+        * Overlay instance.
+        * @param {String} p_oOverlay String representing the id of an 
+        * Overlay instance.
+        */        
+        bringToTop: function (p_oOverlay) {
+
+            var oOverlay = this.find(p_oOverlay),
+                nTopZIndex,
+                oTopOverlay,
+                aOverlays;
+
+            if (oOverlay) {
+
+                aOverlays = this.overlays;
+                aOverlays.sort(this.compareZIndexDesc);
+
+                oTopOverlay = aOverlays[0];
+                
+                if (oTopOverlay) {
+
+                    nTopZIndex = Dom.getStyle(oTopOverlay.element, "zIndex");
+    
+                    if (!isNaN(nTopZIndex) && oTopOverlay != oOverlay) {
+    
+                        oOverlay.cfg.setProperty("zIndex", 
+                            (parseInt(nTopZIndex, 10) + 2));
+    
+                    }
+                    aOverlays.sort(this.compareZIndexDesc);
+                }
+            }
+        },
+        
+        /**
+        * Attempts to locate an Overlay by instance or ID.
+        * @method find
+        * @param {Overlay} overlay  An Overlay to locate within the manager
+        * @param {String} overlay  An Overlay id to locate within the manager
+        * @return {Overlay} The requested Overlay, if found, or null if it 
+        * cannot be located.
+        */
+        find: function (overlay) {
+        
+            var aOverlays = this.overlays,
+                nOverlays = aOverlays.length,
+                i;
+
+            if (nOverlays > 0) {
+                i = nOverlays - 1;
+
+                if (overlay instanceof Overlay) {
+                    do {
+                        if (aOverlays[i] == overlay) {
+                            return aOverlays[i];
+                        }
+                    }
+                    while(i--);
+
+                } else if (typeof overlay == "string") {
+                    do {
+                        if (aOverlays[i].id == overlay) {
+                            return aOverlays[i];
+                        }
+                    }
+                    while(i--);
+                }
+                return null;
+            }
+        },
+        
+        /**
+        * Used for sorting the manager's Overlays by z-index.
+        * @method compareZIndexDesc
+        * @private
+        * @return {Number} 0, 1, or -1, depending on where the Overlay should 
+        * fall in the stacking order.
+        */
+        compareZIndexDesc: function (o1, o2) {
+
+            var zIndex1 = (o1.cfg) ? o1.cfg.getProperty("zIndex") : null, // Sort invalid (destroyed)
+                zIndex2 = (o2.cfg) ? o2.cfg.getProperty("zIndex") : null; // objects at bottom.
+
+            if (zIndex1 === null && zIndex2 === null) {
+                return 0;
+            } else if (zIndex1 === null){
+                return 1;
+            } else if (zIndex2 === null) {
+                return -1;
+            } else if (zIndex1 > zIndex2) {
+                return -1;
+            } else if (zIndex1 < zIndex2) {
+                return 1;
+            } else {
+                return 0;
+            }
+        },
+        
+        /**
+        * Shows all Overlays in the manager.
+        * @method showAll
+        */
+        showAll: function () {
+        
+            var aOverlays = this.overlays,
+                nOverlays = aOverlays.length,
+                i;
+
+            if (nOverlays > 0) {
+                i = nOverlays - 1;
+                do {
+                    aOverlays[i].show();
+                }
+                while(i--);
+            }
+        },
+        
+        /**
+        * Hides all Overlays in the manager.
+        * @method hideAll
+        */
+        hideAll: function () {
+        
+            var aOverlays = this.overlays,
+                nOverlays = aOverlays.length,
+                i;
+
+            if (nOverlays > 0) {
+                i = nOverlays - 1;
+                do {
+                    aOverlays[i].hide();
+                }
+                while(i--);
+            }
+        },
+        
+        /**
+        * Returns a string representation of the object.
+        * @method toString
+        * @return {String} The string representation of the OverlayManager
+        */
+        toString: function () {
+            return "OverlayManager";
+        }
+    };
+
+}());
+
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class Tooltip
+    * @extends YAHOO.widget.Overlay
+    * @constructor
+    * @param {String} el The element ID representing the Tooltip <em>OR</em>
+    * @param {HTMLElement} el The element representing the Tooltip
+    * @param {Object} userConfig The configuration object literal containing 
+    * the configuration that should be set for this Overlay. See configuration 
+    * documentation for more details.
+    */
+    YAHOO.widget.Tooltip = function (el, userConfig) {
+    
+        YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
+    
+    };
+
+
+    var Lang = YAHOO.lang,
+        Event = YAHOO.util.Event,
+        Dom = YAHOO.util.Dom,
+        Tooltip = YAHOO.widget.Tooltip,
+    
+        m_oShadowTemplate,
+        
+        /**
+        * Constant representing the Tooltip's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "PREVENT_OVERLAP": { 
+                key: "preventoverlap", 
+                value: true, 
+                validator: Lang.isBoolean, 
+                supercedes: ["x", "y", "xy"] 
+            },
+        
+            "SHOW_DELAY": { 
+                key: "showdelay", 
+                value: 200, 
+                validator: Lang.isNumber 
+            }, 
+        
+            "AUTO_DISMISS_DELAY": { 
+                key: "autodismissdelay", 
+                value: 5000, 
+                validator: Lang.isNumber 
+            }, 
+        
+            "HIDE_DELAY": { 
+                key: "hidedelay", 
+                value: 250, 
+                validator: Lang.isNumber 
+            }, 
+        
+            "TEXT": { 
+                key: "text", 
+                suppressEvent: true 
+            }, 
+        
+            "CONTAINER": { 
+                key: "container"
+            }
+        
+        };
+
+    
+    /**
+    * Constant representing the Tooltip CSS class
+    * @property YAHOO.widget.Tooltip.CSS_TOOLTIP
+    * @static
+    * @final
+    * @type String
+    */
+    Tooltip.CSS_TOOLTIP = "yui-tt";
+
+
+    /* 
+        "hide" event handler that sets a Tooltip instance's "width"
+        configuration property back to its original value before 
+        "setWidthToOffsetWidth" was called.
+    */
+    
+    function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) {
+
+        var sOriginalWidth = p_oObject[0],
+            sNewWidth = p_oObject[1],
+            oConfig = this.cfg,
+            sCurrentWidth = oConfig.getProperty("width");
+
+        if (sCurrentWidth == sNewWidth) {
+            
+            oConfig.setProperty("width", sOriginalWidth);
+        
+        }
+
+        this.unsubscribe("hide", this._onHide, p_oObject);
+    
+    }
+
+    /* 
+        "beforeShow" event handler that sets a Tooltip instance's "width"
+        configuration property to the value of its root HTML 
+        elements's offsetWidth
+    */
+
+    function setWidthToOffsetWidth(p_sType, p_aArgs) {
+
+        var oBody = document.body,
+            oConfig = this.cfg,
+            sOriginalWidth = oConfig.getProperty("width"),
+            sNewWidth,
+            oClone;
+
+        
+        if ((!sOriginalWidth || sOriginalWidth == "auto") && 
+            (oConfig.getProperty("container") != oBody || 
+            oConfig.getProperty("x") >= Dom.getViewportWidth() || 
+            oConfig.getProperty("y") >= Dom.getViewportHeight())) {
+
+            oClone = this.element.cloneNode(true);
+            oClone.style.visibility = "hidden";
+            oClone.style.top = "0px";
+            oClone.style.left = "0px";
+            
+            oBody.appendChild(oClone);
+
+            sNewWidth = (oClone.offsetWidth + "px");
+            
+            oBody.removeChild(oClone);
+            
+            oClone = null;
+
+            oConfig.setProperty("width", sNewWidth);
+            
+            oConfig.refireEvent("xy");
+            
+            this.subscribe("hide", restoreOriginalWidth, 
+                [(sOriginalWidth || ""), sNewWidth]);
+        
+        }
+
+    }
+
+
+    // "onDOMReady" that renders the ToolTip
+
+    function onDOMReady(p_sType, p_aArgs, p_oObject) {
+    
+        this.render(p_oObject);
+    
+    }
+
+
+    //  "init" event handler that automatically renders the Tooltip
+
+    function onInit() {
+
+        Event.onDOMReady(onDOMReady, this.cfg.getProperty("container"), this);
+
+    }
+
+    
+    YAHOO.extend(Tooltip, YAHOO.widget.Overlay, { 
+    
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the Tooltip <em>OR</em>
+        * @param {HTMLElement} el The element representing the Tooltip
+        * @param {Object} userConfig The configuration object literal 
+        * containing the configuration that should be set for this Tooltip. 
+        * See configuration documentation for more details.
+        */
+        init: function (el, userConfig) {
+    
+    
+            Tooltip.superclass.init.call(this, el);
+    
+            this.beforeInitEvent.fire(Tooltip);
+    
+            Dom.addClass(this.element, Tooltip.CSS_TOOLTIP);
+    
+            if (userConfig) {
+
+                this.cfg.applyConfig(userConfig, true);
+
+            }
+    
+            this.cfg.queueProperty("visible", false);
+            this.cfg.queueProperty("constraintoviewport", true);
+    
+            this.setBody("");
+
+            this.subscribe("beforeShow", setWidthToOffsetWidth);
+            this.subscribe("init", onInit);
+            this.subscribe("render", this.onRender);
+    
+            this.initEvent.fire(Tooltip);
+
+        },
+        
+        /**
+        * Initializes the class's configurable properties which can be 
+        * changed using the Overlay's Config object (cfg).
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+
+            Tooltip.superclass.initDefaultConfig.call(this);
+        
+            /**
+            * Specifies whether the Tooltip should be kept from overlapping 
+            * its context element.
+            * @config preventoverlap
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.PREVENT_OVERLAP.key, {
+                value: DEFAULT_CONFIG.PREVENT_OVERLAP.value, 
+                validator: DEFAULT_CONFIG.PREVENT_OVERLAP.validator, 
+                supercedes: DEFAULT_CONFIG.PREVENT_OVERLAP.supercedes
+            });
+        
+            /**
+            * The number of milliseconds to wait before showing a Tooltip 
+            * on mouseover.
+            * @config showdelay
+            * @type Number
+            * @default 200
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.SHOW_DELAY.key, {
+                handler: this.configShowDelay,
+                value: 200, 
+                validator: DEFAULT_CONFIG.SHOW_DELAY.validator
+            });
+        
+            /**
+            * The number of milliseconds to wait before automatically 
+            * dismissing a Tooltip after the mouse has been resting on the 
+            * context element.
+            * @config autodismissdelay
+            * @type Number
+            * @default 5000
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.AUTO_DISMISS_DELAY.key, {
+                handler: this.configAutoDismissDelay,
+                value: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.value,
+                validator: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.validator
+            });
+        
+            /**
+            * The number of milliseconds to wait before hiding a Tooltip 
+            * on mouseover.
+            * @config hidedelay
+            * @type Number
+            * @default 250
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.HIDE_DELAY.key, {
+                handler: this.configHideDelay,
+                value: DEFAULT_CONFIG.HIDE_DELAY.value, 
+                validator: DEFAULT_CONFIG.HIDE_DELAY.validator
+            });
+        
+            /**
+            * Specifies the Tooltip's text.
+            * @config text
+            * @type String
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, {
+                handler: this.configText,
+                suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent
+            });
+
+            /**
+            * Specifies the container element that the Tooltip's markup 
+            * should be rendered into.
+            * @config container
+            * @type HTMLElement/String
+            * @default document.body
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.CONTAINER.key, {
+                handler: this.configContainer,
+                value: document.body
+            });
+        
+            /**
+            * Specifies the element or elements that the Tooltip should be 
+            * anchored to on mouseover.
+            * @config context
+            * @type HTMLElement[]/String[]
+            * @default null
+            */ 
+
+            /**
+            * String representing the width of the Tooltip.  <em>Please note:
+            * </em> As of version 2.3 if either no value or a value of "auto" 
+            * is specified, and the Toolip's "container" configuration property
+            * is set to something other than <code>document.body</code> or 
+            * its "context" element resides outside the immediately visible 
+            * portion of the document, the width of the Tooltip will be 
+            * calculated based on the offsetWidth of its root HTML and set just 
+            * before it is made visible.  The original value will be 
+            * restored when the Tooltip is hidden. This ensures the Tooltip is 
+            * rendered at a usable width.  For more information see 
+            * SourceForge bug #1685496 and SourceForge 
+            * bug #1735423.
+            * @config width
+            * @type String
+            * @default null
+            */
+        
+        },
+        
+        // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * The default event handler fired when the "text" property is changed.
+        * @method configText
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configText: function (type, args, obj) {
+            var text = args[0];
+            if (text) {
+                this.setBody(text);
+            }
+        },
+        
+        /**
+        * The default event handler fired when the "container" property 
+        * is changed.
+        * @method configContainer
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For 
+        * configuration handlers, args[0] will equal the newly applied value 
+        * for the property.
+        * @param {Object} obj The scope object. For configuration handlers,
+        * this will usually equal the owner.
+        */
+        configContainer: function (type, args, obj) {
+
+            var container = args[0];
+
+            if (typeof container == 'string') {
+
+                this.cfg.setProperty("container", 
+                    document.getElementById(container), true);
+
+            }
+
+        },
+        
+        /**
+        * @method _removeEventListeners
+        * @description Removes all of the DOM event handlers from the HTML
+        *  element(s) that trigger the display of the tooltip.
+        * @protected
+        */
+        _removeEventListeners: function () {
+        
+            var aElements = this._context,
+                nElements,
+                oElement,
+                i;
+        
+            
+            if (aElements) {
+        
+                nElements = aElements.length;
+                
+                if (nElements > 0) {
+                
+                    i = nElements - 1;
+                    
+                    do {
+        
+                        oElement = aElements[i];
+        
+                        Event.removeListener(oElement, "mouseover", 
+                            this.onContextMouseOver);
+
+                        Event.removeListener(oElement, "mousemove", 
+                            this.onContextMouseMove);
+
+                        Event.removeListener(oElement, "mouseout", 
+                            this.onContextMouseOut);
+                    
+                    }
+                    while (i--);
+                
+                }
+        
+            }
+        
+        },
+        
+        /**
+        * The default event handler fired when the "context" property 
+        * is changed.
+        * @method configContext
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers,
+        * this will usually equal the owner.
+        */
+        configContext: function (type, args, obj) {
+        
+            var context = args[0],
+                aElements,
+                nElements,
+                oElement,
+                i;
+            
+        
+            if (context) {
+        
+                // Normalize parameter into an array
+                if (! (context instanceof Array)) {
+
+                    if (typeof context == "string") {
+
+                        this.cfg.setProperty("context", 
+                            [document.getElementById(context)], true);
+
+                    } else { // Assuming this is an element
+
+                        this.cfg.setProperty("context", [context], true);
+
+                    }
+
+                    context = this.cfg.getProperty("context");
+
+                }
+        
+        
+                // Remove any existing mouseover/mouseout listeners
+                this._removeEventListeners();
+        
+                // Add mouseover/mouseout listeners to context elements
+                this._context = context;
+        
+                aElements = this._context;
+                
+                if (aElements) {
+            
+                    nElements = aElements.length;
+                    
+                    if (nElements > 0) {
+                    
+                        i = nElements - 1;
+                        
+                        do {
+            
+                            oElement = aElements[i];
+            
+                            Event.on(oElement, "mouseover", 
+                                this.onContextMouseOver, this);
+
+                            Event.on(oElement, "mousemove", 
+                                this.onContextMouseMove, this);
+
+                            Event.on(oElement, "mouseout", 
+                                this.onContextMouseOut, this);
+                        
+                        }
+                        while (i--);
+                    
+                    }
+            
+                }
+        
+            }
+        },
+        
+        // END BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        // BEGIN BUILT-IN DOM EVENT HANDLERS //
+        
+        /**
+        * The default event handler fired when the user moves the mouse while 
+        * over the context element.
+        * @method onContextMouseMove
+        * @param {DOMEvent} e The current DOM event
+        * @param {Object} obj The object argument
+        */
+        onContextMouseMove: function (e, obj) {
+            obj.pageX = Event.getPageX(e);
+            obj.pageY = Event.getPageY(e);
+        
+        },
+        
+        /**
+        * The default event handler fired when the user mouses over the 
+        * context element.
+        * @method onContextMouseOver
+        * @param {DOMEvent} e The current DOM event
+        * @param {Object} obj The object argument
+        */
+        onContextMouseOver: function (e, obj) {
+        
+            var context = this;
+        
+            if (obj.hideProcId) {
+
+                clearTimeout(obj.hideProcId);
+
+
+                obj.hideProcId = null;
+
+            }
+        
+            Event.on(context, "mousemove", obj.onContextMouseMove, obj);
+        
+            if (context.title) {
+                obj._tempTitle = context.title;
+                context.title = "";
+            }
+        
+            /**
+            * The unique process ID associated with the thread responsible 
+            * for showing the Tooltip.
+            * @type int
+            */
+            obj.showProcId = obj.doShow(e, context);
+
+        },
+        
+        /**
+        * The default event handler fired when the user mouses out of 
+        * the context element.
+        * @method onContextMouseOut
+        * @param {DOMEvent} e The current DOM event
+        * @param {Object} obj The object argument
+        */
+        onContextMouseOut: function (e, obj) {
+            var el = this;
+        
+            if (obj._tempTitle) {
+                el.title = obj._tempTitle;
+                obj._tempTitle = null;
+            }
+        
+            if (obj.showProcId) {
+                clearTimeout(obj.showProcId);
+                obj.showProcId = null;
+            }
+        
+            if (obj.hideProcId) {
+                clearTimeout(obj.hideProcId);
+                obj.hideProcId = null;
+            }
+        
+        
+            obj.hideProcId = setTimeout(function () {
+                obj.hide();
+    
+            }, obj.cfg.getProperty("hidedelay"));
+    
+        },
+        
+        // END BUILT-IN DOM EVENT HANDLERS //
+        
+        /**
+        * Processes the showing of the Tooltip by setting the timeout delay 
+        * and offset of the Tooltip.
+        * @method doShow
+        * @param {DOMEvent} e The current DOM event
+        * @return {Number} The process ID of the timeout function associated 
+        * with doShow
+        */
+        doShow: function (e, context) {
+        
+            var yOffset = 25,
+                me = this;
+        
+            if (YAHOO.env.ua.opera && context.tagName && 
+                context.tagName.toUpperCase() == "A") {
+
+                yOffset += 12;
+
+            }
+        
+            return setTimeout(function () {
+        
+                if (me._tempTitle) {
+                    me.setBody(me._tempTitle);
+                } else {
+                    me.cfg.refireEvent("text");
+                }
+        
+                me.moveTo(me.pageX, me.pageY + yOffset);
+
+                if (me.cfg.getProperty("preventoverlap")) {
+                    me.preventOverlap(me.pageX, me.pageY);
+                }
+        
+                Event.removeListener(context, "mousemove", 
+                    me.onContextMouseMove);
+        
+                me.show();
+                me.hideProcId = me.doHide();
+
+
+            }, this.cfg.getProperty("showdelay"));
+        
+        },
+        
+        /**
+        * 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.
+        * @method doHide
+        */
+        doHide: function () {
+        
+            var me = this;
+        
+        
+            return setTimeout(function () {
+        
+                me.hide();
+        
+            }, this.cfg.getProperty("autodismissdelay"));
+        
+        },
+        
+        /**
+        * Fired when the Tooltip is moved, this event handler is used to 
+        * prevent the Tooltip from overlapping with its context element.
+        * @method preventOverlay
+        * @param {Number} pageX The x coordinate position of the mouse pointer
+        * @param {Number} pageY The y coordinate position of the mouse pointer
+        */
+        preventOverlap: function (pageX, pageY) {
+        
+            var height = this.element.offsetHeight,
+                mousePoint = new YAHOO.util.Point(pageX, pageY),
+                elementRegion = Dom.getRegion(this.element);
+        
+            elementRegion.top -= 5;
+            elementRegion.left -= 5;
+            elementRegion.right += 5;
+            elementRegion.bottom += 5;
+        
+        
+            if (elementRegion.contains(mousePoint)) {
+                this.cfg.setProperty("y", (pageY - height - 5));
+            }
+        },
+
+
+        /**
+        * @method onRender
+        * @description "render" event handler for the Tooltip.
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        onRender: function (p_sType, p_aArgs) {
+    
+            function sizeShadow() {
+    
+                var oElement = this.element,
+                    oShadow = this._shadow;
+            
+                if (oShadow) {
+            
+                    oShadow.style.width = (oElement.offsetWidth + 6) + "px";
+                    oShadow.style.height = (oElement.offsetHeight + 1) + "px"; 
+            
+                }
+            
+            }
+
+
+            function addShadowVisibleClass() {
+            
+                Dom.addClass(this._shadow, "yui-tt-shadow-visible");
+            
+            }
+            
+
+            function removeShadowVisibleClass() {
+        
+                Dom.removeClass(this._shadow, "yui-tt-shadow-visible");
+            
+            }
+    
+    
+            function createShadow() {
+    
+                var oShadow = this._shadow,
+                    oElement,
+                    Module,
+                    nIE,
+                    me;
+    
+                if (!oShadow) {
+    
+                    oElement = this.element;
+                    Module = YAHOO.widget.Module;
+                    nIE = YAHOO.env.ua.ie;
+                    me = this;
+    
+                    if (!m_oShadowTemplate) {
+        
+                        m_oShadowTemplate = document.createElement("div");
+                        m_oShadowTemplate.className = "yui-tt-shadow";
+                    
+                    }
+        
+                    oShadow = m_oShadowTemplate.cloneNode(false);
+        
+                    oElement.appendChild(oShadow);
+                    
+                    this._shadow = oShadow;
+    
+                    addShadowVisibleClass.call(this);
+        
+                    this.subscribe("beforeShow", addShadowVisibleClass);
+                    this.subscribe("beforeHide", removeShadowVisibleClass);
+
+                    if (nIE == 6 || 
+                        (nIE == 7 && document.compatMode == "BackCompat")) {
+                
+                        window.setTimeout(function () { 
+        
+                            sizeShadow.call(me); 
+        
+                        }, 0);
+    
+                        this.cfg.subscribeToConfigEvent("width", sizeShadow);
+                        this.cfg.subscribeToConfigEvent("height", sizeShadow);
+                        this.subscribe("changeContent", sizeShadow);
+    
+                        Module.textResizeEvent.subscribe(sizeShadow, 
+                                                            this, true);
+                        
+                        this.subscribe("destroy", function () {
+                        
+                            Module.textResizeEvent.unsubscribe(sizeShadow, 
+                                                                    this);
+                        
+                        });
+                
+                    }
+                
+                }
+    
+            }
+    
+    
+            function onBeforeShow() {
+            
+                createShadow.call(this);
+    
+                this.unsubscribe("beforeShow", onBeforeShow);
+            
+            }
+    
+    
+            if (this.cfg.getProperty("visible")) {
+    
+                createShadow.call(this);
+            
+            }
+            else {
+    
+                this.subscribe("beforeShow", onBeforeShow);
+            
+            }
+        
+        },
+        
+        /**
+        * Removes the Tooltip element from the DOM and sets all child 
+        * elements to null.
+        * @method destroy
+        */
+        destroy: function () {
+        
+            // Remove any existing mouseover/mouseout listeners
+            this._removeEventListeners();
+        
+            Tooltip.superclass.destroy.call(this);  
+        
+        },
+        
+        /**
+        * Returns a string representation of the object.
+        * @method toString
+        * @return {String} The string representation of the Tooltip
+        */
+        toString: function () {
+            return "Tooltip " + this.id;
+        }
+    
+    });
+
+}());
+
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class Panel
+    * @extends YAHOO.widget.Overlay
+    * @constructor
+    * @param {String} el The element ID representing the Panel <em>OR</em>
+    * @param {HTMLElement} el The element representing the Panel
+    * @param {Object} userConfig The configuration object literal containing 
+    * the configuration that should be set for this Panel. See configuration 
+    * documentation for more details.
+    */
+    YAHOO.widget.Panel = function (el, userConfig) {
+        YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
+    };
+
+    var Lang = YAHOO.lang,
+        DD = YAHOO.util.DD,
+        Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event,
+        Overlay = YAHOO.widget.Overlay,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Config = YAHOO.util.Config,
+        Panel = YAHOO.widget.Panel,
+
+        m_oMaskTemplate,
+        m_oUnderlayTemplate,
+        m_oCloseIconTemplate,
+
+        /**
+        * Constant representing the name of the Panel's events
+        * @property EVENT_TYPES
+        * @private
+        * @final
+        * @type Object
+        */
+        EVENT_TYPES = {
+        
+            "SHOW_MASK": "showMask",
+            "HIDE_MASK": "hideMask",
+            "DRAG": "drag"
+        
+        },
+
+        /**
+        * Constant representing the Panel's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "CLOSE": { 
+                key: "close", 
+                value: true, 
+                validator: Lang.isBoolean, 
+                supercedes: ["visible"] 
+            },
+
+            "DRAGGABLE": { 
+                key: "draggable", 
+                value: (DD ? true : false), 
+                validator: Lang.isBoolean, 
+                supercedes: ["visible"]  
+            },
+
+            "UNDERLAY": { 
+                key: "underlay", 
+                value: "shadow", 
+                supercedes: ["visible"] 
+            },
+
+            "MODAL": { 
+                key: "modal", 
+                value: false, 
+                validator: Lang.isBoolean, 
+                supercedes: ["visible", "zindex"]
+            },
+
+            "KEY_LISTENERS": { 
+                key: "keylisteners", 
+                suppressEvent: true, 
+                supercedes: ["visible"] 
+            }
+        };
+
+    /**
+    * Constant representing the default CSS class used for a Panel
+    * @property YAHOO.widget.Panel.CSS_PANEL
+    * @static
+    * @final
+    * @type String
+    */
+    Panel.CSS_PANEL = "yui-panel";
+    
+    /**
+    * Constant representing the default CSS class used for a Panel's 
+    * wrapping container
+    * @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
+    * @static
+    * @final
+    * @type String
+    */
+    Panel.CSS_PANEL_CONTAINER = "yui-panel-container";
+
+
+    // Private CustomEvent listeners
+
+    /* 
+        "beforeRender" event handler that creates an empty header for a Panel 
+        instance if its "draggable" configuration property is set to "true" 
+        and no header has been created.
+    */
+
+    function createHeader(p_sType, p_aArgs) {
+        if (!this.header) {
+            this.setHeader("&#160;");
+        }
+    }
+
+    /* 
+        "hide" event handler that sets a Panel instance's "width"
+        configuration property back to its original value before 
+        "setWidthToOffsetWidth" was called.
+    */
+    
+    function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) {
+
+        var sOriginalWidth = p_oObject[0],
+            sNewWidth = p_oObject[1],
+            oConfig = this.cfg,
+            sCurrentWidth = oConfig.getProperty("width");
+
+        if (sCurrentWidth == sNewWidth) {
+            oConfig.setProperty("width", sOriginalWidth);
+        }
+
+        this.unsubscribe("hide", restoreOriginalWidth, p_oObject);
+    }
+
+    /* 
+        "beforeShow" event handler that sets a Panel instance's "width"
+        configuration property to the value of its root HTML 
+        elements's offsetWidth
+    */
+
+    function setWidthToOffsetWidth(p_sType, p_aArgs) {
+
+        var nIE = YAHOO.env.ua.ie,
+            oConfig,
+            sOriginalWidth,
+            sNewWidth;
+
+        if (nIE == 6 || (nIE == 7 && document.compatMode == "BackCompat")) {
+
+            oConfig = this.cfg;
+            sOriginalWidth = oConfig.getProperty("width");
+            
+            if (!sOriginalWidth || sOriginalWidth == "auto") {
+    
+                sNewWidth = (this.element.offsetWidth + "px");
+    
+                oConfig.setProperty("width", sNewWidth);
+                
+                this.subscribe("hide", restoreOriginalWidth, 
+                    [(sOriginalWidth || ""), sNewWidth]);
+            
+            }
+        }
+    }
+
+    /* 
+        "focus" event handler for a focuable element.  Used to automatically 
+        blur the element when it receives focus to ensure that a Panel 
+        instance's modality is not compromised.
+    */
+
+    function onElementFocus() {
+        this.blur();
+    }
+
+    /* 
+        "showMask" event handler that adds a "focus" event handler to all
+        focusable elements in the document to enforce a Panel instance's 
+        modality from being compromised.
+    */
+
+    function addFocusEventHandlers(p_sType, p_aArgs) {
+
+        var me = this;
+
+        function isFocusable(el) {
+
+            var sTagName = el.tagName.toUpperCase(),
+                bFocusable = false;
+            
+            switch (sTagName) {
+            
+            case "A":
+            case "BUTTON":
+            case "SELECT":
+            case "TEXTAREA":
+
+                if (!Dom.isAncestor(me.element, el)) {
+                    Event.on(el, "focus", onElementFocus, el, true);
+                    bFocusable = true;
+                }
+
+                break;
+
+            case "INPUT":
+
+                if (el.type != "hidden" && 
+                    !Dom.isAncestor(me.element, el)) {
+
+                    Event.on(el, "focus", onElementFocus, el, true);
+                    bFocusable = true;
+
+                }
+
+                break;
+            
+            }
+
+            return bFocusable;
+
+        }
+
+        this.focusableElements = Dom.getElementsBy(isFocusable);
+    
+    }
+
+    /* 
+        "hideMask" event handler that removes all "focus" event handlers added 
+        by the "addFocusEventHandlers" method.
+    */
+    
+    function removeFocusEventHandlers(p_sType, p_aArgs) {
+
+        var aElements = this.focusableElements,
+            nElements = aElements.length,
+            el2,
+            i;
+
+        for (i = 0; i < nElements; i++) {
+            el2 = aElements[i];
+            Event.removeListener(el2, "focus", onElementFocus);
+        }
+
+    }
+
+    YAHOO.extend(Panel, Overlay, {
+    
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the Overlay <em>OR</em>
+        * @param {HTMLElement} el The element representing the Overlay
+        * @param {Object} userConfig The configuration object literal 
+        * containing the configuration that should be set for this Overlay. 
+        * See configuration documentation for more details.
+        */
+        init: function (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
+            */
+
+            Panel.superclass.init.call(this, el/*, userConfig*/);  
+        
+            this.beforeInitEvent.fire(Panel);
+        
+            Dom.addClass(this.element, Panel.CSS_PANEL);
+        
+            this.buildWrapper();
+        
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+        
+            this.subscribe("showMask", addFocusEventHandlers);
+            this.subscribe("hideMask", removeFocusEventHandlers);
+
+            // We also set up a beforeRender handler
+            // in configDraggable, but we need to check here, 
+            // since configDraggable won't get called until
+            // after the first render
+            if (this.cfg.getProperty("draggable")) {
+                this.subscribe("beforeRender", createHeader);
+            }
+
+            this.initEvent.fire(Panel);
+        },
+        
+        /**
+        * Initializes the custom events for Module which are fired 
+        * automatically at appropriate times by the Module class.
+        */
+        initEvents: function () {
+            Panel.superclass.initEvents.call(this);
+        
+            var SIGNATURE = CustomEvent.LIST;
+        
+            /**
+            * CustomEvent fired after the modality mask is shown
+            * @event showMaskEvent
+            */
+            this.showMaskEvent = this.createEvent(EVENT_TYPES.SHOW_MASK);
+            this.showMaskEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired after the modality mask is hidden
+            * @event hideMaskEvent
+            */
+            this.hideMaskEvent = this.createEvent(EVENT_TYPES.HIDE_MASK);
+            this.hideMaskEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent when the Panel is dragged
+            * @event dragEvent
+            */
+            this.dragEvent = this.createEvent(EVENT_TYPES.DRAG);
+            this.dragEvent.signature = SIGNATURE;
+        
+        },
+        
+        /**
+        * Initializes the class's configurable properties which can be changed 
+        * using the Panel's Config object (cfg).
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+            Panel.superclass.initDefaultConfig.call(this);
+        
+            // Add panel config properties //
+        
+            /**
+            * True if the Panel should display a "close" button
+            * @config close
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key, { 
+                handler: this.configClose, 
+                value: DEFAULT_CONFIG.CLOSE.value, 
+                validator: DEFAULT_CONFIG.CLOSE.validator, 
+                supercedes: DEFAULT_CONFIG.CLOSE.supercedes 
+            });
+        
+            /**
+            * Boolean specifying if the Panel should be draggable.  The default 
+            * value is "true" if the Drag and Drop utility is included, 
+            * otherwise it is "false." <strong>PLEASE NOTE:</strong> There is a 
+            * known issue in IE 6 (Strict Mode and Quirks Mode) and IE 7 
+            * (Quirks Mode) where Panels that either don't have a value set for 
+            * their "width" configuration property, or their "width" 
+            * configuration property is set to "auto" will only be draggable by
+            * placing the mouse on the text of the Panel's header element.
+            * To fix this bug, draggable Panels missing a value for their 
+            * "width" configuration property, or whose "width" configuration 
+            * property is set to "auto" will have it set to the value of 
+            * their root HTML element's offsetWidth before they are made 
+            * visible.  The calculated width is then removed when the Panel is   
+            * hidden. <em>This fix is only applied to draggable Panels in IE 6 
+            * (Strict Mode and Quirks Mode) and IE 7 (Quirks Mode)</em>. For 
+            * more information on this issue see:
+            * SourceForge bugs #1726972 and #1589210.
+            * @config draggable
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key, { 
+                handler: this.configDraggable, 
+                value: DEFAULT_CONFIG.DRAGGABLE.value, 
+                validator: DEFAULT_CONFIG.DRAGGABLE.validator, 
+                supercedes: DEFAULT_CONFIG.DRAGGABLE.supercedes 
+            });
+        
+            /**
+            * Sets the type of underlay to display for the Panel. Valid values 
+            * are "shadow," "matte," and "none".  <strong>PLEASE NOTE:</strong> 
+            * The creation of the underlay element is deferred until the Panel 
+            * is initially made visible.  For Gecko-based browsers on Mac
+            * OS X the underlay elment is always created as it is used as a 
+            * shim to prevent Aqua scrollbars below a Panel instance from poking 
+            * through it (See SourceForge bug #836476).
+            * @config underlay
+            * @type String
+            * @default shadow
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key, { 
+                handler: this.configUnderlay, 
+                value: DEFAULT_CONFIG.UNDERLAY.value, 
+                supercedes: DEFAULT_CONFIG.UNDERLAY.supercedes 
+            });
+        
+            /**
+            * True if the Panel should be displayed in a modal fashion, 
+            * automatically creating a transparent mask over the document that
+            * will not be removed until the Panel is dismissed.
+            * @config modal
+            * @type Boolean
+            * @default false
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key, { 
+                handler: this.configModal, 
+                value: DEFAULT_CONFIG.MODAL.value,
+                validator: DEFAULT_CONFIG.MODAL.validator, 
+                supercedes: DEFAULT_CONFIG.MODAL.supercedes 
+            });
+        
+            /**
+            * A KeyListener (or array of KeyListeners) that will be enabled 
+            * when the Panel is shown, and disabled when the Panel is hidden.
+            * @config keylisteners
+            * @type YAHOO.util.KeyListener[]
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key, { 
+                handler: this.configKeyListeners, 
+                suppressEvent: DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.KEY_LISTENERS.supercedes 
+            });
+        
+        },
+        
+        // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * 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.
+        * @method configClose
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configClose: function (type, args, obj) {
+
+            var val = args[0],
+                oClose = this.close;
+        
+            function doHide(e, obj) {
+                obj.hide();
+            }
+        
+            if (val) {
+                if (!oClose) {
+                    if (!m_oCloseIconTemplate) {
+                        m_oCloseIconTemplate = document.createElement("span");
+                        m_oCloseIconTemplate.innerHTML = "&#160;";
+                        m_oCloseIconTemplate.className = "container-close";
+                    }
+
+                    oClose = m_oCloseIconTemplate.cloneNode(true);
+                    this.innerElement.appendChild(oClose);
+                    Event.on(oClose, "click", doHide, this);
+                    
+                    this.close = oClose;
+
+                } else {
+                    oClose.style.display = "block";
+                }
+
+            } else {
+                if (oClose) {
+                    oClose.style.display = "none";
+                }
+            }
+
+        },
+
+        /**
+        * The default event handler fired when the "draggable" property 
+        * is changed.
+        * @method configDraggable
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configDraggable: function (type, args, obj) {
+            var val = args[0];
+
+            if (val) {
+                if (!DD) {
+                    this.cfg.setProperty("draggable", false);
+                    return;
+                }
+
+                if (this.header) {
+                    Dom.setStyle(this.header, "cursor", "move");
+                    this.registerDragDrop();
+                }
+
+                if (!Config.alreadySubscribed(this.beforeRenderEvent, createHeader, null)) {
+                    this.subscribe("beforeRender", createHeader);
+                }
+                this.subscribe("beforeShow", setWidthToOffsetWidth);
+
+            } else {
+
+                if (this.dd) {
+                    this.dd.unreg();
+                }
+
+                if (this.header) {
+                    Dom.setStyle(this.header,"cursor","auto");
+                }
+
+                this.unsubscribe("beforeRender", createHeader);
+                this.unsubscribe("beforeShow", setWidthToOffsetWidth);
+            }
+        },
+      
+        /**
+        * The default event handler fired when the "underlay" property 
+        * is changed.
+        * @method configUnderlay
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configUnderlay: function (type, args, obj) {
+    
+            var UA = YAHOO.env.ua,
+                bMacGecko = (this.platform == "mac" && UA.gecko),
+                sUnderlay = args[0].toLowerCase(),
+                oUnderlay = this.underlay,
+                oElement = this.element;
+
+            function createUnderlay() {
+
+                var nIE;
+
+                if (!oUnderlay) { // create if not already in DOM
+
+                    if (!m_oUnderlayTemplate) {
+                        m_oUnderlayTemplate = document.createElement("div");
+                        m_oUnderlayTemplate.className = "underlay";
+                    }
+
+                    oUnderlay = m_oUnderlayTemplate.cloneNode(false);
+                    this.element.appendChild(oUnderlay);
+                    
+                    this.underlay = oUnderlay;
+
+                    nIE = UA.ie;
+
+                    if (nIE == 6 || 
+                        (nIE == 7 && document.compatMode == "BackCompat")) {
+                            
+                        this.sizeUnderlay();
+
+                        this.cfg.subscribeToConfigEvent("width", 
+                            this.sizeUnderlay);
+
+                        this.cfg.subscribeToConfigEvent("height", 
+                            this.sizeUnderlay);
+
+                        this.changeContentEvent.subscribe(this.sizeUnderlay);
+
+                        YAHOO.widget.Module.textResizeEvent.subscribe(
+                            this.sizeUnderlay, this, true);
+                    
+                    }
+
+                }
+
+            }
+
+            function onBeforeShow() {
+                createUnderlay.call(this);
+                this._underlayDeferred = false;
+                this.beforeShowEvent.unsubscribe(onBeforeShow);
+            }
+            
+            function destroyUnderlay() {
+                if (this._underlayDeferred) {
+                    this.beforeShowEvent.unsubscribe(onBeforeShow);
+                    this._underlayDeferred = false;
+                }
+
+                if (oUnderlay) {
+
+                    this.cfg.unsubscribeFromConfigEvent("width", 
+                        this.sizeUnderlay);
+
+                    this.cfg.unsubscribeFromConfigEvent("height", 
+                        this.sizeUnderlay);
+
+                    this.changeContentEvent.unsubscribe(this.sizeUnderlay);
+
+                    YAHOO.widget.Module.textResizeEvent.unsubscribe(
+                        this.sizeUnderlay, this, true);
+
+                    this.element.removeChild(oUnderlay);
+
+                    this.underlay = null;
+                }
+            }
+        
+
+            switch (sUnderlay) {
+    
+            case "shadow":
+
+                Dom.removeClass(oElement, "matte");
+                Dom.addClass(oElement, "shadow");
+
+                break;
+
+            case "matte":
+
+                if (!bMacGecko) {
+                    destroyUnderlay.call(this);
+                }
+
+                Dom.removeClass(oElement, "shadow");
+                Dom.addClass(oElement, "matte");
+
+                break;
+            default:
+
+                if (!bMacGecko) {
+
+                    destroyUnderlay.call(this);
+
+                }
+            
+                Dom.removeClass(oElement, "shadow");
+                Dom.removeClass(oElement, "matte");
+
+                break;
+            }
+
+
+            if ((sUnderlay == "shadow") || (bMacGecko && !oUnderlay)) {
+                
+                if (this.cfg.getProperty("visible")) {
+                    createUnderlay.call(this);
+                }
+                else {
+                    if (!this._underlayDeferred) {
+                        this.beforeShowEvent.subscribe(onBeforeShow);
+                        this._underlayDeferred = true;
+                    }
+                }
+            }
+    
+        },
+        
+        /**
+        * 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.
+        * @method configModal
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configModal: function (type, args, obj) {
+
+            var modal = args[0];
+            if (modal) {
+                if (!this._hasModalityEventListeners) {
+
+                    this.subscribe("beforeShow", this.buildMask);
+                    this.subscribe("beforeShow", this.bringToTop);
+                    this.subscribe("beforeShow", this.showMask);
+                    this.subscribe("hide", this.hideMask);
+
+                    Overlay.windowResizeEvent.subscribe(this.sizeMask, 
+                        this, true);
+
+                    this._hasModalityEventListeners = true;
+                }
+            } else {
+                if (this._hasModalityEventListeners) {
+
+                    if (this.cfg.getProperty("visible")) {
+                        this.hideMask();
+                        this.removeMask();
+                    }
+
+                    this.unsubscribe("beforeShow", this.buildMask);
+                    this.unsubscribe("beforeShow", this.bringToTop);
+                    this.unsubscribe("beforeShow", this.showMask);
+                    this.unsubscribe("hide", this.hideMask);
+
+                    Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
+                    
+                    this._hasModalityEventListeners = false;
+                }
+            }
+        },
+        
+        /**
+        * Removes the modality mask.
+        * @method removeMask
+        */
+        removeMask: function () {
+        
+            var oMask = this.mask,
+                oParentNode;
+        
+            if (oMask) {
+                /*
+                    Hide the mask before destroying it to ensure that DOM
+                    event handlers on focusable elements get removed.
+                */
+                this.hideMask();
+                
+                oParentNode = oMask.parentNode;
+                if (oParentNode) {
+                    oParentNode.removeChild(oMask);
+                }
+
+                this.mask = null;
+            }
+        },
+        
+        /**
+        * The default event handler fired when the "keylisteners" property 
+        * is changed.
+        * @method configKeyListeners
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configKeyListeners: function (type, args, obj) {
+
+            var listeners = args[0],
+                listener,
+                nListeners,
+                i;
+        
+            if (listeners) {
+
+                if (listeners instanceof Array) {
+
+                    nListeners = listeners.length;
+
+                    for (i = 0; i < nListeners; i++) {
+
+                        listener = listeners[i];
+        
+                        if (!Config.alreadySubscribed(this.showEvent, 
+                            listener.enable, listener)) {
+
+                            this.showEvent.subscribe(listener.enable, 
+                                listener, true);
+
+                        }
+
+                        if (!Config.alreadySubscribed(this.hideEvent, 
+                            listener.disable, listener)) {
+
+                            this.hideEvent.subscribe(listener.disable, 
+                                listener, true);
+
+                            this.destroyEvent.subscribe(listener.disable, 
+                                listener, true);
+                        }
+
+                    }
+
+                } else {
+
+                    if (!Config.alreadySubscribed(this.showEvent, 
+                        listeners.enable, listeners)) {
+
+                        this.showEvent.subscribe(listeners.enable, 
+                            listeners, true);
+                    }
+
+                    if (!Config.alreadySubscribed(this.hideEvent, 
+                        listeners.disable, listeners)) {
+
+                        this.hideEvent.subscribe(listeners.disable, 
+                            listeners, true);
+
+                        this.destroyEvent.subscribe(listeners.disable, 
+                            listeners, true);
+
+                    }
+
+                }
+
+            }
+
+        },
+        
+        /**
+        * The default event handler fired when the "height" property is changed.
+        * @method configHeight
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configHeight: function (type, args, obj) {
+    
+            var height = args[0],
+                el = this.innerElement;
+    
+            Dom.setStyle(el, "height", height);
+            this.cfg.refireEvent("iframe");
+    
+        },
+        
+        /**
+        * The default event handler fired when the "width" property is changed.
+        * @method configWidth
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configWidth: function (type, args, obj) {
+    
+            var width = args[0],
+                el = this.innerElement;
+    
+            Dom.setStyle(el, "width", width);
+            this.cfg.refireEvent("iframe");
+    
+        },
+        
+        /**
+        * The default event handler fired when the "zIndex" property is changed.
+        * @method configzIndex
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configzIndex: function (type, args, obj) {
+            Panel.superclass.configzIndex.call(this, type, args, obj);
+
+            if (this.mask || this.cfg.getProperty("modal") === true) {
+                var panelZ = Dom.getStyle(this.element, "zIndex");
+                if (!panelZ || isNaN(panelZ)) {
+                    panelZ = 0;
+                }
+
+                if (panelZ === 0) {
+                    // Recursive call to configzindex (which should be stopped
+                    // from going further because panelZ should no longer === 0)
+                    this.cfg.setProperty("zIndex", 1);
+                } else {
+                    this.stackMask();
+                }
+            }
+        },
+
+        // END BUILT-IN PROPERTY EVENT HANDLERS //
+        /**
+        * 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.
+        * @method buildWrapper
+        */
+        buildWrapper: function () {
+    
+            var elementParent = this.element.parentNode,
+                originalElement = this.element,
+                wrapper = document.createElement("div");
+    
+            wrapper.className = Panel.CSS_PANEL_CONTAINER;
+            wrapper.id = originalElement.id + "_c";
+        
+            if (elementParent) {
+                elementParent.insertBefore(wrapper, originalElement);
+            }
+        
+            wrapper.appendChild(originalElement);
+        
+            this.element = wrapper;
+            this.innerElement = originalElement;
+        
+            Dom.setStyle(this.innerElement, "visibility", "inherit");
+        },
+        
+        /**
+        * Adjusts the size of the shadow based on the size of the element.
+        * @method sizeUnderlay
+        */
+        sizeUnderlay: function () {
+
+            var oUnderlay = this.underlay,
+                oElement;
+
+            if (oUnderlay) {
+
+                oElement = this.element;
+
+                oUnderlay.style.width = oElement.offsetWidth + "px";
+                oUnderlay.style.height = oElement.offsetHeight + "px";
+
+            }
+
+        },
+
+        
+        /**
+        * Registers the Panel's header for drag & drop capability.
+        * @method registerDragDrop
+        */
+        registerDragDrop: function () {
+    
+            var me = this;
+    
+            if (this.header) {
+        
+                if (!DD) {
+        
+        
+                    return;
+                
+                }
+        
+                this.dd = new DD(this.element.id, this.id);
+        
+                if (!this.header.id) {
+                    this.header.id = this.id + "_h";
+                }
+        
+    
+                this.dd.startDrag = function () {
+        
+                    var offsetHeight,
+                        offsetWidth,
+                        viewPortWidth,
+                        viewPortHeight,
+                        scrollX,
+                        scrollY,
+                        topConstraint,
+                        leftConstraint,
+                        bottomConstraint,
+                        rightConstraint;
+    
+                    if (YAHOO.env.ua.ie == 6) {
+                        Dom.addClass(me.element,"drag");
+                    }
+        
+                    if (me.cfg.getProperty("constraintoviewport")) {
+    
+                        offsetHeight = me.element.offsetHeight;
+                        offsetWidth = me.element.offsetWidth;
+                        
+                        viewPortWidth = Dom.getViewportWidth();
+                        viewPortHeight = Dom.getViewportHeight();
+                        
+                        scrollX = Dom.getDocumentScrollLeft();
+                        scrollY = Dom.getDocumentScrollTop();
+                        
+                        topConstraint = scrollY + 10;
+                        leftConstraint = scrollX + 10;
+
+                        bottomConstraint = 
+                            scrollY + viewPortHeight - offsetHeight - 10;
+
+                        rightConstraint = 
+                            scrollX + viewPortWidth - offsetWidth - 10;
+        
+                        this.minX = leftConstraint;
+                        this.maxX = rightConstraint;
+                        this.constrainX = true;
+        
+                        this.minY = topConstraint;
+                        this.maxY = bottomConstraint;
+                        this.constrainY = true;
+    
+                    } else {
+    
+                        this.constrainX = false;
+                        this.constrainY = false;
+    
+                    }
+        
+                    me.dragEvent.fire("startDrag", arguments);
+                };
+        
+                this.dd.onDrag = function () {
+                    me.syncPosition();
+                    me.cfg.refireEvent("iframe");
+                    if (this.platform == "mac" && YAHOO.env.ua.gecko) {
+                        this.showMacGeckoScrollbars();
+                    }
+        
+                    me.dragEvent.fire("onDrag", arguments);
+                };
+        
+                this.dd.endDrag = function () {
+
+                    if (YAHOO.env.ua.ie == 6) {
+                        Dom.removeClass(me.element,"drag");
+                    }
+        
+                    me.dragEvent.fire("endDrag", arguments);
+                    me.moveEvent.fire(me.cfg.getProperty("xy"));
+                    
+                };
+        
+                this.dd.setHandleElId(this.header.id);
+                this.dd.addInvalidHandleType("INPUT");
+                this.dd.addInvalidHandleType("SELECT");
+                this.dd.addInvalidHandleType("TEXTAREA");
+            }
+        },
+        
+        /**
+        * Builds the mask that is laid over the document when the Panel is 
+        * configured to be modal.
+        * @method buildMask
+        */
+        buildMask: function () {
+            var oMask = this.mask;
+            if (!oMask) {
+                if (!m_oMaskTemplate) {
+                    m_oMaskTemplate = document.createElement("div");
+                    m_oMaskTemplate.className = "mask";
+                    m_oMaskTemplate.innerHTML = "&#160;";
+                }
+                oMask = m_oMaskTemplate.cloneNode(true);
+                oMask.id = this.id + "_mask";
+
+                document.body.insertBefore(oMask, document.body.firstChild);
+
+                this.mask = oMask;
+
+                // Stack mask based on the element zindex
+                this.stackMask();
+            }
+        },
+
+        /**
+        * Hides the modality mask.
+        * @method hideMask
+        */
+        hideMask: function () {
+            if (this.cfg.getProperty("modal") && this.mask) {
+                this.mask.style.display = "none";
+                this.hideMaskEvent.fire();
+                Dom.removeClass(document.body, "masked");
+            }
+        },
+
+        /**
+        * Shows the modality mask.
+        * @method showMask
+        */
+        showMask: function () {
+            if (this.cfg.getProperty("modal") && this.mask) {
+                Dom.addClass(document.body, "masked");
+                this.sizeMask();
+                this.mask.style.display = "block";
+                this.showMaskEvent.fire();
+            }
+        },
+
+        /**
+        * Sets the size of the modality mask to cover the entire scrollable 
+        * area of the document
+        * @method sizeMask
+        */
+        sizeMask: function () {
+            if (this.mask) {
+                this.mask.style.height = Dom.getDocumentHeight() + "px";
+                this.mask.style.width = Dom.getDocumentWidth() + "px";
+            }
+        },
+
+        /**
+         * Sets the zindex of the mask, if it exists, based on the zindex of 
+         * the Panel element. The zindex of the mask is set to be one less 
+         * than the Panel element's zindex.
+         * 
+         * <p>NOTE: This method will not bump up the zindex of the Panel
+         * to ensure that the mask has a non-negative zindex. If you require the
+         * mask zindex to be 0 or higher, the zindex of the Panel 
+         * should be set to a value higher than 0, before this method is called.
+         * </p>
+         * @method stackMask
+         */
+        stackMask: function() {
+            if (this.mask) {
+                var panelZ = Dom.getStyle(this.element, "zIndex");
+                if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) {
+                    Dom.setStyle(this.mask, "zIndex", panelZ - 1);
+                }
+            }
+        },
+
+        /**
+        * 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.
+        * @method render
+        * @param {String} appendToNode The element id to which the Module 
+        * should be appended to prior to rendering <em>OR</em>
+        * @param {HTMLElement} appendToNode The element to which the Module 
+        * should be appended to prior to rendering
+        * @return {boolean} Success or failure of the render
+        */
+        render: function (appendToNode) {
+
+            return Panel.superclass.render.call(this, 
+                appendToNode, this.innerElement);
+
+        },
+        
+        /**
+        * Removes the Panel element from the DOM and sets all child elements
+        * to null.
+        * @method destroy
+        */
+        destroy: function () {
+        
+            Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
+            
+            this.removeMask();
+        
+            if (this.close) {
+            
+                Event.purgeElement(this.close);
+        
+            }
+        
+            Panel.superclass.destroy.call(this);  
+        
+        },
+        
+        /**
+        * Returns a String representation of the object.
+        * @method toString
+        * @return {String} The string representation of the Panel.
+        */
+        toString: function () {
+            return "Panel " + this.id;
+        }
+    
+    });
+
+}());
+
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class Dialog
+    * @extends YAHOO.widget.Panel
+    * @constructor
+    * @param {String} el The element ID representing the Dialog <em>OR</em>
+    * @param {HTMLElement} el The element representing the Dialog
+    * @param {Object} userConfig The configuration object literal containing 
+    * the configuration that should be set for this Dialog. See configuration 
+    * documentation for more details.
+    */
+    YAHOO.widget.Dialog = function (el, userConfig) {
+    
+        YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
+    
+    };
+
+
+    var Event = YAHOO.util.Event,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Dom = YAHOO.util.Dom,
+        KeyListener = YAHOO.util.KeyListener,
+        Connect = YAHOO.util.Connect,
+        Dialog = YAHOO.widget.Dialog,
+        Lang = YAHOO.lang,
+
+        /**
+        * Constant representing the name of the Dialog's events
+        * @property EVENT_TYPES
+        * @private
+        * @final
+        * @type Object
+        */
+        EVENT_TYPES = {
+        
+            "BEFORE_SUBMIT": "beforeSubmit",
+            "SUBMIT": "submit",
+            "MANUAL_SUBMIT": "manualSubmit",
+            "ASYNC_SUBMIT": "asyncSubmit",
+            "FORM_SUBMIT": "formSubmit",
+            "CANCEL": "cancel"
+        
+        },
+        
+        /**
+        * Constant representing the Dialog's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "POST_METHOD": { 
+                key: "postmethod", 
+                value: "async" 
+            },
+            
+            "BUTTONS": { 
+                key: "buttons", 
+                value: "none" 
+            }
+        };    
+
+    /**
+    * Constant representing the default CSS class used for a Dialog
+    * @property YAHOO.widget.Dialog.CSS_DIALOG
+    * @static
+    * @final
+    * @type String
+    */
+    Dialog.CSS_DIALOG = "yui-dialog";
+
+    function removeButtonEventHandlers() {
+
+        var aButtons = this._aButtons,
+            nButtons,
+            oButton,
+            i;
+
+        if (Lang.isArray(aButtons)) {
+            nButtons = aButtons.length;
+
+            if (nButtons > 0) {
+                i = nButtons - 1;
+                do {
+                    oButton = aButtons[i];
+
+                    if (YAHOO.widget.Button && oButton instanceof YAHOO.widget.Button) {
+                        oButton.destroy();
+                    }
+                    else if (oButton.tagName.toUpperCase() == "BUTTON") {
+                        Event.purgeElement(oButton);
+                        Event.purgeElement(oButton, false);
+                    }
+                }
+                while (i--);
+            }
+        }
+    }
+    
+    YAHOO.extend(Dialog, YAHOO.widget.Panel, { 
+
+        
+        /**
+        * @property form
+        * @description Object reference to the Dialog's 
+        * <code>&#60;form&#62;</code> element.
+        * @default null 
+        * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-40002357">HTMLFormElement</a>
+        */
+        form: null,
+    
+        /**
+        * Initializes the class's configurable properties which can be changed 
+        * using the Dialog's Config object (cfg).
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+            Dialog.superclass.initDefaultConfig.call(this);
+        
+            /**
+            * The internally maintained callback object for use with the 
+            * Connection utility
+            * @property callback
+            * @type Object
+            */
+            this.callback = {
+    
+                /**
+                * The function to execute upon success of the 
+                * Connection submission
+                * @property callback.success
+                * @type Function
+                */
+                success: null,
+    
+                /**
+                * The function to execute upon failure of the 
+                * Connection submission
+                * @property callback.failure
+                * @type Function
+                */
+                failure: null,
+    
+                /**
+                * The arbitraty argument or arguments to pass to the Connection 
+                * callback functions
+                * @property callback.argument
+                * @type Object
+                */
+                argument: null
+    
+            };
+        
+
+            // Add form dialog config properties //
+            
+            /**
+            * The method to use for posting the Dialog's form. Possible values 
+            * are "async", "form", and "manual".
+            * @config postmethod
+            * @type String
+            * @default async
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.POST_METHOD.key, {
+                handler: this.configPostMethod, 
+                value: DEFAULT_CONFIG.POST_METHOD.value, 
+                validator: function (val) {
+                    if (val != "form" && val != "async" && val != "none" && 
+                        val != "manual") {
+                        return false;
+                    } else {
+                        return true;
+                    }
+                }
+            });
+            
+            /**
+            * Array of object literals, each containing a set of properties 
+            * defining a button to be appended into the Dialog's footer.
+            * Each button object in the buttons array can have three properties:
+            * <dt>text:</dt>
+            * <dd>The text that will display on the face of the button.  <em>
+            * Please note:</em> As of version 2.3, the text can include 
+            * HTML.</dd>
+            * <dt>handler:</dt>
+            * <dd>Can be either:
+            *     <ol>
+            *         <li>A reference to a function that should fire when the 
+            * button is clicked.  (In this case scope of this function is 
+            * always its Dialog instance.)</li>
+            *         <li>An object literal representing the code to be 
+            * executed when the button is clicked.  Format:<br> <code> {<br>  
+            * <strong>fn:</strong> Function,   &#47;&#47; The handler to call 
+            * when  the event fires.<br> <strong>obj:</strong> Object, 
+            * &#47;&#47; An  object to pass back to the handler.<br> <strong>
+            * scope:</strong>  Object &#47;&#47; The object to use for the 
+            * scope of the handler. <br> } </code> <br><em>Please note: this 
+            * functionality was added in version 2.3.</em></li>
+            *     </ol>
+            * </dd>
+            * <dt>isDefault:</dt>
+            * <dd>An optional boolean value that specifies that a button 
+            * should be highlighted and focused by default.</dd>
+            * @config buttons
+            * @type {Array|String}
+            * @default "none"
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.BUTTONS.key, {
+                handler: this.configButtons,
+                value: DEFAULT_CONFIG.BUTTONS.value
+            }); 
+            
+        },
+        
+        /**
+        * Initializes the custom events for Dialog which are fired 
+        * automatically at appropriate times by the Dialog class.
+        * @method initEvents
+        */
+        initEvents: function () {
+            Dialog.superclass.initEvents.call(this);
+        
+            var SIGNATURE = CustomEvent.LIST;
+        
+            /**
+            * CustomEvent fired prior to submission
+            * @event beforeSubmitEvent
+            */ 
+            this.beforeSubmitEvent = 
+                this.createEvent(EVENT_TYPES.BEFORE_SUBMIT);
+            this.beforeSubmitEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired after submission
+            * @event submitEvent
+            */
+            this.submitEvent = this.createEvent(EVENT_TYPES.SUBMIT);
+            this.submitEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired prior to manual submission
+            * @event manualSubmitEvent
+            */
+            this.manualSubmitEvent = 
+                this.createEvent(EVENT_TYPES.MANUAL_SUBMIT);
+            this.manualSubmitEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired prior to asynchronous submission
+            * @event asyncSubmitEvent
+            */ 
+            this.asyncSubmitEvent = this.createEvent(EVENT_TYPES.ASYNC_SUBMIT);
+            this.asyncSubmitEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired prior to form-based submission
+            * @event formSubmitEvent
+            */
+            this.formSubmitEvent = this.createEvent(EVENT_TYPES.FORM_SUBMIT);
+            this.formSubmitEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired after cancel
+            * @event cancelEvent
+            */
+            this.cancelEvent = this.createEvent(EVENT_TYPES.CANCEL);
+            this.cancelEvent.signature = SIGNATURE;
+        
+        },
+        
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the Dialog <em>OR</em>
+        * @param {HTMLElement} el The element representing the Dialog
+        * @param {Object} userConfig The configuration object literal 
+        * containing the configuration that should be set for this Dialog. 
+        * See configuration documentation for more details.
+        */
+        init: function (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
+            */
+
+            Dialog.superclass.init.call(this, el/*, userConfig*/); 
+        
+            this.beforeInitEvent.fire(Dialog);
+        
+            Dom.addClass(this.element, Dialog.CSS_DIALOG);
+        
+            this.cfg.setProperty("visible", false);
+        
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+        
+            this.showEvent.subscribe(this.focusFirst, this, true);
+            this.beforeHideEvent.subscribe(this.blurButtons, this, true);
+
+            this.subscribe("changeBody", this.registerForm);
+        
+            this.initEvent.fire(Dialog);
+        },
+        
+        /**
+        * Submits the Dialog's form depending on the value of the 
+        * "postmethod" configuration property.  <strong>Please note:
+        * </strong> As of version 2.3 this method will automatically handle 
+        * asyncronous file uploads should the Dialog instance's form contain 
+        * <code>&#60;input type="file"&#62;</code> elements.  If a Dialog 
+        * instance will be handling asyncronous file uploads, its 
+        * <code>callback</code> property will need to be setup with a 
+        * <code>upload</code> handler rather than the standard 
+        * <code>success</code> and, or <code>failure</code> handlers.  For more 
+        * information, see the <a href="http://developer.yahoo.com/yui/
+        * connection/#file">Connection Manager documenation on file uploads</a>.
+        * @method doSubmit
+        */
+        doSubmit: function () {
+    
+            var oForm = this.form,
+                bUseFileUpload = false,
+                bUseSecureFileUpload = false,
+                aElements,
+                nElements,
+                i,
+                sMethod;
+
+
+            switch (this.cfg.getProperty("postmethod")) {
+    
+            case "async":
+
+                aElements = oForm.elements;
+                nElements = aElements.length;
+
+                if (nElements > 0) {
+                
+                    i = nElements - 1;
+                
+                    do {
+                    
+                        if (aElements[i].type == "file") {
+                        
+                            bUseFileUpload = true;
+                            break;
+                        
+                        }
+                    
+                    }
+                    while(i--);
+                
+                }
+
+                if (bUseFileUpload && YAHOO.env.ua.ie && this.isSecure) {
+
+                    bUseSecureFileUpload = true;
+                
+                }
+
+                sMethod = 
+                    (oForm.getAttribute("method") || "POST").toUpperCase();
+
+                Connect.setForm(oForm, bUseFileUpload, bUseSecureFileUpload);
+
+                Connect.asyncRequest(sMethod, oForm.getAttribute("action"), 
+                    this.callback);
+
+                this.asyncSubmitEvent.fire();
+
+                break;
+
+            case "form":
+
+                oForm.submit();
+                this.formSubmitEvent.fire();
+
+                break;
+
+            case "none":
+            case "manual":
+
+                this.manualSubmitEvent.fire();
+
+                break;
+    
+            }
+    
+        },
+        
+        
+        /**
+        * Prepares the Dialog's internal FORM object, creating one if one is
+        * not currently present.
+        * @method registerForm
+        */
+        registerForm: function () {
+    
+            var form = this.element.getElementsByTagName("form")[0],
+                me = this,
+                firstElement,
+                lastElement;
+
+
+            if (this.form) {
+                if (this.form == form && 
+                    Dom.isAncestor(this.element, this.form)) {
+    
+                    return;
+                } else {
+                    Event.purgeElement(this.form);
+                    this.form = null;                
+                }
+            }
+
+            if (!form) {
+                form = document.createElement("form");
+                form.name = "frm_" + this.id;
+
+                this.body.appendChild(form);
+            }
+
+            if (form) {
+                this.form = form;
+
+                Event.on(form, "submit", function (e) {
+                    Event.stopEvent(e);
+                    this.submit();
+                    this.form.blur();
+                }, this, true);
+
+                this.firstFormElement = function () {
+                    var f, el, nElements = form.elements.length;
+
+                    for (f = 0; f < nElements; f++) {
+                        el = form.elements[f];
+                        if (el.focus && !el.disabled && el.type != "hidden") {
+                            return el;
+                        }
+                    }
+                    return null;
+                }();
+            
+                this.lastFormElement = function () {
+                    var f, el, nElements = form.elements.length;
+                    
+                    for (f = nElements - 1; f >= 0; f--) {
+                        el = form.elements[f];
+                        if (el.focus && !el.disabled && el.type != "hidden") {
+                            return el;
+                        }
+                    }
+                    return null;
+                }();
+            
+                if (this.cfg.getProperty("modal")) {
+                    firstElement = this.firstFormElement || this.firstButton;
+                    if (firstElement) {
+                        this.preventBackTab = new 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);
+                    }
+            
+                    lastElement = this.lastButton || this.lastFormElement;
+    
+                    if (lastElement) {
+                        this.preventTabOut = new 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);
+                    }
+                }
+            }
+        },
+        
+        // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * 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 Dialog.
+        * @method configClose
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For 
+        * configuration handlers, args[0] will equal the newly applied value 
+        * for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configClose: function (type, args, obj) {
+            var val = args[0];
+        
+            function doCancel(e, obj) {
+                obj.cancel();
+            }
+        
+            if (val) {
+                if (! this.close) {
+                    this.close = document.createElement("div");
+                    Dom.addClass(this.close, "container-close");
+        
+                    this.close.innerHTML = "&#160;";
+                    this.innerElement.appendChild(this.close);
+                    Event.on(this.close, "click", doCancel, this);
+                } else {
+                    this.close.style.display = "block";
+                }
+            } else {
+                if (this.close) {
+                    this.close.style.display = "none";
+                }
+            }
+        },
+        
+        /**
+        * The default event handler for the "buttons" configuration property
+        * @method configButtons
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configButtons: function (type, args, obj) {
+    
+            var Button = YAHOO.widget.Button,
+                aButtons = args[0],
+                oInnerElement = this.innerElement,
+                oButton,
+                oButtonEl,
+                oYUIButton,
+                nButtons,
+                oSpan,
+                oFooter,
+                i;
+
+            removeButtonEventHandlers.call(this);
+            
+            this._aButtons = null;
+
+            if (Lang.isArray(aButtons)) {
+
+                oSpan = document.createElement("span");
+                oSpan.className = "button-group";
+
+                nButtons = aButtons.length;
+
+                this._aButtons = [];
+        
+                for (i = 0; i < nButtons; i++) {
+
+                    oButton = aButtons[i];
+
+                    if (Button) {
+
+                        oYUIButton = new Button({ label: oButton.text, 
+                                            container: oSpan });
+
+                        oButtonEl = oYUIButton.get("element");
+
+                        if (oButton.isDefault) {
+
+                            oYUIButton.addClass("default");
+
+                            this.defaultHtmlButton = oButtonEl;
+
+                        }
+    
+                        if (Lang.isFunction(oButton.handler)) {
+    
+                            oYUIButton.set("onclick", { fn: oButton.handler, 
+                                obj: this, scope: this });
+            
+                        }
+                        else if (Lang.isObject(oButton.handler) && 
+                            Lang.isFunction(oButton.handler.fn)) {
+
+                            oYUIButton.set("onclick", { fn: oButton.handler.fn, 
+                                obj: ((!Lang.isUndefined(oButton.handler.obj)) ? 
+                                oButton.handler.obj : this), 
+                                scope: (oButton.handler.scope || this) });
+    
+                        }
+
+                        this._aButtons[this._aButtons.length] = oYUIButton;
+
+                    }
+                    else {
+        
+                        oButtonEl = document.createElement("button");
+                        oButtonEl.setAttribute("type", "button");
+            
+                        if (oButton.isDefault) {
+                            oButtonEl.className = "default";
+                            this.defaultHtmlButton = oButtonEl;
+                        }
+    
+                        oButtonEl.innerHTML = oButton.text;
+    
+                        if (Lang.isFunction(oButton.handler)) {
+    
+                            Event.on(oButtonEl, "click", oButton.handler, 
+                                this, true);
+            
+                        }
+                        else if (Lang.isObject(oButton.handler) && 
+                            Lang.isFunction(oButton.handler.fn)) {
+    
+                            Event.on(oButtonEl, "click", oButton.handler.fn, 
+                                ((!Lang.isUndefined(oButton.handler.obj)) ? 
+                                oButton.handler.obj : this), 
+                                (oButton.handler.scope || this));
+    
+                        }
+            
+                        oSpan.appendChild(oButtonEl);
+                        
+                        this._aButtons[this._aButtons.length] = oButtonEl;
+                        
+                    }
+
+                    oButton.htmlButton = oButtonEl;
+        
+                    if (i === 0) {
+                        this.firstButton = oButtonEl;
+                    }
+        
+                    if (i == (nButtons - 1)) {
+                        this.lastButton = oButtonEl;
+                    }
+        
+                }
+        
+                this.setFooter(oSpan);
+
+                oFooter = this.footer;
+                
+                if (Dom.inDocument(this.element) && 
+                    !Dom.isAncestor(oInnerElement, oFooter)) {
+    
+                    oInnerElement.appendChild(oFooter);
+                
+                }
+
+                this.buttonSpan = oSpan;
+
+            } else { // Do cleanup
+
+                oSpan = this.buttonSpan;
+                oFooter = this.footer;
+
+                if (oSpan && oFooter) {
+
+                    oFooter.removeChild(oSpan);
+
+                    this.buttonSpan = null;
+                    this.firstButton = null;
+                    this.lastButton = null;
+                    this.defaultHtmlButton = null;
+
+                }
+
+            }
+
+            this.cfg.refireEvent("iframe");
+            this.cfg.refireEvent("underlay");
+
+        },
+
+
+        /**
+        * @method getButtons
+        * @description Returns an array containing each of the Dialog's 
+        * buttons, by default an array of HTML <code>&#60;BUTTON&#60;</code> 
+        * elements.  If the Dialog's buttons were created using the 
+        * YAHOO.widget.Button class (via the inclusion of the optional Button 
+        * dependancy on the page), an array of YAHOO.widget.Button instances 
+        * is returned.
+        * @return {Array}
+        */
+        getButtons: function () {
+        
+            var aButtons = this._aButtons;
+            
+            if (aButtons) {
+            
+                return aButtons;
+            
+            }
+        
+        },
+
+        
+        /**
+        * Sets focus to the first element in the Dialog's form or the first 
+        * button defined via the "buttons" configuration property. Called 
+        * when the Dialog is made visible.
+        * @method focusFirst
+        */
+        focusFirst: function (type, args, obj) {
+    
+            var oElement = this.firstFormElement,
+                oEvent;
+
+            if (args) {
+
+                oEvent = args[1];
+
+                if (oEvent) {
+
+                    Event.stopEvent(oEvent);
+
+                }
+
+            }
+        
+
+            if (oElement) {
+
+                /*
+                    Place the call to the "focus" method inside a try/catch
+                    block to prevent IE from throwing JavaScript errors if
+                    the element is disabled or hidden.
+                */
+
+                try {
+
+                    oElement.focus();
+
+                }
+                catch(oException) {
+
+                }
+
+            } else {
+
+                this.focusDefaultButton();
+
+            }
+
+        },
+        
+        /**
+        * Sets focus to the last element in the Dialog's form or the last 
+        * button defined via the "buttons" configuration property.
+        * @method focusLast
+        */
+        focusLast: function (type, args, obj) {
+    
+            var aButtons = this.cfg.getProperty("buttons"),
+                oElement = this.lastFormElement,
+                oEvent;
+    
+            if (args) {
+
+                oEvent = args[1];
+
+                if (oEvent) {
+
+                    Event.stopEvent(oEvent);
+
+                }
+
+            }
+            
+            if (aButtons && Lang.isArray(aButtons)) {
+
+                this.focusLastButton();
+
+            } else {
+
+                if (oElement) {
+
+                    /*
+                        Place the call to the "focus" method inside a try/catch
+                        block to prevent IE from throwing JavaScript errors if
+                        the element is disabled or hidden.
+                    */
+    
+                    try {
+    
+                        oElement.focus();
+    
+                    }
+                    catch(oException) {
+    
+                    }
+
+                }
+
+            }
+
+        },
+        
+        /**
+        * Sets the focus to the button that is designated as the default via 
+        * the "buttons" configuration property. By default, this method is 
+        * called when the Dialog is made visible.
+        * @method focusDefaultButton
+        */
+        focusDefaultButton: function () {
+        
+            var oElement = this.defaultHtmlButton;
+        
+            if (oElement) {
+
+                /*
+                    Place the call to the "focus" method inside a try/catch
+                    block to prevent IE from throwing JavaScript errors if
+                    the element is disabled or hidden.
+                */
+
+                try {
+
+                    oElement.focus();
+                
+                }
+                catch(oException) {
+                
+                }
+
+            }
+        },
+        
+        /**
+        * Blurs all the buttons defined via the "buttons" 
+        * configuration property.
+        * @method blurButtons
+        */
+        blurButtons: function () {
+            
+            var aButtons = this.cfg.getProperty("buttons"),
+                nButtons,
+                oButton,
+                oElement,
+                i;
+
+            if (aButtons && Lang.isArray(aButtons)) {
+            
+                nButtons = aButtons.length;
+                
+                if (nButtons > 0) {
+                
+                    i = (nButtons - 1);
+                    
+                    do {
+                    
+                        oButton = aButtons[i];
+                        
+                        if (oButton) {
+
+                            oElement = oButton.htmlButton;
+
+                            if (oElement) {
+
+                                /*
+                                    Place the call to the "blur" method inside  
+                                    a try/catch block to prevent IE from  
+                                    throwing JavaScript errors if the element 
+                                    is disabled or hidden.
+                                */
+    
+                                try {
+            
+                                    oElement.blur();
+                                
+                                }
+                                catch(oException) {
+                                
+                                
+                                }
+                            
+                            }
+
+                        }
+                    
+                    }
+                    while(i--);
+                
+                }
+            
+            }
+
+        },
+        
+        /**
+        * Sets the focus to the first button created via the "buttons"
+        * configuration property.
+        * @method focusFirstButton
+        */
+        focusFirstButton: function () {
+    
+            var aButtons = this.cfg.getProperty("buttons"),
+                oButton,
+                oElement;
+
+            if (aButtons && Lang.isArray(aButtons)) {
+
+                oButton = aButtons[0];
+
+                if (oButton) {
+
+                    oElement = oButton.htmlButton;
+                    
+                    if (oElement) {
+
+                        /*
+                            Place the call to the "focus" method inside a 
+                            try/catch block to prevent IE from throwing 
+                            JavaScript errors if the element is disabled 
+                            or hidden.
+                        */
+    
+                        try {
+    
+                            oElement.focus();
+                        
+                        }
+                        catch(oException) {
+                        
+                        
+                        }
+                    
+                    }
+
+                }
+
+            }
+        },
+        
+        /**
+        * Sets the focus to the last button created via the "buttons" 
+        * configuration property.
+        * @method focusLastButton
+        */
+        focusLastButton: function () {
+    
+            var aButtons = this.cfg.getProperty("buttons"),
+                nButtons,
+                oButton,
+                oElement;
+
+            if (aButtons && Lang.isArray(aButtons)) {
+
+                nButtons = aButtons.length;
+                
+                if (nButtons > 0) {
+
+                    oButton = aButtons[(nButtons - 1)];
+                    
+                    if (oButton) {
+                    
+                        oElement = oButton.htmlButton;
+
+                        if (oElement) {
+
+                            /*
+                                Place the call to the "focus" method inside a 
+                                try/catch block to prevent IE from throwing 
+                                JavaScript errors if the element is disabled
+                                or hidden.
+                            */
+        
+                            try {
+        
+                                oElement.focus();
+                            
+                            }
+                            catch(oException) {
+                            
+                            
+                            }
+                        
+                        }
+                    
+                    }
+                
+                }
+            
+            }
+
+        },
+        
+        /**
+        * The default event handler for the "postmethod" configuration property
+        * @method configPostMethod
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For 
+        * configuration handlers, args[0] will equal the newly applied value 
+        * for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configPostMethod: function (type, args, obj) {
+    
+            var postmethod = args[0];
+        
+            this.registerForm();
+    
+        },
+        
+        // END BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * 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.
+        * @method validate
+        */
+        validate: function () {
+            return true;
+        },
+        
+        /**
+        * Executes a submit of the Dialog followed by a hide, if validation 
+        * is successful.
+        * @method submit
+        */
+        submit: function () {
+            if (this.validate()) {
+                this.beforeSubmitEvent.fire();
+                this.doSubmit();
+                this.submitEvent.fire();
+                this.hide();
+                return true;
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Executes the cancel of the Dialog followed by a hide.
+        * @method cancel
+        */
+        cancel: function () {
+            this.cancelEvent.fire();
+            this.hide();
+        },
+        
+        /**
+        * Returns a JSON-compatible data structure representing the data 
+        * currently contained in the form.
+        * @method getData
+        * @return {Object} A JSON object reprsenting the data of the 
+        * current form.
+        */
+        getData: function () {
+        
+            var oForm = this.form,
+                aElements,
+                nTotalElements,
+                oData,
+                sName,
+                oElement,
+                nElements,
+                sType,
+                sTagName,
+                aOptions,
+                nOptions,
+                aValues,
+                oOption,
+                sValue,
+                oRadio,
+                oCheckbox,
+                i,
+                n;    
+    
+            function isFormElement(p_oElement) {
+            
+                var sTag = p_oElement.tagName.toUpperCase();
+                
+                return ((sTag == "INPUT" || sTag == "TEXTAREA" || 
+                        sTag == "SELECT") && p_oElement.name == sName);
+    
+            }
+    
+    
+            if (oForm) {
+        
+                aElements = oForm.elements;
+                nTotalElements = aElements.length;
+                oData = {};
+    
+        
+                for (i = 0; i < nTotalElements; i++) {
+        
+                    sName = aElements[i].name;
+        
+                    /*
+                        Using "Dom.getElementsBy" to safeguard user from JS 
+                        errors that result from giving a form field (or set of 
+                        fields) the same name as a native method of a form 
+                        (like "submit") or a DOM collection (such as the "item"
+                        method). Originally tried accessing fields via the 
+                        "namedItem" method of the "element" collection, but 
+                        discovered that it won't return a collection of fields 
+                        in Gecko.
+                    */
+        
+                    oElement = Dom.getElementsBy(isFormElement, "*", oForm);
+                    nElements = oElement.length;
+        
+                    if (nElements > 0) {
+        
+                        if (nElements == 1) {
+        
+                            oElement = oElement[0];
+        
+                            sType = oElement.type;
+                            sTagName = oElement.tagName.toUpperCase();
+        
+                            switch (sTagName) {
+        
+                            case "INPUT":
+    
+                                if (sType == "checkbox") {
+    
+                                    oData[sName] = oElement.checked;
+    
+                                }
+                                else if (sType != "radio") {
+    
+                                    oData[sName] = oElement.value;
+    
+                                }
+    
+                                break;
+    
+                            case "TEXTAREA":
+    
+                                oData[sName] = oElement.value;
+    
+                                break;
+    
+                            case "SELECT":
+    
+                                aOptions = oElement.options;
+                                nOptions = aOptions.length;
+                                aValues = [];
+    
+                                for (n = 0; n < nOptions; n++) {
+    
+                                    oOption = aOptions[n];
+    
+                                    if (oOption.selected) {
+    
+                                        sValue = oOption.value;
+    
+                                        if (!sValue || sValue === "") {
+    
+                                            sValue = oOption.text;
+    
+                                        }
+    
+                                        aValues[aValues.length] = sValue;
+    
+                                    }
+    
+                                }
+    
+                                oData[sName] = aValues;
+    
+                                break;
+        
+                            }
+        
+        
+                        }
+                        else {
+        
+                            sType = oElement[0].type;
+        
+                            switch (sType) {
+        
+                            case "radio":
+    
+                                for (n = 0; n < nElements; n++) {
+    
+                                    oRadio = oElement[n];
+    
+                                    if (oRadio.checked) {
+    
+                                        oData[sName] = oRadio.value;
+                                        break;
+    
+                                    }
+    
+                                }
+    
+                                break;
+    
+                            case "checkbox":
+    
+                                aValues = [];
+    
+                                for (n = 0; n < nElements; n++) {
+    
+                                    oCheckbox = oElement[n];
+    
+                                    if (oCheckbox.checked) {
+    
+                                        aValues[aValues.length] = 
+                                            oCheckbox.value;
+    
+                                    }
+    
+                                }
+    
+                                oData[sName] = aValues;
+    
+                                break;
+        
+                            }
+        
+                        }
+        
+                    }
+        
+                }
+        
+            }
+        
+        
+            return oData;
+        
+        },
+        
+        /**
+        * Removes the Panel element from the DOM and sets all child elements 
+        * to null.
+        * @method destroy
+        */
+        destroy: function () {
+        
+            removeButtonEventHandlers.call(this);
+            
+            this._aButtons = null;
+
+            var aForms = this.element.getElementsByTagName("form"),
+                oForm;
+            
+            if (aForms.length > 0) {
+
+                oForm = aForms[0];
+
+                if (oForm) {
+                    Event.purgeElement(oForm);
+                    if (oForm.parentNode) {
+                        oForm.parentNode.removeChild(oForm);
+                    }
+                    this.form = null;
+                }
+            }
+        
+            Dialog.superclass.destroy.call(this);  
+        
+        },
+        
+        /**
+        * Returns a string representation of the object.
+        * @method toString
+        * @return {String} The string representation of the Dialog
+        */
+        toString: function () {
+            return "Dialog " + this.id;
+        }
+    
+    });
+
+}());
+
+(function () {
+
+    /**
+    * 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.
+    * @namespace YAHOO.widget
+    * @class SimpleDialog
+    * @extends YAHOO.widget.Dialog
+    * @constructor
+    * @param {String} el The element ID representing the SimpleDialog 
+    * <em>OR</em>
+    * @param {HTMLElement} el The element representing the SimpleDialog
+    * @param {Object} userConfig The configuration object literal containing 
+    * the configuration that should be set for this SimpleDialog. See 
+    * configuration documentation for more details.
+    */
+    YAHOO.widget.SimpleDialog = function (el, userConfig) {
+    
+        YAHOO.widget.SimpleDialog.superclass.constructor.call(this, 
+            el, userConfig);
+    
+    };
+
+    var Dom = YAHOO.util.Dom,
+        SimpleDialog = YAHOO.widget.SimpleDialog,
+    
+        /**
+        * Constant representing the SimpleDialog's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "ICON": { 
+                key: "icon", 
+                value: "none", 
+                suppressEvent: true  
+            },
+        
+            "TEXT": { 
+                key: "text", 
+                value: "", 
+                suppressEvent: true, 
+                supercedes: ["icon"] 
+            }
+        
+        };
+
+    /**
+    * Constant for the standard network icon for a blocking action
+    * @property YAHOO.widget.SimpleDialog.ICON_BLOCK
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_BLOCK = "blckicon";
+    
+    /**
+    * Constant for the standard network icon for alarm
+    * @property YAHOO.widget.SimpleDialog.ICON_ALARM
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_ALARM = "alrticon";
+    
+    /**
+    * Constant for the standard network icon for help
+    * @property YAHOO.widget.SimpleDialog.ICON_HELP
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_HELP  = "hlpicon";
+    
+    /**
+    * Constant for the standard network icon for info
+    * @property YAHOO.widget.SimpleDialog.ICON_INFO
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_INFO  = "infoicon";
+    
+    /**
+    * Constant for the standard network icon for warn
+    * @property YAHOO.widget.SimpleDialog.ICON_WARN
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_WARN  = "warnicon";
+    
+    /**
+    * Constant for the standard network icon for a tip
+    * @property YAHOO.widget.SimpleDialog.ICON_TIP
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_TIP   = "tipicon";
+
+    /**
+    * Constant representing the name of the CSS class applied to the element 
+    * created by the "icon" configuration property.
+    * @property YAHOO.widget.SimpleDialog.ICON_CSS_CLASSNAME
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.ICON_CSS_CLASSNAME = "yui-icon";
+    
+    /**
+    * Constant representing the default CSS class used for a SimpleDialog
+    * @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
+    * @static
+    * @final
+    * @type String
+    */
+    SimpleDialog.CSS_SIMPLEDIALOG = "yui-simple-dialog";
+
+    
+    YAHOO.extend(SimpleDialog, YAHOO.widget.Dialog, {
+    
+        /**
+        * Initializes the class's configurable properties which can be changed 
+        * using the SimpleDialog's Config object (cfg).
+        * @method initDefaultConfig
+        */
+        initDefaultConfig: function () {
+        
+            SimpleDialog.superclass.initDefaultConfig.call(this);
+        
+            // Add dialog config properties //
+        
+            /**
+            * Sets the informational icon for the SimpleDialog
+            * @config icon
+            * @type String
+            * @default "none"
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.ICON.key, {
+                handler: this.configIcon,
+                value: DEFAULT_CONFIG.ICON.value,
+                suppressEvent: DEFAULT_CONFIG.ICON.suppressEvent
+            });
+        
+            /**
+            * Sets the text for the SimpleDialog
+            * @config text
+            * @type String
+            * @default ""
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, { 
+                handler: this.configText, 
+                value: DEFAULT_CONFIG.TEXT.value, 
+                suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.TEXT.supercedes 
+            });
+        
+        },
+        
+        
+        /**
+        * 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.
+        * @method init
+        * @param {String} el The element ID representing the SimpleDialog 
+        * <em>OR</em>
+        * @param {HTMLElement} el The element representing the SimpleDialog
+        * @param {Object} userConfig The configuration object literal 
+        * containing the configuration that should be set for this 
+        * SimpleDialog. See configuration documentation for more details.
+        */
+        init: function (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
+            */
+
+            SimpleDialog.superclass.init.call(this, el/*, userConfig*/);
+        
+            this.beforeInitEvent.fire(SimpleDialog);
+        
+            Dom.addClass(this.element, SimpleDialog.CSS_SIMPLEDIALOG);
+        
+            this.cfg.queueProperty("postmethod", "manual");
+        
+            if (userConfig) {
+                this.cfg.applyConfig(userConfig, true);
+            }
+        
+            this.beforeRenderEvent.subscribe(function () {
+                if (! this.body) {
+                    this.setBody("");
+                }
+            }, this, true);
+        
+            this.initEvent.fire(SimpleDialog);
+        
+        },
+        
+        /**
+        * Prepares the SimpleDialog's internal FORM object, creating one if one 
+        * is not currently present, and adding the value hidden field.
+        * @method registerForm
+        */
+        registerForm: function () {
+
+            SimpleDialog.superclass.registerForm.call(this);
+
+            this.form.innerHTML += "<input type=\"hidden\" name=\"" + 
+                this.id + "\" value=\"\"/>";
+
+        },
+        
+        // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * Fired when the "icon" property is set.
+        * @method configIcon
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configIcon: function (type,args,obj) {
+        
+            var sIcon = args[0],
+                oBody = this.body,
+                sCSSClass = SimpleDialog.ICON_CSS_CLASSNAME,
+                oIcon,
+                oIconParent;
+        
+            if (sIcon && sIcon != "none") {
+
+                oIcon = Dom.getElementsByClassName(sCSSClass, "*" , oBody);
+
+                if (oIcon) {
+
+                    oIconParent = oIcon.parentNode;
+                    
+                    if (oIconParent) {
+                    
+                        oIconParent.removeChild(oIcon);
+                        
+                        oIcon = null;
+                    
+                    }
+
+                }
+
+
+                if (sIcon.indexOf(".") == -1) {
+
+                    oIcon = document.createElement("span");
+                    oIcon.className = (sCSSClass + " " + sIcon);
+                    oIcon.innerHTML = "&#160;";
+
+                } else {
+
+                    oIcon = document.createElement("img");
+                    oIcon.src = (this.imageRoot + sIcon);
+                    oIcon.className = sCSSClass;
+
+                }
+                
+
+                if (oIcon) {
+                
+                    oBody.insertBefore(oIcon, oBody.firstChild);
+                
+                }
+
+            }
+
+        },
+        
+        /**
+        * Fired when the "text" property is set.
+        * @method configText
+        * @param {String} type The CustomEvent type (usually the property name)
+        * @param {Object[]} args The CustomEvent arguments. For configuration 
+        * handlers, args[0] will equal the newly applied value for the property.
+        * @param {Object} obj The scope object. For configuration handlers, 
+        * this will usually equal the owner.
+        */
+        configText: function (type,args,obj) {
+            var text = args[0];
+            if (text) {
+                this.setBody(text);
+                this.cfg.refireEvent("icon");
+            }
+        },
+        
+        // END BUILT-IN PROPERTY EVENT HANDLERS //
+        
+        /**
+        * Returns a string representation of the object.
+        * @method toString
+        * @return {String} The string representation of the SimpleDialog
+        */
+        toString: function () {
+            return "SimpleDialog " + this.id;
+        }
+    
+    });
+
+}());
+
+(function () {
+
+    /**
+    * ContainerEffect encapsulates animation transitions that are executed when 
+    * an Overlay is shown or hidden.
+    * @namespace YAHOO.widget
+    * @class ContainerEffect
+    * @constructor
+    * @param {YAHOO.widget.Overlay} overlay The Overlay that the animation 
+    * should be associated with
+    * @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(Number), and method(i.e. Easing.easeIn).
+    * @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(Number), and method(i.e. Easing.easeIn).
+    * @param {HTMLElement} targetElement Optional. The target element that  
+    * should be animated during the transition. Defaults to overlay.element.
+    * @param {class} Optional. The animation class to instantiate. Defaults to 
+    * YAHOO.util.Anim. Other options include YAHOO.util.Motion.
+    */
+    YAHOO.widget.ContainerEffect = 
+    
+        function (overlay, attrIn, attrOut, targetElement, animClass) {
+    
+        if (!animClass) {
+            animClass = YAHOO.util.Anim;
+        }
+        
+        /**
+        * The overlay to animate
+        * @property overlay
+        * @type YAHOO.widget.Overlay
+        */
+        this.overlay = overlay;
+    
+        /**
+        * The animation attributes to use when transitioning into view
+        * @property attrIn
+        * @type Object
+        */
+        this.attrIn = attrIn;
+    
+        /**
+        * The animation attributes to use when transitioning out of view
+        * @property attrOut
+        * @type Object
+        */
+        this.attrOut = attrOut;
+    
+        /**
+        * The target element to be animated
+        * @property targetElement
+        * @type HTMLElement
+        */
+        this.targetElement = targetElement || overlay.element;
+    
+        /**
+        * The animation class to use for animating the overlay
+        * @property animClass
+        * @type class
+        */
+        this.animClass = animClass;
+    
+    };
+
+
+    var Dom = YAHOO.util.Dom,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Easing = YAHOO.util.Easing,
+        ContainerEffect = YAHOO.widget.ContainerEffect;
+
+
+    /**
+    * A pre-configured ContainerEffect instance that can be used for fading 
+    * an overlay in and out.
+    * @method FADE
+    * @static
+    * @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
+    * @param {Number} dur The duration of the animation
+    * @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
+    */
+    ContainerEffect.FADE = function (overlay, dur) {
+    
+        var fade = new ContainerEffect(overlay, 
+        
+            { attributes: { opacity: { from: 0, to: 1 } }, 
+                duration: dur, 
+                method: Easing.easeIn }, 
+            
+            { attributes: { opacity: { to: 0 } },
+                duration: dur, 
+                method: Easing.easeOut }, 
+            
+            overlay.element);
+        
+    
+        fade.handleStartAnimateIn = function (type,args,obj) {
+            Dom.addClass(obj.overlay.element, "hide-select");
+        
+            if (! obj.overlay.underlay) {
+                obj.overlay.cfg.refireEvent("underlay");
+            }
+        
+            if (obj.overlay.underlay) {
+    
+                obj.initialUnderlayOpacity = 
+                    Dom.getStyle(obj.overlay.underlay, "opacity");
+    
+                obj.overlay.underlay.style.filter = null;
+    
+            }
+        
+            Dom.setStyle(obj.overlay.element, "visibility", "visible");
+            Dom.setStyle(obj.overlay.element, "opacity", 0);
+        };
+        
+    
+        fade.handleCompleteAnimateIn = function (type,args,obj) {
+            Dom.removeClass(obj.overlay.element, "hide-select");
+        
+            if (obj.overlay.element.style.filter) {
+                obj.overlay.element.style.filter = null;
+            }
+        
+            if (obj.overlay.underlay) {
+                Dom.setStyle(obj.overlay.underlay, "opacity", 
+                    obj.initialUnderlayOpacity);
+            }
+        
+            obj.overlay.cfg.refireEvent("iframe");
+            obj.animateInCompleteEvent.fire();
+        };
+        
+    
+        fade.handleStartAnimateOut = function (type, args, obj) {
+            Dom.addClass(obj.overlay.element, "hide-select");
+        
+            if (obj.overlay.underlay) {
+                obj.overlay.underlay.style.filter = null;
+            }
+        };
+        
+    
+        fade.handleCompleteAnimateOut =  function (type, args, obj) {
+            Dom.removeClass(obj.overlay.element, "hide-select");
+            if (obj.overlay.element.style.filter) {
+                obj.overlay.element.style.filter = null;
+            }
+            Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+            Dom.setStyle(obj.overlay.element, "opacity", 1);
+        
+            obj.overlay.cfg.refireEvent("iframe");
+        
+            obj.animateOutCompleteEvent.fire();
+        };
+        
+        fade.init();
+        return fade;
+    };
+    
+    
+    /**
+    * A pre-configured ContainerEffect instance that can be used for sliding an 
+    * overlay in and out.
+    * @method SLIDE
+    * @static
+    * @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
+    * @param {Number} dur The duration of the animation
+    * @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
+    */
+    ContainerEffect.SLIDE = function (overlay, dur) {
+    
+        var x = overlay.cfg.getProperty("x") || Dom.getX(overlay.element),
+    
+            y = overlay.cfg.getProperty("y") || Dom.getY(overlay.element),
+    
+            clientWidth = Dom.getClientWidth(),
+    
+            offsetWidth = overlay.element.offsetWidth,
+    
+            slide = new ContainerEffect(overlay, 
+            
+            { attributes: { points: { to: [x, y] } },
+                duration: dur,
+                method: Easing.easeIn },
+    
+            { attributes: { points: { to: [(clientWidth + 25), y] } },
+                duration: dur,
+                method: 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";
+        };
+        
+        slide.handleTweenAnimateIn = function (type, args, obj) {
+        
+            var pos = Dom.getXY(obj.overlay.element),
+                currentX = pos[0],
+                currentY = pos[1];
+        
+            if (Dom.getStyle(obj.overlay.element, "visibility") == 
+                "hidden" && currentX < x) {
+
+                Dom.setStyle(obj.overlay.element, "visibility", "visible");
+
+            }
+        
+            obj.overlay.cfg.setProperty("xy", [currentX, currentY], true);
+            obj.overlay.cfg.refireEvent("iframe");
+        };
+        
+        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();
+        };
+        
+        slide.handleStartAnimateOut = function (type, args, obj) {
+    
+            var vw = Dom.getViewportWidth(),
+                pos = Dom.getXY(obj.overlay.element),
+                yso = pos[1],
+                currentTo = obj.animOut.attributes.points.to;
+    
+            obj.animOut.attributes.points.to = [(vw + 25), yso];
+    
+        };
+        
+        slide.handleTweenAnimateOut = function (type, args, obj) {
+    
+            var pos = Dom.getXY(obj.overlay.element),
+                xto = pos[0],
+                yto = pos[1];
+        
+            obj.overlay.cfg.setProperty("xy", [xto, yto], true);
+            obj.overlay.cfg.refireEvent("iframe");
+        };
+        
+        slide.handleCompleteAnimateOut = function (type, args, obj) {
+            Dom.setStyle(obj.overlay.element, "visibility", "hidden");
+        
+            obj.overlay.cfg.setProperty("xy", [x, y]);
+            obj.animateOutCompleteEvent.fire();
+        };
+        
+        slide.init();
+        return slide;
+    };
+    
+    ContainerEffect.prototype = {
+    
+        /**
+        * Initializes the animation classes and events.
+        * @method init
+        */
+        init: function () {
+
+            this.beforeAnimateInEvent = this.createEvent("beforeAnimateIn");
+            this.beforeAnimateInEvent.signature = CustomEvent.LIST;
+            
+            this.beforeAnimateOutEvent = this.createEvent("beforeAnimateOut");
+            this.beforeAnimateOutEvent.signature = CustomEvent.LIST;
+        
+            this.animateInCompleteEvent = this.createEvent("animateInComplete");
+            this.animateInCompleteEvent.signature = CustomEvent.LIST;
+        
+            this.animateOutCompleteEvent = 
+                this.createEvent("animateOutComplete");
+            this.animateOutCompleteEvent.signature = CustomEvent.LIST;
+        
+            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);
+
+        },
+        
+        /**
+        * Triggers the in-animation.
+        * @method animateIn
+        */
+        animateIn: function () {
+            this.beforeAnimateInEvent.fire();
+            this.animIn.animate();
+        },
+        
+        /**
+        * Triggers the out-animation.
+        * @method animateOut
+        */
+        animateOut: function () {
+            this.beforeAnimateOutEvent.fire();
+            this.animOut.animate();
+        },
+        
+        /**
+        * The default onStart handler for the in-animation.
+        * @method handleStartAnimateIn
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleStartAnimateIn: function (type, args, obj) { },
+    
+        /**
+        * The default onTween handler for the in-animation.
+        * @method handleTweenAnimateIn
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleTweenAnimateIn: function (type, args, obj) { },
+    
+        /**
+        * The default onComplete handler for the in-animation.
+        * @method handleCompleteAnimateIn
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleCompleteAnimateIn: function (type, args, obj) { },
+        
+        /**
+        * The default onStart handler for the out-animation.
+        * @method handleStartAnimateOut
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleStartAnimateOut: function (type, args, obj) { },
+    
+        /**
+        * The default onTween handler for the out-animation.
+        * @method handleTweenAnimateOut
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleTweenAnimateOut: function (type, args, obj) { },
+    
+        /**
+        * The default onComplete handler for the out-animation.
+        * @method handleCompleteAnimateOut
+        * @param {String} type The CustomEvent type
+        * @param {Object[]} args The CustomEvent arguments
+        * @param {Object} obj The scope object
+        */
+        handleCompleteAnimateOut: function (type, args, obj) { },
+        
+        /**
+        * Returns a string representation of the object.
+        * @method toString
+        * @return {String} The string representation of the ContainerEffect
+        */
+        toString: function () {
+            var output = "ContainerEffect";
+            if (this.overlay) {
+                output += " [" + this.overlay.toString() + "]";
+            }
+            return output;
+        }
+    
+    };
+
+    YAHOO.lang.augmentProto(ContainerEffect, YAHOO.util.EventProvider);
+
+})();
+
+YAHOO.register("container", YAHOO.widget.Module, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/datasource-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/datasource-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/datasource-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1365 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The DataSource utility provides a common configurable interface for widgets
+ * to access a variety of data, from JavaScript arrays to online servers over
+ * XHR.
+ *
+ * @namespace YAHOO.util
+ * @module datasource
+ * @requires yahoo, event
+ * @optional connection
+ * @title DataSource Utility
+ * @beta
+ */
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The DataSource class defines and manages a live set of data for widgets to
+ * interact with. Examples of live databases include in-memory
+ * local data such as a JavaScript array, a JavaScript function, or JSON, or
+ * remote data such as data retrieved through an XHR connection.
+ *
+ * @class DataSource
+ * @uses YAHOO.util.EventProvider
+ * @constructor
+ * @param oLiveData {Object} Pointer to live database.
+ * @param oConfigs {Object} (optional) Object literal of configuration values.
+ */
+YAHOO.util.DataSource = function(oLiveData, oConfigs) {
+    // Set any config params passed in to override defaults
+    if(oConfigs && (oConfigs.constructor == Object)) {
+        for(var sConfig in oConfigs) {
+            if(sConfig) {
+                this[sConfig] = oConfigs[sConfig];
+            }
+        }
+    }
+    
+    if(!oLiveData) {
+        return;
+    }
+
+    if(oLiveData.nodeType && oLiveData.nodeType == 9) {
+        this.dataType = YAHOO.util.DataSource.TYPE_XML;
+    }
+    else if(YAHOO.lang.isArray(oLiveData)) {
+        this.dataType = YAHOO.util.DataSource.TYPE_JSARRAY;
+    }
+    else if(YAHOO.lang.isString(oLiveData)) {
+        this.dataType = YAHOO.util.DataSource.TYPE_XHR;
+    }
+    else if(YAHOO.lang.isFunction(oLiveData)) {
+        this.dataType = YAHOO.util.DataSource.TYPE_JSFUNCTION;
+    }
+    else if(oLiveData.nodeName && (oLiveData.nodeName.toLowerCase() == "table")) {
+        this.dataType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
+    }
+    else if(YAHOO.lang.isObject(oLiveData)) {
+        this.dataType = YAHOO.util.DataSource.TYPE_JSON;
+    }
+    else {
+        this.dataType = YAHOO.util.DataSource.TYPE_UNKNOWN;
+    }
+
+    this.liveData = oLiveData;
+    this._oQueue = {interval:null, conn:null, requests:[]};
+
+
+    // Validate and initialize public configs
+    var maxCacheEntries = this.maxCacheEntries;
+    if(!YAHOO.lang.isNumber(maxCacheEntries) || (maxCacheEntries < 0)) {
+        maxCacheEntries = 0;
+    }
+
+    // Initialize local cache
+    if(maxCacheEntries > 0 && !this._aCache) {
+        this._aCache = [];
+    }
+
+    this._sName = "DataSource instance" + YAHOO.util.DataSource._nIndex;
+    YAHOO.util.DataSource._nIndex++;
+
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Custom Events
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Fired when a request is made to the local cache.
+     *
+     * @event cacheRequestEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     */
+    this.createEvent("cacheRequestEvent");
+
+    /**
+     * Fired when data is retrieved from the local cache.
+     *
+     * @event getCachedResponseEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.response {Object} The response object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     * @param oArgs.tId {Number} Transaction ID.
+     */
+    this.createEvent("cacheResponseEvent");
+
+    /**
+     * Fired when a request is sent to the live data source.
+     *
+     * @event requestEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     */
+    this.createEvent("requestEvent");
+
+    /**
+     * Fired when live data source sends response.
+     *
+     * @event responseEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.response {Object} The raw response object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     */
+    this.createEvent("responseEvent");
+
+    /**
+     * Fired when response is parsed.
+     *
+     * @event responseParseEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.response {Object} The parsed response object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     */
+    this.createEvent("responseParseEvent");
+
+    /**
+     * Fired when response is cached.
+     *
+     * @event responseCacheEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.response {Object} The parsed response object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     */
+    this.createEvent("responseCacheEvent");
+    /**
+     * Fired when an error is encountered with the live data source.
+     *
+     * @event dataErrorEvent
+     * @param oArgs.request {Object} The request object.
+     * @param oArgs.callback {Function} The callback function.
+     * @param oArgs.caller {Object} The parent object of the callback function.
+     * @param oArgs.message {String} The error message.
+     */
+    this.createEvent("dataErrorEvent");
+
+    /**
+     * Fired when the local cache is flushed.
+     *
+     * @event cacheFlushEvent
+     */
+    this.createEvent("cacheFlushEvent");
+};
+
+YAHOO.augment(YAHOO.util.DataSource, YAHOO.util.EventProvider);
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public constants
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Type is unknown.
+ *
+ * @property TYPE_UNKNOWN
+ * @type Number
+ * @final
+ * @default -1
+ */
+YAHOO.util.DataSource.TYPE_UNKNOWN = -1;
+
+/**
+ * Type is a JavaScript Array.
+ *
+ * @property TYPE_JSARRAY
+ * @type Number
+ * @final
+ * @default 0
+ */
+YAHOO.util.DataSource.TYPE_JSARRAY = 0;
+
+/**
+ * Type is a JavaScript Function.
+ *
+ * @property TYPE_JSFUNCTION
+ * @type Number
+ * @final
+ * @default 1
+ */
+YAHOO.util.DataSource.TYPE_JSFUNCTION = 1;
+
+/**
+ * Type is hosted on a server via an XHR connection.
+ *
+ * @property TYPE_XHR
+ * @type Number
+ * @final
+ * @default 2
+ */
+YAHOO.util.DataSource.TYPE_XHR = 2;
+
+/**
+ * Type is JSON.
+ *
+ * @property TYPE_JSON
+ * @type Number
+ * @final
+ * @default 3
+ */
+YAHOO.util.DataSource.TYPE_JSON = 3;
+
+/**
+ * Type is XML.
+ *
+ * @property TYPE_XML
+ * @type Number
+ * @final
+ * @default 4
+ */
+YAHOO.util.DataSource.TYPE_XML = 4;
+
+/**
+ * Type is plain text.
+ *
+ * @property TYPE_TEXT
+ * @type Number
+ * @final
+ * @default 5
+ */
+YAHOO.util.DataSource.TYPE_TEXT = 5;
+
+/**
+ * Type is an HTML TABLE element.
+ *
+ * @property TYPE_HTMLTABLE
+ * @type Number
+ * @final
+ * @default 6
+ */
+YAHOO.util.DataSource.TYPE_HTMLTABLE = 6;
+
+/**
+ * Error message for invalid dataresponses.
+ *
+ * @property ERROR_DATAINVALID
+ * @type String
+ * @final
+ * @default "Invalid data"
+ */
+YAHOO.util.DataSource.ERROR_DATAINVALID = "Invalid data";
+
+/**
+ * Error message for null data responses.
+ *
+ * @property ERROR_DATANULL
+ * @type String
+ * @final
+ * @default "Null data"
+ */
+YAHOO.util.DataSource.ERROR_DATANULL = "Null data";
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to index multiple DataSource instances.
+ *
+ * @property DataSource._nIndex
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.util.DataSource._nIndex = 0;
+
+/**
+ * Internal class variable to assign unique transaction IDs.
+ *
+ * @property DataSource._nTransactionId
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.util.DataSource._nTransactionId = 0;
+
+/**
+ * Name of DataSource instance.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.util.DataSource.prototype._sName = null;
+
+/**
+ * Local cache of data result object literals indexed chronologically.
+ *
+ * @property _aCache
+ * @type Object[]
+ * @private
+ */
+YAHOO.util.DataSource.prototype._aCache = null;
+
+/**
+ * Local queue of request connections, enabled if queue needs to be managed.
+ *
+ * @property _oQueue
+ * @type Object
+ * @private
+ */
+YAHOO.util.DataSource.prototype._oQueue = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Max size of the local cache.  Set to 0 to turn off caching.  Caching is
+ * useful to reduce the number of server connections.  Recommended only for data
+ * sources that return comprehensive results for queries or when stale data is
+ * not an issue.
+ *
+ * @property maxCacheEntries
+ * @type Number
+ * @default 0
+ */
+YAHOO.util.DataSource.prototype.maxCacheEntries = 0;
+
+ /**
+ * Pointer to live database.
+ *
+ * @property liveData
+ * @type Object
+ */
+YAHOO.util.DataSource.prototype.liveData = null;
+
+/**
+ * Where the live data is held.
+ *
+ * @property dataType
+ * @type Number
+ * @default YAHOO.util.DataSource.TYPE_UNKNOWN
+ *
+ */
+YAHOO.util.DataSource.prototype.dataType = YAHOO.util.DataSource.TYPE_UNKNOWN;
+
+/**
+ * Format of response.
+ *
+ * @property responseType
+ * @type Number
+ * @default YAHOO.util.DataSource.TYPE_UNKNOWN
+ */
+YAHOO.util.DataSource.prototype.responseType = YAHOO.util.DataSource.TYPE_UNKNOWN;
+
+/**
+ * Response schema object literal takes a combination of the following properties:
+ *
+ * <dl>
+ * <dt>resultsList</dt> <dd>Pointer to array of tabular data</dd>
+ * <dt>resultNode</dt> <dd>Pointer to node name of row data (XML data only)</dd>
+ * <dt>recordDelim</dt> <dd>Record delimiter (text data only)</dd>
+ * <dt>fieldDelim</dt> <dd>Field delimiter (text data only)</dd>
+ * <dt>fields</dt> <dd>Array of field names (aka keys), or array of object literals
+ * such as: {key:"fieldname",parser:YAHOO.util.DataSource.parseDate}</dd>
+ * </dl>
+ *
+ * @property responseSchema
+ * @type Object
+ */
+YAHOO.util.DataSource.prototype.responseSchema = null;
+
+ /**
+ * Alias to YUI Connection Manager. Allows implementers to specify their own
+ * subclasses of the YUI Connection Manager utility.
+ *
+ * @property connMgr
+ * @type Object
+ * @default YAHOO.util.Connect
+ */
+YAHOO.util.DataSource.prototype.connMgr = null;
+
+ /**
+ * If data is accessed over XHR via Connection Manager, this setting defines
+ * request/response management in the following manner:
+ * <dl>
+ *     <dt>queueRequests</dt>
+ *     <dd>If a request is already in progress, wait until response is returned
+ *     before sending the next request.</dd>
+ *
+ *     <dt>cancelStaleRequests</dt>
+ *     <dd>If a request is already in progress, cancel it before sending the next
+ *     request.</dd>
+ *
+ *     <dt>ignoreStaleResponses</dt>
+ *     <dd>Send all requests, but handle only the response for the most recently
+ *     sent request.</dd>
+ *
+ *     <dt>allowAll</dt>
+ *     <dd>Send all requests and handle all responses.</dd>
+ *
+ * </dl>
+ *
+ * @property connXhrMode
+ * @type String
+ * @default "allowAll"
+ */
+YAHOO.util.DataSource.prototype.connXhrMode = "allowAll";
+
+ /**
+ * If data is accessed over XHR via Connection Manager, true if data should be
+ * sent via POST, otherwise data will be sent via GET.
+ *
+ * @property connMethodPost
+ * @type Boolean
+ * @default false
+ */
+YAHOO.util.DataSource.prototype.connMethodPost = false;
+
+ /**
+ * If data is accessed over XHR via Connection Manager, the connection timeout
+ * defines how many  milliseconds the XHR connection will wait for a server
+ * response. Any non-zero value will enable the Connection utility's
+ * Auto-Abort feature.
+ *
+ * @property connTimeout
+ * @type Number
+ * @default 0
+ */
+YAHOO.util.DataSource.prototype.connTimeout = 0;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public static methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Converts data to type String.
+ *
+ * @method DataSource.parseString
+ * @param oData {String | Number | Boolean | Date | Array | Object} Data to parse.
+ * The special values null and undefined will return null.
+ * @return {Number} A string, or null.
+ * @static
+ */
+YAHOO.util.DataSource.parseString = function(oData) {
+    // Special case null and undefined
+    if(!YAHOO.lang.isValue(oData)) {
+        return null;
+    }
+    
+    //Convert to string
+    var string = oData + "";
+
+    // Validate
+    if(YAHOO.lang.isString(string)) {
+        return string;
+    }
+    else {
+        return null;
+    }
+};
+
+/**
+ * Converts data to type Number.
+ *
+ * @method DataSource.parseNumber
+ * @param oData {String | Number | Boolean | Null} Data to convert. Beware, null
+ * returns as 0.
+ * @return {Number} A number, or null if NaN.
+ * @static
+ */
+YAHOO.util.DataSource.parseNumber = function(oData) {
+    //Convert to number
+    var number = oData * 1;
+    
+    // Validate
+    if(YAHOO.lang.isNumber(number)) {
+        return number;
+    }
+    else {
+        return null;
+    }
+};
+// Backward compatibility
+YAHOO.util.DataSource.convertNumber = function(oData) {
+    return YAHOO.util.DataSource.parseNumber(oData);
+};
+
+/**
+ * Converts data to type Date.
+ *
+ * @method DataSource.parseDate
+ * @param oData {Date | String | Number} Data to convert.
+ * @return {Date} A Date instance.
+ * @static
+ */
+YAHOO.util.DataSource.parseDate = function(oData) {
+    var date = null;
+    
+    //Convert to date
+    if(!(oData instanceof Date)) {
+        date = new Date(oData);
+    }
+    else {
+        return oData;
+    }
+    
+    // Validate
+    if(date instanceof Date) {
+        return date;
+    }
+    else {
+        return null;
+    }
+};
+// Backward compatibility
+YAHOO.util.DataSource.convertDate = function(oData) {
+    return YAHOO.util.DataSource.parseDate(oData);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Public accessor to the unique name of the DataSource instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the DataSource instance.
+ */
+YAHOO.util.DataSource.prototype.toString = function() {
+    return this._sName;
+};
+
+/**
+ * Overridable method passes request to cache and returns cached response if any,
+ * refreshing the hit in the cache as the newest item. Returns null if there is
+ * no cache hit.
+ *
+ * @method getCachedResponse
+ * @param oRequest {Object} Request object.
+ * @param oCallback {Function} Handler function to receive the response.
+ * @param oCaller {Object} The Calling object that is making the request.
+ * @return {Object} Cached response object or null.
+ */
+YAHOO.util.DataSource.prototype.getCachedResponse = function(oRequest, oCallback, oCaller) {
+    var aCache = this._aCache;
+    var nCacheLength = (aCache) ? aCache.length : 0;
+    var oResponse = null;
+
+    // If cache is enabled...
+    if((this.maxCacheEntries > 0) && aCache && (nCacheLength > 0)) {
+        this.fireEvent("cacheRequestEvent", {request:oRequest,callback:oCallback,caller:oCaller});
+
+        // Loop through each cached element
+        for(var i = nCacheLength-1; i >= 0; i--) {
+            var oCacheElem = aCache[i];
+
+            // Defer cache hit logic to a public overridable method
+            if(this.isCacheHit(oRequest,oCacheElem.request)) {
+                // Grab the cached response
+                oResponse = oCacheElem.response;
+                // The cache returned a hit!
+                // Remove element from its original location
+                aCache.splice(i,1);
+                // Add as newest
+                this.addToCache(oRequest, oResponse);
+                this.fireEvent("cacheResponseEvent", {request:oRequest,response:oResponse,callback:oCallback,caller:oCaller});
+                break;
+            }
+        }
+    }
+    return oResponse;
+};
+
+/**
+ * Default overridable method matches given request to given cached request.
+ * Returns true if is a hit, returns false otherwise.  Implementers should
+ * override this method to customize the cache-matching algorithm.
+ *
+ * @method isCacheHit
+ * @param oRequest {Object} Request object.
+ * @param oCachedRequest {Object} Cached request object.
+ * @return {Boolean} True if given request matches cached request, false otherwise.
+ */
+YAHOO.util.DataSource.prototype.isCacheHit = function(oRequest, oCachedRequest) {
+    return (oRequest === oCachedRequest);
+};
+
+/**
+ * Adds a new item to the cache. If cache is full, evicts the stalest item
+ * before adding the new item.
+ *
+ * @method addToCache
+ * @param oRequest {Object} Request object.
+ * @param oResponse {Object} Response object to cache.
+ */
+YAHOO.util.DataSource.prototype.addToCache = function(oRequest, oResponse) {
+    var aCache = this._aCache;
+    if(!aCache) {
+        return;
+    }
+
+    //TODO: check for duplicate entries
+
+    // If the cache is full, make room by removing stalest element (index=0)
+    while(aCache.length >= this.maxCacheEntries) {
+        aCache.shift();
+    }
+
+    // Add to cache in the newest position, at the end of the array
+    var oCacheElem = {request:oRequest,response:oResponse};
+    aCache.push(oCacheElem);
+    this.fireEvent("responseCacheEvent", {request:oRequest,response:oResponse});
+};
+
+/**
+ * Flushes cache.
+ *
+ * @method flushCache
+ */
+YAHOO.util.DataSource.prototype.flushCache = function() {
+    if(this._aCache) {
+        this._aCache = [];
+        this.fireEvent("cacheFlushEvent");
+    }
+};
+
+/**
+ * First looks for cached response, then sends request to live data.
+ *
+ * @method sendRequest
+ * @param oRequest {Object} Request object.
+ * @param oCallback {Function} Handler function to receive the response.
+ * @param oCaller {Object} The Calling object that is making the request.
+ * @return {Number} Transaction ID, or null if response found in cache.
+ */
+YAHOO.util.DataSource.prototype.sendRequest = function(oRequest, oCallback, oCaller) {
+    // First look in cache
+    var oCachedResponse = this.getCachedResponse(oRequest, oCallback, oCaller);
+    if(oCachedResponse) {
+        oCallback.call(oCaller, oRequest, oCachedResponse);
+        return null;
+    }
+
+    // Not in cache, so forward request to live data
+    return this.makeConnection(oRequest, oCallback, oCaller);
+};
+
+/**
+ * Overridable method provides default functionality to make a connection to
+ * live data in order to send request. The response coming back is then
+ * forwarded to the handleResponse function. This method should be customized
+ * to achieve more complex implementations.
+ *
+ * @method makeConnection
+ * @param oRequest {Object} Request object.
+ * @param oCallback {Function} Handler function to receive the response.
+ * @param oCaller {Object} The Calling object that is making the request.
+ * @return {Number} Transaction ID.
+ */
+YAHOO.util.DataSource.prototype.makeConnection = function(oRequest, oCallback, oCaller) {
+    this.fireEvent("requestEvent", {request:oRequest,callback:oCallback,caller:oCaller});
+    var oRawResponse = null;
+    var tId = YAHOO.util.DataSource._nTransactionId++;
+
+    // How to make the connection depends on the type of data
+    switch(this.dataType) {
+        // If the live data is a JavaScript Function
+        // pass the request in as a parameter and
+        // forward the return value to the handler
+        case YAHOO.util.DataSource.TYPE_JSFUNCTION:
+            oRawResponse = this.liveData(oRequest);
+            this.handleResponse(oRequest, oRawResponse, oCallback, oCaller, tId);
+            break;
+        // If the live data is over Connection Manager
+        // set up the callback object and
+        // pass the request in as a URL query and
+        // forward the response to the handler
+        case YAHOO.util.DataSource.TYPE_XHR:
+            var oSelf = this;
+            var oConnMgr = this.connMgr || YAHOO.util.Connect;
+            var oQueue = this._oQueue;
+
+            /**
+             * Define Connection Manager success handler
+             *
+             * @method _xhrSuccess
+             * @param oResponse {Object} HTTPXMLRequest object
+             * @private
+             */
+            var _xhrSuccess = function(oResponse) {
+                // If response ID does not match last made request ID,
+                // silently fail and wait for the next response
+                if(oResponse && (this.connXhrMode == "ignoreStaleResponses") &&
+                        (oResponse.tId != oQueue.conn.tId)) {
+                    return null;
+                }
+                // Error if no response
+                else if(!oResponse) {
+                    this.fireEvent("dataErrorEvent", {request:oRequest,
+                            callback:oCallback, caller:oCaller,
+                            message:YAHOO.util.DataSource.ERROR_DATANULL});
+
+                    // Send error response back to the caller with the error flag on
+                    oCallback.call(oCaller, oRequest, oResponse, true);
+
+                    return null;
+                }
+                // Forward to handler
+                else {
+                    this.handleResponse(oRequest, oResponse, oCallback, oCaller, tId);
+                }
+            };
+
+            /**
+             * Define Connection Manager failure handler
+             *
+             * @method _xhrFailure
+             * @param oResponse {Object} HTTPXMLRequest object
+             * @private
+             */
+            var _xhrFailure = function(oResponse) {
+                this.fireEvent("dataErrorEvent", {request:oRequest,
+                        callback:oCallback, caller:oCaller,
+                        message:YAHOO.util.DataSource.ERROR_DATAINVALID});
+
+                // Backward compatibility
+                if((this.liveData.lastIndexOf("?") !== this.liveData.length-1) &&
+                    (oRequest.indexOf("?") !== 0)){
+                }
+
+                // Send failure response back to the caller with the error flag on
+                oCallback.call(oCaller, oRequest, oResponse, true);
+                return null;
+            };
+
+            /**
+             * Define Connection Manager callback object
+             *
+             * @property _xhrCallback
+             * @param oResponse {Object} HTTPXMLRequest object
+             * @private
+             */
+             var _xhrCallback = {
+                success:_xhrSuccess,
+                failure:_xhrFailure,
+                scope: this
+            };
+
+            // Apply Connection Manager timeout
+            if(YAHOO.lang.isNumber(this.connTimeout)) {
+                _xhrCallback.timeout = this.connTimeout;
+            }
+
+            // Cancel stale requests
+            if(this.connXhrMode == "cancelStaleRequests") {
+                    // Look in queue for stale requests
+                    if(oQueue.conn) {
+                        if(oConnMgr.abort) {
+                            oConnMgr.abort(oQueue.conn);
+                            oQueue.conn = null;
+                        }
+                        else {
+                        }
+                    }
+            }
+
+            // Get ready to send the request URL
+            if(oConnMgr && oConnMgr.asyncRequest) {
+                var sLiveData = this.liveData;
+                var isPost = this.connMethodPost;
+                var sMethod = (isPost) ? "POST" : "GET";
+                var sUri = (isPost) ? sLiveData : sLiveData+oRequest;
+                var sRequest = (isPost) ? oRequest : null;
+
+                // Send the request right away
+                if(this.connXhrMode != "queueRequests") {
+                    oQueue.conn = oConnMgr.asyncRequest(sMethod, sUri, _xhrCallback, sRequest);
+                }
+                // Queue up then send the request
+                else {
+                    // Found a request already in progress
+                    if(oQueue.conn) {
+                        // Add request to queue
+                        oQueue.requests.push({request:oRequest, callback:_xhrCallback});
+
+                        // Interval needs to be started
+                        if(!oQueue.interval) {
+                            oQueue.interval = setInterval(function() {
+                                // Connection is in progress
+                                if(oConnMgr.isCallInProgress(oQueue.conn)) {
+                                    return;
+                                }
+                                else {
+                                    // Send next request
+                                    if(oQueue.requests.length > 0) {
+                                        sUri = (isPost) ? sLiveData : sLiveData+oQueue.requests[0].request;
+                                        sRequest = (isPost) ? oQueue.requests[0].request : null;
+                                        oQueue.conn = oConnMgr.asyncRequest(sMethod, sUri, oQueue.requests[0].callback, sRequest);
+
+                                        // Remove request from queue
+                                        oQueue.requests.shift();
+                                    }
+                                    // No more requests
+                                    else {
+                                        clearInterval(oQueue.interval);
+                                        oQueue.interval = null;
+                                    }
+                                }
+                            }, 50);
+                        }
+                    }
+                    // Nothing is in progress
+                    else {
+                        oQueue.conn = oConnMgr.asyncRequest(sMethod, sUri, _xhrCallback, sRequest);
+                    }
+                }
+            }
+            else {
+                // Send null response back to the caller with the error flag on
+                oCallback.call(oCaller, oRequest, null, true);
+            }
+
+            break;
+        // Simply forward the entire data object to the handler
+        default:
+            /* accounts for the following cases:
+            YAHOO.util.DataSource.TYPE_UNKNOWN:
+            YAHOO.util.DataSource.TYPE_JSARRAY:
+            YAHOO.util.DataSource.TYPE_JSON:
+            YAHOO.util.DataSource.TYPE_HTMLTABLE:
+            YAHOO.util.DataSource.TYPE_XML:
+            */
+            oRawResponse = this.liveData;
+            this.handleResponse(oRequest, oRawResponse, oCallback, oCaller, tId);
+            break;
+    }
+    return tId;
+};
+
+/**
+ * Handles raw data response from live data source. Sends a parsed response object
+ * to the callback function in this format:
+ *
+ * fnCallback(oRequest, oParsedResponse)
+ *
+ * where the oParsedResponse object literal with the following properties:
+ * <ul>
+ *     <li>tId {Number} Unique transaction ID</li>
+ *     <li>results {Array} Array of parsed data results</li>
+ *     <li>error {Boolean} True if there was an error</li>
+ * </ul>
+ *
+ * @method handleResponse
+ * @param oRequest {Object} Request object
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @param oCallback {Function} Handler function to receive the response.
+ * @param oCaller {Object} The calling object that is making the request.
+ * @param tId {Number} Transaction ID.
+ */
+YAHOO.util.DataSource.prototype.handleResponse = function(oRequest, oRawResponse, oCallback, oCaller, tId) {
+    this.fireEvent("responseEvent", {request:oRequest, response:oRawResponse,
+            callback:oCallback, caller:oCaller, tId: tId});
+    var xhr = (this.dataType == YAHOO.util.DataSource.TYPE_XHR) ? true : false;
+    var oParsedResponse = null;
+    var bError = false;
+
+    // Access to the raw response before it gets parsed
+    oRawResponse = this.doBeforeParseData(oRequest, oRawResponse);
+
+    switch(this.responseType) {
+        case YAHOO.util.DataSource.TYPE_JSARRAY:
+            if(xhr && oRawResponse.responseText) {
+                oRawResponse = oRawResponse.responseText;
+            }
+            oParsedResponse = this.parseArrayData(oRequest, oRawResponse);
+            break;
+        case YAHOO.util.DataSource.TYPE_JSON:
+            if(xhr && oRawResponse.responseText) {
+                oRawResponse = oRawResponse.responseText;
+            }
+            oParsedResponse = this.parseJSONData(oRequest, oRawResponse);
+            break;
+        case YAHOO.util.DataSource.TYPE_HTMLTABLE:
+            if(xhr && oRawResponse.responseText) {
+                oRawResponse = oRawResponse.responseText;
+            }
+            oParsedResponse = this.parseHTMLTableData(oRequest, oRawResponse);
+            break;
+        case YAHOO.util.DataSource.TYPE_XML:
+            if(xhr && oRawResponse.responseXML) {
+                oRawResponse = oRawResponse.responseXML;
+            }
+            oParsedResponse = this.parseXMLData(oRequest, oRawResponse);
+            break;
+        case YAHOO.util.DataSource.TYPE_TEXT:
+            if(xhr && oRawResponse.responseText) {
+                oRawResponse = oRawResponse.responseText;
+            }
+            oParsedResponse = this.parseTextData(oRequest, oRawResponse);
+            break;
+        default:
+            //var contentType = oRawResponse.getResponseHeader["Content-Type"];
+            break;
+    }
+
+
+    if(oParsedResponse) {
+        // Last chance to touch the raw response or the parsed response
+        oParsedResponse.tId = tId;
+        oParsedResponse = this.doBeforeCallback(oRequest, oRawResponse, oParsedResponse);
+        this.fireEvent("responseParseEvent", {request:oRequest,
+                response:oParsedResponse, callback:oCallback, caller:oCaller});
+        // Cache the response
+        this.addToCache(oRequest, oParsedResponse);
+    }
+    else {
+        this.fireEvent("dataErrorEvent", {request:oRequest, callback:oCallback,
+                caller:oCaller, message:YAHOO.util.DataSource.ERROR_DATANULL});
+        
+        // Send response back to the caller with the error flag on
+        oParsedResponse = {error:true};
+    }
+    
+    // Send the response back to the caller
+    oCallback.call(oCaller, oRequest, oParsedResponse);
+};
+
+/**
+ * Overridable method gives implementers access to the original raw response
+ * before the data gets parsed. Implementers should take care not to return an
+ * unparsable or otherwise invalid raw response.
+ *
+ * @method doBeforeParseData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Raw response for parsing.
+ */
+YAHOO.util.DataSource.prototype.doBeforeParseData = function(oRequest, oRawResponse) {
+    return oRawResponse;
+};
+
+/**
+ * Overridable method gives implementers access to the original raw response and
+ * the parsed response (parsed against the given schema) before the data
+ * is added to the cache (if applicable) and then sent back to callback function.
+ * This is your chance to access the raw response and/or populate the parsed
+ * response with any custom data.
+ *
+ * @method doBeforeCallback
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @param oParsedResponse {Object} The parsed response to return to calling object.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.doBeforeCallback = function(oRequest, oRawResponse, oParsedResponse) {
+    return oParsedResponse;
+};
+
+/**
+ * Overridable method parses raw array data into a response object.
+ *
+ * @method parseArrayData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.parseArrayData = function(oRequest, oRawResponse) {
+    if(YAHOO.lang.isArray(oRawResponse) && YAHOO.lang.isArray(this.responseSchema.fields)) {
+        var oParsedResponse = {results:[]};
+        var fields = this.responseSchema.fields;
+        for(var i=oRawResponse.length-1; i>-1; i--) {
+            var oResult = {};
+            for(var j=fields.length-1; j>-1; j--) {
+                var field = fields[j];
+                var key = (YAHOO.lang.isValue(field.key)) ? field.key : field;
+                var data = (YAHOO.lang.isValue(oRawResponse[i][j])) ? oRawResponse[i][j] : oRawResponse[i][key];
+                // Backward compatibility
+                if(!field.parser && field.converter) {
+                    field.parser = field.converter;
+                }
+                if(field.parser) {
+                    data = field.parser.call(this, data);
+                }
+                // Safety measure
+                if(data === undefined) {
+                    data = null;
+                }
+                oResult[key] = data;
+            }
+            oParsedResponse.results.unshift(oResult);
+        }
+        return oParsedResponse;
+    }
+    else {
+        return null;
+    }
+};
+
+/**
+ * Overridable method parses raw plain text data into a response object.
+ *
+ * @method parseTextData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.parseTextData = function(oRequest, oRawResponse) {
+    var oParsedResponse = {};
+    if(YAHOO.lang.isString(oRawResponse) &&
+            YAHOO.lang.isArray(this.responseSchema.fields) &&
+            YAHOO.lang.isString(this.responseSchema.recordDelim) &&
+            YAHOO.lang.isString(this.responseSchema.fieldDelim)) {
+        oParsedResponse.results = [];
+        var recDelim = this.responseSchema.recordDelim;
+        var fieldDelim = this.responseSchema.fieldDelim;
+        var fields = this.responseSchema.fields;
+        if(oRawResponse.length > 0) {
+            // Delete the last line delimiter at the end of the data if it exists
+            var newLength = oRawResponse.length-recDelim.length;
+            if(oRawResponse.substr(newLength) == recDelim) {
+                oRawResponse = oRawResponse.substr(0, newLength);
+            }
+            // Split along record delimiter to get an array of strings
+            var recordsarray = oRawResponse.split(recDelim);
+            // Cycle through each record, except the first which contains header info
+            for(var i = recordsarray.length-1; i>-1; i--) {
+                var oResult = {};
+                for(var j=fields.length-1; j>-1; j--) {
+                    // Split along field delimter to get each data value
+                    var fielddataarray = recordsarray[i].split(fieldDelim);
+
+                    // Remove quotation marks from edges, if applicable
+                    var data = fielddataarray[j];
+                    if(data.charAt(0) == "\"") {
+                        data = data.substr(1);
+                    }
+                    if(data.charAt(data.length-1) == "\"") {
+                        data = data.substr(0,data.length-1);
+                    }
+                    var field = fields[j];
+                    var key = (YAHOO.lang.isValue(field.key)) ? field.key : field;
+                    // Backward compatibility
+                    if(!field.parser && field.converter) {
+                        field.parser = field.converter;
+                    }
+                    if(field.parser) {
+                        data = field.parser.call(this, data);
+                    }
+                    // Safety measure
+                    if(data === undefined) {
+                        data = null;
+                    }
+                    oResult[key] = data;
+                }
+                oParsedResponse.results.unshift(oResult);
+            }
+        }
+    }
+    else {
+        oParsedResponse.error = true;
+    }
+    return oParsedResponse;
+};
+
+/**
+ * Overridable method parses raw XML data into a response object.
+ *
+ * @method parseXMLData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.parseXMLData = function(oRequest, oRawResponse) {
+        var bError = false;
+        var oParsedResponse = {};
+        var xmlList = (this.responseSchema.resultNode) ?
+                oRawResponse.getElementsByTagName(this.responseSchema.resultNode) :
+                null;
+        if(!xmlList || !YAHOO.lang.isArray(this.responseSchema.fields)) {
+            bError = true;
+        }
+        // Loop through each result
+        else {
+            oParsedResponse.results = [];
+            for(var k = xmlList.length-1; k >= 0 ; k--) {
+                var result = xmlList.item(k);
+                var oResult = {};
+                // Loop through each data field in each result using the schema
+                for(var m = this.responseSchema.fields.length-1; m >= 0 ; m--) {
+                    var field = this.responseSchema.fields[m];
+                    var key = (YAHOO.lang.isValue(field.key)) ? field.key : field;
+                    var data = null;
+                    // Values may be held in an attribute...
+                    var xmlAttr = result.attributes.getNamedItem(key);
+                    if(xmlAttr) {
+                        data = xmlAttr.value;
+                    }
+                    // ...or in a node
+                    else {
+                        var xmlNode = result.getElementsByTagName(key);
+                        if(xmlNode && xmlNode.item(0) && xmlNode.item(0).firstChild) {
+                            data = xmlNode.item(0).firstChild.nodeValue;
+                        }
+                        else {
+                               data = "";
+                        }
+                    }
+                    // Backward compatibility
+                    if(!field.parser && field.converter) {
+                        field.parser = field.converter;
+                    }
+                    if(field.parser) {
+                        data = field.parser.call(this, data);
+                    }
+                    // Safety measure
+                    if(data === undefined) {
+                        data = null;
+                    }
+                    oResult[key] = data;
+                }
+                // Capture each array of values into an array of results
+                oParsedResponse.results.unshift(oResult);
+            }
+        }
+        if(bError) {
+            oParsedResponse.error = true;
+        }
+        else {
+        }
+        return oParsedResponse;
+};
+
+/**
+ * Overridable method parses raw JSON data into a response object.
+ *
+ * @method parseJSONData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.parseJSONData = function(oRequest, oRawResponse) {
+    var oParsedResponse = {};
+    if(oRawResponse && YAHOO.lang.isArray(this.responseSchema.fields)) {
+        var fields = this.responseSchema.fields;
+        var bError = false;
+        oParsedResponse.results = [];
+        var jsonObj,jsonList;
+
+        // Parse JSON object out if it's a string
+        if(YAHOO.lang.isString(oRawResponse)) {
+            // Check for latest JSON lib but divert KHTML clients
+            var isNotMac = (navigator.userAgent.toLowerCase().indexOf('khtml')== -1);
+            if(oRawResponse.parseJSON && isNotMac) {
+                // Use the new JSON utility if available
+                jsonObj = oRawResponse.parseJSON();
+                if(!jsonObj) {
+                    bError = true;
+                }
+            }
+            // Check for older JSON lib but divert KHTML clients
+            else if(window.JSON && JSON.parse && isNotMac) {
+                // Use the JSON utility if available
+                jsonObj = JSON.parse(oRawResponse);
+                if(!jsonObj) {
+                    bError = true;
+                }
+            }
+            // No JSON lib found so parse the string
+            else {
+                try {
+                    // Trim leading spaces
+                    while (oRawResponse.length > 0 &&
+                            (oRawResponse.charAt(0) != "{") &&
+                            (oRawResponse.charAt(0) != "[")) {
+                        oRawResponse = oRawResponse.substring(1, oRawResponse.length);
+                    }
+
+                    if(oRawResponse.length > 0) {
+                        // Strip extraneous stuff at the end
+                        var objEnd = Math.max(oRawResponse.lastIndexOf("]"),oRawResponse.lastIndexOf("}"));
+                        oRawResponse = oRawResponse.substring(0,objEnd+1);
+
+                        // Turn the string into an object literal...
+                        // ...eval is necessary here
+                        jsonObj = eval("(" + oRawResponse + ")");
+                        if(!jsonObj) {
+                            bError = true;
+                        }
+
+                    }
+                    else {
+                        jsonObj = null;
+                        bError = true;
+                    }
+                }
+                catch(e) {
+                    bError = true;
+               }
+            }
+        }
+        // Response must already be a JSON object
+        else if(oRawResponse.constructor == Object) {
+            jsonObj = oRawResponse;
+        }
+        // Not a string or an object
+        else {
+            bError = true;
+        }
+        // Now that we have a JSON object, parse a jsonList out of it
+        if(jsonObj && jsonObj.constructor == Object) {
+            try {
+                // eval is necessary here since schema can be of unknown depth
+                jsonList = eval("jsonObj." + this.responseSchema.resultsList);
+            }
+            catch(e) {
+                bError = true;
+            }
+        }
+
+        if(bError || !jsonList) {
+            oParsedResponse.error = true;
+        }
+        if(jsonList && !YAHOO.lang.isArray(jsonList)) {
+            jsonList = [jsonList];
+        }
+        else if(!jsonList) {
+            jsonList = [];
+        }
+
+        // Loop through the array of all responses...
+        for(var i = jsonList.length-1; i >= 0 ; i--) {
+            var oResult = {};
+            var jsonResult = jsonList[i];
+            // ...and loop through each data field value of each response
+            for(var j = fields.length-1; j >= 0 ; j--) {
+                var field = fields[j];
+                var key = (YAHOO.lang.isValue(field.key)) ? field.key : field;
+                // ...and capture data into an array mapped according to the schema...
+                // eval is necessary here since schema can be of unknown depth
+                var data = eval("jsonResult." + key);
+                
+                // Backward compatibility
+                if(!field.parser && field.converter) {
+                    field.parser = field.converter;
+                }
+                if(field.parser) {
+                    data = field.parser.call(this, data);
+                }
+                // Safety measure
+                if(data === undefined) {
+                    data = null;
+                }
+                oResult[key] = data;
+            }
+            // Capture the array of data field values in an array of results
+            oParsedResponse.results.unshift(oResult);
+        }
+    }
+    else {
+        oParsedResponse.error = true;
+    }
+    return oParsedResponse;
+};
+
+/**
+ * Overridable method parses raw HTML TABLE element data into a response object.
+ *
+ * @method parseHTMLTableData
+ * @param oRequest {Object} Request object.
+ * @param oRawResponse {Object} The raw response from the live database.
+ * @return {Object} Parsed response object.
+ */
+YAHOO.util.DataSource.prototype.parseHTMLTableData = function(oRequest, oRawResponse) {
+        var bError = false;
+        var elTable = oRawResponse;
+        var fields = this.responseSchema.fields;
+        var oParsedResponse = {};
+        oParsedResponse.results = [];
+
+        // Iterate through each TBODY
+        for(var i=0; i<elTable.tBodies.length; i++) {
+            var elTbody = elTable.tBodies[i];
+
+            // Iterate through each TR
+            for(var j=elTbody.rows.length-1; j>-1; j--) {
+                var elRow = elTbody.rows[j];
+                var oResult = {};
+                
+                for(var k=fields.length-1; k>-1; k--) {
+                    var field = fields[k];
+                    var key = (YAHOO.lang.isValue(field.key)) ? field.key : field;
+                    var data = elRow.cells[k].innerHTML;
+
+                    // Backward compatibility
+                    if(!field.parser && field.converter) {
+                        field.parser = field.converter;
+                    }
+                    if(field.parser) {
+                        data = field.parser.call(this, data);
+                    }
+                    // Safety measure
+                    if(data === undefined) {
+                        data = null;
+                    }
+                    oResult[key] = data;
+                }
+                oParsedResponse.results.unshift(oResult);
+            }
+        }
+
+        if(bError) {
+            oParsedResponse.error = true;
+        }
+        else {
+        }
+        return oParsedResponse;
+};
+
+YAHOO.register("datasource", YAHOO.util.DataSource, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/datatable-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/datatable-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/datatable-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,9362 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The DataTable widget provides a progressively enhanced DHTML control for
+ * displaying tabular data across A-grade browsers.
+ *
+ * @module datatable
+ * @requires yahoo, dom, event, datasource
+ * @optional dragdrop
+ * @title DataTable Widget
+ * @beta
+ */
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * DataTable class for the YUI DataTable widget.
+ *
+ * @namespace YAHOO.widget
+ * @class DataTable
+ * @uses YAHOO.util.EventProvider
+ * @constructor
+ * @param elContainer {HTMLElement} Container element for the TABLE.
+ * @param aColumnDefs {Object[]} Array of object literal Column definitions.
+ * @param oDataSource {YAHOO.util.DataSource} DataSource instance.
+ * @param oConfigs {object} (optional) Object literal of configuration values.
+ */
+YAHOO.widget.DataTable = function(elContainer,aColumnDefs,oDataSource,oConfigs) {
+    // Internal vars
+    this._nIndex = YAHOO.widget.DataTable._nCount;
+    this._sName = "instance" + this._nIndex;
+    this.id = "yui-dt"+this._nIndex;
+
+    // Initialize container element
+    this._initContainerEl(elContainer);
+    if(!this._elContainer) {
+        return;
+    }
+
+    // Initialize configs
+    this._initConfigs(oConfigs);
+
+    // Initialize ColumnSet
+    this._initColumnSet(aColumnDefs);
+    if(!this._oColumnSet) {
+        return;
+    }
+    
+    // Initialize RecordSet
+    this._initRecordSet();
+    if(!this._oRecordSet) {
+        return;
+    }
+
+    // Initialize DataSource
+    this._initDataSource(oDataSource);
+    if(!this._oDataSource) {
+        return;
+    }
+
+    // Progressive enhancement special case
+    if(this._oDataSource.dataType == YAHOO.util.DataSource.TYPE_HTMLTABLE) {
+        this._oDataSource.sendRequest(this.get("initialRequest"), this._onDataReturnEnhanceTable, this);
+    }
+    else {
+        // Initialize DOM elements
+        this._initTableEl();
+        if(!this._elTable || !this._elThead || !this._elTbody) {
+            return;
+        }
+
+        // Call Element's constructor after DOM elements are created
+        // but *before* table is populated with data
+        YAHOO.widget.DataTable.superclass.constructor.call(this, this._elContainer, this._oConfigs);
+        
+        //HACK: Set the Paginator values here via updatePaginator
+        if(this._oConfigs && this._oConfigs.paginator) {
+            this.updatePaginator(this._oConfigs.paginator);
+        }
+
+        // Send out for data in an asynchronous request
+        this._oDataSource.sendRequest(this.get("initialRequest"), this.onDataReturnInitializeTable, this);
+    }
+
+    // Initialize inline Cell editing
+    this._initCellEditorEl();
+
+    // Initialize Column sort
+    this._initColumnSort();
+
+    // Initialize DOM event listeners
+    this._initDomEvents();
+
+    YAHOO.widget.DataTable._nCount++;
+};
+
+if(YAHOO.util.Element) {
+    YAHOO.lang.extend(YAHOO.widget.DataTable, YAHOO.util.Element);
+}
+else {
+}
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Superclass methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Implementation of Element's abstract method. Sets up config values.
+ *
+ * @method initAttributes
+ * @param oConfigs {Object} (Optional) Object literal definition of configuration values.
+ * @private
+ */
+
+YAHOO.widget.DataTable.prototype.initAttributes = function(oConfigs) {
+    oConfigs = oConfigs || {};
+    YAHOO.widget.DataTable.superclass.initAttributes.call(this, oConfigs);
+
+    /**
+    * @attribute summary
+    * @description Value for the SUMMARY attribute.
+    * @type String
+    */
+    this.setAttributeConfig("summary", {
+        value: null,
+        validator: YAHOO.lang.isString,
+        method: function(sSummary) {
+            this._elTable.summary = sSummary;
+        }
+    });
+
+    /**
+    * @attribute selectionMode
+    * @description Specifies row or cell selection mode. Accepts the following strings:
+    *    <dl>
+    *      <dt>"standard"</dt>
+    *      <dd>Standard row selection with support for modifier keys to enable
+    *      multiple selections.</dd>
+    *
+    *      <dt>"single"</dt>
+    *      <dd>Row selection with modifier keys disabled to not allow
+    *      multiple selections.</dd>
+    *
+    *      <dt>"singlecell"</dt>
+    *      <dd>Cell selection with modifier keys disabled to not allow
+    *      multiple selections.</dd>
+    *
+    *      <dt>"cellblock"</dt>
+    *      <dd>Cell selection with support for modifier keys to enable multiple
+    *      selections in a block-fashion, like a spreadsheet.</dd>
+    *
+    *      <dt>"cellrange"</dt>
+    *      <dd>Cell selection with support for modifier keys to enable multiple
+    *      selections in a range-fashion, like a calendar.</dd>
+    *    </dl>
+    *
+    * @default "standard"
+    * @type String
+    */
+    this.setAttributeConfig("selectionMode", {
+        value: "standard",
+        validator: YAHOO.lang.isString
+    });
+
+    /**
+    * @attribute initialRequest
+    * @description Defines the initial request that gets sent to the DataSource.
+    * @type String
+    */
+    this.setAttributeConfig("initialRequest", {
+        value: "",
+        validator: YAHOO.lang.isString
+    });
+
+    /**
+    * @attribute sortedBy
+    * @description Object literal provides metadata for initial sort values if
+    * data will arrive pre-sorted:
+    * <dl>
+    *     <dt>sortedBy.key</dt>
+    *     <dd>{String} Key of sorted Column</dd>
+    *     <dt>sortedBy.dir</dt>
+    *     <dd>{String} Initial sort direction, either "asc" or "desc"</dd>
+    * </dl>
+    * @type Object
+    */
+    this.setAttributeConfig("sortedBy", {
+        value: null,
+        // TODO: accepted array for nested sorts
+        validator: function(oNewSortedBy) {
+            return (oNewSortedBy && (oNewSortedBy.constructor == Object) && oNewSortedBy.key);
+        },
+        method: function(oNewSortedBy) {
+            // Remove ASC/DESC from TH
+            var oOldSortedBy = this.get("sortedBy");
+            if(oOldSortedBy && (oOldSortedBy.constructor == Object) && oOldSortedBy.key) {
+                var oldColumn = this._oColumnSet.getColumn(oOldSortedBy.key);
+                var oldThEl = this.getThEl(oldColumn);
+                YAHOO.util.Dom.removeClass(oldThEl, YAHOO.widget.DataTable.CLASS_ASC);
+                YAHOO.util.Dom.removeClass(oldThEl, YAHOO.widget.DataTable.CLASS_DESC);
+            }
+            
+            // Set ASC/DESC on TH
+            var column = (oNewSortedBy.column) ? oNewSortedBy.column : this._oColumnSet.getColumn(oNewSortedBy.key);
+            if(column) {
+                var newClass = (oNewSortedBy.dir && (oNewSortedBy.dir != "asc")) ?
+                        YAHOO.widget.DataTable.CLASS_DESC :
+                        YAHOO.widget.DataTable.CLASS_ASC;
+                YAHOO.util.Dom.addClass(this.id + "-col" + column.getId(), newClass);
+            }
+        }
+    });
+
+    /**
+    * @attribute paginator
+    * @description Object literal of pagination values.
+    * @default <br>
+    *   { containers:[], // UI container elements <br>
+    *   rowsPerPage:500, // 500 rows <br>
+    *   currentPage:1,  // page one <br>
+    *   pageLinks:0,    // show all links <br>
+    *   pageLinksStart:1, // first link is page 1 <br>
+    *   dropdownOptions:null, // no dropdown <br>
+    *   links: [], // links elements <br>
+    *   dropdowns: [] } //dropdown elements
+    * 
+    * @type Object
+    */
+    this.setAttributeConfig("paginator", {
+        value: {
+            rowsPerPage:500, // 500 rows per page
+            currentPage:1,  // show page one
+            startRecordIndex:0, // start with first Record
+            totalRecords:0, // how many Records total
+            totalPages:0, // how many pages total
+            rowsThisPage:0, // how many rows this page
+            pageLinks:0,    // show all links
+            pageLinksStart:1, // first link is page 1
+            dropdownOptions: null, //no dropdown
+            containers:[], // Paginator container element references
+            dropdowns: [], //dropdown element references,
+            links: [] // links elements
+        },
+        validator: function(oNewPaginator) {
+            if(oNewPaginator && (oNewPaginator.constructor == Object)) {
+                // Check for incomplete set of values
+                if((oNewPaginator.rowsPerPage !== undefined) &&
+                        (oNewPaginator.currentPage !== undefined) &&
+                        (oNewPaginator.startRecordIndex !== undefined) &&
+                        (oNewPaginator.totalRecords !== undefined) &&
+                        (oNewPaginator.totalPages !== undefined) &&
+                        (oNewPaginator.rowsThisPage !== undefined) &&
+                        (oNewPaginator.pageLinks !== undefined) &&
+                        (oNewPaginator.pageLinksStart !== undefined) &&
+                        (oNewPaginator.dropdownOptions !== undefined) &&
+                        (oNewPaginator.containers !== undefined) &&
+                        (oNewPaginator.dropdowns !== undefined) &&
+                        (oNewPaginator.links !== undefined)) {
+
+                    // Validate each value
+                    if(YAHOO.lang.isNumber(oNewPaginator.rowsPerPage) &&
+                            YAHOO.lang.isNumber(oNewPaginator.currentPage) &&
+                            YAHOO.lang.isNumber(oNewPaginator.startRecordIndex) &&
+                            YAHOO.lang.isNumber(oNewPaginator.totalRecords) &&
+                            YAHOO.lang.isNumber(oNewPaginator.totalPages) &&
+                            YAHOO.lang.isNumber(oNewPaginator.rowsThisPage) &&
+                            YAHOO.lang.isNumber(oNewPaginator.pageLinks) &&
+                            YAHOO.lang.isNumber(oNewPaginator.pageLinksStart) &&
+                            YAHOO.lang.isArray(oNewPaginator.dropdownOptions) &&
+                            YAHOO.lang.isArray(oNewPaginator.containers) &&
+                            YAHOO.lang.isArray(oNewPaginator.dropdowns) &&
+                            YAHOO.lang.isArray(oNewPaginator.links)) {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+    });
+
+    /**
+    * @attribute paginated
+    * @description True if built-in client-side pagination is enabled
+    * @default false
+    * @type Boolean
+    */
+    this.setAttributeConfig("paginated", {
+        value: false,
+        validator: YAHOO.lang.isBoolean,
+        method: function(oParam) {
+            var oPaginator = this.get("paginator");
+            var aContainerEls = oPaginator.containers;
+            var i;
+            
+            // Paginator is enabled
+            if(oParam) {
+                // No containers found, create two from scratch
+                if(aContainerEls.length === 0) {
+                    // One before TABLE
+                    var pag0 = document.createElement("span");
+                    pag0.id = this.id + "-paginator0";
+                    YAHOO.util.Dom.addClass(pag0, YAHOO.widget.DataTable.CLASS_PAGINATOR);
+                    pag0 = this._elContainer.insertBefore(pag0, this._elTable);
+                    aContainerEls.push(pag0);
+
+                    // One after TABLE
+                    var pag1 = document.createElement("span");
+                    pag1.id = this.id + "-paginator1";
+                    YAHOO.util.Dom.addClass(pag1, YAHOO.widget.DataTable.CLASS_PAGINATOR);
+                    pag1 = this._elContainer.insertBefore(pag1, this._elTable.nextSibling);
+                    aContainerEls.push(pag1);
+
+                    // Add containers directly to tracker
+                    this._configs.paginator.value.containers = [pag0, pag1];
+
+                }
+                else {
+                    // Show each container
+                    for(i=0; i<aContainerEls.length; i++) {
+                        aContainerEls[i].style.display = "";
+                    }
+                }
+
+                // Links are enabled
+                if(oPaginator.pageLinks > -1) {
+                    var aLinkEls = oPaginator.links;
+                    // No links containers found, create from scratch
+                    if(aLinkEls.length === 0) {
+                        for(i=0; i<aContainerEls.length; i++) {
+                            // Create one links container per Paginator container
+                            var linkEl = document.createElement("span");
+                            linkEl.id = "yui-dt-pagselect"+i;
+                            linkEl = aContainerEls[i].appendChild(linkEl);
+
+                            // Add event listener
+                            //TODO: anon fnc
+                            YAHOO.util.Event.addListener(linkEl,"click",this._onPaginatorLinkClick,this);
+
+                             // Add directly to tracker
+                            this._configs.paginator.value.links.push(linkEl);
+                       }
+                   }
+                }
+
+                // Show these options in the dropdown
+                var dropdownOptions = oPaginator.dropdownOptions || [];
+
+                for(i=0; i<aContainerEls.length; i++) {
+                    // Create one SELECT element per Paginator container
+                    var selectEl = document.createElement("select");
+                    YAHOO.util.Dom.addClass(selectEl, YAHOO.widget.DataTable.CLASS_DROPDOWN);
+                    selectEl = aContainerEls[i].appendChild(selectEl);
+                    selectEl.id = "yui-dt-pagselect"+i;
+
+                    // Add event listener
+                    //TODO: anon fnc
+                    YAHOO.util.Event.addListener(selectEl,"change",this._onPaginatorDropdownChange,this);
+
+                    // Add DOM reference directly to tracker
+                   this._configs.paginator.value.dropdowns.push(selectEl);
+
+                    // Hide dropdown
+                    if(!oPaginator.dropdownOptions) {
+                        selectEl.style.display = "none";
+                    }
+                }
+
+                //TODO: fire paginatorDisabledEvent & add to api doc
+            }
+            // Pagination is disabled
+            else {
+                // Containers found
+                if(aContainerEls.length > 0) {
+                    // Destroy or just hide?
+                    
+                    // Hide each container
+                    for(i=0; i<aContainerEls.length; i++) {
+                        aContainerEls[i].style.display = "none";
+                    }
+
+                    /*TODO?
+                    // Destroy each container
+                    for(i=0; i<aContainerEls.length; i++) {
+                        YAHOO.util.Event.purgeElement(aContainerEls[i], true);
+                        aContainerEls.innerHTML = null;
+                        //TODO: remove container?
+                        // aContainerEls[i].parentNode.removeChild(aContainerEls[i]);
+                    }
+                    */
+                }
+                //TODO: fire paginatorDisabledEvent & add to api doc
+            }
+        }
+    });
+
+    /**
+    * @attribute caption
+    * @description Value for the CAPTION element.
+    * @type String
+    */
+    this.setAttributeConfig("caption", {
+        value: null,
+        validator: YAHOO.lang.isString,
+        method: function(sCaption) {
+            // Create CAPTION element
+            if(!this._elCaption) {
+                if(!this._elTable.firstChild) {
+                    this._elCaption = this._elTable.appendChild(document.createElement("caption"));
+                }
+                else {
+                    this._elCaption = this._elTable.insertBefore(document.createElement("caption"), this._elTable.firstChild);
+                }
+            }
+            // Set CAPTION value
+            this._elCaption.innerHTML = sCaption;
+        }
+    });
+
+    /**
+    * @attribute scrollable
+    * @description True if primary TBODY should scroll while THEAD remains fixed.
+    * When enabling this feature, captions cannot be used, and the following
+    * features are not recommended: inline editing, resizeable columns.
+    * @default false
+    * @type Boolean
+    */
+    this.setAttributeConfig("scrollable", {
+        value: false,
+        validator: function(oParam) {
+            //TODO: validate agnst resizeable
+            return (YAHOO.lang.isBoolean(oParam) &&
+                    // Not compatible with caption
+                    !YAHOO.lang.isString(this.get("caption")));
+        },
+        method: function(oParam) {
+            if(oParam) {
+                //TODO: conf height
+                YAHOO.util.Dom.addClass(this._elContainer,YAHOO.widget.DataTable.CLASS_SCROLLABLE);
+                YAHOO.util.Dom.addClass(this._elTbody,YAHOO.widget.DataTable.CLASS_SCROLLBODY);
+            }
+            else {
+                YAHOO.util.Dom.removeClass(this._elContainer,YAHOO.widget.DataTable.CLASS_SCROLLABLE);
+                YAHOO.util.Dom.removeClass(this._elTbody,YAHOO.widget.DataTable.CLASS_SCROLLBODY);
+
+            }
+        }
+    });
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public constants
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Class name assigned to TABLE element.
+ *
+ * @property DataTable.CLASS_TABLE
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-table"
+ */
+YAHOO.widget.DataTable.CLASS_TABLE = "yui-dt-table";
+
+/**
+ * Class name assigned to header container elements within each TH element.
+ *
+ * @property DataTable.CLASS_HEADER
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-header"
+ */
+YAHOO.widget.DataTable.CLASS_HEADER = "yui-dt-header";
+
+/**
+ * Class name assigned to the primary TBODY element.
+ *
+ * @property DataTable.CLASS_BODY
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-body"
+ */
+YAHOO.widget.DataTable.CLASS_BODY = "yui-dt-body";
+
+/**
+ * Class name assigned to the scrolling TBODY element of a fixed scrolling DataTable.
+ *
+ * @property DataTable.CLASS_SCROLLBODY
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-scrollbody"
+ */
+YAHOO.widget.DataTable.CLASS_SCROLLBODY = "yui-dt-scrollbody";
+
+/**
+ * Class name assigned to display label elements.
+ *
+ * @property DataTable.CLASS_LABEL
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-label"
+ */
+YAHOO.widget.DataTable.CLASS_LABEL = "yui-dt-label";
+
+/**
+ * Class name assigned to resizer handle elements.
+ *
+ * @property DataTable.CLASS_RESIZER
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-resizer"
+ */
+YAHOO.widget.DataTable.CLASS_RESIZER = "yui-dt-resizer";
+
+/**
+ * Class name assigned to Editor container elements.
+ *
+ * @property DataTable.CLASS_EDITOR
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-editor"
+ */
+YAHOO.widget.DataTable.CLASS_EDITOR = "yui-dt-editor";
+
+/**
+ * Class name assigned to paginator container elements.
+ *
+ * @property DataTable.CLASS_PAGINATOR
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-paginator"
+ */
+YAHOO.widget.DataTable.CLASS_PAGINATOR = "yui-dt-paginator";
+
+/**
+ * Class name assigned to page number indicators.
+ *
+ * @property DataTable.CLASS_PAGE
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-page"
+ */
+YAHOO.widget.DataTable.CLASS_PAGE = "yui-dt-page";
+
+/**
+ * Class name assigned to default indicators.
+ *
+ * @property DataTable.CLASS_DEFAULT
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-default"
+ */
+YAHOO.widget.DataTable.CLASS_DEFAULT = "yui-dt-default";
+
+/**
+ * Class name assigned to previous indicators.
+ *
+ * @property DataTable.CLASS_PREVIOUS
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-previous"
+ */
+YAHOO.widget.DataTable.CLASS_PREVIOUS = "yui-dt-previous";
+
+/**
+ * Class name assigned next indicators.
+ *
+ * @property DataTable.CLASS_NEXT
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-next"
+ */
+YAHOO.widget.DataTable.CLASS_NEXT = "yui-dt-next";
+
+/**
+ * Class name assigned to first elements.
+ *
+ * @property DataTable.CLASS_FIRST
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-first"
+ */
+YAHOO.widget.DataTable.CLASS_FIRST = "yui-dt-first";
+
+/**
+ * Class name assigned to last elements.
+ *
+ * @property DataTable.CLASS_LAST
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-last"
+ */
+YAHOO.widget.DataTable.CLASS_LAST = "yui-dt-last";
+
+/**
+ * Class name assigned to even elements.
+ *
+ * @property DataTable.CLASS_EVEN
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-even"
+ */
+YAHOO.widget.DataTable.CLASS_EVEN = "yui-dt-even";
+
+/**
+ * Class name assigned to odd elements.
+ *
+ * @property DataTable.CLASS_ODD
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-odd"
+ */
+YAHOO.widget.DataTable.CLASS_ODD = "yui-dt-odd";
+
+/**
+ * Class name assigned to selected elements.
+ *
+ * @property DataTable.CLASS_SELECTED
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-selected"
+ */
+YAHOO.widget.DataTable.CLASS_SELECTED = "yui-dt-selected";
+
+/**
+ * Class name assigned to highlighted elements.
+ *
+ * @property DataTable.CLASS_HIGHLIGHTED
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-highlighted"
+ */
+YAHOO.widget.DataTable.CLASS_HIGHLIGHTED = "yui-dt-highlighted";
+
+/**
+ * Class name assigned to disabled elements.
+ *
+ * @property DataTable.CLASS_DISABLED
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-disabled"
+ */
+YAHOO.widget.DataTable.CLASS_DISABLED = "yui-dt-disabled";
+
+/**
+ * Class name assigned to empty indicators.
+ *
+ * @property DataTable.CLASS_EMPTY
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-empty"
+ */
+YAHOO.widget.DataTable.CLASS_EMPTY = "yui-dt-empty";
+
+/**
+ * Class name assigned to loading indicatorx.
+ *
+ * @property DataTable.CLASS_LOADING
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-loading"
+ */
+YAHOO.widget.DataTable.CLASS_LOADING = "yui-dt-loading";
+
+/**
+ * Class name assigned to error indicators.
+ *
+ * @property DataTable.CLASS_ERROR
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-error"
+ */
+YAHOO.widget.DataTable.CLASS_ERROR = "yui-dt-error";
+
+/**
+ * Class name assigned to editable elements.
+ *
+ * @property DataTable.CLASS_EDITABLE
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-editable"
+ */
+YAHOO.widget.DataTable.CLASS_EDITABLE = "yui-dt-editable";
+
+/**
+ * Class name assigned to scrollable elements.
+ *
+ * @property DataTable.CLASS_SCROLLABLE
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-scrollable"
+ */
+YAHOO.widget.DataTable.CLASS_SCROLLABLE = "yui-dt-scrollable";
+
+/**
+ * Class name assigned to sortable elements.
+ *
+ * @property DataTable.CLASS_SORTABLE
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-sortable"
+ */
+YAHOO.widget.DataTable.CLASS_SORTABLE = "yui-dt-sortable";
+
+/**
+ * Class name assigned to ascending elements.
+ *
+ * @property DataTable.CLASS_ASC
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-asc"
+ */
+YAHOO.widget.DataTable.CLASS_ASC = "yui-dt-asc";
+
+/**
+ * Class name assigned to descending elements.
+ *
+ * @property DataTable.CLASS_DESC
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-desc"
+ */
+YAHOO.widget.DataTable.CLASS_DESC = "yui-dt-desc";
+
+/**
+ * Class name assigned to BUTTON elements and/or container elements.
+ *
+ * @property DataTable.CLASS_BUTTON
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-button"
+ */
+YAHOO.widget.DataTable.CLASS_BUTTON = "yui-dt-button";
+
+/**
+ * Class name assigned to INPUT TYPE=CHECKBOX elements and/or container elements.
+ *
+ * @property DataTable.CLASS_CHECKBOX
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-checkbox"
+ */
+YAHOO.widget.DataTable.CLASS_CHECKBOX = "yui-dt-checkbox";
+
+/**
+ * Class name assigned to SELECT elements and/or container elements.
+ *
+ * @property DataTable.CLASS_DROPDOWN
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-dropdown"
+ */
+YAHOO.widget.DataTable.CLASS_DROPDOWN = "yui-dt-dropdown";
+
+/**
+ * Class name assigned to INPUT TYPE=RADIO elements and/or container elements.
+ *
+ * @property DataTable.CLASS_RADIO
+ * @type String
+ * @static
+ * @final
+ * @default "yui-dt-radio"
+ */
+YAHOO.widget.DataTable.CLASS_RADIO = "yui-dt-radio";
+
+/**
+ * Message to display if DataTable has no data.
+ *
+ * @property DataTable.MSG_EMPTY
+ * @type String
+ * @static
+ * @final
+ * @default "No records found."
+ */
+YAHOO.widget.DataTable.MSG_EMPTY = "No records found.";
+
+/**
+ * Message to display while DataTable is loading data.
+ *
+ * @property DataTable.MSG_LOADING
+ * @type String
+ * @static
+ * @final
+ * @default "Loading data..."
+ */
+YAHOO.widget.DataTable.MSG_LOADING = "Loading data...";
+
+/**
+ * Message to display while DataTable has data error.
+ *
+ * @property DataTable.MSG_ERROR
+ * @type String
+ * @static
+ * @final
+ * @default "Data error."
+ */
+YAHOO.widget.DataTable.MSG_ERROR = "Data error.";
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable for indexing multiple DataTable instances.
+ *
+ * @property DataTable._nCount
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.widget.DataTable._nCount = 0;
+
+/**
+ * Index assigned to instance.
+ *
+ * @property _nIndex
+ * @type Number
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._nIndex = null;
+
+/**
+ * Counter for IDs assigned to TR elements.
+ *
+ * @property _nTrCount
+ * @type Number
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._nTrCount = 0;
+
+/**
+ * Unique name assigned to instance.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sName = null;
+
+/**
+ * DOM reference to the container element for the DataTable instance into which
+ * the TABLE element gets created.
+ *
+ * @property _elContainer
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elContainer = null;
+
+/**
+ * DOM reference to the CAPTION element for the DataTable instance.
+ *
+ * @property _elCaption
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elCaption = null;
+
+/**
+ * DOM reference to the TABLE element for the DataTable instance.
+ *
+ * @property _elTable
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elTable = null;
+
+/**
+ * DOM reference to the THEAD element for the DataTable instance.
+ *
+ * @property _elThead
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elThead = null;
+
+/**
+ * DOM reference to the primary TBODY element for the DataTable instance.
+ *
+ * @property _elTbody
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elTbody = null;
+
+/**
+ * DOM reference to the secondary TBODY element used to display DataTable messages.
+ *
+ * @property _elMsgTbody
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elMsgTbody = null;
+
+/**
+ * DOM reference to the secondary TBODY element's single TR element used to display DataTable messages.
+ *
+ * @property _elMsgTbodyRow
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elMsgTbodyRow = null;
+
+/**
+ * DOM reference to the secondary TBODY element's single TD element used to display DataTable messages.
+ *
+ * @property _elMsgTbodyCell
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._elMsgTbodyCell = null;
+
+/**
+ * DataSource instance for the DataTable instance.
+ *
+ * @property _oDataSource
+ * @type YAHOO.util.DataSource
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._oDataSource = null;
+
+/**
+ * ColumnSet instance for the DataTable instance.
+ *
+ * @property _oColumnSet
+ * @type YAHOO.widget.ColumnSet
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._oColumnSet = null;
+
+/**
+ * RecordSet instance for the DataTable instance.
+ *
+ * @property _oRecordSet
+ * @type YAHOO.widget.RecordSet
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._oRecordSet = null;
+
+/**
+ * ID string of first label link element of the current DataTable page, if any.
+ * Used for focusing sortable Columns with TAB.
+ *
+ * @property _sFirstLabelLinkId
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sFirstLabelLinkId = null;
+
+/**
+ * ID string of first TR element of the current DataTable page.
+ *
+ * @property _sFirstTrId
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sFirstTrId = null;
+
+/**
+ * ID string of the last TR element of the current DataTable page.
+ *
+ * @property _sLastTrId
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sLastTrId = null;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Sets focus on the given element.
+ *
+ * @method _focusEl
+ * @param el {HTMLElement} Element.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._focusEl = function(el) {
+    el = el || this._elTable;
+    // http://developer.mozilla.org/en/docs/index.php?title=Key-navigable_custom_DHTML_widgets
+    // The timeout is necessary in both IE and Firefox 1.5, to prevent scripts from doing
+    // strange unexpected things as the user clicks on buttons and other controls.
+    setTimeout(function() { el.focus(); },0);
+};
+
+
+
+
+
+// INIT FUNCTIONS
+
+/**
+ * Initializes container element.
+ *
+ * @method _initContainerEl
+ * @param elContainer {HTMLElement | String} HTML DIV element by reference or ID.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initContainerEl = function(elContainer) {
+    this._elContainer = null;
+    elContainer = YAHOO.util.Dom.get(elContainer);
+    if(elContainer && elContainer.tagName && (elContainer.tagName.toLowerCase() == "div")) {
+        this._elContainer = elContainer;
+    }
+};
+
+/**
+ * Initializes object literal of config values.
+ *
+ * @method _initConfigs
+ * @param oConfig {Object} Object literal of config values.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initConfigs = function(oConfigs) {
+    if(oConfigs) {
+        if(oConfigs.constructor != Object) {
+            oConfigs = null;
+        }
+        // Backward compatibility
+        else if(YAHOO.lang.isBoolean(oConfigs.paginator)) {
+        }
+        this._oConfigs = oConfigs;
+    }
+};
+
+/**
+ * Initializes ColumnSet.
+ *
+ * @method _initColumnSet
+ * @param aColumnDefs {Object[]} Array of object literal Column definitions.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initColumnSet = function(aColumnDefs) {
+    this._oColumnSet = null;
+    if(YAHOO.lang.isArray(aColumnDefs)) {
+        this._oColumnSet =  new YAHOO.widget.ColumnSet(aColumnDefs);
+    }
+    // Backward compatibility
+    else if(aColumnDefs instanceof YAHOO.widget.ColumnSet) {
+        this._oColumnSet =  aColumnDefs;
+    }
+};
+
+/**
+ * Initializes DataSource.
+ *
+ * @method _initDataSource
+ * @param oDataSource {YAHOO.util.DataSource} DataSource instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initDataSource = function(oDataSource) {
+    this._oDataSource = null;
+    if(oDataSource && (oDataSource instanceof YAHOO.util.DataSource)) {
+        this._oDataSource = oDataSource;
+    }
+    // Backward compatibility
+    else {
+        var tmpTable = null;
+        var tmpContainer = this._elContainer;
+        var i;
+        // Peek in container child nodes to see if TABLE already exists
+        if(tmpContainer.hasChildNodes()) {
+            var tmpChildren = tmpContainer.childNodes;
+            for(i=0; i<tmpChildren.length; i++) {
+                if(tmpChildren[i].tagName && tmpChildren[i].tagName.toLowerCase() == "table") {
+                    tmpTable = tmpChildren[i];
+                    break;
+                }
+            }
+            if(tmpTable) {
+                var tmpFieldsArray = [];
+                for(i=0; i<this._oColumnSet.keys.length; i++) {
+                    tmpFieldsArray.push({key:this._oColumnSet.keys[i].key});
+                }
+
+                this._oDataSource = new YAHOO.util.DataSource(tmpTable);
+                this._oDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
+                this._oDataSource.responseSchema = {fields: tmpFieldsArray};
+            }
+        }
+    }
+};
+
+/**
+ * Initializes RecordSet.
+ *
+ * @method _initRecordSet
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initRecordSet = function() {
+    if(this._oRecordSet) {
+        this._oRecordSet.reset();
+    }
+    else {
+        this._oRecordSet = new YAHOO.widget.RecordSet();
+    }
+};
+
+/**
+ * Creates HTML markup for TABLE, THEAD and TBODY elements.
+ *
+ * @method _initTableEl
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initTableEl = function() {
+    // Clear the container
+    YAHOO.util.Event.purgeElement(this._elContainer, true);
+    this._elContainer.innerHTML = "";
+
+    // Create TABLE
+    this._elTable = this._elContainer.appendChild(document.createElement("table"));
+    var elTable = this._elTable;
+    elTable.tabIndex = 0;
+    elTable.id = this.id + "-table";
+    YAHOO.util.Dom.addClass(elTable, YAHOO.widget.DataTable.CLASS_TABLE);
+
+    // Create THEAD
+    this._initTheadEl(elTable, this._oColumnSet);
+
+
+    // Create TBODY for messages
+    var elMsgTbody = document.createElement("tbody");
+    var elMsgRow = elMsgTbody.appendChild(document.createElement("tr"));
+    YAHOO.util.Dom.addClass(elMsgRow,YAHOO.widget.DataTable.CLASS_FIRST);
+    YAHOO.util.Dom.addClass(elMsgRow,YAHOO.widget.DataTable.CLASS_LAST);
+    this._elMsgRow = elMsgRow;
+    var elMsgCell = elMsgRow.appendChild(document.createElement("td"));
+    elMsgCell.colSpan = this._oColumnSet.keys.length;
+    YAHOO.util.Dom.addClass(elMsgCell,YAHOO.widget.DataTable.CLASS_FIRST);
+    YAHOO.util.Dom.addClass(elMsgCell,YAHOO.widget.DataTable.CLASS_LAST);
+    this._elMsgTd = elMsgCell;
+    this._elMsgTbody = elTable.appendChild(elMsgTbody);
+    this.showTableMessage(YAHOO.widget.DataTable.MSG_LOADING, YAHOO.widget.DataTable.CLASS_LOADING);
+
+    // Create TBODY for data
+    this._elTbody = elTable.appendChild(document.createElement("tbody"));
+    YAHOO.util.Dom.addClass(this._elTbody,YAHOO.widget.DataTable.CLASS_BODY);
+};
+
+/**
+ * Populates THEAD element with TH cells as defined by ColumnSet.
+ *
+ * @method _initTheadEl
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initTheadEl = function() {
+    var i,oColumn, colId;
+    var oColumnSet = this._oColumnSet;
+    this._sFirstLabelLinkId = null;
+    
+    // Create THEAD
+    var elThead = document.createElement("thead");
+
+    // Iterate through each row of Column headers...
+    var colTree = oColumnSet.tree;
+    for(i=0; i<colTree.length; i++) {
+        var elTheadRow = elThead.appendChild(document.createElement("tr"));
+        elTheadRow.id = this.id+"-hdrow"+i;
+
+        var elTheadCell;
+        // ...and create THEAD cells
+        for(var j=0; j<colTree[i].length; j++) {
+            oColumn = colTree[i][j];
+            elTheadCell = elTheadRow.appendChild(document.createElement("th"));
+            elTheadCell.id = this.id+"-col" + oColumn.getId();
+            this._initThEl(elTheadCell,oColumn,i,j);
+        }
+
+        // Set FIRST/LAST on THEAD rows
+        if(i === 0) {
+            YAHOO.util.Dom.addClass(elTheadRow, YAHOO.widget.DataTable.CLASS_FIRST);
+        }
+        if(i === (colTree.length-1)) {
+            YAHOO.util.Dom.addClass(elTheadRow, YAHOO.widget.DataTable.CLASS_LAST);
+        }
+    }
+
+    this._elThead = this._elTable.appendChild(elThead);
+
+    // Set FIRST/LAST on THEAD cells using the values in ColumnSet headers array
+    var aFirstHeaders = oColumnSet.headers[0];
+    var aLastHeaders = oColumnSet.headers[oColumnSet.headers.length-1];
+    for(i=0; i<aFirstHeaders.length; i++) {
+        YAHOO.util.Dom.addClass(YAHOO.util.Dom.get(this.id+"-col"+aFirstHeaders[i]), YAHOO.widget.DataTable.CLASS_FIRST);
+    }
+    for(i=0; i<aLastHeaders.length; i++) {
+        YAHOO.util.Dom.addClass(YAHOO.util.Dom.get(this.id+"-col"+aLastHeaders[i]), YAHOO.widget.DataTable.CLASS_LAST);
+    }
+    
+    // Add Resizer only after DOM has been updated
+    var foundDD = (YAHOO.util.DD) ? true : false;
+    var needDD = false;
+    for(i=0; i<this._oColumnSet.keys.length; i++) {
+        oColumn = this._oColumnSet.keys[i];
+        var colKey = oColumn.getKey();
+        var elTheadCellId = YAHOO.util.Dom.get(this.id + "-col" + oColumn.getId());
+        if(oColumn.resizeable) {
+            if(foundDD) {
+                //TODO: fix fixed width tables
+                // Skip the last column for fixed-width tables
+                if(!this.fixedWidth || (this.fixedWidth &&
+                        (oColumn.getKeyIndex() != this._oColumnSet.keys.length-1))) {
+                    // TODO: better way to get elTheadContainer
+                    var elThContainer = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_HEADER,"div",elTheadCellId)[0];
+                    var elThResizer = elThContainer.appendChild(document.createElement("span"));
+                    elThResizer.id = this.id + "-resizer-" + colKey;
+                    YAHOO.util.Dom.addClass(elThResizer,YAHOO.widget.DataTable.CLASS_RESIZER);
+                    oColumn.ddResizer = new YAHOO.util.ColumnResizer(
+                            this, oColumn, elTheadCellId, elThResizer.id, elThResizer.id);
+                    var cancelClick = function(e) {
+                        YAHOO.util.Event.stopPropagation(e);
+                    };
+                    YAHOO.util.Event.addListener(elThResizer,"click",cancelClick);
+                }
+                if(this.fixedWidth) {
+                    //TODO: fix fixedWidth
+                    //elThContainer.style.overflow = "hidden";
+                    //TODO: better way to get elTheadText
+                    var elThLabel = (YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_LABEL,"span",elTheadCellId))[0];
+                    elThLabel.style.overflow = "hidden";
+                }
+            }
+            else {
+                needDD = true;
+            }
+        }
+    }
+    if(needDD) {
+    }
+
+};
+
+/**
+ * Populates TH cell as defined by Column.
+ *
+ * @method _initThEl
+ * @param elTheadCell {HTMLElement} TH cell element reference.
+ * @param oColumn {YAHOO.widget.Column} Column object.
+ * @param row {number} Row index.
+ * @param col {number} Column index.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initThEl = function(elTheadCell,oColumn,row,col) {
+    // Clear out the cell of prior content
+    // TODO: purgeListeners and other validation-related things
+    var index = this._nIndex;
+    var colKey = oColumn.getKey();
+    var colId = oColumn.getId();
+    elTheadCell.yuiColumnKey = colKey;
+    elTheadCell.yuiColumnId = colId;
+    if(oColumn.abbr) {
+        elTheadCell.abbr = oColumn.abbr;
+    }
+    if(oColumn.width) {
+        elTheadCell.style.width = oColumn.width;
+    }
+
+    var aCustomClasses;
+    if(YAHOO.lang.isString(oColumn.className)) {
+        aCustomClasses = [oColumn.className];
+    }
+    else if(YAHOO.lang.isArray(oColumn.className)) {
+        aCustomClasses = oColumn.className;
+    }
+    if(aCustomClasses) {
+        for(var i=0; i<aCustomClasses.length; i++) {
+            YAHOO.util.Dom.addClass(elTheadCell,aCustomClasses[i]);
+        }
+    }
+    
+    YAHOO.util.Dom.addClass(elTheadCell, "yui-dt-col-"+colKey);
+    
+    elTheadCell.innerHTML = "";
+    elTheadCell.rowSpan = oColumn.getRowspan();
+    elTheadCell.colSpan = oColumn.getColspan();
+
+    var elTheadContainer = elTheadCell.appendChild(document.createElement("div"));
+    elTheadContainer.id = this.id + "-container" + colId;
+    YAHOO.util.Dom.addClass(elTheadContainer,YAHOO.widget.DataTable.CLASS_HEADER);
+    var elTheadLabel = elTheadContainer.appendChild(document.createElement("span"));
+    elTheadLabel.id = this.id + "-label" + colId;
+    YAHOO.util.Dom.addClass(elTheadLabel,YAHOO.widget.DataTable.CLASS_LABEL);
+
+    var sLabel = YAHOO.lang.isValue(oColumn.label) ? oColumn.label : colKey;
+    if(oColumn.sortable) {
+        YAHOO.util.Dom.addClass(elTheadCell,YAHOO.widget.DataTable.CLASS_SORTABLE);
+        //TODO: Make sortLink customizeable
+        //TODO: Make title configurable
+        //TODO: Separate label from an accessibility link that says
+        // "Click to sort ascending" and push it offscreen
+        var sLabelLinkId = this.id + "-labellink" + colId;
+        var sortLink = "?key=" + colKey;
+        elTheadLabel.innerHTML = "<a id=\"" + sLabelLinkId + "\" href=\"" + sortLink + "\" title=\"Click to sort\" class=\"" + YAHOO.widget.DataTable.CLASS_SORTABLE + "\">" + sLabel + "</a>";
+        if(!this._sFirstLabelLinkId) {
+            this._sFirstLabelLinkId = sLabelLinkId;
+        }
+    }
+    else {
+        elTheadLabel.innerHTML = sLabel;
+    }
+};
+
+/**
+ * Creates HTML markup for Cell Editor.
+ *
+ * @method _initCellEditorEl
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initCellEditorEl = function() {
+    // Attach Cell Editor container element to body
+    var elCellEditor = document.createElement("div");
+    elCellEditor.id = this.id + "-celleditor";
+    elCellEditor.style.display = "none";
+    YAHOO.util.Dom.addClass(elCellEditor, YAHOO.widget.DataTable.CLASS_EDITOR);
+    elCellEditor = document.body.appendChild(elCellEditor);
+
+    // Internal tracker of Cell Editor values
+    var oCellEditor = {};
+    oCellEditor.container = elCellEditor;
+    oCellEditor.value = null;
+    oCellEditor.isActive = false;
+    this._oCellEditor = oCellEditor;
+
+    // Handle ESC key
+    this.subscribe("editorKeydownEvent", function(oArgs) {
+        var e = oArgs.event;
+        var elTarget = YAHOO.util.Event.getTarget(e);
+
+        // ESC hides Cell Editor
+        if((e.keyCode == 27)) {
+            this.cancelCellEditor();
+        }
+    });
+};
+
+/**
+ * Initializes Column sorting.
+ *
+ * @method _initColumnSort
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initColumnSort = function() {
+    this.subscribe("headerCellClickEvent", this.onEventSortColumn);
+};
+
+/**
+ * Initializes DOM event listeners.
+ *
+ * @method _initDomEvents
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._initDomEvents = function() {
+    var elTable = this._elTable;
+    var elThead = this._elThead;
+    var elTbody = this._elTbody;
+    var elContainer = this._elContainer;
+
+    YAHOO.util.Event.addListener(document, "click", this._onDocumentClick, this);
+    YAHOO.util.Event.addListener(document, "keydown", this._onDocumentKeydown, this);
+
+    YAHOO.util.Event.addListener(elTable, "focus", this._onTableFocus, this);
+    YAHOO.util.Event.addListener(elTable, "mouseover", this._onTableMouseover, this);
+    YAHOO.util.Event.addListener(elTable, "mouseout", this._onTableMouseout, this);
+    YAHOO.util.Event.addListener(elTable, "mousedown", this._onTableMousedown, this);
+    YAHOO.util.Event.addListener(elTable, "keydown", this._onTableKeydown, this);
+    YAHOO.util.Event.addListener(elTable, "keypress", this._onTableKeypress, this);
+
+    // Since we can't listen for click and dblclick on the same element...
+    YAHOO.util.Event.addListener(elTable, "dblclick", this._onTableDblclick, this);
+    YAHOO.util.Event.addListener(elThead, "click", this._onTheadClick, this);
+    YAHOO.util.Event.addListener(elTbody, "click", this._onTbodyClick, this);
+
+    YAHOO.util.Event.addListener(elContainer, "scroll", this._onScroll, this); // for IE
+    YAHOO.util.Event.addListener(elTbody, "scroll", this._onScroll, this); // for everyone else
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// DOM MUTATION FUNCTIONS
+
+
+
+
+/**
+ * Adds a TR element to the primary TBODY at the page row index if given, otherwise
+ * at the end of the page. Formats TD elements within the TR element using data
+ * from the given Record.
+ *
+ * @method _addTrEl
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param index {Number} (optional) The page row index at which to add the TR
+ * element.
+ * @return {String} ID of the added TR element, or null.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._addTrEl = function(oRecord, index) {
+    this.hideTableMessage();
+
+    // It's an append if no index provided, or index is negative or too big
+    var append = (!YAHOO.lang.isNumber(index) || (index < 0) ||
+            (index >= (this._elTbody.rows.length))) ? true : false;
+            
+    var oColumnSet = this._oColumnSet;
+    var oRecordSet = this._oRecordSet;
+    var isSortedBy = this.get("sortedBy");
+    var sortedColKeyIndex  = null;
+    var sortedDir, newClass;
+    if(isSortedBy) {
+        sortedColKeyIndex = (isSortedBy.column) ?
+                isSortedBy.column.getKeyIndex() :
+                this._oColumnSet.getColumn(isSortedBy.key).getKeyIndex();
+        sortedDir = isSortedBy.dir;
+        newClass = (sortedDir === "desc") ? YAHOO.widget.DataTable.CLASS_DESC :
+                YAHOO.widget.DataTable.CLASS_ASC;
+
+    }
+
+
+    var elRow = (append) ? this._elTbody.appendChild(document.createElement("tr")) :
+        this._elTbody.insertBefore(document.createElement("tr"),this._elTbody.rows[index]);
+
+    elRow.id = this.id+"-bdrow"+this._nTrCount;
+    this._nTrCount++;
+    elRow.yuiRecordId = oRecord.getId();
+
+    // Create TD cells
+    for(var j=0; j<oColumnSet.keys.length; j++) {
+        var oColumn = oColumnSet.keys[j];
+        var elCell = elRow.appendChild(document.createElement("td"));
+        elCell.id = elRow.id+"-cell"+j;
+        elCell.yuiColumnKey = oColumn.getKey();
+        elCell.yuiColumnId = oColumn.getId();
+
+        for(var k=0; k<oColumnSet.headers[j].length; k++) {
+            elCell.headers += this.id + "-col" + oColumnSet.headers[j][k] + " ";
+        }
+        
+        // For SF2 cellIndex bug: http://www.webreference.com/programming/javascript/ppk2/3.html
+        elCell.yuiCellIndex = j;
+
+        // Update UI
+        this.formatCell(elCell, oRecord, oColumn);
+
+        // Set FIRST/LAST on TD
+        if (j === 0) {
+            YAHOO.util.Dom.addClass(elCell, YAHOO.widget.DataTable.CLASS_FIRST);
+        }
+        else if (j === this._oColumnSet.keys.length-1) {
+            YAHOO.util.Dom.addClass(elCell, YAHOO.widget.DataTable.CLASS_LAST);
+        }
+        
+        // Remove ASC/DESC
+        YAHOO.util.Dom.removeClass(elCell, YAHOO.widget.DataTable.CLASS_ASC);
+        YAHOO.util.Dom.removeClass(elCell, YAHOO.widget.DataTable.CLASS_DESC);
+        
+        // Set ASC/DESC on TD
+        if(j === sortedColKeyIndex) {
+            newClass = (sortedDir === "desc") ?
+                    YAHOO.widget.DataTable.CLASS_DESC :
+                    YAHOO.widget.DataTable.CLASS_ASC;
+            YAHOO.util.Dom.addClass(elCell, newClass);
+        }
+
+
+        /*p.abx {word-wrap:break-word;}
+ought to solve the problem for Safari (the long words will wrap in your
+tds, instead of overflowing to the next td.
+(this is supported by IE win as well, so hide it if needed).
+
+One thing, though: it doesn't work in combination with
+'white-space:nowrap'.*/
+
+// need a div wrapper for safari?
+        //TODO: fix fixedWidth
+        if(this.fixedWidth) {
+            elCell.style.overflow = "hidden";
+            //elCell.style.width = "20px";
+        }
+    }
+
+    return elRow.id;
+};
+
+/**
+ * Formats all TD elements of given TR element with data from the given Record.
+ *
+ * @method _updateTrEl
+ * @param elRow {HTMLElement} The TR element to update.
+ * @param oRecord {YAHOO.widget.Record} The associated Record instance.
+ * @return {String} ID of the updated TR element, or null.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._updateTrEl = function(elRow, oRecord) {
+    this.hideTableMessage();
+
+    var isSortedBy = this.get("sortedBy");
+    var sortedColKeyIndex  = null;
+    var sortedDir, newClass;
+    if(isSortedBy) {
+        sortedColKeyIndex = (isSortedBy.column) ?
+                isSortedBy.column.getKeyIndex() :
+                this._oColumnSet.getColumn(isSortedBy.key).getKeyIndex();
+        sortedDir = isSortedBy.dir;
+        newClass = (sortedDir === "desc") ? YAHOO.widget.DataTable.CLASS_DESC :
+                YAHOO.widget.DataTable.CLASS_ASC;
+    }
+
+    // Update TD elements with new data
+    for(var j=0; j<elRow.cells.length; j++) {
+        var oColumn = this._oColumnSet.keys[j];
+        var elCell = elRow.cells[j];
+        this.formatCell(elCell, oRecord, oColumn);
+
+        // Remove ASC/DESC
+        YAHOO.util.Dom.removeClass(elCell, YAHOO.widget.DataTable.CLASS_ASC);
+        YAHOO.util.Dom.removeClass(elCell, YAHOO.widget.DataTable.CLASS_DESC);
+
+        // Set ASC/DESC on TD
+        if(j === sortedColKeyIndex) {
+            YAHOO.util.Dom.addClass(elCell, newClass);
+        }
+    }
+
+    // Update Record ID
+    elRow.yuiRecordId = oRecord.getId();
+    
+    return elRow.id;
+};
+
+
+/**
+ * Deletes TR element by DOM reference or by DataTable page row index.
+ *
+ * @method _deleteTrEl
+ * @param row {HTMLElement | Number} TR element reference or Datatable page row index.
+ * @return {Boolean} Returns true if successful, else returns false.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._deleteTrEl = function(row) {
+    var rowIndex;
+    
+    // Get page row index for the element
+    if(!YAHOO.lang.isNumber(row)) {
+        rowIndex = YAHOO.util.Dom.get(row).sectionRowIndex;
+    }
+    else {
+        rowIndex = row;
+    }
+    if(YAHOO.lang.isNumber(rowIndex) && (rowIndex > -2) && (rowIndex < this._elTbody.rows.length)) {
+        this._elTbody.deleteRow(rowIndex);
+        return true;
+    }
+    else {
+        return false;
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// CSS/STATE FUNCTIONS
+
+
+
+
+/**
+ * Assigns the class YAHOO.widget.DataTable.CLASS_FIRST to the first TR element
+ * of the DataTable page and updates internal tracker.
+ *
+ * @method _setFirstRow
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._setFirstRow = function() {
+    var rowEl = this.getFirstTrEl();
+    if(rowEl) {
+        // Remove FIRST
+        if(this._sFirstTrId) {
+            YAHOO.util.Dom.removeClass(this._sFirstTrId, YAHOO.widget.DataTable.CLASS_FIRST);
+        }
+        // Set FIRST
+        YAHOO.util.Dom.addClass(rowEl, YAHOO.widget.DataTable.CLASS_FIRST);
+        this._sFirstTrId = rowEl.id;
+    }
+    else {
+        this._sFirstTrId = null;
+    }
+};
+
+/**
+ * Assigns the class YAHOO.widget.DataTable.CLASS_LAST to the last TR element
+ * of the DataTable page and updates internal tracker.
+ *
+ * @method _setLastRow
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._setLastRow = function() {
+    var rowEl = this.getLastTrEl();
+    if(rowEl) {
+        // Unassign previous class
+        if(this._sLastTrId) {
+            YAHOO.util.Dom.removeClass(this._sLastTrId, YAHOO.widget.DataTable.CLASS_LAST);
+        }
+        // Assign class
+        YAHOO.util.Dom.addClass(rowEl, YAHOO.widget.DataTable.CLASS_LAST);
+        this._sLastTrId = rowEl.id;
+    }
+    else {
+        this._sLastTrId = null;
+    }
+};
+
+/**
+ * Assigns the classes YAHOO.widget.DataTable.CLASS_EVEN and
+ * YAHOO.widget.DataTable.CLASS_ODD to alternating TR elements of the DataTable
+ * page. For performance, a subset of rows may be specified.
+ *
+ * @method _setRowStripes
+ * @param row {HTMLElement | String | Number} (optional) HTML TR element reference
+ * or string ID, or page row index of where to start striping.
+ * @param range {Number} (optional) If given, how many rows to stripe, otherwise
+ * stripe all the rows until the end.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._setRowStripes = function(row, range) {
+    // Default values stripe all rows
+    var allRows = this._elTbody.rows;
+    var nStartIndex = 0;
+    var nEndIndex = allRows.length;
+    
+    // Stripe a subset
+    if((row !== null) && (row !== undefined)) {
+        // Validate given start row
+        var elStartRow = this.getTrEl(row);
+        if(elStartRow) {
+            nStartIndex = elStartRow.sectionRowIndex;
+            
+            // Validate given range
+            if(YAHOO.lang.isNumber(range) && (range > 1)) {
+                nEndIndex = nStartIndex + range;
+            }
+        }
+    }
+
+    for(var i=nStartIndex; i<nEndIndex; i++) {
+        if(i%2) {
+            YAHOO.util.Dom.removeClass(allRows[i], YAHOO.widget.DataTable.CLASS_EVEN);
+            YAHOO.util.Dom.addClass(allRows[i], YAHOO.widget.DataTable.CLASS_ODD);
+        }
+        else {
+            YAHOO.util.Dom.removeClass(allRows[i], YAHOO.widget.DataTable.CLASS_ODD);
+            YAHOO.util.Dom.addClass(allRows[i], YAHOO.widget.DataTable.CLASS_EVEN);
+        }
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private DOM Event Handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Handles scroll events on the CONTAINER (for IE) and TBODY elements (for everyone else).
+ *
+ * @method _onScroll
+ * @param e {HTMLEvent} The scroll event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onScroll = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+    
+    if(oSelf._oCellEditor.isActive) {
+        oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
+        oSelf.cancelCellEditor();
+    }
+
+    oSelf.fireEvent("tableScrollEvent", {event:e, target:elTarget});
+};
+
+/**
+ * Handles click events on the DOCUMENT.
+ *
+ * @method _onDocumentClick
+ * @param e {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onDocumentClick = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    if(!YAHOO.util.Dom.isAncestor(oSelf._elTable, elTarget)) {
+        oSelf.fireEvent("tableBlurEvent");
+
+        // Fires editorBlurEvent when click is not within the TABLE.
+        // For cases when click is within the TABLE, due to timing issues,
+        // the editorBlurEvent needs to get fired by the lower-level DOM click
+        // handlers below rather than by the TABLE click handler directly.
+        if(oSelf._oCellEditor && oSelf._oCellEditor.isActive) {
+            // Only if the click was not within the Cell Editor container
+            if(!YAHOO.util.Dom.isAncestor(oSelf._oCellEditor.container, elTarget) &&
+                    (oSelf._oCellEditor.container.id !== elTarget.id)) {
+                oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
+            }
+        }
+    }
+};
+
+/**
+ * Handles keydown events on the DOCUMENT.
+ *
+ * @method _onDocumentKeydown
+ * @param e {HTMLEvent} The keydown event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onDocumentKeydown = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    if(oSelf._oCellEditor && oSelf._oCellEditor.isActive &&
+            YAHOO.util.Dom.isAncestor(oSelf._oCellEditor.container, elTarget)) {
+        oSelf.fireEvent("editorKeydownEvent", {editor:oSelf._oCellEditor, event:e});
+    }
+};
+
+/**
+ * Handles focus events on the TABLE element.
+ *
+ * @method _onTableFocus
+ * @param e {HTMLEvent} The focus event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableMouseover = function(e, oSelf) {
+    oSelf.fireEvent("tableFocusEvent");
+};
+
+/**
+ * Handles mouseover events on the TABLE element.
+ *
+ * @method _onTableMouseover
+ * @param e {HTMLEvent} The mouseover event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableMouseover = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                 break;
+            case "a":
+                break;
+            case "td":
+                oSelf.fireEvent("cellMouseoverEvent",{target:elTarget,event:e});
+                break;
+            case "span":
+                if(YAHOO.util.Dom.hasClass(elTarget, YAHOO.widget.DataTable.CLASS_LABEL)) {
+                    oSelf.fireEvent("headerLabelMouseoverEvent",{target:elTarget,event:e});
+                }
+                break;
+            case "th":
+                oSelf.fireEvent("headerCellMouseoverEvent",{target:elTarget,event:e});
+                break;
+            case "tr":
+                if(elTarget.parentNode.tagName.toLowerCase() == "thead") {
+                    oSelf.fireEvent("headerRowMouseoverEvent",{target:elTarget,event:e});
+                }
+                else {
+                    oSelf.fireEvent("rowMouseoverEvent",{target:elTarget,event:e});
+                }
+                break;
+            default:
+                break;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+    }
+    oSelf.fireEvent("tableMouseoverEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/**
+ * Handles mouseout events on the TABLE element.
+ *
+ * @method _onTableMouseout
+ * @param e {HTMLEvent} The mouseout event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableMouseout = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                break;
+            case "a":
+                break;
+            case "td":
+                oSelf.fireEvent("cellMouseoutEvent",{target:elTarget,event:e});
+                break;
+            case "span":
+                if(YAHOO.util.Dom.hasClass(elTarget, YAHOO.widget.DataTable.CLASS_LABEL)) {
+                    oSelf.fireEvent("headerLabelMouseoutEvent",{target:elTarget,event:e});
+                }
+                break;
+            case "th":
+                oSelf.fireEvent("headerCellMouseoutEvent",{target:elTarget,event:e});
+                break;
+            case "tr":
+                if(elTarget.parentNode.tagName.toLowerCase() == "thead") {
+                    oSelf.fireEvent("headerRowMouseoutEvent",{target:elTarget,event:e});
+                }
+                else {
+                    oSelf.fireEvent("rowMouseoutEvent",{target:elTarget,event:e});
+                }
+                break;
+            default:
+                break;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+    }
+    oSelf.fireEvent("tableMouseoutEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/**
+ * Handles mousedown events on the TABLE element.
+ *
+ * @method _onTableMousedown
+ * @param e {HTMLEvent} The mousedown event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableMousedown = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                break;
+            case "a":
+                break;
+            case "td":
+                oSelf.fireEvent("cellMousedownEvent",{target:elTarget,event:e});
+                break;
+            case "span":
+                if(YAHOO.util.Dom.hasClass(elTarget, YAHOO.widget.DataTable.CLASS_LABEL)) {
+                    oSelf.fireEvent("headerLabelMousedownEvent",{target:elTarget,event:e});
+                }
+                break;
+            case "th":
+                oSelf.fireEvent("headerCellMousedownEvent",{target:elTarget,event:e});
+                break;
+            case "tr":
+                if(elTarget.parentNode.tagName.toLowerCase() == "thead") {
+                    oSelf.fireEvent("headerRowMousedownEvent",{target:elTarget,event:e});
+                }
+                else {
+                    oSelf.fireEvent("rowMousedownEvent",{target:elTarget,event:e});
+                }
+                break;
+            default:
+                break;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+    }
+    oSelf.fireEvent("tableMousedownEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/**
+ * Handles dblclick events on the TABLE element.
+ *
+ * @method _onTableDblclick
+ * @param e {HTMLEvent} The dblclick event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableDblclick = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                break;
+            case "td":
+                oSelf.fireEvent("cellDblclickEvent",{target:elTarget,event:e});
+                break;
+            case "span":
+                if(YAHOO.util.Dom.hasClass(elTarget, YAHOO.widget.DataTable.CLASS_LABEL)) {
+                    oSelf.fireEvent("headerLabelDblclickEvent",{target:elTarget,event:e});
+                }
+                break;
+            case "th":
+                oSelf.fireEvent("headerCellDblclickEvent",{target:elTarget,event:e});
+                break;
+            case "tr":
+                if(elTarget.parentNode.tagName.toLowerCase() == "thead") {
+                    oSelf.fireEvent("headerRowDblclickEvent",{target:elTarget,event:e});
+                }
+                else {
+                    oSelf.fireEvent("rowDblclickEvent",{target:elTarget,event:e});
+                }
+                break;
+            default:
+                break;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+    }
+    oSelf.fireEvent("tableDblclickEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/**
+ * Handles keydown events on the TABLE element. Handles arrow selection.
+ *
+ * @method _onTableKeydown
+ * @param e {HTMLEvent} The key event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableKeydown = function(e, oSelf) {
+    var bSHIFT = e.shiftKey;
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    
+    // Ignore actions in the THEAD
+    if(YAHOO.util.Dom.isAncestor(oSelf._elThead, elTarget)) {
+        return;
+    }
+    
+    var nKey = YAHOO.util.Event.getCharCode(e);
+    
+    // Handle TAB
+    if(nKey === 9) {
+        // From TABLE el focus first TH label link, if any
+        if(!bSHIFT && (elTarget.id === oSelf._elTable.id) && oSelf._sFirstLabelLinkId) {
+            YAHOO.util.Event.stopEvent(e);
+            
+            oSelf._focusEl(YAHOO.util.Dom.get(oSelf._sFirstLabelLinkId));
+        }
+        return;
+    }
+
+    // Handle ARROW selection
+    if((nKey > 36) && (nKey < 41)) {
+        YAHOO.util.Event.stopEvent(e);
+        
+        var allRows = oSelf._elTbody.rows;
+        var sMode = oSelf.get("selectionMode");
+
+        var i, oAnchorCell, oAnchorRecord, nAnchorRecordIndex, nAnchorTrIndex, oAnchorColumn, nAnchorColKeyIndex,
+        oTriggerCell, oTriggerRecord, nTriggerRecordIndex, nTriggerTrIndex, oTriggerColumn, nTriggerColKeyIndex, elTriggerRow,
+        startIndex, endIndex, anchorPos, elNext;
+        
+        // Row mode
+        if((sMode == "standard") || (sMode == "single")) {
+            // Validate trigger row:
+            // Arrow selection only works if last selected row is on current page
+            oTriggerRecord = oSelf.getLastSelectedRecord();
+            // No selected rows found
+            if(!oTriggerRecord) {
+                    return;
+            }
+            else {
+                oTriggerRecord = oSelf.getRecord(oTriggerRecord);
+                nTriggerRecordIndex = oSelf.getRecordIndex(oTriggerRecord);
+                elTriggerRow = oSelf.getTrEl(oTriggerRecord);
+                nTriggerTrIndex = oSelf.getTrIndex(elTriggerRow);
+                
+                // Last selected row not found on this page
+                if(nTriggerTrIndex === null) {
+                    return;
+                }
+            }
+           
+            // Validate anchor row
+            oAnchorRecord = oSelf._oAnchorRecord;
+            if(!oAnchorRecord) {
+                oAnchorRecord = oSelf._oAnchorRecord = oTriggerRecord;
+            }
+            
+            nAnchorRecordIndex = oSelf.getRecordIndex(oAnchorRecord);
+            nAnchorTrIndex = oSelf.getTrIndex(oAnchorRecord);
+            // If anchor row is not on this page...
+            if(nAnchorTrIndex === null) {
+                // ...set TR index equal to top TR
+                if(nAnchorRecordIndex < oSelf.getRecordIndex(oSelf.getFirstTrEl())) {
+                    nAnchorTrIndex = 0;
+                }
+                // ...set TR index equal to bottom TR
+                else {
+                    nAnchorTrIndex = oSelf.getRecordIndex(oSelf.getLastTrEl());
+                }
+            }
+
+
+
+
+
+
+        ////////////////////////////////////////////////////////////////////////
+        //
+        // SHIFT row selection
+        //
+        ////////////////////////////////////////////////////////////////////////
+        if(bSHIFT && (sMode != "single")) {
+            if(nAnchorRecordIndex > nTriggerTrIndex) {
+                anchorPos = 1;
+            }
+            else if(nAnchorRecordIndex < nTriggerTrIndex) {
+                anchorPos = -1;
+            }
+            else {
+                anchorPos = 0;
+            }
+
+            // Arrow down
+            if(nKey == 40) {
+                // Selecting away from anchor row
+                if(anchorPos <= 0) {
+                    // Select the next row down
+                    if(nTriggerTrIndex < allRows.length-1) {
+                        oSelf.selectRow(allRows[nTriggerTrIndex+1]);
+                    }
+                }
+                // Unselecting toward anchor row
+                else {
+                    // Unselect this row towards the anchor row down
+                    oSelf.unselectRow(allRows[nTriggerTrIndex]);
+                }
+
+            }
+            // Arrow up
+            else if(nKey == 38) {
+                // Selecting away from anchor row
+                if(anchorPos >= 0) {
+                    // Select the next row up
+                    if(nTriggerTrIndex > 0) {
+                        oSelf.selectRow(allRows[nTriggerTrIndex-1]);
+                    }
+                }
+                // Unselect this row towards the anchor row up
+                else {
+                    oSelf.unselectRow(allRows[nTriggerTrIndex]);
+                }
+            }
+            // Arrow right
+            else if(nKey == 39) {
+                // Do nothing
+            }
+            // Arrow left
+            else if(nKey == 37) {
+                // Do nothing
+            }
+        }
+        ////////////////////////////////////////////////////////////////////////
+        //
+        // Simple single row selection
+        //
+        ////////////////////////////////////////////////////////////////////////
+        else {
+            // Arrow down
+            if(nKey == 40) {
+                oSelf.unselectAllRows();
+
+                // Select the next row
+                if(nTriggerTrIndex < allRows.length-1) {
+                    elNext = allRows[nTriggerTrIndex+1];
+                    oSelf.selectRow(elNext);
+                }
+                // Select only the last row
+                else {
+                    elNext = allRows[nTriggerTrIndex];
+                    oSelf.selectRow(elNext);
+                }
+
+                oSelf._oAnchorRecord = oSelf.getRecord(elNext);
+            }
+            // Arrow up
+            else if(nKey == 38) {
+                oSelf.unselectAllRows();
+
+                // Select the previous row
+                if(nTriggerTrIndex > 0) {
+                    elNext = allRows[nTriggerTrIndex-1];
+                    oSelf.selectRow(elNext);
+                }
+                // Select only the first row
+                else {
+                    elNext = allRows[nTriggerTrIndex];
+                    oSelf.selectRow(elNext);
+                }
+
+                oSelf._oAnchorRecord = oSelf.getRecord(elNext);
+            }
+            // Arrow right
+            else if(nKey == 39) {
+                // Do nothing
+            }
+            // Arrow left
+            else if(nKey == 37) {
+                // Do nothing
+            }
+
+
+
+
+
+
+
+
+    }
+
+
+
+
+
+
+
+
+
+        }
+        // Cell mode
+        else {
+            // Validate trigger cell:
+            // Arrow selection only works if last selected cell is on current page
+            oTriggerCell = oSelf.getLastSelectedCell();
+            // No selected cells found
+            if(!oTriggerCell) {
+                return;
+            }
+            else {
+                oTriggerRecord = oSelf.getRecord(oTriggerCell.recordId);
+                nTriggerRecordIndex = oSelf.getRecordIndex(oTriggerRecord);
+                elTriggerRow = oSelf.getTrEl(oTriggerRecord);
+                nTriggerTrIndex = oSelf.getTrIndex(elTriggerRow);
+
+                // Last selected cell not found on this page
+                if(nTriggerTrIndex === null) {
+                    return;
+                }
+                else {
+                    oTriggerColumn = oSelf.getColumnById(oTriggerCell.columnId);
+                    nTriggerColKeyIndex = oTriggerColumn.getKeyIndex();
+                }
+            }
+
+            // Validate anchor cell
+            oAnchorCell = oSelf._oAnchorCell;
+            if(!oAnchorCell) {
+                oAnchorCell = oSelf._oAnchorCell = oTriggerCell;
+            }
+            oAnchorRecord = oSelf._oAnchorCell.record;
+            nAnchorRecordIndex = oSelf._oRecordSet.getRecordIndex(oAnchorRecord);
+            nAnchorTrIndex = oSelf.getTrIndex(oAnchorRecord);
+            // If anchor cell is not on this page...
+            if(nAnchorTrIndex === null) {
+                // ...set TR index equal to top TR
+                if(nAnchorRecordIndex < oSelf.getRecordIndex(oSelf.getFirstTrEl())) {
+                    nAnchorTrIndex = 0;
+                }
+                // ...set TR index equal to bottom TR
+                else {
+                    nAnchorTrIndex = oSelf.getRecordIndex(oSelf.getLastTrEl());
+                }
+            }
+
+            oAnchorColumn = oSelf._oAnchorCell.column;
+            nAnchorColKeyIndex = oAnchorColumn.getKeyIndex();
+
+
+            ////////////////////////////////////////////////////////////////////////
+            //
+            // SHIFT cell block selection
+            //
+            ////////////////////////////////////////////////////////////////////////
+            if(bSHIFT && (sMode == "cellblock")) {
+                // Arrow DOWN
+                if(nKey == 40) {
+                    // Is the anchor cell above, below, or same row as trigger
+                    if(nAnchorRecordIndex > nTriggerRecordIndex) {
+                        anchorPos = 1;
+                    }
+                    else if(nAnchorRecordIndex < nTriggerRecordIndex) {
+                        anchorPos = -1;
+                    }
+                    else {
+                        anchorPos = 0;
+                    }
+
+                    // Selecting away from anchor cell
+                    if(anchorPos <= 0) {
+                        // Select the horiz block on the next row...
+                        // ...making sure there is room below the trigger row
+                        if(nTriggerTrIndex < allRows.length-1) {
+                            // Select in order from anchor to trigger...
+                            startIndex = nAnchorColKeyIndex;
+                            endIndex = nTriggerColKeyIndex;
+                            // ...going left
+                            if(startIndex > endIndex) {
+                                for(i=startIndex; i>=endIndex; i--) {
+                                    elNext = allRows[nTriggerTrIndex+1].cells[i];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                            // ... going right
+                            else {
+                                for(i=startIndex; i<=endIndex; i++) {
+                                    elNext = allRows[nTriggerTrIndex+1].cells[i];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        startIndex = Math.min(nAnchorColKeyIndex, nTriggerColKeyIndex);
+                        endIndex = Math.max(nAnchorColKeyIndex, nTriggerColKeyIndex);
+                        // Unselect the horiz block on this row towards the next row
+                        for(i=startIndex; i<=endIndex; i++) {
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[i]);
+                        }
+                    }
+                }
+                // Arrow up
+                else if(nKey == 38) {
+                    // Is the anchor cell above, below, or same row as trigger
+                    if(nAnchorRecordIndex > nTriggerRecordIndex) {
+                        anchorPos = 1;
+                    }
+                    else if(nAnchorRecordIndex < nTriggerRecordIndex) {
+                        anchorPos = -1;
+                    }
+                    else {
+                        anchorPos = 0;
+                    }
+                    
+                    // Selecting away from anchor cell
+                    if(anchorPos >= 0) {
+                        // Select the horiz block on the previous row...
+                        // ...making sure there is room
+                        if(nTriggerTrIndex > 0) {
+                            // Select in order from anchor to trigger...
+                            startIndex = nAnchorColKeyIndex;
+                            endIndex = nTriggerColKeyIndex;
+                            // ...going left
+                            if(startIndex > endIndex) {
+                                for(i=startIndex; i>=endIndex; i--) {
+                                    elNext = allRows[nTriggerTrIndex-1].cells[i];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                            // ... going right
+                            else {
+                                for(i=startIndex; i<=endIndex; i++) {
+                                    elNext = allRows[nTriggerTrIndex-1].cells[i];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        startIndex = Math.min(nAnchorColKeyIndex, nTriggerColKeyIndex);
+                        endIndex = Math.max(nAnchorColKeyIndex, nTriggerColKeyIndex);
+                        // Unselect the horiz block on this row towards the previous row
+                        for(i=startIndex; i<=endIndex; i++) {
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[i]);
+                        }
+                    }
+                }
+                // Arrow right
+                else if(nKey == 39) {
+                    // Is the anchor cell left, right, or same column
+                    if(nAnchorColKeyIndex > nTriggerColKeyIndex) {
+                        anchorPos = 1;
+                    }
+                    else if(nAnchorColKeyIndex < nTriggerColKeyIndex) {
+                        anchorPos = -1;
+                    }
+                    else {
+                        anchorPos = 0;
+                    }
+
+                    // Selecting away from anchor cell
+                    if(anchorPos <= 0) {
+                        // Select the next vert block to the right...
+                        // ...making sure there is room
+                        if(nTriggerColKeyIndex < allRows[nTriggerTrIndex].cells.length-1) {
+                            // Select in order from anchor to trigger...
+                            startIndex = nAnchorTrIndex;
+                            endIndex = nTriggerTrIndex;
+                            // ...going up
+                            if(startIndex > endIndex) {
+                                for(i=startIndex; i>=endIndex; i--) {
+                                    elNext = allRows[i].cells[nTriggerColKeyIndex+1];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                            // ... going down
+                            else {
+                                for(i=startIndex; i<=endIndex; i++) {
+                                    elNext = allRows[i].cells[nTriggerColKeyIndex+1];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        // Unselect the vert block on this column towards the right
+                        startIndex = Math.min(nAnchorTrIndex, nTriggerTrIndex);
+                        endIndex = Math.max(nAnchorTrIndex, nTriggerTrIndex);
+                        for(i=startIndex; i<=endIndex; i++) {
+                            oSelf.unselectCell(allRows[i].cells[nTriggerColKeyIndex]);
+                        }
+                    }
+                }
+                // Arrow left
+                else if(nKey == 37) {
+                    // Is the anchor cell left, right, or same column
+                    if(nAnchorColKeyIndex > nTriggerColKeyIndex) {
+                        anchorPos = 1;
+                    }
+                    else if(nAnchorColKeyIndex < nTriggerColKeyIndex) {
+                        anchorPos = -1;
+                    }
+                    else {
+                        anchorPos = 0;
+                    }
+
+                    // Selecting away from anchor cell
+                    if(anchorPos >= 0) {
+                        //Select the previous vert block to the left
+                        if(nTriggerColKeyIndex > 0) {
+                            // Select in order from anchor to trigger...
+                            startIndex = nAnchorTrIndex;
+                            endIndex = nTriggerTrIndex;
+                            // ...going up
+                            if(startIndex > endIndex) {
+                                for(i=startIndex; i>=endIndex; i--) {
+                                    elNext = allRows[i].cells[nTriggerColKeyIndex-1];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                            // ... going down
+                            else {
+                                for(i=startIndex; i<=endIndex; i++) {
+                                    elNext = allRows[i].cells[nTriggerColKeyIndex-1];
+                                    oSelf.selectCell(elNext);
+                                }
+                            }
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        // Unselect the vert block on this column towards the left
+                        startIndex = Math.min(nAnchorTrIndex, nTriggerTrIndex);
+                        endIndex = Math.max(nAnchorTrIndex, nTriggerTrIndex);
+                        for(i=startIndex; i<=endIndex; i++) {
+                            oSelf.unselectCell(allRows[i].cells[nTriggerColKeyIndex]);
+                        }
+                    }
+                }
+            }
+            ////////////////////////////////////////////////////////////////////////
+            //
+            // SHIFT cell range selection
+            //
+            ////////////////////////////////////////////////////////////////////////
+            else if(bSHIFT && (sMode == "cellrange")) {
+                // Is the anchor cell above, below, or same row as trigger
+                if(nAnchorRecordIndex > nTriggerRecordIndex) {
+                    anchorPos = 1;
+                }
+                else if(nAnchorRecordIndex < nTriggerRecordIndex) {
+                    anchorPos = -1;
+                }
+                else {
+                    anchorPos = 0;
+                }
+
+                // Arrow down
+                if(nKey == 40) {
+                    // Selecting away from anchor cell
+                    if(anchorPos <= 0) {
+                        // Select all cells to the end of this row
+                        for(i=nTriggerColKeyIndex+1; i<allRows[nTriggerTrIndex].cells.length; i++){
+                            elNext = allRows[nTriggerTrIndex].cells[i];
+                            oSelf.selectCell(elNext);
+                        }
+
+                        // Select some of the cells on the next row down
+                        if(nTriggerTrIndex < allRows.length-1) {
+                            for(i=0; i<=nTriggerColKeyIndex; i++){
+                                elNext = allRows[nTriggerTrIndex+1].cells[i];
+                                oSelf.selectCell(elNext);
+                            }
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        // Unselect all cells to the end of this row
+                        for(i=nTriggerColKeyIndex; i<allRows[nTriggerTrIndex].cells.length; i++){
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[i]);
+                        }
+
+                        // Unselect some of the cells on the next row down
+                        for(i=0; i<nTriggerColKeyIndex; i++){
+                            oSelf.unselectCell(allRows[nTriggerTrIndex+1].cells[i]);
+                        }
+                    }
+                }
+                // Arrow up
+                else if(nKey == 38) {
+                    // Selecting away from anchor cell
+                    if(anchorPos >= 0) {
+                        // Select all the cells to the beginning of this row
+                        for(i=nTriggerColKeyIndex-1; i>-1; i--){
+                            elNext = allRows[nTriggerTrIndex].cells[i];
+                            oSelf.selectCell(elNext);
+                        }
+
+                        // Select some of the cells from the end of the previous row
+                        if(nTriggerTrIndex > 0) {
+                            for(i=allRows[nTriggerTrIndex].cells.length-1; i>=nTriggerColKeyIndex; i--){
+                                elNext = allRows[nTriggerTrIndex-1].cells[i];
+                                oSelf.selectCell(elNext);
+                            }
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else {
+                        // Unselect all the cells to the beginning of this row
+                        for(i=nTriggerColKeyIndex; i>-1; i--){
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[i]);
+                        }
+
+                        // Unselect some of the cells from the end of the previous row
+                        for(i=allRows[nTriggerTrIndex].cells.length-1; i>nTriggerColKeyIndex; i--){
+                            oSelf.unselectCell(allRows[nTriggerTrIndex-1].cells[i]);
+                        }
+                    }
+                }
+                // Arrow right
+                else if(nKey == 39) {
+                    // Selecting away from anchor cell
+                    if(anchorPos < 0) {
+                        // Select the next cell to the right
+                        if(nTriggerColKeyIndex < allRows[nTriggerTrIndex].cells.length-1) {
+                            elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex+1];
+                            oSelf.selectCell(elNext);
+                        }
+                        // Select the first cell of the next row
+                        else if(nTriggerTrIndex < allRows.length-1) {
+                            elNext = allRows[nTriggerTrIndex+1].cells[0];
+                            oSelf.selectCell(elNext);
+                        }
+                    }
+                    // Unselecting towards anchor cell
+                    else if(anchorPos > 0) {
+                        oSelf.unselectCell(allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex]);
+
+                        // Unselect this cell towards the right
+                        if(nTriggerColKeyIndex < allRows[nTriggerTrIndex].cells.length-1) {
+                        }
+                        // Unselect this cells towards the first cell of the next row
+                        else {
+                        }
+                    }
+                    // Anchor is on this row
+                    else {
+                        // Selecting away from anchor
+                        if(nAnchorColKeyIndex <= nTriggerColKeyIndex) {
+                            // Select the next cell to the right
+                            if(nTriggerColKeyIndex < allRows[nTriggerTrIndex].cells.length-1) {
+                                elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex+1];
+                                oSelf.selectCell(elNext);
+                            }
+                            // Select the first cell on the next row
+                            else if(nTriggerTrIndex < allRows.length-1){
+                                elNext = allRows[nTriggerTrIndex+1].cells[0];
+                                oSelf.selectCell(elNext);
+                            }
+                        }
+                        // Unselecting towards anchor
+                        else {
+                            // Unselect this cell towards the right
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex]);
+                        }
+                    }
+                }
+                // Arrow left
+                else if(nKey == 37) {
+                    // Unselecting towards the anchor
+                    if(anchorPos < 0) {
+                        oSelf.unselectCell(allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex]);
+
+                        // Unselect this cell towards the left
+                        if(nTriggerColKeyIndex > 0) {
+                        }
+                        // Unselect this cell towards the last cell of the previous row
+                        else {
+                        }
+                    }
+                    // Selecting towards the anchor
+                    else if(anchorPos > 0) {
+                        // Select the next cell to the left
+                        if(nTriggerColKeyIndex > 0) {
+                            elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex-1];
+                            oSelf.selectCell(elNext);
+                        }
+                        // Select the last cell of the previous row
+                        else if(nTriggerTrIndex > 0){
+                            elNext = allRows[nTriggerTrIndex-1].cells[allRows[nTriggerTrIndex-1].cells.length-1];
+                            oSelf.selectCell(elNext);
+                        }
+                    }
+                    // Anchor is on this row
+                    else {
+                        // Selecting away from anchor cell
+                        if(nAnchorColKeyIndex >= nTriggerColKeyIndex) {
+                            // Select the next cell to the left
+                            if(nTriggerColKeyIndex > 0) {
+                                elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex-1];
+                                oSelf.selectCell(elNext);
+                            }
+                            // Select the last cell of the previous row
+                            else if(nTriggerTrIndex > 0){
+                                elNext = allRows[nTriggerTrIndex-1].cells[allRows[nTriggerTrIndex-1].cells.length-1];
+                                oSelf.selectCell(elNext);
+                            }
+                        }
+                        // Unselecting towards anchor cell
+                        else {
+                            oSelf.unselectCell(allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex]);
+
+                            // Unselect this cell towards the left
+                            if(nTriggerColKeyIndex > 0) {
+                            }
+                            // Unselect this cell towards the last cell of the previous row
+                            else {
+                            }
+                        }
+                    }
+                }
+            }
+            ////////////////////////////////////////////////////////////////////////
+            //
+            // Simple single cell selection
+            //
+            ////////////////////////////////////////////////////////////////////////
+            else if((sMode == "cellblock") || (sMode == "cellrange") || (sMode == "singlecell")) {
+                // Arrow down
+                if(nKey == 40) {
+                    oSelf.unselectAllCells();
+
+                    // Select the next cell down
+                    if(nTriggerTrIndex < allRows.length-1) {
+                        elNext = allRows[nTriggerTrIndex+1].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+                    // Select only the bottom cell
+                    else {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+
+                    oSelf._oAnchorCell = {record:oSelf.getRecord(elNext), column:oSelf.getColumn(elNext)};
+                }
+                // Arrow up
+                else if(nKey == 38) {
+                    oSelf.unselectAllCells();
+
+                    // Select the next cell up
+                    if(nTriggerTrIndex > 0) {
+                        elNext = allRows[nTriggerTrIndex-1].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+                    // Select only the top cell
+                    else {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+
+                    oSelf._oAnchorCell = {record:oSelf.getRecord(elNext), column:oSelf.getColumn(elNext)};
+                }
+                // Arrow right
+                else if(nKey == 39) {
+                    oSelf.unselectAllCells();
+
+                    // Select the next cell to the right
+                    if(nTriggerColKeyIndex < allRows[nTriggerTrIndex].cells.length-1) {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex+1];
+                        oSelf.selectCell(elNext);
+                    }
+                    // Select only the right cell
+                    else {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+
+                    oSelf._oAnchorCell = {record:oSelf.getRecord(elNext), column:oSelf.getColumn(elNext)};
+                }
+                // Arrow left
+                else if(nKey == 37) {
+                    oSelf.unselectAllCells();
+
+                    // Select the next cell to the left
+                    if(nTriggerColKeyIndex > 0) {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex-1];
+                        oSelf.selectCell(elNext);
+                    }
+                    // Select only the left cell
+                    else {
+                        elNext = allRows[nTriggerTrIndex].cells[nTriggerColKeyIndex];
+                        oSelf.selectCell(elNext);
+                    }
+
+                    oSelf._oAnchorCell = {record:oSelf.getRecord(elNext), column:oSelf.getColumn(elNext)};
+                }
+            }
+
+
+
+
+
+
+
+
+
+
+
+
+
+        }
+    }
+    else {
+        //TODO: handle tab across cells
+        //TODO: handle backspace
+        //TODO: handle delete
+        //TODO: handle arrow selection across pages
+        return;
+    }
+};
+
+/**
+ * Handles keypress events on the TABLE. Mainly to support stopEvent on Mac.
+ *
+ * @method _onTableKeypress
+ * @param e {HTMLEvent} The key event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTableKeypress = function(e, oSelf) {
+    var isMac = (navigator.userAgent.toLowerCase().indexOf("mac") != -1);
+    if(isMac) {
+        var nKey = YAHOO.util.Event.getCharCode(e);
+        // arrow down
+        if(nKey == 40) {
+            YAHOO.util.Event.stopEvent(e);
+        }
+        // arrow up
+        else if(nKey == 38) {
+            YAHOO.util.Event.stopEvent(e);
+        }
+    }
+};
+
+/**
+ * Handles click events on the THEAD element.
+ *
+ * @method _onTheadClick
+ * @param e {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTheadClick = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    if(oSelf._oCellEditor && oSelf._oCellEditor.isActive) {
+        oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
+    }
+
+    while(elTarget && (elTag != "thead")) {
+            switch(elTag) {
+                case "body":
+                    break;
+                case "span":
+                    if(YAHOO.util.Dom.hasClass(elTarget, YAHOO.widget.DataTable.CLASS_LABEL)) {
+                        oSelf.fireEvent("headerLabelClickEvent",{target:elTarget,event:e});
+                    }
+                    break;
+                case "th":
+                    oSelf.fireEvent("headerCellClickEvent",{target:elTarget,event:e});
+                    break;
+                case "tr":
+                    oSelf.fireEvent("headerRowClickEvent",{target:elTarget,event:e});
+                    break;
+                default:
+                    break;
+            }
+            elTarget = elTarget.parentNode;
+            if(elTarget) {
+                elTag = elTarget.tagName.toLowerCase();
+            }
+    }
+    oSelf.fireEvent("tableClickEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/**
+ * Handles click events on the primary TBODY element.
+ *
+ * @method _onTbodyClick
+ * @param e {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onTbodyClick = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    if(oSelf._oCellEditor && oSelf._oCellEditor.isActive) {
+        oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
+    }
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                break;
+            case "input":
+                if(elTarget.type.toLowerCase() == "checkbox") {
+                    oSelf.fireEvent("checkboxClickEvent",{target:elTarget,event:e});
+                }
+                else if(elTarget.type.toLowerCase() == "radio") {
+                    oSelf.fireEvent("radioClickEvent",{target:elTarget,event:e});
+                }
+                oSelf.fireEvent("tableClickEvent",{target:(elTarget || oSelf._elTable),event:e});
+                return;
+            case "a":
+                oSelf.fireEvent("linkClickEvent",{target:elTarget,event:e});
+                oSelf.fireEvent("tableClickEvent",{target:(elTarget || oSelf._elTable),event:e});
+                return;
+            case "button":
+                oSelf.fireEvent("buttonClickEvent",{target:elTarget,event:e});
+                oSelf.fireEvent("tableClickEvent",{target:(elTarget || oSelf._elTable),event:e});
+                return;
+            case "td":
+                oSelf.fireEvent("cellClickEvent",{target:elTarget,event:e});
+                break;
+            case "tr":
+                oSelf.fireEvent("rowClickEvent",{target:elTarget,event:e});
+                break;
+            default:
+                break;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+    }
+    oSelf.fireEvent("tableClickEvent",{target:(elTarget || oSelf._elTable),event:e});
+};
+
+/*TODO: delete
+ * Handles keyup events on the TBODY. Executes deletion.
+ *
+ * @method _onTbodyKeyup
+ * @param e {HTMLEvent} The key event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+/*YAHOO.widget.DataTable.prototype._onTbodyKeyup = function(e, oSelf) {
+   var nKey = YAHOO.util.Event.getCharCode(e);
+    // delete
+    if(nKey == 46) {//TODO: if something is selected
+        //TODO: delete row
+    }
+};*/
+
+/**
+ * Handles click events on paginator links.
+ *
+ * @method _onPaginatorLinkClick
+ * @param e {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onPaginatorLinkClick = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var elTag = elTarget.tagName.toLowerCase();
+
+    if(oSelf._oCellEditor && oSelf._oCellEditor.isActive) {
+        oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
+    }
+
+    while(elTarget && (elTag != "table")) {
+        switch(elTag) {
+            case "body":
+                return;
+            case "a":
+                YAHOO.util.Event.stopEvent(e);
+                //TODO: after the showPage call, figure out which link
+                //TODO: was clicked and reset focus to the new version of it
+                switch(elTarget.className) {
+                    case YAHOO.widget.DataTable.CLASS_PAGE:
+                        oSelf.showPage(parseInt(elTarget.innerHTML,10));
+                        return;
+                    case YAHOO.widget.DataTable.CLASS_FIRST:
+                        oSelf.showPage(1);
+                        return;
+                    case YAHOO.widget.DataTable.CLASS_LAST:
+                        oSelf.showPage(oSelf.get("paginator").totalPages);
+                        return;
+                    case YAHOO.widget.DataTable.CLASS_PREVIOUS:
+                        oSelf.showPage(oSelf.get("paginator").currentPage - 1);
+                        return;
+                    case YAHOO.widget.DataTable.CLASS_NEXT:
+                        oSelf.showPage(oSelf.get("paginator").currentPage + 1);
+                        return;
+                }
+                break;
+            default:
+                return;
+        }
+        elTarget = elTarget.parentNode;
+        if(elTarget) {
+            elTag = elTarget.tagName.toLowerCase();
+        }
+        else {
+            return;
+        }
+    }
+};
+
+/**
+ * Handles change events on paginator SELECT element.
+ *
+ * @method _onPaginatorDropdownChange
+ * @param e {HTMLEvent} The change event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onPaginatorDropdownChange = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    var newValue = elTarget[elTarget.selectedIndex].value;
+
+    var newRowsPerPage = YAHOO.lang.isValue(parseInt(newValue,10)) ? parseInt(newValue,10) : null;
+    if(newRowsPerPage !== null) {
+        var newStartRecordIndex = (oSelf.get("paginator").currentPage-1) * newRowsPerPage;
+        oSelf.updatePaginator({rowsPerPage:newRowsPerPage, startRecordIndex:newStartRecordIndex});
+        oSelf.refreshView();
+    }
+    else {
+    }
+};
+
+/**
+ * Handles change events on SELECT elements within DataTable.
+ *
+ * @method _onDropdownChange
+ * @param e {HTMLEvent} The change event.
+ * @param oSelf {YAHOO.widget.DataTable} DataTable instance.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onDropdownChange = function(e, oSelf) {
+    var elTarget = YAHOO.util.Event.getTarget(e);
+    //TODO: pass what args?
+    //var value = elTarget[elTarget.selectedIndex].value;
+    oSelf.fireEvent("dropdownChangeEvent", {event:e, target:elTarget});
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+// OBJECT ACCESSORS
+
+/**
+ * Public accessor to the unique name of the DataSource instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the DataSource instance.
+ */
+
+YAHOO.widget.DataTable.prototype.toString = function() {
+    return "DataTable " + this._sName;
+};
+
+/**
+ * Returns the DataTable instance's DataSource instance.
+ *
+ * @method getDataSource
+ * @return {YAHOO.util.DataSource} DataSource instance.
+ */
+YAHOO.widget.DataTable.prototype.getDataSource = function() {
+    return this._oDataSource;
+};
+
+/**
+ * Returns the DataTable instance's ColumnSet instance.
+ *
+ * @method getColumnSet
+ * @return {YAHOO.widget.ColumnSet} ColumnSet instance.
+ */
+YAHOO.widget.DataTable.prototype.getColumnSet = function() {
+    return this._oColumnSet;
+};
+
+/**
+ * Returns the DataTable instance's RecordSet instance.
+ *
+ * @method getRecordSet
+ * @return {YAHOO.widget.RecordSet} RecordSet instance.
+ */
+YAHOO.widget.DataTable.prototype.getRecordSet = function() {
+    return this._oRecordSet;
+};
+
+/**
+ * Returns the DataTable instance's Cell Editor as an object literal with the
+ * following properties:
+ * <dl>
+ * <dt>cell</dt>
+ * <dd>{HTMLElement} Cell element being edited.</dd>
+ *
+ * <dt>column</dt>
+ * <dd>{YAHOO.widget.Column} Associated Column instance.</dd>
+ *
+ * <dt>container</dt>
+ * <dd>{HTMLElement} Reference to editor's container DIV element.</dd>
+ *
+ * <dt>isActive</dt>
+ * <dd>{Boolean} True if cell is currently being edited.</dd>
+ *
+ * <dt>record</dt>
+ * <dd>{YAHOO.widget.Record} Associated Record instance.</dd>
+ *
+ * <dt>validator</dt>
+ * <dd>{HTMLFunction} Associated validator function called before new data is stored. Called
+ * within the scope of the DataTable instance, the function receieves the
+ * following arguments:
+ *
+ * <dl>
+ *  <dt>oNewData</dt>
+ *  <dd>{Object} New data to validate.</dd>
+ *
+ *  <dt>oOldData</dt>
+ *  <dd>{Object} Original data in case of reversion.</dd>
+ *
+ *  <dt>oCellEditor</dt>
+ *  <dd>{Object} Object literal representation of Editor values.</dd>
+ * </dl>
+ *
+ *  </dd>
+ *
+ * <dt>value</dt>
+ * <dd>Current input value</dd>
+ * </dl>
+ *
+ *
+ *
+ *
+ *
+ *
+ * @method getCellEditor
+ * @return {Object} Cell Editor object literal values.
+ */
+YAHOO.widget.DataTable.prototype.getCellEditor = function() {
+    return this._oCellEditor;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// DOM ACCESSORS
+
+/**
+ * Returns DOM reference to the DataTable's TABLE element.
+ *
+ * @method getTableEl
+ * @return {HTMLElement} Reference to TABLE element.
+ */
+YAHOO.widget.DataTable.prototype.getTableEl = function() {
+    return this._elTable;
+};
+
+/**
+ * Returns DOM reference to the DataTable's THEAD element.
+ *
+ * @method getTheadEl
+ * @return {HTMLElement} Reference to THEAD element.
+ */
+YAHOO.widget.DataTable.prototype.getTheadEl = function() {
+    return this._elThead;
+};
+
+/**
+ * Returns DOM reference to the DataTable's primary TBODY element.
+ *
+ * @method getTbodyEl
+ * @return {HTMLElement} Reference to TBODY element.
+ */
+YAHOO.widget.DataTable.prototype.getTbodyEl = function() {
+    return this._elTbody;
+};
+// Backward compatibility
+YAHOO.widget.DataTable.prototype.getBody = function() {
+    return this.getTbodyEl();
+};
+
+/**
+ * Returns DOM reference to the DataTable's secondary TBODY element that is
+ * used to display messages.
+ *
+ * @method getMsgTbodyEl
+ * @return {HTMLElement} Reference to TBODY element.
+ */
+YAHOO.widget.DataTable.prototype.getMsgTbodyEl = function() {
+    return this._elMsgTbody;
+};
+
+/**
+ * Returns DOM reference to the TD element within the secondary TBODY that is
+ * used to display messages.
+ *
+ * @method getMsgTdEl
+ * @return {HTMLElement} Reference to TD element.
+ */
+YAHOO.widget.DataTable.prototype.getMsgTdEl = function() {
+    return this._elMsgTd;
+};
+
+/**
+ * Returns the corresponding TR reference for a given DOM element, ID string or
+ * directly page row index. If the given identifier is a child of a TR element,
+ * then DOM tree is traversed until a parent TR element is returned, otherwise
+ * null.
+ *
+ * @method getTrEl
+ * @param row {HTMLElement | String | Number | YAHOO.widget.Record} Which row to
+ * get: by element reference, ID string, page row index, or Record.
+ * @return {HTMLElement} Reference to TR element, or null.
+ */
+YAHOO.widget.DataTable.prototype.getTrEl = function(row) {
+    var allRows = this._elTbody.rows;
+    
+    // By Record
+    if(row instanceof YAHOO.widget.Record) {
+        var nTrIndex = this.getTrIndex(row);
+            if(nTrIndex !== null) {
+                return allRows[nTrIndex];
+            }
+            // Not a valid Record
+            else {
+                return null;
+            }
+    }
+    // By page row index
+    else if(YAHOO.lang.isNumber(row) && (row > -1) && (row < allRows.length)) {
+        return allRows[row];
+    }
+    // By ID string or element reference
+    else {
+        var elRow;
+        var el = YAHOO.util.Dom.get(row);
+        
+        // Validate HTML element
+        if(el && (el.ownerDocument == document)) {
+            // Validate TR element
+            if(el.tagName.toLowerCase() != "tr") {
+                // Traverse up the DOM to find the corresponding TR element
+                elRow = YAHOO.util.Dom.getAncestorByTagName(el,"tr");
+            }
+            else {
+                elRow = el;
+            }
+
+            // Make sure the TR is in this TBODY
+            if(elRow && (elRow.parentNode == this._elTbody)) {
+                // Now we can return the TR element
+                return elRow;
+            }
+        }
+    }
+    
+    return null;
+};
+// Backward compatibility
+YAHOO.widget.DataTable.prototype.getRow = function(index) {
+    return this.getTrEl(index);
+};
+
+/**
+ * Returns DOM reference to the first TR element in the DataTable page, or null.
+ *
+ * @method getFirstTrEl
+ * @return {HTMLElement} Reference to TR element.
+ */
+YAHOO.widget.DataTable.prototype.getFirstTrEl = function() {
+    return this._elTbody.rows[0] || null;
+};
+
+/**
+ * Returns DOM reference to the last TR element in the DataTable page, or null.
+ *
+ * @method getLastTrEl
+ * @return {HTMLElement} Reference to last TR element.
+ */
+YAHOO.widget.DataTable.prototype.getLastTrEl = function() {
+    var allRows = this._elTbody.rows;
+        if(allRows.length > 0) {
+            return allRows[allRows.length-1] || null;
+        }
+};
+
+/**
+ * Returns DOM reference to a TD element.
+ *
+ * @method getTdEl
+ * @param cell {HTMLElement | String | Object} DOM element reference or string ID, or
+ * object literal of syntax {record:oRecord, column:oColumn}.
+ * @return {HTMLElement} Reference to TD element.
+ */
+YAHOO.widget.DataTable.prototype.getTdEl = function(cell) {
+    var elCell;
+    var el = YAHOO.util.Dom.get(cell);
+
+    // Validate HTML element
+    if(el && (el.ownerDocument == document)) {
+        // Validate TD element
+        if(el.tagName.toLowerCase() != "td") {
+            // Traverse up the DOM to find the corresponding TR element
+            elCell = YAHOO.util.Dom.getAncestorByTagName(el, "td");
+        }
+        else {
+            elCell = el;
+        }
+
+        // Make sure the TD is in this TBODY
+        if(elCell && (elCell.parentNode.parentNode == this._elTbody)) {
+            // Now we can return the TD element
+            return elCell;
+        }
+    }
+    else if(cell.record && cell.column && cell.column.getKeyIndex) {
+        var oRecord = cell.record;
+        var elRow = this.getTrEl(oRecord);
+        if(elRow && elRow.cells && elRow.cells.length > 0) {
+            return elRow.cells[cell.column.getKeyIndex()] || null;
+        }
+    }
+    
+    return null;
+};
+
+/**
+ * Returns DOM reference to a TH element.
+ *
+ * @method getThEl
+ * @param header {YAHOO.widget.Column | HTMLElement | String} Column instance,
+ * DOM element reference, or string ID.
+ * @return {HTMLElement} Reference to TH element.
+ */
+YAHOO.widget.DataTable.prototype.getThEl = function(header) {
+    var elHeader;
+        
+    // Validate Column instance
+    if(header instanceof YAHOO.widget.Column) {
+        var oColumn = header;
+        elHeader = YAHOO.util.Dom.get(this.id + "-col" + oColumn.getId());
+        if(elHeader) {
+            return elHeader;
+        }
+    }
+    // Validate HTML element
+    else {
+        var el = YAHOO.util.Dom.get(header);
+
+        if(el && (el.ownerDocument == document)) {
+            // Validate TH element
+            if(el.tagName.toLowerCase() != "th") {
+                // Traverse up the DOM to find the corresponding TR element
+                elHeader = YAHOO.util.Dom.getAncestorByTagName(el,"th");
+            }
+            else {
+                elHeader = el;
+            }
+
+            // Make sure the TH is in this THEAD
+            if(elHeader && (elHeader.parentNode.parentNode == this._elThead)) {
+                // Now we can return the TD element
+                return elHeader;
+            }
+        }
+    }
+
+    return null;
+};
+
+/**
+ * Returns the page row index of given row. Returns null if the row is not on the
+ * current DataTable page.
+ *
+ * @method getTrIndex
+ * @param row {HTMLElement | String | YAHOO.widget.Record | Number} DOM or ID
+ * string reference to an element within the DataTable page, a Record instance,
+ * or a Record's RecordSet index.
+ * @return {Number} Page row index, or null if row does not exist or is not on current page.
+ */
+YAHOO.widget.DataTable.prototype.getTrIndex = function(row) {
+    var nRecordIndex;
+    
+    // By Record
+    if(row instanceof YAHOO.widget.Record) {
+        nRecordIndex = this._oRecordSet.getRecordIndex(row);
+        if(nRecordIndex === null) {
+            // Not a valid Record
+            return null;
+        }
+    }
+    // Calculate page row index from Record index
+    else if(YAHOO.lang.isNumber(row)) {
+        nRecordIndex = row;
+    }
+    if(YAHOO.lang.isNumber(nRecordIndex)) {
+        // Validate the number
+        if((nRecordIndex > -1) && (nRecordIndex < this._oRecordSet.getLength())) {
+            // DataTable is paginated
+            if(this.get("paginated")) {
+                // Get the first and last Record on current page
+                var startRecordIndex = this.get("paginator").startRecordIndex;
+                var endRecordIndex = startRecordIndex + this.get("paginator").rowsPerPage - 1;
+                // This Record is on current page
+                if((nRecordIndex >= startRecordIndex) && (nRecordIndex <= endRecordIndex)) {
+                    return nRecordIndex - startRecordIndex;
+                }
+                // This Record is not on current page
+                else {
+                    return null;
+                }
+            }
+            // Not paginated, just return the Record index
+            else {
+                return nRecordIndex;
+            }
+        }
+        // RecordSet index is out of range
+        else {
+            return null;
+        }
+    }
+    // By element reference or ID string
+    else {
+        // Validate TR element
+        var elRow = this.getTrEl(row);
+        if(elRow && (elRow.ownerDocument == document) &&
+                (elRow.parentNode == this._elTbody)) {
+            return elRow.sectionRowIndex;
+        }
+    }
+    
+    return null;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// TABLE FUNCTIONS
+
+/**
+ * Resets a RecordSet with the given data and populates the page view
+ * with the new data. Any previous data and selection states are cleared.
+ * However, sort states are not cleared, so if the given data is in a particular
+ * sort order, implementers should take care to reset the sortedBy property. If
+ * pagination is enabled, the currentPage is shown and Paginator UI updated,
+ * otherwise all rows are displayed as a single page. For performance, existing
+ * DOM elements are reused when possible.
+ *
+ * @method initializeTable
+ * @param oData {Object | Object[]} An object literal of data or an array of
+ * object literals containing data.
+ */
+YAHOO.widget.DataTable.prototype.initializeTable = function(oData) {
+    // Clear the RecordSet
+    this._oRecordSet.reset();
+
+    // Add data to RecordSet
+    var records = this._oRecordSet.addRecords(oData);
+
+    // Clear selections
+    this._unselectAllTrEls();
+    this._unselectAllTdEls();
+    this._aSelections = null;
+    this._oAnchorRecord = null;
+    this._oAnchorCell = null;
+
+    // Refresh the view
+    this.refreshView();
+    this.fireEvent("initEvent");
+};
+
+/**
+ * Refreshes the view with existing Records from the RecordSet while
+ * maintaining sort, pagination, and selection states. For performance, reuses
+ * existing DOM elements when possible while deleting extraneous elements.
+ *
+ * @method refreshView
+ */
+YAHOO.widget.DataTable.prototype.refreshView = function() {
+    var i, j, k, l, aRecords;
+    var oPaginator = this.updatePaginator();
+
+    // Paginator is enabled, show a subset of Records and update Paginator UI
+    if(this.get("paginated")) {
+        var rowsPerPage = oPaginator.rowsPerPage;
+        var startRecordIndex = (oPaginator.currentPage - 1) * rowsPerPage;
+        aRecords = this._oRecordSet.getRecords(startRecordIndex, rowsPerPage);
+        this.formatPaginators();
+    }
+    // Show all records
+    else {
+        aRecords = this._oRecordSet.getRecords();
+    }
+
+    var elTbody = this._elTbody;
+    var elRows = elTbody.rows;
+
+    // Has rows
+    if(YAHOO.lang.isArray(aRecords) && (aRecords.length > 0)) {
+        this.hideTableMessage();
+
+        // Keep track of selected rows
+        var aSelectedRows = this.getSelectedRows();
+        // Keep track of selected cells
+        var aSelectedCells = this.getSelectedCells();
+        // Anything to reinstate?
+        var bReselect = (aSelectedRows.length>0) || (aSelectedCells.length > 0);
+
+        // Remove extra rows from the bottom so as to preserve ID order
+        while(elTbody.hasChildNodes() && (elRows.length > aRecords.length)) {
+            elTbody.deleteRow(-1);
+        }
+
+        // Unselect all TR and TD elements in the UI
+        if(bReselect) {
+            this._unselectAllTrEls();
+            this._unselectAllTdEls();
+        }
+
+        // From the top, update in-place existing rows
+        for(i=0; i<elRows.length; i++) {
+            this._updateTrEl(elRows[i], aRecords[i]);
+        }
+
+        // Add TR elements as necessary
+        for(i=elRows.length; i<aRecords.length; i++) {
+            this._addTrEl(aRecords[i]);
+        }
+
+        // Reinstate selected and sorted classes
+        if(bReselect) {
+            // Loop over each row
+            for(j=0; j<elRows.length; j++) {
+                var thisRow = elRows[j];
+                var sMode = this.get("selectionMode");
+                if ((sMode == "standard") || (sMode == "single")) {
+                    // Set SELECTED
+                    for(k=0; k<aSelectedRows.length; k++) {
+                        if(aSelectedRows[k] === thisRow.yuiRecordId) {
+                            YAHOO.util.Dom.addClass(thisRow, YAHOO.widget.DataTable.CLASS_SELECTED);
+                            if(j === elRows.length-1) {
+                                this._oAnchorRecord = this.getRecord(thisRow.yuiRecordId);
+                            }
+                        }
+                    }
+                }
+                else {
+                    // Loop over each cell
+                    for(k=0; k<thisRow.cells.length; k++) {
+                        var thisCell = thisRow.cells[k];
+                        // Set SELECTED
+                        for(l=0; l<aSelectedCells.length; l++) {
+                            if((aSelectedCells[l].recordId === thisRow.yuiRecordId) &&
+                                    (aSelectedCells[l].columnId === thisCell.yuiColumnId)) {
+                                YAHOO.util.Dom.addClass(thisCell, YAHOO.widget.DataTable.CLASS_SELECTED);
+                                if(k === thisRow.cells.length-1) {
+                                    this._oAnchorCell = {record:this.getRecord(thisRow.yuiRecordId), column:this.getColumnById(thisCell.yuiColumnId)};
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        // Set FIRST/LAST, EVEN/ODD
+        this._setFirstRow();
+        this._setLastRow();
+        this._setRowStripes();
+
+        this.fireEvent("refreshEvent");
+    }
+    // Empty
+    else {
+        // Remove all rows
+        while(elTbody.hasChildNodes()) {
+            elTbody.deleteRow(-1);
+        }
+
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY, YAHOO.widget.DataTable.CLASS_EMPTY);
+    }
+};
+
+/**
+ * Nulls out the entire DataTable instance and related objects, removes attached
+ * event listeners, and clears out DOM elements inside the container. After
+ * calling this method, the instance reference should be expliclitly nulled by
+ * implementer, as in myDataTable = null. Use with caution!
+ *
+ * @method destroy
+ */
+YAHOO.widget.DataTable.prototype.destroy = function() {
+    // Destroy Cell Editor
+    YAHOO.util.Event.purgeElement(this._oCellEditor.container, true);
+    document.body.removeChild(this._oCellEditor.container);
+    
+    var instanceName = this.toString();
+    var elContainer = this._elContainer;
+
+    // Unhook custom events
+    this._oRecordSet.unsubscribeAll();
+    this.unsubscribeAll();
+
+    // Unhook DOM events
+    YAHOO.util.Event.purgeElement(elContainer, true);
+
+    // Remove DOM elements
+    elContainer.innerHTML = "";
+
+    // Null out objects
+    for(var param in this) {
+        if(YAHOO.lang.hasOwnProperty(this, param)) {
+            this[param] = null;
+        }
+    }
+
+};
+
+/**
+ * Displays message within secondary TBODY.
+ *
+ * @method showTableMessage
+ * @param sHTML {String} (optional) Value for innerHTML.
+ * @param sClassName {String} (optional) Classname.
+ */
+YAHOO.widget.DataTable.prototype.showTableMessage = function(sHTML, sClassName) {
+    var elCell = this._elMsgTd;
+    if(YAHOO.lang.isString(sHTML)) {
+        elCell.innerHTML = sHTML;
+    }
+    if(YAHOO.lang.isString(sClassName)) {
+        YAHOO.util.Dom.addClass(elCell, sClassName);
+    }
+    this._elMsgTbody.style.display = "";
+    this.fireEvent("tableMsgShowEvent", {html:sHTML, className:sClassName});
+};
+
+/**
+ * Hides secondary TBODY.
+ *
+ * @method hideTableMessage
+ */
+YAHOO.widget.DataTable.prototype.hideTableMessage = function() {
+    if(this._elMsgTbody.style.display != "none") {
+        this._elMsgTbody.style.display = "none";
+        this.fireEvent("tableMsgHideEvent");
+    }
+};
+
+/**
+ * Brings focus to DataTable instance.
+ *
+ * @method focus
+ */
+YAHOO.widget.DataTable.prototype.focus = function() {
+    this._focusEl(this._elTable);
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// RECORDSET FUNCTIONS
+
+/**
+ * Returns Record index for given TR element or page row index.
+ *
+ * @method getRecordIndex
+ * @param row {YAHOO.widget.Record | HTMLElement | Number} Record instance, TR
+ * element reference or page row index.
+ * @return {Number} Record's RecordSet index, or null.
+ */
+YAHOO.widget.DataTable.prototype.getRecordIndex = function(row) {
+    var nTrIndex;
+
+    if(!YAHOO.lang.isNumber(row)) {
+        // By Record
+        if(row instanceof YAHOO.widget.Record) {
+            return this._oRecordSet.getRecordIndex(row);
+        }
+        // By element reference
+        else {
+            // Find the TR element
+            var el = this.getTrEl(row);
+            if(el) {
+                nTrIndex = el.sectionRowIndex;
+            }
+        }
+    }
+    // By page row index
+    else {
+        nTrIndex = row;
+    }
+
+    if(YAHOO.lang.isNumber(nTrIndex)) {
+        if(this.get("paginated")) {
+            return this.get("paginator").startRecordIndex + nTrIndex;
+        }
+        else {
+            return nTrIndex;
+        }
+    }
+
+    return null;
+};
+
+/**
+ * For the given identifier, returns the associated Record instance.
+ *
+ * @method getRecord
+ * @param row {HTMLElement | Number | String} DOM reference to a TR element (or
+ * child of a TR element), RecordSet position index, or Record ID.
+ * @return {YAHOO.widget.Record} Record instance.
+ */
+YAHOO.widget.DataTable.prototype.getRecord = function(row) {
+    var oRecord = this._oRecordSet.getRecord(row);
+    
+    if(!oRecord) {
+        // Validate TR element
+        var elRow = this.getTrEl(row);
+        if(elRow) {
+            oRecord = this._oRecordSet.getRecord(elRow.yuiRecordId);
+        }
+    }
+    
+    if(oRecord instanceof YAHOO.widget.Record) {
+        return this._oRecordSet.getRecord(oRecord);
+    }
+    else {
+        return null;
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// COLUMN FUNCTIONS
+
+/**
+ * For the given identifier, returns the associated Column instance. Note: For
+ * getting Columns by Column ID string, please use the method getColumnById().
+ *
+ * @method getColumn
+ * @param column {HTMLElement | String | Number} DOM reference or ID string to a
+ * TH/TD element (or child of a TH/TD element), a Column key, or a ColumnSet key index.
+ * @return {YAHOO.widget.Column} Column instance.
+ */
+ YAHOO.widget.DataTable.prototype.getColumn = function(column) {
+    var oColumn = this._oColumnSet.getColumn(column);
+    
+    if(!oColumn) {
+        // Validate TD element
+        var elCell = this.getTdEl(column);
+        if(elCell) {
+            oColumn = this._oColumnSet.getColumnById(elCell.yuiColumnId);
+        }
+        // Validate TH element
+        else {
+            elCell = this.getThEl(column);
+            if(elCell) {
+                oColumn = this._oColumnSet.getColumnById(elCell.yuiColumnId);
+            }
+        }
+    }
+    if(!oColumn) {
+    }
+    return oColumn;
+};
+
+/**
+ * For the given Column ID, returns the associated Column instance. Note: For
+ * getting Columns by key, please use the method getColumn().
+ *
+ * @method getColumnById
+ * @param column {String} Column ID string.
+ * @return {YAHOO.widget.Column} Column instance.
+ */
+ YAHOO.widget.DataTable.prototype.getColumnById = function(column) {
+    return this._oColumnSet.getColumnById(column);
+};
+
+/**
+ * Sorts given Column.
+ *
+ * @method sortColumn
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ */
+YAHOO.widget.DataTable.prototype.sortColumn = function(oColumn) {
+    if(oColumn && (oColumn instanceof YAHOO.widget.Column)) {
+        if(!oColumn.sortable) {
+            YAHOO.util.Dom.addClass(this.getThEl(oColumn), YAHOO.widget.DataTable.CLASS_SORTABLE);
+        }
+        // What is the default sort direction?
+        var sortDir = (oColumn.sortOptions && oColumn.sortOptions.defaultOrder) ? oColumn.sortOptions.defaultOrder : "asc";
+
+        // Already sorted?
+        var oSortedBy = this.get("sortedBy");
+        if(oSortedBy && (oSortedBy.key === oColumn.key)) {
+            if(oSortedBy.dir) {
+                sortDir = (oSortedBy.dir == "asc") ? "desc" : "asc";
+            }
+            else {
+                sortDir = (sortDir == "asc") ? "desc" : "asc";
+            }
+        }
+
+        // Is there a custom sort handler function defined?
+        var sortFnc = (oColumn.sortOptions && YAHOO.lang.isFunction(oColumn.sortOptions.sortFunction)) ?
+                oColumn.sortOptions.sortFunction : function(a, b, desc) {
+                    var sorted = YAHOO.util.Sort.compare(a.getData(oColumn.key),b.getData(oColumn.key), desc);
+                    if(sorted === 0) {
+                        return YAHOO.util.Sort.compare(a.getId(),b.getId(), desc);
+                    }
+                    else {
+                        return sorted;
+                    }
+        };
+
+        // Do the actual sort
+        var desc = (sortDir == "desc") ? true : false;
+        this._oRecordSet.sortRecords(sortFnc, desc);
+
+        // Update sortedBy tracker
+        this.set("sortedBy", {key:oColumn.key, dir:sortDir, column:oColumn});
+
+        // Reset to first page
+        //TODO: Keep selection in view
+        this.updatePaginator({currentPage:1});
+
+        // Update the UI
+        this.refreshView();
+
+        this.fireEvent("columnSortEvent",{column:oColumn,dir:sortDir});
+    }
+    else {
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// ROW FUNCTIONS
+
+
+/**
+ * Adds one new Record of data into the RecordSet at the index if given,
+ * otherwise at the end. If the new Record is in page view, the
+ * corresponding DOM elements are also updated.
+ *
+ * @method addRow
+ * @param oData {Object} Object literal of data for the row.
+ * @param index {Number} (optional) RecordSet position index at which to add data.
+ */
+YAHOO.widget.DataTable.prototype.addRow = function(oData, index) {
+    if(oData && (oData.constructor == Object)) {
+        var oRecord = this._oRecordSet.addRecord(oData, index);
+        if(oRecord) {
+            var nTrIndex = this.getTrIndex(oRecord);
+
+            // Row is on current page
+            if(YAHOO.lang.isNumber(nTrIndex)) {
+                // Paginated so just refresh the view to keep pagination state
+                if(this.get("paginated")) {
+                    this.refreshView();
+                }
+                // Add the TR element
+                else {
+                    var newTrId = this._addTrEl(oRecord, nTrIndex);
+                    if(newTrId) {
+                        // Is this an insert or an append?
+                        var append = (YAHOO.lang.isNumber(nTrIndex) &&
+                                (nTrIndex == this._elTbody.rows.length-1)) ? true : false;
+
+                        // Stripe the one new row
+                        if(append) {
+                            if((this._elTbody.rows.length-1)%2) {
+                                YAHOO.util.Dom.addClass(newTrId, YAHOO.widget.DataTable.CLASS_ODD);
+                            }
+                            else {
+                                YAHOO.util.Dom.addClass(newTrId, YAHOO.widget.DataTable.CLASS_EVEN);
+                            }
+                        }
+                        // Restripe all the rows after the new one
+                        else {
+                            this._setRowStripes(nTrIndex);
+                        }
+
+                        // If new row is at the bottom
+                        if(append) {
+                            this._setLastRow();
+                        }
+                        // If new row is at the top
+                        else if(YAHOO.lang.isNumber(index) && (nTrIndex === 0)) {
+                            this._setFirstRow();
+                        }
+                    }
+                }
+            }
+            // Record is not on current page so just update pagination UI
+            else {
+                this.updatePaginator();
+            }
+
+            // TODO: what args to pass?
+            this.fireEvent("rowAddEvent", {record:oRecord});
+
+            // For log message
+            nTrIndex = (YAHOO.lang.isValue(nTrIndex))? nTrIndex : "n/a";
+
+            return;
+        }
+    }
+};
+
+/**
+ * Convenience method to add multiple rows.
+ *
+ * @method addRows
+ * @param aData {Object[]} Array of object literal data for the rows.
+ * @param index {Number} (optional) RecordSet position index at which to add data.
+ */
+YAHOO.widget.DataTable.prototype.addRows = function(aData, index) {
+    if(YAHOO.lang.isArray(aData)) {
+        var i;
+        if(YAHOO.lang.isNumber(index)) {
+            for(i=aData.length-1; i>-1; i--) {
+                this.addRow(aData[i], index);
+            }
+        }
+        else {
+            for(i=0; i<aData.length; i++) {
+                this.addRow(aData[i]);
+            }
+        }
+    }
+    else {
+    }
+};
+
+/**
+ * For the given row, updates the associated Record with the given data. If the
+ * row is on current page, the corresponding DOM elements are also updated.
+ *
+ * @method updateRow
+ * @param row {YAHOO.widget.Record | Number | HTMLElement | String}
+ * Which row to update: By Record instance, by Record's RecordSet
+ * position index, by HTMLElement reference to the TR element, or by ID string
+ * of the TR element.
+ * @param oData {Object} Object literal of data for the row.
+ */
+YAHOO.widget.DataTable.prototype.updateRow = function(row, oData) {
+    var oldRecord, oldData, updatedRecord, elRow;
+
+    // Get the Record directly
+    if((row instanceof YAHOO.widget.Record) || (YAHOO.lang.isNumber(row))) {
+            // Get the Record directly
+            oldRecord = this._oRecordSet.getRecord(row);
+            
+            // Is this row on current page?
+            elRow = this.getTrEl(oldRecord);
+    }
+    // Get the Record by TR element
+    else {
+        elRow = this.getTrEl(row);
+        if(elRow) {
+            oldRecord = this.getRecord(elRow);
+        }
+    }
+
+    // Update the Record
+    if(oldRecord) {
+        // Copy data from the Record for the event that gets fired later
+        var oRecordData = oldRecord.getData();
+        oldData = {};
+        for(var param in oRecordData) {
+            oldData[param] = oRecordData[param];
+        }
+
+        updatedRecord = this._oRecordSet.updateRecord(oldRecord, oData);
+    }
+    else {
+        return;
+
+    }
+    
+    // Update the TR only if row is on current page
+    if(elRow) {
+        this._updateTrEl(elRow, updatedRecord);
+    }
+
+    this.fireEvent("rowUpdateEvent", {record:updatedRecord, oldData:oldData});
+};
+
+/**
+ * Deletes the given row's Record from the RecordSet. If the row is on current page,
+ * the corresponding DOM elements are also deleted.
+ *
+ * @method deleteRow
+ * @param row {HTMLElement | String | Number} DOM element reference or ID string
+ * to DataTable page element or RecordSet index.
+ */
+YAHOO.widget.DataTable.prototype.deleteRow = function(row) {
+    // Get the Record index...
+    var oRecord = null;
+    // ...by Record index
+    if(YAHOO.lang.isNumber(row)) {
+        oRecord = this._oRecordSet.getRecord(row);
+    }
+    // ...by element reference
+    else {
+        var elRow = YAHOO.util.Dom.get(row);
+        elRow = this.getTrEl(elRow);
+        if(elRow) {
+            oRecord = this.getRecord(elRow);
+        }
+    }
+    if(oRecord) {
+        var sRecordId = oRecord.getId();
+        
+        // Remove from selection tracker if there
+        var tracker = this._aSelections || [];
+        for(var j=tracker.length-1; j>-1; j--) {
+            if((YAHOO.lang.isNumber(tracker[j]) && (tracker[j] === sRecordId)) ||
+                    ((tracker[j].constructor == Object) && (tracker[j].recordId === sRecordId))) {
+                tracker.splice(j,1);
+            }
+        }
+
+        // Copy data from the Record for the event that gets fired later
+        var nRecordIndex = this.getRecordIndex(oRecord);
+        var oRecordData = oRecord.getData();
+        var oData = {};
+        for(var param in oRecordData) {
+            oData[param] = oRecordData[param];
+        }
+
+        // Grab the TR index before deleting the Record
+        var nTrIndex = this.getTrIndex(oRecord);
+
+        // Delete Record from RecordSet
+        this._oRecordSet.deleteRecord(nRecordIndex);
+
+        // If row is on current page, delete the TR element
+        if(YAHOO.lang.isNumber(nTrIndex)) {
+            var isLast = (nTrIndex == this.getLastTrEl().sectionRowIndex) ?
+                    true : false;
+            this._deleteTrEl(nTrIndex);
+
+            // Empty body
+            if(this._elTbody.rows.length === 0) {
+                this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY, YAHOO.widget.DataTable.CLASS_EMPTY);
+            }
+            // Update UI
+            else {
+                // Set FIRST/LAST
+                if(nTrIndex === 0) {
+                    this._setFirstRow();
+                }
+                if(isLast) {
+                    this._setLastRow();
+                }
+                // Set EVEN/ODD
+                if(nTrIndex != this._elTbody.rows.length) {
+                    this._setRowStripes(nTrIndex);
+                }
+            }
+        }
+
+        this.fireEvent("rowDeleteEvent", {recordIndex:nRecordIndex,
+                oldData:oData, trElIndex:nTrIndex});
+    }
+    else {
+    }
+};
+
+/**
+ * Convenience method to delete multiple rows.
+ *
+ * @method deleteRows
+ * @param row {HTMLElement | String | Number} DOM element reference or ID string
+ * to DataTable page element or RecordSet index.
+ * @param count {Number} (optional) How many rows to delete. A negative value
+ * will delete towards the beginning.
+ */
+YAHOO.widget.DataTable.prototype.deleteRows = function(row, count) {
+    // Get the Record index...
+    var nRecordIndex = null;
+    // ...by Record index
+    if(YAHOO.lang.isNumber(row)) {
+        nRecordIndex = row;
+    }
+    // ...by element reference
+    else {
+        var elRow = YAHOO.util.Dom.get(row);
+        elRow = this.getTrEl(elRow);
+        if(elRow) {
+            nRecordIndex = this.getRecordIndex(elRow);
+        }
+    }
+    if(nRecordIndex !== null) {
+        if(count && YAHOO.lang.isNumber(count)) {
+            // Start with highest index and work down
+            var startIndex = (count > 0) ? nRecordIndex + count -1 : nRecordIndex;
+            var endIndex = (count > 0) ? nRecordIndex : nRecordIndex + count + 1;
+            for(var i=startIndex; i>endIndex-1; i--) {
+                this.deleteRow(i);
+            }
+        }
+        else {
+            this.deleteRow(nRecordIndex);
+        }
+    }
+    else {
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// CELL FUNCTIONS
+
+/**
+ * Outputs markup into the given TD based on given Record.
+ *
+ * @method formatCell
+ * @param elCell {HTMLElement} TD Element.
+ * @param oRecord {YAHOO.widget.Record} (Optional) Record instance.
+ * @param oColumn {YAHOO.widget.Column} (Optional) Column instance.
+ * @return {HTML} Markup.
+ */
+YAHOO.widget.DataTable.prototype.formatCell = function(elCell, oRecord, oColumn) {
+    if(!(oRecord instanceof YAHOO.widget.Record)) {
+        oRecord = this.getRecord(elCell);
+    }
+    if(!(oColumn instanceof YAHOO.widget.Column)) {
+        oColumn = this._oColumnSet.getColumn(elCell.yuiColumnKey);
+    }
+    
+    if(oRecord && oColumn) {
+        var sKey = oColumn.key;
+        var oData = oRecord.getData(sKey);
+
+        var fnFormatter;
+        if(YAHOO.lang.isString(oColumn.formatter)) {
+            switch(oColumn.formatter) {
+                case "button":
+                    fnFormatter = YAHOO.widget.DataTable.formatButton;
+                    break;
+                case "checkbox":
+                    fnFormatter = YAHOO.widget.DataTable.formatCheckbox;
+                    break;
+                case "currency":
+                    fnFormatter = YAHOO.widget.DataTable.formatCurrency;
+                    break;
+                case "date":
+                    fnFormatter = YAHOO.widget.DataTable.formatDate;
+                    break;
+                case "dropdown":
+                    fnFormatter = YAHOO.widget.DataTable.formatDropdown;
+                    break;
+                case "email":
+                    fnFormatter = YAHOO.widget.DataTable.formatEmail;
+                    break;
+                case "link":
+                    fnFormatter = YAHOO.widget.DataTable.formatLink;
+                    break;
+                case "number":
+                    fnFormatter = YAHOO.widget.DataTable.formatNumber;
+                    break;
+                case "radio":
+                    fnFormatter = YAHOO.widget.DataTable.formatRadio;
+                    break;
+                case "text":
+                    fnFormatter = YAHOO.widget.DataTable.formatText;
+                    break;
+                case "textarea":
+                    fnFormatter = YAHOO.widget.DataTable.formatTextarea;
+                    break;
+                case "textbox":
+                    fnFormatter = YAHOO.widget.DataTable.formatTextbox;
+                    break;
+                case "html":
+                    // This is the default
+                    break;
+                default:
+                    fnFormatter = null;
+            }
+        }
+        else if(YAHOO.lang.isFunction(oColumn.formatter)) {
+            fnFormatter = oColumn.formatter;
+        }
+
+        // Apply special formatter
+        if(fnFormatter) {
+            fnFormatter.call(this, elCell, oRecord, oColumn, oData);
+        }
+        else {
+            elCell.innerHTML = (YAHOO.lang.isValue(oData)) ? oData.toString() : "";
+        }
+
+        // Add custom classNames
+        var aCustomClasses = null;
+        if(YAHOO.lang.isString(oColumn.className)) {
+            aCustomClasses = [oColumn.className];
+        }
+        else if(YAHOO.lang.isArray(oColumn.className)) {
+            aCustomClasses = oColumn.className;
+        }
+        if(aCustomClasses) {
+            for(var i=0; i<aCustomClasses.length; i++) {
+                YAHOO.util.Dom.addClass(elCell, aCustomClasses[i]);
+            }
+        }
+        
+        YAHOO.util.Dom.addClass(elCell, "yui-dt-col-"+sKey);
+
+        // Is editable?
+        if(oColumn.editor) {
+            YAHOO.util.Dom.addClass(elCell,YAHOO.widget.DataTable.CLASS_EDITABLE);
+        }
+        
+        this.fireEvent("cellFormatEvent", {record:oRecord, column:oColumn, key:sKey, el:elCell});
+    }
+    else {
+    }
+};
+
+
+/**
+ * Formats a BUTTON element.
+ *
+ * @method DataTable.formatButton
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object | Boolean} Data value for the cell. By default, the value
+ * is what gets written to the BUTTON.
+ * @static
+ */
+YAHOO.widget.DataTable.formatButton= function(el, oRecord, oColumn, oData) {
+    var sValue = YAHOO.lang.isValue(oData) ? oData : "Click";
+    //TODO: support YAHOO.widget.Button
+    //if(YAHOO.widget.Button) {
+    
+    //}
+    //else {
+        el.innerHTML = "<button type=\"button\" class=\""+
+                YAHOO.widget.DataTable.CLASS_BUTTON + "\">" + sValue + "</button>";
+    //}
+};
+
+/**
+ * Formats a CHECKBOX element.
+ *
+ * @method DataTable.formatCheckbox
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object | Boolean} Data value for the cell. Can be a simple
+ * Boolean to indicate whether checkbox is checked or not. Can be object literal
+ * {checked:bBoolean, label:sLabel}. Other forms of oData require a custom
+ * formatter.
+ * @static
+ */
+YAHOO.widget.DataTable.formatCheckbox = function(el, oRecord, oColumn, oData) {
+    var bChecked = oData;
+    bChecked = (bChecked) ? " checked" : "";
+    el.innerHTML = "<input type=\"checkbox\"" + bChecked +
+            " class=\"" + YAHOO.widget.DataTable.CLASS_CHECKBOX + "\">";
+};
+
+/**
+ * Formats currency. Default unit is USD.
+ *
+ * @method DataTable.formatCurrency
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Number} Data value for the cell.
+ * @static
+ */
+YAHOO.widget.DataTable.formatCurrency = function(el, oRecord, oColumn, oData) {
+    if(YAHOO.lang.isNumber(oData)) {
+        var nAmount = oData;
+        var markup;
+
+        // Round to the penny
+        nAmount = Math.round(nAmount*100)/100;
+
+        // Default currency is USD
+        markup = "$"+nAmount;
+
+        // Normalize digits
+        var dotIndex = markup.indexOf(".");
+        if(dotIndex < 0) {
+            markup += ".00";
+        }
+        else {
+            while(dotIndex > markup.length-3) {
+                markup += "0";
+            }
+        }
+        el.innerHTML = markup;
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats JavaScript Dates.
+ *
+ * @method DataTable.formatDate
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} Data value for the cell, or null.
+ * @static
+ */
+YAHOO.widget.DataTable.formatDate = function(el, oRecord, oColumn, oData) {
+    var oDate = oData;
+    if(oDate instanceof Date) {
+        el.innerHTML = (oDate.getMonth()+1) + "/" + oDate.getDate()  + "/" + oDate.getFullYear();
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats SELECT elements.
+ *
+ * @method DataTable.formatDropdown
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} Data value for the cell, or null.
+ * @static
+ */
+YAHOO.widget.DataTable.formatDropdown = function(el, oRecord, oColumn, oData) {
+    var selectedValue = (YAHOO.lang.isValue(oData)) ? oData : oRecord.getData(oColumn.key);
+    var options = (YAHOO.lang.isArray(oColumn.dropdownOptions)) ?
+            oColumn.dropdownOptions : null;
+
+    var selectEl;
+    var collection = el.getElementsByTagName("select");
+    
+    // Create the form element only once, so we can attach the onChange listener
+    if(collection.length === 0) {
+        // Create SELECT element
+        selectEl = document.createElement("select");
+        YAHOO.util.Dom.addClass(selectEl, YAHOO.widget.DataTable.CLASS_DROPDOWN);
+        selectEl = el.appendChild(selectEl);
+
+        // Add event listener
+        YAHOO.util.Event.addListener(selectEl,"change",this._onDropdownChange,this);
+    }
+
+    selectEl = collection[0];
+
+    // Update the form element
+    if(selectEl) {
+        // Clear out previous options
+        selectEl.innerHTML = "";
+        
+        // We have options to populate
+        if(options) {
+            // Create OPTION elements
+            for(var i=0; i<options.length; i++) {
+                var option = options[i];
+                var optionEl = document.createElement("option");
+                optionEl.value = (YAHOO.lang.isValue(option.value)) ?
+                        option.value : option;
+                optionEl.innerHTML = (YAHOO.lang.isValue(option.text)) ?
+                        option.text : option;
+                optionEl = selectEl.appendChild(optionEl);
+            }
+        }
+        // Selected value is our only option
+        else {
+            selectEl.innerHTML = "<option value=\"" + selectedValue + "\">" + selectedValue + "</option>";
+        }
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats emails.
+ *
+ * @method DataTable.formatEmail
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} Data value for the cell, or null.
+ * @static
+ */
+YAHOO.widget.DataTable.formatEmail = function(el, oRecord, oColumn, oData) {
+    if(YAHOO.lang.isString(oData)) {
+        el.innerHTML = "<a href=\"mailto:" + oData + "\">" + oData + "</a>";
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats links.
+ *
+ * @method DataTable.formatLink
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} Data value for the cell, or null.
+ * @static
+ */
+YAHOO.widget.DataTable.formatLink = function(el, oRecord, oColumn, oData) {
+    if(YAHOO.lang.isString(oData)) {
+        el.innerHTML = "<a href=\"" + oData + "\">" + oData + "</a>";
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats numbers.
+ *
+ * @method DataTable.formatNumber
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} Data value for the cell, or null.
+ * @static
+ */
+YAHOO.widget.DataTable.formatNumber = function(el, oRecord, oColumn, oData) {
+    if(YAHOO.lang.isNumber(oData)) {
+        el.innerHTML = oData;
+    }
+    else {
+        el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
+    }
+};
+
+/**
+ * Formats INPUT TYPE=RADIO elements.
+ *
+ * @method DataTable.formatRadio
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} (Optional) Data value for the cell.
+ * @static
+ */
+YAHOO.widget.DataTable.formatRadio = function(el, oRecord, oColumn, oData) {
+    var bChecked = oData;
+    bChecked = (bChecked) ? " checked" : "";
+    el.innerHTML = "<input type=\"radio\"" + bChecked +
+            " name=\"" + oColumn.getKey() + "-radio\"" +
+            " class=\"" + YAHOO.widget.DataTable.CLASS_RADIO+ "\">";
+};
+
+/**
+ * Formats text strings.
+ *
+ * @method DataTable.formatText
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} (Optional) Data value for the cell.
+ * @static
+ */
+YAHOO.widget.DataTable.formatText = function(el, oRecord, oColumn, oData) {
+    var value = (YAHOO.lang.isValue(oRecord.getData(oColumn.key))) ?
+            oRecord.getData(oColumn.key) : "";
+    //TODO: move to util function
+    el.innerHTML = value.toString().replace(/&/g, "&#38;").replace(/</g, "&#60;").replace(/>/g, "&#62;");
+};
+
+/**
+ * Formats TEXTAREA elements.
+ *
+ * @method DataTable.formatTextarea
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} (Optional) Data value for the cell.
+ * @static
+ */
+YAHOO.widget.DataTable.formatTextarea = function(el, oRecord, oColumn, oData) {
+    var value = (YAHOO.lang.isValue(oRecord.getData(oColumn.key))) ?
+            oRecord.getData(oColumn.key) : "";
+    var markup = "<textarea>" + value + "</textarea>";
+    el.innerHTML = markup;
+};
+
+/**
+ * Formats INPUT TYPE=TEXT elements.
+ *
+ * @method DataTable.formatTextbox
+ * @param el {HTMLElement} The element to format with markup.
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param oData {Object} (Optional) Data value for the cell.
+ * @static
+ */
+YAHOO.widget.DataTable.formatTextbox = function(el, oRecord, oColumn, oData) {
+    var value = (YAHOO.lang.isValue(oRecord.getData(oColumn.key))) ?
+            oRecord.getData(oColumn.key) : "";
+    var markup = "<input type=\"text\" value=\"" + value + "\">";
+    el.innerHTML = markup;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// PAGINATION
+
+/**
+ * Updates Paginator values in response to RecordSet changes and/or DOM events.
+ * Pass in all, a subset, or no values.
+ *
+ * @method updatePaginator
+ * @param oNewValues {Object} (Optional) Object literal of Paginator values, or
+ * a subset of Paginator values.
+ * @param {Object} Object literal of all Paginator values.
+ */
+
+YAHOO.widget.DataTable.prototype.updatePaginator = function(oNewValues) {
+    // Complete the set
+    var oValidPaginator = this.get("paginator");
+    var nOrigCurrentPage = oValidPaginator.currentPage;
+    for(var param in oNewValues) {
+        if(YAHOO.lang.hasOwnProperty(oValidPaginator, param)) {
+            oValidPaginator[param] = oNewValues[param];
+        }
+    }
+    
+    oValidPaginator.totalRecords = this._oRecordSet.getLength();
+    oValidPaginator.rowsThisPage = Math.min(oValidPaginator.rowsPerPage, oValidPaginator.totalRecords);
+    oValidPaginator.totalPages = Math.ceil(oValidPaginator.totalRecords / oValidPaginator.rowsThisPage);
+    if(isNaN(oValidPaginator.totalPages)) {
+        oValidPaginator.totalPages = 0;
+    }
+    if(oValidPaginator.currentPage > oValidPaginator.totalPages) {
+        if(oValidPaginator.totalPages < 1) {
+            oValidPaginator.currentPage = 1;
+        }
+        else {
+            oValidPaginator.currentPage = oValidPaginator.totalPages;
+        }
+    }
+
+    if(oValidPaginator.currentPage !== nOrigCurrentPage) {
+        oValidPaginator.startRecordIndex = (oValidPaginator.currentPage-1)*oValidPaginator.rowsPerPage;
+    }
+
+
+    this.set("paginator", oValidPaginator);
+    return this.get("paginator");
+};
+
+/**
+ * Displays given page of a paginated DataTable.
+ *
+ * @method showPage
+ * @param nPage {Number} Which page.
+ */
+YAHOO.widget.DataTable.prototype.showPage = function(nPage) {
+    // Validate input
+    if(!YAHOO.lang.isNumber(nPage) || (nPage < 1) || (nPage > this.get("paginator").totalPages)) {
+        nPage = 1;
+    }
+    this.updatePaginator({currentPage:nPage});
+    this.refreshView();
+};
+
+/**
+ * Updates Paginator containers with markup. Override this method to customize pagination UI.
+ *
+ * @method formatPaginators
+ */
+ YAHOO.widget.DataTable.prototype.formatPaginators = function() {
+    var pag = this.get("paginator");
+    var i;
+
+    // For Opera workaround
+    var dropdownEnabled = false;
+
+    // Links are enabled
+    if(pag.pageLinks > -1) {
+        for(i=0; i<pag.links.length; i++) {
+            this.formatPaginatorLinks(pag.links[i], pag.currentPage, pag.pageLinksStart, pag.pageLinks, pag.totalPages);
+        }
+    }
+
+    // Dropdown is enabled
+    for(i=0; i<pag.dropdowns.length; i++) {
+         if(pag.dropdownOptions) {
+            dropdownEnabled = true;
+            this.formatPaginatorDropdown(pag.dropdowns[i], pag.dropdownOptions);
+        }
+        else {
+            pag.dropdowns[i].style.display = "none";
+        }
+    }
+
+    // For Opera artifacting in dropdowns
+    if(dropdownEnabled && navigator.userAgent.toLowerCase().indexOf("opera") != -1) {
+        document.body.style += '';
+    }
+};
+
+/**
+ * Updates Paginator dropdown. If dropdown doesn't exist, the markup is created.
+ * Sets dropdown elements's "selected" value.
+ *
+ * @method formatPaginatorDropdown
+ * @param elDropdown {HTMLElement} The SELECT element.
+ * @param dropdownOptions {Object[]} OPTION values for display in the SELECT element.
+ */
+YAHOO.widget.DataTable.prototype.formatPaginatorDropdown = function(elDropdown, dropdownOptions) {
+    if(elDropdown && (elDropdown.ownerDocument == document)) {
+        // Clear OPTION elements
+        while (elDropdown.firstChild) {
+            elDropdown.removeChild(elDropdown.firstChild);
+        }
+
+        // Create OPTION elements
+        for(var j=0; j<dropdownOptions.length; j++) {
+            var dropdownOption = dropdownOptions[j];
+            var optionEl = document.createElement("option");
+            optionEl.value = (YAHOO.lang.isValue(dropdownOption.value)) ?
+                    dropdownOption.value : dropdownOption;
+            optionEl.innerHTML = (YAHOO.lang.isValue(dropdownOption.text)) ?
+                    dropdownOption.text : dropdownOption;
+            optionEl = elDropdown.appendChild(optionEl);
+        }
+
+        var options = elDropdown.options;
+        // Update dropdown's "selected" value
+        if(options.length) {
+            for(var i=options.length-1; i>-1; i--) {
+                if((this.get("paginator").rowsPerPage + "") === options[i].value) {
+                    options[i].selected = true;
+                }
+            }
+        }
+
+        // Show the dropdown
+        elDropdown.style.display = "";
+        return;
+    }
+};
+
+/**
+ * Updates Paginator links container with markup.
+ *
+ * @method formatPaginatorLinks
+ * @param elContainer {HTMLElement} The link container element.
+ * @param nCurrentPage {Number} Current page.
+ * @param nPageLinksStart {Number} First page link to display.
+ * @param nPageLinksLength {Number} How many page links to display.
+ * @param nTotalPages {Number} Total number of pages.
+ */
+YAHOO.widget.DataTable.prototype.formatPaginatorLinks = function(elContainer, nCurrentPage, nPageLinksStart, nPageLinksLength, nTotalPages) {
+    if(elContainer && (elContainer.ownerDocument == document) &&
+            YAHOO.lang.isNumber(nCurrentPage) && YAHOO.lang.isNumber(nPageLinksStart) &&
+            YAHOO.lang.isNumber(nTotalPages)) {
+        // Set up markup for first/last/previous/next
+        var bIsFirstPage = (nCurrentPage == 1) ? true : false;
+        var bIsLastPage = (nCurrentPage == nTotalPages) ? true : false;
+        var sFirstLinkMarkup = (bIsFirstPage) ?
+                " <span class=\"" + YAHOO.widget.DataTable.CLASS_DISABLED +
+                " " + YAHOO.widget.DataTable.CLASS_FIRST + "\">&lt;&lt;</span> " :
+                " <a href=\"#\" class=\"" + YAHOO.widget.DataTable.CLASS_FIRST + "\">&lt;&lt;</a> ";
+        var sPrevLinkMarkup = (bIsFirstPage) ?
+                " <span class=\"" + YAHOO.widget.DataTable.CLASS_DISABLED +
+                " " + YAHOO.widget.DataTable.CLASS_PREVIOUS + "\">&lt;</span> " :
+                " <a href=\"#\" class=\"" + YAHOO.widget.DataTable.CLASS_PREVIOUS + "\">&lt;</a> " ;
+        var sNextLinkMarkup = (bIsLastPage) ?
+                " <span class=\"" + YAHOO.widget.DataTable.CLASS_DISABLED +
+                " " + YAHOO.widget.DataTable.CLASS_NEXT + "\">&gt;</span> " :
+                " <a href=\"#\" class=\"" + YAHOO.widget.DataTable.CLASS_NEXT + "\">&gt;</a> " ;
+        var sLastLinkMarkup = (bIsLastPage) ?
+                " <span class=\"" + YAHOO.widget.DataTable.CLASS_DISABLED +
+                " " + YAHOO.widget.DataTable.CLASS_LAST +  "\">&gt;&gt;</span> " :
+                " <a href=\"#\" class=\"" + YAHOO.widget.DataTable.CLASS_LAST + "\">&gt;&gt;</a> ";
+
+        // Start with first and previous
+        var sMarkup = sFirstLinkMarkup + sPrevLinkMarkup;
+        
+        // Ok to show all links
+        var nMaxLinks = nTotalPages;
+        var nFirstLink = 1;
+        var nLastLink = nTotalPages;
+
+        if(nPageLinksLength > 0) {
+        // Calculate how many links to show
+            nMaxLinks = (nPageLinksStart+nPageLinksLength < nTotalPages) ?
+                    nPageLinksStart+nPageLinksLength-1 : nTotalPages;
+
+            // Try to keep the current page in the middle
+            nFirstLink = (nCurrentPage - Math.floor(nMaxLinks/2) > 0) ? nCurrentPage - Math.floor(nMaxLinks/2) : 1;
+            nLastLink = (nCurrentPage + Math.floor(nMaxLinks/2) <= nTotalPages) ? nCurrentPage + Math.floor(nMaxLinks/2) : nTotalPages;
+
+            // Keep the last link in range
+            if(nFirstLink === 1) {
+                nLastLink = nMaxLinks;
+            }
+            // Keep the first link in range
+            else if(nLastLink === nTotalPages) {
+                nFirstLink = nTotalPages - nMaxLinks + 1;
+            }
+
+            // An even number of links can get funky
+            if(nLastLink - nFirstLink === nMaxLinks) {
+                nLastLink--;
+            }
+      }
+        
+        // Generate markup for each page
+        for(var i=nFirstLink; i<=nLastLink; i++) {
+            if(i != nCurrentPage) {
+                sMarkup += " <a href=\"#\" class=\"" + YAHOO.widget.DataTable.CLASS_PAGE + "\">" + i + "</a> ";
+            }
+            else {
+                sMarkup += " <span class=\"" + YAHOO.widget.DataTable.CLASS_SELECTED + "\">" + i + "</span>";
+            }
+        }
+        sMarkup += sNextLinkMarkup + sLastLinkMarkup;
+        elContainer.innerHTML = sMarkup;
+        return;
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// SELECTION/HIGHLIGHTING
+
+/**
+ * ID string of last highlighted cell element
+ *
+ * @property _sLastHighlightedTdElId
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sLastHighlightedTdElId = null;
+
+/**
+ * ID string of last highlighted row element
+ *
+ * @property _sLastHighlightedTrElId
+ * @type String
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._sLastHighlightedTrElId = null;
+
+/**
+ * Array to track row selections (by sRecordId) and/or cell selections
+ * (by {recordId:sRecordId, columnId:sColumnId})
+ *
+ * @property _aSelections
+ * @type Object[]
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._aSelections = null;
+
+/**
+ * Record instance of the row selection anchor.
+ *
+ * @property _oAnchorRecord
+ * @type YAHOO.widget.Record
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._oAnchorRecord = null;
+
+/**
+ * Object literal representing cell selection anchor:
+ * {recordId:sRecordId, columnId:sColumnId}.
+ *
+ * @property _oAnchorCell
+ * @type Object
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._oAnchorCell = null;
+
+/**
+ * Convenience method to remove the class YAHOO.widget.DataTable.CLASS_SELECTED
+ * from all TR elements on the page.
+ *
+ * @method _unselectAllTrEls
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._unselectAllTrEls = function() {
+    var selectedRows = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"tr",this._elTbody);
+    YAHOO.util.Dom.removeClass(selectedRows, YAHOO.widget.DataTable.CLASS_SELECTED);
+};
+
+/**
+ * Returns array of selected TR elements on the page.
+ *
+ * @method getSelectedTrEls
+ * @return {HTMLElement[]} Array of selected TR elements.
+ */
+YAHOO.widget.DataTable.prototype.getSelectedTrEls = function() {
+    return YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"tr",this._elTbody);
+};
+
+/**
+ * Sets given row to the selected state.
+ *
+ * @method selectRow
+ * @param row {HTMLElement | String | YAHOO.widget.Record | Number} HTML element
+ * reference or ID string, Record instance, or RecordSet position index.
+ */
+YAHOO.widget.DataTable.prototype.selectRow = function(row) {
+    var oRecord, elRow;
+    
+    if(row instanceof YAHOO.widget.Record) {
+        oRecord = this._oRecordSet.getRecord(row);
+        elRow = this.getTrEl(oRecord);
+    }
+    else if(YAHOO.lang.isNumber(row)) {
+        oRecord = this.getRecord(row);
+        elRow = this.getTrEl(oRecord);
+    }
+    else {
+        elRow = this.getTrEl(row);
+        oRecord = this.getRecord(elRow);
+    }
+    
+    if(oRecord) {
+        // Update selection trackers
+        var tracker = this._aSelections || [];
+        var sRecordId = oRecord.getId();
+
+        // Remove if already there:
+        // Use Array.indexOf if available...
+        if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
+            tracker.splice(tracker.indexOf(sRecordId),1);
+        }
+        // ...or do it the old-fashioned way
+        else {
+            for(var j=tracker.length-1; j>-1; j--) {
+               if(tracker[j] === sRecordId){
+                    tracker.splice(j,1);
+                    break;
+                }
+            }
+        }
+        // Add to the end
+        tracker.push(sRecordId);
+        this._aSelections = tracker;
+
+        // Update trackers
+        if(!this._oAnchorRecord) {
+            this._oAnchorRecord = oRecord;
+        }
+
+        // Update UI
+        if(elRow) {
+            YAHOO.util.Dom.addClass(elRow, YAHOO.widget.DataTable.CLASS_SELECTED);
+        }
+
+        this.fireEvent("rowSelectEvent", {record:oRecord, el:elRow});
+    }
+};
+// Backward compatibility
+YAHOO.widget.DataTable.prototype.select = function(els) {
+    if(!YAHOO.lang.isArray(els)) {
+        els = [els];
+    }
+    for(var i=0; i<els.length; i++) {
+        this.selectRow(els[i]);
+    }
+};
+
+/**
+ * Sets given row to the selected state.
+ *
+ * @method selectRow
+ * @param row {HTMLElement | String | YAHOO.widget.Record | Number} HTML element
+ * reference or ID string, Record instance, or RecordSet position index.
+ */
+YAHOO.widget.DataTable.prototype.unselectRow = function(row) {
+    var elRow = this.getTrEl(row);
+
+    var oRecord;
+    if(row instanceof YAHOO.widget.Record) {
+        oRecord = this._oRecordSet.getRecord(row);
+    }
+    else if(YAHOO.lang.isNumber(row)) {
+        oRecord = this.getRecord(row);
+    }
+    else {
+        oRecord = this.getRecord(elRow);
+    }
+
+    if(oRecord) {
+        // Update selection trackers
+        var tracker = this._aSelections || [];
+        var sRecordId = oRecord.getId();
+
+        // Remove if found
+        var bFound = false;
+        
+        // Use Array.indexOf if available...
+        if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
+            tracker.splice(tracker.indexOf(sRecordId),1);
+        }
+        // ...or do it the old-fashioned way
+        else {
+            for(var j=tracker.length-1; j>-1; j--) {
+               if(tracker[j] === sRecordId){
+                    tracker.splice(j,1);
+                    break;
+                }
+            }
+        }
+        
+        if(bFound) {
+            // Update tracker
+            this._aSelections = tracker;
+
+            // Update the UI
+            YAHOO.util.Dom.removeClass(elRow, YAHOO.widget.DataTable.CLASS_SELECTED);
+
+            this.fireEvent("rowUnselectEvent", {record:oRecord, el:elRow});
+
+            return;
+        }
+
+        // Update the UI
+        YAHOO.util.Dom.removeClass(elRow, YAHOO.widget.DataTable.CLASS_SELECTED);
+
+        this.fireEvent("rowUnselectEvent", {record:oRecord, el:elRow});
+    }
+};
+
+/**
+ * Clears out all row selections.
+ *
+ * @method unselectAllRows
+ */
+YAHOO.widget.DataTable.prototype.unselectAllRows = function() {
+    // Remove all rows from tracker
+    var tracker = this._aSelections || [];
+    for(var j=tracker.length-1; j>-1; j--) {
+       if(YAHOO.lang.isString(tracker[j])){
+            tracker.splice(j,1);
+        }
+    }
+
+    // Update tracker
+    this._aSelections = tracker;
+
+    // Update UI
+    this._unselectAllTrEls();
+
+    //TODO: send an array of [{el:el,record:record}]
+    //TODO: or convert this to an unselectRows method
+    //TODO: that takes an array of rows or unselects all if none given
+    this.fireEvent("unselectAllRowsEvent");
+};
+
+/**
+ * Convenience method to remove the class YAHOO.widget.DataTable.CLASS_SELECTED
+ * from all TD elements in the internal tracker.
+ *
+ * @method _unselectAllTdEls
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._unselectAllTdEls = function() {
+    var selectedCells = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"td",this._elTbody);
+    YAHOO.util.Dom.removeClass(selectedCells, YAHOO.widget.DataTable.CLASS_SELECTED);
+};
+
+/**
+ * Returns array of selected TD elements on the page.
+ *
+ * @method getSelectedTdEls
+ * @return {HTMLElement[]} Array of selected TD elements.
+ */
+YAHOO.widget.DataTable.prototype.getSelectedTdEls = function() {
+    return YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"td",this._elTbody);
+};
+
+/**
+ * Sets given cell to the selected state.
+ *
+ * @method selectCell
+ * @param cell {HTMLElement | String} DOM element reference or ID string
+ * to DataTable page element or RecordSet index.
+ */
+YAHOO.widget.DataTable.prototype.selectCell = function(cell) {
+/*TODO:
+accept {record}
+*/
+    var elCell = this.getTdEl(cell);
+    
+    if(elCell) {
+        var oRecord = this.getRecord(elCell);
+        var sColumnId = elCell.yuiColumnId;
+
+        if(oRecord && sColumnId) {
+            // Get Record ID
+            var tracker = this._aSelections || [];
+            var sRecordId = oRecord.getId();
+
+            // Remove if there
+            for(var j=tracker.length-1; j>-1; j--) {
+               if((tracker[j].recordId === sRecordId) && (tracker[j].columnId === sColumnId)){
+                    tracker.splice(j,1);
+                    break;
+                }
+            }
+
+            // Add to the end
+            tracker.push({recordId:sRecordId, columnId:sColumnId});
+
+            // Update trackers
+            this._aSelections = tracker;
+            if(!this._oAnchorCell) {
+                this._oAnchorCell = {record:oRecord, column:this.getColumnById(sColumnId)};
+            }
+
+            // Update the UI
+            YAHOO.util.Dom.addClass(elCell, YAHOO.widget.DataTable.CLASS_SELECTED);
+
+            this.fireEvent("cellSelectEvent", {record:oRecord, column:this.getColumnById(sColumnId), key: elCell.yuiColumnKey, el:elCell});
+            return;
+        }
+    }
+};
+
+/**
+ * Sets given cell to the unselected state.
+ *
+ * @method unselectCell
+ * @param cell {HTMLElement | String} DOM element reference or ID string
+ * to DataTable page element or RecordSet index.
+ */
+YAHOO.widget.DataTable.prototype.unselectCell = function(cell) {
+    var elCell = this.getTdEl(cell);
+
+    if(elCell) {
+        var oRecord = this.getRecord(elCell);
+        var sColumnId = elCell.yuiColumnId;
+
+        if(oRecord && sColumnId) {
+            // Get Record ID
+            var tracker = this._aSelections || [];
+            var id = oRecord.getId();
+
+            // Is it selected?
+            for(var j=tracker.length-1; j>-1; j--) {
+                if((tracker[j].recordId === id) && (tracker[j].columnId === sColumnId)){
+                    // Remove from tracker
+                    tracker.splice(j,1);
+                    
+                    // Update tracker
+                    this._aSelections = tracker;
+
+                    // Update the UI
+                    YAHOO.util.Dom.removeClass(elCell, YAHOO.widget.DataTable.CLASS_SELECTED);
+
+                    this.fireEvent("cellUnselectEvent", {record:oRecord, column: this.getColumnById(sColumnId), key:elCell.yuiColumnKey, el:elCell});
+                    return;
+                }
+            }
+        }
+    }
+};
+
+/**
+ * Clears out all cell selections.
+ *
+ * @method unselectAllCells
+ */
+YAHOO.widget.DataTable.prototype.unselectAllCells= function() {
+    // Remove all cells from tracker
+    var tracker = this._aSelections || [];
+    for(var j=tracker.length-1; j>-1; j--) {
+       if(tracker[j].constructor == Object){
+            tracker.splice(j,1);
+        }
+    }
+
+    // Update tracker
+    this._aSelections = tracker;
+
+    // Update UI
+    this._unselectAllTdEls();
+    
+    //TODO: send data
+    //TODO: or fire individual cellUnselectEvent
+    this.fireEvent("unselectAllCellsEvent");
+};
+
+/**
+ * Returns true if given item is selected, false otherwise.
+ *
+ * @method isSelected
+ * @param o {String | HTMLElement | YAHOO.widget.Record | Number
+ * {record:YAHOO.widget.Record, column:YAHOO.widget.Column} } TR or TD element by
+ * reference or ID string, a Record instance, a RecordSet position index,
+ * or an object literal representation
+ * of a cell.
+ * @return {Boolean} True if item is selected.
+ */
+YAHOO.widget.DataTable.prototype.isSelected = function(o) {
+    var oRecord, sRecordId, j;
+
+    var el = this.getTrEl(o) || this.getTdEl(o);
+    if(el) {
+        return YAHOO.util.Dom.hasClass(el,YAHOO.widget.DataTable.CLASS_SELECTED);
+    }
+    else {
+        var tracker = this._aSelections;
+        if(tracker && tracker.length > 1) {
+            // Looking for a Record?
+            if(o instanceof YAHOO.widget.Record) {
+                oRecord = o;
+            }
+            else if(YAHOO.lang.isNumber(o)) {
+                oRecord = this.getRecord(o);
+            }
+            if(oRecord) {
+                sRecordId = oRecord.getId();
+
+                // Is it there?
+                // Use Array.indexOf if available...
+                if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
+                    return true;
+                }
+                // ...or do it the old-fashioned way
+                else {
+                    for(j=tracker.length-1; j>-1; j--) {
+                       if(tracker[j] === sRecordId){
+                        return true;
+                       }
+                    }
+                }
+            }
+            // Looking for a cell
+            else if(o.record && o.column){
+                sRecordId = o.record.getId();
+                var sColumnId = o.column.getId();
+
+                for(j=tracker.length-1; j>-1; j--) {
+                    if((tracker[j].recordId === sRecordId) && (tracker[j].columnId === sColumnId)){
+                        return true;
+                    }
+                }
+            }
+        }
+    }
+    return false;
+};
+
+/**
+ * Returns selected rows as an array of Record IDs.
+ *
+ * @method getSelectedRows
+ * @return {String[]} Array of selected rows by Record ID.
+ */
+YAHOO.widget.DataTable.prototype.getSelectedRows = function() {
+    var aSelectedRows = [];
+    var tracker = this._aSelections || [];
+    for(var j=0; j<tracker.length; j++) {
+       if(YAHOO.lang.isString(tracker[j])){
+            aSelectedRows.push(tracker[j]);
+        }
+    }
+    return aSelectedRows;
+};
+
+/**
+ * Returns selected cells as an array of object literals:
+ *     {recordId:sRecordId, columnId:sColumnId}.
+ *
+ * @method getSelectedCells
+ * @return {Object[]} Array of selected cells by Record ID and Column ID.
+ */
+YAHOO.widget.DataTable.prototype.getSelectedCells = function() {
+    var aSelectedCells = [];
+    var tracker = this._aSelections || [];
+    for(var j=0; j<tracker.length; j++) {
+       if(tracker[j] && (tracker[j].constructor == Object)){
+            aSelectedCells.push(tracker[j]);
+        }
+    }
+    return aSelectedCells;
+};
+
+/**
+ * Returns last selected Record ID.
+ *
+ * @method getLastSelectedRecord
+ * @return {String} Record ID of last selected row.
+ */
+YAHOO.widget.DataTable.prototype.getLastSelectedRecord = function() {
+    var tracker = this._aSelections;
+    if(tracker.length > 0) {
+        for(var i=tracker.length-1; i>-1; i--) {
+           if(YAHOO.lang.isString(tracker[i])){
+                return tracker[i];
+            }
+        }
+    }
+};
+
+/**
+ * Returns last selected cell as an object literal:
+ *     {recordId:sRecordId, columnId:sColumnId}.
+ *
+ * @method getLastSelectedCell
+ * @return {Object} Object literal representation of a cell.
+ */
+YAHOO.widget.DataTable.prototype.getLastSelectedCell = function() {
+    var tracker = this._aSelections;
+    if(tracker.length > 0) {
+        for(var i=tracker.length-1; i>-1; i--) {
+           if(tracker[i].recordId && tracker[i].columnId){
+                return tracker[i];
+            }
+        }
+    }
+};
+
+/**
+ * Assigns the class YAHOO.widget.DataTable.CLASS_HIGHLIGHTED to the given row.
+ *
+ * @method highlightRow
+ * @param row {HTMLElement | String} DOM element reference or ID string.
+ */
+YAHOO.widget.DataTable.prototype.highlightRow = function(row) {
+    var elRow = this.getTrEl(row);
+
+    if(elRow) {
+        // Make sure previous row is unhighlighted
+        if(this._sLastHighlightedTrElId) {
+            YAHOO.util.Dom.removeClass(this._sLastHighlightedTrElId,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        }
+        var oRecord = this.getRecord(elRow);
+        YAHOO.util.Dom.addClass(elRow,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        this._sLastHighlightedTrElId = elRow.id;
+        this.fireEvent("rowHighlightEvent", {record:oRecord, el:elRow});
+        return;
+    }
+};
+
+/**
+ * Removes the class YAHOO.widget.DataTable.CLASS_HIGHLIGHTED from the given row.
+ *
+ * @method unhighlightRow
+ * @param row {HTMLElement | String} DOM element reference or ID string.
+ */
+YAHOO.widget.DataTable.prototype.unhighlightRow = function(row) {
+    var elRow = this.getTrEl(row);
+
+    if(elRow) {
+        var oRecord = this.getRecord(elRow);
+        YAHOO.util.Dom.removeClass(elRow,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        this.fireEvent("rowUnhighlightEvent", {record:oRecord, el:elRow});
+        return;
+    }
+};
+
+/**
+ * Assigns the class YAHOO.widget.DataTable.CLASS_HIGHLIGHTED to the given cell.
+ *
+ * @method highlightCell
+ * @param cell {HTMLElement | String} DOM element reference or ID string.
+ */
+YAHOO.widget.DataTable.prototype.highlightCell = function(cell) {
+    var elCell = this.getTdEl(cell);
+
+    if(elCell) {
+        // Make sure previous cell is unhighlighted
+        if(this._sLastHighlightedTdElId) {
+            YAHOO.util.Dom.removeClass(this._sLastHighlightedTdElId,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        }
+        
+        var oRecord = this.getRecord(elCell);
+        var sColumnId = elCell.yuiColumnId;
+        YAHOO.util.Dom.addClass(elCell,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        this._sLastHighlightedTdElId = elCell.id;
+        this.fireEvent("cellHighlightEvent", {record:oRecord, column:this.getColumnById(sColumnId), key:elCell.yuiColumnKey, el:elCell});
+        return;
+    }
+};
+
+/**
+ * Removes the class YAHOO.widget.DataTable.CLASS_HIGHLIGHTED from the given cell.
+ *
+ * @method unhighlightCell
+ * @param cell {HTMLElement | String} DOM element reference or ID string.
+ */
+YAHOO.widget.DataTable.prototype.unhighlightCell = function(cell) {
+    var elCell = this.getTdEl(cell);
+
+    if(elCell) {
+        var oRecord = this.getRecord(elCell);
+        YAHOO.util.Dom.removeClass(elCell,YAHOO.widget.DataTable.CLASS_HIGHLIGHTED);
+        this.fireEvent("cellUnhighlightEvent", {record:oRecord, column:this.getColumnById(elCell.yuiColumnId), key:elCell.yuiColumnKey, el:elCell});
+        return;
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// INLINE EDITING
+
+/*TODO: for TAB handling
+ * Shows Cell Editor for next cell.
+ *
+ * @method editNextCell
+ * @param elCell {HTMLElement} Cell element from which to edit next cell.
+ */
+//YAHOO.widget.DataTable.prototype.editNextCell = function(elCell) {
+//};
+
+/**
+ * Shows Cell Editor for given cell.
+ *
+ * @method showCellEditor
+ * @param elCell {HTMLElement | String} Cell element to edit.
+ * @param oRecord {YAHOO.widget.Record} (Optional) Record instance.
+ * @param oColumn {YAHOO.widget.Column} (Optional) Column instance.
+ */
+YAHOO.widget.DataTable.prototype.showCellEditor = function(elCell, oRecord, oColumn) {
+    elCell = YAHOO.util.Dom.get(elCell);
+    
+    if(elCell && (elCell.ownerDocument === document)) {
+        if(!oRecord || !(oRecord instanceof YAHOO.widget.Record)) {
+            oRecord = this.getRecord(elCell);
+        }
+        if(!oColumn || !(oColumn instanceof YAHOO.widget.Column)) {
+            oColumn = this.getColumn(elCell);
+        }
+        if(oRecord && oColumn) {
+            var oCellEditor = this._oCellEditor;
+            
+            // Clear previous Editor
+            if(oCellEditor.isActive) {
+                this.cancelCellEditor();
+            }
+
+            // Editor not defined
+            if(!oColumn.editor) {
+                return;
+            }
+            
+            // Update Editor values
+            oCellEditor.cell = elCell;
+            oCellEditor.record = oRecord;
+            oCellEditor.column = oColumn;
+            oCellEditor.validator = (oColumn.editorOptions &&
+                    YAHOO.lang.isFunction(oColumn.editorOptions.validator)) ?
+                    oColumn.editorOptions.validator : null;
+            oCellEditor.value = oRecord.getData(oColumn.key);
+
+            // Move Editor
+            var elContainer = oCellEditor.container;
+            var x = YAHOO.util.Dom.getX(elCell);
+            var y = YAHOO.util.Dom.getY(elCell);
+
+            // SF doesn't get xy for cells in scrolling table
+            // when tbody display is set to block
+            if(isNaN(x) || isNaN(y)) {
+                x = elCell.offsetLeft + // cell pos relative to table
+                        YAHOO.util.Dom.getX(this._elTable) - // plus table pos relative to document
+                        this._elTbody.scrollLeft; // minus tbody scroll
+                y = elCell.offsetTop + // cell pos relative to table
+                        YAHOO.util.Dom.getY(this._elTable) - // plus table pos relative to document
+                        this._elTbody.scrollTop + // minus tbody scroll
+                        this._elThead.offsetHeight; // account for fixed headers
+            }
+            
+            elContainer.style.left = x + "px";
+            elContainer.style.top = y + "px";
+
+            // Show Editor
+            elContainer.style.display = "";
+            
+            // Render Editor markup
+            var fnEditor;
+            if(YAHOO.lang.isString(oColumn.editor)) {
+                switch(oColumn.editor) {
+                    case "checkbox":
+                        fnEditor = YAHOO.widget.DataTable.editCheckbox;
+                        break;
+                    case "date":
+                        fnEditor = YAHOO.widget.DataTable.editDate;
+                        break;
+                    case "dropdown":
+                        fnEditor = YAHOO.widget.DataTable.editDropdown;
+                        break;
+                    case "radio":
+                        fnEditor = YAHOO.widget.DataTable.editRadio;
+                        break;
+                    case "textarea":
+                        fnEditor = YAHOO.widget.DataTable.editTextarea;
+                        break;
+                    case "textbox":
+                        fnEditor = YAHOO.widget.DataTable.editTextbox;
+                        break;
+                    default:
+                        fnEditor = null;
+                }
+            }
+            else if(YAHOO.lang.isFunction(oColumn.editor)) {
+                fnEditor = oColumn.editor;
+            }
+
+            if(fnEditor) {
+                // Create DOM input elements
+                fnEditor(this._oCellEditor, this);
+                
+                // Show Save/Cancel buttons
+                if(!oColumn.editorOptions || !oColumn.editorOptions.disableBtns) {
+                    this.showCellEditorBtns(elContainer);
+                }
+
+                // Hook to customize the UI
+                this.doBeforeShowCellEditor(this._oCellEditor);
+
+                oCellEditor.isActive = true;
+                
+                //TODO: verify which args to pass
+                this.fireEvent("editorShowEvent", {editor:oCellEditor});
+                return;
+            }
+        }
+    }
+};
+
+/**
+ * Overridable abstract method to customize Cell Editor UI.
+ *
+ * @method doBeforeShowCellEditor
+ * @param oCellEditor {Object} Cell Editor object literal.
+ */
+YAHOO.widget.DataTable.prototype.doBeforeShowCellEditor = function(oCellEditor) {
+};
+
+/**
+ * Adds Save/Cancel buttons to Cell Editor.
+ *
+ * @method showCellEditorBtns
+ * @param elContainer {HTMLElement} Cell Editor container.
+ */
+YAHOO.widget.DataTable.prototype.showCellEditorBtns = function(elContainer) {
+    // Buttons
+    var elBtnsDiv = elContainer.appendChild(document.createElement("div"));
+    YAHOO.util.Dom.addClass(elBtnsDiv, YAHOO.widget.DataTable.CLASS_BUTTON);
+
+    // Save button
+    var elSaveBtn = elBtnsDiv.appendChild(document.createElement("button"));
+    YAHOO.util.Dom.addClass(elSaveBtn, YAHOO.widget.DataTable.CLASS_DEFAULT);
+    elSaveBtn.innerHTML = "OK";
+    YAHOO.util.Event.addListener(elSaveBtn, "click", this.saveCellEditor, this, true);
+
+    // Cancel button
+    var elCancelBtn = elBtnsDiv.appendChild(document.createElement("button"));
+    elCancelBtn.innerHTML = "Cancel";
+    YAHOO.util.Event.addListener(elCancelBtn, "click", this.cancelCellEditor, this, true);
+};
+
+/**
+ * Clears Cell Editor of all state and UI.
+ *
+ * @method resetCellEditor
+ */
+
+YAHOO.widget.DataTable.prototype.resetCellEditor = function() {
+    var elContainer = this._oCellEditor.container;
+    elContainer.style.display = "none";
+    YAHOO.util.Event.purgeElement(elContainer, true);
+    elContainer.innerHTML = "";
+    this._oCellEditor.value = null;
+    this._oCellEditor.isActive = false;
+};
+
+/**
+ * Saves Cell Editor input to Record.
+ *
+ * @method saveCellEditor
+ */
+YAHOO.widget.DataTable.prototype.saveCellEditor = function() {
+    //TODO: Copy the editor's values to pass to the event
+    if(this._oCellEditor.isActive) {
+        var newData = this._oCellEditor.value;
+        var oldData = this._oCellEditor.record.getData(this._oCellEditor.column.key);
+
+        // Validate input data
+        if(this._oCellEditor.validator) {
+            this._oCellEditor.value = this._oCellEditor.validator.call(this, newData, oldData, this._oCellEditor);
+            if(this._oCellEditor.value === null ) {
+                this.resetCellEditor();
+                this.fireEvent("editorRevertEvent",
+                        {editor:this._oCellEditor, oldData:oldData, newData:newData});
+                return;
+            }
+        }
+
+        // Update the Record
+        this._oRecordSet.updateKey(this._oCellEditor.record, this._oCellEditor.column.key, this._oCellEditor.value);
+
+        // Update the UI
+        this.formatCell(this._oCellEditor.cell);
+
+        // Clear out the Cell Editor
+        this.resetCellEditor();
+
+        this.fireEvent("editorSaveEvent",
+                {editor:this._oCellEditor, oldData:oldData, newData:newData});
+    }
+    else {
+    }
+};
+
+/**
+ * Cancels Cell Editor.
+ *
+ * @method cancelCellEditor
+ */
+YAHOO.widget.DataTable.prototype.cancelCellEditor = function() {
+    if(this._oCellEditor.isActive) {
+        this.resetCellEditor();
+        //TODO: preserve values for the event?
+        this.fireEvent("editorCancelEvent", {editor:this._oCellEditor});
+    }
+    else {
+    }
+};
+
+/**
+ * Enables CHECKBOX Editor.
+ *
+ * @method editCheckbox
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+//YAHOO.widget.DataTable.editCheckbox = function(elContainer, oRecord, oColumn, oEditor, oSelf) {
+YAHOO.widget.DataTable.editCheckbox = function(oEditor, oSelf) {
+    var elCell = oEditor.cell;
+    var oRecord = oEditor.record;
+    var oColumn = oEditor.column;
+    var elContainer = oEditor.container;
+    var aCheckedValues = oRecord.getData(oColumn.key);
+    if(!YAHOO.lang.isArray(aCheckedValues)) {
+        aCheckedValues = [aCheckedValues];
+    }
+
+    // Checkboxes
+    if(oColumn.editorOptions && YAHOO.lang.isArray(oColumn.editorOptions.checkboxOptions)) {
+        var checkboxOptions = oColumn.editorOptions.checkboxOptions;
+        var checkboxValue, checkboxId, elLabel, j, k;
+        // First create the checkbox buttons in an IE-friendly way
+        for(j=0; j<checkboxOptions.length; j++) {
+            checkboxValue = YAHOO.lang.isValue(checkboxOptions[j].label) ?
+                    checkboxOptions[j].label : checkboxOptions[j];
+            checkboxId =  oSelf.id + "-editor-checkbox" + j;
+            elContainer.innerHTML += "<input type=\"checkbox\"" +
+                    " name=\"" + oSelf.id + "-editor-checkbox\"" +
+                    " value=\"" + checkboxValue + "\"" +
+                    " id=\"" +  checkboxId + "\">";
+            // Then create the labels in an IE-friendly way
+            elLabel = elContainer.appendChild(document.createElement("label"));
+            elLabel.htmlFor = checkboxId;
+            elLabel.innerHTML = checkboxValue;
+        }
+        var aCheckboxEls = [];
+        var checkboxEl;
+        // Loop through checkboxes to check them
+        for(j=0; j<checkboxOptions.length; j++) {
+            checkboxEl = YAHOO.util.Dom.get(oSelf.id + "-editor-checkbox" + j);
+            aCheckboxEls.push(checkboxEl);
+            for(k=0; k<aCheckedValues.length; k++) {
+                if(checkboxEl.value === aCheckedValues[k]) {
+                    checkboxEl.checked = true;
+                }
+            }
+            // Focus the first checkbox
+            if(j===0) {
+                oSelf._focusEl(checkboxEl);
+            }
+        }
+        // Loop through checkboxes to assign click handlers
+        for(j=0; j<checkboxOptions.length; j++) {
+            checkboxEl = YAHOO.util.Dom.get(oSelf.id + "-editor-checkbox" + j);
+            YAHOO.util.Event.addListener(checkboxEl, "click", function(){
+                var aNewValues = [];
+                for(var m=0; m<aCheckboxEls.length; m++) {
+                    if(aCheckboxEls[m].checked) {
+                        aNewValues.push(aCheckboxEls[m].value);
+                    }
+                }
+                oSelf._oCellEditor.value = aNewValues;
+                oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+            });
+        }
+    }
+};
+
+/**
+ * Enables Date Editor.
+ *
+ * @method editDate
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+YAHOO.widget.DataTable.editDate = function(oEditor, oSelf) {
+    var elCell = oEditor.cell;
+    var oRecord = oEditor.record;
+    var oColumn = oEditor.column;
+    var elContainer = oEditor.container;
+    var value = oRecord.getData(oColumn.key);
+
+    // Calendar widget
+    if(YAHOO.widget.Calendar) {
+        var selectedValue = (value.getMonth()+1)+"/"+value.getDate()+"/"+value.getFullYear();
+        var calContainer = elContainer.appendChild(document.createElement("div"));
+        calContainer.id = oSelf.id + "-col" + oColumn.getId() + "-dateContainer";
+        var calendar =
+                new YAHOO.widget.Calendar(oSelf.id + "-col" + oColumn.getId() + "-date",
+                calContainer.id,
+                {selected:selectedValue, pagedate:value});
+        calendar.render();
+        calContainer.style.cssFloat = "none";
+
+        //var calFloatClearer = elContainer.appendChild(document.createElement("br"));
+        //calFloatClearer.style.clear = "both";
+        
+        calendar.selectEvent.subscribe(function(type, args, obj) {
+            oSelf._oCellEditor.value = new Date(args[0][0][0], args[0][0][1]-1, args[0][0][2]);
+            oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+        });
+    }
+    else {
+        //TODO;
+    }
+};
+
+/**
+ * Enables SELECT Editor.
+ *
+ * @method editDropdown
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+YAHOO.widget.DataTable.editDropdown = function(oEditor, oSelf) {
+    var elCell = oEditor.cell;
+    var oRecord = oEditor.record;
+    var oColumn = oEditor.column;
+    var elContainer = oEditor.container;
+    var value = oRecord.getData(oColumn.key);
+
+    // Textbox
+    var elDropdown = elContainer.appendChild(document.createElement("select"));
+    var dropdownOptions = (oColumn.editorOptions && YAHOO.lang.isArray(oColumn.editorOptions.dropdownOptions)) ?
+            oColumn.editorOptions.dropdownOptions : [];
+    for(var j=0; j<dropdownOptions.length; j++) {
+        var dropdownOption = dropdownOptions[j];
+        var elOption = document.createElement("option");
+        elOption.value = (YAHOO.lang.isValue(dropdownOption.value)) ?
+                dropdownOption.value : dropdownOption;
+        elOption.innerHTML = (YAHOO.lang.isValue(dropdownOption.text)) ?
+                dropdownOption.text : dropdownOption;
+        elOption = elDropdown.appendChild(elOption);
+        if(value === elDropdown.options[j].value) {
+            elDropdown.options[j].selected = true;
+        }
+    }
+    
+    // Set up a listener on each check box to track the input value
+    YAHOO.util.Event.addListener(elDropdown, "change",
+        function(){
+            oSelf._oCellEditor.value = elDropdown[elDropdown.selectedIndex].value;
+            oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+    });
+            
+    // Focus the dropdown
+    oSelf._focusEl(elDropdown);
+};
+
+/**
+ * Enables INPUT TYPE=RADIO Editor.
+ *
+ * @method editRadio
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+YAHOO.widget.DataTable.editRadio = function(oEditor, oSelf) {
+    var elCell = oEditor.cell;
+    var oRecord = oEditor.record;
+    var oColumn = oEditor.column;
+    var elContainer = oEditor.container;
+    var value = oRecord.getData(oColumn.key);
+
+    // Radios
+    if(oColumn.editorOptions && YAHOO.lang.isArray(oColumn.editorOptions.radioOptions)) {
+        var radioOptions = oColumn.editorOptions.radioOptions;
+        var radioValue, radioId, elLabel, j;
+        // First create the radio buttons in an IE-friendly way
+        for(j=0; j<radioOptions.length; j++) {
+            radioValue = YAHOO.lang.isValue(radioOptions[j].label) ?
+                    radioOptions[j].label : radioOptions[j];
+            radioId =  oSelf.id + "-editor-radio" + j;
+            elContainer.innerHTML += "<input type=\"radio\"" +
+                    " name=\"" + oSelf.id + "-editor-radio\"" +
+                    " value=\"" + radioValue + "\"" +
+                    " id=\"" +  radioId + "\">";
+            // Then create the labels in an IE-friendly way
+            elLabel = elContainer.appendChild(document.createElement("label"));
+            elLabel.htmlFor = radioId;
+            elLabel.innerHTML = radioValue;
+        }
+        // Then check one, and assign click handlers
+        for(j=0; j<radioOptions.length; j++) {
+            var radioEl = YAHOO.util.Dom.get(oSelf.id + "-editor-radio" + j);
+            if(value === radioEl.value) {
+                radioEl.checked = true;
+                oSelf._focusEl(radioEl);
+            }
+            YAHOO.util.Event.addListener(radioEl, "click",
+                function(){
+                    oSelf._oCellEditor.value = this.value;
+                    oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+            });
+        }
+    }
+};
+
+/**
+ * Enables TEXTAREA Editor.
+ *
+ * @method editTextarea
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+YAHOO.widget.DataTable.editTextarea = function(oEditor, oSelf) {
+   var elCell = oEditor.cell;
+   var oRecord = oEditor.record;
+   var oColumn = oEditor.column;
+   var elContainer = oEditor.container;
+   var value = oRecord.getData(oColumn.key);
+
+    // Textarea
+    var elTextarea = elContainer.appendChild(document.createElement("textarea"));
+    elTextarea.style.width = elCell.offsetWidth + "px"; //(parseInt(elCell.offsetWidth,10)) + "px";
+    elTextarea.style.height = "3em"; //(parseInt(elCell.offsetHeight,10)) + "px";
+    elTextarea.value = YAHOO.lang.isValue(value) ? value : "";
+    
+    // Set up a listener on each check box to track the input value
+    YAHOO.util.Event.addListener(elTextarea, "keyup", function(){
+        //TODO: set on a timeout
+        oSelf._oCellEditor.value = elTextarea.value;
+        oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+    });
+    
+    // Select the text
+    elTextarea.focus();
+    elTextarea.select();
+};
+
+/**
+ * Enables INPUT TYPE=TEXT Editor.
+ *
+ * @method editTextbox
+ * @param oEditor {Object} Object literal representation of Editor values.
+ * @param oSelf {YAHOO.widget.DataTable} Reference back to DataTable instance.
+ * @static
+ */
+YAHOO.widget.DataTable.editTextbox = function(oEditor, oSelf) {
+   var elCell = oEditor.cell;
+   var oRecord = oEditor.record;
+   var oColumn = oEditor.column;
+   var elContainer = oEditor.container;
+   var value = YAHOO.lang.isValue(oRecord.getData(oColumn.key)) ? oRecord.getData(oColumn.key) : "";
+
+    // Textbox
+    var elTextbox = elContainer.appendChild(document.createElement("input"));
+    elTextbox.type = "text";
+    elTextbox.style.width = elCell.offsetWidth + "px"; //(parseInt(elCell.offsetWidth,10)) + "px";
+    //elTextbox.style.height = "1em"; //(parseInt(elCell.offsetHeight,10)) + "px";
+    elTextbox.value = value;
+
+    // Set up a listener on each textbox to track the input value
+    YAHOO.util.Event.addListener(elTextbox, "keyup", function(){
+        //TODO: set on a timeout
+        oSelf._oCellEditor.value = elTextbox.value;
+        oSelf.fireEvent("editorUpdateEvent",{editor:oSelf._oCellEditor});
+    });
+
+    // Select the text
+    elTextbox.focus();
+    elTextbox.select();
+};
+
+/*
+ * Validates Editor input value to type Number, doing type conversion as
+ * necessary. A valid Number value is return, else the previous value is returned
+ * if input value does not validate.
+ * 
+ *
+ * @method validateNumber
+ * @param oData {Object} Data to validate.
+ * @static
+*/
+YAHOO.widget.DataTable.validateNumber = function(oData) {
+    //Convert to number
+    var number = oData * 1;
+
+    // Validate
+    if(YAHOO.lang.isNumber(number)) {
+        return number;
+    }
+    else {
+        return null;
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// ABSTRACT METHODS
+
+/**
+ * Overridable method gives implementers a hook to access data before
+ * it gets added to RecordSet and rendered to the TBODY.
+ *
+ * @method doBeforeLoadData
+ * @param sRequest {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @return {Boolean} Return true to continue loading data into RecordSet and
+ * updating DataTable with new Records, false to cancel.
+ */
+YAHOO.widget.DataTable.prototype.doBeforeLoadData = function(sRequest, oResponse) {
+    return true;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public Custom Event Handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Overridable custom event handler to sort Column.
+ *
+ * @method onEventSortColumn
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventSortColumn = function(oArgs) {
+//TODO: support nested header column sorting
+    var evt = oArgs.event;
+    var target = oArgs.target;
+    YAHOO.util.Event.stopEvent(evt);
+    
+    var el = this.getThEl(target) || this.getTdEl(target);
+    if(el && el.yuiColumnKey) {
+        var oColumn = this.getColumn(el.yuiColumnKey);
+        if(oColumn.sortable) {
+            this.sortColumn(oColumn);
+        }
+        else {
+        }
+    }
+    else {
+    }
+};
+
+/**
+ * Overridable custom event handler to manage selection according to desktop paradigm.
+ *
+ * @method onEventSelectRow
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventSelectRow = function(oArgs) {
+    var sMode = this.get("selectionMode");
+    if ((sMode == "singlecell") || (sMode == "cellblock") || (sMode == "cellrange")) {
+        return;
+    }
+
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+
+    var bSHIFT = evt.shiftKey;
+    var bCTRL = evt.ctrlKey || ((navigator.userAgent.toLowerCase().indexOf("mac") != -1) && evt.metaKey);
+    var i;
+    //var nAnchorPos;
+
+    // Validate target row
+    var elTargetRow = this.getTrEl(elTarget);
+    if(elTargetRow) {
+        var nAnchorRecordIndex, nAnchorTrIndex;
+        var allRows = this._elTbody.rows;
+        var oTargetRecord = this.getRecord(elTargetRow);
+        var nTargetRecordIndex = this._oRecordSet.getRecordIndex(oTargetRecord);
+        var nTargetTrIndex = this.getTrIndex(elTargetRow);
+
+        var oAnchorRecord = this._oAnchorRecord;
+        if(oAnchorRecord) {
+            nAnchorRecordIndex = this._oRecordSet.getRecordIndex(oAnchorRecord);
+            nAnchorTrIndex = this.getTrIndex(oAnchorRecord);
+            if(nAnchorTrIndex === null) {
+                if(nAnchorRecordIndex < this.getRecordIndex(this.getFirstTrEl())) {
+                    nAnchorTrIndex = 0;
+                }
+                else {
+                    nAnchorTrIndex = this.getRecordIndex(this.getLastTrEl());
+                }
+            }
+        }
+
+        // Both SHIFT and CTRL
+        if((sMode != "single") && bSHIFT && bCTRL) {
+            // Validate anchor
+            if(oAnchorRecord) {
+                if(this.isSelected(oAnchorRecord)) {
+                    // Select all rows between anchor row and target row, including target row
+                    if(nAnchorRecordIndex < nTargetRecordIndex) {
+                        for(i=nAnchorRecordIndex+1; i<=nTargetRecordIndex; i++) {
+                            if(!this.isSelected(i)) {
+                                this.selectRow(i);
+                            }
+                        }
+                    }
+                    // Select all rows between target row and anchor row, including target row
+                    else {
+                        for(i=nAnchorRecordIndex-1; i>=nTargetRecordIndex; i--) {
+                            if(!this.isSelected(i)) {
+                                this.selectRow(i);
+                            }
+                        }
+                    }
+                }
+                else {
+                    // Unselect all rows between anchor row and target row
+                    if(nAnchorRecordIndex < nTargetRecordIndex) {
+                        for(i=nAnchorRecordIndex+1; i<=nTargetRecordIndex-1; i++) {
+                            if(this.isSelected(i)) {
+                                this.unselectRow(i);
+                            }
+                        }
+                    }
+                    // Unselect all rows between target row and anchor row
+                    else {
+                        for(i=nTargetRecordIndex+1; i<=nAnchorRecordIndex-1; i++) {
+                            if(this.isSelected(i)) {
+                                this.unselectRow(i);
+                            }
+                        }
+                    }
+                    // Select the target row
+                    this.selectRow(oTargetRecord);
+                }
+            }
+            // Invalid anchor
+            else {
+                // Set anchor
+                this._oAnchorRecord = oTargetRecord;
+
+                // Toggle selection of target
+                if(this.isSelected(oTargetRecord)) {
+                    this.unselectRow(oTargetRecord);
+                }
+                else {
+                    this.selectRow(oTargetRecord);
+                }
+            }
+        }
+        // Only SHIFT
+        else if((sMode != "single") && bSHIFT) {
+            this.unselectAllRows();
+
+            // Validate anchor
+            if(oAnchorRecord) {
+                // Select all rows between anchor row and target row,
+                // including the anchor row and target row
+                if(nAnchorRecordIndex < nTargetRecordIndex) {
+                    for(i=nAnchorRecordIndex; i<=nTargetRecordIndex; i++) {
+                        this.selectRow(i);
+                    }
+                }
+                // Select all rows between target row and anchor row,
+                // including the target row and anchor row
+                else {
+                    for(i=nAnchorRecordIndex; i>=nTargetRecordIndex; i--) {
+                        this.selectRow(i);
+                    }
+                }
+            }
+            // Invalid anchor
+            else {
+                // Set anchor
+                this._oAnchorRecord = oTargetRecord;
+
+                // Select target row only
+                this.selectRow(oTargetRecord);
+            }
+        }
+        // Only CTRL
+        else if((sMode != "single") && bCTRL) {
+            // Set anchor
+            this._oAnchorRecord = oTargetRecord;
+
+            // Toggle selection of target
+            if(this.isSelected(oTargetRecord)) {
+                this.unselectRow(oTargetRecord);
+            }
+            else {
+                this.selectRow(oTargetRecord);
+            }
+        }
+        // Neither SHIFT nor CTRL and "single" mode
+        else if(sMode == "single") {
+            this.unselectAllRows();
+            this.selectRow(oTargetRecord);
+        }
+        // Neither SHIFT nor CTRL
+        else {
+            // Set anchor
+            this._oAnchorRecord = oTargetRecord;
+
+            // Select only target
+            this.unselectAllRows();
+            this.selectRow(oTargetRecord);
+        }
+
+        // Clear any selections that are a byproduct of the click or dblclick
+        var sel;
+        if(window.getSelection) {
+        	sel = window.getSelection();
+        }
+        else if(document.getSelection) {
+        	sel = document.getSelection();
+        }
+        else if(document.selection) {
+        	sel = document.selection;
+        }
+        if(sel) {
+            if(sel.empty) {
+                sel.empty();
+            }
+            else if (sel.removeAllRanges) {
+                sel.removeAllRanges();
+            }
+            else if(sel.collapse) {
+                sel.collapse();
+            }
+        }
+    }
+    else {
+    }
+};
+
+/**
+ * Overridable custom event handler to select cell.
+ *
+ * @method onEventSelectCell
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventSelectCell = function(oArgs) {
+    var sMode = this.get("selectionMode");
+    if ((sMode == "standard") || (sMode == "single")) {
+        return;
+    }
+
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+
+    var bSHIFT = evt.shiftKey;
+    var bCTRL = evt.ctrlKey  || ((navigator.userAgent.toLowerCase().indexOf("mac") != -1) && evt.metaKey);
+    var i, j, currentRow, startIndex, endIndex;
+    
+    var elTargetCell = this.getTdEl(elTarget);
+    if(elTargetCell) {
+        var nAnchorRecordIndex, nAnchorTrIndex, oAnchorColumn, nAnchorColKeyIndex;
+        
+        var elTargetRow = this.getTrEl(elTargetCell);
+        var allRows = this._elTbody.rows;
+        
+        var oTargetRecord = this.getRecord(elTargetRow);
+        var nTargetRecordIndex = this._oRecordSet.getRecordIndex(oTargetRecord);
+        var oTargetColumn = this.getColumn(elTargetCell);
+        var nTargetColKeyIndex = oTargetColumn.getKeyIndex();
+        var nTargetTrIndex = this.getTrIndex(elTargetRow);
+        var oTargetCell = {record:oTargetRecord, column:oTargetColumn};
+
+        var oAnchorRecord = (this._oAnchorCell) ? this._oAnchorCell.record : null;
+        if(oAnchorRecord) {
+            nAnchorRecordIndex = this._oRecordSet.getRecordIndex(oAnchorRecord);
+            oAnchorColumn = this._oAnchorCell.column;
+            nAnchorColKeyIndex = oAnchorColumn.getKeyIndex();
+            nAnchorTrIndex = this.getTrIndex(oAnchorRecord);
+            if(nAnchorTrIndex === null) {
+                if(nAnchorRecordIndex < this.getRecordIndex(this.getFirstTrEl())) {
+                    nAnchorTrIndex = 0;
+                }
+                else {
+                    nAnchorTrIndex = this.getRecordIndex(this.getLastTrEl());
+                }
+            }
+        }
+        var oAnchorCell = {record:oAnchorRecord, column:oAnchorColumn};
+
+        // Both SHIFT and CTRL
+        if((sMode != "singlecell") && bSHIFT && bCTRL) {
+            // Validate anchor
+            if(oAnchorRecord && oAnchorColumn) {
+                // Anchor is selected
+                if(this.isSelected(this._oAnchorCell)) {
+                    // All cells are on the same row
+                    if(nAnchorRecordIndex === nTargetRecordIndex) {
+                        // Select all cells between anchor cell and target cell, including target cell
+                        if(nAnchorColKeyIndex < nTargetColKeyIndex) {
+                            for(i=nAnchorColKeyIndex+1; i<=nTargetColKeyIndex; i++) {
+                                this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+                        }
+                        // Select all cells between target cell and anchor cell, including target cell
+                        else if(nTargetColKeyIndex < nAnchorColKeyIndex) {
+                            for(i=nTargetColKeyIndex; i<nAnchorColKeyIndex; i++) {
+                                this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+                        }
+                    }
+                    // Anchor row is above target row
+                    else if(nAnchorRecordIndex < nTargetRecordIndex) {
+                        if(sMode == "cellrange") {
+                            // Select all cells on anchor row from anchor cell to the end of the row
+                            for(i=nAnchorColKeyIndex+1; i<allRows[nAnchorTrIndex].cells.length; i++) {
+                                this.selectCell(allRows[nAnchorTrIndex].cells[i]);
+                            }
+                            
+                            // Select all cells on all rows between anchor row and target row
+                            for(i=nAnchorTrIndex+1; i<nTargetTrIndex; i++) {
+                                for(j=0; j<allRows[i].cells.length; j++){
+                                    this.selectCell(allRows[i].cells[j]);
+                                }
+                            }
+
+                            // Select all cells on target row from first cell to the target cell
+                            for(i=0; i<=nTargetColKeyIndex; i++) {
+                                this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+                        }
+                        else if(sMode == "cellblock") {
+                            startIndex = Math.min(nAnchorColKeyIndex, nTargetColKeyIndex);
+                            endIndex = Math.max(nAnchorColKeyIndex, nTargetColKeyIndex);
+                            
+                            // Select all cells from startIndex to endIndex on rows between anchor row and target row
+                            for(i=nAnchorTrIndex; i<=nTargetTrIndex; i++) {
+                                for(j=startIndex; j<=endIndex; j++) {
+                                    this.selectCell(allRows[i].cells[j]);
+                                }
+                            }
+                        }
+                    }
+                    // Anchor row is below target row
+                    else {
+                        if(sMode == "cellrange") {
+                            // Select all cells on target row from target cell to the end of the row
+                            for(i=nTargetColKeyIndex; i<allRows[nTargetTrIndex].cells.length; i++) {
+                                this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+
+                            // Select all cells on all rows between target row and anchor row
+                            for(i=nTargetTrIndex+1; i<nAnchorTrIndex; i++) {
+                                for(j=0; j<allRows[i].cells.length; j++){
+                                    this.selectCell(allRows[i].cells[j]);
+                                }
+                            }
+
+                            // Select all cells on anchor row from first cell to the anchor cell
+                            for(i=0; i<nAnchorColKeyIndex; i++) {
+                                this.selectCell(allRows[nAnchorTrIndex].cells[i]);
+                            }
+                        }
+                        else if(sMode == "cellblock") {
+                            startIndex = Math.min(nAnchorTrIndex, nTargetColKeyIndex);
+                            endIndex = Math.max(nAnchorTrIndex, nTargetColKeyIndex);
+
+                            // Select all cells from startIndex to endIndex on rows between target row and anchor row
+                            for(i=nAnchorTrIndex; i>=nTargetTrIndex; i--) {
+                                for(j=endIndex; j>=startIndex; j--) {
+                                    this.selectCell(allRows[i].cells[j]);
+                                }
+                            }
+                        }
+                    }
+                }
+                // Anchor cell is unselected
+                else {
+                    // All cells are on the same row
+                    if(nAnchorRecordIndex === nTargetRecordIndex) {
+                        // Unselect all cells between anchor cell and target cell
+                        if(nAnchorColKeyIndex < nTargetColKeyIndex) {
+                            for(i=nAnchorColKeyIndex+1; i<nTargetColKeyIndex; i++) {
+                                this.unselectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+                        }
+                        // Select all cells between target cell and anchor cell
+                        else if(nTargetColKeyIndex < nAnchorColKeyIndex) {
+                            for(i=nTargetColKeyIndex+1; i<nAnchorColKeyIndex; i++) {
+                                this.unselectCell(allRows[nTargetTrIndex].cells[i]);
+                            }
+                        }
+                    }
+                    // Anchor row is above target row
+                    if(nAnchorRecordIndex < nTargetRecordIndex) {
+                        // Unselect all cells from anchor cell to target cell
+                        for(i=nAnchorTrIndex; i<=nTargetTrIndex; i++) {
+                            currentRow = allRows[i];
+                            for(j=0; j<currentRow.cells.length; j++) {
+                                // This is the anchor row, only unselect cells after the anchor cell
+                                if(currentRow.sectionRowIndex === nAnchorTrIndex) {
+                                    if(j>nAnchorColKeyIndex) {
+                                        this.unselectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // This is the target row, only unelect cells before the target cell
+                                else if(currentRow.sectionRowIndex === nTargetTrIndex) {
+                                    if(j<nTargetColKeyIndex) {
+                                        this.unselectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // Unselect all cells on this row
+                                else {
+                                    this.unselectCell(currentRow.cells[j]);
+                                }
+                            }
+                        }
+                    }
+                    // Anchor row is below target row
+                    else {
+                        // Unselect all cells from target cell to anchor cell
+                        for(i=nTargetTrIndex; i<=nAnchorTrIndex; i++) {
+                            currentRow = allRows[i];
+                            for(j=0; j<currentRow.cells.length; j++) {
+                                // This is the target row, only unselect cells after the target cell
+                                if(currentRow.sectionRowIndex == nTargetTrIndex) {
+                                    if(j>nTargetColKeyIndex) {
+                                        this.unselectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // This is the anchor row, only unselect cells before the anchor cell
+                                else if(currentRow.sectionRowIndex == nAnchorTrIndex) {
+                                    if(j<nAnchorColKeyIndex) {
+                                        this.unselectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // Unselect all cells on this row
+                                else {
+                                    this.unselectCell(currentRow.cells[j]);
+                                }
+                            }
+                        }
+                    }
+
+                    // Select the target cell
+                    this.selectCell(elTargetCell);
+                }
+            }
+            // Invalid anchor
+            else {
+                // Set anchor
+                this._oAnchorCell = oTargetCell;
+
+                // Toggle selection of target
+                if(this.isSelected(oTargetCell)) {
+                    this.unselectCell(oTargetCell);
+                }
+                else {
+                    this.selectCell(oTargetCell);
+                }
+            }
+        }
+        // Only SHIFT
+        else if((sMode != "singlecell") && bSHIFT) {
+            this.unselectAllCells();
+
+            // Validate anchor
+            if(oAnchorCell) {
+                // All cells are on the same row
+                if(nAnchorRecordIndex === nTargetRecordIndex) {
+                    // Select all cells between anchor cell and target cell,
+                    // including the anchor cell and target cell
+                    if(nAnchorColKeyIndex < nTargetColKeyIndex) {
+                        for(i=nAnchorColKeyIndex; i<=nTargetColKeyIndex; i++) {
+                            this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                        }
+                    }
+                    // Select all cells between target cell and anchor cell
+                    // including the target cell and anchor cell
+                    else if(nTargetColKeyIndex < nAnchorColKeyIndex) {
+                        for(i=nTargetColKeyIndex; i<=nAnchorColKeyIndex; i++) {
+                            this.selectCell(allRows[nTargetTrIndex].cells[i]);
+                        }
+                    }
+                }
+                // Anchor row is above target row
+                else if(nAnchorRecordIndex < nTargetRecordIndex) {
+                    if(sMode == "cellrange") {
+                        // Select all cells from anchor cell to target cell
+                        // including the anchor cell and target cell
+                        for(i=nAnchorTrIndex; i<=nTargetTrIndex; i++) {
+                            currentRow = allRows[i];
+                            for(j=0; j<currentRow.cells.length; j++) {
+                                // This is the anchor row, only select the anchor cell and after
+                                if(currentRow.sectionRowIndex == nAnchorTrIndex) {
+                                    if(j>=nAnchorColKeyIndex) {
+                                        this.selectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // This is the target row, only select the target cell and before
+                                else if(currentRow.sectionRowIndex == nTargetTrIndex) {
+                                    if(j<=nTargetColKeyIndex) {
+                                        this.selectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // Select all cells on this row
+                                else {
+                                    this.selectCell(currentRow.cells[j]);
+                                }
+                            }
+                        }
+                    }
+                    else if(sMode == "cellblock") {
+                        // Select the cellblock from anchor cell to target cell
+                        // including the anchor cell and the target cell
+                        startIndex = Math.min(nAnchorColKeyIndex, nTargetColKeyIndex);
+                        endIndex = Math.max(nAnchorColKeyIndex, nTargetColKeyIndex);
+
+                        for(i=nAnchorTrIndex; i<=nTargetTrIndex; i++) {
+                            for(j=startIndex; j<=endIndex; j++) {
+                                this.selectCell(allRows[i].cells[j]);
+                            }
+                        }
+                    }
+                }
+                // Anchor row is below target row
+                else {
+                    if(sMode == "cellrange") {
+                        // Select all cells from target cell to anchor cell,
+                        // including the target cell and anchor cell
+                        for(i=nTargetTrIndex; i<=nAnchorTrIndex; i++) {
+                            currentRow = allRows[i];
+                            for(j=0; j<currentRow.cells.length; j++) {
+                                // This is the target row, only select the target cell and after
+                                if(currentRow.sectionRowIndex == nTargetTrIndex) {
+                                    if(j>=nTargetColKeyIndex) {
+                                        this.selectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // This is the anchor row, only select the anchor cell and before
+                                else if(currentRow.sectionRowIndex == nAnchorTrIndex) {
+                                    if(j<=nAnchorColKeyIndex) {
+                                        this.selectCell(currentRow.cells[j]);
+                                    }
+                                }
+                                // Select all cells on this row
+                                else {
+                                    this.selectCell(currentRow.cells[j]);
+                                }
+                            }
+                        }
+                    }
+                    else if(sMode == "cellblock") {
+                        // Select the cellblock from target cell to anchor cell
+                        // including the target cell and the anchor cell
+                        startIndex = Math.min(nAnchorColKeyIndex, nTargetColKeyIndex);
+                        endIndex = Math.max(nAnchorColKeyIndex, nTargetColKeyIndex);
+
+                        for(i=nTargetTrIndex; i<=nAnchorTrIndex; i++) {
+                            for(j=startIndex; j<=endIndex; j++) {
+                                this.selectCell(allRows[i].cells[j]);
+                            }
+                        }
+                    }
+                }
+            }
+            // Invalid anchor
+            else {
+                // Set anchor
+                this._oAnchorCell = oTargetCell;
+
+                // Select target only
+                this.selectCell(oTargetCell);
+            }
+        }
+        // Only CTRL
+        else if((sMode != "singlecell") && bCTRL) {
+            // Set anchor
+            this._oAnchorCell = oTargetCell;
+
+            // Toggle selection of target
+            if(this.isSelected(oTargetCell)) {
+                this.unselectCell(oTargetCell);
+            }
+            else {
+                this.selectCell(oTargetCell);
+            }
+        }
+        // Neither SHIFT nor CTRL, or multi-selection has been disabled
+        else {
+            // Set anchor
+            this._oAnchorCell = oTargetCell;
+
+            // Select only target
+            this.unselectAllCells();
+            this.selectCell(oTargetCell);
+        }
+
+        // Clear any selections that are a byproduct of the click or dblclick
+        var sel;
+        if(window.getSelection) {
+        	sel = window.getSelection();
+        }
+        else if(document.getSelection) {
+        	sel = document.getSelection();
+        }
+        else if(document.selection) {
+        	sel = document.selection;
+        }
+        if(sel) {
+            if(sel.empty) {
+                sel.empty();
+            }
+            else if (sel.removeAllRanges) {
+                sel.removeAllRanges();
+            }
+            else if(sel.collapse) {
+                sel.collapse();
+            }
+        }
+    }
+    else {
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Overridable custom event handler to highlight row.
+ *
+ * @method onEventHighlightRow
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventHighlightRow = function(oArgs) {
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+    this.highlightRow(elTarget);
+};
+
+/**
+ * Overridable custom event handler to unhighlight row.
+ *
+ * @method onEventUnhighlightRow
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventUnhighlightRow = function(oArgs) {
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+    this.unhighlightRow(elTarget);
+};
+
+/**
+ * Overridable custom event handler to highlight cell.
+ *
+ * @method onEventHighlightCell
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventHighlightCell = function(oArgs) {
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+    this.highlightCell(elTarget);
+};
+
+/**
+ * Overridable custom event handler to unhighlight cell.
+ *
+ * @method onEventUnhighlightCell
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventUnhighlightCell = function(oArgs) {
+    var evt = oArgs.event;
+    var elTarget = oArgs.target;
+    this.unhighlightCell(elTarget);
+};
+
+/**
+ * Overridable custom event handler to format cell.
+ *
+ * @method onEventFormatCell
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventFormatCell = function(oArgs) {
+    var evt = oArgs.event;
+    var target = oArgs.target;
+    var elTag = target.tagName.toLowerCase();
+
+    var elCell = this.getTdEl(target);
+    if(elCell && elCell.yuiColumnKey) {
+        var oColumn = this.getColumn(elCell.yuiColumnKey);
+        this.formatCell(elCell, this.getRecord(elCell), oColumn);
+    }
+    else {
+    }
+};
+
+/**
+ * Overridable custom event handler to edit cell.
+ *
+ * @method onEventShowCellEditor
+ * @param oArgs.event {HTMLEvent} Event object.
+ * @param oArgs.target {HTMLElement} Target element.
+ */
+YAHOO.widget.DataTable.prototype.onEventShowCellEditor = function(oArgs) {
+    var evt = oArgs.event;
+    var target = oArgs.target;
+    var elTag = target.tagName.toLowerCase();
+
+    var elCell = this.getTdEl(target);
+    if(elCell) {
+        this.showCellEditor(elCell);
+    }
+    else {
+    }
+};
+// Backward compatibility
+YAHOO.widget.DataTable.prototype.onEventEditCell = function(oArgs) {
+    this.onEventShowCellEditor(oArgs);
+};
+
+/**
+ * Overridable custom event handler to save Cell Editor input.
+ *
+ * @method onEventSaveCellEditor
+ * @param oArgs.editor {Object} Cell Editor object literal.
+ */
+YAHOO.widget.DataTable.prototype.onEventSaveCellEditor = function(oArgs) {
+    this.saveCellEditor();
+};
+
+/**
+ * Callback function for creating a progressively enhanced DataTable first
+ * receives data from DataSource and populates the RecordSet, then initializes
+ * DOM elements.
+ *
+ * @method _onDataReturnEnhanceTable
+ * @param sRequest {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param bError {Boolean} (optional) True if there was a data error.
+ * @private
+ */
+YAHOO.widget.DataTable.prototype._onDataReturnEnhanceTable = function(sRequest, oResponse) {
+    // Pass data through abstract method for any transformations
+    var ok = this.doBeforeLoadData(sRequest, oResponse);
+
+    // Data ok to populate
+    if(ok && oResponse && !oResponse.error && YAHOO.lang.isArray(oResponse.results)) {
+        // Update RecordSet
+        this._oRecordSet.addRecords(oResponse.results);
+
+        // Initialize DOM elements
+        this._initTableEl();
+        if(!this._elTable || !this._elThead || !this._elTbody) {
+            return;
+        }
+
+        // Call Element's constructor after DOM elements are created
+        // but *before* UI is updated with data
+        YAHOO.widget.DataTable.superclass.constructor.call(this, this._elContainer, this._oConfigs);
+
+        //HACK: Set the Paginator values
+        if(this._oConfigs.paginator) {
+            this.updatePaginator(this._oConfigs.paginator);
+        }
+
+        // Update the UI
+        this.refreshView();
+    }
+    // Error
+    else if(ok && oResponse.error) {
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
+    }
+    // Empty
+    else if(ok){
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY, YAHOO.widget.DataTable.CLASS_EMPTY);
+    }
+};
+    
+/**
+ * Callback function receives data from DataSource and populates an entire
+ * DataTable with Records and TR elements, clearing previous Records, if any.
+ *
+ * @method onDataReturnInitializeTable
+ * @param sRequest {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param bError {Boolean} (optional) True if there was a data error.
+ */
+YAHOO.widget.DataTable.prototype.onDataReturnInitializeTable = function(sRequest, oResponse) {
+    this.fireEvent("dataReturnEvent", {request:sRequest,response:oResponse});
+
+    // Pass data through abstract method for any transformations
+    var ok = this.doBeforeLoadData(sRequest, oResponse);
+
+    // Data ok to populate
+    if(ok && oResponse && !oResponse.error && YAHOO.lang.isArray(oResponse.results)) {
+        this.initializeTable(oResponse.results);
+    }
+    // Error
+    else if(ok && oResponse.error) {
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
+    }
+    // Empty
+    else if(ok){
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY, YAHOO.widget.DataTable.CLASS_EMPTY);
+    }
+};
+// Backward compatibility
+YAHOO.widget.DataTable.prototype.onDataReturnReplaceRows = function(sRequest, oResponse) {
+    this.onDataReturnInitializeTable(sRequest, oResponse);
+};
+
+/**
+ * Callback function receives data from DataSource and appends to an existing
+ * DataTable new Records and, if applicable, creates or updates
+ * corresponding TR elements.
+ *
+ * @method onDataReturnAppendRows
+ * @param sRequest {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param bError {Boolean} (optional) True if there was a data error.
+ */
+YAHOO.widget.DataTable.prototype.onDataReturnAppendRows = function(sRequest, oResponse) {
+    this.fireEvent("dataReturnEvent", {request:sRequest,response:oResponse});
+    
+    // Pass data through abstract method for any transformations
+    var ok = this.doBeforeLoadData(sRequest, oResponse);
+    
+    // Data ok to append
+    if(ok && oResponse && !oResponse.error && YAHOO.lang.isArray(oResponse.results)) {
+        this.addRows(oResponse.results);
+    }
+    // Error
+    else if(ok && oResponse.error) {
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
+    }
+};
+
+/**
+ * Callback function receives data from DataSource and inserts into top of an
+ * existing DataTable new Records and, if applicable, creates or updates
+ * corresponding TR elements.
+ *
+ * @method onDataReturnInsertRows
+ * @param sRequest {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param bError {Boolean} (optional) True if there was a data error.
+ */
+YAHOO.widget.DataTable.prototype.onDataReturnInsertRows = function(sRequest, oResponse) {
+    this.fireEvent("dataReturnEvent", {request:sRequest,response:oResponse});
+    
+    // Pass data through abstract method for any transformations
+    var ok = this.doBeforeLoadData(sRequest, oResponse);
+    
+    // Data ok to append
+    if(ok && oResponse && !oResponse.error && YAHOO.lang.isArray(oResponse.results)) {
+        this.addRows(oResponse.results, 0);
+    }
+    // Error
+    else if(ok && oResponse.error) {
+        this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
+    }
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Custom Events
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Fired when the DataTable instance's initialization is complete.
+     *
+     * @event initEvent
+     */
+
+    /**
+     * Fired when the DataTable's view is refreshed.
+     *
+     * @event refreshEvent
+     */
+
+    /**
+     * Fired when data is returned from DataSource but before it is consumed by
+     * DataTable.
+     *
+     * @event dataReturnEvent
+     * @param oArgs.request {String} Original request.
+     * @param oArgs.response {Object} Response object.
+     */
+
+    /**
+     * Fired when the DataTable has a focus.
+     *
+     * @event tableFocusEvent
+     */
+
+    /**
+     * Fired when the DataTable has a blur.
+     *
+     * @event tableBlurEvent
+     */
+
+    /**
+     * Fired when the DataTable has a mouseover.
+     *
+     * @event tableMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's TABLE element.
+     *
+     */
+
+    /**
+     * Fired when the DataTable has a mouseout.
+     *
+     * @event tableMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's TABLE element.
+     *
+     */
+
+    /**
+     * Fired when the DataTable has a mousedown.
+     *
+     * @event tableMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's TABLE element.
+     *
+     */
+
+    /**
+     * Fired when the DataTable has a click.
+     *
+     * @event tableClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's TABLE element.
+     *
+     */
+
+    /**
+     * Fired when the DataTable has a dblclick.
+     *
+     * @event tableDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's TABLE element.
+     *
+     */
+
+    /**
+     * Fired when a fixed scrolling DataTable has a scroll.
+     *
+     * @event tableScrollEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The DataTable's CONTAINER element (in IE)
+     * or the DataTable's TBODY element (everyone else).
+     *
+     */
+
+    /**
+     * Fired when a message is shown in the DataTable's message element.
+     *
+     * @event tableMsgShowEvent
+     * @param oArgs.html {String} The HTML displayed.
+     * @param oArgs.className {String} The className assigned.
+     *
+     */
+
+    /**
+     * Fired when the DataTable's message element is hidden.
+     *
+     * @event tableMsgHideEvent
+     */
+
+    /**
+     * Fired when a header row has a mouseover.
+     *
+     * @event headerRowMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a header row has a mouseout.
+     *
+     * @event headerRowMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a header row has a mousedown.
+     *
+     * @event headerRowMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a header row has a click.
+     *
+     * @event headerRowClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a header row has a dblclick.
+     *
+     * @event headerRowDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a header cell has a mouseover.
+     *
+     * @event headerCellMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TH element.
+     *
+     */
+
+    /**
+     * Fired when a header cell has a mouseout.
+     *
+     * @event headerCellMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TH element.
+     *
+     */
+
+    /**
+     * Fired when a header cell has a mousedown.
+     *
+     * @event headerCellMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TH element.
+     */
+
+    /**
+     * Fired when a header cell has a click.
+     *
+     * @event headerCellClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TH element.
+     */
+
+    /**
+     * Fired when a header cell has a dblclick.
+     *
+     * @event headerCellDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TH element.
+     */
+
+    /**
+     * Fired when a header label has a mouseover.
+     *
+     * @event headerLabelMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SPAN element.
+     *
+     */
+
+    /**
+     * Fired when a header label has a mouseout.
+     *
+     * @event headerLabelMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SPAN element.
+     *
+     */
+
+    /**
+     * Fired when a header label has a mousedown.
+     *
+     * @event headerLabelMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SPAN element.
+     */
+
+    /**
+     * Fired when a header label has a click.
+     *
+     * @event headerLabelClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SPAN element.
+     */
+
+    /**
+     * Fired when a header label has a dblclick.
+     *
+     * @event headerLabelDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SPAN element.
+     */
+
+    /**
+     * Fired when a column is sorted.
+     *
+     * @event columnSortEvent
+     * @param oArgs.column {YAHOO.widget.Column} The Column instance.
+     * @param oArgs.dir {String} Sort direction "asc" or "desc".
+     */
+
+    /**
+     * Fired when a column is resized.
+     *
+     * @event columnResizeEvent
+     * @param oArgs.column {YAHOO.widget.Column} The Column instance.
+     * @param oArgs.target {HTMLElement} The TH element.
+     */
+
+    /**
+     * Fired when a row has a mouseover.
+     *
+     * @event rowMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a row has a mouseout.
+     *
+     * @event rowMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a row has a mousedown.
+     *
+     * @event rowMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a row has a click.
+     *
+     * @event rowClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a row has a dblclick.
+     *
+     * @event rowDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TR element.
+     */
+
+    /**
+     * Fired when a row is added.
+     *
+     * @event rowAddEvent
+     * @param oArgs.record {YAHOO.widget.Record} The added Record.
+     */
+
+    /**
+     * Fired when a row is updated.
+     *
+     * @event rowUpdateEvent
+     * @param oArgs.record {YAHOO.widget.Record} The updated Record.
+     * @param oArgs.oldData {Object} Object literal of the old data.
+     */
+
+    /**
+     * Fired when a row is deleted.
+     *
+     * @event rowDeleteEvent
+     * @param oArgs.oldData {Object} Object literal of the deleted data.
+     * @param oArgs.recordIndex {Number} Index of the deleted Record.
+     * @param oArgs.trElIndex {Number} Index of the deleted TR element, if on current page.
+     */
+
+    /**
+     * Fired when a row is selected.
+     *
+     * @event rowSelectEvent
+     * @param oArgs.el {HTMLElement} The selected TR element, if applicable.
+     * @param oArgs.record {YAHOO.widget.Record} The selected Record.
+     */
+
+    /**
+     * Fired when a row is unselected.
+     *
+     * @event rowUnselectEvent
+     * @param oArgs.el {HTMLElement} The unselected TR element, if applicable.
+     * @param oArgs.record {YAHOO.widget.Record} The unselected Record.
+     */
+
+    /*TODO: delete and use rowUnselectEvent?
+     * Fired when all row selections are cleared.
+     *
+     * @event unselectAllRowsEvent
+     */
+
+    /*
+     * Fired when a row is highlighted.
+     *
+     * @event rowHighlightEvent
+     * @param oArgs.el {HTMLElement} The highlighted TR element.
+     * @param oArgs.record {YAHOO.widget.Record} The highlighted Record.
+     */
+
+    /*
+     * Fired when a row is unhighlighted.
+     *
+     * @event rowUnhighlightEvent
+     * @param oArgs.el {HTMLElement} The highlighted TR element.
+     * @param oArgs.record {YAHOO.widget.Record} The highlighted Record.
+     */
+
+    /**
+     * Fired when a cell has a mouseover.
+     *
+     * @event cellMouseoverEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TD element.
+     */
+
+    /**
+     * Fired when a cell has a mouseout.
+     *
+     * @event cellMouseoutEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TD element.
+     */
+
+    /**
+     * Fired when a cell has a mousedown.
+     *
+     * @event cellMousedownEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TD element.
+     */
+
+    /**
+     * Fired when a cell has a click.
+     *
+     * @event cellClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TD element.
+     */
+
+    /**
+     * Fired when a cell has a dblclick.
+     *
+     * @event cellDblclickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The TD element.
+     */
+
+    /**
+     * Fired when a cell is formatted.
+     *
+     * @event cellFormatEvent
+     * @param oArgs.el {HTMLElement} The formatted TD element.
+     * @param oArgs.record {YAHOO.widget.Record} The associated Record instance.
+     * @param oArgs.column {YAHOO.widget.Column} The associated Column instance.
+     * @param oArgs.key {String} (deprecated) The key of the formatted cell.
+     */
+
+    /**
+     * Fired when a cell is selected.
+     *
+     * @event cellSelectEvent
+     * @param oArgs.el {HTMLElement} The selected TD element.
+     * @param oArgs.record {YAHOO.widget.Record} The associated Record instance.
+     * @param oArgs.column {YAHOO.widget.Column} The associated Column instance.
+     * @param oArgs.key {String} (deprecated) The key of the selected cell.
+     */
+
+    /**
+     * Fired when a cell is unselected.
+     *
+     * @event cellUnselectEvent
+     * @param oArgs.el {HTMLElement} The unselected TD element.
+     * @param oArgs.record {YAHOO.widget.Record} The associated Record.
+     * @param oArgs.column {YAHOO.widget.Column} The associated Column instance.
+     * @param oArgs.key {String} (deprecated) The key of the unselected cell.
+
+     */
+
+    /**
+     * Fired when a cell is highlighted.
+     *
+     * @event cellHighlightEvent
+     * @param oArgs.el {HTMLElement} The highlighted TD element.
+     * @param oArgs.record {YAHOO.widget.Record} The associated Record instance.
+     * @param oArgs.column {YAHOO.widget.Column} The associated Column instance.
+     * @param oArgs.key {String} (deprecated) The key of the highlighted cell.
+
+     */
+
+    /**
+     * Fired when a cell is unhighlighted.
+     *
+     * @event cellUnhighlightEvent
+     * @param oArgs.el {HTMLElement} The unhighlighted TD element.
+     * @param oArgs.record {YAHOO.widget.Record} The associated Record instance.
+     * @param oArgs.column {YAHOO.widget.Column} The associated Column instance.
+     * @param oArgs.key {String} (deprecated) The key of the unhighlighted cell.
+
+     */
+
+    /*TODO: hide from doc and use cellUnselectEvent
+     * Fired when all cell selections are cleared.
+     *
+     * @event unselectAllCellsEvent
+     */
+
+    /*TODO: implement
+     * Fired when DataTable paginator is updated.
+     *
+     * @event paginatorUpdateEvent
+     * @param paginator {Object} Object literal of Paginator values.
+     */
+
+    /**
+     * Fired when an Editor is activated.
+     *
+     * @event editorShowEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     */
+
+    /**
+     * Fired when an active Editor has a keydown.
+     *
+     * @event editorKeydownEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     * @param oArgs.event {HTMLEvent} The event object.
+     */
+
+    /**
+     * Fired when Editor input is reverted.
+     *
+     * @event editorRevertEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     * @param oArgs.newData {Object} New data value.
+     * @param oArgs.oldData {Object} Old data value.
+     */
+
+    /**
+     * Fired when Editor input is saved.
+     *
+     * @event editorSaveEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     * @param oArgs.newData {Object} New data value.
+     * @param oArgs.oldData {Object} Old data value.
+     */
+
+    /**
+     * Fired when Editor input is canceled.
+     *
+     * @event editorCancelEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     */
+
+    /**
+     * Fired when an active Editor has a blur.
+     *
+     * @event editorBlurEvent
+     * @param oArgs.editor {Object} The Editor object literal.
+     */
+
+
+
+
+
+
+
+    /**
+     * Fired when a link is clicked.
+     *
+     * @event linkClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The A element.
+     */
+
+    /**
+     * Fired when a BUTTON element is clicked.
+     *
+     * @event buttonClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The BUTTON element.
+     */
+
+    /**
+     * Fired when a CHECKBOX element is clicked.
+     *
+     * @event checkboxClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The CHECKBOX element.
+     */
+
+    /*TODO
+     * Fired when a SELECT element is changed.
+     *
+     * @event dropdownChangeEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The SELECT element.
+     */
+
+    /**
+     * Fired when a RADIO element is clicked.
+     *
+     * @event radioClickEvent
+     * @param oArgs.event {HTMLEvent} The event object.
+     * @param oArgs.target {HTMLElement} The RADIO element.
+     */
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The ColumnSet class defines and manages a DataTable's Columns,
+ * including nested hierarchies and access to individual Column instances.
+ *
+ * @namespace YAHOO.widget
+ * @class ColumnSet
+ * @uses YAHOO.util.EventProvider
+ * @constructor
+ * @param aHeaders {Object[]} Array of object literals that define header cells.
+ */
+YAHOO.widget.ColumnSet = function(aHeaders) {
+    this._sName = "instance" + YAHOO.widget.ColumnSet._nCount;
+
+    // DOM tree representation of all Columns
+    var tree = [];
+    // Flat representation of all Columns
+    var flat = [];
+    // Flat representation of only Columns that are meant to display data
+    var keys = [];
+    // Array of HEADERS attribute values for all keys in the "keys" array
+    var headers = [];
+
+    // Tracks current node list depth being tracked
+    var nodeDepth = -1;
+
+    // Internal recursive function to defined Column instances
+    var oSelf = this;
+    var parseColumns = function(nodeList, parent) {
+        // One level down
+        nodeDepth++;
+
+        // Create corresponding tree node if not already there for this depth
+        if(!tree[nodeDepth]) {
+            tree[nodeDepth] = [];
+        }
+
+
+        // Parse each node at this depth for attributes and any children
+        for(var j=0; j<nodeList.length; j++) {
+            var currentNode = nodeList[j];
+
+            // Instantiate a new Column for each node
+            var oColumn = new YAHOO.widget.Column(currentNode);
+            oColumn._sId = YAHOO.widget.Column._nCount + "";
+            oColumn._sName = "Column instance" + YAHOO.widget.Column._nCount;
+            // Assign a key if not found
+            if(!YAHOO.lang.isValue(oColumn.key)) {
+                oColumn.key = "yui-dt-col" + YAHOO.widget.Column._nCount;
+            }
+            // Increment counter
+            YAHOO.widget.Column._nCount++;
+
+            // Add the new Column to the flat list
+            flat.push(oColumn);
+
+            // Assign its parent as an attribute, if applicable
+            if(parent) {
+                oColumn.parent = parent;
+            }
+
+            // The Column has descendants
+            if(YAHOO.lang.isArray(currentNode.children)) {
+                oColumn.children = currentNode.children;
+
+                // Determine COLSPAN value for this Column
+                var terminalChildNodes = 0;
+                var countTerminalChildNodes = function(ancestor) {
+                    var descendants = ancestor.children;
+                    // Drill down each branch and count terminal nodes
+                    for(var k=0; k<descendants.length; k++) {
+                        // Keep drilling down
+                        if(YAHOO.lang.isArray(descendants[k].children)) {
+                            countTerminalChildNodes(descendants[k]);
+                        }
+                        // Reached branch terminus
+                        else {
+                            terminalChildNodes++;
+                        }
+                    }
+                };
+                countTerminalChildNodes(currentNode);
+                oColumn._colspan = terminalChildNodes;
+
+                // Cascade certain properties to children if not defined on their own
+                var currentChildren = currentNode.children;
+                for(var k=0; k<currentChildren.length; k++) {
+                    var child = currentChildren[k];
+                    if(oColumn.className && (child.className === undefined)) {
+                        child.className = oColumn.className;
+                    }
+                    if(oColumn.editor && (child.editor === undefined)) {
+                        child.editor = oColumn.editor;
+                    }
+                    if(oColumn.editorOptions && (child.editorOptions === undefined)) {
+                        child.editorOptions = oColumn.editorOptions;
+                    }
+                    if(oColumn.formatter && (child.formatter === undefined)) {
+                        child.formatter = oColumn.formatter;
+                    }
+                    if(oColumn.resizeable && (child.resizeable === undefined)) {
+                        child.resizeable = oColumn.resizeable;
+                    }
+                    if(oColumn.sortable && (child.sortable === undefined)) {
+                        child.sortable = oColumn.sortable;
+                    }
+                    if(oColumn.width && (child.width === undefined)) {
+                        child.width = oColumn.width;
+                    }
+                    // Backward compatibility
+                    if(oColumn.type && (child.type === undefined)) {
+                        child.type = oColumn.type;
+                    }
+                    if(oColumn.type && !oColumn.formatter) {
+                        oColumn.formatter = oColumn.type;
+                    }
+                    if(oColumn.text && !YAHOO.lang.isValue(oColumn.label)) {
+                        oColumn.label = oColumn.text;
+                    }
+                    if(oColumn.parser) {
+                    }
+                    if(oColumn.sortOptions && ((oColumn.sortOptions.ascFunction) ||
+                            (oColumn.sortOptions.descFunction))) {
+                    }
+                }
+
+                // The children themselves must also be parsed for Column instances
+                if(!tree[nodeDepth+1]) {
+                    tree[nodeDepth+1] = [];
+                }
+                parseColumns(currentChildren, oColumn);
+            }
+            // This Column does not have any children
+            else {
+                oColumn._nKeyIndex = keys.length;
+                oColumn._colspan = 1;
+                keys.push(oColumn);
+            }
+
+            // Add the Column to the top-down tree
+            tree[nodeDepth].push(oColumn);
+        }
+        nodeDepth--;
+    };
+
+    // Parse out Column instances from the array of object literals
+    if(YAHOO.lang.isArray(aHeaders)) {
+        parseColumns(aHeaders);
+    }
+
+    // Determine ROWSPAN value for each Column in the tree
+    var parseTreeForRowspan = function(tree) {
+        var maxRowDepth = 1;
+        var currentRow;
+        var currentColumn;
+
+        // Calculate the max depth of descendants for this row
+        var countMaxRowDepth = function(row, tmpRowDepth) {
+            tmpRowDepth = tmpRowDepth || 1;
+
+            for(var n=0; n<row.length; n++) {
+                var col = row[n];
+                // Column has children, so keep counting
+                if(YAHOO.lang.isArray(col.children)) {
+                    tmpRowDepth++;
+                    countMaxRowDepth(col.children, tmpRowDepth);
+                    tmpRowDepth--;
+                }
+                // No children, is it the max depth?
+                else {
+                    if(tmpRowDepth > maxRowDepth) {
+                        maxRowDepth = tmpRowDepth;
+                    }
+                }
+
+            }
+        };
+
+        // Count max row depth for each row
+        for(var m=0; m<tree.length; m++) {
+            currentRow = tree[m];
+            countMaxRowDepth(currentRow);
+
+            // Assign the right ROWSPAN values to each Column in the row
+            for(var p=0; p<currentRow.length; p++) {
+                currentColumn = currentRow[p];
+                if(!YAHOO.lang.isArray(currentColumn.children)) {
+                    currentColumn._rowspan = maxRowDepth;
+                }
+                else {
+                    currentColumn._rowspan = 1;
+                }
+            }
+
+            // Reset counter for next row
+            maxRowDepth = 1;
+        }
+    };
+    parseTreeForRowspan(tree);
+
+
+
+
+
+    // Store header relationships in an array for HEADERS attribute
+    var recurseAncestorsForHeaders = function(i, oColumn) {
+        headers[i].push(oColumn._sId);
+        if(oColumn.parent) {
+            recurseAncestorsForHeaders(i, oColumn.parent);
+        }
+    };
+    for(var i=0; i<keys.length; i++) {
+        headers[i] = [];
+        recurseAncestorsForHeaders(i, keys[i]);
+        headers[i] = headers[i].reverse();
+    }
+
+    // Save to the ColumnSet instance
+    this.tree = tree;
+    this.flat = flat;
+    this.keys = keys;
+    this.headers = headers;
+
+    YAHOO.widget.ColumnSet._nCount++;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to index multiple ColumnSet instances.
+ *
+ * @property ColumnSet._nCount
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.widget.ColumnSet._nCount = 0;
+
+/**
+ * Unique instance name.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.ColumnSet.prototype._sName = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Top-down tree representation of Column hierarchy.
+ *
+ * @property tree
+ * @type YAHOO.widget.Column[]
+ */
+YAHOO.widget.ColumnSet.prototype.tree = null;
+
+/**
+ * Flattened representation of all Columns.
+ *
+ * @property flat
+ * @type YAHOO.widget.Column[]
+ * @default []
+ */
+YAHOO.widget.ColumnSet.prototype.flat = null;
+
+/**
+ * Array of Columns that map one-to-one to a table column.
+ *
+ * @property keys
+ * @type YAHOO.widget.Column[]
+ * @default []
+ */
+YAHOO.widget.ColumnSet.prototype.keys = null;
+
+/**
+ * ID index of nested parent hierarchies for HEADERS accessibility attribute.
+ *
+ * @property headers
+ * @type String[]
+ * @default []
+ */
+YAHOO.widget.ColumnSet.prototype.headers = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Public accessor to the unique name of the ColumnSet instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the ColumnSet instance.
+ */
+
+YAHOO.widget.ColumnSet.prototype.toString = function() {
+    return "ColumnSet " + this._sName;
+};
+
+/**
+ * Returns Column instance with given ID.
+ *
+ * @method getColumnById
+ * @param column {String} Column ID.
+ * @return {YAHOO.widget.Column} Column instance.
+ */
+
+YAHOO.widget.ColumnSet.prototype.getColumnById = function(column) {
+    if(YAHOO.lang.isString(column)) {
+        var allColumns = this.flat;
+        for(var i=allColumns.length-1; i>-1; i--) {
+            if(allColumns[i]._sId === column) {
+                return allColumns[i];
+            }
+        }
+    }
+    return null;
+};
+
+/**
+ * Returns Column instance with given key or ColumnSet key index.
+ *
+ * @method getColumn
+ * @param column {String | Number} Column key or ColumnSet key index.
+ * @return {YAHOO.widget.Column} Column instance.
+ */
+
+YAHOO.widget.ColumnSet.prototype.getColumn = function(column) {
+    if(YAHOO.lang.isNumber(column) && this.keys[column]) {
+        return this.keys[column];
+    }
+    else if(YAHOO.lang.isString(column)) {
+        var allColumns = this.flat;
+        var aColumns = [];
+        for(var i=0; i<allColumns.length; i++) {
+            if(allColumns[i].key === column) {
+                aColumns.push(allColumns[i]);
+            }
+        }
+        if(aColumns.length === 1) {
+            return aColumns[0];
+        }
+        else if(aColumns.length > 1) {
+            return aColumns;
+        }
+    }
+    return null;
+};
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The Column class defines and manages attributes of DataTable Columns
+ *
+ * @namespace YAHOO.widget
+ * @class Column
+ * @constructor
+ * @param oConfigs {Object} Object literal of configuration values.
+ */
+YAHOO.widget.Column = function(oConfigs) {
+    // Object literal defines Column attributes
+    if(oConfigs && (oConfigs.constructor == Object)) {
+        for(var sConfig in oConfigs) {
+            if(sConfig) {
+                this[sConfig] = oConfigs[sConfig];
+            }
+        }
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to index multiple Column instances.
+ *
+ * @property Column._nCount
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.widget.Column._nCount = 0;
+
+/**
+ * Unique instance name.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.Column.prototype._sName = null;
+
+/**
+ * Unique String identifier assigned at instantiation.
+ *
+ * @property _sId
+ * @type String
+ * @private
+ */
+YAHOO.widget.Column.prototype._sId = null;
+
+/**
+ * Reference to Column's current position index within its ColumnSet's keys array, if applicable.
+ *
+ * @property _nKeyIndex
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Column.prototype._nKeyIndex = null;
+
+/**
+ * Number of table cells the Column spans.
+ *
+ * @property _colspan
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Column.prototype._colspan = 1;
+
+/**
+ * Number of table rows the Column spans.
+ *
+ * @property _rowspan
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Column.prototype._rowspan = 1;
+
+/**
+ * Column's parent Column instance, or null.
+ *
+ * @property _parent
+ * @type YAHOO.widget.Column
+ * @private
+ */
+YAHOO.widget.Column.prototype._parent = null;
+
+/**
+ * Current offsetWidth of the Column (in pixels).
+ *
+ * @property _width
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Column.prototype._width = null;
+
+/**
+ * Minimum width the Column can support (in pixels). Value is populated only if table
+ * is fixedWidth, null otherwise.
+ *
+ * @property _minWidth
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Column.prototype._minWidth = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Associated database field, or null.
+ *
+ * @property key
+ * @type String
+ */
+YAHOO.widget.Column.prototype.key = null;
+
+/**
+ * Text or HTML for display as Column's label in the TH element.
+ *
+ * @property label
+ * @type String
+ */
+YAHOO.widget.Column.prototype.label = null;
+
+/**
+ * Column head cell ABBR for accessibility.
+ *
+ * @property abbr
+ * @type String
+ */
+YAHOO.widget.Column.prototype.abbr = null;
+
+/**
+ * Array of object literals that define children (nested headers) of a Column.
+ *
+ * @property children
+ * @type Object[]
+ */
+YAHOO.widget.Column.prototype.children = null;
+
+/**
+ * Column width.
+ *
+ * @property width
+ * @type String
+ */
+YAHOO.widget.Column.prototype.width = null;
+
+/**
+ * Custom CSS class or array of classes to be applied to every cell in the Column.
+ *
+ * @property className
+ * @type String || String[]
+ */
+YAHOO.widget.Column.prototype.className = null;
+
+/**
+ * Defines a format function.
+ *
+ * @property formatter
+ * @type String || HTMLFunction
+ */
+YAHOO.widget.Column.prototype.formatter = null;
+
+/**
+ * Defines an editor function, otherwise Column is not editable.
+ *
+ * @property editor
+ * @type String || HTMLFunction
+ */
+YAHOO.widget.Column.prototype.editor = null;
+
+/**
+ * Defines editor options for Column in an object literal of param:value pairs.
+ *
+ * @property editorOptions
+ * @type Object
+ */
+YAHOO.widget.Column.prototype.editorOptions = null;
+
+/**
+ * True if Column is resizeable, false otherwise.
+ *
+ * @property resizeable
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.Column.prototype.resizeable = false;
+
+/**
+ * True if Column is sortable, false otherwise.
+ *
+ * @property sortable
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.Column.prototype.sortable = false;
+
+/**
+ * Default sort order for Column: "asc" or "desc".
+ *
+ * @property sortOptions.defaultOrder
+ * @type String
+ * @default null
+ */
+/**
+ * Custom sort handler.
+ *
+ * @property sortOptions.sortFunction
+ * @type Function
+ * @default null
+ */
+YAHOO.widget.Column.prototype.sortOptions = null;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Public accessor to the unique name of the Column instance.
+ *
+ * @method toString
+ * @return {String} Column's unique name.
+ */
+YAHOO.widget.Column.prototype.toString = function() {
+    return this._sName;
+};
+
+/**
+ * Returns unique ID string.
+ *
+ * @method getId
+ * @return {String} Unique ID string.
+ */
+YAHOO.widget.Column.prototype.getId = function() {
+    return this._sId;
+};
+
+/**
+ * Returns unique Column key.
+ *
+ * @method getKey
+ * @return {String} Column key.
+ */
+YAHOO.widget.Column.prototype.getKey = function() {
+    return this.key;
+};
+
+/**
+ * Public accessor returns Column's current position index within its ColumnSet's keys array, if applicable.
+ *
+ * @method getKeyIndex
+ * @return {Number} Position index, or null.
+ */
+YAHOO.widget.Column.prototype.getKeyIndex = function() {
+    return this._nKeyIndex;
+};
+
+/**
+ * Public accessor returns Column's parent instance if any, or null otherwise.
+ *
+ * @method getParent
+ * @return {YAHOO.widget.Column} Column's parent instance.
+ */
+YAHOO.widget.Column.prototype.getParent = function() {
+    return this._parent;
+};
+
+/**
+ * Public accessor returns Column's calculated COLSPAN value.
+ *
+ * @method getColspan
+ * @return {Number} Column's COLSPAN value.
+ */
+YAHOO.widget.Column.prototype.getColspan = function() {
+    return this._colspan;
+};
+// Backward compatibility
+YAHOO.widget.Column.prototype.getColSpan = function() {
+    return this.getColspan();
+};
+
+/**
+ * Public accessor returns Column's calculated ROWSPAN value.
+ *
+ * @method getRowspan
+ * @return {Number} Column's ROWSPAN value.
+ */
+YAHOO.widget.Column.prototype.getRowspan = function() {
+    return this._rowspan;
+};
+
+// Backward compatibility
+YAHOO.widget.Column.prototype.getIndex = function() {
+    return this.getKeyIndex();
+};
+YAHOO.widget.Column.prototype.format = function() {
+};
+YAHOO.widget.Column.formatCheckbox = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatCheckbox(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatCurrency = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatCurrency(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatDate = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatDate(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatEmail = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatEmail(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatLink = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatLink(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatNumber = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatNumber(elCell, oRecord, oColumn, oData);
+};
+YAHOO.widget.Column.formatSelect = function(elCell, oRecord, oColumn, oData) {
+    YAHOO.widget.DataTable.formatDropdown(elCell, oRecord, oColumn, oData);
+};
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Sort static utility to support Column sorting.
+ *
+ * @namespace YAHOO.util
+ * @class Sort
+ * @static
+ */
+YAHOO.util.Sort = {
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Public methods
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Comparator function for simple case-insensitive string sorting.
+     *
+     * @method compare
+     * @param a {Object} First sort argument.
+     * @param b {Object} Second sort argument.
+     * @param desc {Boolean} True if sort direction is descending, false if
+     * sort direction is ascending.
+     */
+    compare: function(a, b, desc) {
+        if((a === null) || (typeof a == "undefined")) {
+            if((b === null) || (typeof b == "undefined")) {
+                return 0;
+            }
+            else {
+                return 1;
+            }
+        }
+        else if((b === null) || (typeof b == "undefined")) {
+            return -1;
+        }
+
+        if(a.constructor == String) {
+            a = a.toLowerCase();
+        }
+        if(b.constructor == String) {
+            b = b.toLowerCase();
+        }
+        if(a < b) {
+            return (desc) ? 1 : -1;
+        }
+        else if (a > b) {
+            return (desc) ? -1 : 1;
+        }
+        else {
+            return 0;
+        }
+    }
+};
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * ColumnResizer subclasses DragDrop to support resizeable Columns.
+ *
+ * @namespace YAHOO.util
+ * @class ColumnResizer
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param oDataTable {YAHOO.widget.DataTable} DataTable instance.
+ * @param oColumn {YAHOO.widget.Column} Column instance.
+ * @param elThead {HTMLElement} TH element reference.
+ * @param sHandleElId {String} DOM ID of the handle element that causes the resize.
+ * @param sGroup {String} Group name of related DragDrop items.
+ * @param oConfig {Object} (Optional) Object literal of config values.
+ */
+YAHOO.util.ColumnResizer = function(oDataTable, oColumn, elThead, sHandleId, sGroup, oConfig) {
+    if(oDataTable && oColumn && elThead && sHandleId) {
+        this.datatable = oDataTable;
+        this.column = oColumn;
+        this.cell = elThead;
+        this.init(sHandleId, sGroup, oConfig);
+        //this.initFrame();
+        this.setYConstraint(0,0);
+    }
+    else {
+    }
+};
+
+if(YAHOO.util.DD) {
+    YAHOO.extend(YAHOO.util.ColumnResizer, YAHOO.util.DD);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public DOM event handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Handles mousedown events on the Column resizer.
+ *
+ * @method onMouseDown
+ * @param e {string} The mousedown event
+ */
+YAHOO.util.ColumnResizer.prototype.onMouseDown = function(e) {
+    this.startWidth = this.cell.offsetWidth;
+    this.startPos = YAHOO.util.Dom.getX(this.getDragEl());
+
+    if(this.datatable.fixedWidth) {
+        var cellLabel = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_LABEL,"span",this.cell)[0];
+        this.minWidth = cellLabel.offsetWidth + 6;
+        var sib = this.cell.nextSibling;
+        var sibCellLabel = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_LABEL,"span",sib)[0];
+        this.sibMinWidth = sibCellLabel.offsetWidth + 6;
+//!!
+        var left = ((this.startWidth - this.minWidth) < 0) ? 0 : (this.startWidth - this.minWidth);
+        var right = ((sib.offsetWidth - this.sibMinWidth) < 0) ? 0 : (sib.offsetWidth - this.sibMinWidth);
+        this.setXConstraint(left, right);
+    }
+
+};
+
+/**
+ * Handles mouseup events on the Column resizer.
+ *
+ * @method onMouseUp
+ * @param e {string} The mouseup event
+ */
+YAHOO.util.ColumnResizer.prototype.onMouseUp = function(e) {
+    //TODO: replace the resizer where it belongs:
+    var resizeStyle = YAHOO.util.Dom.get(this.handleElId).style;
+    resizeStyle.left = "auto";
+    resizeStyle.right = 0;
+    resizeStyle.marginRight = "-6px";
+    resizeStyle.width = "6px";
+    //.yui-dt-headresizer {position:absolute;margin-right:-6px;right:0;bottom:0;width:6px;height:100%;cursor:w-resize;cursor:col-resize;}
+
+
+    //var cells = this.datatable._elTable.tHead.rows[this.datatable._elTable.tHead.rows.length-1].cells;
+    //for(var i=0; i<cells.length; i++) {
+        //cells[i].style.width = "5px";
+    //}
+
+    //TODO: set new ColumnSet width values
+    this.datatable.fireEvent("columnResizeEvent", {column:this.column,target:this.cell});
+};
+
+/**
+ * Handles drag events on the Column resizer.
+ *
+ * @method onDrag
+ * @param e {string} The drag event
+ */
+YAHOO.util.ColumnResizer.prototype.onDrag = function(e) {
+    try {
+        var newPos = YAHOO.util.Dom.getX(this.getDragEl());
+        var offsetX = newPos - this.startPos;
+        var newWidth = this.startWidth + offsetX;
+
+        if(newWidth < this.minWidth) {
+            newWidth = this.minWidth;
+        }
+
+        // Resize the Column
+        var oDataTable = this.datatable;
+        var elCell = this.cell;
+
+
+        // Resize the other Columns
+        if(oDataTable.fixedWidth) {
+            // Moving right or left?
+            var sib = elCell.nextSibling;
+            //var sibIndex = elCell.index + 1;
+            var sibnewwidth = sib.offsetWidth - offsetX;
+            if(sibnewwidth < this.sibMinWidth) {
+                sibnewwidth = this.sibMinWidth;
+            }
+
+            //TODO: how else to cycle through all the Columns without having to use an index property?
+            for(var i=0; i<oDataTable._oColumnSet.length; i++) {
+                //if((i != elCell.index) &&  (i!=sibIndex)) {
+                //    YAHOO.util.Dom.get(oDataTable._oColumnSet.keys[i].id).style.width = oDataTable._oColumnSet.keys[i].width + "px";
+                //}
+            }
+            sib.style.width = sibnewwidth;
+            elCell.style.width = newWidth + "px";
+            //oDataTable._oColumnSet.flat[sibIndex].width = sibnewwidth;
+            //oDataTable._oColumnSet.flat[elCell.index].width = newWidth;
+
+        }
+        else {
+            elCell.style.width = newWidth + "px";
+        }
+    }
+    catch(e) {
+    }
+};
+
+
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * A RecordSet defines and manages a set of Records.
+ *
+ * @namespace YAHOO.widget
+ * @class RecordSet
+ * @param data {Object || Object[]} An object literal or an array of data.
+ * @constructor
+ */
+YAHOO.widget.RecordSet = function(data) {
+    // Internal variables
+    this._sName = "RecordSet instance" + YAHOO.widget.RecordSet._nCount;
+    YAHOO.widget.RecordSet._nCount++;
+    this._records = [];
+    this._length = 0;
+    
+    if(data) {
+        if(YAHOO.lang.isArray(data)) {
+            this.addRecords(data);
+        }
+        else if(data.constructor == Object) {
+            this.addRecord(data);
+        }
+    }
+
+    /**
+     * Fired when a new Record is added to the RecordSet.
+     *
+     * @event recordAddEvent
+     * @param oArgs.record {YAHOO.widget.Record} The Record instance.
+     * @param oArgs.data {Object} Data added.
+     */
+    this.createEvent("recordAddEvent");
+
+    /**
+     * Fired when multiple Records are added to the RecordSet at once.
+     *
+     * @event recordsAddEvent
+     * @param oArgs.records {YAHOO.widget.Record[]} An array of Record instances.
+     * @param oArgs.data {Object[]} Data added.
+     */
+    this.createEvent("recordsAddEvent");
+
+    /**
+     * Fired when a Record is updated with new data.
+     *
+     * @event recordUpdateEvent
+     * @param oArgs.record {YAHOO.widget.Record} The Record instance.
+     * @param oArgs.newData {Object} New data.
+     * @param oArgs.oldData {Object} Old data.
+     */
+    this.createEvent("recordUpdateEvent");
+    
+    /**
+     * Fired when a Record is deleted from the RecordSet.
+     *
+     * @event recordDeleteEvent
+     * @param oArgs.data {Object} A copy of the data held by the Record,
+     * or an array of data object literals if multiple Records were deleted at once.
+     * @param oArgs.index {Object} Index of the deleted Record.
+     */
+    this.createEvent("recordDeleteEvent");
+
+    /**
+     * Fired when multiple Records are deleted from the RecordSet at once.
+     *
+     * @event recordsDeleteEvent
+     * @param oArgs.data {Object[]} An array of data object literals copied
+     * from the Records.
+     * @param oArgs.index {Object} Index of the first deleted Record.
+     */
+    this.createEvent("recordsDeleteEvent");
+    
+    /**
+     * Fired when all Records are deleted from the RecordSet at once.
+     *
+     * @event resetEvent
+     */
+    this.createEvent("resetEvent");
+
+    /**
+     * Fired when a Record Key is updated with new data.
+     *
+     * @event keyUpdateEvent
+     * @param oArgs.record {YAHOO.widget.Record} The Record instance.
+     * @param oArgs.key {String} The updated key.
+     * @param oArgs.newData {Object} New data.
+     * @param oArgs.oldData {Object} Old data.
+     *
+     */
+    this.createEvent("keyUpdateEvent");
+
+};
+
+if(YAHOO.util.EventProvider) {
+    YAHOO.augment(YAHOO.widget.RecordSet, YAHOO.util.EventProvider);
+}
+else {
+}
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * Internal class variable to name multiple Recordset instances.
+ *
+ * @property RecordSet._nCount
+ * @type Number
+ * @private
+ * @static
+ */
+YAHOO.widget.RecordSet._nCount = 0;
+
+/**
+ * Unique instance name.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.RecordSet.prototype._sName = null;
+
+/**
+ * Internal counter of how many Records are in the RecordSet.
+ *
+ * @property _length
+ * @type Number
+ * @private
+ */
+YAHOO.widget.RecordSet.prototype._length = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Adds one Record to the RecordSet at the given index. If index is null,
+ * then adds the Record to the end of the RecordSet.
+ *
+ * @method _addRecord
+ * @param oData {Object} An object literal of data.
+ * @param index {Number} (optional) Position index.
+ * @return {YAHOO.widget.Record} A Record instance.
+ * @private
+ */
+YAHOO.widget.RecordSet.prototype._addRecord = function(oData, index) {
+    var oRecord = new YAHOO.widget.Record(oData);
+    
+    if(YAHOO.lang.isNumber(index) && (index > -1)) {
+        this._records.splice(index,0,oRecord);
+    }
+    else {
+        index = this.getLength();
+        this._records.push(oRecord);
+    }
+    this._length++;
+    return oRecord;
+};
+
+/**
+ * Deletes Records from the RecordSet at the given index. If range is null,
+ * then only one Record is deleted.
+ *
+ * @method _deleteRecord
+ * @param index {Number} Position index.
+ * @param range {Number} (optional) How many Records to delete
+ * @private
+ */
+YAHOO.widget.RecordSet.prototype._deleteRecord = function(index, range) {
+    if(!YAHOO.lang.isNumber(range) || (range < 0)) {
+        range = 1;
+    }
+    this._records.splice(index, range);
+    this._length = this._length - range;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Public accessor to the unique name of the RecordSet instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the RecordSet instance.
+ */
+YAHOO.widget.RecordSet.prototype.toString = function() {
+    return this._sName;
+};
+
+/**
+ * Returns the number of Records held in the RecordSet.
+ *
+ * @method getLength
+ * @return {Number} Number of records in the RecordSet.
+ */
+YAHOO.widget.RecordSet.prototype.getLength = function() {
+        return this._length;
+};
+
+/**
+ * Returns Record by ID or RecordSet position index.
+ *
+ * @method getRecord
+ * @param record {YAHOO.widget.Record | Number | String} Record instance,
+ * RecordSet position index, or Record ID.
+ * @return {YAHOO.widget.Record} Record object.
+ */
+YAHOO.widget.RecordSet.prototype.getRecord = function(record) {
+    var i;
+    if(record instanceof YAHOO.widget.Record) {
+        for(i=0; i<this._records.length; i++) {
+            if(this._records[i]._sId === record._sId) {
+                return record;
+            }
+        }
+    }
+    else if(YAHOO.lang.isNumber(record)) {
+        if((record > -1) && (record < this.getLength())) {
+            return this._records[record];
+        }
+    }
+    else if(YAHOO.lang.isString(record)) {
+        for(i=0; i<this._records.length; i++) {
+            if(this._records[i]._sId === record) {
+                return this._records[i];
+            }
+        }
+    }
+    // Not a valid Record for this RecordSet
+    return null;
+
+};
+
+/**
+ * Returns an array of Records from the RecordSet.
+ *
+ * @method getRecords
+ * @param index {Number} (optional) Recordset position index of which Record to
+ * start at.
+ * @param range {Number} (optional) Number of Records to get.
+ * @return {YAHOO.widget.Record[]} Array of Records starting at given index and
+ * length equal to given range. If index is not given, all Records are returned.
+ */
+YAHOO.widget.RecordSet.prototype.getRecords = function(index, range) {
+    if(!YAHOO.lang.isNumber(index)) {
+        return this._records;
+    }
+    if(!YAHOO.lang.isNumber(range)) {
+        return this._records.slice(index);
+    }
+    return this._records.slice(index, index+range);
+};
+
+/**
+ * Returns current position index for the given Record.
+ *
+ * @method getRecordIndex
+ * @param oRecord {YAHOO.widget.Record} Record instance.
+ * @return {Number} Record's RecordSet position index.
+ */
+
+YAHOO.widget.RecordSet.prototype.getRecordIndex = function(oRecord) {
+    if(oRecord) {
+        for(var i=this._records.length-1; i>-1; i--) {
+            if(oRecord.getId() === this._records[i].getId()) {
+                return i;
+            }
+        }
+    }
+    return null;
+
+};
+
+/**
+ * Adds one Record to the RecordSet at the given index. If index is null,
+ * then adds the Record to the end of the RecordSet.
+ *
+ * @method addRecord
+ * @param oData {Object} An object literal of data.
+ * @param index {Number} (optional) Position index.
+ * @return {YAHOO.widget.Record} A Record instance.
+ */
+YAHOO.widget.RecordSet.prototype.addRecord = function(oData, index) {
+    if(oData && (oData.constructor == Object)) {
+        var oRecord = this._addRecord(oData, index);
+        this.fireEvent("recordAddEvent",{record:oRecord,data:oData});
+        return oRecord;
+    }
+    else {
+        return null;
+    }
+};
+
+/**
+ * Adds multiple Records at once to the RecordSet at the given index with the
+ * given data. If index is null, then the new Records are added to the end of
+ * the RecordSet.
+ *
+ * @method addRecords
+ * @param aData {Object[]} An array of object literal data.
+ * @param index {Number} (optional) Position index.
+ * @return {YAHOO.widget.Record[]} An array of Record instances.
+ */
+YAHOO.widget.RecordSet.prototype.addRecords = function(aData, index) {
+    if(YAHOO.lang.isArray(aData)) {
+        var newRecords = [];
+        // Can't go backwards bc we need to preserve order
+        for(var i=0; i<aData.length; i++) {
+            if(aData[i] && (aData[i].constructor == Object)) {
+                var record = this._addRecord(aData[i], index);
+                newRecords.push(record);
+            }
+       }
+        this.fireEvent("recordsAddEvent",{records:newRecords,data:aData});
+       return newRecords;
+    }
+    else if(aData && (aData.constructor == Object)) {
+        var oRecord = this._addRecord(aData);
+        this.fireEvent("recordsAddEvent",{records:[oRecord],data:aData});
+        return oRecord;
+    }
+    else {
+    }
+};
+
+/**
+ * Updates given Record with given data.
+ *
+ * @method updateRecord
+ * @param record {YAHOO.widget.Record | Number | String} A Record instance,
+ * a RecordSet position index, or a Record ID.
+ * @param oData {Object) Object literal of new data.
+ * @return {YAHOO.widget.Record} Updated Record, or null.
+ */
+YAHOO.widget.RecordSet.prototype.updateRecord = function(record, oData) {
+    var oRecord = this.getRecord(record);
+    if(oRecord && oData && (oData.constructor == Object)) {
+        // Copy data from the Record for the event that gets fired later
+        var oldData = {};
+        for(var key in oRecord._oData) {
+            oldData[key] = oRecord._oData[key];
+        }
+        oRecord._oData = oData;
+        this.fireEvent("recordUpdateEvent",{record:oRecord,newData:oData,oldData:oldData});
+        return oRecord;
+    }
+    else {
+        return null;
+    }
+};
+
+/**
+ * Updates given Record at given key with given data.
+ *
+ * @method updateKey
+ * @param record {YAHOO.widget.Record | Number | String} A Record instance,
+ * a RecordSet position index, or a Record ID.
+ * @param sKey {String} Key name.
+ * @param oData {Object) New data.
+ */
+YAHOO.widget.RecordSet.prototype.updateKey = function(record, sKey, oData) {
+    var oRecord = this.getRecord(record);
+    if(oRecord) {
+        var oldData = null;
+        var keyValue = oRecord._oData[sKey];
+        // Copy data from the Record for the event that gets fired later
+        if(keyValue && keyValue.constructor == Object) {
+            oldData = {};
+            for(var key in keyValue) {
+                oldData[key] = keyValue[key];
+            }
+        }
+        // Copy by value
+        else {
+            oldData = keyValue;
+        }
+
+        oRecord._oData[sKey] = oData;
+        this.fireEvent("keyUpdateEvent",{record:oRecord,key:sKey,newData:oData,oldData:oldData});
+    }
+    else {
+    }
+};
+
+/**
+ * Replaces all Records in RecordSet with new data.
+ *
+ * @method replaceRecords
+ * @param data {Object || Object[]} An object literal of data or an array of
+ * object literal data.
+ * @return {YAHOO.widget.Record || YAHOO.widget.Record[]} A Record instance or
+ * an array of Records.
+ */
+YAHOO.widget.RecordSet.prototype.replaceRecords = function(data) {
+    this.reset();
+    return this.addRecords(data);
+};
+
+/**
+ * Sorts all Records by given function. Records keep their unique IDs but will
+ * have new RecordSet position indexes.
+ *
+ * @method sortRecords
+ * @param fnSort {Function} Reference to a sort function.
+ * @param desc {Boolean} True if sort direction is descending, false if sort
+ * direction is ascending.
+ * @return {YAHOO.widget.Record[]} Sorted array of Records.
+ */
+YAHOO.widget.RecordSet.prototype.sortRecords = function(fnSort, desc) {
+    return this._records.sort(function(a, b) {return fnSort(a, b, desc);});
+};
+
+
+/**
+ * Removes the Record at the given position index from the RecordSet. If a range
+ * is also provided, removes that many Records, starting from the index. Length
+ * of RecordSet is correspondingly shortened.
+ *
+ * @method deleteRecord
+ * @param index {Number} Record's RecordSet position index.
+ * @param range {Number} (optional) How many Records to delete.
+ * @return {Object} A copy of the data held by the deleted Record.
+ */
+YAHOO.widget.RecordSet.prototype.deleteRecord = function(index) {
+    if(YAHOO.lang.isNumber(index) && (index > -1) && (index < this.getLength())) {
+        // Copy data from the Record for the event that gets fired later
+        var oRecordData = this.getRecord(index).getData();
+        var oData = {};
+        for(var key in oRecordData) {
+            oData[key] = oRecordData[key];
+        }
+        
+        this._deleteRecord(index);
+        this.fireEvent("recordDeleteEvent",{data:oData,index:index});
+        return oData;
+    }
+    else {
+        return null;
+    }
+};
+
+/**
+ * Removes the Record at the given position index from the RecordSet. If a range
+ * is also provided, removes that many Records, starting from the index. Length
+ * of RecordSet is correspondingly shortened.
+ *
+ * @method deleteRecords
+ * @param index {Number} Record's RecordSet position index.
+ * @param range {Number} (optional) How many Records to delete.
+ */
+YAHOO.widget.RecordSet.prototype.deleteRecords = function(index, range) {
+    if(!YAHOO.lang.isNumber(range)) {
+        range = 1;
+    }
+    if(YAHOO.lang.isNumber(index) && (index > -1) && (index < this.getLength())) {
+        var recordsToDelete = this.getRecords(index, range);
+        // Copy data from each Record for the event that gets fired later
+        var deletedData = [];
+        for(var i=0; i<recordsToDelete.length; i++) {
+            var oData = {};
+            for(var key in recordsToDelete[i]) {
+                oData[key] = recordsToDelete[i][key];
+            }
+            deletedData.push(oData);
+        }
+        this._deleteRecord(index, range);
+
+        this.fireEvent("recordsDeleteEvent",{data:deletedData,index:index});
+
+    }
+    else {
+    }
+};
+
+/**
+ * Deletes all Records from the RecordSet.
+ *
+ * @method reset
+ */
+YAHOO.widget.RecordSet.prototype.reset = function() {
+    this._records = [];
+    this._length = 0;
+    this.fireEvent("resetEvent");
+};
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The Record class defines a DataTable record.
+ *
+ * @namespace YAHOO.widget
+ * @class Record
+ * @constructor
+ * @param oConfigs {Object} (optional) Object literal of key/value pairs.
+ */
+YAHOO.widget.Record = function(oLiteral) {
+    this._sId = YAHOO.widget.Record._nCount + "";
+    YAHOO.widget.Record._nCount++;
+    this._oData = {};
+    if(oLiteral && (oLiteral.constructor == Object)) {
+        for(var sKey in oLiteral) {
+            this._oData[sKey] = oLiteral[sKey];
+        }
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class variable to give unique IDs to Record instances.
+ *
+ * @property Record._nCount
+ * @type Number
+ * @private
+ */
+YAHOO.widget.Record._nCount = 0;
+
+/**
+ * Immutable unique ID assigned at instantiation. Remains constant while a
+ * Record's position index can change from sorting.
+ *
+ * @property _sId
+ * @type String
+ * @private
+ */
+YAHOO.widget.Record.prototype._sId = null;
+
+/**
+ * Holds data for the Record in an object literal.
+ *
+ * @property _oData
+ * @type Object
+ * @private
+ */
+YAHOO.widget.Record.prototype._oData = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Returns unique ID assigned at instantiation.
+ *
+ * @method getId
+ * @return String
+ */
+YAHOO.widget.Record.prototype.getId = function() {
+    return this._sId;
+};
+
+/**
+ * Returns data for the Record for a key if given, or the entire object
+ * literal otherwise.
+ *
+ * @method getData
+ * @param sKey {String} (Optional) The key to retrieve a single data value.
+ * @return Object
+ */
+YAHOO.widget.Record.prototype.getData = function(sKey) {
+    if(YAHOO.lang.isString(sKey)) {
+        return this._oData[sKey];
+    }
+    else {
+        return this._oData;
+    }
+};
+
+
+YAHOO.register("datatable", YAHOO.widget.DataTable, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/dom.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/dom.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/dom.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1217 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The dom module provides helper methods for manipulating Dom elements.
+ * @module dom
+ *
+ */
+
+(function() {
+    var Y = YAHOO.util,     // internal shorthand
+        getStyle,           // for load time browser branching
+        setStyle,           // ditto
+        id_counter = 0,     // for use with generateId
+        propertyCache = {}, // for faster hyphen converts
+        reClassNameCache = {}; // cache regexes for className
+    
+    // brower detection
+    var isOpera = YAHOO.env.ua.opera,
+        isSafari = YAHOO.env.ua.webkit, 
+        isGecko = YAHOO.env.ua.gecko,
+        isIE = YAHOO.env.ua.ie; 
+    
+    // regex cache
+    var patterns = {
+        HYPHEN: /(-[a-z])/i, // to normalize get/setStyle
+        ROOT_TAG: /^body|html$/i // body for quirks mode, html for standards
+    };
+
+    var toCamel = function(property) {
+        if ( !patterns.HYPHEN.test(property) ) {
+            return property; // no hyphens
+        }
+        
+        if (propertyCache[property]) { // already converted
+            return propertyCache[property];
+        }
+       
+        var converted = property;
+ 
+        while( patterns.HYPHEN.exec(converted) ) {
+            converted = converted.replace(RegExp.$1,
+                    RegExp.$1.substr(1).toUpperCase());
+        }
+        
+        propertyCache[property] = converted;
+        return converted;
+        //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+    };
+    
+    var getClassRegEx = function(className) {
+        var re = reClassNameCache[className];
+        if (!re) {
+            re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+            reClassNameCache[className] = re;
+        }
+        return re;
+    };
+
+    // branching at load instead of runtime
+    if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
+        getStyle = function(el, property) {
+            var value = null;
+            
+            if (property == 'float') { // fix reserved word
+                property = 'cssFloat';
+            }
+
+            var computed = document.defaultView.getComputedStyle(el, '');
+            if (computed) { // test computed before touching for safari
+                value = computed[toCamel(property)];
+            }
+            
+            return el.style[property] || value;
+        };
+    } else if (document.documentElement.currentStyle && isIE) { // IE method
+        getStyle = function(el, property) {                         
+            switch( toCamel(property) ) {
+                case 'opacity' :// IE opacity uses filter
+                    var val = 100;
+                    try { // will error if no DXImageTransform
+                        val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
+
+                    } catch(e) {
+                        try { // make sure its in the document
+                            val = el.filters('alpha').opacity;
+                        } catch(e) {
+                        }
+                    }
+                    return val / 100;
+                case 'float': // fix reserved word
+                    property = 'styleFloat'; // fall through
+                default: 
+                    // test currentStyle before touching
+                    var value = el.currentStyle ? el.currentStyle[property] : null;
+                    return ( el.style[property] || value );
+            }
+        };
+    } else { // default to inline only
+        getStyle = function(el, property) { return el.style[property]; };
+    }
+    
+    if (isIE) {
+        setStyle = function(el, property, val) {
+            switch (property) {
+                case 'opacity':
+                    if ( YAHOO.lang.isString(el.style.filter) ) { // in case not appended
+                        el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+                        
+                        if (!el.currentStyle || !el.currentStyle.hasLayout) {
+                            el.style.zoom = 1; // when no layout or cant tell
+                        }
+                    }
+                    break;
+                case 'float':
+                    property = 'styleFloat';
+                default:
+                el.style[property] = val;
+            }
+        };
+    } else {
+        setStyle = function(el, property, val) {
+            if (property == 'float') {
+                property = 'cssFloat';
+            }
+            el.style[property] = val;
+        };
+    }
+    
+    var testElement = function(node, method) {
+        return node && node.nodeType == 1 && ( !method || method(node) );
+    };
+
+    /**
+     * Provides helper methods for DOM elements.
+     * @namespace YAHOO.util
+     * @class Dom
+     */
+    YAHOO.util.Dom = {
+        /**
+         * Returns an HTMLElement reference.
+         * @method get
+         * @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.
+         * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
+         */
+        get: function(el) {
+            if (el && (el.tagName || el.item)) { // HTMLElement, or HTMLCollection
+                return el;
+            }
+
+            if (YAHOO.lang.isString(el) || !el) { // HTMLElement or null
+                return document.getElementById(el);
+            }
+            
+            if (el.length !== undefined) { // array-like 
+                var c = [];
+                for (var i = 0, len = el.length; i < len; ++i) {
+                    c[c.length] = Y.Dom.get(el[i]);
+                }
+                
+                return c;
+            }
+
+            return el; // some other object, just pass it back
+        },
+    
+        /**
+         * Normalizes currentStyle and ComputedStyle.
+         * @method getStyle
+         * @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.
+         * @param {String} property The style property whose value is returned.
+         * @return {String | Array} The current value of the style property for the element(s).
+         */
+        getStyle: function(el, property) {
+            property = toCamel(property);
+            
+            var f = function(element) {
+                return getStyle(element, property);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.
+         * @method setStyle
+         * @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.
+         * @param {String} property The style property to be set.
+         * @param {String} val The value to apply to the given property.
+         */
+        setStyle: function(el, property, val) {
+            property = toCamel(property);
+            
+            var f = function(element) {
+                setStyle(element, property, val);
+                
+            };
+            
+            Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * 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).
+         * @method getXY
+         * @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
+         * @return {Array} The XY position of the element(s)
+         */
+        getXY: function(el) {
+            var f = function(el) {
+    
+            // has to be part of document to have pageXY
+                if ( (el.parentNode === null || el.offsetParent === null ||
+                        this.getStyle(el, 'display') == 'none') && el != document.body) {
+                    return false;
+                }
+                
+                var parentNode = null;
+                var pos = [];
+                var box;
+                var doc = el.ownerDocument; 
+
+                if (el.getBoundingClientRect) { // IE
+                    box = el.getBoundingClientRect();
+                    return [box.left + Y.Dom.getDocumentScrollLeft(el.ownerDocument), box.top + Y.Dom.getDocumentScrollTop(el.ownerDocument)];
+                }
+                else { // safari, opera, & gecko
+                    pos = [el.offsetLeft, el.offsetTop];
+                    parentNode = el.offsetParent;
+
+                    // safari: if el is abs or any parent is abs, subtract body offsets
+                    var hasAbs = this.getStyle(el, 'position') == 'absolute';
+
+                    if (parentNode != el) {
+                        while (parentNode) {
+                            pos[0] += parentNode.offsetLeft;
+                            pos[1] += parentNode.offsetTop;
+                            if (isSafari && !hasAbs && 
+                                    this.getStyle(parentNode,'position') == 'absolute' ) {
+                                hasAbs = true; // we need to offset if any parent is absolutely positioned
+                            }
+                            parentNode = parentNode.offsetParent;
+                        }
+                    }
+
+                    if (isSafari && hasAbs) { //safari doubles in this case
+                        pos[0] -= el.ownerDocument.body.offsetLeft;
+                        pos[1] -= el.ownerDocument.body.offsetTop;
+                    } 
+                }
+                
+                parentNode = el.parentNode;
+
+                // account for any scrolled ancestors
+                while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) ) 
+                {
+                   // work around opera inline/table scrollLeft/Top bug
+                   if (Y.Dom.getStyle(parentNode, 'display').search(/^inline|table-row.*$/i)) { 
+                        pos[0] -= parentNode.scrollLeft;
+                        pos[1] -= parentNode.scrollTop;
+                    }
+                    
+                    parentNode = parentNode.parentNode; 
+                }
+       
+                
+                return pos;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * 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).
+         * @method getX
+         * @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
+         * @return {Number | Array} The X position of the element(s)
+         */
+        getX: function(el) {
+            var f = function(el) {
+                return Y.Dom.getXY(el)[0];
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * 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).
+         * @method getY
+         * @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
+         * @return {Number | Array} The Y position of the element(s)
+         */
+        getY: function(el) {
+            var f = function(el) {
+                return Y.Dom.getXY(el)[1];
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setXY
+         * @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
+         * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+         * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+         */
+        setXY: function(el, pos, noRetry) {
+            var f = function(el) {
+                var style_pos = this.getStyle(el, 'position');
+                if (style_pos == 'static') { // default to relative
+                    this.setStyle(el, 'position', 'relative');
+                    style_pos = 'relative';
+                }
+
+                var pageXY = this.getXY(el);
+                if (pageXY === false) { // has to be part of doc to have pageXY
+                    return false; 
+                }
+                
+                var delta = [ // assuming pixels; if not we will have to retry
+                    parseInt( this.getStyle(el, 'left'), 10 ),
+                    parseInt( this.getStyle(el, 'top'), 10 )
+                ];
+            
+                if ( isNaN(delta[0]) ) {// in case of 'auto'
+                    delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+                } 
+                if ( isNaN(delta[1]) ) { // in case of 'auto'
+                    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'; }
+              
+                if (!noRetry) {
+                    var newXY = this.getXY(el);
+
+                    // if retry is true, try one more time if we miss 
+                   if ( (pos[0] !== null && newXY[0] != pos[0]) || 
+                        (pos[1] !== null && newXY[1] != pos[1]) ) {
+                       this.setXY(el, pos, true);
+                   }
+                }        
+        
+            };
+            
+            Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setX
+         * @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.
+         * @param {Int} x The value to use as the X coordinate for the element(s).
+         */
+        setX: function(el, x) {
+            Y.Dom.setXY(el, [x, null]);
+        },
+        
+        /**
+         * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @method setY
+         * @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.
+         * @param {Int} x To use as the Y coordinate for the element(s).
+         */
+        setY: function(el, y) {
+            Y.Dom.setXY(el, [null, y]);
+        },
+        
+        /**
+         * Returns the region position of the given element.
+         * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+         * @method getRegion
+         * @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.
+         * @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+         */
+        getRegion: function(el) {
+            var f = function(el) {
+                if ( (el.parentNode === null || el.offsetParent === null ||
+                        this.getStyle(el, 'display') == 'none') && el != document.body) {
+                    return false;
+                }
+
+                var region = Y.Region.getRegion(el);
+                return region;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Returns the width of the client (viewport).
+         * @method getClientWidth
+         * @deprecated Now using getViewportWidth.  This interface left intact for back compat.
+         * @return {Int} The width of the viewable area of the page.
+         */
+        getClientWidth: function() {
+            return Y.Dom.getViewportWidth();
+        },
+        
+        /**
+         * Returns the height of the client (viewport).
+         * @method getClientHeight
+         * @deprecated Now using getViewportHeight.  This interface left intact for back compat.
+         * @return {Int} The height of the viewable area of the page.
+         */
+        getClientHeight: function() {
+            return Y.Dom.getViewportHeight();
+        },
+
+        /**
+         * Returns a array of HTMLElements with the given class.
+         * For optimized performance, include a tag and/or root node when possible.
+         * @method getElementsByClassName
+         * @param {String} className The class name to match against
+         * @param {String} tag (optional) The tag name of the elements being collected
+         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point 
+         * @param {Function} apply (optional) A function to apply to each element when found 
+         * @return {Array} An array of elements that have the given class name
+         */
+        getElementsByClassName: function(className, tag, root, apply) {
+            tag = tag || '*';
+            root = (root) ? Y.Dom.get(root) : null || document; 
+            if (!root) {
+                return [];
+            }
+
+            var nodes = [],
+                elements = root.getElementsByTagName(tag),
+                re = getClassRegEx(className);
+
+            for (var i = 0, len = elements.length; i < len; ++i) {
+                if ( re.test(elements[i].className) ) {
+                    nodes[nodes.length] = elements[i];
+                    if (apply) {
+                        apply.call(elements[i], elements[i]);
+                    }
+                }
+            }
+            
+            return nodes;
+        },
+
+        /**
+         * Determines whether an HTMLElement has the given className.
+         * @method hasClass
+         * @param {String | HTMLElement | Array} el The element or collection to test
+         * @param {String} className the class name to search for
+         * @return {Boolean | Array} A boolean value or array of boolean values
+         */
+        hasClass: function(el, className) {
+            var re = getClassRegEx(className);
+
+            var f = function(el) {
+                return re.test(el.className);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Adds a class name to a given element or collection of elements.
+         * @method addClass         
+         * @param {String | HTMLElement | Array} el The element or collection to add the class to
+         * @param {String} className the class name to add to the class attribute
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        addClass: function(el, className) {
+            var f = function(el) {
+                if (this.hasClass(el, className)) {
+                    return false; // already present
+                }
+                
+                
+                el.className = YAHOO.lang.trim([el.className, className].join(' '));
+                return true;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+    
+        /**
+         * Removes a class name from a given element or collection of elements.
+         * @method removeClass         
+         * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+         * @param {String} className the class name to remove from the class attribute
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        removeClass: function(el, className) {
+            var re = getClassRegEx(className);
+            
+            var f = function(el) {
+                if (!this.hasClass(el, className)) {
+                    return false; // not present
+                }                 
+
+                
+                var c = el.className;
+                el.className = c.replace(re, ' ');
+                if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+                    this.removeClass(el, className);
+                }
+
+                el.className = YAHOO.lang.trim(el.className); // remove any trailing spaces
+                return true;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Replace a class with another class for a given element or collection of elements.
+         * If no oldClassName is present, the newClassName is simply added.
+         * @method replaceClass  
+         * @param {String | HTMLElement | Array} el The element or collection to remove the class from
+         * @param {String} oldClassName the class name to be replaced
+         * @param {String} newClassName the class name that will be replacing the old class name
+         * @return {Boolean | Array} A pass/fail boolean or array of booleans
+         */
+        replaceClass: function(el, oldClassName, newClassName) {
+            if (!newClassName || oldClassName === newClassName) { // avoid infinite loop
+                return false;
+            }
+            
+            var re = getClassRegEx(oldClassName);
+
+            var f = function(el) {
+            
+                if ( !this.hasClass(el, oldClassName) ) {
+                    this.addClass(el, newClassName); // just add it if nothing to replace
+                    return true; // NOTE: return
+                }
+            
+                el.className = el.className.replace(re, ' ' + newClassName + ' ');
+
+                if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+                    this.replaceClass(el, oldClassName, newClassName);
+                }
+
+                el.className = YAHOO.lang.trim(el.className); // remove any trailing spaces
+                return true;
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Returns an ID and applies it to the element "el", if provided.
+         * @method generateId  
+         * @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).
+         * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
+         * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+         */
+        generateId: function(el, prefix) {
+            prefix = prefix || 'yui-gen';
+
+            var f = function(el) {
+                if (el && el.id) { // do not override existing ID
+                    return el.id;
+                } 
+
+                var id = prefix + id_counter++;
+
+                if (el) {
+                    el.id = id;
+                }
+                
+                return id;
+            };
+
+            // batch fails when no element, so just generate and return single ID
+            return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
+        },
+        
+        /**
+         * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
+         * @method isAncestor
+         * @param {String | HTMLElement} haystack The possible ancestor
+         * @param {String | HTMLElement} needle The possible descendent
+         * @return {Boolean} Whether or not the haystack is an ancestor of needle
+         */
+        isAncestor: function(haystack, needle) {
+            haystack = Y.Dom.get(haystack);
+            if (!haystack || !needle) { return false; }
+            
+            var f = function(node) {
+                if (haystack.contains && node.nodeType && !isSafari) { // safari contains is broken
+                    return haystack.contains(node);
+                }
+                else if ( haystack.compareDocumentPosition && node.nodeType ) {
+                    return !!(haystack.compareDocumentPosition(node) & 16);
+                } else if (node.nodeType) {
+                    // fallback to crawling up (safari)
+                    return !!this.getAncestorBy(node, function(el) {
+                        return el == haystack; 
+                    }); 
+                }
+                return false;
+            };
+            
+            return Y.Dom.batch(needle, f, Y.Dom, true);      
+        },
+        
+        /**
+         * Determines whether an HTMLElement is present in the current document.
+         * @method inDocument         
+         * @param {String | HTMLElement} el The element to search for
+         * @return {Boolean} Whether or not the element is present in the current document
+         */
+        inDocument: function(el) {
+            var f = function(el) { // safari contains fails for body so crawl up
+                if (isSafari) {
+                    while (el = el.parentNode) { // note assignment
+                        if (el == document.documentElement) {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+                return this.isAncestor(document.documentElement, el);
+            };
+            
+            return Y.Dom.batch(el, f, Y.Dom, true);
+        },
+        
+        /**
+         * Returns a array of HTMLElements that pass the test applied by supplied boolean method.
+         * For optimized performance, include a tag and/or root node when possible.
+         * @method getElementsBy
+         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+         * @param {String} tag (optional) The tag name of the elements being collected
+         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point 
+         * @param {Function} apply (optional) A function to apply to each element when found 
+         * @return {Array} Array of HTMLElements
+         */
+        getElementsBy: function(method, tag, root, apply) {
+            tag = tag || '*';
+            root = (root) ? Y.Dom.get(root) : null || document; 
+
+            if (!root) {
+                return [];
+            }
+
+            var nodes = [],
+                elements = root.getElementsByTagName(tag);
+            
+            for (var i = 0, len = elements.length; i < len; ++i) {
+                if ( method(elements[i]) ) {
+                    nodes[nodes.length] = elements[i];
+                    if (apply) {
+                        apply(elements[i]);
+                    }
+                }
+            }
+
+            
+            return nodes;
+        },
+        
+        /**
+         * Runs the supplied method against each item in the Collection/Array.
+         * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
+         * @method batch
+         * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
+         * @param {Function} method The method to apply to the element(s)
+         * @param {Any} o (optional) An optional arg that is passed to the supplied method
+         * @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
+         * @return {Any | Array} The return value(s) from the supplied method
+         */
+        batch: function(el, method, o, override) {
+            el = (el && (el.tagName || el.item)) ? el : Y.Dom.get(el); // skip get() when possible
+
+            if (!el || !method) {
+                return false;
+            } 
+            var scope = (override) ? o : window;
+            
+            if (el.tagName || el.length === undefined) { // element or not array-like 
+                return method.call(scope, el, o);
+            } 
+
+            var collection = [];
+            
+            for (var i = 0, len = el.length; i < len; ++i) {
+                collection[collection.length] = method.call(scope, el[i], o);
+            }
+            
+            return collection;
+        },
+        
+        /**
+         * Returns the height of the document.
+         * @method getDocumentHeight
+         * @return {Int} The height of the actual document (which includes the body and its margin).
+         */
+        getDocumentHeight: function() {
+            var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
+
+            var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
+            return h;
+        },
+        
+        /**
+         * Returns the width of the document.
+         * @method getDocumentWidth
+         * @return {Int} The width of the actual document (which includes the body and its margin).
+         */
+        getDocumentWidth: function() {
+            var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
+            var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
+            return w;
+        },
+
+        /**
+         * Returns the current height of the viewport.
+         * @method getViewportHeight
+         * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+         */
+        getViewportHeight: function() {
+            var height = self.innerHeight; // Safari, Opera
+            var mode = document.compatMode;
+        
+            if ( (mode || isIE) && !isOpera ) { // IE, Gecko
+                height = (mode == 'CSS1Compat') ?
+                        document.documentElement.clientHeight : // Standards
+                        document.body.clientHeight; // Quirks
+            }
+        
+            return height;
+        },
+        
+        /**
+         * Returns the current width of the viewport.
+         * @method getViewportWidth
+         * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+         */
+        
+        getViewportWidth: function() {
+            var width = self.innerWidth;  // Safari
+            var mode = document.compatMode;
+            
+            if (mode || isIE) { // IE, Gecko, Opera
+                width = (mode == 'CSS1Compat') ?
+                        document.documentElement.clientWidth : // Standards
+                        document.body.clientWidth; // Quirks
+            }
+            return width;
+        },
+
+       /**
+         * Returns the nearest ancestor that passes the test applied by supplied boolean method.
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * @method getAncestorBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
+         * @return {Object} HTMLElement or null if not found
+         */
+        getAncestorBy: function(node, method) {
+            while (node = node.parentNode) { // NOTE: assignment
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            } 
+
+            return null;
+        },
+        
+        /**
+         * Returns the nearest ancestor with the given className.
+         * @method getAncestorByClassName
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @param {String} className
+         * @return {Object} HTMLElement
+         */
+        getAncestorByClassName: function(node, className) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            var method = function(el) { return Y.Dom.hasClass(el, className); };
+            return Y.Dom.getAncestorBy(node, method);
+        },
+
+        /**
+         * Returns the nearest ancestor with the given tagName.
+         * @method getAncestorByTagName
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @param {String} tagName
+         * @return {Object} HTMLElement
+         */
+        getAncestorByTagName: function(node, tagName) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            var method = function(el) {
+                 return el.tagName && el.tagName.toUpperCase() == tagName.toUpperCase();
+            };
+
+            return Y.Dom.getAncestorBy(node, method);
+        },
+
+        /**
+         * Returns the previous sibling that is an HTMLElement. 
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * Returns the nearest HTMLElement sibling if no method provided.
+         * @method getPreviousSiblingBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test siblings
+         * that receives the sibling node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getPreviousSiblingBy: function(node, method) {
+            while (node) {
+                node = node.previousSibling;
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            }
+            return null;
+        }, 
+
+        /**
+         * Returns the previous sibling that is an HTMLElement 
+         * @method getPreviousSibling
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getPreviousSibling: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+
+            return Y.Dom.getPreviousSiblingBy(node);
+        }, 
+
+        /**
+         * Returns the next HTMLElement sibling that passes the boolean method. 
+         * For performance reasons, IDs are not accepted and argument validation omitted.
+         * Returns the nearest HTMLElement sibling if no method provided.
+         * @method getNextSiblingBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test siblings
+         * that receives the sibling node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getNextSiblingBy: function(node, method) {
+            while (node) {
+                node = node.nextSibling;
+                if ( testElement(node, method) ) {
+                    return node;
+                }
+            }
+            return null;
+        }, 
+
+        /**
+         * Returns the next sibling that is an HTMLElement 
+         * @method getNextSibling
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getNextSibling: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+
+            return Y.Dom.getNextSiblingBy(node);
+        }, 
+
+        /**
+         * Returns the first HTMLElement child that passes the test method. 
+         * @method getFirstChildBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getFirstChildBy: function(node, method) {
+            var child = ( testElement(node.firstChild, method) ) ? node.firstChild : null;
+            return child || Y.Dom.getNextSiblingBy(node.firstChild, method);
+        }, 
+
+        /**
+         * Returns the first HTMLElement child. 
+         * @method getFirstChild
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getFirstChild: function(node, method) {
+            node = Y.Dom.get(node);
+            if (!node) {
+                return null;
+            }
+            return Y.Dom.getFirstChildBy(node);
+        }, 
+
+        /**
+         * Returns the last HTMLElement child that passes the test method. 
+         * @method getLastChildBy
+         * @param {HTMLElement} node The HTMLElement to use as the starting point 
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Object} HTMLElement or null if not found
+         */
+        getLastChildBy: function(node, method) {
+            if (!node) {
+                return null;
+            }
+            var child = ( testElement(node.lastChild, method) ) ? node.lastChild : null;
+            return child || Y.Dom.getPreviousSiblingBy(node.lastChild, method);
+        }, 
+
+        /**
+         * Returns the last HTMLElement child. 
+         * @method getLastChild
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Object} HTMLElement or null if not found
+         */
+        getLastChild: function(node) {
+            node = Y.Dom.get(node);
+            return Y.Dom.getLastChildBy(node);
+        }, 
+
+        /**
+         * Returns an array of HTMLElement childNodes that pass the test method. 
+         * @method getChildrenBy
+         * @param {HTMLElement} node The HTMLElement to start from
+         * @param {Function} method A boolean function used to test children
+         * that receives the node being tested as its only argument
+         * @return {Array} A static array of HTMLElements
+         */
+        getChildrenBy: function(node, method) {
+            var child = Y.Dom.getFirstChildBy(node, method);
+            var children = child ? [child] : [];
+
+            Y.Dom.getNextSiblingBy(child, function(node) {
+                if ( !method || method(node) ) {
+                    children[children.length] = node;
+                }
+                return false; // fail test to collect all children
+            });
+
+            return children;
+        },
+ 
+        /**
+         * Returns an array of HTMLElement childNodes. 
+         * @method getChildren
+         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point 
+         * @return {Array} A static array of HTMLElements
+         */
+        getChildren: function(node) {
+            node = Y.Dom.get(node);
+            if (!node) {
+            }
+
+            return Y.Dom.getChildrenBy(node);
+        },
+ 
+        /**
+         * Returns the left scroll value of the document 
+         * @method getDocumentScrollLeft
+         * @param {HTMLDocument} document (optional) The document to get the scroll value of
+         * @return {Int}  The amount that the document is scrolled to the left
+         */
+        getDocumentScrollLeft: function(doc) {
+            doc = doc || document;
+            return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+        }, 
+
+        /**
+         * Returns the top scroll value of the document 
+         * @method getDocumentScrollTop
+         * @param {HTMLDocument} document (optional) The document to get the scroll value of
+         * @return {Int}  The amount that the document is scrolled to the top
+         */
+        getDocumentScrollTop: function(doc) {
+            doc = doc || document;
+            return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+        },
+
+        /**
+         * Inserts the new node as the previous sibling of the reference node 
+         * @method insertBefore
+         * @param {String | HTMLElement} newNode The node to be inserted
+         * @param {String | HTMLElement} referenceNode The node to insert the new node before 
+         * @return {HTMLElement} The node that was inserted (or null if insert fails) 
+         */
+        insertBefore: function(newNode, referenceNode) {
+            newNode = Y.Dom.get(newNode); 
+            referenceNode = Y.Dom.get(referenceNode); 
+            
+            if (!newNode || !referenceNode || !referenceNode.parentNode) {
+                return null;
+            }       
+
+            return referenceNode.parentNode.insertBefore(newNode, referenceNode); 
+        },
+
+        /**
+         * Inserts the new node as the next sibling of the reference node 
+         * @method insertAfter
+         * @param {String | HTMLElement} newNode The node to be inserted
+         * @param {String | HTMLElement} referenceNode The node to insert the new node after 
+         * @return {HTMLElement} The node that was inserted (or null if insert fails) 
+         */
+        insertAfter: function(newNode, referenceNode) {
+            newNode = Y.Dom.get(newNode); 
+            referenceNode = Y.Dom.get(referenceNode); 
+            
+            if (!newNode || !referenceNode || !referenceNode.parentNode) {
+                return null;
+            }       
+
+            if (referenceNode.nextSibling) {
+                return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 
+            } else {
+                return referenceNode.parentNode.appendChild(newNode);
+            }
+        }
+    };
+})();
+/**
+ * A region is a representation of an object on a grid.  It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default.  If 
+ * other shapes are required, this class could be extended to support it.
+ * @namespace YAHOO.util
+ * @class Region
+ * @param {Int} t the top extent
+ * @param {Int} r the right extent
+ * @param {Int} b the bottom extent
+ * @param {Int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+    /**
+     * The region's top extent
+     * @property top
+     * @type Int
+     */
+    this.top = t;
+    
+    /**
+     * The region's top extent as index, for symmetry with set/getXY
+     * @property 1
+     * @type Int
+     */
+    this[1] = t;
+
+    /**
+     * The region's right extent
+     * @property right
+     * @type int
+     */
+    this.right = r;
+
+    /**
+     * The region's bottom extent
+     * @property bottom
+     * @type Int
+     */
+    this.bottom = b;
+
+    /**
+     * The region's left extent
+     * @property left
+     * @type Int
+     */
+    this.left = l;
+    
+    /**
+     * The region's left extent as index, for symmetry with set/getXY
+     * @property 0
+     * @type Int
+     */
+    this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ * @method contains
+ * @param  {Region}  region The region to evaluate
+ * @return {Boolean}        True if the region is contained with this region, 
+ *                          else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+    return ( region.left   >= this.left   && 
+             region.right  <= this.right  && 
+             region.top    >= this.top    && 
+             region.bottom <= this.bottom    );
+
+};
+
+/**
+ * Returns the area of the region
+ * @method getArea
+ * @return {Int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+    return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ * @method intersect
+ * @param  {Region} region The region that intersects
+ * @return {Region}        The overlap region, or null if there is no overlap
+ */
+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;
+    }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ * @method union
+ * @param  {Region} region The region that to create the union with
+ * @return {Region}        The union region
+ */
+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);
+};
+
+/**
+ * toString
+ * @method toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+    return ( "Region {"    +
+             "top: "       + this.top    + 
+             ", right: "   + this.right  + 
+             ", bottom: "  + this.bottom + 
+             ", left: "    + this.left   + 
+             "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ * @method getRegion
+ * @param  {HTMLElement} el The element
+ * @return {Region}         The region that the element occupies
+ * @static
+ */
+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);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * A point is a region that is special in that it represents a single point on 
+ * the grid.
+ * @namespace YAHOO.util
+ * @class Point
+ * @param {Int} x The X position of the point
+ * @param {Int} y The Y position of the point
+ * @constructor
+ * @extends YAHOO.util.Region
+ */
+YAHOO.util.Point = function(x, y) {
+   if (YAHOO.lang.isArray(x)) { // accept input from Dom.getXY, Event.getXY, etc.
+      y = x[1]; // dont blow away x yet
+      x = x[0];
+   }
+   
+    /**
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+     * @property x
+     * @type Int
+     */
+
+    this.x = this.right = this.left = this[0] = x;
+     
+    /**
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+     * @property y
+     * @type Int
+     */
+    this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
+YAHOO.register("dom", YAHOO.util.Dom, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/dragdrop.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/dragdrop.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/dragdrop.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,3099 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The drag and drop utility provides a framework for building drag and drop
+ * applications.  In addition to enabling drag and drop for specific elements,
+ * the drag and drop elements are tracked by the manager class, and the
+ * interactions between the various elements are tracked during the drag and
+ * the implementing code is notified about these important moments.
+ * @module dragdrop
+ * @title Drag and Drop
+ * @requires yahoo,dom,event
+ * @namespace YAHOO.util
+ */
+
+// Only load the library once.  Rewriting the manager class would orphan 
+// existing drag and drop instances.
+if (!YAHOO.util.DragDropMgr) {
+
+/**
+ * DragDropMgr is a singleton that tracks the element interaction for 
+ * all DragDrop items in the window.  Generally, you will not call 
+ * this class directly, but it does have helper methods that could 
+ * be useful in your DragDrop implementations.
+ * @class DragDropMgr
+ * @static
+ */
+YAHOO.util.DragDropMgr = function() {
+
+    var Event = YAHOO.util.Event;
+
+    return {
+
+        /**
+         * Two dimensional Array of registered DragDrop objects.  The first 
+         * dimension is the DragDrop item group, the second the DragDrop 
+         * object.
+         * @property ids
+         * @type {string: string}
+         * @private
+         * @static
+         */
+        ids: {},
+
+        /**
+         * Array of element ids defined as drag handles.  Used to determine 
+         * if the element that generated the mousedown event is actually the 
+         * handle and not the html element itself.
+         * @property handleIds
+         * @type {string: string}
+         * @private
+         * @static
+         */
+        handleIds: {},
+
+        /**
+         * the DragDrop object that is currently being dragged
+         * @property dragCurrent
+         * @type DragDrop
+         * @private
+         * @static
+         **/
+        dragCurrent: null,
+
+        /**
+         * the DragDrop object(s) that are being hovered over
+         * @property dragOvers
+         * @type Array
+         * @private
+         * @static
+         */
+        dragOvers: {},
+
+        /**
+         * the X distance between the cursor and the object being dragged
+         * @property deltaX
+         * @type int
+         * @private
+         * @static
+         */
+        deltaX: 0,
+
+        /**
+         * the Y distance between the cursor and the object being dragged
+         * @property deltaY
+         * @type int
+         * @private
+         * @static
+         */
+        deltaY: 0,
+
+        /**
+         * Flag to determine if we should prevent the default behavior of the
+         * events we define. By default this is true, but this can be set to 
+         * false if you need the default behavior (not recommended)
+         * @property preventDefault
+         * @type boolean
+         * @static
+         */
+        preventDefault: true,
+
+        /**
+         * Flag to determine if we should stop the propagation of the events 
+         * we generate. This is true by default but you may want to set it to
+         * false if the html element contains other features that require the
+         * mouse click.
+         * @property stopPropagation
+         * @type boolean
+         * @static
+         */
+        stopPropagation: true,
+
+        /**
+         * Internal flag that is set to true when drag and drop has been
+         * initialized
+         * @property initialized
+         * @private
+         * @static
+         */
+        initialized: false,
+
+        /**
+         * All drag and drop can be disabled.
+         * @property locked
+         * @private
+         * @static
+         */
+        locked: false,
+
+        /**
+         * Provides additional information about the the current set of
+         * interactions.  Can be accessed from the event handlers. It
+         * contains the following properties:
+         *
+         *       out:       onDragOut interactions
+         *       enter:     onDragEnter interactions
+         *       over:      onDragOver interactions
+         *       drop:      onDragDrop interactions
+         *       point:     The location of the cursor
+         *       draggedRegion: The location of dragged element at the time
+         *                      of the interaction
+         *       sourceRegion: The location of the source elemtn at the time
+         *                     of the interaction
+         *       validDrop: boolean
+         * @property interactionInfo
+         * @type object
+         * @static
+         */
+        interactionInfo: null,
+
+        /**
+         * Called the first time an element is registered.
+         * @method init
+         * @private
+         * @static
+         */
+        init: function() {
+            this.initialized = true;
+        },
+
+        /**
+         * In point mode, drag and drop interaction is defined by the 
+         * location of the cursor during the drag/drop
+         * @property POINT
+         * @type int
+         * @static
+         * @final
+         */
+        POINT: 0,
+
+        /**
+         * In intersect mode, drag and drop interaction is defined by the 
+         * cursor position or the amount of overlap of two or more drag and 
+         * drop objects.
+         * @property INTERSECT
+         * @type int
+         * @static
+         * @final
+         */
+        INTERSECT: 1,
+
+        /**
+         * In intersect mode, drag and drop interaction is defined only by the 
+         * overlap of two or more drag and drop objects.
+         * @property STRICT_INTERSECT
+         * @type int
+         * @static
+         * @final
+         */
+        STRICT_INTERSECT: 2,
+
+        /**
+         * The current drag and drop mode.  Default: POINT
+         * @property mode
+         * @type int
+         * @static
+         */
+        mode: 0,
+
+        /**
+         * Runs method on all drag and drop objects
+         * @method _execOnAll
+         * @private
+         * @static
+         */
+        _execOnAll: function(sMethod, args) {
+            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[sMethod].apply(oDD, args);
+                }
+            }
+        },
+
+        /**
+         * Drag and drop initialization.  Sets up the global event handlers
+         * @method _onLoad
+         * @private
+         * @static
+         */
+        _onLoad: function() {
+
+            this.init();
+
+
+            Event.on(document, "mouseup",   this.handleMouseUp, this, true);
+            Event.on(document, "mousemove", this.handleMouseMove, this, true);
+            Event.on(window,   "unload",    this._onUnload, this, true);
+            Event.on(window,   "resize",    this._onResize, this, true);
+            // Event.on(window,   "mouseout",    this._test);
+
+        },
+
+        /**
+         * Reset constraints on all drag and drop objs
+         * @method _onResize
+         * @private
+         * @static
+         */
+        _onResize: function(e) {
+            this._execOnAll("resetConstraints", []);
+        },
+
+        /**
+         * Lock all drag and drop functionality
+         * @method lock
+         * @static
+         */
+        lock: function() { this.locked = true; },
+
+        /**
+         * Unlock all drag and drop functionality
+         * @method unlock
+         * @static
+         */
+        unlock: function() { this.locked = false; },
+
+        /**
+         * Is drag and drop locked?
+         * @method isLocked
+         * @return {boolean} True if drag and drop is locked, false otherwise.
+         * @static
+         */
+        isLocked: function() { return this.locked; },
+
+        /**
+         * Location cache that is set for all drag drop objects when a drag is
+         * initiated, cleared when the drag is finished.
+         * @property locationCache
+         * @private
+         * @static
+         */
+        locationCache: {},
+
+        /**
+         * Set useCache to false if you want to force object the lookup of each
+         * drag and drop linked element constantly during a drag.
+         * @property useCache
+         * @type boolean
+         * @static
+         */
+        useCache: true,
+
+        /**
+         * The number of pixels that the mouse needs to move after the 
+         * mousedown before the drag is initiated.  Default=3;
+         * @property clickPixelThresh
+         * @type int
+         * @static
+         */
+        clickPixelThresh: 3,
+
+        /**
+         * The number of milliseconds after the mousedown event to initiate the
+         * drag if we don't get a mouseup event. Default=1000
+         * @property clickTimeThresh
+         * @type int
+         * @static
+         */
+        clickTimeThresh: 1000,
+
+        /**
+         * Flag that indicates that either the drag pixel threshold or the 
+         * mousdown time threshold has been met
+         * @property dragThreshMet
+         * @type boolean
+         * @private
+         * @static
+         */
+        dragThreshMet: false,
+
+        /**
+         * Timeout used for the click time threshold
+         * @property clickTimeout
+         * @type Object
+         * @private
+         * @static
+         */
+        clickTimeout: null,
+
+        /**
+         * The X position of the mousedown event stored for later use when a 
+         * drag threshold is met.
+         * @property startX
+         * @type int
+         * @private
+         * @static
+         */
+        startX: 0,
+
+        /**
+         * The Y position of the mousedown event stored for later use when a 
+         * drag threshold is met.
+         * @property startY
+         * @type int
+         * @private
+         * @static
+         */
+        startY: 0,
+
+        /**
+         * Each DragDrop instance must be registered with the DragDropMgr.  
+         * This is executed in DragDrop.init()
+         * @method regDragDrop
+         * @param {DragDrop} oDD the DragDrop object to register
+         * @param {String} sGroup the name of the group this element belongs to
+         * @static
+         */
+        regDragDrop: function(oDD, sGroup) {
+            if (!this.initialized) { this.init(); }
+            
+            if (!this.ids[sGroup]) {
+                this.ids[sGroup] = {};
+            }
+            this.ids[sGroup][oDD.id] = oDD;
+        },
+
+        /**
+         * Removes the supplied dd instance from the supplied group. Executed
+         * by DragDrop.removeFromGroup, so don't call this function directly.
+         * @method removeDDFromGroup
+         * @private
+         * @static
+         */
+        removeDDFromGroup: function(oDD, sGroup) {
+            if (!this.ids[sGroup]) {
+                this.ids[sGroup] = {};
+            }
+
+            var obj = this.ids[sGroup];
+            if (obj && obj[oDD.id]) {
+                delete obj[oDD.id];
+            }
+        },
+
+        /**
+         * Unregisters a drag and drop item.  This is executed in 
+         * DragDrop.unreg, use that method instead of calling this directly.
+         * @method _remove
+         * @private
+         * @static
+         */
+        _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];
+        },
+
+        /**
+         * Each DragDrop handle element must be registered.  This is done
+         * automatically when executing DragDrop.setHandleElId()
+         * @method regHandle
+         * @param {String} sDDId the DragDrop id this element is a handle for
+         * @param {String} sHandleId the id of the element that is the drag 
+         * handle
+         * @static
+         */
+        regHandle: function(sDDId, sHandleId) {
+            if (!this.handleIds[sDDId]) {
+                this.handleIds[sDDId] = {};
+            }
+            this.handleIds[sDDId][sHandleId] = sHandleId;
+        },
+
+        /**
+         * Utility function to determine if a given element has been 
+         * registered as a drag drop item.
+         * @method isDragDrop
+         * @param {String} id the element id to check
+         * @return {boolean} true if this element is a DragDrop item, 
+         * false otherwise
+         * @static
+         */
+        isDragDrop: function(id) {
+            return ( this.getDDById(id) ) ? true : false;
+        },
+
+        /**
+         * Returns the drag and drop instances that are in all groups the
+         * passed in instance belongs to.
+         * @method getRelated
+         * @param {DragDrop} p_oDD the obj to get related data for
+         * @param {boolean} bTargetsOnly if true, only return targetable objs
+         * @return {DragDrop[]} the related instances
+         * @static
+         */
+        getRelated: function(p_oDD, bTargetsOnly) {
+            var oDDs = [];
+            for (var i in p_oDD.groups) {
+                for (var j in this.ids[i]) {
+                    var dd = this.ids[i][j];
+                    if (! this.isTypeOfDD(dd)) {
+                        continue;
+                    }
+                    if (!bTargetsOnly || dd.isTarget) {
+                        oDDs[oDDs.length] = dd;
+                    }
+                }
+            }
+
+            return oDDs;
+        },
+
+        /**
+         * Returns true if the specified dd target is a legal target for 
+         * the specifice drag obj
+         * @method isLegalTarget
+         * @param {DragDrop} the drag obj
+         * @param {DragDrop} the target
+         * @return {boolean} true if the target is a legal target for the 
+         * dd obj
+         * @static
+         */
+        isLegalTarget: function (oDD, oTargetDD) {
+            var targets = this.getRelated(oDD, true);
+            for (var i=0, len=targets.length;i<len;++i) {
+                if (targets[i].id == oTargetDD.id) {
+                    return true;
+                }
+            }
+
+            return false;
+        },
+
+        /**
+         * My goal is to be able to transparently determine if an object is
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof 
+         * returns "object", oDD.constructor.toString() always returns
+         * "DragDrop" and not the name of the subclass.  So for now it just
+         * evaluates a well-known variable in DragDrop.
+         * @method isTypeOfDD
+         * @param {Object} the object to evaluate
+         * @return {boolean} true if typeof oDD = DragDrop
+         * @static
+         */
+        isTypeOfDD: function (oDD) {
+            return (oDD && oDD.__ygDragDrop);
+        },
+
+        /**
+         * Utility function to determine if a given element has been 
+         * registered as a drag drop handle for the given Drag Drop object.
+         * @method isHandle
+         * @param {String} id the element id to check
+         * @return {boolean} true if this element is a DragDrop handle, false 
+         * otherwise
+         * @static
+         */
+        isHandle: function(sDDId, sHandleId) {
+            return ( this.handleIds[sDDId] && 
+                            this.handleIds[sDDId][sHandleId] );
+        },
+
+        /**
+         * Returns the DragDrop instance for a given id
+         * @method getDDById
+         * @param {String} id the id of the DragDrop object
+         * @return {DragDrop} the drag drop object, null if it is not found
+         * @static
+         */
+        getDDById: function(id) {
+            for (var i in this.ids) {
+                if (this.ids[i][id]) {
+                    return this.ids[i][id];
+                }
+            }
+            return null;
+        },
+
+        /**
+         * Fired after a registered DragDrop object gets the mousedown event.
+         * Sets up the events required to track the object being dragged
+         * @method handleMouseDown
+         * @param {Event} e the event
+         * @param oDD the DragDrop object being dragged
+         * @private
+         * @static
+         */
+        handleMouseDown: function(e, oDD) {
+
+            this.currentTarget = YAHOO.util.Event.getTarget(e);
+
+            this.dragCurrent = oDD;
+
+            var el = oDD.getEl();
+
+            // track start position
+            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 );
+        },
+
+        /**
+         * Fired when either the drag pixel threshol or the mousedown hold 
+         * time threshold has been met.
+         * @method startDrag
+         * @param x {int} the X position of the original mousedown
+         * @param y {int} the Y position of the original mousedown
+         * @static
+         */
+        startDrag: function(x, y) {
+            clearTimeout(this.clickTimeout);
+            var dc = this.dragCurrent;
+            if (dc) {
+                dc.b4StartDrag(x, y);
+            }
+            if (dc) {
+                dc.startDrag(x, y);
+            }
+            this.dragThreshMet = true;
+        },
+
+        /**
+         * Internal function to handle the mouseup event.  Will be invoked 
+         * from the context of the document.
+         * @method handleMouseUp
+         * @param {Event} e the event
+         * @private
+         * @static
+         */
+        handleMouseUp: function(e) {
+            if (this.dragCurrent) {
+                clearTimeout(this.clickTimeout);
+
+                if (this.dragThreshMet) {
+                    this.fireEvents(e, true);
+                } else {
+                }
+
+                this.stopDrag(e);
+
+                this.stopEvent(e);
+            }
+        },
+
+        /**
+         * Utility to stop event propagation and event default, if these 
+         * features are turned on.
+         * @method stopEvent
+         * @param {Event} e the event as returned by this.getEvent()
+         * @static
+         */
+        stopEvent: function(e) {
+            if (this.stopPropagation) {
+                YAHOO.util.Event.stopPropagation(e);
+            }
+
+            if (this.preventDefault) {
+                YAHOO.util.Event.preventDefault(e);
+            }
+        },
+
+        /** 
+         * Ends the current drag, cleans up the state, and fires the endDrag
+         * and mouseUp events.  Called internally when a mouseup is detected
+         * during the drag.  Can be fired manually during the drag by passing
+         * either another event (such as the mousemove event received in onDrag)
+         * or a fake event with pageX and pageY defined (so that endDrag and
+         * onMouseUp have usable position data.).  Alternatively, pass true
+         * for the silent parameter so that the endDrag and onMouseUp events
+         * are skipped (so no event data is needed.)
+         *
+         * @method stopDrag
+         * @param {Event} e the mouseup event, another event (or a fake event) 
+         *                  with pageX and pageY defined, or nothing if the 
+         *                  silent parameter is true
+         * @param {boolean} silent skips the enddrag and mouseup events if true
+         * @static
+         */
+        stopDrag: function(e, silent) {
+
+            // Fire the drag end event for the item that was dragged
+            if (this.dragCurrent && !silent) {
+                if (this.dragThreshMet) {
+                    this.dragCurrent.b4EndDrag(e);
+                    this.dragCurrent.endDrag(e);
+                }
+
+                this.dragCurrent.onMouseUp(e);
+            }
+
+            this.dragCurrent = null;
+            this.dragOvers = {};
+        },
+
+        /** 
+         * Internal function to handle the mousemove event.  Will be invoked 
+         * from the context of the html element.
+         *
+         * @TODO figure out what we can do about mouse events lost when the 
+         * user drags objects beyond the window boundary.  Currently we can 
+         * detect this in internet explorer by verifying that the mouse is 
+         * down during the mousemove event.  Firefox doesn't give us the 
+         * button state on the mousemove event.
+         * @method handleMouseMove
+         * @param {Event} e the event
+         * @private
+         * @static
+         */
+        handleMouseMove: function(e) {
+            
+            var dc = this.dragCurrent;
+            if (dc) {
+
+                // var button = e.which || e.button;
+
+                // check for IE mouseup outside of page boundary
+                if (YAHOO.util.Event.isIE && !e.button) {
+                    this.stopEvent(e);
+                    return this.handleMouseUp(e);
+                }
+
+                if (!this.dragThreshMet) {
+                    var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
+                    var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
+                    if (diffX > this.clickPixelThresh || 
+                                diffY > this.clickPixelThresh) {
+                        this.startDrag(this.startX, this.startY);
+                    }
+                }
+
+                if (this.dragThreshMet) {
+                    dc.b4Drag(e);
+                    if (dc) {
+                        dc.onDrag(e);
+                    }
+                    if (dc) {
+                        this.fireEvents(e, false);
+                    }
+                }
+
+                this.stopEvent(e);
+            }
+        },
+
+        /**
+         * Iterates over all of the DragDrop elements to find ones we are 
+         * hovering over or dropping on
+         * @method fireEvents
+         * @param {Event} e the event
+         * @param {boolean} isDrop is this a drop op or a mouseover op?
+         * @private
+         * @static
+         */
+        fireEvents: function(e, isDrop) {
+            var dc = this.dragCurrent;
+
+            // If the user did the mouse up outside of the window, we could 
+            // get here even though we have ended the drag.
+            if (!dc || dc.isLocked()) {
+                return;
+            }
+
+            var x = YAHOO.util.Event.getPageX(e),
+                y = YAHOO.util.Event.getPageY(e),
+                pt = new YAHOO.util.Point(x,y),
+                pos = dc.getTargetCoord(pt.x, pt.y),
+                el = dc.getDragEl(),
+                curRegion = new YAHOO.util.Region( pos.y, 
+                                               pos.x + el.offsetWidth,
+                                               pos.y + el.offsetHeight, 
+                                               pos.x ),
+            
+                oldOvers = [], // cache the previous dragOver array
+                outEvts   = [],
+                overEvts  = [],
+                dropEvts  = [],
+                enterEvts = [];
+
+
+            // Check to see if the object(s) we were hovering over is no longer 
+            // being hovered over so we can fire the onDragOut event
+            for (var i in this.dragOvers) {
+
+                var ddo = this.dragOvers[i];
+
+                if (! this.isTypeOfDD(ddo)) {
+                    continue;
+                }
+
+                if (! this.isOverTarget(pt, ddo, this.mode, curRegion)) {
+                    outEvts.push( ddo );
+                }
+
+                oldOvers[i] = true;
+                delete this.dragOvers[i];
+            }
+
+            for (var sGroup in dc.groups) {
+                
+                if ("string" != typeof sGroup) {
+                    continue;
+                }
+
+                for (i in this.ids[sGroup]) {
+                    var oDD = this.ids[sGroup][i];
+                    if (! this.isTypeOfDD(oDD)) {
+                        continue;
+                    }
+
+                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
+                        if (this.isOverTarget(pt, oDD, this.mode, curRegion)) {
+                            // look for drop interactions
+                            if (isDrop) {
+                                dropEvts.push( oDD );
+                            // look for drag enter and drag over interactions
+                            } else {
+
+                                // initial drag over: dragEnter fires
+                                if (!oldOvers[oDD.id]) {
+                                    enterEvts.push( oDD );
+                                // subsequent drag overs: dragOver fires
+                                } else {
+                                    overEvts.push( oDD );
+                                }
+
+                                this.dragOvers[oDD.id] = oDD;
+                            }
+                        }
+                    }
+                }
+            }
+
+            this.interactionInfo = {
+                out:       outEvts,
+                enter:     enterEvts,
+                over:      overEvts,
+                drop:      dropEvts,
+                point:     pt,
+                draggedRegion:    curRegion,
+                sourceRegion: this.locationCache[dc.id],
+                validDrop: isDrop
+            };
+
+            // notify about a drop that did not find a target
+            if (isDrop && !dropEvts.length) {
+                this.interactionInfo.validDrop = false;
+                dc.onInvalidDrop(e);
+            }
+
+
+            if (this.mode) {
+                if (outEvts.length) {
+                    dc.b4DragOut(e, outEvts);
+                    if (dc) {
+                        dc.onDragOut(e, outEvts);
+                    }
+                }
+
+                if (enterEvts.length) {
+                    if (dc) {
+                        dc.onDragEnter(e, enterEvts);
+                    }
+                }
+
+                if (overEvts.length) {
+                    if (dc) {
+                        dc.b4DragOver(e, overEvts);
+                    }
+
+                    if (dc) {
+                        dc.onDragOver(e, overEvts);
+                    }
+                }
+
+                if (dropEvts.length) {
+                    if (dc) {
+                        dc.b4DragDrop(e, dropEvts);
+                    }
+                    if (dc) {
+                        dc.onDragDrop(e, dropEvts);
+                    }
+                }
+
+            } else {
+                // fire dragout events
+                var len = 0;
+                for (i=0, len=outEvts.length; i<len; ++i) {
+                    if (dc) {
+                        dc.b4DragOut(e, outEvts[i].id);
+                    }
+                    if (dc) {
+                        dc.onDragOut(e, outEvts[i].id);
+                    }
+                }
+                 
+                // fire enter events
+                for (i=0,len=enterEvts.length; i<len; ++i) {
+                    // dc.b4DragEnter(e, oDD.id);
+
+                    if (dc) {
+                        dc.onDragEnter(e, enterEvts[i].id);
+                    }
+                }
+         
+                // fire over events
+                for (i=0,len=overEvts.length; i<len; ++i) {
+                    if (dc) {
+                        dc.b4DragOver(e, overEvts[i].id);
+                    }
+                    if (dc) {
+                        dc.onDragOver(e, overEvts[i].id);
+                    }
+                }
+
+                // fire drop events
+                for (i=0, len=dropEvts.length; i<len; ++i) {
+                    if (dc) {
+                        dc.b4DragDrop(e, dropEvts[i].id);
+                    }
+                    if (dc) {
+                        dc.onDragDrop(e, dropEvts[i].id);
+                    }
+                }
+
+            }
+        },
+
+        /**
+         * Helper function for getting the best match from the list of drag 
+         * and drop objects returned by the drag and drop events when we are 
+         * in INTERSECT mode.  It returns either the first object that the 
+         * cursor is over, or the object that has the greatest overlap with 
+         * the dragged element.
+         * @method getBestMatch
+         * @param  {DragDrop[]} dds The array of drag and drop objects 
+         * targeted
+         * @return {DragDrop}       The best single match
+         * @static
+         */
+        getBestMatch: function(dds) {
+            var winner = null;
+
+            var len = dds.length;
+
+            if (len == 1) {
+                winner = dds[0];
+            } else {
+                // Loop through the targeted items
+                for (var i=0; i<len; ++i) {
+                    var dd = dds[i];
+                    // If the cursor is over the object, it wins.  If the 
+                    // cursor is over multiple matches, the first one we come
+                    // to wins.
+                    if (this.mode == this.INTERSECT && dd.cursorIsOver) {
+                        winner = dd;
+                        break;
+                    // Otherwise the object with the most overlap wins
+                    } else {
+                        if (!winner || !winner.overlap || (dd.overlap &&
+                            winner.overlap.getArea() < dd.overlap.getArea())) {
+                            winner = dd;
+                        }
+                    }
+                }
+            }
+
+            return winner;
+        },
+
+        /**
+         * Refreshes the cache of the top-left and bottom-right points of the 
+         * drag and drop objects in the specified group(s).  This is in the
+         * format that is stored in the drag and drop instance, so typical 
+         * usage is:
+         * <code>
+         * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
+         * </code>
+         * Alternatively:
+         * <code>
+         * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
+         * </code>
+         * @TODO this really should be an indexed array.  Alternatively this
+         * method could accept both.
+         * @method refreshCache
+         * @param {Object} groups an associative array of groups to refresh
+         * @static
+         */
+        refreshCache: function(groups) {
+
+            // refresh everything if group array is not provided
+            var g = groups || this.ids;
+
+            for (var sGroup in g) {
+                if ("string" != typeof sGroup) {
+                    continue;
+                }
+                for (var 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 checks to make sure an element exists and is in the DOM.  The
+         * main purpose is to handle cases where innerHTML is used to remove
+         * drag and drop objects from the DOM.  IE provides an 'unspecified
+         * error' when trying to access the offsetParent of such an element
+         * @method verifyEl
+         * @param {HTMLElement} el the element to check
+         * @return {boolean} true if the element looks usable
+         * @static
+         */
+        verifyEl: function(el) {
+            try {
+                if (el) {
+                    var parent = el.offsetParent;
+                    if (parent) {
+                        return true;
+                    }
+                }
+            } catch(e) {
+            }
+
+            return false;
+        },
+        
+        /**
+         * Returns a Region object containing the drag and drop element's position
+         * and size, including the padding configured for it
+         * @method getLocation
+         * @param {DragDrop} oDD the drag and drop object to get the 
+         *                       location for
+         * @return {YAHOO.util.Region} a Region object representing the total area
+         *                             the element occupies, including any padding
+         *                             the instance is configured for.
+         * @static
+         */
+        getLocation: function(oDD) {
+            if (! this.isTypeOfDD(oDD)) {
+                return null;
+            }
+
+            var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
+
+            try {
+                pos= YAHOO.util.Dom.getXY(el);
+            } catch (e) { }
+
+            if (!pos) {
+                return null;
+            }
+
+            x1 = pos[0];
+            x2 = x1 + el.offsetWidth;
+            y1 = pos[1];
+            y2 = y1 + el.offsetHeight;
+
+            t = y1 - oDD.padding[0];
+            r = x2 + oDD.padding[1];
+            b = y2 + oDD.padding[2];
+            l = x1 - oDD.padding[3];
+
+            return new YAHOO.util.Region( t, r, b, l );
+        },
+
+        /**
+         * Checks the cursor location to see if it over the target
+         * @method isOverTarget
+         * @param {YAHOO.util.Point} pt The point to evaluate
+         * @param {DragDrop} oTarget the DragDrop object we are inspecting
+         * @param {boolean} intersect true if we are in intersect mode
+         * @param {YAHOO.util.Region} pre-cached location of the dragged element
+         * @return {boolean} true if the mouse is over the target
+         * @private
+         * @static
+         */
+        isOverTarget: function(pt, oTarget, intersect, curRegion) {
+            // use cache if available
+            var loc = this.locationCache[oTarget.id];
+            if (!loc || !this.useCache) {
+                loc = this.getLocation(oTarget);
+                this.locationCache[oTarget.id] = loc;
+
+            }
+
+            if (!loc) {
+                return false;
+            }
+
+            oTarget.cursorIsOver = loc.contains( pt );
+
+            // DragDrop is using this as a sanity check for the initial mousedown
+            // in this case we are done.  In POINT mode, if the drag obj has no
+            // contraints, we are done. Otherwise we need to evaluate the 
+            // region the target as occupies to determine if the dragged element
+            // overlaps with it.
+            
+            var dc = this.dragCurrent;
+            if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {
+
+                //if (oTarget.cursorIsOver) {
+                //}
+                return oTarget.cursorIsOver;
+            }
+
+            oTarget.overlap = null;
+
+            // Get the current location of the drag element, this is the
+            // location of the mouse event less the delta that represents
+            // where the original mousedown happened on the element.  We
+            // need to consider constraints and ticks as well.
+
+            if (!curRegion) {
+                var pos = dc.getTargetCoord(pt.x, pt.y);
+                var el = dc.getDragEl();
+                curRegion = new YAHOO.util.Region( pos.y, 
+                                                   pos.x + el.offsetWidth,
+                                                   pos.y + el.offsetHeight, 
+                                                   pos.x );
+            }
+
+            var overlap = curRegion.intersect(loc);
+
+            if (overlap) {
+                oTarget.overlap = overlap;
+                return (intersect) ? true : oTarget.cursorIsOver;
+            } else {
+                return false;
+            }
+        },
+
+        /**
+         * unload event handler
+         * @method _onUnload
+         * @private
+         * @static
+         */
+        _onUnload: function(e, me) {
+            this.unregAll();
+        },
+
+        /**
+         * Cleans up the drag and drop events and objects.
+         * @method unregAll
+         * @private
+         * @static
+         */
+        unregAll: function() {
+
+            if (this.dragCurrent) {
+                this.stopDrag();
+                this.dragCurrent = null;
+            }
+
+            this._execOnAll("unreg", []);
+
+            //for (var i in this.elementCache) {
+                //delete this.elementCache[i];
+            //}
+            //this.elementCache = {};
+
+            this.ids = {};
+        },
+
+        /**
+         * A cache of DOM elements
+         * @property elementCache
+         * @private
+         * @static
+         * @deprecated elements are not cached now
+         */
+        elementCache: {},
+        
+        /**
+         * Get the wrapper for the DOM element specified
+         * @method getElWrapper
+         * @param {String} id the id of the element to get
+         * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
+         * @private
+         * @deprecated This wrapper isn't that useful
+         * @static
+         */
+        getElWrapper: function(id) {
+            var oWrapper = this.elementCache[id];
+            if (!oWrapper || !oWrapper.el) {
+                oWrapper = this.elementCache[id] = 
+                    new this.ElementWrapper(YAHOO.util.Dom.get(id));
+            }
+            return oWrapper;
+        },
+
+        /**
+         * Returns the actual DOM element
+         * @method getElement
+         * @param {String} id the id of the elment to get
+         * @return {Object} The element
+         * @deprecated use YAHOO.util.Dom.get instead
+         * @static
+         */
+        getElement: function(id) {
+            return YAHOO.util.Dom.get(id);
+        },
+        
+        /**
+         * Returns the style property for the DOM element (i.e., 
+         * document.getElById(id).style)
+         * @method getCss
+         * @param {String} id the id of the elment to get
+         * @return {Object} The style property of the element
+         * @deprecated use YAHOO.util.Dom instead
+         * @static
+         */
+        getCss: function(id) {
+            var el = YAHOO.util.Dom.get(id);
+            return (el) ? el.style : null;
+        },
+
+        /**
+         * Inner class for cached elements
+         * @class DragDropMgr.ElementWrapper
+         * @for DragDropMgr
+         * @private
+         * @deprecated
+         */
+        ElementWrapper: function(el) {
+                /**
+                 * The element
+                 * @property el
+                 */
+                this.el = el || null;
+                /**
+                 * The element id
+                 * @property id
+                 */
+                this.id = this.el && el.id;
+                /**
+                 * A reference to the style property
+                 * @property css
+                 */
+                this.css = this.el && el.style;
+            },
+
+        /**
+         * Returns the X position of an html element
+         * @method getPosX
+         * @param el the element for which to get the position
+         * @return {int} the X coordinate
+         * @for DragDropMgr
+         * @deprecated use YAHOO.util.Dom.getX instead
+         * @static
+         */
+        getPosX: function(el) {
+            return YAHOO.util.Dom.getX(el);
+        },
+
+        /**
+         * Returns the Y position of an html element
+         * @method getPosY
+         * @param el the element for which to get the position
+         * @return {int} the Y coordinate
+         * @deprecated use YAHOO.util.Dom.getY instead
+         * @static
+         */
+        getPosY: function(el) {
+            return YAHOO.util.Dom.getY(el); 
+        },
+
+        /**
+         * Swap two nodes.  In IE, we use the native method, for others we 
+         * emulate the IE behavior
+         * @method swapNode
+         * @param n1 the first node to swap
+         * @param n2 the other node to swap
+         * @static
+         */
+        swapNode: function(n1, n2) {
+            if (n1.swapNode) {
+                n1.swapNode(n2);
+            } else {
+                var p = n2.parentNode;
+                var s = n2.nextSibling;
+
+                if (s == n1) {
+                    p.insertBefore(n1, n2);
+                } else if (n2 == n1.nextSibling) {
+                    p.insertBefore(n2, n1);
+                } else {
+                    n1.parentNode.replaceChild(n2, n1);
+                    p.insertBefore(n1, s);
+                }
+            }
+        },
+
+        /**
+         * Returns the current scroll position
+         * @method getScroll
+         * @private
+         * @static
+         */
+        getScroll: function () {
+            var t, l, dde=document.documentElement, db=document.body;
+            if (dde && (dde.scrollTop || dde.scrollLeft)) {
+                t = dde.scrollTop;
+                l = dde.scrollLeft;
+            } else if (db) {
+                t = db.scrollTop;
+                l = db.scrollLeft;
+            } else {
+            }
+            return { top: t, left: l };
+        },
+
+        /**
+         * Returns the specified element style property
+         * @method getStyle
+         * @param {HTMLElement} el          the element
+         * @param {string}      styleProp   the style property
+         * @return {string} The value of the style property
+         * @deprecated use YAHOO.util.Dom.getStyle
+         * @static
+         */
+        getStyle: function(el, styleProp) {
+            return YAHOO.util.Dom.getStyle(el, styleProp);
+        },
+
+        /**
+         * Gets the scrollTop
+         * @method getScrollTop
+         * @return {int} the document's scrollTop
+         * @static
+         */
+        getScrollTop: function () { return this.getScroll().top; },
+
+        /**
+         * Gets the scrollLeft
+         * @method getScrollLeft
+         * @return {int} the document's scrollTop
+         * @static
+         */
+        getScrollLeft: function () { return this.getScroll().left; },
+
+        /**
+         * Sets the x/y position of an element to the location of the
+         * target element.
+         * @method moveToEl
+         * @param {HTMLElement} moveEl      The element to move
+         * @param {HTMLElement} targetEl    The position reference element
+         * @static
+         */
+        moveToEl: function (moveEl, targetEl) {
+            var aCoord = YAHOO.util.Dom.getXY(targetEl);
+            YAHOO.util.Dom.setXY(moveEl, aCoord);
+        },
+
+        /**
+         * Gets the client height
+         * @method getClientHeight
+         * @return {int} client height in px
+         * @deprecated use YAHOO.util.Dom.getViewportHeight instead
+         * @static
+         */
+        getClientHeight: function() {
+            return YAHOO.util.Dom.getViewportHeight();
+        },
+
+        /**
+         * Gets the client width
+         * @method getClientWidth
+         * @return {int} client width in px
+         * @deprecated use YAHOO.util.Dom.getViewportWidth instead
+         * @static
+         */
+        getClientWidth: function() {
+            return YAHOO.util.Dom.getViewportWidth();
+        },
+
+        /**
+         * Numeric array sort function
+         * @method numericSort
+         * @static
+         */
+        numericSort: function(a, b) { return (a - b); },
+
+        /**
+         * Internal counter
+         * @property _timeoutCount
+         * @private
+         * @static
+         */
+        _timeoutCount: 0,
+
+        /**
+         * Trying to make the load order less important.  Without this we get
+         * an error if this file is loaded before the Event Utility.
+         * @method _addListeners
+         * @private
+         * @static
+         */
+        _addListeners: function() {
+            var DDM = YAHOO.util.DDM;
+            if ( YAHOO.util.Event && document ) {
+                DDM._onLoad();
+            } else {
+                if (DDM._timeoutCount > 2000) {
+                } else {
+                    setTimeout(DDM._addListeners, 10);
+                    if (document && document.body) {
+                        DDM._timeoutCount += 1;
+                    }
+                }
+            }
+        },
+
+        /**
+         * Recursively searches the immediate parent and all child nodes for 
+         * the handle element in order to determine wheter or not it was 
+         * clicked.
+         * @method handleWasClicked
+         * @param node the html element to inspect
+         * @static
+         */
+        handleWasClicked: function(node, id) {
+            if (this.isHandle(id, node.id)) {
+                return true;
+            } else {
+                // check to see if this is a text node child of the one we want
+                var p = node.parentNode;
+
+                while (p) {
+                    if (this.isHandle(id, p.id)) {
+                        return true;
+                    } else {
+                        p = p.parentNode;
+                    }
+                }
+            }
+
+            return false;
+        }
+
+    };
+
+}();
+
+// shorter alias, save a few bytes
+YAHOO.util.DDM = YAHOO.util.DragDropMgr;
+YAHOO.util.DDM._addListeners();
+
+}
+
+(function() {
+
+var Event=YAHOO.util.Event; 
+var Dom=YAHOO.util.Dom;
+
+/**
+ * Defines the interface and base operation of items that that can be 
+ * dragged or can be drop targets.  It was designed to be extended, overriding
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
+ * Up to three html elements can be associated with a DragDrop instance:
+ * <ul>
+ * <li>linked element: the element that is passed into the constructor.
+ * This is the element which defines the boundaries for interaction with 
+ * other DragDrop objects.</li>
+ * <li>handle element(s): The drag operation only occurs if the element that 
+ * was clicked matches a handle element.  By default this is the linked 
+ * element, but there are times that you will want only a portion of the 
+ * linked element to initiate the drag operation, and the setHandleElId() 
+ * method provides a way to define this.</li>
+ * <li>drag element: this represents an the element that would be moved along
+ * with the cursor during a drag operation.  By default, this is the linked
+ * element itself as in {@link YAHOO.util.DD}.  setDragElId() lets you define
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
+ * </li>
+ * </ul>
+ * This class should not be instantiated until the onload event to ensure that
+ * the associated elements are available.
+ * The following would define a DragDrop obj that would interact with any 
+ * other DragDrop obj in the "group1" group:
+ * <pre>
+ *  dd = new YAHOO.util.DragDrop("div1", "group1");
+ * </pre>
+ * Since none of the event handlers have been implemented, nothing would 
+ * actually happen if you were to run the code above.  Normally you would 
+ * override this class or one of the default implementations, but you can 
+ * also override the methods you want on an instance of the class...
+ * <pre>
+ *  dd.onDragDrop = function(e, id) {
+ *  &nbsp;&nbsp;alert("dd was dropped on " + id);
+ *  }
+ * </pre>
+ * @namespace YAHOO.util
+ * @class DragDrop
+ * @constructor
+ * @param {String} id of the element that is linked to this instance
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DragDrop: 
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly,
+ */
+YAHOO.util.DragDrop = function(id, sGroup, config) {
+    if (id) {
+        this.init(id, sGroup, config); 
+    }
+};
+
+YAHOO.util.DragDrop.prototype = {
+
+    /**
+     * The id of the element associated with this object.  This is what we 
+     * refer to as the "linked element" because the size and position of 
+     * this element is used to determine when the drag and drop objects have 
+     * interacted.
+     * @property id
+     * @type String
+     */
+    id: null,
+
+    /**
+     * Configuration attributes passed into the constructor
+     * @property config
+     * @type object
+     */
+    config: null,
+
+    /**
+     * The id of the element that will be dragged.  By default this is same 
+     * as the linked element , but could be changed to another element. Ex: 
+     * YAHOO.util.DDProxy
+     * @property dragElId
+     * @type String
+     * @private
+     */
+    dragElId: null, 
+
+    /**
+     * the id of the element that initiates the drag operation.  By default 
+     * this is the linked element, but could be changed to be a child of this
+     * element.  This lets us do things like only starting the drag when the 
+     * header element within the linked html element is clicked.
+     * @property handleElId
+     * @type String
+     * @private
+     */
+    handleElId: null, 
+
+    /**
+     * An associative array of HTML tags that will be ignored if clicked.
+     * @property invalidHandleTypes
+     * @type {string: string}
+     */
+    invalidHandleTypes: null, 
+
+    /**
+     * An associative array of ids for elements that will be ignored if clicked
+     * @property invalidHandleIds
+     * @type {string: string}
+     */
+    invalidHandleIds: null, 
+
+    /**
+     * An indexted array of css class names for elements that will be ignored
+     * if clicked.
+     * @property invalidHandleClasses
+     * @type string[]
+     */
+    invalidHandleClasses: null, 
+
+    /**
+     * The linked element's absolute X position at the time the drag was 
+     * started
+     * @property startPageX
+     * @type int
+     * @private
+     */
+    startPageX: 0,
+
+    /**
+     * The linked element's absolute X position at the time the drag was 
+     * started
+     * @property startPageY
+     * @type int
+     * @private
+     */
+    startPageY: 0,
+
+    /**
+     * The group defines a logical collection of DragDrop objects that are 
+     * related.  Instances only get events when interacting with other 
+     * DragDrop object in the same group.  This lets us define multiple 
+     * groups using a single DragDrop subclass if we want.
+     * @property groups
+     * @type {string: string}
+     */
+    groups: null,
+
+    /**
+     * Individual drag/drop instances can be locked.  This will prevent 
+     * onmousedown start drag.
+     * @property locked
+     * @type boolean
+     * @private
+     */
+    locked: false,
+
+    /**
+     * Lock this instance
+     * @method lock
+     */
+    lock: function() { this.locked = true; },
+
+    /**
+     * Unlock this instace
+     * @method unlock
+     */
+    unlock: function() { this.locked = false; },
+
+    /**
+     * By default, all instances can be a drop target.  This can be disabled by
+     * setting isTarget to false.
+     * @method isTarget
+     * @type boolean
+     */
+    isTarget: true,
+
+    /**
+     * The padding configured for this drag and drop object for calculating
+     * the drop zone intersection with this object.
+     * @method padding
+     * @type int[]
+     */
+    padding: null,
+
+    /**
+     * Cached reference to the linked element
+     * @property _domRef
+     * @private
+     */
+    _domRef: null,
+
+    /**
+     * Internal typeof flag
+     * @property __ygDragDrop
+     * @private
+     */
+    __ygDragDrop: true,
+
+    /**
+     * Set to true when horizontal contraints are applied
+     * @property constrainX
+     * @type boolean
+     * @private
+     */
+    constrainX: false,
+
+    /**
+     * Set to true when vertical contraints are applied
+     * @property constrainY
+     * @type boolean
+     * @private
+     */
+    constrainY: false,
+
+    /**
+     * The left constraint
+     * @property minX
+     * @type int
+     * @private
+     */
+    minX: 0,
+
+    /**
+     * The right constraint
+     * @property maxX
+     * @type int
+     * @private
+     */
+    maxX: 0,
+
+    /**
+     * The up constraint 
+     * @property minY
+     * @type int
+     * @type int
+     * @private
+     */
+    minY: 0,
+
+    /**
+     * The down constraint 
+     * @property maxY
+     * @type int
+     * @private
+     */
+    maxY: 0,
+
+    /**
+     * The difference between the click position and the source element's location
+     * @property deltaX
+     * @type int
+     * @private
+     */
+    deltaX: 0,
+
+    /**
+     * The difference between the click position and the source element's location
+     * @property deltaY
+     * @type int
+     * @private
+     */
+    deltaY: 0,
+
+    /**
+     * Maintain offsets when we resetconstraints.  Set to true when you want
+     * the position of the element relative to its parent to stay the same
+     * when the page changes
+     *
+     * @property maintainOffset
+     * @type boolean
+     */
+    maintainOffset: false,
+
+    /**
+     * Array of pixel locations the element will snap to if we specified a 
+     * horizontal graduation/interval.  This array is generated automatically
+     * when you define a tick interval.
+     * @property xTicks
+     * @type int[]
+     */
+    xTicks: null,
+
+    /**
+     * Array of pixel locations the element will snap to if we specified a 
+     * vertical graduation/interval.  This array is generated automatically 
+     * when you define a tick interval.
+     * @property yTicks
+     * @type int[]
+     */
+    yTicks: null,
+
+    /**
+     * By default the drag and drop instance will only respond to the primary
+     * button click (left button for a right-handed mouse).  Set to true to
+     * allow drag and drop to start with any mouse click that is propogated
+     * by the browser
+     * @property primaryButtonOnly
+     * @type boolean
+     */
+    primaryButtonOnly: true,
+
+    /**
+     * The availabe property is false until the linked dom element is accessible.
+     * @property available
+     * @type boolean
+     */
+    available: false,
+
+    /**
+     * By default, drags can only be initiated if the mousedown occurs in the
+     * region the linked element is.  This is done in part to work around a
+     * bug in some browsers that mis-report the mousedown if the previous
+     * mouseup happened outside of the window.  This property is set to true
+     * if outer handles are defined.
+     *
+     * @property hasOuterHandles
+     * @type boolean
+     * @default false
+     */
+    hasOuterHandles: false,
+
+    /**
+     * Property that is assigned to a drag and drop object when testing to
+     * see if it is being targeted by another dd object.  This property
+     * can be used in intersect mode to help determine the focus of
+     * the mouse interaction.  DDM.getBestMatch uses this property first to
+     * determine the closest match in INTERSECT mode when multiple targets
+     * are part of the same interaction.
+     * @property cursorIsOver
+     * @type boolean
+     */
+    cursorIsOver: false,
+
+    /**
+     * Property that is assigned to a drag and drop object when testing to
+     * see if it is being targeted by another dd object.  This is a region
+     * that represents the area the draggable element overlaps this target.
+     * DDM.getBestMatch uses this property to compare the size of the overlap
+     * to that of other targets in order to determine the closest match in
+     * INTERSECT mode when multiple targets are part of the same interaction.
+     * @property overlap 
+     * @type YAHOO.util.Region
+     */
+    overlap: null,
+
+    /**
+     * Code that executes immediately before the startDrag event
+     * @method b4StartDrag
+     * @private
+     */
+    b4StartDrag: function(x, y) { },
+
+    /**
+     * Abstract method called after a drag/drop object is clicked
+     * and the drag or mousedown time thresholds have beeen met.
+     * @method startDrag
+     * @param {int} X click location
+     * @param {int} Y click location
+     */
+    startDrag: function(x, y) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDrag event
+     * @method b4Drag
+     * @private
+     */
+    b4Drag: function(e) { },
+
+    /**
+     * Abstract method called during the onMouseMove event while dragging an 
+     * object.
+     * @method onDrag
+     * @param {Event} e the mousemove event
+     */
+    onDrag: function(e) { /* override this */ },
+
+    /**
+     * Abstract method called when this element fist begins hovering over 
+     * another DragDrop obj
+     * @method onDragEnter
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this is hovering over.  In INTERSECT mode, an array of one or more 
+     * dragdrop items being hovered over.
+     */
+    onDragEnter: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragOver event
+     * @method b4DragOver
+     * @private
+     */
+    b4DragOver: function(e) { },
+
+    /**
+     * Abstract method called when this element is hovering over another 
+     * DragDrop obj
+     * @method onDragOver
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this is hovering over.  In INTERSECT mode, an array of dd items 
+     * being hovered over.
+     */
+    onDragOver: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragOut event
+     * @method b4DragOut
+     * @private
+     */
+    b4DragOut: function(e) { },
+
+    /**
+     * Abstract method called when we are no longer hovering over an element
+     * @method onDragOut
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this was hovering over.  In INTERSECT mode, an array of dd items 
+     * that the mouse is no longer over.
+     */
+    onDragOut: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragDrop event
+     * @method b4DragDrop
+     * @private
+     */
+    b4DragDrop: function(e) { },
+
+    /**
+     * Abstract method called when this item is dropped on another DragDrop 
+     * obj
+     * @method onDragDrop
+     * @param {Event} e the mouseup event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this 
+     * was dropped on.
+     */
+    onDragDrop: function(e, id) { /* override this */ },
+
+    /**
+     * Abstract method called when this item is dropped on an area with no
+     * drop target
+     * @method onInvalidDrop
+     * @param {Event} e the mouseup event
+     */
+    onInvalidDrop: function(e) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the endDrag event
+     * @method b4EndDrag
+     * @private
+     */
+    b4EndDrag: function(e) { },
+
+    /**
+     * Fired when we are done dragging the object
+     * @method endDrag
+     * @param {Event} e the mouseup event
+     */
+    endDrag: function(e) { /* override this */ },
+
+    /**
+     * Code executed immediately before the onMouseDown event
+     * @method b4MouseDown
+     * @param {Event} e the mousedown event
+     * @private
+     */
+    b4MouseDown: function(e) {  },
+
+    /**
+     * Event handler that fires when a drag/drop obj gets a mousedown
+     * @method onMouseDown
+     * @param {Event} e the mousedown event
+     */
+    onMouseDown: function(e) { /* override this */ },
+
+    /**
+     * Event handler that fires when a drag/drop obj gets a mouseup
+     * @method onMouseUp
+     * @param {Event} e the mouseup event
+     */
+    onMouseUp: function(e) { /* override this */ },
+   
+    /**
+     * Override the onAvailable method to do what is needed after the initial
+     * position was determined.
+     * @method onAvailable
+     */
+    onAvailable: function () { 
+    },
+
+    /**
+     * Returns a reference to the linked element
+     * @method getEl
+     * @return {HTMLElement} the html element 
+     */
+    getEl: function() { 
+        if (!this._domRef) {
+            this._domRef = Dom.get(this.id); 
+        }
+
+        return this._domRef;
+    },
+
+    /**
+     * Returns a reference to the actual element to drag.  By default this is
+     * the same as the html element, but it can be assigned to another 
+     * element. An example of this can be found in YAHOO.util.DDProxy
+     * @method getDragEl
+     * @return {HTMLElement} the html element 
+     */
+    getDragEl: function() {
+        return Dom.get(this.dragElId);
+    },
+
+    /**
+     * Sets up the DragDrop object.  Must be called in the constructor of any
+     * YAHOO.util.DragDrop subclass
+     * @method init
+     * @param id the id of the linked element
+     * @param {String} sGroup the group of related items
+     * @param {object} config configuration attributes
+     */
+    init: function(id, sGroup, config) {
+        this.initTarget(id, sGroup, config);
+        Event.on(this._domRef || this.id, "mousedown", 
+                        this.handleMouseDown, this, true);
+        // Event.on(this.id, "selectstart", Event.preventDefault);
+    },
+
+    /**
+     * Initializes Targeting functionality only... the object does not
+     * get a mousedown handler.
+     * @method initTarget
+     * @param id the id of the linked element
+     * @param {String} sGroup the group of related items
+     * @param {object} config configuration attributes
+     */
+    initTarget: function(id, sGroup, config) {
+
+        // configuration attributes 
+        this.config = config || {};
+
+        // create a local reference to the drag and drop manager
+        this.DDM = YAHOO.util.DDM;
+
+        // initialize the groups object
+        this.groups = {};
+
+        // assume that we have an element reference instead of an id if the
+        // parameter is not a string
+        if (typeof id !== "string") {
+            this._domRef = id;
+            id = Dom.generateId(id);
+        }
+
+        // set the id
+        this.id = id;
+
+        // add to an interaction group
+        this.addToGroup((sGroup) ? sGroup : "default");
+
+        // We don't want to register this as the handle with the manager
+        // so we just set the id rather than calling the setter.
+        this.handleElId = id;
+
+        Event.onAvailable(id, this.handleOnAvailable, this, true);
+
+
+        // the linked element is the element that gets dragged by default
+        this.setDragElId(id); 
+
+        // by default, clicked anchors will not start drag operations. 
+        // @TODO what else should be here?  Probably form fields.
+        this.invalidHandleTypes = { A: "A" };
+        this.invalidHandleIds = {};
+        this.invalidHandleClasses = [];
+
+        this.applyConfig();
+    },
+
+    /**
+     * Applies the configuration parameters that were passed into the constructor.
+     * This is supposed to happen at each level through the inheritance chain.  So
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and 
+     * DragDrop in order to get all of the parameters that are available in
+     * each object.
+     * @method applyConfig
+     */
+    applyConfig: function() {
+
+        // configurable properties: 
+        //    padding, isTarget, maintainOffset, primaryButtonOnly
+        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);
+
+    },
+
+    /**
+     * Executed when the linked element is available
+     * @method handleOnAvailable
+     * @private
+     */
+    handleOnAvailable: function() {
+        this.available = true;
+        this.resetConstraints();
+        this.onAvailable();
+    },
+
+     /**
+     * Configures the padding for the target zone in px.  Effectively expands
+     * (or reduces) the virtual object size for targeting calculations.  
+     * Supports css-style shorthand; if only one parameter is passed, all sides
+     * will have that padding, and if only two are passed, the top and bottom
+     * will have the first param, the left and right the second.
+     * @method setPadding
+     * @param {int} iTop    Top pad
+     * @param {int} iRight  Right pad
+     * @param {int} iBot    Bot pad
+     * @param {int} iLeft   Left pad
+     */
+    setPadding: function(iTop, iRight, iBot, iLeft) {
+        // this.padding = [iLeft, iRight, iTop, iBot];
+        if (!iRight && 0 !== iRight) {
+            this.padding = [iTop, iTop, iTop, iTop];
+        } else if (!iBot && 0 !== iBot) {
+            this.padding = [iTop, iRight, iTop, iRight];
+        } else {
+            this.padding = [iTop, iRight, iBot, iLeft];
+        }
+    },
+
+    /**
+     * Stores the initial placement of the linked element.
+     * @method setInitialPosition
+     * @param {int} diffX   the X offset, default 0
+     * @param {int} diffY   the Y offset, default 0
+     * @private
+     */
+    setInitPosition: function(diffX, diffY) {
+        var el = this.getEl();
+
+        if (!this.DDM.verifyEl(el)) {
+            return;
+        }
+
+        var dx = diffX || 0;
+        var dy = diffY || 0;
+
+        var p = Dom.getXY( el );
+
+        this.initPageX = p[0] - dx;
+        this.initPageY = p[1] - dy;
+
+        this.lastPageX = p[0];
+        this.lastPageY = p[1];
+
+
+
+        this.setStartPosition(p);
+    },
+
+    /**
+     * Sets the start position of the element.  This is set when the obj
+     * is initialized, the reset when a drag is started.
+     * @method setStartPosition
+     * @param pos current position (from previous lookup)
+     * @private
+     */
+    setStartPosition: function(pos) {
+        var p = pos || Dom.getXY(this.getEl());
+
+        this.deltaSetXY = null;
+
+        this.startPageX = p[0];
+        this.startPageY = p[1];
+    },
+
+    /**
+     * Add this instance to a group of related drag/drop objects.  All 
+     * instances belong to at least one group, and can belong to as many 
+     * groups as needed.
+     * @method addToGroup
+     * @param sGroup {string} the name of the group
+     */
+    addToGroup: function(sGroup) {
+        this.groups[sGroup] = true;
+        this.DDM.regDragDrop(this, sGroup);
+    },
+
+    /**
+     * Remove's this instance from the supplied interaction group
+     * @method removeFromGroup
+     * @param {string}  sGroup  The group to drop
+     */
+    removeFromGroup: function(sGroup) {
+        if (this.groups[sGroup]) {
+            delete this.groups[sGroup];
+        }
+
+        this.DDM.removeDDFromGroup(this, sGroup);
+    },
+
+    /**
+     * Allows you to specify that an element other than the linked element 
+     * will be moved with the cursor during a drag
+     * @method setDragElId
+     * @param id {string} the id of the element that will be used to initiate the drag
+     */
+    setDragElId: function(id) {
+        this.dragElId = id;
+    },
+
+    /**
+     * Allows you to specify a child of the linked element that should be 
+     * used to initiate the drag operation.  An example of this would be if 
+     * you have a content div with text and links.  Clicking anywhere in the 
+     * content area would normally start the drag operation.  Use this method
+     * to specify that an element inside of the content div is the element 
+     * that starts the drag operation.
+     * @method setHandleElId
+     * @param id {string} the id of the element that will be used to 
+     * initiate the drag.
+     */
+    setHandleElId: function(id) {
+        if (typeof id !== "string") {
+            id = Dom.generateId(id);
+        }
+        this.handleElId = id;
+        this.DDM.regHandle(this.id, id);
+    },
+
+    /**
+     * Allows you to set an element outside of the linked element as a drag 
+     * handle
+     * @method setOuterHandleElId
+     * @param id the id of the element that will be used to initiate the drag
+     */
+    setOuterHandleElId: function(id) {
+        if (typeof id !== "string") {
+            id = Dom.generateId(id);
+        }
+        Event.on(id, "mousedown", 
+                this.handleMouseDown, this, true);
+        this.setHandleElId(id);
+
+        this.hasOuterHandles = true;
+    },
+
+    /**
+     * Remove all drag and drop hooks for this element
+     * @method unreg
+     */
+    unreg: function() {
+        Event.removeListener(this.id, "mousedown", 
+                this.handleMouseDown);
+        this._domRef = null;
+        this.DDM._remove(this);
+    },
+
+    /**
+     * Returns true if this instance is locked, or the drag drop mgr is locked
+     * (meaning that all drag/drop is disabled on the page.)
+     * @method isLocked
+     * @return {boolean} true if this obj or all drag/drop is locked, else 
+     * false
+     */
+    isLocked: function() {
+        return (this.DDM.isLocked() || this.locked);
+    },
+
+    /**
+     * Fired when this object is clicked
+     * @method handleMouseDown
+     * @param {Event} e 
+     * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
+     * @private
+     */
+    handleMouseDown: function(e, oDD) {
+
+        var button = e.which || e.button;
+
+        if (this.primaryButtonOnly && button > 1) {
+            return;
+        }
+
+        if (this.isLocked()) {
+            return;
+        }
+
+
+
+        // firing the mousedown events prior to calculating positions
+        this.b4MouseDown(e);
+        this.onMouseDown(e);
+
+        this.DDM.refreshCache(this.groups);
+        // var self = this;
+        // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
+
+        // Only process the event if we really clicked within the linked 
+        // element.  The reason we make this check is that in the case that 
+        // another element was moved between the clicked element and the 
+        // cursor in the time between the mousedown and mouseup events. When 
+        // this happens, the element gets the next mousedown event 
+        // regardless of where on the screen it happened.  
+        var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
+        if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
+        } else {
+            if (this.clickValidator(e)) {
+
+
+                // set the initial element position
+                this.setStartPosition();
+
+                // start tracking mousemove distance and mousedown time to
+                // determine when to start the actual drag
+                this.DDM.handleMouseDown(e, this);
+
+                // this mousedown is mine
+                this.DDM.stopEvent(e);
+            } else {
+
+
+            }
+        }
+    },
+
+    clickValidator: function(e) {
+        var target = Event.getTarget(e);
+        return ( this.isValidHandleChild(target) &&
+                    (this.id == this.handleElId || 
+                        this.DDM.handleWasClicked(target, this.id)) );
+    },
+
+    /**
+     * Finds the location the element should be placed if we want to move
+     * it to where the mouse location less the click offset would place us.
+     * @method getTargetCoord
+     * @param {int} iPageX the X coordinate of the click
+     * @param {int} iPageY the Y coordinate of the click
+     * @return an object that contains the coordinates (Object.x and Object.y)
+     * @private
+     */
+    getTargetCoord: function(iPageX, iPageY) {
+
+
+        var x = iPageX - this.deltaX;
+        var y = iPageY - 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};
+    },
+
+    /**
+     * Allows you to specify a tag name that should not start a drag operation
+     * when clicked.  This is designed to facilitate embedding links within a
+     * drag handle that do something other than start the drag.
+     * @method addInvalidHandleType
+     * @param {string} tagName the type of element to exclude
+     */
+    addInvalidHandleType: function(tagName) {
+        var type = tagName.toUpperCase();
+        this.invalidHandleTypes[type] = type;
+    },
+
+    /**
+     * Lets you to specify an element id for a child of a drag handle
+     * that should not initiate a drag
+     * @method addInvalidHandleId
+     * @param {string} id the element id of the element you wish to ignore
+     */
+    addInvalidHandleId: function(id) {
+        if (typeof id !== "string") {
+            id = Dom.generateId(id);
+        }
+        this.invalidHandleIds[id] = id;
+    },
+
+
+    /**
+     * Lets you specify a css class of elements that will not initiate a drag
+     * @method addInvalidHandleClass
+     * @param {string} cssClass the class of the elements you wish to ignore
+     */
+    addInvalidHandleClass: function(cssClass) {
+        this.invalidHandleClasses.push(cssClass);
+    },
+
+    /**
+     * Unsets an excluded tag name set by addInvalidHandleType
+     * @method removeInvalidHandleType
+     * @param {string} tagName the type of element to unexclude
+     */
+    removeInvalidHandleType: function(tagName) {
+        var type = tagName.toUpperCase();
+        // this.invalidHandleTypes[type] = null;
+        delete this.invalidHandleTypes[type];
+    },
+    
+    /**
+     * Unsets an invalid handle id
+     * @method removeInvalidHandleId
+     * @param {string} id the id of the element to re-enable
+     */
+    removeInvalidHandleId: function(id) {
+        if (typeof id !== "string") {
+            id = Dom.generateId(id);
+        }
+        delete this.invalidHandleIds[id];
+    },
+
+    /**
+     * Unsets an invalid css class
+     * @method removeInvalidHandleClass
+     * @param {string} cssClass the class of the element(s) you wish to 
+     * re-enable
+     */
+    removeInvalidHandleClass: function(cssClass) {
+        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
+            if (this.invalidHandleClasses[i] == cssClass) {
+                delete this.invalidHandleClasses[i];
+            }
+        }
+    },
+
+    /**
+     * Checks the tag exclusion list to see if this click should be ignored
+     * @method isValidHandleChild
+     * @param {HTMLElement} node the HTMLElement to evaluate
+     * @return {boolean} true if this is a valid tag type, false if not
+     */
+    isValidHandleChild: function(node) {
+
+        var valid = true;
+        // var n = (node.nodeName == "#text") ? node.parentNode : node;
+        var nodeName;
+        try {
+            nodeName = node.nodeName.toUpperCase();
+        } catch(e) {
+            nodeName = node.nodeName;
+        }
+        valid = valid && !this.invalidHandleTypes[nodeName];
+        valid = valid && !this.invalidHandleIds[node.id];
+
+        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
+            valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
+        }
+
+
+        return valid;
+
+    },
+
+    /**
+     * Create the array of horizontal tick marks if an interval was specified
+     * in setXConstraint().
+     * @method setXTicks
+     * @private
+     */
+    setXTicks: function(iStartX, iTickSize) {
+        this.xTicks = [];
+        this.xTickSize = iTickSize;
+        
+        var tickMap = {};
+
+        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
+            if (!tickMap[i]) {
+                this.xTicks[this.xTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
+            if (!tickMap[i]) {
+                this.xTicks[this.xTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        this.xTicks.sort(this.DDM.numericSort) ;
+    },
+
+    /**
+     * Create the array of vertical tick marks if an interval was specified in 
+     * setYConstraint().
+     * @method setYTicks
+     * @private
+     */
+    setYTicks: function(iStartY, iTickSize) {
+        this.yTicks = [];
+        this.yTickSize = iTickSize;
+
+        var tickMap = {};
+
+        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
+            if (!tickMap[i]) {
+                this.yTicks[this.yTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
+            if (!tickMap[i]) {
+                this.yTicks[this.yTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        this.yTicks.sort(this.DDM.numericSort) ;
+    },
+
+    /**
+     * By default, the element can be dragged any place on the screen.  Use 
+     * this method to limit the horizontal travel of the element.  Pass in 
+     * 0,0 for the parameters if you want to lock the drag to the y axis.
+     * @method setXConstraint
+     * @param {int} iLeft the number of pixels the element can move to the left
+     * @param {int} iRight the number of pixels the element can move to the 
+     * right
+     * @param {int} iTickSize optional parameter for specifying that the 
+     * element
+     * should move iTickSize pixels at a time.
+     */
+    setXConstraint: function(iLeft, iRight, iTickSize) {
+        this.leftConstraint = parseInt(iLeft, 10);
+        this.rightConstraint = parseInt(iRight, 10);
+
+        this.minX = this.initPageX - this.leftConstraint;
+        this.maxX = this.initPageX + this.rightConstraint;
+        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
+
+        this.constrainX = true;
+    },
+
+    /**
+     * Clears any constraints applied to this instance.  Also clears ticks
+     * since they can't exist independent of a constraint at this time.
+     * @method clearConstraints
+     */
+    clearConstraints: function() {
+        this.constrainX = false;
+        this.constrainY = false;
+        this.clearTicks();
+    },
+
+    /**
+     * Clears any tick interval defined for this instance
+     * @method clearTicks
+     */
+    clearTicks: function() {
+        this.xTicks = null;
+        this.yTicks = null;
+        this.xTickSize = 0;
+        this.yTickSize = 0;
+    },
+
+    /**
+     * By default, the element can be dragged any place on the screen.  Set 
+     * this to limit the vertical travel of the element.  Pass in 0,0 for the
+     * parameters if you want to lock the drag to the x axis.
+     * @method setYConstraint
+     * @param {int} iUp the number of pixels the element can move up
+     * @param {int} iDown the number of pixels the element can move down
+     * @param {int} iTickSize optional parameter for specifying that the 
+     * element should move iTickSize pixels at a time.
+     */
+    setYConstraint: function(iUp, iDown, iTickSize) {
+        this.topConstraint = parseInt(iUp, 10);
+        this.bottomConstraint = parseInt(iDown, 10);
+
+        this.minY = this.initPageY - this.topConstraint;
+        this.maxY = this.initPageY + this.bottomConstraint;
+        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
+
+        this.constrainY = true;
+        
+    },
+
+    /**
+     * resetConstraints must be called if you manually reposition a dd element.
+     * @method resetConstraints
+     */
+    resetConstraints: function() {
+
+
+        // Maintain offsets if necessary
+        if (this.initPageX || this.initPageX === 0) {
+            // figure out how much this thing has moved
+            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
+            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
+
+            this.setInitPosition(dx, dy);
+
+        // This is the first time we have detected the element's position
+        } 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         );
+        }
+    },
+
+    /**
+     * Normally the drag element is moved pixel by pixel, but we can specify 
+     * that it move a number of pixels at a time.  This method resolves the 
+     * location when we have it set up like this.
+     * @method getTick
+     * @param {int} val where we want to place the object
+     * @param {int[]} tickArray sorted array of valid points
+     * @return {int} the closest tick
+     * @private
+     */
+    getTick: function(val, tickArray) {
+
+        if (!tickArray) {
+            // If tick interval is not defined, it is effectively 1 pixel, 
+            // so we return the value passed to us.
+            return val; 
+        } else if (tickArray[0] >= val) {
+            // The value is lower than the first tick, so we return the first
+            // tick.
+            return tickArray[0];
+        } else {
+            for (var i=0, len=tickArray.length; i<len; ++i) {
+                var next = i + 1;
+                if (tickArray[next] && tickArray[next] >= val) {
+                    var diff1 = val - tickArray[i];
+                    var diff2 = tickArray[next] - val;
+                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];
+                }
+            }
+
+            // The value is larger than the last tick, so we return the last
+            // tick.
+            return tickArray[tickArray.length - 1];
+        }
+    },
+
+    /**
+     * toString method
+     * @method toString
+     * @return {string} string representation of the dd obj
+     */
+    toString: function() {
+        return ("DragDrop " + this.id);
+    }
+
+};
+
+})();
+/**
+ * A DragDrop implementation where the linked element follows the 
+ * mouse cursor during a drag.
+ * @class DD
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} id the id of the linked element 
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DD: 
+ *                    scroll
+ */
+YAHOO.util.DD = function(id, sGroup, config) {
+    if (id) {
+        this.init(id, sGroup, config);
+    }
+};
+
+YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
+
+    /**
+     * When set to true, the utility automatically tries to scroll the browser
+     * window wehn a drag and drop element is dragged near the viewport boundary.
+     * Defaults to true.
+     * @property scroll
+     * @type boolean
+     */
+    scroll: true, 
+
+    /**
+     * Sets the pointer offset to the distance between the linked element's top 
+     * left corner and the location the element was clicked
+     * @method autoOffset
+     * @param {int} iPageX the X coordinate of the click
+     * @param {int} iPageY the Y coordinate of the click
+     */
+    autoOffset: function(iPageX, iPageY) {
+        var x = iPageX - this.startPageX;
+        var y = iPageY - this.startPageY;
+        this.setDelta(x, y);
+    },
+
+    /** 
+     * Sets the pointer offset.  You can call this directly to force the 
+     * offset to be in a particular location (e.g., pass in 0,0 to set it 
+     * to the center of the object, as done in YAHOO.widget.Slider)
+     * @method setDelta
+     * @param {int} iDeltaX the distance from the left
+     * @param {int} iDeltaY the distance from the top
+     */
+    setDelta: function(iDeltaX, iDeltaY) {
+        this.deltaX = iDeltaX;
+        this.deltaY = iDeltaY;
+    },
+
+    /**
+     * Sets the drag element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
+     * location other than where the cursor is.
+     * @method setDragElPos
+     * @param {int} iPageX the X coordinate of the mousedown or drag event
+     * @param {int} iPageY the Y coordinate of the mousedown or drag event
+     */
+    setDragElPos: function(iPageX, iPageY) {
+        // the first time we do this, we are going to check to make sure
+        // the element has css positioning
+
+        var el = this.getDragEl();
+        this.alignElWithMouse(el, iPageX, iPageY);
+    },
+
+    /**
+     * Sets the element to the location of the mousedown or click event, 
+     * maintaining the cursor location relative to the location on the element 
+     * that was clicked.  Override this if you want to place the element in a 
+     * location other than where the cursor is.
+     * @method alignElWithMouse
+     * @param {HTMLElement} el the element to move
+     * @param {int} iPageX the X coordinate of the mousedown or drag event
+     * @param {int} iPageY the Y coordinate of the mousedown or drag event
+     */
+    alignElWithMouse: function(el, iPageX, iPageY) {
+        var oCoord = this.getTargetCoord(iPageX, iPageY);
+
+        if (!this.deltaSetXY) {
+            var aCoord = [oCoord.x, oCoord.y];
+            YAHOO.util.Dom.setXY(el, aCoord);
+            var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
+            var newTop  = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
+
+            this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
+        } else {
+            YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
+            YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");
+        }
+        
+        this.cachePosition(oCoord.x, oCoord.y);
+        this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
+    },
+
+    /**
+     * Saves the most recent position so that we can reset the constraints and
+     * tick marks on-demand.  We need to know this so that we can calculate the
+     * number of pixels the element is offset from its original position.
+     * @method cachePosition
+     * @param iPageX the current x position (optional, this just makes it so we
+     * don't have to look it up again)
+     * @param iPageY the current y position (optional, this just makes it so we
+     * don't have to look it up again)
+     */
+    cachePosition: function(iPageX, iPageY) {
+        if (iPageX) {
+            this.lastPageX = iPageX;
+            this.lastPageY = iPageY;
+        } else {
+            var aCoord = YAHOO.util.Dom.getXY(this.getEl());
+            this.lastPageX = aCoord[0];
+            this.lastPageY = aCoord[1];
+        }
+    },
+
+    /**
+     * Auto-scroll the window if the dragged object has been moved beyond the 
+     * visible window boundary.
+     * @method autoScroll
+     * @param {int} x the drag element's x position
+     * @param {int} y the drag element's y position
+     * @param {int} h the height of the drag element
+     * @param {int} w the width of the drag element
+     * @private
+     */
+    autoScroll: function(x, y, h, w) {
+
+        if (this.scroll) {
+            // The client height
+            var clientH = this.DDM.getClientHeight();
+
+            // The client width
+            var clientW = this.DDM.getClientWidth();
+
+            // The amt scrolled down
+            var st = this.DDM.getScrollTop();
+
+            // The amt scrolled right
+            var sl = this.DDM.getScrollLeft();
+
+            // Location of the bottom of the element
+            var bot = h + y;
+
+            // Location of the right of the element
+            var right = w + x;
+
+            // The distance from the cursor to the bottom of the visible area, 
+            // adjusted so that we don't scroll if the cursor is beyond the
+            // element drag constraints
+            var toBot = (clientH + st - y - this.deltaY);
+
+            // The distance from the cursor to the right of the visible area
+            var toRight = (clientW + sl - x - this.deltaX);
+
+
+            // How close to the edge the cursor must be before we scroll
+            // var thresh = (document.all) ? 100 : 40;
+            var thresh = 40;
+
+            // How many pixels to scroll per autoscroll op.  This helps to reduce 
+            // clunky scrolling. IE is more sensitive about this ... it needs this 
+            // value to be higher.
+            var scrAmt = (document.all) ? 80 : 30;
+
+            // Scroll down if we are near the bottom of the visible page and the 
+            // obj extends below the crease
+            if ( bot > clientH && toBot < thresh ) { 
+                window.scrollTo(sl, st + scrAmt); 
+            }
+
+            // Scroll up if the window is scrolled down and the top of the object
+            // goes above the top border
+            if ( y < st && st > 0 && y - st < thresh ) { 
+                window.scrollTo(sl, st - scrAmt); 
+            }
+
+            // Scroll right if the obj is beyond the right border and the cursor is
+            // near the border.
+            if ( right > clientW && toRight < thresh ) { 
+                window.scrollTo(sl + scrAmt, st); 
+            }
+
+            // Scroll left if the window has been scrolled to the right and the obj
+            // extends past the left border
+            if ( x < sl && sl > 0 && x - sl < thresh ) { 
+                window.scrollTo(sl - scrAmt, st);
+            }
+        }
+    },
+
+    /*
+     * Sets up config options specific to this class. Overrides
+     * YAHOO.util.DragDrop, but all versions of this method through the 
+     * inheritance chain are called
+     */
+    applyConfig: function() {
+        YAHOO.util.DD.superclass.applyConfig.call(this);
+        this.scroll = (this.config.scroll !== false);
+    },
+
+    /*
+     * Event that fires prior to the onMouseDown event.  Overrides 
+     * YAHOO.util.DragDrop.
+     */
+    b4MouseDown: function(e) {
+        this.setStartPosition();
+        // this.resetConstraints();
+        this.autoOffset(YAHOO.util.Event.getPageX(e), 
+                            YAHOO.util.Event.getPageY(e));
+    },
+
+    /*
+     * Event that fires prior to the onDrag event.  Overrides 
+     * YAHOO.util.DragDrop.
+     */
+    b4Drag: function(e) {
+        this.setDragElPos(YAHOO.util.Event.getPageX(e), 
+                            YAHOO.util.Event.getPageY(e));
+    },
+
+    toString: function() {
+        return ("DD " + this.id);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    // Debugging ygDragDrop events that can be overridden
+    //////////////////////////////////////////////////////////////////////////
+    /*
+    startDrag: function(x, y) {
+    },
+
+    onDrag: function(e) {
+    },
+
+    onDragEnter: function(e, id) {
+    },
+
+    onDragOver: function(e, id) {
+    },
+
+    onDragOut: function(e, id) {
+    },
+
+    onDragDrop: function(e, id) {
+    },
+
+    endDrag: function(e) {
+    }
+
+    */
+
+});
+/**
+ * A DragDrop implementation that inserts an empty, bordered div into
+ * the document that follows the cursor during drag operations.  At the time of
+ * the click, the frame div is resized to the dimensions of the linked html
+ * element, and moved to the exact location of the linked element.
+ *
+ * References to the "frame" element refer to the single proxy element that
+ * was created to be dragged in place of all DDProxy elements on the
+ * page.
+ *
+ * @class DDProxy
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the linked html element
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DDProxy in addition to those in DragDrop: 
+ *                   resizeFrame, centerFrame, dragElId
+ */
+YAHOO.util.DDProxy = function(id, sGroup, config) {
+    if (id) {
+        this.init(id, sGroup, config);
+        this.initFrame(); 
+    }
+};
+
+/**
+ * The default drag frame div id
+ * @property YAHOO.util.DDProxy.dragElId
+ * @type String
+ * @static
+ */
+YAHOO.util.DDProxy.dragElId = "ygddfdiv";
+
+YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
+
+    /**
+     * By default we resize the drag frame to be the same size as the element
+     * we want to drag (this is to get the frame effect).  We can turn it off
+     * if we want a different behavior.
+     * @property resizeFrame
+     * @type boolean
+     */
+    resizeFrame: true,
+
+    /**
+     * By default the frame is positioned exactly where the drag element is, so
+     * we use the cursor offset provided by YAHOO.util.DD.  Another option that works only if
+     * you do not have constraints on the obj is to have the drag frame centered
+     * around the cursor.  Set centerFrame to true for this effect.
+     * @property centerFrame
+     * @type boolean
+     */
+    centerFrame: false,
+
+    /**
+     * Creates the proxy element if it does not yet exist
+     * @method createFrame
+     */
+    createFrame: function() {
+        var self=this, body=document.body;
+
+        if (!body || !body.firstChild) {
+            setTimeout( function() { self.createFrame(); }, 50 );
+            return;
+        }
+
+        var div=this.getDragEl(), Dom=YAHOO.util.Dom;
+
+        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;
+            s.height     = "25px";
+            s.width      = "25px";
+
+            var _data = document.createElement('div');
+            Dom.setStyle(_data, 'height', '100%');
+            Dom.setStyle(_data, 'width', '100%');
+            /**
+            * If the proxy element has no background-color, then it is considered to the "transparent" by Internet Explorer.
+            * Since it is "transparent" then the events pass through it to the iframe below.
+            * So creating a "fake" div inside the proxy element and giving it a background-color, then setting it to an
+            * opacity of 0, it appears to not be there, however IE still thinks that it is so the events never pass through.
+            */
+            Dom.setStyle(_data, 'background-color', '#ccc');
+            Dom.setStyle(_data, 'opacity', '0');
+            div.appendChild(_data);
+
+            // appendChild can blow up IE if invoked prior to the window load event
+            // while rendering a table.  It is possible there are other scenarios 
+            // that would cause this to happen as well.
+            body.insertBefore(div, body.firstChild);
+        }
+    },
+
+    /**
+     * Initialization for the drag frame element.  Must be called in the
+     * constructor of all subclasses
+     * @method initFrame
+     */
+    initFrame: function() {
+        this.createFrame();
+    },
+
+    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);
+    },
+
+    /**
+     * Resizes the drag frame to the dimensions of the clicked object, positions 
+     * it over the object, and finally displays it
+     * @method showFrame
+     * @param {int} iPageX X click position
+     * @param {int} iPageY Y click position
+     * @private
+     */
+    showFrame: function(iPageX, iPageY) {
+        var el = this.getEl();
+        var dragEl = this.getDragEl();
+        var s = dragEl.style;
+
+        this._resizeProxy();
+
+        if (this.centerFrame) {
+            this.setDelta( Math.round(parseInt(s.width,  10)/2), 
+                           Math.round(parseInt(s.height, 10)/2) );
+        }
+
+        this.setDragElPos(iPageX, iPageY);
+
+        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); 
+    },
+
+    /**
+     * The proxy is automatically resized to the dimensions of the linked
+     * element when a drag is initiated, unless resizeFrame is set to false
+     * @method _resizeProxy
+     * @private
+     */
+    _resizeProxy: function() {
+        if (this.resizeFrame) {
+            var DOM    = YAHOO.util.Dom;
+            var el     = this.getEl();
+            var dragEl = this.getDragEl();
+
+            var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth"    ), 10);
+            var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth"  ), 10);
+            var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
+            var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth"   ), 10);
+
+            if (isNaN(bt)) { bt = 0; }
+            if (isNaN(br)) { br = 0; }
+            if (isNaN(bb)) { bb = 0; }
+            if (isNaN(bl)) { bl = 0; }
+
+
+            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);                                                                                           
+            var newHeight = Math.max(0, el.offsetHeight - bt - bb);
+
+
+            DOM.setStyle( dragEl, "width",  newWidth  + "px" );
+            DOM.setStyle( dragEl, "height", newHeight + "px" );
+        }
+    },
+
+    // overrides YAHOO.util.DragDrop
+    b4MouseDown: function(e) {
+        this.setStartPosition();
+        var x = YAHOO.util.Event.getPageX(e);
+        var y = YAHOO.util.Event.getPageY(e);
+        this.autoOffset(x, y);
+
+        // This causes the autoscroll code to kick off, which means autoscroll can
+        // happen prior to the check for a valid drag handle.
+        // this.setDragElPos(x, y);
+    },
+
+    // overrides YAHOO.util.DragDrop
+    b4StartDrag: function(x, y) {
+        // show the drag frame
+        this.showFrame(x, y);
+    },
+
+    // overrides YAHOO.util.DragDrop
+    b4EndDrag: function(e) {
+        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); 
+    },
+
+    // overrides YAHOO.util.DragDrop
+    // By default we try to move the element to the last location of the frame.  
+    // This is so that the default behavior mirrors that of YAHOO.util.DD.  
+    endDrag: function(e) {
+        var DOM = YAHOO.util.Dom;
+        var lel = this.getEl();
+        var del = this.getDragEl();
+
+        // Show the drag frame briefly so we can get its position
+        // del.style.visibility = "";
+        DOM.setStyle(del, "visibility", ""); 
+
+        // Hide the linked element before the move to get around a Safari 
+        // rendering bug.
+        //lel.style.visibility = "hidden";
+        DOM.setStyle(lel, "visibility", "hidden"); 
+        YAHOO.util.DDM.moveToEl(lel, del);
+        //del.style.visibility = "hidden";
+        DOM.setStyle(del, "visibility", "hidden"); 
+        //lel.style.visibility = "";
+        DOM.setStyle(lel, "visibility", ""); 
+    },
+
+    toString: function() {
+        return ("DDProxy " + this.id);
+    }
+
+});
+/**
+ * A DragDrop implementation that does not move, but can be a drop 
+ * target.  You would get the same result by simply omitting implementation 
+ * for the event callbacks, but this way we reduce the processing cost of the 
+ * event listener and the callbacks.
+ * @class DDTarget
+ * @extends YAHOO.util.DragDrop 
+ * @constructor
+ * @param {String} id the id of the element that is a drop target
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                 Valid properties for DDTarget in addition to those in 
+ *                 DragDrop: 
+ *                    none
+ */
+YAHOO.util.DDTarget = function(id, sGroup, config) {
+    if (id) {
+        this.initTarget(id, sGroup, config);
+    }
+};
+
+// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
+YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
+    toString: function() {
+        return ("DDTarget " + this.id);
+    }
+});
+YAHOO.register("dragdrop", YAHOO.util.DragDropMgr, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/editor-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/editor-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/editor-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,6082 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+*/
+/**
+ * @description <p>Creates a rich Toolbar widget based on Button. Primarily used with the Rich Text Editor</p>
+ * @class Toolbar
+ * @namespace YAHOO.widget
+ * @requires yahoo, dom, element, event
+ * @optional container, menu, button, dragdrop
+ * @beta
+ */
+(function() {
+    /**
+    * @private
+    **/
+var Dom = YAHOO.util.Dom,
+    Event = YAHOO.util.Event,
+    Lang = YAHOO.lang;
+
+    /**
+     * Provides a rich toolbar widget based on the button and menu widgets
+     * @constructor
+     * @param {String/HTMLElement} el The element to turn into a toolbar.
+     * @param {Object} attrs Object liternal containing configuration parameters.
+    */
+    YAHOO.widget.Toolbar = function(el, attrs) {
+        
+        if (Lang.isObject(arguments[0]) && !Dom.get(el).nodeType) {
+            attrs = el;
+        }
+        var local_attrs = (attrs || {});
+
+        var oConfig = {
+            element: null,
+            attributes: local_attrs
+        };
+        
+        
+        if (Lang.isString(el) && Dom.get(el)) {
+            oConfig.element = Dom.get(el);
+        } else if (Lang.isObject(el) && Dom.get(el) && Dom.get(el).nodeType) {  
+            oConfig.element = Dom.get(el);
+        }
+        
+
+        if (!oConfig.element) {
+            oConfig.element = document.createElement('DIV');
+            oConfig.element.id = Dom.generateId();
+            
+            if (local_attrs.container && Dom.get(local_attrs.container)) {
+                Dom.get(local_attrs.container).appendChild(oConfig.element);
+            }
+        }
+        
+
+        if (!oConfig.element.id) {
+            oConfig.element.id = ((Lang.isString(el)) ? el : Dom.generateId());
+        }
+        
+        var cont = document.createElement('DIV');
+        oConfig.attributes.cont = cont;
+        Dom.addClass(cont, 'yui-toolbar-subcont');
+        oConfig.element.appendChild(cont);
+        
+        oConfig.attributes.element = oConfig.element;
+        oConfig.attributes.id = oConfig.element.id;
+
+        YAHOO.widget.Toolbar.superclass.constructor.call(this, oConfig.element, oConfig.attributes);
+         
+    };
+
+    /**
+    * @method _addMenuClasses
+    * @private
+    * @description This method is called from Menu's renderEvent to add a few more classes to the menu items
+    * @param {String} ev The event that fired.
+    * @param {Array} na Array of event information.
+    * @param {Object} o Button config object. 
+    */
+
+    function _addMenuClasses(ev, na, o) {
+        Dom.addClass(this.element, 'yui-toolbar-' + o.get('value') + '-menu');
+        if (Dom.hasClass(o._button.parentNode.parentNode, 'yui-toolbar-select')) {
+            Dom.addClass(this.element, 'yui-toolbar-select-menu');
+        }
+        var items = this.getItems();
+        for (var i = 0; i < items.length; i++) {
+            Dom.addClass(items[i].element, 'yui-toolbar-' + o.get('value') + '-' + ((items[i].value) ? items[i].value.replace(/ /g, '-').toLowerCase() : items[i]._oText.nodeValue.replace(/ /g, '-').toLowerCase()));
+            Dom.addClass(items[i].element, 'yui-toolbar-' + o.get('value') + '-' + ((items[i].value) ? items[i].value.replace(/ /g, '-') : items[i]._oText.nodeValue.replace(/ /g, '-')));
+        }
+    }
+
+    YAHOO.extend(YAHOO.widget.Toolbar, YAHOO.util.Element, {
+        /** 
+        * @property dd
+        * @description The DragDrop instance associated with the Toolbar
+        * @type Object
+        */
+        dd: null,
+        /** 
+        * @property _colorData
+        * @description Object reference containing colors hex and text values.
+        * @type Object
+        */
+        _colorData: {
+/* {{{ _colorData */
+    '#111111': 'Obsidian',
+    '#2D2D2D': 'Dark Gray',
+    '#434343': 'Shale',
+    '#5B5B5B': 'Flint',
+    '#737373': 'Gray',
+    '#8B8B8B': 'Concrete',
+    '#A2A2A2': 'Gray',
+    '#B9B9B9': 'Titanium',
+    '#000000': 'Black',
+    '#D0D0D0': 'Light Gray',
+    '#E6E6E6': 'Silver',
+    '#FFFFFF': 'White',
+    '#BFBF00': 'Pumpkin',
+    '#FFFF00': 'Yellow',
+    '#FFFF40': 'Banana',
+    '#FFFF80': 'Pale Yellow',
+    '#FFFFBF': 'Butter',
+    '#525330': 'Raw Siena',
+    '#898A49': 'Mildew',
+    '#AEA945': 'Olive',
+    '#7F7F00': 'Paprika',
+    '#C3BE71': 'Earth',
+    '#E0DCAA': 'Khaki',
+    '#FCFAE1': 'Cream',
+    '#60BF00': 'Cactus',
+    '#80FF00': 'Chartreuse',
+    '#A0FF40': 'Green',
+    '#C0FF80': 'Pale Lime',
+    '#DFFFBF': 'Light Mint',
+    '#3B5738': 'Green',
+    '#668F5A': 'Lime Gray',
+    '#7F9757': 'Yellow',
+    '#407F00': 'Clover',
+    '#8A9B55': 'Pistachio',
+    '#B7C296': 'Light Jade',
+    '#E6EBD5': 'Breakwater',
+    '#00BF00': 'Spring Frost',
+    '#00FF80': 'Pastel Green',
+    '#40FFA0': 'Light Emerald',
+    '#80FFC0': 'Sea Foam',
+    '#BFFFDF': 'Sea Mist',
+    '#033D21': 'Dark Forrest',
+    '#438059': 'Moss',
+    '#7FA37C': 'Medium Green',
+    '#007F40': 'Pine',
+    '#8DAE94': 'Yellow Gray Green',
+    '#ACC6B5': 'Aqua Lung',
+    '#DDEBE2': 'Sea Vapor',
+    '#00BFBF': 'Fog',
+    '#00FFFF': 'Cyan',
+    '#40FFFF': 'Turquoise Blue',
+    '#80FFFF': 'Light Aqua',
+    '#BFFFFF': 'Pale Cyan',
+    '#033D3D': 'Dark Teal',
+    '#347D7E': 'Gray Turquoise',
+    '#609A9F': 'Green Blue',
+    '#007F7F': 'Seaweed',
+    '#96BDC4': 'Green Gray',
+    '#B5D1D7': 'Soapstone',
+    '#E2F1F4': 'Light Turquoise',
+    '#0060BF': 'Summer Sky',
+    '#0080FF': 'Sky Blue',
+    '#40A0FF': 'Electric Blue',
+    '#80C0FF': 'Light Azure',
+    '#BFDFFF': 'Ice Blue',
+    '#1B2C48': 'Navy',
+    '#385376': 'Biscay',
+    '#57708F': 'Dusty Blue',
+    '#00407F': 'Sea Blue',
+    '#7792AC': 'Sky Blue Gray',
+    '#A8BED1': 'Morning Sky',
+    '#DEEBF6': 'Vapor',
+    '#0000BF': 'Deep Blue',
+    '#0000FF': 'Blue',
+    '#4040FF': 'Cerulean Blue',
+    '#8080FF': 'Evening Blue',
+    '#BFBFFF': 'Light Blue',
+    '#212143': 'Deep Indigo',
+    '#373E68': 'Sea Blue',
+    '#444F75': 'Night Blue',
+    '#00007F': 'Indigo Blue',
+    '#585E82': 'Dockside',
+    '#8687A4': 'Blue Gray',
+    '#D2D1E1': 'Light Blue Gray',
+    '#6000BF': 'Neon Violet',
+    '#8000FF': 'Blue Violet',
+    '#A040FF': 'Violet Purple',
+    '#C080FF': 'Violet Dusk',
+    '#DFBFFF': 'Pale Lavender',
+    '#302449': 'Cool Shale',
+    '#54466F': 'Dark Indigo',
+    '#655A7F': 'Dark Violet',
+    '#40007F': 'Violet',
+    '#726284': 'Smoky Violet',
+    '#9E8FA9': 'Slate Gray',
+    '#DCD1DF': 'Violet White',
+    '#BF00BF': 'Royal Violet',
+    '#FF00FF': 'Fuchsia',
+    '#FF40FF': 'Magenta',
+    '#FF80FF': 'Orchid',
+    '#FFBFFF': 'Pale Magenta',
+    '#4A234A': 'Dark Purple',
+    '#794A72': 'Medium Purple',
+    '#936386': 'Cool Granite',
+    '#7F007F': 'Purple',
+    '#9D7292': 'Purple Moon',
+    '#C0A0B6': 'Pale Purple',
+    '#ECDAE5': 'Pink Cloud',
+    '#BF005F': 'Hot Pink',
+    '#FF007F': 'Deep Pink',
+    '#FF409F': 'Grape',
+    '#FF80BF': 'Electric Pink',
+    '#FFBFDF': 'Pink',
+    '#451528': 'Purple Red',
+    '#823857': 'Purple Dino',
+    '#A94A76': 'Purple Gray',
+    '#7F003F': 'Rose',
+    '#BC6F95': 'Antique Mauve',
+    '#D8A5BB': 'Cool Marble',
+    '#F7DDE9': 'Pink Granite',
+    '#C00000': 'Apple',
+    '#FF0000': 'Fire Truck',
+    '#FF4040': 'Pale Red',
+    '#FF8080': 'Salmon',
+    '#FFC0C0': 'Warm Pink',
+    '#441415': 'Sepia',
+    '#82393C': 'Rust',
+    '#AA4D4E': 'Brick',
+    '#800000': 'Brick Red',
+    '#BC6E6E': 'Mauve',
+    '#D8A3A4': 'Shrimp Pink',
+    '#F8DDDD': 'Shell Pink',
+    '#BF5F00': 'Dark Orange',
+    '#FF7F00': 'Orange',
+    '#FF9F40': 'Grapefruit',
+    '#FFBF80': 'Canteloupe',
+    '#FFDFBF': 'Wax',
+    '#482C1B': 'Dark Brick',
+    '#855A40': 'Dirt',
+    '#B27C51': 'Tan',
+    '#7F3F00': 'Nutmeg',
+    '#C49B71': 'Mustard',
+    '#E1C4A8': 'Pale Tan',
+    '#FDEEE0': 'Marble'
+/* }}} */
+        },
+        /** 
+        * @property _colorPicker
+        * @description The HTML Element containing the colorPicker
+        * @type HTMLElement
+        */
+        _colorPicker: null,
+        /** 
+        * @property STR_COLLAPSE
+        * @description String for Toolbar Collapse Button
+        * @type String
+        */
+        STR_COLLAPSE: 'Collapse Toolbar',
+        /** 
+        * @property STR_SPIN_LABEL
+        * @description String for spinbutton dynamic label. Note the {VALUE} will be replaced with YAHOO.lang.substitute
+        * @type String
+        */
+        STR_SPIN_LABEL: 'Spin Button with value {VALUE}. Use Control Shift Up Arrow and Control Shift Down arrow keys to increase or decrease the value.',
+        /** 
+        * @property STR_SPIN_UP
+        * @description String for spinbutton up
+        * @type String
+        */
+        STR_SPIN_UP: 'Click to increase the value of this input',
+        /** 
+        * @property STR_SPIN_DOWN
+        * @description String for spinbutton down
+        * @type String
+        */
+        STR_SPIN_DOWN: 'Click to decrease the value of this input',
+        /** 
+        * @property _titlebar
+        * @description Object reference to the titlebar
+        * @type HTMLElement
+        */
+        _titlebar: null,
+        /** 
+        * @property _disabled
+        * @description Object to track button status when enabling/disabling the toolbar
+        * @type Object
+        */
+        _disabled: null,
+        /** 
+        * @property browser
+        * @description Standard browser detection
+        * @type Object
+        */
+        browser: YAHOO.env.ua,
+        /**
+        * @protected
+        * @property _buttonList
+        * @description Internal property list of current buttons in the toolbar
+        * @type Array
+        */
+        _buttonList: null,
+        /**
+        * @protected
+        * @property _buttonGroupList
+        * @description Internal property list of current button groups in the toolbar
+        * @type Array
+        */
+        _buttonGroupList: null,
+        /**
+        * @protected
+        * @property _sep
+        * @description Internal reference to the separator HTML Element for cloning
+        * @type HTMLElement
+        */
+        _sep: null,
+        /**
+        * @protected
+        * @property _sepCount
+        * @description Internal refernce for counting separators, so we can give them a useful class name for styling
+        * @type Number
+        */
+        _sepCount: null,
+        /**
+        * @protected
+        * @property draghandle
+        * @type HTMLElement
+        */
+        _dragHandle: null,
+        /**
+        * @protected
+        * @property _toolbarConfigs
+        * @type Object
+        */
+        _toolbarConfigs: {
+            renderer: true
+        },
+        /**
+        * @protected
+        * @property CLASS_CONTAINER
+        * @description Default CSS class to apply to the toolbar container element
+        * @type String
+        */
+        CLASS_CONTAINER: 'yui-toolbar-container',
+        /**
+        * @protected
+        * @property CLASS_DRAGHANDLE
+        * @description Default CSS class to apply to the toolbar's drag handle element
+        * @type String
+        */
+        CLASS_DRAGHANDLE: 'yui-toolbar-draghandle',
+        /**
+        * @protected
+        * @property CLASS_SEPARATOR
+        * @description Default CSS class to apply to all separators in the toolbar
+        * @type String
+        */
+        CLASS_SEPARATOR: 'yui-toolbar-separator',
+        /**
+        * @protected
+        * @property CLASS_DISABLED
+        * @description Default CSS class to apply when the toolbar is disabled
+        * @type String
+        */
+        CLASS_DISABLED: 'yui-toolbar-disabled',
+        /**
+        * @protected
+        * @property CLASS_PREFIX
+        * @description Default prefix for dynamically created class names
+        * @type String
+        */
+        CLASS_PREFIX: 'yui-toolbar',
+        /** 
+        * @method init
+        * @description The Toolbar class's initialization method
+        */
+        init: function(p_oElement, p_oAttributes) {
+            YAHOO.widget.Toolbar.superclass.init.call(this, p_oElement, p_oAttributes);
+        },
+        /**
+        * @method initAttributes
+        * @description Initializes all of the configuration attributes used to create 
+        * the toolbar.
+        * @param {Object} attr Object literal specifying a set of 
+        * configuration attributes used to create the toolbar.
+        */
+        initAttributes: function(attr) {
+            YAHOO.widget.Toolbar.superclass.initAttributes.call(this, attr);
+            var el = this.get('element');
+            this.addClass(this.CLASS_CONTAINER);
+
+
+            /**
+            * @attribute buttons
+            * @description Object specifying the buttons to include in the toolbar
+            * Example:
+            * <code><pre>
+            * {
+            *   { id: 'b3', type: 'button', label: 'Underline', value: 'underline' },
+            *   { type: 'separator' },
+            *   { id: 'b4', type: 'menu', label: 'Align', value: 'align',
+            *       menu: [
+            *           { text: "Left", value: 'alignleft' },
+            *           { text: "Center", value: 'aligncenter' },
+            *           { text: "Right", value: 'alignright' }
+            *       ]
+            *   }
+            * }
+            * </pre></code>
+            * @type Array
+            */
+            
+            this.setAttributeConfig('buttons', {
+                value: [],
+                writeOnce: true,
+                method: function(data) {
+                    for (var i in data) {
+                        if (Lang.hasOwnProperty(data, i)) {
+                            if (data[i].type == 'separator') {
+                                this.addSeparator();
+                            } else if (data[i].group !== undefined) {
+                                this.addButtonGroup(data[i]);
+                            } else {
+                                this.addButton(data[i]);
+                            }
+                        }
+                    }
+                }
+            });
+
+            /**
+            * @attribute disabled
+            * @description Boolean indicating if the toolbar should be disabled. It will also disable the draggable attribute if it is on.
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig('disabled', {
+                value: false,
+                method: function(disabled) {
+                    if (this.get('disabled') === disabled) {
+                        return false;
+                    }
+                    if (!Lang.isObject(this._disabled)) {
+                        this._disabled = {};
+                    }
+                    if (disabled) {
+                        this.addClass(this.CLASS_DISABLED);
+                        this.set('draggable', false);
+                    } else {
+                        this.removeClass(this.CLASS_DISABLED);
+                        if (this._configs.draggable._initialConfig.value) {
+                            //Draggable by default, set it back
+                            this.set('draggable', true);
+                        }
+                    }
+                    var len = this._buttonList.length;
+                    for (var i = 0; i < len; i++) {
+                        if (disabled) {
+                            //If it's already disabled, flag it
+                            if (this._buttonList[i].get('disabled')) {
+                                this._disabled[i] = true;
+                            } else {
+                                this._disabled[i] = null;
+                            }
+                            this.disableButton(this._buttonList[i].get('id'));
+                        } else {
+                            //Check to see if it was disabled by default and skip it
+                            var _button = this._buttonList[i];
+                            var _check = _button._configs.disabled._initialConfig.value;
+                            if (this._disabled[i] === true) {
+                                _check = true;
+                            }
+                            if (!_check) {
+                                this.enableButton(_button.get('id'));
+                            }
+                        }
+                    }
+                    if (!disabled) {
+                        this._disabled = {};
+                    }
+                }
+            });
+
+            /**
+            * @attribute cont
+            * @description The container for the toolbar.
+            * @type HTMLElement
+            */
+            this.setAttributeConfig('cont', {
+                value: attr.cont,
+                readOnly: true
+            });
+
+
+            /**
+            * @attribute grouplabels
+            * @description Boolean indicating if the toolbar should show the group label's text string.
+            * @default true
+            * @type Boolean
+            */
+            this.setAttributeConfig('grouplabels', {
+                value: attr.grouplabels || true,
+                method: function(grouplabels) {
+                    if (grouplabels) {
+                        Dom.removeClass(this.get('cont'), (this.CLASS_PREFIX + '-nogrouplabels'));
+                    } else {
+                        Dom.addClass(this.get('cont'), (this.CLASS_PREFIX + '-nogrouplabels'));
+                    }
+                }
+            });
+            /**
+            * @attribute titlebar
+            * @description Boolean indicating if the toolbar should have a titlebar. If
+            * passed a string, it will use that as the titlebar text
+            * @default false
+            * @type Boolean or String
+            */
+            this.setAttributeConfig('titlebar', {
+                value: false,
+                method: function(titlebar) {
+                    if (titlebar) {
+                        if (this._titlebar && this._titlebar.parentNode) {
+                            this._titlebar.parentNode.removeChild(this._titlebar);
+                        }
+                        this._titlebar = document.createElement('DIV');
+                        Dom.addClass(this._titlebar, this.CLASS_PREFIX + '-titlebar');
+                        if (Lang.isString(titlebar)) {
+                            var h2 = document.createElement('h2');
+                            h2.tabIndex = '-1';
+                            h2.innerHTML = titlebar;
+                            this._titlebar.appendChild(h2);
+                        }
+                        if (this.get('firstChild')) {
+                            this.insertBefore(this._titlebar, this.get('firstChild'));
+                        } else {
+                            this.appendChild(this._titlebar);
+                        }
+                        if (this.get('collapse')) {
+                            this.set('collapse', true);
+                        }
+                    } else if (this._titlebar) {
+                        if (this._titlebar && this._titlebar.parentNode) {
+                            this._titlebar.parentNode.removeChild(this._titlebar);
+                        }
+                    }
+                }
+            });
+
+
+            /**
+            * @attribute collapse
+            * @description Boolean indicating if the the titlebar should have a collapse button.
+            * The collapse button will not remove the toolbar, it will minimize it to the titlebar
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig('collapse', {
+                value: false,
+                method: function(collapse) {
+                    var collapseEl = null;
+                    var el = Dom.getElementsByClassName('collapse', 'span', this._titlebar);
+                    if (collapse) {
+                        if (el.length > 0) {
+                            //There is already a collapse button
+                            return true;
+                        }
+                        collapseEl = document.createElement('SPAN');
+                        collapseEl.innerHTML = 'X';
+                        collapseEl.title = this.STR_COLLAPSE;
+
+                        Dom.addClass(collapseEl, 'collapse');
+                        this._titlebar.appendChild(collapseEl);
+                        Event.addListener(collapseEl, 'click', function() {
+                            if (Dom.hasClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed')) {
+                                this.collapse(false); //Expand Toolbar
+                            } else {
+                                this.collapse(); //Collapse Toolbar
+                            }
+                        }, this, true);
+                    } else {
+                        collapseEl = Dom.getElementsByClassName('collapse', 'span', this._titlebar);
+                        if (collapseEl[0]) {
+                            if (Dom.hasClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed')) {
+                                //We are closed, reopen the titlebar..
+                                this.collapse(false); //Expand Toolbar
+                            }
+                            collapseEl[0].parentNode.removeChild(collapseEl[0]);
+                        }
+                    }
+                }
+            });
+
+            /**
+            * @attribute draggable
+            * @description Boolean indicating if the toolbar should be draggable.  
+            * @default false
+            * @type Boolean
+            */
+
+            this.setAttributeConfig('draggable', {
+                value: (attr.draggable || false),
+                method: function(draggable) {
+                    var el = this.get('element');
+
+                    if (draggable && !this.get('titlebar')) {
+                        if (!this._dragHandle) {
+                            this._dragHandle = document.createElement('SPAN');
+                            this._dragHandle.innerHTML = '|';
+                            this._dragHandle.setAttribute('title', 'Click to drag the toolbar');
+                            this._dragHandle.id = this.get('id') + '_draghandle';
+                            Dom.addClass(this._dragHandle, this.CLASS_DRAGHANDLE);
+                            if (this.get('cont').hasChildNodes()) {
+                                this.get('cont').insertBefore(this._dragHandle, this.get('cont').firstChild);
+                            } else {
+                                this.get('cont').appendChild(this._dragHandle);
+                            }
+                            /**
+                            * @property dd
+                            * @description The DragDrop instance associated with the Toolbar
+                            * @type Object
+                            */
+                            this.dd = new YAHOO.util.DD(this.get('id'));
+                            this.dd.setHandleElId(this._dragHandle.id);
+                            
+                        }
+                    } else {
+                        if (this._dragHandle) {
+                            this._dragHandle.parentNode.removeChild(this._dragHandle);
+                            this._dragHandle = null;
+                            this.dd = null;
+                        }
+                    }
+                    if (this._titlebar) {
+                        if (draggable) {
+                            this.dd = new YAHOO.util.DD(this.get('id'));
+                            this.dd.setHandleElId(this._titlebar);
+                            Dom.addClass(this._titlebar, 'draggable');
+                        } else {
+                            Dom.removeClass(this._titlebar, 'draggable');
+                            if (this.dd) {
+                                this.dd.unreg();
+                                this.dd = null;
+                            }
+                        }
+                    }
+                },
+                validator: function(value) {
+                    var ret = true;
+                    if (!YAHOO.util.DD) {
+                        ret = false;
+                    }
+                    return ret;
+                }
+            });
+
+        },
+        /**
+        * @method addButtonGroup
+        * @description Add a new button group to the toolbar. (uses addButton)
+        * @param {Object} oGroup Object literal reference to the Groups Config (contains an array of button configs)
+        */
+        addButtonGroup: function(oGroup) {
+            if (!this.get('element')) {
+                this._queue[this._queue.length] = ['addButtonGroup', arguments];
+                return false;
+            }
+            
+            if (!this.hasClass(this.CLASS_PREFIX + '-grouped')) {
+                this.addClass(this.CLASS_PREFIX + '-grouped');
+            }
+            var div = document.createElement('DIV');
+            Dom.addClass(div, this.CLASS_PREFIX + '-group');
+            Dom.addClass(div, this.CLASS_PREFIX + '-group-' + oGroup.group);
+            //if (oGroup.label && this.get('grouplabels')) {
+            if (oGroup.label) {
+                var label = document.createElement('h3');
+                label.innerHTML = oGroup.label;
+                div.appendChild(label);
+            }
+            if (!this.get('grouplabels')) {
+                Dom.addClass(this.get('cont'), this.CLASS_PREFIX, '-nogrouplabels');
+            }
+
+            this.get('cont').appendChild(div);
+
+            //For accessibility, let's put all of the group buttons in an Unordered List
+            var ul = document.createElement('ul');
+            div.appendChild(ul);
+
+            if (!this._buttonGroupList) {
+                this._buttonGroupList = {};
+            }
+            
+            this._buttonGroupList[oGroup.group] = ul;
+
+            for (var i = 0; i < oGroup.buttons.length; i++) {
+                var li = document.createElement('li');
+                li.className = this.CLASS_PREFIX + '-groupitem';
+                ul.appendChild(li);
+                if ((oGroup.buttons[i].type !== undefined) && oGroup.buttons[i].type == 'separator') {
+                    this.addSeparator(li);
+                } else {
+                    oGroup.buttons[i].container = li;
+                    this.addButton(oGroup.buttons[i]);
+                }
+            }
+        },
+        /**
+        * @method addButtonToGroup
+        * @description Add a new button to a toolbar group. Buttons supported:
+        *   push, split, menu, select, color, spin
+        * @param {Object} oButton Object literal reference to the Button's Config
+        * @param {String} group The Group identifier passed into the initial config
+        * @param {HTMLElement} after Optional HTML element to insert this button after in the DOM.
+        */
+        addButtonToGroup: function(oButton, group, after) {
+            var groupCont = this._buttonGroupList[group];
+            var li = document.createElement('li');
+            li.className = this.CLASS_PREFIX + '-groupitem';
+            oButton.container = li;
+            this.addButton(oButton, after);
+            groupCont.appendChild(li);
+        },
+        /**
+        * @method addButton
+        * @description Add a new button to the toolbar. Buttons supported:
+        *   push, split, menu, select, color, spin
+        * @param {Object} oButton Object literal reference to the Button's Config
+        * @param {HTMLElement} after Optional HTML element to insert this button after in the DOM.
+        */
+        addButton: function(oButton, after) {
+            if (!this.get('element')) {
+                this._queue[this._queue.length] = ['addButton', arguments];
+                return false;
+            }
+            if (!this._buttonList) {
+                this._buttonList = [];
+            }
+            //Add to .get('buttons') manually
+            this._configs.buttons.value[this._configs.buttons.value.length] = oButton;
+            if (!oButton.container) {
+                oButton.container = this.get('cont');
+            }
+
+            if ((oButton.type == 'menu') || (oButton.type == 'split') || (oButton.type == 'select')) {
+                if (Lang.isArray(oButton.menu)) {
+                    for (var i in oButton.menu) {
+                        if (Lang.hasOwnProperty(oButton.menu, i)) {
+                            var funcObject = {
+                                fn: function(ev, x, oMenu) {
+                                    if (!oButton.menucmd) {
+                                        oButton.menucmd = oButton.value;
+                                    }
+                                    oButton.value = ((oMenu.value) ? oMenu.value : oMenu._oText.nodeValue);
+                                    //This line made Opera fire the click event and the mousedown,
+                                    //  so events for menus where firing twice.
+                                    //this._buttonClick('click', oButton);
+                                },
+                                scope: this
+                            };
+                            oButton.menu[i].onclick = funcObject;
+                        }
+                    }
+                }
+            }
+            var _oButton = {};
+            for (var o in oButton) {
+                if (Lang.hasOwnProperty(oButton, o)) {
+                    if (!this._toolbarConfigs[o]) {
+                        _oButton[o] = oButton[o];
+                    }
+                }
+            }
+            if (oButton.type == 'select') {
+                _oButton.type = 'menu';
+            }
+            if (oButton.type == 'spin') {
+                _oButton.type = 'push';
+            }
+            if (_oButton.type == 'color') {
+                _oButton = this._makeColorButton(_oButton);
+            }
+            if (_oButton.menu) {
+                if (oButton.menu instanceof YAHOO.widget.Overlay) {
+                    oButton.menu.showEvent.subscribe(function() {
+                        this._button = _oButton;
+                    });
+                } else {
+                    for (var m = 0; m < _oButton.menu.length; m++) {
+                        if (!_oButton.menu[m].value) {
+                            _oButton.menu[m].value = _oButton.menu[m].text;
+                        }
+                    }
+                    if (this.browser.webkit) {
+                        _oButton.focusmenu = false;
+                    }
+                }
+            }
+            var tmp = new YAHOO.widget.Button(_oButton);
+            if (this.get('disabled')) {
+                //Toolbar is disabled, disable the new button too!
+                tmp.set('disabled', true);
+            }
+            if (!oButton.id) {
+                oButton.id = tmp.get('id');
+            }
+            
+            if (after) {
+                var el = tmp.get('element');
+                var nextSib = null;
+                if (after.get) {
+                    nextSib = after.get('element').nextSibling;
+                } else if (after.nextSibling) {
+                    nextSib = after.nextSibling;
+                }
+                if (nextSib) {
+                    nextSib.parentNode.insertBefore(el, nextSib);
+                }
+            }
+            tmp.addClass(this.CLASS_PREFIX + '-' + tmp.get('value'));
+            var icon = document.createElement('span');
+            icon.className = this.CLASS_PREFIX + '-icon';
+            tmp.get('element').insertBefore(icon, tmp.get('firstChild'));
+            //Replace the Button HTML Element with an a href
+            var a = document.createElement('a');
+            a.innerHTML = tmp._button.innerHTML;
+            a.href = '#';
+            Event.on(a, 'click', function(ev) {
+                Event.stopEvent(ev);
+            });
+            tmp._button.parentNode.replaceChild(a, tmp._button);
+            tmp._button = a;
+
+            if (oButton.type == 'select') {
+                tmp.addClass(this.CLASS_PREFIX + '-select');
+            }
+            if (oButton.type == 'spin') {
+                if (!Lang.isArray(oButton.range)) {
+                    oButton.range = [ 10, 100 ];
+                }
+                this._makeSpinButton(tmp, oButton);
+            }
+
+            tmp.get('element').setAttribute('title', tmp.get('label'));
+
+            if (oButton.type != 'spin') {
+                if (_oButton.menu instanceof YAHOO.widget.Overlay) {
+                    var showPicker = function(ev) {
+                        var exec = true;
+                        if (ev.keyCode && (ev.keyCode == 9)) {
+                            exec = false;
+                        }
+                        if (exec) {
+                            this._colorPicker._button = oButton.value;
+                            var menuEL = tmp.getMenu().element;
+                            if (menuEL.style.visibility == 'hidden') {
+                                tmp.getMenu().show();
+                            } else {
+                                tmp.getMenu().hide();
+                            }
+                        }
+                        YAHOO.util.Event.stopEvent(ev);
+                    };
+                    tmp.on('mousedown', showPicker, oButton, this);
+                    tmp.on('keydown', showPicker, oButton, this);
+                    
+                } else if ((oButton.type != 'menu') && (oButton.type != 'select')) {
+                    tmp.on('keypress', this._buttonClick, oButton, this);
+                    tmp.on('mousedown', function(ev) {
+                        YAHOO.util.Event.stopEvent(ev);
+                        this._buttonClick(ev, oButton);
+                    }, oButton, this);
+                    tmp.on('click', function(ev) {
+                        YAHOO.util.Event.stopEvent(ev);
+                    });
+                } else {
+                    //Stop the mousedown event so we can trap the selection in the editor!
+                    tmp.on('mousedown', function(ev) {
+                        YAHOO.util.Event.stopEvent(ev);
+                    });
+                    tmp.on('click', function(ev) {
+                        YAHOO.util.Event.stopEvent(ev);
+                    });
+                    var self = this;
+                    //Hijack the mousedown event in the menu and make it fire a button click..
+                    tmp.getMenu().mouseDownEvent.subscribe(function(ev, args) {
+                        var oMenu = args[1];
+                        YAHOO.util.Event.stopEvent(args[0]);
+                        tmp._onMenuClick(args[0], tmp);
+                        if (!oButton.menucmd) {
+                            oButton.menucmd = oButton.value;
+                        }
+                        oButton.value = ((oMenu.value) ? oMenu.value : oMenu._oText.nodeValue);
+                        self._buttonClick.call(self, args[1], oButton);
+                        tmp._hideMenu();
+                        return false;
+                    });
+                    tmp.getMenu().clickEvent.subscribe(function(ev, args) {
+                        YAHOO.util.Event.stopEvent(args[0]);
+                    });
+                }
+            } else {
+                //Stop the mousedown event so we can trap the selection in the editor!
+                tmp.on('mousedown', function(ev) {
+                    YAHOO.util.Event.stopEvent(ev);
+                });
+                tmp.on('click', function(ev) {
+                    YAHOO.util.Event.stopEvent(ev);
+                });
+            }
+            if (this.browser.ie) {
+                //Add a couple of new events for IE
+                tmp.DOM_EVENTS.focusin = true;
+                tmp.DOM_EVENTS.focusout = true;
+                
+                //Stop them so we don't loose focus in the Editor
+                tmp.on('focusin', function(ev) {
+                    YAHOO.util.Event.stopEvent(ev);
+                }, oButton, this);
+                
+                tmp.on('focusout', function(ev) {
+                    YAHOO.util.Event.stopEvent(ev);
+                }, oButton, this);
+                tmp.on('click', function(ev) {
+                    YAHOO.util.Event.stopEvent(ev);
+                }, oButton, this);
+            }
+            if (this.browser.webkit) {
+                //This will keep the document from gaining focus and the editor from loosing it..
+                //Forcefully remove the focus calls in button!
+                tmp.hasFocus = function() {
+                    return true;
+                };
+            }
+            this._buttonList[this._buttonList.length] = tmp;
+            if ((oButton.type == 'menu') || (oButton.type == 'split') || (oButton.type == 'select')) {
+                if (Lang.isArray(oButton.menu)) {
+                    var menu = tmp.getMenu();
+                    menu.renderEvent.subscribe(_addMenuClasses, tmp);
+                    if (oButton.renderer) {
+                        menu.renderEvent.subscribe(oButton.renderer, tmp);
+                    }
+                }
+            }
+            return oButton;
+        },
+        /**
+        * @method addSeparator
+        * @description Add a new button separator to the toolbar.
+        * @param {HTMLElement} cont Optional HTML element to insert this button into.
+        * @param {HTMLElement} after Optional HTML element to insert this button after in the DOM.
+        */
+        addSeparator: function(cont, after) {
+            if (!this.get('element')) {
+                this._queue[this._queue.length] = ['addSeparator', arguments];
+                return false;
+            }
+            var sepCont = ((cont) ? cont : this.get('cont'));
+            if (!this.get('element')) {
+                this._queue[this._queue.length] = ['addSeparator', arguments];
+                return false;
+            }
+            if (this._sepCount === null) {
+                this._sepCount = 0;
+            }
+            if (!this._sep) {
+                this._sep = document.createElement('SPAN');
+                Dom.addClass(this._sep, this.CLASS_SEPARATOR);
+                this._sep.innerHTML = '|';
+            }
+            var _sep = this._sep.cloneNode(true);
+            this._sepCount++;
+            Dom.addClass(_sep, this.CLASS_SEPARATOR + '-' + this._sepCount);
+            if (after) {
+                var nextSib = null;
+                if (after.get) {
+                    nextSib = after.get('element').nextSibling;
+                } else if (after.nextSibling) {
+                    nextSib = after.nextSibling;
+                } else {
+                    nextSib = after;
+                }
+                if (nextSib) {
+                    if (nextSib == after) {
+                        nextSib.parentNode.appendChild(_sep);
+                    } else {
+                        nextSib.parentNode.insertBefore(_sep, nextSib);
+                    }
+                }
+            } else {
+                sepCont.appendChild(_sep);
+            }
+            return _sep;
+        },
+        /**
+        * @method _createColorPicker
+        * @private
+        * @description Creates the core DOM reference to the color picker menu item.
+        * @param {String} id the id of the toolbar to prefix this DOM container with.
+        */
+        _createColorPicker: function(id) {
+            if (Dom.get(id + '_colors')) {
+               Dom.get(id + '_colors').parentNode.removeChild(Dom.get(id + '_colors'));
+            }
+            var picker = document.createElement('div');
+            picker.className = 'yui-toolbar-colors';
+            picker.id = id + '_colors';
+            picker.style.display = 'none';
+            Event.on(window, 'load', function() {
+                document.body.appendChild(picker);
+            }, this, true);
+
+            this._colorPicker = picker;
+
+            var html = '';
+            for (var i in this._colorData) {
+                if (Lang.hasOwnProperty(this._colorData, i)) {
+                    html += '<a style="background-color: ' + i + '" href="#">' + i.replace('#', '') + '</a>';
+                }
+            }
+            html += '<span><em>X</em><strong></strong></span>';
+            picker.innerHTML = html;
+            var em = picker.getElementsByTagName('em')[0];
+            var strong = picker.getElementsByTagName('strong')[0];
+
+            Event.on(picker, 'mouseover', function(ev) {
+                var tar = Event.getTarget(ev);
+                if (tar.tagName.toLowerCase() == 'a') {
+                    em.style.backgroundColor = tar.style.backgroundColor;
+                    strong.innerHTML = this._colorData['#' + tar.innerHTML] + '<br>' + tar.innerHTML;
+                }
+            }, this, true);
+            Event.on(picker, 'focus', function(ev) {
+                Event.stopEvent(ev);
+            });
+            Event.on(picker, 'click', function(ev) {
+                Event.stopEvent(ev);
+            });
+            Event.on(picker, 'mousedown', function(ev) {
+                Event.stopEvent(ev);
+                var tar = Event.getTarget(ev);
+                if (tar.tagName.toLowerCase() == 'a') {
+                    this.fireEvent('colorPickerClicked', { type: 'colorPickerClicked', target: this, button: this._colorPicker._button, color: tar.innerHTML, colorName: this._colorData['#' + tar.innerHTML] } );
+                    this.getButtonByValue(this._colorPicker._button).getMenu().hide();
+                }
+            }, this, true);
+        },
+        /**
+        * @method _resetColorPicker
+        * @private
+        * @description Clears the currently selected color or mouseover color in the color picker.
+        */
+        _resetColorPicker: function() {
+            var em = this._colorPicker.getElementsByTagName('em')[0];
+            var strong = this._colorPicker.getElementsByTagName('strong')[0];
+            em.style.backgroundColor = 'transparent';
+            strong.innerHTML = '';
+        },
+        /**
+        * @method _makeColorButton
+        * @private
+        * @description Called to turn a "color" button into a menu button with an Overlay for the menu.
+        * @param {Object} _oButton <a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a> reference
+        */
+        _makeColorButton: function(_oButton) {
+            if (!this._colorPicker) {   
+                this._createColorPicker(this.get('id'));
+            }
+            _oButton.type = 'color';
+            _oButton.menu = new YAHOO.widget.Overlay(this.get('id') + '_' + _oButton.value + '_menu', { visbile: false, position: 'absolute' });
+            _oButton.menu.setBody('');
+            _oButton.menu.render(this.get('cont'));
+            _oButton.menu.beforeShowEvent.subscribe(function() {
+                _oButton.menu.cfg.setProperty('zindex', 5); //Re Adjust the overlays zIndex.. not sure why.
+                _oButton.menu.cfg.setProperty('context', [this.getButtonById(_oButton.id).get('element'), 'tl', 'bl']); //Re Adjust the overlay.. not sure why.
+                //Move the DOM reference of the color picker to the Overlay that we are about to show.
+                this._resetColorPicker();
+                var _p = this._colorPicker;
+                if (_p.parentNode) {
+                    //if (_p.parentNode != _oButton.menu.body) {
+                        _p.parentNode.removeChild(_p);
+                    //}
+                }
+                _oButton.menu.setBody('');
+                _oButton.menu.appendToBody(_p);
+                this._colorPicker.style.display = 'block';
+            }, this, true);
+            return _oButton;
+        },
+        /**
+        * @private
+        * @method _makeSpinButton
+        * @description Create a button similar to an OS Spin button.. It has an up/down arrow combo to scroll through a range of int values.
+        * @param {Object} _button <a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a> reference
+        * @param {Object} oButton Object literal containing the buttons initial config
+        */
+        _makeSpinButton: function(_button, oButton) {
+            _button.addClass(this.CLASS_PREFIX + '-spinbutton');
+            var self = this,
+                _par = _button._button.parentNode.parentNode, //parentNode of Button Element for appending child
+                range = oButton.range,
+                _b1 = document.createElement('a'),
+                _b2 = document.createElement('a');
+                _b1.href = '#';
+                _b2.href = '#';
+            
+            //Setup the up and down arrows
+            _b1.className = 'up';
+            _b1.title = this.STR_SPIN_UP;
+            _b1.innerHTML = this.STR_SPIN_UP;
+            _b2.className = 'down';
+            _b2.title = this.STR_SPIN_DOWN;
+            _b2.innerHTML = this.STR_SPIN_DOWN;
+
+            //Append them to the container
+            _par.appendChild(_b1);
+            _par.appendChild(_b2);
+            
+            var label = YAHOO.lang.substitute(this.STR_SPIN_LABEL, { VALUE: _button.get('label') });
+            _button.set('title', label);
+
+            var cleanVal = function(value) {
+                value = ((value < range[0]) ? range[0] : value);
+                value = ((value > range[1]) ? range[1] : value);
+                return value;
+            };
+
+            var br = this.browser;
+            var tbar = false;
+            var strLabel = this.STR_SPIN_LABEL;
+            if (this._titlebar && this._titlebar.firstChild) {
+                tbar = this._titlebar.firstChild;
+            }
+            
+            var _intUp = function(ev) {
+                YAHOO.util.Event.stopEvent(ev);
+                if (!_button.get('disabled') && (ev.keyCode != 9)) {
+                    var value = parseInt(_button.get('label'), 10);
+                    value++;
+                    value = cleanVal(value);
+                    _button.set('label', ''+value);
+                    var label = YAHOO.lang.substitute(strLabel, { VALUE: _button.get('label') });
+                    _button.set('title', label);
+                    if (!br.webkit && tbar) {
+                        //tbar.focus(); //We do this for accessibility, on the re-focus of the element, a screen reader will re-read the title that was just changed
+                        //_button.focus();
+                    }
+                    self._buttonClick(ev, oButton);
+                }
+            };
+
+            var _intDown = function(ev) {
+                YAHOO.util.Event.stopEvent(ev);
+                if (!_button.get('disabled') && (ev.keyCode != 9)) {
+                    var value = parseInt(_button.get('label'), 10);
+                    value--;
+                    value = cleanVal(value);
+
+                    _button.set('label', ''+value);
+                    var label = YAHOO.lang.substitute(strLabel, { VALUE: _button.get('label') });
+                    _button.set('title', label);
+                    if (!br.webkit && tbar) {
+                        //tbar.focus(); //We do this for accessibility, on the re-focus of the element, a screen reader will re-read the title that was just changed
+                        //_button.focus();
+                    }
+                    self._buttonClick(ev, oButton);
+                }
+            };
+
+            var _intKeyUp = function(ev) {
+                if (ev.keyCode == 38) {
+                    _intUp(ev);
+                } else if (ev.keyCode == 40) {
+                    _intDown(ev);
+                } else if (ev.keyCode == 107 && ev.shiftKey) {  //Plus Key
+                    _intUp(ev);
+                } else if (ev.keyCode == 109 && ev.shiftKey) {  //Minus Key
+                    _intDown(ev);
+                }
+            };
+
+            //Handle arrow keys..
+            _button.on('keydown', _intKeyUp, this, true);
+
+            //Listen for the click on the up button and act on it
+            //Listen for the click on the down button and act on it
+            Event.on(_b1, 'mousedown',function(ev) {
+                Event.stopEvent(ev);
+            }, this, true);
+            Event.on(_b2, 'mousedown', function(ev) {
+                Event.stopEvent(ev);
+            }, this, true);
+            Event.on(_b1, 'click', _intUp, this, true);
+            Event.on(_b2, 'click', _intDown, this, true);
+        },
+        /**
+        * @protected
+        * @method _buttonClick
+        * @description Click handler for all buttons in the toolbar.
+        * @param {String} ev The event that was passed in.
+        * @param {Object} info Object literal of information about the button that was clicked.
+        */
+        _buttonClick: function(ev, info) {
+            var doEvent = true;
+            
+            if (ev && ev.type == 'keypress') {
+                if (ev.keyCode == 9) {
+                    doEvent = false;
+                } else if ((ev.keyCode === 13) || (ev.keyCode === 0) || (ev.keyCode === 32)) {
+                } else {
+                    doEvent = false;
+                }
+            }
+
+            if (doEvent) {
+                var fireNextEvent = true,
+                    retValue = false;
+                if (info.value) {
+                    retValue = this.fireEvent(info.value + 'Click', { type: info.value + 'Click', target: this.get('element'), button: info });
+                    if (retValue === false) {
+                        fireNextEvent = false;
+                    }
+                }
+                
+                if (info.menucmd && fireNextEvent) {
+                    retValue = this.fireEvent(info.menucmd + 'Click', { type: info.menucmd + 'Click', target: this.get('element'), button: info });
+                    if (retValue === false) {
+                        fireNextEvent = false;
+                    }
+                }
+                if (fireNextEvent) {
+                    this.fireEvent('buttonClick', { type: 'buttonClick', target: this.get('element'), button: info });
+                }
+
+                if (info.type == 'select') {
+                    var button = this.getButtonById(info.id);
+                    var txt = info.value;
+                    for (var i = 0; i < info.menu.length; i++) {
+                        if (info.menu[i].value == info.value) {
+                            txt = info.menu[i].text;
+                            break;
+                        }
+                    }
+                    button.set('label', '<span class="yui-toolbar-' + info.menucmd + '-' + (info.value).replace(/ /g, '-').toLowerCase() + '">' + txt + '</span>');
+                    var _items = button.getMenu().getItems();
+                    for (var m = 0; m < _items.length; m++) {
+                        if (_items[m].value.toLowerCase() == info.value.toLowerCase()) {
+                            _items[m].cfg.setProperty('checked', true);
+                        } else {
+                            _items[m].cfg.setProperty('checked', false);
+                        }
+                    }
+                }
+            }
+            if (ev) {
+                Event.stopEvent(ev);
+            }
+        },
+        /**
+        * @method getButtonById
+        * @description Gets a button instance from the toolbar by is Dom id.
+        * @param {String} id The Dom id to query for.
+        * @return {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}
+        */
+        getButtonById: function(id) {
+            var len = this._buttonList.length;
+            for (var i = 0; i < len; i++) {
+                if (this._buttonList[i].get('id') == id) {
+                    return this._buttonList[i];
+                }
+            }
+            return false;
+        },
+        /**
+        * @method getButtonByValue
+        * @description Gets a button instance or a menuitem instance from the toolbar by it's value.
+        * @param {String} value The button value to query for.
+        * @return {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a> or <a href="YAHOO.widget.MenuItem.html">YAHOO.widget.MenuItem</a>}
+        */
+        getButtonByValue: function(value) {
+            var _buttons = this.get('buttons');
+            var len = _buttons.length;
+            for (var i = 0; i < len; i++) {
+                if (_buttons[i].group !== undefined) {
+                    for (var m = 0; m < _buttons[i].buttons.length; m++) {
+                        if ((_buttons[i].buttons[m].value == value) || (_buttons[i].buttons[m].menucmd == value)) {
+                            return this.getButtonById(_buttons[i].buttons[m].id);
+                        }
+                        if (_buttons[i].buttons[m].menu) { //Menu Button, loop through the values
+                            for (var s = 0; s < _buttons[i].buttons[m].menu.length; s++) {
+                                if (_buttons[i].buttons[m].menu[s].value == value) {
+                                    return this.getButtonById(_buttons[i].buttons[m].id);
+                                }
+                            }
+                        }
+                    }
+                } else {
+                    if ((_buttons[i].value == value) || (_buttons[i].menucmd == value)) {
+                        return this.getButtonById(_buttons[i].id);
+                    }
+                    if (_buttons[i].menu) { //Menu Button, loop through the values
+                        for (var j = 0; j < _buttons[i].menu.length; j++) {
+                            if (_buttons[i].menu[j].value == value) {
+                                return this.getButtonById(_buttons[i].id);
+                            }
+                        }
+                    }
+                }
+            }
+            return false;
+        },
+        /**
+        * @method getButtonByIndex
+        * @description Gets a button instance from the toolbar by is index in _buttonList.
+        * @param {Number} index The index of the button in _buttonList.
+        * @return {<a href="YAHOO.widget.Button.html">YAHOO.widget.Button</a>}
+        */
+        getButtonByIndex: function(index) {
+            if (this._buttonList[index]) {
+                return this._buttonList[index];
+            } else {
+                return false;
+            }
+        },
+        /**
+        * @method getButtons
+        * @description Returns an array of buttons in the current toolbar
+        * @return {Array}
+        */
+        getButtons: function() {
+            return this._buttonList;
+        },
+        /**
+        * @method disableButton
+        * @description Disables a button in the toolbar.
+        * @param {String/Number} id Disable a button by it's id, index or value.
+        * @return {Boolean}
+        */
+        disableButton: function(id) {
+            var button = id;
+            if (Lang.isString(id)) {
+                button = this.getButtonById(id);
+            }
+            if (Lang.isNumber(id)) {
+                button = this.getButtonByIndex(id);
+            }
+            if (!(button instanceof YAHOO.widget.Button)) {
+                button = this.getButtonByValue(id);
+            }
+            if (button instanceof YAHOO.widget.Button) {
+                button.set('disabled', true);
+            } else {
+                return false;
+            }
+        },
+        /**
+        * @method enableButton
+        * @description Enables a button in the toolbar.
+        * @param {String/Number} id Enable a button by it's id, index or value.
+        * @return {Boolean}
+        */
+        enableButton: function(id) {
+            if (this.get('disabled')) {
+                return false;
+            }
+            var button = id;
+            if (Lang.isString(id)) {
+                button = this.getButtonById(id);
+            }
+            if (Lang.isNumber(id)) {
+                button = this.getButtonByIndex(id);
+            }
+            if (!(button instanceof YAHOO.widget.Button)) {
+                button = this.getButtonByValue(id);
+            }
+            if (button instanceof YAHOO.widget.Button) {
+                if (button.get('disabled')) {
+                    button.set('disabled', false);
+                }
+            } else {
+                return false;
+            }
+        },
+        /**
+        * @method selectButton
+        * @description Selects a button in the toolbar.
+        * @param {String/Number} id Select a button by it's id, index or value.
+        * @return {Boolean}
+        */
+        selectButton: function(id, value) {
+            var button = id;
+            if (id) {
+                if (Lang.isString(id)) {
+                    button = this.getButtonById(id);
+                }
+                if (Lang.isNumber(id)) {
+                    button = this.getButtonByIndex(id);
+                }
+                if (!(button instanceof YAHOO.widget.Button)) {
+                    button = this.getButtonByValue(id);
+                }
+                if (button instanceof YAHOO.widget.Button) {
+                    button.addClass('yui-button-selected');
+                    button.addClass('yui-button-' + button.get('value') + '-selected');
+                    if (value) {
+                        var _items = button.getMenu().getItems();
+                        for (var m = 0; m < _items.length; m++) {
+                            if (_items[m].value == value) {
+                                _items[m].cfg.setProperty('checked', true);
+                                button.set('label', '<span class="yui-toolbar-' + button.get('value') + '-' + (value).replace(/ /g, '-').toLowerCase() + '">' + _items[m]._oText.nodeValue + '</span>');
+                            } else {
+                                _items[m].cfg.setProperty('checked', false);
+                            }
+                        }
+                    }
+                } else {
+                    return false;
+                }
+            }
+        },
+        /**
+        * @method deselectButton
+        * @description Deselects a button in the toolbar.
+        * @param {String/Number} id Deselect a button by it's id, index or value.
+        * @return {Boolean}
+        */
+        deselectButton: function(id) {
+            var button = id;
+            if (Lang.isString(id)) {
+                button = this.getButtonById(id);
+            }
+            if (Lang.isNumber(id)) {
+                button = this.getButtonByIndex(id);
+            }
+            if (!(button instanceof YAHOO.widget.Button)) {
+                button = this.getButtonByValue(id);
+            }
+            if (button instanceof YAHOO.widget.Button) {
+                button.removeClass('yui-button-selected');
+                button.removeClass('yui-button-' + button.get('value') + '-selected');
+                button.removeClass('yui-button-hover');
+            } else {
+                return false;
+            }
+        },
+        /**
+        * @method deselectAllButtons
+        * @description Deselects all buttons in the toolbar.
+        * @return {Boolean}
+        */
+        deselectAllButtons: function() {
+            var len = this._buttonList.length;
+            for (var i = 0; i < len; i++) {
+                this.deselectButton(this._buttonList[i]);
+            }
+        },
+        /**
+        * @method disableAllButtons
+        * @description Disables all buttons in the toolbar.
+        * @return {Boolean}
+        */
+        disableAllButtons: function() {
+            if (this.get('disabled')) {
+                return false;
+            }
+            var len = this._buttonList.length;
+            for (var i = 0; i < len; i++) {
+                this.disableButton(this._buttonList[i]);
+            }
+        },
+        /**
+        * @method enableAllButtons
+        * @description Enables all buttons in the toolbar.
+        * @return {Boolean}
+        */
+        enableAllButtons: function() {
+            if (this.get('disabled')) {
+                return false;
+            }
+            var len = this._buttonList.length;
+            for (var i = 0; i < len; i++) {
+                this.enableButton(this._buttonList[i]);
+            }
+        },
+        /**
+        * @method resetAllButtons
+        * @description Resets all buttons to their initial state.
+        * @param {Object} _ex Except these buttons
+        * @return {Boolean}
+        */
+        resetAllButtons: function(_ex) {
+            if (!Lang.isObject(_ex)) {
+                _ex = {};
+            }
+            if (this.get('disabled')) {
+                return false;
+            }
+            var len = this._buttonList.length;
+            for (var i = 0; i < len; i++) {
+                var _button = this._buttonList[i];
+                var disabled = _button._configs.disabled._initialConfig.value;
+                if (_ex[_button.get('id')]) {
+                    this.enableButton(_button);
+                    this.selectButton(_button);
+                } else {
+                    if (disabled) {
+                        this.disableButton(_button);
+                    } else {
+                        this.enableButton(_button);
+                    }
+                    this.deselectButton(_button);
+                }
+            }
+        },
+        /**
+        * @method destroyButton
+        * @description Destroy a button in the toolbar.
+        * @param {String/Number} id Destroy a button by it's id or index.
+        * @return {Boolean}
+        */
+        destroyButton: function(id) {
+            var button = id;
+            if (Lang.isString(id)) {
+                button = this.getButtonById(id);
+            }
+            if (Lang.isNumber(id)) {
+                button = this.getButtonByIndex(id);
+            }
+            if (!(button instanceof YAHOO.widget.Button)) {
+                button = this.getButtonByValue(id);
+            }
+            if (button instanceof YAHOO.widget.Button) {
+                var thisID = button.get('id');
+                button.destroy();
+
+                var len = this._buttonList.length;
+                for (var i = 0; i < len; i++) {
+                    if (this._buttonList[i].get('id') == thisID) {
+                        this._buttonList[i] = null;
+                    }
+                }
+            } else {
+                return false;
+            }
+
+        },
+        /**
+        * @method destroy
+        * @description Destroys the toolbar, all of it's elements and objects.
+        * @return {Boolean}
+        */
+        destroy: function() {
+            this.get('element').innerHTML = '';
+            this.get('element').className = '';
+            //Brutal Object Destroy
+            for (var i in this) {
+                if (Lang.hasOwnProperty(this, i)) {
+                    this[i] = null;
+                }
+            }
+            return true;
+        },
+        /**
+        * @method collapse
+        * @description Programatically collapse the toolbar.
+        * @param {Boolean} collapse True to collapse, false to expand.
+        */
+        collapse: function(collapse) {
+            var el = Dom.getElementsByClassName('collapse', 'span', this._titlebar);
+            if (collapse === false) {
+                Dom.removeClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed');
+                if (el[0]) {
+                    Dom.removeClass(el[0], 'collapsed');
+                }
+                this.fireEvent('toolbarExpanded', { type: 'toolbarExpanded', target: this });
+            } else {
+                if (el[0]) {
+                    Dom.addClass(el[0], 'collapsed');
+                }
+                Dom.addClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed');
+                this.fireEvent('toolbarCollapsed', { type: 'toolbarCollapsed', target: this });
+            }
+        },
+        /**
+        * @method toString
+        * @description Returns a string representing the toolbar.
+        * @return {String}
+        */
+        toString: function() {
+            return 'Toolbar (#' + this.get('element').id + ') with ' + this._buttonList.length + ' buttons.';
+        }
+    });
+/**
+* @event buttonClick
+* @param {Object} o The object passed to this handler is the button config used to create the button.
+* @description Fires when any botton receives a click event. Passes back a single object representing the buttons config object. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event valueClick
+* @param {Object} o The object passed to this handler is the button config used to create the button.
+* @description This is a special dynamic event that is created and dispatched based on the value property
+* of the button config. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* Example:
+* <code><pre>
+* buttons : [
+*   { type: 'button', value: 'test', value: 'testButton' }
+* ]</pre>
+* </code>
+* With the valueClick event you could subscribe to this buttons click event with this:
+* tbar.in('testButtonClick', function() { alert('test button clicked'); })
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event toolbarExpanded
+* @description Fires when the toolbar is expanded via the collapse button. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event toolbarCollapsed
+* @description Fires when the toolbar is collapsed via the collapse button. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+})();
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+*/
+/**
+ * @module editor
+ * @description <p>The Rich Text Editor is a UI control that replaces a standard HTML textarea; it allows for the rich formatting of text content, including common structural treatments like lists, formatting treatments like bold and italic text, and drag-and-drop inclusion and sizing of images. The Rich Text Editor's toolbar is extensible via a plugin architecture so that advanced implementations can achieve a high degree of customization.</p>
+ * @namespace YAHOO.widget
+ * @requires yahoo, dom, element, event, toolbar, container, menu, button
+ * @optional dragdrop, animation
+ * @beta
+ */
+
+(function() {
+var Dom = YAHOO.util.Dom,
+    Event = YAHOO.util.Event,
+    Lang = YAHOO.lang,
+    Toolbar = YAHOO.widget.Toolbar;
+
+    /**
+     * The Rich Text Editor is a UI control that replaces a standard HTML textarea; it allows for the rich formatting of text content, including common structural treatments like lists, formatting treatments like bold and italic text, and drag-and-drop inclusion and sizing of images. The Rich Text Editor's toolbar is extensible via a plugin architecture so that advanced implementations can achieve a high degree of customization.
+     * @constructor
+     * @class Editor
+     * @extends YAHOO.util.Element
+     * @param {String/HTMLElement} el The textarea element to turn into an editor.
+     * @param {Object} attrs Object liternal containing configuration parameters.
+    */
+    
+    YAHOO.widget.Editor = function(el, attrs) {
+
+        var oConfig = {
+            element: null,
+            attributes: (attrs || {})
+        }, id = null;
+
+        if (Lang.isString(el)) {
+            id = el;
+        } else {
+            id = el.id;
+        }
+        oConfig.element = el;
+
+        var element_cont = document.createElement('DIV');
+        oConfig.attributes.element_cont = new YAHOO.util.Element(element_cont, {
+            id: id + '_container'
+        });
+        var div = document.createElement('div');
+        Dom.addClass(div, 'first-child');
+        oConfig.attributes.element_cont.appendChild(div);
+        
+        if (!oConfig.attributes.toolbar_cont) {
+            oConfig.attributes.toolbar_cont = document.createElement('DIV');
+            oConfig.attributes.toolbar_cont.id = id + '_toolbar';
+            div.appendChild(oConfig.attributes.toolbar_cont);
+        }
+        
+        var editorWrapper = document.createElement('DIV');
+        div.appendChild(editorWrapper);
+        oConfig.attributes.editor_wrapper = editorWrapper;
+
+        YAHOO.widget.Editor.superclass.constructor.call(this, oConfig.element, oConfig.attributes);
+    };
+
+    /**
+    * @private _cleanClassName
+    * @description Makes a useable classname from dynamic data, by dropping it to lowercase and replacing spaces with -'s.
+    * @param {String} str The classname to clean up
+    * @returns {String}
+    */
+    function _cleanClassName(str) {
+        return str.replace(/ /g, '-').toLowerCase();
+    }
+
+
+    YAHOO.extend(YAHOO.widget.Editor, YAHOO.util.Element, {
+        /**
+        * @property _lastButton
+        * @private
+        * @description The last button pressed, so we don't disable it.
+        * @type Object
+        */
+        _lastButton: null,
+        /**
+        * @property _baseHREF
+        * @private
+        * @description The base location of the editable page (this page) so that relative paths for image work.
+        * @type String
+        */
+        _baseHREF: function() {
+            var href = document.location.href;
+            if (href.indexOf('?') !== -1) { //Remove the query string
+                href = href.substring(0, href.indexOf('?'));
+            }
+            href = href.substring(0, href.lastIndexOf('/')) + '/';
+            return href;
+        }(),
+        /**
+        * @property _lastImage
+        * @private
+        * @description Safari reference for the last image selected (for styling as selected).
+        * @type HTMLElement
+        */
+        _lastImage: null,
+        /**
+        * @property _blankImageLoaded
+        * @private
+        * @description Don't load the blank image more than once..
+        * @type Date
+        */
+        _blankImageLoaded: false,
+        /**
+        * @property _fixNodesTimer
+        * @private
+        * @description Holder for the fixNodes timer
+        * @type Date
+        */
+        _fixNodesTimer: null,
+        /**
+        * @property _nodeChangeTimer
+        * @private
+        * @description Holds a reference to the nodeChange setTimeout call
+        * @type Number
+        */
+        _nodeChangeTimer: null,
+        /**
+        * @property _lastNodeChangeEvent
+        * @private
+        * @description Flag to determine the last event that fired a node change
+        * @type Event
+        */
+        _lastNodeChangeEvent: null,
+        /**
+        * @property _lastNodeChange
+        * @private
+        * @description Flag to determine when the last node change was fired
+        * @type Date
+        */
+        _lastNodeChange: 0,
+        /**
+        * @property _rendered
+        * @private
+        * @description Flag to determine if editor has been rendered or not
+        * @type Boolean
+        */
+        _rendered: false,
+        /**
+        * @property DOMReady
+        * @private
+        * @description Flag to determine if DOM is ready or not
+        * @type Boolean
+        */
+        DOMReady: null,
+        /**
+        * @property _selection
+        * @private
+        * @description Holder for caching iframe selections
+        * @type Object
+        */
+        _selection: null,
+        /**
+        * @property _mask
+        * @private
+        * @description DOM Element holder for the editor Mask when disabled
+        * @type Object
+        */
+        _mask: null,
+        /**
+        * @property _showingHiddenElements
+        * @private
+        * @description Status of the hidden elements button
+        * @type Boolean
+        */
+        _showingHiddenElements: null,
+        /**
+        * @property currentWindow
+        * @description A reference to the currently open EditorWindow
+        * @type Object
+        */
+        currentWindow: null,
+        /**
+        * @property currentEvent
+        * @description A reference to the current editor event
+        * @type Event
+        */
+        currentEvent: null,
+        /**
+        * @property operaEvent
+        * @private
+        * @description setTimeout holder for Opera and Image DoubleClick event..
+        * @type Object
+        */
+        operaEvent: null,
+        /**
+        * @property currentFont
+        * @description A reference to the last font selected from the Toolbar
+        * @type HTMLElement
+        */
+        currentFont: null,
+        /**
+        * @property currentElement
+        * @description A reference to the current working element in the editor
+        * @type Array
+        */
+        currentElement: [],
+        /**
+        * @property dompath
+        * @description A reference to the dompath container for writing the current working dom path to.
+        * @type HTMLElement
+        */
+        dompath: null,
+        /**
+        * @property beforeElement
+        * @description A reference to the H2 placed before the editor for Accessibilty.
+        * @type HTMLElement
+        */
+        beforeElement: null,
+        /**
+        * @property afterElement
+        * @description A reference to the H2 placed after the editor for Accessibilty.
+        * @type HTMLElement
+        */
+        afterElement: null,
+        /**
+        * @property invalidHTML
+        * @description Contains a list of HTML elements that are invalid inside the editor. They will be removed when they are found.
+        * @type Object
+        */
+        invalidHTML: {
+            form: true,
+            input: true,
+            button: true,
+            select: true,
+            link: true,
+            html: true,
+            body: true,
+            script: true,
+            style: true,
+            textarea: true
+        },
+        /**
+        * @property toolbar
+        * @description Local property containing the <a href="YAHOO.widget.Toolbar.html">YAHOO.widget.Toolbar</a> instance
+        * @type <a href="YAHOO.widget.Toolbar.html">YAHOO.widget.Toolbar</a>
+        */
+        toolbar: null,
+        /**
+        * @private
+        * @property _contentTimer
+        * @description setTimeout holder for documentReady check
+        */
+        _contentTimer: null,
+        /**
+        * @private
+        * @property _contentTimerCounter
+        * @description Counter to check the number of times the body is polled for before giving up
+        * @type Number
+        */
+        _contentTimerCounter: 0,
+        /**
+        * @private
+        * @property _disabled
+        * @description The Toolbar items that should be disabled if there is no selection present in the editor.
+        * @type Array
+        */
+        _disabled: [ 'createlink', 'forecolor', 'backcolor', 'fontname', 'fontsize', 'superscript', 'subscript', 'removeformat', 'heading', 'indent' ],
+        /**
+        * @private
+        * @property _alwaysDisabled
+        * @description The Toolbar items that should ALWAYS be disabled event if there is a selection present in the editor.
+        * @type Object
+        */
+        _alwaysDisabled: { 'outdent': true },
+        /**
+        * @private
+        * @property _alwaysEnabled
+        * @description The Toolbar items that should ALWAYS be enabled event if there isn't a selection present in the editor.
+        * @type Object
+        */
+        _alwaysEnabled: { hiddenelements: true },
+        /**
+        * @private
+        * @property _semantic
+        * @description The Toolbar commands that we should attempt to make tags out of instead of using styles.
+        * @type Object
+        */
+        _semantic: { 'bold': true, 'italic' : true, 'underline' : true },
+        /**
+        * @private
+        * @property _tag2cmd
+        * @description A tag map of HTML tags to convert to the different types of commands so we can select the proper toolbar button.
+        * @type Object
+        */
+        _tag2cmd: {
+            'b': 'bold',
+            'strong': 'bold',
+            'i': 'italic',
+            'em': 'italic',
+            'u': 'underline',
+            'sup': 'superscript',
+            'sub': 'subscript',
+            'img': 'insertimage',
+            'a' : 'createlink',
+            'ul' : 'insertunorderedlist',
+            'ol' : 'insertorderedlist'
+        },
+
+        /**
+        * @private _createIframe
+        * @description Creates the DOM and YUI Element for the iFrame editor area.
+        * @param {String} id The string ID to prefix the iframe with
+        * @returns {Object} iFrame object
+        */
+        _createIframe: function() {
+            var ifrmDom = document.createElement('iframe');
+            ifrmDom.id = this.get('id') + '_editor';
+            var config = {
+                border: '0',
+                frameBorder: '0',
+                marginWidth: '0',
+                marginHeight: '0',
+                leftMargin: '0',
+                topMargin: '0',
+                allowTransparency: 'true',
+                width: '100%'
+            };
+            for (var i in config) {
+                if (Lang.hasOwnProperty(config, i)) {
+                    ifrmDom.setAttribute(i, config[i]);
+                }
+            }
+            var isrc = 'javascript:;';
+            if (this.browser.ie) {
+                isrc = 'about:blank';
+            }
+            ifrmDom.setAttribute('src', isrc);
+            var ifrm = new YAHOO.util.Element(ifrmDom);
+            ifrm.setStyle('zIndex', '-1');
+            return ifrm;
+        },
+        /**
+        * @private _isElement
+        * @description Checks to see if an Element reference is a valid one and has a certain tag type
+        * @param {HTMLElement} el The element to check
+        * @param {String} tag The tag that the element needs to be
+        * @returns {Boolean}
+        */
+        _isElement: function(el, tag) {
+            if (el && el.tagName && (el.tagName.toLowerCase() == tag)) {
+                return true;
+            }
+            if (el && el.getAttribute && (el.getAttribute('tag') == tag)) {
+                return true;
+            }
+            return false;
+        },
+        /**
+        * @private
+        * @method _getDoc
+        * @description Get the Document of the IFRAME
+        * @return {Object}
+        */
+        _getDoc: function() {
+            var value = false;
+            if (this.get) {
+                if (this.get('iframe')) {
+                    if (this.get('iframe').get) {
+                        if (this.get('iframe').get('element')) {
+                            try {
+                                if (this.get('iframe').get('element').contentWindow) {
+                                    if (this.get('iframe').get('element').contentWindow.document) {
+                                        value = this.get('iframe').get('element').contentWindow.document;
+                                        return value;
+                                    }
+                                }
+                            } catch (e) {}
+                        }
+                    }
+                }
+            }
+            return false;
+        },
+        /**
+        * @private
+        * @method _getWindow
+        * @description Get the Window of the IFRAME
+        * @return {Object}
+        */
+        _getWindow: function() {
+            return this.get('iframe').get('element').contentWindow;
+        },
+        /**
+        * @private
+        * @method _focusWindow
+        * @description Attempt to set the focus of the iframes window.
+        * @param {Boolean} onLoad Safari needs some special care to set the cursor in the iframe
+        */
+        _focusWindow: function(onLoad) {
+            if (this.browser.webkit) {
+                if (onLoad) {
+                    /**
+                    * @knownissue Safari Cursor Position
+                    * @browser Safari 2.x
+                    * @description Can't get Safari to place the cursor at the beginning of the text..
+                    * This workaround at least set's the toolbar into the proper state.
+                    */
+                    this._getSelection().setBaseAndExtent(this._getDoc().body.firstChild, 0, this._getDoc().body.firstChild, 1);
+                    if (this.browser.webkit3) {
+                        this._getSelection().collapseToStart();
+                    } else {
+                        this._getSelection().collapse(false);
+                    }
+                } else {
+                    this._getSelection().setBaseAndExtent(this._getDoc().body, 1, this._getDoc().body, 1);
+                    if (this.browser.webkit3) {
+                        this._getSelection().collapseToStart();
+                    } else {
+                        this._getSelection().collapse(false);
+                    }
+                }
+                this._getWindow().focus();
+            } else {
+                this._getWindow().focus();
+            }
+        },
+        /**
+        * @private
+        * @method _hasSelection
+        * @description Determines if there is a selection in the editor document.
+        * @returns {Boolean}
+        */
+        _hasSelection: function() {
+            var sel = this._getSelection();
+            var range = this._getRange();
+            var hasSel = false;
+
+            //Internet Explorer
+            if (this.browser.ie || this.browser.opera) {
+                if (range.text) {
+                    hasSel = true;
+                }
+                if (range.html) {
+                    hasSel = true;
+                }
+            } else {
+                if (this.browser.webkit) {
+                    if (sel+'' !== '') {
+                        hasSel = true;
+                    }
+                } else {
+                    if (sel && (sel.toString() !== '') && (sel !== undefined)) {
+                        hasSel = true;
+                    }
+                }
+            }
+            return hasSel;
+        },
+        /**
+        * @private
+        * @method _getSelection
+        * @description Handles the different selection objects across the A-Grade list.
+        * @returns {Object} Selection Object
+        */
+        _getSelection: function() {
+            var _sel = null;
+            if (this._getDoc() && this._getWindow()) {
+                if (this._getDoc().selection) {
+                    _sel = this._getDoc().selection;
+                } else {
+                    _sel = this._getWindow().getSelection();
+                }
+                //Handle Safari's lack of Selection Object
+                if (this.browser.webkit) {
+                    if (_sel.baseNode) {
+                            this._selection = {};
+                            this._selection.baseNode = _sel.baseNode;
+                            this._selection.baseOffset = _sel.baseOffset;
+                            this._selection.extentNode = _sel.extentNode;
+                            this._selection.extentOffset = _sel.extentOffset;
+                    } else if (this._selection !== null) {
+                        _sel = this._getWindow().getSelection();
+                        _sel.setBaseAndExtent(
+                            this._selection.baseNode,
+                            this._selection.baseOffset,
+                            this._selection.extentNode,
+                            this._selection.extentOffset);
+                        this._selection = null;
+                    }
+                }
+            }
+            return _sel;
+        },
+        /**
+        * @private
+        * @method _selectNode
+        * @description Places the highlight around a given node
+        * @param {HTMLElement} node The node to select
+        */
+        _selectNode: function(node) {
+            if (!node) {
+                return false;
+            }
+            var sel = this._getSelection(),
+                range = null;
+
+            if (this.browser.ie) {
+                try { //IE freaks out here sometimes..
+                    range = this.getDoc().body.createTextRange();
+                    range.moveToElementText(node);
+                    range.select();
+                } catch (e) {}
+            } else if (this.browser.webkit) {
+				sel.setBaseAndExtent(node, 0, node, node.innerText.length);
+            } else {
+                range = this._getDoc().createRange();
+                range.selectNodeContents(node);
+                sel.removeAllRanges();
+                sel.addRange(range);
+            }
+        },
+        /**
+        * @private
+        * @method _getRange
+        * @description Handles the different range objects across the A-Grade list.
+        * @returns {Object} Range Object
+        */
+        _getRange: function() {
+            var sel = this._getSelection();
+
+            if (sel === null) {
+                return null;
+            }
+
+            if (this.browser.webkit && !sel.getRangeAt) {
+                var _range = this._getDoc().createRange();
+                try {
+                    _range.setStart(sel.anchorNode, sel.anchorOffset);
+                    _range.setEnd(sel.focusNode, sel.focusOffset);
+                } catch (e) {
+                    _range = this._getWindow().getSelection()+'';
+                }
+                return _range;
+            }
+
+            if (this.browser.ie || this.browser.opera) {
+                return sel.createRange();
+            }
+
+            if (sel.rangeCount > 0) {
+                return sel.getRangeAt(0);
+            }
+            return null;
+        },
+        /**
+        * @private
+        * @method _setDesignMode
+        * @description Sets the designMode of the iFrame document.
+        * @param {String} state This should be either on or off
+        */
+        _setDesignMode: function(state) {
+            try {
+                this._getDoc().designMode = state;
+            } catch(e) { }
+        },
+        /**
+        * @private
+        * @method _toggleDesignMode
+        * @description Toggles the designMode of the iFrame document on and off.
+        * @returns {String} The state that it was set to.
+        */
+        _toggleDesignMode: function() {
+            var _dMode = this._getDoc().designMode,
+                _state = 'on';
+            if (_dMode == 'on') {
+                _state = 'off';
+            }
+            this._setDesignMode(_state);
+            return _state;
+        },
+        /**
+        * @private
+        * @method _initEditor
+        * @description This method is fired from _checkLoaded when the document is ready. It turns on designMode and set's up the listeners.
+        */
+        _initEditor: function() {
+            if (this.browser.ie) {
+                this._getDoc().body.style.margin = '0';
+            }
+            this._setDesignMode('on');
+            
+            this.toolbar.on('buttonClick', this._handleToolbarClick, this, true);
+            //Setup Listeners on iFrame
+            Event.on(this._getDoc(), 'mouseup', this._handleMouseUp, this, true);
+            Event.on(this._getDoc(), 'mousedown', this._handleMouseDown, this, true);
+            Event.on(this._getDoc(), 'click', this._handleClick, this, true);
+            Event.on(this._getDoc(), 'dblclick', this._handleDoubleClick, this, true);
+            Event.on(this._getDoc(), 'keypress', this._handleKeyPress, this, true);
+            Event.on(this._getDoc(), 'keyup', this._handleKeyUp, this, true);
+            Event.on(this._getDoc(), 'keydown', this._handleKeyDown, this, true);
+            this.toolbar.set('disabled', false);
+            this.fireEvent('editorContentLoaded', { type: 'editorLoaded', target: this });
+            if (this.get('dompath')) {
+                var self = this;
+                setTimeout(function() {
+                    self._writeDomPath.call(self);
+                }, 150);
+            }
+            this.nodeChange(true);
+            this._setBusy(true);
+        },
+        /**
+        * @private
+        * @method _checkLoaded
+        * @description Called from a setTimeout loop to check if the iframes body.onload event has fired, then it will init the editor.
+        */
+        _checkLoaded: function() {
+            this._contentTimerCounter++;
+            if (this._contentTimer) {
+                clearTimeout(this._contentTimer);
+            }
+            if (this._contentTimerCounter > 250) {
+                return false;
+            }
+            var init = false;
+            try {
+                if (this._getDoc() && this._getDoc().body && (this._getDoc().body._rteLoaded === true)) {
+                    init = true;
+                }
+            } catch (e) {
+                init = false;
+            }
+
+            if (init === true) {
+                //The onload event has fired, clean up after ourselves and fire the _initEditor method
+                this._initEditor();
+            } else {
+                var self = this;
+                this._contentTimer = setTimeout(function() {
+                    self._checkLoaded.call(self);
+                }, 20);
+            }
+        },
+        /**
+        * @private
+        * @method _setInitialContent
+        * @description This method will open the iframes content document and write the textareas value into it, then start the body.onload checking.
+        */
+        _setInitialContent: function() {
+            var html = Lang.substitute(this.get('html'), {
+                TITLE: this.STR_TITLE,
+                CONTENT: this.get('element').value,
+                CSS: this.get('css'),
+                HIDDEN_CSS: this.get('hiddencss')
+            }),
+            check = true;
+            if (this.browser.ie || this.browser.webkit || this.browser.opera) {
+                try {
+                    this._getDoc().open();
+                    this._getDoc().write(html);
+                    this._getDoc().close();
+                } catch (e) {
+                    //Safari will only be here if we are hidden
+                    check = false;
+                }
+            } else {
+                //This keeps Firefox from writing the iframe to history preserving the back buttons functionality
+                this.get('iframe').get('element').src = 'data:text/html;charset=utf-8,' + encodeURIComponent(html);
+            }
+            if (check) {
+                this._checkLoaded();
+            }
+        },
+        /**
+        * @private
+        * @method _setMarkupType
+        * @param {String} action The action to take. Possible values are: css, default or semantic
+        * @description This method will turn on/off the useCSS execCommand.
+        */
+        _setMarkupType: function(action) {
+            switch (this.get('markup')) {
+                case 'css':
+                    this._setEditorStyle(true);
+                    break;
+                case 'default':
+                    this._setEditorStyle(false);
+                    break;
+                case 'semantic':
+                case 'xhtml':
+                    if (this._semantic[action]) {
+                        this._setEditorStyle(false);
+                    } else {
+                        this._setEditorStyle(true);
+                    }
+                    break;
+            }
+        },
+        /**
+        * Set the editor to use CSS instead of HTML
+        * @param {Booleen} stat True/False
+        */
+        _setEditorStyle: function(stat) {
+            try {
+                this._getDoc().execCommand('useCSS', false, !stat);
+            } catch (ex) {
+            }
+        },
+        /**
+        * @private
+        * @method _getSelectedElement
+        * @description This method will attempt to locate the element that was last interacted with, either via selection, location or event.
+        * @returns {HTMLElement} The currently selected element.
+        */
+        _getSelectedElement: function() {
+            var doc = this._getDoc(),
+                range = null,
+                sel = null,
+                elm = null;
+
+            if (this.browser.ie) {
+                this.currentEvent = this._getWindow().event; //Event utility assumes window.event, so we need to reset it to this._getWindow().event;
+                range = this._getRange();
+                if (range) {
+                    elm = range.item ? range.item(0) : range.parentElement();
+                    if (elm == doc.body) {
+                        elm = null;
+                    }
+                }
+                if ((this.currentEvent !== null) && (this.currentEvent.keyCode === 0)) {
+                    elm = Event.getTarget(this.currentEvent);
+                }
+            } else {
+                sel = this._getSelection();
+                range = this._getRange();
+
+                if (!sel || !range) {
+                    return null;
+                }
+                if (!this._hasSelection() && !this.browser.webkit) {
+                    if (sel.anchorNode && (sel.anchorNode.nodeType == 3)) {
+                        if (sel.anchorNode.parentNode) { //next check parentNode
+                            elm = sel.anchorNode.parentNode;
+                        }
+                        if (sel.anchorNode.nextSibling != sel.focusNode.nextSibling) {
+                            elm = sel.anchorNode.nextSibling;
+                        }
+                    }
+                    
+                    if (this._isElement(elm, 'br')) {
+                        elm = null;
+                    }
+                
+                    if (!elm) {
+                        elm = range.commonAncestorContainer;
+                        if (!range.collapsed) {
+                            if (range.startContainer == range.endContainer) {
+                                if (range.startOffset - range.endOffset < 2) {
+                                    if (range.startContainer.hasChildNodes()) {
+                                        elm = range.startContainer.childNodes[range.startOffset];
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            if (this.currentEvent !== null) {
+                switch (this.currentEvent.type) {
+                    case 'click':
+                    case 'mousedown':
+                    case 'mouseup':
+                        elm = Event.getTarget(this.currentEvent);
+                        break;
+                    default:
+                        //Do nothing
+                        break;
+                }
+            } else if (this.currentElement && this.currentElement[0]) {
+                elm = this.currentElement[0];
+            }
+
+            if (this.browser.opera || this.browser.webkit) {
+                if (this.currentEvent && !elm) {
+                    elm = YAHOO.util.Event.getTarget(this.currentEvent);
+                }
+            }
+
+            if (!elm || !elm.tagName) {
+                elm = doc.body;
+            }
+            if (this._isElement(elm, 'html')) {
+                //Safari sometimes gives us the HTML node back..
+                elm = doc.body;
+            }
+            if (this._isElement(elm, 'body')) {
+                //make sure that body means this body not the parent..
+                elm = doc.body;
+            }
+            if (elm && !elm.parentNode) { //Not in document
+                elm = doc.body;
+            }
+            if (elm === undefined) {
+                elm = null;
+            }
+            return elm;
+        },
+        /**
+        * @private
+        * @method _getDomPath
+        * @description This method will attempt to build the DOM path from the currently selected element.
+        * @returns {Array} An array of node references that will create the DOM Path.
+        */
+        _getDomPath: function() {
+			var el = this._getSelectedElement();
+			var domPath = [];
+            while (el !== null) {
+                if (el.ownerDocument != this._getDoc()) {
+                    el = null;
+                    break;
+                }
+                //Check to see if we get el.nodeName and nodeType
+                if (el.nodeName && el.nodeType && (el.nodeType == 1)) {
+                    domPath[domPath.length] = el;
+                }
+
+                if (this._isElement(el, 'body')) {
+                    break;
+                }
+
+                el = el.parentNode;
+            }
+            if (domPath.length === 0) {
+                if (this._getDoc() && this._getDoc().body) {
+                    domPath[0] = this._getDoc().body;
+                }
+            }
+            return domPath.reverse();
+        },
+        /**
+        * @private
+        * @method _writeDomPath
+        * @description Write the current DOM path out to the dompath container below the editor.
+        */
+        _writeDomPath: function() { 
+            var path = this._getDomPath(),
+                pathArr = [],
+                classPath = '',
+                pathStr = '';
+            for (var i = 0; i < path.length; i++) {
+                var tag = path[i].tagName.toLowerCase();
+                if ((tag == 'ol') && (path[i].type)) {
+                    tag += ':' + path[i].type;
+                }
+                if (Dom.hasClass(path[i], 'yui-tag')) {
+                    tag = path[i].getAttribute('tag');
+                }
+                if ((this.get('markup') == 'semantic') || (this.get('markup') == 'xhtml')) {
+                    switch (tag) {
+                        case 'b': tag = 'strong'; break;
+                        case 'i': tag = 'em'; break;
+                    }
+                }
+                if (!Dom.hasClass(path[i], 'yui-non')) {
+                    if (Dom.hasClass(path[i], 'yui-tag')) {
+                        pathStr = tag;
+                    } else {
+                        classPath = ((path[i].className !== '') ? '.' + path[i].className.replace(/ /g, '.') : '');
+                        if ((classPath.indexOf('yui') != -1) || (classPath.toLowerCase().indexOf('apple-style-span') != -1)) {
+                            classPath = '';
+                        }
+                        pathStr = tag + ((path[i].id) ? '#' + path[i].id : '') + classPath;
+                    }
+                    switch (tag) {
+                        case 'a':
+                            if (path[i].getAttribute('href')) {
+                                pathStr += ':' + path[i].getAttribute('href').replace('mailto:', '').replace('http:/'+'/', '').replace('https:/'+'/', ''); //May need to add others here ftp
+                            }
+                            break;
+                        case 'img':
+                            var h = path[i].height;
+                            var w = path[i].width;
+                            if (path[i].style.height) {
+                                h = parseInt(path[i].style.height, 10);
+                            }
+                            if (path[i].style.width) {
+                                w = parseInt(path[i].style.width, 10);
+                            }
+                            pathStr += '(' + h + 'x' + w + ')';
+                        break;
+                    }
+
+                    if (pathStr.length > 10) {
+                        pathStr = '<span title="' + pathStr + '">' + pathStr.substring(0, 10) + '...' + '</span>';
+                    } else {
+                        pathStr = '<span title="' + pathStr + '">' + pathStr + '</span>';
+                    }
+                    pathArr[pathArr.length] = pathStr;
+                }
+            }
+            var str = pathArr.join(' ' + this.SEP_DOMPATH + ' ');
+            //Prevent flickering
+            if (this.dompath.innerHTML != str) {
+                this.dompath.innerHTML = str;
+            }
+        },
+        /**
+        * @private
+        * @method _fixNodes
+        * @description Fix href and imgs as well as remove invalid HTML.
+        */
+        _fixNodes: function() {
+            for (var v in this.invalidHTML) {
+                if (Lang.hasOwnProperty(this.invalidHTML, v)) {
+                    var tags = this._getDoc().body.getElementsByTagName(v);
+                    for (var h = 0; h < tags.length; h++) {
+                        if (tags[h].parentNode) {
+                            tags[h].parentNode.removeChild(tags[h]);
+                        }
+                    }
+                }
+            }
+            var imgs = this._getDoc().getElementsByTagName('img');
+            Dom.addClass(imgs, 'yui-img');
+            
+            var url = '';
+
+            for (var im = 0; im < imgs.length; im++) {
+                if (imgs[im].getAttribute('href', 2)) {
+                    url = imgs[im].getAttribute('src', 2);
+                    if (this._isLocalFile(url)) {
+                        Dom.addClass(imgs[im], this.CLASS_LOCAL_FILE);
+                    } else {
+                        Dom.removeClass(imgs[im], this.CLASS_LOCAL_FILE);
+                    }
+                }
+            }
+            var fakeAs = this._getDoc().body.getElementsByTagName('a');
+            for (var a = 0; a < fakeAs.length; a++) {
+                if (fakeAs[a].getAttribute('href', 2)) {
+                    url = fakeAs[a].getAttribute('href', 2);
+                    if (this._isLocalFile(url)) {
+                        Dom.addClass(fakeAs[a], this.CLASS_LOCAL_FILE);
+                    } else {
+                        Dom.removeClass(fakeAs[a], this.CLASS_LOCAL_FILE);
+                    }
+                }
+            }
+        },
+        /**
+        * @private
+        * @method _showHidden
+        * @description Toggle on/off the hidden.css file.
+        */
+        _showHidden: function() {
+            if (this._showingHiddenElements) {
+                this._showingHiddenElements = false;
+                this.toolbar.deselectButton('hiddenelements');
+                Dom.removeClass(this._getDoc().body, this.CLASS_HIDDEN);
+            } else {
+                this._showingHiddenElements = true;
+                Dom.addClass(this._getDoc().body, this.CLASS_HIDDEN);
+                this.toolbar.selectButton('hiddenelements');
+            }
+        },
+        /**
+        * @private
+        * @method _setCurrentEvent
+        * @param {Event} ev The event to cache
+        * @description Sets the current event property
+        */
+        _setCurrentEvent: function(ev) {
+            this.currentEvent = ev;
+        },
+        /**
+        * @private
+        * @method _handleClick
+        * @param {Event} ev The event we are working on.
+        * @description Handles all click events inside the iFrame document.
+        */
+        _handleClick: function(ev) {
+            this._setCurrentEvent(ev);
+            if (this.currentWindow) {
+                this.closeWindow();
+            }
+            if (YAHOO.widget.EditorInfo.window.win && YAHOO.widget.EditorInfo.window.scope) {
+                YAHOO.widget.EditorInfo.window.scope.closeWindow.call(YAHOO.widget.EditorInfo.window.scope);
+            }
+            if (this.browser.webkit) {
+                var tar =Event.getTarget(ev);
+                if (this._isElement(tar, 'a') || this._isElement(tar.parentNode, 'a')) {
+                    Event.stopEvent(ev);
+                    this.nodeChange();
+                }
+            } else {
+                this.nodeChange();
+            }
+        },
+        /**
+        * @private
+        * @method _handleMouseUp
+        * @param {Event} ev The event we are working on.
+        * @description Handles all mouseup events inside the iFrame document.
+        */
+        _handleMouseUp: function(ev) {
+            this._setCurrentEvent(ev);
+            var self = this;
+            if (this.browser.opera) {
+                /**
+                * @knownissue Opera appears to stop the MouseDown, Click and DoubleClick events on an image inside of a document with designMode on..
+                * @browser Opera
+                * @description This work around traps the MouseUp event and sets a timer to check if another MouseUp event fires in so many seconds. If another event is fired, they we internally fire the DoubleClick event.
+                */
+                var sel = Event.getTarget(ev);
+                if (this._isElement(sel, 'img')) {
+                    this.nodeChange();
+                    if (this.operaEvent) {
+                        clearTimeout(this.operaEvent);
+                        this.operaEvent = null;
+                        this._handleDoubleClick(ev);
+                    } else {
+                        this.operaEvent = window.setTimeout(function() {
+                            self.operaEvent = false;
+                        }, 700);
+                    }
+                }
+            }
+            //This will stop Safari from selecting the entire document if you select all the text in the editor
+            if (this.browser.webkit || this.browser.opera) {
+                if (this.browser.webkit) {
+                    Event.stopEvent(ev);
+                }
+            }
+            this.nodeChange();
+            this.fireEvent('editorMouseUp', { type: 'editorMouseUp', target: this, ev: ev });
+        },
+        /**
+        * @private
+        * @method _handleMouseDown
+        * @param {Event} ev The event we are working on.
+        * @description Handles all mousedown events inside the iFrame document.
+        */
+        _handleMouseDown: function(ev) {
+            this._setCurrentEvent(ev);
+            var sel = Event.getTarget(ev);
+            if (this.browser.webkit && this._hasSelection()) {
+                var _sel = this._getSelection();
+                if (!this.browser.webkit3) {
+                    _sel.collapse(true);
+                } else {
+                    _sel.collapseToStart();
+                }
+            }
+            if (this.browser.webkit && this._lastImage) {
+                Dom.removeClass(this._lastImage, 'selected');
+                this._lastImage = null;
+            }
+            if (this._isElement(sel, 'img') || this._isElement(sel, 'a')) {
+                if (this.browser.webkit) {
+                    Event.stopEvent(ev);
+                    if (this._isElement(sel, 'img')) {
+                        Dom.addClass(sel, 'selected');
+                        this._lastImage = sel;
+                    }
+                }
+                this.nodeChange();
+            }
+            this.fireEvent('editorMouseDown', { type: 'editorMouseDown', target: this, ev: ev });
+        },
+        /**
+        * @private
+        * @method _handleDoubleClick
+        * @param {Event} ev The event we are working on.
+        * @description Handles all doubleclick events inside the iFrame document.
+        */
+        _handleDoubleClick: function(ev) {
+            this._setCurrentEvent(ev);
+            var sel = Event.getTarget(ev);
+            if (this._isElement(sel, 'img')) {
+                this.currentElement[0] = sel;
+                this.toolbar.fireEvent('insertimageClick', { type: 'insertimageClick', target: this.toolbar });
+                this.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: this });
+            } else if (this._isElement(sel, 'a')) {
+                this.currentElement[0] = sel;
+                this.toolbar.fireEvent('createlinkClick', { type: 'createlinkClick', target: this.toolbar });
+                this.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: this });
+            }
+            this.nodeChange();
+            this.fireEvent('editorDoubleClick', { type: 'editorDoubleClick', target: this, ev: ev });
+        },
+        /**
+        * @private
+        * @method _handleKeyUp
+        * @param {Event} ev The event we are working on.
+        * @description Handles all keyup events inside the iFrame document.
+        */
+        _handleKeyUp: function(ev) {
+            this._setCurrentEvent(ev);
+            switch (ev.keyCode) {
+                case 37: //Left Arrow
+                case 38: //Up Arrow
+                case 39: //Right Arrow
+                case 40: //Down Arrow
+                case 46: //Forward Delete
+                case 8: //Delete
+                case 87: //W key if window is open
+                    if ((ev.keyCode == 87) && this.currentWindow && ev.shiftKey && ev.ctrlKey) {
+                        this.closeWindow();
+                    } else {
+                        if (!this.browser.ie) {
+                            if (this._nodeChangeTimer) {
+                                clearTimeout(this._nodeChangeTimer);
+                            }
+                            var self = this;
+                            this._nodeChangeTimer = setTimeout(function() {
+                                self._nodeChangeTimer = null;
+                                self.nodeChange.call(self);
+                            }, 100);
+                        } else {
+                            this.nodeChange();
+                        }
+                    }
+                    break;
+            }
+            this.fireEvent('editorKeyUp', { type: 'editorKeyUp', target: this, ev: ev });
+        },
+        /**
+        * @private
+        * @method _handleKeyPress
+        * @param {Event} ev The event we are working on.
+        * @description Handles all keypress events inside the iFrame document.
+        */
+        _handleKeyPress: function(ev) {
+            this._setCurrentEvent(ev);
+            this.fireEvent('editorKeyPress', { type: 'editorKeyPress', target: this, ev: ev });
+        },
+        /**
+        * @private
+        * @method _handleKeyDown
+        * @param {Event} ev The event we are working on.
+        * @description Handles all keydown events inside the iFrame document.
+        */
+        _handleKeyDown: function(ev) {
+            this._setCurrentEvent(ev);
+            if (this.currentWindow) {
+                this.closeWindow();
+            }
+            if (YAHOO.widget.EditorInfo.window.win && YAHOO.widget.EditorInfo.window.scope) {
+                YAHOO.widget.EditorInfo.window.scope.closeWindow.call(YAHOO.widget.EditorInfo.window.scope);
+            }
+            var doExec = false,
+                action = null,
+                exec = false;
+
+            if (ev.shiftKey && ev.ctrlKey) {
+                doExec = true;
+            }
+            switch (ev.keyCode) {
+                case 84: //Focus Toolbar Header -- Ctrl + Shift + T
+                    if (ev.shiftKey && ev.ctrlKey) {
+                        this.toolbar._titlebar.firstChild.focus();
+                        Event.stopEvent(ev);
+                        doExec = false;
+                    }
+                    break;
+                case 27: //Focus After Element - Ctrl + Shift + Esc
+                    if (ev.shiftKey) {
+                        this.afterElement.focus();
+                        Event.stopEvent(ev);
+                        exec = false;
+                    }
+                    break;
+                case 219: //Left
+                    action = 'justifyleft';
+                    break;
+                case 220: //Center
+                    action = 'justifycenter';
+                    break;
+                case 221: //Right
+                    action = 'justifyright';
+                    break;
+                case 76: //L
+                    if (this._hasSelection()) {
+                        if (ev.shiftKey && ev.ctrlKey) {
+                            this.execCommand('createlink', '');
+                            this.toolbar.fireEvent('createlinkClick', { type: 'createlinkClick', target: this.toolbar });
+                            this.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: this });
+                            doExec = false;
+                        }
+                    }
+                    break;
+                case 65:
+                    if (ev.metaKey && this.browser.webkit) {
+                        Event.stopEvent(ev);
+                        //Override Safari's select all and select the contents of the editor not the iframe as Safari would by default.
+                        this._getSelection().setBaseAndExtent(this._getDoc().body, 1, this._getDoc().body, this._getDoc().body.innerHTML.length);
+                    }
+                    break;
+                case 66: //B
+                    action = 'bold';
+                    break;
+                case 73: //I
+                    action = 'italic';
+                    break;
+                case 85: //U
+                    action = 'underline';
+                    break;
+                case 9: //Tab Key
+                    if (this.browser.safari) {
+                        this._getDoc().execCommand('inserttext', false, '\t');
+                        Event.stopEvent(ev);
+                    }
+                    break;
+                case 13:
+                    if (this.browser.ie) {
+                        //Insert a <br> instead of a <p></p> in Internet Explorer
+                        var _range = this._getRange();
+                        var tar = this._getSelectedElement();
+                        if (!this._isElement(tar, 'li')) {
+                            if (_range) {
+                                _range.pasteHTML('<br>');
+                                _range.collapse(false);
+                                _range.select();
+                            }
+                            Event.stopEvent(ev);
+                        }
+                    }
+            }
+            if (doExec && action) {
+                this.execCommand(action, null);
+                Event.stopEvent(ev);
+                this.nodeChange();
+            }
+            this.fireEvent('editorKeyDown', { type: 'editorKeyDown', target: this, ev: ev });
+        },
+        /**
+        * @method nodeChange
+        * @param {Boolean} force Optional paramenter to skip the threshold counter
+        * @description Handles setting up the toolbar buttons, getting the Dom path, fixing nodes.
+        */
+        nodeChange: function(force) {
+            var threshold = parseInt(this.get('nodeChangeThreshold'), 10);
+            var thisNodeChange = Math.round(new Date().getTime() / 1000);
+            if (force === true) {
+                this._lastNodeChange = 0;
+            }
+            if ((this._lastNodeChange + threshold) < thisNodeChange) {
+                var self = this;
+                if (this._fixNodesTimer === null) {
+                    this._fixNodesTimer = window.setTimeout(function() {
+                        self._fixNodes.call(self);
+                        self._fixNodesTimer = null;
+                    }, 0);
+                }
+            }
+            this._lastNodeChange = thisNodeChange;
+            if (this.currentEvent) {
+                this._lastNodeChangeEvent = this.currentEvent.type;
+            }
+
+            var beforeNodeChange = this.fireEvent('beforeNodeChange', { type: 'beforeNodeChange', target: this });
+            if (beforeNodeChange === false) {
+                return false;
+            }
+            if (this.get('dompath')) {
+                this._writeDomPath();
+            }
+            //Check to see if we are disabled before continuing
+            if (!this.get('disabled')) {
+                if (this.STOP_NODE_CHANGE) {
+                    //Reset this var for next action
+                    this.STOP_NODE_CHANGE = false;
+                    return false;
+                } else {
+                    var sel = this._getSelection(),
+                        range = this._getRange(),
+                        el = this._getSelectedElement(),
+                        fn_button = this.toolbar.getButtonByValue('fontname'),
+                        fs_button = this.toolbar.getButtonByValue('fontsize');
+
+                    //Handle updating the toolbar with active buttons
+                    var _ex = {};
+                    if (this._lastButton) {
+                        _ex[this._lastButton.id] = true;
+                    }
+                    if (!this._isElement(el, 'body')) {
+                        if (fn_button) {
+                            _ex[fn_button.get('id')] = true;
+                        }
+                        if (fs_button) {
+                            _ex[fs_button.get('id')] = true;
+                        }
+                    }
+                    this.toolbar.resetAllButtons(_ex);
+
+                    //Handle disabled buttons
+                    for (var d = 0; d < this._disabled.length; d++) {
+                        var _button = this.toolbar.getButtonByValue(this._disabled[d]);
+                        if (_button && _button.get) {
+                            if (this._lastButton && (_button.get('id') === this._lastButton.id)) {
+                                //Skip
+                            } else {
+                                if (!this._hasSelection()) {
+                                    switch (this._disabled[d]) {
+                                        case 'fontname':
+                                        case 'fontsize':
+                                            break;
+                                        default:
+                                            //No Selection - disable
+                                            this.toolbar.disableButton(_button);
+                                    }
+                                } else {
+                                    if (!this._alwaysDisabled[this._disabled[d]]) {
+                                        this.toolbar.enableButton(_button);
+                                    }
+                                }
+                                if (!this._alwaysEnabled[this._disabled[d]]) {
+                                    this.toolbar.deselectButton(_button);
+                                }
+                            }
+                        }
+                    }
+                    var path = this._getDomPath();
+                    var olType = null, tag = null, cmd = null;
+                    for (var i = 0; i < path.length; i++) {
+                        tag = path[i].tagName.toLowerCase();
+                        if (path[i].getAttribute('tag')) {
+                            tag = path[i].getAttribute('tag').toLowerCase();
+                        }
+                        cmd = this._tag2cmd[tag];
+                        if (cmd === undefined) {
+                            cmd = [];
+                        }
+                        if (!Lang.isArray(cmd)) {
+                            cmd = [cmd];
+                        }
+
+                        //Bold and Italic styles
+                        if (path[i].style.fontWeight.toLowerCase() == 'bold') {
+                            cmd[cmd.length] = 'bold';
+                        }
+                        if (path[i].style.fontStyle.toLowerCase() == 'italic') {
+                            cmd[cmd.length] = 'italic';
+                        }
+                        if (path[i].style.textDecoration.toLowerCase() == 'underline') {
+                            cmd[cmd.length] = 'underline';
+                        }
+                        if (cmd.length > 0) {
+                            for (var j = 0; j < cmd.length; j++) {
+                                this.toolbar.selectButton(cmd[j]);
+                                this.toolbar.enableButton(cmd[j]);
+                            }
+                        }
+                        //Handle Alignment
+                        switch (path[i].style.textAlign.toLowerCase()) {
+                            case 'left':
+                            case 'right':
+                            case 'center':
+                            case 'justify':
+                                var alignType = path[i].style.textAlign.toLowerCase();
+                                if (path[i].style.textAlign.toLowerCase() == 'justify') {
+                                    alignType = 'full';
+                                }
+                                this.toolbar.selectButton('justify' + alignType);
+                                this.toolbar.enableButton('justify' + alignType);
+                                break;
+                        }
+                    }
+                    //After for loop
+
+                    //Reset Font Family and Size to the inital configs
+                    if (fn_button) {
+                        var family = fn_button._configs.label._initialConfig.value;
+                        fn_button.set('label', '<span class="yui-toolbar-fontname-' + _cleanClassName(family) + '">' + family + '</span>');
+                        this._updateMenuChecked('fontname', family);
+                    }
+
+                    if (fs_button) {
+                        fs_button.set('label', fs_button._configs.label._initialConfig.value);
+                    }
+
+                    var hd_button = this.toolbar.getButtonByValue('heading');
+                    if (hd_button) {
+                        hd_button.set('label', hd_button._configs.label._initialConfig.value);
+                        this._updateMenuChecked('heading', 'none');
+                    }
+                    var img_button = this.toolbar.getButtonByValue('insertimage');
+                    if (img_button && this.currentWindow && (this.currentWindow.name == 'insertimage')) {
+                        this.toolbar.disableButton(img_button);
+                    }
+                }
+            }
+
+            this.fireEvent('afterNodeChange', { type: 'afterNodeChange', target: this });
+        },
+        /**
+        * @private
+        * @method _updateMenuChecked
+        * @param {Object} button The command identifier of the button you want to check
+        * @param {String} value The value of the menu item you want to check
+        * @param {<a href="YAHOO.widget.Toolbar.html">YAHOO.widget.Toolbar</a>} The Toolbar instance the button belongs to (defaults to this.toolbar) 
+        * @description Gets the menu from a button instance, if the menu is not rendered it will render it. It will then search the menu for the specified value, unchecking all other items and checking the specified on.
+        */
+        _updateMenuChecked: function(button, value, tbar) {
+            if (!tbar) {
+                tbar = this.toolbar;
+            }
+            var _button = tbar.getButtonByValue(button);
+            var _menuItems = _button.getMenu().getItems();
+            if (_menuItems.length === 0) {
+                _button.getMenu()._onBeforeShow();
+                _menuItems = _button.getMenu().getItems();
+            }
+            for (var i = 0; i < _menuItems.length; i++) {
+                _menuItems[i].cfg.setProperty('checked', false);
+                if (_menuItems[i].value == value) {
+                    _menuItems[i].cfg.setProperty('checked', true);
+                }
+            }
+        },
+        /**
+        * @private
+        * @method _handleToolbarClick
+        * @param {Event} ev The event that triggered the button click
+        * @description This is an event handler attached to the Toolbar's buttonClick event. It will fire execCommand with the command identifier from the Toolbar Button.
+        */
+        _handleToolbarClick: function(ev) {
+            var value = '';
+            var str = '';
+            var cmd = ev.button.value;
+            if (ev.button.menucmd) {
+                value = cmd;
+                cmd = ev.button.menucmd;
+            }
+            this._lastButton = ev.button;
+            if (this.STOP_EXEC_COMMAND) {
+                this.STOP_EXEC_COMMAND = false;
+                return false;
+            } else {
+                this.execCommand(cmd, value);
+                if (!this.browser.webkit) {
+                     var self = this;
+                     setTimeout(function() {
+                         self._focusWindow.call(self);
+                     }, 5);
+                 }
+            }
+            Event.stopEvent(ev);
+        },
+        /**
+        * @private
+        * @method _setupAfterElement
+        * @description Creates the accessibility h2 header and places it after the iframe in the Dom for navigation.
+        */
+        _setupAfterElement: function() {
+            if (!this.afterElement) {
+                this.afterElement = document.createElement('h2');
+                this.afterElement.className = 'yui-editor-skipheader';
+                this.afterElement.tabIndex = '-1';
+                this.afterElement.innerHTML = this.STR_LEAVE_EDITOR;
+                this.get('element_cont').get('firstChild').appendChild(this.afterElement);
+            }
+        },
+        /**
+        * @property EDITOR_PANEL_ID
+        * @description HTML id to give the properties window in the DOM.
+        * @type String
+        */
+        EDITOR_PANEL_ID: 'yui-editor-panel',
+        /**
+        * @property SEP_DOMPATH
+        * @description The value to place in between the Dom path items
+        * @type String
+        */
+        SEP_DOMPATH: '<',
+        /**
+        * @property STR_LEAVE_EDITOR
+        * @description The accessibility string for the element after the iFrame
+        * @type String
+        */
+        STR_LEAVE_EDITOR: 'You have left the Rich Text Editor.',
+        /**
+        * @property STR_BEFORE_EDITOR
+        * @description The accessibility string for the element before the iFrame
+        * @type String
+        */
+        STR_BEFORE_EDITOR: 'This text field can contain stylized text and graphics. To cycle through all formatting options, use the keyboard shortcut Control + Shift + T to place focus on the toolbar and navigate between option heading names. <h4>Common formatting keyboard shortcuts:</h4><ul><li>Control Shift B sets text to bold</li> <li>Control Shift I sets text to italic</li> <li>Control Shift U underlines text</li> <li>Control Shift [ aligns text left</li> <li>Control Shift | centers text</li> <li>Control Shift ] aligns text right</li> <li>Control Shift L adds an HTML link</li> <li>To exit this text editor use the keyboard shortcut Control + Shift + ESC.</li></ul>',
+        /**
+        * @property STR_CLOSE_WINDOW
+        * @description The Title of the close button in the Editor Window
+        * @type String
+        */
+        STR_CLOSE_WINDOW: 'Close Window',
+        /**
+        * @property STR_CLOSE_WINDOW_NOTE
+        * @description A note appearing in the Editor Window to tell the user that the Escape key will close the window
+        * @type String
+        */
+        STR_CLOSE_WINDOW_NOTE: 'To close this window use the Control + Shift + W key',
+        /**
+        * @property STR_TITLE
+        * @description The Title of the HTML document that is created in the iFrame
+        * @type String
+        */
+        STR_TITLE: 'Rich Text Area.',
+        /**
+        * @property STR_IMAGE_HERE
+        * @description The text to place in the URL textbox when using the blankimage.
+        * @type String
+        */
+        STR_IMAGE_HERE: 'Image Url Here',
+        /**
+        * @property STR_IMAGE_PROP_TITLE
+        * @description The title for the Image Property Editor Window
+        * @type String
+        */
+        STR_IMAGE_PROP_TITLE: 'Image Options',
+        /**
+        * @property STR_IMAGE_URL
+        * @description The label string for Image URL
+        * @type String
+        */
+        STR_IMAGE_URL: 'Image Url',
+        /**
+        * @property STR_IMAGE_TITLE
+        * @description The label string for Image Description
+        * @type String
+        */
+        STR_IMAGE_TITLE: 'Description',
+        /**
+        * @property STR_IMAGE_SIZE
+        * @description The label string for Image Size
+        * @type String
+        */
+        STR_IMAGE_SIZE: 'Size',
+        /**
+        * @property STR_IMAGE_ORIG_SIZE
+        * @description The label string for Original Image Size
+        * @type String
+        */
+        STR_IMAGE_ORIG_SIZE: 'Original Size',
+        /**
+        * @property STR_IMAGE_COPY
+        * @description The label string for the image copy and paste message for Opera and Safari
+        * @type String
+        */
+        STR_IMAGE_COPY: '<span class="tip"><span class="icon icon-info"></span><strong>Note:</strong>To move this image just highlight it, cut, and paste where ever you\'d like.</span>',
+        /**
+        * @property STR_IMAGE_PADDING
+        * @description The label string for the image padding.
+        * @type String
+        */
+        STR_IMAGE_PADDING: 'Padding',
+        /**
+        * @property STR_IMAGE_BORDER
+        * @description The label string for the image border.
+        * @type String
+        */
+        STR_IMAGE_BORDER: 'Border',
+        /**
+        * @property STR_IMAGE_TEXTFLOW
+        * @description The label string for the image text flow.
+        * @type String
+        */
+        STR_IMAGE_TEXTFLOW: 'Text Flow',
+        /**
+        * @property STR_LOCAL_FILE_WARNING
+        * @description The label string for the local file warning.
+        * @type String
+        */
+        STR_LOCAL_FILE_WARNING: '<span class="tip"><span class="icon icon-warn"></span><strong>Note:</strong>This image/link points to a file on your computer and will not be accessible to others on the internet.</span>',
+        /**
+        * @property STR_LINK_PROP_TITLE
+        * @description The label string for the Link Property Editor Window.
+        * @type String
+        */
+        STR_LINK_PROP_TITLE: 'Link Options',
+        /**
+        * @property STR_LINK_PROP_REMOVE
+        * @description The label string for the Remove link from text link inside the property editor.
+        * @type String
+        */
+        STR_LINK_PROP_REMOVE: 'Remove link from text',
+        /**
+        * @property STR_LINK_URL
+        * @description The label string for the Link URL.
+        * @type String
+        */
+        STR_LINK_URL: 'Link URL',
+        /**
+        * @property STR_LINK_NEW_WINDOW
+        * @description The string for the open in a new window label.
+        * @type String
+        */
+        STR_LINK_NEW_WINDOW: 'Open in a new window.',
+        /**
+        * @property STR_LINK_TITLE
+        * @description The string for the link description.
+        * @type String
+        */
+        STR_LINK_TITLE: 'Description',
+        /**
+        * @protected
+        * @property STOP_EXEC_COMMAND
+        * @description Set to true when you want the default execCommand function to not process anything
+        * @type Boolean
+        */
+        STOP_EXEC_COMMAND: false,
+        /**
+        * @protected
+        * @property STOP_NODE_CHANGE
+        * @description Set to true when you want the default nodeChange function to not process anything
+        * @type Boolean
+        */
+        STOP_NODE_CHANGE: false,
+        /**
+        * @protected
+        * @property CLASS_HIDDEN
+        * @description CSS class applied to the body when the hiddenelements button is pressed.
+        * @type String
+        */
+        CLASS_HIDDEN: 'hidden',
+        /**
+        * @protected
+        * @property CLASS_LOCAL_FILE
+        * @description CSS class applied to an element when it's found to have a local url.
+        * @type String
+        */
+        CLASS_LOCAL_FILE: 'warning-localfile',
+        /**
+        * @protected
+        * @property CLASS_CONTAINER
+        * @description Default CSS class to apply to the editors container element
+        * @type String
+        */
+        CLASS_CONTAINER: 'yui-editor-container',
+        /**
+        * @protected
+        * @property CLASS_EDITABLE
+        * @description Default CSS class to apply to the editors iframe element
+        * @type String
+        */
+        CLASS_EDITABLE: 'yui-editor-editable',
+        /**
+        * @protected
+        * @property CLASS_EDITABLE_CONT
+        * @description Default CSS class to apply to the editors iframe's parent element
+        * @type String
+        */
+        CLASS_EDITABLE_CONT: 'yui-editor-editable-container',
+        /**
+        * @protected
+        * @property CLASS_PREFIX
+        * @description Default prefix for dynamically created class names
+        * @type String
+        */
+        CLASS_PREFIX: 'yui-editor',
+        /** 
+        * @property browser
+        * @description Standard browser detection
+        * @type Object
+        */
+        browser: function() {
+            var br = YAHOO.env.ua;
+            //Check for webkit3
+            if (br.webkit > 420) {
+                br.webkit3 = br.webkit;
+            } else {
+                br.webkit3 = 0;
+            }
+            return br;
+        }(),
+        /** 
+        * @method init
+        * @description The Editor class' initialization method
+        */
+        init: function(p_oElement, p_oAttributes) {
+            YAHOO.widget.Editor.superclass.init.call(this, p_oElement, p_oAttributes);
+            YAHOO.widget.EditorInfo._instances[this.get('id')] = this;
+
+            this.on('contentReady', function() {
+                this.DOMReady = true;
+                this.fireQueue();
+            }, this, true);
+        },
+        /**
+        * @method initAttributes
+        * @description Initializes all of the configuration attributes used to create 
+        * the editor.
+        * @param {Object} attr Object literal specifying a set of 
+        * configuration attributes used to create the editor.
+        */
+        initAttributes: function(attr) {
+            YAHOO.widget.Editor.superclass.initAttributes.call(this, attr);
+            var self = this;
+
+            /**
+            * @private
+            * @attribute iframe
+            * @description Internal config for holding the iframe element.
+            * @default null
+            * @type HTMLElement
+            */
+            this.setAttributeConfig('iframe', {
+                value: null
+            });
+            /**
+            * @private
+            * @depreciated
+            * @attribute textarea
+            * @description Internal config for holding the textarea element (replaced with element).
+            * @default null
+            * @type HTMLElement
+            */
+            this.setAttributeConfig('textarea', {
+                value: null,
+                writeOnce: true
+            });
+            /**
+            * @attribute nodeChangeThreshold
+            * @description The number of seconds that need to be in between nodeChange processing
+            * @default 3
+            * @type Number
+            */            
+            this.setAttributeConfig('nodeChangeThreshold', {
+                value: attr.nodeChangeThreshold || 3,
+                validator: YAHOO.lang.isNumber
+            });
+            /**
+            * @attribute element_cont
+            * @description Internal config for the editors container
+            * @default false
+            * @type HTMLElement
+            */
+            this.setAttributeConfig('element_cont', {
+                value: attr.element_cont
+            });
+            /**
+            * @private
+            * @attribute editor_wrapper
+            * @description The outter wrapper for the entire editor.
+            * @default null
+            * @type HTMLElement
+            */
+            this.setAttributeConfig('editor_wrapper', {
+                value: attr.editor_wrapper || null,
+                writeOnce: true
+            });
+            /**
+            * @attribute height
+            * @description The height of the editor iframe container, not including the toolbar..
+            * @default Best guessed size of the textarea, for best results use CSS to style the height of the textarea or pass it in as an argument
+            * @type String
+            */
+            this.setAttributeConfig('height', {
+                value: attr.height || Dom.getStyle(self.get('element'), 'height'),
+                method: function(height) {
+                    if (this._rendered) {
+                        //We have been rendered, change the height
+                        if (this.get('animate')) {
+                            var anim = new YAHOO.util.Anim(this.get('iframe').get('parentNode'), {
+                                height: {
+                                    to: parseInt(height, 10)
+                                }
+                            }, 0.5);
+                            anim.animate();
+                        } else {
+                            Dom.setStyle(this.get('iframe').get('parentNode'), 'height', height);
+                        }
+                    }
+                }
+            });
+            /**
+            * @attribute width
+            * @description The width of the editor container.
+            * @default Best guessed size of the textarea, for best results use CSS to style the width of the textarea or pass it in as an argument
+            * @type String
+            */            
+            this.setAttributeConfig('width', {
+                value: attr.width || Dom.getStyle(this.get('element'), 'width'),
+                method: function(width) {
+                    if (this._rendered) {
+                        //We have been rendered, change the width
+                        if (this.get('animate')) {
+                            var anim = new YAHOO.util.Anim(this.get('element_cont').get('element'), {
+                                width: {
+                                    to: parseInt(width, 10)
+                                }
+                            }, 0.5);
+                            anim.animate();
+                        } else {
+                            this.get('element_cont').setStyle('width', width);
+                        }
+                    }
+                }
+            });
+                        
+            /**
+            * @attribute blankimage
+            * @description The CSS used to show/hide hidden elements on the page
+            * @default 'assets/blankimage.png'
+            * @type String
+            */            
+            this.setAttributeConfig('blankimage', {
+                value: attr.blankimage || this._getBlankImage()
+            });
+            /**
+            * @attribute hiddencss
+            * @description The CSS used to show/hide hidden elements on the page, these rules must be prefixed with the class provided in <code>this.CLASS_HIDDEN</code>
+            * @default <code><pre>
+            .hidden font, .hidden strong, .hidden b, .hidden em, .hidden i, .hidden u, .hidden div, .hidden p, .hidden span, .hidden img, .hidden ul, .hidden ol, .hidden li, .hidden table {
+                border: 1px dotted #ccc;
+            }
+            .hidden .yui-non {
+                border: none;
+            }
+            .hidden img {
+                padding: 2px;
+            }</pre></code>
+            * @type String
+            */            
+            this.setAttributeConfig('hiddencss', {
+                value: attr.hiddencss || '.hidden font, .hidden strong, .hidden b, .hidden em, .hidden i, .hidden u, .hidden div,.hidden p,.hidden span,.hidden img, .hidden ul, .hidden ol, .hidden li, .hidden table { border: 1px dotted #ccc; } .hidden .yui-non { border: none; } .hidden img { padding: 2px; }',
+                writeOnce: true
+            });
+            /**
+            * @attribute css
+            * @description The Base CSS used to format the content of the editor
+            * @default <code><pre>html {
+                height: 95%;
+            }
+            body {
+                height: 100%;
+                padding: 7px; background-color: #fff; font:13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;
+            }
+            a {
+                color: blue;
+                text-decoration: underline;
+                cursor: pointer;
+            }
+            .warning-localfile {
+                border-bottom: 1px dashed red !important;
+            }
+            .yui-busy {
+                cursor: wait !important;
+            }
+            img.selected { //Safari image selection
+                border: 2px dotted #808080;
+            }
+            img {
+                cursor: pointer !important;
+                border: none;
+            }
+            </pre></code>
+            * @type String
+            */            
+            this.setAttributeConfig('css', {
+                value: attr.css || 'html { height: 95%; } body { height: 100%; padding: 7px; background-color: #fff; font:13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a { color: blue; text-decoration: underline; cursor: pointer; } .warning-localfile { border-bottom: 1px dashed red !important; } .yui-busy { cursor: wait !important; } img.selected { border: 2px dotted #808080; } img { cursor: pointer !important; border: none; }',
+                writeOnce: true
+            });
+            /**
+            * @attribute html
+            * @description The default HTML to be written to the iframe document before the contents are loaded
+            * @default This HTML requires a few things if you are to override:
+                <p><code>{TITLE}, {CSS}, {HIDDEN_CSS}</code> and <code>{CONTENT}</code> need to be there, they are passed to YAHOO.lang.substitute to be replace with other strings.<p>
+                <p><code>onload="document.body._rteLoaded = true;"</code> : the onload statement must be there or the editor will not finish loading.</p>
+                <code>
+                <pre>
+                &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
+                &lt;html&gt;
+                    &lt;head&gt;
+                        &lt;title&gt;{TITLE}&lt;/title&gt;
+                        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
+                        &lt;style&gt;
+                        {CSS}
+                        &lt;/style&gt;
+                        &lt;style&gt;
+                        {HIDDEN_CSS}
+                        &lt;/style&gt;
+                    &lt;/head&gt;
+                &lt;body onload="document.body._rteLoaded = true;"&gt;
+                {CONTENT}
+                &lt;/body&gt;
+                &lt;/html&gt;
+                </pre>
+                </code>
+            * @type String
+            */            
+            this.setAttributeConfig('html', {
+                value: attr.html || '<!DOCTYPE HTML PUBLIC "-/'+'/W3C/'+'/DTD HTML 4.01/'+'/EN" "http:/'+'/www.w3.org/TR/html4/strict.dtd"><html><head><title>{TITLE}</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><base href="' + this._baseHREF + '"><style>{CSS}</style><style>{HIDDEN_CSS}</style></head><body onload="document.body._rteLoaded = true;">{CONTENT}</body></html>',
+                writeOnce: true
+            });
+
+            /**
+            * @attribute handleSubmit
+            * @description Config handles if the editor will attach itself to the textareas parent form's submit handler.
+            If it is set to true, the editor will attempt to attach a submit listener to the textareas parent form.
+            Then it will trigger the editors save handler and place the new content back into the text area before the form is submitted.
+            * @default false
+            * @type Boolean
+            */            
+            this.setAttributeConfig('handleSubmit', {
+                value: false,
+                writeOnce: true,
+                method: function(exec) {
+                    if (exec) {
+                        var ta = this.get('element');
+                        if (ta.form) {
+                            var submitForm = function(ev) {
+                                Event.stopEvent(ev);
+                                this.saveHTML();
+                                window.setTimeout(function() {
+                                    YAHOO.util.Event.removeListener(ta.form, 'submit', submitForm);
+                                    ta.form.submit();
+                                }, 200);
+                            };
+                            Event.on(ta.form, 'submit', submitForm, this, true);
+                        }
+                    }
+                }
+            });
+            /**
+            * @attribute disabled
+            * @description This will toggle the editor's disabled state. When the editor is disabled, designMode is turned off and a mask is placed over the iframe so no interaction can take place.
+            All Toolbar buttons are also disabled so they cannot be used.
+            * @default false
+            * @type Boolean
+            */
+
+            this.setAttributeConfig('disabled', {
+                value: false,
+                method: function(disabled) {
+                    if (disabled) {
+                        if (!this._mask) {
+                            this._setDesignMode('off');
+                            this.toolbar.set('disabled', true);
+                            this._mask = document.createElement('DIV');
+                            Dom.setStyle(this._mask, 'height', '100%');
+                            Dom.setStyle(this._mask, 'width', '100%');
+                            Dom.setStyle(this._mask, 'position', 'absolute');
+                            Dom.setStyle(this._mask, 'top', '0');
+                            Dom.setStyle(this._mask, 'left', '0');
+                            Dom.setStyle(this._mask, 'opacity', '.5');
+                            Dom.addClass(this._mask, 'yui-editor-masked');
+                            this.get('iframe').get('parentNode').appendChild(this._mask);
+                        }
+                    } else {
+                        if (this._mask) {
+                            this._mask.parentNode.removeChild(this._mask);
+                            this._mask = null;
+                            this.toolbar.set('disabled', false);
+                            this._setDesignMode('on');
+                            this._focusWindow();
+                        }
+                    }
+                }
+            });
+            /**
+            * @attribute toolbar_cont
+            * @description Internal config for the toolbars container
+            * @default false
+            * @type Boolean
+            */
+            this.setAttributeConfig('toolbar_cont', {
+                value: null,
+                writeOnce: true
+            });
+            /**
+            * @attribute toolbar
+            * @description The default toolbar config.
+            * @default This config is too large to display here, view the code to see it: <a href="editor.js.html"></a>
+            * @type Object
+            */            
+            this.setAttributeConfig('toolbar', {
+                value: attr.toolbar || {
+                    /* {{{ Defaut Toolbar Config */
+                    collapse: true,
+                    titlebar: 'Text Editing Tools',
+                    draggable: false,
+                    buttons: [
+                        { group: 'fontstyle', label: 'Font Name and Size',
+                            buttons: [
+                                { type: 'select', label: 'Arial', value: 'fontname', disabled: true,
+                                    menu: [
+                                        { text: 'Arial', checked: true },
+                                        { text: 'Arial Black' },
+                                        { text: 'Comic Sans MS' },
+                                        { text: 'Courier New' },
+                                        { text: 'Lucida Console' },
+                                        { text: 'Tahoma' },
+                                        { text: 'Times New Roman' },
+                                        { text: 'Trebuchet MS' },
+                                        { text: 'Verdana' }
+                                    ]
+                                },
+                                { type: 'spin', label: '13', value: 'fontsize', range: [ 9, 75 ], disabled: true }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'textstyle', label: 'Font Style',
+                            buttons: [
+                                { type: 'push', label: 'Bold CTRL + SHIFT + B', value: 'bold' },
+                                { type: 'push', label: 'Italic CTRL + SHIFT + I', value: 'italic' },
+                                { type: 'push', label: 'Underline CTRL + SHIFT + U', value: 'underline' },
+                                { type: 'separator' },
+                                { type: 'push', label: 'Subscript', value: 'subscript', disabled: true },
+                                { type: 'push', label: 'Superscript', value: 'superscript', disabled: true },
+                                { type: 'separator' },
+                                { type: 'color', label: 'Font Color', value: 'forecolor', disabled: true },
+                                { type: 'color', label: 'Background Color', value: 'backcolor', disabled: true },
+                                { type: 'separator' },
+                                { type: 'push', label: 'Remove Formatting', value: 'removeformat', disabled: true },
+                                { type: 'push', label: 'Show/Hide Hidden Elements', value: 'hiddenelements' }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'alignment', label: 'Alignment',
+                            buttons: [
+                                { type: 'push', label: 'Align Left CTRL + SHIFT + [', value: 'justifyleft' },
+                                { type: 'push', label: 'Align Center CTRL + SHIFT + |', value: 'justifycenter' },
+                                { type: 'push', label: 'Align Right CTRL + SHIFT + ]', value: 'justifyright' },
+                                { type: 'push', label: 'Justify', value: 'justifyfull' }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'parastyle', label: 'Paragraph Style',
+                            buttons: [
+                            { type: 'select', label: 'Normal', value: 'heading', disabled: true,
+                                menu: [
+                                    { text: 'Normal', value: 'none', checked: true },
+                                    { text: 'Header 1', value: 'h1' },
+                                    { text: 'Header 2', value: 'h2' },
+                                    { text: 'Header 3', value: 'h3' },
+                                    { text: 'Header 4', value: 'h4' },
+                                    { text: 'Header 5', value: 'h5' },
+                                    { text: 'Header 6', value: 'h6' }
+                                ]
+                            }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'indentlist', label: 'Indenting and Lists',
+                            buttons: [
+                                { type: 'push', label: 'Indent', value: 'indent', disabled: true },
+                                { type: 'push', label: 'Outdent', value: 'outdent', disabled: true },
+                                { type: 'push', label: 'Create an Unordered List', value: 'insertunorderedlist' },
+                                { type: 'push', label: 'Create an Ordered List', value: 'insertorderedlist' }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'insertitem', label: 'Insert Item',
+                            buttons: [
+                                { type: 'push', label: 'HTML Link CTRL + SHIFT + L', value: 'createlink', disabled: true },
+                                { type: 'push', label: 'Insert Image', value: 'insertimage' }
+                            ]
+                        }
+                    ]
+                    /* }}} */
+                },
+                writeOnce: true,
+                method: function(toolbar) {
+                }
+            });
+            /**
+            * @attribute animate
+            * @description Should the editor animate window movements
+            * @default false unless Animation is found, then true
+            * @type Boolean
+            */            
+            this.setAttributeConfig('animate', {
+                value: false,
+                validator: function(value) {
+                    var ret = true;
+                    if (!YAHOO.util.Anim) {
+                        ret = false;
+                    }
+                    return ret;
+                }               
+            });
+            /**
+            * @attribute panel
+            * @description A reference to the panel we are using for windows.
+            * @default false
+            * @type Boolean
+            */            
+            this.setAttributeConfig('panel', {
+                value: null,
+                writeOnce: true,
+                validator: function(value) {
+                    var ret = true;
+                    if (!YAHOO.widget.Overlay) {
+                        ret = false;
+                    }
+                    return ret;
+                }               
+            });
+            /**
+            * @attribute localFileWarning
+            * @description Should we throw the warning if we detect a file that is local to their machine?
+            * @default true
+            * @type Boolean
+            */            
+            this.setAttributeConfig('localFileWarning', {
+                value: attr.locaFileWarning || true
+            });
+            /**
+            * @attribute focusAtStart
+            * @description Should we focus the window when the content is ready?
+            * @default false
+            * @type Boolean
+            */            
+            this.setAttributeConfig('focusAtStart', {
+                value: attr.focusAtStart || false,
+                writeOnce: true,
+                method: function() {
+                    this.on('editorContentLoaded', function() {
+                        var self = this;
+                        setTimeout(function() {
+                            self._focusWindow.call(self, true);
+                        }, 400);
+                    }, this, true);
+                }
+            });
+            /**
+            * @attribute dompath
+            * @description Toggle the display of the current Dom path below the editor
+            * @default false
+            * @type Boolean
+            */            
+            this.setAttributeConfig('dompath', {
+                value: attr.dompath || false,
+                method: function(dompath) {
+                    if (dompath && !this.dompath) {
+                        this.dompath = document.createElement('DIV');
+                        this.dompath.id = this.get('id') + '_dompath';
+                        Dom.addClass(this.dompath, 'dompath');
+                        this.get('element_cont').get('firstChild').appendChild(this.dompath);
+                        if (this.get('iframe')) {
+                            this._writeDomPath();
+                        }
+                    } else if (!dompath && this.dompath) {
+                        this.dompath.parentNode.removeChild(this.dompath);
+                        this.dompath = null;
+                    }
+                    this._setupAfterElement();
+                }
+            });
+            /**
+            * @attribute markup
+            * @description Should we try to adjust the markup for the following types: semantic, css, default or xhtml
+            * @default "semantic"
+            * @type String
+            */            
+            this.setAttributeConfig('markup', {
+                value: attr.markup || 'semantic',
+                validator: function(markup) {
+                    switch (markup.toLowerCase()) {
+                        case 'semantic':
+                        case 'css':
+                        case 'default':
+                        case 'xhtml':
+                        return true;
+                    }
+                    return false;
+                }
+            });
+            /**
+            * @attribute removeLineBreaks
+            * @description Should we remove linebreaks and extra spaces on cleanup
+            * @default false
+            * @type Boolean
+            */            
+            this.setAttributeConfig('removeLineBreaks', {
+                value: attr.removeLineBreaks || false,
+                validator: YAHOO.lang.isBoolean
+            });
+            
+
+            this.on('afterRender', function() {
+                this._renderPanel();
+            });
+        },
+        /**
+        * @private
+        * @method _getBlankImage
+        * @description Retrieves the full url of the image to use as the blank image.
+        * @returns {String} The URL to the blank image
+        */
+        _getBlankImage: function() {
+            if (!this.DOMReady) {
+                this._queue[this._queue.length] = ['_getBlankImage', arguments];
+                return '';
+            }
+            var img = '';
+            if (!this._blankImageLoaded) {
+                var div = document.createElement('div');
+                div.style.position = 'absolute';
+                div.style.top = '-9999px';
+                div.style.left = '-9999px';
+                div.className = this.CLASS_PREFIX + '-blankimage';
+                document.body.appendChild(div);
+                img = YAHOO.util.Dom.getStyle(div, 'background-image');
+                img = img.replace('url(', '').replace(')', '').replace(/"/g, '');
+                this.set('blankimage', img);
+                this._blankImageLoaded = true;
+            } else {
+                img = this.get('blankimage');
+            }
+            return img;
+        },
+        /**
+        * @private
+        * @method _handleFontSize
+        * @description Handles the font size button in the toolbar.
+        * @param {Object} o Object returned from Toolbar's buttonClick Event
+        */
+        _handleFontSize: function(o) {
+            var button = this.toolbar.getButtonById(o.button.id);
+            var value = button.get('label') + 'px';
+            this.execCommand('fontsize', value);
+            this.STOP_EXEC_COMMAND = true;
+        },
+        /**
+        * @private
+        * @method _handleColorPicker
+        * @description Handles the colorpicker buttons in the toolbar.
+        * @param {Object} o Object returned from Toolbar's buttonClick Event
+        */
+        _handleColorPicker: function(o) {
+            var cmd = o.button;
+            var value = '#' + o.color;
+            if ((cmd == 'forecolor') || (cmd == 'backcolor')) {
+                this.execCommand(cmd, value);
+            }
+        },
+        /**
+        * @private
+        * @method _handleAlign
+        * @description Handles the alignment buttons in the toolbar.
+        * @param {Object} o Object returned from Toolbar's buttonClick Event
+        */
+        _handleAlign: function(o) {
+            var button = this.toolbar.getButtonById(o.button.id);
+            var cmd = null;
+            for (var i = 0; i < o.button.menu.length; i++) {
+                if (o.button.menu[i].value == o.button.value) {
+                    cmd = o.button.menu[i].value;
+                }
+            }
+            var value = this._getSelection();
+
+            this.execCommand(cmd, value);
+            this.STOP_EXEC_COMMAND = true;
+        },
+        /**
+        * @private
+        * @method _handleAfterNodeChange
+        * @description Fires after a nodeChange happens to setup the things that where reset on the node change (button state).
+        */
+        _handleAfterNodeChange: function() {
+            var path = this._getDomPath(),
+                elm = null,
+                family = null,
+                fontsize = null,
+                validFont = false;
+            var fn_button = this.toolbar.getButtonByValue('fontname');
+            var fs_button = this.toolbar.getButtonByValue('fontsize');
+            var hd_button = this.toolbar.getButtonByValue('heading');
+
+            for (var i = 0; i < path.length; i++) {
+                elm = path[i];
+
+                var tag = elm.tagName.toLowerCase();
+
+
+                if (elm.getAttribute('tag')) {
+                    tag = elm.getAttribute('tag');
+                }
+
+                family = elm.getAttribute('face');
+                if (Dom.getStyle(elm, 'font-family')) {
+                    family = Dom.getStyle(elm, 'font-family');
+                }
+
+                if (tag.substring(0, 1) == 'h') {
+                    if (hd_button) {
+                        for (var h = 0; h < hd_button._configs.menu.value.length; h++) {
+                            if (hd_button._configs.menu.value[h].value.toLowerCase() == tag) {
+                                hd_button.set('label', hd_button._configs.menu.value[h].text);
+                            }
+                        }
+                        this._updateMenuChecked('heading', tag);
+                    }
+                }
+            }
+
+            if (fn_button) {
+                for (var b = 0; b < fn_button._configs.menu.value.length; b++) {
+                    if (family && fn_button._configs.menu.value[b].text.toLowerCase() == family.toLowerCase()) {
+                        validFont = true;
+                        family = fn_button._configs.menu.value[b].text; //Put the proper menu name in the button
+                    }
+                }
+                if (!validFont) {
+                    family = fn_button._configs.label._initialConfig.value;
+                }
+                var familyLabel = '<span class="yui-toolbar-fontname-' + _cleanClassName(family) + '">' + family + '</span>';
+                if (fn_button.get('label') != familyLabel) {
+                    fn_button.set('label', familyLabel);
+                    this._updateMenuChecked('fontname', family);
+                }
+            }
+
+            if (fs_button) {
+                fontsize = parseInt(Dom.getStyle(elm, 'fontSize'), 10);
+                if ((fontsize === null) || isNaN(fontsize)) {
+                    fontsize = fs_button._configs.label._initialConfig.value;
+                }
+                fs_button.set('label', ''+fontsize);
+            }
+            
+            if (!this._isElement(elm, 'body') && !this._isElement(elm, 'img')) {
+                this.toolbar.enableButton(fn_button);
+                this.toolbar.enableButton(fs_button);
+                this.toolbar.enableButton('forecolor');
+                this.toolbar.enableButton('backcolor');
+            }
+            if (this._isElement(elm, 'img')) {
+                this.toolbar.enableButton('createlink');
+            }
+            if (this._isElement(elm, 'blockquote')) {
+                this.toolbar.selectButton('indent');
+                this.toolbar.disableButton('indent');
+                this.toolbar.enableButton('outdent');
+            }
+            this._lastButton = null;
+            
+        },
+        _setBusy: function(off) {
+            /*
+            if (off) {
+                Dom.removeClass(document.body, 'yui-busy');
+                Dom.removeClass(this._getDoc().body, 'yui-busy');
+            } else {
+                Dom.addClass(document.body, 'yui-busy');
+                Dom.addClass(this._getDoc().body, 'yui-busy');
+            }
+            */
+        },
+        /**
+        * @private
+        * @method _handleInsertImageClick
+        * @description Opens the Image Properties Window when the insert Image button is clicked or an Image is Double Clicked.
+        */
+        _handleInsertImageClick: function() {
+            this._setBusy();
+            this.on('afterExecCommand', function() {
+                var el = this.currentElement[0],
+                    body = null,
+                    link = '',
+                    target = '',
+                    title = '',
+                    src = '',
+                    align = '',
+                    height = 75,
+                    width = 75,
+                    padding = 0,
+                    oheight = 0,
+                    owidth = 0,
+                    blankimage = false,
+                    win = new YAHOO.widget.EditorWindow('insertimage', {
+                        width: '415px'
+                    });
+
+                if (!el) {
+                    el = this._getSelectedElement();
+                }
+                if (el) {
+                    if (el.getAttribute('src')) {
+                        src = el.getAttribute('src', 2);
+                        if (src.indexOf(this.get('blankimage')) != -1) {
+                            src = this.STR_IMAGE_HERE;
+                            blankimage = true;
+                        }
+                    }
+                    if (el.getAttribute('alt', 2)) {
+                        title = el.getAttribute('alt', 2);
+                    }
+                    if (el.getAttribute('title', 2)) {
+                        title = el.getAttribute('title', 2);
+                    }
+
+                    if (el.parentNode && this._isElement(el.parentNode, 'a')) {
+                        link = el.parentNode.getAttribute('href');
+                        if (el.parentNode.getAttribute('target') !== null) {
+                            target = el.parentNode.getAttribute('target');
+                        }
+                    }
+                    height = parseInt(el.height, 10);
+                    width = parseInt(el.width, 10);
+                    if (el.style.height) {
+                        height = parseInt(el.style.height, 10);
+                    }
+                    if (el.style.width) {
+                        width = parseInt(el.style.width, 10);
+                    }
+                    if (el.style.margin) {
+                        padding = parseInt(el.style.margin, 10);
+                    }
+                    if (!el._height) {
+                        el._height = height;
+                    }
+                    if (!el._width) {
+                        el._width = width;
+                    }
+                    oheight = el._height;
+                    owidth = el._width;
+                }
+                var str = '<label for="insertimage_url"><strong>' + this.STR_IMAGE_URL + ':</strong> <input type="text" id="insertimage_url" value="' + src + '" size="40"></label>';
+                body = document.createElement('div');
+                body.innerHTML = str;
+
+                var tbarCont = document.createElement('div');
+                tbarCont.id = 'img_toolbar';
+                body.appendChild(tbarCont);
+
+                var str2 = '<label for="insertimage_title"><strong>' + this.STR_IMAGE_TITLE + ':</strong> <input type="text" id="insertimage_title" value="' + title + '" size="40"></label>';
+                str2 += '<label for="insertimage_link"><strong>' + this.STR_LINK_URL + ':</strong> <input type="text" name="insertimage_link" id="insertimage_link" value="' + link + '"></label>';
+                str2 += '<label for="insertimage_target"><strong>&nbsp;</strong><input type="checkbox" name="insertimage_target_" id="insertimage_target" value="_blank"' + ((target) ? ' checked' : '') + '> ' + this.STR_LINK_NEW_WINDOW + '</label>';
+                var div = document.createElement('div');
+                div.innerHTML = str2;
+                body.appendChild(div);
+                win.cache = body;
+
+                var tbar = new YAHOO.widget.Toolbar(tbarCont, {
+                    /* {{{ */ 
+                    buttons: [
+                        { group: 'textflow', label: this.STR_IMAGE_TEXTFLOW + ':',
+                            buttons: [
+                                { type: 'push', label: 'Left', value: 'left' },
+                                { type: 'push', label: 'Inline', value: 'inline' },
+                                { type: 'push', label: 'Block', value: 'block' },
+                                { type: 'push', label: 'Right', value: 'right' }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'padding', label: this.STR_IMAGE_PADDING + ':',
+                            buttons: [
+                                { type: 'spin', label: ''+padding, value: 'padding', range: [0, 50] }
+                            ]
+                        },
+                        { type: 'separator' },
+                        { group: 'border', label: this.STR_IMAGE_BORDER + ':',
+                            buttons: [
+                                { type: 'select', label: 'Border Size', value: 'bordersize',
+                                    menu: [
+                                        { text: 'none', value: '0', checked: true },
+                                        { text: ' ', value: '1' },
+                                        { text: ' ', value: '2' },
+                                        { text: ' ', value: '3' },
+                                        { text: ' ', value: '4' },
+                                        { text: ' ', value: '5' }
+                                    ]
+                                },
+                                { type: 'select', label: 'Border Type', value: 'bordertype', disabled: true,
+                                    menu: [
+                                        { text: ' ', value: 'solid', checked: true },
+                                        { text: ' ', value: 'dashed' },
+                                        { text: ' ', value: 'dotted' }
+                                    ]
+                                },
+                                { type: 'color', label: 'Border Color', value: 'bordercolor', disabled: true }
+                            ]
+                        }
+                    ]
+                    /* }}} */
+                });
+                
+                var bsize = '0';
+                var btype = 'solid';
+                if (el.style.borderLeftWidth) {
+                    bsize = parseInt(el.style.borderLeftWidth, 10);
+                }
+                if (el.style.borderLeftStyle) {
+                    btype = el.style.borderLeftStyle;
+                }
+                var bs_button = tbar.getButtonByValue('bordersize');
+                var bSizeStr = ((parseInt(bsize, 10) > 0) ? '' : 'none');
+                bs_button.set('label', '<span class="yui-toolbar-bordersize-' + bsize + '">'+bSizeStr+'</span>');
+                this._updateMenuChecked('bordersize', bsize, tbar);
+
+                var bt_button = tbar.getButtonByValue('bordertype');
+                bt_button.set('label', '<span class="yui-toolbar-bordertype-' + btype + '"></span>');
+                this._updateMenuChecked('bordertype', btype, tbar);
+                if (parseInt(bsize, 10) > 0) {
+                    tbar.enableButton(bt_button);
+                    tbar.enableButton(bs_button);
+                }
+
+                var cont = tbar.get('cont');
+                var hw = document.createElement('div');
+                hw.className = 'yui-toolbar-group yui-toolbar-group-height-width height-width';
+                hw.innerHTML = '<h3>' + this.STR_IMAGE_SIZE + ':</h3>';
+                var orgSize = '';
+                if ((height != oheight) || (width != owidth)) {
+                    orgSize = '<span class="info">' + this.STR_IMAGE_ORIG_SIZE + '<br>'+ owidth +' x ' + oheight + '</span>';
+                }
+                hw.innerHTML += '<span><input type="text" size="3" value="'+width+'" id="insertimage_width"> x <input type="text" size="3" value="'+height+'" id="insertimage_height"></span>' + orgSize;
+                cont.insertBefore(hw, cont.firstChild);
+
+                Event.onAvailable('insertimage_width', function() {
+                    Event.on('insertimage_width', 'blur', function() {
+                        var value = parseInt(Dom.get('insertimage_width').value, 10);
+                        if (value > 5) {
+                            el.style.width = value + 'px';
+                            this.moveWindow();
+                        }
+                    }, this, true);
+                }, this, true);
+                Event.onAvailable('insertimage_height', function() {
+                    Event.on('insertimage_height', 'blur', function() {
+                        var value = parseInt(Dom.get('insertimage_height').value, 10);
+                        if (value > 5) {
+                            el.style.height = value + 'px';
+                            this.moveWindow();
+                        }
+                    }, this, true);
+                }, this, true);
+
+                if ((el.align == 'right') || (el.align == 'left')) {
+                    tbar.selectButton(el.align);
+                } else if (el.style.display == 'block') {
+                    tbar.selectButton('block');
+                } else {
+                    tbar.selectButton('inline');
+                }
+                if (parseInt(el.style.marginLeft, 10) > 0) {
+                     tbar.getButtonByValue('padding').set('label', ''+parseInt(el.style.marginLeft, 10));
+                }
+                if (el.style.borderSize) {
+                    tbar.selectButton('bordersize');
+                    tbar.selectButton(parseInt(el.style.borderSize, 10));
+                }
+
+                tbar.on('colorPickerClicked', function(o) {
+                    var size = '1', type = 'solid', color = 'black';
+
+                    if (el.style.borderLeftWidth) {
+                        size = parseInt(el.style.borderLeftWidth, 10);
+                    }
+                    if (el.style.borderLeftStyle) {
+                        type = el.style.borderLeftStyle;
+                    }
+                    if (el.style.borderLeftColor) {
+                        color = el.style.borderLeftColor;
+                    }
+                    var borderString = size + 'px ' + type + ' #' + o.color;
+                    el.style.border = borderString;
+                }, this.toolbar, true);
+
+                tbar.on('buttonClick', function(o) {
+                    var value = o.button.value,
+                        borderString = '';
+                    if (o.button.menucmd) {
+                        value = o.button.menucmd;
+                    }
+                    var size = '1', type = 'solid', color = 'black';
+
+                    /* All border calcs are done on the left border
+                        since our default interface only supports
+                        one border size/type and color */
+                    if (el.style.borderLeftWidth) {
+                        size = parseInt(el.style.borderLeftWidth, 10);
+                    }
+                    if (el.style.borderLeftStyle) {
+                        type = el.style.borderLeftStyle;
+                    }
+                    if (el.style.borderLeftColor) {
+                        color = el.style.borderLeftColor;
+                    }
+                    switch(value) {
+                        case 'bordersize':
+                            if (this.browser.webkit && this._lastImage) {
+                                Dom.removeClass(this._lastImage, 'selected');
+                                this._lastImage = null;
+                            }
+
+                            borderString = parseInt(o.button.value, 10) + 'px ' + type + ' ' + color;
+                            el.style.border = borderString;
+                            if (parseInt(o.button.value, 10) > 0) {
+                                tbar.enableButton('bordertype');
+                                tbar.enableButton('bordercolor');
+                            } else {
+                                tbar.disableButton('bordertype');
+                                tbar.disableButton('bordercolor');
+                            }
+                            break;
+                        case 'bordertype':
+                            if (this.browser.webkit && this._lastImage) {
+                                Dom.removeClass(this._lastImage, 'selected');
+                                this._lastImage = null;
+                            }
+                            borderString = size + 'px ' + o.button.value + ' ' + color;
+                            el.style.border = borderString;
+                            break;
+                        case 'right':
+                        case 'left':
+                            tbar.deselectAllButtons();
+                            el.style.display = '';
+                            el.align = o.button.value;
+                            break;
+                        case 'inline':
+                            tbar.deselectAllButtons();
+                            el.style.display = '';
+                            el.align = '';
+                            break;
+                        case 'block':
+                            tbar.deselectAllButtons();
+                            el.style.display = 'block';
+                            el.align = 'center';
+                            break;
+                        case 'padding':
+                            var _button = tbar.getButtonById(o.button.id);
+                            el.style.margin = _button.get('label') + 'px';
+                            break;
+                    }
+                    tbar.selectButton(o.button.value);
+                    this.moveWindow();
+                }, this, true);
+
+                win.setHeader(this.STR_IMAGE_PROP_TITLE);
+                win.setBody(body);
+                if ((this.browser.webkit && !this.browser.webkit3) || this.browser.opera) {
+                    win.setFooter(this.STR_IMAGE_COPY);
+                }
+                this.openWindow(win);
+
+                //Set event after openWindow..
+                Event.onAvailable('insertimage_url', function() {
+
+                    this.toolbar.selectButton('insertimage');
+
+                    window.setTimeout(function() {
+                        YAHOO.util.Dom.get('insertimage_url').focus();
+                        if (blankimage) {
+                            YAHOO.util.Dom.get('insertimage_url').select();
+                        }
+                    }, 50);
+                    
+                    if (this.get('localFileWarning')) {
+                        Event.on('insertimage_link', 'blur', function() {
+                            var url = Dom.get('insertimage_link');
+                            if (this._isLocalFile(url.value)) {
+                                //Local File throw Warning
+                                Dom.addClass(url, 'warning');
+                                this.get('panel').setFooter(this.STR_LOCAL_FILE_WARNING);
+                            } else {
+                                Dom.removeClass(url, 'warning');
+                                this.get('panel').setFooter(' ');
+                                if ((this.browser.webkit && !this.browser.webkit3) || this.browser.opera) {
+                                    this.get('panel').setFooter(this.STR_IMAGE_COPY);
+                                }
+                            }
+                        }, this, true);
+
+                        Event.on('insertimage_url', 'blur', function() {
+                            var url = Dom.get('insertimage_url');
+                            if (this._isLocalFile(url.value)) {
+                                //Local File throw Warning
+                                Dom.addClass(url, 'warning');
+                                this.get('panel').setFooter(this.STR_LOCAL_FILE_WARNING);
+                            } else {
+                                Dom.removeClass(url, 'warning');
+                                this.get('panel').setFooter(' ');
+                                if ((this.browser.webkit && !this.browser.webkit3) || this.browser.opera) {
+                                    this.get('panel').setFooter(this.STR_IMAGE_COPY);
+                                }
+                                
+                                if (url && url.value && (url.value != this.STR_IMAGE_HERE)) {
+                                    this.currentElement[0].setAttribute('src', url.value);
+                                    var self = this,
+                                        img = new Image();
+
+                                    img.onerror = function() {
+                                        url.value = self.STR_IMAGE_HERE;
+                                        img.setAttribute('src', self.get('blankimage'));
+                                        self.currentElement[0].setAttribute('src', self.get('blankimage'));
+                                        YAHOO.util.Dom.get('insertimage_height').value = img.height;
+                                        YAHOO.util.Dom.get('insertimage_width').value = img.width;
+                                    };
+                                    window.setTimeout(function() {
+                                        YAHOO.util.Dom.get('insertimage_height').value = img.height;
+                                        YAHOO.util.Dom.get('insertimage_width').value = img.width;
+                                        if (self.currentElement && self.currentElement[0]) {
+                                            if (!self.currentElement[0]._height) {
+                                                self.currentElement[0]._height = img.height;
+                                            }
+                                            if (!self.currentElement[0]._width) {
+                                                self.currentElement[0]._width = img.width;
+                                            }
+                                        }
+                                        self.moveWindow();
+                                    }, 200);
+
+                                    if (url.value != this.STR_IMAGE_HERE) {
+                                        img.src = url.value;
+                                    }
+                                }
+                            }
+                        }, this, true);
+                    }
+                }, this, true);
+            });
+        },
+        /**
+        * @private
+        * @method _handleInsertImageWindowClose
+        * @description Handles the closing of the Image Properties Window.
+        */
+        _handleInsertImageWindowClose: function() {
+            var url = Dom.get('insertimage_url');
+            var title = Dom.get('insertimage_title');
+            var link = Dom.get('insertimage_link');
+            var target = Dom.get('insertimage_target');
+            var el = this.currentElement[0];
+            if (url && url.value && (url.value != this.STR_IMAGE_HERE)) {
+                el.setAttribute('src', url.value);
+                el.setAttribute('title', title.value);
+                el.setAttribute('alt', title.value);
+                var par = el.parentNode;
+                if (link.value) {
+                    var urlValue = link.value;
+                    if ((urlValue.indexOf(':/'+'/') == -1) && (urlValue.substring(0,1) != '/') && (urlValue.substring(0, 6).toLowerCase() != 'mailto')) {
+                        if ((urlValue.indexOf('@') != -1) && (urlValue.substring(0, 6).toLowerCase() != 'mailto')) {
+                            //Found an @ sign, prefix with mailto:
+                            urlValue = 'mailto:' + urlValue;
+                        } else {
+                            /* :// not found adding */
+                            urlValue = 'http:/'+'/' + urlValue;
+                        }
+                    }
+                    if (par && this._isElement(par, 'a')) {
+                        par.setAttribute('href', urlValue);
+                        if (target.checked) {
+                            par.setAttribute('target', target.value);
+                        } else {
+                            par.setAttribute('target', '');
+                        }
+                    } else {
+                        var _a = this._getDoc().createElement('a');
+                        _a.setAttribute('href', urlValue);
+                        if (target.checked) {
+                            _a.setAttribute('target', target.value);
+                        } else {
+                            _a.setAttribute('target', '');
+                        }
+                        el.parentNode.replaceChild(_a, el);
+                        _a.appendChild(el);
+                    }
+                } else {
+                    if (par && this._isElement(par, 'a')) {
+                        par.parentNode.replaceChild(el, par);
+                    }
+                }
+            } else {
+                //No url/src given, remove the node from the document
+                el.parentNode.removeChild(el);
+            }
+            this.currentElement = [];
+            this.nodeChange();
+        },
+        /**
+        * @private
+        * @method _isLocalFile
+        * @param {String} url THe url/string to check
+        * @description Checks to see if a string (href or img src) is possibly a local file reference..
+        */
+        _isLocalFile: function(url) {
+            if ((url !== '') && ((url.indexOf('file:/') != -1) || (url.indexOf(':\\') != -1))) {
+                return true;
+            }
+            return false;
+        },
+        /**
+        * @private
+        * @method _handleCreateLinkClick
+        * @description Handles the opening of the Link Properties Window when the Create Link button is clicked or an href is doubleclicked.
+        */
+        _handleCreateLinkClick: function() {
+            var el = this._getSelectedElement();
+            if (this._isElement(el, 'img')) {
+                this.STOP_EXEC_COMMAND = true;
+                this.currentElement[0] = el;
+                this.toolbar.fireEvent('insertimageClick', { type: 'insertimageClick', target: this.toolbar });
+                this.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: this });
+                return false;
+            }
+            this.on('afterExecCommand', function() {
+
+                var win = new YAHOO.widget.EditorWindow('createlink', {
+                    width: '350px'
+                });
+                
+                var el = this.currentElement[0],
+                    url = '',
+                    title = '',
+                    target = '',
+                    localFile = false;
+                if (el) {
+                    if (el.getAttribute('href') !== null) {
+                        url = el.getAttribute('href');
+                        if (this._isLocalFile(url)) {
+                            //Local File throw Warning
+                            win.setFooter(this.STR_LOCAL_FILE_WARNING);
+                            localFile = true;
+                        } else {
+                            win.setFooter(' ');
+                        }
+                    }
+                    if (el.getAttribute('title') !== null) {
+                        title = el.getAttribute('title');
+                    }
+                    if (el.getAttribute('target') !== null) {
+                        target = el.getAttribute('target');
+                    }
+                }
+                var str = '<label for="createlink_url"><strong>' + this.STR_LINK_URL + ':</strong> <input type="text" name="createlink_url" id="createlink_url" value="' + url + '"' + ((localFile) ? ' class="warning"' : '') + '></label>';
+                str += '<label for="createlink_target"><strong>&nbsp;</strong><input type="checkbox" name="createlink_target_" id="createlink_target" value="_blank"' + ((target) ? ' checked' : '') + '> ' + this.STR_LINK_NEW_WINDOW + '</label>';
+                str += '<label for="createlink_title"><strong>' + this.STR_LINK_TITLE + ':</strong> <input type="text" name="createlink_title" id="createlink_title" value="' + title + '"></label>';
+                
+                var body = document.createElement('div');
+                body.innerHTML = str;
+
+                var unlinkCont = document.createElement('div');
+                unlinkCont.className = 'removeLink';
+                var unlink = document.createElement('a');
+                unlink.href = '#';
+                unlink.innerHTML = this.STR_LINK_PROP_REMOVE;
+                unlink.title = this.STR_LINK_PROP_REMOVE;
+                Event.on(unlink, 'click', function(ev) {
+                    Event.stopEvent(ev);
+                    this.execCommand('unlink');
+                    this.closeWindow();
+                }, this, true);
+                unlinkCont.appendChild(unlink);
+                body.appendChild(unlinkCont);
+
+                win.setHeader(this.STR_LINK_PROP_TITLE);
+                win.setBody(body);
+
+                Event.onAvailable('createlink_url', function() {
+                    window.setTimeout(function() {
+                        try {
+                            YAHOO.util.Dom.get('createlink_url').focus();
+                        } catch (e) {}
+                    }, 50);
+                    Event.on('createlink_url', 'blur', function() {
+                        var url = Dom.get('createlink_url');
+                        if (this._isLocalFile(url.value)) {
+                            //Local File throw Warning
+                            Dom.addClass(url, 'warning');
+                            this.get('panel').setFooter(this.STR_LOCAL_FILE_WARNING);
+                        } else {
+                            Dom.removeClass(url, 'warning');
+                            this.get('panel').setFooter(' ');
+                        }
+                    }, this, true);
+                }, this, true);
+
+                this.openWindow(win);
+            });
+        },
+        /**
+        * @private
+        * @method _handleCreateLinkWindowClose
+        * @description Handles the closing of the Link Properties Window.
+        */
+        _handleCreateLinkWindowClose: function() {
+            var url = Dom.get('createlink_url'),
+                target = Dom.get('createlink_target'),
+                title = Dom.get('createlink_title'),
+                el = this.currentElement[0],
+                a = el;
+            if (url && url.value) {
+                var urlValue = url.value;
+                if ((urlValue.indexOf(':/'+'/') == -1) && (urlValue.substring(0,1) != '/') && (urlValue.substring(0, 6).toLowerCase() != 'mailto')) {
+                    if ((urlValue.indexOf('@') != -1) && (urlValue.substring(0, 6).toLowerCase() != 'mailto')) {
+                        //Found an @ sign, prefix with mailto:
+                        urlValue = 'mailto:' + urlValue;
+                    } else {
+                        /* :// not found adding */
+                        urlValue = 'http:/'+'/' + urlValue;
+                    }
+                }
+                el.setAttribute('href', urlValue);
+                if (target.checked) {
+                    el.setAttribute('target', target.value);
+                } else {
+                    el.setAttribute('target', '');
+                }
+                el.setAttribute('title', ((title.value) ? title.value : ''));
+
+            } else {
+                var _span = this._getDoc().createElement('span');
+                _span.innerHTML = el.innerHTML;
+                Dom.addClass(_span, 'yui-non');
+                el.parentNode.replaceChild(_span, el);
+            }
+            this.nodeChange();
+            this.currentElement = [];
+        },
+        /**
+        * @method render
+        * @description Causes the toolbar and the editor to render and replace the textarea.
+        */
+        render: function() {
+            if (this._rendered) {
+                return false;
+            }
+            if (!this.DOMReady) {
+                this._queue[this._queue.length] = ['render', arguments];
+                return false;
+            }
+            this._setBusy();
+            this._rendered = true;
+            var self = this;
+
+            this.set('textarea', this.get('element'));
+
+            this.get('element_cont').setStyle('display', 'none');
+            this.get('element_cont').addClass(this.CLASS_CONTAINER);
+
+            this.set('iframe', this._createIframe());
+            window.setTimeout(function() {
+                self._setInitialContent.call(self);
+            }, 10);
+
+            this.get('editor_wrapper').appendChild(this.get('iframe').get('element'));
+            Dom.addClass(this.get('iframe').get('parentNode'), this.CLASS_EDITABLE_CONT);
+            this.get('iframe').addClass(this.CLASS_EDITABLE);
+
+
+            var tbarConf = this.get('toolbar');
+            //Set the toolbar to disabled until content is loaded
+            tbarConf.disabled = true;
+            //Create Toolbar instance
+            this.toolbar = new Toolbar(this.get('toolbar_cont'), tbarConf);
+            this.fireEvent('toolbarLoaded', { type: 'toolbarLoaded', target: this.toolbar });
+
+            
+            this.toolbar.on('toolbarCollapsed', function() {
+                if (this.currentWindow) {
+                    this.moveWindow();
+                }
+            }, this, true);
+            this.toolbar.on('toolbarExpanded', function() {
+                if (this.currentWindow) {
+                    this.moveWindow();
+                }
+            }, this, true);
+            this.toolbar.on('fontsizeClick', function(o) {
+                this._handleFontSize(o);
+            }, this, true);
+            
+            this.toolbar.on('colorPickerClicked', function(o) {
+                this._handleColorPicker(o);
+            }, this, true);
+
+            this.toolbar.on('alignClick', function(o) {
+                this._handleAlign(o);
+            }, this, true);
+            this.on('afterNodeChange', function() {
+                this._handleAfterNodeChange();
+            }, this, true);
+            this.toolbar.on('insertimageClick', function() {
+                this._handleInsertImageClick();
+            }, this, true);
+            this.on('windowinsertimageClose', function() {
+                this._handleInsertImageWindowClose();
+            }, this, true);
+            this.toolbar.on('createlinkClick', function() {
+                this._handleCreateLinkClick();
+            }, this, true);
+            this.on('windowcreatelinkClose', function() {
+                this._handleCreateLinkWindowClose();
+            }, this, true);
+
+
+            //Replace Textarea with editable area
+            
+            this.get('parentNode').replaceChild(this.get('element_cont').get('element'), this.get('element'));
+
+
+            if (!this.beforeElement) {
+                this.beforeElement = document.createElement('h2');
+                this.beforeElement.className = 'yui-editor-skipheader';
+                this.beforeElement.tabIndex = '-1';
+                this.beforeElement.innerHTML = this.STR_BEFORE_EDITOR;
+                this.get('element_cont').get('firstChild').insertBefore(this.beforeElement, this.toolbar.get('nextSibling'));
+            }
+            this.setStyle('visibility', 'hidden');
+            this.setStyle('position', 'absolute');
+            this.setStyle('top', '-9999px');
+            this.setStyle('left', '-9999px');
+            this.get('element_cont').appendChild(this.get('element'));
+            this.get('element_cont').setStyle('display', 'block');
+
+
+            //Set height and width of editor container
+            this.get('element_cont').setStyle('width', this.get('width'));
+            Dom.setStyle(this.get('iframe').get('parentNode'), 'height', this.get('height'));
+
+            this.get('iframe').setStyle('width', '100%'); //WIDTH
+            //this.get('iframe').setStyle('_width', '99%'); //WIDTH
+            this.get('iframe').setStyle('height', '100%');
+
+            this.fireEvent('afterRender', { type: 'afterRender', target: this });
+        },
+        /**
+        * @method execCommand
+        * @param {String} action The "execCommand" action to try to execute (Example: bold, insertimage, inserthtml)
+        * @param {String} value (optional) The value for a given action such as action: fontname value: 'Verdana'
+        * @description This method attempts to try and level the differences in the various browsers and their support for execCommand actions
+        */
+        execCommand: function(action, value) {
+            var beforeExec = this.fireEvent('beforeExecCommand', { type: 'beforeExecCommand', target: this, args: arguments });
+            if ((beforeExec === false) || (this.STOP_EXEC_COMMAND)) {
+                this.STOP_EXEC_COMMAND = false;
+                return false;
+            }
+            this._setMarkupType(action);
+            if (this.browser.ie) {
+                this._getWindow().focus();
+            }
+            var exec = true,
+                selEl = null,
+                el = null,
+                tag = '',
+                str = '',
+                _span = null,
+                _sel = this._getSelection(),
+                _range = this._getRange(),
+                _selEl = this._getSelectedElement();
+
+            if (_selEl) {
+                _sel = _selEl;
+            }
+            switch (action.toLowerCase()) {
+                case 'heading':
+                    if (this.browser.ie) {
+                        action = 'formatblock';
+                    }
+                    var h = 0;
+                    if (value == 'none') {
+                        if ((_sel && _sel.tagName && (_sel.tagName.toLowerCase().substring(0,1) == 'h')) || (_sel && _sel.parentNode && _sel.parentNode.tagName && (_sel.parentNode.tagName.toLowerCase().substring(0,1) == 'h'))) {
+                            if (_sel.parentNode.tagName.toLowerCase().substring(0,1) == 'h') {
+                                if (!this._isElement(_sel.parentNode, 'html')) {
+                                    _sel = _sel.parentNode;
+                                }
+                            }
+                            if (this._isElement(_sel, 'body')) {
+                                return false;
+                            }
+                            for (h = 0; h < this.currentElement.length; h++) {
+                                if (this._isElement(this.currentElement[h], 'h1') || this._isElement(this.currentElement[h], 'h2') || this._isElement(this.currentElement[h], 'h3') || this._isElement(this.currentElement[h], 'h4') || this._isElement(this.currentElement[h], 'h5') || this._isElement(this.currentElement[h], 'h6')) {
+                                    el = this._swapEl(this.currentElement[h], 'span', function(el) {
+                                        el.className = 'yui-non';
+                                        el.innerHTML = el.innerHTML.replace(new RegExp('<span class="yui-non">(.*?)<\/span>', 'gi'), '$1');
+                                    });
+                                    this.currentElement[h] = el;
+                                }
+                                if (this.currentElement[h].nextSibling && !this._isElement(this.currentElement[h].nextSibling, 'br')) {
+                                    var _br = this._getDoc().createElement('br');
+                                    this.currentElement[h].parentNode.insertBefore(_br, this.currentElement[h].nextSibling);
+                                }
+                            }
+                        }
+                        exec = false;
+                    } else {
+                        if (this._isElement(_selEl, 'h1') || this._isElement(_selEl, 'h2') || this._isElement(_selEl, 'h3') || this._isElement(_selEl, 'h4') || this._isElement(_selEl, 'h5') || this._isElement(_selEl, 'h6')) {
+                            el = this._swapEl(_selEl, value);
+                            this._selectNode(el);
+                            this.currentElement[0] = el;
+                        } else {
+                            this._createCurrentElement(value);
+                            this._selectNode(this.currentElement[0]);
+                            //If the next sibling is a br, remove it
+                            for (h = 0; h < this.currentElement.length; h++) {
+                                if (this.currentElement[h].nextSibling && this._isElement(this.currentElement[h].nextSibling, 'br')) {
+                                    this.currentElement[h].nextSibling.parentNode.removeChild(this.currentElement[h].nextSibling);
+                                }
+                            }
+                        }
+                        exec = false;
+                    }
+                    break;
+                case 'backcolor':
+                    if (this.browser.gecko || this.browser.opera) {
+                        this._setEditorStyle(true);
+                        action = 'hilitecolor';
+                    }
+                    /**
+                    * @browser opera
+                    * @knownissue - Opera fails to assign a background color on an element that already has one.
+                    */
+                    el = this._getSelectedElement();
+                    if (this.browser.opera) {
+                        if (!this._isElement(el, 'body') && Dom.getStyle(el, 'background-color')) {
+                            Dom.setStyle(el, 'background-color', value);
+                        } else {
+                            this._createCurrentElement('span', { backgroundColor: value });
+                        }
+                        exec = false;
+                    } else if (!this._hasSelection()) {
+                        if (el !== this._getDoc().body) {
+                            Dom.setStyle(el, 'background-color', value);
+                            exec = false;
+                        }
+                    }
+                    break;
+                case 'forecolor':
+                    el = this._getSelectedElement();
+                    if ((el !== this._getDoc().body) && (!this._hasSelection())) {
+                        Dom.setStyle(el, 'color', value);
+                        exec = false;
+                    }
+                    break;
+                case 'hiddenelements':
+                    this._showHidden();
+                    exec = false;
+                    break;
+                case 'unlink':
+                    el = this._swapEl(this.currentElement[0], 'span', function(el) {
+                        el.className = 'yui-non';
+                    });
+                    exec = false;
+                    break;
+                case 'createlink':
+                    el = this._getSelectedElement();
+                    var _a = null;
+                    if (!this._isElement(el, 'a')) {
+                        this._createCurrentElement('a');
+                        _a = this._swapEl(this.currentElement[0], 'a');
+                        this.currentElement[0] = _a;
+                    } else {
+                        this.currentElement[0] = el;
+                    }
+                    exec = false;
+                    break;
+                case 'insertimage':
+                    if (value === '') {
+                        value = this.get('blankimage');
+                    }
+                    /**
+                    * @knownissue
+                    * @browser Safari 2.x
+                    * @description The issue here is that we have no way of knowing where the cursor position is
+                    * inside of the iframe, so we have to place the newly inserted data in the best place that we can.
+                    */
+                    
+                    el = this._getSelectedElement();
+                    if (this._isElement(el, 'img')) {
+                        this.currentElement[0] = el;
+                        exec = false;
+                    } else {
+                        if (this._getDoc().queryCommandEnabled(action)) {
+                            this._getDoc().execCommand('insertimage', false, value);
+                            var imgs = this._getDoc().getElementsByTagName('img');
+                            for (var i = 0; i < imgs.length; i++) {
+                                if (!YAHOO.util.Dom.hasClass(imgs[i], 'yui-img')) {
+                                    YAHOO.util.Dom.addClass(imgs[i], 'yui-img');
+                                    this.currentElement[0] = imgs[i];
+                                }
+                            }
+                            exec = false;
+                        } else {
+                            var _img = null;
+                            if (el == this._getDoc().body) {
+                                _img = this._getDoc().createElement('img');
+                                _img.setAttribute('src', value);
+                                YAHOO.util.Dom.addClass(_img, 'yui-img');
+                                this._getDoc().body.appendChild(_img);
+                            } else {
+                                this._createCurrentElement('img');
+                                _img = this._getDoc().createElement('img');
+                                _img.setAttribute('src', value);
+                                YAHOO.util.Dom.addClass(_img, 'yui-img');
+                                this.currentElement[0].parentNode.replaceChild(_img, this.currentElement[0]);
+                            }
+                            this.currentElement[0] = _img;
+                            exec = false;
+                        }
+                    }
+                    
+                    break;
+                case 'inserthtml':
+                    /**
+                    * @knownissue
+                    * @browser Safari 2.x
+                    * @description The issue here is that we have no way of knowing where the cursor position is
+                    * inside of the iframe, so we have to place the newly inserted data in the best place that we can.
+                    */
+                    if (this.browser.webkit && !this._getDoc().queryCommandEnabled(action)) {
+                        this._createCurrentElement('img');
+                        _span = this._getDoc().createElement('span');
+                        _span.innerHTML = value;
+                        this.currentElement[0].parentNode.replaceChild(_span, this.currentElement[0]);
+                        exec = false;
+                    } else if (this.browser.ie) {
+                        _range = this._getRange();
+                        if (_range.item) {
+                            _range.item(0).outerHTML = value;
+                        } else {
+                            _range.pasteHTML(value);
+                        }
+                        exec = false;                    
+                    }
+                    break;
+                case 'removeformat':
+                    /**
+                    * @knownissue Remove Format issue
+                    * @browser Safari 2.x
+                    * @description There is an issue here with Safari, that it may not always remove the format of the item that is selected.
+                    * Due to the way that Safari 2.x handles ranges, it is very difficult to determine what the selection holds.
+                    * So here we are making the best possible guess and acting on it.
+                    */
+                    if (this.browser.webkit && !this._getDoc().queryCommandEnabled(action)) {
+                        this._createCurrentElement('span');
+                        YAHOO.util.Dom.addClass(this.currentElement[0], 'yui-non');
+                        var re= /<\S[^><]*>/g;
+                        str = this.currentElement[0].innerHTML.replace(re, '');
+                        var _txt = this._getDoc().createTextNode(str);
+                        this.currentElement[0].parentNode.parentNode.replaceChild(_txt, this.currentElement[0].parentNode);
+                        
+                        exec = false;
+                    }
+                    break;
+                case 'superscript':
+                case 'subscript':
+                    if (this.browser.webkit) {
+                        tag = action.toLowerCase().substring(0, 3);
+                        if (this._isElement(_selEl, tag)) {
+                            _span = this._swapEl(this.currentElement[0], 'span', function(el) {
+                                el.className = 'yui-non';
+                            });
+                            this._selectNode(_span);
+                        } else {
+                            this._createCurrentElement(tag);
+                            var _sub = this._swapEl(this.currentElement[0], tag);
+                            this._selectNode(_sub);
+                            this.currentElement[0] = _sub;
+                        }
+                        exec = false;
+                    }
+                    break;
+                case 'formatblock':
+                    value = 'blockquote';
+                    if (this.browser.webkit) {
+                        this._createCurrentElement('blockquote');
+                        if (YAHOO.util.Dom.hasClass(this.currentElement[0].parentNode, 'yui-tag-blockquote')) {
+                            _span = this._getDoc().createElement('span');
+                            _span.innerHTML = this.currentElement[0].innerHTML;
+                            YAHOO.util.Dom.addClass(_span, 'yui-non');
+                            this.currentElement[0].parentNode.parentNode.replaceChild(_span, this.currentElement[0].parentNode);
+                        }
+                        exec = false;
+                    } else {
+                        var tar = Event.getTarget(this.currentEvent);
+                        if (this._isElement(tar, 'blockquote')) {
+                            _span = this._getDoc().createElement('span');
+                            _span.innerHTML = tar.innerHTML;
+                            YAHOO.util.Dom.addClass(_span, 'yui-non');
+                            tar.parentNode.replaceChild(_span, tar);
+                            exec = false;
+                        }
+                    }
+                    break;
+                case 'indent':
+                case 'outdent':
+                    if (this.browser.webkit || this.browser.ie || this.browser.gecko) {
+                        selEl = this._getSelectedElement();
+                        var _bq = null;
+                        if (this._isElement(selEl, 'blockquote')) {
+                            if (action == 'indent') {
+                                _bq = this._getDoc().createElement('blockquote');
+                                _bq.innerHTML = selEl.innerHTML;
+                                selEl.innerHTML = '';
+                                selEl.appendChild(_bq);
+                                this._selectNode(_bq);
+                            } else {
+                                var par = selEl.parentNode;
+                                if (this._isElement(selEl.parentNode, 'blockquote')) {
+                                    par.innerHTML = selEl.innerHTML;
+                                    this._selectNode(par);
+                                } else {
+                                    _span = this._getDoc().createElement('span');
+                                    _span.innerHTML = selEl.innerHTML;
+                                    YAHOO.util.Dom.addClass(_span, 'yui-non');
+                                    par.replaceChild(_span, selEl);
+                                    this._selectNode(_span);
+                                }
+                            }
+                        } else {
+                            if (action == 'indent') {
+                                this._createCurrentElement('blockquote');
+                                _bq = this._getDoc().createElement('blockquote');
+                                _bq.innerHTML = this.currentElement[0].innerHTML;
+                                this.currentElement[0].parentNode.replaceChild(_bq, this.currentElement[0]);
+                                this.currentElement[0] = _bq;
+                                this._selectNode(_bq);
+                            } else {
+                            }
+                        }
+                        exec = false;
+                    } else {
+                        //action = 'formatblock';
+                        value = 'blockquote';
+                    }
+                    break;
+                case 'insertorderedlist':
+                case 'insertunorderedlist':
+                    /**
+                    * @knownissue Safari 2.+ doesn't support ordered and unordered lists
+                    * @browser Safari 2.x
+                    * The issue with this workaround is that when applied to a set of text
+                    * that has BR's in it, Safari may or may not pick up the individual items as
+                    * list items. This is fixed in WebKit (Safari 3)
+                    */
+                    tag = ((action.toLowerCase() == 'insertorderedlist') ? 'ol' : 'ul');
+                    if ((this.browser.webkit && !this._getDoc().queryCommandEnabled(action))) {
+                        var list = null;
+                        selEl = this._getSelectedElement();
+                        var li = 0;
+                        if (this._isElement(selEl, 'li') && this._isElement(selEl.parentNode, tag)) {
+                            el = selEl.parentNode;
+                            list = this._getDoc().createElement('span');
+                            YAHOO.util.Dom.addClass(list, 'yui-non');
+                            str = '';
+                            var lis = el.getElementsByTagName('li');
+                            for (li = 0; li < lis.length; li++) {
+                                str += '<div>' + lis[li].innerHTML + '</div>';
+                            }
+                            list.innerHTML = str;
+                            this.currentElement[0] = el;
+                        } else {
+                            this._createCurrentElement(tag.toLowerCase());
+                            list = this._getDoc().createElement(tag);
+                            var els = this.currentElement;
+                            for (li = 0; li < this.currentElement.length; li++) {
+                                var newli = this._getDoc().createElement('li');
+                                newli.innerHTML = this.currentElement[li].innerHTML + '&nbsp;';
+                                list.appendChild(newli);
+                                if (li > 0) {
+                                    this.currentElement[li].parentNode.removeChild(this.currentElement[li]);
+                                }
+                            }
+                        }
+                        this.currentElement[0].parentNode.replaceChild(list, this.currentElement[0]);
+                        exec = false;
+                    } else {
+                        el = this._getSelectedElement();
+                        if (this._isElement(el, 'li') && this._isElement(el.parentNode, tag) || (this.browser.ie && this._isElement(this._getRange().parentElement, 'li'))) { //we are in a list..
+                            if (this.browser.ie) {
+                                str = '';
+                                var lis2 = el.parentNode.getElementsByTagName('li');
+                                for (var j = 0; j < lis2.length; j++) {
+                                    str += lis2[j].innerHTML + '<br>';
+                                }
+                                var newEl = this._getDoc().createElement('span');
+                                newEl.innerHTML = str;
+                                el.parentNode.parentNode.replaceChild(newEl, el.parentNode);
+                            } else {
+                                this.nodeChange();
+                                this._getDoc().execCommand(action, '', el.parentNode);
+                                this.nodeChange();
+                            }
+                            exec = false;
+                        }
+                        if (this.browser.opera) {
+                            var self = this;
+                            window.setTimeout(function() {
+                                var liso = self._getDoc().getElementsByTagName('li');
+                                for (var i = 0; i < liso.length; i++) {
+                                    if (liso[i].innerHTML.toLowerCase() == '<br>') {
+                                        liso[i].parentNode.parentNode.removeChild(liso[i].parentNode);
+                                    }
+                                }
+                            },30);
+                        }
+                        if (this.browser.ie && exec) {
+                            var html = '';
+                            if (this._getRange().html) {
+                                html = '<li>' + this._getRange().html+ '</li>';
+                            } else {
+                                html = '<li>' + this._getRange().text + '</li>';
+                            }
+
+                            this._getRange().pasteHTML('<' + tag + '>' + html + '</' + tag + '>');
+                            exec = false;
+                        }
+                    }
+                    break;
+                case 'fontname':
+                    selEl = this._getSelectedElement();
+                    this.currentFont = value;
+                    if (selEl && selEl.tagName && !this._hasSelection()) {
+                        YAHOO.util.Dom.setStyle(selEl, 'font-family', value);
+                        exec = false;
+                    }
+                    break;
+                case 'fontsize':
+                    if ((this.currentElement.length > 0) && (!this._hasSelection())) {
+                        YAHOO.util.Dom.setStyle(this.currentElement, 'fontSize', value);
+                    } else if (!this._isElement(this._getSelectedElement(), 'body')) {
+                        YAHOO.util.Dom.setStyle(this._getSelectedElement(), 'fontSize', value);
+                    } else {
+                        this._createCurrentElement('span', {'fontSize': value });
+                    }
+                    exec = false;
+                    break;
+            }
+            if (exec) {
+                try {
+                    this._getDoc().execCommand(action, false, value);
+                } catch(e) {
+                }
+            } else {
+            }
+            this.on('afterExecCommand', function() {
+                this.unsubscribeAll('afterExecCommand');
+                this.nodeChange();
+            });
+            this.fireEvent('afterExecCommand', { type: 'afterExecCommand', target: this });
+            
+        },
+        /**
+        * @private
+        * @method _swapEl
+        * @param {HTMLElement} el The element to swap with
+        * @param {String} tagName The tagname of the element that you wish to create
+        * @param {Function} callback (optional) A function to run on the element after it is created, but before it is replaced. An element reference is passed to this function.
+        * @description This function will create a new element in the DOM and populate it with the contents of another element. Then it will assume it's place.
+        */
+        _swapEl: function(el, tagName, callback) {
+            var _el = this._getDoc().createElement(tagName);
+            _el.innerHTML = el.innerHTML;
+            if (typeof callback == 'function') {
+                callback.call(this, _el);
+            }
+            el.parentNode.replaceChild(_el, el);
+            return _el;
+        },
+        /**
+        * @private
+        * @method _createCurrentElement
+        * @param {String} tagName (optional defaults to a) The tagname of the element that you wish to create
+        * @param {Object} tagStyle (optional) Object literal containing styles to apply to the new element.
+        * @description This is a work around for the various browser issues with execCommand. This method will run <code>execCommand('fontname', false, 'yui-tmp')</code> on the given selection.
+        * It will then search the document for an element with the font-family set to <strong>yui-tmp</strong> and replace that with another span that has other information in it, then assign the new span to the 
+        * <code>this.currentElement</code> array, so we now have element references to the elements that were just modified. At this point we can use standard DOM manipulation to change them as we see fit.
+        */
+        _createCurrentElement: function(tagName, tagStyle) {
+            tagName = ((tagName) ? tagName : 'a');
+            var sel = this._getSelection(),
+                tar = null,
+                el = [],
+                _doc = this._getDoc();
+            
+            if (this.currentFont) {
+                if (!tagStyle) {
+                    tagStyle = {};
+                }
+                tagStyle.fontFamily = this.currentFont;
+                this.currentFont = null;
+            }
+            this.currentElement = [];
+
+            var _elCreate = function() {
+                var el = null;
+                switch (tagName) {
+                    case 'h1':
+                    case 'h2':
+                    case 'h3':
+                    case 'h4':
+                    case 'h5':
+                    case 'h6':
+                        el = _doc.createElement(tagName);
+                        break;
+                    default:
+                        el = _doc.createElement('span');
+                        YAHOO.util.Dom.addClass(el, 'yui-tag-' + tagName);
+                        YAHOO.util.Dom.addClass(el, 'yui-tag');
+                        el.setAttribute('tag', tagName);
+
+                        for (var k in tagStyle) {
+                            if (YAHOO.util.Lang.hasOwnProperty(tagStyle, k)) {
+                                el.style[k] = tagStyle[k];
+                            }
+                        }
+                        break;
+                }
+                return el;
+            };
+
+            if (!this._hasSelection()) {
+                if (this._getDoc().queryCommandEnabled('insertimage')) {
+                    this._getDoc().execCommand('insertimage', false, 'yui-tmp-img');
+                    var imgs = this._getDoc().getElementsByTagName('img');
+                    for (var j = 0; j < imgs.length; j++) {
+                        if (imgs[j].getAttribute('src', 2) == 'yui-tmp-img') {
+                            el = _elCreate();
+                            imgs[j].parentNode.replaceChild(el, imgs[j]);
+                            this.currentElement[this.currentElement.length] = el;
+                        }
+                    }
+                } else {
+                    if (this.currentEvent) {
+                        tar = YAHOO.util.Event.getTarget(this.currentEvent);
+                    } else {
+                        //For Safari..
+                        tar = this._getDoc().body;                        
+                    }
+                }
+                if (tar) {
+                    /**
+                    * @knownissue
+                    * @browser Safari 2.x
+                    * @description The issue here is that we have no way of knowing where the cursor position is
+                    * inside of the iframe, so we have to place the newly inserted data in the best place that we can.
+                    */
+                    el = _elCreate();
+                    if (this._isElement(tar, 'body')) {
+                        tar.appendChild(el);
+                    } else if (tar.nextSibling) {
+                        tar.parentNode.insertBefore(el, tar.nextSibling);
+                    } else {
+                        tar.parentNode.appendChild(el);
+                    }
+                    //this.currentElement = el;
+                    this.currentElement[this.currentElement.length] = el;
+                    this.currentEvent = null;
+                    if (this.browser.webkit) {
+                        //Force Safari to focus the new element
+                        this._getSelection().setBaseAndExtent(el, 0, el, 0);
+                        if (this.browser.webkit3) {
+                            this._getSelection().collapseToStart();
+                        } else {
+                            this._getSelection().collapse(true);
+                        }
+                    }
+                }
+            } else {
+                //Force CSS Styling for this action...
+                this._setEditorStyle(true);
+                this._getDoc().execCommand('fontname', false, 'yui-tmp');
+                var _tmp = [];
+                /* TODO: This needs to be cleaned up.. */
+                var _tmp1 = this._getDoc().getElementsByTagName('font');
+                var _tmp2 = this._getDoc().getElementsByTagName(this._getSelectedElement().tagName);
+                var _tmp3 = this._getDoc().getElementsByTagName('span');
+                var _tmp4 = this._getDoc().getElementsByTagName('i');
+                var _tmp5 = this._getDoc().getElementsByTagName('b');
+                var _tmp6 = this._getDoc().getElementsByTagName(this._getSelectedElement().parentNode.tagName);
+                for (var e1 = 0; e1 < _tmp1.length; e1++) {
+                    _tmp[_tmp.length] = _tmp1[e1];
+                }
+                for (var e6 = 0; e6 < _tmp6.length; e6++) {
+                    _tmp[_tmp.length] = _tmp6[e6];
+                }
+                for (var e2 = 0; e2 < _tmp2.length; e2++) {
+                    _tmp[_tmp.length] = _tmp2[e2];
+                }
+                for (var e3 = 0; e3 < _tmp3.length; e3++) {
+                    _tmp[_tmp.length] = _tmp3[e3];
+                }
+                for (var e4 = 0; e4 < _tmp4.length; e4++) {
+                    _tmp[_tmp.length] = _tmp4[e4];
+                }
+                for (var e5 = 0; e5 < _tmp5.length; e5++) {
+                    _tmp[_tmp.length] = _tmp5[e5];
+                }
+                for (var i = 0; i < _tmp.length; i++) {
+                    if ((YAHOO.util.Dom.getStyle(_tmp[i], 'font-family') == 'yui-tmp') || (_tmp[i].face && (_tmp[i].face == 'yui-tmp'))) {
+                        el = _elCreate();
+                        el.innerHTML = _tmp[i].innerHTML;
+                        if (this._isElement(_tmp[i], 'ol') || (this._isElement(_tmp[i], 'ul'))) {
+                            var fc = _tmp[i].getElementsByTagName('li')[0];
+                            _tmp[i].style.fontFamily = 'inherit';
+                            fc.style.fontFamily = 'inherit';
+                            el.innerHTML = fc.innerHTML;
+                            fc.innerHTML = '';
+                            fc.appendChild(el);
+                            this.currentElement[this.currentElement.length] = el;
+                        } else if (this._isElement(_tmp[i], 'li')) {
+                            _tmp[i].innerHTML = '';
+                            _tmp[i].appendChild(el);
+                            _tmp[i].style.fontFamily = 'inherit';
+                            this.currentElement[this.currentElement.length] = el;
+                        } else {
+                            if (_tmp[i].parentNode) {
+                                _tmp[i].parentNode.replaceChild(el, _tmp[i]);
+                                this.currentElement[this.currentElement.length] = el;
+                                this.currentEvent = null;
+                                if (this.browser.webkit) {
+                                    //Force Safari to focus the new element
+                                    this._getSelection().setBaseAndExtent(el, 0, el, 0);
+                                    if (this.browser.webkit3) {
+                                        this._getSelection().collapseToStart();
+                                    } else {
+                                        this._getSelection().collapse(true);
+                                    }
+                                }
+                                if (this.browser.ie && tagStyle && tagStyle.fontSize) {
+                                    this._getSelection().empty();
+                                }
+                                if (this.browser.gecko) {
+                                    this._getSelection().collapseToStart();
+                                }
+                            }
+                        }
+                    }
+                }
+                var len = this.currentElement.length;
+                for (var e = 0; e < len; e++) {
+                    if ((e + 1) != len) { //Skip the last one in the list
+                        if (this.currentElement[e] && this.currentElement[e].nextSibling) {
+                            if (this._isElement(this.currentElement[e], 'br')) {
+                                this.currentElement[this.currentElement.length] = this.currentElement[e].nextSibling;
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        /**
+        * @method saveHTML
+        * @description Cleans the HTML with the cleanHTML method then places that string back into the textarea.
+        */
+        saveHTML: function() {
+            var html = this.cleanHTML();
+            this.get('element').value = html;
+            return html;
+        },
+        /**
+        * @method setEditorHTML
+        * @param {String} html The html content to load into the editor
+        * @description Loads HTML into the editors body
+        */
+        setEditorHTML: function(html) {
+            this._getDoc().body.innerHTML = html;
+            this.nodeChange();
+        },
+        /**
+        * @method getEditorHTML
+        * @description Gets the unprocessed/unfiltered HTML from the editor
+        */
+        getEditorHTML: function() {
+            return this._getDoc().body.innerHTML;
+        },
+        /**
+        * @method show
+        * @description This method needs to be called if the Editor was hidden (like in a TabView or Panel). It is used to reset the editor after being in a container that was set to display none.
+        */
+        show: function() {
+            if (this.browser.gecko) {
+                this._setDesignMode('on');
+                this._focusWindow();
+            }
+            if (this.browser.webkit) {
+                var self = this;
+                window.setTimeout(function() {
+                    self._setInitialContent.call(self);
+                }, 10);
+            }
+            //Adding this will close all other Editor window's when showing this one.
+            if (YAHOO.widget.EditorInfo.window.win && YAHOO.widget.EditorInfo.window.scope) {
+                YAHOO.widget.EditorInfo.window.scope.closeWindow.call(YAHOO.widget.EditorInfo.window.scope);
+            }
+            //Put the iframe back in place
+            this.get('iframe').setStyle('position', 'static');
+            this.get('iframe').setStyle('left', '');
+        },
+        /**
+        * @method hide
+        * @description This method needs to be called if the Editor is to be hidden (like in a TabView or Panel). It should be called to clear timeouts and close open editor windows.
+        */
+        hide: function() {
+            //Adding this will close all other Editor window's.
+            if (YAHOO.widget.EditorInfo.window.win && YAHOO.widget.EditorInfo.window.scope) {
+                YAHOO.widget.EditorInfo.window.scope.closeWindow.call(YAHOO.widget.EditorInfo.window.scope);
+            }
+            if (this._fixNodesTimer) {
+                clearTimeout(this._fixNodesTimer);
+                this._fixNodesTimer = null;
+            }
+            if (this._nodeChangeTimer) {
+                clearTimeout(this._nodeChangeTimer);
+                this._nodeChangeTimer = null;
+            }
+            this._lastNodeChange = 0;
+            //Move the iframe off of the screen, so that in containers with visiblity hidden, IE will not cover other elements.
+            this.get('iframe').setStyle('position', 'absolute');
+            this.get('iframe').setStyle('left', '-9999px');
+        },
+        /**
+        * @method cleanHTML
+        * @param {String} html The unfiltered HTML
+        * @description Process the HTML with a few regexes to clean it up and stabilize the output
+        * @returns {String} The filtered HTML
+        */
+        cleanHTML: function(html) {
+            //Start Filtering Output
+            //Begin RegExs..
+            if (!html) { 
+                html = this.getEditorHTML();
+            }
+            var markup = this.get('markup');
+            //Make some backups...
+            if (this.browser.webkit) {
+		        html = html.replace(/<br class="khtml-block-placeholder">/gi, '<YUI_BR>');
+		        html = html.replace(/<br class="webkit-block-placeholder">/gi, '<YUI_BR>');
+            }
+		    html = html.replace(/<br>/gi, '<YUI_BR>');
+		    html = html.replace(/<br\/>/gi, '<YUI_BR>');
+		    html = html.replace(/<br \/>/gi, '<YUI_BR>');
+		    html = html.replace(/<div><YUI_BR><\/div>/gi, '<YUI_BR>');
+		    html = html.replace(/<p>(&nbsp;|&#160;)<\/p>/g, '<YUI_BR>');            
+		    html = html.replace(/<p><br>&nbsp;<\/p>/gi, '<YUI_BR>');
+		    html = html.replace(/<p>&nbsp;<\/p>/gi, '<YUI_BR>');
+		    html = html.replace(/<img([^>]*)\/>/gi, '<YUI_IMG$1>');
+		    html = html.replace(/<img([^>]*)>/gi, '<YUI_IMG$1>');
+		    html = html.replace(/<ul([^>]*)>/gi, '<YUI_UL$1>');
+		    html = html.replace(/<\/ul>/gi, '<\/YUI_UL>');
+		    html = html.replace(/<blockquote([^>]*)>/gi, '<YUI_BQ$1>');
+		    html = html.replace(/<\/blockquote>/gi, '<\/YUI_BQ>');
+
+            //Convert b and i tags to strong and em tags
+            if ((markup == 'semantic') || (markup == 'xhtml')) {
+                html = html.replace(/<i([^>]*)>/gi, '<em$1>');
+                html = html.replace(/<\/i>/gi, '</em>');
+                html = html.replace(/<b([^>]*)>/gi, '<strong$1>');
+                html = html.replace(/<\/b>/gi, '</strong>');
+            }
+            
+            //Case Changing
+		    html = html.replace(/<font/gi, '<font');
+		    html = html.replace(/<\/font>/gi, '</font>');
+		    html = html.replace(/<span/gi, '<span');
+		    html = html.replace(/<\/span>/gi, '</span>');
+            if ((markup == 'semantic') || (markup == 'xhtml') || (markup == 'css')) {
+                html = html.replace(new RegExp('<font([^>]*)face="([^>]*)">(.*?)<\/font>', 'gi'), '<span $1 style="font-family: $2;">$3</span>');
+                html = html.replace(/<u/gi, '<span style="text-decoration: underline;"');
+                html = html.replace(/\/u>/gi, '/span>');
+                if (markup == 'css') {
+                    html = html.replace(/<em([^>]*)>/gi, '<i$1>');
+                    html = html.replace(/<\/em>/gi, '</i>');
+                    html = html.replace(/<strong([^>]*)>/gi, '<b$1>');
+                    html = html.replace(/<\/strong>/gi, '</b>');
+                    html = html.replace(/<b/gi, '<span style="font-weight: bold;"');
+                    html = html.replace(/\/b>/gi, '/span>');
+                    html = html.replace(/<i/gi, '<span style="font-style: italic;"');
+                    html = html.replace(/\/i>/gi, '/span>');
+                }
+                html = html.replace(/  /gi, ' '); //Replace all double spaces and replace with a single
+            } else {
+		        html = html.replace(/<u/gi, '<u');
+		        html = html.replace(/\/u>/gi, '/u>');
+            }
+		    html = html.replace(/<ol([^>]*)>/gi, '<ol$1>');
+		    html = html.replace(/\/ol>/gi, '/ol>');
+		    html = html.replace(/<li/gi, '<li');
+		    html = html.replace(/\/li>/gi, '/li>');
+
+            //Fix stuff we don't want
+	        html = html.replace(/<\/?(body|head|html)[^>]*>/gi, '');
+            //Fix last BR
+	        html = html.replace(/<YUI_BR>$/, '');
+            //Fix last BR in P
+	        html = html.replace(/<YUI_BR><\/p>/g, '</p>');
+            //Fix last BR in LI
+		    html = html.replace(/<YUI_BR><\/li>/gi, '</li>');
+
+            //Safari only regexes
+            if (this.browser.webkit) {
+                //<DIV><SPAN class="Apple-style-span" style="line-height: normal;">Test THis</SPAN></DIV>
+                html = html.replace(/Apple-style-span/gi, '');
+                html = html.replace(/style="line-height: normal;"/gi, '');
+                //Remove bogus LI's
+                html = html.replace(/<li><\/li>/gi, '');
+                html = html.replace(/<li> <\/li>/gi, '');
+                //Remove bogus DIV's
+                html = html.replace(/<div><\/div>/gi, '');
+                html = html.replace(/<div> <\/div>/gi, '');
+            }
+
+		    html = html.replace(/yui-tag-span/gi, '');
+		    html = html.replace(/yui-tag/gi, '');
+		    html = html.replace(/yui-non/gi, '');
+		    html = html.replace(/yui-img/gi, '');
+		    html = html.replace(/ tag="span"/gi, '');
+		    html = html.replace(/ class=""/gi, '');
+		    html = html.replace(/ style=""/gi, '');
+		    html = html.replace(/ class=" "/gi, '');
+		    html = html.replace(/ class="  "/gi, '');
+		    html = html.replace(/ target=""/gi, '');
+		    html = html.replace(/ title=""/gi, '');
+            for (var i = 0; i < 5; i++) {
+                html = html.replace(new RegExp('<span>(.*?)<\/span>', 'gi'), '$1');
+            }
+
+            if (this.browser.ie) {
+		        html = html.replace(/ class= /gi, '');
+		        html = html.replace(/ class= >/gi, '');
+		        html = html.replace(/_height="([^>])"/gi, '');
+		        html = html.replace(/_width="([^>])"/gi, '');
+            }
+            
+            //Replace our backups with the real thing
+            if (markup == 'xhtml') {
+		        html = html.replace(/<YUI_BR>/g, '<br/>');
+		        html = html.replace(/<YUI_IMG([^>]*)>/g, '<img $1/>');
+            } else {
+		        html = html.replace(/<YUI_BR>/g, '<br>');
+		        html = html.replace(/<YUI_IMG([^>]*)>/g, '<img $1>');
+            }
+		    html = html.replace(/<YUI_UL([^>]*)>/g, '<ul$1>');
+		    html = html.replace(/<\/YUI_UL>/g, '<\/ul>');
+		    html = html.replace(/<YUI_BQ([^>]*)>/g, '<blockquote$1>');
+		    html = html.replace(/<\/YUI_BQ>/g, '<\/blockquote>');
+
+            //Trim the output, removing whitespace from the beginning and end
+            html = html.replace(/^\s+/g, '').replace(/\s+$/g, '');
+
+            if (this.get('removeLineBreaks')) {
+                html = html.replace(/\n/g, '').replace(/\r/g, '');
+                html = html.replace(/  /gi, ' '); //Replace all double spaces and replace with a single
+            }
+            return html;
+        },
+        /**
+        * @method clearEditorDoc
+        * @description Clear the doc of the Editor
+        */
+        clearEditorDoc: function() {
+            this._getDoc().body.innerHTML = '&nbsp;';
+        },
+        /**
+        * @private
+        * @method _renderPanel
+        * @description Renders the panel used for Editor Windows to the document so we can start using it..
+        * @returns {<a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>}
+        */
+        _renderPanel: function() {
+            var panel = null;
+            if (!YAHOO.widget.EditorInfo.panel) {
+                panel = new YAHOO.widget.Overlay(this.EDITOR_PANEL_ID, {
+                    width: '300px',
+                    iframe: true,
+                    visible: false,
+                    underlay: 'none',
+                    draggable: false,
+                    close: false
+                });
+                YAHOO.widget.EditorInfo.panel = panel;
+            } else {
+                panel = YAHOO.widget.EditorInfo.panel;
+            }
+            this.set('panel', panel);
+
+            this.get('panel').setBody('---');
+            this.get('panel').setHeader(' ');
+            this.get('panel').setFooter(' ');
+            if (this.DOMReady) {
+                this.get('panel').render(document.body);
+                Dom.addClass(this.get('panel').element, 'yui-editor-panel');
+            } else {
+                Event.onDOMReady(function() {
+                    this.get('panel').render(document.body);
+                    Dom.addClass(this.get('panel').element, 'yui-editor-panel');
+                }, this, true);
+            }
+            this.get('panel').showEvent.subscribe(function() {
+                YAHOO.util.Dom.setStyle(this.element, 'display', 'block');
+            });
+            return this.get('panel');
+        },
+        /**
+        * @method openWindow
+        * @param {<a href="YAHOO.widget.EditorWindow.html">YAHOO.widget.EditorWindow</a>} win A <a href="YAHOO.widget.EditorWindow.html">YAHOO.widget.EditorWindow</a> instance
+        * @description Opens a new "window/panel"
+        */
+        openWindow: function(win) {
+            this.toolbar.set('disabled', true); //Disable the toolbar when an editor window is open..
+            Event.on(document, 'keypress', this._closeWindow, this, true);
+            if (YAHOO.widget.EditorInfo.window.win && YAHOO.widget.EditorInfo.window.scope) {
+                YAHOO.widget.EditorInfo.window.scope.closeWindow.call(YAHOO.widget.EditorInfo.window.scope);
+            }
+            YAHOO.widget.EditorInfo.window.win = win;
+            YAHOO.widget.EditorInfo.window.scope = this;
+
+            var self = this,
+                xy = Dom.getXY(this.currentElement[0]),
+                elXY = Dom.getXY(this.get('iframe').get('element')),
+                panel = this.get('panel'),
+                newXY = [(xy[0] + elXY[0] - 20), (xy[1] + elXY[1] + 10)],
+                wWidth = (parseInt(win.attrs.width, 10) / 2),
+                align = 'center',
+                body = null;
+
+            this.fireEvent('beforeOpenWindow', { type: 'beforeOpenWindow', win: win, panel: panel });
+
+            body = document.createElement('div');
+            body.className = this.CLASS_PREFIX + '-body-cont';
+            for (var b in this.browser) {
+                if (this.browser[b]) {
+                    Dom.addClass(body, b);
+                    break;
+                }
+            }
+
+            var _note = document.createElement('h3');
+            _note.className = 'yui-editor-skipheader';
+            _note.innerHTML = this.STR_CLOSE_WINDOW_NOTE;
+            body.appendChild(_note);
+            form = document.createElement('form');
+            form.setAttribute('method', 'GET');
+            var windowName = win.name;
+            Event.on(form, 'submit', function(ev) {
+                var evName = 'window' + windowName + 'Submit';
+                self.fireEvent(evName, { type: evName, target: this });
+                Event.stopEvent(ev);
+            }, this, true);
+            body.appendChild(form);
+
+            if (Lang.isObject(win.body)) { //Assume it's a reference
+                form.appendChild(win.body);
+            } else { //Assume it's a string
+                var _tmp = document.createElement('div');
+                _tmp.innerHTML = win.body;
+                form.appendChild(_tmp);
+            }
+            var _close = document.createElement('span');
+            _close.innerHTML = 'X';
+            _close.title = this.STR_CLOSE_WINDOW;
+            _close.className = 'close';
+            Event.on(_close, 'click', function() {
+                this.closeWindow();
+            }, this, true);
+            var _knob = document.createElement('span');
+            _knob.innerHTML = '^';
+            _knob.className = 'knob';
+            win._knob = _knob;
+
+            var _header = document.createElement('h3');
+            _header.innerHTML = win.header;
+
+            panel.cfg.setProperty('width', win.attrs.width);
+            panel.setHeader(' '); //Clear the current header
+            panel.appendToHeader(_header);
+            _header.appendChild(_close);
+            _header.appendChild(_knob);
+            panel.setBody(' '); //Clear the current body
+            panel.setFooter(' '); //Clear the current footer
+            if (win.footer !== null) {
+                panel.setFooter(win.footer);
+                Dom.addClass(panel.footer, 'open');
+            } else {
+                Dom.removeClass(panel.footer, 'open');
+            }
+            panel.appendToBody(body); //Append the new DOM node to it
+            var fireShowEvent = function() {
+                panel.bringToTop();
+                Event.on(panel.element, 'click', function(ev) {
+                    Event.stopPropagation(ev);
+                });
+                this._setBusy(true);
+                panel.showEvent.unsubscribe(fireShowEvent);
+            };
+            panel.showEvent.subscribe(fireShowEvent, this, true);
+            var fireCloseEvent = function() {
+                this.currentWindow = null;
+                var evName = 'window' + windowName + 'Close';
+                this.fireEvent(evName, { type: evName, target: this });
+                panel.hideEvent.unsubscribe(fireCloseEvent);
+            };
+            panel.hideEvent.subscribe(fireCloseEvent, this, true);
+            this.currentWindow = win;
+            this.moveWindow(true);
+            panel.show();
+            this.fireEvent('afterOpenWindow', { type: 'afterOpenWindow', win: win, panel: panel });
+        },
+        /**
+        * @method moveWindow
+        * @param {Boolean} force Boolean to tell it to move but not use any animation (Usually done the first time the window is loaded.)
+        * @description Realign the window with the currentElement and reposition the knob above the panel.
+        */
+        moveWindow: function(force) {
+            if (!this.currentWindow) {
+                return false;
+            }
+            var win = this.currentWindow,
+                xy = Dom.getXY(this.currentElement[0]),
+                elXY = Dom.getXY(this.get('iframe').get('element')),
+                panel = this.get('panel'),
+                //newXY = [(xy[0] + elXY[0] - 20), (xy[1] + elXY[1] + 10)],
+                newXY = [(xy[0] + elXY[0]), (xy[1] + elXY[1])],
+                wWidth = (parseInt(win.attrs.width, 10) / 2),
+                align = 'center',
+                orgXY = panel.cfg.getProperty('xy'),
+                _knob = win._knob,
+                xDiff = 0,
+                yDiff = 0,
+                anim = false;
+
+            newXY[0] = ((newXY[0] - wWidth) + 20);
+            //Account for the Scroll bars in a scrolled editor window.
+            newXY[0] = newXY[0] - Dom.getDocumentScrollLeft(this._getDoc());
+            newXY[1] = newXY[1] - Dom.getDocumentScrollTop(this._getDoc());
+            
+
+
+            if (this._isElement(this.currentElement[0], 'img')) {
+                if (this.currentElement[0].src.indexOf(this.get('blankimage')) != -1) {
+                    newXY[0] = (newXY[0] + (75 / 2)); //Placeholder size
+                    newXY[1] = (newXY[1] + 75); //Placeholder sizea
+                } else {
+                    var w = parseInt(this.currentElement[0].width, 10);
+                    var h = parseInt(this.currentElement[0].height, 10);
+                    newXY[0] = (newXY[0] + (w / 2));
+                    newXY[1] = (newXY[1] + h);
+                }
+                newXY[1] = newXY[1] + 15;
+            } else {
+                var fs = Dom.getStyle(this.currentElement[0], 'fontSize');
+                if (fs && fs.indexOf && fs.indexOf('px') != -1) {
+                    newXY[1] = newXY[1] + parseInt(Dom.getStyle(this.currentElement[0], 'fontSize'), 10) + 5;
+                } else {
+                    newXY[1] = newXY[1] + 20;
+                }
+            }
+            if (newXY[0] < elXY[0]) {
+                newXY[0] = elXY[0] + 5;
+                align = 'left';
+            }
+
+            if ((newXY[0] + (wWidth * 2)) > (elXY[0] + parseInt(this.get('iframe').get('element').clientWidth, 10))) {
+                newXY[0] = ((elXY[0] + parseInt(this.get('iframe').get('element').clientWidth, 10)) - (wWidth * 2) - 5);
+                align = 'right';
+            }
+            
+            try {
+                xDiff = (newXY[0] - orgXY[0]);
+                yDiff = (newXY[1] - orgXY[1]);
+            } catch (e) {}
+            
+            //Convert negative numbers to positive so we can get the difference in distance
+            xDiff = ((xDiff < 0) ? (xDiff * -1) : xDiff);
+            yDiff = ((yDiff < 0) ? (yDiff * -1) : yDiff);
+
+            if (((xDiff > 10) || (yDiff > 10)) || force) { //Only move the window if it's supposed to move more than 10px or force was passed (new window)
+                var _knobLeft = 0,
+                    elW = 0;
+
+                if (this.currentElement[0].width) {
+                    elW = (parseInt(this.currentElement[0].width, 10) / 2);
+                }
+
+                var leftOffset = xy[0] + elXY[0] + elW;
+                _knobLeft = leftOffset - newXY[0];
+                //Check to see if the knob will go off either side & reposition it
+                if (_knobLeft > (parseInt(win.attrs.width, 10) - 40)) {
+                    _knobLeft = parseInt(win.attrs.width, 10) - 40;
+                } else if (_knobLeft < 40) {
+                    _knobLeft = 40;
+                }
+                if (isNaN(_knobLeft)) {
+                    _knobLeft = 40;
+                }
+                if (force) {
+                    if (_knob) {
+                        _knob.style.left = _knobLeft + 'px';
+                    }
+                    if (this.get('animate')) {
+                        Dom.setStyle(panel.element, 'opacity', '0');
+                        anim = new YAHOO.util.Anim(panel.element, {
+                            opacity: {
+                                from: 0,
+                                to: 1
+                            }
+                        }, 0.1, YAHOO.util.Easing.easeOut);
+                        panel.cfg.setProperty('xy', newXY);
+                        anim.onComplete.subscribe(function() {
+                            if (this.browser.ie) {
+                                panel.element.style.filter = 'none';
+                            }
+                        }, this, true);
+                        anim.animate();
+                    } else {
+                        panel.cfg.setProperty('xy', newXY);
+                    }
+                } else {
+                    if (this.get('animate')) {
+                        anim = new YAHOO.util.Anim(panel.element, {}, 0.5, YAHOO.util.Easing.easeOut);
+                        anim.attributes = {
+                            top: {
+                                to: newXY[1]
+                            },
+                            left: {
+                                to: newXY[0]
+                            }
+                        };
+                        anim.onComplete.subscribe(function() {
+                            panel.cfg.setProperty('xy', newXY);
+                        });
+                        //We have to animate the iframe shim at the same time as the panel or we get scrollbar bleed ..
+                        var iframeAnim = new YAHOO.util.Anim(panel.iframe, anim.attributes, 0.5, YAHOO.util.Easing.easeOut);
+
+                        var _knobAnim = new YAHOO.util.Anim(_knob, {
+                            left: {
+                                to: _knobLeft
+                            }
+                        }, 0.6, YAHOO.util.Easing.easeOut);
+                        anim.animate();
+                        iframeAnim.animate();
+                        _knobAnim.animate();
+                    } else {
+                        _knob.style.left = _knobLeft + 'px';
+                        panel.cfg.setProperty('xy', newXY);
+                    }
+                }
+            }
+        },
+        /**
+        * @private
+        * @method _closeWindow
+        * @description Close the currently open EditorWindow with the Escape key.
+        * @param {Event} ev The keypress Event that we are trapping
+        */
+        _closeWindow: function(ev) {
+            if ((ev.charCode == 87) && ev.shiftKey && ev.ctrlKey) {
+                if (this.currentWindow) {
+                    this.closeWindow();
+                }
+            }
+        },
+        /**
+        * @method closeWindow
+        * @description Close the currently open EditorWindow.
+        */
+        closeWindow: function() {
+            YAHOO.widget.EditorInfo.window = {};
+            this.fireEvent('closeWindow', { type: 'closeWindow', win: this.currentWindow });
+            this.currentWindow = null;
+            this.get('panel').hide();
+            this.get('panel').cfg.setProperty('xy', [-900,-900]);
+            this.get('panel').syncIframe(); //Needed to move the iframe with the hidden panel
+            this.unsubscribeAll('afterExecCommand');
+            this.toolbar.set('disabled', false); //enable the toolbar now that the window is closed
+            this.toolbar.resetAllButtons();
+            this._focusWindow();
+            Event.removeListener(document, 'keypress', this._closeWindow);
+        },
+        /**
+        * @method destroy
+        * @description Destroys the editor, all of it's elements and objects.
+        * @return {Boolean}
+        */
+        destroy: function() {
+            this.saveHTML();
+            this.toolbar.destroy();
+            this.setStyle('visibility', 'hidden');
+            this.setStyle('position', 'absolute');
+            this.setStyle('top', '-9999px');
+            this.setStyle('left', '-9999px');
+            var textArea = this.get('element');
+            this.get('element_cont').get('parentNode').replaceChild(textArea, this.get('element_cont').get('element'));
+            this.get('element_cont').get('element').innerHTML = '';
+            //Brutal Object Destroy
+            for (var i in this) {
+                if (Lang.hasOwnProperty(this, i)) {
+                    this[i] = null;
+                }
+            }
+            return true;
+        },        
+        /**
+        * @method toString
+        * @description Returns a string representing the editor.
+        * @return {String}
+        */
+        toString: function() {
+            var str = 'Editor';
+            if (this.get && this.get('element_cont')) {
+                str = 'Editor (#' + this.get('element_cont').get('id') + ')' + ((this.get('disabled') ? ' Disabled' : ''));
+            }
+            return str;
+        }
+    });
+
+/**
+* @event toolbarLoaded
+* @description Event is fired during the render process directly after the Toolbar is loaded. Allowing you to attach events to the toolbar. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event afterRender
+* @description Event is fired after the render process finishes. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorContentLoaded
+* @description Event is fired after the editor iframe's document fully loads and fires it's onload event. From here you can start injecting your own things into the document. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorMouseUp
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorMouseDown
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorDoubleClick
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorKeyUp
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorKeyPress
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event editorKeyDown
+* @param {Event} ev The DOM Event that occured
+* @description Passed through HTML Event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event beforeNodeChange
+* @description Event fires at the beginning of the nodeChange process. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event afterNodeChange
+* @description Event fires at the end of the nodeChange process. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event beforeExecCommand
+* @description Event fires at the beginning of the execCommand process. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event afterExecCommand
+* @description Event fires at the end of the execCommand process. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event beforeOpenWindow
+* @param {<a href="YAHOO.widget.EditorWindow.html">EditorWindow</a>} win The EditorWindow object
+* @param {Overlay} panel The Overlay object that is used to create the window.
+* @description Event fires before an Editor Window is opened. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event afterOpenWindow
+* @param {<a href="YAHOO.widget.EditorWindow.html">EditorWindow</a>} win The EditorWindow object
+* @param {Overlay} panel The Overlay object that is used to create the window.
+* @description Event fires after an Editor Window is opened. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event closeWindow
+* @param {<a href="YAHOO.widget.EditorWindow.html">EditorWindow</a>} win The EditorWindow object
+* @description Event fires after an Editor Window is closed. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event windowCMDOpen
+* @param {<a href="YAHOO.widget.EditorWindow.html">EditorWindow</a>} win The EditorWindow object
+* @param {Overlay} panel The Overlay object that is used to create the window.
+* @description Dynamic event fired when an <a href="YAHOO.widget.EditorWindow.html">EditorWindow</a> is opened.. The dynamic event is based on the name of the window. Example Window: createlink, opening this window would fire the windowcreatelinkOpen event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+/**
+* @event windowCMDClose
+* @param {<a href="YAHOO.widget.EditorWindow.html">EditorWindow</a>} win The EditorWindow object
+* @param {Overlay} panel The Overlay object that is used to create the window.
+* @description Dynamic event fired when an <a href="YAHOO.widget.EditorWindow.html">EditorWindow</a> is closed.. The dynamic event is based on the name of the window. Example Window: createlink, opening this window would fire the windowcreatelinkClose event. See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
+* @type YAHOO.util.CustomEvent
+*/
+
+/**
+     * @description Singleton object used to track the open window objects and panels across the various open editors
+     * @class EditorInfo
+     * @static
+    */
+    YAHOO.widget.EditorInfo = {
+        /**
+        * @private
+        * @property _instances
+        * @description A reference to all editors on the page.
+        * @type Object
+        */
+        _instances: {},
+        /**
+        * @private
+        * @property window
+        * @description A reference to the currently open window object in any editor on the page.
+        * @type Object <a href="YAHOO.widget.EditorWindow.html">YAHOO.widget.EditorWindow</a>
+        */
+        window: {},
+        /**
+        * @private
+        * @property panel
+        * @description A reference to the currently open panel in any editor on the page.
+        * @type Object <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>
+        */
+        panel: null,
+        /**
+        * @method getEditorById
+        * @description Returns a reference to the Editor object associated with the given textarea
+        * @param {String/HTMLElement} id The id or reference of the textarea to return the Editor instance of
+        * @returns Object <a href="YAHOO.widget.Editor.html">YAHOO.widget.Editor</a>
+        */
+        getEditorById: function(id) {
+            if (!YAHOO.lang.isString(id)) {
+                //Not a string, assume a node Reference
+                id = id.id;
+            }
+            if (this._instances[id]) {
+                return this._instances[id];
+            }
+            return false;
+        },
+        /**
+        * @method toString
+        * @description Returns a string representing the EditorInfo.
+        * @return {String}
+        */
+        toString: function() {
+            var len = 0;
+            for (var i in this._instances) {
+                len++;
+            }
+            return 'Editor Info (' + len + ' registered intance' + ((len > 1) ? 's' : '') + ')';
+        }
+    };
+
+    /**
+     * @description Class to hold Window information between uses. We use the same panel to show the windows, so using this will allow you to configure a window before it is shown.
+     * This is what you pass to Editor.openWindow();. These parameters will not take effect until the openWindow() is called in the editor.
+     * @class EditorWindow
+     * @param {String} name The name of the window.
+     * @param {Object} attrs Attributes for the window. Current attributes used are : height and width
+    */
+    YAHOO.widget.EditorWindow = function(name, attrs) {
+        /**
+        * @private
+        * @property name
+        * @description A unique name for the window
+        */
+        this.name = name.replace(' ', '_');
+        /**
+        * @private
+        * @property attrs
+        * @description The window attributes
+        */
+        this.attrs = attrs;
+    };
+
+    YAHOO.widget.EditorWindow.prototype = {
+        /**
+        * @private
+        * @property _cache
+        * @description Holds a cache of the DOM for the window so we only have to build it once..
+        */
+        _cache: null,
+        /**
+        * @private
+        * @property header
+        * @description Holder for the header of the window, used in Editor.openWindow
+        */
+        header: null,
+        /**
+        * @private
+        * @property body
+        * @description Holder for the body of the window, used in Editor.openWindow
+        */
+        body: null,
+        /**
+        * @private
+        * @property footer
+        * @description Holder for the footer of the window, used in Editor.openWindow
+        */
+        footer: null,
+        /**
+        * @method setHeader
+        * @description Sets the header for the window.
+        * @param {String/HTMLElement} str The string or DOM reference to be used as the windows header.
+        */
+        setHeader: function(str) {
+            this.header = str;
+        },
+        /**
+        * @method setBody
+        * @description Sets the body for the window.
+        * @param {String/HTMLElement} str The string or DOM reference to be used as the windows body.
+        */
+        setBody: function(str) {
+            this.body = str;
+        },
+        /**
+        * @method setFooter
+        * @description Sets the footer for the window.
+        * @param {String/HTMLElement} str The string or DOM reference to be used as the windows footer.
+        */
+        setFooter: function(str) {
+            this.footer = str;
+        },
+        /**
+        * @method toString
+        * @description Returns a string representing the EditorWindow.
+        * @return {String}
+        */
+        toString: function() {
+            return 'Editor Window (' + this.name + ')';
+        }
+    };
+
+
+    
+})();
+YAHOO.register("editor", YAHOO.widget.Editor, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/element-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/element-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/element-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,967 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * Provides Attribute configurations.
+ * @namespace YAHOO.util
+ * @class Attribute
+ * @constructor
+ * @param hash {Object} The intial Attribute.
+ * @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
+ */
+
+YAHOO.util.Attribute = function(hash, owner) {
+    if (owner) { 
+        this.owner = owner;
+        this.configure(hash, true);
+    }
+};
+
+YAHOO.util.Attribute.prototype = {
+	/**
+     * The name of the attribute.
+	 * @property name
+	 * @type String
+	 */
+    name: undefined,
+    
+	/**
+     * The value of the attribute.
+	 * @property value
+	 * @type String
+	 */
+    value: null,
+    
+	/**
+     * The owner of the attribute.
+	 * @property owner
+	 * @type YAHOO.util.AttributeProvider
+	 */
+    owner: null,
+    
+	/**
+     * Whether or not the attribute is read only.
+	 * @property readOnly
+	 * @type Boolean
+	 */
+    readOnly: false,
+    
+	/**
+     * Whether or not the attribute can only be written once.
+	 * @property writeOnce
+	 * @type Boolean
+	 */
+    writeOnce: false,
+
+	/**
+     * The attribute's initial configuration.
+     * @private
+	 * @property _initialConfig
+	 * @type Object
+	 */
+    _initialConfig: null,
+    
+	/**
+     * Whether or not the attribute's value has been set.
+     * @private
+	 * @property _written
+	 * @type Boolean
+	 */
+    _written: false,
+    
+	/**
+     * The method to use when setting the attribute's value.
+     * The method recieves the new value as the only argument.
+	 * @property method
+	 * @type Function
+	 */
+    method: null,
+    
+	/**
+     * The validator to use when setting the attribute's value.
+	 * @property validator
+	 * @type Function
+     * @return Boolean
+	 */
+    validator: null,
+    
+    /**
+     * Retrieves the current value of the attribute.
+     * @method getValue
+     * @return {any} The current value of the attribute.
+     */
+    getValue: function() {
+        return this.value;
+    },
+    
+    /**
+     * Sets the value of the attribute and fires beforeChange and change events.
+     * @method setValue
+     * @param {Any} value The value to apply to the attribute.
+     * @param {Boolean} silent If true the change events will not be fired.
+     * @return {Boolean} Whether or not the value was set.
+     */
+    setValue: function(value, silent) {
+        var beforeRetVal;
+        var owner = this.owner;
+        var name = this.name;
+        
+        var event = {
+            type: name, 
+            prevValue: this.getValue(),
+            newValue: value
+        };
+        
+        if (this.readOnly || ( this.writeOnce && this._written) ) {
+            return false; // write not allowed
+        }
+        
+        if (this.validator && !this.validator.call(owner, value) ) {
+            return false; // invalid value
+        }
+
+        if (!silent) {
+            beforeRetVal = owner.fireBeforeChangeEvent(event);
+            if (beforeRetVal === false) {
+                return false;
+            }
+        }
+
+        if (this.method) {
+            this.method.call(owner, value);
+        }
+        
+        this.value = value;
+        this._written = true;
+        
+        event.type = name;
+        
+        if (!silent) {
+            this.owner.fireChangeEvent(event);
+        }
+        
+        return true;
+    },
+    
+    /**
+     * Allows for configuring the Attribute's properties.
+     * @method configure
+     * @param {Object} map A key-value map of Attribute properties.
+     * @param {Boolean} init Whether or not this should become the initial config.
+     */
+    configure: function(map, init) {
+        map = map || {};
+        this._written = false; // reset writeOnce
+        this._initialConfig = this._initialConfig || {};
+        
+        for (var key in map) {
+            if ( key && YAHOO.lang.hasOwnProperty(map, key) ) {
+                this[key] = map[key];
+                if (init) {
+                    this._initialConfig[key] = map[key];
+                }
+            }
+        }
+    },
+    
+    /**
+     * Resets the value to the initial config value.
+     * @method resetValue
+     * @return {Boolean} Whether or not the value was set.
+     */
+    resetValue: function() {
+        return this.setValue(this._initialConfig.value);
+    },
+    
+    /**
+     * Resets the attribute config to the initial config state.
+     * @method resetConfig
+     */
+    resetConfig: function() {
+        this.configure(this._initialConfig);
+    },
+    
+    /**
+     * Resets the value to the current value.
+     * Useful when values may have gotten out of sync with actual properties.
+     * @method refresh
+     * @return {Boolean} Whether or not the value was set.
+     */
+    refresh: function(silent) {
+        this.setValue(this.value, silent);
+    }
+};
+
+(function() {
+    var Lang = YAHOO.util.Lang;
+
+    /*
+    Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+    Code licensed under the BSD License:
+    http://developer.yahoo.net/yui/license.txt
+    */
+    
+    /**
+     * Provides and manages YAHOO.util.Attribute instances
+     * @namespace YAHOO.util
+     * @class AttributeProvider
+     * @uses YAHOO.util.EventProvider
+     */
+    YAHOO.util.AttributeProvider = function() {};
+
+    YAHOO.util.AttributeProvider.prototype = {
+        
+        /**
+         * A key-value map of Attribute configurations
+         * @property _configs
+         * @protected (may be used by subclasses and augmentors)
+         * @private
+         * @type {Object}
+         */
+        _configs: null,
+        /**
+         * Returns the current value of the attribute.
+         * @method get
+         * @param {String} key The attribute whose value will be returned.
+         */
+        get: function(key){
+            this._configs = this._configs || {};
+            var config = this._configs[key];
+            
+            if (!config) {
+                return undefined;
+            }
+            
+            return config.value;
+        },
+        
+        /**
+         * Sets the value of a config.
+         * @method set
+         * @param {String} key The name of the attribute
+         * @param {Any} value The value to apply to the attribute
+         * @param {Boolean} silent Whether or not to suppress change events
+         * @return {Boolean} Whether or not the value was set.
+         */
+        set: function(key, value, silent){
+            this._configs = this._configs || {};
+            var config = this._configs[key];
+            
+            if (!config) {
+                return false;
+            }
+            
+            return config.setValue(value, silent);
+        },
+    
+        /**
+         * Returns an array of attribute names.
+         * @method getAttributeKeys
+         * @return {Array} An array of attribute names.
+         */
+        getAttributeKeys: function(){
+            this._configs = this._configs;
+            var keys = [];
+            var config;
+            for (var key in this._configs) {
+                config = this._configs[key];
+                if ( Lang.hasOwnProperty(this._configs, key) && 
+                        !Lang.isUndefined(config) ) {
+                    keys[keys.length] = key;
+                }
+            }
+            
+            return keys;
+        },
+        
+        /**
+         * Sets multiple attribute values.
+         * @method setAttributes
+         * @param {Object} map  A key-value map of attributes
+         * @param {Boolean} silent Whether or not to suppress change events
+         */
+        setAttributes: function(map, silent){
+            for (var key in map) {
+                if ( Lang.hasOwnProperty(map, key) ) {
+                    this.set(key, map[key], silent);
+                }
+            }
+        },
+    
+        /**
+         * Resets the specified attribute's value to its initial value.
+         * @method resetValue
+         * @param {String} key The name of the attribute
+         * @param {Boolean} silent Whether or not to suppress change events
+         * @return {Boolean} Whether or not the value was set
+         */
+        resetValue: function(key, silent){
+            this._configs = this._configs || {};
+            if (this._configs[key]) {
+                this.set(key, this._configs[key]._initialConfig.value, silent);
+                return true;
+            }
+            return false;
+        },
+    
+        /**
+         * Sets the attribute's value to its current value.
+         * @method refresh
+         * @param {String | Array} key The attribute(s) to refresh
+         * @param {Boolean} silent Whether or not to suppress change events
+         */
+        refresh: function(key, silent){
+            this._configs = this._configs;
+            
+            key = ( ( Lang.isString(key) ) ? [key] : key ) || 
+                    this.getAttributeKeys();
+            
+            for (var i = 0, len = key.length; i < len; ++i) { 
+                if ( // only set if there is a value and not null
+                    this._configs[key[i]] && 
+                    ! Lang.isUndefined(this._configs[key[i]].value) &&
+                    ! Lang.isNull(this._configs[key[i]].value) ) {
+                    this._configs[key[i]].refresh(silent);
+                }
+            }
+        },
+    
+        /**
+         * Adds an Attribute to the AttributeProvider instance. 
+         * @method register
+         * @param {String} key The attribute's name
+         * @param {Object} map A key-value map containing the
+         * attribute's properties.
+         * @deprecated Use setAttributeConfig
+         */
+        register: function(key, map) {
+            this.setAttributeConfig(key, map);
+        },
+        
+        
+        /**
+         * Returns the attribute's properties.
+         * @method getAttributeConfig
+         * @param {String} key The attribute's name
+         * @private
+         * @return {object} A key-value map containing all of the
+         * attribute's properties.
+         */
+        getAttributeConfig: function(key) {
+            this._configs = this._configs || {};
+            var config = this._configs[key] || {};
+            var map = {}; // returning a copy to prevent overrides
+            
+            for (key in config) {
+                if ( Lang.hasOwnProperty(config, key) ) {
+                    map[key] = config[key];
+                }
+            }
+    
+            return map;
+        },
+        
+        /**
+         * Sets or updates an Attribute instance's properties. 
+         * @method setAttributeConfig
+         * @param {String} key The attribute's name.
+         * @param {Object} map A key-value map of attribute properties
+         * @param {Boolean} init Whether or not this should become the intial config.
+         */
+        setAttributeConfig: function(key, map, init) {
+            this._configs = this._configs || {};
+            map = map || {};
+            if (!this._configs[key]) {
+                map.name = key;
+                this._configs[key] = this.createAttribute(map);
+            } else {
+                this._configs[key].configure(map, init);
+            }
+        },
+        
+        /**
+         * Sets or updates an Attribute instance's properties. 
+         * @method configureAttribute
+         * @param {String} key The attribute's name.
+         * @param {Object} map A key-value map of attribute properties
+         * @param {Boolean} init Whether or not this should become the intial config.
+         * @deprecated Use setAttributeConfig
+         */
+        configureAttribute: function(key, map, init) {
+            this.setAttributeConfig(key, map, init);
+        },
+        
+        /**
+         * Resets an attribute to its intial configuration. 
+         * @method resetAttributeConfig
+         * @param {String} key The attribute's name.
+         * @private
+         */
+        resetAttributeConfig: function(key){
+            this._configs = this._configs || {};
+            this._configs[key].resetConfig();
+        },
+        
+        // wrapper for EventProvider.subscribe
+        // to create events on the fly
+        subscribe: function(type, callback) {
+            this._events = this._events || {};
+
+            if ( !(type in this._events) ) {
+                this._events[type] = this.createEvent(type);
+            }
+
+            YAHOO.util.EventProvider.prototype.subscribe.apply(this, arguments);
+        },
+
+        on: function() {
+            this.subscribe.apply(this, arguments);
+        },
+
+        addListener: function() {
+            this.subscribe.apply(this, arguments);
+        },
+
+        /**
+         * Fires the attribute's beforeChange event. 
+         * @method fireBeforeChangeEvent
+         * @param {String} key The attribute's name.
+         * @param {Obj} e The event object to pass to handlers.
+         */
+        fireBeforeChangeEvent: function(e) {
+            var type = 'before';
+            type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
+            e.type = type;
+            return this.fireEvent(e.type, e);
+        },
+        
+        /**
+         * Fires the attribute's change event. 
+         * @method fireChangeEvent
+         * @param {String} key The attribute's name.
+         * @param {Obj} e The event object to pass to the handlers.
+         */
+        fireChangeEvent: function(e) {
+            e.type += 'Change';
+            return this.fireEvent(e.type, e);
+        },
+
+        createAttribute: function(map) {
+            return new YAHOO.util.Attribute(map, this);
+        }
+    };
+    
+    YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
+})();
+
+(function() {
+// internal shorthand
+var Dom = YAHOO.util.Dom,
+    AttributeProvider = YAHOO.util.AttributeProvider;
+
+/**
+ * Element provides an wrapper object to simplify adding
+ * event listeners, using dom methods, and managing attributes. 
+ * @module element
+ * @namespace YAHOO.util
+ * @requires yahoo, dom, event
+ * @beta
+ */
+
+/**
+ * Element provides an wrapper object to simplify adding
+ * event listeners, using dom methods, and managing attributes. 
+ * @class Element
+ * @uses YAHOO.util.AttributeProvider
+ * @constructor
+ * @param el {HTMLElement | String} The html element that 
+ * represents the Element.
+ * @param {Object} map A key-value map of initial config names and values
+ */
+YAHOO.util.Element = function(el, map) {
+    if (arguments.length) {
+        this.init(el, map);
+    }
+};
+
+YAHOO.util.Element.prototype = {
+    /**
+     * Dom events supported by the Element instance.
+     * @property DOM_EVENTS
+     * @type Object
+     */
+    DOM_EVENTS: null,
+
+    /**
+     * Wrapper for HTMLElement method.
+     * @method appendChild
+     * @param {YAHOO.util.Element || HTMLElement} child The element to append. 
+     */
+    appendChild: function(child) {
+        child = child.get ? child.get('element') : child;
+        this.get('element').appendChild(child);
+    },
+    
+    /**
+     * Wrapper for HTMLElement method.
+     * @method getElementsByTagName
+     * @param {String} tag The tagName to collect
+     */
+    getElementsByTagName: function(tag) {
+        return this.get('element').getElementsByTagName(tag);
+    },
+    
+    /**
+     * Wrapper for HTMLElement method.
+     * @method hasChildNodes
+     * @return {Boolean} Whether or not the element has childNodes
+     */
+    hasChildNodes: function() {
+        return this.get('element').hasChildNodes();
+    },
+    
+    /**
+     * Wrapper for HTMLElement method.
+     * @method insertBefore
+     * @param {HTMLElement} element The HTMLElement to insert
+     * @param {HTMLElement} before The HTMLElement to insert
+     * the element before.
+     */
+    insertBefore: function(element, before) {
+        element = element.get ? element.get('element') : element;
+        before = (before && before.get) ? before.get('element') : before;
+        
+        this.get('element').insertBefore(element, before);
+    },
+    
+    /**
+     * Wrapper for HTMLElement method.
+     * @method removeChild
+     * @param {HTMLElement} child The HTMLElement to remove
+     */
+    removeChild: function(child) {
+        child = child.get ? child.get('element') : child;
+        this.get('element').removeChild(child);
+        return true;
+    },
+    
+    /**
+     * Wrapper for HTMLElement method.
+     * @method replaceChild
+     * @param {HTMLElement} newNode The HTMLElement to insert
+     * @param {HTMLElement} oldNode The HTMLElement to replace
+     */
+    replaceChild: function(newNode, oldNode) {
+        newNode = newNode.get ? newNode.get('element') : newNode;
+        oldNode = oldNode.get ? oldNode.get('element') : oldNode;
+        return this.get('element').replaceChild(newNode, oldNode);
+    },
+
+    
+    /**
+     * Registers Element specific attributes.
+     * @method initAttributes
+     * @param {Object} map A key-value map of initial attribute configs
+     */
+    initAttributes: function(map) {
+    },
+
+    /**
+     * Adds a listener for the given event.  These may be DOM or 
+     * customEvent listeners.  Any event that is fired via fireEvent
+     * can be listened for.  All handlers receive an event object. 
+     * @method addListener
+     * @param {String} type The name of the event to listen for
+     * @param {Function} fn The handler to call when the event fires
+     * @param {Any} obj A variable to pass to the handler
+     * @param {Object} scope The object to use for the scope of the handler 
+     */
+    addListener: function(type, fn, obj, scope) {
+        var el = this.get('element');
+        scope = scope || this;
+        
+        el = this.get('id') || el;
+        var self = this; 
+        if (!this._events[type]) { // create on the fly
+            if ( this.DOM_EVENTS[type] ) {
+                YAHOO.util.Event.addListener(el, type, function(e) {
+                    if (e.srcElement && !e.target) { // supplement IE with target
+                        e.target = e.srcElement;
+                    }
+                    self.fireEvent(type, e);
+                }, obj, scope);
+            }
+            
+            this.createEvent(type, this);
+        }
+        
+        YAHOO.util.EventProvider.prototype.subscribe.apply(this, arguments); // notify via customEvent
+    },
+    
+    
+    /**
+     * Alias for addListener
+     * @method on
+     * @param {String} type The name of the event to listen for
+     * @param {Function} fn The function call when the event fires
+     * @param {Any} obj A variable to pass to the handler
+     * @param {Object} scope The object to use for the scope of the handler 
+     */
+    on: function() { this.addListener.apply(this, arguments); },
+    
+    /**
+     * Alias for addListener
+     * @method subscribe
+     * @param {String} type The name of the event to listen for
+     * @param {Function} fn The function call when the event fires
+     * @param {Any} obj A variable to pass to the handler
+     * @param {Object} scope The object to use for the scope of the handler 
+     */
+    subscribe: function() { this.addListener.apply(this, arguments); },
+    
+    /**
+     * Remove an event listener
+     * @method removeListener
+     * @param {String} type The name of the event to listen for
+     * @param {Function} fn The function call when the event fires
+     */
+    removeListener: function(type, fn) {
+        this.unsubscribe.apply(this, arguments);
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method addClass
+     * @param {String} className The className to add
+     */
+    addClass: function(className) {
+        Dom.addClass(this.get('element'), className);
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method getElementsByClassName
+     * @param {String} className The className to collect
+     * @param {String} tag (optional) The tag to use in
+     * conjunction with class name
+     * @return {Array} Array of HTMLElements
+     */
+    getElementsByClassName: function(className, tag) {
+        return Dom.getElementsByClassName(className, tag,
+                this.get('element') );
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method hasClass
+     * @param {String} className The className to add
+     * @return {Boolean} Whether or not the element has the class name
+     */
+    hasClass: function(className) {
+        return Dom.hasClass(this.get('element'), className); 
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method removeClass
+     * @param {String} className The className to remove
+     */
+    removeClass: function(className) {
+        return Dom.removeClass(this.get('element'), className);
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method replaceClass
+     * @param {String} oldClassName The className to replace
+     * @param {String} newClassName The className to add
+     */
+    replaceClass: function(oldClassName, newClassName) {
+        return Dom.replaceClass(this.get('element'), 
+                oldClassName, newClassName);
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method setStyle
+     * @param {String} property The style property to set
+     * @param {String} value The value to apply to the style property
+     */
+    setStyle: function(property, value) {
+        var el = this.get('element');
+        if (!el) {
+            return this._queue[this._queue.length] = ['setStyle', arguments];
+        }
+
+        return Dom.setStyle(el,  property, value); // TODO: always queuing?
+    },
+    
+    /**
+     * Wrapper for Dom method.
+     * @method getStyle
+     * @param {String} property The style property to retrieve
+     * @return {String} The current value of the property
+     */
+    getStyle: function(property) {
+        return Dom.getStyle(this.get('element'),  property);
+    },
+    
+    /**
+     * Apply any queued set calls.
+     * @method fireQueue
+     */
+    fireQueue: function() {
+        var queue = this._queue;
+        for (var i = 0, len = queue.length; i < len; ++i) {
+            this[queue[i][0]].apply(this, queue[i][1]);
+        }
+    },
+    
+    /**
+     * Appends the HTMLElement into either the supplied parentNode.
+     * @method appendTo
+     * @param {HTMLElement | Element} parentNode The node to append to
+     * @param {HTMLElement | Element} before An optional node to insert before
+     */
+    appendTo: function(parent, before) {
+        parent = (parent.get) ?  parent.get('element') : Dom.get(parent);
+        
+        this.fireEvent('beforeAppendTo', {
+            type: 'beforeAppendTo',
+            target: parent
+        });
+        
+        
+        before = (before && before.get) ? 
+                before.get('element') : Dom.get(before);
+        var element = this.get('element');
+        
+        if (!element) {
+            return false;
+        }
+        
+        if (!parent) {
+            return false;
+        }
+        
+        if (element.parent != parent) {
+            if (before) {
+                parent.insertBefore(element, before);
+            } else {
+                parent.appendChild(element);
+            }
+        }
+        
+        
+        this.fireEvent('appendTo', {
+            type: 'appendTo',
+            target: parent
+        });
+    },
+    
+    get: function(key) {
+        var configs = this._configs || {};
+        var el = configs.element; // avoid loop due to 'element'
+        if (el && !configs[key] && !YAHOO.lang.isUndefined(el.value[key]) ) {
+            return el.value[key];
+        }
+
+        return AttributeProvider.prototype.get.call(this, key);
+    },
+
+    setAttributes: function(map, silent){
+        var el = this.get('element');
+        for (var key in map) {
+            // need to configure if setting unconfigured HTMLElement attribute 
+            if ( !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
+                this.setAttributeConfig(key);
+            }
+        }
+
+        // set based on configOrder
+        for (var i = 0, len = this._configOrder.length; i < len; ++i) {
+            if (map[this._configOrder[i]]) {
+                this.set(this._configOrder[i], map[this._configOrder[i]], silent);
+            }
+        }
+    },
+
+    set: function(key, value, silent) {
+        var el = this.get('element');
+        if (!el) {
+            this._queue[this._queue.length] = ['set', arguments];
+            if (this._configs[key]) {
+                this._configs[key].value = value; // so "get" works while queueing
+            
+            }
+            return;
+        }
+        
+        // set it on the element if not configured and is an HTML attribute
+        if ( !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
+            _registerHTMLAttr.call(this, key);
+        }
+
+        return AttributeProvider.prototype.set.apply(this, arguments);
+    },
+    
+    setAttributeConfig: function(key, map, init) {
+        var el = this.get('element');
+
+        if (el && !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
+            _registerHTMLAttr.call(this, key, map);
+        } else {
+            AttributeProvider.prototype.setAttributeConfig.apply(this, arguments);
+        }
+        this._configOrder.push(key);
+    },
+    
+    getAttributeKeys: function() {
+        var el = this.get('element');
+        var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
+        
+        //add any unconfigured element keys
+        for (var key in el) {
+            if (!this._configs[key]) {
+                keys[key] = keys[key] || el[key];
+            }
+        }
+        
+        return keys;
+    },
+
+    createEvent: function(type, scope) {
+        this._events[type] = true;
+        AttributeProvider.prototype.createEvent.apply(this, arguments);
+    },
+    
+    init: function(el, attr) {
+        _initElement.apply(this, arguments); 
+    }
+};
+
+var _initElement = function(el, attr) {
+    this._queue = this._queue || [];
+    this._events = this._events || {};
+    this._configs = this._configs || {};
+    this._configOrder = []; 
+    attr = attr || {};
+    attr.element = attr.element || el || null;
+
+    this.DOM_EVENTS = {
+        'click': true,
+        'dblclick': true,
+        'keydown': true,
+        'keypress': true,
+        'keyup': true,
+        'mousedown': true,
+        'mousemove': true,
+        'mouseout': true, 
+        'mouseover': true, 
+        'mouseup': true,
+        'focus': true,
+        'blur': true,
+        'submit': true
+    };
+
+    var isReady = false;  // to determine when to init HTMLElement and content
+
+    if (YAHOO.lang.isString(el) ) { // defer until available/ready
+        _registerHTMLAttr.call(this, 'id', { value: attr.element });
+    }
+
+    if (Dom.get(el)) {
+        isReady = true;
+        _initHTMLElement.call(this, attr);
+        _initContent.call(this, attr);
+    } 
+
+    YAHOO.util.Event.onAvailable(attr.element, function() {
+        if (!isReady) { // otherwise already done
+            _initHTMLElement.call(this, attr);
+        }
+
+        this.fireEvent('available', { type: 'available', target: attr.element });  
+    }, this, true);
+    
+    YAHOO.util.Event.onContentReady(attr.element, function() {
+        if (!isReady) { // otherwise already done
+            _initContent.call(this, attr);
+        }
+        this.fireEvent('contentReady', { type: 'contentReady', target: attr.element });  
+    }, this, true);
+};
+
+var _initHTMLElement = function(attr) {
+    /**
+     * The HTMLElement the Element instance refers to.
+     * @attribute element
+     * @type HTMLElement
+     */
+    this.setAttributeConfig('element', {
+        value: Dom.get(attr.element),
+        readOnly: true
+     });
+};
+
+var _initContent = function(attr) {
+    this.initAttributes(attr);
+    this.setAttributes(attr, true);
+    this.fireQueue();
+
+};
+
+/**
+ * Sets the value of the property and fires beforeChange and change events.
+ * @private
+ * @method _registerHTMLAttr
+ * @param {YAHOO.util.Element} element The Element instance to
+ * register the config to.
+ * @param {String} key The name of the config to register
+ * @param {Object} map A key-value map of the config's params
+ */
+var _registerHTMLAttr = function(key, map) {
+    var el = this.get('element');
+    map = map || {};
+    map.name = key;
+    map.method = map.method || function(value) {
+        el[key] = value;
+    };
+    map.value = map.value || el[key];
+    this._configs[key] = new YAHOO.util.Attribute(map, this);
+};
+
+/**
+ * Fires when the Element's HTMLElement can be retrieved by Id.
+ * <p>See: <a href="#addListener">Element.addListener</a></p>
+ * <p><strong>Event fields:</strong><br>
+ * <code>&lt;String&gt; type</code> available<br>
+ * <code>&lt;HTMLElement&gt;
+ * target</code> the HTMLElement bound to this Element instance<br>
+ * <p><strong>Usage:</strong><br>
+ * <code>var handler = function(e) {var target = e.target};<br>
+ * myTabs.addListener('available', handler);</code></p>
+ * @event available
+ */
+ 
+/**
+ * Fires when the Element's HTMLElement subtree is rendered.
+ * <p>See: <a href="#addListener">Element.addListener</a></p>
+ * <p><strong>Event fields:</strong><br>
+ * <code>&lt;String&gt; type</code> contentReady<br>
+ * <code>&lt;HTMLElement&gt;
+ * target</code> the HTMLElement bound to this Element instance<br>
+ * <p><strong>Usage:</strong><br>
+ * <code>var handler = function(e) {var target = e.target};<br>
+ * myTabs.addListener('contentReady', handler);</code></p>
+ * @event contentReady
+ */
+
+
+YAHOO.augment(YAHOO.util.Element, AttributeProvider);
+})();
+
+YAHOO.register("element", YAHOO.util.Element, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/event.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/event.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/event.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,2374 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+
+/**
+ * The CustomEvent class lets you define events for your application
+ * that can be subscribed to by one or more independent component.
+ *
+ * @param {String}  type The type of event, which is passed to the callback
+ *                  when the event fires
+ * @param {Object}  oScope The context the event will fire from.  "this" will
+ *                  refer to this object in the callback.  Default value: 
+ *                  the window object.  The listener can override this.
+ * @param {boolean} silent pass true to prevent the event from writing to
+ *                  the debugsystem
+ * @param {int}     signature the signature that the custom event subscriber
+ *                  will receive. YAHOO.util.CustomEvent.LIST or 
+ *                  YAHOO.util.CustomEvent.FLAT.  The default is
+ *                  YAHOO.util.CustomEvent.LIST.
+ * @namespace YAHOO.util
+ * @class CustomEvent
+ * @constructor
+ */
+YAHOO.util.CustomEvent = function(type, oScope, silent, signature) {
+
+    /**
+     * The type of event, returned to subscribers when the event fires
+     * @property type
+     * @type string
+     */
+    this.type = type;
+
+    /**
+     * The scope the the event will fire from by default.  Defaults to the window 
+     * obj
+     * @property scope
+     * @type object
+     */
+    this.scope = oScope || window;
+
+    /**
+     * By default all custom events are logged in the debug build, set silent
+     * to true to disable debug outpu for this event.
+     * @property silent
+     * @type boolean
+     */
+    this.silent = silent;
+
+    /**
+     * Custom events support two styles of arguments provided to the event
+     * subscribers.  
+     * <ul>
+     * <li>YAHOO.util.CustomEvent.LIST: 
+     *   <ul>
+     *   <li>param1: event name</li>
+     *   <li>param2: array of arguments sent to fire</li>
+     *   <li>param3: <optional> a custom object supplied by the subscriber</li>
+     *   </ul>
+     * </li>
+     * <li>YAHOO.util.CustomEvent.FLAT
+     *   <ul>
+     *   <li>param1: the first argument passed to fire.  If you need to
+     *           pass multiple parameters, use and array or object literal</li>
+     *   <li>param2: <optional> a custom object supplied by the subscriber</li>
+     *   </ul>
+     * </li>
+     * </ul>
+     *   @property signature
+     *   @type int
+     */
+    this.signature = signature || YAHOO.util.CustomEvent.LIST;
+
+    /**
+     * The subscribers to this event
+     * @property subscribers
+     * @type Subscriber[]
+     */
+    this.subscribers = [];
+
+    if (!this.silent) {
+    }
+
+    var onsubscribeType = "_YUICEOnSubscribe";
+
+    // Only add subscribe events for events that are not generated by 
+    // CustomEvent
+    if (type !== onsubscribeType) {
+
+        /**
+         * Custom events provide a custom event that fires whenever there is
+         * a new subscriber to the event.  This provides an opportunity to
+         * handle the case where there is a non-repeating event that has
+         * already fired has a new subscriber.  
+         *
+         * @event subscribeEvent
+         * @type YAHOO.util.CustomEvent
+         * @param {Function} fn The function to execute
+         * @param {Object}   obj An object to be passed along when the event 
+         *                       fires
+         * @param {boolean|Object}  override If true, the obj passed in becomes 
+         *                                   the execution scope of the listener.
+         *                                   if an object, that object becomes the
+         *                                   the execution scope.
+         */
+        this.subscribeEvent = 
+                new YAHOO.util.CustomEvent(onsubscribeType, this, true);
+
+    } 
+
+
+    /**
+     * In order to make it possible to execute the rest of the subscriber
+     * stack when one thows an exception, the subscribers exceptions are
+     * caught.  The most recent exception is stored in this property
+     * @property lastError
+     * @type Error
+     */
+    this.lastError = null;
+};
+
+/**
+ * Subscriber listener sigature constant.  The LIST type returns three
+ * parameters: the event type, the array of args passed to fire, and
+ * the optional custom object
+ * @property YAHOO.util.CustomEvent.LIST
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.LIST = 0;
+
+/**
+ * Subscriber listener sigature constant.  The FLAT type returns two
+ * parameters: the first argument passed to fire and the optional 
+ * custom object
+ * @property YAHOO.util.CustomEvent.FLAT
+ * @static
+ * @type int
+ */
+YAHOO.util.CustomEvent.FLAT = 1;
+
+YAHOO.util.CustomEvent.prototype = {
+
+    /**
+     * Subscribes the caller to this event
+     * @method subscribe
+     * @param {Function} fn        The function to execute
+     * @param {Object}   obj       An object to be passed along when the event 
+     *                             fires
+     * @param {boolean|Object}  override If true, the obj passed in becomes 
+     *                                   the execution scope of the listener.
+     *                                   if an object, that object becomes the
+     *                                   the execution scope.
+     */
+    subscribe: function(fn, obj, override) {
+
+        if (!fn) {
+throw new Error("Invalid callback for subscriber to '" + this.type + "'");
+        }
+
+        if (this.subscribeEvent) {
+            this.subscribeEvent.fire(fn, obj, override);
+        }
+
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, override) );
+    },
+
+    /**
+     * Unsubscribes subscribers.
+     * @method unsubscribe
+     * @param {Function} fn  The subscribed function to remove, if not supplied
+     *                       all will be removed
+     * @param {Object}   obj  The custom object passed to subscribe.  This is
+     *                        optional, but if supplied will be used to
+     *                        disambiguate multiple listeners that are the same
+     *                        (e.g., you subscribe many object using a function
+     *                        that lives on the prototype)
+     * @return {boolean} True if the subscriber was found and detached.
+     */
+    unsubscribe: function(fn, obj) {
+
+        if (!fn) {
+            return this.unsubscribeAll();
+        }
+
+        var found = false;
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s && s.contains(fn, obj)) {
+                this._delete(i);
+                found = true;
+            }
+        }
+
+        return found;
+    },
+
+    /**
+     * Notifies the subscribers.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the 
+     * following parameters:
+     *   <ul>
+     *   <li>The type of event</li>
+     *   <li>All of the arguments fire() was executed with as an array</li>
+     *   <li>The custom object (if any) that was passed into the subscribe() 
+     *       method</li>
+     *   </ul>
+     * @method fire 
+     * @param {Object*} arguments an arbitrary set of parameters to pass to 
+     *                            the handler.
+     * @return {boolean} false if one of the subscribers returned false, 
+     *                   true otherwise
+     */
+    fire: function() {
+        var len=this.subscribers.length;
+        if (!len && this.silent) {
+            return true;
+        }
+
+        var args=[], ret=true, i, rebuild=false;
+
+        for (i=0; i<arguments.length; ++i) {
+            args.push(arguments[i]);
+        }
+
+        var argslength = args.length;
+
+        if (!this.silent) {
+        }
+
+        for (i=0; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (!s) {
+                rebuild=true;
+            } else {
+                if (!this.silent) {
+                }
+
+                var scope = s.getScope(this.scope);
+
+                if (this.signature == YAHOO.util.CustomEvent.FLAT) {
+                    var param = null;
+                    if (args.length > 0) {
+                        param = args[0];
+                    }
+
+                    try {
+                        ret = s.fn.call(scope, param, s.obj);
+                    } catch(e) {
+                        this.lastError = e;
+                    }
+                } else {
+                    try {
+                        ret = s.fn.call(scope, this.type, args, s.obj);
+                    } catch(e) {
+                        this.lastError = e;
+                    }
+                }
+                if (false === ret) {
+                    if (!this.silent) {
+                    }
+
+                    //break;
+                    return false;
+                }
+            }
+        }
+
+        if (rebuild) {
+            var newlist=[],subs=this.subscribers;
+            for (i=0,len=subs.length; i<len; i=i+1) {
+                newlist.push(subs[i]);
+            }
+
+            this.subscribers=newlist;
+        }
+
+        return true;
+    },
+
+    /**
+     * Removes all listeners
+     * @method unsubscribeAll
+     * @return {int} The number of listeners unsubscribed
+     */
+    unsubscribeAll: function() {
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            this._delete(len - 1 - i);
+        }
+
+        this.subscribers=[];
+
+        return i;
+    },
+
+    /**
+     * @method _delete
+     * @private
+     */
+    _delete: function(index) {
+        var s = this.subscribers[index];
+        if (s) {
+            delete s.fn;
+            delete s.obj;
+        }
+
+        this.subscribers[index]=null;
+    },
+
+    /**
+     * @method toString
+     */
+    toString: function() {
+         return "CustomEvent: " + "'" + this.type  + "', " + 
+             "scope: " + this.scope;
+
+    }
+};
+
+/////////////////////////////////////////////////////////////////////
+
+/**
+ * Stores the subscriber information to be used when the event fires.
+ * @param {Function} fn       The function to execute
+ * @param {Object}   obj      An object to be passed along when the event fires
+ * @param {boolean}  override If true, the obj passed in becomes the execution
+ *                            scope of the listener
+ * @class Subscriber
+ * @constructor
+ */
+YAHOO.util.Subscriber = function(fn, obj, override) {
+
+    /**
+     * The callback that will be execute when the event fires
+     * @property fn
+     * @type function
+     */
+    this.fn = fn;
+
+    /**
+     * An optional custom object that will passed to the callback when
+     * the event fires
+     * @property obj
+     * @type object
+     */
+    this.obj = YAHOO.lang.isUndefined(obj) ? null : obj;
+
+    /**
+     * The default execution scope for the event listener is defined when the
+     * event is created (usually the object which contains the event).
+     * By setting override to true, the execution scope becomes the custom
+     * object passed in by the subscriber.  If override is an object, that 
+     * object becomes the scope.
+     * @property override
+     * @type boolean|object
+     */
+    this.override = override;
+
+};
+
+/**
+ * Returns the execution scope for this listener.  If override was set to true
+ * the custom obj will be the scope.  If override is an object, that is the
+ * scope, otherwise the default scope will be used.
+ * @method getScope
+ * @param {Object} defaultScope the scope to use if this listener does not
+ *                              override it.
+ */
+YAHOO.util.Subscriber.prototype.getScope = function(defaultScope) {
+    if (this.override) {
+        if (this.override === true) {
+            return this.obj;
+        } else {
+            return this.override;
+        }
+    }
+    return defaultScope;
+};
+
+/**
+ * Returns true if the fn and obj match this objects properties.
+ * Used by the unsubscribe method to match the right subscriber.
+ *
+ * @method contains
+ * @param {Function} fn the function to execute
+ * @param {Object} obj an object to be passed along when the event fires
+ * @return {boolean} true if the supplied arguments match this 
+ *                   subscriber's signature.
+ */
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {
+    if (obj) {
+        return (this.fn == fn && this.obj == obj);
+    } else {
+        return (this.fn == fn);
+    }
+};
+
+/**
+ * @method toString
+ */
+YAHOO.util.Subscriber.prototype.toString = function() {
+    return "Subscriber { obj: " + this.obj  + 
+           ", override: " +  (this.override || "no") + " }";
+};
+
+/**
+ * The Event Utility provides utilities for managing DOM Events and tools
+ * for building event systems
+ *
+ * @module event
+ * @title Event Utility
+ * @namespace YAHOO.util
+ * @requires yahoo
+ */
+
+// The first instance of Event will win if it is loaded more than once.
+// @TODO this needs to be changed so that only the state data that needs to
+// be preserved is kept, while methods are overwritten/added as needed.
+// This means that the module pattern can't be used.
+if (!YAHOO.util.Event) {
+
+/**
+ * The event utility provides functions to add and remove event listeners,
+ * event cleansing.  It also tries to automatically remove listeners it
+ * registers during the unload event.
+ *
+ * @class Event
+ * @static
+ */
+    YAHOO.util.Event = function() {
+
+        /**
+         * True after the onload event has fired
+         * @property loadComplete
+         * @type boolean
+         * @static
+         * @private
+         */
+        var loadComplete =  false;
+
+        /**
+         * True when the document is initially usable
+         * @property DOMReady
+         * @type boolean
+         * @static
+         * @private
+         */
+        var DOMReady = false;
+
+        /**
+         * Cache of wrapped listeners
+         * @property listeners
+         * @type array
+         * @static
+         * @private
+         */
+        var listeners = [];
+
+        /**
+         * User-defined unload function that will be fired before all events
+         * are detached
+         * @property unloadListeners
+         * @type array
+         * @static
+         * @private
+         */
+        var unloadListeners = [];
+
+        /**
+         * Cache of DOM0 event handlers to work around issues with DOM2 events
+         * in Safari
+         * @property legacyEvents
+         * @static
+         * @private
+         */
+        var legacyEvents = [];
+
+        /**
+         * Listener stack for DOM0 events
+         * @property legacyHandlers
+         * @static
+         * @private
+         */
+        var legacyHandlers = [];
+
+        /**
+         * The number of times to poll after window.onload.  This number is
+         * increased if additional late-bound handlers are requested after
+         * the page load.
+         * @property retryCount
+         * @static
+         * @private
+         */
+        var retryCount = 0;
+
+        /**
+         * onAvailable listeners
+         * @property onAvailStack
+         * @static
+         * @private
+         */
+        var onAvailStack = [];
+
+        /**
+         * Lookup table for legacy events
+         * @property legacyMap
+         * @static
+         * @private
+         */
+        var legacyMap = [];
+
+        /**
+         * Counter for auto id generation
+         * @property counter
+         * @static
+         * @private
+         */
+        var counter = 0;
+        
+        /**
+         * Normalized keycodes for webkit/safari
+         * @property webkitKeymap
+         * @type {int: int}
+         * @private
+         * @static
+         * @final
+         */
+        var webkitKeymap = {
+            63232: 38, // up
+            63233: 40, // down
+            63234: 37, // left
+            63235: 39  // right
+        };
+
+        return {
+
+            /**
+             * The number of times we should look for elements that are not
+             * in the DOM at the time the event is requested after the document
+             * has been loaded.  The default is 4000 at amp;10 ms, so it will poll
+             * for 40 seconds or until all outstanding handlers are bound
+             * (whichever comes first).
+             * @property POLL_RETRYS
+             * @type int
+             * @static
+             * @final
+             */
+            POLL_RETRYS: 4000,
+
+            /**
+             * The poll interval in milliseconds
+             * @property POLL_INTERVAL
+             * @type int
+             * @static
+             * @final
+             */
+            POLL_INTERVAL: 10,
+
+            /**
+             * Element to bind, int constant
+             * @property EL
+             * @type int
+             * @static
+             * @final
+             */
+            EL: 0,
+
+            /**
+             * Type of event, int constant
+             * @property TYPE
+             * @type int
+             * @static
+             * @final
+             */
+            TYPE: 1,
+
+            /**
+             * Function to execute, int constant
+             * @property FN
+             * @type int
+             * @static
+             * @final
+             */
+            FN: 2,
+
+            /**
+             * Function wrapped for scope correction and cleanup, int constant
+             * @property WFN
+             * @type int
+             * @static
+             * @final
+             */
+            WFN: 3,
+
+            /**
+             * Object passed in by the user that will be returned as a 
+             * parameter to the callback, int constant.  Specific to
+             * unload listeners
+             * @property OBJ
+             * @type int
+             * @static
+             * @final
+             */
+            UNLOAD_OBJ: 3,
+
+            /**
+             * Adjusted scope, either the element we are registering the event
+             * on or the custom object passed in by the listener, int constant
+             * @property ADJ_SCOPE
+             * @type int
+             * @static
+             * @final
+             */
+            ADJ_SCOPE: 4,
+
+            /**
+             * The original obj passed into addListener
+             * @property OBJ
+             * @type int
+             * @static
+             * @final
+             */
+            OBJ: 5,
+
+            /**
+             * The original scope parameter passed into addListener
+             * @property OVERRIDE
+             * @type int
+             * @static
+             * @final
+             */
+            OVERRIDE: 6,
+
+            /**
+             * addListener/removeListener can throw errors in unexpected scenarios.
+             * These errors are suppressed, the method returns false, and this property
+             * is set
+             * @property lastError
+             * @static
+             * @type Error
+             */
+            lastError: null,
+
+            /**
+             * Safari detection
+             * @property isSafari
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.webkit
+             */
+            isSafari: YAHOO.env.ua.webkit,
+            
+            /**
+             * webkit version
+             * @property webkit
+             * @type string
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.webkit
+             */
+            webkit: YAHOO.env.ua.webkit,
+            
+            /**
+             * IE detection 
+             * @property isIE
+             * @private
+             * @static
+             * @deprecated use YAHOO.env.ua.ie
+             */
+            isIE: YAHOO.env.ua.ie,
+
+            /**
+             * poll handle
+             * @property _interval
+             * @static
+             * @private
+             */
+            _interval: null,
+
+            /**
+             * @method startInterval
+             * @static
+             * @private
+             */
+            startInterval: function() {
+                if (!this._interval) {
+                    var self = this;
+                    var callback = function() { self._tryPreloadAttach(); };
+                    this._interval = setInterval(callback, this.POLL_INTERVAL);
+                }
+            },
+
+            /**
+             * Executes the supplied callback when the item with the supplied
+             * id is found.  This is meant to be used to execute behavior as
+             * soon as possible as the page loads.  If you use this after the
+             * initial page load it will poll for a fixed time for the element.
+             * The number of times it will poll and the frequency are
+             * configurable.  By default it will poll for 10 seconds.
+             *
+             * <p>The callback is executed with a single parameter:
+             * the custom object parameter, if provided.</p>
+             *
+             * @method onAvailable
+             *
+             * @param {string}   p_id the id of the element to look for.
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj, if set to an object it
+             *                   will execute in the scope of that object
+             *
+             * @static
+             */
+            onAvailable: function(p_id, p_fn, p_obj, p_override) {
+                onAvailStack.push( { id:         p_id, 
+                                     fn:         p_fn, 
+                                     obj:        p_obj, 
+                                     override:   p_override, 
+                                     checkReady: false    } );
+                retryCount = this.POLL_RETRYS;
+                this.startInterval();
+            },
+
+            /**
+             * Executes the supplied callback when the DOM is first usable.  This
+             * will execute immediately if called after the DOMReady event has
+             * fired.   @todo the DOMContentReady event does not fire when the
+             * script is dynamically injected into the page.  This means the
+             * DOMReady custom event will never fire in FireFox or Opera when the
+             * library is injected.  It _will_ fire in Safari, and the IE 
+             * implementation would allow for us to fire it if the defered script
+             * is not available.  We want this to behave the same in all browsers.
+             * Is there a way to identify when the script has been injected 
+             * instead of included inline?  Is there a way to know whether the 
+             * window onload event has fired without having had a listener attached 
+             * to it when it did so?
+             *
+             * <p>The callback is a CustomEvent, so the signature is:</p>
+             * <p>type <string>, args <array>, customobject <object></p>
+             * <p>For DOMReady events, there are no fire argments, so the
+             * signature is:</p>
+             * <p>"DOMReady", [], obj</p>
+             *
+             *
+             * @method onDOMReady
+             *
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_scope If set to true, p_fn will execute
+             *                   in the scope of p_obj, if set to an object it
+             *                   will execute in the scope of that object
+             *
+             * @static
+             */
+            onDOMReady: function(p_fn, p_obj, p_override) {
+                if (DOMReady) {
+                    setTimeout(function() {
+                        var s = window;
+                        if (p_override) {
+                            if (p_override === true) {
+                                s = p_obj;
+                            } else {
+                                s = p_override;
+                            }
+                        }
+                        p_fn.call(s, "DOMReady", [], p_obj);
+                    }, 0);
+                } else {
+                    this.DOMReadyEvent.subscribe(p_fn, p_obj, p_override);
+                }
+            },
+
+            /**
+             * Works the same way as onAvailable, but additionally checks the
+             * state of sibling elements to determine if the content of the
+             * available element is safe to modify.
+             *
+             * <p>The callback is executed with a single parameter:
+             * the custom object parameter, if provided.</p>
+             *
+             * @method onContentReady
+             *
+             * @param {string}   p_id the id of the element to look for.
+             * @param {function} p_fn what to execute when the element is ready.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean|object}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj.  If an object, p_fn will
+             *                   exectute in the scope of that object
+             *
+             * @static
+             */
+            onContentReady: function(p_id, p_fn, p_obj, p_override) {
+                onAvailStack.push( { id:         p_id, 
+                                     fn:         p_fn, 
+                                     obj:        p_obj, 
+                                     override:   p_override,
+                                     checkReady: true      } );
+
+                retryCount = this.POLL_RETRYS;
+                this.startInterval();
+            },
+
+            /**
+             * Appends an event handler
+             *
+             * @method addListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to assign the 
+             *  listener to.
+             * @param {String}   sType     The type of event to append
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   obj    An arbitrary object that will be 
+             *                             passed as a parameter to the handler
+             * @param {Boolean|object}  override  If true, the obj passed in becomes
+             *                             the execution scope of the listener. If an
+             *                             object, this object becomes the execution
+             *                             scope.
+             * @return {Boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements 
+             *                        could not have the listener attached,
+             *                        or if the operation throws an exception.
+             * @static
+             */
+            addListener: function(el, sType, fn, obj, override) {
+
+                if (!fn || !fn.call) {
+// throw new TypeError(sType + " addListener call failed, callback undefined");
+                    return false;
+                }
+
+                // The el argument can be an array of elements or element ids.
+                if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (var i=0,len=el.length; i<len; ++i) {
+                        ok = this.on(el[i], 
+                                       sType, 
+                                       fn, 
+                                       obj, 
+                                       override) && ok;
+                    }
+                    return ok;
+
+                } else if (YAHOO.lang.isString(el)) {
+                    var oEl = this.getEl(el);
+                    // If the el argument is a string, we assume it is 
+                    // actually the id of the element.  If the page is loaded
+                    // we convert el to the actual element, otherwise we 
+                    // defer attaching the event until onload event fires
+
+                    // check to see if we need to delay hooking up the event 
+                    // until after the page loads.
+                    if (oEl) {
+                        el = oEl;
+                    } else {
+                        // defer adding the event until the element is available
+                        this.onAvailable(el, function() {
+                           YAHOO.util.Event.on(el, sType, fn, obj, override);
+                        });
+
+                        return true;
+                    }
+                }
+
+                // Element should be an html element or an array if we get 
+                // here.
+                if (!el) {
+                    return false;
+                }
+
+                // we need to make sure we fire registered unload events 
+                // prior to automatically unhooking them.  So we hang on to 
+                // these instead of attaching them to the window and fire the
+                // handles explicitly during our one unload event.
+                if ("unload" == sType && obj !== this) {
+                    unloadListeners[unloadListeners.length] =
+                            [el, sType, fn, obj, override];
+                    return true;
+                }
+
+
+                // if the user chooses to override the scope, we use the custom
+                // object passed in, otherwise the executing scope will be the
+                // HTML element that the event is registered on
+                var scope = el;
+                if (override) {
+                    if (override === true) {
+                        scope = obj;
+                    } else {
+                        scope = override;
+                    }
+                }
+
+                // wrap the function so we can return the obj object when
+                // the event fires;
+                var wrappedFn = function(e) {
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e, el), 
+                                obj);
+                    };
+
+                var li = [el, sType, fn, wrappedFn, scope, obj, override];
+                var index = listeners.length;
+                // cache the listener so we can try to automatically unload
+                listeners[index] = li;
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+
+                    // Add a new dom0 wrapper if one is not detected for this
+                    // element
+                    if ( legacyIndex == -1 || 
+                                el != legacyEvents[legacyIndex][0] ) {
+
+                        legacyIndex = legacyEvents.length;
+                        legacyMap[el.id + sType] = legacyIndex;
+
+                        // cache the signature for the DOM0 event, and 
+                        // include the existing handler for the event, if any
+                        legacyEvents[legacyIndex] = 
+                            [el, sType, el["on" + sType]];
+                        legacyHandlers[legacyIndex] = [];
+
+                        el["on" + sType] = 
+                            function(e) {
+                                YAHOO.util.Event.fireLegacyEvent(
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);
+                            };
+                    }
+
+                    // add a reference to the wrapped listener to our custom
+                    // stack of events
+                    //legacyHandlers[legacyIndex].push(index);
+                    legacyHandlers[legacyIndex].push(li);
+
+                } else {
+                    try {
+                        this._simpleAdd(el, sType, wrappedFn, false);
+                    } catch(ex) {
+                        // handle an error trying to attach an event.  If it fails
+                        // we need to clean up the cache
+                        this.lastError = ex;
+                        this.removeListener(el, sType, fn);
+                        return false;
+                    }
+                }
+
+                return true;
+                
+            },
+
+            /**
+             * When using legacy events, the handler is routed to this object
+             * so we can fire our custom listener stack.
+             * @method fireLegacyEvent
+             * @static
+             * @private
+             */
+            fireLegacyEvent: function(e, legacyIndex) {
+                var ok=true,le,lh,li,scope,ret;
+                
+                lh = legacyHandlers[legacyIndex];
+                for (var i=0,len=lh.length; i<len; ++i) {
+                    li = lh[i];
+                    if ( li && li[this.WFN] ) {
+                        scope = li[this.ADJ_SCOPE];
+                        ret = li[this.WFN].call(scope, e);
+                        ok = (ok && ret);
+                    }
+                }
+
+                // Fire the original handler if we replaced one.  We fire this
+                // after the other events to keep stopPropagation/preventDefault
+                // that happened in the DOM0 handler from touching our DOM2
+                // substitute
+                le = legacyEvents[legacyIndex];
+                if (le && le[2]) {
+                    le[2](e);
+                }
+                
+                return ok;
+            },
+
+            /**
+             * Returns the legacy event index that matches the supplied 
+             * signature
+             * @method getLegacyIndex
+             * @static
+             * @private
+             */
+            getLegacyIndex: function(el, sType) {
+                var key = this.generateId(el) + sType;
+                if (typeof legacyMap[key] == "undefined") { 
+                    return -1;
+                } else {
+                    return legacyMap[key];
+                }
+            },
+
+            /**
+             * Logic that determines when we should automatically use legacy
+             * events instead of DOM2 events.  Currently this is limited to old
+             * Safari browsers with a broken preventDefault
+             * @method useLegacyEvent
+             * @static
+             * @private
+             */
+            useLegacyEvent: function(el, sType) {
+                if (this.webkit && ("click"==sType || "dblclick"==sType)) {
+                    var v = parseInt(this.webkit, 10);
+                    if (!isNaN(v) && v<418) {
+                        return true;
+                    }
+                }
+                return false;
+            },
+                    
+            /**
+             * Removes an event listener
+             *
+             * @method removeListener
+             *
+             * @param {String|HTMLElement|Array|NodeList} el An id, an element 
+             *  reference, or a collection of ids and/or elements to remove
+             *  the listener from.
+             * @param {String} sType the type of event to remove.
+             * @param {Function} fn the method the event invokes.  If fn is
+             *  undefined, then all event handlers for the type of event are 
+             *  removed.
+             * @return {boolean} true if the unbind was successful, false 
+             *  otherwise.
+             * @static
+             */
+            removeListener: function(el, sType, fn) {
+                var i, len, li;
+
+                // The el argument can be a string
+                if (typeof el == "string") {
+                    el = this.getEl(el);
+                // The el argument can be an array of elements or element ids.
+                } else if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (i=0,len=el.length; i<len; ++i) {
+                        ok = ( this.removeListener(el[i], sType, fn) && ok );
+                    }
+                    return ok;
+                }
+
+                if (!fn || !fn.call) {
+                    //return false;
+                    return this.purgeElement(el, false, sType);
+                }
+
+                if ("unload" == sType) {
+
+                    for (i=0, len=unloadListeners.length; i<len; i++) {
+                        li = unloadListeners[i];
+                        if (li && 
+                            li[0] == el && 
+                            li[1] == sType && 
+                            li[2] == fn) {
+                                //unloadListeners.splice(i, 1);
+                                unloadListeners[i]=null;
+                                return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                var cacheItem = null;
+
+                // The index is a hidden parameter; needed to remove it from
+                // the method signature because it was tempting users to
+                // try and take advantage of it, which is not possible.
+                var index = arguments[3];
+  
+                if ("undefined" === typeof index) {
+                    index = this._getCacheIndex(el, sType, fn);
+                }
+
+                if (index >= 0) {
+                    cacheItem = listeners[index];
+                }
+
+                if (!el || !cacheItem) {
+                    return false;
+                }
+
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+                    var llist = legacyHandlers[legacyIndex];
+                    if (llist) {
+                        for (i=0, len=llist.length; i<len; ++i) {
+                            li = llist[i];
+                            if (li && 
+                                li[this.EL] == el && 
+                                li[this.TYPE] == sType && 
+                                li[this.FN] == fn) {
+                                    //llist.splice(i, 1);
+                                    llist[i]=null;
+                                    break;
+                            }
+                        }
+                    }
+
+                } else {
+                    try {
+                        this._simpleRemove(el, sType, cacheItem[this.WFN], false);
+                    } catch(ex) {
+                        this.lastError = ex;
+                        return false;
+                    }
+                }
+
+                // removed the wrapped handler
+                delete listeners[index][this.WFN];
+                delete listeners[index][this.FN];
+                //listeners.splice(index, 1);
+                listeners[index]=null;
+
+                return true;
+
+            },
+
+            /**
+             * Returns the event's target element.  Safari sometimes provides
+             * a text node, and this is automatically resolved to the text
+             * node's parent so that it behaves like other browsers.
+             * @method getTarget
+             * @param {Event} ev the event
+             * @param {boolean} resolveTextNode when set to true the target's
+             *                  parent will be returned if the target is a 
+             *                  text node.  @deprecated, the text node is
+             *                  now resolved automatically
+             * @return {HTMLElement} the event's target
+             * @static
+             */
+            getTarget: function(ev, resolveTextNode) {
+                var t = ev.target || ev.srcElement;
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * In some cases, some browsers will return a text node inside
+             * the actual element that was targeted.  This normalizes the
+             * return value for getTarget and getRelatedTarget.
+             * @method resolveTextNode
+             * @param {HTMLElement} node node to resolve
+             * @return {HTMLElement} the normized node
+             * @static
+             */
+            resolveTextNode: function(node) {
+                if (node && 3 == node.nodeType) {
+                    return node.parentNode;
+                } else {
+                    return node;
+                }
+            },
+
+            /**
+             * Returns the event's pageX
+             * @method getPageX
+             * @param {Event} ev the event
+             * @return {int} the event's pageX
+             * @static
+             */
+            getPageX: function(ev) {
+                var x = ev.pageX;
+                if (!x && 0 !== x) {
+                    x = ev.clientX || 0;
+
+                    if ( this.isIE ) {
+                        x += this._getScrollLeft();
+                    }
+                }
+
+                return x;
+            },
+
+            /**
+             * Returns the event's pageY
+             * @method getPageY
+             * @param {Event} ev the event
+             * @return {int} the event's pageY
+             * @static
+             */
+            getPageY: function(ev) {
+                var y = ev.pageY;
+                if (!y && 0 !== y) {
+                    y = ev.clientY || 0;
+
+                    if ( this.isIE ) {
+                        y += this._getScrollTop();
+                    }
+                }
+
+
+                return y;
+            },
+
+            /**
+             * Returns the pageX and pageY properties as an indexed array.
+             * @method getXY
+             * @param {Event} ev the event
+             * @return {[x, y]} the pageX and pageY properties of the event
+             * @static
+             */
+            getXY: function(ev) {
+                return [this.getPageX(ev), this.getPageY(ev)];
+            },
+
+            /**
+             * Returns the event's related target 
+             * @method getRelatedTarget
+             * @param {Event} ev the event
+             * @return {HTMLElement} the event's relatedTarget
+             * @static
+             */
+            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);
+            },
+
+            /**
+             * Returns the time of the event.  If the time is not included, the
+             * event is modified using the current time.
+             * @method getTime
+             * @param {Event} ev the event
+             * @return {Date} the time of the event
+             * @static
+             */
+            getTime: function(ev) {
+                if (!ev.time) {
+                    var t = new Date().getTime();
+                    try {
+                        ev.time = t;
+                    } catch(ex) { 
+                        this.lastError = ex;
+                        return t;
+                    }
+                }
+
+                return ev.time;
+            },
+
+            /**
+             * Convenience method for stopPropagation + preventDefault
+             * @method stopEvent
+             * @param {Event} ev the event
+             * @static
+             */
+            stopEvent: function(ev) {
+                this.stopPropagation(ev);
+                this.preventDefault(ev);
+            },
+
+            /**
+             * Stops event propagation
+             * @method stopPropagation
+             * @param {Event} ev the event
+             * @static
+             */
+            stopPropagation: function(ev) {
+                if (ev.stopPropagation) {
+                    ev.stopPropagation();
+                } else {
+                    ev.cancelBubble = true;
+                }
+            },
+
+            /**
+             * Prevents the default behavior of the event
+             * @method preventDefault
+             * @param {Event} ev the event
+             * @static
+             */
+            preventDefault: function(ev) {
+                if (ev.preventDefault) {
+                    ev.preventDefault();
+                } else {
+                    ev.returnValue = false;
+                }
+            },
+             
+            /**
+             * Finds the event in the window object, the caller's arguments, or
+             * in the arguments of another method in the callstack.  This is
+             * executed automatically for events registered through the event
+             * manager, so the implementer should not normally need to execute
+             * this function at all.
+             * @method getEvent
+             * @param {Event} e the event parameter from the handler
+             * @param {HTMLElement} boundEl the element the listener is attached to
+             * @return {Event} the event 
+             * @static
+             */
+            getEvent: function(e, boundEl) {
+                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;
+                    }
+                }
+
+                // IE events that target non-browser objects (e.g., VML
+                // canvas) will sometimes throw errors when you try to
+                // inspect the properties of the event target.  We try to
+                // detect this condition, and provide a dummy target (the bound
+                // element) to eliminate spurious errors.  
+                if (ev && this.isIE) {
+
+                    try {
+
+                        var el = ev.srcElement;
+                        if (el) {
+                            var type = el.type;
+                        }
+
+                    } catch(ex) {
+
+                         
+                        ev.target = boundEl;
+                    }
+
+                }
+
+                return ev;
+            },
+
+            /**
+             * Returns the charcode for an event
+             * @method getCharCode
+             * @param {Event} ev the event
+             * @return {int} the event's charCode
+             * @static
+             */
+            getCharCode: function(ev) {
+                var code = ev.keyCode || ev.charCode || 0;
+
+                // webkit normalization
+                if (YAHOO.env.ua.webkit && (code in webkitKeymap)) {
+                    code = webkitKeymap[code];
+                }
+                return code;
+            },
+
+            /**
+             * Locating the saved event handler data by function ref
+             *
+             * @method _getCacheIndex
+             * @static
+             * @private
+             */
+            _getCacheIndex: function(el, sType, fn) {
+                for (var i=0,len=listeners.length; i<len; ++i) {
+                    var li = listeners[i];
+                    if ( li                 && 
+                         li[this.FN] == fn  && 
+                         li[this.EL] == el  && 
+                         li[this.TYPE] == sType ) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            },
+
+            /**
+             * Generates an unique ID for the element if it does not already 
+             * have one.
+             * @method generateId
+             * @param el the element to create the id for
+             * @return {string} the resulting id of the element
+             * @static
+             */
+            generateId: function(el) {
+                var id = el.id;
+
+                if (!id) {
+                    id = "yuievtautoid-" + counter;
+                    ++counter;
+                    el.id = id;
+                }
+
+                return id;
+            },
+
+
+            /**
+             * We want to be able to use getElementsByTagName as a collection
+             * to attach a group of events to.  Unfortunately, different 
+             * browsers return different types of collections.  This function
+             * tests to determine if the object is array-like.  It will also 
+             * fail if the object is an array, but is empty.
+             * @method _isValidCollection
+             * @param o the object to test
+             * @return {boolean} true if the object is array-like and populated
+             * @static
+             * @private
+             */
+            _isValidCollection: function(o) {
+                try {
+                    return ( typeof o !== "string" && // o is not a string
+                             o.length              && // o is indexed
+                             !o.tagName            && // o is not an HTML element
+                             !o.alert              && // o is not a window
+                             typeof o[0] !== "undefined" );
+                } catch(e) {
+                    return false;
+                }
+
+            },
+
+            /**
+             * @private
+             * @property elCache
+             * DOM element cache
+             * @static
+             * @deprecated Elements are not cached due to issues that arise when
+             * elements are removed and re-added
+             */
+            elCache: {},
+
+            /**
+             * We cache elements bound by id because when the unload event 
+             * fires, we can no longer use document.getElementById
+             * @method getEl
+             * @static
+             * @private
+             * @deprecated Elements are not cached any longer
+             */
+            getEl: function(id) {
+                return (typeof id === "string") ? document.getElementById(id) : id;
+            },
+
+            /**
+             * Clears the element cache
+             * @deprecated Elements are not cached any longer
+             * @method clearCache
+             * @static
+             * @private
+             */
+            clearCache: function() { },
+
+            /**
+             * Custom event the fires when the dom is initially usable
+             * @event DOMReadyEvent
+             */
+            DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", this),
+
+            /**
+             * hook up any deferred listeners
+             * @method _load
+             * @static
+             * @private
+             */
+            _load: function(e) {
+
+                if (!loadComplete) {
+                    loadComplete = true;
+                    var EU = YAHOO.util.Event;
+
+                    // Just in case DOMReady did not go off for some reason
+                    EU._ready();
+
+                    // Available elements may not have been detected before the
+                    // window load event fires. Try to find them now so that the
+                    // the user is more likely to get the onAvailable notifications
+                    // before the window load notification
+                    EU._tryPreloadAttach();
+
+                    // Remove the listener to assist with the IE memory issue, but not
+                    // for other browsers because FF 1.0x does not like it.
+                    //if (this.isIE) {
+                        //EU._simpleRemove(window, "load", EU._load);
+                    //}
+                }
+            },
+
+            /**
+             * Fires the DOMReady event listeners the first time the document is
+             * usable.
+             * @method _ready
+             * @static
+             * @private
+             */
+            _ready: function(e) {
+                if (!DOMReady) {
+                    DOMReady=true;
+                    var EU = YAHOO.util.Event;
+
+                    // Fire the content ready custom event
+                    EU.DOMReadyEvent.fire();
+
+                    // Remove the DOMContentLoaded (FF/Opera)
+                    EU._simpleRemove(document, "DOMContentLoaded", EU._ready);
+                }
+            },
+
+            /**
+             * Polling function that runs before the onload event fires, 
+             * attempting to attach to DOM Nodes as soon as they are 
+             * available
+             * @method _tryPreloadAttach
+             * @static
+             * @private
+             */
+            _tryPreloadAttach: function() {
+
+                if (this.locked) {
+                    return false;
+                }
+
+                if (this.isIE) {
+                    // Hold off if DOMReady has not fired and check current
+                    // readyState to protect against the IE operation aborted
+                    // issue.
+                    //if (!DOMReady || "complete" !== document.readyState) {
+                    if (!DOMReady) {
+                        this.startInterval();
+                        return false;
+                    }
+                }
+
+                this.locked = true;
+
+
+                // keep trying until after the page is loaded.  We need to 
+                // check the page load state prior to trying to bind the 
+                // elements so that we can be certain all elements have been 
+                // tested appropriately
+                var tryAgain = !loadComplete;
+                if (!tryAgain) {
+                    tryAgain = (retryCount > 0);
+                }
+
+                // onAvailable
+                var notAvail = [];
+
+                var executeItem = function (el, item) {
+                    var scope = el;
+                    if (item.override) {
+                        if (item.override === true) {
+                            scope = item.obj;
+                        } else {
+                            scope = item.override;
+                        }
+                    }
+                    item.fn.call(scope, item.obj);
+                };
+
+                var i,len,item,el;
+
+                // onAvailable
+                for (i=0,len=onAvailStack.length; i<len; ++i) {
+                    item = onAvailStack[i];
+                    if (item && !item.checkReady) {
+                        el = this.getEl(item.id);
+                        if (el) {
+                            executeItem(el, item);
+                            onAvailStack[i] = null;
+                        } else {
+                            notAvail.push(item);
+                        }
+                    }
+                }
+
+                // onContentReady
+                for (i=0,len=onAvailStack.length; i<len; ++i) {
+                    item = onAvailStack[i];
+                    if (item && item.checkReady) {
+                        el = this.getEl(item.id);
+
+                        if (el) {
+                            // The element is available, but not necessarily ready
+                            // @todo should we test parentNode.nextSibling?
+                            if (loadComplete || el.nextSibling) {
+                                executeItem(el, item);
+                                onAvailStack[i] = null;
+                            }
+                        } else {
+                            notAvail.push(item);
+                        }
+                    }
+                }
+
+                retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
+
+                if (tryAgain) {
+                    // we may need to strip the nulled out items here
+                    this.startInterval();
+                } else {
+                    clearInterval(this._interval);
+                    this._interval = null;
+                }
+
+                this.locked = false;
+
+                return true;
+
+            },
+
+            /**
+             * Removes all listeners attached to the given element via addListener.
+             * Optionally, the node's children can also be purged.
+             * Optionally, you can specify a specific type of event to remove.
+             * @method purgeElement
+             * @param {HTMLElement} el the element to purge
+             * @param {boolean} recurse recursively purge this element's children
+             * as well.  Use with caution.
+             * @param {string} sType optional type of listener to purge. If
+             * left out, all listeners will be removed
+             * @static
+             */
+            purgeElement: function(el, recurse, sType) {
+                var elListeners = this.getListeners(el, sType), i, len;
+                if (elListeners) {
+                    for (i=0,len=elListeners.length; i<len ; ++i) {
+                        var l = elListeners[i];
+                        // can't use the index on the changing collection
+                        this.removeListener(el, l.type, l.fn, l.index);
+                        //this.removeListener(el, l.type, l.fn);
+                    }
+                }
+
+                if (recurse && el && el.childNodes) {
+                    for (i=0,len=el.childNodes.length; i<len ; ++i) {
+                        this.purgeElement(el.childNodes[i], recurse, sType);
+                    }
+                }
+            },
+
+            /**
+             * Returns all listeners attached to the given element via addListener.
+             * Optionally, you can specify a specific type of event to return.
+             * @method getListeners
+             * @param el {HTMLElement} the element to inspect 
+             * @param sType {string} optional type of listener to return. If
+             * left out, all listeners will be returned
+             * @return {Object} the listener. Contains the following fields:
+             * &nbsp;&nbsp;type:   (string)   the type of event
+             * &nbsp;&nbsp;fn:     (function) the callback supplied to addListener
+             * &nbsp;&nbsp;obj:    (object)   the custom object supplied to addListener
+             * &nbsp;&nbsp;adjust: (boolean|object)  whether or not to adjust the default scope
+             * &nbsp;&nbsp;scope: (boolean)  the derived scope based on the adjust parameter
+             * &nbsp;&nbsp;index:  (int)      its position in the Event util listener cache
+             * @static
+             */           
+            getListeners: function(el, sType) {
+                var results=[], searchLists;
+                if (!sType) {
+                    searchLists = [listeners, unloadListeners];
+                } else if (sType == "unload") {
+                    searchLists = [unloadListeners];
+                } else {
+                    searchLists = [listeners];
+                }
+
+                for (var j=0;j<searchLists.length; j=j+1) {
+                    var searchList = searchLists[j];
+                    if (searchList && searchList.length > 0) {
+                        for (var i=0,len=searchList.length; i<len ; ++i) {
+                            var l = searchList[i];
+                            if ( l  && l[this.EL] === el && 
+                                    (!sType || sType === l[this.TYPE]) ) {
+                                results.push({
+                                    type:   l[this.TYPE],
+                                    fn:     l[this.FN],
+                                    obj:    l[this.OBJ],
+                                    adjust: l[this.OVERRIDE],
+                                    scope:  l[this.ADJ_SCOPE],
+                                    index:  i
+                                });
+                            }
+                        }
+                    }
+                }
+
+                return (results.length) ? results : null;
+            },
+
+            /**
+             * Removes all listeners registered by pe.event.  Called 
+             * automatically during the unload event.
+             * @method _unload
+             * @static
+             * @private
+             */
+            _unload: function(e) {
+
+                var EU = YAHOO.util.Event, i, j, l, len, index;
+
+                for (i=0,len=unloadListeners.length; i<len; ++i) {
+                    l = unloadListeners[i];
+                    if (l) {
+                        var scope = window;
+                        if (l[EU.ADJ_SCOPE]) {
+                            if (l[EU.ADJ_SCOPE] === true) {
+                                scope = l[EU.UNLOAD_OBJ];
+                            } else {
+                                scope = l[EU.ADJ_SCOPE];
+                            }
+                        }
+                        l[EU.FN].call(scope, EU.getEvent(e, l[EU.EL]), l[EU.UNLOAD_OBJ] );
+                        unloadListeners[i] = null;
+                        l=null;
+                        scope=null;
+                    }
+                }
+
+                unloadListeners = null;
+
+                if (listeners && listeners.length > 0) {
+                    j = listeners.length;
+                    while (j) {
+                        index = j-1;
+                        l = listeners[index];
+                        if (l) {
+                            EU.removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], index);
+                        } 
+                        j = j - 1;
+                    }
+                    l=null;
+
+                    EU.clearCache();
+                }
+
+                for (i=0,len=legacyEvents.length; i<len; ++i) {
+                    // dereference the element
+                    //delete legacyEvents[i][0];
+                    legacyEvents[i][0] = null;
+
+                    // delete the array item
+                    //delete legacyEvents[i];
+                    legacyEvents[i] = null;
+                }
+
+                legacyEvents = null;
+
+                EU._simpleRemove(window, "unload", EU._unload);
+
+            },
+
+            /**
+             * Returns scrollLeft
+             * @method _getScrollLeft
+             * @static
+             * @private
+             */
+            _getScrollLeft: function() {
+                return this._getScroll()[1];
+            },
+
+            /**
+             * Returns scrollTop
+             * @method _getScrollTop
+             * @static
+             * @private
+             */
+            _getScrollTop: function() {
+                return this._getScroll()[0];
+            },
+
+            /**
+             * Returns the scrollTop and scrollLeft.  Used to calculate the 
+             * pageX and pageY in Internet Explorer
+             * @method _getScroll
+             * @static
+             * @private
+             */
+            _getScroll: function() {
+                var dd = document.documentElement, db = document.body;
+                if (dd && (dd.scrollTop || dd.scrollLeft)) {
+                    return [dd.scrollTop, dd.scrollLeft];
+                } else if (db) {
+                    return [db.scrollTop, db.scrollLeft];
+                } else {
+                    return [0, 0];
+                }
+            },
+            
+            /**
+             * Used by old versions of CustomEvent, restored for backwards
+             * compatibility
+             * @method regCE
+             * @private
+             * @static
+             * @deprecated still here for backwards compatibility
+             */
+            regCE: function() {
+                // does nothing
+            },
+
+            /**
+             * Adds a DOM event directly without the caching, cleanup, scope adj, etc
+             *
+             * @method _simpleAdd
+             * @param {HTMLElement} el      the element to bind the handler to
+             * @param {string}      sType   the type of event handler
+             * @param {function}    fn      the callback to invoke
+             * @param {boolen}      capture capture or bubble phase
+             * @static
+             * @private
+             */
+            _simpleAdd: function () {
+                if (window.addEventListener) {
+                    return function(el, sType, fn, capture) {
+                        el.addEventListener(sType, fn, (capture));
+                    };
+                } else if (window.attachEvent) {
+                    return function(el, sType, fn, capture) {
+                        el.attachEvent("on" + sType, fn);
+                    };
+                } else {
+                    return function(){};
+                }
+            }(),
+
+            /**
+             * Basic remove listener
+             *
+             * @method _simpleRemove
+             * @param {HTMLElement} el      the element to bind the handler to
+             * @param {string}      sType   the type of event handler
+             * @param {function}    fn      the callback to invoke
+             * @param {boolen}      capture capture or bubble phase
+             * @static
+             * @private
+             */
+            _simpleRemove: function() {
+                if (window.removeEventListener) {
+                    return function (el, sType, fn, capture) {
+                        el.removeEventListener(sType, fn, (capture));
+                    };
+                } else if (window.detachEvent) {
+                    return function (el, sType, fn) {
+                        el.detachEvent("on" + sType, fn);
+                    };
+                } else {
+                    return function(){};
+                }
+            }()
+        };
+
+    }();
+
+    (function() {
+        var EU = YAHOO.util.Event;
+
+        /**
+         * YAHOO.util.Event.on is an alias for addListener
+         * @method on
+         * @see addListener
+         * @static
+         */
+        EU.on = EU.addListener;
+
+        /////////////////////////////////////////////////////////////
+        // DOMReady
+        // based on work by: Dean Edwards/John Resig/Matthias Miller 
+
+        // Internet Explorer: use the readyState of a defered script.
+        // This isolates what appears to be a safe moment to manipulate
+        // the DOM prior to when the document's readyState suggests
+        // it is safe to do so.
+        if (EU.isIE) {
+
+            // Process onAvailable/onContentReady items when when the 
+            // DOM is ready.
+            YAHOO.util.Event.onDOMReady(
+                    YAHOO.util.Event._tryPreloadAttach,
+                    YAHOO.util.Event, true);
+
+
+            var el, d=document, b=d.body;
+
+            // If the library is being injected after window.onload, it
+            // is not safe to document.write the script tag.  Detecting
+            // this state doesn't appear possible, so we expect a flag
+            // in YAHOO_config to be set if the library is being injected.
+            if (("undefined" !== typeof YAHOO_config) && YAHOO_config.injecting) {
+
+                el = document.createElement("script");
+                var p=d.getElementsByTagName("head")[0] || b;
+                p.insertBefore(el, p.firstChild);
+
+            } else {
+    d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');
+                el=document.getElementById("_yui_eu_dr");
+            }
+            
+
+            if (el) {
+                el.onreadystatechange = function() {
+                    if ("complete" === this.readyState) {
+                        this.parentNode.removeChild(this);
+                        YAHOO.util.Event._ready();
+                    }
+                };
+            } else {
+                // The library was likely injected into the page
+                // rendering onDOMReady unreliable
+                // YAHOO.util.Event._ready();
+            }
+
+            el=null;
+
+        
+        // Safari: The document's readyState in Safari currently will
+        // change to loaded/complete before images are loaded.
+        //} else if (EU.webkit) {
+        } else if (EU.webkit) {
+
+            EU._drwatch = setInterval(function(){
+                var rs=document.readyState;
+                if ("loaded" == rs || "complete" == rs) {
+                    clearInterval(EU._drwatch);
+                    EU._drwatch = null;
+                    EU._ready();
+                }
+            }, EU.POLL_INTERVAL); 
+
+        // FireFox and Opera: These browsers provide a event for this
+        // moment.
+        } else {
+
+            // @todo will this fire when the library is injected?
+
+            EU._simpleAdd(document, "DOMContentLoaded", EU._ready);
+
+        }
+        /////////////////////////////////////////////////////////////
+
+
+        EU._simpleAdd(window, "load", EU._load);
+        EU._simpleAdd(window, "unload", EU._unload);
+        EU._tryPreloadAttach();
+    })();
+
+}
+/**
+ * EventProvider is designed to be used with YAHOO.augment to wrap 
+ * CustomEvents in an interface that allows events to be subscribed to 
+ * and fired by name.  This makes it possible for implementing code to
+ * subscribe to an event that either has not been created yet, or will
+ * not be created at all.
+ *
+ * @Class EventProvider
+ */
+YAHOO.util.EventProvider = function() { };
+
+YAHOO.util.EventProvider.prototype = {
+
+    /**
+     * Private storage of custom events
+     * @property __yui_events
+     * @type Object[]
+     * @private
+     */
+    __yui_events: null,
+
+    /**
+     * Private storage of custom event subscribers
+     * @property __yui_subscribers
+     * @type Object[]
+     * @private
+     */
+    __yui_subscribers: null,
+    
+    /**
+     * Subscribe to a CustomEvent by event type
+     *
+     * @method subscribe
+     * @param p_type     {string}   the type, or name of the event
+     * @param p_fn       {function} the function to exectute when the event fires
+     * @param p_obj      {Object}   An object to be passed along when the event 
+     *                              fires
+     * @param p_override {boolean}  If true, the obj passed in becomes the 
+     *                              execution scope of the listener
+     */
+    subscribe: function(p_type, p_fn, p_obj, p_override) {
+
+        this.__yui_events = this.__yui_events || {};
+        var ce = this.__yui_events[p_type];
+
+        if (ce) {
+            ce.subscribe(p_fn, p_obj, p_override);
+        } else {
+            this.__yui_subscribers = this.__yui_subscribers || {};
+            var subs = this.__yui_subscribers;
+            if (!subs[p_type]) {
+                subs[p_type] = [];
+            }
+            subs[p_type].push(
+                { fn: p_fn, obj: p_obj, override: p_override } );
+        }
+    },
+
+    /**
+     * Unsubscribes one or more listeners the from the specified event
+     * @method unsubscribe
+     * @param p_type {string}   The type, or name of the event.  If the type
+     *                          is not specified, it will attempt to remove
+     *                          the listener from all hosted events.
+     * @param p_fn   {Function} The subscribed function to unsubscribe, if not
+     *                          supplied, all subscribers will be removed.
+     * @param p_obj  {Object}   The custom object passed to subscribe.  This is
+     *                        optional, but if supplied will be used to
+     *                        disambiguate multiple listeners that are the same
+     *                        (e.g., you subscribe many object using a function
+     *                        that lives on the prototype)
+     * @return {boolean} true if the subscriber was found and detached.
+     */
+    unsubscribe: function(p_type, p_fn, p_obj) {
+        this.__yui_events = this.__yui_events || {};
+        var evts = this.__yui_events;
+        if (p_type) {
+            var ce = evts[p_type];
+            if (ce) {
+                return ce.unsubscribe(p_fn, p_obj);
+            }
+        } else {
+            var ret = true;
+            for (var i in evts) {
+                if (YAHOO.lang.hasOwnProperty(evts, i)) {
+                    ret = ret && evts[i].unsubscribe(p_fn, p_obj);
+                }
+            }
+            return ret;
+        }
+
+        return false;
+    },
+    
+    /**
+     * Removes all listeners from the specified event.  If the event type
+     * is not specified, all listeners from all hosted custom events will
+     * be removed.
+     * @method unsubscribeAll
+     * @param p_type {string}   The type, or name of the event
+     */
+    unsubscribeAll: function(p_type) {
+        return this.unsubscribe(p_type);
+    },
+
+    /**
+     * Creates a new custom event of the specified type.  If a custom event
+     * by that name already exists, it will not be re-created.  In either
+     * case the custom event is returned. 
+     *
+     * @method createEvent
+     *
+     * @param p_type {string} the type, or name of the event
+     * @param p_config {object} optional config params.  Valid properties are:
+     *
+     *  <ul>
+     *    <li>
+     *      scope: defines the default execution scope.  If not defined
+     *      the default scope will be this instance.
+     *    </li>
+     *    <li>
+     *      silent: if true, the custom event will not generate log messages.
+     *      This is false by default.
+     *    </li>
+     *    <li>
+     *      onSubscribeCallback: specifies a callback to execute when the
+     *      event has a new subscriber.  This will fire immediately for
+     *      each queued subscriber if any exist prior to the creation of
+     *      the event.
+     *    </li>
+     *  </ul>
+     *
+     *  @return {CustomEvent} the custom event
+     *
+     */
+    createEvent: function(p_type, p_config) {
+
+        this.__yui_events = this.__yui_events || {};
+        var opts = p_config || {};
+        var events = this.__yui_events;
+
+        if (events[p_type]) {
+        } else {
+
+            var scope  = opts.scope  || this;
+            var silent = (opts.silent);
+
+            var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
+                    YAHOO.util.CustomEvent.FLAT);
+            events[p_type] = ce;
+
+            if (opts.onSubscribeCallback) {
+                ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
+            }
+
+            this.__yui_subscribers = this.__yui_subscribers || {};
+            var qs = this.__yui_subscribers[p_type];
+
+            if (qs) {
+                for (var i=0; i<qs.length; ++i) {
+                    ce.subscribe(qs[i].fn, qs[i].obj, qs[i].override);
+                }
+            }
+        }
+
+        return events[p_type];
+    },
+
+
+   /**
+     * Fire a custom event by name.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the 
+     * following parameters:
+     *   <ul>
+     *   <li>The first argument fire() was executed with</li>
+     *   <li>The custom object (if any) that was passed into the subscribe() 
+     *       method</li>
+     *   </ul>
+     * If the custom event has not been explicitly created, it will be
+     * created now with the default config, scoped to the host object
+     * @method fireEvent
+     * @param p_type    {string}  the type, or name of the event
+     * @param arguments {Object*} an arbitrary set of parameters to pass to 
+     *                            the handler.
+     * @return {boolean} the return value from CustomEvent.fire
+     *                   
+     */
+    fireEvent: function(p_type, arg1, arg2, etc) {
+
+        this.__yui_events = this.__yui_events || {};
+        var ce = this.__yui_events[p_type];
+
+        if (!ce) {
+            return null;
+        }
+
+        var args = [];
+        for (var i=1; i<arguments.length; ++i) {
+            args.push(arguments[i]);
+        }
+        return ce.fire.apply(ce, args);
+    },
+
+    /**
+     * Returns true if the custom event of the provided type has been created
+     * with createEvent.
+     * @method hasEvent
+     * @param type {string} the type, or name of the event
+     */
+    hasEvent: function(type) {
+        if (this.__yui_events) {
+            if (this.__yui_events[type]) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+};
+
+/**
+* KeyListener is a utility that provides an easy interface for listening for
+* keydown/keyup events fired against DOM elements.
+* @namespace YAHOO.util
+* @class KeyListener
+* @constructor
+* @param {HTMLElement} attachTo The element or element ID to which the key 
+*                               event should be attached
+* @param {String}      attachTo The element or element ID to which the key
+*                               event should be attached
+* @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).
+* @param {Function}    handler  The CustomEvent handler to fire when the 
+*                               key event is detected
+* @param {Object}      handler  An object literal representing the handler. 
+* @param {String}      event    Optional. The event (keydown or keyup) to 
+*                               listen for. Defaults automatically to keydown.
+*
+* @knownissue the "keypress" event is completely broken in Safari 2.x and below.
+*             the workaround is use "keydown" for key listening.  However, if
+*             it is desired to prevent the default behavior of the keystroke,
+*             that can only be done on the keypress event.  This makes key
+*             handling quite ugly.
+* @knownissue keydown is also broken in Safari 2.x and below for the ESC key.
+*             There currently is no workaround other than choosing another
+*             key to listen for.
+*/
+YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {
+    if (!attachTo) {
+    } else if (!keyData) {
+    } else if (!handler) {
+    } 
+    
+    if (!event) {
+        event = YAHOO.util.KeyListener.KEYDOWN;
+    }
+
+    /**
+    * The CustomEvent fired internally when a key is pressed
+    * @event keyEvent
+    * @private
+    * @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).
+    */
+    var keyEvent = new YAHOO.util.CustomEvent("keyPressed");
+    
+    /**
+    * The CustomEvent fired when the KeyListener is enabled via the enable() 
+    * function
+    * @event enabledEvent
+    * @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).
+    */
+    this.enabledEvent = new YAHOO.util.CustomEvent("enabled");
+
+    /**
+    * The CustomEvent fired when the KeyListener is disabled via the 
+    * disable() function
+    * @event disabledEvent
+    * @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).
+    */
+    this.disabledEvent = new YAHOO.util.CustomEvent("disabled");
+
+    if (typeof attachTo == 'string') {
+        attachTo = document.getElementById(attachTo);
+    }
+
+    if (typeof handler == 'function') {
+        keyEvent.subscribe(handler);
+    } else {
+        keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);
+    }
+
+    /**
+    * Handles the key event when a key is pressed.
+    * @method handleKeyPress
+    * @param {DOMEvent} e   The keypress DOM event
+    * @param {Object}   obj The DOM event scope object
+    * @private
+    */
+    function handleKeyPress(e, obj) {
+        if (! keyData.shift) {  
+            keyData.shift = false; 
+        }
+        if (! keyData.alt) {    
+            keyData.alt = false;
+        }
+        if (! keyData.ctrl) {
+            keyData.ctrl = false;
+        }
+
+        // check held down modifying keys first
+        if (e.shiftKey == keyData.shift && 
+            e.altKey   == keyData.alt &&
+            e.ctrlKey  == keyData.ctrl) { // if we pass this, all modifiers match
+            
+            var dataItem;
+            var keyPressed;
+
+            if (keyData.keys instanceof Array) {
+                for (var i=0;i<keyData.keys.length;i++) {
+                    dataItem = keyData.keys[i];
+
+                    if (dataItem == e.charCode ) {
+                        keyEvent.fire(e.charCode, e);
+                        break;
+                    } else if (dataItem == e.keyCode) {
+                        keyEvent.fire(e.keyCode, e);
+                        break;
+                    }
+                }
+            } else {
+                dataItem = keyData.keys;
+                if (dataItem == e.charCode ) {
+                    keyEvent.fire(e.charCode, e);
+                } else if (dataItem == e.keyCode) {
+                    keyEvent.fire(e.keyCode, e);
+                }
+            }
+        }
+    }
+
+    /**
+    * Enables the KeyListener by attaching the DOM event listeners to the 
+    * target DOM element
+    * @method enable
+    */
+    this.enable = function() {
+        if (! this.enabled) {
+            YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);
+            this.enabledEvent.fire(keyData);
+        }
+        /**
+        * Boolean indicating the enabled/disabled state of the Tooltip
+        * @property enabled
+        * @type Boolean
+        */
+        this.enabled = true;
+    };
+
+    /**
+    * Disables the KeyListener by removing the DOM event listeners from the 
+    * target DOM element
+    * @method disable
+    */
+    this.disable = function() {
+        if (this.enabled) {
+            YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);
+            this.disabledEvent.fire(keyData);
+        }
+        this.enabled = false;
+    };
+
+    /**
+    * Returns a String representation of the object.
+    * @method toString
+    * @return {String}  The string representation of the KeyListener
+    */ 
+    this.toString = function() {
+        return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + 
+                (attachTo.id ? "[" + attachTo.id + "]" : "");
+    };
+
+};
+
+/**
+* Constant representing the DOM "keydown" event.
+* @property YAHOO.util.KeyListener.KEYDOWN
+* @static
+* @final
+* @type String
+*/
+YAHOO.util.KeyListener.KEYDOWN = "keydown";
+
+/**
+* Constant representing the DOM "keyup" event.
+* @property YAHOO.util.KeyListener.KEYUP
+* @static
+* @final
+* @type String
+*/
+YAHOO.util.KeyListener.KEYUP = "keyup";
+YAHOO.register("event", YAHOO.util.Event, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/history-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/history-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/history-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,768 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The Browser History Manager provides the ability to use the
+ * back/forward navigation buttons in a DHTML application. It also allows
+ * a DHTML application to be bookmarked in a specific state.
+ *
+ * @module history
+ * @requires yahoo,event
+ * @namespace YAHOO.util
+ * @title Browser History Manager
+ * @experimental
+ */
+
+/**
+ * The History class provides the ability to use the back/forward navigation
+ * buttons in a DHTML application. It also allows a DHTML application to
+ * be bookmarked in a specific state.
+ *
+ * @class History
+ * @constructor
+ */
+YAHOO.util.History = ( function () {
+
+    /**
+     * Our hidden IFrame used to store the browsing history.
+     *
+     * @property _iframe
+     * @type HTMLIFrameElement
+     * @default null
+     * @private
+     */
+    var _iframe = null;
+
+    /**
+     * INPUT field (with type="hidden" or type="text") or TEXTAREA.
+     * This field keeps the value of the initial state, current state
+     * the list of all states across pages within a single browser session.
+     *
+     * @property _storageField
+     * @type HTMLInputElement|HTMLTextAreaElement
+     * @default null
+     * @private
+     */
+    var _storageField = null;
+
+    /**
+     * Flag used to tell whether YAHOO.util.History.initialize has been called.
+     *
+     * @property _initialized
+     * @type boolean
+     * @default false
+     * @private
+     */
+    var _initialized = false;
+
+    /**
+     * Flag used to tell whether the storage field is ready to be used.
+     *
+     * @property _storageFieldReady
+     * @type boolean
+     * @default false
+     * @private
+     */
+    var _storageFieldReady = false;
+
+    /**
+     * Flag used to tell whether the Browser History Manager is ready.
+     *
+     * @property _bhmReady
+     * @type boolean
+     * @default false
+     * @private
+     */
+    var _bhmReady = false;
+
+    /**
+     * List of registered modules.
+     *
+     * @property _modules
+     * @type array
+     * @default []
+     * @private
+     */
+    var _modules = [];
+
+    /**
+     * List of fully qualified states. This is used only by Safari.
+     *
+     * @property _fqstates
+     * @type array
+     * @default []
+     * @private
+     */
+    var _fqstates = [];
+
+    /**
+     * Trims a string.
+     *
+     * @method _trim
+     * @param {string} str The string to be trimmed.
+     * @return {string} The trimmed string
+     * @private
+     */
+    function _trim( str ) {
+        return str.replace( /^\s*(\S*(\s+\S+)*)\s*$/, "$1" );
+    }
+
+    /**
+     * location.hash is a bit buggy on Opera. I have seen instances where
+     * navigating the history using the back/forward buttons, and hence
+     * changing the URL, would not change location.hash. That's ok, the
+     * implementation of an equivalent is trivial.
+     *
+     * @method _getHash
+     * @return {string} The hash portion of the document's location
+     * @private
+     */
+    function _getHash() {
+
+        var href;
+        var i;
+
+        href = top.location.href;
+        i = href.indexOf( "#" );
+        return i >= 0 ? href.substr( i + 1 ) : null;
+    }
+
+    /**
+     * Stores all the registered modules' initial state and current state.
+     * On Safari, we also store all the fully qualified states visited by
+     * the application within a single browser session. The storage takes
+     * place in the form field specified during initialization.
+     *
+     * @method _storeStates
+     * @private
+     */
+    function _storeStates() {
+
+        var moduleName;
+        var moduleObj;
+        var initialStates = [];
+        var currentStates = [];
+
+        for ( moduleName in _modules ) {
+            if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
+                moduleObj = _modules[moduleName];
+                initialStates.push( moduleName + "=" + moduleObj.initialState );
+                currentStates.push( moduleName + "=" + moduleObj.currentState );
+            }
+        }
+
+        _storageField.value = initialStates.join( "&" ) + "|" + currentStates.join( "&" );
+
+        if ( YAHOO.env.ua.webkit ) {
+            _storageField.value += "|" + _fqstates.join( "," );
+        }
+    }
+
+    /**
+     * Sets the new currentState attribute of all modules depending on the new
+     * fully qualified state. Also notifies the modules which current state has
+     * changed.
+     *
+     * @method _handleFQStateChange
+     * @param {string} fqstate Fully qualified state
+     * @private
+     */
+    function _handleFQStateChange( fqstate ) {
+
+        var i;
+        var len;
+        var moduleName;
+        var moduleObj;
+        var modules;
+        var states;
+        var tokens;
+        var currentState;
+
+        if ( !fqstate ) {
+            // Notifies all modules
+            for ( moduleName in _modules ) {
+                if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
+                    moduleObj = _modules[moduleName];
+                    moduleObj.currentState = moduleObj.initialState;
+                    moduleObj.onStateChange( unescape( moduleObj.currentState ) );
+                }
+            }
+            return;
+        }
+
+        modules = [];
+        states = fqstate.split( "&" );
+        for ( i = 0, len = states.length ; i < len ; i++ ) {
+            tokens = states[i].split( "=" );
+            if ( tokens.length === 2 ) {
+                moduleName = tokens[0];
+                currentState = tokens[1];
+                modules[moduleName] = currentState;
+            }
+        }
+
+        for ( moduleName in _modules ) {
+            if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
+                moduleObj = _modules[moduleName];
+                currentState = modules[moduleName];
+                if ( !currentState || moduleObj.currentState !== currentState ) {
+                    moduleObj.currentState = currentState || moduleObj.initialState;
+                    moduleObj.onStateChange( unescape( moduleObj.currentState ) );
+                }
+            }
+        }
+    }
+
+    /**
+     * Periodically checks whether our internal IFrame is ready to be used.
+     *
+     * @method _checkIframeLoaded
+     * @private
+     */
+    function _checkIframeLoaded() {
+
+        var doc;
+        var elem;
+        var fqstate;
+
+        if ( !_iframe.contentWindow || !_iframe.contentWindow.document ) {
+            // Check again in 10 msec...
+            setTimeout( _checkIframeLoaded, 10 );
+            return;
+        }
+
+        // Start the thread that will have the responsibility to
+        // periodically check whether a navigate operation has been
+        // requested on the main window. This will happen when
+        // YAHOO.util.History.navigate has been called or after
+        // the user has hit the back/forward button.
+
+        doc = _iframe.contentWindow.document;
+        elem = doc.getElementById( "state" );
+        // We must use innerText, and not innerHTML because our string contains
+        // the "&" character (which would end up being escaped as "&amp;") and
+        // the string comparison would fail...
+        fqstate = elem ? elem.innerText : null;
+
+        setInterval( function () {
+
+            var newfqstate;
+            var hash;
+            var states;
+            var moduleName;
+            var moduleObj;
+
+            doc = _iframe.contentWindow.document;
+            elem = doc.getElementById( "state" );
+            // See my comment above about using innerText instead of innerHTML...
+            newfqstate = elem ? elem.innerText : null;
+
+            if ( newfqstate !== fqstate ) {
+                fqstate = newfqstate;
+                _handleFQStateChange( fqstate );
+
+                if ( !fqstate ) {
+                    states = [];
+                    for ( moduleName in _modules ) {
+                        if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
+                            moduleObj = _modules[moduleName];
+                            states.push( moduleName + "=" + moduleObj.initialState );
+                        }
+                    }
+                    hash = states.join( "&" );
+                } else {
+                    hash = fqstate;
+                }
+
+                // Allow the state to be bookmarked by setting the top window's
+                // URL fragment identifier. Note that here, we are on IE, and
+                // IE does not touch the browser history when setting the hash
+                // (unlike all the other browsers). I used to write:
+                //     top.location.replace( "#" + hash );
+                // but this had a side effect when the page was not the top frame.
+                top.location.hash = hash;
+
+                _storeStates();
+            }
+        }, 50 );
+
+        _bhmReady = true;
+
+        YAHOO.util.History.onLoadEvent.fire();
+    }
+
+    /**
+     * Finish up the initialization of the Browser History Manager.
+     *
+     * @method _initialize
+     * @private
+     */
+    function _initialize() {
+
+        var i;
+        var len;
+        var parts;
+        var tokens;
+        var moduleName;
+        var moduleObj;
+        var initialStates;
+        var initialState;
+        var currentStates;
+        var currentState;
+        var counter;
+        var hash;
+
+        _storageField = document.getElementById( "yui_hist_field" );
+
+        // Decode the content of our storage field...
+        parts = _storageField.value.split( "|" );
+
+        if ( parts.length > 1 ) {
+
+            initialStates = parts[0].split( "&" );
+            for ( i = 0, len = initialStates.length ; i < len ; i++ ) {
+                tokens = initialStates[i].split( "=" );
+                if ( tokens.length === 2 ) {
+                    moduleName = tokens[0];
+                    initialState = tokens[1];
+                    moduleObj = _modules[moduleName];
+                    if ( moduleObj ) {
+                        moduleObj.initialState = initialState;
+                    }
+                }
+            }
+
+            currentStates = parts[1].split( "&" );
+            for ( i = 0, len = currentStates.length ; i < len ; i++ ) {
+                tokens = currentStates[i].split( "=" );
+                if ( tokens.length >= 2 ) {
+                    moduleName = tokens[0];
+                    currentState = tokens[1];
+                    moduleObj = _modules[moduleName];
+                    if ( moduleObj ) {
+                        moduleObj.currentState = currentState;
+                    }
+                }
+            }
+        }
+
+        if ( parts.length > 2 ) {
+            _fqstates = parts[2].split( "," );
+        }
+
+        _storageFieldReady = true;
+
+        if ( YAHOO.env.ua.ie ) {
+
+            _iframe = document.getElementById( "yui_hist_iframe" );
+            _checkIframeLoaded();
+
+        } else {
+
+            // Start the thread that will have the responsibility to
+            // periodically check whether a navigate operation has been
+            // requested on the main window. This will happen when
+            // YAHOO.util.History.navigate has been called or after
+            // the user has hit the back/forward button.
+
+            // On Safari 1.x and 2.0, the only way to catch a back/forward
+            // operation is to watch history.length... We basically exploit
+            // what I consider to be a bug (history.length is not supposed
+            // to change when going back/forward in the history...) This is
+            // why, in the following thread, we first compare the hash,
+            // because the hash thing will be fixed in the next major
+            // version of Safari. So even if they fix the history.length
+            // bug, all this will still work!
+            counter = history.length;
+
+            // On Gecko and Opera, we just need to watch the hash...
+            hash = _getHash();
+
+            setInterval( function () {
+
+                var state;
+                var newHash;
+                var newCounter;
+
+                newHash = _getHash();
+                newCounter = history.length;
+                if ( newHash !== hash ) {
+                    hash = newHash;
+                    counter = newCounter;
+                    _handleFQStateChange( hash );
+                    _storeStates();
+                } else if ( newCounter !== counter ) {
+                    // If we ever get here, we should be on Safari...
+                    hash = newHash;
+                    counter = newCounter;
+                    state = _fqstates[counter - 1];
+                    _handleFQStateChange( state );
+                    _storeStates();
+                }
+            }, 50 );
+
+            _bhmReady = true;
+
+            YAHOO.util.History.onLoadEvent.fire();
+        }
+    }
+
+    return {
+
+        /**
+         * Fired when the Browser History Manager is ready.
+         *
+         * @event onLoadEvent
+         */
+        onLoadEvent: new YAHOO.util.CustomEvent( "onLoad" ),
+
+        /**
+         * Registers a new module.
+         *
+         * @method register
+         * @param {string} module Non-empty string uniquely identifying the
+         *     module you wish to register.
+         * @param {string} initialState The initial state of the specified
+         *     module corresponding to its earliest history entry.
+         * @param {function} onStateChange Callback called when the
+         *     state of the specified module has changed.
+         * @param {object} obj An arbitrary object that will be passed as a
+         *     parameter to the handler.
+         * @param {boolean} override If true, the obj passed in becomes the
+         *     execution scope of the listener.
+         */
+        register: function ( module, initialState, onStateChange, obj, override ) {
+
+            var scope;
+            var wrappedFn;
+
+            if ( typeof module !== "string" || _trim( module ) === "" ||
+                 typeof initialState !== "string" ||
+                 typeof onStateChange !== "function" ) {
+                throw new Error( "Missing or invalid argument passed to YAHOO.util.History.register" );
+            }
+
+            if ( _modules[module] ) {
+                // Here, we used to throw an exception. However, users have
+                // complained about this behavior, so we now just return.
+                return;
+            }
+
+            // Note: A module CANNOT be registered after calling
+            // YAHOO.util.History.initialize. Indeed, we set the initial state
+            // of each registered module in YAHOO.util.History.initialize.
+            // If you could register a module after initializing the Browser
+            // History Manager, you would not read the correct state using
+            // YAHOO.util.History.getCurrentState when coming back to the
+            // page using the back button.
+            if ( _initialized ) {
+                throw new Error( "All modules must be registered before calling YAHOO.util.History.initialize" );
+            }
+
+            // Make sure the strings passed in do not contain our separators "," and "|"
+            module = escape( module );
+            initialState = escape( initialState );
+
+            // If the user chooses to override the scope, we use the
+            // custom object passed in as the execution scope.
+            scope = null;
+            if ( override === true ) {
+                scope = obj;
+            } else {
+                scope = override;
+            }
+
+            wrappedFn = function ( state ) {
+                return onStateChange.call( scope, state, obj );
+            };
+
+            _modules[module] = {
+                name: module,
+                initialState: initialState,
+                currentState: initialState,
+                onStateChange: wrappedFn
+            };
+        },
+
+        /**
+         * Initializes the Browser History Manager. Call this method
+         * from a script block located right after the opening body tag.
+         *
+         * @method initialize
+         * @param {string} iframeTarget Optional - Path to an existing
+         *     HTML document accessible from the same domain. If not
+         *     specified, defaults to "blank.html". This is only useful
+         *     if you use https.
+         * @public
+         */
+        initialize: function ( iframeTarget ) {
+
+            // Return if the browser history manager has already been initialized
+            if ( _initialized ) {
+                return;
+            }
+
+            if ( !iframeTarget ) {
+                iframeTarget = "blank.html";
+            }
+
+            if ( typeof iframeTarget !== "string" || _trim( iframeTarget ) === "" ) {
+                throw new Error( "Invalid argument passed to YAHOO.util.History.initialize" );
+            }
+
+            document.write( '<input type="hidden" id="yui_hist_field">' );
+
+            if ( YAHOO.env.ua.ie ) {
+                if ( location.protocol === "https:" ) {
+                    // If we use https, we MUST point the IFrame to a valid
+                    // document on the same server. If we don't, we will get
+                    // a warning (do you want to display non secure items?)
+                    document.write( '<iframe id="yui_hist_iframe" src="' + iframeTarget + '" style="position:absolute;visibility:hidden;"></iframe>' );
+                } else {
+                    // This trick allows us to do without having to download
+                    // the asset, saving one HTTP request...
+                    document.write( '<iframe id="yui_hist_iframe" src="javascript:document.open();document.write(&quot;' + new Date().getTime() + '&quot;);document.close();" style="position:absolute;visibility:hidden;"></iframe>' );
+                }
+            }
+
+            // We have to wait for the window's onload handler. Otherwise, our
+            // hidden form field will always be empty (i.e. the browser won't
+            // have had enough time to restore the session)
+            YAHOO.util.Event.addListener( window, "load", _initialize );
+
+            _initialized = true;
+        },
+
+        /**
+         * Call this method when you want to store a new entry in the browser's history.
+         *
+         * @method navigate
+         * @param {string} module Non-empty string representing your module.
+         * @param {string} state String representing the new state of the specified module.
+         * @return {boolean} Indicates whether the new state was successfully added to the history.
+         * @public
+         */
+        navigate: function ( module, state ) {
+
+            var currentStates;
+            var moduleName;
+            var moduleObj;
+            var currentState;
+            var states;
+
+            if ( typeof module !== "string" || typeof state !== "string" ) {
+                throw new Error( "Missing or invalid argument passed to YAHOO.util.History.navigate" );
+            }
+
+            states = {};
+            states[module] = state;
+
+            return YAHOO.util.History.multiNavigate( states );
+        },
+
+        /**
+         * Call this method when you want to store a new entry in the browser's history.
+         *
+         * @method multiNavigate
+         * @param {object} states Associative array of module-state pairs to set simultaneously.
+         * @return {boolean} Indicates whether the new state was successfully added to the history.
+         * @public
+         */
+        multiNavigate: function ( states ) {
+
+            var currentStates;
+            var moduleName;
+            var moduleObj;
+            var currentState;
+            var fqstate;
+            var html;
+            var doc;
+
+            if ( typeof states !== "object" ) {
+                throw new Error( "Missing or invalid argument passed to YAHOO.util.History.multiNavigate" );
+            }
+
+            if ( !_bhmReady ) {
+                throw new Error( "The Browser History Manager is not initialized" );
+            }
+
+            for ( moduleName in states ) {
+                if ( !_modules[moduleName] ) {
+                    throw new Error( "The following module has not been registered: " + moduleName );
+                }
+            }
+
+            // Generate our new full state string mod1=xxx&mod2=yyy
+            currentStates = [];
+
+            for ( moduleName in _modules ) {
+                if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
+                    moduleObj = _modules[moduleName];
+                    if ( YAHOO.lang.hasOwnProperty( states, moduleName ) ) {
+                        currentState = states[moduleName];
+                    } else {
+                        currentState = moduleObj.currentState;
+                    }
+
+                    // Make sure the strings passed in do not contain our separators "," and "|"
+                    moduleName = escape( moduleName );
+                    currentState = escape( currentState );
+
+                    currentStates.push( moduleName + "=" + currentState );
+                }
+            }
+
+            fqstate = currentStates.join( "&" );
+
+            if ( YAHOO.env.ua.ie ) {
+
+                html = '<html><body><div id="state">' + fqstate + '</div></body></html>';
+                try {
+                    doc = _iframe.contentWindow.document;
+                    doc.open();
+                    doc.write( html );
+                    doc.close();
+                } catch ( e ) {
+                    return false;
+                }
+
+            } else {
+
+                // Known bug: On Safari 1.x and 2.0, if you have tab browsing
+                // enabled, Safari will show an endless loading icon in the
+                // tab. This has apparently been fixed in recent WebKit builds.
+                // One work around found by Dav Glass is to submit a form that
+                // points to the same document. This indeed works on Safari 1.x
+                // and 2.0 but creates bigger problems on WebKit. So for now,
+                // we'll consider this an acceptable bug, and hope that Apple
+                // comes out with their next version of Safari very soon.
+                top.location.hash = fqstate;
+                if ( YAHOO.env.ua.webkit ) {
+                    // The following two lines are only useful for Safari 1.x
+                    // and 2.0. Recent nightly builds of WebKit do not require
+                    // that, but unfortunately, it is not easy to differentiate
+                    // between the two. Once Safari 2.0 departs the A-grade
+                    // list, we can remove the following two lines...
+                    _fqstates[history.length] = fqstate;
+                    _storeStates();
+                }
+
+            }
+
+            return true;
+        },
+
+        /**
+         * Returns the current state of the specified module.
+         *
+         * @method getCurrentState
+         * @param {string} module Non-empty string representing your module.
+         * @return {string} The current state of the specified module.
+         * @public
+         */
+        getCurrentState: function ( module ) {
+
+            var moduleObj;
+
+            if ( typeof module !== "string" ) {
+                throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getCurrentState" );
+            }
+
+            if ( !_storageFieldReady ) {
+                throw new Error( "The Browser History Manager is not initialized" );
+            }
+
+            moduleObj = _modules[module];
+            if ( !moduleObj ) {
+                throw new Error( "No such registered module: " + module );
+            }
+
+            return unescape( moduleObj.currentState );
+        },
+
+        /**
+         * Returns the state of a module according to the URL fragment
+         * identifier. This method is useful to initialize your modules
+         * if your application was bookmarked from a particular state.
+         *
+         * @method getBookmarkedState
+         * @param {string} module Non-empty string representing your module.
+         * @return {string} The bookmarked state of the specified module.
+         * @public
+         */
+        getBookmarkedState: function ( module ) {
+
+            var i;
+            var len;
+            var hash;
+            var states;
+            var tokens;
+            var moduleName;
+
+            if ( typeof module !== "string" ) {
+                throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getBookmarkedState" );
+            }
+
+            hash = top.location.hash.substr(1);
+            states = hash.split( "&" );
+            for ( i = 0, len = states.length ; i < len ; i++ ) {
+                tokens = states[i].split( "=" );
+                if ( tokens.length === 2 ) {
+                    moduleName = tokens[0];
+                    if ( moduleName === module ) {
+                        return unescape( tokens[1] );
+                    }
+                }
+            }
+
+            return null;
+        },
+
+        /**
+         * Returns the value of the specified query string parameter.
+         * This method is not used internally by the Browser History Manager.
+         * However, it is provided here as a helper since many applications
+         * using the Browser History Manager will want to read the value of
+         * url parameters to initialize themselves.
+         *
+         * @method getQueryStringParameter
+         * @param {string} paramName Name of the parameter we want to look up.
+         * @param {string} queryString Optional URL to look at. If not specified,
+         *     this method uses the URL in the address bar.
+         * @return {string} The value of the specified parameter, or null.
+         * @public
+         */
+        getQueryStringParameter: function ( paramName, url ) {
+
+            var i;
+            var len;
+            var idx;
+            var queryString;
+            var params;
+            var tokens;
+
+            url = url || top.location.href;
+
+            idx = url.indexOf( "?" );
+            queryString = idx >= 0 ? url.substr( idx + 1 ) : url;
+            params = queryString.split( "&" );
+
+            for ( i = 0, len = params.length ; i < len ; i++ ) {
+                tokens = params[i].split( "=" );
+                if ( tokens.length >= 2 ) {
+                    if ( tokens[0] === paramName ) {
+                        return unescape( tokens[1] );
+                    }
+                }
+            }
+
+            return null;
+        }
+
+    };
+
+} )();
+YAHOO.register("history", YAHOO.util.History, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/logger.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/logger.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/logger.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1945 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The LogMsg class defines a single log message.
+ *
+ * @class LogMsg
+ * @constructor
+ * @param oConfigs {Object} Object literal of configuration params.
+ */
+ YAHOO.widget.LogMsg = function(oConfigs) {
+    // Parse configs
+    if (oConfigs && (oConfigs.constructor == Object)) {
+        for(var param in oConfigs) {
+            this[param] = oConfigs[param];
+        }
+    }
+ };
+ 
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Log message.
+ *
+ * @property msg
+ * @type String
+ */
+YAHOO.widget.LogMsg.prototype.msg = null;
+ 
+/**
+ * Log timestamp.
+ *
+ * @property time
+ * @type Date
+ */
+YAHOO.widget.LogMsg.prototype.time = null;
+
+/**
+ * Log category.
+ *
+ * @property category
+ * @type String
+ */
+YAHOO.widget.LogMsg.prototype.category = null;
+
+/**
+ * Log source. The first word passed in as the source argument.
+ *
+ * @property source
+ * @type String
+ */
+YAHOO.widget.LogMsg.prototype.source = null;
+
+/**
+ * Log source detail. The remainder of the string passed in as the source argument, not
+ * including the first word (if any).
+ *
+ * @property sourceDetail
+ * @type String
+ */
+YAHOO.widget.LogMsg.prototype.sourceDetail = null;
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The LogWriter class provides a mechanism to log messages through
+ * YAHOO.widget.Logger from a named source.
+ *
+ * @class LogWriter
+ * @constructor
+ * @param sSource {String} Source of LogWriter instance.
+ */
+YAHOO.widget.LogWriter = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not instantiate LogWriter due to invalid source.",
+            "error", "LogWriter");
+        return;
+    }
+    this._source = sSource;
+ };
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Public accessor to the unique name of the LogWriter instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the LogWriter instance.
+ */
+YAHOO.widget.LogWriter.prototype.toString = function() {
+    return "LogWriter " + this._sSource;
+};
+
+/**
+ * Logs a message attached to the source of the LogWriter.
+ *
+ * @method log
+ * @param sMsg {String} The log message.
+ * @param sCategory {String} Category name.
+ */
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {
+    YAHOO.widget.Logger.log(sMsg, sCategory, this._source);
+};
+
+/**
+ * Public accessor to get the source name.
+ *
+ * @method getSource
+ * @return {String} The LogWriter source.
+ */
+YAHOO.widget.LogWriter.prototype.getSource = function() {
+    return this._sSource;
+};
+
+/**
+ * Public accessor to set the source name.
+ *
+ * @method setSource
+ * @param sSource {String} Source of LogWriter instance.
+ */
+YAHOO.widget.LogWriter.prototype.setSource = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not set source due to invalid source.", "error", this.toString());
+        return;
+    }
+    else {
+        this._sSource = sSource;
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Source of the LogWriter instance.
+ *
+ * @property _source
+ * @type String
+ * @private
+ */
+YAHOO.widget.LogWriter.prototype._source = null;
+
+
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * The LogReader class provides UI to read messages logged to YAHOO.widget.Logger.
+ *
+ * @class LogReader
+ * @constructor
+ * @param elContainer {HTMLElement} (optional) DOM element reference of an existing DIV.
+ * @param elContainer {String} (optional) String ID of an existing DIV.
+ * @param oConfigs {Object} (optional) Object literal of configuration params.
+ */
+YAHOO.widget.LogReader = function(elContainer, oConfigs) {
+    this._sName = YAHOO.widget.LogReader._index;
+    YAHOO.widget.LogReader._index++;
+    
+    // Internal vars
+    this._buffer = []; // output buffer
+    this._filterCheckboxes = {}; // pointers to checkboxes
+    this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last log message to console
+
+    // Parse config vars here
+    if (oConfigs && (oConfigs.constructor == Object)) {
+        for(var param in oConfigs) {
+            this[param] = oConfigs[param];
+        }
+    }
+
+    this._initContainerEl(elContainer);
+    if(!this._elContainer) {
+        YAHOO.log("Could not instantiate LogReader due to an invalid container element " +
+                elContainer, "error", this.toString());
+        return;
+    }
+    
+    this._initHeaderEl();
+    this._initConsoleEl();
+    this._initFooterEl();
+
+    this._initDragDrop();
+
+    this._initCategories();
+    this._initSources();
+
+    // Subscribe to Logger custom events
+    YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);
+    YAHOO.widget.Logger.logResetEvent.subscribe(this._onReset, this);
+
+    YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate, this);
+    YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate, this);
+
+    this._filterLogs();
+    YAHOO.log("LogReader initialized", null, this.toString());
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Whether or not LogReader is enabled to output log messages.
+ *
+ * @property logReaderEnabled
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;
+
+/**
+ * Public member to access CSS width of the LogReader container.
+ *
+ * @property width
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.width = null;
+
+/**
+ * Public member to access CSS height of the LogReader container.
+ *
+ * @property height
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.height = null;
+
+/**
+ * Public member to access CSS top position of the LogReader container.
+ *
+ * @property top
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.top = null;
+
+/**
+ * Public member to access CSS left position of the LogReader container.
+ *
+ * @property left
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.left = null;
+
+/**
+ * Public member to access CSS right position of the LogReader container.
+ *
+ * @property right
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.right = null;
+
+/**
+ * Public member to access CSS bottom position of the LogReader container.
+ *
+ * @property bottom
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.bottom = null;
+
+/**
+ * Public member to access CSS font size of the LogReader container.
+ *
+ * @property fontSize
+ * @type String
+ */
+YAHOO.widget.LogReader.prototype.fontSize = null;
+
+/**
+ * Whether or not the footer UI is enabled for the LogReader.
+ *
+ * @property footerEnabled
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.LogReader.prototype.footerEnabled = true;
+
+/**
+ * Whether or not output is verbose (more readable). Setting to true will make
+ * output more compact (less readable).
+ *
+ * @property verboseOutput
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.LogReader.prototype.verboseOutput = true;
+
+/**
+ * Whether or not newest message is printed on top.
+ *
+ * @property newestOnTop
+ * @type Boolean
+ */
+YAHOO.widget.LogReader.prototype.newestOnTop = true;
+
+/**
+ * Output timeout buffer in milliseconds.
+ *
+ * @property outputBuffer
+ * @type Number
+ * @default 100
+ */
+YAHOO.widget.LogReader.prototype.outputBuffer = 100;
+
+/**
+ * Maximum number of messages a LogReader console will display.
+ *
+ * @property thresholdMax
+ * @type Number
+ * @default 500
+ */
+YAHOO.widget.LogReader.prototype.thresholdMax = 500;
+
+/**
+ * When a LogReader console reaches its thresholdMax, it will clear out messages
+ * and print out the latest thresholdMin number of messages.
+ *
+ * @property thresholdMin
+ * @type Number
+ * @default 100
+ */
+YAHOO.widget.LogReader.prototype.thresholdMin = 100;
+
+/**
+ * True when LogReader is in a collapsed state, false otherwise.
+ *
+ * @property isCollapsed
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.LogReader.prototype.isCollapsed = false;
+
+/**
+ * True when LogReader is in a paused state, false otherwise.
+ *
+ * @property isPaused
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.LogReader.prototype.isPaused = false;
+
+/**
+ * Enables draggable LogReader if DragDrop Utility is present.
+ *
+ * @property draggable
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.LogReader.prototype.draggable = true;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Public methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Public accessor to the unique name of the LogReader instance.
+ *
+ * @method toString
+ * @return {String} Unique name of the LogReader instance.
+ */
+YAHOO.widget.LogReader.prototype.toString = function() {
+    return "LogReader instance" + this._sName;
+};
+/**
+ * Pauses output of log messages. While paused, log messages are not lost, but
+ * get saved to a buffer and then output upon resume of LogReader.
+ *
+ * @method pause
+ */
+YAHOO.widget.LogReader.prototype.pause = function() {
+    this.isPaused = true;
+    this._btnPause.value = "Resume";
+    this._timeout = null;
+    this.logReaderEnabled = false;
+};
+
+/**
+ * Resumes output of log messages, including outputting any log messages that
+ * have been saved to buffer while paused.
+ *
+ * @method resume
+ */
+YAHOO.widget.LogReader.prototype.resume = function() {
+    this.isPaused = false;
+    this._btnPause.value = "Pause";
+    this.logReaderEnabled = true;
+    this._printBuffer();
+};
+
+/**
+ * Hides UI of LogReader. Logging functionality is not disrupted.
+ *
+ * @method hide
+ */
+YAHOO.widget.LogReader.prototype.hide = function() {
+    this._elContainer.style.display = "none";
+};
+
+/**
+ * Shows UI of LogReader. Logging functionality is not disrupted.
+ *
+ * @method show
+ */
+YAHOO.widget.LogReader.prototype.show = function() {
+    this._elContainer.style.display = "block";
+};
+
+/**
+ * Collapses UI of LogReader. Logging functionality is not disrupted.
+ *
+ * @method collapse
+ */
+YAHOO.widget.LogReader.prototype.collapse = function() {
+    this._elConsole.style.display = "none";
+    if(this._elFt) {
+        this._elFt.style.display = "none";
+    }
+    this._btnCollapse.value = "Expand";
+    this.isCollapsed = true;
+};
+
+/**
+ * Expands UI of LogReader. Logging functionality is not disrupted.
+ *
+ * @method expand
+ */
+YAHOO.widget.LogReader.prototype.expand = function() {
+    this._elConsole.style.display = "block";
+    if(this._elFt) {
+        this._elFt.style.display = "block";
+    }
+    this._btnCollapse.value = "Collapse";
+    this.isCollapsed = false;
+};
+
+/**
+ * Returns related checkbox element for given filter (i.e., category or source).
+ *
+ * @method getCheckbox
+ * @param {String} Category or source name.
+ * @return {Array} Array of all filter checkboxes.
+ */
+YAHOO.widget.LogReader.prototype.getCheckbox = function(filter) {
+    return this._filterCheckboxes[filter];
+};
+
+/**
+ * Returns array of enabled categories.
+ *
+ * @method getCategories
+ * @return {String[]} Array of enabled categories.
+ */
+YAHOO.widget.LogReader.prototype.getCategories = function() {
+    return this._categoryFilters;
+};
+
+/**
+ * Shows log messages associated with given category.
+ *
+ * @method showCategory
+ * @param {String} Category name.
+ */
+YAHOO.widget.LogReader.prototype.showCategory = function(sCategory) {
+    var filtersArray = this._categoryFilters;
+    // Don't do anything if category is already enabled
+    // Use Array.indexOf if available...
+    if(filtersArray.indexOf) {
+         if(filtersArray.indexOf(sCategory) >  -1) {
+            return;
+        }
+    }
+    // ...or do it the old-fashioned way
+    else {
+        for(var i=0; i<filtersArray.length; i++) {
+           if(filtersArray[i] === sCategory){
+                return;
+            }
+        }
+    }
+
+    this._categoryFilters.push(sCategory);
+    this._filterLogs();
+    var elCheckbox = this.getCheckbox(sCategory);
+    if(elCheckbox) {
+        elCheckbox.checked = true;
+    }
+};
+
+/**
+ * Hides log messages associated with given category.
+ *
+ * @method hideCategory
+ * @param {String} Category name.
+ */
+YAHOO.widget.LogReader.prototype.hideCategory = function(sCategory) {
+    var filtersArray = this._categoryFilters;
+    for(var i=0; i<filtersArray.length; i++) {
+        if(sCategory == filtersArray[i]) {
+            filtersArray.splice(i, 1);
+            break;
+        }
+    }
+    this._filterLogs();
+    var elCheckbox = this.getCheckbox(sCategory);
+    if(elCheckbox) {
+        elCheckbox.checked = false;
+    }
+};
+
+/**
+ * Returns array of enabled sources.
+ *
+ * @method getSources
+ * @return {Array} Array of enabled sources.
+ */
+YAHOO.widget.LogReader.prototype.getSources = function() {
+    return this._sourceFilters;
+};
+
+/**
+ * Shows log messages associated with given source.
+ *
+ * @method showSource
+ * @param {String} Source name.
+ */
+YAHOO.widget.LogReader.prototype.showSource = function(sSource) {
+    var filtersArray = this._sourceFilters;
+    // Don't do anything if category is already enabled
+    // Use Array.indexOf if available...
+    if(filtersArray.indexOf) {
+         if(filtersArray.indexOf(sSource) >  -1) {
+            return;
+        }
+    }
+    // ...or do it the old-fashioned way
+    else {
+        for(var i=0; i<filtersArray.length; i++) {
+           if(sSource == filtersArray[i]){
+                return;
+            }
+        }
+    }
+    filtersArray.push(sSource);
+    this._filterLogs();
+    var elCheckbox = this.getCheckbox(sSource);
+    if(elCheckbox) {
+        elCheckbox.checked = true;
+    }
+};
+
+/**
+ * Hides log messages associated with given source.
+ *
+ * @method hideSource
+ * @param {String} Source name.
+ */
+YAHOO.widget.LogReader.prototype.hideSource = function(sSource) {
+    var filtersArray = this._sourceFilters;
+    for(var i=0; i<filtersArray.length; i++) {
+        if(sSource == filtersArray[i]) {
+            filtersArray.splice(i, 1);
+            break;
+        }
+    }
+    this._filterLogs();
+    var elCheckbox = this.getCheckbox(sSource);
+    if(elCheckbox) {
+        elCheckbox.checked = false;
+    }
+};
+
+/**
+ * Does not delete any log messages, but clears all printed log messages from
+ * the console. Log messages will be printed out again if user re-filters. The
+ * static method YAHOO.widget.Logger.reset() should be called in order to
+ * actually delete log messages.
+ *
+ * @method clearConsole
+ */
+YAHOO.widget.LogReader.prototype.clearConsole = function() {
+    // Clear the buffer of any pending messages
+    this._timeout = null;
+    this._buffer = [];
+    this._consoleMsgCount = 0;
+
+    var elConsole = this._elConsole;
+    while(elConsole.hasChildNodes()) {
+        elConsole.removeChild(elConsole.firstChild);
+    }
+};
+
+/**
+ * Updates title to given string.
+ *
+ * @method setTitle
+ * @param sTitle {String} New title.
+ */
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {
+    this._title.innerHTML = this.html2Text(sTitle);
+};
+
+/**
+ * Gets timestamp of the last log.
+ *
+ * @method getLastTime
+ * @return {Date} Timestamp of the last log.
+ */
+YAHOO.widget.LogReader.prototype.getLastTime = function() {
+    return this._lastTime;
+};
+
+/**
+ * Formats message string to HTML for output to console.
+ *
+ * @method formatMsg
+ * @param oLogMsg {Object} Log message object.
+ * @return {String} HTML-formatted message for output to console.
+ */
+YAHOO.widget.LogReader.prototype.formatMsg = function(oLogMsg) {
+    var category = oLogMsg.category;
+    
+    // Label for color-coded display
+    var label = category.substring(0,4).toUpperCase();
+
+    // Calculate the elapsed time to be from the last item that passed through the filter,
+    // not the absolute previous item in the stack
+
+    var time = oLogMsg.time;
+    if (time.toLocaleTimeString) {
+        var localTime  = time.toLocaleTimeString();
+    }
+    else {
+        localTime = time.toString();
+    }
+
+    var msecs = time.getTime();
+    var startTime = YAHOO.widget.Logger.getStartTime();
+    var totalTime = msecs - startTime;
+    var elapsedTime = msecs - this.getLastTime();
+
+    var source = oLogMsg.source;
+    var sourceDetail = oLogMsg.sourceDetail;
+    var sourceAndDetail = (sourceDetail) ?
+        source + " " + sourceDetail : source;
+        
+    
+    // Escape HTML entities in the log message itself for output to console
+    //var msg = this.html2Text(oLogMsg.msg); //TODO: delete
+    var msg = this.html2Text(YAHOO.lang.dump(oLogMsg.msg));
+
+    // Verbose output includes extra line breaks
+    var output =  (this.verboseOutput) ?
+        ["<pre class=\"yui-log-verbose\"><p><span class='", category, "'>", label, "</span> ",
+        totalTime, "ms (+", elapsedTime, ") ",
+        localTime, ": ",
+        "</p><p>",
+        sourceAndDetail,
+        ": </p><p>",
+        msg,
+        "</p></pre>"] :
+
+        ["<pre><p><span class='", category, "'>", label, "</span> ",
+        totalTime, "ms (+", elapsedTime, ") ",
+        localTime, ": ",
+        sourceAndDetail, ": ",
+        msg, "</p></pre>"];
+
+    return output.join("");
+};
+
+/**
+ * Converts input chars "<", ">", and "&" to HTML entities.
+ *
+ * @method html2Text
+ * @param sHtml {String} String to convert.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype.html2Text = function(sHtml) {
+    if(sHtml) {
+        sHtml += "";
+        return sHtml.replace(/&/g, "&#38;").replace(/</g, "&#60;").replace(/>/g, "&#62;");
+    }
+    return "";
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private member variables
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Internal class member to index multiple LogReader instances.
+ *
+ * @property _memberName
+ * @static
+ * @type Number
+ * @default 0
+ * @private
+ */
+YAHOO.widget.LogReader._index = 0;
+
+/**
+ * Name of LogReader instance.
+ *
+ * @property _sName
+ * @type String
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sName = null;
+
+//TODO: remove
+/**
+ * A class member shared by all LogReaders if a container needs to be
+ * created during instantiation. Will be null if a container element never needs to
+ * be created on the fly, such as when the implementer passes in their own element.
+ *
+ * @property _elDefaultContainer
+ * @type HTMLElement
+ * @private
+ */
+//YAHOO.widget.LogReader._elDefaultContainer = null;
+
+/**
+ * Buffer of log message objects for batch output.
+ *
+ * @property _buffer
+ * @type Object[]
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._buffer = null;
+
+/**
+ * Number of log messages output to console.
+ *
+ * @property _consoleMsgCount
+ * @type Number
+ * @default 0
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleMsgCount = 0;
+
+/**
+ * Date of last output log message.
+ *
+ * @property _lastTime
+ * @type Date
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._lastTime = null;
+
+/**
+ * Batched output timeout ID.
+ *
+ * @property _timeout
+ * @type Number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._timeout = null;
+
+/**
+ * Hash of filters and their related checkbox elements.
+ *
+ * @property _filterCheckboxes
+ * @type Object
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._filterCheckboxes = null;
+
+/**
+ * Array of filters for log message categories.
+ *
+ * @property _categoryFilters
+ * @type String[]
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFilters = null;
+
+/**
+ * Array of filters for log message sources.
+ *
+ * @property _sourceFilters
+ * @type String[]
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFilters = null;
+
+/**
+ * LogReader container element.
+ *
+ * @property _elContainer
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elContainer = null;
+
+/**
+ * LogReader header element.
+ *
+ * @property _elHd
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elHd = null;
+
+/**
+ * LogReader collapse element.
+ *
+ * @property _elCollapse
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elCollapse = null;
+
+/**
+ * LogReader collapse button element.
+ *
+ * @property _btnCollapse
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnCollapse = null;
+
+/**
+ * LogReader title header element.
+ *
+ * @property _title
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._title = null;
+
+/**
+ * LogReader console element.
+ *
+ * @property _elConsole
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elConsole = null;
+
+/**
+ * LogReader footer element.
+ *
+ * @property _elFt
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elFt = null;
+
+/**
+ * LogReader buttons container element.
+ *
+ * @property _elBtns
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elBtns = null;
+
+/**
+ * Container element for LogReader category filter checkboxes.
+ *
+ * @property _elCategoryFilters
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elCategoryFilters = null;
+
+/**
+ * Container element for LogReader source filter checkboxes.
+ *
+ * @property _elSourceFilters
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._elSourceFilters = null;
+
+/**
+ * LogReader pause button element.
+ *
+ * @property _btnPause
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnPause = null;
+
+/**
+ * Clear button element.
+ *
+ * @property _btnClear
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnClear = null;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private methods
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Initializes the primary container element.
+ *
+ * @method _initContainerEl
+ * @param elContainer {HTMLElement} Container element by reference or string ID.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initContainerEl = function(elContainer) {
+    // Validate container
+    elContainer = YAHOO.util.Dom.get(elContainer);
+    // Attach to existing container...
+    if(elContainer && elContainer.tagName && (elContainer.tagName.toLowerCase() == "div")) {
+        this._elContainer = elContainer;
+        YAHOO.util.Dom.addClass(this._elContainer,"yui-log");
+    }
+    // ...or create container from scratch
+    else {
+        this._elContainer = document.body.appendChild(document.createElement("div"));
+        //this._elContainer.id = "yui-log" + this._sName;
+        YAHOO.util.Dom.addClass(this._elContainer,"yui-log");
+        YAHOO.util.Dom.addClass(this._elContainer,"yui-log-container");
+
+        //YAHOO.widget.LogReader._elDefaultContainer = this._elContainer;
+
+        // If implementer has provided container values, trust and set those
+        var containerStyle = this._elContainer.style;
+        if(this.width) {
+            containerStyle.width = this.width;
+        }
+        if(this.right) {
+            containerStyle.right = this.right;
+        }
+        if(this.top) {
+            containerStyle.top = this.top;
+        }
+         if(this.left) {
+            containerStyle.left = this.left;
+            containerStyle.right = "auto";
+        }
+        if(this.bottom) {
+            containerStyle.bottom = this.bottom;
+            containerStyle.top = "auto";
+        }
+       if(this.fontSize) {
+            containerStyle.fontSize = this.fontSize;
+        }
+        // For Opera
+        if(navigator.userAgent.toLowerCase().indexOf("opera") != -1) {
+            document.body.style += '';
+        }
+    }
+};
+
+/**
+ * Initializes the header element.
+ *
+ * @method _initHeaderEl
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initHeaderEl = function() {
+    var oSelf = this;
+
+    // Destroy header
+    if(this._elHd) {
+        // Unhook DOM events
+        YAHOO.util.Event.purgeElement(this._elHd, true);
+
+        // Remove DOM elements
+        this._elHd.innerHTML = "";
+    }
+    
+    // Create header
+    this._elHd = this._elContainer.appendChild(document.createElement("div"));
+    this._elHd.id = "yui-log-hd" + this._sName;
+    this._elHd.className = "yui-log-hd";
+
+    this._elCollapse = this._elHd.appendChild(document.createElement("div"));
+    this._elCollapse.className = "yui-log-btns";
+
+    this._btnCollapse = document.createElement("input");
+    this._btnCollapse.type = "button";
+    //this._btnCollapse.style.fontSize =
+    //    YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");
+    this._btnCollapse.className = "yui-log-button";
+    this._btnCollapse.value = "Collapse";
+    this._btnCollapse = this._elCollapse.appendChild(this._btnCollapse);
+    YAHOO.util.Event.addListener(
+        oSelf._btnCollapse,'click',oSelf._onClickCollapseBtn,oSelf);
+
+    this._title = this._elHd.appendChild(document.createElement("h4"));
+    this._title.innerHTML = "Logger Console";
+};
+
+/**
+ * Initializes the console element.
+ *
+ * @method _initConsoleEl
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initConsoleEl = function() {
+    // Destroy console
+    if(this._elConsole) {
+        // Unhook DOM events
+        YAHOO.util.Event.purgeElement(this._elConsole, true);
+
+        // Remove DOM elements
+        this._elConsole.innerHTML = "";
+    }
+
+    // Ceate console
+    this._elConsole = this._elContainer.appendChild(document.createElement("div"));
+    this._elConsole.className = "yui-log-bd";
+
+    // If implementer has provided console, trust and set those
+    if(this.height) {
+        this._elConsole.style.height = this.height;
+    }
+};
+
+/**
+ * Initializes the footer element.
+ *
+ * @method _initFooterEl
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initFooterEl = function() {
+    var oSelf = this;
+
+    // Don't create footer elements if footer is disabled
+    if(this.footerEnabled) {
+        // Destroy console
+        if(this._elFt) {
+            // Unhook DOM events
+            YAHOO.util.Event.purgeElement(this._elFt, true);
+
+            // Remove DOM elements
+            this._elFt.innerHTML = "";
+        }
+
+        this._elFt = this._elContainer.appendChild(document.createElement("div"));
+        this._elFt.className = "yui-log-ft";
+
+        this._elBtns = this._elFt.appendChild(document.createElement("div"));
+        this._elBtns.className = "yui-log-btns";
+
+        this._btnPause = document.createElement("input");
+        this._btnPause.type = "button";
+        //this._btnPause.style.fontSize =
+        //    YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");
+        this._btnPause.className = "yui-log-button";
+        this._btnPause.value = "Pause";
+        this._btnPause = this._elBtns.appendChild(this._btnPause);
+        YAHOO.util.Event.addListener(
+            oSelf._btnPause,'click',oSelf._onClickPauseBtn,oSelf);
+
+        this._btnClear = document.createElement("input");
+        this._btnClear.type = "button";
+        //this._btnClear.style.fontSize =
+        //    YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");
+        this._btnClear.className = "yui-log-button";
+        this._btnClear.value = "Clear";
+        this._btnClear = this._elBtns.appendChild(this._btnClear);
+        YAHOO.util.Event.addListener(
+            oSelf._btnClear,'click',oSelf._onClickClearBtn,oSelf);
+
+        this._elCategoryFilters = this._elFt.appendChild(document.createElement("div"));
+        this._elCategoryFilters.className = "yui-log-categoryfilters";
+        this._elSourceFilters = this._elFt.appendChild(document.createElement("div"));
+        this._elSourceFilters.className = "yui-log-sourcefilters";
+    }
+};
+
+/**
+ * Initializes Drag and Drop on the header element.
+ *
+ * @method _initDragDrop
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initDragDrop = function() {
+    // If Drag and Drop utility is available...
+    // ...and draggable is true...
+    // ...then make the header draggable
+    if(YAHOO.util.DD && this.draggable && this._elHd) {
+        var ylog_dd = new YAHOO.util.DD(this._elContainer);
+        ylog_dd.setHandleElId(this._elHd.id);
+        //TODO: use class name
+        this._elHd.style.cursor = "move";
+    }
+};
+
+/**
+ * Initializes category filters.
+ *
+ * @method _initCategories
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initCategories = function() {
+    // Initialize category filters
+    this._categoryFilters = [];
+    var aInitialCategories = YAHOO.widget.Logger.categories;
+
+    for(var j=0; j < aInitialCategories.length; j++) {
+        var sCategory = aInitialCategories[j];
+
+        // Add category to the internal array of filters
+        this._categoryFilters.push(sCategory);
+
+        // Add checkbox element if UI is enabled
+        if(this._elCategoryFilters) {
+            this._createCategoryCheckbox(sCategory);
+        }
+    }
+};
+
+/**
+ * Initializes source filters.
+ *
+ * @method _initSources
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._initSources = function() {
+    // Initialize source filters
+    this._sourceFilters = [];
+    var aInitialSources = YAHOO.widget.Logger.sources;
+
+    for(var j=0; j < aInitialSources.length; j++) {
+        var sSource = aInitialSources[j];
+
+        // Add source to the internal array of filters
+        this._sourceFilters.push(sSource);
+
+        // Add checkbox element if UI is enabled
+        if(this._elSourceFilters) {
+            this._createSourceCheckbox(sSource);
+        }
+    }}
+;
+
+/**
+ * Creates the UI for a category filter in the LogReader footer element.
+ *
+ * @method _createCategoryCheckbox
+ * @param sCategory {String} Category name.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(sCategory) {
+    var oSelf = this;
+
+    if(this._elFt) {
+        var elParent = this._elCategoryFilters;
+        var elFilter = elParent.appendChild(document.createElement("span"));
+        elFilter.className = "yui-log-filtergrp";
+        
+        // Append el at the end so IE 5.5 can set "type" attribute
+        // and THEN set checked property
+        var chkCategory = document.createElement("input");
+        chkCategory.id = "yui-log-filter-" + sCategory + this._sName;
+        chkCategory.className = "yui-log-filter-" + sCategory;
+        chkCategory.type = "checkbox";
+        chkCategory.category = sCategory;
+        chkCategory = elFilter.appendChild(chkCategory);
+        chkCategory.checked = true;
+
+        // Subscribe to the click event
+        YAHOO.util.Event.addListener(chkCategory,'click',oSelf._onCheckCategory,oSelf);
+
+        // Create and class the text label
+        var lblCategory = elFilter.appendChild(document.createElement("label"));
+        lblCategory.htmlFor = chkCategory.id;
+        lblCategory.className = sCategory;
+        lblCategory.innerHTML = sCategory;
+        
+        this._filterCheckboxes[sCategory] = chkCategory;
+    }
+};
+
+/**
+ * Creates a checkbox in the LogReader footer element to filter by source.
+ *
+ * @method _createSourceCheckbox
+ * @param sSource {String} Source name.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(sSource) {
+    var oSelf = this;
+
+    if(this._elFt) {
+        var elParent = this._elSourceFilters;
+        var elFilter = elParent.appendChild(document.createElement("span"));
+        elFilter.className = "yui-log-filtergrp";
+
+        // Append el at the end so IE 5.5 can set "type" attribute
+        // and THEN set checked property
+        var chkSource = document.createElement("input");
+        chkSource.id = "yui-log-filter" + sSource + this._sName;
+        chkSource.className = "yui-log-filter" + sSource;
+        chkSource.type = "checkbox";
+        chkSource.source = sSource;
+        chkSource = elFilter.appendChild(chkSource);
+        chkSource.checked = true;
+
+        // Subscribe to the click event
+        YAHOO.util.Event.addListener(chkSource,'click',oSelf._onCheckSource,oSelf);
+
+        // Create and class the text label
+        var lblSource = elFilter.appendChild(document.createElement("label"));
+        lblSource.htmlFor = chkSource.id;
+        lblSource.className = sSource;
+        lblSource.innerHTML = sSource;
+        
+        this._filterCheckboxes[sSource] = chkSource;
+    }
+};
+
+/**
+ * Reprints all log messages in the stack through filters.
+ *
+ * @method _filterLogs
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._filterLogs = function() {
+    // Reprint stack with new filters
+    if (this._elConsole !== null) {
+        this.clearConsole();
+        this._printToConsole(YAHOO.widget.Logger.getStack());
+    }
+};
+
+/**
+ * Sends buffer of log messages to output and clears buffer.
+ *
+ * @method _printBuffer
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printBuffer = function() {
+    this._timeout = null;
+
+    if(this._elConsole !== null) {
+        var thresholdMax = this.thresholdMax;
+        thresholdMax = (thresholdMax && !isNaN(thresholdMax)) ? thresholdMax : 500;
+        if(this._consoleMsgCount < thresholdMax) {
+            var entries = [];
+            for (var i=0; i<this._buffer.length; i++) {
+                entries[i] = this._buffer[i];
+            }
+            this._buffer = [];
+            this._printToConsole(entries);
+        }
+        else {
+            this._filterLogs();
+        }
+        
+        if(!this.newestOnTop) {
+            this._elConsole.scrollTop = this._elConsole.scrollHeight;
+        }
+    }
+};
+
+/**
+ * Cycles through an array of log messages, and outputs each one to the console
+ * if its category has not been filtered out.
+ *
+ * @method _printToConsole
+ * @param aEntries {Object[]} Array of LogMsg objects to output to console.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {
+    // Manage the number of messages displayed in the console
+    var entriesLen = aEntries.length;
+    var thresholdMin = this.thresholdMin;
+    if(isNaN(thresholdMin) || (thresholdMin > this.thresholdMax)) {
+        thresholdMin = 0;
+    }
+    var entriesStartIndex = (entriesLen > thresholdMin) ? (entriesLen - thresholdMin) : 0;
+    
+    // Iterate through all log entries 
+    var sourceFiltersLen = this._sourceFilters.length;
+    var categoryFiltersLen = this._categoryFilters.length;
+    for(var i=entriesStartIndex; i<entriesLen; i++) {
+        // Print only the ones that filter through
+        var okToPrint = false;
+        var okToFilterCats = false;
+
+        // Get log message details
+        var entry = aEntries[i];
+        var source = entry.source;
+        var category = entry.category;
+
+        for(var j=0; j<sourceFiltersLen; j++) {
+            if(source == this._sourceFilters[j]) {
+                okToFilterCats = true;
+                break;
+            }
+        }
+        if(okToFilterCats) {
+            for(var k=0; k<categoryFiltersLen; k++) {
+                if(category == this._categoryFilters[k]) {
+                    okToPrint = true;
+                    break;
+                }
+            }
+        }
+        if(okToPrint) {
+            var output = this.formatMsg(entry);
+            if(this.newestOnTop) {
+                this._elConsole.innerHTML = output + this._elConsole.innerHTML;
+            }
+            else {
+                this._elConsole.innerHTML += output;
+            }
+            this._consoleMsgCount++;
+            this._lastTime = entry.time.getTime();
+        }
+    }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private event handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Handles Logger's categoryCreateEvent.
+ *
+ * @method _onCategoryCreate
+ * @param sType {String} The event.
+ * @param aArgs {Object[]} Data passed from event firer.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(sType, aArgs, oSelf) {
+    var category = aArgs[0];
+    
+    // Add category to the internal array of filters
+    oSelf._categoryFilters.push(category);
+
+    if(oSelf._elFt) {
+        oSelf._createCategoryCheckbox(category);
+    }
+};
+
+/**
+ * Handles Logger's sourceCreateEvent.
+ *
+ * @method _onSourceCreate
+ * @param sType {String} The event.
+ * @param aArgs {Object[]} Data passed from event firer.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(sType, aArgs, oSelf) {
+    var source = aArgs[0];
+    
+    // Add source to the internal array of filters
+    oSelf._sourceFilters.push(source);
+
+    if(oSelf._elFt) {
+        oSelf._createSourceCheckbox(source);
+    }
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @method _onCheckCategory
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {
+    var category = this.category;
+    if(!this.checked) {
+        oSelf.hideCategory(category);
+    }
+    else {
+        oSelf.showCategory(category);
+    }
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @method _onCheckSource
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {
+    var source = this.source;
+    if(!this.checked) {
+        oSelf.hideSource(source);
+    }
+    else {
+        oSelf.showSource(source);
+    }
+};
+
+/**
+ * Handles click events on the collapse button.
+ *
+ * @method _onClickCollapseBtn
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {Object} The LogReader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {
+    if(!oSelf.isCollapsed) {
+        oSelf.collapse();
+    }
+    else {
+        oSelf.expand();
+    }
+};
+
+/**
+ * Handles click events on the pause button.
+ *
+ * @method _onClickPauseBtn
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {
+    if(!oSelf.isPaused) {
+        oSelf.pause();
+    }
+    else {
+        oSelf.resume();
+    }
+};
+
+/**
+ * Handles click events on the clear button.
+ *
+ * @method _onClickClearBtn
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {
+    oSelf.clearConsole();
+};
+
+/**
+ * Handles Logger's newLogEvent.
+ *
+ * @method _onNewLog
+ * @param sType {String} The event.
+ * @param aArgs {Object[]} Data passed from event firer.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onNewLog = function(sType, aArgs, oSelf) {
+    var logEntry = aArgs[0];
+    oSelf._buffer.push(logEntry);
+
+    if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {
+        oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, oSelf.outputBuffer);
+    }
+};
+
+/**
+ * Handles Logger's resetEvent.
+ *
+ * @method _onReset
+ * @param sType {String} The event.
+ * @param aArgs {Object[]} Data passed from event firer.
+ * @param oSelf {Object} The LogReader instance.
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onReset = function(sType, aArgs, oSelf) {
+    oSelf._filterLogs();
+};
+
+ /**
+ * The Logger widget provides a simple way to read or write log messages in
+ * JavaScript code. Integration with the YUI Library's debug builds allow
+ * implementers to access under-the-hood events, errors, and debugging messages.
+ * Output may be read through a LogReader console and/or output to a browser
+ * console.
+ *
+ * @module logger
+ * @requires yahoo, event, dom
+ * @optional dragdrop
+ * @namespace YAHOO.widget
+ * @title Logger Widget
+ */
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+// Define once
+if(!YAHOO.widget.Logger) {
+    /**
+     * The singleton Logger class provides core log management functionality. Saves
+     * logs written through the global YAHOO.log function or written by a LogWriter
+     * instance. Provides access to logs for reading by a LogReader instance or
+     * native browser console such as the Firebug extension to Firefox or Safari's
+     * JavaScript console through integration with the console.log() method.
+     *
+     * @class Logger
+     * @static
+     */
+    YAHOO.widget.Logger = {
+        // Initialize properties
+        loggerEnabled: true,
+        _browserConsoleEnabled: false,
+        categories: ["info","warn","error","time","window"],
+        sources: ["global"],
+        _stack: [], // holds all log msgs
+        maxStackEntries: 2500,
+        _startTime: new Date().getTime(), // static start timestamp
+        _lastTime: null // timestamp of last logged message
+    };
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Public properties
+    //
+    /////////////////////////////////////////////////////////////////////////////
+    /**
+     * True if Logger is enabled, false otherwise.
+     *
+     * @property loggerEnabled
+     * @type Boolean
+     * @static
+     * @default true
+     */
+
+    /**
+     * Array of categories.
+     *
+     * @property categories
+     * @type String[]
+     * @static
+     * @default ["info","warn","error","time","window"]
+     */
+
+    /**
+     * Array of sources.
+     *
+     * @property sources
+     * @type String[]
+     * @static
+     * @default ["global"]
+     */
+
+    /**
+     * Upper limit on size of internal stack.
+     *
+     * @property maxStackEntries
+     * @type Number
+     * @static
+     * @default 2500
+     */
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Private properties
+    //
+    /////////////////////////////////////////////////////////////////////////////
+    /**
+     * Internal property to track whether output to browser console is enabled.
+     *
+     * @property _browserConsoleEnabled
+     * @type Boolean
+     * @static
+     * @default false
+     * @private
+     */
+
+    /**
+     * Array to hold all log messages.
+     *
+     * @property _stack
+     * @type Array
+     * @static
+     * @private
+     */
+    /**
+     * Static timestamp of Logger initialization.
+     *
+     * @property _startTime
+     * @type Date
+     * @static
+     * @private
+     */
+    /**
+     * Timestamp of last logged message.
+     *
+     * @property _lastTime
+     * @type Date
+     * @static
+     * @private
+     */
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Public methods
+    //
+    /////////////////////////////////////////////////////////////////////////////
+    /**
+     * Saves a log message to the stack and fires newLogEvent. If the log message is
+     * assigned to an unknown category, creates a new category. If the log message is
+     * from an unknown source, creates a new source.  If browser console is enabled,
+     * outputs the log message to browser console.
+     *
+     * @method log
+     * @param sMsg {String} The log message.
+     * @param sCategory {String} Category of log message, or null.
+     * @param sSource {String} Source of LogWriter, or null if global.
+     */
+    YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {
+        if(this.loggerEnabled) {
+            if(!sCategory) {
+                sCategory = "info"; // default category
+            }
+            else {
+                sCategory = sCategory.toLocaleLowerCase();
+                if(this._isNewCategory(sCategory)) {
+                    this._createNewCategory(sCategory);
+                }
+            }
+            var sClass = "global"; // default source
+            var sDetail = null;
+            if(sSource) {
+                var spaceIndex = sSource.indexOf(" ");
+                if(spaceIndex > 0) {
+                    // Substring until first space
+                    sClass = sSource.substring(0,spaceIndex);
+                    // The rest of the source
+                    sDetail = sSource.substring(spaceIndex,sSource.length);
+                }
+                else {
+                    sClass = sSource;
+                }
+                if(this._isNewSource(sClass)) {
+                    this._createNewSource(sClass);
+                }
+            }
+
+            var timestamp = new Date();
+            var logEntry = new YAHOO.widget.LogMsg({
+                msg: sMsg,
+                time: timestamp,
+                category: sCategory,
+                source: sClass,
+                sourceDetail: sDetail
+            });
+
+            var stack = this._stack;
+            var maxStackEntries = this.maxStackEntries;
+            if(maxStackEntries && !isNaN(maxStackEntries) &&
+                (stack.length >= maxStackEntries)) {
+                stack.shift();
+            }
+            stack.push(logEntry);
+            this.newLogEvent.fire(logEntry);
+
+            if(this._browserConsoleEnabled) {
+                this._printToBrowserConsole(logEntry);
+            }
+            return true;
+        }
+        else {
+            return false;
+        }
+    };
+
+    /**
+     * Resets internal stack and startTime, enables Logger, and fires logResetEvent.
+     *
+     * @method reset
+     */
+    YAHOO.widget.Logger.reset = function() {
+        this._stack = [];
+        this._startTime = new Date().getTime();
+        this.loggerEnabled = true;
+        this.log("Logger reset");
+        this.logResetEvent.fire();
+    };
+
+    /**
+     * Public accessor to internal stack of log message objects.
+     *
+     * @method getStack
+     * @return {Object[]} Array of log message objects.
+     */
+    YAHOO.widget.Logger.getStack = function() {
+        return this._stack;
+    };
+
+    /**
+     * Public accessor to internal start time.
+     *
+     * @method getStartTime
+     * @return {Date} Internal date of when Logger singleton was initialized.
+     */
+    YAHOO.widget.Logger.getStartTime = function() {
+        return this._startTime;
+    };
+
+    /**
+     * Disables output to the browser's global console.log() function, which is used
+     * by the Firebug extension to Firefox as well as Safari.
+     *
+     * @method disableBrowserConsole
+     */
+    YAHOO.widget.Logger.disableBrowserConsole = function() {
+        YAHOO.log("Logger output to the function console.log() has been disabled.");
+        this._browserConsoleEnabled = false;
+    };
+
+    /**
+     * Enables output to the browser's global console.log() function, which is used
+     * by the Firebug extension to Firefox as well as Safari.
+     *
+     * @method enableBrowserConsole
+     */
+    YAHOO.widget.Logger.enableBrowserConsole = function() {
+        this._browserConsoleEnabled = true;
+        YAHOO.log("Logger output to the function console.log() has been enabled.");
+    };
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Public events
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+     /**
+     * Fired when a new category has been created.
+     *
+     * @event categoryCreateEvent
+     * @param sCategory {String} Category name.
+     */
+    YAHOO.widget.Logger.categoryCreateEvent =
+        new YAHOO.util.CustomEvent("categoryCreate", this, true);
+
+     /**
+     * Fired when a new source has been named.
+     *
+     * @event sourceCreateEvent
+     * @param sSource {String} Source name.
+     */
+    YAHOO.widget.Logger.sourceCreateEvent =
+        new YAHOO.util.CustomEvent("sourceCreate", this, true);
+
+     /**
+     * Fired when a new log message has been created.
+     *
+     * @event newLogEvent
+     * @param sMsg {String} Log message.
+     */
+    YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this, true);
+
+    /**
+     * Fired when the Logger has been reset has been created.
+     *
+     * @event logResetEvent
+     */
+    YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset", this, true);
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Private methods
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Creates a new category of log messages and fires categoryCreateEvent.
+     *
+     * @method _createNewCategory
+     * @param sCategory {String} Category name.
+     * @private
+     */
+    YAHOO.widget.Logger._createNewCategory = function(sCategory) {
+        this.categories.push(sCategory);
+        this.categoryCreateEvent.fire(sCategory);
+    };
+
+    /**
+     * Checks to see if a category has already been created.
+     *
+     * @method _isNewCategory
+     * @param sCategory {String} Category name.
+     * @return {Boolean} Returns true if category is unknown, else returns false.
+     * @private
+     */
+    YAHOO.widget.Logger._isNewCategory = function(sCategory) {
+        for(var i=0; i < this.categories.length; i++) {
+            if(sCategory == this.categories[i]) {
+                return false;
+            }
+        }
+        return true;
+    };
+
+    /**
+     * Creates a new source of log messages and fires sourceCreateEvent.
+     *
+     * @method _createNewSource
+     * @param sSource {String} Source name.
+     * @private
+     */
+    YAHOO.widget.Logger._createNewSource = function(sSource) {
+        this.sources.push(sSource);
+        this.sourceCreateEvent.fire(sSource);
+    };
+
+    /**
+     * Checks to see if a source already exists.
+     *
+     * @method _isNewSource
+     * @param sSource {String} Source name.
+     * @return {Boolean} Returns true if source is unknown, else returns false.
+     * @private
+     */
+    YAHOO.widget.Logger._isNewSource = function(sSource) {
+        if(sSource) {
+            for(var i=0; i < this.sources.length; i++) {
+                if(sSource == this.sources[i]) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    };
+
+    /**
+     * Outputs a log message to global console.log() function.
+     *
+     * @method _printToBrowserConsole
+     * @param oEntry {Object} Log entry object.
+     * @private
+     */
+    YAHOO.widget.Logger._printToBrowserConsole = function(oEntry) {
+        if(window.console && console.log) {
+            var category = oEntry.category;
+            var label = oEntry.category.substring(0,4).toUpperCase();
+
+            var time = oEntry.time;
+            if (time.toLocaleTimeString) {
+                var localTime  = time.toLocaleTimeString();
+            }
+            else {
+                localTime = time.toString();
+            }
+
+            var msecs = time.getTime();
+            var elapsedTime = (YAHOO.widget.Logger._lastTime) ?
+                (msecs - YAHOO.widget.Logger._lastTime) : 0;
+            YAHOO.widget.Logger._lastTime = msecs;
+
+            var output =
+                localTime + " (" +
+                elapsedTime + "ms): " +
+                oEntry.source + ": " +
+                oEntry.msg;
+
+            console.log(output);
+        }
+    };
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Private event handlers
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Handles logging of messages due to window error events.
+     *
+     * @method _onWindowError
+     * @param sMsg {String} The error message.
+     * @param sUrl {String} URL of the error.
+     * @param sLine {String} Line number of the error.
+     * @private
+     */
+    YAHOO.widget.Logger._onWindowError = function(sMsg,sUrl,sLine) {
+        // Logger is not in scope of this event handler
+        try {
+            YAHOO.widget.Logger.log(sMsg+' ('+sUrl+', line '+sLine+')', "window");
+            if(YAHOO.widget.Logger._origOnWindowError) {
+                YAHOO.widget.Logger._origOnWindowError();
+            }
+        }
+        catch(e) {
+            return false;
+        }
+    };
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // Enable handling of native JavaScript errors
+    // NB: Not all browsers support the window.onerror event
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    if(window.onerror) {
+        // Save any previously defined handler to call
+        YAHOO.widget.Logger._origOnWindowError = window.onerror;
+    }
+    window.onerror = YAHOO.widget.Logger._onWindowError;
+
+    /////////////////////////////////////////////////////////////////////////////
+    //
+    // First log
+    //
+    /////////////////////////////////////////////////////////////////////////////
+
+    YAHOO.widget.Logger.log("Logger initialized");
+}
+
+
+YAHOO.register("logger", YAHOO.widget.Logger, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/menu.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/menu.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/menu.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,8915 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+
+
+/**
+* @module menu
+* @description <p>The Menu family of components features a collection of 
+* controls that make it easy to add menus to your website or web application.  
+* With the Menu Controls you can create website fly-out menus, customized 
+* context menus, or application-style menu bars with just a small amount of 
+* scripting.</p><p>The Menu family of controls features:</p>
+* <ul>
+*    <li>Screen-reader accessibility.</li>
+*    <li>Keyboard and mouse navigation.</li>
+*    <li>A rich event model that provides access to all of a menu's 
+*    interesting moments.</li>
+*    <li>Support for 
+*    <a href="http://en.wikipedia.org/wiki/Progressive_Enhancement">Progressive
+*    Enhancement</a>; Menus can be created from simple, 
+*    semantic markup on the page or purely through JavaScript.</li>
+* </ul>
+* @title Menu
+* @namespace YAHOO.widget
+* @requires Event, Dom, Container
+*/
+(function () {
+
+    var Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event;
+
+
+    /**
+    * Singleton that manages a collection of all menus and menu items.  Listens 
+    * for DOM events at the document level and dispatches the events to the 
+    * corresponding menu or menu item.
+    *
+    * @namespace YAHOO.widget
+    * @class MenuManager
+    * @static
+    */
+    YAHOO.widget.MenuManager = function () {
+    
+        // Private member variables
+    
+    
+        // Flag indicating if the DOM event handlers have been attached
+    
+        var m_bInitializedEventHandlers = false,
+    
+    
+        // Collection of menus
+
+        m_oMenus = {},
+
+
+        // Collection of visible menus
+    
+        m_oVisibleMenus = {},
+    
+    
+        //  Collection of menu items 
+
+        m_oItems = {},
+
+
+        // Map of DOM event types to their equivalent CustomEvent types
+        
+        m_oEventTypes = {
+            "click": "clickEvent",
+            "mousedown": "mouseDownEvent",
+            "mouseup": "mouseUpEvent",
+            "mouseover": "mouseOverEvent",
+            "mouseout": "mouseOutEvent",
+            "keydown": "keyDownEvent",
+            "keyup": "keyUpEvent",
+            "keypress": "keyPressEvent"
+        },
+    
+    
+        m_oFocusedMenuItem = null;
+    
+    
+    
+    
+    
+        // Private methods
+    
+    
+        /**
+        * @method getMenuRootElement
+        * @description Finds the root DIV node of a menu or the root LI node of 
+        * a menu item.
+        * @private
+        * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+        * level-one-html.html#ID-58190037">HTMLElement</a>} p_oElement Object 
+        * specifying an HTML element.
+        */
+        function getMenuRootElement(p_oElement) {
+        
+            var oParentNode;
+    
+            if (p_oElement && p_oElement.tagName) {
+            
+                switch (p_oElement.tagName.toUpperCase()) {
+                        
+                case "DIV":
+    
+                    oParentNode = p_oElement.parentNode;
+    
+                    // Check if the DIV is the inner "body" node of a menu
+
+                    if (
+                        (
+                            Dom.hasClass(p_oElement, "hd") ||
+                            Dom.hasClass(p_oElement, "bd") ||
+                            Dom.hasClass(p_oElement, "ft")
+                        ) && 
+                        oParentNode && 
+                        oParentNode.tagName && 
+                        oParentNode.tagName.toUpperCase() == "DIV") 
+                    {
+                    
+                        return oParentNode;
+                    
+                    }
+                    else {
+                    
+                        return p_oElement;
+                    
+                    }
+                
+                    break;
+
+                case "LI":
+    
+                    return p_oElement;
+
+                default:
+    
+                    oParentNode = p_oElement.parentNode;
+    
+                    if (oParentNode) {
+                    
+                        return getMenuRootElement(oParentNode);
+                    
+                    }
+                
+                    break;
+                
+                }
+    
+            }
+            
+        }
+    
+    
+    
+        // Private event handlers
+    
+    
+        /**
+        * @method onDOMEvent
+        * @description Generic, global event handler for all of a menu's 
+        * DOM-based events.  This listens for events against the document 
+        * object.  If the target of a given event is a member of a menu or 
+        * menu item's DOM, the instance's corresponding Custom Event is fired.
+        * @private
+        * @param {Event} p_oEvent Object representing the DOM event object  
+        * passed back by the event utility (YAHOO.util.Event).
+        */
+        function onDOMEvent(p_oEvent) {
+    
+            // Get the target node of the DOM event
+        
+            var oTarget = Event.getTarget(p_oEvent),
+                
+            // See if the target of the event was a menu, or a menu item
+    
+            oElement = getMenuRootElement(oTarget),
+            sCustomEventType,
+            sTagName,
+            sId,
+            oMenuItem,
+            oMenu; 
+    
+    
+            if (oElement) {
+    
+                sTagName = oElement.tagName.toUpperCase();
+        
+                if (sTagName == "LI") {
+            
+                    sId = oElement.id;
+            
+                    if (sId && m_oItems[sId]) {
+            
+                        oMenuItem = m_oItems[sId];
+                        oMenu = oMenuItem.parent;
+            
+                    }
+                
+                }
+                else if (sTagName == "DIV") {
+                
+                    if (oElement.id) {
+                    
+                        oMenu = m_oMenus[oElement.id];
+                    
+                    }
+                
+                }
+    
+            }
+    
+    
+            if (oMenu) {
+    
+                sCustomEventType = m_oEventTypes[p_oEvent.type];
+    
+    
+                // Fire the Custom Event that corresponds the current DOM event    
+        
+                if (oMenuItem && !oMenuItem.cfg.getProperty("disabled")) {
+    
+                    oMenuItem[sCustomEventType].fire(p_oEvent);                   
+    
+    
+                    if (
+                            p_oEvent.type == "keyup" || 
+                            p_oEvent.type == "mousedown") 
+                    {
+    
+                        if (m_oFocusedMenuItem != oMenuItem) {
+                        
+                            if (m_oFocusedMenuItem) {
+    
+                                m_oFocusedMenuItem.blurEvent.fire();
+                            
+                            }
+    
+                            oMenuItem.focusEvent.fire();
+                        
+                        }
+                    
+                    }
+    
+                }
+        
+                oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);
+            
+            }
+            else if (p_oEvent.type == "mousedown") {
+    
+                if (m_oFocusedMenuItem) {
+    
+                    m_oFocusedMenuItem.blurEvent.fire();
+    
+                    m_oFocusedMenuItem = null;
+    
+                }
+    
+    
+                /*
+                    If the target of the event wasn't a menu, hide all 
+                    dynamically positioned menus
+                */
+                
+                for (var i in m_oMenus) {
+        
+                    if (YAHOO.lang.hasOwnProperty(m_oMenus, i)) {
+        
+                        oMenu = m_oMenus[i];
+        
+                        if (oMenu.cfg.getProperty("clicktohide") && 
+                            !(oMenu instanceof YAHOO.widget.MenuBar) && 
+                            oMenu.cfg.getProperty("position") == "dynamic") {
+        
+                            oMenu.hide();
+        
+                        }
+                        else {
+    
+                            oMenu.clearActiveItem(true);
+        
+                        }
+        
+                    }
+        
+                } 
+    
+            }
+            else if (p_oEvent.type == "keyup") { 
+    
+                if (m_oFocusedMenuItem) {
+    
+                    m_oFocusedMenuItem.blurEvent.fire();
+    
+                    m_oFocusedMenuItem = null;
+    
+                }
+    
+            }
+    
+        }
+    
+    
+        /**
+        * @method onMenuDestroy
+        * @description "destroy" event handler for a menu.
+        * @private
+        * @param {String} p_sType String representing the name of the event 
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        * @param {YAHOO.widget.Menu} p_oMenu The menu that fired the event.
+        */
+        function onMenuDestroy(p_sType, p_aArgs, p_oMenu) {
+    
+            if (m_oMenus[p_oMenu.id]) {
+    
+                this.removeMenu(p_oMenu);
+    
+            }
+    
+        }
+    
+    
+        /**
+        * @method onMenuFocus
+        * @description "focus" event handler for a MenuItem instance.
+        * @private
+        * @param {String} p_sType String representing the name of the event 
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        function onMenuFocus(p_sType, p_aArgs) {
+    
+            var oItem = p_aArgs[0];
+    
+            if (oItem) {
+    
+                m_oFocusedMenuItem = oItem;
+            
+            }
+    
+        }
+    
+    
+        /**
+        * @method onMenuBlur
+        * @description "blur" event handler for a MenuItem instance.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        function onMenuBlur(p_sType, p_aArgs) {
+    
+            m_oFocusedMenuItem = null;
+    
+        }
+    
+    
+    
+        /**
+        * @method onMenuVisibleConfigChange
+        * @description Event handler for when the "visible" configuration  
+        * property of a Menu instance changes.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        function onMenuVisibleConfigChange(p_sType, p_aArgs) {
+    
+            var bVisible = p_aArgs[0],
+                sId = this.id;
+            
+            if (bVisible) {
+    
+                m_oVisibleMenus[sId] = this;
+                
+            
+            }
+            else if (m_oVisibleMenus[sId]) {
+            
+                delete m_oVisibleMenus[sId];
+                
+            
+            }
+        
+        }
+    
+    
+        /**
+        * @method onItemDestroy
+        * @description "destroy" event handler for a MenuItem instance.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        function onItemDestroy(p_sType, p_aArgs) {
+    
+            removeItem(this);
+    
+        }
+
+    
+        function removeItem(p_oMenuItem) {
+
+            var sId = p_oMenuItem.id;
+    
+            if (sId && m_oItems[sId]) {
+    
+                if (m_oFocusedMenuItem == p_oMenuItem) {
+    
+                    m_oFocusedMenuItem = null;
+    
+                }
+    
+                delete m_oItems[sId];
+                
+                p_oMenuItem.destroyEvent.unsubscribe(onItemDestroy);
+    
+    
+            }
+
+        }
+    
+    
+        /**
+        * @method onItemAdded
+        * @description "itemadded" event handler for a Menu instance.
+        * @private
+        * @param {String} p_sType String representing the name of the event  
+        * that was fired.
+        * @param {Array} p_aArgs Array of arguments sent when the event 
+        * was fired.
+        */
+        function onItemAdded(p_sType, p_aArgs) {
+    
+            var oItem = p_aArgs[0],
+                sId;
+    
+            if (oItem instanceof YAHOO.widget.MenuItem) { 
+    
+                sId = oItem.id;
+        
+                if (!m_oItems[sId]) {
+            
+                    m_oItems[sId] = oItem;
+        
+                    oItem.destroyEvent.subscribe(onItemDestroy);
+        
+        
+                }
+    
+            }
+        
+        }
+    
+    
+        return {
+    
+            // Privileged methods
+    
+    
+            /**
+            * @method addMenu
+            * @description Adds a menu to the collection of known menus.
+            * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu  
+            * instance to be added.
+            */
+            addMenu: function (p_oMenu) {
+    
+                var oDoc;
+    
+                if (p_oMenu instanceof YAHOO.widget.Menu && p_oMenu.id && 
+                    !m_oMenus[p_oMenu.id]) {
+        
+                    m_oMenus[p_oMenu.id] = p_oMenu;
+                
+            
+                    if (!m_bInitializedEventHandlers) {
+            
+                        oDoc = document;
+                
+                        Event.on(oDoc, "mouseover", onDOMEvent, this, true);
+                        Event.on(oDoc, "mouseout", onDOMEvent, this, true);
+                        Event.on(oDoc, "mousedown", onDOMEvent, this, true);
+                        Event.on(oDoc, "mouseup", onDOMEvent, this, true);
+                        Event.on(oDoc, "click", onDOMEvent, this, true);
+                        Event.on(oDoc, "keydown", onDOMEvent, this, true);
+                        Event.on(oDoc, "keyup", onDOMEvent, this, true);
+                        Event.on(oDoc, "keypress", onDOMEvent, this, true);
+    
+    
+                        m_bInitializedEventHandlers = true;
+                        
+            
+                    }
+            
+                    p_oMenu.cfg.subscribeToConfigEvent("visible", 
+                        onMenuVisibleConfigChange);
+
+                    p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, 
+                                            this);
+            
+                    p_oMenu.itemAddedEvent.subscribe(onItemAdded);
+                    p_oMenu.focusEvent.subscribe(onMenuFocus);
+                    p_oMenu.blurEvent.subscribe(onMenuBlur);
+        
+        
+                }
+        
+            },
+    
+        
+            /**
+            * @method removeMenu
+            * @description Removes a menu from the collection of known menus.
+            * @param {YAHOO.widget.Menu} p_oMenu Object specifying the Menu  
+            * instance to be removed.
+            */
+            removeMenu: function (p_oMenu) {
+    
+                var sId,
+                    aItems,
+                    i;
+        
+                if (p_oMenu) {
+    
+                    sId = p_oMenu.id;
+        
+                    if (m_oMenus[sId] == p_oMenu) {
+
+                        // Unregister each menu item
+
+                        aItems = p_oMenu.getItems();
+
+                        if (aItems && aItems.length > 0) {
+
+                            i = aItems.length - 1;
+
+                            do {
+
+                                removeItem(aItems[i]);
+
+                            }
+                            while (i--);
+
+                        }
+
+
+                        // Unregister the menu
+
+                        delete m_oMenus[sId];
+            
+        
+
+                        /*
+                             Unregister the menu from the collection of 
+                             visible menus
+                        */
+
+                        if (m_oVisibleMenus[sId] == p_oMenu) {
+            
+                            delete m_oVisibleMenus[sId];
+                            
+       
+                        }
+
+
+                        // Unsubscribe event listeners
+
+                        if (p_oMenu.cfg) {
+
+                            p_oMenu.cfg.unsubscribeFromConfigEvent("visible", 
+                                onMenuVisibleConfigChange);
+                            
+                        }
+
+                        p_oMenu.destroyEvent.unsubscribe(onMenuDestroy, 
+                            p_oMenu);
+                
+                        p_oMenu.itemAddedEvent.unsubscribe(onItemAdded);
+                        p_oMenu.focusEvent.unsubscribe(onMenuFocus);
+                        p_oMenu.blurEvent.unsubscribe(onMenuBlur);
+
+                    }
+                
+                }
+    
+            },
+        
+        
+            /**
+            * @method hideVisible
+            * @description Hides all visible, dynamically positioned menus 
+            * (excluding instances of YAHOO.widget.MenuBar).
+            */
+            hideVisible: function () {
+        
+                var oMenu;
+        
+                for (var i in m_oVisibleMenus) {
+        
+                    if (YAHOO.lang.hasOwnProperty(m_oVisibleMenus, i)) {
+        
+                        oMenu = m_oVisibleMenus[i];
+        
+                        if (!(oMenu instanceof YAHOO.widget.MenuBar) && 
+                            oMenu.cfg.getProperty("position") == "dynamic") {
+        
+                            oMenu.hide();
+        
+                        }
+        
+                    }
+        
+                }        
+    
+            },
+    
+    
+            /**
+            * @method getMenus
+            * @description Returns an array of all menus registered with the 
+            * menu manger.
+            * @return {Array}
+            */
+            getMenus: function () {
+    
+                return m_oMenus;
+            
+            },
+    
+    
+            /**
+            * @method getMenu
+            * @description Returns a menu with the specified id.
+            * @param {String} p_sId String specifying the id of the 
+            * <code>&#60;div&#62;</code> element representing the menu to
+            * be retrieved.
+            * @return {YAHOO.widget.Menu}
+            */
+            getMenu: function (p_sId) {
+    
+                var oMenu = m_oMenus[p_sId];
+        
+                if (oMenu) {
+                
+                    return oMenu;
+                
+                }
+            
+            },
+    
+    
+            /**
+            * @method getMenuItem
+            * @description Returns a menu item with the specified id.
+            * @param {String} p_sId String specifying the id of the 
+            * <code>&#60;li&#62;</code> element representing the menu item to
+            * be retrieved.
+            * @return {YAHOO.widget.MenuItem}
+            */
+            getMenuItem: function (p_sId) {
+    
+                var oItem = m_oItems[p_sId];
+        
+                if (oItem) {
+                
+                    return oItem;
+                
+                }
+            
+            },
+
+
+            /**
+            * @method getMenuItemGroup
+            * @description Returns an array of menu item instances whose 
+            * corresponding <code>&#60;li&#62;</code> elements are child 
+            * nodes of the <code>&#60;ul&#62;</code> element with the 
+            * specified id.
+            * @param {String} p_sId String specifying the id of the 
+            * <code>&#60;ul&#62;</code> element representing the group of 
+            * menu items to be retrieved.
+            * @return {Array}
+            */
+            getMenuItemGroup: function (p_sId) {
+
+                var oUL = Dom.get(p_sId),
+                    aItems,
+                    oNode,
+                    oItem,
+                    sId;
+    
+
+                if (oUL && oUL.tagName && 
+                    oUL.tagName.toUpperCase() == "UL") {
+
+                    oNode = oUL.firstChild;
+
+                    if (oNode) {
+
+                        aItems = [];
+                        
+                        do {
+
+                            sId = oNode.id;
+
+                            if (sId) {
+                            
+                                oItem = this.getMenuItem(sId);
+                                
+                                if (oItem) {
+                                
+                                    aItems[aItems.length] = oItem;
+                                
+                                }
+                            
+                            }
+                        
+                        }
+                        while ((oNode = oNode.nextSibling));
+
+
+                        if (aItems.length > 0) {
+
+                            return aItems;
+                        
+                        }
+
+                    }
+                
+                }
+            
+            },
+
+    
+            /**
+            * @method getFocusedMenuItem
+            * @description Returns a reference to the menu item that currently 
+            * has focus.
+            * @return {YAHOO.widget.MenuItem}
+            */
+            getFocusedMenuItem: function () {
+    
+                return m_oFocusedMenuItem;
+    
+            },
+    
+    
+            /**
+            * @method getFocusedMenu
+            * @description Returns a reference to the menu that currently 
+            * has focus.
+            * @return {YAHOO.widget.Menu}
+            */
+            getFocusedMenu: function () {
+    
+                if (m_oFocusedMenuItem) {
+    
+                    return (m_oFocusedMenuItem.parent.getRoot());
+                
+                }
+    
+            },
+    
+        
+            /**
+            * @method toString
+            * @description Returns a string representing the menu manager.
+            * @return {String}
+            */
+            toString: function () {
+            
+                return "MenuManager";
+            
+            }
+    
+        };
+    
+    }();
+
+})();
+
+
+
+(function () {
+
+
+/**
+* The Menu class creates a container that holds a vertical list representing 
+* a set of options or commands.  Menu is the base class for all 
+* menu containers. 
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source 
+* for the menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+* level-one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object 
+* specifying the <code>&#60;div&#62;</code> element of the menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+* level-one-html.html#ID-94282980">HTMLSelectElement</a>} p_oElement 
+* Object specifying the <code>&#60;select&#62;</code> element to be used as 
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu. See configuration class documentation for 
+* more details.
+* @namespace YAHOO.widget
+* @class Menu
+* @constructor
+* @extends YAHOO.widget.Overlay
+*/
+YAHOO.widget.Menu = function (p_oElement, p_oConfig) {
+
+    if (p_oConfig) {
+
+        this.parent = p_oConfig.parent;
+        this.lazyLoad = p_oConfig.lazyLoad || p_oConfig.lazyload;
+        this.itemData = p_oConfig.itemData || p_oConfig.itemdata;
+
+    }
+
+
+    YAHOO.widget.Menu.superclass.constructor.call(this, p_oElement, p_oConfig);
+
+};
+
+
+
+/**
+* @method checkPosition
+* @description Checks to make sure that the value of the "position" property 
+* is one of the supported strings. Returns true if the position is supported.
+* @private
+* @param {Object} p_sPosition String specifying the position of the menu.
+* @return {Boolean}
+*/
+function checkPosition(p_sPosition) {
+
+    if (typeof p_sPosition == "string") {
+
+        return ("dynamic,static".indexOf((p_sPosition.toLowerCase())) != -1);
+
+    }
+
+}
+
+
+var Dom = YAHOO.util.Dom,
+    Event = YAHOO.util.Event,
+    Module = YAHOO.widget.Module,
+    Overlay = YAHOO.widget.Overlay,
+    Menu = YAHOO.widget.Menu,
+    MenuManager = YAHOO.widget.MenuManager,
+    CustomEvent = YAHOO.util.CustomEvent,
+    Lang = YAHOO.lang,
+    UA = YAHOO.env.ua,
+    
+    m_oShadowTemplate,
+
+    /**
+    * Constant representing the name of the Menu's events
+    * @property EVENT_TYPES
+    * @private
+    * @final
+    * @type Object
+    */
+    EVENT_TYPES = {
+    
+        "MOUSE_OVER": "mouseover",
+        "MOUSE_OUT": "mouseout",
+        "MOUSE_DOWN": "mousedown",
+        "MOUSE_UP": "mouseup",
+        "CLICK": "click",
+        "KEY_PRESS": "keypress",
+        "KEY_DOWN": "keydown",
+        "KEY_UP": "keyup",
+        "FOCUS": "focus",
+        "BLUR": "blur",
+        "ITEM_ADDED": "itemAdded",
+        "ITEM_REMOVED": "itemRemoved"
+    
+    },
+
+
+    /**
+    * Constant representing the Menu's configuration properties
+    * @property DEFAULT_CONFIG
+    * @private
+    * @final
+    * @type Object
+    */
+    DEFAULT_CONFIG = {
+
+        "VISIBLE": { 
+            key: "visible", 
+            value: false, 
+            validator: Lang.isBoolean
+        }, 
+    
+        "CONSTRAIN_TO_VIEWPORT": {
+            key: "constraintoviewport", 
+            value: true, 
+            validator: Lang.isBoolean, 
+            supercedes: ["iframe","x","y","xy"]
+        }, 
+    
+        "POSITION": { 
+            key: "position", 
+            value: "dynamic", 
+            validator: checkPosition, 
+            supercedes: ["visible", "iframe"]
+        }, 
+    
+        "SUBMENU_ALIGNMENT": { 
+            key: "submenualignment", 
+            value: ["tl","tr"]
+        },
+    
+        "AUTO_SUBMENU_DISPLAY": { 
+            key: "autosubmenudisplay", 
+            value: true, 
+            validator: Lang.isBoolean 
+        }, 
+    
+        "SHOW_DELAY": { 
+            key: "showdelay", 
+            value: 250, 
+            validator: Lang.isNumber 
+        }, 
+    
+        "HIDE_DELAY": { 
+            key: "hidedelay", 
+            value: 0, 
+            validator: Lang.isNumber, 
+            suppressEvent: true
+        }, 
+    
+        "SUBMENU_HIDE_DELAY": { 
+            key: "submenuhidedelay", 
+            value: 250, 
+            validator: Lang.isNumber
+        }, 
+    
+        "CLICK_TO_HIDE": { 
+            key: "clicktohide", 
+            value: true, 
+            validator: Lang.isBoolean
+        },
+    
+        "CONTAINER": { 
+            key: "container"
+        }, 
+    
+        "MAX_HEIGHT": { 
+            key: "maxheight", 
+            value: 0, 
+            validator: Lang.isNumber,
+            supercedes: ["iframe"]
+        }, 
+    
+        "CLASS_NAME": { 
+            key: "classname", 
+            value: null, 
+            validator: Lang.isString
+        }, 
+    
+        "DISABLED": { 
+            key: "disabled", 
+            value: false, 
+            validator: Lang.isBoolean,
+            suppressEvent: true
+        }
+    
+    };
+
+
+
+YAHOO.lang.extend(Menu, Overlay, {
+
+
+// Constants
+
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the 
+* menu's <code>&#60;div&#62;</code> element.
+* @default "yuimenu"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenu",
+
+
+/**
+* @property ITEM_TYPE
+* @description Object representing the type of menu item to instantiate and 
+* add when parsing the child nodes (either <code>&#60;li&#62;</code> element, 
+* <code>&#60;optgroup&#62;</code> element or <code>&#60;option&#62;</code>) 
+* of the menu's source HTML element.
+* @default YAHOO.widget.MenuItem
+* @final
+* @type YAHOO.widget.MenuItem
+*/
+ITEM_TYPE: null,
+
+
+/**
+* @property GROUP_TITLE_TAG_NAME
+* @description String representing the tagname of the HTML element used to 
+* title the menu's item groups.
+* @default H6
+* @final
+* @type String
+*/
+GROUP_TITLE_TAG_NAME: "h6",
+
+
+
+// Private properties
+
+
+/** 
+* @property _nHideDelayId
+* @description Number representing the time-out setting used to cancel the 
+* hiding of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nHideDelayId: null,
+
+
+/** 
+* @property _nShowDelayId
+* @description Number representing the time-out setting used to cancel the 
+* showing of a menu.
+* @default null
+* @private
+* @type Number
+*/
+_nShowDelayId: null,
+
+
+/** 
+* @property _nSubmenuHideDelayId
+* @description Number representing the time-out setting used to cancel the 
+* hiding of a submenu.
+* @default null
+* @private
+* @type Number
+*/
+_nSubmenuHideDelayId: null,
+
+
+/** 
+* @property _nBodyScrollId
+* @description Number representing the time-out setting used to cancel the 
+* scrolling of the menu's body element.
+* @default null
+* @private
+* @type Number
+*/
+_nBodyScrollId: null,
+
+
+/** 
+* @property _bHideDelayEventHandlersAssigned
+* @description Boolean indicating if the "mouseover" and "mouseout" event 
+* handlers used for hiding the menu via a call to "window.setTimeout" have 
+* already been assigned.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHideDelayEventHandlersAssigned: false,
+
+
+/**
+* @property _bHandledMouseOverEvent
+* @description Boolean indicating the current state of the menu's 
+* "mouseover" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOverEvent: false,
+
+
+/**
+* @property _bHandledMouseOutEvent
+* @description Boolean indicating the current state of the menu's
+* "mouseout" event.
+* @default false
+* @private
+* @type Boolean
+*/
+_bHandledMouseOutEvent: false,
+
+
+/**
+* @property _aGroupTitleElements
+* @description Array of HTML element used to title groups of menu items.
+* @default []
+* @private
+* @type Array
+*/
+_aGroupTitleElements: null,
+
+
+/**
+* @property _aItemGroups
+* @description Multi-dimensional Array representing the menu items as they
+* are grouped in the menu.
+* @default []
+* @private
+* @type Array
+*/
+_aItemGroups: null,
+
+
+/**
+* @property _aListElements
+* @description Array of <code>&#60;ul&#62;</code> elements, each of which is 
+* the parent node for each item's <code>&#60;li&#62;</code> element.
+* @default []
+* @private
+* @type Array
+*/
+_aListElements: null,
+
+
+/**
+* @property _nCurrentMouseX
+* @description The current x coordinate of the mouse inside the area of 
+* the menu.
+* @default 0
+* @private
+* @type Number
+*/
+_nCurrentMouseX: 0,
+
+
+/**
+* @property _nMaxHeight
+* @description The original value of the "maxheight" configuration property 
+* as set by the user.
+* @default -1
+* @private
+* @type Number
+*/
+_nMaxHeight: -1,
+
+
+/**
+* @property _bStopMouseEventHandlers
+* @description Stops "mouseover," "mouseout," and "mousemove" event handlers 
+* from executing.
+* @default false
+* @private
+* @type Boolean
+*/
+_bStopMouseEventHandlers: false,
+
+
+/**
+* @property _sClassName
+* @description The current value of the "classname" configuration attribute.
+* @default null
+* @private
+* @type String
+*/
+_sClassName: null,
+
+
+
+// Public properties
+
+
+/**
+* @property lazyLoad
+* @description Boolean indicating if the menu's "lazy load" feature is 
+* enabled.  If set to "true," initialization and rendering of the menu's 
+* items will be deferred until the first time it is made visible.  This 
+* property should be set via the constructor using the configuration 
+* object literal.
+* @default false
+* @type Boolean
+*/
+lazyLoad: false,
+
+
+/**
+* @property itemData
+* @description Array of items to be added to the menu.  The array can contain 
+* strings representing the text for each item to be created, object literals 
+* representing the menu item configuration properties, or MenuItem instances.  
+* This property should be set via the constructor using the configuration 
+* object literal.
+* @default null
+* @type Array
+*/
+itemData: null,
+
+
+/**
+* @property activeItem
+* @description Object reference to the item in the menu that has is selected.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+activeItem: null,
+
+
+/**
+* @property parent
+* @description Object reference to the menu's parent menu or menu item.  
+* This property can be set via the constructor using the configuration 
+* object literal.
+* @default null
+* @type YAHOO.widget.MenuItem
+*/
+parent: null,
+
+
+/**
+* @property srcElement
+* @description Object reference to the HTML element (either 
+* <code>&#60;select&#62;</code> or <code>&#60;div&#62;</code>) used to 
+* create the menu.
+* @default null
+* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+* level-one-html.html#ID-94282980">HTMLSelectElement</a>|<a 
+* href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.
+* html#ID-22445964">HTMLDivElement</a>
+*/
+srcElement: null,
+
+
+
+// Events
+
+
+/**
+* @event mouseOverEvent
+* @description Fires when the mouse has entered the menu.  Passes back 
+* the DOM Event object as an argument.
+*/
+mouseOverEvent: null,
+
+
+/**
+* @event mouseOutEvent
+* @description Fires when the mouse has left the menu.  Passes back the DOM 
+* Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseOutEvent: null,
+
+
+/**
+* @event mouseDownEvent
+* @description Fires when the user mouses down on the menu.  Passes back the 
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseDownEvent: null,
+
+
+/**
+* @event mouseUpEvent
+* @description Fires when the user releases a mouse button while the mouse is 
+* over the menu.  Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+mouseUpEvent: null,
+
+
+/**
+* @event clickEvent
+* @description Fires when the user clicks the on the menu.  Passes back the 
+* DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+clickEvent: null,
+
+
+/**
+* @event keyPressEvent
+* @description Fires when the user presses an alphanumeric key when one of the
+* menu's items has focus.  Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyPressEvent: null,
+
+
+/**
+* @event keyDownEvent
+* @description Fires when the user presses a key when one of the menu's items 
+* has focus.  Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyDownEvent: null,
+
+
+/**
+* @event keyUpEvent
+* @description Fires when the user releases a key when one of the menu's items 
+* has focus.  Passes back the DOM Event object as an argument.
+* @type YAHOO.util.CustomEvent
+*/
+keyUpEvent: null,
+
+
+/**
+* @event itemAddedEvent
+* @description Fires when an item is added to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemAddedEvent: null,
+
+
+/**
+* @event itemRemovedEvent
+* @description Fires when an item is removed to the menu.
+* @type YAHOO.util.CustomEvent
+*/
+itemRemovedEvent: null,
+
+
+/**
+* @method init
+* @description The Menu class's initialization method. 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.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the menu.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source 
+* for the menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+* level-one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object 
+* specifying the <code>&#60;div&#62;</code> element of the menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+* level-one-html.html#ID-94282980">HTMLSelectElement</a>} p_oElement 
+* Object specifying the <code>&#60;select&#62;</code> element to be used as 
+* the data source for the menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu. See configuration class documentation for 
+* more details.
+*/
+init: function (p_oElement, p_oConfig) {
+
+    this._aItemGroups = [];
+    this._aListElements = [];
+    this._aGroupTitleElements = [];
+
+    if (!this.ITEM_TYPE) {
+
+        this.ITEM_TYPE = YAHOO.widget.MenuItem;
+
+    }
+
+
+    var oElement;
+
+    if (typeof p_oElement == "string") {
+
+        oElement = document.getElementById(p_oElement);
+
+    }
+    else if (p_oElement.tagName) {
+
+        oElement = p_oElement;
+
+    }
+
+
+    if (oElement && oElement.tagName) {
+
+        switch(oElement.tagName.toUpperCase()) {
+    
+            case "DIV":
+
+                this.srcElement = oElement;
+
+                if (!oElement.id) {
+
+                    oElement.setAttribute("id", Dom.generateId());
+
+                }
+
+
+                /* 
+                    Note: we don't pass the user config in here yet 
+                    because we only want it executed once, at the lowest 
+                    subclass level.
+                */ 
+            
+                Menu.superclass.init.call(this, oElement);
+
+                this.beforeInitEvent.fire(Menu);
+
+
+    
+            break;
+    
+            case "SELECT":
+    
+                this.srcElement = oElement;
+
+    
+                /*
+                    The source element is not something that we can use 
+                    outright, so we need to create a new Overlay
+
+                    Note: we don't pass the user config in here yet 
+                    because we only want it executed once, at the lowest 
+                    subclass level.
+                */ 
+
+                Menu.superclass.init.call(this, Dom.generateId());
+
+                this.beforeInitEvent.fire(Menu);
+
+
+
+            break;
+
+        }
+
+    }
+    else {
+
+        /* 
+            Note: we don't pass the user config in here yet 
+            because we only want it executed once, at the lowest 
+            subclass level.
+        */ 
+    
+        Menu.superclass.init.call(this, p_oElement);
+
+        this.beforeInitEvent.fire(Menu);
+
+
+
+    }
+
+
+    if (this.element) {
+
+        Dom.addClass(this.element, this.CSS_CLASS_NAME);
+
+
+        // Subscribe to Custom Events
+
+        this.initEvent.subscribe(this._onInit);
+        this.beforeRenderEvent.subscribe(this._onBeforeRender);
+        this.renderEvent.subscribe(this._onRender);
+        this.renderEvent.subscribe(this.onRender);
+        this.beforeShowEvent.subscribe(this._onBeforeShow);
+        this.showEvent.subscribe(this._onShow);
+        this.beforeHideEvent.subscribe(this._onBeforeHide);
+        this.hideEvent.subscribe(this._onHide);
+        this.mouseOverEvent.subscribe(this._onMouseOver);
+        this.mouseOutEvent.subscribe(this._onMouseOut);
+        this.clickEvent.subscribe(this._onClick);
+        this.keyDownEvent.subscribe(this._onKeyDown);
+        this.keyPressEvent.subscribe(this._onKeyPress);
+
+
+        if (p_oConfig) {
+    
+            this.cfg.applyConfig(p_oConfig, true);
+    
+        }
+
+
+        // Register the Menu instance with the MenuManager
+
+        MenuManager.addMenu(this);
+        
+
+        this.initEvent.fire(Menu);
+
+    }
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _initSubTree
+* @description Iterates the childNodes of the source element to find nodes 
+* used to instantiate menu and menu items.
+* @private
+*/
+_initSubTree: function () {
+
+    var oSrcElement = this.srcElement,
+        sSrcElementTagName,
+        nGroup,
+        sGroupTitleTagName,
+        oNode,
+        aListElements,
+        nListElements,
+        i;
+
+
+    if (oSrcElement) {
+    
+        sSrcElementTagName = 
+            (oSrcElement.tagName && oSrcElement.tagName.toUpperCase());
+
+
+        if (sSrcElementTagName == "DIV") {
+    
+            //  Populate the collection of item groups and item group titles
+    
+            oNode = this.body.firstChild;
+    
+
+            if (oNode) {
+    
+                nGroup = 0;
+                sGroupTitleTagName = this.GROUP_TITLE_TAG_NAME.toUpperCase();
+        
+                do {
+        
+
+                    if (oNode && oNode.tagName) {
+        
+                        switch (oNode.tagName.toUpperCase()) {
+        
+                            case sGroupTitleTagName:
+                            
+                                this._aGroupTitleElements[nGroup] = oNode;
+        
+                            break;
+        
+                            case "UL":
+        
+                                this._aListElements[nGroup] = oNode;
+                                this._aItemGroups[nGroup] = [];
+                                nGroup++;
+        
+                            break;
+        
+                        }
+                    
+                    }
+        
+                }
+                while ((oNode = oNode.nextSibling));
+        
+        
+                /*
+                    Apply the "first-of-type" class to the first UL to mimic 
+                    the "first-of-type" CSS3 psuedo class.
+                */
+        
+                if (this._aListElements[0]) {
+        
+                    Dom.addClass(this._aListElements[0], "first-of-type");
+        
+                }
+            
+            }
+    
+        }
+    
+    
+        oNode = null;
+    
+    
+
+        if (sSrcElementTagName) {
+    
+            switch (sSrcElementTagName) {
+        
+                case "DIV":
+
+                    aListElements = this._aListElements;
+                    nListElements = aListElements.length;
+        
+                    if (nListElements > 0) {
+        
+        
+                        i = nListElements - 1;
+        
+                        do {
+        
+                            oNode = aListElements[i].firstChild;
+            
+                            if (oNode) {
+
+            
+                                do {
+                
+                                    if (oNode && oNode.tagName && 
+                                        oNode.tagName.toUpperCase() == "LI") {
+                
+        
+                                        this.addItem(new this.ITEM_TYPE(oNode, 
+                                                    { parent: this }), i);
+            
+                                    }
+                        
+                                }
+                                while ((oNode = oNode.nextSibling));
+                            
+                            }
+                    
+                        }
+                        while (i--);
+        
+                    }
+        
+                break;
+        
+                case "SELECT":
+        
+        
+                    oNode = oSrcElement.firstChild;
+        
+                    do {
+        
+                        if (oNode && oNode.tagName) {
+                        
+                            switch (oNode.tagName.toUpperCase()) {
+            
+                                case "OPTGROUP":
+                                case "OPTION":
+            
+            
+                                    this.addItem(
+                                            new this.ITEM_TYPE(
+                                                    oNode, 
+                                                    { parent: this }
+                                                )
+                                            );
+            
+                                break;
+            
+                            }
+    
+                        }
+        
+                    }
+                    while ((oNode = oNode.nextSibling));
+        
+                break;
+        
+            }
+    
+        }    
+    
+    }
+
+},
+
+
+/**
+* @method _getFirstEnabledItem
+* @description Returns the first enabled item in the menu.
+* @return {YAHOO.widget.MenuItem}
+* @private
+*/
+_getFirstEnabledItem: function () {
+
+    var aItems = this.getItems(),
+        nItems = aItems.length,
+        oItem;
+    
+    for(var i=0; i<nItems; i++) {
+
+        oItem = aItems[i];
+
+        if (oItem && !oItem.cfg.getProperty("disabled") && 
+            oItem.element.style.display != "none") {
+
+            return oItem;
+
+        }
+    
+    }
+    
+},
+
+
+/**
+* @method _addItemToGroup
+* @description Adds a menu item to a group.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the 
+* item belongs.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance to be added to the menu.
+* @param {String} p_oItem String specifying the text of the item to be added 
+* to the menu.
+* @param {Object} p_oItem Object literal containing a set of menu item 
+* configuration properties.
+* @param {Number} p_nItemIndex Optional. Number indicating the index at 
+* which the menu item should be added.
+* @return {YAHOO.widget.MenuItem}
+*/
+_addItemToGroup: function (p_nGroupIndex, p_oItem, p_nItemIndex) {
+
+    var oItem,
+        bDisabled = this.cfg.getProperty("disabled"),
+        nGroupIndex,
+        aGroup,
+        oGroupItem,
+        bAppend,
+        oNextItemSibling,
+        nItemIndex;
+
+    function getNextItemSibling(p_aArray, p_nStartIndex) {
+
+        return (p_aArray[p_nStartIndex] || getNextItemSibling(p_aArray, 
+                (p_nStartIndex+1)));
+
+    }
+
+    if (p_oItem instanceof this.ITEM_TYPE) {
+
+        oItem = p_oItem;
+        oItem.parent = this;
+
+    }
+    else if (typeof p_oItem == "string") {
+
+        oItem = new this.ITEM_TYPE(p_oItem, { parent: this });
+    
+    }
+    else if (typeof p_oItem == "object") {
+
+        p_oItem.parent = this;
+
+        oItem = new this.ITEM_TYPE(p_oItem.text, p_oItem);
+
+    }
+
+
+    if (oItem) {
+
+        if (oItem.cfg.getProperty("selected")) {
+
+            this.activeItem = oItem;
+        
+        }
+
+
+        nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+        aGroup = this._getItemGroup(nGroupIndex);
+
+
+
+        if (!aGroup) {
+
+            aGroup = this._createItemGroup(nGroupIndex);
+
+        }
+
+
+        if (typeof p_nItemIndex == "number") {
+
+            bAppend = (p_nItemIndex >= aGroup.length);            
+
+
+            if (aGroup[p_nItemIndex]) {
+    
+                aGroup.splice(p_nItemIndex, 0, oItem);
+    
+            }
+            else {
+    
+                aGroup[p_nItemIndex] = oItem;
+    
+            }
+
+
+            oGroupItem = aGroup[p_nItemIndex];
+
+            if (oGroupItem) {
+
+                if (bAppend && (!oGroupItem.element.parentNode || 
+                        oGroupItem.element.parentNode.nodeType == 11)) {
+        
+                    this._aListElements[nGroupIndex].appendChild(
+                        oGroupItem.element);
+    
+                }
+                else {
+    
+                    oNextItemSibling = getNextItemSibling(aGroup, 
+                        (p_nItemIndex+1));
+    
+                    if (oNextItemSibling && (!oGroupItem.element.parentNode || 
+                            oGroupItem.element.parentNode.nodeType == 11)) {
+            
+                        this._aListElements[nGroupIndex].insertBefore(
+                                oGroupItem.element, 
+                                oNextItemSibling.element);
+        
+                    }
+    
+                }
+    
+
+                oGroupItem.parent = this;
+        
+                this._subscribeToItemEvents(oGroupItem);
+    
+                this._configureSubmenu(oGroupItem);
+                
+                this._updateItemProperties(nGroupIndex);
+        
+
+                this.itemAddedEvent.fire(oGroupItem);
+                this.changeContentEvent.fire();
+
+                return oGroupItem;
+    
+            }
+
+        }
+        else {
+    
+            nItemIndex = aGroup.length;
+    
+            aGroup[nItemIndex] = oItem;
+
+            oGroupItem = aGroup[nItemIndex];
+    
+
+            if (oGroupItem) {
+    
+                if (!Dom.isAncestor(this._aListElements[nGroupIndex], 
+                        oGroupItem.element)) {
+    
+                    this._aListElements[nGroupIndex].appendChild(
+                        oGroupItem.element);
+    
+                }
+    
+                oGroupItem.element.setAttribute("groupindex", nGroupIndex);
+                oGroupItem.element.setAttribute("index", nItemIndex);
+        
+                oGroupItem.parent = this;
+    
+                oGroupItem.index = nItemIndex;
+                oGroupItem.groupIndex = nGroupIndex;
+        
+                this._subscribeToItemEvents(oGroupItem);
+    
+                this._configureSubmenu(oGroupItem);
+    
+                if (nItemIndex === 0) {
+        
+                    Dom.addClass(oGroupItem.element, "first-of-type");
+        
+                }
+
+        
+
+                this.itemAddedEvent.fire(oGroupItem);
+                this.changeContentEvent.fire();
+
+                return oGroupItem;
+    
+            }
+    
+        }
+
+    }
+    
+},
+
+
+/**
+* @method _removeItemFromGroupByIndex
+* @description Removes a menu item from a group by index.  Returns the menu 
+* item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the menu 
+* item belongs.
+* @param {Number} p_nItemIndex Number indicating the index of the menu item 
+* to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/
+_removeItemFromGroupByIndex: function (p_nGroupIndex, p_nItemIndex) {
+
+    var nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0,
+        aGroup = this._getItemGroup(nGroupIndex),
+        aArray,
+        oItem,
+        oUL;
+
+    if (aGroup) {
+
+        aArray = aGroup.splice(p_nItemIndex, 1);
+        oItem = aArray[0];
+    
+        if (oItem) {
+    
+            // Update the index and className properties of each member        
+            
+            this._updateItemProperties(nGroupIndex);
+    
+            if (aGroup.length === 0) {
+    
+                // Remove the UL
+    
+                oUL = this._aListElements[nGroupIndex];
+    
+                if (this.body && oUL) {
+    
+                    this.body.removeChild(oUL);
+    
+                }
+    
+                // Remove the group from the array of items
+    
+                this._aItemGroups.splice(nGroupIndex, 1);
+    
+    
+                // Remove the UL from the array of ULs
+    
+                this._aListElements.splice(nGroupIndex, 1);
+    
+    
+                /*
+                     Assign the "first-of-type" class to the new first UL 
+                     in the collection
+                */
+    
+                oUL = this._aListElements[0];
+    
+                if (oUL) {
+    
+                    Dom.addClass(oUL, "first-of-type");
+    
+                }            
+    
+            }
+    
+
+            this.itemRemovedEvent.fire(oItem);
+            this.changeContentEvent.fire();
+
+
+            // Return a reference to the item that was removed
+        
+            return oItem;
+    
+        }
+
+    }
+    
+},
+
+
+/**
+* @method _removeItemFromGroupByValue
+* @description Removes a menu item from a group by reference.  Returns the 
+* menu item that was removed.
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group to which the
+* menu item belongs.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance to be removed.
+* @return {YAHOO.widget.MenuItem}
+*/    
+_removeItemFromGroupByValue: function (p_nGroupIndex, p_oItem) {
+
+    var aGroup = this._getItemGroup(p_nGroupIndex),
+        nItems,
+        nItemIndex,
+        i;
+
+    if (aGroup) {
+
+        nItems = aGroup.length;
+        nItemIndex = -1;
+    
+        if (nItems > 0) {
+    
+            i = nItems-1;
+        
+            do {
+        
+                if (aGroup[i] == p_oItem) {
+        
+                    nItemIndex = i;
+                    break;    
+        
+                }
+        
+            }
+            while(i--);
+        
+            if (nItemIndex > -1) {
+        
+                return (this._removeItemFromGroupByIndex(p_nGroupIndex, 
+                            nItemIndex));
+        
+            }
+    
+        }
+    
+    }
+
+},
+
+
+/**
+* @method _updateItemProperties
+* @description Updates the "index," "groupindex," and "className" properties 
+* of the menu items in the specified group. 
+* @private
+* @param {Number} p_nGroupIndex Number indicating the group of items to update.
+*/
+_updateItemProperties: function (p_nGroupIndex) {
+
+    var aGroup = this._getItemGroup(p_nGroupIndex),
+        nItems = aGroup.length,
+        oItem,
+        oLI,
+        i;
+
+
+    if (nItems > 0) {
+
+        i = nItems - 1;
+
+        // Update the index and className properties of each member
+    
+        do {
+
+            oItem = aGroup[i];
+
+            if (oItem) {
+    
+                oLI = oItem.element;
+
+                oItem.index = i;
+                oItem.groupIndex = p_nGroupIndex;
+
+                oLI.setAttribute("groupindex", p_nGroupIndex);
+                oLI.setAttribute("index", i);
+
+                Dom.removeClass(oLI, "first-of-type");
+
+            }
+    
+        }
+        while(i--);
+
+
+        if (oLI) {
+
+            Dom.addClass(oLI, "first-of-type");
+
+        }
+
+    }
+
+},
+
+
+/**
+* @method _createItemGroup
+* @description Creates a new menu item group (array) and its associated 
+* <code>&#60;ul&#62;</code> element. Returns an aray of menu item groups.
+* @private
+* @param {Number} p_nIndex Number indicating the group to create.
+* @return {Array}
+*/
+_createItemGroup: function (p_nIndex) {
+
+    var oUL;
+
+    if (!this._aItemGroups[p_nIndex]) {
+
+        this._aItemGroups[p_nIndex] = [];
+
+        oUL = document.createElement("ul");
+
+        this._aListElements[p_nIndex] = oUL;
+
+        return this._aItemGroups[p_nIndex];
+
+    }
+
+},
+
+
+/**
+* @method _getItemGroup
+* @description Returns the menu item group at the specified index.
+* @private
+* @param {Number} p_nIndex Number indicating the index of the menu item group 
+* to be retrieved.
+* @return {Array}
+*/
+_getItemGroup: function (p_nIndex) {
+
+    var nIndex = ((typeof p_nIndex == "number") ? p_nIndex : 0);
+
+    return this._aItemGroups[nIndex];
+
+},
+
+
+/**
+* @method _configureSubmenu
+* @description Subscribes the menu item's submenu to its parent menu's events.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance with the submenu to be configured.
+*/
+_configureSubmenu: function (p_oItem) {
+
+    var oSubmenu = p_oItem.cfg.getProperty("submenu");
+
+    if (oSubmenu) {
+            
+        /*
+            Listen for configuration changes to the parent menu 
+            so they they can be applied to the submenu.
+        */
+
+        this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange, 
+                oSubmenu, true);
+
+        this.renderEvent.subscribe(this._onParentMenuRender, oSubmenu, true);
+
+        oSubmenu.beforeShowEvent.subscribe(this._onSubmenuBeforeShow);
+
+    }
+
+},
+
+
+/**
+* @method _subscribeToItemEvents
+* @description Subscribes a menu to a menu item's event.
+* @private
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance whose events should be subscribed to.
+*/
+_subscribeToItemEvents: function (p_oItem) {
+
+    p_oItem.focusEvent.subscribe(this._onMenuItemFocus);
+
+    p_oItem.blurEvent.subscribe(this._onMenuItemBlur);
+
+    p_oItem.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange,
+        p_oItem, this);
+
+},
+
+
+/**
+* @method _getOffsetWidth
+* @description Returns the offset width of the menu's 
+* <code>&#60;div&#62;</code> element.
+* @private
+*/
+_getOffsetWidth: function () {
+
+    var oClone = this.element.cloneNode(true),
+        oRoot = this.getRoot(),
+        oParentNode = oRoot.element.parentNode,
+        sWidth;
+
+    Dom.removeClass(oClone, "visible");
+
+    Dom.setStyle(oClone, "width", "");
+
+
+    if (oParentNode) {
+
+        oParentNode.appendChild(oClone);
+    
+        sWidth = oClone.offsetWidth;
+    
+        oParentNode.removeChild(oClone);
+    
+        return sWidth;
+
+    }
+
+},
+
+
+/**
+* @method _setWidth
+* @description Sets the width of the menu's root <code>&#60;div&#62;</code> 
+* element to its offsetWidth.
+* @private
+*/
+_setWidth: function () {
+
+    var oElement = this.element,
+        bVisible = Dom.removeClass(oElement, "visible"),
+        sWidth;
+
+    if (oElement.parentNode.tagName.toUpperCase() == "BODY") {
+
+        if (YAHOO.env.ua.opera) {
+
+            sWidth = this._getOffsetWidth();
+        
+        }
+        else {
+
+            Dom.setStyle(oElement, "width", "auto");
+            
+            sWidth = oElement.offsetWidth;
+        
+        }
+
+    }
+    else {
+    
+        sWidth = this._getOffsetWidth();
+    
+    }
+
+    this.cfg.setProperty("width", (sWidth + "px"));
+    
+
+    if (bVisible) {
+    
+        Dom.addClass(oElement, "visible");
+    
+    }
+
+},
+
+
+/**
+* @method _onWidthChange
+* @description Change event handler for the the menu's "width" configuration
+* property.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onWidthChange: function (p_sType, p_aArgs) {
+
+    var sWidth = p_aArgs[0];
+    
+    if (sWidth && !this._hasSetWidthHandlers) {
+
+        this.itemAddedEvent.subscribe(this._setWidth);
+        this.itemRemovedEvent.subscribe(this._setWidth);
+
+        this._hasSetWidthHandlers = true;
+
+    }
+    else if (this._hasSetWidthHandlers) {
+
+        this.itemAddedEvent.unsubscribe(this._setWidth);
+        this.itemRemovedEvent.unsubscribe(this._setWidth);
+
+        this._hasSetWidthHandlers = false;
+
+    }
+
+},
+
+
+/**
+* @method _onVisibleChange
+* @description Change event handler for the the menu's "visible" configuration
+* property.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onVisibleChange: function (p_sType, p_aArgs) {
+
+    var bVisible = p_aArgs[0];
+    
+    if (bVisible) {
+
+        Dom.addClass(this.element, "visible");
+
+    }
+    else {
+
+        Dom.removeClass(this.element, "visible");
+
+    }
+
+},
+
+
+/**
+* @method _cancelHideDelay
+* @description Cancels the call to "hideMenu."
+* @private
+*/
+_cancelHideDelay: function () {
+
+    var oRoot = this.getRoot();
+
+    if (oRoot._nHideDelayId) {
+
+        window.clearTimeout(oRoot._nHideDelayId);
+
+    }
+
+},
+
+
+/**
+* @method _execHideDelay
+* @description Hides the menu after the number of milliseconds specified by 
+* the "hidedelay" configuration property.
+* @private
+*/
+_execHideDelay: function () {
+
+    this._cancelHideDelay();
+
+    var oRoot = this.getRoot(),
+        me = this;
+
+    function hideMenu() {
+    
+        if (oRoot.activeItem) {
+
+            oRoot.clearActiveItem();
+
+        }
+
+        if (oRoot == me && !(me instanceof YAHOO.widget.MenuBar) && 
+            me.cfg.getProperty("position") == "dynamic") {
+
+            me.hide();
+        
+        }
+    
+    }
+
+
+    oRoot._nHideDelayId = 
+        window.setTimeout(hideMenu, oRoot.cfg.getProperty("hidedelay"));
+
+},
+
+
+/**
+* @method _cancelShowDelay
+* @description Cancels the call to the "showMenu."
+* @private
+*/
+_cancelShowDelay: function () {
+
+    var oRoot = this.getRoot();
+
+    if (oRoot._nShowDelayId) {
+
+        window.clearTimeout(oRoot._nShowDelayId);
+
+    }
+
+},
+
+
+/**
+* @method _execShowDelay
+* @description Shows the menu after the number of milliseconds specified by 
+* the "showdelay" configuration property have ellapsed.
+* @private
+* @param {YAHOO.widget.Menu} p_oMenu Object specifying the menu that should 
+* be made visible.
+*/
+_execShowDelay: function (p_oMenu) {
+
+    var oRoot = this.getRoot();
+
+    function showMenu() {
+
+        if (p_oMenu.parent.cfg.getProperty("selected")) {
+
+            p_oMenu.show();
+
+        }
+
+    }
+
+
+    oRoot._nShowDelayId = 
+        window.setTimeout(showMenu, oRoot.cfg.getProperty("showdelay"));
+
+},
+
+
+/**
+* @method _execSubmenuHideDelay
+* @description Hides a submenu after the number of milliseconds specified by 
+* the "submenuhidedelay" configuration property have ellapsed.
+* @private
+* @param {YAHOO.widget.Menu} p_oSubmenu Object specifying the submenu that  
+* should be hidden.
+* @param {Number} p_nMouseX The x coordinate of the mouse when it left 
+* the specified submenu's parent menu item.
+* @param {Number} p_nHideDelay The number of milliseconds that should ellapse
+* before the submenu is hidden.
+*/
+_execSubmenuHideDelay: function (p_oSubmenu, p_nMouseX, p_nHideDelay) {
+
+    var me = this;
+
+    p_oSubmenu._nSubmenuHideDelayId = window.setTimeout(function () {
+
+        if (me._nCurrentMouseX > (p_nMouseX + 10)) {
+
+            p_oSubmenu._nSubmenuHideDelayId = window.setTimeout(function () {
+        
+                p_oSubmenu.hide();
+
+            }, p_nHideDelay);
+
+        }
+        else {
+
+            p_oSubmenu.hide();
+        
+        }
+
+    }, 50);
+
+},
+
+
+
+// Protected methods
+
+
+/**
+* @method _disableScrollHeader
+* @description Disables the header used for scrolling the body of the menu.
+* @protected
+*/
+_disableScrollHeader: function () {
+
+    if (!this._bHeaderDisabled) {
+
+        Dom.addClass(this.header, "topscrollbar_disabled");
+        this._bHeaderDisabled = true;
+
+    }
+
+},
+
+
+/**
+* @method _disableScrollFooter
+* @description Disables the footer used for scrolling the body of the menu.
+* @protected
+*/
+_disableScrollFooter: function () {
+
+    if (!this._bFooterDisabled) {
+
+        Dom.addClass(this.footer, "bottomscrollbar_disabled");
+        this._bFooterDisabled = true;
+
+    }
+
+},
+
+
+/**
+* @method _enableScrollHeader
+* @description Enables the header used for scrolling the body of the menu.
+* @protected
+*/
+_enableScrollHeader: function () {
+
+    if (this._bHeaderDisabled) {
+
+        Dom.removeClass(this.header, "topscrollbar_disabled");
+        this._bHeaderDisabled = false;
+
+    }
+
+},
+
+
+/**
+* @method _enableScrollFooter
+* @description Enables the footer used for scrolling the body of the menu.
+* @protected
+*/
+_enableScrollFooter: function () {
+
+    if (this._bFooterDisabled) {
+
+        Dom.removeClass(this.footer, "bottomscrollbar_disabled");
+        this._bFooterDisabled = false;
+
+    }
+
+},
+
+
+/**
+* @method _onMouseOver
+* @description "mouseover" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMouseOver: function (p_sType, p_aArgs) {
+
+    if (this._bStopMouseEventHandlers) {
+    
+        return false;
+    
+    }
+
+
+    var oEvent = p_aArgs[0],
+        oItem = p_aArgs[1],
+        oTarget = Event.getTarget(oEvent),
+        oParentMenu,
+        nShowDelay,
+        bShowDelay,
+        oActiveItem,
+        oItemCfg,
+        oSubmenu;
+
+
+    if (!this._bHandledMouseOverEvent && (oTarget == this.element || 
+        Dom.isAncestor(this.element, oTarget))) {
+
+        // Menu mouseover logic
+
+        this._nCurrentMouseX = 0;
+
+        Event.on(this.element, "mousemove", this._onMouseMove, this, true);
+
+
+        this.clearActiveItem();
+
+
+        if (this.parent && this._nSubmenuHideDelayId) {
+
+            window.clearTimeout(this._nSubmenuHideDelayId);
+
+            this.parent.cfg.setProperty("selected", true);
+
+            oParentMenu = this.parent.parent;
+
+            oParentMenu._bHandledMouseOutEvent = true;
+            oParentMenu._bHandledMouseOverEvent = false;
+
+        }
+
+
+        this._bHandledMouseOverEvent = true;
+        this._bHandledMouseOutEvent = false;
+    
+    }
+
+
+    if (oItem && !oItem.handledMouseOverEvent && 
+        !oItem.cfg.getProperty("disabled") && 
+        (oTarget == oItem.element || Dom.isAncestor(oItem.element, oTarget))) {
+
+        // Menu Item mouseover logic
+
+        nShowDelay = this.cfg.getProperty("showdelay");
+        bShowDelay = (nShowDelay > 0);
+
+
+        if (bShowDelay) {
+        
+            this._cancelShowDelay();
+        
+        }
+
+
+        oActiveItem = this.activeItem;
+    
+        if (oActiveItem) {
+    
+            oActiveItem.cfg.setProperty("selected", false);
+    
+        }
+
+
+        oItemCfg = oItem.cfg;
+    
+        // Select and focus the current menu item
+    
+        oItemCfg.setProperty("selected", true);
+
+
+        if (this.hasFocus()) {
+        
+            oItem.focus();
+        
+        }
+
+
+        if (this.cfg.getProperty("autosubmenudisplay")) {
+
+            // Show the submenu this menu item
+
+            oSubmenu = oItemCfg.getProperty("submenu");
+        
+            if (oSubmenu) {
+        
+                if (bShowDelay) {
+
+                    this._execShowDelay(oSubmenu);
+        
+                }
+                else {
+
+                    oSubmenu.show();
+
+                }
+
+            }
+
+        }                        
+
+        oItem.handledMouseOverEvent = true;
+        oItem.handledMouseOutEvent = false;
+
+    }
+
+},
+
+
+/**
+* @method _onMouseOut
+* @description "mouseout" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMouseOut: function (p_sType, p_aArgs) {
+
+    if (this._bStopMouseEventHandlers) {
+    
+        return false;
+    
+    }
+
+
+    var oEvent = p_aArgs[0],
+        oItem = p_aArgs[1],
+        oRelatedTarget = Event.getRelatedTarget(oEvent),
+        bMovingToSubmenu = false,
+        oItemCfg,
+        oSubmenu,
+        nSubmenuHideDelay,
+        nShowDelay;
+
+
+    if (oItem && !oItem.cfg.getProperty("disabled")) {
+
+        oItemCfg = oItem.cfg;
+        oSubmenu = oItemCfg.getProperty("submenu");
+
+
+        if (oSubmenu && (oRelatedTarget == oSubmenu.element ||
+                Dom.isAncestor(oSubmenu.element, oRelatedTarget))) {
+
+            bMovingToSubmenu = true;
+
+        }
+
+
+        if (!oItem.handledMouseOutEvent && ((oRelatedTarget != oItem.element &&  
+            !Dom.isAncestor(oItem.element, oRelatedTarget)) || 
+            bMovingToSubmenu)) {
+
+            // Menu Item mouseout logic
+
+            if (!bMovingToSubmenu) {
+
+                oItem.cfg.setProperty("selected", false);
+
+
+                if (oSubmenu) {
+
+                    nSubmenuHideDelay = 
+                        this.cfg.getProperty("submenuhidedelay");
+
+                    nShowDelay = this.cfg.getProperty("showdelay");
+
+                    if (!(this instanceof YAHOO.widget.MenuBar) && 
+                        nSubmenuHideDelay > 0 && 
+                        nShowDelay >= nSubmenuHideDelay) {
+
+                        this._execSubmenuHideDelay(oSubmenu, 
+                                Event.getPageX(oEvent),
+                                nSubmenuHideDelay);
+
+                    }
+                    else {
+
+                        oSubmenu.hide();
+
+                    }
+
+                }
+
+            }
+
+
+            oItem.handledMouseOutEvent = true;
+            oItem.handledMouseOverEvent = false;
+    
+        }
+
+    }
+
+
+    if (!this._bHandledMouseOutEvent && ((oRelatedTarget != this.element &&  
+        !Dom.isAncestor(this.element, oRelatedTarget)) || bMovingToSubmenu)) {
+
+        // Menu mouseout logic
+
+        Event.removeListener(this.element, "mousemove", this._onMouseMove);
+
+        this._nCurrentMouseX = Event.getPageX(oEvent);
+
+        this._bHandledMouseOutEvent = true;
+        this._bHandledMouseOverEvent = false;
+
+    }
+
+},
+
+
+/**
+* @method _onMouseMove
+* @description "click" event handler for the menu.
+* @protected
+* @param {Event} p_oEvent Object representing the DOM event object passed 
+* back by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+_onMouseMove: function (p_oEvent, p_oMenu) {
+
+    if (this._bStopMouseEventHandlers) {
+    
+        return false;
+    
+    }
+
+    this._nCurrentMouseX = Event.getPageX(p_oEvent);
+
+},
+
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onClick: function (p_sType, p_aArgs) {
+
+    var oEvent = p_aArgs[0],
+        oItem = p_aArgs[1],
+        oTarget,
+        oItemCfg,
+        oSubmenu,
+        sURL,
+        nURL,
+        oRoot;
+
+
+    if (oItem && !oItem.cfg.getProperty("disabled")) {
+
+        oTarget = Event.getTarget(oEvent);
+        oItemCfg = oItem.cfg;
+        oSubmenu = oItemCfg.getProperty("submenu");
+
+
+        /*
+            ACCESSIBILITY FEATURE FOR SCREEN READERS: 
+            Expand/collapse the submenu when the user clicks 
+            on the submenu indicator image.
+        */        
+
+        if (oTarget == oItem.submenuIndicator && oSubmenu) {
+
+            if (oSubmenu.cfg.getProperty("visible")) {
+
+                oSubmenu.hide();
+                
+                oSubmenu.parent.focus();
+    
+            }
+            else {
+
+                this.clearActiveItem();
+
+                oItemCfg.setProperty("selected", true);
+
+                oSubmenu.show();
+                
+                oSubmenu.setInitialFocus();
+    
+            }
+
+            Event.preventDefault(oEvent);
+    
+        }
+        else {
+
+            sURL = oItemCfg.getProperty("url");
+            
+            if ((sURL.substr(0,1) == "#")) {
+
+                Event.preventDefault(oEvent);
+
+                oItem.focus();
+            
+            }
+
+
+            if (!oSubmenu) {
+    
+                oRoot = this.getRoot();
+                
+                if (oRoot instanceof YAHOO.widget.MenuBar || 
+                    oRoot.cfg.getProperty("position") == "static") {
+    
+                    oRoot.clearActiveItem();
+    
+                }
+                else if (oRoot.cfg.getProperty("clicktohide")) {
+
+                    oRoot.hide();
+                
+                }
+    
+            }
+
+        }                    
+    
+    }
+
+},
+
+
+/**
+* @method _onKeyDown
+* @description "keydown" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onKeyDown: function (p_sType, p_aArgs) {
+
+    var oEvent = p_aArgs[0],
+        oItem = p_aArgs[1],
+        me = this,
+        oSubmenu,
+        oItemCfg,
+        oParentItem,
+        oRoot,
+        oNextItem,
+        oBody,
+        nBodyScrollTop,
+        nBodyOffsetHeight,
+        aItems,
+        nItems,
+        nNextItemOffsetTop,
+        nScrollTarget,
+        oParentMenu;
+
+
+    /*
+        This function is called to prevent a bug in Firefox.  In Firefox,
+        moving a DOM element into a stationary mouse pointer will cause the 
+        browser to fire mouse events.  This can result in the menu mouse
+        event handlers being called uncessarily, especially when menus are 
+        moved into a stationary mouse pointer as a result of a 
+        key event handler.
+    */
+    function stopMouseEventHandlers() {
+
+        me._bStopMouseEventHandlers = true;
+        
+        window.setTimeout(function () {
+        
+            me._bStopMouseEventHandlers = false;
+        
+        }, 10);
+
+    }
+
+
+    if (oItem && !oItem.cfg.getProperty("disabled")) {
+
+        oItemCfg = oItem.cfg;
+        oParentItem = this.parent;
+
+        switch(oEvent.keyCode) {
+    
+            case 38:    // Up arrow
+            case 40:    // Down arrow
+    
+                oNextItem = (oEvent.keyCode == 38) ? 
+                    oItem.getPreviousEnabledSibling() : 
+                    oItem.getNextEnabledSibling();
+        
+                if (oNextItem) {
+
+                    this.clearActiveItem();
+
+                    oNextItem.cfg.setProperty("selected", true);
+                    oNextItem.focus();
+
+
+                    if (this.cfg.getProperty("maxheight") > 0) {
+
+                        oBody = this.body;
+                        nBodyScrollTop = oBody.scrollTop;
+                        nBodyOffsetHeight = oBody.offsetHeight;
+                        aItems = this.getItems();
+                        nItems = aItems.length - 1;
+                        nNextItemOffsetTop = oNextItem.element.offsetTop;
+
+
+                        if (oEvent.keyCode == 40 ) {    // Down
+                       
+                            if (nNextItemOffsetTop >= (nBodyOffsetHeight + nBodyScrollTop)) {
+
+                                oBody.scrollTop = nNextItemOffsetTop - nBodyOffsetHeight;
+
+                            }
+                            else if (nNextItemOffsetTop <= nBodyScrollTop) {
+                            
+                                oBody.scrollTop = 0;
+                            
+                            }
+
+
+                            if (oNextItem == aItems[nItems]) {
+
+                                oBody.scrollTop = oNextItem.element.offsetTop;
+
+                            }
+
+                        }
+                        else {  // Up
+
+                            if (nNextItemOffsetTop <= nBodyScrollTop) {
+
+                                oBody.scrollTop = nNextItemOffsetTop - oNextItem.element.offsetHeight;
+                            
+                            }
+                            else if (nNextItemOffsetTop >= (nBodyScrollTop + nBodyOffsetHeight)) {
+                            
+                                oBody.scrollTop = nNextItemOffsetTop;
+                            
+                            }
+
+
+                            if (oNextItem == aItems[0]) {
+                            
+                                oBody.scrollTop = 0;
+                            
+                            }
+
+                        }
+
+
+                        nBodyScrollTop = oBody.scrollTop;
+                        nScrollTarget = oBody.scrollHeight - oBody.offsetHeight;
+
+                        if (nBodyScrollTop === 0) {
+
+                            this._disableScrollHeader();
+                            this._enableScrollFooter();
+
+                        }
+                        else if (nBodyScrollTop == nScrollTarget) {
+
+                             this._enableScrollHeader();
+                             this._disableScrollFooter();
+
+                        }
+                        else {
+
+                            this._enableScrollHeader();
+                            this._enableScrollFooter();
+
+                        }
+
+                    }
+
+                }
+
+    
+                Event.preventDefault(oEvent);
+
+                stopMouseEventHandlers();
+    
+            break;
+            
+    
+            case 39:    // Right arrow
+    
+                oSubmenu = oItemCfg.getProperty("submenu");
+    
+                if (oSubmenu) {
+    
+                    if (!oItemCfg.getProperty("selected")) {
+        
+                        oItemCfg.setProperty("selected", true);
+        
+                    }
+    
+                    oSubmenu.show();
+                    oSubmenu.setInitialFocus();
+                    oSubmenu.setInitialSelection();
+    
+                }
+                else {
+    
+                    oRoot = this.getRoot();
+                    
+                    if (oRoot instanceof YAHOO.widget.MenuBar) {
+    
+                        oNextItem = oRoot.activeItem.getNextEnabledSibling();
+    
+                        if (oNextItem) {
+                        
+                            oRoot.clearActiveItem();
+    
+                            oNextItem.cfg.setProperty("selected", true);
+    
+                            oSubmenu = oNextItem.cfg.getProperty("submenu");
+    
+                            if (oSubmenu) {
+    
+                                oSubmenu.show();
+                            
+                            }
+    
+                            oNextItem.focus();
+                        
+                        }
+                    
+                    }
+                
+                }
+    
+    
+                Event.preventDefault(oEvent);
+
+                stopMouseEventHandlers();
+
+            break;
+    
+    
+            case 37:    // Left arrow
+    
+                if (oParentItem) {
+    
+                    oParentMenu = oParentItem.parent;
+    
+                    if (oParentMenu instanceof YAHOO.widget.MenuBar) {
+    
+                        oNextItem = 
+                            oParentMenu.activeItem.getPreviousEnabledSibling();
+    
+                        if (oNextItem) {
+                        
+                            oParentMenu.clearActiveItem();
+    
+                            oNextItem.cfg.setProperty("selected", true);
+    
+                            oSubmenu = oNextItem.cfg.getProperty("submenu");
+    
+                            if (oSubmenu) {
+                            
+                                oSubmenu.show();
+                            
+                            }
+    
+                            oNextItem.focus();
+                        
+                        } 
+                    
+                    }
+                    else {
+    
+                        this.hide();
+    
+                        oParentItem.focus();
+                    
+                    }
+    
+                }
+    
+                Event.preventDefault(oEvent);
+
+                stopMouseEventHandlers();
+
+            break;        
+    
+        }
+
+
+    }
+
+
+    if (oEvent.keyCode == 27) { // Esc key
+
+        if (this.cfg.getProperty("position") == "dynamic") {
+        
+            this.hide();
+
+            if (this.parent) {
+
+                this.parent.focus();
+            
+            }
+
+        }
+        else if (this.activeItem) {
+
+            oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+            if (oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+            
+                oSubmenu.hide();
+                this.activeItem.focus();
+            
+            }
+            else {
+
+                this.activeItem.blur();
+                this.activeItem.cfg.setProperty("selected", false);
+        
+            }
+        
+        }
+
+
+        Event.preventDefault(oEvent);
+    
+    }
+    
+},
+
+
+/**
+* @method _onKeyPress
+* @description "keypress" event handler for a Menu instance.
+* @protected
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event 
+* was fired.
+*/
+_onKeyPress: function (p_sType, p_aArgs) {
+    
+    var oEvent = p_aArgs[0];
+
+
+    if (oEvent.keyCode == 40 || oEvent.keyCode == 38) {
+
+        Event.preventDefault(oEvent);
+
+    }
+
+},
+
+
+/**
+* @method _onTextResize
+* @description "textresize" event handler for the menu.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+_onTextResize: function (p_sType, p_aArgs, p_oMenu) {
+
+    if (YAHOO.env.ua.gecko && !this._handleResize) {
+
+        this._handleResize = true;
+        return;
+    
+    }
+
+
+    var oConfig = this.cfg;
+
+    if (oConfig.getProperty("position") == "dynamic") {
+
+        oConfig.setProperty("width", (this._getOffsetWidth() + "px"));
+
+    }
+
+},
+
+
+/**
+* @method _onScrollTargetMouseOver
+* @description "mouseover" event handler for the menu's "header" and "footer" 
+* elements.  Used to scroll the body of the menu up and down when the 
+* menu's "maxheight" configuration property is set to a value greater than 0.
+* @protected
+* @param {Event} p_oEvent Object representing the DOM event object passed 
+* back by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+_onScrollTargetMouseOver: function (p_oEvent, p_oMenu) {
+
+    this._cancelHideDelay();
+
+    var oTarget = Event.getTarget(p_oEvent),
+        oBody = this.body,
+        me = this,
+        nScrollTarget,
+        fnScrollFunction;
+
+
+    function scrollBodyDown() {
+
+        var nScrollTop = oBody.scrollTop;
+
+
+        if (nScrollTop < nScrollTarget) {
+
+            oBody.scrollTop = (nScrollTop + 1);
+
+            me._enableScrollHeader();
+
+        }
+        else {
+
+            oBody.scrollTop = nScrollTarget;
+            
+            window.clearInterval(me._nBodyScrollId);
+
+            me._disableScrollFooter();
+
+        }
+
+    }
+
+
+    function scrollBodyUp() {
+
+        var nScrollTop = oBody.scrollTop;
+
+
+        if (nScrollTop > 0) {
+
+            oBody.scrollTop = (nScrollTop - 1);
+
+            me._enableScrollFooter();
+
+        }
+        else {
+
+            oBody.scrollTop = 0;
+            
+            window.clearInterval(me._nBodyScrollId);
+
+            me._disableScrollHeader();
+
+        }
+
+    }
+
+    
+    if (Dom.hasClass(oTarget, "hd")) {
+
+        fnScrollFunction = scrollBodyUp;
+    
+    }
+    else {
+
+        nScrollTarget = oBody.scrollHeight - oBody.offsetHeight;
+
+        fnScrollFunction = scrollBodyDown;
+    
+    }
+
+
+    this._nBodyScrollId = window.setInterval(fnScrollFunction, 10);
+
+},
+
+
+/**
+* @method _onScrollTargetMouseOut
+* @description "mouseout" event handler for the menu's "header" and "footer" 
+* elements.  Used to stop scrolling the body of the menu up and down when the 
+* menu's "maxheight" configuration property is set to a value greater than 0.
+* @protected
+* @param {Event} p_oEvent Object representing the DOM event object passed 
+* back by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+_onScrollTargetMouseOut: function (p_oEvent, p_oMenu) {
+
+    window.clearInterval(this._nBodyScrollId);
+
+    this._cancelHideDelay();
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _onInit
+* @description "init" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onInit: function (p_sType, p_aArgs) {
+
+    this.cfg.subscribeToConfigEvent("width", this._onWidthChange);
+    this.cfg.subscribeToConfigEvent("visible", this._onVisibleChange);
+
+    var bRootMenu = !this.parent,
+        bLazyLoad = this.lazyLoad;
+
+
+    /*
+        Automatically initialize a menu's subtree if:
+
+        1) This is the root menu and lazyload is off
+        
+        2) This is the root menu, lazyload is on, but the menu is 
+           already visible
+
+        3) This menu is a submenu and lazyload is off
+    */
+
+
+
+    if (((bRootMenu && !bLazyLoad) || 
+        (bRootMenu && (this.cfg.getProperty("visible") || 
+        this.cfg.getProperty("position") == "static")) || 
+        (!bRootMenu && !bLazyLoad)) && this.getItemGroups().length === 0) {
+
+        if (this.srcElement) {
+
+            this._initSubTree();
+        
+        }
+
+
+        if (this.itemData) {
+
+            this.addItems(this.itemData);
+
+        }
+    
+    }
+    else if (bLazyLoad) {
+
+        this.cfg.fireQueue();
+    
+    }
+
+},
+
+
+/**
+* @method _onBeforeRender
+* @description "beforerender" event handler for the menu.  Appends all of the 
+* <code>&#60;ul&#62;</code>, <code>&#60;li&#62;</code> and their accompanying 
+* title elements to the body element of the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onBeforeRender: function (p_sType, p_aArgs) {
+
+    var oConfig = this.cfg,
+        oEl = this.element,
+        nListElements = this._aListElements.length,
+        bFirstList = true,
+        i = 0,
+        oUL,
+        oGroupTitle;
+
+    if (nListElements > 0) {
+
+        do {
+
+            oUL = this._aListElements[i];
+
+            if (oUL) {
+
+                if (bFirstList) {
+        
+                    Dom.addClass(oUL, "first-of-type");
+                    bFirstList = false;
+        
+                }
+
+
+                if (!Dom.isAncestor(oEl, oUL)) {
+
+                    this.appendToBody(oUL);
+
+                }
+
+
+                oGroupTitle = this._aGroupTitleElements[i];
+
+                if (oGroupTitle) {
+
+                    if (!Dom.isAncestor(oEl, oGroupTitle)) {
+
+                        oUL.parentNode.insertBefore(oGroupTitle, oUL);
+
+                    }
+
+
+                    Dom.addClass(oUL, "hastitle");
+
+                }
+
+            }
+
+            i++;
+
+        }
+        while(i < nListElements);
+
+    }
+
+},
+
+
+/**
+* @method _onRender
+* @description "render" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onRender: function (p_sType, p_aArgs) {
+
+    Module.textResizeEvent.subscribe(this._onTextResize, this, true);
+
+    if (this.cfg.getProperty("position") == "dynamic" && 
+        !this.cfg.getProperty("width")) {
+
+        this._setWidth();
+    
+    }
+
+},
+
+
+/**
+* @method _onBeforeShow
+* @description "beforeshow" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onBeforeShow: function (p_sType, p_aArgs) {
+
+    var nOptions,
+        n,
+        nViewportHeight,
+        oRegion,
+        nMaxHeight,
+        oBody,
+        oSrcElement;
+
+
+    if (this.lazyLoad && this.getItemGroups().length === 0) {
+
+        if (this.srcElement) {
+        
+            this._initSubTree();
+
+        }
+
+
+        if (this.itemData) {
+
+            if (this.parent && this.parent.parent && 
+                this.parent.parent.srcElement && 
+                this.parent.parent.srcElement.tagName.toUpperCase() == 
+                "SELECT") {
+
+                nOptions = this.itemData.length;
+    
+                for(n=0; n<nOptions; n++) {
+
+                    if (this.itemData[n].tagName) {
+
+                        this.addItem((new this.ITEM_TYPE(this.itemData[n])));
+    
+                    }
+    
+                }
+            
+            }
+            else {
+
+                this.addItems(this.itemData);
+            
+            }
+        
+        }
+
+
+        oSrcElement = this.srcElement;
+
+        if (oSrcElement) {
+
+            if (oSrcElement.tagName.toUpperCase() == "SELECT") {
+
+                if (Dom.inDocument(oSrcElement)) {
+
+                    this.render(oSrcElement.parentNode);
+                
+                }
+                else {
+                
+                    this.render(this.cfg.getProperty("container"));
+                
+                }
+
+            }
+            else {
+
+                this.render();
+
+            }
+
+        }
+        else {
+
+            if (this.parent) {
+
+                this.render(this.parent.element);            
+
+            }
+            else {
+
+                this.render(this.cfg.getProperty("container"));
+                this.cfg.refireEvent("xy");
+
+            }                
+
+        }
+
+    }
+
+
+    if (!(this instanceof YAHOO.widget.MenuBar) && 
+        this.cfg.getProperty("position") == "dynamic") {
+
+        nViewportHeight = Dom.getViewportHeight();
+
+
+        if (this.parent && this.parent.parent instanceof YAHOO.widget.MenuBar) {
+           
+            oRegion = YAHOO.util.Region.getRegion(this.parent.element);
+            
+            nViewportHeight = (nViewportHeight - oRegion.bottom);
+
+        }
+
+
+        if (this.element.offsetHeight >= nViewportHeight) {
+    
+            nMaxHeight = this.cfg.getProperty("maxheight");
+
+            /*
+                Cache the original value for the "maxheight" configuration  
+                property so that we can set it back when the menu is hidden.
+            */
+    
+            this._nMaxHeight = nMaxHeight;
+
+            this.cfg.setProperty("maxheight", (nViewportHeight - 20));
+        
+        }
+    
+    
+        if (this.cfg.getProperty("maxheight") > 0) {
+    
+            oBody = this.body;
+    
+            if (oBody.scrollTop > 0) {
+    
+                oBody.scrollTop = 0;
+    
+            }
+
+            this._disableScrollHeader();
+            this._enableScrollFooter();
+    
+        }
+
+    }
+
+
+},
+
+
+/**
+* @method _onShow
+* @description "show" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onShow: function (p_sType, p_aArgs) {
+
+    var oParent = this.parent,
+        oParentMenu,
+        aParentAlignment,
+        aAlignment;
+
+
+    function disableAutoSubmenuDisplay(p_oEvent) {
+
+        var oTarget;
+
+        if (p_oEvent.type == "mousedown" || (p_oEvent.type == "keydown" && 
+            p_oEvent.keyCode == 27)) {
+
+            /*  
+                Set the "autosubmenudisplay" to "false" if the user
+                clicks outside the menu bar.
+            */
+
+            oTarget = Event.getTarget(p_oEvent);
+
+            if (oTarget != oParentMenu.element || 
+                !Dom.isAncestor(oParentMenu.element, oTarget)) {
+
+                oParentMenu.cfg.setProperty("autosubmenudisplay", false);
+
+                Event.removeListener(document, "mousedown", 
+                        disableAutoSubmenuDisplay);
+
+                Event.removeListener(document, "keydown", 
+                        disableAutoSubmenuDisplay);
+
+            }
+        
+        }
+
+    }
+
+
+    if (oParent) {
+
+        oParentMenu = oParent.parent;
+        aParentAlignment = oParentMenu.cfg.getProperty("submenualignment");
+        aAlignment = this.cfg.getProperty("submenualignment");
+
+
+        if ((aParentAlignment[0] != aAlignment[0]) &&
+            (aParentAlignment[1] != aAlignment[1])) {
+
+            this.cfg.setProperty("submenualignment", 
+                [aParentAlignment[0], aParentAlignment[1]]);
+        
+        }
+
+
+        if (!oParentMenu.cfg.getProperty("autosubmenudisplay") && 
+            (oParentMenu instanceof YAHOO.widget.MenuBar || 
+            oParentMenu.cfg.getProperty("position") == "static")) {
+
+            oParentMenu.cfg.setProperty("autosubmenudisplay", true);
+
+            Event.on(document, "mousedown", disableAutoSubmenuDisplay);                             
+            Event.on(document, "keydown", disableAutoSubmenuDisplay);
+
+        }
+
+    }
+
+},
+
+
+/**
+* @method _onBeforeHide
+* @description "beforehide" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onBeforeHide: function (p_sType, p_aArgs) {
+
+    var oActiveItem = this.activeItem,
+        oConfig,
+        oSubmenu;
+
+    if (oActiveItem) {
+
+        oConfig = oActiveItem.cfg;
+
+        oConfig.setProperty("selected", false);
+
+        oSubmenu = oConfig.getProperty("submenu");
+
+        if (oSubmenu) {
+
+            oSubmenu.hide();
+
+        }
+
+    }
+
+    if (this.getRoot() == this) {
+
+        this.blur();
+    
+    }
+
+},
+
+
+/**
+* @method _onHide
+* @description "hide" event handler for the menu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onHide: function (p_sType, p_aArgs) {
+
+    if (this._nMaxHeight != -1) {
+
+        this.cfg.setProperty("maxheight", this._nMaxHeight);
+
+        this._nMaxHeight = -1;
+
+    }
+
+},
+
+
+/**
+* @method _onParentMenuConfigChange
+* @description "configchange" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that 
+* subscribed to the event.
+*/
+_onParentMenuConfigChange: function (p_sType, p_aArgs, p_oSubmenu) {
+    
+    var sPropertyName = p_aArgs[0][0],
+        oPropertyValue = p_aArgs[0][1];
+
+    switch(sPropertyName) {
+
+        case "iframe":
+        case "constraintoviewport":
+        case "hidedelay":
+        case "showdelay":
+        case "submenuhidedelay":
+        case "clicktohide":
+        case "effect":
+        case "classname":
+
+            p_oSubmenu.cfg.setProperty(sPropertyName, oPropertyValue);
+                
+        break;        
+        
+    }
+    
+},
+
+
+/**
+* @method _onParentMenuRender
+* @description "render" event handler for a submenu.  Renders a  
+* submenu in response to the firing of its parent's "render" event.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that 
+* subscribed to the event.
+*/
+_onParentMenuRender: function (p_sType, p_aArgs, p_oSubmenu) {
+
+    var oParentMenu = p_oSubmenu.parent.parent,
+
+        oConfig = {
+
+            constraintoviewport: 
+                oParentMenu.cfg.getProperty("constraintoviewport"),
+
+            xy: [0,0],
+                
+            clicktohide: oParentMenu.cfg.getProperty("clicktohide"),
+                
+            effect: oParentMenu.cfg.getProperty("effect"),
+
+            showdelay: oParentMenu.cfg.getProperty("showdelay"),
+            
+            hidedelay: oParentMenu.cfg.getProperty("hidedelay"),
+
+            submenuhidedelay: oParentMenu.cfg.getProperty("submenuhidedelay"),
+
+            classname: oParentMenu.cfg.getProperty("classname")
+
+        },
+        
+        oLI;
+
+
+    /*
+        Only sync the "iframe" configuration property if the parent
+        menu's "position" configuration is the same.
+    */
+
+    if (this.cfg.getProperty("position") == 
+        oParentMenu.cfg.getProperty("position")) {
+
+        oConfig.iframe = oParentMenu.cfg.getProperty("iframe");
+    
+    }
+               
+
+    p_oSubmenu.cfg.applyConfig(oConfig);
+
+
+    if (!this.lazyLoad) {
+
+        oLI = this.parent.element;
+
+        if (this.element.parentNode == oLI) {
+    
+            this.render();
+    
+        }
+        else {
+
+            this.render(oLI);
+    
+        }
+
+    }
+    
+},
+
+
+/**
+* @method _onSubmenuBeforeShow
+* @description "beforeshow" event handler for a submenu.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onSubmenuBeforeShow: function (p_sType, p_aArgs) {
+    
+    var oParent = this.parent,
+        aAlignment = oParent.parent.cfg.getProperty("submenualignment");
+
+    this.cfg.setProperty("context", 
+        [oParent.element, aAlignment[0], aAlignment[1]]);
+
+
+    var nScrollTop = oParent.parent.body.scrollTop;
+
+    if ((UA.gecko || UA.webkit) && nScrollTop > 0) {
+
+         this.cfg.setProperty("y", (this.cfg.getProperty("y") - nScrollTop));
+    
+    }
+
+},
+
+
+
+
+
+/**
+* @method _onMenuItemFocus
+* @description "focus" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMenuItemFocus: function (p_sType, p_aArgs) {
+
+    this.parent.focusEvent.fire(this);
+
+},
+
+
+/**
+* @method _onMenuItemBlur
+* @description "blur" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event 
+* that was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+_onMenuItemBlur: function (p_sType, p_aArgs) {
+
+    this.parent.blurEvent.fire(this);
+
+},
+
+
+/**
+* @method _onMenuItemConfigChange
+* @description "configchange" event handler for the menu's items.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item 
+* that fired the event.
+*/
+_onMenuItemConfigChange: function (p_sType, p_aArgs, p_oItem) {
+
+    var sPropertyName = p_aArgs[0][0],
+        oPropertyValue = p_aArgs[0][1],
+        oSubmenu;
+
+
+    switch(sPropertyName) {
+
+        case "selected":
+
+            if (oPropertyValue === true) {
+
+                this.activeItem = p_oItem;
+            
+            }
+
+        break;
+
+        case "submenu":
+
+            oSubmenu = p_aArgs[0][1];
+
+            if (oSubmenu) {
+
+                this._configureSubmenu(p_oItem);
+
+            }
+
+        break;
+
+        case "text":
+        case "helptext":
+
+            /*
+                A change to an item's "text" or "helptext"
+                configuration properties requires the width of the parent
+                menu to be recalculated.
+            */
+
+            if (this.element.style.width) {
+
+                this.cfg.setProperty("width", (this._getOffsetWidth() + "px"));
+
+            }
+
+        break;
+
+    }
+
+},
+
+
+
+// Public event handlers for configuration properties
+
+
+/**
+* @method enforceConstraints
+* @description The default event handler executed when the moveEvent is fired,  
+* if the "constraintoviewport" configuration property is set to true.
+* @param {String} type The name of the event that was fired.
+* @param {Array} args Collection of arguments sent when the 
+* event was fired.
+* @param {Array} obj Array containing the current Menu instance 
+* and the item that fired the event.
+*/
+enforceConstraints: function (type, args, obj) {
+
+    var oParentMenuItem = this.parent,
+        oElement,
+        oConfig,
+        pos,
+        x,
+        y,
+        offsetHeight,
+        offsetWidth,
+        viewPortWidth,
+        viewPortHeight,
+        scrollX,
+        scrollY,
+        nPadding,
+        topConstraint,
+        leftConstraint,
+        bottomConstraint,
+        rightConstraint,
+        aContext,
+        oContextElement;
+
+
+    if (oParentMenuItem && 
+        !(oParentMenuItem.parent instanceof YAHOO.widget.MenuBar)) {
+
+        oElement = this.element;
+    
+        oConfig = this.cfg;
+        pos = args[0];
+        
+        x = pos[0];
+        y = pos[1];
+        
+        offsetHeight = oElement.offsetHeight;
+        offsetWidth = oElement.offsetWidth;
+        
+        viewPortWidth = Dom.getViewportWidth();
+        viewPortHeight = Dom.getViewportHeight();
+        
+        scrollX = Dom.getDocumentScrollLeft();
+        scrollY = Dom.getDocumentScrollTop();
+        
+        nPadding = 
+            (oParentMenuItem.parent instanceof YAHOO.widget.MenuBar) ? 0 : 10;
+        
+        topConstraint = scrollY + nPadding;
+        leftConstraint = scrollX + nPadding;
+        
+        bottomConstraint = scrollY + viewPortHeight - offsetHeight - nPadding;
+        rightConstraint = scrollX + viewPortWidth - offsetWidth - nPadding;
+        
+        aContext = oConfig.getProperty("context");
+        oContextElement = aContext ? aContext[0] : null;
+    
+    
+        if (x < 10) {
+    
+            x = leftConstraint;
+    
+        } else if ((x + offsetWidth) > viewPortWidth) {
+    
+            if (oContextElement &&
+                ((x - oContextElement.offsetWidth) > offsetWidth)) {
+    
+                x = (x - (oContextElement.offsetWidth + offsetWidth));
+    
+            }
+            else {
+    
+                x = rightConstraint;
+    
+            }
+    
+        }
+    
+        if (y < 10) {
+    
+            y = topConstraint;
+    
+        } else if (y > bottomConstraint) {
+    
+            if (oContextElement && (y > offsetHeight)) {
+    
+                y = ((y + oContextElement.offsetHeight) - offsetHeight);
+    
+            }
+            else {
+    
+                y = bottomConstraint;
+    
+            }
+    
+        }
+    
+        oConfig.setProperty("x", x, true);
+        oConfig.setProperty("y", y, true);
+        oConfig.setProperty("xy", [x,y], true);
+    
+    }
+    else if (this == this.getRoot() && 
+        this.cfg.getProperty("position") == "dynamic") {
+    
+        Menu.superclass.enforceConstraints.call(this, type, args, obj);
+    
+    }
+
+},
+
+
+/**
+* @method configVisible
+* @description Event handler for when the "visible" configuration property 
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+configVisible: function (p_sType, p_aArgs, p_oMenu) {
+
+    var bVisible,
+        sDisplay;
+
+    if (this.cfg.getProperty("position") == "dynamic") {
+
+        Menu.superclass.configVisible.call(this, p_sType, p_aArgs, p_oMenu);
+
+    }
+    else {
+
+        bVisible = p_aArgs[0];
+        sDisplay = Dom.getStyle(this.element, "display");
+
+        Dom.setStyle(this.element, "visibility", "visible");
+
+        if (bVisible) {
+
+            if (sDisplay != "block") {
+                this.beforeShowEvent.fire();
+                Dom.setStyle(this.element, "display", "block");
+                this.showEvent.fire();
+            }
+        
+        }
+        else {
+
+			if (sDisplay == "block") {
+				this.beforeHideEvent.fire();
+				Dom.setStyle(this.element, "display", "none");
+				this.hideEvent.fire();
+			}
+        
+        }
+
+    }
+
+},
+
+
+/**
+* @method configPosition
+* @description Event handler for when the "position" configuration property 
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+configPosition: function (p_sType, p_aArgs, p_oMenu) {
+
+    var oElement = this.element,
+        sCSSPosition = p_aArgs[0] == "static" ? "static" : "absolute",
+        sCurrentPosition = Dom.getStyle(oElement, "position"),
+        oCfg = this.cfg,
+        nZIndex;
+
+
+    Dom.setStyle(this.element, "position", sCSSPosition);
+
+
+    if (sCSSPosition == "static") {
+
+        /*
+            Remove the iframe for statically positioned menus since it will 
+            intercept mouse events.
+        */
+
+        oCfg.setProperty("iframe", false);
+
+
+        // Statically positioned menus are visible by default
+        
+        Dom.setStyle(this.element, "display", "block");
+
+        oCfg.setProperty("visible", true);
+
+    }
+    else {
+
+        if (sCurrentPosition != "absolute") {
+
+            oCfg.setProperty("iframe", (UA.ie == 6 ? true : false));
+
+        }
+
+        /*
+            Even though the "visible" property is queued to 
+            "false" by default, we need to set the "visibility" property to 
+            "hidden" since Overlay's "configVisible" implementation checks the 
+            element's "visibility" style property before deciding whether 
+            or not to show an Overlay instance.
+        */
+
+        Dom.setStyle(this.element, "visibility", "hidden");
+    
+    }
+
+
+    if (sCSSPosition == "absolute") {
+
+        nZIndex = oCfg.getProperty("zindex");
+
+        if (!nZIndex || nZIndex === 0) {
+
+            nZIndex = this.parent ? 
+                (this.parent.parent.cfg.getProperty("zindex") + 1) : 1;
+
+            oCfg.setProperty("zindex", nZIndex);
+
+        }
+
+    }
+
+},
+
+
+/**
+* @method configIframe
+* @description Event handler for when the "iframe" configuration property of 
+* the menu changes.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+configIframe: function (p_sType, p_aArgs, p_oMenu) {    
+
+    if (this.cfg.getProperty("position") == "dynamic") {
+
+        Menu.superclass.configIframe.call(this, p_sType, p_aArgs, p_oMenu);
+
+    }
+
+},
+
+
+/**
+* @method configHideDelay
+* @description Event handler for when the "hidedelay" configuration property 
+* of the menu changes.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+configHideDelay: function (p_sType, p_aArgs, p_oMenu) {
+
+    var nHideDelay = p_aArgs[0],
+        oMouseOutEvent = this.mouseOutEvent,
+        oMouseOverEvent = this.mouseOverEvent,
+        oKeyDownEvent = this.keyDownEvent;
+
+    if (nHideDelay > 0) {
+
+        /*
+            Only assign event handlers once. This way the user change 
+            the value for the hidedelay as many times as they want.
+        */
+
+        if (!this._bHideDelayEventHandlersAssigned) {
+
+            oMouseOutEvent.subscribe(this._execHideDelay);
+            oMouseOverEvent.subscribe(this._cancelHideDelay);
+            oKeyDownEvent.subscribe(this._cancelHideDelay);
+
+            this._bHideDelayEventHandlersAssigned = true;
+        
+        }
+
+    }
+    else {
+
+        oMouseOutEvent.unsubscribe(this._execHideDelay);
+        oMouseOverEvent.unsubscribe(this._cancelHideDelay);
+        oKeyDownEvent.unsubscribe(this._cancelHideDelay);
+
+        this._bHideDelayEventHandlersAssigned = false;
+
+    }
+
+},
+
+
+/**
+* @method configContainer
+* @description Event handler for when the "container" configuration property 
+of the menu changes.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that 
+* fired the event.
+*/
+configContainer: function (p_sType, p_aArgs, p_oMenu) {
+
+	var oElement = p_aArgs[0];
+
+	if (typeof oElement == 'string') {
+
+        this.cfg.setProperty("container", document.getElementById(oElement), 
+                true);
+
+	}
+
+},
+
+
+/**
+* @method _setMaxHeight
+* @description "renderEvent" handler used to defer the setting of the 
+* "maxheight" configuration property until the menu is rendered in lazy 
+* load scenarios.
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event 
+* was fired.
+* @param {Number} p_nMaxHeight Number representing the value to set for the 
+* "maxheight" configuration property.
+* @private
+*/
+_setMaxHeight: function (p_sType, p_aArgs, p_nMaxHeight) {
+
+    this.cfg.setProperty("maxheight", p_nMaxHeight);
+    this.renderEvent.unsubscribe(this._setMaxHeight);
+
+},
+
+
+/**
+* @method configMaxHeight
+* @description Event handler for when the "maxheight" configuration property of 
+* a Menu changes.
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event 
+* was fired.
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired
+* the event.
+*/
+configMaxHeight: function (p_sType, p_aArgs, p_oMenu) {
+
+    var nMaxHeight = p_aArgs[0],
+        oBody = this.body,
+        oHeader = this.header,
+        oFooter = this.footer,
+        fnMouseOver = this._onScrollTargetMouseOver,
+        fnMouseOut = this._onScrollTargetMouseOut,
+        nHeight;
+
+
+    if (this.lazyLoad && !oBody) {
+
+        this.renderEvent.unsubscribe(this._setMaxHeight);
+    
+        if (nMaxHeight > 0) {
+
+            this.renderEvent.subscribe(this._setMaxHeight, nMaxHeight, this);
+
+        }
+
+        return;
+    
+    }
+
+    Dom.setStyle(oBody, "height", "auto");
+    Dom.removeClass(oBody, "yui-menu-body-scrolled");
+
+    if ((nMaxHeight > 0) && (oBody.offsetHeight > nMaxHeight)) {
+
+        if (!this.cfg.getProperty("width")) {
+
+            this._setWidth();
+
+        }
+
+        if (!oHeader && !oFooter) {
+
+            this.setHeader("&#32;");
+            this.setFooter("&#32;");
+
+            oHeader = this.header;
+            oFooter = this.footer;
+
+            Dom.addClass(oHeader, "topscrollbar");
+            Dom.addClass(oFooter, "bottomscrollbar");
+            
+            this.element.insertBefore(oHeader, oBody);
+            this.element.appendChild(oFooter);
+
+            Event.on(oHeader, "mouseover", fnMouseOver, this, true);
+            Event.on(oHeader, "mouseout", fnMouseOut, this, true);
+            Event.on(oFooter, "mouseover", fnMouseOver, this, true);
+            Event.on(oFooter, "mouseout", fnMouseOut, this, true);
+        
+        }
+
+        Dom.addClass(oBody, "yui-menu-body-scrolled");
+
+        nHeight = (nMaxHeight - (this.footer.offsetHeight + 
+                    this.header.offsetHeight));
+
+        Dom.setStyle(oBody, "height", (nHeight + "px"));
+
+    }
+    else if (oHeader && oFooter) {
+
+        Event.removeListener(oHeader, "mouseover", fnMouseOver);
+        Event.removeListener(oHeader, "mouseout", fnMouseOut);
+        Event.removeListener(oFooter, "mouseover", fnMouseOver);
+        Event.removeListener(oFooter, "mouseout", fnMouseOut);
+
+        this.element.removeChild(oHeader);
+        this.element.removeChild(oFooter);
+    
+        this.header = null;
+        this.footer = null;
+    
+    }
+
+    this.cfg.refireEvent("iframe");
+
+},
+
+
+/**
+* @method configClassName
+* @description Event handler for when the "classname" configuration property of 
+* a menu changes.
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired the event.
+*/
+configClassName: function (p_sType, p_aArgs, p_oMenu) {
+
+    var sClassName = p_aArgs[0];
+
+    if (this._sClassName) {
+
+        Dom.removeClass(this.element, this._sClassName);
+
+    }
+
+    Dom.addClass(this.element, sClassName);
+    this._sClassName = sClassName;
+
+},
+
+
+/**
+* @method _onItemAdded
+* @description "itemadded" event handler for a Menu instance.
+* @private
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event 
+* was fired.
+*/
+_onItemAdded: function (p_sType, p_aArgs) {
+
+    var oItem = p_aArgs[0];
+    
+    if (oItem) {
+
+        oItem.cfg.setProperty("disabled", true);
+    
+    }
+
+},
+
+
+/**
+* @method configDisabled
+* @description Event handler for when the "disabled" configuration property of 
+* a menu changes.
+* @param {String} p_sType The name of the event that was fired.
+* @param {Array} p_aArgs Collection of arguments sent when the event was fired.
+* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired the event.
+*/
+configDisabled: function (p_sType, p_aArgs, p_oMenu) {
+
+    var bDisabled = p_aArgs[0],
+        aItems = this.getItems(),
+        nItems,
+        i;
+
+    if (Lang.isArray(aItems)) {
+
+        nItems = aItems.length;
+    
+        if (nItems > 0) {
+        
+            i = nItems - 1;
+    
+            do {
+    
+                aItems[i].cfg.setProperty("disabled", bDisabled);
+            
+            }
+            while (i--);
+        
+        }
+
+
+        if (bDisabled) {
+
+            Dom.addClass(this.element, "disabled");
+
+            this.itemAddedEvent.subscribe(this._onItemAdded);
+
+        }
+        else {
+
+            Dom.removeClass(this.element, "disabled");
+
+            this.itemAddedEvent.unsubscribe(this._onItemAdded);
+
+        }
+        
+    }
+
+},
+
+
+/**
+* @method onRender
+* @description "render" event handler for the menu.
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+*/
+onRender: function (p_sType, p_aArgs) {
+
+    function sizeShadow() {
+
+        var oElement = this.element,
+            oShadow = this._shadow;
+    
+        if (oShadow) {
+
+            oShadow.style.width = (oElement.offsetWidth + 6) + "px";
+            oShadow.style.height = (oElement.offsetHeight + 1) + "px";
+            
+        }
+    
+    }
+
+
+    function addShadowVisibleClass() {
+    
+        Dom.addClass(this._shadow, "yui-menu-shadow-visible");
+    
+    }
+    
+
+    function removeShadowVisibleClass() {
+
+        Dom.removeClass(this._shadow, "yui-menu-shadow-visible");
+    
+    }
+
+
+    function createShadow() {
+
+        var oShadow = this._shadow,
+            oElement,
+            me;
+
+        if (!oShadow) {
+
+            oElement = this.element;
+            me = this;
+
+            if (!m_oShadowTemplate) {
+
+                m_oShadowTemplate = document.createElement("div");
+                m_oShadowTemplate.className = "yui-menu-shadow";
+            
+            }
+
+            oShadow = m_oShadowTemplate.cloneNode(false);
+
+            oElement.appendChild(oShadow);
+            
+            this._shadow = oShadow;
+
+            addShadowVisibleClass.call(this);
+
+            this.beforeShowEvent.subscribe(addShadowVisibleClass);
+            this.beforeHideEvent.subscribe(removeShadowVisibleClass);
+
+            if (UA.ie) {
+        
+                /*
+                     Need to call sizeShadow & syncIframe via setTimeout for 
+                     IE 7 Quirks Mode and IE 6 Standards Mode and Quirks Mode 
+                     or the shadow and iframe shim will not be sized and 
+                     positioned properly.
+                */
+        
+                window.setTimeout(function () { 
+        
+                    sizeShadow.call(me); 
+                    me.syncIframe();
+        
+                }, 0);
+
+                this.cfg.subscribeToConfigEvent("width", sizeShadow);
+                this.cfg.subscribeToConfigEvent("height", sizeShadow);
+                this.cfg.subscribeToConfigEvent("maxheight", sizeShadow);
+                this.changeContentEvent.subscribe(sizeShadow);
+
+                Module.textResizeEvent.subscribe(sizeShadow, me, true);
+                
+                this.destroyEvent.subscribe(function () {
+                
+                    Module.textResizeEvent.unsubscribe(sizeShadow, me);
+                
+                });
+        
+            }
+        
+        }
+
+    }
+
+
+    function onBeforeShow() {
+    
+        createShadow.call(this);
+
+        this.beforeShowEvent.unsubscribe(onBeforeShow);
+    
+    }
+
+
+    if (this.cfg.getProperty("position") == "dynamic") {
+
+        if (this.cfg.getProperty("visible")) {
+
+            createShadow.call(this);
+        
+        }
+        else {
+
+            this.beforeShowEvent.subscribe(onBeforeShow);
+        
+        }
+    
+    }
+
+},
+
+
+// Public methods
+
+
+/**
+* @method initEvents
+* @description Initializes the custom events for the menu.
+*/
+initEvents: function () {
+
+	Menu.superclass.initEvents.call(this);
+
+    // Create custom events
+
+    var SIGNATURE = CustomEvent.LIST;
+
+    this.mouseOverEvent = this.createEvent(EVENT_TYPES.MOUSE_OVER);
+    this.mouseOverEvent.signature = SIGNATURE;
+
+    this.mouseOutEvent = this.createEvent(EVENT_TYPES.MOUSE_OUT);
+    this.mouseOutEvent.signature = SIGNATURE;
+    
+    this.mouseDownEvent = this.createEvent(EVENT_TYPES.MOUSE_DOWN);
+    this.mouseDownEvent.signature = SIGNATURE;
+
+    this.mouseUpEvent = this.createEvent(EVENT_TYPES.MOUSE_UP);
+    this.mouseUpEvent.signature = SIGNATURE;
+    
+    this.clickEvent = this.createEvent(EVENT_TYPES.CLICK);
+    this.clickEvent.signature = SIGNATURE;
+    
+    this.keyPressEvent = this.createEvent(EVENT_TYPES.KEY_PRESS);
+    this.keyPressEvent.signature = SIGNATURE;
+    
+    this.keyDownEvent = this.createEvent(EVENT_TYPES.KEY_DOWN);
+    this.keyDownEvent.signature = SIGNATURE;
+    
+    this.keyUpEvent = this.createEvent(EVENT_TYPES.KEY_UP);
+    this.keyUpEvent.signature = SIGNATURE;
+    
+    this.focusEvent = this.createEvent(EVENT_TYPES.FOCUS);
+    this.focusEvent.signature = SIGNATURE;
+    
+    this.blurEvent = this.createEvent(EVENT_TYPES.BLUR);
+    this.blurEvent.signature = SIGNATURE;
+    
+    this.itemAddedEvent = this.createEvent(EVENT_TYPES.ITEM_ADDED);
+    this.itemAddedEvent.signature = SIGNATURE;
+    
+    this.itemRemovedEvent = this.createEvent(EVENT_TYPES.ITEM_REMOVED);
+    this.itemRemovedEvent.signature = SIGNATURE;
+
+},
+
+
+/**
+* @method getRoot
+* @description Finds the menu's root menu.
+*/
+getRoot: function () {
+
+    var oItem = this.parent,
+        oParentMenu;
+
+    if (oItem) {
+
+        oParentMenu = oItem.parent;
+
+        return oParentMenu ? oParentMenu.getRoot() : this;
+
+    }
+    else {
+    
+        return this;
+    
+    }
+
+},
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu.
+* @return {String}
+*/
+toString: function () {
+
+    var sReturnVal = "Menu",
+        sId = this.id;
+
+    if (sId) {
+
+        sReturnVal += (" " + sId);
+    
+    }
+
+    return sReturnVal;
+
+},
+
+
+/**
+* @method setItemGroupTitle
+* @description Sets the title of a group of menu items.
+* @param {String} p_sGroupTitle String specifying the title of the group.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to which
+* the title belongs.
+*/
+setItemGroupTitle: function (p_sGroupTitle, p_nGroupIndex) {
+
+    var nGroupIndex,
+        oTitle,
+        i,
+        nFirstIndex;
+        
+    if (typeof p_sGroupTitle == "string" && p_sGroupTitle.length > 0) {
+
+        nGroupIndex = typeof p_nGroupIndex == "number" ? p_nGroupIndex : 0;
+        oTitle = this._aGroupTitleElements[nGroupIndex];
+
+
+        if (oTitle) {
+
+            oTitle.innerHTML = p_sGroupTitle;
+            
+        }
+        else {
+
+            oTitle = document.createElement(this.GROUP_TITLE_TAG_NAME);
+                    
+            oTitle.innerHTML = p_sGroupTitle;
+
+            this._aGroupTitleElements[nGroupIndex] = oTitle;
+
+        }
+
+
+        i = this._aGroupTitleElements.length - 1;
+
+        do {
+
+            if (this._aGroupTitleElements[i]) {
+
+                Dom.removeClass(this._aGroupTitleElements[i], "first-of-type");
+
+                nFirstIndex = i;
+
+            }
+
+        }
+        while(i--);
+
+
+        if (nFirstIndex !== null) {
+
+            Dom.addClass(this._aGroupTitleElements[nFirstIndex], 
+                "first-of-type");
+
+        }
+
+        this.changeContentEvent.fire();
+
+    }
+
+},
+
+
+
+/**
+* @method addItem
+* @description Appends an item to the menu.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance to be added to the menu.
+* @param {String} p_oItem String specifying the text of the item to be added 
+* to the menu.
+* @param {Object} p_oItem Object literal containing a set of menu item 
+* configuration properties.
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to
+* which the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+addItem: function (p_oItem, p_nGroupIndex) {
+
+    if (p_oItem) {
+
+        return this._addItemToGroup(p_nGroupIndex, p_oItem);
+        
+    }
+
+},
+
+
+/**
+* @method addItems
+* @description Adds an array of items to the menu.
+* @param {Array} p_aItems Array of items to be added to the menu.  The array 
+* can contain strings specifying the text for each item to be created, object
+* literals specifying each of the menu item configuration properties, 
+* or MenuItem instances.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to 
+* which the items belongs.
+* @return {Array}
+*/
+addItems: function (p_aItems, p_nGroupIndex) {
+
+    var nItems,
+        aItems,
+        oItem,
+        i;
+
+    if (Lang.isArray(p_aItems)) {
+
+        nItems = p_aItems.length;
+        aItems = [];
+
+        for(i=0; i<nItems; i++) {
+
+            oItem = p_aItems[i];
+
+            if (oItem) {
+
+                if (Lang.isArray(oItem)) {
+    
+                    aItems[aItems.length] = this.addItems(oItem, i);
+    
+                }
+                else {
+    
+                    aItems[aItems.length] = 
+                        this._addItemToGroup(p_nGroupIndex, oItem);
+                
+                }
+
+            }
+    
+        }
+
+
+        if (aItems.length) {
+        
+            return aItems;
+        
+        }
+
+    }
+
+},
+
+
+/**
+* @method insertItem
+* @description Inserts an item into the menu at the specified index.
+* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem 
+* instance to be added to the menu.
+* @param {String} p_oItem String specifying the text of the item to be added 
+* to the menu.
+* @param {Object} p_oItem Object literal containing a set of menu item 
+* configuration properties.
+* @param {Number} p_nItemIndex Number indicating the ordinal position at which
+* the item should be added.
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which 
+* the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+insertItem: function (p_oItem, p_nItemIndex, p_nGroupIndex) {
+    
+    if (p_oItem) {
+
+        return this._addItemToGroup(p_nGroupIndex, p_oItem, p_nItemIndex);
+
+    }
+
+},
+
+
+/**
+* @method removeItem
+* @description Removes the specified item from the menu.
+* @param {YAHOO.widget.MenuItem} p_oObject Object reference for the MenuItem 
+* instance to be removed from the menu.
+* @param {Number} p_oObject Number specifying the index of the item 
+* to be removed.
+* @param {Number} p_nGroupIndex Optional. Number specifying the group to 
+* which the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+removeItem: function (p_oObject, p_nGroupIndex) {
+
+    var oItem;
+    
+    if (typeof p_oObject != "undefined") {
+
+        if (p_oObject instanceof YAHOO.widget.MenuItem) {
+
+            oItem = this._removeItemFromGroupByValue(p_nGroupIndex, p_oObject);           
+
+        }
+        else if (typeof p_oObject == "number") {
+
+            oItem = this._removeItemFromGroupByIndex(p_nGroupIndex, p_oObject);
+
+        }
+
+        if (oItem) {
+
+            oItem.destroy();
+
+
+            return oItem;
+
+        }
+
+    }
+
+},
+
+
+/**
+* @method getItems
+* @description Returns an array of all of the items in the menu.
+* @return {Array}
+*/
+getItems: function () {
+
+    var aGroups = this._aItemGroups,
+        nGroups,
+        aItems = [];
+
+    if (Lang.isArray(aGroups)) {
+
+        nGroups = aGroups.length;
+
+        return ((nGroups == 1) ? aGroups[0] : 
+                    (Array.prototype.concat.apply(aItems, aGroups)));
+
+    }
+
+},
+
+
+/**
+* @method getItemGroups
+* @description Multi-dimensional Array representing the menu items as they 
+* are grouped in the menu.
+* @return {Array}
+*/        
+getItemGroups: function () {
+
+    return this._aItemGroups;
+
+},
+
+
+/**
+* @method getItem
+* @description Returns the item at the specified index.
+* @param {Number} p_nItemIndex Number indicating the ordinal position of the 
+* item to be retrieved.
+* @param {Number} p_nGroupIndex Optional. Number indicating the group to which 
+* the item belongs.
+* @return {YAHOO.widget.MenuItem}
+*/
+getItem: function (p_nItemIndex, p_nGroupIndex) {
+    
+    var aGroup;
+    
+    if (typeof p_nItemIndex == "number") {
+
+        aGroup = this._getItemGroup(p_nGroupIndex);
+
+        if (aGroup) {
+
+            return aGroup[p_nItemIndex];
+        
+        }
+
+    }
+    
+},
+
+
+/**
+* @method getSubmenus
+* @description Returns an array of all of the submenus that are immediate 
+* children of the menu.
+* @return {Array}
+*/
+getSubmenus: function () {
+
+    var aItems = this.getItems(),
+        nItems = aItems.length,
+        aSubmenus,
+        oSubmenu,
+        oItem,
+        i;
+
+
+    if (nItems > 0) {
+        
+        aSubmenus = [];
+
+        for(i=0; i<nItems; i++) {
+
+            oItem = aItems[i];
+            
+            if (oItem) {
+
+                oSubmenu = oItem.cfg.getProperty("submenu");
+                
+                if (oSubmenu) {
+
+                    aSubmenus[aSubmenus.length] = oSubmenu;
+
+                }
+            
+            }
+        
+        }
+    
+    }
+
+    return aSubmenus;
+
+},
+
+/**
+* @method clearContent
+* @description Removes all of the content from the menu, including the menu 
+* items, group titles, header and footer.
+*/
+clearContent: function () {
+
+    var aItems = this.getItems(),
+        nItems = aItems.length,
+        oElement = this.element,
+        oBody = this.body,
+        oHeader = this.header,
+        oFooter = this.footer,
+        oItem,
+        oSubmenu,
+        i;
+
+
+    if (nItems > 0) {
+
+        i = nItems - 1;
+
+        do {
+
+            oItem = aItems[i];
+
+            if (oItem) {
+
+                oSubmenu = oItem.cfg.getProperty("submenu");
+
+                if (oSubmenu) {
+
+                    this.cfg.configChangedEvent.unsubscribe(
+                        this._onParentMenuConfigChange, oSubmenu);
+
+                    this.renderEvent.unsubscribe(this._onParentMenuRender, 
+                        oSubmenu);
+
+                }
+                
+                this.removeItem(oItem);
+
+            }
+        
+        }
+        while(i--);
+
+    }
+
+
+    if (oHeader) {
+
+        Event.purgeElement(oHeader);
+        oElement.removeChild(oHeader);
+
+    }
+    
+
+    if (oFooter) {
+
+        Event.purgeElement(oFooter);
+        oElement.removeChild(oFooter);
+    }
+
+
+    if (oBody) {
+
+        Event.purgeElement(oBody);
+
+        oBody.innerHTML = "";
+
+    }
+
+    this.activeItem = null;
+
+    this._aItemGroups = [];
+    this._aListElements = [];
+    this._aGroupTitleElements = [];
+
+    this.cfg.setProperty("width", null);
+
+},
+
+
+/**
+* @method destroy
+* @description Removes the menu's <code>&#60;div&#62;</code> element 
+* (and accompanying child nodes) from the document.
+*/
+destroy: function () {
+
+    Module.textResizeEvent.unsubscribe(this._onTextResize, this);
+
+    // Remove all items
+
+    this.clearContent();
+
+    this._aItemGroups = null;
+    this._aListElements = null;
+    this._aGroupTitleElements = null;
+
+
+    // Continue with the superclass implementation of this method
+
+    Menu.superclass.destroy.call(this);
+    
+
+},
+
+
+/**
+* @method setInitialFocus
+* @description Sets focus to the menu's first enabled item.
+*/
+setInitialFocus: function () {
+
+    var oItem = this._getFirstEnabledItem();
+    
+    if (oItem) {
+
+        oItem.focus();
+
+    }
+    
+},
+
+
+/**
+* @method setInitialSelection
+* @description Sets the "selected" configuration property of the menu's first 
+* enabled item to "true."
+*/
+setInitialSelection: function () {
+
+    var oItem = this._getFirstEnabledItem();
+    
+    if (oItem) {
+    
+        oItem.cfg.setProperty("selected", true);
+    }        
+
+},
+
+
+/**
+* @method clearActiveItem
+* @description Sets the "selected" configuration property of the menu's active
+* item to "false" and hides the item's submenu.
+* @param {Boolean} p_bBlur Boolean indicating if the menu's active item 
+* should be blurred.  
+*/
+clearActiveItem: function (p_bBlur) {
+
+    if (this.cfg.getProperty("showdelay") > 0) {
+    
+        this._cancelShowDelay();
+    
+    }
+
+
+    var oActiveItem = this.activeItem,
+        oConfig,
+        oSubmenu;
+
+    if (oActiveItem) {
+
+        oConfig = oActiveItem.cfg;
+
+        if (p_bBlur) {
+
+            oActiveItem.blur();
+        
+        }
+
+        oConfig.setProperty("selected", false);
+
+        oSubmenu = oConfig.getProperty("submenu");
+
+        if (oSubmenu) {
+
+            oSubmenu.hide();
+
+        }
+
+        this.activeItem = null;            
+
+    }
+
+},
+
+
+/**
+* @method focus
+* @description Causes the menu to receive focus and fires the "focus" event.
+*/
+focus: function () {
+
+    if (!this.hasFocus()) {
+
+        this.setInitialFocus();
+    
+    }
+
+},
+
+
+/**
+* @method blur
+* @description Causes the menu to lose focus and fires the "blur" event.
+*/    
+blur: function () {
+
+    var oItem;
+
+    if (this.hasFocus()) {
+    
+        oItem = MenuManager.getFocusedMenuItem();
+        
+        if (oItem) {
+
+            oItem.blur();
+
+        }
+
+    }
+
+},
+
+
+/**
+* @method hasFocus
+* @description Returns a boolean indicating whether or not the menu has focus.
+* @return {Boolean}
+*/
+hasFocus: function () {
+
+    return (MenuManager.getFocusedMenu() == this.getRoot());
+
+},
+
+
+/**
+* Adds the specified CustomEvent subscriber to the menu and each of 
+* its submenus.
+* @method subscribe
+* @param p_type     {string}   the type, or name of the event
+* @param p_fn       {function} the function to exectute when the event fires
+* @param p_obj      {Object}   An object to be passed along when the event 
+*                              fires
+* @param p_override {boolean}  If true, the obj passed in becomes the 
+*                              execution scope of the listener
+*/
+subscribe: function () {
+
+    function onItemAdded(p_sType, p_aArgs, p_oObject) {
+
+        var oItem = p_aArgs[0],
+            oSubmenu = oItem.cfg.getProperty("submenu");
+
+        if (oSubmenu) {
+
+            oSubmenu.subscribe.apply(oSubmenu, p_oObject);
+
+        }
+    
+    }
+
+
+    Menu.superclass.subscribe.apply(this, arguments);
+    Menu.superclass.subscribe.call(this, "itemAdded", onItemAdded, arguments);
+
+
+    var aSubmenus = this.getSubmenus(),
+        nSubmenus,
+        oSubmenu,
+        i;
+
+    if (aSubmenus) {
+
+        nSubmenus = aSubmenus.length;
+
+        if (nSubmenus > 0) {
+        
+            i = nSubmenus - 1;
+            
+            do {
+    
+                oSubmenu = aSubmenus[i];
+                
+                oSubmenu.subscribe.apply(oSubmenu, arguments);
+    
+            }
+            while(i--);
+        
+        }
+    
+    }
+
+},
+
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function () {
+
+    Menu.superclass.initDefaultConfig.call(this);
+
+    var oConfig = this.cfg;
+
+	// Add configuration attributes
+
+    /*
+        Change the default value for the "visible" configuration 
+        property to "false" by re-adding the property.
+    */
+
+    /**
+    * @config visible
+    * @description Boolean indicating whether or not the menu is visible.  If 
+    * the menu's "position" configuration property is set to "dynamic" (the 
+    * default), this property toggles the menu's <code>&#60;div&#62;</code> 
+    * element's "visibility" style property between "visible" (true) or 
+    * "hidden" (false).  If the menu's "position" configuration property is 
+    * set to "static" this property toggles the menu's 
+    * <code>&#60;div&#62;</code> element's "display" style property 
+    * between "block" (true) or "none" (false).
+    * @default false
+    * @type Boolean
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.VISIBLE.key, 
+        {
+            handler: this.configVisible, 
+            value: DEFAULT_CONFIG.VISIBLE.value, 
+            validator: DEFAULT_CONFIG.VISIBLE.validator
+         }
+     );
+
+
+    /*
+        Change the default value for the "constraintoviewport" configuration 
+        property to "true" by re-adding the property.
+    */
+
+    /**
+    * @config constraintoviewport
+    * @description Boolean indicating if the menu will try to remain inside 
+    * the boundaries of the size of viewport.
+    * @default true
+    * @type Boolean
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key, 
+        {
+            handler: this.configConstrainToViewport, 
+            value: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value, 
+            validator: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator, 
+            supercedes: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes 
+        } 
+    );
+
+
+    /**
+    * @config position
+    * @description String indicating how a menu should be positioned on the 
+    * screen.  Possible values are "static" and "dynamic."  Static menus are 
+    * visible by default and reside in the normal flow of the document 
+    * (CSS position: static).  Dynamic menus are hidden by default, reside 
+    * out of the normal flow of the document (CSS position: absolute), and 
+    * can overlay other elements on the screen.
+    * @default dynamic
+    * @type String
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.POSITION.key, 
+        {
+            handler: this.configPosition,
+            value: DEFAULT_CONFIG.POSITION.value, 
+            validator: DEFAULT_CONFIG.POSITION.validator,
+            supercedes: DEFAULT_CONFIG.POSITION.supercedes
+        }
+    );
+
+
+    /**
+    * @config submenualignment
+    * @description Array defining how submenus should be aligned to their 
+    * parent menu item. The format is: [itemCorner, submenuCorner]. By default
+    * a submenu's top left corner is aligned to its parent menu item's top 
+    * right corner.
+    * @default ["tl","tr"]
+    * @type Array
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.SUBMENU_ALIGNMENT.key, 
+        { 
+            value: DEFAULT_CONFIG.SUBMENU_ALIGNMENT.value 
+        }
+    );
+
+
+    /**
+    * @config autosubmenudisplay
+    * @description Boolean indicating if submenus are automatically made 
+    * visible when the user mouses over the menu's items.
+    * @default true
+    * @type Boolean
+    */
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.key, 
+	   { 
+	       value: DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.value, 
+	       validator: DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.validator
+       } 
+    );
+
+
+    /**
+    * @config showdelay
+    * @description Number indicating the time (in milliseconds) that should 
+    * expire before a submenu is made visible when the user mouses over 
+    * the menu's items.
+    * @default 250
+    * @type Number
+    */
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.SHOW_DELAY.key, 
+	   { 
+	       value: DEFAULT_CONFIG.SHOW_DELAY.value, 
+	       validator: DEFAULT_CONFIG.SHOW_DELAY.validator
+       } 
+    );
+
+
+    /**
+    * @config hidedelay
+    * @description Number indicating the time (in milliseconds) that should 
+    * expire before the menu is hidden.
+    * @default 0
+    * @type Number
+    */
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.HIDE_DELAY.key, 
+	   { 
+	       handler: this.configHideDelay,
+	       value: DEFAULT_CONFIG.HIDE_DELAY.value, 
+	       validator: DEFAULT_CONFIG.HIDE_DELAY.validator, 
+	       suppressEvent: DEFAULT_CONFIG.HIDE_DELAY.suppressEvent
+       } 
+    );
+
+
+    /**
+    * @config submenuhidedelay
+    * @description Number indicating the time (in milliseconds) that should 
+    * expire before a submenu is hidden when the user mouses out of a menu item 
+    * heading in the direction of a submenu.  The value must be greater than or 
+    * equal to the value specified for the "showdelay" configuration property.
+    * @default 250
+    * @type Number
+    */
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.key, 
+	   { 
+	       value: DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.value, 
+	       validator: DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.validator
+       } 
+    );
+
+
+    /**
+    * @config clicktohide
+    * @description Boolean indicating if the menu will automatically be 
+    * hidden if the user clicks outside of it.
+    * @default true
+    * @type Boolean
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.CLICK_TO_HIDE.key,
+        {
+            value: DEFAULT_CONFIG.CLICK_TO_HIDE.value,
+            validator: DEFAULT_CONFIG.CLICK_TO_HIDE.validator
+        }
+    );
+
+
+	/**
+	* @config container
+	* @description HTML element reference or string specifying the id 
+	* attribute of the HTML element that the menu's markup should be 
+	* rendered into.
+	* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+	* level-one-html.html#ID-58190037">HTMLElement</a>|String
+	* @default document.body
+	*/
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.CONTAINER.key, 
+	   { 
+	       handler: this.configContainer,
+	       value: document.body
+       } 
+   );
+
+
+    /**
+    * @config maxheight
+    * @description Defines the maximum height (in pixels) for a menu before the
+    * contents of the body are scrolled.
+    * @default 0
+    * @type Number
+    */
+    oConfig.addProperty(
+       DEFAULT_CONFIG.MAX_HEIGHT.key, 
+       {
+            handler: this.configMaxHeight,
+            value: DEFAULT_CONFIG.MAX_HEIGHT.value,
+            validator: DEFAULT_CONFIG.MAX_HEIGHT.validator
+       } 
+    );
+
+
+    /**
+    * @config classname
+    * @description CSS class to be applied to the menu's root 
+    * <code>&#60;div&#62;</code> element.  The specified class(es) are 
+    * appended in addition to the default class as specified by the menu's
+    * CSS_CLASS_NAME constant.
+    * @default null
+    * @type String
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.CLASS_NAME.key, 
+        { 
+            handler: this.configClassName,
+            value: DEFAULT_CONFIG.CLASS_NAME.value, 
+            validator: DEFAULT_CONFIG.CLASS_NAME.validator
+        }
+    );
+
+
+    /**
+    * @config disabled
+    * @description Boolean indicating if the menu should be disabled.  
+    * Disabling a menu disables each of its items.  (Disabled menu items are 
+    * dimmed and will not respond to user input or fire events.)  Disabled
+    * menus have a corresponding "disabled" CSS class applied to their root
+    * <code>&#60;div&#62;</code> element.
+    * @default false
+    * @type Boolean
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.DISABLED.key, 
+        { 
+            handler: this.configDisabled,
+            value: DEFAULT_CONFIG.DISABLED.value, 
+            validator: DEFAULT_CONFIG.DISABLED.validator,
+            suppressEvent: DEFAULT_CONFIG.DISABLED.suppressEvent
+        }
+    );
+
+}
+
+}); // END YAHOO.lang.extend
+
+})();
+
+
+
+(function() {
+
+
+/**
+* Creates an item for a menu.
+* 
+* @param {String} p_oObject String specifying the text of the menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying 
+* the <code>&#60;li&#62;</code> element of the menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+* specifying the <code>&#60;optgroup&#62;</code> element of the menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object 
+* specifying the <code>&#60;option&#62;</code> element of the menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu item. See configuration class documentation 
+* for more details.
+* @class MenuItem
+* @constructor
+*/
+YAHOO.widget.MenuItem = function(p_oObject, p_oConfig) {
+
+    if(p_oObject) {
+
+        if(p_oConfig) {
+    
+            this.parent = p_oConfig.parent;
+            this.value = p_oConfig.value;
+            this.id = p_oConfig.id;
+
+        }
+
+        this.init(p_oObject, p_oConfig);
+
+    }
+
+};
+
+var Dom = YAHOO.util.Dom,
+    Module = YAHOO.widget.Module,
+    Menu = YAHOO.widget.Menu,
+    MenuItem = YAHOO.widget.MenuItem,
+    CustomEvent = YAHOO.util.CustomEvent,
+    Lang = YAHOO.lang,
+
+    m_oMenuItemTemplate,
+
+    /**
+    * Constant representing the name of the MenuItem's events
+    * @property EVENT_TYPES
+    * @private
+    * @final
+    * @type Object
+    */
+    EVENT_TYPES = {
+    
+        "MOUSE_OVER": "mouseover",
+        "MOUSE_OUT": "mouseout",
+        "MOUSE_DOWN": "mousedown",
+        "MOUSE_UP": "mouseup",
+        "CLICK": "click",
+        "KEY_PRESS": "keypress",
+        "KEY_DOWN": "keydown",
+        "KEY_UP": "keyup",
+        "ITEM_ADDED": "itemAdded",
+        "ITEM_REMOVED": "itemRemoved",
+        "FOCUS": "focus",
+        "BLUR": "blur",
+        "DESTROY": "destroy"
+    
+    },
+
+    /**
+    * Constant representing the MenuItem's configuration properties
+    * @property DEFAULT_CONFIG
+    * @private
+    * @final
+    * @type Object
+    */
+    DEFAULT_CONFIG = {
+    
+        "TEXT": { 
+            key: "text", 
+            value: "", 
+            validator: Lang.isString, 
+            suppressEvent: true 
+        }, 
+    
+        "HELP_TEXT": { 
+            key: "helptext",
+            supercedes: ["text"]
+        },
+    
+        "URL": { 
+            key: "url", 
+            value: "#", 
+            suppressEvent: true 
+        }, 
+    
+        "TARGET": { 
+            key: "target", 
+            suppressEvent: true 
+        }, 
+    
+        "EMPHASIS": { 
+            key: "emphasis", 
+            value: false, 
+            validator: Lang.isBoolean, 
+            suppressEvent: true, 
+            supercedes: ["text"]
+        }, 
+    
+        "STRONG_EMPHASIS": { 
+            key: "strongemphasis", 
+            value: false, 
+            validator: Lang.isBoolean, 
+            suppressEvent: true,
+            supercedes: ["text"]
+        },
+    
+        "CHECKED": { 
+            key: "checked", 
+            value: false, 
+            validator: Lang.isBoolean, 
+            suppressEvent: true, 
+            supercedes: ["text"]
+        }, 
+    
+        "DISABLED": { 
+            key: "disabled", 
+            value: false, 
+            validator: Lang.isBoolean, 
+            suppressEvent: true,
+            supercedes: ["text"]
+        },
+    
+        "SELECTED": { 
+            key: "selected", 
+            value: false, 
+            validator: Lang.isBoolean, 
+            suppressEvent: true
+        },
+    
+        "SUBMENU": { 
+            key: "submenu",
+            supercedes: ["text"]
+        },
+    
+        "ONCLICK": { 
+            key: "onclick"
+        },
+    
+        "CLASS_NAME": { 
+            key: "classname", 
+            value: null, 
+            validator: Lang.isString
+        }
+    
+    };
+
+
+MenuItem.prototype = {
+
+    // Constants
+
+    /**
+    * @property COLLAPSED_SUBMENU_INDICATOR_TEXT
+    * @description String representing the text for the <code>&#60;em&#62;</code>
+    * element used for the submenu arrow indicator.
+    * @default "Submenu collapsed.  Click to expand submenu."
+    * @final
+    * @type String
+    */
+    COLLAPSED_SUBMENU_INDICATOR_TEXT: 
+        "Submenu collapsed.  Click to expand submenu.",
+
+
+    /**
+    * @property EXPANDED_SUBMENU_INDICATOR_TEXT
+    * @description String representing the text for the submenu arrow indicator 
+    * element (<code>&#60;em&#62;</code>) when the submenu is visible.
+    * @default "Submenu expanded.  Click to collapse submenu."
+    * @final
+    * @type String
+    */
+    EXPANDED_SUBMENU_INDICATOR_TEXT: 
+        "Submenu expanded.  Click to collapse submenu.",
+
+
+    /**
+    * @property DISABLED_SUBMENU_INDICATOR_TEXT
+    * @description String representing the text for the submenu arrow indicator 
+    * element (<code>&#60;em&#62;</code>) when the menu item is disabled.
+    * @default "Submenu collapsed.  (Item disabled.)."
+    * @final
+    * @type String
+    */
+    DISABLED_SUBMENU_INDICATOR_TEXT: "Submenu collapsed.  (Item disabled.)",
+
+
+    /**
+    * @property CHECKED_TEXT
+    * @description String representing the text to be used for the checked 
+    * indicator element (<code>&#60;em&#62;</code>).
+    * @default "Checked."
+    * @final
+    * @type String
+    */
+    CHECKED_TEXT: "Menu item checked.",
+    
+    
+    /**
+    * @property DISABLED_CHECKED_TEXT
+    * @description String representing the text to be used for the checked 
+    * indicator element (<code>&#60;em&#62;</code>) when the menu item 
+    * is disabled.
+    * @default "Checked. (Item disabled.)"
+    * @final
+    * @type String
+    */
+    DISABLED_CHECKED_TEXT: "Checked. (Item disabled.)",
+
+
+    /**
+    * @property CSS_CLASS_NAME
+    * @description String representing the CSS class(es) to be applied to the 
+    * <code>&#60;li&#62;</code> element of the menu item.
+    * @default "yuimenuitem"
+    * @final
+    * @type String
+    */
+    CSS_CLASS_NAME: "yuimenuitem",
+
+
+    /**
+    * @property CSS_LABEL_CLASS_NAME
+    * @description String representing the CSS class(es) to be applied to the 
+    * menu item's <code>&#60;a&#62;</code> element.
+    * @default "yuimenuitemlabel"
+    * @final
+    * @type String
+    */
+    CSS_LABEL_CLASS_NAME: "yuimenuitemlabel",
+
+
+    /**
+    * @property SUBMENU_TYPE
+    * @description Object representing the type of menu to instantiate and 
+    * add when parsing the child nodes of the menu item's source HTML element.
+    * @final
+    * @type YAHOO.widget.Menu
+    */
+    SUBMENU_TYPE: null,
+
+
+
+    // Private member variables
+    
+
+    /**
+    * @property _oAnchor
+    * @description Object reference to the menu item's 
+    * <code>&#60;a&#62;</code> element.
+    * @default null 
+    * @private
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-48250443">HTMLAnchorElement</a>
+    */
+    _oAnchor: null,
+    
+    
+    /**
+    * @property _oHelpTextEM
+    * @description Object reference to the menu item's help text 
+    * <code>&#60;em&#62;</code> element.
+    * @default null
+    * @private
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-58190037">HTMLElement</a>
+    */
+    _oHelpTextEM: null,
+    
+    
+    /**
+    * @property _oSubmenu
+    * @description Object reference to the menu item's submenu.
+    * @default null
+    * @private
+    * @type YAHOO.widget.Menu
+    */
+    _oSubmenu: null,
+    
+
+    /**
+    * @property _oCheckedIndicator
+    * @description Object reference to the menu item's checkmark image.
+    * @default <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-58190037">HTMLElement</a>
+    * @private
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-58190037">HTMLElement</a>
+    */
+    _oCheckedIndicator: null,
+
+
+    /** 
+    * @property _oOnclickAttributeValue
+    * @description Object reference to the menu item's current value for the 
+    * "onclick" configuration attribute.
+    * @default null
+    * @private
+    * @type Object
+    */
+    _oOnclickAttributeValue: null,
+
+
+    /**
+    * @property _sClassName
+    * @description The current value of the "classname" configuration attribute.
+    * @default null
+    * @private
+    * @type String
+    */
+    _sClassName: null,
+
+
+
+    // Public properties
+
+
+	/**
+    * @property constructor
+	* @description Object reference to the menu item's constructor function.
+    * @default YAHOO.widget.MenuItem
+	* @type YAHOO.widget.MenuItem
+	*/
+	constructor: MenuItem,
+
+
+    /**
+    * @property index
+    * @description Number indicating the ordinal position of the menu item in 
+    * its group.
+    * @default null
+    * @type Number
+    */
+    index: null,
+
+
+    /**
+    * @property groupIndex
+    * @description Number indicating the index of the group to which the menu 
+    * item belongs.
+    * @default null
+    * @type Number
+    */
+    groupIndex: null,
+
+
+    /**
+    * @property parent
+    * @description Object reference to the menu item's parent menu.
+    * @default null
+    * @type YAHOO.widget.Menu
+    */
+    parent: null,
+
+
+    /**
+    * @property element
+    * @description Object reference to the menu item's 
+    * <code>&#60;li&#62;</code> element.
+    * @default <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level
+    * -one-html.html#ID-74680021">HTMLLIElement</a>
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-74680021">HTMLLIElement</a>
+    */
+    element: null,
+
+
+    /**
+    * @property srcElement
+    * @description Object reference to the HTML element (either 
+    * <code>&#60;li&#62;</code>, <code>&#60;optgroup&#62;</code> or 
+    * <code>&#60;option&#62;</code>) used create the menu item.
+    * @default <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-74680021">HTMLLIElement</a>|<a href="http://www.
+    * w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-38450247"
+    * >HTMLOptGroupElement</a>|<a href="http://www.w3.org/TR/2000/WD-DOM-
+    * Level-1-20000929/level-one-html.html#ID-70901257">HTMLOptionElement</a>
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-74680021">HTMLLIElement</a>|<a href="http://www.w3.
+    * org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-38450247">
+    * HTMLOptGroupElement</a>|<a href="http://www.w3.org/TR/2000/WD-DOM-
+    * Level-1-20000929/level-one-html.html#ID-70901257">HTMLOptionElement</a>
+    */
+    srcElement: null,
+
+
+    /**
+    * @property value
+    * @description Object reference to the menu item's value.
+    * @default null
+    * @type Object
+    */
+    value: null,
+
+
+    /**
+    * @property submenuIndicator
+    * @description Object reference to the <code>&#60;em&#62;</code> element 
+    * used to create the submenu indicator for the menu item.
+    * @default <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-58190037">HTMLElement</a>
+    * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-58190037">HTMLElement</a>
+    */
+    submenuIndicator: null,
+
+
+	/**
+    * @property browser
+    * @deprecated Use YAHOO.env.ua
+	* @description String representing the browser.
+	* @type String
+	*/
+	browser: Module.prototype.browser,
+
+
+    /**
+    * @property id
+    * @description Id of the menu item's root <code>&#60;li&#62;</code> 
+    * element.  This property should be set via the constructor using the 
+    * configuration object literal.  If an id is not specified, then one will 
+    * be created using the "generateId" method of the Dom utility.
+    * @default null
+    * @type String
+    */
+    id: null,
+
+
+
+    // Events
+
+
+    /**
+    * @event destroyEvent
+    * @description Fires when the menu item's <code>&#60;li&#62;</code> 
+    * element is removed from its parent <code>&#60;ul&#62;</code> element.
+    * @type YAHOO.util.CustomEvent
+    */
+    destroyEvent: null,
+
+
+    /**
+    * @event mouseOverEvent
+    * @description Fires when the mouse has entered the menu item.  Passes 
+    * back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    mouseOverEvent: null,
+
+
+    /**
+    * @event mouseOutEvent
+    * @description Fires when the mouse has left the menu item.  Passes back 
+    * the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    mouseOutEvent: null,
+
+
+    /**
+    * @event mouseDownEvent
+    * @description Fires when the user mouses down on the menu item.  Passes 
+    * back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    mouseDownEvent: null,
+
+
+    /**
+    * @event mouseUpEvent
+    * @description Fires when the user releases a mouse button while the mouse 
+    * is over the menu item.  Passes back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    mouseUpEvent: null,
+
+
+    /**
+    * @event clickEvent
+    * @description Fires when the user clicks the on the menu item.  Passes 
+    * back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    clickEvent: null,
+
+
+    /**
+    * @event keyPressEvent
+    * @description Fires when the user presses an alphanumeric key when the 
+    * menu item has focus.  Passes back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    keyPressEvent: null,
+
+
+    /**
+    * @event keyDownEvent
+    * @description Fires when the user presses a key when the menu item has 
+    * focus.  Passes back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    keyDownEvent: null,
+
+
+    /**
+    * @event keyUpEvent
+    * @description Fires when the user releases a key when the menu item has 
+    * focus.  Passes back the DOM Event object as an argument.
+    * @type YAHOO.util.CustomEvent
+    */
+    keyUpEvent: null,
+
+
+    /**
+    * @event focusEvent
+    * @description Fires when the menu item receives focus.
+    * @type YAHOO.util.CustomEvent
+    */
+    focusEvent: null,
+
+
+    /**
+    * @event blurEvent
+    * @description Fires when the menu item loses the input focus.
+    * @type YAHOO.util.CustomEvent
+    */
+    blurEvent: null,
+
+
+    /**
+    * @method init
+    * @description The MenuItem class's initialization method. 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.
+    * @param {String} p_oObject String specifying the text of the menu item.
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying 
+    * the <code>&#60;li&#62;</code> element of the menu item.
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+    * specifying the <code>&#60;optgroup&#62;</code> element of the menu item.
+    * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+    * one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object 
+    * specifying the <code>&#60;option&#62;</code> element of the menu item.
+    * @param {Object} p_oConfig Optional. Object literal specifying the 
+    * configuration for the menu item. See configuration class documentation 
+    * for more details.
+    */
+    init: function(p_oObject, p_oConfig) {
+
+
+        if(!this.SUBMENU_TYPE) {
+    
+            this.SUBMENU_TYPE = Menu;
+    
+        }
+
+
+        // Create the config object
+
+        this.cfg = new YAHOO.util.Config(this);
+
+        this.initDefaultConfig();
+
+        var SIGNATURE = CustomEvent.LIST,
+            oConfig = this.cfg,
+            sURL = "#",
+            oAnchor,
+            sTarget,
+            sText,
+            sId;
+
+
+        if(Lang.isString(p_oObject)) {
+
+            this._createRootNodeStructure();
+
+            oConfig.queueProperty("text", p_oObject);
+
+        }
+        else if(p_oObject && p_oObject.tagName) {
+
+            switch(p_oObject.tagName.toUpperCase()) {
+
+                case "OPTION":
+
+                    this._createRootNodeStructure();
+
+                    oConfig.queueProperty("text", p_oObject.text);
+                    
+                    this.value = p_oObject.value;
+
+                    this.srcElement = p_oObject;
+
+                break;
+
+                case "OPTGROUP":
+
+                    this._createRootNodeStructure();
+
+                    oConfig.queueProperty("text", p_oObject.label);
+
+                    this.srcElement = p_oObject;
+
+                    this._initSubTree();
+
+                break;
+
+                case "LI":
+
+                    // Get the anchor node (if it exists)
+                    
+                    oAnchor = Dom.getFirstChild(p_oObject);
+
+
+                    // Capture the "text" and/or the "URL"
+
+                    if(oAnchor) {
+
+                        sURL = oAnchor.getAttribute("href");
+
+                        if (YAHOO.env.ua.ie) {
+            
+                            sURL = sURL.substring(
+                                document.location.href.length, sURL.length);
+            
+                        }
+
+                        sTarget = oAnchor.getAttribute("target");
+                        sText = oAnchor.innerHTML;
+
+                    }
+
+                    this.srcElement = p_oObject;
+                    this.element = p_oObject;
+                    this._oAnchor = oAnchor;
+
+                    /*
+                        Set these properties silently to sync up the 
+                        configuration object without making changes to the 
+                        element's DOM
+                    */ 
+
+                    oConfig.setProperty("text", sText, true);
+                    oConfig.setProperty("url", sURL, true);
+                    oConfig.setProperty("target", sTarget, true);
+
+                    this._initSubTree();
+
+                break;
+
+            }            
+
+        }
+
+
+        if(this.element) {
+
+            sId = this.element.id;
+
+            if(!sId) {
+
+                sId = this.id || Dom.generateId();
+
+                this.element.id = sId;
+
+            }
+
+            this.id = sId;
+
+
+            Dom.addClass(this.element, this.CSS_CLASS_NAME);
+            Dom.addClass(this._oAnchor, this.CSS_LABEL_CLASS_NAME);
+
+
+            // Create custom events
+
+            this.mouseOverEvent = this.createEvent(EVENT_TYPES.MOUSE_OVER);
+            this.mouseOverEvent.signature = SIGNATURE;
+
+            this.mouseOutEvent = this.createEvent(EVENT_TYPES.MOUSE_OUT);
+            this.mouseOutEvent.signature = SIGNATURE;
+
+            this.mouseDownEvent = this.createEvent(EVENT_TYPES.MOUSE_DOWN);
+            this.mouseDownEvent.signature = SIGNATURE;
+
+            this.mouseUpEvent = this.createEvent(EVENT_TYPES.MOUSE_UP);
+            this.mouseUpEvent.signature = SIGNATURE;
+
+            this.clickEvent = this.createEvent(EVENT_TYPES.CLICK);
+            this.clickEvent.signature = SIGNATURE;
+
+            this.keyPressEvent = this.createEvent(EVENT_TYPES.KEY_PRESS);
+            this.keyPressEvent.signature = SIGNATURE;
+
+            this.keyDownEvent = this.createEvent(EVENT_TYPES.KEY_DOWN);
+            this.keyDownEvent.signature = SIGNATURE;
+
+            this.keyUpEvent = this.createEvent(EVENT_TYPES.KEY_UP);
+            this.keyUpEvent.signature = SIGNATURE;
+
+            this.focusEvent = this.createEvent(EVENT_TYPES.FOCUS);
+            this.focusEvent.signature = SIGNATURE;
+
+            this.blurEvent = this.createEvent(EVENT_TYPES.BLUR);
+            this.blurEvent.signature = SIGNATURE;
+
+            this.destroyEvent = this.createEvent(EVENT_TYPES.DESTROY);
+            this.destroyEvent.signature = SIGNATURE;
+
+            if(p_oConfig) {
+    
+                oConfig.applyConfig(p_oConfig);
+    
+            }        
+
+            oConfig.fireQueue();
+
+        }
+
+    },
+
+
+
+    // Private methods
+
+
+    /**
+    * @method _createRootNodeStructure
+    * @description Creates the core DOM structure for the menu item.
+    * @private
+    */
+    _createRootNodeStructure: function () {
+
+        var oElement,
+            oAnchor;
+
+        if(!m_oMenuItemTemplate) {
+
+            m_oMenuItemTemplate = document.createElement("li");
+            m_oMenuItemTemplate.innerHTML = "<a href=\"#\"></a>";
+
+        }
+
+        oElement = m_oMenuItemTemplate.cloneNode(true);
+        oElement.className = this.CSS_CLASS_NAME;
+
+        oAnchor = oElement.firstChild;
+        oAnchor.className = this.CSS_LABEL_CLASS_NAME;
+        
+        this.element = oElement;
+        this._oAnchor = oAnchor;
+
+    },
+
+
+    /**
+    * @method _initSubTree
+    * @description Iterates the source element's childNodes collection and uses 
+    * the child nodes to instantiate other menus.
+    * @private
+    */
+    _initSubTree: function() {
+
+        var oSrcEl = this.srcElement,
+            oConfig = this.cfg,
+            oNode,
+            aOptions,
+            nOptions,
+            oMenu,
+            n;
+
+
+        if(oSrcEl.childNodes.length > 0) {
+
+            if(this.parent.lazyLoad && this.parent.srcElement && 
+                this.parent.srcElement.tagName.toUpperCase() == "SELECT") {
+
+                oConfig.setProperty(
+                        "submenu", 
+                        { id: Dom.generateId(), itemdata: oSrcEl.childNodes }
+                    );
+
+            }
+            else {
+
+                oNode = oSrcEl.firstChild;
+                aOptions = [];
+    
+                do {
+    
+                    if(oNode && oNode.tagName) {
+    
+                        switch(oNode.tagName.toUpperCase()) {
+                
+                            case "DIV":
+                
+                                oConfig.setProperty("submenu", oNode);
+                
+                            break;
+         
+                            case "OPTION":
+        
+                                aOptions[aOptions.length] = oNode;
+        
+                            break;
+               
+                        }
+                    
+                    }
+                
+                }        
+                while((oNode = oNode.nextSibling));
+    
+    
+                nOptions = aOptions.length;
+    
+                if(nOptions > 0) {
+    
+                    oMenu = new this.SUBMENU_TYPE(Dom.generateId());
+                    
+                    oConfig.setProperty("submenu", oMenu);
+    
+                    for(n=0; n<nOptions; n++) {
+        
+                        oMenu.addItem((new oMenu.ITEM_TYPE(aOptions[n])));
+        
+                    }
+        
+                }
+            
+            }
+
+        }
+
+    },
+
+
+
+    // Event handlers for configuration properties
+
+
+    /**
+    * @method configText
+    * @description Event handler for when the "text" configuration property of 
+    * the menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */
+    configText: function(p_sType, p_aArgs, p_oItem) {
+
+        var sText = p_aArgs[0],
+            oConfig = this.cfg,
+            oAnchor = this._oAnchor,
+            sHelpText = oConfig.getProperty("helptext"),
+            sHelpTextHTML = "",
+            sCheckHTML = "",
+            oSubmenu = oConfig.getProperty("submenu"),
+            sSubmenuIndicatorHTML = "",
+            sEmphasisStartTag = "",
+            sEmphasisEndTag = "";
+
+
+        if (sText) {
+
+
+            if (sHelpText) {
+                    
+                sHelpTextHTML = "<em class=\"helptext\">" + sHelpText + "</em>";
+            
+            }
+
+
+            if (oConfig.getProperty("checked")) {
+
+                sCheckHTML = "<em class=\"checkedindicator\">" + 
+                    this.CHECKED_TEXT + "</em>";
+            
+            }
+            
+            
+            if (oSubmenu) {
+
+                sSubmenuIndicatorHTML =  "<em class=\"submenuindicator\">" + 
+                    ((oSubmenu instanceof Menu && 
+                    oSubmenu.cfg.getProperty("visible")) ? 
+                    this.EXPANDED_SUBMENU_INDICATOR_TEXT : 
+                    this.COLLAPSED_SUBMENU_INDICATOR_TEXT) + "</em>";
+            
+            }
+            
+
+            if (oConfig.getProperty("emphasis")) {
+
+                sEmphasisStartTag = "<em>";
+                sEmphasisEndTag = "</em>";
+
+            }
+
+
+            if (oConfig.getProperty("strongemphasis")) {
+
+                sEmphasisStartTag = "<strong>";
+                sEmphasisEndTag = "</strong>";
+            
+            }
+
+
+            oAnchor.innerHTML = (sEmphasisStartTag + sText + 
+                sEmphasisEndTag + sHelpTextHTML + 
+                sCheckHTML + sSubmenuIndicatorHTML);
+
+
+            if (oSubmenu) {
+
+                this.submenuIndicator = oAnchor.lastChild;
+            
+            }
+
+        }
+
+    },
+
+
+    /**
+    * @method configHelpText
+    * @description Event handler for when the "helptext" configuration property 
+    * of the menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configHelpText: function(p_sType, p_aArgs, p_oItem) {
+
+        var sHelpText = p_aArgs[0],
+            oAnchor = this._oAnchor;
+
+        if (sHelpText) {
+
+            Dom.addClass(oAnchor, "hashelptext");
+
+        }
+        else {
+
+            Dom.removeClass(oAnchor, "hashelptext");
+        
+        }
+
+        this.cfg.refireEvent("text");
+
+    },
+
+
+    /**
+    * @method configURL
+    * @description Event handler for when the "url" configuration property of 
+    * the menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configURL: function(p_sType, p_aArgs, p_oItem) {
+
+        var sURL = p_aArgs[0];
+
+        if(!sURL) {
+
+            sURL = "#";
+
+        }
+
+        var oAnchor = this._oAnchor;
+
+        if (YAHOO.env.ua.opera) {
+
+            oAnchor.removeAttribute("href");
+        
+        }
+
+        oAnchor.setAttribute("href", sURL);
+
+    },
+
+
+    /**
+    * @method configTarget
+    * @description Event handler for when the "target" configuration property 
+    * of the menu item changes.  
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configTarget: function(p_sType, p_aArgs, p_oItem) {
+
+        var sTarget = p_aArgs[0],
+            oAnchor = this._oAnchor;
+
+        if(sTarget && sTarget.length > 0) {
+
+            oAnchor.setAttribute("target", sTarget);
+
+        }
+        else {
+
+            oAnchor.removeAttribute("target");
+        
+        }
+
+    },
+
+
+    /**
+    * @method configEmphasis
+    * @description Event handler for when the "emphasis" configuration property
+    * of the menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+        var bEmphasis = p_aArgs[0],
+            oConfig = this.cfg;
+
+
+        if(bEmphasis && oConfig.getProperty("strongemphasis")) {
+
+            oConfig.setProperty("strongemphasis", false);
+
+        }
+
+
+        oConfig.refireEvent("text");
+
+    },
+
+
+    /**
+    * @method configStrongEmphasis
+    * @description Event handler for when the "strongemphasis" configuration 
+    * property of the menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configStrongEmphasis: function(p_sType, p_aArgs, p_oItem) {
+
+        var bStrongEmphasis = p_aArgs[0],
+            oConfig = this.cfg;
+
+
+        if(bStrongEmphasis && oConfig.getProperty("emphasis")) {
+
+            oConfig.setProperty("emphasis", false);
+
+        }
+
+        oConfig.refireEvent("text");
+
+    },
+
+
+    /**
+    * @method configChecked
+    * @description Event handler for when the "checked" configuration property 
+    * of the menu item changes. 
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configChecked: function(p_sType, p_aArgs, p_oItem) {
+
+        var bChecked = p_aArgs[0],
+            oAnchor = this._oAnchor;
+
+        if (bChecked) {
+
+            Dom.addClass(oAnchor, "checked");
+
+        }
+        else {
+
+            Dom.removeClass(oAnchor, "checked");
+        
+        }
+
+        this.cfg.refireEvent("text");
+
+    },
+
+
+
+    /**
+    * @method configDisabled
+    * @description Event handler for when the "disabled" configuration property 
+    * of the menu item changes. 
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configDisabled: function(p_sType, p_aArgs, p_oItem) {
+
+        var bDisabled = p_aArgs[0],
+            oConfig = this.cfg,
+            oAnchor = this._oAnchor;
+
+
+        if(bDisabled) {
+
+            if(oConfig.getProperty("selected")) {
+
+                oConfig.setProperty("selected", false);
+
+            }
+
+            oAnchor.removeAttribute("href");
+
+            Dom.addClass(oAnchor, "disabled");
+
+        }
+        else {
+
+            oAnchor.setAttribute("href", oConfig.getProperty("url"));
+
+            Dom.removeClass(oAnchor, "disabled");
+
+        }
+
+    },
+
+
+    /**
+    * @method configSelected
+    * @description Event handler for when the "selected" configuration property 
+    * of the menu item changes. 
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */    
+    configSelected: function(p_sType, p_aArgs, p_oItem) {
+
+        var bSelected,
+            oAnchor;
+
+        if(!this.cfg.getProperty("disabled")) {
+
+            bSelected = p_aArgs[0];
+            oAnchor = this._oAnchor;
+
+            if (YAHOO.env.ua.opera) {
+
+                oAnchor.blur();
+            
+            }
+
+            if(bSelected) {
+    
+                Dom.addClass(oAnchor, "selected");
+    
+            }
+            else {
+    
+                Dom.removeClass(oAnchor, "selected");
+    
+            }
+
+            if (this.hasFocus() && YAHOO.env.ua.opera) {
+            
+                oAnchor.focus();
+            
+            }
+
+        }
+
+    },
+
+
+    /**
+    * @method _onSubmenuShow
+    * @description "show" event handler for a submenu.
+    * @private
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    */
+    _onSubmenuShow: function (p_sType, p_aArgs) {
+
+        var oTextNode = this.submenuIndicator.firstChild;
+        
+        if (oTextNode) {
+
+            oTextNode.nodeValue = this.EXPANDED_SUBMENU_INDICATOR_TEXT;
+
+        }
+
+    },
+
+
+    /**
+    * @method _onSubmenuBeforeHide
+    * @description "beforehide" Custom Event handler for a submenu.
+    * @private
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    */
+    _onSubmenuBeforeHide: function (p_sType, p_aArgs) {
+
+        var oItem = this.parent,
+            oMenu;
+
+        function onHide() {
+
+            oItem._oAnchor.blur();
+            oMenu.beforeHideEvent.unsubscribe(onHide);
+        
+        }
+    
+        if (oItem.hasFocus()) {
+
+            oMenu = oItem.parent;
+
+            oMenu.beforeHideEvent.subscribe(onHide);
+        
+        }
+    
+    },
+    
+
+    /**
+    * @method _onSubmenuHide
+    * @description "hide" Custom Event handler for a submenu.
+    * @private
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    */
+    _onSubmenuHide: function (p_sType, p_aArgs) {
+
+        var oTextNode = this.submenuIndicator.firstChild;
+        
+        if (oTextNode) {
+
+            oTextNode.nodeValue = this.COLLAPSED_SUBMENU_INDICATOR_TEXT;
+
+        }
+
+    },
+
+
+    /**
+    * @method configSubmenu
+    * @description Event handler for when the "submenu" configuration property 
+    * of the menu item changes. 
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */
+    configSubmenu: function(p_sType, p_aArgs, p_oItem) {
+
+        var oAnchor = this._oAnchor,
+            oSubmenu = p_aArgs[0],
+            oSubmenuIndicator = this.submenuIndicator,
+            oConfig = this.cfg,
+            bLazyLoad = this.parent && this.parent.lazyLoad,
+            oMenu,
+            sSubmenuId,
+            oSubmenuConfig;
+
+
+        if(oSubmenu) {
+
+            if(oSubmenu instanceof Menu) {
+
+                oMenu = oSubmenu;
+                oMenu.parent = this;
+                oMenu.lazyLoad = bLazyLoad;
+
+            }
+            else if(typeof oSubmenu == "object" && oSubmenu.id && 
+                !oSubmenu.nodeType) {
+
+                sSubmenuId = oSubmenu.id;
+                oSubmenuConfig = oSubmenu;
+
+                oSubmenuConfig.lazyload = bLazyLoad;
+                oSubmenuConfig.parent = this;
+
+                oMenu = new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig);
+
+
+                // Set the value of the property to the Menu instance
+
+                this.cfg.setProperty("submenu", oMenu, true);
+
+            }
+            else {
+
+                oMenu = new this.SUBMENU_TYPE(oSubmenu,
+                                { lazyload: bLazyLoad, parent: this });
+
+
+                // Set the value of the property to the Menu instance
+                
+                this.cfg.setProperty("submenu", oMenu, true);
+
+            }
+
+
+            if(oMenu) {
+
+                Dom.addClass(oAnchor, "hassubmenu");
+
+                this._oSubmenu = oMenu;
+                
+                oMenu.showEvent.subscribe(this._onSubmenuShow, null, this);
+                oMenu.hideEvent.subscribe(this._onSubmenuHide, null, this);
+            
+                if (YAHOO.env.ua.opera) {
+                
+                    oMenu.beforeHideEvent.subscribe(this._onSubmenuBeforeHide);               
+                
+                }
+            
+            }
+
+        }
+        else {
+
+            Dom.removeClass(oAnchor, "hassubmenu");
+
+            if(oSubmenuIndicator) {
+
+                oAnchor.removeChild(oSubmenuIndicator);
+
+            }
+
+            if(this._oSubmenu) {
+
+                this._oSubmenu.destroy();
+
+            }
+
+        }
+        
+        oConfig.refireEvent("text");
+
+    },
+
+
+    /**
+    * @method configOnClick
+    * @description Event handler for when the "onclick" configuration property 
+    * of the menu item changes. 
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */
+    configOnClick: function(p_sType, p_aArgs, p_oItem) {
+
+        var oObject = p_aArgs[0];
+
+        /*
+            Remove any existing listeners if a "click" event handler has 
+            already been specified.
+        */
+
+        if(this._oOnclickAttributeValue && 
+            (this._oOnclickAttributeValue != oObject)) {
+
+            this.clickEvent.unsubscribe(this._oOnclickAttributeValue.fn, 
+                                this._oOnclickAttributeValue.obj);
+
+            this._oOnclickAttributeValue = null;
+
+        }
+
+
+        if(!this._oOnclickAttributeValue && typeof oObject == "object" && 
+            typeof oObject.fn == "function") {
+            
+            this.clickEvent.subscribe(oObject.fn, 
+                ((!YAHOO.lang.isUndefined(oObject.obj)) ? oObject.obj : this), 
+                oObject.scope);
+
+            this._oOnclickAttributeValue = oObject;
+
+        }
+    
+    },
+
+
+    /**
+    * @method configClassName
+    * @description Event handler for when the "classname" configuration 
+    * property of a menu item changes.
+    * @param {String} p_sType String representing the name of the event that 
+    * was fired.
+    * @param {Array} p_aArgs Array of arguments sent when the event was fired.
+    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
+    * that fired the event.
+    */
+    configClassName: function(p_sType, p_aArgs, p_oItem) {
+    
+        var sClassName = p_aArgs[0];
+    
+        if(this._sClassName) {
+    
+            Dom.removeClass(this.element, this._sClassName);
+    
+        }
+    
+        Dom.addClass(this.element, sClassName);
+        this._sClassName = sClassName;
+    
+    },
+
+
+
+    // Public methods
+
+
+	/**
+    * @method initDefaultConfig
+	* @description Initializes an item's configurable properties.
+	*/
+	initDefaultConfig : function() {
+
+        var oConfig = this.cfg;
+
+
+        // Define the configuration attributes
+
+        /**
+        * @config text
+        * @description String specifying the text label for the menu item.  
+        * When building a menu from existing HTML the value of this property
+        * will be interpreted from the menu's markup.
+        * @default ""
+        * @type String
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.TEXT.key, 
+            { 
+                handler: this.configText, 
+                value: DEFAULT_CONFIG.TEXT.value, 
+                validator: DEFAULT_CONFIG.TEXT.validator, 
+                suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent 
+            }
+        );
+        
+
+        /**
+        * @config helptext
+        * @description String specifying additional instructional text to 
+        * accompany the text for the menu item.
+        * @deprecated Use "text" configuration property to add help text markup.  
+        * For example: <code>oMenuItem.cfg.setProperty("text", "Copy &#60;em 
+        * class=\"helptext\"&#62;Ctrl + C&#60;/em&#60;");</code>
+        * @default null
+        * @type String|<a href="http://www.w3.org/TR/
+        * 2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-58190037">
+        * HTMLElement</a>
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.HELP_TEXT.key,
+            { handler: this.configHelpText }
+        );
+
+
+        /**
+        * @config url
+        * @description String specifying the URL for the menu item's anchor's 
+        * "href" attribute.  When building a menu from existing HTML the value 
+        * of this property will be interpreted from the menu's markup.
+        * @default "#"
+        * @type String
+        */        
+        oConfig.addProperty(
+            DEFAULT_CONFIG.URL.key, 
+            {
+                handler: this.configURL, 
+                value: DEFAULT_CONFIG.URL.value, 
+                suppressEvent: DEFAULT_CONFIG.URL.suppressEvent
+            }
+        );
+
+
+        /**
+        * @config target
+        * @description String specifying the value for the "target" attribute 
+        * of the menu item's anchor element. <strong>Specifying a target will 
+        * require the user to click directly on the menu item's anchor node in
+        * order to cause the browser to navigate to the specified URL.</strong> 
+        * When building a menu from existing HTML the value of this property 
+        * will be interpreted from the menu's markup.
+        * @default null
+        * @type String
+        */        
+        oConfig.addProperty(
+            DEFAULT_CONFIG.TARGET.key, 
+            {
+                handler: this.configTarget, 
+                suppressEvent: DEFAULT_CONFIG.TARGET.suppressEvent
+            }
+        );
+
+
+        /**
+        * @config emphasis
+        * @description Boolean indicating if the text of the menu item will be 
+        * rendered with emphasis.
+        * @deprecated Use "text" configuration property to add emphasis.  
+        * For example: <code>oMenuItem.cfg.setProperty("text", "&#60;em&#62;Some 
+        * Text&#60;/em&#60;");</code>
+        * @default false
+        * @type Boolean
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.EMPHASIS.key, 
+            { 
+                handler: this.configEmphasis, 
+                value: DEFAULT_CONFIG.EMPHASIS.value, 
+                validator: DEFAULT_CONFIG.EMPHASIS.validator, 
+                suppressEvent: DEFAULT_CONFIG.EMPHASIS.suppressEvent 
+            }
+        );
+
+
+        /**
+        * @config strongemphasis
+        * @description Boolean indicating if the text of the menu item will be 
+        * rendered with strong emphasis.
+        * @deprecated Use "text" configuration property to add strong emphasis.  
+        * For example: <code>oMenuItem.cfg.setProperty("text", "&#60;strong&#62; 
+        * Some Text&#60;/strong&#60;");</code>
+        * @default false
+        * @type Boolean
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.STRONG_EMPHASIS.key,
+            {
+                handler: this.configStrongEmphasis,
+                value: DEFAULT_CONFIG.STRONG_EMPHASIS.value,
+                validator: DEFAULT_CONFIG.STRONG_EMPHASIS.validator,
+                suppressEvent: DEFAULT_CONFIG.STRONG_EMPHASIS.suppressEvent
+            }
+        );
+
+
+        /**
+        * @config checked
+        * @description Boolean indicating if the menu item should be rendered 
+        * with a checkmark.
+        * @default false
+        * @type Boolean
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.CHECKED.key, 
+            {
+                handler: this.configChecked, 
+                value: DEFAULT_CONFIG.CHECKED.value, 
+                validator: DEFAULT_CONFIG.CHECKED.validator, 
+                suppressEvent: DEFAULT_CONFIG.CHECKED.suppressEvent,
+                supercedes: DEFAULT_CONFIG.CHECKED.supercedes
+            } 
+        );
+
+
+        /**
+        * @config disabled
+        * @description Boolean indicating if the menu item should be disabled.  
+        * (Disabled menu items are  dimmed and will not respond to user input 
+        * or fire events.)
+        * @default false
+        * @type Boolean
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.DISABLED.key,
+            {
+                handler: this.configDisabled,
+                value: DEFAULT_CONFIG.DISABLED.value,
+                validator: DEFAULT_CONFIG.DISABLED.validator,
+                suppressEvent: DEFAULT_CONFIG.DISABLED.suppressEvent
+            }
+        );
+
+
+        /**
+        * @config selected
+        * @description Boolean indicating if the menu item should 
+        * be highlighted.
+        * @default false
+        * @type Boolean
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.SELECTED.key,
+            {
+                handler: this.configSelected,
+                value: DEFAULT_CONFIG.SELECTED.value,
+                validator: DEFAULT_CONFIG.SELECTED.validator,
+                suppressEvent: DEFAULT_CONFIG.SELECTED.suppressEvent
+            }
+        );
+
+
+        /**
+        * @config submenu
+        * @description Object specifying the submenu to be appended to the 
+        * menu item.  The value can be one of the following: <ul><li>Object 
+        * specifying a Menu instance.</li><li>Object literal specifying the
+        * menu to be created.  Format: <code>{ id: [menu id], itemdata: 
+        * [<a href="YAHOO.widget.Menu.html#itemData">array of values for 
+        * items</a>] }</code>.</li><li>String specifying the id attribute 
+        * of the <code>&#60;div&#62;</code> element of the menu.</li><li>
+        * Object specifying the <code>&#60;div&#62;</code> element of the 
+        * menu.</li></ul>
+        * @default null
+        * @type Menu|String|Object|<a href="http://www.w3.org/TR/2000/
+        * WD-DOM-Level-1-20000929/level-one-html.html#ID-58190037">
+        * HTMLElement</a>
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.SUBMENU.key, 
+            { handler: this.configSubmenu }
+        );
+
+
+        /**
+        * @config onclick
+        * @description Object literal representing the code to be executed when 
+        * the item is clicked.  Format:<br> <code> {<br> 
+        * <strong>fn:</strong> Function,   &#47;&#47; The handler to call when 
+        * the event fires.<br> <strong>obj:</strong> Object, &#47;&#47; An 
+        * object to  pass back to the handler.<br> <strong>scope:</strong> 
+        * Object &#47;&#47; The object to use for the scope of the handler.
+        * <br> } </code>
+        * @type Object
+        * @default null
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.ONCLICK.key, 
+            { handler: this.configOnClick }
+        );
+
+
+        /**
+        * @config classname
+        * @description CSS class to be applied to the menu item's root 
+        * <code>&#60;li&#62;</code> element.  The specified class(es) are 
+        * appended in addition to the default class as specified by the menu 
+        * item's CSS_CLASS_NAME constant.
+        * @default null
+        * @type String
+        */
+        oConfig.addProperty(
+            DEFAULT_CONFIG.CLASS_NAME.key, 
+            { 
+                handler: this.configClassName,
+                value: DEFAULT_CONFIG.CLASS_NAME.value, 
+                validator: DEFAULT_CONFIG.CLASS_NAME.validator
+            }
+        );
+
+	},
+
+
+    /**
+    * @method getNextEnabledSibling
+    * @description Finds the menu item's next enabled sibling.
+    * @return YAHOO.widget.MenuItem
+    */
+    getNextEnabledSibling: function() {
+
+        var nGroupIndex,
+            aItemGroups,
+            oNextItem,
+            nNextGroupIndex,
+            aNextGroup;
+
+        function getNextArrayItem(p_aArray, p_nStartIndex) {
+
+            return p_aArray[p_nStartIndex] || 
+                getNextArrayItem(p_aArray, (p_nStartIndex+1));
+
+        }
+
+        if(this.parent instanceof Menu) {
+
+            nGroupIndex = this.groupIndex;
+    
+            aItemGroups = this.parent.getItemGroups();
+    
+            if(this.index < (aItemGroups[nGroupIndex].length - 1)) {
+    
+                oNextItem = getNextArrayItem(aItemGroups[nGroupIndex], 
+                        (this.index+1));
+    
+            }
+            else {
+    
+                if(nGroupIndex < (aItemGroups.length - 1)) {
+    
+                    nNextGroupIndex = nGroupIndex + 1;
+    
+                }
+                else {
+    
+                    nNextGroupIndex = 0;
+    
+                }
+    
+                aNextGroup = getNextArrayItem(aItemGroups, nNextGroupIndex);
+    
+                // Retrieve the first menu item in the next group
+    
+                oNextItem = getNextArrayItem(aNextGroup, 0);
+    
+            }
+    
+            return (oNextItem.cfg.getProperty("disabled") || 
+                oNextItem.element.style.display == "none") ? 
+                oNextItem.getNextEnabledSibling() : oNextItem;
+
+        }
+
+    },
+
+
+    /**
+    * @method getPreviousEnabledSibling
+    * @description Finds the menu item's previous enabled sibling.
+    * @return {YAHOO.widget.MenuItem}
+    */
+    getPreviousEnabledSibling: function() {
+
+        var nGroupIndex,
+            aItemGroups,
+            oPreviousItem,
+            nPreviousGroupIndex,
+            aPreviousGroup;
+
+        function getPreviousArrayItem(p_aArray, p_nStartIndex) {
+
+            return p_aArray[p_nStartIndex] ||  
+                getPreviousArrayItem(p_aArray, (p_nStartIndex-1));
+
+        }
+
+        function getFirstItemIndex(p_aArray, p_nStartIndex) {
+
+            return p_aArray[p_nStartIndex] ? p_nStartIndex : 
+                getFirstItemIndex(p_aArray, (p_nStartIndex+1));
+
+        }
+
+       if(this.parent instanceof Menu) {
+
+            nGroupIndex = this.groupIndex;
+            aItemGroups = this.parent.getItemGroups();
+
+    
+            if(this.index > getFirstItemIndex(aItemGroups[nGroupIndex], 0)) {
+    
+                oPreviousItem = getPreviousArrayItem(aItemGroups[nGroupIndex], 
+                        (this.index-1));
+    
+            }
+            else {
+    
+                if(nGroupIndex > getFirstItemIndex(aItemGroups, 0)) {
+    
+                    nPreviousGroupIndex = nGroupIndex - 1;
+    
+                }
+                else {
+    
+                    nPreviousGroupIndex = aItemGroups.length - 1;
+    
+                }
+    
+                aPreviousGroup = getPreviousArrayItem(aItemGroups, 
+                    nPreviousGroupIndex);
+    
+                oPreviousItem = getPreviousArrayItem(aPreviousGroup, 
+                        (aPreviousGroup.length - 1));
+    
+            }
+
+            return (oPreviousItem.cfg.getProperty("disabled") || 
+                oPreviousItem.element.style.display == "none") ? 
+                oPreviousItem.getPreviousEnabledSibling() : oPreviousItem;
+
+        }
+
+    },
+
+
+    /**
+    * @method focus
+    * @description Causes the menu item to receive the focus and fires the 
+    * focus event.
+    */
+    focus: function() {
+
+        var oParent = this.parent,
+            oAnchor = this._oAnchor,
+            oActiveItem = oParent.activeItem,
+            me = this;
+
+
+        function setFocus() {
+
+            try {
+
+                if (YAHOO.env.ua.ie && !document.hasFocus()) {
+                
+                    return;
+                
+                }
+
+                oAnchor.focus();
+
+            }
+            catch(e) {
+            
+            }
+
+        }
+
+
+        if(!this.cfg.getProperty("disabled") && oParent && 
+            oParent.cfg.getProperty("visible") && 
+            this.element.style.display != "none") {
+
+            if(oActiveItem) {
+
+                oActiveItem.blur();
+
+            }
+
+
+            /*
+                Setting focus via a timer fixes a race condition in Firefox, IE 
+                and Opera where the browser viewport jumps as it trys to 
+                position and focus the menu.
+            */
+
+            window.setTimeout(setFocus, 0);
+            
+            this.focusEvent.fire();
+
+        }
+
+    },
+
+
+    /**
+    * @method blur
+    * @description Causes the menu item to lose focus and fires the 
+    * blur event.
+    */    
+    blur: function() {
+
+        var oParent = this.parent;
+
+        if(!this.cfg.getProperty("disabled") && oParent && 
+            oParent.cfg.getProperty("visible")) {
+
+            try {
+
+                this._oAnchor.blur();
+            
+            }
+            catch (e) {
+            
+            }
+
+            this.blurEvent.fire();
+
+        }
+
+    },
+
+
+    /**
+    * @method hasFocus
+    * @description Returns a boolean indicating whether or not the menu item
+    * has focus.
+    * @return {Boolean}
+    */
+    hasFocus: function() {
+    
+        return (YAHOO.widget.MenuManager.getFocusedMenuItem() == this);
+    
+    },
+
+
+	/**
+    * @method destroy
+	* @description Removes the menu item's <code>&#60;li&#62;</code> element 
+	* from its parent <code>&#60;ul&#62;</code> element.
+	*/
+    destroy: function() {
+
+        var oEl = this.element,
+            oSubmenu,
+            oParentNode;
+
+        if(oEl) {
+
+
+            // If the item has a submenu, destroy it first
+
+            oSubmenu = this.cfg.getProperty("submenu");
+
+            if(oSubmenu) {
+            
+                oSubmenu.destroy();
+            
+            }
+
+
+            // Remove CustomEvent listeners
+    
+            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();
+
+
+            // Remove the element from the parent node
+
+            oParentNode = oEl.parentNode;
+
+            if(oParentNode) {
+
+                oParentNode.removeChild(oEl);
+
+                this.destroyEvent.fire();
+
+            }
+
+            this.destroyEvent.unsubscribeAll();
+
+        }
+
+    },
+
+
+    /**
+    * @method toString
+    * @description Returns a string representing the menu item.
+    * @return {String}
+    */
+    toString: function() {
+
+        var sReturnVal = "MenuItem",
+            sId = this.id;
+
+        if(sId) {
+    
+            sReturnVal += (" " + sId);
+        
+        }
+
+        return sReturnVal;
+    
+    }
+
+};
+
+Lang.augmentProto(MenuItem, YAHOO.util.EventProvider);
+
+})();
+(function () {
+
+
+/**
+* Creates a list of options or commands which are made visible in response to 
+* an HTML element's "contextmenu" event ("mousedown" for Opera).
+*
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source for the 
+* context menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-
+* html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object specifying the 
+* <code>&#60;div&#62;</code> element of the context menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-
+* html.html#ID-94282980">HTMLSelectElement</a>} p_oElement Object specifying 
+* the <code>&#60;select&#62;</code> element to be used as the data source for 
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the context menu. See configuration class documentation 
+* for more details.
+* @class ContextMenu
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.ContextMenu = function(p_oElement, p_oConfig) {
+
+    YAHOO.widget.ContextMenu.superclass.constructor.call(this, 
+            p_oElement, p_oConfig);
+
+};
+
+var Event = YAHOO.util.Event,
+    ContextMenu = YAHOO.widget.ContextMenu,
+
+/**
+* Constant representing the name of the ContextMenu's events
+* @property EVENT_TYPES
+* @private
+* @final
+* @type Object
+*/
+    EVENT_TYPES = {
+
+        "TRIGGER_CONTEXT_MENU": "triggerContextMenu",
+        "CONTEXT_MENU": (YAHOO.env.ua.opera ? "mousedown" : "contextmenu"),
+        "CLICK": "click"
+
+    },
+    
+    
+    /**
+    * Constant representing the ContextMenu's configuration properties
+    * @property DEFAULT_CONFIG
+    * @private
+    * @final
+    * @type Object
+    */
+    DEFAULT_CONFIG = {
+    
+        "TRIGGER": { 
+            key: "trigger" 
+        }
+    
+    };
+
+
+YAHOO.lang.extend(ContextMenu, YAHOO.widget.Menu, {
+
+
+
+// Private properties
+
+
+/**
+* @property _oTrigger
+* @description Object reference to the current value of the "trigger" 
+* configuration property.
+* @default null
+* @private
+* @type String|<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/leve
+* l-one-html.html#ID-58190037">HTMLElement</a>|Array
+*/
+_oTrigger: null,
+
+
+/**
+* @property _bCancelled
+* @description Boolean indicating if the display of the context menu should 
+* be cancelled.
+* @default false
+* @private
+* @type Boolean
+*/
+_bCancelled: false,
+
+
+
+// Public properties
+
+
+/**
+* @property contextEventTarget
+* @description Object reference for the HTML element that was the target of the
+* "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of 
+* the context menu.
+* @default null
+* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-
+* html.html#ID-58190037">HTMLElement</a>
+*/
+contextEventTarget: null,
+
+
+
+// Events
+
+
+/**
+* @event triggerContextMenuEvent
+* @description Custom Event wrapper for the "contextmenu" DOM event 
+* ("mousedown" for Opera) fired by the element(s) that trigger the display of 
+* the context menu.
+*/
+triggerContextMenuEvent: null,
+
+
+
+/**
+* @method init
+* @description The ContextMenu class's initialization method. 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.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the context menu.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source for 
+* the context menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-
+* html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object specifying the 
+* <code>&#60;div&#62;</code> element of the context menu.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-
+* html.html#ID-94282980">HTMLSelectElement</a>} p_oElement Object specifying 
+* the <code>&#60;select&#62;</code> element to be used as the data source for 
+* the context menu.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the context menu. See configuration class documentation 
+* for more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+    if(!this.ITEM_TYPE) {
+
+        this.ITEM_TYPE = YAHOO.widget.ContextMenuItem;
+
+    }
+
+
+    // Call the init of the superclass (YAHOO.widget.Menu)
+
+    ContextMenu.superclass.init.call(this, p_oElement);
+
+
+    this.beforeInitEvent.fire(ContextMenu);
+
+
+    if(p_oConfig) {
+
+        this.cfg.applyConfig(p_oConfig, true);
+
+    }
+    
+    
+    this.initEvent.fire(ContextMenu);
+    
+},
+
+
+/**
+* @method initEvents
+* @description Initializes the custom events for the context menu.
+*/
+initEvents: function() {
+
+	ContextMenu.superclass.initEvents.call(this);
+
+    // Create custom events
+
+    this.triggerContextMenuEvent = 
+        this.createEvent(EVENT_TYPES.TRIGGER_CONTEXT_MENU);
+
+    this.triggerContextMenuEvent.signature = YAHOO.util.CustomEvent.LIST;
+
+},
+
+
+/**
+* @method cancel
+* @description Cancels the display of the context menu.
+*/
+cancel: function() {
+
+    this._bCancelled = true;
+
+},
+
+
+
+// Private methods
+
+
+/**
+* @method _removeEventHandlers
+* @description Removes all of the DOM event handlers from the HTML element(s) 
+* whose "context menu" event ("click" for Opera) trigger the display of 
+* the context menu.
+* @private
+*/
+_removeEventHandlers: function() {
+
+    var oTrigger = this._oTrigger;
+
+
+    // Remove the event handlers from the trigger(s)
+
+    if (oTrigger) {
+
+        Event.removeListener(oTrigger, EVENT_TYPES.CONTEXT_MENU, 
+            this._onTriggerContextMenu);    
+        
+        if(YAHOO.env.ua.opera) {
+        
+            Event.removeListener(oTrigger, EVENT_TYPES.CLICK, 
+                this._onTriggerClick);
+    
+        }
+
+    }
+
+},
+
+
+
+// Private event handlers
+
+
+/**
+* @method _onTriggerClick
+* @description "click" event handler for the HTML element(s) identified as the 
+* "trigger" for the context menu.  Used to cancel default behaviors in Opera.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back 
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context 
+* menu that is handling the event.
+*/
+_onTriggerClick: function(p_oEvent, p_oMenu) {
+
+    if(p_oEvent.ctrlKey) {
+    
+        Event.stopEvent(p_oEvent);
+
+    }
+    
+},
+
+
+/**
+* @method _onTriggerContextMenu
+* @description "contextmenu" event handler ("mousedown" for Opera) for the HTML 
+* element(s) that trigger the display of the context menu.
+* @private
+* @param {Event} p_oEvent Object representing the DOM event object passed back 
+* by the event utility (YAHOO.util.Event).
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context 
+* menu that is handling the event.
+*/
+_onTriggerContextMenu: function(p_oEvent, p_oMenu) {
+
+    if(p_oEvent.type == "mousedown" && !p_oEvent.ctrlKey) {
+
+        return;
+
+    }
+
+
+    /*
+        Prevent the browser's default context menu from appearing and 
+        stop the propagation of the "contextmenu" event so that 
+        other ContextMenu instances are not displayed.
+    */
+
+    Event.stopEvent(p_oEvent);
+
+
+    // Hide any other ContextMenu instances that might be visible
+
+    YAHOO.widget.MenuManager.hideVisible();
+
+
+    this.contextEventTarget = Event.getTarget(p_oEvent);
+
+    this.triggerContextMenuEvent.fire(p_oEvent);
+
+
+    if(!this._bCancelled) {
+
+        // Position and display the context menu
+    
+        this.cfg.setProperty("xy", Event.getXY(p_oEvent));
+
+        this.show();
+
+    }
+
+    this._bCancelled = false;
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the context menu.
+* @return {String}
+*/
+toString: function() {
+
+    var sReturnVal = "ContextMenu",
+        sId = this.id;
+
+    if(sId) {
+
+        sReturnVal += (" " + sId);
+    
+    }
+
+    return sReturnVal;
+
+},
+
+
+/**
+* @method initDefaultConfig
+* @description Initializes the class's configurable properties which can be 
+* changed using the context menu's Config object ("cfg").
+*/
+initDefaultConfig: function() {
+
+    ContextMenu.superclass.initDefaultConfig.call(this);
+
+    /**
+    * @config trigger
+    * @description The HTML element(s) whose "contextmenu" event ("mousedown" 
+    * for Opera) trigger the display of the context menu.  Can be a string 
+    * representing the id attribute of the HTML element, an object reference 
+    * for the HTML element, or an array of strings or HTML element references.
+    * @default null
+    * @type String|<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
+    * level-one-html.html#ID-58190037">HTMLElement</a>|Array
+    */
+    this.cfg.addProperty(DEFAULT_CONFIG.TRIGGER.key, 
+        { handler: this.configTrigger });
+
+},
+
+
+/**
+* @method destroy
+* @description Removes the context menu's <code>&#60;div&#62;</code> element 
+* (and accompanying child nodes) from the document.
+*/
+destroy: function() {
+
+    // Remove the DOM event handlers from the current trigger(s)
+
+    this._removeEventHandlers();
+    
+
+    // Continue with the superclass implementation of this method
+
+    ContextMenu.superclass.destroy.call(this);
+
+},
+
+
+
+// Public event handlers for configuration properties
+
+
+/**
+* @method configTrigger
+* @description Event handler for when the value of the "trigger" configuration 
+* property changes. 
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.ContextMenu} p_oMenu Object representing the context 
+* menu that fired the event.
+*/
+configTrigger: function(p_sType, p_aArgs, p_oMenu) {
+    
+    var oTrigger = p_aArgs[0];
+
+    if(oTrigger) {
+
+        /*
+            If there is a current "trigger" - remove the event handlers 
+            from that element(s) before assigning new ones
+        */
+
+        if(this._oTrigger) {
+        
+            this._removeEventHandlers();
+
+        }
+
+        this._oTrigger = oTrigger;
+
+
+        /*
+            Listen for the "mousedown" event in Opera b/c it does not 
+            support the "contextmenu" event
+        */ 
+  
+        Event.on(oTrigger, EVENT_TYPES.CONTEXT_MENU, 
+            this._onTriggerContextMenu, this, true);
+
+
+        /*
+            Assign a "click" event handler to the trigger element(s) for
+            Opera to prevent default browser behaviors.
+        */
+
+        if(YAHOO.env.ua.opera) {
+        
+            Event.on(oTrigger, EVENT_TYPES.CLICK, this._onTriggerClick, 
+                this, true);
+
+        }
+
+    }
+    else {
+   
+        this._removeEventHandlers();
+    
+    }
+    
+}
+
+}); // END YAHOO.lang.extend
+
+}());
+
+
+
+/**
+* Creates an item for a context menu.
+* 
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying the 
+* <code>&#60;li&#62;</code> element of the context menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+* specifying the <code>&#60;optgroup&#62;</code> element of the context 
+* menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object specifying 
+* the <code>&#60;option&#62;</code> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the context menu item. See configuration class 
+* documentation for more details.
+* @class ContextMenuItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.ContextMenuItem = function(p_oObject, p_oConfig) {
+
+    YAHOO.widget.ContextMenuItem.superclass.constructor.call(this, 
+        p_oObject, p_oConfig);
+
+};
+
+YAHOO.lang.extend(YAHOO.widget.ContextMenuItem, YAHOO.widget.MenuItem, {
+
+
+/**
+* @method init
+* @description The ContextMenuItem class's initialization method. 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.
+* @param {String} p_oObject String specifying the text of the context menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying the 
+* <code>&#60;li&#62;</code> element of the context menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+* specifying the <code>&#60;optgroup&#62;</code> element of the context 
+* menu item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object specifying 
+* the <code>&#60;option&#62;</code> element of the context menu item.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the context menu item. See configuration class 
+* documentation for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+    
+    if(!this.SUBMENU_TYPE) {
+
+        this.SUBMENU_TYPE = YAHOO.widget.ContextMenu;
+
+    }
+
+
+    /* 
+        Call the init of the superclass (YAHOO.widget.MenuItem)
+        Note: We don't pass the user config in here yet 
+        because we only want it executed once, at the lowest 
+        subclass level.
+    */ 
+
+    YAHOO.widget.ContextMenuItem.superclass.init.call(this, p_oObject);
+
+    var oConfig = this.cfg;
+
+    if(p_oConfig) {
+
+        oConfig.applyConfig(p_oConfig, true);
+
+    }
+
+    oConfig.fireQueue();
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the context menu item.
+* @return {String}
+*/
+toString: function() {
+
+    var sReturnVal = "ContextMenuItem";
+
+    if(this.cfg && this.cfg.getProperty("text")) {
+
+        sReturnVal += (": " + this.cfg.getProperty("text"));
+
+    }
+
+    return sReturnVal;
+
+}
+    
+}); // END YAHOO.lang.extend
+(function () {
+
+
+/**
+* Horizontal collection of items, each of which can contain a submenu.
+* 
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source for the 
+* menu bar.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object specifying 
+* the <code>&#60;div&#62;</code> element of the menu bar.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-94282980">HTMLSelectElement</a>} p_oElement Object 
+* specifying the <code>&#60;select&#62;</code> element to be used as the data 
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+* @class MenuBar
+* @constructor
+* @extends YAHOO.widget.Menu
+* @namespace YAHOO.widget
+*/
+YAHOO.widget.MenuBar = function(p_oElement, p_oConfig) {
+
+    YAHOO.widget.MenuBar.superclass.constructor.call(this, 
+        p_oElement, p_oConfig);
+
+};
+
+
+/**
+* @method checkPosition
+* @description Checks to make sure that the value of the "position" property 
+* is one of the supported strings. Returns true if the position is supported.
+* @private
+* @param {Object} p_sPosition String specifying the position of the menu.
+* @return {Boolean}
+*/
+function checkPosition(p_sPosition) {
+
+    if (typeof p_sPosition == "string") {
+
+        return ("dynamic,static".indexOf((p_sPosition.toLowerCase())) != -1);
+
+    }
+
+}
+
+
+var Event = YAHOO.util.Event,
+    Dom = YAHOO.util.Dom,
+    MenuBar = YAHOO.widget.MenuBar,
+
+    /**
+    * Constant representing the MenuBar's configuration properties
+    * @property DEFAULT_CONFIG
+    * @private
+    * @final
+    * @type Object
+    */
+    DEFAULT_CONFIG = {
+    
+        "POSITION": { 
+            key: "position", 
+            value: "static", 
+            validator: checkPosition, 
+            supercedes: ["visible"] 
+        }, 
+    
+        "SUBMENU_ALIGNMENT": { 
+            key: "submenualignment", 
+            value: ["tl","bl"] 
+        },
+    
+        "AUTO_SUBMENU_DISPLAY": { 
+            key: "autosubmenudisplay", 
+            value: false, 
+            validator: YAHOO.lang.isBoolean 
+        }
+    
+    };
+
+
+
+YAHOO.lang.extend(MenuBar, YAHOO.widget.Menu, {
+
+/**
+* @method init
+* @description The MenuBar class's initialization method. 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.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;div&#62;</code> element of the menu bar.
+* @param {String} p_oElement String specifying the id attribute of the 
+* <code>&#60;select&#62;</code> element to be used as the data source for the 
+* menu bar.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object specifying 
+* the <code>&#60;div&#62;</code> element of the menu bar.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-94282980">HTMLSelectElement</a>} p_oElement Object 
+* specifying the <code>&#60;select&#62;</code> element to be used as the data 
+* source for the menu bar.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu bar. See configuration class documentation for
+* more details.
+*/
+init: function(p_oElement, p_oConfig) {
+
+    if(!this.ITEM_TYPE) {
+
+        this.ITEM_TYPE = YAHOO.widget.MenuBarItem;
+
+    }
+
+
+    // Call the init of the superclass (YAHOO.widget.Menu)
+
+    MenuBar.superclass.init.call(this, p_oElement);
+
+
+    this.beforeInitEvent.fire(MenuBar);
+
+
+    if(p_oConfig) {
+
+        this.cfg.applyConfig(p_oConfig, true);
+
+    }
+
+    this.initEvent.fire(MenuBar);
+
+},
+
+
+
+// Constants
+
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the menu 
+* bar's <code>&#60;div&#62;</code> element.
+* @default "yuimenubar"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubar",
+
+
+
+// Protected event handlers
+
+
+/**
+* @method _onKeyDown
+* @description "keydown" Custom Event handler for the menu bar.
+* @private
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar 
+* that fired the event.
+*/
+_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) {
+
+    var oEvent = p_aArgs[0],
+        oItem = p_aArgs[1],
+        oSubmenu,
+        oItemCfg,
+        oNextItem;
+
+
+    if(oItem && !oItem.cfg.getProperty("disabled")) {
+
+        oItemCfg = oItem.cfg;
+
+        switch(oEvent.keyCode) {
+    
+            case 37:    // Left arrow
+            case 39:    // Right arrow
+    
+                if(oItem == this.activeItem && 
+                    !oItemCfg.getProperty("selected")) {
+    
+                    oItemCfg.setProperty("selected", true);
+    
+                }
+                else {
+    
+                    oNextItem = (oEvent.keyCode == 37) ? 
+                        oItem.getPreviousEnabledSibling() : 
+                        oItem.getNextEnabledSibling();
+            
+                    if(oNextItem) {
+    
+                        this.clearActiveItem();
+    
+                        oNextItem.cfg.setProperty("selected", true);
+    
+    
+                        if(this.cfg.getProperty("autosubmenudisplay")) {
+                        
+                            oSubmenu = oNextItem.cfg.getProperty("submenu");
+                            
+                            if(oSubmenu) {
+                        
+                                oSubmenu.show();
+                            
+                            }
+                
+                        }           
+    
+                        oNextItem.focus();
+    
+                    }
+    
+                }
+    
+                Event.preventDefault(oEvent);
+    
+            break;
+    
+            case 40:    // Down arrow
+    
+                if(this.activeItem != oItem) {
+    
+                    this.clearActiveItem();
+    
+                    oItemCfg.setProperty("selected", true);
+                    oItem.focus();
+                
+                }
+    
+                oSubmenu = oItemCfg.getProperty("submenu");
+    
+                if(oSubmenu) {
+    
+                    if(oSubmenu.cfg.getProperty("visible")) {
+    
+                        oSubmenu.setInitialSelection();
+                        oSubmenu.setInitialFocus();
+                    
+                    }
+                    else {
+    
+                        oSubmenu.show();
+                    
+                    }
+    
+                }
+    
+                Event.preventDefault(oEvent);
+    
+            break;
+    
+        }
+
+    }
+
+
+    if(oEvent.keyCode == 27 && this.activeItem) { // Esc key
+
+        oSubmenu = this.activeItem.cfg.getProperty("submenu");
+
+        if(oSubmenu && oSubmenu.cfg.getProperty("visible")) {
+        
+            oSubmenu.hide();
+            this.activeItem.focus();
+        
+        }
+        else {
+
+            this.activeItem.cfg.setProperty("selected", false);
+            this.activeItem.blur();
+    
+        }
+
+        Event.preventDefault(oEvent);
+    
+    }
+
+},
+
+
+/**
+* @method _onClick
+* @description "click" event handler for the menu bar.
+* @protected
+* @param {String} p_sType String representing the name of the event that 
+* was fired.
+* @param {Array} p_aArgs Array of arguments sent when the event was fired.
+* @param {YAHOO.widget.MenuBar} p_oMenuBar Object representing the menu bar 
+* that fired the event.
+*/
+_onClick: function(p_sType, p_aArgs, p_oMenuBar) {
+
+    MenuBar.superclass._onClick.call(this, p_sType, p_aArgs, p_oMenuBar);
+
+    var oItem = p_aArgs[1],
+        oEvent,
+        oTarget,
+        oActiveItem,
+        oConfig,
+        oSubmenu;
+    
+
+    if(oItem && !oItem.cfg.getProperty("disabled")) {
+
+        oEvent = p_aArgs[0];
+        oTarget = Event.getTarget(oEvent);
+        oActiveItem = this.activeItem;
+        oConfig = this.cfg;
+
+
+        // Hide any other submenus that might be visible
+    
+        if(oActiveItem && oActiveItem != oItem) {
+    
+            this.clearActiveItem();
+    
+        }
+
+    
+        oItem.cfg.setProperty("selected", true);
+    
+
+        // Show the submenu for the item
+    
+        oSubmenu = oItem.cfg.getProperty("submenu");
+
+
+        if(oSubmenu && oTarget != oItem.submenuIndicator) {
+        
+            if(oSubmenu.cfg.getProperty("visible")) {
+            
+                oSubmenu.hide();
+            
+            }
+            else {
+            
+                oSubmenu.show();                    
+            
+            }
+        
+        }
+    
+    }
+
+},
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar.
+* @return {String}
+*/
+toString: function() {
+
+    var sReturnVal = "MenuBar",
+        sId = this.id;
+
+    if(sId) {
+
+        sReturnVal += (" " + sId);
+    
+    }
+
+    return sReturnVal;
+
+},
+
+
+/**
+* @description Initializes the class's configurable properties which can be
+* changed using the menu bar's Config object ("cfg").
+* @method initDefaultConfig
+*/
+initDefaultConfig: function() {
+
+    MenuBar.superclass.initDefaultConfig.call(this);
+
+    var oConfig = this.cfg;
+
+	// Add configuration properties
+
+
+    /*
+        Set the default value for the "position" configuration property
+        to "static" by re-adding the property.
+    */
+
+
+    /**
+    * @config position
+    * @description String indicating how a menu bar should be positioned on the 
+    * screen.  Possible values are "static" and "dynamic."  Static menu bars 
+    * are visible by default and reside in the normal flow of the document 
+    * (CSS position: static).  Dynamic menu bars are hidden by default, reside
+    * out of the normal flow of the document (CSS position: absolute), and can 
+    * overlay other elements on the screen.
+    * @default static
+    * @type String
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.POSITION.key, 
+        {
+            handler: this.configPosition, 
+            value: DEFAULT_CONFIG.POSITION.value, 
+            validator: DEFAULT_CONFIG.POSITION.validator,
+            supercedes: DEFAULT_CONFIG.POSITION.supercedes
+        }
+    );
+
+
+    /*
+        Set the default value for the "submenualignment" configuration property
+        to ["tl","bl"] by re-adding the property.
+    */
+
+    /**
+    * @config submenualignment
+    * @description Array defining how submenus should be aligned to their 
+    * parent menu bar item. The format is: [itemCorner, submenuCorner].
+    * @default ["tl","bl"]
+    * @type Array
+    */
+    oConfig.addProperty(
+        DEFAULT_CONFIG.SUBMENU_ALIGNMENT.key, 
+        {
+            value: DEFAULT_CONFIG.SUBMENU_ALIGNMENT.value
+        }
+    );
+
+
+    /*
+        Change the default value for the "autosubmenudisplay" configuration 
+        property to "false" by re-adding the property.
+    */
+
+    /**
+    * @config autosubmenudisplay
+    * @description Boolean indicating if submenus are automatically made 
+    * visible when the user mouses over the menu bar's items.
+    * @default false
+    * @type Boolean
+    */
+	oConfig.addProperty(
+	   DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.key, 
+	   {
+	       value: DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.value, 
+	       validator: DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.validator
+       } 
+    );
+
+}
+ 
+}); // END YAHOO.lang.extend
+
+}());
+
+
+
+/**
+* Creates an item for a menu bar.
+* 
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying the 
+* <code>&#60;li&#62;</code> element of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+* specifying the <code>&#60;optgroup&#62;</code> element of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object specifying 
+* the <code>&#60;option&#62;</code> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu bar item. See configuration class documentation 
+* for more details.
+* @class MenuBarItem
+* @constructor
+* @extends YAHOO.widget.MenuItem
+*/
+YAHOO.widget.MenuBarItem = function(p_oObject, p_oConfig) {
+
+    YAHOO.widget.MenuBarItem.superclass.constructor.call(this, 
+        p_oObject, p_oConfig);
+
+};
+
+YAHOO.lang.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {
+
+
+
+/**
+* @method init
+* @description The MenuBarItem class's initialization method. 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.
+* @param {String} p_oObject String specifying the text of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-74680021">HTMLLIElement</a>} p_oObject Object specifying the 
+* <code>&#60;li&#62;</code> element of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-38450247">HTMLOptGroupElement</a>} p_oObject Object 
+* specifying the <code>&#60;optgroup&#62;</code> element of the menu bar item.
+* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
+* one-html.html#ID-70901257">HTMLOptionElement</a>} p_oObject Object specifying 
+* the <code>&#60;option&#62;</code> element of the menu bar item.
+* @param {Object} p_oConfig Optional. Object literal specifying the 
+* configuration for the menu bar item. See configuration class documentation 
+* for more details.
+*/
+init: function(p_oObject, p_oConfig) {
+
+    if(!this.SUBMENU_TYPE) {
+
+        this.SUBMENU_TYPE = YAHOO.widget.Menu;
+
+    }
+
+
+    /* 
+        Call the init of the superclass (YAHOO.widget.MenuItem)
+        Note: We don't pass the user config in here yet 
+        because we only want it executed once, at the lowest 
+        subclass level.
+    */ 
+
+    YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject);  
+
+
+    var oConfig = this.cfg;
+
+    if(p_oConfig) {
+
+        oConfig.applyConfig(p_oConfig, true);
+
+    }
+
+    oConfig.fireQueue();
+
+},
+
+
+
+// Constants
+
+
+/**
+* @property CSS_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the 
+* <code>&#60;li&#62;</code> element of the menu bar item.
+* @default "yuimenubaritem"
+* @final
+* @type String
+*/
+CSS_CLASS_NAME: "yuimenubaritem",
+
+
+/**
+* @property CSS_LABEL_CLASS_NAME
+* @description String representing the CSS class(es) to be applied to the 
+* menu bar item's <code>&#60;a&#62;</code> element.
+* @default "yuimenubaritemlabel"
+* @final
+* @type String
+*/
+CSS_LABEL_CLASS_NAME: "yuimenubaritemlabel",
+
+
+
+// Public methods
+
+
+/**
+* @method toString
+* @description Returns a string representing the menu bar item.
+* @return {String}
+*/
+toString: function() {
+
+    var sReturnVal = "MenuBarItem";
+
+    if(this.cfg && this.cfg.getProperty("text")) {
+
+        sReturnVal += (": " + this.cfg.getProperty("text"));
+
+    }
+
+    return sReturnVal;
+
+}
+    
+}); // END YAHOO.lang.extend
+YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/slider.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/slider.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/slider.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1350 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The Slider component is a UI control that enables the user to adjust 
+ * values in a finite range along one or two axes. Typically, the Slider 
+ * control is used in a web application as a rich, visual replacement 
+ * for an input box that takes a number as input. The Slider control can 
+ * also easily accommodate a second dimension, providing x,y output for 
+ * a selection point chosen from a rectangular region.
+ *
+ * @module    slider
+ * @title     Slider Widget
+ * @namespace YAHOO.widget
+ * @requires  yahoo,dom,dragdrop,event
+ * @optional  animation
+ */
+
+/**
+ * A DragDrop implementation that can be used as a background for a
+ * slider.  It takes a reference to the thumb instance 
+ * so it can delegate some of the events to it.  The goal is to make the 
+ * thumb jump to the location on the background when the background is 
+ * clicked.  
+ *
+ * @class Slider
+ * @extends YAHOO.util.DragDrop
+ * @uses YAHOO.util.EventProvider
+ * @constructor
+ * @param {String}      id     The id of the element linked to this instance
+ * @param {String}      sGroup The group of related DragDrop items
+ * @param {SliderThumb} oThumb The thumb for this slider
+ * @param {String}      sType  The type of slider (horiz, vert, region)
+ */
+YAHOO.widget.Slider = function(sElementId, sGroup, oThumb, sType) {
+
+    YAHOO.widget.Slider.ANIM_AVAIL = 
+        (!YAHOO.lang.isUndefined(YAHOO.util.Anim));
+
+    if (sElementId) {
+        this.init(sElementId, sGroup, true);
+        this.initSlider(sType);
+        this.initThumb(oThumb);
+    }
+};
+
+/**
+ * Factory method for creating a horizontal slider
+ * @method YAHOO.widget.Slider.getHorizSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iTickSize optional parameter for specifying that the element 
+ * should move a certain number pixels at a time.
+ * @return {Slider} a horizontal slider control
+ */
+YAHOO.widget.Slider.getHorizSlider = 
+    function (sBGElId, sHandleElId, iLeft, iRight, iTickSize) {
+        return new YAHOO.widget.Slider(sBGElId, sBGElId, 
+            new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 
+                               iLeft, iRight, 0, 0, iTickSize), "horiz");
+};
+
+/**
+ * Factory method for creating a vertical slider
+ * @method YAHOO.widget.Slider.getVertSlider
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element 
+ * should move a certain number pixels at a time.
+ * @return {Slider} a vertical slider control
+ */
+YAHOO.widget.Slider.getVertSlider = 
+    function (sBGElId, sHandleElId, iUp, iDown, iTickSize) {
+        return new YAHOO.widget.Slider(sBGElId, sBGElId, 
+            new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, 0, 0, 
+                               iUp, iDown, iTickSize), "vert");
+};
+
+/**
+ * Factory method for creating a slider region like the one in the color
+ * picker example
+ * @method YAHOO.widget.Slider.getSliderRegion
+ * @static
+ * @param {String} sBGElId the id of the slider's background element
+ * @param {String} sHandleElId the id of the thumb element
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element 
+ * should move a certain number pixels at a time.
+ * @return {Slider} a slider region control
+ */
+YAHOO.widget.Slider.getSliderRegion = 
+    function (sBGElId, sHandleElId, iLeft, iRight, iUp, iDown, iTickSize) {
+        return new YAHOO.widget.Slider(sBGElId, sBGElId, 
+            new YAHOO.widget.SliderThumb(sHandleElId, sBGElId, iLeft, iRight, 
+                               iUp, iDown, iTickSize), "region");
+};
+
+/**
+ * By default, animation is available if the animation utility is detected.
+ * @property YAHOO.widget.Slider.ANIM_AVAIL
+ * @static
+ * @type boolean
+ */
+YAHOO.widget.Slider.ANIM_AVAIL = false;
+
+YAHOO.extend(YAHOO.widget.Slider, YAHOO.util.DragDrop, {
+
+    /**
+     * Initializes the slider.  Executed in the constructor
+     * @method initSlider
+     * @param {string} sType the type of slider (horiz, vert, region)
+     */
+    initSlider: function(sType) {
+
+        /**
+         * The type of the slider (horiz, vert, region)
+         * @property type
+         * @type string
+         */
+        this.type = sType;
+
+        //this.removeInvalidHandleType("A");
+
+
+        /**
+         * Event the fires when the value of the control changes.  If 
+         * the control is animated the event will fire every point
+         * along the way.
+         * @event change
+         * @param {int} newOffset|x the new offset for normal sliders, or the new
+         *                          x offset for region sliders
+         * @param {int} y the number of pixels the thumb has moved on the y axis
+         *                (region sliders only)
+         */
+        this.createEvent("change", this);
+
+        /**
+         * Event that fires at the beginning of a slider thumb move.
+         * @event slideStart
+         */
+        this.createEvent("slideStart", this);
+
+        /**
+         * Event that fires at the end of a slider thumb move
+         * @event slideEnd
+         */
+        this.createEvent("slideEnd", this);
+
+        /**
+         * Overrides the isTarget property in YAHOO.util.DragDrop
+         * @property isTarget
+         * @private
+         */
+        this.isTarget = false;
+    
+        /**
+         * Flag that determines if the thumb will animate when moved
+         * @property animate
+         * @type boolean
+         */
+        this.animate = YAHOO.widget.Slider.ANIM_AVAIL;
+
+        /**
+         * Set to false to disable a background click thumb move
+         * @property backgroundEnabled
+         * @type boolean
+         */
+        this.backgroundEnabled = true;
+
+        /**
+         * Adjustment factor for tick animation, the more ticks, the
+         * faster the animation (by default)
+         * @property tickPause
+         * @type int
+         */
+        this.tickPause = 40;
+
+        /**
+         * Enables the arrow, home and end keys, defaults to true.
+         * @property enableKeys
+         * @type boolean
+         */
+        this.enableKeys = true;
+
+        /**
+         * Specifies the number of pixels the arrow keys will move the slider.
+         * Default is 25.
+         * @property keyIncrement
+         * @type int
+         */
+        this.keyIncrement = 20;
+
+        /**
+         * moveComplete is set to true when the slider has moved to its final
+         * destination.  For animated slider, this value can be checked in 
+         * the onChange handler to make it possible to execute logic only
+         * when the move is complete rather than at all points along the way.
+         * Deprecated because this flag is only useful when the background is
+         * clicked and the slider is animated.  If the user drags the thumb,
+         * the flag is updated when the drag is over ... the final onDrag event
+         * fires before the mouseup the ends the drag, so the implementer will
+         * never see it.
+         *
+         * @property moveComplete
+         * @type Boolean
+         * @deprecated use the slideEnd event instead
+         */
+        this.moveComplete = true;
+
+        /**
+         * If animation is configured, specifies the length of the animation
+         * in seconds.
+         * @property animationDuration
+         * @type int
+         * @default 0.2
+         */
+        this.animationDuration = 0.2;
+
+        /**
+         * Constant for valueChangeSource, indicating that the user clicked or
+         * dragged the slider to change the value.
+         * @property SOURCE_UI_EVENT
+         * @final
+         * @default 1
+         */
+        this.SOURCE_UI_EVENT = 1;
+
+        /**
+         * Constant for valueChangeSource, indicating that the value was altered
+         * by a programmatic call to setValue/setRegionValue.
+         * @property SOURCE_SET_VALUE
+         * @final
+         * @default 2
+         */
+        this.SOURCE_SET_VALUE = 2;
+
+        /**
+         * When the slider value changes, this property is set to identify where
+         * the update came from.  This will be either 1, meaning the slider was
+         * clicked or dragged, or 2, meaning that it was set via a setValue() call.
+         * This can be used within event handlers to apply some of the logic only
+         * when dealing with one source or another.
+         * @property valueChangeSource
+         * @type int
+         * @since 2.3.0
+         */
+        this.valueChangeSource = 0;
+
+        /**
+         * Indicates whether or not events will be supressed for the current
+         * slide operation
+         * @property _silent
+         * @type boolean
+         * @private
+         */
+        this._silent = false;
+
+        /**
+         * Saved offset used to protect against NaN problems when slider is
+         * set to display:none
+         * @property lastOffset
+         * @type [int, int]
+         */
+        this.lastOffset = [0,0];
+    },
+
+    /**
+     * Initializes the slider's thumb. Executed in the constructor.
+     * @method initThumb
+     * @param {YAHOO.widget.SliderThumb} t the slider thumb
+     */
+    initThumb: function(t) {
+
+        var self = this;
+
+        /**
+         * A YAHOO.widget.SliderThumb instance that we will use to 
+         * reposition the thumb when the background is clicked
+         * @property thumb
+         * @type YAHOO.widget.SliderThumb
+         */
+        this.thumb = t;
+        t.cacheBetweenDrags = true;
+
+        // add handler for the handle onchange event
+        //t.onChange = function() { 
+            //self.handleThumbChange(); 
+        //};
+
+        if (t._isHoriz && t.xTicks && t.xTicks.length) {
+            this.tickPause = Math.round(360 / t.xTicks.length);
+        } else if (t.yTicks && t.yTicks.length) {
+            this.tickPause = Math.round(360 / t.yTicks.length);
+        }
+
+
+        // delegate thumb methods
+        t.onAvailable = function() { 
+                return self.setStartSliderState(); 
+            };
+        t.onMouseDown = function () { 
+                return self.focus(); 
+            };
+        t.startDrag = function() { 
+                self._slideStart(); 
+            };
+        t.onDrag = function() { 
+                self.fireEvents(true); 
+            };
+        t.onMouseUp = function() { 
+                self.thumbMouseUp(); 
+            };
+
+    },
+
+    /**
+     * Executed when the slider element is available
+     * @method onAvailable
+     */
+    onAvailable: function() {
+        var Event = YAHOO.util.Event;
+        Event.on(this.id, "keydown",  this.handleKeyDown,  this, true);
+        Event.on(this.id, "keypress", this.handleKeyPress, this, true);
+    },
+ 
+    /**
+     * Executed when a keypress event happens with the control focused.
+     * Prevents the default behavior for navigation keys.  The actual
+     * logic for moving the slider thumb in response to a key event
+     * happens in handleKeyDown.
+     * @param {Event} e the keypress event
+     */
+    handleKeyPress: function(e) {
+        if (this.enableKeys) {
+            var Event = YAHOO.util.Event;
+            var kc = Event.getCharCode(e);
+            switch (kc) {
+                case 0x25: // left
+                case 0x26: // up
+                case 0x27: // right
+                case 0x28: // down
+                case 0x24: // home
+                case 0x23: // end
+                    Event.preventDefault(e);
+                    break;
+                default:
+            }
+        }
+    },
+
+    /**
+     * Executed when a keydown event happens with the control focused.
+     * Updates the slider value and display when the keypress is an
+     * arrow key, home, or end as long as enableKeys is set to true.
+     * @param {Event} e the keydown event
+     */
+    handleKeyDown: function(e) {
+        if (this.enableKeys) {
+            var Event = YAHOO.util.Event;
+
+            var kc = Event.getCharCode(e), t=this.thumb;
+            var h=this.getXValue(),v=this.getYValue();
+
+            var horiz = false;
+            var changeValue = true;
+            switch (kc) {
+
+                // left
+                case 0x25: h -= this.keyIncrement; break;
+
+                // up
+                case 0x26: v -= this.keyIncrement; break;
+
+                // right
+                case 0x27: h += this.keyIncrement; break;
+
+                // down
+                case 0x28: v += this.keyIncrement; break;
+
+                // home
+                case 0x24: h = t.leftConstraint;    
+                           v = t.topConstraint;    
+                           break;
+
+                // end
+                case 0x23: h = t.rightConstraint; 
+                           v = t.bottomConstraint;    
+                           break;
+
+                default:   changeValue = false;
+            }
+
+            if (changeValue) {
+                if (t._isRegion) {
+                    this.setRegionValue(h, v, true);
+                } else {
+                    var newVal = (t._isHoriz) ? h : v;
+                    this.setValue(newVal, true);
+                }
+                Event.stopEvent(e);
+            }
+
+        }
+    },
+
+    /**
+     * Initialization that sets up the value offsets once the elements are ready
+     * @method setStartSliderState
+     */
+    setStartSliderState: function() {
+
+
+        this.setThumbCenterPoint();
+
+        /**
+         * The basline position of the background element, used
+         * to determine if the background has moved since the last
+         * operation.
+         * @property baselinePos
+         * @type [int, int]
+         */
+        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);
+                this.deferredSetRegionValue = null;
+            } else {
+                this.setRegionValue(0, 0, true, true, true);
+            }
+        } else {
+            if (this.deferredSetValue) {
+                this.setValue.apply(this, this.deferredSetValue, true);
+                this.deferredSetValue = null;
+            } else {
+                this.setValue(0, true, true, true);
+            }
+        }
+    },
+
+    /**
+     * When the thumb is available, we cache the centerpoint of the element so
+     * we can position the element correctly when the background is clicked
+     * @method setThumbCenterPoint
+     */
+    setThumbCenterPoint: function() {
+
+        var el = this.thumb.getEl();
+
+        if (el) {
+            /**
+             * The center of the slider element is stored so we can 
+             * place it in the correct position when the background is clicked.
+             * @property thumbCenterPoint
+             * @type {"x": int, "y": int}
+             */
+            this.thumbCenterPoint = { 
+                    x: parseInt(el.offsetWidth/2, 10), 
+                    y: parseInt(el.offsetHeight/2, 10) 
+            };
+        }
+
+    },
+
+    /**
+     * Locks the slider, overrides YAHOO.util.DragDrop
+     * @method lock
+     */
+    lock: function() {
+        this.thumb.lock();
+        this.locked = true;
+    },
+
+    /**
+     * Unlocks the slider, overrides YAHOO.util.DragDrop
+     * @method unlock
+     */
+    unlock: function() {
+        this.thumb.unlock();
+        this.locked = false;
+    },
+
+    /**
+     * Handles mouseup event on the thumb
+     * @method thumbMouseUp
+     * @private
+     */
+    thumbMouseUp: function() {
+        if (!this.isLocked() && !this.moveComplete) {
+            this.endMove();
+        }
+
+    },
+
+    onMouseUp: function() {
+        if (!this.isLocked() && !this.moveComplete) {
+            this.endMove();
+        }
+    },
+
+    /**
+     * Returns a reference to this slider's thumb
+     * @method getThumb
+     * @return {SliderThumb} this slider's thumb
+     */
+    getThumb: function() {
+        return this.thumb;
+    },
+
+    /**
+     * Try to focus the element when clicked so we can add
+     * accessibility features
+     * @method focus
+     * @private
+     */
+    focus: function() {
+        this.valueChangeSource = this.SOURCE_UI_EVENT;
+
+        // Focus the background element if possible
+        var el = this.getEl();
+
+        if (el.focus) {
+            try {
+                el.focus();
+            } catch(e) {
+                // Prevent permission denied unhandled exception in FF that can
+                // happen when setting focus while another element is handling
+                // the blur.  @TODO this is still writing to the error log 
+                // (unhandled error) in FF1.5 with strict error checking on.
+            }
+        }
+
+        this.verifyOffset();
+
+        if (this.isLocked()) {
+            return false;
+        } else {
+            this._slideStart();
+            return true;
+        }
+    },
+
+    /**
+     * Event that fires when the value of the slider has changed
+     * @method onChange
+     * @param {int} firstOffset the number of pixels the thumb has moved
+     * from its start position. Normal horizontal and vertical sliders will only
+     * have the firstOffset.  Regions will have both, the first is the horizontal
+     * offset, the second the vertical.
+     * @param {int} secondOffset the y offset for region sliders
+     * @deprecated use instance.subscribe("change") instead
+     */
+    onChange: function (firstOffset, secondOffset) { 
+        /* override me */ 
+    },
+
+    /**
+     * Event that fires when the at the beginning of the slider thumb move
+     * @method onSlideStart
+     * @deprecated use instance.subscribe("slideStart") instead
+     */
+    onSlideStart: function () { 
+        /* override me */ 
+    },
+
+    /**
+     * Event that fires at the end of a slider thumb move
+     * @method onSliderEnd
+     * @deprecated use instance.subscribe("slideEnd") instead
+     */
+    onSlideEnd: function () { 
+        /* override me */ 
+    },
+
+    /**
+     * Returns the slider's thumb offset from the start position
+     * @method getValue
+     * @return {int} the current value
+     */
+    getValue: function () { 
+        return this.thumb.getValue();
+    },
+
+    /**
+     * Returns the slider's thumb X offset from the start position
+     * @method getXValue
+     * @return {int} the current horizontal offset
+     */
+    getXValue: function () { 
+        return this.thumb.getXValue();
+    },
+
+    /**
+     * Returns the slider's thumb Y offset from the start position
+     * @method getYValue
+     * @return {int} the current vertical offset
+     */
+    getYValue: function () { 
+        return this.thumb.getYValue();
+    },
+
+    /**
+     * Internal handler for the slider thumb's onChange event
+     * @method handleThumbChange
+     * @private
+     */
+    handleThumbChange: function () { 
+        /*
+        var t = this.thumb;
+        if (t._isRegion) {
+
+            if (!this._silent) {
+                t.onChange(t.getXValue(), t.getYValue());
+                this.fireEvent("change", { x: t.getXValue(), y: t.getYValue() } );
+            }
+        } else {
+            if (!this._silent) {
+                t.onChange(t.getValue());
+                this.fireEvent("change", t.getValue());
+            }
+        }
+        */
+
+    },
+
+    /**
+     * Provides a way to set the value of the slider in code.
+     * @method setValue
+     * @param {int} newOffset the number of pixels the thumb should be
+     * positioned away from the initial start point 
+     * @param {boolean} skipAnim set to true to disable the animation
+     * for this move action (but not others).
+     * @param {boolean} force ignore the locked setting and set value anyway
+     * @param {boolean} silent when true, do not fire events
+     * @return {boolean} true if the move was performed, false if it failed
+     */
+    setValue: function(newOffset, skipAnim, force, silent) {
+
+        this._silent = silent;
+        this.valueChangeSource = this.SOURCE_SET_VALUE;
+
+        if (!this.thumb.available) {
+            this.deferredSetValue = arguments;
+            return false;
+        }
+
+        if (this.isLocked() && !force) {
+            return false;
+        }
+
+        if ( isNaN(newOffset) ) {
+            return false;
+        }
+
+        var t = this.thumb;
+        t.lastOffset = [newOffset, newOffset];
+        var newX, newY;
+        this.verifyOffset(true);
+        if (t._isRegion) {
+            return false;
+        } else if (t._isHoriz) {
+            this._slideStart();
+            // this.fireEvent("slideStart");
+            newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+            this.moveThumb(newX, t.initPageY, skipAnim);
+        } else {
+            this._slideStart();
+            // this.fireEvent("slideStart");
+            newY = t.initPageY + newOffset + this.thumbCenterPoint.y;
+            this.moveThumb(t.initPageX, newY, skipAnim);
+        }
+
+        return true;
+    },
+
+    /**
+     * Provides a way to set the value of the region slider in code.
+     * @method setRegionValue
+     * @param {int} newOffset the number of pixels the thumb should be
+     * positioned away from the initial start point (x axis for region)
+     * @param {int} newOffset2 the number of pixels the thumb should be
+     * positioned away from the initial start point (y axis for region)
+     * @param {boolean} skipAnim set to true to disable the animation
+     * for this move action (but not others).
+     * @param {boolean} force ignore the locked setting and set value anyway
+     * @param {boolean} silent when true, do not fire events
+     * @return {boolean} true if the move was performed, false if it failed
+     */
+    setRegionValue: function(newOffset, newOffset2, skipAnim, force, silent) {
+
+        this._silent = silent;
+
+        this.valueChangeSource = this.SOURCE_SET_VALUE;
+
+        if (!this.thumb.available) {
+            this.deferredSetRegionValue = arguments;
+            return false;
+        }
+
+        if (this.isLocked() && !force) {
+            return false;
+        }
+
+        if ( isNaN(newOffset) ) {
+            return false;
+        }
+
+        var t = this.thumb;
+        t.lastOffset = [newOffset, newOffset2];
+        this.verifyOffset(true);
+        if (t._isRegion) {
+            this._slideStart();
+            var newX = t.initPageX + newOffset + this.thumbCenterPoint.x;
+            var newY = t.initPageY + newOffset2 + this.thumbCenterPoint.y;
+            this.moveThumb(newX, newY, skipAnim);
+            return true;
+        }
+
+        return false;
+
+    },
+
+    /**
+     * Checks the background position element position.  If it has moved from the
+     * baseline position, the constraints for the thumb are reset
+     * @param checkPos {boolean} check the position instead of using cached value
+     * @method verifyOffset
+     * @return {boolean} True if the offset is the same as the baseline.
+     */
+    verifyOffset: function(checkPos) {
+
+        var newPos = YAHOO.util.Dom.getXY(this.getEl());
+        //var newPos = [this.initPageX, this.initPageY];
+
+        if (newPos) {
+
+
+            if (newPos[0] != this.baselinePos[0] || newPos[1] != this.baselinePos[1]) {
+                this.thumb.resetConstraints();
+                this.baselinePos = newPos;
+                return false;
+            }
+        }
+
+        return true;
+    },
+
+    /**
+     * Move the associated slider moved to a timeout to try to get around the 
+     * mousedown stealing moz does when I move the slider element between the 
+     * cursor and the background during the mouseup event
+     * @method moveThumb
+     * @param {int} x the X coordinate of the click
+     * @param {int} y the Y coordinate of the click
+     * @param {boolean} skipAnim don't animate if the move happend onDrag
+     * @param {boolean} midMove set to true if this is not terminating
+     * the slider movement
+     * @private
+     */
+    moveThumb: function(x, y, skipAnim, midMove) {
+
+
+        var t = this.thumb;
+        var self = this;
+
+        if (!t.available) {
+            return;
+        }
+
+
+        // this.verifyOffset();
+
+        t.setDelta(this.thumbCenterPoint.x, this.thumbCenterPoint.y);
+
+        var _p = t.getTargetCoord(x, y);
+        var p = [_p.x, _p.y];
+
+        this._slideStart();
+
+        if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && t._graduated && !skipAnim) {
+            // this.thumb._animating = true;
+            this.lock();
+
+            // cache the current thumb pos
+            this.curCoord = YAHOO.util.Dom.getXY(this.thumb.getEl());
+
+            setTimeout( function() { self.moveOneTick(p); }, this.tickPause );
+
+        } else if (this.animate && YAHOO.widget.Slider.ANIM_AVAIL && !skipAnim) {
+
+            // this.thumb._animating = true;
+            this.lock();
+
+            var oAnim = new YAHOO.util.Motion( 
+                    t.id, { points: { to: p } }, 
+                    this.animationDuration, 
+                    YAHOO.util.Easing.easeOut );
+
+            oAnim.onComplete.subscribe( function() { 
+                    
+                    self.endMove(); 
+                } );
+            oAnim.animate();
+        } else {
+            t.setDragElPos(x, y);
+            // this.fireEvents();
+            if (!midMove) {
+                this.endMove();
+            }
+        }
+    },
+
+    _slideStart: function() {
+        if (!this._sliding) {
+            if (!this._silent) {
+                this.onSlideStart();
+                this.fireEvent("slideStart");
+            }
+            this._sliding = true;
+        }
+    },
+
+    _slideEnd: function() {
+
+        if (this._sliding && this.moveComplete) {
+            if (!this._silent) {
+                this.onSlideEnd();
+                this.fireEvent("slideEnd");
+            }
+            this._sliding = false;
+            this._silent = false;
+            this.moveComplete = false;
+        }
+    },
+
+    /**
+     * Move the slider one tick mark towards its final coordinate.  Used
+     * for the animation when tick marks are defined
+     * @method moveOneTick
+     * @param {int[]} the destination coordinate
+     * @private
+     */
+    moveOneTick: function(finalCoord) {
+
+        var t = this.thumb, tmp;
+
+
+        // redundant call to getXY since we set the position most of time prior 
+        // to getting here.  Moved to this.curCoord
+        //var curCoord = YAHOO.util.Dom.getXY(t.getEl());
+
+        // alignElWithMouse caches position in lastPageX, lastPageY .. doesn't work
+        //var curCoord = [this.lastPageX, this.lastPageY];
+
+        // var thresh = Math.min(t.tickSize + (Math.floor(t.tickSize/2)), 10);
+        // var thresh = 10;
+        // var thresh = t.tickSize + (Math.floor(t.tickSize/2));
+
+        var nextCoord = null;
+
+        if (t._isRegion) {
+            nextCoord = this._getNextX(this.curCoord, finalCoord);
+            var tmpX = (nextCoord) ? nextCoord[0] : this.curCoord[0];
+            nextCoord = this._getNextY([tmpX, this.curCoord[1]], finalCoord);
+
+        } else if (t._isHoriz) {
+            nextCoord = this._getNextX(this.curCoord, finalCoord);
+        } else {
+            nextCoord = this._getNextY(this.curCoord, finalCoord);
+        }
+
+
+        if (nextCoord) {
+
+            // cache the position
+            this.curCoord = nextCoord;
+
+            // move to the next coord
+            // YAHOO.util.Dom.setXY(t.getEl(), nextCoord);
+
+            // var el = t.getEl();
+            // YAHOO.util.Dom.setStyle(el, "left", (nextCoord[0] + this.thumb.deltaSetXY[0]) + "px");
+            // YAHOO.util.Dom.setStyle(el, "top",  (nextCoord[1] + this.thumb.deltaSetXY[1]) + "px");
+
+            this.thumb.alignElWithMouse(t.getEl(), nextCoord[0], nextCoord[1]);
+            
+            // check if we are in the final position, if not make a recursive call
+            if (!(nextCoord[0] == finalCoord[0] && nextCoord[1] == finalCoord[1])) {
+                var self = this;
+                setTimeout(function() { self.moveOneTick(finalCoord); }, 
+                        this.tickPause);
+            } else {
+                this.endMove();
+            }
+        } else {
+            this.endMove();
+        }
+
+        //this.tickPause = Math.round(this.tickPause/2);
+    },
+
+    /**
+     * Returns the next X tick value based on the current coord and the target coord.
+     * @method _getNextX
+     * @private
+     */
+    _getNextX: function(curCoord, finalCoord) {
+        var t = this.thumb;
+        var thresh;
+        var tmp = [];
+        var nextCoord = null;
+        if (curCoord[0] > finalCoord[0]) {
+            thresh = t.tickSize - this.thumbCenterPoint.x;
+            tmp = t.getTargetCoord( curCoord[0] - thresh, curCoord[1] );
+            nextCoord = [tmp.x, tmp.y];
+        } else if (curCoord[0] < finalCoord[0]) {
+            thresh = t.tickSize + this.thumbCenterPoint.x;
+            tmp = t.getTargetCoord( curCoord[0] + thresh, curCoord[1] );
+            nextCoord = [tmp.x, tmp.y];
+        } else {
+            // equal, do nothing
+        }
+
+        return nextCoord;
+    },
+
+    /**
+     * Returns the next Y tick value based on the current coord and the target coord.
+     * @method _getNextY
+     * @private
+     */
+    _getNextY: function(curCoord, finalCoord) {
+        var t = this.thumb;
+        var thresh;
+        var tmp = [];
+        var nextCoord = null;
+
+        if (curCoord[1] > finalCoord[1]) {
+            thresh = t.tickSize - this.thumbCenterPoint.y;
+            tmp = t.getTargetCoord( curCoord[0], curCoord[1] - thresh );
+            nextCoord = [tmp.x, tmp.y];
+        } else if (curCoord[1] < finalCoord[1]) {
+            thresh = t.tickSize + this.thumbCenterPoint.y;
+            tmp = t.getTargetCoord( curCoord[0], curCoord[1] + thresh );
+            nextCoord = [tmp.x, tmp.y];
+        } else {
+            // equal, do nothing
+        }
+
+        return nextCoord;
+    },
+
+    /**
+     * Resets the constraints before moving the thumb.
+     * @method b4MouseDown
+     * @private
+     */
+    b4MouseDown: function(e) {
+        this.thumb.autoOffset();
+        this.thumb.resetConstraints();
+    },
+
+
+    /**
+     * Handles the mousedown event for the slider background
+     * @method onMouseDown
+     * @private
+     */
+    onMouseDown: function(e) {
+        // this.resetConstraints(true);
+        // this.thumb.resetConstraints(true);
+
+        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);
+        }
+        
+    },
+
+    /**
+     * Handles the onDrag event for the slider background
+     * @method onDrag
+     * @private
+     */
+    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, true);
+        }
+    },
+
+    /**
+     * Fired when the slider movement ends
+     * @method endMove
+     * @private
+     */
+    endMove: function () {
+        // this._animating = false;
+        this.unlock();
+        this.moveComplete = true;
+        this.fireEvents();
+    },
+
+    /**
+     * Fires the change event if the value has been changed.  Ignored if we are in
+     * the middle of an animation as the event will fire when the animation is
+     * complete
+     * @method fireEvents
+     * @param {boolean} thumbEvent set to true if this event is fired from an event
+     *                  that occurred on the thumb.  If it is, the state of the
+     *                  thumb dd object should be correct.  Otherwise, the event
+     *                  originated on the background, so the thumb state needs to
+     *                  be refreshed before proceeding.
+     * @private
+     */
+    fireEvents: function (thumbEvent) {
+
+        var t = this.thumb;
+
+        if (!thumbEvent) {
+            t.cachePosition();
+        }
+
+        if (! this.isLocked()) {
+            if (t._isRegion) {
+                var newX = t.getXValue();
+                var newY = t.getYValue();
+
+                if (newX != this.previousX || newY != this.previousY) {
+                    if (!this._silent) {
+                        this.onChange(newX, newY);
+                        this.fireEvent("change", { x: newX, y: newY });
+                    }
+                }
+
+                this.previousX = newX;
+                this.previousY = newY;
+
+            } else {
+                var newVal = t.getValue();
+                if (newVal != this.previousVal) {
+                    if (!this._silent) {
+                        this.onChange( newVal );
+                        this.fireEvent("change", newVal);
+                    }
+                }
+                this.previousVal = newVal;
+            }
+
+            this._slideEnd();
+
+        }
+    },
+
+    /**
+     * Slider toString
+     * @method toString
+     * @return {string} string representation of the instance
+     */
+    toString: function () { 
+        return ("Slider (" + this.type +") " + this.id);
+    }
+
+});
+
+YAHOO.augment(YAHOO.widget.Slider, YAHOO.util.EventProvider);
+
+/**
+ * A drag and drop implementation to be used as the thumb of a slider.
+ * @class SliderThumb
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the slider html element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {int} iLeft the number of pixels the element can move left
+ * @param {int} iRight the number of pixels the element can move right
+ * @param {int} iUp the number of pixels the element can move up
+ * @param {int} iDown the number of pixels the element can move down
+ * @param {int} iTickSize optional parameter for specifying that the element 
+ * should move a certain number pixels at a time.
+ */
+YAHOO.widget.SliderThumb = function(id, sGroup, iLeft, iRight, iUp, iDown, iTickSize) {
+
+    if (id) {
+        //this.init(id, sGroup);
+        YAHOO.widget.SliderThumb.superclass.constructor.call(this, id, sGroup);
+
+        /**
+         * The id of the thumbs parent HTML element (the slider background 
+         * element).
+         * @property parentElId
+         * @type string
+         */
+        this.parentElId = sGroup;
+    }
+
+
+    //this.removeInvalidHandleType("A");
+
+
+    /**
+     * Overrides the isTarget property in YAHOO.util.DragDrop
+     * @property isTarget
+     * @private
+     */
+    this.isTarget = false;
+
+    /**
+     * The tick size for this slider
+     * @property tickSize
+     * @type int
+     * @private
+     */
+    this.tickSize = iTickSize;
+
+    /**
+     * Informs the drag and drop util that the offsets should remain when
+     * resetting the constraints.  This preserves the slider value when
+     * the constraints are reset
+     * @property maintainOffset
+     * @type boolean
+     * @private
+     */
+    this.maintainOffset = true;
+
+    this.initSlider(iLeft, iRight, iUp, iDown, iTickSize);
+
+    /**
+     * Turns off the autoscroll feature in drag and drop
+     * @property scroll
+     * @private
+     */
+    this.scroll = false;
+
+}; 
+
+YAHOO.extend(YAHOO.widget.SliderThumb, YAHOO.util.DD, {
+
+    /**
+     * The (X and Y) difference between the thumb location and its parent 
+     * (the slider background) when the control is instantiated.
+     * @property startOffset
+     * @type [int, int]
+     */
+    startOffset: null,
+
+    /**
+     * Flag used to figure out if this is a horizontal or vertical slider
+     * @property _isHoriz
+     * @type boolean
+     * @private
+     */
+    _isHoriz: false,
+
+    /**
+     * Cache the last value so we can check for change
+     * @property _prevVal
+     * @type int
+     * @private
+     */
+    _prevVal: 0,
+
+    /**
+     * The slider is _graduated if there is a tick interval defined
+     * @property _graduated
+     * @type boolean
+     * @private
+     */
+    _graduated: false,
+
+
+    /**
+     * Returns the difference between the location of the thumb and its parent.
+     * @method getOffsetFromParent
+     * @param {[int, int]} parentPos Optionally accepts the position of the parent
+     * @type [int, int]
+     */
+    getOffsetFromParent0: function(parentPos) {
+        var myPos = YAHOO.util.Dom.getXY(this.getEl());
+        var ppos  = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
+
+        return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
+    },
+
+    getOffsetFromParent: function(parentPos) {
+
+        var el = this.getEl(), newOffset;
+
+        if (!this.deltaOffset) {
+
+            var myPos = YAHOO.util.Dom.getXY(el);
+            var ppos  = parentPos || YAHOO.util.Dom.getXY(this.parentElId);
+
+            newOffset = [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
+
+            var l = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
+            var t = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
+
+            var deltaX = l - newOffset[0];
+            var deltaY = t - newOffset[1];
+
+            if (isNaN(deltaX) || isNaN(deltaY)) {
+            } else {
+                this.deltaOffset = [deltaX, deltaY];
+            }
+
+        } else {
+            var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
+            var newTop  = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
+
+            newOffset  = [newLeft + this.deltaOffset[0], newTop + this.deltaOffset[1]];
+        }
+
+        return newOffset;
+
+        //return [ (myPos[0] - ppos[0]), (myPos[1] - ppos[1]) ];
+    },
+
+    /**
+     * Set up the slider, must be called in the constructor of all subclasses
+     * @method initSlider
+     * @param {int} iLeft the number of pixels the element can move left
+     * @param {int} iRight the number of pixels the element can move right
+     * @param {int} iUp the number of pixels the element can move up
+     * @param {int} iDown the number of pixels the element can move down
+     * @param {int} iTickSize the width of the tick interval.
+     */
+    initSlider: function (iLeft, iRight, iUp, iDown, iTickSize) {
+
+
+        //document these.  new for 0.12.1
+        this.initLeft = iLeft;
+        this.initRight = iRight;
+        this.initUp = iUp;
+        this.initDown = iDown;
+
+        this.setXConstraint(iLeft, iRight, iTickSize);
+        this.setYConstraint(iUp, iDown, iTickSize);
+
+        if (iTickSize && iTickSize > 1) {
+            this._graduated = true;
+        }
+
+        this._isHoriz  = (iLeft || iRight); 
+        this._isVert   = (iUp   || iDown);
+        this._isRegion = (this._isHoriz && this._isVert); 
+
+    },
+
+    /**
+     * Clear's the slider's ticks
+     * @method clearTicks
+     */
+    clearTicks: function () {
+        YAHOO.widget.SliderThumb.superclass.clearTicks.call(this);
+        this.tickSize = 0;
+        this._graduated = false;
+    },
+
+
+    /**
+     * Gets the current offset from the element's start position in
+     * pixels.
+     * @method getValue
+     * @return {int} the number of pixels (positive or negative) the
+     * slider has moved from the start position.
+     */
+    getValue: function () {
+        return (this._isHoriz) ? this.getXValue() : this.getYValue();
+    },
+
+    /**
+     * Gets the current X offset from the element's start position in
+     * pixels.
+     * @method getXValue
+     * @return {int} the number of pixels (positive or negative) the
+     * slider has moved horizontally from the start position.
+     */
+    getXValue: function () {
+        if (!this.available) { 
+            return 0; 
+        }
+        var newOffset = this.getOffsetFromParent();
+        if (YAHOO.lang.isNumber(newOffset[0])) {
+            this.lastOffset = newOffset;
+            return (newOffset[0] - this.startOffset[0]);
+        } else {
+            return (this.lastOffset[0] - this.startOffset[0]);
+        }
+    },
+
+    /**
+     * Gets the current Y offset from the element's start position in
+     * pixels.
+     * @method getYValue
+     * @return {int} the number of pixels (positive or negative) the
+     * slider has moved vertically from the start position.
+     */
+    getYValue: function () {
+        if (!this.available) { 
+            return 0; 
+        }
+        var newOffset = this.getOffsetFromParent();
+        if (YAHOO.lang.isNumber(newOffset[1])) {
+            this.lastOffset = newOffset;
+            return (newOffset[1] - this.startOffset[1]);
+        } else {
+            return (this.lastOffset[1] - this.startOffset[1]);
+        }
+    },
+
+    /**
+     * Thumb toString
+     * @method toString
+     * @return {string} string representation of the instance
+     */
+    toString: function () { 
+        return "SliderThumb " + this.id;
+    },
+
+    /**
+     * The onchange event for the handle/thumb is delegated to the YAHOO.widget.Slider
+     * instance it belongs to.
+     * @method onChange
+     * @private
+     */
+    onChange: function (x, y) { 
+    }
+
+});
+
+YAHOO.register("slider", YAHOO.widget.Slider, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/tabview.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/tabview.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/tabview.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,881 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+(function() {
+
+    /**
+     * The tabview module provides a widget for managing content bound to tabs.
+     * @module tabview
+     * @requires yahoo, dom, event, element
+     *
+     */
+    /**
+     * A widget to control tabbed views.
+     * @namespace YAHOO.widget
+     * @class TabView
+     * @extends YAHOO.util.Element
+     * @constructor
+     * @param {HTMLElement | String | Object} el(optional) The html 
+     * element that represents the TabView, or the attribute object to use. 
+     * An element will be created if none provided.
+     * @param {Object} attr (optional) A key map of the tabView's 
+     * initial attributes.  Ignored if first arg is attributes object.
+     */
+    YAHOO.widget.TabView = function(el, attr) {
+        attr = attr || {};
+        if (arguments.length == 1 && !YAHOO.lang.isString(el) && !el.nodeName) {
+            attr = el; // treat first arg as attr object
+            el = attr.element || null;
+        }
+        
+        if (!el && !attr.element) { // create if we dont have one
+            el = _createTabViewElement.call(this, attr);
+        }
+    	YAHOO.widget.TabView.superclass.constructor.call(this, el, attr); 
+    };
+
+    YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
+    
+    var proto = YAHOO.widget.TabView.prototype;
+    var Dom = YAHOO.util.Dom;
+    var Event = YAHOO.util.Event;
+    var Tab = YAHOO.widget.Tab;
+    
+    
+    /**
+     * The className to add when building from scratch. 
+     * @property CLASSNAME
+     * @default "navset"
+     */
+    proto.CLASSNAME = 'yui-navset';
+    
+    /**
+     * The className of the HTMLElement containing the TabView's tab elements
+     * to look for when building from existing markup, or to add when building
+     * from scratch. 
+     * All childNodes of the tab container are treated as Tabs when building
+     * from existing markup.
+     * @property TAB_PARENT_CLASSNAME
+     * @default "nav"
+     */
+    proto.TAB_PARENT_CLASSNAME = 'yui-nav';
+    
+    /**
+     * The className of the HTMLElement containing the TabView's label elements
+     * to look for when building from existing markup, or to add when building
+     * from scratch. 
+     * All childNodes of the content container are treated as content elements when
+     * building from existing markup.
+     * @property CONTENT_PARENT_CLASSNAME
+     * @default "nav-content"
+     */
+    proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
+    
+    proto._tabParent = null;
+    proto._contentParent = null; 
+    
+    /**
+     * Adds a Tab to the TabView instance.  
+     * If no index is specified, the tab is added to the end of the tab list.
+     * @method addTab
+     * @param {YAHOO.widget.Tab} tab A Tab instance to add.
+     * @param {Integer} index The position to add the tab. 
+     * @return void
+     */
+    proto.addTab = function(tab, index) {
+        var tabs = this.get('tabs');
+        if (!tabs) { // not ready yet
+            this._queue[this._queue.length] = ['addTab', arguments];
+            return false;
+        }
+        
+        index = (index === undefined) ? tabs.length : index;
+        
+        var before = this.getTab(index);
+        
+        var self = this;
+        var el = this.get('element');
+        var tabParent = this._tabParent;
+        var contentParent = this._contentParent;
+
+        var tabElement = tab.get('element');
+        var contentEl = tab.get('contentEl');
+
+        if ( before ) {
+            tabParent.insertBefore(tabElement, before.get('element'));
+        } else {
+            tabParent.appendChild(tabElement);
+        }
+
+        if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
+            contentParent.appendChild(contentEl);
+        }
+        
+        if ( !tab.get('active') ) {
+            tab.set('contentVisible', false, true); /* hide if not active */
+        } else {
+            this.set('activeTab', tab, true);
+            
+        }
+
+        var activate = function(e) {
+            YAHOO.util.Event.preventDefault(e);
+            var silent = false;
+
+            if (this == self.get('activeTab')) {
+                silent = true; // dont fire activeTabChange if already active
+            }
+            self.set('activeTab', this, silent);
+        };
+        
+        tab.addListener( tab.get('activationEvent'), activate);
+        
+        tab.addListener('activationEventChange', function(e) {
+            if (e.prevValue != e.newValue) {
+                tab.removeListener(e.prevValue, activate);
+                tab.addListener(e.newValue, activate);
+            }
+        });
+        
+        tabs.splice(index, 0, tab);
+    };
+
+    /**
+     * Routes childNode events.
+     * @method DOMEventHandler
+     * @param {event} e The Dom event that is being handled.
+     * @return void
+     */
+    proto.DOMEventHandler = function(e) {
+        var el = this.get('element');
+        var target = YAHOO.util.Event.getTarget(e);
+        var tabParent = this._tabParent;
+        
+        if (Dom.isAncestor(tabParent, target) ) {
+            var tabEl;
+            var tab = null;
+            var contentEl;
+            var tabs = this.get('tabs');
+
+            for (var i = 0, len = tabs.length; i < len; i++) {
+                tabEl = tabs[i].get('element');
+                contentEl = tabs[i].get('contentEl');
+
+                if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
+                    tab = tabs[i];
+                    break; // note break
+                }
+            } 
+            
+            if (tab) {
+                tab.fireEvent(e.type, e);
+            }
+        }
+    };
+    
+    /**
+     * Returns the Tab instance at the specified index.
+     * @method getTab
+     * @param {Integer} index The position of the Tab.
+     * @return YAHOO.widget.Tab
+     */
+    proto.getTab = function(index) {
+    	return this.get('tabs')[index];
+    };
+    
+    /**
+     * Returns the index of given tab.
+     * @method getTabIndex
+     * @param {YAHOO.widget.Tab} tab The tab whose index will be returned.
+     * @return int
+     */
+    proto.getTabIndex = function(tab) {
+        var index = null;
+        var tabs = this.get('tabs');
+    	for (var i = 0, len = tabs.length; i < len; ++i) {
+            if (tab == tabs[i]) {
+                index = i;
+                break;
+            }
+        }
+        
+        return index;
+    };
+    
+    /**
+     * Removes the specified Tab from the TabView.
+     * @method removeTab
+     * @param {YAHOO.widget.Tab} item The Tab instance to be removed.
+     * @return void
+     */
+    proto.removeTab = function(tab) {
+        var tabCount = this.get('tabs').length;
+
+        var index = this.getTabIndex(tab);
+        var nextIndex = index + 1;
+        if ( tab == this.get('activeTab') ) { // select next tab
+            if (tabCount > 1) {
+                if (index + 1 == tabCount) {
+                    this.set('activeIndex', index - 1);
+                } else {
+                    this.set('activeIndex', index + 1);
+                }
+            }
+        }
+        
+        this._tabParent.removeChild( tab.get('element') );
+        this._contentParent.removeChild( tab.get('contentEl') );
+        this._configs.tabs.value.splice(index, 1);
+    	
+    };
+    
+    /**
+     * Provides a readable name for the TabView instance.
+     * @method toString
+     * @return String
+     */
+    proto.toString = function() {
+        var name = this.get('id') || this.get('tagName');
+        return "TabView " + name; 
+    };
+    
+    /**
+     * The transiton to use when switching between tabs.
+     * @method contentTransition
+     */
+    proto.contentTransition = function(newTab, oldTab) {
+        newTab.set('contentVisible', true);
+        oldTab.set('contentVisible', false);
+    };
+    
+    /**
+     * setAttributeConfigs TabView specific properties.
+     * @method initAttributes
+     * @param {Object} attr Hash of initial attributes
+     */
+    proto.initAttributes = function(attr) {
+        YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
+        
+        if (!attr.orientation) {
+            attr.orientation = 'top';
+        }
+        
+        var el = this.get('element');
+
+        if (!YAHOO.util.Dom.hasClass(el, this.CLASSNAME)) {
+            YAHOO.util.Dom.addClass(el, this.CLASSNAME);        
+        }
+        
+        /**
+         * The Tabs belonging to the TabView instance.
+         * @attribute tabs
+         * @type Array
+         */
+        this.setAttributeConfig('tabs', {
+            value: [],
+            readOnly: true
+        });
+
+        /**
+         * The container of the tabView's label elements.
+         * @property _tabParent
+         * @private
+         * @type HTMLElement
+         */
+        this._tabParent = 
+                this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
+                        'ul' )[0] || _createTabParent.call(this);
+            
+        /**
+         * The container of the tabView's content elements.
+         * @property _contentParent
+         * @type HTMLElement
+         * @private
+         */
+        this._contentParent = 
+                this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
+                        'div')[0] ||  _createContentParent.call(this);
+        
+        /**
+         * How the Tabs should be oriented relative to the TabView.
+         * @attribute orientation
+         * @type String
+         * @default "top"
+         */
+        this.setAttributeConfig('orientation', {
+            value: attr.orientation,
+            method: function(value) {
+                var current = this.get('orientation');
+                this.addClass('yui-navset-' + value);
+                
+                if (current != value) {
+                    this.removeClass('yui-navset-' + current);
+                }
+                
+                switch(value) {
+                    case 'bottom':
+                    this.appendChild(this._tabParent);
+                    break;
+                }
+            }
+        });
+        
+        /**
+         * The index of the tab currently active.
+         * @attribute activeIndex
+         * @type Int
+         */
+        this.setAttributeConfig('activeIndex', {
+            value: attr.activeIndex,
+            method: function(value) {
+                this.set('activeTab', this.getTab(value));
+            },
+            validator: function(value) {
+                return !this.getTab(value).get('disabled'); // cannot activate if disabled
+            }
+        });
+        
+        /**
+         * The tab currently active.
+         * @attribute activeTab
+         * @type YAHOO.widget.Tab
+         */
+        this.setAttributeConfig('activeTab', {
+            value: attr.activeTab,
+            method: function(tab) {
+                var activeTab = this.get('activeTab');
+                
+                if (tab) {  
+                    tab.set('active', true);
+                    this._configs['activeIndex'].value = this.getTabIndex(tab); // keep in sync
+                }
+                
+                if (activeTab && activeTab != tab) {
+                    activeTab.set('active', false);
+                }
+                
+                if (activeTab && tab != activeTab) { // no transition if only 1
+                    this.contentTransition(tab, activeTab);
+                } else if (tab) {
+                    tab.set('contentVisible', true);
+                }
+            },
+            validator: function(value) {
+                return !value.get('disabled'); // cannot activate if disabled
+            }
+        });
+
+        if ( this._tabParent ) {
+            _initTabs.call(this);
+        }
+        
+        // Due to delegation we add all DOM_EVENTS to the TabView container
+        // but IE will leak when unsupported events are added, so remove these
+        this.DOM_EVENTS.submit = false;
+        this.DOM_EVENTS.focus = false;
+        this.DOM_EVENTS.blur = false;
+
+        for (var type in this.DOM_EVENTS) {
+            if ( YAHOO.lang.hasOwnProperty(this.DOM_EVENTS, type) ) {
+                this.addListener.call(this, type, this.DOMEventHandler);
+            }
+        }
+    };
+    
+    /**
+     * Creates Tab instances from a collection of HTMLElements.
+     * @method initTabs
+     * @private
+     * @return void
+     */
+    var _initTabs = function() {
+        var tab,
+            attr,
+            contentEl;
+            
+        var el = this.get('element');   
+        var tabs = _getChildNodes(this._tabParent);
+        var contentElements = _getChildNodes(this._contentParent);
+
+        for (var i = 0, len = tabs.length; i < len; ++i) {
+            attr = {};
+            
+            if (contentElements[i]) {
+                attr.contentEl = contentElements[i];
+            }
+
+            tab = new YAHOO.widget.Tab(tabs[i], attr);
+            this.addTab(tab);
+            
+            if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
+                this._configs.activeTab.value = tab; // dont invoke method
+                this._configs.activeIndex.value = this.getTabIndex(tab);
+            }
+        }
+    };
+    
+    var _createTabViewElement = function(attr) {
+        var el = document.createElement('div');
+
+        if ( this.CLASSNAME ) {
+            el.className = this.CLASSNAME;
+        }
+        
+        return el;
+    };
+    
+    var _createTabParent = function(attr) {
+        var el = document.createElement('ul');
+
+        if ( this.TAB_PARENT_CLASSNAME ) {
+            el.className = this.TAB_PARENT_CLASSNAME;
+        }
+        
+        this.get('element').appendChild(el);
+        
+        return el;
+    };
+    
+    var _createContentParent = function(attr) {
+        var el = document.createElement('div');
+
+        if ( this.CONTENT_PARENT_CLASSNAME ) {
+            el.className = this.CONTENT_PARENT_CLASSNAME;
+        }
+        
+        this.get('element').appendChild(el);
+        
+        return el;
+    };
+    
+    var _getChildNodes = function(el) {
+        var nodes = [];
+        var childNodes = el.childNodes;
+        
+        for (var i = 0, len = childNodes.length; i < len; ++i) {
+            if (childNodes[i].nodeType == 1) {
+                nodes[nodes.length] = childNodes[i];
+            }
+        }
+        
+        return nodes;
+    };
+})();
+
+(function() {
+    var Dom = YAHOO.util.Dom,
+        Event = YAHOO.util.Event;
+    
+    /**
+     * A representation of a Tab's label and content.
+     * @namespace YAHOO.widget
+     * @class Tab
+     * @extends YAHOO.util.Element
+     * @constructor
+     * @param element {HTMLElement | String} (optional) The html element that 
+     * represents the TabView. An element will be created if none provided.
+     * @param {Object} properties A key map of initial properties
+     */
+    var Tab = function(el, attr) {
+        attr = attr || {};
+        if (arguments.length == 1 && !YAHOO.lang.isString(el) && !el.nodeName) {
+            attr = el;
+            el = attr.element;
+        }
+
+        if (!el && !attr.element) {
+            el = _createTabElement.call(this, attr);
+        }
+
+        this.loadHandler =  {
+            success: function(o) {
+                this.set('content', o.responseText);
+            },
+            failure: function(o) {
+            }
+        };
+        
+        Tab.superclass.constructor.call(this, el, attr);
+        
+        this.DOM_EVENTS = {}; // delegating to tabView
+    };
+
+    YAHOO.extend(Tab, YAHOO.util.Element);
+    var proto = Tab.prototype;
+    
+    /**
+     * The default tag name for a Tab's inner element.
+     * @property LABEL_INNER_TAGNAME
+     * @type String
+     * @default "em"
+     */
+    proto.LABEL_TAGNAME = 'em';
+    
+    /**
+     * The class name applied to active tabs.
+     * @property ACTIVE_CLASSNAME
+     * @type String
+     * @default "selected"
+     */
+    proto.ACTIVE_CLASSNAME = 'selected';
+    
+    /**
+     * The class name applied to disabled tabs.
+     * @property DISABLED_CLASSNAME
+     * @type String
+     * @default "disabled"
+     */
+    proto.DISABLED_CLASSNAME = 'disabled';
+    
+    /**
+     * The class name applied to dynamic tabs while loading.
+     * @property LOADING_CLASSNAME
+     * @type String
+     * @default "disabled"
+     */
+    proto.LOADING_CLASSNAME = 'loading';
+
+    /**
+     * Provides a reference to the connection request object when data is
+     * loaded dynamically.
+     * @property dataConnection
+     * @type Object
+     */
+    proto.dataConnection = null;
+    
+    /**
+     * Object containing success and failure callbacks for loading data.
+     * @property loadHandler
+     * @type object
+     */
+    proto.loadHandler = null;
+
+    proto._loading = false;
+    
+    /**
+     * Provides a readable name for the tab.
+     * @method toString
+     * @return String
+     */
+    proto.toString = function() {
+        var el = this.get('element');
+        var id = el.id || el.tagName;
+        return "Tab " + id; 
+    };
+    
+    /**
+     * setAttributeConfigs TabView specific properties.
+     * @method initAttributes
+     * @param {Object} attr Hash of initial attributes
+     */
+    proto.initAttributes = function(attr) {
+        attr = attr || {};
+        Tab.superclass.initAttributes.call(this, attr);
+        
+        var el = this.get('element');
+        
+        /**
+         * The event that triggers the tab's activation.
+         * @attribute activationEvent
+         * @type String
+         */
+        this.setAttributeConfig('activationEvent', {
+            value: attr.activationEvent || 'click'
+        });        
+
+        /**
+         * The element that contains the tab's label.
+         * @attribute labelEl
+         * @type HTMLElement
+         */
+        this.setAttributeConfig('labelEl', {
+            value: attr.labelEl || _getlabelEl.call(this),
+            method: function(value) {
+                var current = this.get('labelEl');
+
+                if (current) {
+                    if (current == value) {
+                        return false; // already set
+                    }
+                    
+                    this.replaceChild(value, current);
+                } else if (el.firstChild) { // ensure label is firstChild by default
+                    this.insertBefore(value, el.firstChild);
+                } else {
+                    this.appendChild(value);
+                }  
+            } 
+        });
+
+        /**
+         * The tab's label text (or innerHTML).
+         * @attribute label
+         * @type String
+         */
+        this.setAttributeConfig('label', {
+            value: attr.label || _getLabel.call(this),
+            method: function(value) {
+                var labelEl = this.get('labelEl');
+                if (!labelEl) { // create if needed
+                    this.set('labelEl', _createlabelEl.call(this));
+                }
+                
+                _setLabel.call(this, value);
+            }
+        });
+        
+        /**
+         * The HTMLElement that contains the tab's content.
+         * @attribute contentEl
+         * @type HTMLElement
+         */
+        this.setAttributeConfig('contentEl', {
+            value: attr.contentEl || document.createElement('div'),
+            method: function(value) {
+                var current = this.get('contentEl');
+
+                if (current) {
+                    if (current == value) {
+                        return false; // already set
+                    }
+                    this.replaceChild(value, current);
+                }
+            }
+        });
+        
+        /**
+         * The tab's content.
+         * @attribute content
+         * @type String
+         */
+        this.setAttributeConfig('content', {
+            value: attr.content,
+            method: function(value) {
+                this.get('contentEl').innerHTML = value;
+            }
+        });
+
+        var _dataLoaded = false;
+        
+        /**
+         * The tab's data source, used for loading content dynamically.
+         * @attribute dataSrc
+         * @type String
+         */
+        this.setAttributeConfig('dataSrc', {
+            value: attr.dataSrc
+        });
+        
+        /**
+         * Whether or not content should be reloaded for every view.
+         * @attribute cacheData
+         * @type Boolean
+         * @default false
+         */
+        this.setAttributeConfig('cacheData', {
+            value: attr.cacheData || false,
+            validator: YAHOO.lang.isBoolean
+        });
+        
+        /**
+         * The method to use for the data request.
+         * @attribute loadMethod
+         * @type String
+         * @default "GET"
+         */
+        this.setAttributeConfig('loadMethod', {
+            value: attr.loadMethod || 'GET',
+            validator: YAHOO.lang.isString
+        });
+
+        /**
+         * Whether or not any data has been loaded from the server.
+         * @attribute dataLoaded
+         * @type Boolean
+         */        
+        this.setAttributeConfig('dataLoaded', {
+            value: false,
+            validator: YAHOO.lang.isBoolean,
+            writeOnce: true
+        });
+        
+        /**
+         * Number if milliseconds before aborting and calling failure handler.
+         * @attribute dataTimeout
+         * @type Number
+         * @default null
+         */
+        this.setAttributeConfig('dataTimeout', {
+            value: attr.dataTimeout || null,
+            validator: YAHOO.lang.isNumber
+        });
+        
+        /**
+         * Whether or not the tab is currently active.
+         * If a dataSrc is set for the tab, the content will be loaded from
+         * the given source.
+         * @attribute active
+         * @type Boolean
+         */
+        this.setAttributeConfig('active', {
+            value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
+            method: function(value) {
+                if (value === true) {
+                    this.addClass(this.ACTIVE_CLASSNAME);
+                    this.set('title', 'active');
+                } else {
+                    this.removeClass(this.ACTIVE_CLASSNAME);
+                    this.set('title', '');
+                }
+            },
+            validator: function(value) {
+                return YAHOO.lang.isBoolean(value) && !this.get('disabled') ;
+            }
+        });
+        
+        /**
+         * Whether or not the tab is disabled.
+         * @attribute disabled
+         * @type Boolean
+         */
+        this.setAttributeConfig('disabled', {
+            value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
+            method: function(value) {
+                if (value === true) {
+                    Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
+                } else {
+                    Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
+                }
+            },
+            validator: YAHOO.lang.isBoolean
+        });
+        
+        /**
+         * The href of the tab's anchor element.
+         * @attribute href
+         * @type String
+         * @default '#'
+         */
+        this.setAttributeConfig('href', {
+            value: attr.href ||
+                    this.getElementsByTagName('a')[0].getAttribute('href', 2) || '#',
+            method: function(value) {
+                this.getElementsByTagName('a')[0].href = value;
+            },
+            validator: YAHOO.lang.isString
+        });
+        
+        /**
+         * The Whether or not the tab's content is visible.
+         * @attribute contentVisible
+         * @type Boolean
+         * @default false
+         */
+        this.setAttributeConfig('contentVisible', {
+            value: attr.contentVisible,
+            method: function(value) {
+                if (value) {
+                    this.get('contentEl').style.display = 'block';
+                    
+                    if ( this.get('dataSrc') ) {
+                     // load dynamic content unless already loading or loaded and caching
+                        if ( !this._loading && !(this.get('dataLoaded') && this.get('cacheData')) ) {
+                            _dataConnect.call(this);
+                        }
+                    }
+                } else {
+                    this.get('contentEl').style.display = 'none';
+                }
+            },
+            validator: YAHOO.lang.isBoolean
+        });
+    };
+    
+    var _createTabElement = function(attr) {
+        var el = document.createElement('li');
+        var a = document.createElement('a');
+        
+        a.href = attr.href || '#';
+        
+        el.appendChild(a);
+        
+        var label = attr.label || null;
+        var labelEl = attr.labelEl || null;
+        
+        if (labelEl) { // user supplied labelEl
+            if (!label) { // user supplied label
+                label = _getLabel.call(this, labelEl);
+            }
+        } else {
+            labelEl = _createlabelEl.call(this);
+        }
+        
+        a.appendChild(labelEl);
+        
+        return el;
+    };
+    
+    var _getlabelEl = function() {
+        return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
+    };
+    
+    var _createlabelEl = function() {
+        var el = document.createElement(this.LABEL_TAGNAME);
+        return el;
+    };
+    
+    var _setLabel = function(label) {
+        var el = this.get('labelEl');
+        el.innerHTML = label;
+    };
+    
+    var _getLabel = function() {
+        var label,
+            el = this.get('labelEl');
+            
+            if (!el) {
+                return undefined;
+            }
+        
+        return el.innerHTML;
+    };
+    
+    var _dataConnect = function() {
+        if (!YAHOO.util.Connect) {
+            return false;
+        }
+
+        Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
+        this._loading = true; 
+        this.dataConnection = YAHOO.util.Connect.asyncRequest(
+            this.get('loadMethod'),
+            this.get('dataSrc'), 
+            {
+                success: function(o) {
+                    this.loadHandler.success.call(this, o);
+                    this.set('dataLoaded', true);
+                    this.dataConnection = null;
+                    Dom.removeClass(this.get('contentEl').parentNode,
+                            this.LOADING_CLASSNAME);
+                    this._loading = false;
+                },
+                failure: function(o) {
+                    this.loadHandler.failure.call(this, o);
+                    this.dataConnection = null;
+                    Dom.removeClass(this.get('contentEl').parentNode,
+                            this.LOADING_CLASSNAME);
+                    this._loading = false;
+                },
+                scope: this,
+                timeout: this.get('dataTimeout')
+            }
+        );
+    };
+    
+    YAHOO.widget.Tab = Tab;
+})();
+
+YAHOO.register("tabview", YAHOO.widget.TabView, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/treeview.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/treeview.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/treeview.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,2312 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The treeview widget is a generic tree building tool.
+ * @module treeview
+ * @title TreeView Widget
+ * @requires yahoo, event
+ * @optional animation
+ * @namespace YAHOO.widget
+ */
+
+/**
+ * Contains the tree view state data and the root node.
+ *
+ * @class TreeView
+ * @uses YAHOO.util.EventProvider
+ * @constructor
+ * @param {string|HTMLElement} id The id of the element, or the element
+ * itself that the tree will be inserted into.
+ */
+YAHOO.widget.TreeView = function(id) {
+    if (id) { this.init(id); }
+};
+
+YAHOO.widget.TreeView.prototype = {
+
+    /**
+     * The id of tree container element
+     * @property id
+     * @type String
+     */
+    id: null,
+
+    /**
+     * The host element for this tree
+     * @property _el
+     * @private
+     */
+    _el: null,
+
+     /**
+     * Flat collection of all nodes in this tree.  This is a sparse
+     * array, so the length property can't be relied upon for a
+     * node count for the tree.
+     * @property _nodes
+     * @type Node[]
+     * @private
+     */
+    _nodes: null,
+
+    /**
+     * We lock the tree control while waiting for the dynamic loader to return
+     * @property locked
+     * @type boolean
+     */
+    locked: false,
+
+    /**
+     * The animation to use for expanding children, if any
+     * @property _expandAnim
+     * @type string
+     * @private
+     */
+    _expandAnim: null,
+
+    /**
+     * The animation to use for collapsing children, if any
+     * @property _collapseAnim
+     * @type string
+     * @private
+     */
+    _collapseAnim: null,
+
+    /**
+     * The current number of animations that are executing
+     * @property _animCount
+     * @type int
+     * @private
+     */
+    _animCount: 0,
+
+    /**
+     * The maximum number of animations to run at one time.
+     * @property maxAnim
+     * @type int
+     */
+    maxAnim: 2,
+
+    /**
+     * Sets up the animation for expanding children
+     * @method setExpandAnim
+     * @param {string} type the type of animation (acceptable values defined 
+     * in YAHOO.widget.TVAnim)
+     */
+    setExpandAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._expandAnim = type;
+        }
+    },
+
+    /**
+     * Sets up the animation for collapsing children
+     * @method setCollapseAnim
+     * @param {string} the type of animation (acceptable values defined in 
+     * YAHOO.widget.TVAnim)
+     */
+    setCollapseAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._collapseAnim = type;
+        }
+    },
+
+    /**
+     * Perform the expand animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     * @method animateExpand
+     * @param el {HTMLElement} the element to animate
+     * @param node {YAHOO.util.Node} the node that was expanded
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateExpand: function(el, node) {
+
+        if (this._expandAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el, 
+                            function() { tree.expandComplete(node); });
+            if (a) { 
+                ++this._animCount;
+                this.fireEvent("animStart", {
+                        "node": node, 
+                        "type": "expand"
+                    });
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Perform the collapse animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     * @method animateCollapse
+     * @param el {HTMLElement} the element to animate
+     * @param node {YAHOO.util.Node} the node that was expanded
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateCollapse: function(el, node) {
+
+        if (this._collapseAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el, 
+                            function() { tree.collapseComplete(node); });
+            if (a) { 
+                ++this._animCount;
+                this.fireEvent("animStart", {
+                        "node": node, 
+                        "type": "collapse"
+                    });
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Function executed when the expand animation completes
+     * @method expandComplete
+     */
+    expandComplete: function(node) {
+        --this._animCount;
+        this.fireEvent("animComplete", {
+                "node": node, 
+                "type": "expand"
+            });
+        // this.locked = false;
+    },
+
+    /**
+     * Function executed when the collapse animation completes
+     * @method collapseComplete
+     */
+    collapseComplete: function(node) {
+        --this._animCount;
+        this.fireEvent("animComplete", {
+                "node": node, 
+                "type": "collapse"
+            });
+        // this.locked = false;
+    },
+
+    /**
+     * Initializes the tree
+     * @method init
+     * @parm {string|HTMLElement} id the id of the element that will hold the tree
+     * @private
+     */
+    init: function(id) {
+
+        this.id = id;
+
+        if ("string" !== typeof id) {
+            this._el = id;
+            this.id = this.generateId(id);
+        }
+
+        /**
+         * When animation is enabled, this event fires when the animation
+         * starts
+         * @event animStart
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+         * @parm {String} type the type of animation ("expand" or "collapse")
+         */
+        this.createEvent("animStart", this);
+
+        /**
+         * When animation is enabled, this event fires when the animation
+         * completes
+         * @event animComplete
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that is expanding/collapsing
+         * @parm {String} type the type of animation ("expand" or "collapse")
+         */
+        this.createEvent("animComplete", this);
+
+        /**
+         * Fires when a node is going to be collapsed.  Return false to stop
+         * the collapse.
+         * @event collapse
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that is collapsing
+         */
+        this.createEvent("collapse", this);
+
+        /**
+         * Fires after a node is successfully collapsed.  This event will not fire
+         * if the "collapse" event was cancelled.
+         * @event collapseComplete
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that was collapsed
+         */
+        this.createEvent("collapseComplete", this);
+
+        /**
+         * Fires when a node is going to be expanded.  Return false to stop
+         * the collapse.
+         * @event expand
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that is expanding
+         */
+        this.createEvent("expand", this);
+
+        /**
+         * Fires after a node is successfully expanded.  This event will not fire
+         * if the "expand" event was cancelled.
+         * @event expandComplete
+         * @type CustomEvent
+         * @param {YAHOO.widget.Node} node the node that was expanded
+         */
+        this.createEvent("expandComplete", this);
+
+        this._nodes = [];
+
+        // store a global reference
+        YAHOO.widget.TreeView.trees[this.id] = this;
+
+        // Set up the root node
+        this.root = new YAHOO.widget.RootNode(this);
+
+        var LW = YAHOO.widget.LogWriter;
+
+
+
+        // YAHOO.util.Event.onContentReady(this.id, this.handleAvailable, this, true);
+        // YAHOO.util.Event.on(this.id, "click", this.handleClick, this, true);
+    },
+
+    //handleAvailable: function() {
+        //var Event = YAHOO.util.Event;
+        //Event.on(this.id, 
+    //},
+
+    /**
+     * Renders the tree boilerplate and visible nodes
+     * @method draw
+     */
+    draw: function() {
+        var html = this.root.getHtml();
+        this.getEl().innerHTML = html;
+        this.firstDraw = false;
+    },
+
+    /**
+     * Returns the tree's host element
+     * @method getEl
+     * @return {HTMLElement} the host element
+     */
+    getEl: function() {
+        if (! this._el) {
+            this._el = document.getElementById(this.id);
+        }
+        return this._el;
+    },
+
+    /**
+     * Nodes register themselves with the tree instance when they are created.
+     * @method regNode
+     * @param node {Node} the node to register
+     * @private
+     */
+    regNode: function(node) {
+        this._nodes[node.index] = node;
+    },
+
+    /**
+     * Returns the root node of this tree
+     * @method getRoot
+     * @return {Node} the root node
+     */
+    getRoot: function() {
+        return this.root;
+    },
+
+    /**
+     * Configures this tree to dynamically load all child data
+     * @method setDynamicLoad
+     * @param {function} fnDataLoader the function that will be called to get the data
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the 
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) { 
+        this.root.setDynamicLoad(fnDataLoader, iconMode);
+    },
+
+    /**
+     * Expands all child nodes.  Note: this conflicts with the "multiExpand"
+     * node property.  If expand all is called in a tree with nodes that
+     * do not allow multiple siblings to be displayed, only the last sibling
+     * will be expanded.
+     * @method expandAll
+     */
+    expandAll: function() { 
+        if (!this.locked) {
+            this.root.expandAll(); 
+        }
+    },
+
+    /**
+     * Collapses all expanded child nodes in the entire tree.
+     * @method collapseAll
+     */
+    collapseAll: function() { 
+        if (!this.locked) {
+            this.root.collapseAll(); 
+        }
+    },
+
+    /**
+     * Returns a node in the tree that has the specified index (this index
+     * is created internally, so this function probably will only be used
+     * in html generated for a given node.)
+     * @method getNodeByIndex
+     * @param {int} nodeIndex the index of the node wanted
+     * @return {Node} the node with index=nodeIndex, null if no match
+     */
+    getNodeByIndex: function(nodeIndex) {
+        var n = this._nodes[nodeIndex];
+        return (n) ? n : null;
+    },
+
+    /**
+     * Returns a node that has a matching property and value in the data
+     * object that was passed into its constructor.
+     * @method getNodeByProperty
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Node} the matching node, null if no match
+     */
+    getNodeByProperty: function(property, value) {
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                return n;
+            }
+        }
+
+        return null;
+    },
+
+    /**
+     * Returns a collection of nodes that have a matching property 
+     * and value in the data object that was passed into its constructor.  
+     * @method getNodesByProperty
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Array} the matching collection of nodes, null if no match
+     */
+    getNodesByProperty: function(property, value) {
+        var values = [];
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                values.push(n);
+            }
+        }
+
+        return (values.length) ? values : null;
+    },
+
+    /**
+     * Removes the node and its children, and optionally refreshes the 
+     * branch of the tree that was affected.
+     * @method removeNode
+     * @param {Node} The node to remove
+     * @param {boolean} autoRefresh automatically refreshes branch if true
+     * @return {boolean} False is there was a problem, true otherwise.
+     */
+    removeNode: function(node, autoRefresh) { 
+
+        // Don't delete the root node
+        if (node.isRoot()) {
+            return false;
+        }
+
+        // Get the branch that we may need to refresh
+        var p = node.parent;
+        if (p.parent) {
+            p = p.parent;
+        }
+
+        // Delete the node and its children
+        this._deleteNode(node);
+
+        // Refresh the parent of the parent
+        if (autoRefresh && p && p.childrenRendered) {
+            p.refresh();
+        }
+
+        return true;
+    },
+
+    /**
+     * wait until the animation is complete before deleting 
+     * to avoid javascript errors
+     * @method _removeChildren_animComplete
+     * @param o the custom event payload
+     * @private
+     */
+    _removeChildren_animComplete: function(o) {
+        this.unsubscribe(this._removeChildren_animComplete);
+        this.removeChildren(o.node);
+    },
+
+    /**
+     * Deletes this nodes child collection, recursively.  Also collapses
+     * the node, and resets the dynamic load flag.  The primary use for
+     * this method is to purge a node and allow it to fetch its data
+     * dynamically again.
+     * @method removeChildren
+     * @param {Node} node the node to purge
+     */
+    removeChildren: function(node) { 
+
+        if (node.expanded) {
+            // wait until the animation is complete before deleting to
+            // avoid javascript errors
+            if (this._collapseAnim) {
+                this.subscribe("animComplete", 
+                        this._removeChildren_animComplete, this, true);
+                node.collapse();
+                return;
+            }
+
+            node.collapse();
+        }
+
+        while (node.children.length) {
+            this._deleteNode(node.children[0]);
+        }
+
+        node.childrenRendered = false;
+        node.dynamicLoadComplete = false;
+
+        node.updateIcon();
+    },
+
+    /**
+     * Deletes the node and recurses children
+     * @method _deleteNode
+     * @private
+     */
+    _deleteNode: function(node) { 
+        // Remove all the child nodes first
+        this.removeChildren(node);
+
+        // Remove the node from the tree
+        this.popNode(node);
+    },
+
+    /**
+     * Removes the node from the tree, preserving the child collection 
+     * to make it possible to insert the branch into another part of the 
+     * tree, or another tree.
+     * @method popNode
+     * @param {Node} the node to remove
+     */
+    popNode: function(node) { 
+        var p = node.parent;
+
+        // Update the parent's collection of children
+        var a = [];
+
+        for (var i=0, len=p.children.length;i<len;++i) {
+            if (p.children[i] != node) {
+                a[a.length] = p.children[i];
+            }
+        }
+
+        p.children = a;
+
+        // reset the childrenRendered flag for the parent
+        p.childrenRendered = false;
+
+         // Update the sibling relationship
+        if (node.previousSibling) {
+            node.previousSibling.nextSibling = node.nextSibling;
+        }
+
+        if (node.nextSibling) {
+            node.nextSibling.previousSibling = node.previousSibling;
+        }
+
+        node.parent = null;
+        node.previousSibling = null;
+        node.nextSibling = null;
+        node.tree = null;
+
+        // Update the tree's node collection 
+        delete this._nodes[node.index];
+    },
+
+
+    /**
+     * TreeView instance toString
+     * @method toString
+     * @return {string} string representation of the tree
+     */
+    toString: function() {
+        return "TreeView " + this.id;
+    },
+
+    /**
+     * Generates an unique id for an element if it doesn't yet have one
+     * @method generateId
+     * @private
+     */
+    generateId: function(el) {
+        var id = el.id;
+
+        if (!id) {
+            id = "yui-tv-auto-id-" + YAHOO.widget.TreeView.counter;
+            ++YAHOO.widget.TreeView.counter;
+        }
+
+        return id;
+    },
+
+    /**
+     * Abstract method that is executed when a node is expanded
+     * @method onExpand
+     * @param node {Node} the node that was expanded
+     * @deprecated use treeobj.subscribe("expand") instead
+     */
+    onExpand: function(node) { },
+
+    /**
+     * Abstract method that is executed when a node is collapsed.
+     * @method onCollapse
+     * @param node {Node} the node that was collapsed.
+     * @deprecated use treeobj.subscribe("collapse") instead
+     */
+    onCollapse: function(node) { }
+
+};
+
+YAHOO.augment(YAHOO.widget.TreeView, YAHOO.util.EventProvider);
+
+/**
+ * Running count of all nodes created in all trees.  This is 
+ * used to provide unique identifies for all nodes.  Deleting
+ * nodes does not change the nodeCount.
+ * @property YAHOO.widget.TreeView.nodeCount
+ * @type int
+ * @static
+ */
+YAHOO.widget.TreeView.nodeCount = 0;
+
+/**
+ * Global cache of tree instances
+ * @property YAHOO.widget.TreeView.trees
+ * @type Array
+ * @static
+ * @private
+ */
+YAHOO.widget.TreeView.trees = [];
+
+/**
+ * Counter for generating a new unique element id
+ * @property YAHOO.widget.TreeView.counter
+ * @static
+ * @private
+ */
+YAHOO.widget.TreeView.counter = 0;
+
+/**
+ * Global method for getting a tree by its id.  Used in the generated
+ * tree html.
+ * @method YAHOO.widget.TreeView.getTree
+ * @param treeId {String} the id of the tree instance
+ * @return {TreeView} the tree instance requested, null if not found.
+ * @static
+ */
+YAHOO.widget.TreeView.getTree = function(treeId) {
+    var t = YAHOO.widget.TreeView.trees[treeId];
+    return (t) ? t : null;
+};
+
+
+/**
+ * Global method for getting a node by its id.  Used in the generated
+ * tree html.
+ * @method YAHOO.widget.TreeView.getNode
+ * @param treeId {String} the id of the tree instance
+ * @param nodeIndex {String} the index of the node to return
+ * @return {Node} the node instance requested, null if not found
+ * @static
+ */
+YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) {
+    var t = YAHOO.widget.TreeView.getTree(treeId);
+    return (t) ? t.getNodeByIndex(nodeIndex) : null;
+};
+
+/**
+ * Add a DOM event
+ * @method YAHOO.widget.TreeView.addHandler
+ * @param el the elment to bind the handler to
+ * @param {string} sType the type of event handler
+ * @param {function} fn the callback to invoke
+ * @static
+ */
+YAHOO.widget.TreeView.addHandler = function (el, sType, fn) {
+    if (el.addEventListener) {
+        el.addEventListener(sType, fn, false);
+    } else if (el.attachEvent) {
+        el.attachEvent("on" + sType, fn);
+    }
+};
+
+/**
+ * Remove a DOM event
+ * @method YAHOO.widget.TreeView.removeHandler
+ * @param el the elment to bind the handler to
+ * @param {string} sType the type of event handler
+ * @param {function} fn the callback to invoke
+ * @static
+ */
+
+YAHOO.widget.TreeView.removeHandler = function (el, sType, fn) {
+    if (el.removeEventListener) {
+        el.removeEventListener(sType, fn, false);
+    } else if (el.detachEvent) {
+        el.detachEvent("on" + sType, fn);
+    }
+};
+
+/**
+ * Attempts to preload the images defined in the styles used to draw the tree by
+ * rendering off-screen elements that use the styles.
+ * @method YAHOO.widget.TreeView.preload
+ * @param {string} prefix the prefix to use to generate the names of the
+ * images to preload, default is ygtv
+ * @static
+ */
+YAHOO.widget.TreeView.preload = function(e, prefix) {
+    prefix = prefix || "ygtv";
+
+
+    var styles = ["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];
+    // var styles = ["tp"];
+
+    var sb = [];
+    
+    // save the first one for the outer container
+    for (var i=1; i < styles.length; i=i+1) { 
+        sb[sb.length] = '<span class="' + prefix + styles[i] + '">&#160;</span>';
+    }
+
+    var f = document.createElement("div");
+    var s = f.style;
+    s.className = prefix + styles[0];
+    s.position = "absolute";
+    s.height = "1px";
+    s.width = "1px";
+    s.top = "-1000px";
+    s.left = "-1000px";
+    f.innerHTML = sb.join("");
+
+    document.body.appendChild(f);
+
+    YAHOO.widget.TreeView.removeHandler(window, 
+                "load", YAHOO.widget.TreeView.preload);
+
+};
+
+YAHOO.widget.TreeView.addHandler(window, 
+                "load", YAHOO.widget.TreeView.preload);
+
+/**
+ * The base class for all tree nodes.  The node's presentation and behavior in
+ * response to mouse events is handled in Node subclasses.
+ * @namespace YAHOO.widget
+ * @class Node
+ * @uses YAHOO.util.EventProvider
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.Node = function(oData, oParent, expanded) {
+    if (oData) { this.init(oData, oParent, expanded); }
+};
+
+YAHOO.widget.Node.prototype = {
+
+    /**
+     * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
+     * @property index
+     * @type int
+     */
+    index: 0,
+
+    /**
+     * This node's child node collection.
+     * @property children
+     * @type Node[] 
+     */
+    children: null,
+
+    /**
+     * Tree instance this node is part of
+     * @property tree
+     * @type TreeView
+     */
+    tree: null,
+
+    /**
+     * The data linked to this node.  This can be any object or primitive
+     * value, and the data can be used in getNodeHtml().
+     * @property data
+     * @type object
+     */
+    data: null,
+
+    /**
+     * Parent node
+     * @property parent
+     * @type Node
+     */
+    parent: null,
+
+    /**
+     * The depth of this node.  We start at -1 for the root node.
+     * @property depth
+     * @type int
+     */
+    depth: -1,
+
+    /**
+     * The href for the node's label.  If one is not specified, the href will
+     * be set so that it toggles the node.
+     * @property href
+     * @type string
+     */
+    href: null,
+
+    /**
+     * The label href target, defaults to current window
+     * @property target
+     * @type string
+     */
+    target: "_self",
+
+    /**
+     * The node's expanded/collapsed state
+     * @property expanded
+     * @type boolean
+     */
+    expanded: false,
+
+    /**
+     * Can multiple children be expanded at once?
+     * @property multiExpand
+     * @type boolean
+     */
+    multiExpand: true,
+
+    /**
+     * Should we render children for a collapsed node?  It is possible that the
+     * implementer will want to render the hidden data...  @todo verify that we 
+     * need this, and implement it if we do.
+     * @property renderHidden
+     * @type boolean
+     */
+    renderHidden: false,
+
+    /**
+     * This flag is set to true when the html is generated for this node's
+     * children, and set to false when new children are added.
+     * @property childrenRendered
+     * @type boolean
+     */
+    childrenRendered: false,
+
+    /**
+     * Dynamically loaded nodes only fetch the data the first time they are
+     * expanded.  This flag is set to true once the data has been fetched.
+     * @property dynamicLoadComplete
+     * @type boolean
+     */
+    dynamicLoadComplete: false,
+
+    /**
+     * This node's previous sibling
+     * @property previousSibling
+     * @type Node
+     */
+    previousSibling: null,
+
+    /**
+     * This node's next sibling
+     * @property nextSibling
+     * @type Node
+     */
+    nextSibling: null,
+
+    /**
+     * We can set the node up to call an external method to get the child
+     * data dynamically.
+     * @property _dynLoad
+     * @type boolean
+     * @private
+     */
+    _dynLoad: false,
+
+    /**
+     * Function to execute when we need to get this node's child data.
+     * @property dataLoader
+     * @type function
+     */
+    dataLoader: null,
+
+    /**
+     * This is true for dynamically loading nodes while waiting for the
+     * callback to return.
+     * @property isLoading
+     * @type boolean
+     */
+    isLoading: false,
+
+    /**
+     * The toggle/branch icon will not show if this is set to false.  This
+     * could be useful if the implementer wants to have the child contain
+     * extra info about the parent, rather than an actual node.
+     * @property hasIcon
+     * @type boolean
+     */
+    hasIcon: true,
+
+    /**
+     * Used to configure what happens when a dynamic load node is expanded
+     * and we discover that it does not have children.  By default, it is
+     * treated as if it still could have children (plus/minus icon).  Set
+     * iconMode to have it display like a leaf node instead.
+     * @property iconMode
+     * @type int
+     */
+    iconMode: 0,
+
+    /**
+     * Specifies whether or not the content area of the node should be allowed
+     * to wrap.
+     * @property nowrap
+     * @type boolean
+     * @default false
+     */
+    nowrap: false,
+
+    /**
+     * The node type
+     * @property _type
+     * @private
+     */
+    _type: "Node",
+
+    /*
+    spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
+    expandedText: "Expanded",
+    collapsedText: "Collapsed",
+    loadingText: "Loading",
+    */
+
+    /**
+     * Initializes this node, gets some of the properties from the parent
+     * @method init
+     * @param oData {object} a string or object containing the data that will
+     * be used to render this node
+     * @param oParent {Node} this node's parent node
+     * @param expanded {boolean} the initial expanded/collapsed state
+     */
+    init: function(oData, oParent, expanded) {
+
+        this.data       = oData;
+        this.children   = [];
+        this.index      = YAHOO.widget.TreeView.nodeCount;
+        ++YAHOO.widget.TreeView.nodeCount;
+        this.expanded   = expanded;
+
+        /**
+         * The parentChange event is fired when a parent element is applied
+         * to the node.  This is useful if you need to apply tree-level
+         * properties to a tree that need to happen if a node is moved from
+         * one tree to another.
+         *
+         * @event parentChange
+         * @type CustomEvent
+         */
+        this.createEvent("parentChange", this);
+
+        // oParent should never be null except when we create the root node.
+        if (oParent) {
+            oParent.appendChild(this);
+        }
+    },
+
+    /**
+     * Certain properties for the node cannot be set until the parent
+     * is known. This is called after the node is inserted into a tree.
+     * the parent is also applied to this node's children in order to
+     * make it possible to move a branch from one tree to another.
+     * @method applyParent
+     * @param {Node} parentNode this node's parent node
+     * @return {boolean} true if the application was successful
+     */
+    applyParent: function(parentNode) {
+        if (!parentNode) {
+            return false;
+        }
+
+        this.tree   = parentNode.tree;
+        this.parent = parentNode;
+        this.depth  = parentNode.depth + 1;
+
+        if (!this.href) {
+            this.href = "javascript:" + this.getToggleLink();
+        }
+
+        // @todo why was this put here.  This causes new nodes added at the
+        // root level to lose the menu behavior.
+        // if (! this.multiExpand) {
+            // this.multiExpand = parentNode.multiExpand;
+        // }
+
+        this.tree.regNode(this);
+        parentNode.childrenRendered = false;
+
+        // cascade update existing children
+        for (var i=0, len=this.children.length;i<len;++i) {
+            this.children[i].applyParent(this);
+        }
+
+        this.fireEvent("parentChange");
+
+        return true;
+    },
+
+    /**
+     * Appends a node to the child collection.
+     * @method appendChild
+     * @param childNode {Node} the new node
+     * @return {Node} the child node
+     * @private
+     */
+    appendChild: function(childNode) {
+        if (this.hasChildren()) {
+            var sib = this.children[this.children.length - 1];
+            sib.nextSibling = childNode;
+            childNode.previousSibling = sib;
+        }
+        this.children[this.children.length] = childNode;
+        childNode.applyParent(this);
+
+        // part of the IE display issue workaround. If child nodes
+        // are added after the initial render, and the node was
+        // instantiated with expanded = true, we need to show the
+        // children div now that the node has a child.
+        if (this.childrenRendered && this.expanded) {
+            this.getChildrenEl().style.display = "";
+        }
+
+        return childNode;
+    },
+
+    /**
+     * Appends this node to the supplied node's child collection
+     * @method appendTo
+     * @param parentNode {Node} the node to append to.
+     * @return {Node} The appended node
+     */
+    appendTo: function(parentNode) {
+        return parentNode.appendChild(this);
+    },
+
+    /**
+    * Inserts this node before this supplied node
+    * @method insertBefore
+    * @param node {Node} the node to insert this node before
+    * @return {Node} the inserted node
+    */
+    insertBefore: function(node) {
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+            p.children.splice(refIndex, 0, this);
+            if (node.previousSibling) {
+                node.previousSibling.nextSibling = this;
+            }
+            this.previousSibling = node.previousSibling;
+            this.nextSibling = node;
+            node.previousSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+ 
+    /**
+    * Inserts this node after the supplied node
+    * @method insertAfter
+    * @param node {Node} the node to insert after
+    * @return {Node} the inserted node
+    */
+    insertAfter: function(node) {
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+
+            if (!node.nextSibling) {
+                this.nextSibling = null;
+                return this.appendTo(p);
+            }
+
+            p.children.splice(refIndex + 1, 0, this);
+
+            node.nextSibling.previousSibling = this;
+            this.previousSibling = node;
+            this.nextSibling = node.nextSibling;
+            node.nextSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+
+    /**
+    * Returns true if the Node is a child of supplied Node
+    * @method isChildOf
+    * @param parentNode {Node} the Node to check
+    * @return {boolean} The node index if this Node is a child of 
+    *                   supplied Node, else -1.
+    * @private
+    */
+    isChildOf: function(parentNode) {
+        if (parentNode && parentNode.children) {
+            for (var i=0, len=parentNode.children.length; i<len ; ++i) {
+                if (parentNode.children[i] === this) {
+                    return i;
+                }
+            }
+        }
+
+        return -1;
+    },
+
+    /**
+     * Returns a node array of this node's siblings, null if none.
+     * @method getSiblings
+     * @return Node[]
+     */
+    getSiblings: function() {
+        return this.parent.children;
+    },
+
+    /**
+     * Shows this node's children
+     * @method showChildren
+     */
+    showChildren: function() {
+        if (!this.tree.animateExpand(this.getChildrenEl(), this)) {
+            if (this.hasChildren()) {
+                this.getChildrenEl().style.display = "";
+            }
+        }
+    },
+
+    /**
+     * Hides this node's children
+     * @method hideChildren
+     */
+    hideChildren: function() {
+
+        if (!this.tree.animateCollapse(this.getChildrenEl(), this)) {
+            this.getChildrenEl().style.display = "none";
+        }
+    },
+
+    /**
+     * Returns the id for this node's container div
+     * @method getElId
+     * @return {string} the element id
+     */
+    getElId: function() {
+        return "ygtv" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's children div
+     * @method getChildrenElId
+     * @return {string} the element id for this node's children div
+     */
+    getChildrenElId: function() {
+        return "ygtvc" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's toggle element
+     * @method getToggleElId
+     * @return {string} the toggel element id
+     */
+    getToggleElId: function() {
+        return "ygtvt" + this.index;
+    },
+
+
+    /*
+     * Returns the id for this node's spacer image.  The spacer is positioned
+     * over the toggle and provides feedback for screen readers.
+     * @method getSpacerId
+     * @return {string} the id for the spacer image
+     */
+    /*
+    getSpacerId: function() {
+        return "ygtvspacer" + this.index;
+    }, 
+    */
+
+    /**
+     * Returns this node's container html element
+     * @method getEl
+     * @return {HTMLElement} the container html element
+     */
+    getEl: function() {
+        return document.getElementById(this.getElId());
+    },
+
+    /**
+     * Returns the div that was generated for this node's children
+     * @method getChildrenEl
+     * @return {HTMLElement} this node's children div
+     */
+    getChildrenEl: function() {
+        return document.getElementById(this.getChildrenElId());
+    },
+
+    /**
+     * Returns the element that is being used for this node's toggle.
+     * @method getToggleEl
+     * @return {HTMLElement} this node's toggle html element
+     */
+    getToggleEl: function() {
+        return document.getElementById(this.getToggleElId());
+    },
+
+    /*
+     * Returns the element that is being used for this node's spacer.
+     * @method getSpacer
+     * @return {HTMLElement} this node's spacer html element
+     */
+    /*
+    getSpacer: function() {
+        return document.getElementById( this.getSpacerId() ) || {};
+    },
+    */
+
+    /*
+    getStateText: function() {
+        if (this.isLoading) {
+            return this.loadingText;
+        } else if (this.hasChildren(true)) {
+            if (this.expanded) {
+                return this.expandedText;
+            } else {
+                return this.collapsedText;
+            }
+        } else {
+            return "";
+        }
+    },
+    */
+
+    /**
+     * Generates the link that will invoke this node's toggle method
+     * @method getToggleLink
+     * @return {string} the javascript url for toggling this node
+     */
+    getToggleLink: function() {
+        return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + 
+            this.index + ").toggle()";
+    },
+
+    /**
+     * Hides this nodes children (creating them if necessary), changes the
+     * @method collapse
+     * toggle style.
+     */
+    collapse: function() {
+        // Only collapse if currently expanded
+        if (!this.expanded) { return; }
+
+        // fire the collapse event handler
+        var ret = this.tree.onCollapse(this);
+
+        if (false === ret) {
+            return;
+        }
+
+        ret = this.tree.fireEvent("collapse", this);
+
+        if (false === ret) {
+            return;
+        }
+
+
+        if (!this.getEl()) {
+            this.expanded = false;
+        } else {
+            // hide the child div
+            this.hideChildren();
+            this.expanded = false;
+
+            this.updateIcon();
+        }
+
+        // this.getSpacer().title = this.getStateText();
+
+        ret = this.tree.fireEvent("collapseComplete", this);
+
+    },
+
+    /**
+     * Shows this nodes children (creating them if necessary), changes the
+     * toggle style, and collapses its siblings if multiExpand is not set.
+     * @method expand
+     */
+    expand: function(lazySource) {
+        // Only expand if currently collapsed.
+        if (this.expanded) { return; }
+
+        var ret = true;
+
+        // When returning from the lazy load handler, expand is called again
+        // in order to render the new children.  The "expand" event already
+        // fired before fething the new data, so we need to skip it now.
+        if (!lazySource) {
+            // fire the expand event handler
+            ret = this.tree.onExpand(this);
+
+            if (false === ret) {
+                return;
+            }
+            
+            ret = this.tree.fireEvent("expand", this);
+        }
+
+        if (false === ret) {
+            return;
+        }
+
+        if (!this.getEl()) {
+            this.expanded = true;
+            return;
+        }
+
+        if (! this.childrenRendered) {
+            this.getChildrenEl().innerHTML = this.renderChildren();
+        } else {
+        }
+
+        this.expanded = true;
+
+        this.updateIcon();
+
+        // this.getSpacer().title = this.getStateText();
+
+        // We do an extra check for children here because the lazy
+        // load feature can expose nodes that have no children.
+
+        // if (!this.hasChildren()) {
+        if (this.isLoading) {
+            this.expanded = false;
+            return;
+        }
+
+        if (! this.multiExpand) {
+            var sibs = this.getSiblings();
+            for (var i=0; i<sibs.length; ++i) {
+                if (sibs[i] != this && sibs[i].expanded) { 
+                    sibs[i].collapse(); 
+                }
+            }
+        }
+
+        this.showChildren();
+
+        ret = this.tree.fireEvent("expandComplete", this);
+    },
+
+    updateIcon: function() {
+        if (this.hasIcon) {
+            var el = this.getToggleEl();
+            if (el) {
+                el.className = this.getStyle();
+            }
+        }
+    },
+
+    /**
+     * Returns the css style name for the toggle
+     * @method getStyle
+     * @return {string} the css class for this node's toggle
+     */
+    getStyle: function() {
+        if (this.isLoading) {
+            return "ygtvloading";
+        } else {
+            // location top or bottom, middle nodes also get the top style
+            var loc = (this.nextSibling) ? "t" : "l";
+
+            // type p=plus(expand), m=minus(collapase), n=none(no children)
+            var type = "n";
+            if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {
+            // if (this.hasChildren(true)) {
+                type = (this.expanded) ? "m" : "p";
+            }
+
+            return "ygtv" + loc + type;
+        }
+    },
+
+    /**
+     * Returns the hover style for the icon
+     * @return {string} the css class hover state
+     * @method getHoverStyle
+     */
+    getHoverStyle: function() { 
+        var s = this.getStyle();
+        if (this.hasChildren(true) && !this.isLoading) { 
+            s += "h"; 
+        }
+        return s;
+    },
+
+    /**
+     * Recursively expands all of this node's children.
+     * @method expandAll
+     */
+    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();
+            }
+        }
+    },
+
+    /**
+     * Recursively collapses all of this node's children.
+     * @method collapseAll
+     */
+    collapseAll: function() { 
+        for (var i=0;i<this.children.length;++i) {
+            this.children[i].collapse();
+            this.children[i].collapseAll();
+        }
+    },
+
+    /**
+     * Configures this node for dynamically obtaining the child data
+     * when the node is first expanded.  Calling it without the callback
+     * will turn off dynamic load for the node.
+     * @method setDynamicLoad
+     * @param fmDataLoader {function} the function that will be used to get the data.
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the 
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) { 
+        if (fnDataLoader) {
+            this.dataLoader = fnDataLoader;
+            this._dynLoad = true;
+        } else {
+            this.dataLoader = null;
+            this._dynLoad = false;
+        }
+
+        if (iconMode) {
+            this.iconMode = iconMode;
+        }
+    },
+
+    /**
+     * Evaluates if this node is the root node of the tree
+     * @method isRoot
+     * @return {boolean} true if this is the root node
+     */
+    isRoot: function() { 
+        return (this == this.tree.root);
+    },
+
+    /**
+     * Evaluates if this node's children should be loaded dynamically.  Looks for
+     * the property both in this instance and the root node.  If the tree is
+     * defined to load all children dynamically, the data callback function is
+     * defined in the root node
+     * @method isDynamic
+     * @return {boolean} true if this node's children are to be loaded dynamically
+     */
+    isDynamic: function() { 
+        var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));
+        return lazy;
+    },
+
+    /**
+     * Returns the current icon mode.  This refers to the way childless dynamic
+     * load nodes appear.
+     * @method getIconMode
+     * @return {int} 0 for collapse style, 1 for leaf node style
+     */
+    getIconMode: function() {
+        return (this.iconMode || this.tree.root.iconMode);
+    },
+
+    /**
+     * Checks if this node has children.  If this node is lazy-loading and the
+     * children have not been rendered, we do not know whether or not there
+     * are actual children.  In most cases, we need to assume that there are
+     * children (for instance, the toggle needs to show the expandable 
+     * presentation state).  In other times we want to know if there are rendered
+     * children.  For the latter, "checkForLazyLoad" should be false.
+     * @method hasChildren
+     * @param checkForLazyLoad {boolean} should we check for unloaded children?
+     * @return {boolean} true if this has children or if it might and we are
+     * checking for this condition.
+     */
+    hasChildren: function(checkForLazyLoad) { 
+        return ( this.children.length > 0 || 
+                (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
+    },
+
+    /**
+     * Expands if node is collapsed, collapses otherwise.
+     * @method toggle
+     */
+    toggle: function() {
+        if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
+            if (this.expanded) { this.collapse(); } else { this.expand(); }
+        }
+    },
+
+    /**
+     * Returns the markup for this node and its children.
+     * @method getHtml
+     * @return {string} the markup for this node and its expanded children.
+     */
+    getHtml: function() {
+
+        this.childrenRendered = false;
+
+        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("");
+    },
+
+    /**
+     * Called when first rendering the tree.  We always build the div that will
+     * contain this nodes children, but we don't render the children themselves
+     * unless this node is expanded.
+     * @method getChildrenHtml
+     * @return {string} the children container div html and any expanded children
+     * @private
+     */
+    getChildrenHtml: function() {
+
+
+        var sb = [];
+        sb[sb.length] = '<div class="ygtvchildren"';
+        sb[sb.length] = ' id="' + this.getChildrenElId() + '"';
+
+        // This is a workaround for an IE rendering issue, the child div has layout
+        // in IE, creating extra space if a leaf node is created with the expanded
+        // property set to true.
+        if (!this.expanded || !this.hasChildren()) {
+            sb[sb.length] = ' style="display:none;"';
+        }
+        sb[sb.length] = '>';
+
+        // Don't render the actual child node HTML unless this node is expanded.
+        if ( (this.hasChildren(true) && this.expanded) ||
+                (this.renderHidden && !this.isDynamic()) ) {
+            sb[sb.length] = this.renderChildren();
+        }
+
+        sb[sb.length] = '</div>';
+
+        return sb.join("");
+    },
+
+    /**
+     * Generates the markup for the child nodes.  This is not done until the node
+     * is expanded.
+     * @method renderChildren
+     * @return {string} the html for this node's children
+     * @private
+     */
+    renderChildren: function() {
+
+
+        var node = this;
+
+        if (this.isDynamic() && !this.dynamicLoadComplete) {
+            this.isLoading = true;
+            this.tree.locked = true;
+
+            if (this.dataLoader) {
+
+                setTimeout( 
+                    function() {
+                        node.dataLoader(node, 
+                            function() { 
+                                node.loadComplete(); 
+                            });
+                    }, 10);
+                
+            } else if (this.tree.root.dataLoader) {
+
+                setTimeout( 
+                    function() {
+                        node.tree.root.dataLoader(node, 
+                            function() { 
+                                node.loadComplete(); 
+                            });
+                    }, 10);
+
+            } else {
+                return "Error: data loader not found or not specified.";
+            }
+
+            return "";
+
+        } else {
+            return this.completeRender();
+        }
+    },
+
+    /**
+     * Called when we know we have all the child data.
+     * @method completeRender
+     * @return {string} children html
+     */
+    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("");
+    },
+
+    /**
+     * Load complete is the callback function we pass to the data provider
+     * in dynamic load situations.
+     * @method loadComplete
+     */
+    loadComplete: function() {
+        this.getChildrenEl().innerHTML = this.completeRender();
+        this.dynamicLoadComplete = true;
+        this.isLoading = false;
+        this.expand(true);
+        this.tree.locked = false;
+    },
+
+    /**
+     * Returns this node's ancestor at the specified depth.
+     * @method getAncestor
+     * @param {int} depth the depth of the ancestor.
+     * @return {Node} the ancestor
+     */
+    getAncestor: function(depth) {
+        if (depth >= this.depth || depth < 0)  {
+            return null;
+        }
+
+        var p = this.parent;
+        
+        while (p.depth > depth) {
+            p = p.parent;
+        }
+
+        return p;
+    },
+
+    /**
+     * Returns the css class for the spacer at the specified depth for
+     * this node.  If this node's ancestor at the specified depth
+     * has a next sibling the presentation is different than if it
+     * does not have a next sibling
+     * @method getDepthStyle
+     * @param {int} depth the depth of the ancestor.
+     * @return {string} the css class for the spacer
+     */
+    getDepthStyle: function(depth) {
+        return (this.getAncestor(depth).nextSibling) ? 
+            "ygtvdepthcell" : "ygtvblankdepthcell";
+    },
+
+    /**
+     * Get the markup for the node.  This is designed to be overrided so that we can
+     * support different types of nodes.
+     * @method getNodeHtml
+     * @return {string} The HTML that will render this node.
+     */
+    getNodeHtml: function() { 
+        return ""; 
+    },
+
+    /**
+     * Regenerates the html for this node and its children.  To be used when the
+     * node is expanded and new children have been added.
+     * @method refresh
+     */
+    refresh: function() {
+        // this.loadComplete();
+        this.getChildrenEl().innerHTML = this.completeRender();
+
+        if (this.hasIcon) {
+            var el = this.getToggleEl();
+            if (el) {
+                el.className = this.getStyle();
+            }
+        }
+    },
+
+    /**
+     * Node toString
+     * @method toString
+     * @return {string} string representation of the node
+     */
+    toString: function() {
+        return "Node (" + this.index + ")";
+    }
+
+};
+
+YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
+
+/**
+ * The default node presentation.  The first parameter should be
+ * either a string that will be used as the node's label, or an object
+ * that has a string propery called label.  By default, the clicking the
+ * label will toggle the expanded/collapsed state of the node.  By
+ * changing the href property of the instance, this behavior can be
+ * changed so that the label will go to the specified href.
+ * @namespace YAHOO.widget
+ * @class TextNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {
+
+    if (oData) { 
+        this.init(oData, oParent, expanded);
+        this.setUpLabel(oData);
+    }
+
+};
+
+YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
+    
+    /**
+     * The CSS class for the label href.  Defaults to ygtvlabel, but can be
+     * overridden to provide a custom presentation for a specific node.
+     * @property labelStyle
+     * @type string
+     */
+    labelStyle: "ygtvlabel",
+
+    /**
+     * The derived element id of the label for this node
+     * @property labelElId
+     * @type string
+     */
+    labelElId: null,
+
+    /**
+     * The text for the label.  It is assumed that the oData parameter will
+     * either be a string that will be used as the label, or an object that
+     * has a property called "label" that we will use.
+     * @property label
+     * @type string
+     */
+    label: null,
+
+    textNodeParentChange: function() {
+ 
+        /**
+         * Custom event that is fired when the text node label is clicked.  The
+         * custom event is defined on the tree instance, so there is a single
+         * event that handles all nodes in the tree.  The node clicked is 
+         * provided as an argument
+         *
+         * @event labelClick
+         * @for YAHOO.widget.TreeView
+         * @param {YAHOO.widget.Node} node the node clicked
+         */
+        if (this.tree && !this.tree.hasEvent("labelClick")) {
+            this.tree.createEvent("labelClick", this.tree);
+        }
+       
+    },
+
+    /**
+     * Sets up the node label
+     * @method setUpLabel
+     * @param oData string containing the label, or an object with a label property
+     */
+    setUpLabel: function(oData) { 
+        
+        // set up the custom event on the tree
+        this.textNodeParentChange();
+        this.subscribe("parentChange", this.textNodeParentChange);
+
+        if (typeof oData == "string") {
+            oData = { label: oData };
+        }
+        this.label = oData.label;
+        this.data.label = oData.label;
+        
+        // update the link
+        if (oData.href) {
+            this.href = oData.href;
+        }
+
+        // set the target
+        if (oData.target) {
+            this.target = oData.target;
+        }
+
+        if (oData.style) {
+            this.labelStyle = oData.style;
+        }
+
+        this.labelElId = "ygtvlabelel" + this.index;
+    },
+
+    /**
+     * Returns the label element
+     * @for YAHOO.widget.TextNode
+     * @method getLabelEl
+     * @return {object} the element
+     */
+    getLabelEl: function() { 
+        return document.getElementById(this.labelElId);
+    },
+
+    // overrides YAHOO.widget.Node
+    getNodeHtml: function() { 
+        var sb = [];
+
+        sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+        sb[sb.length] = '<tr>';
+        
+        for (var i=0;i<this.depth;++i) {
+            //sb[sb.length] = '<td><div class="' + this.getDepthStyle(i) + '">&#160;</div></td>';
+            //sb[sb.length] = '<td><div class="' + this.getDepthStyle(i) + '"></div></td>';
+            sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '"><div class="ygtvspacer"></div></td>';
+        }
+
+        var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
+                        this.tree.id + '\',' + this.index + ')';
+
+        sb[sb.length] = '<td';
+        // sb[sb.length] = ' onselectstart="return false"';
+        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] = getNode + '.getHoverStyle()"';
+            sb[sb.length] = ' onmouseout="this.className=';
+            sb[sb.length] = getNode + '.getStyle()"';
+        }
+        sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">';
+
+        sb[sb.length] = '<div class="ygtvspacer">';
+
+        /*
+        sb[sb.length] = '<img id="' + this.getSpacerId() + '"';
+        sb[sb.length] = ' alt=""';
+        sb[sb.length] = ' tabindex=0';
+        sb[sb.length] = ' src="' + this.spacerPath + '"';
+        sb[sb.length] = ' title="' + this.getStateText() + '"';
+        sb[sb.length] = ' class="ygtvspacer"';
+        // sb[sb.length] = ' onkeypress="return ' + getNode + '".onKeyPress()"';
+        sb[sb.length] = ' />';
+        */
+
+        //sb[sb.length] = '&#160;';
+
+        sb[sb.length] = '</div>';
+        sb[sb.length] = '</td>';
+        sb[sb.length] = '<td ';
+        sb[sb.length] = (this.nowrap) ? ' nowrap="nowrap" ' : '';
+        sb[sb.length] = ' >';
+        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 ' + getNode + '.onLabelClick(' + getNode +')"';
+        if (this.hasChildren(true)) {
+            sb[sb.length] = ' onmouseover="document.getElementById(\'';
+            sb[sb.length] = this.getToggleElId() + '\').className=';
+            sb[sb.length] = getNode + '.getHoverStyle()"';
+            sb[sb.length] = ' onmouseout="document.getElementById(\'';
+            sb[sb.length] = this.getToggleElId() + '\').className=';
+            sb[sb.length] = getNode + '.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("");
+    },
+
+
+    /**
+     * Executed when the label is clicked.  Fires the labelClick custom event.
+     * @method onLabelClick
+     * @param me {Node} this node
+     * @scope the anchor tag clicked
+     * @return false to cancel the anchor click
+     */
+    onLabelClick: function(me) { 
+        return me.tree.fireEvent("labelClick", me);
+        //return true;
+    },
+
+    toString: function() { 
+        return "TextNode (" + this.index + ") " + this.label;
+    }
+
+});
+/**
+ * A custom YAHOO.widget.Node that handles the unique nature of 
+ * the virtual, presentationless root node.
+ * @namespace YAHOO.widget
+ * @class RootNode
+ * @extends YAHOO.widget.Node
+ * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
+ * @constructor
+ */
+YAHOO.widget.RootNode = function(oTree) {
+	// Initialize the node with null params.  The root node is a
+	// special case where the node has no presentation.  So we have
+	// to alter the standard properties a bit.
+	this.init(null, null, true);
+	
+	/*
+	 * For the root node, we get the tree reference from as a param
+	 * to the constructor instead of from the parent element.
+	 */
+	this.tree = oTree;
+};
+
+YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
+    
+    // overrides YAHOO.widget.Node
+    getNodeHtml: function() { 
+        return ""; 
+    },
+
+    toString: function() { 
+        return "RootNode";
+    },
+
+    loadComplete: function() { 
+        this.tree.draw();
+    },
+
+    collapse: function() {},
+    expand: function() {}
+
+});
+/**
+ * This implementation takes either a string or object for the
+ * oData argument.  If is it a string, we will use it for the display
+ * of this node (and it can contain any html code).  If the parameter
+ * is an object, we look for a parameter called "html" that will be
+ * used for this node's display.
+ * @namespace YAHOO.widget
+ * @class HTMLNode
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
+ * have an icon
+ */
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
+    if (oData) { 
+        this.init(oData, oParent, expanded);
+        this.initContent(oData, hasIcon);
+    }
+};
+
+YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
+
+    /**
+     * The CSS class for the html content container.  Defaults to ygtvhtml, but 
+     * can be overridden to provide a custom presentation for a specific node.
+     * @property contentStyle
+     * @type string
+     */
+    contentStyle: "ygtvhtml",
+
+    /**
+     * The generated id that will contain the data passed in by the implementer.
+     * @property contentElId
+     * @type string
+     */
+    contentElId: null,
+
+    /**
+     * The HTML content to use for this node's display
+     * @property content
+     * @type string
+     */
+    content: null,
+
+    /**
+     * Sets up the node label
+     * @property initContent
+     * @param oData {object} An html string or object containing an html property
+     * @param hasIcon {boolean} determines if the node will be rendered with an
+     * icon or not
+     */
+    initContent: function(oData, hasIcon) { 
+        this.setHtml(oData);
+        this.contentElId = "ygtvcontentel" + this.index;
+        this.hasIcon = hasIcon;
+
+    },
+
+    /**
+     * Synchronizes the node.data, node.html, and the node's content
+     * @property setHtml
+     * @param o {object} An html string or object containing an html property
+     */
+    setHtml: function(o) {
+
+        this.data = o;
+        this.html = (typeof o === "string") ? o : o.html;
+
+        var el = this.getContentEl();
+        if (el) {
+            el.innerHTML = this.html;
+        }
+
+    },
+
+    /**
+     * Returns the outer html element for this node's content
+     * @method getContentEl
+     * @return {HTMLElement} the element
+     */
+    getContentEl: function() { 
+        return document.getElementById(this.contentElId);
+    },
+
+    // overrides YAHOO.widget.Node
+    getNodeHtml: function() { 
+        var sb = [];
+
+        sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+        sb[sb.length] = '<tr>';
+        
+        for (var i=0;i<this.depth;++i) {
+            //sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+            sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '"><div class="ygtvspacer"></div></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] = '><div class="ygtvspacer"></div></td>';
+        }
+
+        sb[sb.length] = '<td';
+        sb[sb.length] = ' id="' + this.contentElId + '"';
+        sb[sb.length] = ' class="' + this.contentStyle + '"';
+        sb[sb.length] = (this.nowrap) ? ' nowrap="nowrap" ' : '';
+        sb[sb.length] = ' >';
+        sb[sb.length] = this.html;
+        sb[sb.length] = '</td>';
+        sb[sb.length] = '</tr>';
+        sb[sb.length] = '</table>';
+
+        return sb.join("");
+    },
+
+    toString: function() { 
+        return "HTMLNode (" + this.index + ")";
+    }
+
+});
+/**
+ * A menu-specific implementation that differs from TextNode in that only 
+ * one sibling can be expanded at a time.
+ * @namespace YAHOO.widget
+ * @class MenuNode
+ * @extends YAHOO.widget.TextNode
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
+	if (oData) { 
+		this.init(oData, oParent, expanded);
+		this.setUpLabel(oData);
+	}
+
+    /*
+     * Menus usually allow only one branch to be open at a time.
+     */
+	this.multiExpand = false;
+
+
+};
+
+YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
+
+    toString: function() { 
+        return "MenuNode (" + this.index + ") " + this.label;
+    }
+
+});
+/**
+ * A static factory class for tree view expand/collapse animations
+ * @class TVAnim
+ * @static
+ */
+YAHOO.widget.TVAnim = function() {
+    return {
+        /**
+         * Constant for the fade in animation
+         * @property FADE_IN
+         * @type string
+         * @static
+         */
+        FADE_IN: "TVFadeIn",
+
+        /**
+         * Constant for the fade out animation
+         * @property FADE_OUT
+         * @type string
+         * @static
+         */
+        FADE_OUT: "TVFadeOut",
+
+        /**
+         * Returns a ygAnim instance of the given type
+         * @method getAnim
+         * @param type {string} the type of animation
+         * @param el {HTMLElement} the element to element (probably the children div)
+         * @param callback {function} function to invoke when the animation is done.
+         * @return {YAHOO.util.Animation} the animation instance
+         * @static
+         */
+        getAnim: function(type, el, callback) {
+            if (YAHOO.widget[type]) {
+                return new YAHOO.widget[type](el, callback);
+            } else {
+                return null;
+            }
+        },
+
+        /**
+         * Returns true if the specified animation class is available
+         * @method isValid
+         * @param type {string} the type of animation
+         * @return {boolean} true if valid, false if not
+         * @static
+         */
+        isValid: function(type) {
+            return (YAHOO.widget[type]);
+        }
+    };
+} ();
+
+/**
+ * A 1/2 second fade-in animation.
+ * @class TVFadeIn
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeIn = function(el, callback) {
+    /**
+     * The element to animate
+     * @property el
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     * @property callback
+     * @type function
+     */
+    this.callback = callback;
+
+};
+
+YAHOO.widget.TVFadeIn.prototype = {
+    /**
+     * Performs the animation
+     * @method animate
+     */
+    animate: function() {
+        var tvanim = 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() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     * @method onComplete
+     */
+    onComplete: function() {
+        this.callback();
+    },
+
+    /**
+     * toString
+     * @method toString
+     * @return {string} the string representation of the instance
+     */
+    toString: function() {
+        return "TVFadeIn";
+    }
+};
+
+/**
+ * A 1/2 second fade out animation.
+ * @class TVFadeOut
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {Function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeOut = function(el, callback) {
+    /**
+     * The element to animate
+     * @property el
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     * @property callback
+     * @type function
+     */
+    this.callback = callback;
+
+};
+
+YAHOO.widget.TVFadeOut.prototype = {
+    /**
+     * Performs the animation
+     * @method animate
+     */
+    animate: function() {
+        var tvanim = 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() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     * @method onComplete
+     */
+    onComplete: function() {
+        var s = this.el.style;
+        s.display = "none";
+        // s.opacity = 1;
+        s.filter = "alpha(opacity=100)";
+        this.callback();
+    },
+
+    /**
+     * toString
+     * @method toString
+     * @return {string} the string representation of the instance
+     */
+    toString: function() {
+        return "TVFadeOut";
+    }
+};
+
+YAHOO.register("treeview", YAHOO.widget.TreeView, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/utilities.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/utilities.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/utilities.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,16 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang={isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice)&&!A.hasOwnProperty(B.length);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var C={},A=arguments,B;for(B=0;B<A.length;B=B+1){YAHOO.lang.augmentObject(C,A[B],true);}return C;},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.1",build:"541"});(function(){var B=YAHOO.util,K,I,H=0,J={},F={};var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var M=function(O){if(!E.HYPHEN.test(O)){return O;}if(J[O]){return J[O];}var P=O;while(E.HYPHEN.exec(P)){P=P.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[O]=P;return P;};var N=function(P){var O=F[P];if(!O){O=new RegExp("(?:^|\\s+)"+P+"(?:\\s+|$)");F[P]=O;}return O;};if(document.defaultView&&document.defaultView.getComputedStyle){K=function(O,R){var Q=null;if(R=="float"){R="cssFloat";}var P=document.defaultView.getComputedStyle(O,"");if(P){Q=P[M(R)];}return O.style[R]||Q;};}else{if(document.documentElement.currentStyle&&G){K=function(O,Q){switch(M(Q)){case"opacity":var S=100;try{S=O.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(R){try{S=O.filters("alpha").opacity;}catch(R){}}return S/100;case"float":Q="styleFloat";default:var P=O.currentStyle?O.currentStyle[Q]:null;return(O.style[Q]||P);}};}else{K=function(O,P){return O.style[P];};}}if(G){I=function(O,P,Q){switch(P){case"opacity":if(YAHOO.lang.isString(O.style.filter)){O.style.filter="alpha(opacity="+Q*100+")";if(!O.currentStyle||!O.currentStyle.hasLayout){O.style.zoom=1;}}break;case"float":P="styleFloat";default:O.style[P]=Q;}};}else{I=function(O,P,Q){if(P=="float"){P="cssFloat";}O.style[P]=Q;};}var D=function(O,P){return O&&O.nodeType==1&&(!P||P(O));};YAHOO.util.Dom={get:function(Q){if(Q&&(Q.tagName||Q.item)){return Q;}if(YAHOO.lang.isString(Q)||!Q){return document.getElementById(Q);}if(Q.length!==undefined){var R=[];for(var P=0,O=Q.length;P<O;++P){R[R.length]=B.Dom.get(Q[P]);}return R;}return Q;},getStyle:function(O,Q){Q=M(Q);var P=function(R){return K(R,Q);};return B.Dom.batch(O,P,B.Dom,true);},setStyle:function(O,Q,R){Q=M(Q);var P=function(S){I(S,Q,R);};B.Dom.batch(O,P,B.Dom,true);},getXY:function(O){var P=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=document.body){return false;}var Q=null;var V=[];var S;var T=R.ownerDocument;if(R.getBoundingClientRect){S=R.getBoundingClientRect();return[S.left+B.Dom.getDocumentScrollLeft(R.ownerDocument),S.top+B.Dom.getDocumentScrollTop(R.ownerDocument)];}else{V=[R.offsetLeft,R.offsetTop];Q=R.offsetParent;var U=this.getStyle(R,"position")=="absolute";if(Q!=R){while(Q){V[0]+=Q.offsetLeft;V[1]+=Q.offsetTop;if(L&&!U&&this.getStyle(Q,"position")=="absolute"){U=true;}Q=Q.offsetParent;}}if(L&&U){V[0]-=R.ownerDocument.body.offsetLeft;V[1]-=R.ownerDocument.body.offsetTop;}}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(B.Dom.getStyle(Q,"display").search(/^inline|table-row.*$/i)){V[0]-=Q.scrollLeft;V[1]-=Q.scrollTop;}Q=Q.parentNode;}return V;};return B.Dom.batch(O,P,B.Dom,true);},getX:function(O){var P=function(Q){return B.Dom.getXY(Q)[0];};return B.Dom.batch(O,P,B.Dom,true);},getY:function(O){var P=function(Q){return B.Dom.getXY(Q)[1];};return B.Dom.batch(O,P,B.Dom,true);},setXY:function(O,R,Q){var P=function(U){var T=this.getStyle(U,"position");if(T=="static"){this.setStyle(U,"position","relative");T="relative";}var W=this.getXY(U);if(W===false){return false;}var V=[parseInt(this.getStyle(U,"left"),10),parseInt(this.getStyle(U,"top"),10)];if(isNaN(V[0])){V[0]=(T=="relative")?0:U.offsetLeft;}if(isNaN(V[1])){V[1]=(T=="relative")?0:U.offsetTop;}if(R[0]!==null){U.style.left=R[0]-W[0]+V[0]+"px";}if(R[1]!==null){U.style.top=R[1]-W[1]+V[1]+"px";}if(!Q){var S=this.getXY(U);if((R[0]!==null&&S[0]!=R[0])||(R[1]!==null&&S[1]!=R[1])){this.setXY(U,R,true);}}};B.Dom.batch(O,P,B.Dom,true);},setX:function(P,O){B.Dom.setXY(P,[O,null]);},setY:function(O,P){B.Dom.setXY(O,[null,P]);},getRegion:function(O){var P=function(Q){if((Q.parentNode===null||Q.offsetParent===null||this.getStyle(Q,"display")=="none")&&Q!=document.body){return false;}var R=B.Region.getRegion(Q);return R;};return B.Dom.batch(O,P,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(S,W,T,U){W=W||"*";T=(T)?B.Dom.get(T):null||document;if(!T){return[];}var P=[],O=T.getElementsByTagName(W),V=N(S);for(var Q=0,R=O.length;Q<R;++Q){if(V.test(O[Q].className)){P[P.length]=O[Q];if(U){U.call(O[Q],O[Q]);}}}return P;},hasClass:function(Q,P){var O=N(P);var R=function(S){return O.test(S.className);};return B.Dom.batch(Q,R,B.Dom,true);},addClass:function(P,O){var Q=function(R){if(this.hasClass(R,O)){return false;}R.className=YAHOO.lang.trim([R.className,O].join(" "));return true;};return B.Dom.batch(P,Q,B.Dom,true);},removeClass:function(Q,P){var O=N(P);var R=function(S){if(!this.hasClass(S,P)){return false;}var T=S.className;S.className=T.replace(O," ");if(this.hasClass(S,P)){this.removeClass(S,P);}S.className=YAHOO.lang.trim(S.className);return true;};return B.Dom.batch(Q,R,B.Dom,true);},replaceClass:function(R,P,O){if(!O||P===O){return false;}var Q=N(P);var S=function(T){if(!this.hasClass(T,P)){this.addClass(T,O);return true;}T.className=T.className.replace(Q," "+O+" ");if(this.hasClass(T,P)){this.replaceClass(T,P,O);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},generateId:function(O,Q){Q=Q||"yui-gen";var P=function(R){if(R&&R.id){return R.id;}var S=Q+H++;if(R){R.id=S;}return S;};return B.Dom.batch(O,P,B.Dom,true)||P.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);if(!P||!Q){return false;}var O=function(R){if(P.contains&&R.nodeType&&!L){return P.contains(R);}else{if(P.compareDocumentPosition&&R.nodeType){return !!(P.compareDocumentPosition(R)&16);}else{if(R.nodeType){return !!this.getAncestorBy(R,function(S){return S==P;});}}}return false;};return B.Dom.batch(Q,O,B.Dom,true);},inDocument:function(O){var P=function(Q){if(L){while(Q=Q.parentNode){if(Q==document.documentElement){return true;}}return false;}return this.isAncestor(document.documentElement,Q);};return B.Dom.batch(O,P,B.Dom,true);},getElementsBy:function(V,P,Q,S){P=P||"*";
+Q=(Q)?B.Dom.get(Q):null||document;if(!Q){return[];}var R=[],U=Q.getElementsByTagName(P);for(var T=0,O=U.length;T<O;++T){if(V(U[T])){R[R.length]=U[T];if(S){S(U[T]);}}}return R;},batch:function(S,V,U,Q){S=(S&&(S.tagName||S.item))?S:B.Dom.get(S);if(!S||!V){return false;}var R=(Q)?U:window;if(S.tagName||S.length===undefined){return V.call(R,S,U);}var T=[];for(var P=0,O=S.length;P<O;++P){T[T.length]=V.call(R,S[P],U);}return T;},getDocumentHeight:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var O=Math.max(P,B.Dom.getViewportHeight());return O;},getDocumentWidth:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var O=Math.max(P,B.Dom.getViewportWidth());return O;},getViewportHeight:function(){var O=self.innerHeight;var P=document.compatMode;if((P||G)&&!C){O=(P=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return O;},getViewportWidth:function(){var O=self.innerWidth;var P=document.compatMode;if(P||G){O=(P=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return O;},getAncestorBy:function(O,P){while(O=O.parentNode){if(D(O,P)){return O;}}return null;},getAncestorByClassName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return B.Dom.hasClass(R,O);};return B.Dom.getAncestorBy(P,Q);},getAncestorByTagName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return R.tagName&&R.tagName.toUpperCase()==O.toUpperCase();};return B.Dom.getAncestorBy(P,Q);},getPreviousSiblingBy:function(O,P){while(O){O=O.previousSibling;if(D(O,P)){return O;}}return null;},getPreviousSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getPreviousSiblingBy(O);},getNextSiblingBy:function(O,P){while(O){O=O.nextSibling;if(D(O,P)){return O;}}return null;},getNextSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getNextSiblingBy(O);},getFirstChildBy:function(O,Q){var P=(D(O.firstChild,Q))?O.firstChild:null;return P||B.Dom.getNextSiblingBy(O.firstChild,Q);},getFirstChild:function(O,P){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getFirstChildBy(O);},getLastChildBy:function(O,Q){if(!O){return null;}var P=(D(O.lastChild,Q))?O.lastChild:null;return P||B.Dom.getPreviousSiblingBy(O.lastChild,Q);},getLastChild:function(O){O=B.Dom.get(O);return B.Dom.getLastChildBy(O);},getChildrenBy:function(P,R){var Q=B.Dom.getFirstChildBy(P,R);var O=Q?[Q]:[];B.Dom.getNextSiblingBy(Q,function(S){if(!R||R(S)){O[O.length]=S;}return false;});return O;},getChildren:function(O){O=B.Dom.get(O);if(!O){}return B.Dom.getChildrenBy(O);},getDocumentScrollLeft:function(O){O=O||document;return Math.max(O.documentElement.scrollLeft,O.body.scrollLeft);},getDocumentScrollTop:function(O){O=O||document;return Math.max(O.documentElement.scrollTop,O.body.scrollTop);},insertBefore:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}return O.parentNode.insertBefore(P,O);},insertAfter:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}if(O.nextSibling){return O.parentNode.insertBefore(P,O.nextSibling);}else{return O.parentNode.appendChild(P);}}};})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};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(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.1",build:"541"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){var E=this.subscribers.length;if(!E&&this.silent){return true;}var H=[],G=true,D,I=false;for(D=0;D<arguments.length;++D){H.push(arguments[D]);}var A=H.length;if(!this.silent){}for(D=0;D<E;++D){var L=this.subscribers[D];if(!L){I=true;}else{if(!this.silent){}var K=L.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(H.length>0){B=H[0];}try{G=L.fn.call(K,B,L.obj);}catch(F){this.lastError=F;}}else{try{G=L.fn.call(K,this.type,H,L.obj);}catch(F){this.lastError=F;}}if(false===G){if(!this.silent){}return false;}}}if(I){var J=[],C=this.subscribers;for(D=0,E=C.length;D<E;D=D+1){J.push(C[D]);}this.subscribers=J;}return true;},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B);}this.subscribers=[];return B;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers[A]=null;},toString:function(){return"CustomEvent: '"+this.type+"', scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var J=false;var I=[];var K=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach();};this._interval=setInterval(M,this.POLL_INTERVAL);}},onAvailable:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:false});C=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(L,N,M){if(J){setTimeout(function(){var O=window;if(M){if(M===true){O=N;}else{O=M;}}L.call(O,"DOMReady",[],N);},0);}else{this.DOMReadyEvent.subscribe(L,N,M);}},onContentReady:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:true});C=this.POLL_RETRYS;this.startInterval();},addListener:function(N,L,W,R,M){if(!W||!W.call){return false;}if(this._isValidCollection(N)){var X=true;for(var S=0,U=N.length;S<U;++S){X=this.on(N[S],L,W,R,M)&&X;}return X;}else{if(YAHOO.lang.isString(N)){var Q=this.getEl(N);if(Q){N=Q;}else{this.onAvailable(N,function(){YAHOO.util.Event.on(N,L,W,R,M);});return true;}}}if(!N){return false;}if("unload"==L&&R!==this){K[K.length]=[N,L,W,R,M];return true;}var Z=N;if(M){if(M===true){Z=R;}else{Z=M;}}var O=function(a){return W.call(Z,YAHOO.util.Event.getEvent(a,N),R);};var Y=[N,L,W,O,Z,R,M];var T=I.length;I[T]=Y;if(this.useLegacyEvent(N,L)){var P=this.getLegacyIndex(N,L);if(P==-1||N!=G[P][0]){P=G.length;B[N.id+L]=P;G[P]=[N,L,N["on"+L]];E[P]=[];N["on"+L]=function(a){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(a),P);};}E[P].push(Y);}else{try{this._simpleAdd(N,L,O,false);}catch(V){this.lastError=V;this.removeListener(N,L,W);return false;}}return true;},fireLegacyEvent:function(P,N){var R=true,L,T,S,U,Q;T=E[N];for(var M=0,O=T.length;M<O;++M){S=T[M];if(S&&S[this.WFN]){U=S[this.ADJ_SCOPE];Q=S[this.WFN].call(U,P);R=(R&&Q);}}L=G[N];if(L&&L[2]){L[2](P);}return R;},getLegacyIndex:function(M,N){var L=this.generateId(M)+N;if(typeof B[L]=="undefined"){return -1;}else{return B[L];}},useLegacyEvent:function(M,N){if(this.webkit&&("click"==N||"dblclick"==N)){var L=parseInt(this.webkit,10);if(!isNaN(L)&&L<418){return true;}}return false;},removeListener:function(M,L,U){var P,S,W;if(typeof M=="string"){M=this.getEl(M);}else{if(this._isValidCollection(M)){var V=true;for(P=0,S=M.length;P<S;++P){V=(this.removeListener(M[P],L,U)&&V);}return V;}}if(!U||!U.call){return this.purgeElement(M,false,L);}if("unload"==L){for(P=0,S=K.length;P<S;P++){W=K[P];if(W&&W[0]==M&&W[1]==L&&W[2]==U){K[P]=null;return true;}}return false;}var Q=null;var R=arguments[3];if("undefined"===typeof R){R=this._getCacheIndex(M,L,U);}if(R>=0){Q=I[R];}if(!M||!Q){return false;}if(this.useLegacyEvent(M,L)){var O=this.getLegacyIndex(M,L);var N=E[O];if(N){for(P=0,S=N.length;P<S;++P){W=N[P];if(W&&W[this.EL]==M&&W[this.TYPE]==L&&W[this.FN]==U){N[P]=null;break;}}}}else{try{this._simpleRemove(M,L,Q[this.WFN],false);}catch(T){this.lastError=T;return false;}}delete I[R][this.WFN];delete I[R][this.FN];I[R]=null;return true;},getTarget:function(N,M){var L=N.target||N.srcElement;return this.resolveTextNode(L);},resolveTextNode:function(L){if(L&&3==L.nodeType){return L.parentNode;}else{return L;}},getPageX:function(M){var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(this.isIE){L+=this._getScrollLeft();}}return L;},getPageY:function(L){var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(this.isIE){M+=this._getScrollTop();}}return M;},getXY:function(L){return[this.getPageX(L),this.getPageY(L)];
+},getRelatedTarget:function(M){var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement;}else{if(M.type=="mouseover"){L=M.fromElement;}}}return this.resolveTextNode(L);},getTime:function(N){if(!N.time){var M=new Date().getTime();try{N.time=M;}catch(L){this.lastError=L;return M;}}return N.time;},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L);},stopPropagation:function(L){if(L.stopPropagation){L.stopPropagation();}else{L.cancelBubble=true;}},preventDefault:function(L){if(L.preventDefault){L.preventDefault();}else{L.returnValue=false;}},getEvent:function(Q,O){var P=Q||window.event;if(!P){var R=this.getEvent.caller;while(R){P=R.arguments[0];if(P&&Event==P.constructor){break;}R=R.caller;}}if(P&&this.isIE){try{var N=P.srcElement;if(N){var M=N.type;}}catch(L){P.target=O;}}return P;},getCharCode:function(M){var L=M.keyCode||M.charCode||0;if(YAHOO.env.ua.webkit&&(L in D)){L=D[L];}return L;},_getCacheIndex:function(P,Q,O){for(var N=0,M=I.length;N<M;++N){var L=I[N];if(L&&L[this.FN]==O&&L[this.EL]==P&&L[this.TYPE]==Q){return N;}}return -1;},generateId:function(L){var M=L.id;if(!M){M="yuievtautoid-"+A;++A;L.id=M;}return M;},_isValidCollection:function(M){try{return(typeof M!=="string"&&M.length&&!M.tagName&&!M.alert&&typeof M[0]!=="undefined");}catch(L){return false;}},elCache:{},getEl:function(L){return(typeof L==="string")?document.getElementById(L):L;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(M){if(!H){H=true;var L=YAHOO.util.Event;L._ready();L._tryPreloadAttach();}},_ready:function(M){if(!J){J=true;var L=YAHOO.util.Event;L.DOMReadyEvent.fire();L._simpleRemove(document,"DOMContentLoaded",L._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}if(this.isIE){if(!J){this.startInterval();return false;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var M,L,O,N;for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&!O.checkReady){N=this.getEl(O.id);if(N){R(N,O);F[M]=null;}else{P.push(O);}}}for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&O.checkReady){N=this.getEl(O.id);if(N){if(H||N.nextSibling){R(N,O);F[M]=null;}}else{P.push(O);}}}C=(P.length===0)?0:C-1;if(Q){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(O,P,R){var Q=this.getListeners(O,R),N,L;if(Q){for(N=0,L=Q.length;N<L;++N){var M=Q[N];this.removeListener(O,M.type,M.fn,M.index);}}if(P&&O&&O.childNodes){for(N=0,L=O.childNodes.length;N<L;++N){this.purgeElement(O.childNodes[N],P,R);}}},getListeners:function(N,L){var Q=[],M;if(!L){M=[I,K];}else{if(L=="unload"){M=[K];}else{M=[I];}}for(var P=0;P<M.length;P=P+1){var T=M[P];if(T&&T.length>0){for(var R=0,S=T.length;R<S;++R){var O=T[R];if(O&&O[this.EL]===N&&(!L||L===O[this.TYPE])){Q.push({type:O[this.TYPE],fn:O[this.FN],obj:O[this.OBJ],adjust:O[this.OVERRIDE],scope:O[this.ADJ_SCOPE],index:R});}}}}return(Q.length)?Q:null;},_unload:function(S){var R=YAHOO.util.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.UNLOAD_OBJ];}else{Q=M[R.ADJ_SCOPE];}}M[R.FN].call(Q,R.getEvent(S,M[R.EL]),M[R.UNLOAD_OBJ]);K[P]=null;M=null;Q=null;}}K=null;if(I&&I.length>0){O=I.length;while(O){N=O-1;M=I[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N);}O=O-1;}M=null;R.clearCache();}for(P=0,L=G.length;P<L;++P){G[P][0]=null;G[P]=null;}G=null;R._simpleRemove(window,"unload",R._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft];}else{if(M){return[M.scrollTop,M.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(N,O,M,L){N.addEventListener(O,M,(L));};}else{if(window.attachEvent){return function(N,O,M,L){N.attachEvent("on"+O,M);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(N,O,M,L){N.removeEventListener(O,M,(L));};}else{if(window.detachEvent){return function(M,N,L){M.detachEvent("on"+N,L);};}else{return function(){};}}}()};}();(function(){var D=YAHOO.util.Event;D.on=D.addListener;if(D.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var B,E=document,A=E.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){B=document.createElement("script");var C=E.getElementsByTagName("head")[0]||A;C.insertBefore(B,C.firstChild);}else{E.write("<script id=\"_yui_eu_dr\" defer=\"true\" src=\"//:\"></script>");B=document.getElementById("_yui_eu_dr");}if(B){B.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}B=null;}else{if(D.webkit){D._drwatch=setInterval(function(){var F=document.readyState;if("loaded"==F||"complete"==F){clearInterval(D._drwatch);D._drwatch=null;D._ready();}},D.POLL_INTERVAL);}else{D._simpleAdd(document,"DOMContentLoaded",D._ready);}}D._simpleAdd(window,"load",D._load);D._simpleAdd(window,"unload",D._unload);D._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};
+var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(K,J){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(K.shiftKey==F.shift&&K.altKey==F.alt&&K.ctrlKey==F.ctrl){var H;var G;if(F.keys instanceof Array){for(var I=0;I<F.keys.length;I++){H=F.keys[I];if(H==K.charCode){D.fire(K.charCode,K);break;}else{if(H==K.keyCode){D.fire(K.keyCode,K);break;}}}}else{H=F.keys;if(H==K.charCode){D.fire(K.charCode,K);}else{if(H==K.keyCode){D.fire(K.keyCode,K);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.1",build:"541"});YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(q){try{var S=YAHOO.util.Event.getTarget(q);if(S.type.toLowerCase()=="submit"){YAHOO.util.Connect._submitElementValue=encodeURIComponent(S.name)+"="+encodeURIComponent(S.value);}}catch(q){}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(S){this._msxml_progid.unshift(S);},setDefaultPostHeader:function(S){if(typeof S=="string"){this._default_post_header=S;}else{if(typeof S=="boolean"){this._use_default_post_header=S;}}},setDefaultXhrHeader:function(S){if(typeof S=="string"){this._default_xhr_header=S;}else{this._use_default_xhr_header=S;}},setPollingInterval:function(S){if(typeof S=="number"&&isFinite(S)){this._polling_interval=S;}},createXhrObject:function(w){var m,S;try{S=new XMLHttpRequest();m={conn:S,tId:w};}catch(R){for(var q=0;q<this._msxml_progid.length;++q){try{S=new ActiveXObject(this._msxml_progid[q]);m={conn:S,tId:w};break;}catch(R){}}}finally{return m;}},getConnectionObject:function(S){var R;var m=this._transaction_id;try{if(!S){R=this.createXhrObject(m);}else{R={};R.tId=m;R.isUpload=true;}if(R){this._transaction_id++;}}catch(q){}finally{return R;}},asyncRequest:function(w,q,m,S){var R=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();if(!R){return null;}else{if(m&&m.customevents){this.initCustomEvents(R,m);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(R,m,q,S);return R;}if(w.toUpperCase()=="GET"){if(this._sFormData.length!==0){q+=((q.indexOf("?")==-1)?"?":"&")+this._sFormData;}else{q+="?"+this._sFormData;}}else{if(w.toUpperCase()=="POST"){S=S?this._sFormData+"&"+S:this._sFormData;}}}R.conn.open(w,q,true);if(this._use_default_xhr_header){if(!this._default_headers["X-Requested-With"]){this.initHeader("X-Requested-With",this._default_xhr_header,true);}}if(this._isFormSubmit==false&&this._use_default_post_header){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(R);}this.handleReadyState(R,m);R.conn.send(S||null);this.startEvent.fire(R);if(R.startEvent){R.startEvent.fire(R);}return R;}},initCustomEvents:function(S,R){for(var q in R.customevents){if(this._customEvents[q][0]){S[this._customEvents[q][0]]=new YAHOO.util.CustomEvent(this._customEvents[q][1],(R.scope)?R.scope:null);S[this._customEvents[q][0]].subscribe(R.customevents[q]);}}},handleReadyState:function(q,R){var S=this;if(R&&R.timeout){this._timeOut[q.tId]=window.setTimeout(function(){S.abort(q,R,true);},R.timeout);}this._poll[q.tId]=window.setInterval(function(){if(q.conn&&q.conn.readyState===4){window.clearInterval(S._poll[q.tId]);delete S._poll[q.tId];if(R&&R.timeout){window.clearTimeout(S._timeOut[q.tId]);delete S._timeOut[q.tId];}S.completeEvent.fire(q);if(q.completeEvent){q.completeEvent.fire(q);}S.handleTransactionResponse(q,R);}},this._polling_interval);},handleTransactionResponse:function(w,V,S){var R,q;try{if(w.conn.status!==undefined&&w.conn.status!==0){R=w.conn.status;}else{R=13030;}}catch(m){R=13030;}if(R>=200&&R<300||R===1223){q=this.createResponseObject(w,(V&&V.argument)?V.argument:undefined);if(V){if(V.success){if(!V.scope){V.success(q);}else{V.success.apply(V.scope,[q]);}}}this.successEvent.fire(q);if(w.successEvent){w.successEvent.fire(q);}}else{switch(R){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:q=this.createExceptionObject(w.tId,(V&&V.argument)?V.argument:undefined,(S?S:false));if(V){if(V.failure){if(!V.scope){V.failure(q);}else{V.failure.apply(V.scope,[q]);}}}break;default:q=this.createResponseObject(w,(V&&V.argument)?V.argument:undefined);if(V){if(V.failure){if(!V.scope){V.failure(q);}else{V.failure.apply(V.scope,[q]);}}}}this.failureEvent.fire(q);if(w.failureEvent){w.failureEvent.fire(q);}}this.releaseObject(w);q=null;},createResponseObject:function(S,d){var m={};var T={};try{var R=S.conn.getAllResponseHeaders();var V=R.split("\n");for(var w=0;w<V.length;w++){var q=V[w].indexOf(":");if(q!=-1){T[V[w].substring(0,q)]=V[w].substring(q+2);}}}catch(N){}m.tId=S.tId;m.status=(S.conn.status==1223)?204:S.conn.status;m.statusText=(S.conn.status==1223)?"No Content":S.conn.statusText;m.getResponseHeader=T;m.getAllResponseHeaders=R;m.responseText=S.conn.responseText;m.responseXML=S.conn.responseXML;if(typeof d!==undefined){m.argument=d;}return m;},createExceptionObject:function(N,m,S){var V=0;var d="communication failure";var R=-1;var q="transaction aborted";var w={};w.tId=N;if(S){w.status=R;w.statusText=q;}else{w.status=V;w.statusText=d;}if(m){w.argument=m;}return w;},initHeader:function(S,m,R){var q=(R)?this._default_headers:this._http_headers;q[S]=m;if(R){this._has_default_headers=true;}else{this._has_http_headers=true;}},setHeader:function(S){if(this._has_default_headers){for(var q in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,q)){S.conn.setRequestHeader(q,this._default_headers[q]);}}}if(this._has_http_headers){for(var q in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,q)){S.conn.setRequestHeader(q,this._http_headers[q]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(M,w,q){this.resetFormState();var f;if(typeof M=="string"){f=(document.getElementById(M)||document.forms[M]);}else{if(typeof M=="object"){f=M;}else{return ;}}if(w){var V=this.createFrame(q?q:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=f;return ;}var S,T,d,p;var N=false;for(var m=0;m<f.elements.length;m++){S=f.elements[m];p=f.elements[m].disabled;T=f.elements[m].name;d=f.elements[m].value;if(!p&&T){switch(S.type){case "select-one":case "select-multiple":for(var R=0;R<S.options.length;R++){if(S.options[R].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(S.options[R].attributes["value"].specified?S.options[R].value:S.options[R].text)+"&";}else{this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(S.options[R].hasAttribute("value")?S.options[R].value:S.options[R].text)+"&";}}}break;case "radio":case "checkbox":if(S.checked){this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}break;case "file":case undefined:case "reset":case "button":break;case "submit":if(N===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+"&";}else{this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}N=true;}break;default:this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}}}this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);this.initHeader("Content-Type",this._default_form_header);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(S){var q="yuiIO"+this._transaction_id;var R;if(window.ActiveXObject){R=document.createElement("<iframe id=\""+q+"\" name=\""+q+"\" />");if(typeof S=="boolean"){R.src="javascript:false";}else{if(typeof secureURI=="string"){R.src=S;}}}else{R=document.createElement("iframe");R.id=q;R.name=q;}R.style.position="absolute";R.style.top="-1000px";R.style.left="-1000px";document.body.appendChild(R);},appendPostData:function(S){var m=[];var q=S.split("&");for(var R=0;R<q.length;R++){var w=q[R].indexOf("=");if(w!=-1){m[R]=document.createElement("input");m[R].type="hidden";m[R].name=q[R].substring(0,w);m[R].value=q[R].substring(w+1);this._formNode.appendChild(m[R]);}}return m;},uploadFile:function(m,p,w,R){var N="yuiIO"+m.tId;var T="multipart/form-data";var f=document.getElementById(N);var U=this;var q={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",w);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",N);if(this._formNode.encoding){this._formNode.setAttribute("encoding",T);}else{this._formNode.setAttribute("enctype",T);}if(R){var M=this.appendPostData(R);}this._formNode.submit();this.startEvent.fire(m);if(m.startEvent){m.startEvent.fire(m);}if(p&&p.timeout){this._timeOut[m.tId]=window.setTimeout(function(){U.abort(m,p,true);},p.timeout);}if(M&&M.length>0){for(var d=0;d<M.length;d++){this._formNode.removeChild(M[d]);}}for(var S in q){if(YAHOO.lang.hasOwnProperty(q,S)){if(q[S]){this._formNode.setAttribute(S,q[S]);}else{this._formNode.removeAttribute(S);}}}this.resetFormState();var V=function(){if(p&&p.timeout){window.clearTimeout(U._timeOut[m.tId]);delete U._timeOut[m.tId];}U.completeEvent.fire(m);if(m.completeEvent){m.completeEvent.fire(m);}var v={};v.tId=m.tId;v.argument=p.argument;try{v.responseText=f.contentWindow.document.body?f.contentWindow.document.body.innerHTML:f.contentWindow.document.documentElement.textContent;v.responseXML=f.contentWindow.document.XMLDocument?f.contentWindow.document.XMLDocument:f.contentWindow.document;}catch(u){}if(p&&p.upload){if(!p.scope){p.upload(v);}else{p.upload.apply(p.scope,[v]);}}U.uploadEvent.fire(v);if(m.uploadEvent){m.uploadEvent.fire(v);}YAHOO.util.Event.removeListener(f,"load",V);setTimeout(function(){document.body.removeChild(f);U.releaseObject(m);},100);};YAHOO.util.Event.addListener(f,"load",V);},abort:function(m,V,S){var R;if(m.conn){if(this.isCallInProgress(m)){m.conn.abort();window.clearInterval(this._poll[m.tId]);delete this._poll[m.tId];if(S){window.clearTimeout(this._timeOut[m.tId]);delete this._timeOut[m.tId];}R=true;}}else{if(m.isUpload===true){var q="yuiIO"+m.tId;var w=document.getElementById(q);if(w){YAHOO.util.Event.removeListener(w,"load",uploadCallback);document.body.removeChild(w);if(S){window.clearTimeout(this._timeOut[m.tId]);delete this._timeOut[m.tId];}R=true;}}else{R=false;}}if(R===true){this.abortEvent.fire(m);if(m.abortEvent){m.abortEvent.fire(m);}this.handleTransactionResponse(m,V,true);}return R;},isCallInProgress:function(q){if(q&&q.conn){return q.conn.readyState!==4&&q.conn.readyState!==0;}else{if(q&&q.isUpload===true){var S="yuiIO"+q.tId;return document.getElementById(S)?true:false;}else{return false;}}},releaseObject:function(S){if(S.conn){S.conn=null;}S=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.3.1",build:"541"});YAHOO.util.Anim=function(B,A,C,D){if(!B){}this.init(B,A,C,D);};YAHOO.util.Anim.prototype={toString:function(){var A=this.getEl();var B=A.id||A.tagName||A;return("Anim "+B);},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(A,C,B){return this.method(this.currentFrame,C,B-C,this.totalFrames);},setAttribute:function(A,C,B){if(this.patterns.noNegatives.test(A)){C=(C>0)?C:0;}YAHOO.util.Dom.setStyle(this.getEl(),A,C+B);},getAttribute:function(A){var C=this.getEl();var E=YAHOO.util.Dom.getStyle(C,A);if(E!=="auto"&&!this.patterns.offsetUnit.test(E)){return parseFloat(E);}var B=this.patterns.offsetAttribute.exec(A)||[];var F=!!(B[3]);var D=!!(B[2]);if(D||(YAHOO.util.Dom.getStyle(C,"position")=="absolute"&&F)){E=C["offset"+B[0].charAt(0).toUpperCase()+B[0].substr(1)];}else{E=0;}return E;},getDefaultUnit:function(A){if(this.patterns.defaultUnit.test(A)){return"px";}return"";},setRuntimeAttribute:function(B){var G;var C;var D=this.attributes;this.runtimeAttributes[B]={};var F=function(H){return(typeof H!=="undefined");};if(!F(D[B]["to"])&&!F(D[B]["by"])){return false;}G=(F(D[B]["from"]))?D[B]["from"]:this.getAttribute(B);if(F(D[B]["to"])){C=D[B]["to"];}else{if(F(D[B]["by"])){if(G.constructor==Array){C=[];for(var E=0,A=G.length;E<A;++E){C[E]=G[E]+D[B]["by"][E]*1;}}else{C=G+D[B]["by"]*1;}}}this.runtimeAttributes[B].start=G;this.runtimeAttributes[B].end=C;this.runtimeAttributes[B].unit=(F(D[B].unit))?D[B]["unit"]:this.getDefaultUnit(B);return true;},init:function(C,H,G,A){var B=false;var D=null;var F=0;C=YAHOO.util.Dom.get(C);this.attributes=H||{};this.duration=!YAHOO.lang.isUndefined(G)?G:1;this.method=A||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(K){C=YAHOO.util.Dom.get(K);};this.getEl=function(){return C;};this.isAnimated=function(){return B;};this.getStartTime=function(){return D;};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;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(K){if(K){this.currentFrame=this.totalFrames;this._onTween.fire();}YAHOO.util.AnimMgr.stop(this);};var J=function(){this.onStart.fire();this.runtimeAttributes={};for(var K in this.attributes){this.setRuntimeAttribute(K);}B=true;F=0;D=new Date();};var I=function(){var M={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};M.toString=function(){return("duration: "+M.duration+", currentFrame: "+M.currentFrame);};this.onTween.fire(M);var L=this.runtimeAttributes;for(var K in L){this.setAttribute(K,this.doMethod(K,L[K].start,L[K].end),L[K].unit);}F+=1;};var E=function(){var K=(new Date()-D)/1000;var L={duration:K,frames:F,fps:F/K};L.toString=function(){return("duration: "+L.duration+", frames: "+L.frames+", fps: "+L.fps);};B=false;F=0;this.onComplete.fire(L);};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(J);this._onTween.subscribe(I);this._onComplete.subscribe(E);}};YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){G._onComplete.fire();F=F||E(G);if(F==-1){return false;}B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){if(B[0].isAnimated()){this.unRegister(B[0],0);}}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){YAHOO.util.ColorAnim=function(E,D,F,G){YAHOO.util.ColorAnim.superclass.constructor.call(this,E,D,F,G);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var B=YAHOO.util;var C=B.ColorAnim.superclass;var A=B.ColorAnim.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("ColorAnim "+E);};A.patterns.color=/color$/i;A.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;A.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;A.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;A.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;A.parseColor=function(D){if(D.length==3){return D;}var E=this.patterns.hex.exec(D);if(E&&E.length==4){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)];}E=this.patterns.rgb.exec(D);if(E&&E.length==4){return[parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10)];
+}E=this.patterns.hex3.exec(D);if(E&&E.length==4){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)];}return null;};A.getAttribute=function(D){var F=this.getEl();if(this.patterns.color.test(D)){var G=YAHOO.util.Dom.getStyle(F,D);if(this.patterns.transparent.test(G)){var E=F.parentNode;G=B.Dom.getStyle(E,D);while(E&&this.patterns.transparent.test(G)){E=E.parentNode;G=B.Dom.getStyle(E,D);if(E.tagName.toUpperCase()=="HTML"){G="#fff";}}}}else{G=C.getAttribute.call(this,D);}return G;};A.doMethod=function(E,I,F){var H;if(this.patterns.color.test(E)){H=[];for(var G=0,D=I.length;G<D;++G){H[G]=C.doMethod.call(this,E,I[G],F[G]);}H="rgb("+Math.floor(H[0])+","+Math.floor(H[1])+","+Math.floor(H[2])+")";}else{H=C.doMethod.call(this,E,I,F);}return H;};A.setRuntimeAttribute=function(E){C.setRuntimeAttribute.call(this,E);if(this.patterns.color.test(E)){var G=this.attributes;var I=this.parseColor(this.runtimeAttributes[E].start);var F=this.parseColor(this.runtimeAttributes[E].end);if(typeof G[E]["to"]==="undefined"&&typeof G[E]["by"]!=="undefined"){F=this.parseColor(G[E].by);for(var H=0,D=I.length;H<D;++H){F[H]=I[H]+F[H];}}this.runtimeAttributes[E].start=I;this.runtimeAttributes[E].end=F;}};})();YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){YAHOO.util.Motion=function(G,F,H,I){if(G){YAHOO.util.Motion.superclass.constructor.call(this,G,F,H,I);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var D=YAHOO.util;var E=D.Motion.superclass;var B=D.Motion.prototype;B.toString=function(){var F=this.getEl();var G=F.id||F.tagName;return("Motion "+G);};B.patterns.points=/^points$/i;B.setAttribute=function(F,H,G){if(this.patterns.points.test(F)){G=G||"px";E.setAttribute.call(this,"left",H[0],G);E.setAttribute.call(this,"top",H[1],G);}else{E.setAttribute.call(this,F,H,G);}};B.getAttribute=function(F){if(this.patterns.points.test(F)){var G=[E.getAttribute.call(this,"left"),E.getAttribute.call(this,"top")];}else{G=E.getAttribute.call(this,F);}return G;};B.doMethod=function(F,J,G){var I=null;if(this.patterns.points.test(F)){var H=this.method(this.currentFrame,0,100,this.totalFrames)/100;I=D.Bezier.getPosition(this.runtimeAttributes[F],H);}else{I=E.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(O){if(this.patterns.points.test(O)){var G=this.getEl();var I=this.attributes;var F;var K=I["points"]["control"]||[];var H;var L,N;if(K.length>0&&!(K[0] instanceof Array)){K=[K];}else{var J=[];for(L=0,N=K.length;L<N;++L){J[L]=K[L];}K=J;}if(D.Dom.getStyle(G,"position")=="static"){D.Dom.setStyle(G,"position","relative");}if(C(I["points"]["from"])){D.Dom.setXY(G,I["points"]["from"]);}else{D.Dom.setXY(G,D.Dom.getXY(G));}F=this.getAttribute("points");if(C(I["points"]["to"])){H=A.call(this,I["points"]["to"],F);var M=D.Dom.getXY(this.getEl());for(L=0,N=K.length;L<N;++L){K[L]=A.call(this,K[L],F);}}else{if(C(I["points"]["by"])){H=[F[0]+I["points"]["by"][0],F[1]+I["points"]["by"][1]];for(L=0,N=K.length;L<N;++L){K[L]=[F[0]+K[L][0],F[1]+K[L][1]];}}}this.runtimeAttributes[O]=[F];if(K.length>0){this.runtimeAttributes[O]=this.runtimeAttributes[O].concat(K);}this.runtimeAttributes[O][this.runtimeAttributes[O].length]=H;}else{E.setRuntimeAttribute.call(this,O);}};var A=function(F,H){var G=D.Dom.getXY(this.getEl());F=[F[0]-G[0]+H[0],F[1]-G[1]+H[1]];return F;};var C=function(F){return(typeof F!=="undefined");};})();(function(){YAHOO.util.Scroll=function(E,D,F,G){if(E){YAHOO.util.Scroll.superclass.constructor.call(this,E,D,F,G);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var B=YAHOO.util;var C=B.Scroll.superclass;var A=B.Scroll.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("Scroll "+E);};A.doMethod=function(D,G,E){var F=null;if(D=="scroll"){F=[this.method(this.currentFrame,G[0],E[0]-G[0],this.totalFrames),this.method(this.currentFrame,G[1],E[1]-G[1],this.totalFrames)];
+}else{F=C.doMethod.call(this,D,G,E);}return F;};A.getAttribute=function(D){var F=null;var E=this.getEl();if(D=="scroll"){F=[E.scrollLeft,E.scrollTop];}else{F=C.getAttribute.call(this,D);}return F;};A.setAttribute=function(D,G,F){var E=this.getEl();if(D=="scroll"){E.scrollLeft=G[0];E.scrollTop=G[1];}else{C.setAttribute.call(this,D,G,F);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.3.1",build:"541"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(D,C){for(var E in this.ids){for(var B in this.ids[E]){var F=this.ids[E][B];if(!this.isTypeOfDD(F)){continue;}F[D].apply(F,C);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(B){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(C,B){if(!this.initialized){this.init();}if(!this.ids[B]){this.ids[B]={};}this.ids[B][C.id]=C;},removeDDFromGroup:function(D,B){if(!this.ids[B]){this.ids[B]={};}var C=this.ids[B];if(C&&C[D.id]){delete C[D.id];}},_remove:function(C){for(var B in C.groups){if(B&&this.ids[B][C.id]){delete this.ids[B][C.id];}}delete this.handleIds[C.id];},regHandle:function(C,B){if(!this.handleIds[C]){this.handleIds[C]={};}this.handleIds[C][B]=B;},isDragDrop:function(B){return(this.getDDById(B))?true:false;},getRelated:function(G,C){var F=[];for(var E in G.groups){for(var D in this.ids[E]){var B=this.ids[E][D];if(!this.isTypeOfDD(B)){continue;}if(!C||B.isTarget){F[F.length]=B;}}}return F;},isLegalTarget:function(F,E){var C=this.getRelated(F,true);for(var D=0,B=C.length;D<B;++D){if(C[D].id==E.id){return true;}}return false;},isTypeOfDD:function(B){return(B&&B.__ygDragDrop);},isHandle:function(C,B){return(this.handleIds[C]&&this.handleIds[C][B]);},getDDById:function(C){for(var B in this.ids){if(this.ids[B][C]){return this.ids[B][C];}}return null;},handleMouseDown:function(D,C){this.currentTarget=YAHOO.util.Event.getTarget(D);this.dragCurrent=C;var B=C.getEl();this.startX=YAHOO.util.Event.getPageX(D);this.startY=YAHOO.util.Event.getPageY(D);this.deltaX=this.startX-B.offsetLeft;this.deltaY=this.startY-B.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var E=YAHOO.util.DDM;E.startDrag(E.startX,E.startY);},this.clickTimeThresh);},startDrag:function(B,D){clearTimeout(this.clickTimeout);var C=this.dragCurrent;if(C){C.b4StartDrag(B,D);}if(C){C.startDrag(B,D);}this.dragThreshMet=true;},handleMouseUp:function(B){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(B,true);}else{}this.stopDrag(B);this.stopEvent(B);}},stopEvent:function(B){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(B);}if(this.preventDefault){YAHOO.util.Event.preventDefault(B);}},stopDrag:function(C,B){if(this.dragCurrent&&!B){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(C);this.dragCurrent.endDrag(C);}this.dragCurrent.onMouseUp(C);}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(E){var B=this.dragCurrent;if(B){if(YAHOO.util.Event.isIE&&!E.button){this.stopEvent(E);return this.handleMouseUp(E);}if(!this.dragThreshMet){var D=Math.abs(this.startX-YAHOO.util.Event.getPageX(E));var C=Math.abs(this.startY-YAHOO.util.Event.getPageY(E));if(D>this.clickPixelThresh||C>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){B.b4Drag(E);if(B){B.onDrag(E);}if(B){this.fireEvents(E,false);}}this.stopEvent(E);}},fireEvents:function(Q,H){var S=this.dragCurrent;if(!S||S.isLocked()){return ;}var J=YAHOO.util.Event.getPageX(Q),I=YAHOO.util.Event.getPageY(Q),K=new YAHOO.util.Point(J,I),F=S.getTargetCoord(K.x,K.y),C=S.getDragEl(),P=new YAHOO.util.Region(F.y,F.x+C.offsetWidth,F.y+C.offsetHeight,F.x),E=[],G=[],B=[],R=[],O=[];for(var M in this.dragOvers){var T=this.dragOvers[M];if(!this.isTypeOfDD(T)){continue;}if(!this.isOverTarget(K,T,this.mode,P)){G.push(T);}E[M]=true;delete this.dragOvers[M];}for(var L in S.groups){if("string"!=typeof L){continue;}for(M in this.ids[L]){var D=this.ids[L][M];if(!this.isTypeOfDD(D)){continue;}if(D.isTarget&&!D.isLocked()&&D!=S){if(this.isOverTarget(K,D,this.mode,P)){if(H){R.push(D);}else{if(!E[D.id]){O.push(D);}else{B.push(D);}this.dragOvers[D.id]=D;}}}}}this.interactionInfo={out:G,enter:O,over:B,drop:R,point:K,draggedRegion:P,sourceRegion:this.locationCache[S.id],validDrop:H};if(H&&!R.length){this.interactionInfo.validDrop=false;S.onInvalidDrop(Q);}if(this.mode){if(G.length){S.b4DragOut(Q,G);if(S){S.onDragOut(Q,G);}}if(O.length){if(S){S.onDragEnter(Q,O);}}if(B.length){if(S){S.b4DragOver(Q,B);}if(S){S.onDragOver(Q,B);}}if(R.length){if(S){S.b4DragDrop(Q,R);}if(S){S.onDragDrop(Q,R);}}}else{var N=0;for(M=0,N=G.length;M<N;++M){if(S){S.b4DragOut(Q,G[M].id);}if(S){S.onDragOut(Q,G[M].id);}}for(M=0,N=O.length;M<N;++M){if(S){S.onDragEnter(Q,O[M].id);}}for(M=0,N=B.length;M<N;++M){if(S){S.b4DragOver(Q,B[M].id);}if(S){S.onDragOver(Q,B[M].id);}}for(M=0,N=R.length;M<N;++M){if(S){S.b4DragDrop(Q,R[M].id);}if(S){S.onDragDrop(Q,R[M].id);}}}},getBestMatch:function(D){var F=null;var C=D.length;if(C==1){F=D[0];}else{for(var E=0;E<C;++E){var B=D[E];if(this.mode==this.INTERSECT&&B.cursorIsOver){F=B;break;}else{if(!F||!F.overlap||(B.overlap&&F.overlap.getArea()<B.overlap.getArea())){F=B;}}}}return F;},refreshCache:function(C){var E=C||this.ids;for(var B in E){if("string"!=typeof B){continue;}for(var D in this.ids[B]){var F=this.ids[B][D];if(this.isTypeOfDD(F)){var G=this.getLocation(F);if(G){this.locationCache[F.id]=G;}else{delete this.locationCache[F.id];}}}}},verifyEl:function(C){try{if(C){var B=C.offsetParent;if(B){return true;}}}catch(D){}return false;},getLocation:function(G){if(!this.isTypeOfDD(G)){return null;}var E=G.getEl(),J,D,C,L,K,M,B,I,F;try{J=YAHOO.util.Dom.getXY(E);}catch(H){}if(!J){return null;
+}D=J[0];C=D+E.offsetWidth;L=J[1];K=L+E.offsetHeight;M=L-G.padding[0];B=C+G.padding[1];I=K+G.padding[2];F=D-G.padding[3];return new YAHOO.util.Region(M,B,I,F);},isOverTarget:function(J,B,D,E){var F=this.locationCache[B.id];if(!F||!this.useCache){F=this.getLocation(B);this.locationCache[B.id]=F;}if(!F){return false;}B.cursorIsOver=F.contains(J);var I=this.dragCurrent;if(!I||(!D&&!I.constrainX&&!I.constrainY)){return B.cursorIsOver;}B.overlap=null;if(!E){var G=I.getTargetCoord(J.x,J.y);var C=I.getDragEl();E=new YAHOO.util.Region(G.y,G.x+C.offsetWidth,G.y+C.offsetHeight,G.x);}var H=E.intersect(F);if(H){B.overlap=H;return(D)?true:B.cursorIsOver;}else{return false;}},_onUnload:function(C,B){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);this.ids={};},elementCache:{},getElWrapper:function(C){var B=this.elementCache[C];if(!B||!B.el){B=this.elementCache[C]=new this.ElementWrapper(YAHOO.util.Dom.get(C));}return B;},getElement:function(B){return YAHOO.util.Dom.get(B);},getCss:function(C){var B=YAHOO.util.Dom.get(C);return(B)?B.style:null;},ElementWrapper:function(B){this.el=B||null;this.id=this.el&&B.id;this.css=this.el&&B.style;},getPosX:function(B){return YAHOO.util.Dom.getX(B);},getPosY:function(B){return YAHOO.util.Dom.getY(B);},swapNode:function(D,B){if(D.swapNode){D.swapNode(B);}else{var E=B.parentNode;var C=B.nextSibling;if(C==D){E.insertBefore(D,B);}else{if(B==D.nextSibling){E.insertBefore(B,D);}else{D.parentNode.replaceChild(B,D);E.insertBefore(D,C);}}}},getScroll:function(){var D,B,E=document.documentElement,C=document.body;if(E&&(E.scrollTop||E.scrollLeft)){D=E.scrollTop;B=E.scrollLeft;}else{if(C){D=C.scrollTop;B=C.scrollLeft;}else{}}return{top:D,left:B};},getStyle:function(C,B){return YAHOO.util.Dom.getStyle(C,B);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(B,D){var C=YAHOO.util.Dom.getXY(D);YAHOO.util.Dom.setXY(B,C);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(C,B){return(C-B);},_timeoutCount:0,_addListeners:function(){var B=YAHOO.util.DDM;if(YAHOO.util.Event&&document){B._onLoad();}else{if(B._timeoutCount>2000){}else{setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1;}}}},handleWasClicked:function(B,D){if(this.isHandle(D,B.id)){return true;}else{var C=B.parentNode;while(C){if(this.isHandle(D,C.id)){return true;}else{C=C.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}(function(){var A=YAHOO.util.Event;var B=YAHOO.util.Dom;YAHOO.util.DragDrop=function(E,C,D){if(E){this.init(E,C,D);}};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,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,cursorIsOver:false,overlap:null,b4StartDrag:function(C,D){},startDrag:function(C,D){},b4Drag:function(C){},onDrag:function(C){},onDragEnter:function(C,D){},b4DragOver:function(C){},onDragOver:function(C,D){},b4DragOut:function(C){},onDragOut:function(C,D){},b4DragDrop:function(C){},onDragDrop:function(C,D){},onInvalidDrop:function(C){},b4EndDrag:function(C){},endDrag:function(C){},b4MouseDown:function(C){},onMouseDown:function(C){},onMouseUp:function(C){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=B.get(this.id);}return this._domRef;},getDragEl:function(){return B.get(this.dragElId);},init:function(E,C,D){this.initTarget(E,C,D);A.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(E,C,D){this.config=D||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof E!=="string"){this._domRef=E;E=B.generateId(E);}this.id=E;this.addToGroup((C)?C:"default");this.handleElId=E;A.onAvailable(E,this.handleOnAvailable,this,true);this.setDragElId(E);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(E,C,F,D){if(!C&&0!==C){this.padding=[E,E,E,E];}else{if(!F&&0!==F){this.padding=[E,C,E,C];}else{this.padding=[E,C,F,D];}}},setInitPosition:function(F,E){var G=this.getEl();if(!this.DDM.verifyEl(G)){return ;}var D=F||0;var C=E||0;var H=B.getXY(G);this.initPageX=H[0]-D;this.initPageY=H[1]-C;this.lastPageX=H[0];this.lastPageY=H[1];this.setStartPosition(H);},setStartPosition:function(D){var C=D||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=C[0];this.startPageY=C[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}this.DDM.removeDDFromGroup(this,C);},setDragElId:function(C){this.dragElId=C;},setHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.handleElId=C;this.DDM.regHandle(this.id,C);},setOuterHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}A.on(C,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(C);this.hasOuterHandles=true;},unreg:function(){A.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(F,E){var C=F.which||F.button;
+if(this.primaryButtonOnly&&C>1){return ;}if(this.isLocked()){return ;}this.b4MouseDown(F);this.onMouseDown(F);this.DDM.refreshCache(this.groups);var D=new YAHOO.util.Point(A.getPageX(F),A.getPageY(F));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(D,this)){}else{if(this.clickValidator(F)){this.setStartPosition();this.DDM.handleMouseDown(F,this);this.DDM.stopEvent(F);}else{}}},clickValidator:function(D){var C=A.getTarget(D);return(this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));},getTargetCoord:function(E,D){var C=E-this.deltaX;var F=D-this.deltaY;if(this.constrainX){if(C<this.minX){C=this.minX;}if(C>this.maxX){C=this.maxX;}}if(this.constrainY){if(F<this.minY){F=this.minY;}if(F>this.maxY){F=this.maxY;}}C=this.getTick(C,this.xTicks);F=this.getTick(F,this.yTicks);return{x:C,y:F};},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.invalidHandleIds[C]=C;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}delete this.invalidHandleIds[C];},removeInvalidHandleClass:function(D){for(var E=0,C=this.invalidHandleClasses.length;E<C;++E){if(this.invalidHandleClasses[E]==D){delete this.invalidHandleClasses[E];}}},isValidHandleChild:function(F){var E=true;var H;try{H=F.nodeName.toUpperCase();}catch(G){H=F.nodeName;}E=E&&!this.invalidHandleTypes[H];E=E&&!this.invalidHandleIds[F.id];for(var D=0,C=this.invalidHandleClasses.length;E&&D<C;++D){E=!B.hasClass(F,this.invalidHandleClasses[D]);}return E;},setXTicks:function(F,C){this.xTicks=[];this.xTickSize=C;var E={};for(var D=this.initPageX;D>=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(E,D,C){this.leftConstraint=parseInt(E,10);this.rightConstraint=parseInt(D,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(C){this.setXTicks(this.initPageX,C);}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(C,E,D){this.topConstraint=parseInt(C,10);this.bottomConstraint=parseInt(E,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(D){this.setYTicks(this.initPageY,D);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C);}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(I,F){if(!F){return I;}else{if(F[0]>=I){return F[0];}else{for(var D=0,C=F.length;D<C;++D){var E=D+1;if(F[E]&&F[E]>=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E];}}return F[F.length-1];}}},toString:function(){return("DragDrop "+this.id);}};})();YAHOO.util.DD=function(C,A,B){if(C){this.init(C,A,B);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D);},setDelta:function(B,A){this.deltaX=B;this.deltaY=A;},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B);},alignElWithMouse:function(B,F,E){var D=this.getTargetCoord(F,E);if(!this.deltaSetXY){var G=[D.x,D.y];YAHOO.util.Dom.setXY(B,G);var C=parseInt(YAHOO.util.Dom.getStyle(B,"left"),10);var A=parseInt(YAHOO.util.Dom.getStyle(B,"top"),10);this.deltaSetXY=[C-D.x,A-D.y];}else{YAHOO.util.Dom.setStyle(B,"left",(D.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(B,"top",(D.y+this.deltaSetXY[1])+"px");}this.cachePosition(D.x,D.y);this.autoScroll(D.x,D.y,B.offsetHeight,B.offsetWidth);},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A;}else{var C=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(J,I,E,K){if(this.scroll){var L=this.DDM.getClientHeight();var B=this.DDM.getClientWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G<C){window.scrollTo(D,N+A);}if(I<N&&N>0&&I-N<C){window.scrollTo(D,N-A);}if(M>B&&F<C){window.scrollTo(D+A,N);}if(J<D&&D>0&&J-D<C){window.scrollTo(D-A,N);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(A){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},b4Drag:function(A){this.setDragElPos(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var B=this,A=document.body;if(!A||!A.firstChild){setTimeout(function(){B.createFrame();},50);return ;}var F=this.getDragEl(),E=YAHOO.util.Dom;if(!F){F=document.createElement("div");F.id=this.dragElId;var D=F.style;
+D.position="absolute";D.visibility="hidden";D.cursor="move";D.border="2px solid #aaa";D.zIndex=999;D.height="25px";D.width="25px";var C=document.createElement("div");E.setStyle(C,"height","100%");E.setStyle(C,"width","100%");E.setStyle(C,"background-color","#ccc");E.setStyle(C,"opacity","0");F.appendChild(C);A.insertBefore(F,A.firstChild);}},initFrame:function(){this.createFrame();},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);},showFrame:function(E,D){var C=this.getEl();var A=this.getDragEl();var B=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(B.width,10)/2),Math.round(parseInt(B.height,10)/2));}this.setDragElPos(E,D);YAHOO.util.Dom.setStyle(A,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var H=YAHOO.util.Dom;var B=this.getEl();var C=this.getDragEl();var G=parseInt(H.getStyle(C,"borderTopWidth"),10);var I=parseInt(H.getStyle(C,"borderRightWidth"),10);var F=parseInt(H.getStyle(C,"borderBottomWidth"),10);var D=parseInt(H.getStyle(C,"borderLeftWidth"),10);if(isNaN(G)){G=0;}if(isNaN(I)){I=0;}if(isNaN(F)){F=0;}if(isNaN(D)){D=0;}var E=Math.max(0,B.offsetWidth-I-D);var A=Math.max(0,B.offsetHeight-G-F);H.setStyle(C,"width",E+"px");H.setStyle(C,"height",A+"px");}},b4MouseDown:function(B){this.setStartPosition();var A=YAHOO.util.Event.getPageX(B);var C=YAHOO.util.Event.getPageY(B);this.autoOffset(A,C);},b4StartDrag:function(A,B){this.showFrame(A,B);},b4EndDrag:function(A){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(D){var C=YAHOO.util.Dom;var B=this.getEl();var A=this.getDragEl();C.setStyle(A,"visibility","");C.setStyle(B,"visibility","hidden");YAHOO.util.DDM.moveToEl(B,A);C.setStyle(A,"visibility","hidden");C.setStyle(B,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(C,A,B){if(C){this.initTarget(C,A,B);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.3.1",build:"541"});YAHOO.util.Attribute=function(B,A){if(A){this.owner=A;this.configure(B,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(F,B){var E;var A=this.owner;var C=this.name;var D={type:C,prevValue:this.getValue(),newValue:F};if(this.readOnly||(this.writeOnce&&this._written)){return false;}if(this.validator&&!this.validator.call(A,F)){return false;}if(!B){E=A.fireBeforeChangeEvent(D);if(E===false){return false;}}if(this.method){this.method.call(A,F);}this.value=F;this._written=true;D.type=C;if(!B){this.owner.fireChangeEvent(D);}return true;},configure:function(B,C){B=B||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var A in B){if(A&&YAHOO.lang.hasOwnProperty(B,A)){this[A]=B[A];if(C){this._initialConfig[A]=B[A];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(A){this.setValue(this.value,A);}};(function(){var A=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(C){this._configs=this._configs||{};var B=this._configs[C];if(!B){return undefined;}return B.value;},set:function(D,E,B){this._configs=this._configs||{};var C=this._configs[D];if(!C){return false;}return C.setValue(E,B);},getAttributeKeys:function(){this._configs=this._configs;var D=[];var B;for(var C in this._configs){B=this._configs[C];if(A.hasOwnProperty(this._configs,C)&&!A.isUndefined(B)){D[D.length]=C;}}return D;},setAttributes:function(D,B){for(var C in D){if(A.hasOwnProperty(D,C)){this.set(C,D[C],B);}}},resetValue:function(C,B){this._configs=this._configs||{};if(this._configs[C]){this.set(C,this._configs[C]._initialConfig.value,B);return true;}return false;},refresh:function(E,C){this._configs=this._configs;E=((A.isString(E))?[E]:E)||this.getAttributeKeys();for(var D=0,B=E.length;D<B;++D){if(this._configs[E[D]]&&!A.isUndefined(this._configs[E[D]].value)&&!A.isNull(this._configs[E[D]].value)){this._configs[E[D]].refresh(C);}}},register:function(B,C){this.setAttributeConfig(B,C);},getAttributeConfig:function(C){this._configs=this._configs||{};var B=this._configs[C]||{};var D={};for(C in B){if(A.hasOwnProperty(B,C)){D[C]=B[C];}}return D;},setAttributeConfig:function(B,C,D){this._configs=this._configs||{};C=C||{};if(!this._configs[B]){C.name=B;this._configs[B]=this.createAttribute(C);}else{this._configs[B].configure(C,D);}},configureAttribute:function(B,C,D){this.setAttributeConfig(B,C,D);},resetAttributeConfig:function(B){this._configs=this._configs||{};this._configs[B].resetConfig();},subscribe:function(B,C){this._events=this._events||{};if(!(B in this._events)){this._events[B]=this.createEvent(B);}YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){this.subscribe.apply(this,arguments);},addListener:function(){this.subscribe.apply(this,arguments);},fireBeforeChangeEvent:function(C){var B="before";B+=C.type.charAt(0).toUpperCase()+C.type.substr(1)+"Change";C.type=B;return this.fireEvent(C.type,C);},fireChangeEvent:function(B){B.type+="Change";return this.fireEvent(B.type,B);},createAttribute:function(B){return new YAHOO.util.Attribute(B,this);}};YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider);})();(function(){var D=YAHOO.util.Dom,F=YAHOO.util.AttributeProvider;YAHOO.util.Element=function(G,H){if(arguments.length){this.init(G,H);}};YAHOO.util.Element.prototype={DOM_EVENTS:null,appendChild:function(G){G=G.get?G.get("element"):G;this.get("element").appendChild(G);},getElementsByTagName:function(G){return this.get("element").getElementsByTagName(G);},hasChildNodes:function(){return this.get("element").hasChildNodes();},insertBefore:function(G,H){G=G.get?G.get("element"):G;H=(H&&H.get)?H.get("element"):H;this.get("element").insertBefore(G,H);},removeChild:function(G){G=G.get?G.get("element"):G;this.get("element").removeChild(G);return true;},replaceChild:function(G,H){G=G.get?G.get("element"):G;H=H.get?H.get("element"):H;return this.get("element").replaceChild(G,H);},initAttributes:function(G){},addListener:function(K,J,L,I){var H=this.get("element");I=I||this;H=this.get("id")||H;var G=this;if(!this._events[K]){if(this.DOM_EVENTS[K]){YAHOO.util.Event.addListener(H,K,function(M){if(M.srcElement&&!M.target){M.target=M.srcElement;}G.fireEvent(K,M);},L,I);}this.createEvent(K,this);}YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){this.addListener.apply(this,arguments);},subscribe:function(){this.addListener.apply(this,arguments);},removeListener:function(H,G){this.unsubscribe.apply(this,arguments);},addClass:function(G){D.addClass(this.get("element"),G);},getElementsByClassName:function(H,G){return D.getElementsByClassName(H,G,this.get("element"));},hasClass:function(G){return D.hasClass(this.get("element"),G);},removeClass:function(G){return D.removeClass(this.get("element"),G);},replaceClass:function(H,G){return D.replaceClass(this.get("element"),H,G);},setStyle:function(I,H){var G=this.get("element");if(!G){return this._queue[this._queue.length]=["setStyle",arguments];}return D.setStyle(G,I,H);},getStyle:function(G){return D.getStyle(this.get("element"),G);},fireQueue:function(){var H=this._queue;for(var I=0,G=H.length;I<G;++I){this[H[I][0]].apply(this,H[I][1]);}},appendTo:function(H,I){H=(H.get)?H.get("element"):D.get(H);this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:H});I=(I&&I.get)?I.get("element"):D.get(I);var G=this.get("element");if(!G){return false;}if(!H){return false;}if(G.parent!=H){if(I){H.insertBefore(G,I);}else{H.appendChild(G);}}this.fireEvent("appendTo",{type:"appendTo",target:H});},get:function(G){var I=this._configs||{};var H=I.element;if(H&&!I[G]&&!YAHOO.lang.isUndefined(H.value[G])){return H.value[G];}return F.prototype.get.call(this,G);},setAttributes:function(L,H){var K=this.get("element");
+for(var J in L){if(!this._configs[J]&&!YAHOO.lang.isUndefined(K[J])){this.setAttributeConfig(J);}}for(var I=0,G=this._configOrder.length;I<G;++I){if(L[this._configOrder[I]]){this.set(this._configOrder[I],L[this._configOrder[I]],H);}}},set:function(H,J,G){var I=this.get("element");if(!I){this._queue[this._queue.length]=["set",arguments];if(this._configs[H]){this._configs[H].value=J;}return ;}if(!this._configs[H]&&!YAHOO.lang.isUndefined(I[H])){C.call(this,H);}return F.prototype.set.apply(this,arguments);},setAttributeConfig:function(G,I,J){var H=this.get("element");if(H&&!this._configs[G]&&!YAHOO.lang.isUndefined(H[G])){C.call(this,G,I);}else{F.prototype.setAttributeConfig.apply(this,arguments);}this._configOrder.push(G);},getAttributeKeys:function(){var H=this.get("element");var I=F.prototype.getAttributeKeys.call(this);for(var G in H){if(!this._configs[G]){I[G]=I[G]||H[G];}}return I;},createEvent:function(H,G){this._events[H]=true;F.prototype.createEvent.apply(this,arguments);},init:function(H,G){A.apply(this,arguments);}};var A=function(H,G){this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};this._configOrder=[];G=G||{};G.element=G.element||H||null;this.DOM_EVENTS={"click":true,"dblclick":true,"keydown":true,"keypress":true,"keyup":true,"mousedown":true,"mousemove":true,"mouseout":true,"mouseover":true,"mouseup":true,"focus":true,"blur":true,"submit":true};var I=false;if(YAHOO.lang.isString(H)){C.call(this,"id",{value:G.element});}if(D.get(H)){I=true;E.call(this,G);B.call(this,G);}YAHOO.util.Event.onAvailable(G.element,function(){if(!I){E.call(this,G);}this.fireEvent("available",{type:"available",target:G.element});},this,true);YAHOO.util.Event.onContentReady(G.element,function(){if(!I){B.call(this,G);}this.fireEvent("contentReady",{type:"contentReady",target:G.element});},this,true);};var E=function(G){this.setAttributeConfig("element",{value:D.get(G.element),readOnly:true});};var B=function(G){this.initAttributes(G);this.setAttributes(G,true);this.fireQueue();};var C=function(G,I){var H=this.get("element");I=I||{};I.name=G;I.method=I.method||function(J){H[G]=J;};I.value=I.value||H[G];this._configs[G]=new YAHOO.util.Attribute(I,this);};YAHOO.augment(YAHOO.util.Element,F);})();YAHOO.register("element",YAHOO.util.Element,{version:"2.3.1",build:"541"});YAHOO.register("utilities", YAHOO, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/yahoo-dom-event.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/yahoo-dom-event.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/yahoo-dom-event.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,10 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang={isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice)&&!A.hasOwnProperty(B.length);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var C={},A=arguments,B;for(B=0;B<A.length;B=B+1){YAHOO.lang.augmentObject(C,A[B],true);}return C;},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.1",build:"541"});(function(){var B=YAHOO.util,K,I,H=0,J={},F={};var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var M=function(O){if(!E.HYPHEN.test(O)){return O;}if(J[O]){return J[O];}var P=O;while(E.HYPHEN.exec(P)){P=P.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[O]=P;return P;};var N=function(P){var O=F[P];if(!O){O=new RegExp("(?:^|\\s+)"+P+"(?:\\s+|$)");F[P]=O;}return O;};if(document.defaultView&&document.defaultView.getComputedStyle){K=function(O,R){var Q=null;if(R=="float"){R="cssFloat";}var P=document.defaultView.getComputedStyle(O,"");if(P){Q=P[M(R)];}return O.style[R]||Q;};}else{if(document.documentElement.currentStyle&&G){K=function(O,Q){switch(M(Q)){case"opacity":var S=100;try{S=O.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(R){try{S=O.filters("alpha").opacity;}catch(R){}}return S/100;case"float":Q="styleFloat";default:var P=O.currentStyle?O.currentStyle[Q]:null;return(O.style[Q]||P);}};}else{K=function(O,P){return O.style[P];};}}if(G){I=function(O,P,Q){switch(P){case"opacity":if(YAHOO.lang.isString(O.style.filter)){O.style.filter="alpha(opacity="+Q*100+")";if(!O.currentStyle||!O.currentStyle.hasLayout){O.style.zoom=1;}}break;case"float":P="styleFloat";default:O.style[P]=Q;}};}else{I=function(O,P,Q){if(P=="float"){P="cssFloat";}O.style[P]=Q;};}var D=function(O,P){return O&&O.nodeType==1&&(!P||P(O));};YAHOO.util.Dom={get:function(Q){if(Q&&(Q.tagName||Q.item)){return Q;}if(YAHOO.lang.isString(Q)||!Q){return document.getElementById(Q);}if(Q.length!==undefined){var R=[];for(var P=0,O=Q.length;P<O;++P){R[R.length]=B.Dom.get(Q[P]);}return R;}return Q;},getStyle:function(O,Q){Q=M(Q);var P=function(R){return K(R,Q);};return B.Dom.batch(O,P,B.Dom,true);},setStyle:function(O,Q,R){Q=M(Q);var P=function(S){I(S,Q,R);};B.Dom.batch(O,P,B.Dom,true);},getXY:function(O){var P=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=document.body){return false;}var Q=null;var V=[];var S;var T=R.ownerDocument;if(R.getBoundingClientRect){S=R.getBoundingClientRect();return[S.left+B.Dom.getDocumentScrollLeft(R.ownerDocument),S.top+B.Dom.getDocumentScrollTop(R.ownerDocument)];}else{V=[R.offsetLeft,R.offsetTop];Q=R.offsetParent;var U=this.getStyle(R,"position")=="absolute";if(Q!=R){while(Q){V[0]+=Q.offsetLeft;V[1]+=Q.offsetTop;if(L&&!U&&this.getStyle(Q,"position")=="absolute"){U=true;}Q=Q.offsetParent;}}if(L&&U){V[0]-=R.ownerDocument.body.offsetLeft;V[1]-=R.ownerDocument.body.offsetTop;}}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(B.Dom.getStyle(Q,"display").search(/^inline|table-row.*$/i)){V[0]-=Q.scrollLeft;V[1]-=Q.scrollTop;}Q=Q.parentNode;}return V;};return B.Dom.batch(O,P,B.Dom,true);},getX:function(O){var P=function(Q){return B.Dom.getXY(Q)[0];};return B.Dom.batch(O,P,B.Dom,true);},getY:function(O){var P=function(Q){return B.Dom.getXY(Q)[1];};return B.Dom.batch(O,P,B.Dom,true);},setXY:function(O,R,Q){var P=function(U){var T=this.getStyle(U,"position");if(T=="static"){this.setStyle(U,"position","relative");T="relative";}var W=this.getXY(U);if(W===false){return false;}var V=[parseInt(this.getStyle(U,"left"),10),parseInt(this.getStyle(U,"top"),10)];if(isNaN(V[0])){V[0]=(T=="relative")?0:U.offsetLeft;}if(isNaN(V[1])){V[1]=(T=="relative")?0:U.offsetTop;}if(R[0]!==null){U.style.left=R[0]-W[0]+V[0]+"px";}if(R[1]!==null){U.style.top=R[1]-W[1]+V[1]+"px";}if(!Q){var S=this.getXY(U);if((R[0]!==null&&S[0]!=R[0])||(R[1]!==null&&S[1]!=R[1])){this.setXY(U,R,true);}}};B.Dom.batch(O,P,B.Dom,true);},setX:function(P,O){B.Dom.setXY(P,[O,null]);},setY:function(O,P){B.Dom.setXY(O,[null,P]);},getRegion:function(O){var P=function(Q){if((Q.parentNode===null||Q.offsetParent===null||this.getStyle(Q,"display")=="none")&&Q!=document.body){return false;}var R=B.Region.getRegion(Q);return R;};return B.Dom.batch(O,P,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(S,W,T,U){W=W||"*";T=(T)?B.Dom.get(T):null||document;if(!T){return[];}var P=[],O=T.getElementsByTagName(W),V=N(S);for(var Q=0,R=O.length;Q<R;++Q){if(V.test(O[Q].className)){P[P.length]=O[Q];if(U){U.call(O[Q],O[Q]);}}}return P;},hasClass:function(Q,P){var O=N(P);var R=function(S){return O.test(S.className);};return B.Dom.batch(Q,R,B.Dom,true);},addClass:function(P,O){var Q=function(R){if(this.hasClass(R,O)){return false;}R.className=YAHOO.lang.trim([R.className,O].join(" "));return true;};return B.Dom.batch(P,Q,B.Dom,true);},removeClass:function(Q,P){var O=N(P);var R=function(S){if(!this.hasClass(S,P)){return false;}var T=S.className;S.className=T.replace(O," ");if(this.hasClass(S,P)){this.removeClass(S,P);}S.className=YAHOO.lang.trim(S.className);return true;};return B.Dom.batch(Q,R,B.Dom,true);},replaceClass:function(R,P,O){if(!O||P===O){return false;}var Q=N(P);var S=function(T){if(!this.hasClass(T,P)){this.addClass(T,O);return true;}T.className=T.className.replace(Q," "+O+" ");if(this.hasClass(T,P)){this.replaceClass(T,P,O);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},generateId:function(O,Q){Q=Q||"yui-gen";var P=function(R){if(R&&R.id){return R.id;}var S=Q+H++;if(R){R.id=S;}return S;};return B.Dom.batch(O,P,B.Dom,true)||P.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);if(!P||!Q){return false;}var O=function(R){if(P.contains&&R.nodeType&&!L){return P.contains(R);}else{if(P.compareDocumentPosition&&R.nodeType){return !!(P.compareDocumentPosition(R)&16);}else{if(R.nodeType){return !!this.getAncestorBy(R,function(S){return S==P;});}}}return false;};return B.Dom.batch(Q,O,B.Dom,true);},inDocument:function(O){var P=function(Q){if(L){while(Q=Q.parentNode){if(Q==document.documentElement){return true;}}return false;}return this.isAncestor(document.documentElement,Q);};return B.Dom.batch(O,P,B.Dom,true);},getElementsBy:function(V,P,Q,S){P=P||"*";
+Q=(Q)?B.Dom.get(Q):null||document;if(!Q){return[];}var R=[],U=Q.getElementsByTagName(P);for(var T=0,O=U.length;T<O;++T){if(V(U[T])){R[R.length]=U[T];if(S){S(U[T]);}}}return R;},batch:function(S,V,U,Q){S=(S&&(S.tagName||S.item))?S:B.Dom.get(S);if(!S||!V){return false;}var R=(Q)?U:window;if(S.tagName||S.length===undefined){return V.call(R,S,U);}var T=[];for(var P=0,O=S.length;P<O;++P){T[T.length]=V.call(R,S[P],U);}return T;},getDocumentHeight:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var O=Math.max(P,B.Dom.getViewportHeight());return O;},getDocumentWidth:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var O=Math.max(P,B.Dom.getViewportWidth());return O;},getViewportHeight:function(){var O=self.innerHeight;var P=document.compatMode;if((P||G)&&!C){O=(P=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return O;},getViewportWidth:function(){var O=self.innerWidth;var P=document.compatMode;if(P||G){O=(P=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return O;},getAncestorBy:function(O,P){while(O=O.parentNode){if(D(O,P)){return O;}}return null;},getAncestorByClassName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return B.Dom.hasClass(R,O);};return B.Dom.getAncestorBy(P,Q);},getAncestorByTagName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return R.tagName&&R.tagName.toUpperCase()==O.toUpperCase();};return B.Dom.getAncestorBy(P,Q);},getPreviousSiblingBy:function(O,P){while(O){O=O.previousSibling;if(D(O,P)){return O;}}return null;},getPreviousSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getPreviousSiblingBy(O);},getNextSiblingBy:function(O,P){while(O){O=O.nextSibling;if(D(O,P)){return O;}}return null;},getNextSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getNextSiblingBy(O);},getFirstChildBy:function(O,Q){var P=(D(O.firstChild,Q))?O.firstChild:null;return P||B.Dom.getNextSiblingBy(O.firstChild,Q);},getFirstChild:function(O,P){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getFirstChildBy(O);},getLastChildBy:function(O,Q){if(!O){return null;}var P=(D(O.lastChild,Q))?O.lastChild:null;return P||B.Dom.getPreviousSiblingBy(O.lastChild,Q);},getLastChild:function(O){O=B.Dom.get(O);return B.Dom.getLastChildBy(O);},getChildrenBy:function(P,R){var Q=B.Dom.getFirstChildBy(P,R);var O=Q?[Q]:[];B.Dom.getNextSiblingBy(Q,function(S){if(!R||R(S)){O[O.length]=S;}return false;});return O;},getChildren:function(O){O=B.Dom.get(O);if(!O){}return B.Dom.getChildrenBy(O);},getDocumentScrollLeft:function(O){O=O||document;return Math.max(O.documentElement.scrollLeft,O.body.scrollLeft);},getDocumentScrollTop:function(O){O=O||document;return Math.max(O.documentElement.scrollTop,O.body.scrollTop);},insertBefore:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}return O.parentNode.insertBefore(P,O);},insertAfter:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}if(O.nextSibling){return O.parentNode.insertBefore(P,O.nextSibling);}else{return O.parentNode.appendChild(P);}}};})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};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(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.1",build:"541"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){var E=this.subscribers.length;if(!E&&this.silent){return true;}var H=[],G=true,D,I=false;for(D=0;D<arguments.length;++D){H.push(arguments[D]);}var A=H.length;if(!this.silent){}for(D=0;D<E;++D){var L=this.subscribers[D];if(!L){I=true;}else{if(!this.silent){}var K=L.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(H.length>0){B=H[0];}try{G=L.fn.call(K,B,L.obj);}catch(F){this.lastError=F;}}else{try{G=L.fn.call(K,this.type,H,L.obj);}catch(F){this.lastError=F;}}if(false===G){if(!this.silent){}return false;}}}if(I){var J=[],C=this.subscribers;for(D=0,E=C.length;D<E;D=D+1){J.push(C[D]);}this.subscribers=J;}return true;},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B);}this.subscribers=[];return B;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers[A]=null;},toString:function(){return"CustomEvent: '"+this.type+"', scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var J=false;var I=[];var K=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach();};this._interval=setInterval(M,this.POLL_INTERVAL);}},onAvailable:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:false});C=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(L,N,M){if(J){setTimeout(function(){var O=window;if(M){if(M===true){O=N;}else{O=M;}}L.call(O,"DOMReady",[],N);},0);}else{this.DOMReadyEvent.subscribe(L,N,M);}},onContentReady:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:true});C=this.POLL_RETRYS;this.startInterval();},addListener:function(N,L,W,R,M){if(!W||!W.call){return false;}if(this._isValidCollection(N)){var X=true;for(var S=0,U=N.length;S<U;++S){X=this.on(N[S],L,W,R,M)&&X;}return X;}else{if(YAHOO.lang.isString(N)){var Q=this.getEl(N);if(Q){N=Q;}else{this.onAvailable(N,function(){YAHOO.util.Event.on(N,L,W,R,M);});return true;}}}if(!N){return false;}if("unload"==L&&R!==this){K[K.length]=[N,L,W,R,M];return true;}var Z=N;if(M){if(M===true){Z=R;}else{Z=M;}}var O=function(a){return W.call(Z,YAHOO.util.Event.getEvent(a,N),R);};var Y=[N,L,W,O,Z,R,M];var T=I.length;I[T]=Y;if(this.useLegacyEvent(N,L)){var P=this.getLegacyIndex(N,L);if(P==-1||N!=G[P][0]){P=G.length;B[N.id+L]=P;G[P]=[N,L,N["on"+L]];E[P]=[];N["on"+L]=function(a){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(a),P);};}E[P].push(Y);}else{try{this._simpleAdd(N,L,O,false);}catch(V){this.lastError=V;this.removeListener(N,L,W);return false;}}return true;},fireLegacyEvent:function(P,N){var R=true,L,T,S,U,Q;T=E[N];for(var M=0,O=T.length;M<O;++M){S=T[M];if(S&&S[this.WFN]){U=S[this.ADJ_SCOPE];Q=S[this.WFN].call(U,P);R=(R&&Q);}}L=G[N];if(L&&L[2]){L[2](P);}return R;},getLegacyIndex:function(M,N){var L=this.generateId(M)+N;if(typeof B[L]=="undefined"){return -1;}else{return B[L];}},useLegacyEvent:function(M,N){if(this.webkit&&("click"==N||"dblclick"==N)){var L=parseInt(this.webkit,10);if(!isNaN(L)&&L<418){return true;}}return false;},removeListener:function(M,L,U){var P,S,W;if(typeof M=="string"){M=this.getEl(M);}else{if(this._isValidCollection(M)){var V=true;for(P=0,S=M.length;P<S;++P){V=(this.removeListener(M[P],L,U)&&V);}return V;}}if(!U||!U.call){return this.purgeElement(M,false,L);}if("unload"==L){for(P=0,S=K.length;P<S;P++){W=K[P];if(W&&W[0]==M&&W[1]==L&&W[2]==U){K[P]=null;return true;}}return false;}var Q=null;var R=arguments[3];if("undefined"===typeof R){R=this._getCacheIndex(M,L,U);}if(R>=0){Q=I[R];}if(!M||!Q){return false;}if(this.useLegacyEvent(M,L)){var O=this.getLegacyIndex(M,L);var N=E[O];if(N){for(P=0,S=N.length;P<S;++P){W=N[P];if(W&&W[this.EL]==M&&W[this.TYPE]==L&&W[this.FN]==U){N[P]=null;break;}}}}else{try{this._simpleRemove(M,L,Q[this.WFN],false);}catch(T){this.lastError=T;return false;}}delete I[R][this.WFN];delete I[R][this.FN];I[R]=null;return true;},getTarget:function(N,M){var L=N.target||N.srcElement;return this.resolveTextNode(L);},resolveTextNode:function(L){if(L&&3==L.nodeType){return L.parentNode;}else{return L;}},getPageX:function(M){var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(this.isIE){L+=this._getScrollLeft();}}return L;},getPageY:function(L){var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(this.isIE){M+=this._getScrollTop();}}return M;},getXY:function(L){return[this.getPageX(L),this.getPageY(L)];
+},getRelatedTarget:function(M){var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement;}else{if(M.type=="mouseover"){L=M.fromElement;}}}return this.resolveTextNode(L);},getTime:function(N){if(!N.time){var M=new Date().getTime();try{N.time=M;}catch(L){this.lastError=L;return M;}}return N.time;},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L);},stopPropagation:function(L){if(L.stopPropagation){L.stopPropagation();}else{L.cancelBubble=true;}},preventDefault:function(L){if(L.preventDefault){L.preventDefault();}else{L.returnValue=false;}},getEvent:function(Q,O){var P=Q||window.event;if(!P){var R=this.getEvent.caller;while(R){P=R.arguments[0];if(P&&Event==P.constructor){break;}R=R.caller;}}if(P&&this.isIE){try{var N=P.srcElement;if(N){var M=N.type;}}catch(L){P.target=O;}}return P;},getCharCode:function(M){var L=M.keyCode||M.charCode||0;if(YAHOO.env.ua.webkit&&(L in D)){L=D[L];}return L;},_getCacheIndex:function(P,Q,O){for(var N=0,M=I.length;N<M;++N){var L=I[N];if(L&&L[this.FN]==O&&L[this.EL]==P&&L[this.TYPE]==Q){return N;}}return -1;},generateId:function(L){var M=L.id;if(!M){M="yuievtautoid-"+A;++A;L.id=M;}return M;},_isValidCollection:function(M){try{return(typeof M!=="string"&&M.length&&!M.tagName&&!M.alert&&typeof M[0]!=="undefined");}catch(L){return false;}},elCache:{},getEl:function(L){return(typeof L==="string")?document.getElementById(L):L;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(M){if(!H){H=true;var L=YAHOO.util.Event;L._ready();L._tryPreloadAttach();}},_ready:function(M){if(!J){J=true;var L=YAHOO.util.Event;L.DOMReadyEvent.fire();L._simpleRemove(document,"DOMContentLoaded",L._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}if(this.isIE){if(!J){this.startInterval();return false;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var M,L,O,N;for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&!O.checkReady){N=this.getEl(O.id);if(N){R(N,O);F[M]=null;}else{P.push(O);}}}for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&O.checkReady){N=this.getEl(O.id);if(N){if(H||N.nextSibling){R(N,O);F[M]=null;}}else{P.push(O);}}}C=(P.length===0)?0:C-1;if(Q){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(O,P,R){var Q=this.getListeners(O,R),N,L;if(Q){for(N=0,L=Q.length;N<L;++N){var M=Q[N];this.removeListener(O,M.type,M.fn,M.index);}}if(P&&O&&O.childNodes){for(N=0,L=O.childNodes.length;N<L;++N){this.purgeElement(O.childNodes[N],P,R);}}},getListeners:function(N,L){var Q=[],M;if(!L){M=[I,K];}else{if(L=="unload"){M=[K];}else{M=[I];}}for(var P=0;P<M.length;P=P+1){var T=M[P];if(T&&T.length>0){for(var R=0,S=T.length;R<S;++R){var O=T[R];if(O&&O[this.EL]===N&&(!L||L===O[this.TYPE])){Q.push({type:O[this.TYPE],fn:O[this.FN],obj:O[this.OBJ],adjust:O[this.OVERRIDE],scope:O[this.ADJ_SCOPE],index:R});}}}}return(Q.length)?Q:null;},_unload:function(S){var R=YAHOO.util.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.UNLOAD_OBJ];}else{Q=M[R.ADJ_SCOPE];}}M[R.FN].call(Q,R.getEvent(S,M[R.EL]),M[R.UNLOAD_OBJ]);K[P]=null;M=null;Q=null;}}K=null;if(I&&I.length>0){O=I.length;while(O){N=O-1;M=I[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N);}O=O-1;}M=null;R.clearCache();}for(P=0,L=G.length;P<L;++P){G[P][0]=null;G[P]=null;}G=null;R._simpleRemove(window,"unload",R._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft];}else{if(M){return[M.scrollTop,M.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(N,O,M,L){N.addEventListener(O,M,(L));};}else{if(window.attachEvent){return function(N,O,M,L){N.attachEvent("on"+O,M);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(N,O,M,L){N.removeEventListener(O,M,(L));};}else{if(window.detachEvent){return function(M,N,L){M.detachEvent("on"+N,L);};}else{return function(){};}}}()};}();(function(){var D=YAHOO.util.Event;D.on=D.addListener;if(D.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var B,E=document,A=E.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){B=document.createElement("script");var C=E.getElementsByTagName("head")[0]||A;C.insertBefore(B,C.firstChild);}else{E.write("<script id=\"_yui_eu_dr\" defer=\"true\" src=\"//:\"></script>");B=document.getElementById("_yui_eu_dr");}if(B){B.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}B=null;}else{if(D.webkit){D._drwatch=setInterval(function(){var F=document.readyState;if("loaded"==F||"complete"==F){clearInterval(D._drwatch);D._drwatch=null;D._ready();}},D.POLL_INTERVAL);}else{D._simpleAdd(document,"DOMContentLoaded",D._ready);}}D._simpleAdd(window,"load",D._load);D._simpleAdd(window,"unload",D._unload);D._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};
+var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(K,J){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(K.shiftKey==F.shift&&K.altKey==F.alt&&K.ctrlKey==F.ctrl){var H;var G;if(F.keys instanceof Array){for(var I=0;I<F.keys.length;I++){H=F.keys[I];if(H==K.charCode){D.fire(K.charCode,K);break;}else{if(H==K.keyCode){D.fire(K.keyCode,K);break;}}}}else{H=F.keys;if(H==K.charCode){D.fire(K.charCode,K);}else{if(H==K.keyCode){D.fire(K.keyCode,K);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.1",build:"541"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/yahoo.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/yahoo.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/yahoo.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,869 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * The YAHOO object is the single global object used by YUI Library.  It
+ * contains utility function for setting up namespaces, inheritance, and
+ * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
+ * created automatically for and used by the library.
+ * @module yahoo
+ * @title  YAHOO Global
+ */
+
+/**
+ * YAHOO_config is not included as part of the library.  Instead it is an 
+ * object that can be defined by the implementer immediately before 
+ * including the YUI library.  The properties included in this object
+ * will be used to configure global properties needed as soon as the 
+ * library begins to load.
+ * @class YAHOO_config
+ * @static
+ */
+
+/**
+ * A reference to a function that will be executed every time a YAHOO module
+ * is loaded.  As parameter, this function will receive the version
+ * information for the module. See <a href="YAHOO.env.html#getVersion">
+ * YAHOO.env.getVersion</a> for the description of the version data structure.
+ * @property listener
+ * @type Function
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Set to true if the library will be dynamically loaded after window.onload.
+ * Defaults to false 
+ * @property injecting
+ * @type boolean
+ * @static
+ * @default undefined
+ */
+
+/**
+ * Instructs the yuiloader component to dynamically load yui components and
+ * their dependencies.  See the yuiloader documentation for more information
+ * about dynamic loading
+ * @property load
+ * @static
+ * @default undefined
+ * @see yuiloader
+ */
+
+if (typeof YAHOO == "undefined") {
+    /**
+     * The YAHOO global namespace object.  If YAHOO is already defined, the
+     * existing YAHOO object will not be overwritten so that defined
+     * namespaces are preserved.
+     * @class YAHOO
+     * @static
+     */
+    var YAHOO = {};
+}
+
+/**
+ * Returns the namespace specified and creates it if it doesn't exist
+ * <pre>
+ * YAHOO.namespace("property.package");
+ * YAHOO.namespace("YAHOO.property.package");
+ * </pre>
+ * Either of the above would create YAHOO.property, then
+ * YAHOO.property.package
+ *
+ * Be careful when naming packages. Reserved words may work in some browsers
+ * and not others. For instance, the following will fail in Safari:
+ * <pre>
+ * YAHOO.namespace("really.long.nested.namespace");
+ * </pre>
+ * This fails because "long" is a future reserved word in ECMAScript
+ *
+ * @method namespace
+ * @static
+ * @param  {String*} arguments 1-n namespaces to create 
+ * @return {Object}  A reference to the last namespace object created
+ */
+YAHOO.namespace = function() {
+    var a=arguments, o=null, i, j, d;
+    for (i=0; i<a.length; i=i+1) {
+        d=a[i].split(".");
+        o=YAHOO;
+
+        // YAHOO is implied, so it is ignored if it is included
+        for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
+            o[d[j]]=o[d[j]] || {};
+            o=o[d[j]];
+        }
+    }
+
+    return o;
+};
+
+/**
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is
+ * available.
+ *
+ * @method log
+ * @static
+ * @param  {String}  msg  The message to log.
+ * @param  {String}  cat  The log category for the message.  Default
+ *                        categories are "info", "warn", "error", time".
+ *                        Custom categories can be used as well. (opt)
+ * @param  {String}  src  The source of the the message (opt)
+ * @return {Boolean}      True if the log operation was successful.
+ */
+YAHOO.log = function(msg, cat, src) {
+    var l=YAHOO.widget.Logger;
+    if(l && l.log) {
+        return l.log(msg, cat, src);
+    } else {
+        return false;
+    }
+};
+
+/**
+ * Registers a module with the YAHOO object
+ * @method register
+ * @static
+ * @param {String}   name    the name of the module (event, slider, etc)
+ * @param {Function} mainClass a reference to class in the module.  This
+ *                             class will be tagged with the version info
+ *                             so that it will be possible to identify the
+ *                             version that is in use when multiple versions
+ *                             have loaded
+ * @param {Object}   data      metadata object for the module.  Currently it
+ *                             is expected to contain a "version" property
+ *                             and a "build" property at minimum.
+ */
+YAHOO.register = function(name, mainClass, data) {
+    var mods = YAHOO.env.modules;
+    if (!mods[name]) {
+        mods[name] = { versions:[], builds:[] };
+    }
+    var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;
+    m.name = name;
+    m.version = v;
+    m.build = b;
+    m.versions.push(v);
+    m.builds.push(b);
+    m.mainClass = mainClass;
+    // fire the module load listeners
+    for (var i=0;i<ls.length;i=i+1) {
+        ls[i](m);
+    }
+    // label the main class
+    if (mainClass) {
+        mainClass.VERSION = v;
+        mainClass.BUILD = b;
+    } else {
+        YAHOO.log("mainClass is undefined for module " + name, "warn");
+    }
+};
+
+/**
+ * YAHOO.env is used to keep track of what is known about the YUI library and
+ * the browsing environment
+ * @class YAHOO.env
+ * @static
+ */
+YAHOO.env = YAHOO.env || {
+
+    /**
+     * Keeps the version info for all YUI modules that have reported themselves
+     * @property modules
+     * @type Object[]
+     */
+    modules: [],
+    
+    /**
+     * List of functions that should be executed every time a YUI module
+     * reports itself.
+     * @property listeners
+     * @type Function[]
+     */
+    listeners: []
+};
+
+/**
+ * Returns the version data for the specified module:
+ *      <dl>
+ *      <dt>name:</dt>      <dd>The name of the module</dd>
+ *      <dt>version:</dt>   <dd>The version in use</dd>
+ *      <dt>build:</dt>     <dd>The build number in use</dd>
+ *      <dt>versions:</dt>  <dd>All versions that were registered</dd>
+ *      <dt>builds:</dt>    <dd>All builds that were registered.</dd>
+ *      <dt>mainClass:</dt> <dd>An object that was was stamped with the
+ *                 current version and build. If 
+ *                 mainClass.VERSION != version or mainClass.BUILD != build,
+ *                 multiple versions of pieces of the library have been
+ *                 loaded, potentially causing issues.</dd>
+ *       </dl>
+ *
+ * @method getVersion
+ * @static
+ * @param {String}  name the name of the module (event, slider, etc)
+ * @return {Object} The version info
+ */
+YAHOO.env.getVersion = function(name) {
+    return YAHOO.env.modules[name] || null;
+};
+
+/**
+ * Do not fork for a browser if it can be avoided.  Use feature detection when
+ * you can.  Use the user agent as a last resort.  YAHOO.env.ua stores a version
+ * number for the browser engine, 0 otherwise.  This value may or may not map
+ * to the version number of the browser using the engine.  The value is 
+ * presented as a float so that it can easily be used for boolean evaluation 
+ * as well as for looking for a particular range of versions.  Because of this, 
+ * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 
+ * reports 1.8).
+ * @class YAHOO.env.ua
+ * @static
+ */
+YAHOO.env.ua = function() {
+    var o={
+
+        /**
+         * Internet Explorer version number or 0.  Example: 6
+         * @property ie
+         * @type float
+         */
+        ie:0,
+
+        /**
+         * Opera version number or 0.  Example: 9.2
+         * @property opera
+         * @type float
+         */
+        opera:0,
+
+        /**
+         * Gecko engine revision number.  Will evaluate to 1 if Gecko 
+         * is detected but the revision could not be found. Other browsers
+         * will be 0.  Example: 1.8
+         * <pre>
+         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
+         * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
+         * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
+         * Firefox 3 alpha: 1.9a4   <-- Reports 1.9
+         * </pre>
+         * @property gecko
+         * @type float
+         */
+        gecko:0,
+
+        /**
+         * AppleWebKit version.  KHTML browsers that are not WebKit browsers 
+         * will evaluate to 1, other browsers 0.  Example: 418.9.1
+         * <pre>
+         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 
+         *                                   latest available for Mac OSX 10.3.
+         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
+         * Safari 2.0.4:         418     <-- preventDefault fixed
+         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
+         *                                   different versions of webkit
+         * Safari 2.0.4 (419.3): 419     <-- Current Safari release
+         * Webkit 212 nightly:   522+    <-- Safari 3.0 (with native SVG) should
+         *                                   be higher than this
+         *                                   
+         * </pre>
+         * http://developer.apple.com/internet/safari/uamatrix.html
+         * @property webkit
+         * @type float
+         */
+        webkit:0
+    };
+
+    var ua=navigator.userAgent, m;
+
+    // Modern KHTML browsers should qualify as Safari X-Grade
+    if ((/KHTML/).test(ua)) {
+        o.webkit=1;
+    }
+    // Modern WebKit browsers are at least X-Grade
+    m=ua.match(/AppleWebKit\/([^\s]*)/);
+    if (m&&m[1]) {
+        o.webkit=parseFloat(m[1]);
+    }
+
+    if (!o.webkit) { // not webkit
+        // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
+        m=ua.match(/Opera[\s\/]([^\s]*)/);
+        if (m&&m[1]) {
+            o.opera=parseFloat(m[1]);
+        } else { // not opera or webkit
+            m=ua.match(/MSIE\s([^;]*)/);
+            if (m&&m[1]) {
+                o.ie=parseFloat(m[1]);
+            } else { // not opera, webkit, or ie
+                m=ua.match(/Gecko\/([^\s]*)/);
+                if (m) {
+                    o.gecko=1; // Gecko detected, look for revision
+                    m=ua.match(/rv:([^\s\)]*)/);
+                    if (m&&m[1]) {
+                        o.gecko=parseFloat(m[1]);
+                    }
+                }
+            }
+        }
+    }
+    
+    return o;
+}();
+
+/*
+ * Initializes the global by creating the default namespaces and applying
+ * any new configuration information that is detected.  This is the setup
+ * for env.
+ * @method init
+ * @static
+ * @private
+ */
+(function() {
+    YAHOO.namespace("util", "widget", "example");
+    if ("undefined" !== typeof YAHOO_config) {
+        var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
+        if (l) {
+            // if YAHOO is loaded multiple times we need to check to see if
+            // this is a new config object.  If it is, add the new component
+            // load listener to the stack
+            for (i=0;i<ls.length;i=i+1) {
+                if (ls[i]==l) {
+                    unique=false;
+                    break;
+                }
+            }
+            if (unique) {
+                ls.push(l);
+            }
+        }
+    }
+})();
+/**
+ * Provides the language utilites and extensions used by the library
+ * @class YAHOO.lang
+ */
+YAHOO.lang = {
+    /**
+     * Determines whether or not the provided object is an array.
+     * Testing typeof/instanceof/constructor of arrays across frame 
+     * boundaries isn't possible in Safari unless you have a reference
+     * to the other frame to test against its Array prototype.  To
+     * handle this case, we test well-known array properties instead.
+     * properties.
+     * @method isArray
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isArray: function(o) { 
+
+        if (o) {
+           var l = YAHOO.lang;
+           return l.isNumber(o.length) && l.isFunction(o.splice) && 
+                  !l.hasOwnProperty(o.length);
+        }
+        return false;
+    },
+
+    /**
+     * Determines whether or not the provided object is a boolean
+     * @method isBoolean
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isBoolean: function(o) {
+        return typeof o === 'boolean';
+    },
+    
+    /**
+     * Determines whether or not the provided object is a function
+     * @method isFunction
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isFunction: function(o) {
+        return typeof o === 'function';
+    },
+        
+    /**
+     * Determines whether or not the provided object is null
+     * @method isNull
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isNull: function(o) {
+        return o === null;
+    },
+        
+    /**
+     * Determines whether or not the provided object is a legal number
+     * @method isNumber
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isNumber: function(o) {
+        return typeof o === 'number' && isFinite(o);
+    },
+      
+    /**
+     * Determines whether or not the provided object is of type object
+     * or function
+     * @method isObject
+     * @param {any} o The object being testing
+     * @return Boolean
+     */  
+    isObject: function(o) {
+return (o && (typeof o === 'object' || YAHOO.lang.isFunction(o))) || false;
+    },
+        
+    /**
+     * Determines whether or not the provided object is a string
+     * @method isString
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isString: function(o) {
+        return typeof o === 'string';
+    },
+        
+    /**
+     * Determines whether or not the provided object is undefined
+     * @method isUndefined
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    isUndefined: function(o) {
+        return typeof o === 'undefined';
+    },
+    
+    /**
+     * Determines whether or not the property was added
+     * to the object instance.  Returns false if the property is not present
+     * in the object, or was inherited from the prototype.
+     * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
+     * There is a discrepancy between YAHOO.lang.hasOwnProperty and
+     * Object.prototype.hasOwnProperty when the property is a primitive added to
+     * both the instance AND prototype with the same value:
+     * <pre>
+     * var A = function() {};
+     * A.prototype.foo = 'foo';
+     * var a = new A();
+     * a.foo = 'foo';
+     * alert(a.hasOwnProperty('foo')); // true
+     * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
+     * </pre>
+     * @method hasOwnProperty
+     * @param {any} o The object being testing
+     * @return Boolean
+     */
+    hasOwnProperty: function(o, prop) {
+        if (Object.prototype.hasOwnProperty) {
+            return o.hasOwnProperty(prop);
+        }
+        
+        return !YAHOO.lang.isUndefined(o[prop]) && 
+                o.constructor.prototype[prop] !== o[prop];
+    },
+ 
+    /**
+     * IE will not enumerate native functions in a derived object even if the
+     * function was overridden.  This is a workaround for specific functions 
+     * we care about on the Object prototype. 
+     * @property _IEEnumFix
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @static
+     * @private
+     */
+    _IEEnumFix: function(r, s) {
+        if (YAHOO.env.ua.ie) {
+            var add=["toString", "valueOf"], i;
+            for (i=0;i<add.length;i=i+1) {
+                var fname=add[i],f=s[fname];
+                if (YAHOO.lang.isFunction(f) && f!=Object.prototype[fname]) {
+                    r[fname]=f;
+                }
+            }
+        }
+    },
+       
+    /**
+     * Utility to set up the prototype, constructor and superclass properties to
+     * support an inheritance strategy that can chain constructors and methods.
+     * Static members will not be inherited.
+     *
+     * @method extend
+     * @static
+     * @param {Function} subc   the object to modify
+     * @param {Function} superc the object to inherit
+     * @param {Object} overrides  additional properties/methods to add to the
+     *                              subclass prototype.  These will override the
+     *                              matching items obtained from the superclass 
+     *                              if present.
+     */
+    extend: function(subc, superc, overrides) {
+        if (!superc||!subc) {
+            throw new Error("YAHOO.lang.extend failed, please check that " +
+                            "all dependencies are included.");
+        }
+        var F = function() {};
+        F.prototype=superc.prototype;
+        subc.prototype=new F();
+        subc.prototype.constructor=subc;
+        subc.superclass=superc.prototype;
+        if (superc.prototype.constructor == Object.prototype.constructor) {
+            superc.prototype.constructor=superc;
+        }
+    
+        if (overrides) {
+            for (var i in overrides) {
+                subc.prototype[i]=overrides[i];
+            }
+
+            YAHOO.lang._IEEnumFix(subc.prototype, overrides);
+        }
+    },
+   
+    /**
+     * Applies all properties in the supplier to the receiver if the
+     * receiver does not have these properties yet.  Optionally, one or 
+     * more methods/properties can be specified (as additional 
+     * parameters).  This option will overwrite the property if receiver 
+     * has it already.  If true is passed as the third parameter, all 
+     * properties will be applied and _will_ overwrite properties in 
+     * the receiver.
+     *
+     * @method augmentObject
+     * @static
+     * @since 2.3.0
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @param {String*|boolean}  arguments zero or more properties methods 
+     *        to augment the receiver with.  If none specified, everything
+     *        in the supplier will be used unless it would
+     *        overwrite an existing property in the receiver. If true
+     *        is specified as the third parameter, all properties will
+     *        be applied and will overwrite an existing property in
+     *        the receiver
+     */
+    augmentObject: function(r, s) {
+        if (!s||!r) {
+            throw new Error("Absorb failed, verify dependencies.");
+        }
+        var a=arguments, i, p, override=a[2];
+        if (override && override!==true) { // only absorb the specified properties
+            for (i=2; i<a.length; i=i+1) {
+                r[a[i]] = s[a[i]];
+            }
+        } else { // take everything, overwriting only if the third parameter is true
+            for (p in s) { 
+                if (override || !r[p]) {
+                    r[p] = s[p];
+                }
+            }
+            
+            YAHOO.lang._IEEnumFix(r, s);
+        }
+    },
+ 
+    /**
+     * Same as YAHOO.lang.augmentObject, except it only applies prototype properties
+     * @see YAHOO.lang.augmentObject
+     * @method augmentProto
+     * @static
+     * @param {Function} r  the object to receive the augmentation
+     * @param {Function} s  the object that supplies the properties to augment
+     * @param {String*|boolean}  arguments zero or more properties methods 
+     *        to augment the receiver with.  If none specified, everything 
+     *        in the supplier will be used unless it would overwrite an existing 
+     *        property in the receiver.  if true is specified as the third 
+     *        parameter, all properties will be applied and will overwrite an 
+     *        existing property in the receiver
+     */
+    augmentProto: function(r, s) {
+        if (!s||!r) {
+            throw new Error("Augment failed, verify dependencies.");
+        }
+        //var a=[].concat(arguments);
+        var a=[r.prototype,s.prototype];
+        for (var i=2;i<arguments.length;i=i+1) {
+            a.push(arguments[i]);
+        }
+        YAHOO.lang.augmentObject.apply(this, a);
+    },
+
+      
+    /**
+     * Returns a simple string representation of the object or array.
+     * Other types of objects will be returned unprocessed.  Arrays
+     * are expected to be indexed.  Use object notation for
+     * associative arrays.
+     * @method dump
+     * @since 2.3.0
+     * @param o {Object} The object to dump
+     * @param d {int} How deep to recurse child objects, default 3
+     * @return {String} the dump result
+     */
+    dump: function(o, d) {
+        var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",
+            COMMA=', ', ARROW=' => ';
+
+        // Cast non-objects to string
+        // Skip dates because the std toString is what we want
+        // Skip HTMLElement-like objects because trying to dump 
+        // an element will cause an unhandled exception in FF 2.x
+        if (!l.isObject(o)) {
+            return o + "";
+        } else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
+            return o;
+        } else if  (l.isFunction(o)) {
+            return FUN;
+        }
+
+        // dig into child objects the depth specifed. Default 3
+        d = (l.isNumber(d)) ? d : 3;
+
+        // arrays [1, 2, 3]
+        if (l.isArray(o)) {
+            s.push("[");
+            for (i=0,len=o.length;i<len;i=i+1) {
+                if (l.isObject(o[i])) {
+                    s.push((d > 0) ? l.dump(o[i], d-1) : OBJ);
+                } else {
+                    s.push(o[i]);
+                }
+                s.push(COMMA);
+            }
+            if (s.length > 1) {
+                s.pop();
+            }
+            s.push("]");
+        // objects {k1 => v1, k2 => v2}
+        } else {
+            s.push("{");
+            for (i in o) {
+                if (l.hasOwnProperty(o, i)) {
+                    s.push(i + ARROW);
+                    if (l.isObject(o[i])) {
+                        s.push((d > 0) ? l.dump(o[i], d-1) : OBJ);
+                    } else {
+                        s.push(o[i]);
+                    }
+                    s.push(COMMA);
+                }
+            }
+            if (s.length > 1) {
+                s.pop();
+            }
+            s.push("}");
+        }
+
+        return s.join("");
+    },
+
+    /**
+     * Does variable substitution on a string. It scans through the string 
+     * looking for expressions enclosed in { } braces. If an expression 
+     * is found, it is used a key on the object.  If there is a space in
+     * the key, the first word is used for the key and the rest is provided
+     * to an optional function to be used to programatically determine the
+     * value (the extra information might be used for this decision). If 
+     * the value for the key in the object, or what is returned from the
+     * function has a string value, number value, or object value, it is 
+     * substituted for the bracket expression and it repeats.  If this
+     * value is an object, it uses the Object's toString() if this has
+     * been overridden, otherwise it does a shallow dump of the key/value
+     * pairs.
+     * @method substitute
+     * @since 2.3.0
+     * @param s {String} The string that will be modified.
+     * @param o {Object} An object containing the replacement values
+     * @param f {Function} An optional function that can be used to
+     *                     process each match.  It receives the key,
+     *                     value, and any extra metadata included with
+     *                     the key inside of the braces.
+     * @return {String} the substituted string
+     */
+    substitute: function (s, o, f) {
+        var i, j, k, key, v, meta, l=YAHOO.lang, saved=[], token, 
+            DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}';
+
+
+        for (;;) {
+            i = s.lastIndexOf(LBRACE);
+            if (i < 0) {
+                break;
+            }
+            j = s.indexOf(RBRACE, i);
+            if (i + 1 >= j) {
+                break;
+            }
+
+            //Extract key and meta info 
+            token = s.substring(i + 1, j);
+            key = token;
+            meta = null;
+            k = key.indexOf(SPACE);
+            if (k > -1) {
+                meta = key.substring(k + 1);
+                key = key.substring(0, k);
+            }
+
+            // lookup the value
+            v = o[key];
+
+            // if a substitution function was provided, execute it
+            if (f) {
+                v = f(key, v, meta);
+            }
+
+            if (l.isObject(v)) {
+                if (l.isArray(v)) {
+                    v = l.dump(v, parseInt(meta, 10));
+                } else {
+                    meta = meta || "";
+
+                    // look for the keyword 'dump', if found force obj dump
+                    var dump = meta.indexOf(DUMP);
+                    if (dump > -1) {
+                        meta = meta.substring(4);
+                    }
+
+                    // use the toString if it is not the Object toString 
+                    // and the 'dump' meta info was not found
+                    if (v.toString===Object.prototype.toString||dump>-1) {
+                        v = l.dump(v, parseInt(meta, 10));
+                    } else {
+                        v = v.toString();
+                    }
+                }
+            } else if (!l.isString(v) && !l.isNumber(v)) {
+                // This {block} has no replace string. Save it for later.
+                v = "~-" + saved.length + "-~";
+                saved[saved.length] = token;
+
+                // break;
+            }
+
+            s = s.substring(0, i) + v + s.substring(j + 1);
+
+
+        }
+
+        // restore saved {block}s
+        for (i=saved.length-1; i>=0; i=i-1) {
+            s = s.replace(new RegExp("~-" + i + "-~"), "{"  + saved[i] + "}", "g");
+        }
+
+        return s;
+    },
+
+
+    /**
+     * Returns a string without any leading or trailing whitespace.  If 
+     * the input is not a string, the input will be returned untouched.
+     * @method trim
+     * @since 2.3.0
+     * @param s {string} the string to trim
+     * @return {string} the trimmed string
+     */
+    trim: function(s){
+        try {
+            return s.replace(/^\s+|\s+$/g, "");
+        } catch(e) {
+            return s;
+        }
+    },
+
+    /**
+     * Returns a new object containing all of the properties of
+     * all the supplied objects.  The properties from later objects
+     * will overwrite those in earlier objects.
+     * @method merge
+     * @since 2.3.0
+     * @param arguments {Object*} the objects to merge
+     * @return the new merged object
+     */
+    merge: function() {
+        var o={}, a=arguments, i;
+        for (i=0; i<a.length; i=i+1) {
+            YAHOO.lang.augmentObject(o, a[i], true);
+            /*
+            for (var j in a[i]) {
+                o[j] = a[i][j];
+            }
+            */
+        }
+        return o;
+    },
+
+    /**
+     * A convenience method for detecting a legitimate non-null value.
+     * Returns false for null/undefined/NaN, true for other values, 
+     * including 0/false/''
+     * @method isValue
+     * @since 2.3.0
+     * @param o {any} the item to test
+     * @return {boolean} true if it is not null/undefined/NaN || false
+     */
+    isValue: function(o) {
+        // return (o || o === false || o === 0 || o === ''); // Infinity fails
+        var l = YAHOO.lang;
+return (l.isObject(o) || l.isString(o) || l.isNumber(o) || l.isBoolean(o));
+    }
+
+};
+
+/*
+ * An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
+ * @class YAHOO.util.Lang
+ */
+YAHOO.util.Lang = YAHOO.lang;
+ 
+/**
+ * Same as YAHOO.lang.augmentObject, except it only applies prototype 
+ * properties.  This is an alias for augmentProto.
+ * @see YAHOO.lang.augmentObject
+ * @method augment
+ * @static
+ * @param {Function} r  the object to receive the augmentation
+ * @param {Function} s  the object that supplies the properties to augment
+ * @param {String*|boolean}  arguments zero or more properties methods to 
+ *        augment the receiver with.  If none specified, everything
+ *        in the supplier will be used unless it would
+ *        overwrite an existing property in the receiver.  if true
+ *        is specified as the third parameter, all properties will
+ *        be applied and will overwrite an existing property in
+ *        the receiver
+ */
+YAHOO.lang.augment = YAHOO.lang.augmentProto;
+
+/**
+ * An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
+ * @for YAHOO
+ * @method augment
+ * @static
+ * @param {Function} r  the object to receive the augmentation
+ * @param {Function} s  the object that supplies the properties to augment
+ * @param {String*}  arguments zero or more properties methods to 
+ *        augment the receiver with.  If none specified, everything
+ *        in the supplier will be used unless it would
+ *        overwrite an existing property in the receiver
+ */
+YAHOO.augment = YAHOO.lang.augmentProto;
+       
+/**
+ * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
+ * @method extend
+ * @static
+ * @param {Function} subc   the object to modify
+ * @param {Function} superc the object to inherit
+ * @param {Object} overrides  additional properties/methods to add to the
+ *        subclass prototype.  These will override the
+ *        matching items obtained from the superclass if present.
+ */
+YAHOO.extend = YAHOO.lang.extend;
+
+YAHOO.register("yahoo", YAHOO, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/root/static/yui/yuiloader-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/yuiloader-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/yuiloader-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,1409 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+/**
+ * Provides dynamic loading for the YUI library.  It includes the dependency
+ * info for the library, and will automatically pull in dependencies for
+ * the modules requested.  It supports rollup files (such as utilities.js
+ * and yahoo-dom-event.js), and will automatically use these when
+ * appropriate in order to minimize the number of http connections
+ * required to load all of the dependencies.
+ * 
+ * @module yuiloader
+ * @namespace YAHOO.util
+ */
+
+/**
+ * YUILoader provides dynamic loading for YUI.
+ * @class YAHOO.util.YUILoader
+ * @todo
+ *      version management, automatic sandboxing
+ */
+(function() {
+ 
+    // Define YAHOO_config if it doesn't exist.  Only relevant if YAHOO is not
+    // already on the page
+    if (typeof YAHOO_config === "undefined") {
+        YAHOO_config = {};
+    }
+
+    // YUI is locally scoped, only pieces of it will be referenced in YAHOO
+    // after YAHOO has been loaded.
+    var YUI = {
+
+        /*
+         * The library metadata for the current release  The is the default
+         * value for YAHOO.util.YUILoader.moduleInfo
+         * @property YUIInfo
+         * @static
+         */
+        info: {
+
+    'base': 'http://yui.yahooapis.com/2.3.1/build/',
+
+    'skin': {
+        'defaultSkin': 'sam',
+        'base': 'assets/skins/',
+        'path': 'skin.css',
+        'rollup': 3
+    },
+
+    'moduleInfo': {
+
+        'animation': {
+            'type': 'js',
+            'path': 'animation/animation-min.js',
+            'requires': ['dom', 'event']
+        },
+
+        'autocomplete': {
+            'type': 'js',
+            'path': 'autocomplete/autocomplete-min.js',
+            'requires': ['dom', 'event'],
+            'optional': ['connection', 'animation'],
+            'skinnable': true
+        },
+
+        'button': {
+            'type': 'js',
+            'path': 'button/button-beta-min.js',
+            'requires': ['element'],
+            'optional': ['menu'],
+            'skinnable': true
+        },
+
+        'calendar': {
+            'type': 'js',
+            'path': 'calendar/calendar-min.js',
+            'requires': ['event', 'dom'],
+            'skinnable': true
+        },
+
+        'colorpicker': {
+            'type': 'js',
+            'path': 'colorpicker/colorpicker-beta-min.js',
+            'requires': ['slider', 'element'],
+            'optional': ['animation'],
+            'skinnable': true
+        },
+
+        'connection': {
+            'type': 'js',
+            'path': 'connection/connection-min.js',
+            'requires': ['event']
+        },
+
+        'container': {
+            'type': 'js',
+            'path': 'container/container-min.js',
+            'requires': ['dom', 'event'],
+            // button is optional, but creates a circular dep
+            //'optional': ['dragdrop', 'animation', 'button'],
+            'optional': ['dragdrop', 'animation'],
+            'supersedes': ['containercore'],
+            'skinnable': true
+        },
+
+        'containercore': {
+            'type': 'js',
+            'path': 'container/container_core-min.js',
+            'requires': ['dom', 'event']
+        },
+
+        'datasource': {
+            'type': 'js',
+            'path': 'datasource/datasource-beta-min.js',
+            'requires': ['event'],
+            'optional': ['connection']
+        },
+
+        'datatable': {
+            'type': 'js',
+            'path': 'datatable/datatable-beta-min.js',
+            'requires': ['element', 'datasource'],
+            'optional': ['calendar', 'dragdrop'],
+            'skinnable': true
+        },
+
+        'dom': {
+            'type': 'js',
+            'path': 'dom/dom-min.js',
+            'requires': ['yahoo']
+        },
+
+        'dragdrop': {
+            'type': 'js',
+            'path': 'dragdrop/dragdrop-min.js',
+            'requires': ['dom', 'event']
+        },
+
+        'editor': {
+            'type': 'js',
+            'path': 'editor/editor-beta-min.js',
+            'requires': ['menu', 'element', 'button'],
+            'optional': ['animation', 'dragdrop'],
+            'skinnable': true
+        },
+
+        'element': {
+            'type': 'js',
+            'path': 'element/element-beta-min.js',
+            'requires': ['dom', 'event']
+        },
+
+        'event': {
+            'type': 'js',
+            'path': 'event/event-min.js',
+            'requires': ['yahoo']
+        },
+
+        'fonts': {
+            'type': 'css',
+            'path': 'fonts/fonts-min.css'
+        },
+
+        'grids': {
+            'type': 'css',
+            'path': 'grids/grids-min.css',
+            'requires': ['fonts'],
+            'optional': ['reset']
+        },
+
+        'history': {
+            'type': 'js',
+            'path': 'history/history-beta-min.js',
+            'requires': ['event']
+        },
+
+        'imageloader': {
+            'type': 'js',
+            'path': 'imageloader/imageloader-experimental-min.js',
+            'requires': ['event', 'dom']
+        },
+
+        'logger': {
+            'type': 'js',
+            'path': 'logger/logger-min.js',
+            'requires': ['event', 'dom'],
+            'optional': ['dragdrop'],
+            'skinnable': true
+        },
+
+        'menu': {
+            'type': 'js',
+            'path': 'menu/menu-min.js',
+            'requires': ['containercore'],
+            'skinnable': true
+        },
+
+        'reset': {
+            'type': 'css',
+            'path': 'reset/reset-min.css'
+        },
+
+        'reset-fonts-grids': {
+            'type': 'css',
+            'path': 'reset-fonts-grids/reset-fonts-grids.css',
+            'supersedes': ['reset', 'fonts', 'grids']
+        },
+
+        'slider': {
+            'type': 'js',
+            'path': 'slider/slider-min.js',
+            'requires': ['dragdrop'],
+            'optional': ['animation']
+        },
+
+        'tabview': {
+            'type': 'js',
+            'path': 'tabview/tabview-min.js',
+            'requires': ['element'],
+            'optional': ['connection'],
+            'skinnable': true
+        },
+
+        'treeview': {
+            'type': 'js',
+            'path': 'treeview/treeview-min.js',
+            'requires': ['event'],
+            'skinnable': true
+        },
+
+        'utilities': {
+            'type': 'js',
+            'path': 'utilities/utilities.js',
+            'supersedes': ['yahoo', 'event', 'dragdrop', 'animation', 'dom', 'connection', 'element', 'yahoo-dom-event'],
+            'rollup': 6
+        },
+
+        'yahoo': {
+            'type': 'js',
+            'path': 'yahoo/yahoo-min.js'
+        },
+
+        'yahoo-dom-event': {
+            'type': 'js',
+            'path': 'yahoo-dom-event/yahoo-dom-event.js',
+            'supersedes': ['yahoo', 'event', 'dom'],
+            'rollup': 3
+        },
+
+        'yuiloader': {
+            'type': 'js',
+            'path': 'yuiloader/yuiloader-beta-min.js'
+        },
+
+        'yuitest': {
+            'type': 'js',
+            'path': 'yuitest/yuitest-beta-min.js',
+            'requires': ['logger'],
+            'skinnable': true
+        }
+    }
+}
+ , 
+
+        // Simple utils since we can't count on YAHOO.lang being available.
+        ObjectUtil: {
+            appendArray: function(o, a) {
+                if (a) {
+                    for (var i=0; i<a.length; i=i+1) {
+                        o[a[i]] = true;
+                    }
+                }
+            },
+
+            clone: function(o) {
+                var c = {};
+                for (var i in o) {
+                    c[i] = o[i];
+                }
+                return c;
+            },
+
+            merge: function() {
+                var o={}, a=arguments, i, j;
+                for (i=0; i<a.length; i=i+1) {
+                    
+                    for (j in a[i]) {
+                        o[j] = a[i][j];
+                    }
+                }
+                return o;
+            },
+
+            keys: function(o, ordered) {
+                var a=[], i;
+                for (i in o) {
+                    a.push(i);
+                }
+
+                return a;
+            }
+        },
+
+        ArrayUtil: {
+
+            appendArray: function(a1, a2) {
+                Array.prototype.push.apply(a1, a2);
+                /*
+                for (var i=0; i<a2.length; i=i+1) {
+                    a1.push(a2[i]);
+                }
+                */
+            },
+
+            indexOf: function(a, val) {
+                for (var i=0; i<a.length; i=i+1) {
+                    if (a[i] === val) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            },
+
+            toObject: function(a) {
+                var o = {};
+                for (var i=0; i<a.length; i=i+1) {
+                    o[a[i]] = true;
+                }
+
+                return o;
+            },
+
+            /*
+             * Returns a unique array.  Does not maintain order, which is fine
+             * for this application, and performs better than it would if it
+             * did.
+             */
+            uniq: function(a) {
+                return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));
+            }
+        },
+
+
+        // loader instances
+        loaders: [],
+
+        finishInit: function(yahooref) {
+
+            // YAHOO has been loaded either in this window or passed 
+            // from the sandbox routine.  Set up local references 
+            // to the loader and module metadata in the YAHOO object
+            // in question so additional modules can be loaded. 
+
+            yahooref = yahooref || YAHOO;
+
+            yahooref.env.YUIInfo=YUI.info;
+            yahooref.util.YUILoader=YUI.YUILoader;
+
+        },
+
+        /*
+         * Global handler for the module loaded event exposed by
+         * YAHOO
+         */
+        onModuleLoaded: function(minfo) {
+
+            var mname = minfo.name, m;
+
+            for (var i=0; i<YUI.loaders.length; i=i+1) {
+                YUI.loaders[i].loadNext(mname);
+            }
+
+            //console.log(YAHOO.lang.dump(minfo));
+
+        },
+
+        /*
+         * Sets up the module metadata
+         */
+        init: function() {
+
+            var c = YAHOO_config, o = c.load, 
+                y_loaded = (typeof YAHOO !== "undefined" && YAHOO.env);
+
+
+            // add our listener to the existing YAHOO.env.listeners stack
+            if (y_loaded) {
+
+                YAHOO.env.listeners.push(YUI.onModuleLoaded);
+
+            // define a listener in YAHOO_config that YAHOO will pick up
+            // when it is loaded.
+            } else {
+
+                if (c.listener) {
+                    YUI.cachedCallback = c.listener;
+                }
+
+                c.listener = function(minfo) {
+                    YUI.onModuleLoaded(minfo);
+                    if (YUI.cachedCallback) {
+                        YUI.cachedCallback(minfo);
+                    }
+                };
+            }
+
+            // Fetch the required modules immediately if specified
+            // in YAHOO_config.  Otherwise detect YAHOO and fetch
+            // it if it doesn't exist so we have a place to put
+            // the loader.  The problem with this is that it will
+            // prevent rollups from working
+            if (o || !y_loaded) {
+
+                o = o || {};
+
+                var loader = new YUI.YUILoader(o);
+                loader.onLoadComplete = function() {
+
+                        YUI.finishInit();
+
+                        if (o.onLoadComplete) {
+
+                            loader._pushEvents();
+                            o.onLoadComplete(loader);
+                        }
+
+                        
+                    };
+
+                // If no load was requested, we must load YAHOO
+                // so we have a place to put the loader
+                if (!y_loaded) {
+                    loader.require("yahoo");
+                }
+
+                loader.insert(null, o);
+            } else {
+                YUI.finishInit();
+            }
+        }
+
+    };
+
+    YUI.YUILoader = function(o) {
+
+        // Inform the library that it is being injected
+        YAHOO_config.injecting = true;
+
+        o = o || {};
+
+        /**
+         * Internal callback to handle multiple internal insert() calls
+         * so that css is inserted prior to js
+         * @property _internalCallback
+         * @private
+         */
+        this._internalCallback = null;
+
+        /**
+         * Callback that will be executed when the loader is finished
+         * with an insert
+         * @method onLoadComplete
+         * @type function
+         */
+        this.onLoadComplete = null;
+
+        /**
+         * The base directory.
+         * @property base
+         * @type string
+         * @default build
+         */
+        this.base = ("base" in o) ? o.base : YUI.info.base;
+
+        /**
+         * Should we allow rollups
+         * @property allowRollup
+         * @type boolean
+         * @default true
+         */
+        this.allowRollup = ("allowRollup" in o) ? o.allowRollup : true;
+
+        /**
+         * Filter to apply to result url
+         * @property filter
+         * @type string|object
+         */
+        this.filter = o.filter;
+
+        /**
+         * Create a sandbox rather than inserting into lib into.
+         * the current context.  Not currently supported
+         * property sandbox
+         * @type boolean
+         * @default false
+         */
+        this.sandbox = o.sandbox;
+
+        /**
+         * The list of requested modules
+         * @property required
+         * @type {string: boolean}
+         */
+        this.required = {};
+
+        /**
+         * The library metadata
+         * @property moduleInfo
+         */
+        this.moduleInfo = o.moduleInfo || YUI.info.moduleInfo;
+
+        /**
+         * List of rollup files found in the library metadata
+         * @property rollups
+         */
+        this.rollups = null;
+
+        /**
+         * Whether or not to load optional dependencies for 
+         * the requested modules
+         * @property loadOptional
+         * @type boolean
+         * @default false
+         */
+        this.loadOptional = o.loadOptional || false;
+
+        /**
+         * All of the derived dependencies in sorted order, which
+         * will be populated when either calculate() or insert()
+         * is called
+         * @property sorted
+         * @type string[]
+         */
+        this.sorted = [];
+
+        /**
+         * Set when beginning to compute the dependency tree. 
+         * Composed of what YAHOO reports to be loaded combined
+         * with what has been loaded by the tool
+         * @propery loaded
+         * @type {string: boolean}
+         */
+        this.loaded = {};
+
+        /**
+         * Flag to indicate the dependency tree needs to be recomputed
+         * if insert is called again.
+         * @property dirty
+         * @type boolean
+         * @default true
+         */
+        this.dirty = true;
+
+        /**
+         * List of modules inserted by the utility
+         * @property inserted
+         * @type {string: boolean}
+         */
+        this.inserted = {};
+
+
+        /**
+         * Provides the information used to skin the skinnable components.
+         * The following skin definition would result in 'skin1' and 'skin2'
+         * being loaded for calendar (if calendar was requested), and
+         * 'sam' for all other skinnable components:
+         *
+         *   <code>
+         *   skin: {
+         *
+         *      // The default skin, which is automatically applied if not
+         *      // overriden by a component-specific skin definition.
+         *      // Change this in to apply a different skin globally
+         *      defaultSkin: 'sam', 
+         *
+         *      // This is combined with the loader base property to get
+         *      // the default root directory for a skin. ex:
+         *      // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
+         *      base: 'assets/skins/',
+         *
+         *      // The name of the rollup css file for the skin
+         *      path: 'skin.css',
+         *
+         *      // The number of skinnable components requested that are
+         *      // required before using the rollup file rather than the
+         *      // individual component css files
+         *      rollup: 3,
+         *
+         *      // Any component-specific overrides can be specified here,
+         *      // making it possible to load different skins for different
+         *      // components.  It is possible to load more than one skin
+         *      // for a given component as well.
+         *      overrides: {
+         *          calendar: ['skin1', 'skin2']
+         *      }
+         *   }
+         *   </code>
+         *   @property skin
+         */
+        this.skin = o.skin || YUI.ObjectUtil.clone(YUI.info.skin); 
+
+
+        if (o.require) {
+            this.require(o.require);
+        }
+
+        YUI.loaders.push(this);
+    };
+
+    YUI.YUILoader.prototype = {
+
+        FILTERS: {
+            RAW: { 
+                'searchExp': "-min\\.js", 
+                'replaceStr': ".js"
+            },
+            DEBUG: { 
+                'searchExp': "-min\\.js", 
+                'replaceStr': "-debug.js"
+            }
+        },
+
+        SKIN_PREFIX: "skin-",
+
+        /** Add a new module to the component metadata.  The javascript 
+         * component must also use YAHOO.register to notify the loader 
+         * when it has been loaded, or a verifier function must be
+         * provided
+         * <dl>
+         *     <dt>name:</dt>       <dd>required, the component name</dd>
+         *     <dt>type:</dt>       <dd>required, the component type (js or css)</dd>
+         *     <dt>path:</dt>       <dd>required, the path to the script from "base"</dd>
+         *     <dt>requires:</dt>   <dd>the modules required by this component</dd>
+         *     <dt>optional:</dt>   <dd>the optional modules for this component</dd>
+         *     <dt>supersedes:</dt> <dd>the modules this component replaces</dd>
+         *     <dt>rollup:</dt>     <dd>the number of superseded modules required for automatic rollup</dd>
+         *     <dt>verifier:</dt>   <dd>a function that is executed to determine when the module is fully loaded</dd>
+         *     <dt>fullpath:</dt>   <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
+         *     <dt>skinnable:</dt>  <dd>flag to determine if skin assets should automatically be pulled in</dd>
+         * </dl>
+         * @method addModule
+         * @param o An object containing the module data
+         * @return {boolean} true if the module was added, false if 
+         * the object passed in did not provide all required attributes
+         */
+        addModule: function(o) {
+
+            if (!o || !o.name || !o.type || (!o.path && !o.fullpath)) {
+                return false;
+            }
+
+            this.moduleInfo[o.name] = o;
+            this.dirty = true;
+
+            return true;
+        },
+
+        /**
+         * Add a requirement for one or more module
+         * @method require
+         * @param what {string[] | string*} the modules to load
+         */
+        require: function(what) {
+            var a = (typeof what === "string") ? arguments : what;
+
+            this.dirty = true;
+
+            for (var i=0; i<a.length; i=i+1) {
+                this.required[a[i]] = true;
+                var s = this.parseSkin(a[i]);
+                if (s) {
+                    this._addSkin(s.skin, s.module);
+                }
+            }
+            YUI.ObjectUtil.appendArray(this.required, a);
+        },
+
+
+        /**
+         * Adds the skin def to the module info
+         * @method _addSkin
+         * @private
+         */
+        _addSkin: function(skin, mod) {
+
+            // Add a module definition for the skin rollup css
+            var name = this.formatSkin(skin);
+            if (!this.moduleInfo[name]) {
+                this.addModule({
+                    'name': name,
+                    'type': 'css',
+                    'path': this.skin.base + skin + "/" + this.skin.path,
+                    //'supersedes': '*',
+                    'rollup': this.skin.rollup
+                });
+            }
+
+            // Add a module definition for the module-specific skin css
+            if (mod) {
+                name = this.formatSkin(skin, mod);
+                if (!this.moduleInfo[name]) {
+                    this.addModule({
+                        'name': name,
+                        'type': 'css',
+                        //'path': this.skin.base + skin + "/" + mod + ".css"
+                        'path': mod + '/' + this.skin.base + skin + "/" + mod + ".css"
+                    });
+                }
+            }
+        },
+
+        /**
+         * Returns an object containing properties for all modules required
+         * in order to load the requested module
+         * @method getRequires
+         * @param mod The module definition from moduleInfo
+         */
+        getRequires: function(mod) {
+            if (!this.dirty && mod.expanded) {
+                return mod.expanded;
+            }
+
+            mod.requires=mod.requires || [];
+            var i, d=[], r=mod.requires, o=mod.optional, s=mod.supersedes, info=this.moduleInfo;
+            for (i=0; i<r.length; i=i+1) {
+                d.push(r[i]);
+                YUI.ArrayUtil.appendArray(d, this.getRequires(info[r[i]]));
+            }
+
+            if (o && this.loadOptional) {
+                for (i=0; i<o.length; i=i+1) {
+                    d.push(o[i]);
+                    YUI.ArrayUtil.appendArray(d, this.getRequires(info[o[i]]));
+                }
+            }
+
+            mod.expanded = YUI.ArrayUtil.uniq(d);
+
+            return mod.expanded;
+        },
+
+        /**
+         * Returns an object literal of the modules the supplied module satisfies
+         * @method getProvides
+         * @param mod The module definition from moduleInfo
+         * @return what this module provides
+         */
+        getProvides: function(name) {
+            var mod = this.moduleInfo[name];
+
+            var o = {};
+            o[name] = true;
+
+            var s = mod && mod.supersedes;
+
+            YUI.ObjectUtil.appendArray(o, s);
+
+            // console.log(this.sorted + ", " + name + " provides " + YUI.ObjectUtil.keys(o));
+
+            return o;
+        },
+
+        /**
+         * Calculates the dependency tree, the result is stored in the sorted 
+         * property
+         * @method calculate
+         * @param o optional options object
+         */
+        calculate: function(o) {
+            if (this.dirty) {
+
+                this._setup(o);
+                this._explode();
+                this._skin();
+                if (this.allowRollup) {
+                    this._rollup();
+                }
+                this._reduce();
+                this._sort();
+
+                this.dirty = false;
+            }
+        },
+
+        /**
+         * Investigates the current YUI configuration on the page.  By default,
+         * modules already detected will not be loaded again unless a force
+         * option is encountered.  Called by calculate()
+         * @method _setup
+         * @param o optional options object
+         * @private
+         */
+        _setup: function(o) {
+
+            o = o || {};
+            this.loaded = YUI.ObjectUtil.clone(this.inserted); 
+            
+            if (!this.sandbox && typeof YAHOO !== "undefined" && YAHOO.env) {
+                this.loaded = YUI.ObjectUtil.merge(this.loaded, YAHOO.env.modules);
+            }
+
+            // add the ignore list to the list of loaded packages
+            if (o.ignore) {
+                YUI.ObjectUtil.appendArray(this.loaded, o.ignore);
+            }
+
+            // remove modules on the force list from the loaded list
+            if (o.force) {
+                for (var i=0; i<o.force.length; i=i+1) {
+                    if (o.force[i] in this.loaded) {
+                        delete this.loaded[o.force[i]];
+                    }
+                }
+            }
+        },
+        
+
+        /**
+         * Inspects the required modules list looking for additional 
+         * dependencies.  Expands the required list to include all 
+         * required modules.  Called by calculate()
+         * @method _explode
+         * @private
+         */
+        _explode: function() {
+
+            var r=this.required, i, mod;
+
+            for (i in r) {
+                mod = this.moduleInfo[i];
+                if (mod) {
+
+                    var req = this.getRequires(mod);
+
+                    if (req) {
+                        YUI.ObjectUtil.appendArray(r, req);
+                    }
+                }
+            }
+        },
+
+        /**
+         * Sets up the requirements for the skin assets if any of the
+         * requested modules are skinnable
+         * @method _skin
+         * @private
+         */
+        _skin: function() {
+
+            var r=this.required, i, mod;
+
+            for (i in r) {
+                mod = this.moduleInfo[i];
+                if (mod && mod.skinnable) {
+                    var o=this.skin.overrides, j;
+                    if (o && o[i]) {
+                        for (j=0; j<o[i].length; j=j+1) {
+                            this.require(this.formatSkin(o[i][j], i));
+                        }
+                    } else {
+                        this.require(this.formatSkin(this.skin.defaultSkin, i));
+                    }
+                }
+            }
+        },
+
+        /**
+         * Returns the skin module name for the specified skin name.  If a
+         * module name is supplied, the returned skin module name is 
+         * specific to the module passed in.
+         * @method formatSkin
+         * @param skin {string} the name of the skin
+         * @param mod {string} optional: the name of a module to skin
+         * @return {string} the full skin module name
+         */
+        formatSkin: function(skin, mod) {
+            var s = this.SKIN_PREFIX + skin;
+            if (mod) {
+                s = s + "-" + mod;
+            }
+
+            return s;
+        },
+        
+        /**
+         * Reverses <code>formatSkin</code>, providing the skin name and
+         * module name if the string matches the pattern for skins.
+         * @method parseSkin
+         * @param mod {string} the module name to parse
+         * @return {skin: string, module: string} the parsed skin name 
+         * and module name, or null if the supplied string does not match
+         * the skin pattern
+         */
+        parseSkin: function(mod) {
+            
+            if (mod.indexOf(this.SKIN_PREFIX) === 0) {
+                var a = mod.split("-");
+                return {skin: a[1], module: a[2]};
+            } 
+
+            return null;
+        },
+
+        /**
+         * Look for rollup packages to determine if all of the modules a
+         * rollup supersedes are required.  If so, include the rollup to
+         * help reduce the total number of connections required.  Called
+         * by calculate()
+         * @method _rollup
+         * @private
+         */
+        _rollup: function() {
+            var i, j, m, s, rollups={}, r=this.required, roll;
+
+            // find and cache rollup modules
+            if (this.dirty || !this.rollups) {
+                for (i in this.moduleInfo) {
+                    m = this.moduleInfo[i];
+                    //if (m && m.rollup && m.supersedes) {
+                    if (m && m.rollup) {
+                        rollups[i] = m;
+                    }
+                }
+
+                this.rollups = rollups;
+            }
+
+            // make as many passes as needed to pick up rollup rollups
+            for (;;) {
+                var rolled = false;
+
+                // go through the rollup candidates
+                for (i in rollups) { 
+
+                    // there can be only one
+                    if (!r[i] && !this.loaded[i]) {
+                        m =this.moduleInfo[i]; s = m.supersedes; roll=true;
+
+                        if (!m.rollup) {
+                            continue;
+                        }
+
+
+                        var skin = this.parseSkin(i), c = 0;
+                        if (skin) {
+
+                            for (j in r) {
+                                if (i !== j && this.parseSkin(j)) {
+                                    c++;
+                                    roll = (c >= m.rollup);
+                                    if (roll) {
+                                        break;
+                                    }
+                                }
+                            }
+
+
+                        } else {
+
+                            // require all modules to trigger a rollup (using the 
+                            // threshold value has not proved worthwhile)
+                            for (j=0;j<s.length;j=j+1) {
+
+                                // if the superseded module is loaded, we can't load the rollup
+                                if (this.loaded[s[j]]) {
+                                    roll = false;
+                                    break;
+                                // increment the counter if this module is required.  if we are
+                                // beyond the rollup threshold, we will use the rollup module
+                                } else if (r[s[j]]) {
+                                    c++;
+                                    roll = (c >= m.rollup);
+                                    if (roll) {
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+
+                        if (roll) {
+                            // add the rollup
+                            r[i] = true;
+                            rolled = true;
+
+                            // expand the rollup's dependencies
+                            this.getRequires(m);
+                        }
+                    }
+                }
+
+                // if we made it here w/o rolling up something, we are done
+                if (!rolled) {
+                    break;
+                }
+            }
+        },
+
+        /**
+         * Remove superceded modules and loaded modules.  Called by
+         * calculate() after we have the mega list of all dependencies
+         * @method _reduce
+         * @private
+         */
+        _reduce: function() {
+
+            var i, j, s, m, r=this.required;
+            for (i in r) {
+
+                // remove if already loaded
+                if (i in this.loaded) { 
+                    delete r[i];
+
+                // remove anything this module supersedes
+                } else {
+
+                    var skinDef = this.parseSkin(i);
+
+                    if (skinDef) {
+                        //console.log("skin found in reduce: " + skinDef.skin + ", " + skinDef.module);
+                        // the skin rollup will not have a module name
+                        if (!skinDef.module) {
+                            var skin_pre = this.SKIN_PREFIX + skinDef.skin;
+                            //console.log("skin_pre: " + skin_pre);
+                            for (j in r) {
+                                if (j !== i && j.indexOf(skin_pre) > -1) {
+                                    //console.log ("removing component skin: " + j);
+                                    delete r[j];
+                                }
+                            }
+                        }
+                    } else {
+
+                         m = this.moduleInfo[i];
+                         s = m && m.supersedes;
+                         if (s) {
+                             for (j=0;j<s.length;j=j+1) {
+                                 if (s[j] in r) {
+                                     delete r[s[j]];
+                                 }
+                             }
+                         }
+                    }
+                }
+            }
+        },
+        
+        /**
+         * Sorts the dependency tree.  The last step of calculate()
+         * @method _sort
+         * @private
+         */
+        _sort: function() {
+            // create an indexed list
+            var s=[], info=this.moduleInfo, loaded=this.loaded;
+
+            // returns true if b is not loaded, and is required
+            // directly or by means of modules it supersedes.
+            var requires = function(aa, bb) {
+                if (loaded[bb]) {
+                    return false;
+                }
+
+                var ii, mm=info[aa], rr=mm && mm.expanded;
+
+                if (rr && YUI.ArrayUtil.indexOf(rr, bb) > -1) {
+                    return true;
+                }
+
+                var ss=info[bb] && info[bb].supersedes;
+                if (ss) {
+                    for (ii=0; ii<ss.length; ii=ii+1) {
+                        if (requires(aa, ss[ii])) {
+                            return true;
+                        }
+                    }
+                }
+
+                return false;
+            };
+
+            // get the required items out of the obj into an array so we
+            // can sort
+            for (var i in this.required) {
+                s.push(i);
+            }
+
+            // pointer to the first unsorted item
+            var p=0; 
+
+            // keep going until we make a pass without moving anything
+            for (;;) {
+               
+                var l=s.length, a, b, j, k, moved=false;
+
+                // start the loop after items that are already sorted
+                for (j=p; j<l; j=j+1) {
+
+                    // check the next module on the list to see if its
+                    // dependencies have been met
+                    a = s[j];
+
+                    // check everything below current item and move if we
+                    // find a requirement for the current item
+                    for (k=j+1; k<l; k=k+1) {
+                        if (requires(a, s[k])) {
+
+                            // extract the dependency so we can move it up
+                            b = s.splice(k, 1);
+
+                            // insert the dependency above the item that 
+                            // requires it
+                            s.splice(j, 0, b[0]);
+
+                            moved = true;
+                            break;
+                        }
+                    }
+
+                    // jump out of loop if we moved something
+                    if (moved) {
+                        break;
+                    // this item is sorted, move our pointer and keep going
+                    } else {
+                        p = p + 1;
+                    }
+                }
+
+                // when we make it here and moved is false, we are 
+                // finished sorting
+                if (!moved) {
+                    break;
+                }
+
+            }
+
+            this.sorted = s;
+        },
+
+        /**
+         * inserts the requested modules and their dependencies.  
+         * <code>type</code> can be "js" or "css".  Both script and 
+         * css are inserted if type is not provided.
+         * @method insert
+         * @param callback {Function} a function to execute when the load
+         * is complete.
+         * @param o optional options object
+         * @param type {string} the type of dependency to insert
+         */
+        insert: function(callback, o, type) {
+
+            //if (!this.onLoadComplete) {
+                //this.onLoadComplete = callback;
+            //}
+
+            if (!type) {
+                var self = this;
+                this._internalCallback = function() {
+                            self._internalCallback = null;
+                            self.insert(callback, o, "js");
+                        };
+                this.insert(null, o, "css");
+                return;
+            }
+
+            o = o || {};
+
+            // store the callback for when we are done
+            this.onLoadComplete = callback || this.onLoadComplete;
+
+            // store the optional filter
+            var f = o && o.filter || null;
+
+            if (typeof f === "string") {
+                f = f.toUpperCase();
+
+                // the logger must be available in order to use the debug
+                // versions of the library
+                if (f === "DEBUG") {
+                    this.require("logger");
+                }
+            }
+
+            this.filter = this.FILTERS[f] || f || this.FILTERS[this.filter] || this.filter;
+
+            // store the options... not currently in use
+            this.insertOptions = o;
+
+            // build the dependency list
+            this.calculate(o);
+
+            // set a flag to indicate the load has started
+            this.loading = true;
+
+            // keep the loadType (js, css or undefined) cached
+            this.loadType = type;
+
+            // start the load
+            this.loadNext();
+
+        },
+
+        /**
+         * Executed every time a module is loaded, and if we are in a load
+         * cycle, we attempt to load the next script.  Public so that it
+         * is possible to call this if using a method other than
+         * YAHOO.register to determine when scripts are fully loaded
+         * @method loadNext
+         * @param mname {string} optional the name of the module that has
+         * been loaded (which is usually why it is time to load the next
+         * one)
+         */
+        loadNext: function(mname) {
+
+            // console.log("loadNext executing, just loaded " + mname);
+
+            // The global handler that is called when each module is loaded
+            // will pass that module name to this function.  Storing this
+            // data to avoid loading the same module multiple times
+            if (mname) {
+                this.inserted[mname] = true;
+                //var o = this.getProvides(mname);
+                //this.inserted = YUI.ObjectUtil.merge(this.inserted, o);
+            }
+
+            // It is possible that this function is executed due to something
+            // else one the page loading a YUI module.  Only react when we
+            // are actively loading something
+            if (!this.loading) {
+                return;
+            }
+
+            // if the module that was just loaded isn't what we were expecting,
+            // continue to wait
+            if (mname && mname !== this.loading) {
+                return;
+            }
+            
+            var s=this.sorted, len=s.length, i, m, url;
+
+            for (i=0; i<len; i=i+1) {
+
+                // This.inserted keeps track of what the loader has loaded
+                if (s[i] in this.inserted) {
+                    // console.log(s[i] + " alread loaded ");
+                    continue;
+                }
+
+                // Because rollups will cause multiple load notifications
+                // from YAHOO, loadNext may be called multiple times for
+                // the same module when loading a rollup.  We can safely
+                // skip the subsequent requests
+                if (s[i] === this.loading) {
+                    // console.log("still loading " + s[i] + ", waiting");
+                    return;
+                }
+
+                // log("inserting " + s[i]);
+
+                m = this.moduleInfo[s[i]];
+
+                // The load type is stored to offer the possibility to load
+                // the css separately from the script.
+                if (!this.loadType || this.loadType === m.type) {
+                    this.loading = s[i];
+
+                    // Insert the css node and continue.  It is possible
+                    // that the css file will load out of order ... this
+                    // may be a problem that needs to be addressed, but
+                    // unlike the script files, there is no notification
+                    // mechanism in place for the css files.
+                    if (m.type === "css") {
+
+                        url = m.fullpath || this._url(m.path);
+                        
+                        this.insertCss(url);
+                        this.inserted[s[i]] = true;
+
+                    // Scripts must be loaded in order, so we wait for the
+                    // notification from YAHOO or a verifier function to 
+                    // process the next script
+                    } else {
+
+                        url = m.fullpath || this._url(m.path);
+                        this.insertScript(url);
+
+                        // if a verifier was included for this module, execute
+                        // it, passing the name of the module, and a callback
+                        // that must be exectued when the verifier is done.
+                        if (m.verifier) {
+                            var self = this, name=s[i];
+                            m.verifier(name, function() {
+                                    self.loadNext(name);
+                                });
+                        }
+
+                        return;
+                    }
+                }
+            }
+
+            // we are finished
+            this.loading = null;
+
+
+            // internal callback for loading css first
+            if (this._internalCallback) {
+                var f = this._internalCallback;
+                this._internalCallback = null;
+                f(this);
+            } else if (this.onLoadComplete) {
+                this._pushEvents();
+                this.onLoadComplete(this);
+            }
+
+        },
+
+        /**
+         * In IE, the onAvailable/onDOMReady events need help when Event is
+         * loaded dynamically
+         * @method _pushEvents
+         * @private
+         */
+        _pushEvents: function() {
+            if (typeof YAHOO !== "undefined" && YAHOO.util && YAHOO.util.Event) {
+                YAHOO.util.Event._load();
+            }
+        },
+
+        /**
+         * Generates the full url for a module
+         * method _url
+         * @param path {string} the path fragment
+         * @return {string} the full url
+         * @private
+         */
+        _url: function(path) {
+            
+            var u = this.base || "", f=this.filter;
+            u = u + path;
+
+            if (f) {
+                // console.log("filter: " + f + ", " + f.searchExp + 
+                // ", " + f.replaceStr);
+                u = u.replace(new RegExp(f.searchExp), f.replaceStr);
+            }
+
+            // console.log(u);
+
+            return u;
+        },
+
+        /**
+         * Inserts a script node
+         * @method insertScript
+         * @param url {string} the full url for the script
+         * @param win {Window} optional window to target
+         */
+        insertScript: function(url, win) {
+
+            //console.log("inserting script " + url);
+            var w = win || window, d=w.document, n=d.createElement("script"),
+                h = d.getElementsByTagName("head")[0];
+
+            n.src = url;
+            n.type = "text/javascript";
+            h.appendChild(n);
+        },
+
+        /**
+         * Inserts a css link node
+         * @method insertCss
+         * @param url {string} the full url for the script
+         * @param win {Window} optional window to target
+         */
+        insertCss: function(url, win) {
+            // console.log("inserting css " + url);
+            var w = win || window, d=w.document, n=d.createElement("link"),
+                h = d.getElementsByTagName("head")[0];
+
+            n.href = url;
+            n.type = "text/css";
+            n.rel = "stylesheet";
+            h.appendChild(n);
+        },
+       
+        /*
+         * Interns the script for the requested modules.  The callback is
+         * provided a reference to the sandboxed YAHOO object.  This only
+         * applies to the script: css can not be sandboxed.  Not implemented.
+         * @method sandbox
+         * @param callback {Function} the callback to exectued when the load is
+         *        complete.
+         * @notimplemented
+         */
+        sandbox: function(callback) {
+            // this.calculate({
+                         //sandbox: true
+                     //});
+        }
+    };
+
+    YUI.init();
+
+})();

Added: trunk/examples/RestYUI/root/static/yui/yuitest-beta.js
===================================================================
--- trunk/examples/RestYUI/root/static/yui/yuitest-beta.js	                        (rev 0)
+++ trunk/examples/RestYUI/root/static/yui/yuitest-beta.js	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,2669 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.1
+*/
+YAHOO.namespace("tool");
+
+//-----------------------------------------------------------------------------
+// TestLogger object
+//-----------------------------------------------------------------------------
+
+/**
+ * Displays test execution progress and results, providing filters based on
+ * different key events.
+ * @namespace YAHOO.tool
+ * @class TestLogger
+ * @constructor
+ * @param {HTMLElement} element (Optional) The element to create the logger in.
+ * @param {Object} config (Optional) Configuration options for the logger.
+ */
+YAHOO.tool.TestLogger = function (element, config) {
+    YAHOO.tool.TestLogger.superclass.constructor.call(this, element, config);
+    this.init();
+};
+
+YAHOO.lang.extend(YAHOO.tool.TestLogger, YAHOO.widget.LogReader, {
+
+    footerEnabled : true,
+    newestOnTop : false,
+
+    /**
+     * Formats message string to HTML for output to console.
+     * @private
+     * @method formatMsg
+     * @param oLogMsg {Object} Log message object.
+     * @return {String} HTML-formatted message for output to console.
+     */
+    formatMsg : function(message /*:Object*/) {
+    
+        var category /*:String*/ = message.category;        
+        var text /*:String*/ = this.html2Text(message.msg);
+        
+        return "<pre><p><span class=\"" + category + "\">" + category.toUpperCase() + "</span> " + text + "</p></pre>";
+    
+    },
+    
+    //-------------------------------------------------------------------------
+    // Private Methods
+    //-------------------------------------------------------------------------
+    
+    /*
+     * Initializes the logger.
+     * @private
+     */
+    init : function () {
+    
+        //attach to any available TestRunner
+        if (YAHOO.tool.TestRunner){
+            this.setTestRunner(YAHOO.tool.TestRunner);
+        }
+        
+        //hide useless sources
+        this.hideSource("global");
+        this.hideSource("LogReader");
+        
+        //hide useless message categories
+        this.hideCategory("warn");
+        this.hideCategory("window");
+        this.hideCategory("time");
+        
+        //reset the logger
+        this.clearConsole();
+    },
+    
+    /**
+     * Clears the reference to the TestRunner from previous operations. This 
+     * unsubscribes all events and removes the object reference.
+     * @return {Void}
+     * @static
+     */
+    clearTestRunner : function () /*:Void*/ {
+        if (this._runner){
+            this._runner.unsubscribeAll();
+            this._runner = null;
+        }
+    },
+    
+    /**
+     * Sets the source test runner that the logger should monitor.
+     * @param {YAHOO.tool.TestRunner} testRunner The TestRunner to observe.
+     * @return {Void}
+     * @static
+     */
+    setTestRunner : function (testRunner /*:YAHOO.tool.TestRunner*/) /*:Void*/ {
+    
+        if (this._runner){
+            this.clearTestRunner();
+        }
+        
+        this._runner = testRunner;
+        
+        //setup event _handlers
+        testRunner.subscribe(testRunner.TEST_PASS_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_FAIL_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_IGNORE_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.BEGIN_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.COMPLETE_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_SUITE_BEGIN_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_SUITE_COMPLETE_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_CASE_BEGIN_EVENT, this._handleTestRunnerEvent, this, true);
+        testRunner.subscribe(testRunner.TEST_CASE_COMPLETE_EVENT, this._handleTestRunnerEvent, this, true);    
+    },
+    
+    //-------------------------------------------------------------------------
+    // Event Handlers
+    //-------------------------------------------------------------------------
+    
+    /**
+     * Handles all TestRunner events, outputting appropriate data into the console.
+     * @param {Object} data The event data object.
+     * @return {Void}
+     * @private
+     */
+    _handleTestRunnerEvent : function (data /*:Object*/) /*:Void*/ {
+    
+        //shortcut variables
+        var TestRunner /*:Object*/ = YAHOO.tool.TestRunner;
+    
+        //data variables
+        var message /*:String*/ = "";
+        var messageType /*:String*/ = "";
+        
+        switch(data.type){
+            case TestRunner.BEGIN_EVENT:
+                message = "Testing began at " + (new Date()).toString() + ".";
+                messageType = "info";
+                break;
+                
+            case TestRunner.COMPLETE_EVENT:
+                message = "Testing completed at " + (new Date()).toString() + ".\nPassed:" 
+                    + data.results.passed + " Failed:" + data.results.failed + " Total:" + data.results.total;
+                messageType = "info";
+                break;
+                
+            case TestRunner.TEST_FAIL_EVENT:
+                message = data.testName + ": " + data.error.getMessage();
+                messageType = "fail";
+                break;
+                
+            case TestRunner.TEST_IGNORE_EVENT:
+                message = data.testName + ": ignored.";
+                messageType = "ignore";
+                break;
+                
+            case TestRunner.TEST_PASS_EVENT:
+                message = data.testName + ": passed.";
+                messageType = "pass";
+                break;
+                
+            case TestRunner.TEST_SUITE_BEGIN_EVENT:
+                message = "Test suite \"" + data.testSuite.name + "\" started.";
+                messageType = "info";
+                break;
+                
+            case TestRunner.TEST_SUITE_COMPLETE_EVENT:
+                message = "Test suite \"" + data.testSuite.name + "\" completed.\nPassed:" 
+                    + data.results.passed + " Failed:" + data.results.failed + " Total:" + data.results.total;
+                messageType = "info";
+                break;
+                
+            case TestRunner.TEST_CASE_BEGIN_EVENT:
+                message = "Test case \"" + data.testCase.name + "\" started.";
+                messageType = "info";
+                break;
+                
+            case TestRunner.TEST_CASE_COMPLETE_EVENT:
+                message = "Test case \"" + data.testCase.name + "\" completed.\nPassed:" 
+                    + data.results.passed + " Failed:" + data.results.failed + " Total:" + data.results.total;
+                messageType = "info";
+                break;
+            default:
+                message = "Unexpected event " + data.type;
+                message = "info";
+        }
+    
+        YAHOO.log(message, messageType, "TestRunner");    
+    }
+    
+});
+YAHOO.namespace("tool");
+
+/**
+ * The YUI test tool
+ * @module yuitest
+ * @namespace YAHOO.tool
+ * @requires yahoo,dom,event,logger
+ */
+
+
+//-----------------------------------------------------------------------------
+// TestRunner object
+//-----------------------------------------------------------------------------
+
+/**
+ * Runs test suites and test cases, providing events to allowing for the
+ * interpretation of test results.
+ * @namespace YAHOO.tool
+ * @class TestRunner
+ * @static
+ */
+YAHOO.tool.TestRunner = (function(){
+
+    function TestRunner(){
+    
+        //inherit from EventProvider
+        TestRunner.superclass.constructor.apply(this,arguments);
+        
+        /**
+         * The test objects to run.
+         * @type Array
+         * @private
+         */
+        this.items /*:Array*/ = [];
+        
+        //create events
+        var events /*:Array*/ = [
+            this.TEST_CASE_BEGIN_EVENT,
+            this.TEST_CASE_COMPLETE_EVENT,
+            this.TEST_SUITE_BEGIN_EVENT,
+            this.TEST_SUITE_COMPLETE_EVENT,
+            this.TEST_PASS_EVENT,
+            this.TEST_FAIL_EVENT,
+            this.TEST_IGNORE_EVENT,
+            this.COMPLETE_EVENT,
+            this.BEGIN_EVENT
+        ];
+        for (var i=0; i < events.length; i++){
+            this.createEvent(events[i], { scope: this });
+        }
+       
+   
+    }
+    
+    YAHOO.lang.extend(TestRunner, YAHOO.util.EventProvider, {
+    
+        //-------------------------------------------------------------------------
+        // Constants
+        //-------------------------------------------------------------------------
+         
+        /**
+         * Fires when a test case is opened but before the first 
+         * test is executed.
+         * @event testcasebegin
+         */         
+        TEST_CASE_BEGIN_EVENT /*:String*/ : "testcasebegin",
+        
+        /**
+         * Fires when all tests in a test case have been executed.
+         * @event testcasecomplete
+         */        
+        TEST_CASE_COMPLETE_EVENT /*:String*/ : "testcasecomplete",
+        
+        /**
+         * Fires when a test suite is opened but before the first 
+         * test is executed.
+         * @event testsuitebegin
+         */        
+        TEST_SUITE_BEGIN_EVENT /*:String*/ : "testsuitebegin",
+        
+        /**
+         * Fires when all test cases in a test suite have been
+         * completed.
+         * @event testsuitecomplete
+         */        
+        TEST_SUITE_COMPLETE_EVENT /*:String*/ : "testsuitecomplete",
+        
+        /**
+         * Fires when a test has passed.
+         * @event pass
+         */        
+        TEST_PASS_EVENT /*:String*/ : "pass",
+        
+        /**
+         * Fires when a test has failed.
+         * @event fail
+         */        
+        TEST_FAIL_EVENT /*:String*/ : "fail",
+        
+        /**
+         * Fires when a test has been ignored.
+         * @event ignore
+         */        
+        TEST_IGNORE_EVENT /*:String*/ : "ignore",
+        
+        /**
+         * Fires when all test suites and test cases have been completed.
+         * @event complete
+         */        
+        COMPLETE_EVENT /*:String*/ : "complete",
+        
+        /**
+         * Fires when the run() method is called.
+         * @event begin
+         */        
+        BEGIN_EVENT /*:String*/ : "begin",    
+    
+        //-------------------------------------------------------------------------
+        // Private Methods
+        //-------------------------------------------------------------------------
+         
+        /**
+         * Runs a given test case.
+         * @param {YAHOO.tool.TestCase} testCase The test case to run.
+         * @return {Object} Results of the execution with properties passed, failed, and total.
+         * @method _runTestCase
+         * @private
+         * @static
+         */
+        _runTestCase : function (testCase /*YAHOO.tool.TestCase*/) /*:Void*/{
+        
+            //object to store results
+            var results /*:Object*/ = {};
+        
+            //test case begins
+            this.fireEvent(this.TEST_CASE_BEGIN_EVENT, { testCase: testCase });
+        
+            //gather the test functions
+            var tests /*:Array*/ = [];
+            for (var prop in testCase){
+                if (prop.indexOf("test") === 0 && typeof testCase[prop] == "function") {
+                    tests.push(prop);
+                }
+            }
+            
+            //get the "should" test cases
+            var shouldFail /*:Object*/ = testCase._should.fail || {};
+            var shouldError /*:Object*/ = testCase._should.error || {};
+            var shouldIgnore /*:Object*/ = testCase._should.ignore || {};
+            
+            //test counts
+            var failCount /*:int*/ = 0;
+            var passCount /*:int*/ = 0;
+            var runCount /*:int*/ = 0;
+            
+            //run each test
+            for (var i=0; i < tests.length; i++){
+            
+                //figure out if the test should be ignored or not
+                if (shouldIgnore[tests[i]]){
+                    this.fireEvent(this.TEST_IGNORE_EVENT, { testCase: testCase, testName: tests[i] });
+                    continue;
+                }
+            
+                //variable to hold whether or not the test failed
+                var failed /*:Boolean*/ = false;
+                var error /*:Error*/ = null;
+            
+                //run the setup
+                testCase.setUp();
+                
+                //try the test
+                try {
+                
+                    //run the test
+                    testCase[tests[i]]();
+                    
+                    //if it should fail, and it got here, then it's a fail because it didn't
+                    if (shouldFail[tests[i]]){
+                        error = new YAHOO.util.ShouldFail();
+                        failed = true;
+                    } else if (shouldError[tests[i]]){
+                        error = new YAHOO.util.ShouldError();
+                        failed = true;
+                    }
+                               
+                } catch (thrown /*:Error*/){
+                    if (thrown instanceof YAHOO.util.AssertionError) {
+                        if (!shouldFail[tests[i]]){
+                            error = thrown;
+                            failed = true;
+                        }
+                    } else {
+                        //first check to see if it should error
+                        if (!shouldError[tests[i]]) {                        
+                            error = new YAHOO.util.UnexpectedError(thrown);
+                            failed = true;
+                        } else {
+                            //check to see what type of data we have
+                            if (YAHOO.lang.isString(shouldError[tests[i]])){
+                                
+                                //if it's a string, check the error message
+                                if (thrown.message != shouldError[tests[i]]){
+                                    error = new YAHOO.util.UnexpectedError(thrown);
+                                    failed = true;                                    
+                                }
+                            } else if (YAHOO.lang.isObject(shouldError[tests[i]])){
+                            
+                                //if it's an object, check the instance and message
+                                if (!(thrown instanceof shouldError[tests[i]].constructor) || 
+                                        thrown.message != shouldError[tests[i]].message){
+                                    error = new YAHOO.util.UnexpectedError(thrown);
+                                    failed = true;                                    
+                                }
+                            
+                            }
+                        
+                        }
+                    }
+                    
+                } finally {
+                
+                    //fireEvent appropriate event
+                    if (failed) {
+                        this.fireEvent(this.TEST_FAIL_EVENT, { testCase: testCase, testName: tests[i], error: error });
+                    } else {
+                        this.fireEvent(this.TEST_PASS_EVENT, { testCase: testCase, testName: tests[i] });
+                    }            
+                }
+                
+                //run the tear down
+                testCase.tearDown();
+                
+                //update results
+                results[tests[i]] = { 
+                    result: failed ? "fail" : "pass",
+                    message : error ? error.getMessage() : "Test passed"
+                };
+                
+                //update counts
+                runCount++;
+                failCount += (failed ? 1 : 0);
+                passCount += (failed ? 0 : 1);
+            }
+            
+            //add test counts to results
+            results.total = runCount;
+            results.failed = failCount;
+            results.passed = passCount;
+            
+            //test case is done
+            this.fireEvent(this.TEST_CASE_COMPLETE_EVENT, { testCase: testCase, results: results });
+            
+            //return results
+            return results;
+        
+        },
+        
+        /**
+         * Runs all the tests in a test suite.
+         * @param {YAHOO.tool.TestSuite} testSuite The test suite to run.
+         * @return {Object} Results of the execution with properties passed, failed, and total.
+         * @method _runTestSuite
+         * @private
+         * @static
+         */
+        _runTestSuite : function (testSuite /*:YAHOO.tool.TestSuite*/) {
+        
+            //object to store results
+            var results /*:Object*/ = {
+                passed: 0,
+                failed: 0,
+                total: 0
+            };
+        
+            //fireEvent event for beginning of test suite run
+            this.fireEvent(this.TEST_SUITE_BEGIN_EVENT, { testSuite: testSuite });
+        
+            //iterate over the test suite items
+            for (var i=0; i < testSuite.items.length; i++){
+                var result = null;
+                if (testSuite.items[i] instanceof YAHOO.tool.TestSuite) {
+                    result = this._runTestSuite(testSuite.items[i]);
+                } else if (testSuite.items[i] instanceof YAHOO.tool.TestCase) {
+                    result = this._runTestCase(testSuite.items[i]);
+                }
+                
+                if (result !== null){
+                    results.total += result.total;
+                    results.passed += result.passed;
+                    results.failed += result.failed;
+                    results[testSuite.items[i].name] = result;
+                }
+            }
+    
+            //fireEvent event for completion of test suite run
+            this.fireEvent(this.TEST_SUITE_COMPLETE_EVENT, { testSuite: testSuite, results: results });
+            
+            //return the results
+            return results;
+        
+        },
+        
+        /**
+         * Runs a test case or test suite, returning the results.
+         * @param {YAHOO.tool.TestCase|YAHOO.tool.TestSuite} testObject The test case or test suite to run.
+         * @return {Object} Results of the execution with properties passed, failed, and total.
+         * @private
+         * @method _run
+         * @static
+         */
+        _run : function (testObject /*:YAHOO.tool.TestCase|YAHOO.tool.TestSuite*/) /*:Void*/ {
+            if (YAHOO.lang.isObject(testObject)){
+                if (testObject instanceof YAHOO.tool.TestSuite) {
+                    return this._runTestSuite(testObject);
+                } else if (testObject instanceof YAHOO.tool.TestCase) {
+                    return this._runTestCase(testObject);
+                } else {
+                    throw new TypeError("_run(): Expected either YAHOO.tool.TestCase or YAHOO.tool.TestSuite.");
+                }    
+            }        
+        },
+        
+        //-------------------------------------------------------------------------
+        // Protected Methods
+        //-------------------------------------------------------------------------   
+    
+        /*
+         * Fires events for the TestRunner. This overrides the default fireEvent()
+         * method from EventProvider to add the type property to the data that is
+         * passed through on each event call.
+         * @param {String} type The type of event to fire.
+         * @param {Object} data (Optional) Data for the event.
+         * @method fireEvent
+         * @static
+         * @protected
+         */
+        fireEvent : function (type /*:String*/, data /*:Object*/) /*:Void*/ {
+            data = data || {};
+            data.type = type;
+            TestRunner.superclass.fireEvent.call(this, type, data);
+        },
+        
+        //-------------------------------------------------------------------------
+        // Public Methods
+        //-------------------------------------------------------------------------   
+    
+        /**
+         * Adds a test suite or test case to the list of test objects to run.
+         * @param testObject Either a TestCase or a TestSuite that should be run.
+         */
+        add : function (testObject /*:Object*/) /*:Void*/ {
+            this.items.push(testObject);
+        },
+        
+        /**
+         * Removes all test objects from the runner.
+         */
+        clear : function () /*:Void*/ {
+            while(this.items.length){
+                this.items.pop();
+            }
+        },
+    
+        /**
+         * Runs the test suite.
+         */
+        run : function (testObject /*:Object*/) /*:Void*/ { 
+            var results = null;
+            
+            this.fireEvent(this.BEGIN_EVENT);
+       
+            //an object passed in overrides everything else
+            if (YAHOO.lang.isObject(testObject)){
+                results = this._run(testObject);  
+            } else {
+                results = {
+                    passed: 0,
+                    failed: 0,
+                    total: 0
+                };
+                for (var i=0; i < this.items.length; i++){
+                    var result = this._run(this.items[i]);
+                    results.passed += result.passed;
+                    results.failed += result.failed;
+                    results.total += result.total;
+                    results[this.items[i].name] = result;
+                }            
+            }
+            
+            this.fireEvent(this.COMPLETE_EVENT, { results: results });
+        }    
+    });
+    
+    return new TestRunner();
+    
+})();
+YAHOO.namespace("tool");
+
+
+//-----------------------------------------------------------------------------
+// TestSuite object
+//-----------------------------------------------------------------------------
+
+/**
+ * A test suite that can contain a collection of TestCase and TestSuite objects.
+ * @param {String} name The name of the test fixture.
+ * @namespace YAHOO.tool
+ * @class TestSuite
+ * @constructor
+ */
+YAHOO.tool.TestSuite = function (name /*:String*/) {
+
+    /**
+     * The name of the test suite.
+     */
+    this.name /*:String*/ = name || YAHOO.util.Dom.generateId(null, "testSuite");
+
+    /**
+     * Array of test suites and
+     * @private
+     */
+    this.items /*:Array*/ = [];
+
+};
+
+YAHOO.tool.TestSuite.prototype = {
+    
+    /**
+     * Adds a test suite or test case to the test suite.
+     * @param {YAHOO.tool.TestSuite||YAHOO.tool.TestCase} testObject The test suite or test case to add.
+     */
+    add : function (testObject /*:YAHOO.tool.TestSuite*/) /*:Void*/ {
+        if (testObject instanceof YAHOO.tool.TestSuite || testObject instanceof YAHOO.tool.TestCase) {
+            this.items.push(testObject);
+        }
+    }
+    
+};
+YAHOO.namespace("tool");
+
+//-----------------------------------------------------------------------------
+// TestCase object
+//-----------------------------------------------------------------------------
+
+/**
+ * Test case containing various tests to run.
+ * @param template An object containing any number of test methods, other methods,
+ *                 an optional name, and anything else the test case needs.
+ * @class TestCase
+ * @namespace YAHOO.tool
+ * @constructor
+ */
+YAHOO.tool.TestCase = function (template /*:Object*/) {
+    
+    /**
+     * Special rules for the test case. Possible subobjects
+     * are fail, for tests that should fail, and error, for
+     * tests that should throw an error.
+     */
+    this._should /*:Object*/ = {};
+    
+    //copy over all properties from the template to this object
+    for (var prop in template) {
+        this[prop] = template[prop];
+    }    
+    
+    //check for a valid name
+    if (!YAHOO.lang.isString(this.name)){
+        /**
+         * Name for the test case.
+         */
+        this.name /*:String*/ = YAHOO.util.Dom.generateId(null, "testCase");
+    }
+
+};
+
+YAHOO.tool.TestCase.prototype = {  
+
+    //-------------------------------------------------------------------------
+    // Test Methods
+    //-------------------------------------------------------------------------
+
+    /**
+     * Function to run before each test is executed.
+     */
+    setUp : function () /*:Void*/ {
+    },
+    
+    /**
+     * Function to run after each test is executed.
+     */
+    tearDown: function () /*:Void*/ {    
+    }
+};
+YAHOO.namespace("util");
+
+//-----------------------------------------------------------------------------
+// Assert object
+//-----------------------------------------------------------------------------
+
+/**
+ * The Assert object provides functions to test JavaScript values against
+ * known and expected results. Whenever a comparison (assertion) fails,
+ * an error is thrown.
+ *
+ * @namespace YAHOO.util
+ * @class Assert
+ * @static
+ */
+YAHOO.util.Assert = {
+
+    //-------------------------------------------------------------------------
+    // Generic Assertion Methods
+    //-------------------------------------------------------------------------
+    
+    /** 
+     * Forces an assertion error to occur.
+     * @param {String} message (Optional) The message to display with the failure.
+     * @method fail
+     * @static
+     */
+    fail : function (message /*:String*/) /*:Void*/ {
+        throw new YAHOO.util.AssertionError(message || "Test force-failed.");
+    },       
+    
+    //-------------------------------------------------------------------------
+    // Equality Assertion Methods
+    //-------------------------------------------------------------------------    
+    
+    /**
+     * Asserts that a value is equal to another. This uses the double equals sign
+     * so type cohersion may occur.
+     * @param {Object} expected The expected value.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areEqual
+     * @static
+     */
+    areEqual : function (expected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (expected != actual) {
+            throw new YAHOO.util.ComparisonFailure(message || "Values should be equal.", expected, actual);
+        }
+    },
+    
+    /**
+     * Asserts that a value is not equal to another. This uses the double equals sign
+     * so type cohersion may occur.
+     * @param {Object} unexpected The unexpected value.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areNotEqual
+     * @static
+     */
+    areNotEqual : function (unexpected /*:Object*/, actual /*:Object*/, 
+                         message /*:String*/) /*:Void*/ {
+        if (unexpected == actual) {
+            throw new YAHOO.util.UnexpectedValue(message || "Values should not be equal.", unexpected);
+        }
+    },
+    
+    /**
+     * Asserts that a value is not the same as another. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} unexpected The unexpected value.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areNotSame
+     * @static
+     */
+    areNotSame : function (unexpected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (unexpected === actual) {
+            throw new YAHOO.util.UnexpectedValue(message || "Values should not be the same.", unexpected);
+        }
+    },
+
+    /**
+     * Asserts that a value is the same as another. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} expected The expected value.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areSame
+     * @static
+     */
+    areSame : function (expected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (expected !== actual) {
+            throw new YAHOO.util.ComparisonFailure(message || "Values should be the same.", expected, actual);
+        }
+    },    
+    
+    //-------------------------------------------------------------------------
+    // Boolean Assertion Methods
+    //-------------------------------------------------------------------------    
+    
+    /**
+     * Asserts that a value is false. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isFalse
+     * @static
+     */
+    isFalse : function (actual /*:Boolean*/, message /*:String*/) {
+        if (false !== actual) {
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be false.", false, actual);
+        }
+    },
+    
+    /**
+     * Asserts that a value is true. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isTrue
+     * @static
+     */
+    isTrue : function (actual /*:Boolean*/, message /*:String*/) /*:Void*/ {
+        if (true !== actual) {
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be true.", true, actual);
+        }
+
+    },
+    
+    //-------------------------------------------------------------------------
+    // Special Value Assertion Methods
+    //-------------------------------------------------------------------------    
+    
+    /**
+     * Asserts that a value is not a number.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNaN
+     * @static
+     */
+    isNaN : function (actual /*:Object*/, message /*:String*/) /*:Void*/{
+        if (!isNaN(actual)){
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be NaN.", NaN, actual);
+        }    
+    },
+    
+    /**
+     * Asserts that a value is not the special NaN value.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNotNaN
+     * @static
+     */
+    isNotNaN : function (actual /*:Object*/, message /*:String*/) /*:Void*/{
+        if (isNaN(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Values should not be NaN.", NaN);
+        }    
+    },
+    
+    /**
+     * Asserts that a value is not null. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNotNull
+     * @static
+     */
+    isNotNull : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (YAHOO.lang.isNull(actual)) {
+            throw new YAHOO.util.UnexpectedValue(message || "Values should not be null.", null);
+        }
+    },
+
+    /**
+     * Asserts that a value is not undefined. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNotUndefined
+     * @static
+     */
+    isNotUndefined : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (YAHOO.lang.isUndefined(actual)) {
+            throw new YAHOO.util.UnexpectedValue(message || "Value should not be undefined.", undefined);
+        }
+    },
+
+    /**
+     * Asserts that a value is null. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNull
+     * @static
+     */
+    isNull : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isNull(actual)) {
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be null.", null, actual);
+        }
+    },
+        
+    /**
+     * Asserts that a value is undefined. This uses the triple equals sign
+     * so no type cohersion may occur.
+     * @param {Object} expected The expected value.
+     * @param {Object} actual The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isUndefined
+     * @static
+     */
+    isUndefined : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isUndefined(actual)) {
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be undefined.", undefined, actual);
+        }
+    },    
+    
+    //--------------------------------------------------------------------------
+    // Instance Assertion Methods
+    //--------------------------------------------------------------------------    
+   
+    /**
+     * Asserts that a value is an array.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isArray
+     * @static
+     */
+    isArray : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isArray(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be an array.", actual);
+        }    
+    },
+   
+    /**
+     * Asserts that a value is a Boolean.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isBoolean
+     * @static
+     */
+    isBoolean : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isBoolean(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be a Boolean.", actual);
+        }    
+    },
+   
+    /**
+     * Asserts that a value is a function.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isFunction
+     * @static
+     */
+    isFunction : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isFunction(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be a function.", actual);
+        }    
+    },
+   
+    /**
+     * Asserts that a value is an instance of a particular object. This may return
+     * incorrect results when comparing objects from one frame to constructors in
+     * another frame. For best results, don't use in a cross-frame manner.
+     * @param {Function} expected The function that the object should be an instance of.
+     * @param {Object} actual The object to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isInstanceOf
+     * @static
+     */
+    isInstanceOf : function (expected /*:Function*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!(actual instanceof expected)){
+            throw new YAHOO.util.ComparisonFailure(message || "Value isn't an instance of expected type.", expected, actual);
+        }
+    },
+    
+    /**
+     * Asserts that a value is a number.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNumber
+     * @static
+     */
+    isNumber : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isNumber(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be a number.", actual);
+        }    
+    },    
+    
+    /**
+     * Asserts that a value is an object.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isObject
+     * @static
+     */
+    isObject : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isObject(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be an object.", actual);
+        }
+    },
+    
+    /**
+     * Asserts that a value is a string.
+     * @param {Object} actual The value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isString
+     * @static
+     */
+    isString : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.isString(actual)){
+            throw new YAHOO.util.UnexpectedValue(message || "Value should be a string.", actual);
+        }
+    },
+    
+    /**
+     * Asserts that a value is of a particular type. 
+     * @param {String} expectedType The expected type of the variable.
+     * @param {Object} actualValue The actual value to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isTypeOf
+     * @static
+     */
+    isTypeOf : function (expectedType /*:String*/, actualValue /*:Object*/, message /*:String*/) /*:Void*/{
+        if (typeof actualValue != expectedType){
+            throw new YAHOO.util.ComparisonFailure(message || "Value should be of type " + expected + ".", expected, typeof actual);
+        }
+    }
+};
+
+//-----------------------------------------------------------------------------
+// Assertion errors
+//-----------------------------------------------------------------------------
+
+/**
+ * AssertionError is thrown whenever an assertion fails. It provides methods
+ * to more easily get at error information and also provides a base class
+ * from which more specific assertion errors can be derived.
+ *
+ * @param {String} message The message to display when the error occurs.
+ * @namespace YAHOO.util
+ * @class AssertionError
+ * @extends Error
+ * @constructor
+ */ 
+YAHOO.util.AssertionError = function (message /*:String*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, message);
+    
+    /*
+     * Error message. Must be duplicated to ensure browser receives it.
+     * @type String
+     * @property message
+     */
+    this.message /*:String*/ = message;
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "AssertionError";
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.AssertionError, Error, {
+
+    /**
+     * Returns a fully formatted error for an assertion failure. This should
+     * be overridden by all subclasses to provide specific information.
+     * @method getMessage
+     * @return {String} A string describing the error.
+     */
+    getMessage : function () /*:String*/ {
+        return this.message;
+    },
+    
+    /**
+     * Returns a string representation of the error.
+     * @method toString
+     * @return {String} A string representation of the error.
+     */
+    toString : function () /*:String*/ {
+        return this.name + ": " + this.getMessage();
+    },
+    
+    /**
+     * Returns a primitive value version of the error. Same as toString().
+     * @method valueOf
+     * @return {String} A primitive value version of the error.
+     */
+    valueOf : function () /*:String*/ {
+        return this.toString();
+    }
+
+});
+
+/**
+ * ComparisonFailure is subclass of AssertionError that is thrown whenever
+ * a comparison between two values fails. It provides mechanisms to retrieve
+ * both the expected and actual value.
+ *
+ * @param {String} message The message to display when the error occurs.
+ * @param {Object} expected The expected value.
+ * @param {Object} actual The actual value that caused the assertion to fail.
+ * @namespace YAHOO.util
+ * @extends YAHOO.util.AssertionError
+ * @class ComparisonFailure
+ * @constructor
+ */ 
+YAHOO.util.ComparisonFailure = function (message /*:String*/, expected /*:Object*/, actual /*:Object*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, message);
+    
+    /**
+     * The expected value.
+     * @type Object
+     * @property expected
+     */
+    this.expected /*:Object*/ = expected;
+    
+    /**
+     * The actual value.
+     * @type Object
+     * @property actual
+     */
+    this.actual /*:Object*/ = actual;
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "ComparisonFailure";
+    
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.ComparisonFailure, YAHOO.util.AssertionError, {
+
+    /**
+     * Returns a fully formatted error for an assertion failure. This message
+     * provides information about the expected and actual values.
+     * @method toString
+     * @return {String} A string describing the error.
+     */
+    getMessage : function () /*:String*/ {
+        return this.message + "\nExpected: " + this.expected + " (" + (typeof this.expected) + ")"  +
+            "\nActual:" + this.actual + " (" + (typeof this.actual) + ")";
+    }
+
+});
+
+/**
+ * UnexpectedValue is subclass of AssertionError that is thrown whenever
+ * a value was unexpected in its scope. This typically means that a test
+ * was performed to determine that a value was *not* equal to a certain
+ * value.
+ *
+ * @param {String} message The message to display when the error occurs.
+ * @param {Object} unexpected The unexpected value.
+ * @namespace YAHOO.util
+ * @extends YAHOO.util.AssertionError
+ * @class UnexpectedValue
+ * @constructor
+ */ 
+YAHOO.util.UnexpectedValue = function (message /*:String*/, unexpected /*:Object*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, message);
+    
+    /**
+     * The unexpected value.
+     * @type Object
+     * @property unexpected
+     */
+    this.unexpected /*:Object*/ = unexpected;
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "UnexpectedValue";
+    
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.UnexpectedValue, YAHOO.util.AssertionError, {
+
+    /**
+     * Returns a fully formatted error for an assertion failure. The message
+     * contains information about the unexpected value that was encountered.
+     * @method getMessage
+     * @return {String} A string describing the error.
+     */
+    getMessage : function () /*:String*/ {
+        return this.message + "\nUnexpected: " + this.unexpected + " (" + (typeof this.unexpected) + ") ";
+    }
+
+});
+
+/**
+ * ShouldFail is subclass of AssertionError that is thrown whenever
+ * a test was expected to fail but did not.
+ *
+ * @param {String} message The message to display when the error occurs.
+ * @namespace YAHOO.util
+ * @extends YAHOO.util.AssertionError
+ * @class ShouldFail
+ * @constructor
+ */  
+YAHOO.util.ShouldFail = function (message /*:String*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, message || "This test should fail but didn't.");
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "ShouldFail";
+    
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.ShouldFail, YAHOO.util.AssertionError);
+
+/**
+ * ShouldError is subclass of AssertionError that is thrown whenever
+ * a test is expected to throw an error but doesn't.
+ *
+ * @param {String} message The message to display when the error occurs.
+ * @namespace YAHOO.util
+ * @extends YAHOO.util.AssertionError
+ * @class ShouldError
+ * @constructor
+ */  
+YAHOO.util.ShouldError = function (message /*:String*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, message || "This test should have thrown an error but didn't.");
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "ShouldError";
+    
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.ShouldError, YAHOO.util.AssertionError);
+
+/**
+ * UnexpectedError is subclass of AssertionError that is thrown whenever
+ * an error occurs within the course of a test and the test was not expected
+ * to throw an error.
+ *
+ * @param {Error} cause The unexpected error that caused this error to be 
+ *                      thrown.
+ * @namespace YAHOO.util
+ * @extends YAHOO.util.AssertionError
+ * @class UnexpectedError
+ * @constructor
+ */  
+YAHOO.util.UnexpectedError = function (cause /*:Object*/){
+
+    //call superclass
+    arguments.callee.superclass.constructor.call(this, "Unexpected error: " + cause.message);
+    
+    /**
+     * The unexpected error that occurred.
+     * @type Error
+     * @property cause
+     */
+    this.cause /*:Error*/ = cause;
+    
+    /**
+     * The name of the error that occurred.
+     * @type String
+     * @property name
+     */
+    this.name /*:String*/ = "UnexpectedError";
+    
+};
+
+//inherit methods
+YAHOO.lang.extend(YAHOO.util.UnexpectedError, YAHOO.util.AssertionError);
+//-----------------------------------------------------------------------------
+// ArrayAssert object
+//-----------------------------------------------------------------------------
+
+/**
+ * The ArrayAssert object provides functions to test JavaScript array objects
+ * for a variety of cases.
+ *
+ * @namespace YAHOO.util
+ * @class ArrayAssert
+ * @static
+ */
+ 
+YAHOO.util.ArrayAssert = {
+
+    /**
+     * Asserts that a value is present in an array. This uses the triple equals 
+     * sign so no type cohersion may occur.
+     * @param {Object} needle The value that is expected in the array.
+     * @param {Array} haystack An array of values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method contains
+     * @static
+     */
+    contains : function (needle /*:Object*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        var found /*:Boolean*/ = false;
+        
+        //begin checking values
+        for (var i=0; i < haystack.length && !found; i++){
+            if (haystack[i] === needle) {
+                found = true;
+            }
+        }
+        
+        if (!found){
+            YAHOO.util.Assert.fail(message || "Value (" + needle + ") not found in array.");
+        }
+    },
+
+    /**
+     * Asserts that a set of values are present in an array. This uses the triple equals 
+     * sign so no type cohersion may occur. For this assertion to pass, all values must
+     * be found.
+     * @param {Object[]} needles An array of values that are expected in the array.
+     * @param {Array} haystack An array of values to check.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method containsItems
+     * @static
+     */
+    containsItems : function (needles /*:Object[]*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+
+        //begin checking values
+        for (var i=0; i < needles.length; i++){
+            this.contains(needles[i], haystack, message);
+        }
+        
+        if (!found){
+            YAHOO.util.Assert.fail(message || "Value not found in array.");
+        }
+    },
+
+    /**
+     * Asserts that a value matching some condition is present in an array. This uses
+     * a function to determine a match.
+     * @param {Function} matcher A function that returns true if the items matches or false if not.
+     * @param {Array} haystack An array of values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method containsMatch
+     * @static
+     */
+    containsMatch : function (matcher /*:Function*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        //check for valid matcher
+        if (typeof matcher != "function"){
+            throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");
+        }
+        
+        var found /*:Boolean*/ = false;
+        
+        //begin checking values
+        for (var i=0; i < haystack.length && !found; i++){
+            if (matcher(haystack[i])) {
+                found = true;
+            }
+        }
+        
+        if (!found){
+            YAHOO.util.Assert.fail(message || "No match found in array.");
+        }
+    },
+
+    /**
+     * Asserts that a value is not present in an array. This uses the triple equals 
+     * sign so no type cohersion may occur.
+     * @param {Object} needle The value that is expected in the array.
+     * @param {Array} haystack An array of values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method doesNotContain
+     * @static
+     */
+    doesNotContain : function (needle /*:Object*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        var found /*:Boolean*/ = false;
+        
+        //begin checking values
+        for (var i=0; i < haystack.length && !found; i++){
+            if (haystack[i] === needle) {
+                found = true;
+            }
+        }
+        
+        if (found){
+            YAHOO.util.Assert.fail(message || "Value found in array.");
+        }
+    },
+
+    /**
+     * Asserts that a set of values are not present in an array. This uses the triple equals 
+     * sign so no type cohersion may occur. For this assertion to pass, all values must
+     * not be found.
+     * @param {Object[]} needles An array of values that are not expected in the array.
+     * @param {Array} haystack An array of values to check.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method doesNotContainItems
+     * @static
+     */
+    doesNotContainItems : function (needles /*:Object[]*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+
+        for (var i=0; i < needles.length; i++){
+            this.doesNotContain(needles[i], haystack, message);
+        }
+
+    },
+        
+    /**
+     * Asserts that no values matching a condition are present in an array. This uses
+     * a function to determine a match.
+     * @param {Function} matcher A function that returns true if the items matches or false if not.
+     * @param {Array} haystack An array of values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method doesNotContainMatch
+     * @static
+     */
+    doesNotContainMatch : function (matcher /*:Function*/, haystack /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        //check for valid matcher
+        if (typeof matcher != "function"){
+            throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");
+        }
+
+        var found /*:Boolean*/ = false;
+        
+        //begin checking values
+        for (var i=0; i < haystack.length && !found; i++){
+            if (matcher(haystack[i])) {
+                found = true;
+            }
+        }
+        
+        if (found){
+            YAHOO.util.Assert.fail(message || "Value found in array.");
+        }
+    },
+        
+    /**
+     * Asserts that the given value is contained in an array at the specified index.
+     * This uses the triple equals sign so no type cohersion will occur.
+     * @param {Object} needle The value to look for.
+     * @param {Array} haystack The array to search in.
+     * @param {int} index The index at which the value should exist.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method indexOf
+     * @static
+     */
+    indexOf : function (needle /*:Object*/, haystack /*:Array*/, index /*:int*/, message /*:String*/) /*:Void*/ {
+    
+        //try to find the value in the array
+        for (var i=0; i < haystack.length; i++){
+            if (haystack[i] === needle){
+                YAHOO.util.Assert.areEqual(index, i, message || "Value exists at index " + i + " but should be at index " + index + ".");
+                return;
+            }
+        }
+        
+        //if it makes it here, it wasn't found at all
+        YAHOO.util.Assert.fail(message || "Value doesn't exist in array.");        
+    },
+        
+    /**
+     * Asserts that the values in an array are equal, and in the same position,
+     * as values in another array. This uses the double equals sign
+     * so type cohersion may occur. Note that the array objects themselves
+     * need not be the same for this test to pass.
+     * @param {Array} expected An array of the expected values.
+     * @param {Array} actual Any array of the actual values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method itemsAreEqual
+     * @static
+     */
+    itemsAreEqual : function (expected /*:Array*/, actual /*:Array*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        //one may be longer than the other, so get the maximum length
+        var len /*:int*/ = Math.max(expected.length, actual.length);
+        
+        //begin checking values
+        for (var i=0; i < len; i++){
+            YAHOO.util.Assert.areEqual(expected[i], actual[i], message || 
+                    "Values in position " + i + " are not equal.");
+        }
+    },
+    
+    /**
+     * Asserts that the values in an array are equivalent, and in the same position,
+     * as values in another array. This uses a function to determine if the values
+     * are equivalent. Note that the array objects themselves
+     * need not be the same for this test to pass.
+     * @param {Array} expected An array of the expected values.
+     * @param {Array} actual Any array of the actual values.
+     * @param {Function} comparator A function that returns true if the values are equivalent
+     *      or false if not.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @return {Void}
+     * @method itemsAreEquivalent
+     * @static
+     */
+    itemsAreEquivalent : function (expected /*:Array*/, actual /*:Array*/, 
+                           comparator /*:Function*/, message /*:String*/) /*:Void*/ {
+        
+        //make sure the comparator is valid
+        if (typeof comparator != "function"){
+            throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");
+        }
+        
+        //one may be longer than the other, so get the maximum length
+        var len /*:int*/ = Math.max(expected.length, actual.length);
+        
+        //begin checking values
+        for (var i=0; i < len; i++){
+            if (!comparator(expected[i], actual[i])){
+                throw new YAHOO.util.ComparisonFailure(message || "Values in position " + i + " are not equivalent.", expected[i], actual[i]);
+            }
+        }
+    },
+    
+    /**
+     * Asserts that an array is empty.
+     * @param {Array} actual The array to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isEmpty
+     * @static
+     */
+    isEmpty : function (actual /*:Array*/, message /*:String*/) /*:Void*/ {        
+        if (actual.length > 0){
+            YAHOO.util.Assert.fail(message || "Array should be empty.");
+        }
+    },    
+    
+    /**
+     * Asserts that an array is not empty.
+     * @param {Array} actual The array to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method isNotEmpty
+     * @static
+     */
+    isNotEmpty : function (actual /*:Array*/, message /*:String*/) /*:Void*/ {        
+        if (actual.length === 0){
+            YAHOO.util.Assert.fail(message || "Array should not be empty.");
+        }
+    },    
+    
+    /**
+     * Asserts that the values in an array are the same, and in the same position,
+     * as values in another array. This uses the triple equals sign
+     * so no type cohersion will occur. Note that the array objects themselves
+     * need not be the same for this test to pass.
+     * @param {Array} expected An array of the expected values.
+     * @param {Array} actual Any array of the actual values.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method itemsAreSame
+     * @static
+     */
+    itemsAreSame : function (expected /*:Array*/, actual /*:Array*/, 
+                          message /*:String*/) /*:Void*/ {
+        
+        //one may be longer than the other, so get the maximum length
+        var len /*:int*/ = Math.max(expected.length, actual.length);
+        
+        //begin checking values
+        for (var i=0; i < len; i++){
+            YAHOO.util.Assert.areSame(expected[i], actual[i], 
+                message || "Values in position " + i + " are not the same.");
+        }
+    },
+    
+    /**
+     * Asserts that the given value is contained in an array at the specified index,
+     * starting from the back of the array.
+     * This uses the triple equals sign so no type cohersion will occur.
+     * @param {Object} needle The value to look for.
+     * @param {Array} haystack The array to search in.
+     * @param {int} index The index at which the value should exist.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method lastIndexOf
+     * @static
+     */
+    lastIndexOf : function (needle /*:Object*/, haystack /*:Array*/, index /*:int*/, message /*:String*/) /*:Void*/ {
+    
+        //try to find the value in the array
+        for (var i=haystack.length; i >= 0; i--){
+            if (haystack[i] === needle){
+                YAHOO.util.Assert.areEqual(index, i, message || "Value exists at index " + i + " but should be at index " + index + ".");
+                return;
+            }
+        }
+        
+        //if it makes it here, it wasn't found at all
+        YAHOO.util.Assert.fail(message || "Value doesn't exist in array.");        
+    }
+    
+};
+YAHOO.namespace("util");
+
+
+//-----------------------------------------------------------------------------
+// ObjectAssert object
+//-----------------------------------------------------------------------------
+
+/**
+ * The ObjectAssert object provides functions to test JavaScript objects
+ * for a variety of cases.
+ *
+ * @namespace YAHOO.util
+ * @class ObjectAssert
+ * @static
+ */
+YAHOO.util.ObjectAssert = {
+        
+    /**
+     * Asserts that all properties in the object exist in another object.
+     * @param {Object} expected An object with the expected properties.
+     * @param {Object} actual An object with the actual properties.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method propertiesAreEqual
+     * @static
+     */
+    propertiesAreEqual : function (expected /*:Object*/, actual /*:Object*/, 
+                           message /*:String*/) /*:Void*/ {
+        
+        //get all properties in the object
+        var properties /*:Array*/ = [];        
+        for (var property in expected){
+            properties.push(property);
+        }
+        
+        //see if the properties are in the expected object
+        for (var i=0; i < properties.length; i++){
+            YAHOO.util.Assert.isNotUndefined(actual[properties[i]], message || 
+                    "Property'" + properties[i] + "' expected.");
+        }
+
+    },
+    
+    /**
+     * Asserts that an object has a property with the given name.
+     * @param {String} propertyName The name of the property to test.
+     * @param {Object} object The object to search.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method hasProperty
+     * @static
+     */    
+    hasProperty : function (propertyName /*:String*/, object /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (YAHOO.lang.isUndefined(object[propertyName])){
+            YAHOO.util.Assert.fail(message || 
+                    "Property " + propertyName + " not found on object.");
+        }    
+    },
+    
+    /**
+     * Asserts that a property with the given name exists on an object instance (not on its prototype).
+     * @param {String} propertyName The name of the property to test.
+     * @param {Object} object The object to search.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method hasProperty
+     * @static
+     */    
+    hasOwnProperty : function (propertyName /*:String*/, object /*:Object*/, message /*:String*/) /*:Void*/ {
+        if (!YAHOO.lang.hasOwnProperty(object, propertyName)){
+            YAHOO.util.Assert.fail(message || 
+                    "Property " + propertyName + " not found on object instance.");
+        }     
+    }
+};
+//-----------------------------------------------------------------------------
+// DateAssert object
+//-----------------------------------------------------------------------------
+
+/**
+ * The DateAssert object provides functions to test JavaScript Date objects
+ * for a variety of cases.
+ *
+ * @namespace YAHOO.util
+ * @class DateAssert
+ * @static
+ */
+ 
+YAHOO.util.DateAssert = {
+
+    /**
+     * Asserts that a date's month, day, and year are equal to another date's.
+     * @param {Date} expected The expected date.
+     * @param {Date} actual The actual date to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areEqual
+     * @static
+     */
+    datesAreEqual : function (expected /*:Date*/, actual /*:Date*/, message /*:String*/){
+        if (expected instanceof Date && actual instanceof Date){
+            YAHOO.util.Assert.areEqual(expected.getFullYear(), actual.getFullYear(), message || "Years should be equal.");
+            YAHOO.util.Assert.areEqual(expected.getMonth(), actual.getMonth(), message || "Months should be equal.");
+            YAHOO.util.Assert.areEqual(expected.getDate(), actual.getDate(), message || "Day of month should be equal.");
+        } else {
+            throw new TypeError("DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");
+        }
+    },
+
+    /**
+     * Asserts that a date's hour, minutes, and seconds are equal to another date's.
+     * @param {Date} expected The expected date.
+     * @param {Date} actual The actual date to test.
+     * @param {String} message (Optional) The message to display if the assertion fails.
+     * @method areEqual
+     * @static
+     */
+    timesAreEqual : function (expected /*:Date*/, actual /*:Date*/, message /*:String*/){
+        if (expected instanceof Date && actual instanceof Date){
+            YAHOO.util.Assert.areEqual(expected.getHours(), actual.getHours(), message || "Hours should be equal.");
+            YAHOO.util.Assert.areEqual(expected.getMinutes(), actual.getMinutes(), message || "Minutes should be equal.");
+            YAHOO.util.Assert.areEqual(expected.getSeconds(), actual.getSeconds(), message || "Seconds should be equal.");
+        } else {
+            throw new TypeError("DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");
+        }
+    }
+    
+};
+YAHOO.namespace("util");
+
+/**
+ * The UserAction object provides functions that simulate events occurring in
+ * the browser. Since these are simulated events, they do not behave exactly
+ * as regular, user-initiated events do, but can be used to test simple
+ * user interactions safely.
+ *
+ * @namespace YAHOO.util
+ * @class UserAction
+ * @static
+ */
+YAHOO.util.UserAction = {
+
+    //--------------------------------------------------------------------------
+    // Generic event methods
+    //--------------------------------------------------------------------------
+
+    /**
+     * Simulates a key event using the given event information to populate
+     * the generated event object. This method does browser-equalizing
+     * calculations to account for differences in the DOM and IE event models
+     * as well as different browser quirks. Note: keydown causes Safari 2.x to
+     * crash.
+     * @method simulateKeyEvent
+     * @private
+     * @static
+     * @param {HTMLElement} target The target of the given event.
+     * @param {String} type The type of event to fire. This can be any one of
+     *      the following: keyup, keydown, and keypress.
+     * @param {Boolean} bubbles (Optional) Indicates if the event can be
+     *      bubbled up. DOM Level 3 specifies that all key events bubble by
+     *      default. The default is true.
+     * @param {Boolean} cancelable (Optional) Indicates if the event can be
+     *      canceled using preventDefault(). DOM Level 3 specifies that all
+     *      key events can be cancelled. The default 
+     *      is true.
+     * @param {Window} view (Optional) The view containing the target. This is
+     *      typically the window object. The default is window.
+     * @param {Boolean} ctrlKey (Optional) Indicates if one of the CTRL keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} altKey (Optional) Indicates if one of the ALT keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} shiftKey (Optional) Indicates if one of the SHIFT keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} metaKey (Optional) Indicates if one of the META keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {int} keyCode (Optional) The code for the key that is in use. 
+     *      The default is 0.
+     * @param {int} charCode (Optional) The Unicode code for the character
+     *      associated with the key being used. The default is 0.
+     */
+    simulateKeyEvent : function (target /*:HTMLElement*/, type /*:String*/, 
+                                 bubbles /*:Boolean*/,  cancelable /*:Boolean*/,    
+                                 view /*:Window*/,
+                                 ctrlKey /*:Boolean*/,    altKey /*:Boolean*/, 
+                                 shiftKey /*:Boolean*/,   metaKey /*:Boolean*/, 
+                                 keyCode /*:int*/,        charCode /*:int*/) /*:Void*/                             
+    {
+        //check target
+        target = YAHOO.util.Dom.get(target);        
+        if (!target){
+            throw new Error("simulateKeyEvent(): Invalid target.");
+        }
+        
+        //check event type
+        if (YAHOO.lang.isString(type)){
+            type = type.toLowerCase();
+            switch(type){
+                case "keyup":
+                case "keydown":
+                case "keypress":
+                    break;
+                case "textevent": //DOM Level 3
+                    type = "keypress";
+                    break;
+                    // @TODO was the fallthrough intentional, if so throw error
+                default:
+                    throw new Error("simulateKeyEvent(): Event type '" + type + "' not supported.");
+            }
+        } else {
+            throw new Error("simulateKeyEvent(): Event type must be a string.");
+        }
+        
+        //setup default values
+        if (!YAHOO.lang.isBoolean(bubbles)){
+            bubbles = true; //all key events bubble
+        }
+        if (!YAHOO.lang.isBoolean(cancelable)){
+            cancelable = true; //all key events can be cancelled
+        }
+        if (!YAHOO.lang.isObject(view)){
+            view = window; //view is typically window
+        }
+        if (!YAHOO.lang.isBoolean(ctrlKey)){
+            ctrlKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(altKey)){
+            altKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(shiftKey)){
+            shiftKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(metaKey)){
+            metaKey = false;
+        }
+        if (!YAHOO.lang.isNumber(keyCode)){
+            keyCode = 0;
+        }
+        if (!YAHOO.lang.isNumber(charCode)){
+            charCode = 0; 
+        }
+        
+        //check for DOM-compliant browsers first
+        if (YAHOO.lang.isFunction(document.createEvent)){
+        
+            //try to create a mouse event
+            var event /*:MouseEvent*/ = null;
+            
+            try {
+                
+                //try to create key event
+                event = document.createEvent("KeyEvents");
+                
+                /*
+                 * Interesting problem: Firefox implemented a non-standard
+                 * version of initKeyEvent() based on DOM Level 2 specs.
+                 * Key event was removed from DOM Level 2 and re-introduced
+                 * in DOM Level 3 with a different interface. Firefox is the
+                 * only browser with any implementation of Key Events, so for
+                 * now, assume it's Firefox if the above line doesn't error.
+                 */
+                //TODO: Decipher between Firefox's implementation and a correct one.
+                event.initKeyEvent(type, bubbles, cancelable, view, ctrlKey,
+                    altKey, shiftKey, metaKey, keyCode, charCode);       
+                
+            } catch (ex /*:Error*/){
+
+                /*
+                 * If it got here, that means key events aren't officially supported. 
+                 * Safari/WebKit is a real problem now. WebKit 522 won't let you
+                 * set keyCode, charCode, or other properties if you use a
+                 * UIEvent, so we first must try to create a generic event. The
+                 * fun part is that this will throw an error on Safari 2.x. The
+                 * end result is that we need another try...catch statement just to
+                 * deal with this mess.
+                 */
+                try {
+
+                    //try to create generic event - will fail in Safari 2.x
+                    event = document.createEvent("Events");
+
+                } catch (uierror /*:Error*/){
+
+                    //the above failed, so create a UIEvent for Safari 2.x
+                    event = document.createEvent("UIEvents");
+
+                } finally {
+
+                    event.initEvent(type, bubbles, cancelable);
+    
+                    //initialize
+                    event.view = view;
+                    event.altKey = altKey;
+                    event.ctrlKey = ctrlKey;
+                    event.shiftKey = shiftKey;
+                    event.metaKey = metaKey;
+                    event.keyCode = keyCode;
+                    event.charCode = charCode;
+          
+                }          
+             
+            }
+            
+            //fire the event
+            target.dispatchEvent(event);
+
+        } else if (YAHOO.lang.isObject(document.createEventObject)){ //IE
+        
+            //create an IE event object
+            event = document.createEventObject();
+            
+            //assign available properties
+            event.bubbles = bubbles;
+            event.cancelable = cancelable;
+            event.view = view;
+            event.ctrlKey = ctrlKey;
+            event.altKey = altKey;
+            event.shiftKey = shiftKey;
+            event.metaKey = metaKey;
+            
+            /*
+             * IE doesn't support charCode explicitly. CharCode should
+             * take precedence over any keyCode value for accurate
+             * representation.
+             */
+            event.keyCode = (charCode > 0) ? charCode : keyCode;
+            
+            //fire the event
+            target.fireEvent("on" + type, event);  
+                    
+        } else {
+            throw new Error("simulateKeyEvent(): No event simulation framework present.");
+        }
+    },
+
+    /**
+     * Simulates a mouse event using the given event information to populate
+     * the generated event object. This method does browser-equalizing
+     * calculations to account for differences in the DOM and IE event models
+     * as well as different browser quirks.
+     * @method simulateMouseEvent
+     * @private
+     * @static
+     * @param {HTMLElement} target The target of the given event.
+     * @param {String} type The type of event to fire. This can be any one of
+     *      the following: click, dblclick, mousedown, mouseup, mouseout,
+     *      mouseover, and mousemove.
+     * @param {Boolean} bubbles (Optional) Indicates if the event can be
+     *      bubbled up. DOM Level 2 specifies that all mouse events bubble by
+     *      default. The default is true.
+     * @param {Boolean} cancelable (Optional) Indicates if the event can be
+     *      canceled using preventDefault(). DOM Level 2 specifies that all
+     *      mouse events except mousemove can be cancelled. The default 
+     *      is true for all events except mousemove, for which the default 
+     *      is false.
+     * @param {Window} view (Optional) The view containing the target. This is
+     *      typically the window object. The default is window.
+     * @param {int} detail (Optional) The number of times the mouse button has
+     *      been used. The default value is 1.
+     * @param {int} screenX (Optional) The x-coordinate on the screen at which
+     *      point the event occured. The default is 0.
+     * @param {int} screenY (Optional) The y-coordinate on the screen at which
+     *      point the event occured. The default is 0.
+     * @param {int} clientX (Optional) The x-coordinate on the client at which
+     *      point the event occured. The default is 0.
+     * @param {int} clientY (Optional) The y-coordinate on the client at which
+     *      point the event occured. The default is 0.
+     * @param {Boolean} ctrlKey (Optional) Indicates if one of the CTRL keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} altKey (Optional) Indicates if one of the ALT keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} shiftKey (Optional) Indicates if one of the SHIFT keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {Boolean} metaKey (Optional) Indicates if one of the META keys
+     *      is pressed while the event is firing. The default is false.
+     * @param {int} button (Optional) The button being pressed while the event
+     *      is executing. The value should be 0 for the primary mouse button
+     *      (typically the left button), 1 for the terciary mouse button
+     *      (typically the middle button), and 2 for the secondary mouse button
+     *      (typically the right button). The default is 0.
+     * @param {HTMLElement} relatedTarget (Optional) For mouseout events,
+     *      this is the element that the mouse has moved to. For mouseover
+     *      events, this is the element that the mouse has moved from. This
+     *      argument is ignored for all other events. The default is null.
+     */
+    simulateMouseEvent : function (target /*:HTMLElement*/, type /*:String*/, 
+                                   bubbles /*:Boolean*/,  cancelable /*:Boolean*/,    
+                                   view /*:Window*/,        detail /*:int*/, 
+                                   screenX /*:int*/,        screenY /*:int*/, 
+                                   clientX /*:int*/,        clientY /*:int*/,       
+                                   ctrlKey /*:Boolean*/,    altKey /*:Boolean*/, 
+                                   shiftKey /*:Boolean*/,   metaKey /*:Boolean*/, 
+                                   button /*:int*/,         relatedTarget /*:HTMLElement*/) /*:Void*/
+    {
+        
+        //check target
+        target = YAHOO.util.Dom.get(target);        
+        if (!target){
+            throw new Error("simulateMouseEvent(): Invalid target.");
+        }
+        
+        //check event type
+        if (YAHOO.lang.isString(type)){
+            type = type.toLowerCase();
+            switch(type){
+                case "mouseover":
+                case "mouseout":
+                case "mousedown":
+                case "mouseup":
+                case "click":
+                case "dblclick":
+                case "mousemove":
+                    break;
+                default:
+                    throw new Error("simulateMouseEvent(): Event type '" + type + "' not supported.");
+            }
+        } else {
+            throw new Error("simulateMouseEvent(): Event type must be a string.");
+        }
+        
+        //setup default values
+        if (!YAHOO.lang.isBoolean(bubbles)){
+            bubbles = true; //all mouse events bubble
+        }
+        if (!YAHOO.lang.isBoolean(cancelable)){
+            cancelable = (type != "mousemove"); //mousemove is the only one that can't be cancelled
+        }
+        if (!YAHOO.lang.isObject(view)){
+            view = window; //view is typically window
+        }
+        if (!YAHOO.lang.isNumber(detail)){
+            detail = 1;  //number of mouse clicks must be at least one
+        }
+        if (!YAHOO.lang.isNumber(screenX)){
+            screenX = 0; 
+        }
+        if (!YAHOO.lang.isNumber(screenY)){
+            screenY = 0; 
+        }
+        if (!YAHOO.lang.isNumber(clientX)){
+            clientX = 0; 
+        }
+        if (!YAHOO.lang.isNumber(clientY)){
+            clientY = 0; 
+        }
+        if (!YAHOO.lang.isBoolean(ctrlKey)){
+            ctrlKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(altKey)){
+            altKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(shiftKey)){
+            shiftKey = false;
+        }
+        if (!YAHOO.lang.isBoolean(metaKey)){
+            metaKey = false;
+        }
+        if (!YAHOO.lang.isNumber(button)){
+            button = 0; 
+        }
+        
+        //check for DOM-compliant browsers first
+        if (YAHOO.lang.isFunction(document.createEvent)){
+        
+            //try to create a mouse event
+            var event /*:MouseEvent*/ = document.createEvent("MouseEvents");
+            
+            //Safari 2.x (WebKit 418) still doesn't implement initMouseEvent()
+            if (event.initMouseEvent){
+                event.initMouseEvent(type, bubbles, cancelable, view, detail,
+                                     screenX, screenY, clientX, clientY, 
+                                     ctrlKey, altKey, shiftKey, metaKey, 
+                                     button, relatedTarget);
+            } else { //Safari
+            
+                //the closest thing available in Safari 2.x is UIEvents
+                event = document.createEvent("UIEvents");
+                event.initEvent(type, bubbles, cancelable);
+                event.view = view;
+                event.detail = detail;
+                event.screenX = screenX;
+                event.screenY = screenY;
+                event.clientX = clientX;
+                event.clientY = clientY;
+                event.ctrlKey = ctrlKey;
+                event.altKey = altKey;
+                event.metaKey = metaKey;
+                event.shiftKey = shiftKey;
+                event.button = button;
+                event.relatedTarget = relatedTarget;
+            }
+            
+            /*
+             * Check to see if relatedTarget has been assigned. Firefox
+             * versions less than 2.0 don't allow it to be assigned via
+             * initMouseEvent() and the property is readonly after event
+             * creation, so in order to keep YAHOO.util.getRelatedTarget()
+             * working, assign to the IE proprietary toElement property
+             * for mouseout event and fromElement property for mouseover
+             * event.
+             */
+            if (relatedTarget && !event.relatedTarget){
+                if (type == "mouseout"){
+                    event.toElement = relatedTarget;
+                } else if (type == "mouseover"){
+                    event.fromElement = relatedTarget;
+                }
+            }
+            
+            //fire the event
+            target.dispatchEvent(event);
+
+        } else if (YAHOO.lang.isObject(document.createEventObject)){ //IE
+        
+            //create an IE event object
+            event = document.createEventObject();
+            
+            //assign available properties
+            event.bubbles = bubbles;
+            event.cancelable = cancelable;
+            event.view = view;
+            event.detail = detail;
+            event.screenX = screenX;
+            event.screenY = screenY;
+            event.clientX = clientX;
+            event.clientY = clientY;
+            event.ctrlKey = ctrlKey;
+            event.altKey = altKey;
+            event.metaKey = metaKey;
+            event.shiftKey = shiftKey;
+
+            //fix button property for IE's wacky implementation
+            switch(button){
+                case 0:
+                    event.button = 1;
+                    break;
+                case 1:
+                    event.button = 4;
+                    break;
+                case 2:
+                    //leave as is
+                    break;
+                default:
+                    event.button = 0;                    
+            }    
+
+            /*
+             * Have to use relatedTarget because IE won't allow assignment
+             * to toElement or fromElement on generic events. This keeps
+             * YAHOO.util.Event.getRelatedTarget() functional.
+             */
+            event.relatedTarget = relatedTarget;
+            
+            //fire the event
+            target.fireEvent("on" + type, event);
+                    
+        } else {
+            throw new Error("simulateMouseEvent(): No event simulation framework present.");
+        }
+    },
+   
+    //--------------------------------------------------------------------------
+    // Mouse events
+    //--------------------------------------------------------------------------
+
+    /**
+     * Simulates a mouse event on a particular element.
+     * @param {HTMLElement} target The element to click on.
+     * @param {String} type The type of event to fire. This can be any one of
+     *      the following: click, dblclick, mousedown, mouseup, mouseout,
+     *      mouseover, and mousemove.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mouseEvent
+     * @static
+     */
+    fireMouseEvent : function (target /*:HTMLElement*/, type /*:String*/, 
+                           options /*:Object*/) /*:Void*/
+    {
+        options = options || {};
+        this.simulateMouseEvent(target, type, options.bubbles,
+            options.cancelable, options.view, options.detail, options.screenX,        
+            options.screenY, options.clientX, options.clientY, options.ctrlKey,
+            options.altKey, options.shiftKey, options.metaKey, options.button,         
+            options.relatedTarget);        
+    },
+
+    /**
+     * Simulates a click on a particular element.
+     * @param {HTMLElement} target The element to click on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method click
+     * @static     
+     */
+    click : function (target /*:HTMLElement*/, options /*:Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "click", options);
+    },
+    
+    /**
+     * Simulates a double click on a particular element.
+     * @param {HTMLElement} target The element to double click on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method dblclick
+     * @static
+     */
+    dblclick : function (target /*:HTMLElement*/, options /*:Object*/) /*:Void*/ {
+        this.fireMouseEvent( target, "dblclick", options);
+    },
+    
+    /**
+     * Simulates a mousedown on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mousedown
+     * @static
+     */
+    mousedown : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "mousedown", options);
+    },
+    
+    /**
+     * Simulates a mousemove on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mousemove
+     * @static
+     */
+    mousemove : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "mousemove", options);
+    },
+    
+    /**
+     * Simulates a mouseout event on a particular element. Use "relatedTarget"
+     * on the options object to specify where the mouse moved to.
+     * Quirks: Firefox less than 2.0 doesn't set relatedTarget properly, so
+     * toElement is assigned in its place. IE doesn't allow toElement to be
+     * be assigned, so relatedTarget is assigned in its place. Both of these
+     * concessions allow YAHOO.util.Event.getRelatedTarget() to work correctly
+     * in both browsers.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mouseout
+     * @static
+     */
+    mouseout : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "mouseout", options);
+    },
+    
+    /**
+     * Simulates a mouseover event on a particular element. Use "relatedTarget"
+     * on the options object to specify where the mouse moved from.
+     * Quirks: Firefox less than 2.0 doesn't set relatedTarget properly, so
+     * fromElement is assigned in its place. IE doesn't allow fromElement to be
+     * be assigned, so relatedTarget is assigned in its place. Both of these
+     * concessions allow YAHOO.util.Event.getRelatedTarget() to work correctly
+     * in both browsers.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mouseover
+     * @static
+     */
+    mouseover : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "mouseover", options);
+    },
+    
+    /**
+     * Simulates a mouseup on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method mouseup
+     * @static
+     */
+    mouseup : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireMouseEvent(target, "mouseup", options);
+    },
+    
+    //--------------------------------------------------------------------------
+    // Key events
+    //--------------------------------------------------------------------------
+
+    /**
+     * Fires an event that normally would be fired by the keyboard (keyup,
+     * keydown, keypress). Make sure to specify either keyCode or charCode as
+     * an option.
+     * @private
+     * @param {String} type The type of event ("keyup", "keydown" or "keypress").
+     * @param {HTMLElement} target The target of the event.
+     * @param {Object} options Options for the event. Either keyCode or charCode
+     *                         are required.
+     * @method fireKeyEvent
+     * @static
+     */     
+    fireKeyEvent : function (type /*:String*/, target /*:HTMLElement*/,
+                             options /*:Object*/) /*:Void*/ 
+    {
+        options = options || {};
+        this.simulateKeyEvent(target, type, options.bubbles,
+            options.cancelable, options.view, options.ctrlKey,
+            options.altKey, options.shiftKey, options.metaKey, 
+            options.keyCode, options.charCode);    
+    },
+    
+    /**
+     * Simulates a keydown event on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method keydown
+     * @static
+     */
+    keydown : function (target /*:HTMLElement*/, options /*:Object*/) /*:Void*/ {
+        this.fireKeyEvent("keydown", target, options);
+    },
+    
+    /**
+     * Simulates a keypress on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method keypress
+     * @static
+     */
+    keypress : function (target /*:HTMLElement*/, options /*:Object*/) /*:Void*/ {
+        this.fireKeyEvent("keypress", target, options);
+    },
+    
+    /**
+     * Simulates a keyup event on a particular element.
+     * @param {HTMLElement} target The element to act on.
+     * @param {Object} options Additional event options (use DOM standard names).
+     * @method keyup
+     * @static
+     */
+    keyup : function (target /*:HTMLElement*/, options /*Object*/) /*:Void*/ {
+        this.fireKeyEvent("keyup", target, options);
+    }
+    
+
+};
+YAHOO.namespace("tool");
+
+//-----------------------------------------------------------------------------
+// TestManager object
+//-----------------------------------------------------------------------------
+
+/**
+ * Runs pages containing test suite definitions.
+ * @namespace YAHOO.tool
+ * @class TestManager
+ * @static
+ */
+YAHOO.tool.TestManager = {
+
+    /**
+     * Constant for the testpagebegin custom event
+     * @property TEST_PAGE_BEGIN_EVENT
+     * @static
+     * @type string
+     * @final
+     */
+    TEST_PAGE_BEGIN_EVENT /*:String*/ : "testpagebegin",
+
+    /**
+     * Constant for the testpagecomplete custom event
+     * @property TEST_PAGE_COMPLETE_EVENT
+     * @static
+     * @type string
+     * @final
+     */
+    TEST_PAGE_COMPLETE_EVENT /*:String*/ : "testpagecomplete",
+
+    /**
+     * Constant for the testmanagerbegin custom event
+     * @property TEST_MANAGER_BEGIN_EVENT
+     * @static
+     * @type string
+     * @final
+     */
+    TEST_MANAGER_BEGIN_EVENT /*:String*/ : "testmanagerbegin",
+
+    /**
+     * Constant for the testmanagercomplete custom event
+     * @property TEST_MANAGER_COMPLETE_EVENT
+     * @static
+     * @type string
+     * @final
+     */
+    TEST_MANAGER_COMPLETE_EVENT /*:String*/ : "testmanagercomplete",
+
+    //-------------------------------------------------------------------------
+    // Private Properties
+    //-------------------------------------------------------------------------
+    
+    
+    /**
+     * The URL of the page currently being executed.
+     * @type String
+     * @private
+     * @property _curPage
+     * @static
+     */
+    _curPage /*:String*/ : null,
+    
+    /**
+     * The frame used to load and run tests.
+     * @type Window
+     * @private
+     * @property _frame
+     * @static
+     */
+    _frame /*:Window*/ : null,
+    
+    /**
+     * The logger used to output results from the various tests.
+     * @type YAHOO.tool.TestLogger
+     * @private
+     * @property _logger
+     * @static
+     */
+    _logger : null,
+    
+    /**
+     * The timeout ID for the next iteration through the tests.
+     * @type int
+     * @private
+     * @property _timeoutId
+     * @static
+     */
+    _timeoutId /*:int*/ : 0,
+    
+    /**
+     * Array of pages to load.
+     * @type String[]
+     * @private
+     * @property _pages
+     * @static
+     */
+    _pages /*:String[]*/ : [],
+    
+    /**
+     * Aggregated results
+     * @type Object
+     * @private
+     * @property _results
+     * @static
+     */
+    _results: null,
+    
+    //-------------------------------------------------------------------------
+    // Private Methods
+    //-------------------------------------------------------------------------
+    
+    /**
+     * Handles TestRunner.COMPLETE_EVENT, storing the results and beginning
+     * the loop again.
+     * @param {Object} data Data about the event.
+     * @return {Void}
+     * @private
+     * @static
+     */
+    _handleTestRunnerComplete : function (data /*:Object*/) /*:Void*/ {
+
+        this.fireEvent(this.TEST_PAGE_COMPLETE_EVENT, {
+                page: this._curPage,
+                results: data.results
+            });
+    
+        //save results
+        //this._results[this.curPage] = data.results;
+        
+        //process 'em
+        this._processResults(this._curPage, data.results);
+        
+        this._logger.clearTestRunner();
+    
+        //if there's more to do, set a timeout to begin again
+        if (this._pages.length){
+            this._timeoutId = setTimeout(function(){
+                YAHOO.tool.TestManager._run();
+            }, 1000);
+        }
+    },
+    
+    /**
+     * Processes the results of a test page run, outputting log messages
+     * for failed tests.
+     * @return {Void}
+     * @private
+     * @static
+     */
+    _processResults : function (page /*:String*/, results /*:Object*/) /*:Void*/ {
+
+        var r = this._results;
+
+        r.page_results[page] = results;
+
+        if (results.passed) {
+            r.pages_passed++;
+            r.tests_passed += results.passed;
+        }
+
+        if (results.failed) {
+            r.pages_failed++;
+            r.tests_failed += results.failed;
+            r.failed.push(page);
+        } else {
+            r.passed.push(page);
+        }
+
+        if (!this._pages.length) {
+            this.fireEvent(this.TEST_MANAGER_COMPLETE_EVENT, this._results);
+        }
+
+    },
+    
+    /**
+     * Loads the next test page into the iframe.
+     * @return {Void}
+     * @static
+     * @private
+     */
+    _run : function () /*:Void*/ {
+    
+        //set the current page
+        this._curPage = this._pages.shift();
+
+        this.fireEvent(this.TEST_PAGE_BEGIN_EVENT, this._curPage);
+        
+        //load the frame - destroy history in case there are other iframes that
+        //need testing
+        this._frame.location.replace(this._curPage);
+    
+    },
+        
+    //-------------------------------------------------------------------------
+    // Public Methods
+    //-------------------------------------------------------------------------
+    
+    /**
+     * Signals that a test page has been loaded. This should be called from
+     * within the test page itself to notify the TestManager that it is ready.
+     * @return {Void}
+     * @static
+     */
+    load : function () /*:Void*/ {
+        if (parent.YAHOO.tool.TestManager !== this){
+            parent.YAHOO.tool.TestManager.load();
+        } else {
+            
+            if (this._frame) {
+                //assign event handling
+                var TestRunner = this._frame.YAHOO.tool.TestRunner;
+
+                this._logger.setTestRunner(TestRunner);
+                TestRunner.subscribe(TestRunner.COMPLETE_EVENT, this._handleTestRunnerComplete, this, true);
+                
+                //run it
+                TestRunner.run();
+            }
+        }
+    },
+    
+    /**
+     * Sets the pages to be loaded.
+     * @param {String[]} pages An array of URLs to load.
+     * @return {Void}
+     * @static
+     */
+    setPages : function (pages /*:String[]*/) /*:Void*/ {
+        this._pages = pages;
+    },
+    
+    /**
+     * Begins the process of running the tests.
+     * @return {Void}
+     * @static
+     */
+    start : function () /*:Void*/ {
+
+        if (!this._initialized) {
+
+            /**
+             * Fires when loading a test page
+             * @event testpagebegin
+             * @param curPage {string} the page being loaded
+             * @static
+             */
+            this.createEvent(this.TEST_PAGE_BEGIN_EVENT);
+
+            /**
+             * Fires when a test page is complete
+             * @event testpagecomplete
+             * @param obj {page: string, results: object} the name of the
+             * page that was loaded, and the test suite results
+             * @static
+             */
+            this.createEvent(this.TEST_PAGE_COMPLETE_EVENT);
+
+            /**
+             * Fires when the test manager starts running all test pages
+             * @event testmanagerbegin
+             * @static
+             */
+            this.createEvent(this.TEST_MANAGER_BEGIN_EVENT);
+
+            /**
+             * Fires when the test manager finishes running all test pages.  External
+             * test runners should subscribe to this event in order to get the
+             * aggregated test results.
+             * @event testmanagercomplete
+             * @param obj { pages_passed: int, pages_failed: int, tests_passed: int
+             *              tests_failed: int, passed: string[], failed: string[],
+             *              page_results: {} }
+             * @static
+             */
+            this.createEvent(this.TEST_MANAGER_COMPLETE_EVENT);
+
+            //create iframe if not already available
+            if (!this._frame){
+                var frame /*:HTMLElement*/ = document.createElement("iframe");
+                frame.style.visibility = "hidden";
+                frame.style.position = "absolute";
+                document.body.appendChild(frame);
+                this._frame = frame.contentWindow || frame.contentDocument.ownerWindow;
+            }
+            
+            //create test logger if not already available
+            if (!this._logger){
+                this._logger = new YAHOO.tool.TestLogger();
+            }
+
+            this._initialized = true;
+        }
+
+
+        // reset the results cache
+        this._results = {
+            // number of pages that pass
+            pages_passed: 0,
+            // number of pages that fail
+            pages_failed: 0,
+            // total number of tests passed
+            tests_passed: 0,
+            // total number of tests failed
+            tests_failed: 0,
+            // array of pages that passed
+            passed: [],
+            // array of pages that failed
+            failed: [],
+            // map of full results for each page
+            page_results: {}
+        };
+
+        this.fireEvent(this.TEST_MANAGER_BEGIN_EVENT, null);
+        this._run();
+    
+    },
+
+    /**
+     * Stops the execution of tests.
+     * @return {Void}
+     * @static
+     */
+    stop : function () /*:Void*/ {
+        clearTimeout(this._timeoutId);
+    }
+
+};
+
+YAHOO.lang.augmentObject(YAHOO.tool.TestManager, YAHOO.util.EventProvider.prototype);
+
+YAHOO.register("yuitest", YAHOO.tool.TestRunner, {version: "2.3.1", build: "541"});

Added: trunk/examples/RestYUI/t/view_TT.t
===================================================================
--- trunk/examples/RestYUI/t/view_TT.t	                        (rev 0)
+++ trunk/examples/RestYUI/t/view_TT.t	2007-11-28 19:55:11 UTC (rev 7186)
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'AdventREST::View::TT' }
+




More information about the Catalyst-commits mailing list