From: Petr Skoda
Date: Wed, 16 Dec 2009 18:21:43 +0000 (+0000)
Subject: MDL-20795 importing latest version of YUI2 2.8.0r4, not integrated yet with our libs
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7d89b4230b31e39a374a1f1563a93e8c469bee66;p=moodle.git
MDL-20795 importing latest version of YUI2 2.8.0r4, not integrated yet with our libs
---
diff --git a/lib/yui/2.8.0r4/animation/animation-debug.js b/lib/yui/2.8.0r4/animation/animation-debug.js
new file mode 100644
index 0000000000..58451e7802
--- /dev/null
+++ b/lib/yui/2.8.0r4/animation/animation-debug.js
@@ -0,0 +1,1396 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function() {
+
+var Y = YAHOO.util;
+
+/*
+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.
+ * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
+ * @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)
+ */
+
+var Anim = function(el, attributes, duration, method) {
+ if (!el) {
+ YAHOO.log('element required to create Anim instance', 'error', 'Anim');
+ }
+ this.init(el, attributes, duration, method);
+};
+
+Anim.NAME = 'Anim';
+
+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;
+ return (this.constructor.NAME + ': ' + 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) {
+ var el = this.getEl();
+ if ( this.patterns.noNegatives.test(attr) ) {
+ val = (val > 0) ? val : 0;
+ }
+
+ if (attr in el && !('style' in el && attr in el.style)) {
+ el[attr] = val;
+ } else {
+ Y.Dom.setStyle(el, 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 = Y.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
+
+ if ('style' in el) {
+ // use offsets for width/height and abs pos top/left
+ if ( box || (Y.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;
+ }
+ } else if (attr in el) {
+ val = el[attr];
+ }
+
+ 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 = Y.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 || Y.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 = Y.AnimMgr.fps;
+
+ /**
+ * Changes the animated element
+ * @method setEl
+ */
+ this.setEl = function(element) {
+ el = Y.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 = {};
+
+ var logger = {};
+ logger.log = function() {YAHOO.log.apply(window, arguments)};
+
+ logger.log('creating new instance of ' + this);
+
+ /**
+ * 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(Y.AnimMgr.fps * this.duration) : this.duration;
+
+ if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration
+ this.totalFrames = 1;
+ }
+ Y.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 (!this.isAnimated()) { // nothing to stop
+ return false;
+ }
+
+ if (finish) {
+ this.currentFrame = this.totalFrames;
+ this._onTween.fire();
+ }
+ Y.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 Y.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 Y.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 Y.CustomEvent('tween', this);
+
+ /**
+ * Custom event that fires after onTween
+ * @private
+ */
+ this._onTween = new Y.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 Y.CustomEvent('complete', this);
+ /**
+ * Custom event that fires after onComplete
+ * @private
+ */
+ this._onComplete = new Y.CustomEvent('_complete', this, true);
+
+ this._onStart.subscribe(onStart);
+ this._onTween.subscribe(onTween);
+ this._onComplete.subscribe(onComplete);
+ }
+};
+
+ Y.Anim = Anim;
+})();
+/**
+ * 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) {
+ index = index || getIndex(tween);
+ if (!tween.isAnimated() || index === -1) {
+ return false;
+ }
+
+ tween._onComplete.fire();
+ 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) {
+ 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;
+ }
+ };
+ this._queue = queue;
+ this._getIndex = getIndex;
+};
+/**
+ * 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.
+ * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);
Color values can be specified with either 112233, #112233,
+ * [255,255,255], or rgb(255,255,255)
+ * @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)
+ */
+ var ColorAnim = function(el, attributes, duration, method) {
+ ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
+ };
+
+ ColorAnim.NAME = 'ColorAnim';
+
+ ColorAnim.DEFAULT_BGCOLOR = '#fff';
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(ColorAnim, Y.Anim);
+
+ var superclass = ColorAnim.superclass;
+ var proto = ColorAnim.prototype;
+
+ 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);
+
+ var that = this;
+ if (this.patterns.transparent.test(val)) { // bgcolor default
+ var parent = YAHOO.util.Dom.getAncestorBy(el, function(node) {
+ return !that.patterns.transparent.test(val);
+ });
+
+ if (parent) {
+ val = Y.Dom.getStyle(parent, attr);
+ } else {
+ val = ColorAnim.DEFAULT_BGCOLOR;
+ }
+ }
+ } 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;
+ }
+ };
+
+ Y.ColorAnim = ColorAnim;
+})();
+/*!
+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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @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.ColorAnim
+ * @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)
+ */
+ var Motion = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ Motion.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+
+ Motion.NAME = 'Motion';
+
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(Motion, Y.ColorAnim);
+
+ var superclass = Motion.superclass;
+ var proto = Motion.prototype;
+
+ 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');
+ };
+
+ Y.Motion = Motion;
+})();
+(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.
+ * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @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.ColorAnim
+ * @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)
+ */
+ var Scroll = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ Scroll.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ Scroll.NAME = 'Scroll';
+
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(Scroll, Y.ColorAnim);
+
+ var superclass = Scroll.superclass;
+ var proto = Scroll.prototype;
+
+ 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);
+ }
+ };
+
+ Y.Scroll = Scroll;
+})();
+YAHOO.register("animation", YAHOO.util.Anim, {version: "2.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/animation/animation-min.js b/lib/yui/2.8.0r4/animation/animation-min.js
new file mode 100644
index 0000000000..9fe8c62d1f
--- /dev/null
+++ b/lib/yui/2.8.0r4/animation/animation-min.js
@@ -0,0 +1,23 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function(){var B=YAHOO.util;var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);};A.NAME="Anim";A.prototype={toString:function(){var C=this.getEl()||{};var D=C.id||C.tagName;return(this.constructor.NAME+": "+D);},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(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},setAttribute:function(C,F,E){var D=this.getEl();if(this.patterns.noNegatives.test(C)){F=(F>0)?F:0;}if(C in D&&!("style" in D&&C in D.style)){D[C]=F;}else{B.Dom.setStyle(D,C,F+E);}},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if("style" in E){if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}}else{if(C in E){G=E[C];}}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};this._queue=B;this._getIndex=E;};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.8.0r4",build:"2449"});
\ No newline at end of file
diff --git a/lib/yui/2.8.0r4/animation/animation.js b/lib/yui/2.8.0r4/animation/animation.js
new file mode 100644
index 0000000000..5737b68bb2
--- /dev/null
+++ b/lib/yui/2.8.0r4/animation/animation.js
@@ -0,0 +1,1392 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function() {
+
+var Y = YAHOO.util;
+
+/*
+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.
+ * Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
+ * @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)
+ */
+
+var Anim = function(el, attributes, duration, method) {
+ if (!el) {
+ }
+ this.init(el, attributes, duration, method);
+};
+
+Anim.NAME = 'Anim';
+
+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;
+ return (this.constructor.NAME + ': ' + 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) {
+ var el = this.getEl();
+ if ( this.patterns.noNegatives.test(attr) ) {
+ val = (val > 0) ? val : 0;
+ }
+
+ if (attr in el && !('style' in el && attr in el.style)) {
+ el[attr] = val;
+ } else {
+ Y.Dom.setStyle(el, 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 = Y.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
+
+ if ('style' in el) {
+ // use offsets for width/height and abs pos top/left
+ if ( box || (Y.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;
+ }
+ } else if (attr in el) {
+ val = el[attr];
+ }
+
+ 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 = Y.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 || Y.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 = Y.AnimMgr.fps;
+
+ /**
+ * Changes the animated element
+ * @method setEl
+ */
+ this.setEl = function(element) {
+ el = Y.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(Y.AnimMgr.fps * this.duration) : this.duration;
+
+ if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration
+ this.totalFrames = 1;
+ }
+ Y.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 (!this.isAnimated()) { // nothing to stop
+ return false;
+ }
+
+ if (finish) {
+ this.currentFrame = this.totalFrames;
+ this._onTween.fire();
+ }
+ Y.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 Y.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 Y.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 Y.CustomEvent('tween', this);
+
+ /**
+ * Custom event that fires after onTween
+ * @private
+ */
+ this._onTween = new Y.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 Y.CustomEvent('complete', this);
+ /**
+ * Custom event that fires after onComplete
+ * @private
+ */
+ this._onComplete = new Y.CustomEvent('_complete', this, true);
+
+ this._onStart.subscribe(onStart);
+ this._onTween.subscribe(onTween);
+ this._onComplete.subscribe(onComplete);
+ }
+};
+
+ Y.Anim = Anim;
+})();
+/**
+ * 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) {
+ index = index || getIndex(tween);
+ if (!tween.isAnimated() || index === -1) {
+ return false;
+ }
+
+ tween._onComplete.fire();
+ 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) {
+ 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;
+ }
+ };
+ this._queue = queue;
+ this._getIndex = getIndex;
+};
+/**
+ * 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.
+ * Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);
Color values can be specified with either 112233, #112233,
+ * [255,255,255], or rgb(255,255,255)
+ * @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)
+ */
+ var ColorAnim = function(el, attributes, duration, method) {
+ ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
+ };
+
+ ColorAnim.NAME = 'ColorAnim';
+
+ ColorAnim.DEFAULT_BGCOLOR = '#fff';
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(ColorAnim, Y.Anim);
+
+ var superclass = ColorAnim.superclass;
+ var proto = ColorAnim.prototype;
+
+ 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);
+
+ var that = this;
+ if (this.patterns.transparent.test(val)) { // bgcolor default
+ var parent = YAHOO.util.Dom.getAncestorBy(el, function(node) {
+ return !that.patterns.transparent.test(val);
+ });
+
+ if (parent) {
+ val = Y.Dom.getStyle(parent, attr);
+ } else {
+ val = ColorAnim.DEFAULT_BGCOLOR;
+ }
+ }
+ } 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;
+ }
+ };
+
+ Y.ColorAnim = ColorAnim;
+})();
+/*!
+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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * @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.
+ * Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @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.ColorAnim
+ * @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)
+ */
+ var Motion = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ Motion.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+
+ Motion.NAME = 'Motion';
+
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(Motion, Y.ColorAnim);
+
+ var superclass = Motion.superclass;
+ var proto = Motion.prototype;
+
+ 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');
+ };
+
+ Y.Motion = Motion;
+})();
+(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.
+ * Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);
+ * @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.ColorAnim
+ * @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)
+ */
+ var Scroll = function(el, attributes, duration, method) {
+ if (el) { // dont break existing subclasses not using YAHOO.extend
+ Scroll.superclass.constructor.call(this, el, attributes, duration, method);
+ }
+ };
+
+ Scroll.NAME = 'Scroll';
+
+ // shorthand
+ var Y = YAHOO.util;
+ YAHOO.extend(Scroll, Y.ColorAnim);
+
+ var superclass = Scroll.superclass;
+ var proto = Scroll.prototype;
+
+ 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);
+ }
+ };
+
+ Y.Scroll = Scroll;
+})();
+YAHOO.register("animation", YAHOO.util.Anim, {version: "2.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/ajax-loader.gif b/lib/yui/2.8.0r4/assets/skins/sam/ajax-loader.gif
new file mode 100644
index 0000000000..fe2cd23b3a
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/ajax-loader.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/asc.gif b/lib/yui/2.8.0r4/assets/skins/sam/asc.gif
new file mode 100644
index 0000000000..a1fe7385d5
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/asc.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/autocomplete.css b/lib/yui/2.8.0r4/assets/skins/sam/autocomplete.css
new file mode 100644
index 0000000000..07fc0302a9
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/autocomplete.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-ac{position:relative;font-family:arial;font-size:100%;}.yui-skin-sam .yui-ac-input{position:absolute;width:100%;}.yui-skin-sam .yui-ac-container{position:absolute;top:1.6em;width:100%;}.yui-skin-sam .yui-ac-content{position:absolute;width:100%;border:1px solid #808080;background:#fff;overflow:hidden;z-index:9050;}.yui-skin-sam .yui-ac-shadow{position:absolute;margin:.3em;width:100%;background:#000;-moz-opacity:.10;opacity:.10;filter:alpha(opacity=10);z-index:9049;}.yui-skin-sam .yui-ac iframe{opacity:0;filter:alpha(opacity=0);padding-right:.3em;padding-bottom:.3em;}.yui-skin-sam .yui-ac-content ul{margin:0;padding:0;width:100%;}.yui-skin-sam .yui-ac-content li{margin:0;padding:2px 5px;cursor:default;white-space:nowrap;list-style:none;zoom:1;}.yui-skin-sam .yui-ac-content li.yui-ac-prehighlight{background:#B3D4FF;}.yui-skin-sam .yui-ac-content li.yui-ac-highlight{background:#426FD9;color:#FFF;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/back-h.png b/lib/yui/2.8.0r4/assets/skins/sam/back-h.png
new file mode 100644
index 0000000000..5f69f4e256
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/back-h.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/back-v.png b/lib/yui/2.8.0r4/assets/skins/sam/back-v.png
new file mode 100644
index 0000000000..658574a9d5
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/back-v.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/bar-h.png b/lib/yui/2.8.0r4/assets/skins/sam/bar-h.png
new file mode 100644
index 0000000000..fea13b15d8
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/bar-h.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/bar-v.png b/lib/yui/2.8.0r4/assets/skins/sam/bar-v.png
new file mode 100644
index 0000000000..2efd664d9a
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/bar-v.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/bg-h.gif b/lib/yui/2.8.0r4/assets/skins/sam/bg-h.gif
new file mode 100644
index 0000000000..996288916e
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/bg-h.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/bg-v.gif b/lib/yui/2.8.0r4/assets/skins/sam/bg-v.gif
new file mode 100644
index 0000000000..8e287cd522
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/bg-v.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/blankimage.png b/lib/yui/2.8.0r4/assets/skins/sam/blankimage.png
new file mode 100644
index 0000000000..b87bb24850
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/blankimage.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/button.css b/lib/yui/2.8.0r4/assets/skins/sam/button.css
new file mode 100644
index 0000000000..9d63c61081
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/button.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-button{display:-moz-inline-box;display:inline-block;vertical-align:text-bottom;}.yui-button .first-child{display:block;*display:inline-block;}.yui-button button,.yui-button a{display:block;*display:inline-block;border:none;margin:0;}.yui-button button{background-color:transparent;*overflow:visible;cursor:pointer;}.yui-button a{text-decoration:none;}.yui-skin-sam .yui-button{border-width:1px 0;border-style:solid;border-color:#808080;background:url(sprite.png) repeat-x 0 0;margin:auto .25em;}.yui-skin-sam .yui-button .first-child{border-width:0 1px;border-style:solid;border-color:#808080;margin:0 -1px;_margin:0;}.yui-skin-sam .yui-button button,.yui-skin-sam .yui-button a,.yui-skin-sam .yui-button a:visited{padding:0 10px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-button a{*line-height:1.875;*padding-bottom:1px;}.yui-skin-sam .yui-split-button button,.yui-skin-sam .yui-menu-button button{padding-right:20px;background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-button button{background-image:url(menu-button-arrow.png);}.yui-skin-sam .yui-split-button button{background-image:url(split-button-arrow.png);}.yui-skin-sam .yui-button-focus{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-focus .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-focus button{background-image:url(split-button-arrow-focus.png);}.yui-skin-sam .yui-button-hover{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-hover .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-hover button{background-image:url(split-button-arrow-hover.png);}.yui-skin-sam .yui-button-active{border-color:#7D98B8;background-position:0 -1700px;}.yui-skin-sam .yui-button-active .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-activeoption{border-color:#808080;background-position:0 0;}.yui-skin-sam .yui-split-button-activeoption .first-child{border-color:#808080;}.yui-skin-sam .yui-split-button-activeoption button{background-image:url(split-button-arrow-active.png);}.yui-skin-sam .yui-radio-button-checked,.yui-skin-sam .yui-checkbox-button-checked{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-radio-button-checked .first-child,.yui-skin-sam .yui-checkbox-button-checked .first-child{border-color:#304369;}.yui-skin-sam .yui-radio-button-checked button,.yui-skin-sam .yui-checkbox-button-checked button{color:#fff;}.yui-skin-sam .yui-button-disabled{border-color:#ccc;background-position:0 -1500px;}.yui-skin-sam .yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-button-disabled button,.yui-skin-sam .yui-button-disabled a,.yui-skin-sam .yui-button-disabled a:visited{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-menu-button-disabled button{background-image:url(menu-button-arrow-disabled.png);}.yui-skin-sam .yui-split-button-disabled button{background-image:url(split-button-arrow-disabled.png);}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/calendar.css b/lib/yui/2.8.0r4/assets/skins/sam/calendar.css
new file mode 100644
index 0000000000..b01c7e6185
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/calendar.css
@@ -0,0 +1,8 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-calcontainer{position:relative;float:left;_overflow:hidden;}.yui-calcontainer iframe{position:absolute;border:none;margin:0;padding:0;z-index:0;width:100%;height:100%;left:0;top:0;}.yui-calcontainer iframe.fixedsize{width:50em;height:50em;top:-1px;left:-1px;}.yui-calcontainer.multi .groupcal{z-index:1;float:left;position:relative;}.yui-calcontainer .title{position:relative;z-index:1;}.yui-calcontainer .close-icon{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar{position:relative;}.yui-calendar .calnavleft{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calnavright{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calheader{position:relative;width:100%;text-align:center;}.yui-calcontainer .yui-cal-nav-mask{position:absolute;z-index:2;margin:0;padding:0;width:100%;height:100%;_width:0;_height:0;left:0;top:0;display:none;}.yui-calcontainer .yui-cal-nav{position:absolute;z-index:3;top:0;display:none;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{display:-moz-inline-box;display:inline-block;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{display:block;*display:inline-block;*overflow:visible;border:none;background-color:transparent;cursor:pointer;}.yui-calendar .calbody a:hover{background:inherit;}p#clear{clear:left;padding-top:10px;}.yui-skin-sam .yui-calcontainer{background-color:#f2f2f2;border:1px solid #808080;padding:10px;}.yui-skin-sam .yui-calcontainer.multi{padding:0 5px 0 5px;}.yui-skin-sam .yui-calcontainer.multi .groupcal{background-color:transparent;border:none;padding:10px 5px 10px 5px;margin:0;}.yui-skin-sam .yui-calcontainer .title{background:url(sprite.png) repeat-x 0 0;border-bottom:1px solid #ccc;font:100% sans-serif;color:#000;font-weight:bold;height:auto;padding:.4em;margin:0 -10px 10px -10px;top:0;left:0;text-align:left;}.yui-skin-sam .yui-calcontainer.multi .title{margin:0 -5px 0 -5px;}.yui-skin-sam .yui-calcontainer.withtitle{padding-top:0;}.yui-skin-sam .yui-calcontainer .calclose{background:url(sprite.png) no-repeat 0 -300px;width:25px;height:15px;top:.4em;right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar{border-spacing:0;border-collapse:collapse;font:100% sans-serif;text-align:center;margin:0;}.yui-skin-sam .yui-calendar .calhead{background:transparent;border:none;vertical-align:middle;padding:0;}.yui-skin-sam .yui-calendar .calheader{background:transparent;font-weight:bold;padding:0 0 .6em 0;text-align:center;}.yui-skin-sam .yui-calendar .calheader img{border:none;}.yui-skin-sam .yui-calendar .calnavleft{background:url(sprite.png) no-repeat 0 -450px;width:25px;height:15px;top:0;bottom:0;left:-10px;margin-left:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calnavright{background:url(sprite.png) no-repeat 0 -500px;width:25px;height:15px;top:0;bottom:0;right:-10px;margin-right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calweekdayrow{height:2em;}.yui-skin-sam .yui-calendar .calweekdayrow th{padding:0;border:none;}.yui-skin-sam .yui-calendar .calweekdaycell{color:#000;font-weight:bold;text-align:center;width:2em;}.yui-skin-sam .yui-calendar .calfoot{background-color:#f2f2f2;}.yui-skin-sam .yui-calendar .calrowhead,.yui-skin-sam .yui-calendar .calrowfoot{color:#a6a6a6;font-size:85%;font-style:normal;font-weight:normal;border:none;}.yui-skin-sam .yui-calendar .calrowhead{text-align:right;padding:0 2px 0 0;}.yui-skin-sam .yui-calendar .calrowfoot{text-align:left;padding:0 0 0 2px;}.yui-skin-sam .yui-calendar td.calcell{border:1px solid #ccc;background:#fff;padding:1px;height:1.6em;line-height:1.6em;text-align:center;white-space:nowrap;}.yui-skin-sam .yui-calendar td.calcell a{color:#06c;display:block;height:100%;text-decoration:none;}.yui-skin-sam .yui-calendar td.calcell.today{background-color:#000;}.yui-skin-sam .yui-calendar td.calcell.today a{background-color:#fff;}.yui-skin-sam .yui-calendar td.calcell.oom{background-color:#ccc;color:#a6a6a6;cursor:default;}.yui-skin-sam .yui-calendar td.calcell.selected{background-color:#fff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.selected a{background-color:#b3d4ff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.calcellhover{background-color:#426fd9;color:#fff;cursor:pointer;}.yui-skin-sam .yui-calendar td.calcell.calcellhover a{background-color:#426fd9;color:#fff;}.yui-skin-sam .yui-calendar td.calcell.previous{color:#e0e0e0;}.yui-skin-sam .yui-calendar td.calcell.restricted{text-decoration:line-through;}.yui-skin-sam .yui-calendar td.calcell.highlight1{background-color:#cf9;}.yui-skin-sam .yui-calendar td.calcell.highlight2{background-color:#9cf;}.yui-skin-sam .yui-calendar td.calcell.highlight3{background-color:#fcc;}.yui-skin-sam .yui-calendar td.calcell.highlight4{background-color:#cf9;}.yui-skin-sam .yui-calendar a.calnav{border:1px solid #f2f2f2;padding:0 4px;text-decoration:none;color:#000;zoom:1;}.yui-skin-sam .yui-calendar a.calnav:hover{background:url(sprite.png) repeat-x 0 0;border-color:#A0A0A0;cursor:pointer;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-calcontainer .yui-cal-nav{font-family:arial,helvetica,clean,sans-serif;font-size:93%;border:1px solid #808080;left:50%;margin-left:-7em;width:14em;padding:0;top:2.5em;background-color:#f2f2f2;}.yui-skin-sam .yui-calcontainer.withtitle .yui-cal-nav{top:4.5em;}.yui-skin-sam .yui-calcontainer.multi .yui-cal-nav{width:16em;margin-left:-8em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y,.yui-skin-sam .yui-calcontainer .yui-cal-nav-m,.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{padding:5px 10px 5px 10px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{text-align:center;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-e{margin-top:5px;padding:5px;background-color:#EDF5FF;border-top:1px solid black;display:none;}.yui-skin-sam .yui-calcontainer .yui-cal-nav label{display:block;font-weight:bold;}
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-mc{width:100%;_width:auto;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y input.yui-invalid{background-color:#FFEE69;border:1px solid #000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-yc{width:4em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{border:1px solid #808080;background:url(sprite.png) repeat-x 0 0;background-color:#ccc;margin:auto .15em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{padding:0 8px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default{border:1px solid #304369;background-color:#426fd9;background:url(sprite.png) repeat-x 0 -1400px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default button{color:#fff;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/carousel.css b/lib/yui/2.8.0r4/assets/skins/sam/carousel.css
new file mode 100644
index 0000000000..dc1f97890f
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/carousel.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-carousel{visibility:hidden;overflow:hidden;position:relative;text-align:left;zoom:1;}.yui-carousel.yui-carousel-visible{visibility:visible;}.yui-carousel-content{overflow:hidden;position:relative;text-align:center;}.yui-carousel-element li{border:1px solid #ccc;list-style:none;margin:1px;overflow:hidden;padding:0;position:absolute;text-align:center;}.yui-carousel-vertical .yui-carousel-element li{display:block;float:none;}.yui-log .carousel{background:#f2e886;}.yui-carousel-nav{zoom:1;}.yui-carousel-nav:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-carousel-button-focus{outline:1px dotted #000;}.yui-carousel-min-width{min-width:115px;}.yui-carousel-element{overflow:hidden;position:relative;margin:0 auto;padding:0;text-align:left;*margin:0;}.yui-carousel-horizontal .yui-carousel-element{width:320000px;}.yui-carousel-vertical .yui-carousel-element{height:320000px;}.yui-skin-sam .yui-carousel-nav select{position:static;}.yui-carousel .yui-carousel-item-selected{border:1px dashed #000;margin:1px;}.yui-skin-sam .yui-carousel,.yui-skin-sam .yui-carousel-vertical{border:1px solid #808080;}.yui-skin-sam .yui-carousel-nav{background:url(sprite.png) repeat-x 0 0;padding:3px;text-align:right;}.yui-skin-sam .yui-carousel-button{background:url(sprite.png) no-repeat 0 -600px;float:right;height:19px;margin:5px;overflow:hidden;width:40px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button{background-position:0 -800px;}.yui-skin-sam .yui-carousel-button-disabled{background-position:0 -2000px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button-disabled{background-position:0 -2100px;}.yui-skin-sam .yui-carousel-button input,.yui-skin-sam .yui-carousel-button button{background-color:transparent;border:0;cursor:pointer;display:block;height:44px;margin:-2px 0 0 -2px;padding:0 0 0 50px;}.yui-skin-sam span.yui-carousel-first-button{background-position:0 -550px;margin-left:-100px;margin-right:50px;*margin:5px 5px 5px -90px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button{background-position:0 -750px;}.yui-skin-sam span.yui-carousel-first-button-disabled{background-position:0 -1950px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button-disabled{background-position:0 -2050px;}.yui-skin-sam .yui-carousel-nav ul{float:right;height:19px;margin:0;margin-left:-220px;margin-right:100px;*margin-left:-160px;*margin-right:0;padding:0;}.yui-skin-sam .yui-carousel-min-width .yui-carousel-nav ul{*margin-left:-170px;}.yui-skin-sam .yui-carousel-nav select{position:relative;*right:50px;top:4px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{position:static;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav ul,.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{float:none;margin:0;*zoom:1;}.yui-skin-sam .yui-carousel-nav ul li{background:url(sprite.png) no-repeat 0 -650px;cursor:pointer;float:left;height:9px;list-style:none;margin:10px 0 0 5px;overflow:hidden;padding:0;width:9px;}.yui-skin-sam .yui-carousel-nav ul:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-skin-sam .yui-carousel-nav ul li a{display:block;width:100%;height:100%;text-indent:-10000px;text-align:left;overflow:hidden;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-focus{outline:1px dotted #000;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-selected{background-position:0 -700px;}.yui-skin-sam .yui-carousel-item-loading{background:url(ajax-loader.gif) no-repeat 50% 50%;position:absolute;text-indent:-150px;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/check0.gif b/lib/yui/2.8.0r4/assets/skins/sam/check0.gif
new file mode 100644
index 0000000000..193028b993
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/check0.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/check1.gif b/lib/yui/2.8.0r4/assets/skins/sam/check1.gif
new file mode 100644
index 0000000000..7d9ceba384
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/check1.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/check2.gif b/lib/yui/2.8.0r4/assets/skins/sam/check2.gif
new file mode 100644
index 0000000000..181317599b
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/check2.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/colorpicker.css b/lib/yui/2.8.0r4/assets/skins/sam/colorpicker.css
new file mode 100644
index 0000000000..aaec21a06d
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/colorpicker.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-picker-panel{background:#e3e3e3;border-color:#888;}.yui-picker-panel .hd{background-color:#ccc;font-size:100%;line-height:100%;border:1px solid #e3e3e3;font-weight:bold;overflow:hidden;padding:6px;color:#000;}.yui-picker-panel .bd{background:#e8e8e8;margin:1px;height:200px;}.yui-picker-panel .ft{background:#e8e8e8;margin:1px;padding:1px;}.yui-picker{position:relative;}.yui-picker-hue-thumb{cursor:default;width:18px;height:18px;top:-8px;left:-2px;z-index:9;position:absolute;}.yui-picker-hue-bg{-moz-outline:none;outline:0 none;position:absolute;left:200px;height:183px;width:14px;background:url(hue_bg.png) no-repeat;top:4px;}.yui-picker-bg{-moz-outline:none;outline:0 none;position:absolute;top:4px;left:4px;height:182px;width:182px;background-color:#F00;background-image:url(picker_mask.png);}*html .yui-picker-bg{background-image:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../build/colorpicker/assets/picker_mask.png',sizingMethod='scale');}.yui-picker-mask{position:absolute;z-index:1;top:0;left:0;}.yui-picker-thumb{cursor:default;width:11px;height:11px;z-index:9;position:absolute;top:-4px;left:-4px;}.yui-picker-swatch{position:absolute;left:240px;top:4px;height:60px;width:55px;border:1px solid #888;}.yui-picker-websafe-swatch{position:absolute;left:304px;top:4px;height:24px;width:24px;border:1px solid #888;}.yui-picker-controls{position:absolute;top:72px;left:226px;font:1em monospace;}.yui-picker-controls .hd{background:transparent;border-width:0!important;}.yui-picker-controls .bd{height:100px;border-width:0!important;}.yui-picker-controls ul{float:left;padding:0 2px 0 0;margin:0;}.yui-picker-controls li{padding:2px;list-style:none;margin:0;}.yui-picker-controls input{font-size:.85em;width:2.4em;}.yui-picker-hex-controls{clear:both;padding:2px;}.yui-picker-hex-controls input{width:4.6em;}.yui-picker-controls a{font:1em arial,helvetica,clean,sans-serif;display:block;*display:inline-block;padding:0;color:#000;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/container.css b/lib/yui/2.8.0r4/assets/skins/sam/container.css
new file mode 100644
index 0000000000..89e708c6b7
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/container.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-overlay,.yui-panel-container{visibility:hidden;position:absolute;z-index:2;}.yui-panel{position:relative;}.yui-panel-container form{margin:0;}.mask{z-index:1;display:none;position:absolute;top:0;left:0;right:0;bottom:0;}.mask.block-scrollbars{overflow:auto;}.masked select,.drag select,.hide-select select{_visibility:hidden;}.yui-panel-container select{_visibility:inherit;}.hide-scrollbars,.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.show-scrollbars{overflow:auto;}.yui-panel-container.show-scrollbars,.yui-tt.show-scrollbars{overflow:visible;}.yui-panel-container.show-scrollbars .underlay,.yui-tt.show-scrollbars .yui-tt-shadow{overflow:auto;}.yui-panel-container.shadow .underlay.yui-force-redraw{padding-bottom:1px;}.yui-effect-fade .underlay,.yui-effect-fade .yui-tt-shadow{display:none;}.yui-tt-shadow{position:absolute;}.yui-override-padding{padding:0!important;}.yui-panel-container .container-close{overflow:hidden;text-indent:-10000em;text-decoration:none;}.yui-overlay.yui-force-redraw,.yui-panel-container.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-panel-container{padding:0 1px;*padding:2px;}.yui-skin-sam .yui-panel{position:relative;left:0;top:0;border-style:solid;border-width:1px 0;border-color:#808080;z-index:1;*border-width:1px;*zoom:1;_zoom:normal;}.yui-skin-sam .yui-panel .hd,.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{border-style:solid;border-width:0 1px;border-color:#808080;margin:0 -1px;*margin:0;*border:0;}.yui-skin-sam .yui-panel .hd{border-bottom:solid 1px #ccc;}.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{background-color:#F2F2F2;}.yui-skin-sam .yui-panel .hd{padding:0 10px;font-size:93%;line-height:2;*line-height:1.9;font-weight:bold;color:#000;background:url(sprite.png) repeat-x 0 -200px;}.yui-skin-sam .yui-panel .bd{padding:10px;}.yui-skin-sam .yui-panel .ft{border-top:solid 1px #808080;padding:5px 10px;font-size:77%;}.yui-skin-sam .container-close{position:absolute;top:5px;right:6px;width:25px;height:15px;background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;}.yui-skin-sam .yui-panel-container .underlay{right:-1px;left:-1px;}.yui-skin-sam .yui-panel-container.matte{padding:9px 10px;background-color:#fff;}.yui-skin-sam .yui-panel-container.shadow{_padding:2px 4px 0 2px;}.yui-skin-sam .yui-panel-container.shadow .underlay{position:absolute;top:2px;left:-3px;right:-3px;bottom:-3px;*top:4px;*left:-1px;*right:-1px;*bottom:-1px;_top:0;_left:0;_right:0;_bottom:0;_margin-top:3px;_margin-left:-1px;background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yui-dialog .ft{border-top:none;padding:0 10px 10px 10px;font-size:100%;}.yui-skin-sam .yui-dialog .ft .button-group{display:block;text-align:right;}.yui-skin-sam .yui-dialog .ft button.default{font-weight:bold;}.yui-skin-sam .yui-dialog .ft span.default{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-dialog .ft span.default .first-child{border-color:#304369;}.yui-skin-sam .yui-dialog .ft span.default button{color:#fff;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled{background-position:0 -1500px;border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled button{color:#a6a6a6;}.yui-skin-sam .yui-simple-dialog .bd .yui-icon{background:url(sprite.png) no-repeat 0 0;width:16px;height:16px;margin-right:10px;float:left;}.yui-skin-sam .yui-simple-dialog .bd span.blckicon{background-position:0 -1100px;}.yui-skin-sam .yui-simple-dialog .bd span.alrticon{background-position:0 -1050px;}.yui-skin-sam .yui-simple-dialog .bd span.hlpicon{background-position:0 -1150px;}.yui-skin-sam .yui-simple-dialog .bd span.infoicon{background-position:0 -1200px;}.yui-skin-sam .yui-simple-dialog .bd span.warnicon{background-position:0 -1900px;}.yui-skin-sam .yui-simple-dialog .bd span.tipicon{background-position:0 -1250px;}.yui-skin-sam .yui-tt .bd{position:relative;top:0;left:0;z-index:1;color:#000;padding:2px 5px;border-color:#D4C237 #A6982B #A6982B #A6982B;border-width:1px;border-style:solid;background-color:#FFEE69;}.yui-skin-sam .yui-tt.show-scrollbars .bd{overflow:auto;}.yui-skin-sam .yui-tt-shadow{top:2px;right:-3px;left:-3px;bottom:-3px;background-color:#000;}.yui-skin-sam .yui-tt-shadow-visible{opacity:.12;filter:alpha(opacity=12);}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/datatable.css b/lib/yui/2.8.0r4/assets/skins/sam/datatable.css
new file mode 100644
index 0000000000..eb5a314013
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/datatable.css
@@ -0,0 +1,8 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-dt-mask{position:absolute;z-index:9500;}.yui-dt-tmp{position:absolute;left:-9000px;}.yui-dt-scrollable .yui-dt-bd{overflow:auto;}.yui-dt-scrollable .yui-dt-hd{overflow:hidden;position:relative;}.yui-dt-scrollable .yui-dt-bd thead tr,.yui-dt-scrollable .yui-dt-bd thead th{position:absolute;left:-1500px;}.yui-dt-scrollable tbody{-moz-outline:none;}.yui-skin-sam thead .yui-dt-sortable{cursor:pointer;}.yui-skin-sam thead .yui-dt-draggable{cursor:move;}.yui-dt-coltarget{position:absolute;z-index:999;}.yui-dt-hd{zoom:1;}th.yui-dt-resizeable .yui-dt-resizerliner{position:relative;}.yui-dt-resizer{position:absolute;right:0;bottom:0;height:100%;cursor:e-resize;cursor:col-resize;background-color:#CCC;opacity:0;filter:alpha(opacity=0);}.yui-dt-resizerproxy{visibility:hidden;position:absolute;z-index:9000;background-color:#CCC;opacity:0;filter:alpha(opacity=0);}th.yui-dt-hidden .yui-dt-liner,td.yui-dt-hidden .yui-dt-liner,th.yui-dt-hidden .yui-dt-resizer{display:none;}.yui-dt-editor{position:absolute;z-index:9000;}.yui-skin-sam .yui-dt table{margin:0;padding:0;font-family:arial;font-size:inherit;border-collapse:separate;*border-collapse:collapse;border-spacing:0;border:1px solid #7F7F7F;}.yui-skin-sam .yui-dt thead{border-spacing:0;}.yui-skin-sam .yui-dt caption{color:#000;font-size:85%;font-weight:normal;font-style:italic;line-height:1;padding:1em 0;text-align:center;}.yui-skin-sam .yui-dt th{background:#D8D8DA url(sprite.png) repeat-x 0 0;}.yui-skin-sam .yui-dt th,.yui-skin-sam .yui-dt th a{font-weight:normal;text-decoration:none;color:#000;vertical-align:bottom;}.yui-skin-sam .yui-dt th{margin:0;padding:0;border:none;border-right:1px solid #CBCBCB;}.yui-skin-sam .yui-dt tr.yui-dt-first td{border-top:1px solid #7F7F7F;}.yui-skin-sam .yui-dt th .yui-dt-liner{white-space:nowrap;}.yui-skin-sam .yui-dt-liner{margin:0;padding:0;padding:4px 10px 4px 10px;}.yui-skin-sam .yui-dt-coltarget{width:5px;background-color:red;}.yui-skin-sam .yui-dt td{margin:0;padding:0;border:none;border-right:1px solid #CBCBCB;text-align:left;}.yui-skin-sam .yui-dt-list td{border-right:none;}.yui-skin-sam .yui-dt-resizer{width:6px;}.yui-skin-sam .yui-dt-mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-dt-message{background-color:#FFF;}.yui-skin-sam .yui-dt-scrollable table{border:none;}.yui-skin-sam .yui-dt-scrollable .yui-dt-hd{border-left:1px solid #7F7F7F;border-top:1px solid #7F7F7F;border-right:1px solid #7F7F7F;}.yui-skin-sam .yui-dt-scrollable .yui-dt-bd{border-left:1px solid #7F7F7F;border-bottom:1px solid #7F7F7F;border-right:1px solid #7F7F7F;background-color:#FFF;}.yui-skin-sam .yui-dt-scrollable .yui-dt-data tr.yui-dt-last td{border-bottom:1px solid #7F7F7F;}.yui-skin-sam th.yui-dt-asc,.yui-skin-sam th.yui-dt-desc{background:url(sprite.png) repeat-x 0 -100px;}.yui-skin-sam th.yui-dt-sortable .yui-dt-label{margin-right:10px;}.yui-skin-sam th.yui-dt-asc .yui-dt-liner{background:url(dt-arrow-up.png) no-repeat right;}.yui-skin-sam th.yui-dt-desc .yui-dt-liner{background:url(dt-arrow-dn.png) no-repeat right;}tbody .yui-dt-editable{cursor:pointer;}.yui-dt-editor{text-align:left;background-color:#F2F2F2;border:1px solid #808080;padding:6px;}.yui-dt-editor label{padding-left:4px;padding-right:6px;}.yui-dt-editor .yui-dt-button{padding-top:6px;text-align:right;}.yui-dt-editor .yui-dt-button button{background:url(sprite.png) repeat-x 0 0;border:1px solid #999;width:4em;height:1.8em;margin-left:6px;}.yui-dt-editor .yui-dt-button button.yui-dt-default{background:url(sprite.png) repeat-x 0 -1400px;background-color:#5584E0;border:1px solid #304369;color:#FFF;}.yui-dt-editor .yui-dt-button button:hover{background:url(sprite.png) repeat-x 0 -1300px;color:#000;}.yui-dt-editor .yui-dt-button button:active{background:url(sprite.png) repeat-x 0 -1700px;color:#000;}.yui-skin-sam tr.yui-dt-even{background-color:#FFF;}.yui-skin-sam tr.yui-dt-odd{background-color:#EDF5FF;}.yui-skin-sam tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam tr.yui-dt-even td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam tr.yui-dt-odd td.yui-dt-desc{background-color:#DBEAFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even{background-color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-odd{background-color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam th.yui-dt-highlighted,.yui-skin-sam th.yui-dt-highlighted a{background-color:#B2D2FF;}.yui-skin-sam tr.yui-dt-highlighted,.yui-skin-sam tr.yui-dt-highlighted td.yui-dt-asc,.yui-skin-sam tr.yui-dt-highlighted td.yui-dt-desc,.yui-skin-sam tr.yui-dt-even td.yui-dt-highlighted,.yui-skin-sam tr.yui-dt-odd td.yui-dt-highlighted{cursor:pointer;background-color:#B2D2FF;}.yui-skin-sam .yui-dt-list th.yui-dt-highlighted,.yui-skin-sam .yui-dt-list th.yui-dt-highlighted a{background-color:#B2D2FF;}.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted,.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted td.yui-dt-desc,.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-highlighted,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-highlighted{cursor:pointer;background-color:#B2D2FF;}.yui-skin-sam th.yui-dt-selected,.yui-skin-sam th.yui-dt-selected a{background-color:#446CD7;}.yui-skin-sam tr.yui-dt-selected td,.yui-skin-sam tr.yui-dt-selected td.yui-dt-asc,.yui-skin-sam tr.yui-dt-selected td.yui-dt-desc{background-color:#426FD9;color:#FFF;}.yui-skin-sam tr.yui-dt-even td.yui-dt-selected,.yui-skin-sam tr.yui-dt-odd td.yui-dt-selected{background-color:#446CD7;color:#FFF;}.yui-skin-sam .yui-dt-list th.yui-dt-selected,.yui-skin-sam .yui-dt-list th.yui-dt-selected a{background-color:#446CD7;}
+.yui-skin-sam .yui-dt-list tr.yui-dt-selected td,.yui-skin-sam .yui-dt-list tr.yui-dt-selected td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-selected td.yui-dt-desc{background-color:#426FD9;color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-selected,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-selected{background-color:#446CD7;color:#FFF;}.yui-skin-sam .yui-dt-paginator{display:block;margin:6px 0;white-space:nowrap;}.yui-skin-sam .yui-dt-paginator .yui-dt-first,.yui-skin-sam .yui-dt-paginator .yui-dt-last,.yui-skin-sam .yui-dt-paginator .yui-dt-selected{padding:2px 6px;}.yui-skin-sam .yui-dt-paginator a.yui-dt-first,.yui-skin-sam .yui-dt-paginator a.yui-dt-last{text-decoration:none;}.yui-skin-sam .yui-dt-paginator .yui-dt-previous,.yui-skin-sam .yui-dt-paginator .yui-dt-next{display:none;}.yui-skin-sam a.yui-dt-page{border:1px solid #CBCBCB;padding:2px 6px;text-decoration:none;background-color:#fff;}.yui-skin-sam .yui-dt-selected{border:1px solid #fff;background-color:#fff;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/desc.gif b/lib/yui/2.8.0r4/assets/skins/sam/desc.gif
new file mode 100644
index 0000000000..c114f290c8
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/desc.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-dn.png b/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-dn.png
new file mode 100644
index 0000000000..85fda0bbca
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-dn.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-up.png b/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-up.png
new file mode 100644
index 0000000000..1c674316ae
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/dt-arrow-up.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/editor-knob.gif b/lib/yui/2.8.0r4/assets/skins/sam/editor-knob.gif
new file mode 100644
index 0000000000..03feab3b00
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/editor-knob.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite-active.gif b/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite-active.gif
new file mode 100644
index 0000000000..3e9d4200b3
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite-active.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite.gif b/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite.gif
new file mode 100644
index 0000000000..02042fa147
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/editor-sprite.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/editor.css b/lib/yui/2.8.0r4/assets/skins/sam/editor.css
new file mode 100644
index 0000000000..00451d8c59
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/editor.css
@@ -0,0 +1,10 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-busy{cursor:wait!important;}.yui-toolbar-container fieldset,.yui-editor-container fieldset{padding:0;margin:0;border:0;}.yui-toolbar-container legend{display:none;}.yui-skin-sam .yui-toolbar-container .yui-button button,.yui-skin-sam .yui-toolbar-container .yui-button a,.yui-skin-sam .yui-toolbar-container .yui-button a:visited{font-size:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a:visited,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a:visited{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{font-size:0;line-height:0;padding:0;}.yui-toolbar-container .yui-toolbar-subcont{padding:.25em 0;zoom:1;}.yui-toolbar-container-collapsed .yui-toolbar-subcont{display:none;}.yui-toolbar-container .yui-toolbar-subcont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container span.yui-toolbar-draghandle{cursor:move;border-left:1px solid #999;border-right:1px solid #999;overflow:hidden;text-indent:77777px;width:2px;height:20px;display:block;clear:none;float:left;margin:0 0 0 .2em;}.yui-toolbar-container .yui-toolbar-titlebar.draggable{cursor:move;}.yui-toolbar-container .yui-toolbar-titlebar{position:relative;}.yui-toolbar-container .yui-toolbar-titlebar h2{font-weight:bold;letter-spacing:0;border:none;color:#000;margin:0;padding:.2em;}.yui-toolbar-container .yui-toolbar-titlebar h2 a{text-decoration:none;color:#000;cursor:default;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-draghandle{height:40px;}.yui-toolbar-container .yui-toolbar-group{float:left;margin-right:.5em;zoom:1;}.yui-toolbar-container .yui-toolbar-group:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container .yui-toolbar-group h3{font-size:75%;padding:0 0 0 .25em;margin:0;}.yui-toolbar-container span.yui-toolbar-separator{width:2px;padding:0;height:18px;margin:.2em 0 .2em .1em;display:none;float:left;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-separator{height:45px;*height:50px;}.yui-toolbar-container.yui-toolbar-grouped .yui-toolbar-group span.yui-toolbar-separator{height:18px;display:block;}.yui-toolbar-container ul li{margin:0;padding:0;list-style-type:none;}.yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-toolbar-container .yui-push-button,.yui-toolbar-container .yui-color-button,.yui-toolbar-container .yui-menu-button{position:relative;cursor:pointer;}.yui-toolbar-container .yui-button .first-child,.yui-toolbar-container .yui-button .first-child a{height:100%;width:100%;overflow:hidden;font-size:0;}.yui-toolbar-container .yui-button-disabled{cursor:default;}.yui-toolbar-container .yui-button-disabled .yui-toolbar-icon{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button-disabled .up,.yui-toolbar-container .yui-button-disabled .down{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button a{overflow:hidden;}.yui-toolbar-container .yui-toolbar-select .first-child a{cursor:pointer;}.yui-toolbar-fontname-arial{font-family:Arial;}.yui-toolbar-fontname-arial-black{font-family:Arial Black;}.yui-toolbar-fontname-comic-sans-ms{font-family:Comic Sans MS;}.yui-toolbar-fontname-courier-new{font-family:Courier New;}.yui-toolbar-fontname-times-new-roman{font-family:Times New Roman;}.yui-toolbar-fontname-verdana{font-family:Verdana;}.yui-toolbar-fontname-impact{font-family:Impact;}.yui-toolbar-fontname-lucida-console{font-family:Lucida Console;}.yui-toolbar-fontname-tahoma{font-family:Tahoma;}.yui-toolbar-fontname-trebuchet-ms{font-family:Trebuchet MS;}.yui-toolbar-container .yui-toolbar-spinbutton{position:relative;}.yui-toolbar-container .yui-toolbar-spinbutton .first-child a{z-index:0;opacity:1;}.yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-toolbar-container .yui-toolbar-spinbutton a.down{position:absolute;display:block;right:0;cursor:pointer;z-index:1;padding:0;margin:0;}.yui-toolbar-container .yui-overlay{position:absolute;}.yui-toolbar-container .yui-overlay ul li{margin:0;list-style-type:none;}.yui-toolbar-container{z-index:1;}.yui-editor-container .yui-editor-editable-container{position:relative;z-index:0;width:100%;}.yui-editor-container .yui-editor-masked{background-color:#CCC;height:100%;width:100%;position:absolute;top:0;left:0;opacity:.5;filter:alpha(opacity=50);}.yui-editor-container iframe{border:0;padding:0;margin:0;zoom:1;display:block;}.yui-editor-container .yui-editor-editable{padding:0;margin:0;}.yui-editor-container .dompath{font-size:85%;}.yui-editor-panel .hd{text-align:left;position:relative;}.yui-editor-panel .hd h3{font-weight:bold;padding:.25em 0 .25em .25em;margin:0;}.yui-editor-panel .bd{width:100%;zoom:1;position:relative;}.yui-editor-panel .bd div.yui-editor-body-cont{padding:.25em .1em;zoom:1;}.yui-editor-panel .bd .gecko form{overflow:auto;}.yui-editor-panel .bd div.yui-editor-body-cont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-editor-panel .ft{text-align:right;width:99%;float:left;clear:both;}.yui-editor-panel .ft span.tip{display:block;position:relative;padding:.5em .5em .5em 23px;text-align:left;zoom:1;}.yui-editor-panel label{clear:both;float:left;padding:0;width:100%;text-align:left;zoom:1;}.yui-editor-panel .gecko label{overflow:auto;}.yui-editor-panel label strong{float:left;width:6em;}.yui-editor-panel .removeLink{width:80%;text-align:right;}.yui-editor-panel label input{margin-left:.25em;float:left;}.yui-editor-panel .yui-toolbar-group{margin-bottom:.75em;}.yui-editor-panel .height-width{float:left;}.yui-editor-panel .height-width span{font-style:italic;display:block;float:left;overflow:visible;}.yui-editor-panel .height-width span.info{font-size:70%;margin-top:3px;float:none;}
+.yui-editor-panel .yui-toolbar-bordersize,.yui-editor-panel .yui-toolbar-bordertype{font-size:75%;}.yui-editor-panel .yui-toolbar-container span.yui-toolbar-separator{border:none;}.yui-editor-panel .yui-toolbar-bordersize span a span,.yui-editor-panel .yui-toolbar-bordertype span a span{display:block;height:8px;left:4px;position:absolute;top:3px;_top:-5px;width:24px;text-indent:52px;font-size:0;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-solid{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dotted{border-bottom:1px dotted black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dashed{border-bottom:1px dashed black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-0{*top:0;text-indent:0;font-size:75%;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-1{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-2{border-bottom:2px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-3{top:2px;*top:-5px;border-bottom:3px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-4{top:1px;*top:-5px;border-bottom:4px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-5{top:1px;*top:-5px;border-bottom:5px solid black;}.yui-toolbar-container .yui-toolbar-bordersize-menu,.yui-toolbar-container .yui-toolbar-bordertype-menu{width:95px!important;}.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel,.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel:hover{margin:0 3px 7px 17px;}.yui-toolbar-bordersize-menu .yuimenuitemlabel .checkedindicator,.yui-toolbar-bordertype-menu .yuimenuitemlabel .checkedindicator{position:absolute;left:-12px;*top:14px;*left:0;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-1 a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-2 a{border-bottom:2px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-3 a{border-bottom:3px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-4 a{border-bottom:4px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-5 a{border-bottom:5px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-solid a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dashed a{border-bottom:1px dashed black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dotted a{border-bottom:1px dotted black;height:14px;}h2.yui-editor-skipheader,h3.yui-editor-skipheader{height:0;margin:0;padding:0;border:none;width:0;overflow:hidden;position:absolute;}.yui-toolbar-colors{width:133px;zoom:1;display:none;z-index:100;overflow:hidden;}.yui-toolbar-colors:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors a{height:9px;width:9px;float:left;display:block;overflow:hidden;text-indent:999px;margin:0;cursor:pointer;border:1px solid #F6F7EE;}.yui-toolbar-colors a:hover{border:1px solid black;}.yui-color-button-menu{overflow:visible;background-color:transparent;}.yui-toolbar-colors span{position:relative;display:block;padding:3px;overflow:hidden;float:left;width:100%;zoom:1;}.yui-toolbar-colors span:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors span em{height:35px;width:30px;float:left;display:block;overflow:hidden;text-indent:999px;margin:.75px;border:1px solid black;}.yui-toolbar-colors span strong{font-weight:normal;padding-left:3px;display:block;font-size:85%;float:left;width:65%;}.yui-toolbar-group-undoredo h3,.yui-toolbar-group-insertitem h3,.yui-toolbar-group-indentlist h3{width:68px;}.yui-toolbar-group-indentlist2 h3{width:122px;}.yui-toolbar-group-alignment h3{width:130px;}.yui-skin-sam .yui-editor-container{border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container{zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar{background:url(sprite.png) repeat-x 0 -200px;position:relative;}.yui-skin-sam .yui-editor-container .draggable .yui-toolbar-titlebar{cursor:move;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar h2{color:#000;font-weight:bold;margin:0;padding:.3em 1em;font-size:100%;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-group h3{color:#808080;font-size:75%;margin:1em 0 0;padding-bottom:0;padding-left:.25em;text-align:left;}.yui-toolbar-container span.yui-toolbar-separator{border:none;text-indent:33px;overflow:hidden;margin:0 .25em;}.yui-skin-sam .yui-toolbar-container{background-color:#F2F2F2;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subcont{padding:0 1em .35em;border-bottom:1px solid #808080;}.yui-skin-sam .yui-toolbar-container-collapsed .yui-toolbar-titlebar{border-bottom:1px solid #808080;}.yui-skin-sam .yui-editor-container .visible .yui-menu-shadow,.yui-skin-sam .yui-editor-panel .visible .yui-menu-shadow{display:none;}.yui-skin-sam .yui-editor-container ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-container ul li{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-toolbar-group ul li.yui-toolbar-groupitem{float:left;}.yui-skin-sam .yui-editor-container .dompath{background-color:#F2F2F2;border-top:1px solid #808080;color:#999;text-align:left;padding:.25em;}.yui-skin-sam .yui-toolbar-container .collapse{background:url(sprite.png) no-repeat 0 -400px;}.yui-skin-sam .yui-toolbar-container .collapsed{background:url(sprite.png) no-repeat 0 -350px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar span.collapse{cursor:pointer;position:absolute;top:4px;right:2px;display:block;overflow:hidden;height:15px;width:15px;text-indent:9999px;}
+.yui-skin-sam .yui-toolbar-container .yui-push-button,.yui-skin-sam .yui-toolbar-container .yui-color-button,.yui-skin-sam .yui-toolbar-container .yui-menu-button{background:url(sprite.png) repeat-x 0 0;position:relative;display:block;height:22px;width:30px;_font-size:0;margin:0;border-color:#808080;color:#f2f2f2;border-style:solid;border-width:1px 0;zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-push-button a,.yui-skin-sam .yui-toolbar-container .yui-color-button a,.yui-skin-sam .yui-toolbar-container .yui-menu-button a{padding-left:35px;height:20px;text-decoration:none;font-size:0;line-height:2;display:block;color:#000;overflow:hidden;white-space:nowrap;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-push-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button .first-child{border-color:#808080;border-style:solid;border-width:0 1px;margin:0 -1px;display:block;position:relative;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-button .first-child{*left:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-fontname{width:135px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-heading{width:92px;}.yui-skin-sam .yui-toolbar-container .yui-button-hover{background:url(sprite.png) repeat-x 0 -1300px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-button-selected{background:url(sprite.png) repeat-x 0 -1700px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels .yui-toolbar-group{margin-top:.75em;}.yui-skin-sam .yui-toolbar-container .yui-push-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-color-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-menu-button span.yui-toolbar-icon{display:block;position:absolute;top:2px;height:18px;width:18px;overflow:hidden;background:url(editor-sprite.gif) no-repeat 30px 30px;}.yui-skin-sam .yui-toolbar-container .yui-button-selected span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-button-hover span.yui-toolbar-icon{background-image:url(editor-sprite-active.gif);}.yui-skin-sam .yui-toolbar-container .visible .yuimenuitemlabel{cursor:pointer;color:#000;*position:relative;}.yui-skin-sam .yui-toolbar-container .yui-button-menu{background-color:#fff;}.yui-skin-sam .yui-toolbar-container .yui-button-menu .yui-menu-body-scrolled{position:relative;}.yui-skin-sam div.yuimenu li.selected{background-color:#B3D4FF;}.yui-skin-sam div.yuimenu li.selected a.selected{color:#000;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bold span.yui-toolbar-icon{background-position:0 0;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-strikethrough span.yui-toolbar-icon{background-position:0 -108px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-italic span.yui-toolbar-icon{background-position:0 -36px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-undo span.yui-toolbar-icon{background-position:0 -1326px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-redo span.yui-toolbar-icon{background-position:0 -1355px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-underline span.yui-toolbar-icon{background-position:0 -72px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subscript span.yui-toolbar-icon{background-position:0 -180px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-superscript span.yui-toolbar-icon{background-position:0 -144px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-forecolor span.yui-toolbar-icon{background-position:0 -216px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-backcolor span.yui-toolbar-icon{background-position:0 -288px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyleft span.yui-toolbar-icon{background-position:0 -324px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifycenter span.yui-toolbar-icon{background-position:0 -360px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyright span.yui-toolbar-icon{background-position:0 -396px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyfull span.yui-toolbar-icon{background-position:0 -432px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-indent span.yui-toolbar-icon{background-position:0 -720px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-outdent span.yui-toolbar-icon{background-position:0 -684px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-createlink span.yui-toolbar-icon{background-position:0 -792px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertimage span.yui-toolbar-icon{background-position:1px -756px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-left span.yui-toolbar-icon{background-position:0 -972px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-right span.yui-toolbar-icon{background-position:0 -936px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-inline span.yui-toolbar-icon{background-position:0 -900px;left:5px;}
+.yui-skin-sam .yui-toolbar-container .yui-toolbar-block span.yui-toolbar-icon{background-position:0 -864px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bordercolor span.yui-toolbar-icon{background-position:0 -252px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-removeformat span.yui-toolbar-icon{background-position:0 -1080px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-hiddenelements span.yui-toolbar-icon{background-position:0 -1044px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertunorderedlist span.yui-toolbar-icon{background-position:0 -468px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertorderedlist span.yui-toolbar-icon{background-position:0 -504px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child{width:35px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child a{padding-left:2px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton span.yui-toolbar-icon{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{right:2px;background:url(editor-sprite.gif) no-repeat 0 -1222px;overflow:hidden;height:6px;width:7px;min-height:0;padding:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up{top:2px;background-position:0 -1222px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{bottom:2px;background-position:0 -1187px;}.yui-skin-sam .yui-toolbar-container select{height:22px;border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select .first-child a{padding-left:5px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select span.yui-toolbar-icon{background:url(editor-sprite.gif) no-repeat 0 -1144px;overflow:hidden;right:-2px;top:0;height:20px;}.yui-skin-sam .yui-editor-panel .yui-color-button-menu .bd{background-color:transparent;border:none;width:135px;}.yui-skin-sam .yui-color-button-menu .yui-toolbar-colors{border:1px solid #808080;}.yui-skin-sam .yui-editor-panel{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;position:absolute;}.yui-skin-sam .yui-editor-panel .hd{margin:10px 0 0;padding:0;border:none;}.yui-skin-sam .yui-editor-panel .hd h3{color:#000;border:1px solid #808080;background:url(sprite.png) repeat-x 0 -200px;width:99%;position:relative;margin:0;padding:3px 0 0 0;font-size:93%;text-indent:5px;height:20px;}.yui-skin-sam .yui-editor-panel .bd{background-color:#F2F2F2;border-left:1px solid #808080;border-right:1px solid #808080;width:99%;margin:0;padding:0;overflow:visible;}.yui-skin-sam .yui-editor-panel ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-panel ul li{margin:0;padding:0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .yui-toolbar-subcont{padding:0;border:none;margin-top:.35em;}.yui-skin-sam .yui-editor-panel .yui-toolbar-bordersize,.yui-skin-sam .yui-editor-panel .yui-toolbar-bordertype{width:50px;}.yui-skin-sam .yui-editor-panel label{display:block;float:none;padding:4px 0;margin-bottom:7px;}.yui-skin-sam .yui-editor-panel label strong{font-weight:normal;font-size:93%;text-align:right;padding-top:2px;}.yui-skin-sam .yui-editor-panel label input{width:75%;}.yui-skin-sam .yui-editor-panel .createlink_target,.yui-skin-sam .yui-editor-panel .insertimage_target{width:auto;margin-right:5px;}.yui-skin-sam .yui-editor-panel .removeLink{width:98%;}.yui-skin-sam .yui-editor-panel label input.warning{background-color:#FFEE69;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group h3{color:#000;float:left;font-weight:normal;font-size:93%;margin:5px 0 0 0;padding:0 3px 0 0;text-align:right;}.yui-skin-sam .yui-editor-panel .height-width h3{margin:3px 0 0 10px;}.yui-skin-sam .yui-editor-panel .height-width{margin:3px 0 0 35px;*margin-left:14px;width:42%;*width:44%;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-border{width:190px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-border{width:210px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding{width:203px;_width:198px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-padding{width:172px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding h3{margin-left:25px;*margin-left:12px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-textflow{width:182px;}.yui-skin-sam .yui-editor-panel .hd{background:none;}.yui-skin-sam .yui-editor-panel .ft{background-color:#F2F2F2;border:1px solid #808080;border-top:none;padding:0;margin:0 0 2px 0;}.yui-skin-sam .yui-editor-panel .hd span.close{background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;display:block;height:16px;overflow:hidden;position:absolute;right:5px;text-indent:500px;top:2px;width:26px;}.yui-skin-sam .yui-editor-panel .ft span.tip{background-color:#EDF5FF;border-top:1px solid #808080;font-size:85%;}.yui-skin-sam .yui-editor-panel .ft span.tip strong{display:block;float:left;margin:0 2px 8px 0;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon{background:url(editor-sprite.gif) no-repeat 0 -1260px;display:block;height:20px;left:2px;position:absolute;top:8px;width:20px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-info{background-position:2px -1260px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-warn{background-position:2px -1296px;}.yui-skin-sam .yui-editor-panel .hd span.knob{position:absolute;height:10px;width:28px;top:-10px;left:25px;text-indent:9999px;overflow:hidden;background:url(editor-knob.gif) no-repeat 0 0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container{float:left;width:100%;background-image:none;border:none;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .bd{background-color:#fff;}.yui-editor-blankimage{background-image:url(blankimage.png);}.yui-skin-sam .yui-editor-container .yui-resize-handle-br{height:11px;width:11px;background-position:-20px -60px;background-color:transparent;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/header_background.png b/lib/yui/2.8.0r4/assets/skins/sam/header_background.png
new file mode 100644
index 0000000000..3ef7909d3e
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/header_background.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/hue_bg.png b/lib/yui/2.8.0r4/assets/skins/sam/hue_bg.png
new file mode 100644
index 0000000000..d9bcdeb5c4
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/hue_bg.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/imagecropper.css b/lib/yui/2.8.0r4/assets/skins/sam/imagecropper.css
new file mode 100644
index 0000000000..0e8d36f62c
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/imagecropper.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-crop{position:relative;}.yui-crop .yui-crop-mask{position:absolute;top:0;left:0;height:100%;width:100%;}.yui-crop .yui-resize{position:absolute;top:10px;left:10px;border:0;}.yui-crop .yui-crop-resize-mask{position:absolute;top:0;left:0;height:100%;width:100%;background-position:-10px -10px;overflow:hidden;}.yui-skin-sam .yui-crop .yui-crop-mask{background-color:#000;opacity:.5;filter:alpha(opacity=50);}.yui-skin-sam .yui-crop .yui-resize{border:1px dashed #fff;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/layout.css b/lib/yui/2.8.0r4/assets/skins/sam/layout.css
new file mode 100644
index 0000000000..aa5545f155
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/layout.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-layout-loading{visibility:hidden;}body.yui-layout{overflow:hidden;position:relative;padding:0;margin:0;}.yui-layout-doc{position:relative;overflow:hidden;padding:0;margin:0;}.yui-layout-unit{height:50px;width:50px;padding:0;margin:0;float:none;z-index:0;}.yui-layout-unit-top{position:absolute;top:0;left:0;width:100%;}.yui-layout-unit-left{position:absolute;top:0;left:0;}.yui-layout-unit-right{position:absolute;top:0;right:0;}.yui-layout-unit-bottom{position:absolute;bottom:0;left:0;width:100%;}.yui-layout-unit-center{position:absolute;top:0;left:0;width:100%;}.yui-layout div.yui-layout-hd{position:absolute;top:0;left:0;zoom:1;width:100%;}.yui-layout div.yui-layout-bd{position:absolute;top:0;left:0;zoom:1;width:100%;}.yui-layout .yui-layout-noscroll div.yui-layout-bd{overflow:hidden;}.yui-layout .yui-layout-scroll div.yui-layout-bd{overflow:auto;}.yui-layout div.yui-layout-ft{position:absolute;bottom:0;left:0;width:100%;zoom:1;}.yui-layout .yui-layout-unit div.yui-layout-hd h2{text-align:left;}.yui-layout .yui-layout-unit div.yui-layout-hd .collapse{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-unit div.yui-layout-hd .close{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-unit div.yui-layout-hd .collapse-close{right:25px;}.yui-layout .yui-layout-clip{position:absolute;height:20px;background-color:#c0c0c0;display:none;}.yui-layout .yui-layout-clip .collapse{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-wrap{height:100%;width:100%;position:absolute;left:0;}.yui-skin-sam .yui-layout .yui-resize-proxy{border:none;font-size:0;margin:0;padding:0;}.yui-skin-sam .yui-layout .yui-resize-resizing .yui-resize-handle{display:none;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy div{position:absolute;border:1px solid #808080;background-color:#EDF5FF;}.yui-skin-sam .yui-layout .yui-resize .yui-resize-handle-active{zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-l{width:5px;height:100%;top:0;left:0;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-r{width:5px;top:0;right:0;height:100%;position:absolute;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-b{width:100%;bottom:0;left:0;height:5px;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-t{width:100%;top:0;left:0;height:5px;}.yui-skin-sam .yui-layout .yui-layout-unit-left div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -160px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-left .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -140px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-right div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -200px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-right .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -120px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-top div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -220px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-top .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -240px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-bottom div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -260px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-bottom .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -180px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd .close{background:transparent url(layout_sprite.png) no-repeat -20px -100px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-hd{background:url(sprite.png) repeat-x 0 -1400px;border:1px solid #808080;}.yui-skin-sam .yui-layout{background-color:#EDF5FF;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd h2{font-weight:bold;color:#fff;padding:3px;margin:0;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd{border:1px solid #808080;border-bottom:none;border-top:none;*border-bottom-width:0;*border-top-width:0;background-color:#f2f2f2;text-align:left;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-noft{border-bottom:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-nohd{border-top:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip{position:absolute;height:20px;background-color:#EDF5FF;display:none;border:1px solid #808080;}.yui-skin-sam .yui-layout div.yui-layout-ft{border:1px solid #808080;border-top:none;*border-top-width:0;background-color:#f2f2f2;}.yui-skin-sam .yui-layout-unit .yui-resize-handle{background-color:transparent;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-r{right:0;top:0;background-image:none;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-l{left:0;top:0;background-image:none;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-b{right:0;bottom:0;background-image:none;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-t{right:0;top:0;background-image:none;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-r .yui-layout-resize-knob,.yui-skin-sam .yui-layout-unit .yui-resize-handle-l .yui-layout-resize-knob{position:absolute;height:16px;width:6px;top:45%;left:0;display:block;background:transparent url(layout_sprite.png) no-repeat 0 -5px;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-t .yui-layout-resize-knob,.yui-skin-sam .yui-layout-unit .yui-resize-handle-b .yui-layout-resize-knob{position:absolute;height:6px;width:16px;left:45%;background:transparent url(layout_sprite.png) no-repeat -20px 0;zoom:1;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/layout_sprite.png b/lib/yui/2.8.0r4/assets/skins/sam/layout_sprite.png
new file mode 100644
index 0000000000..d6fce3c7a5
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/layout_sprite.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/loading.gif b/lib/yui/2.8.0r4/assets/skins/sam/loading.gif
new file mode 100644
index 0000000000..0bbf3bc0c0
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/loading.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/logger.css b/lib/yui/2.8.0r4/assets/skins/sam/logger.css
new file mode 100644
index 0000000000..491b9c09fe
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/logger.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-log{padding:1em;width:31em;background-color:#AAA;color:#000;border:1px solid black;font-family:monospace;font-size:77%;text-align:left;z-index:9000;}.yui-skin-sam .yui-log-container{position:absolute;top:1em;right:1em;}.yui-skin-sam .yui-log input{margin:0;padding:0;font-family:arial;font-size:100%;font-weight:normal;}.yui-skin-sam .yui-log .yui-log-btns{position:relative;float:right;bottom:.25em;}.yui-skin-sam .yui-log .yui-log-hd{margin-top:1em;padding:.5em;background-color:#575757;}.yui-skin-sam .yui-log .yui-log-hd h4{margin:0;padding:0;font-size:108%;font-weight:bold;color:#FFF;}.yui-skin-sam .yui-log .yui-log-bd{width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}.yui-skin-sam .yui-log p{margin:1px;padding:.1em;}.yui-skin-sam .yui-log pre{margin:0;padding:0;}.yui-skin-sam .yui-log pre.yui-log-verbose{white-space:pre-wrap;white-space:-moz-pre-wrap!important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;}.yui-skin-sam .yui-log .yui-log-ft{margin-top:.5em;}.yui-skin-sam .yui-log .yui-log-ft .yui-log-sourcefilters{width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}.yui-skin-sam .yui-log .yui-log-filtergrp{margin-right:.5em;}.yui-skin-sam .yui-log .info{background-color:#A7CC25;}.yui-skin-sam .yui-log .warn{background-color:#F58516;}.yui-skin-sam .yui-log .error{background-color:#E32F0B;}.yui-skin-sam .yui-log .time{background-color:#A6C9D7;}.yui-skin-sam .yui-log .window{background-color:#F2E886;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow-disabled.png b/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow-disabled.png
new file mode 100644
index 0000000000..8cef2abb31
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow-disabled.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow.png b/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow.png
new file mode 100644
index 0000000000..f03dfee4e4
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menu-button-arrow.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menu.css b/lib/yui/2.8.0r4/assets/skins/sam/menu.css
new file mode 100644
index 0000000000..7ff03a14d1
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/menu.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yuimenu{top:-999em;left:-999em;}.yuimenubar{position:static;}.yuimenu .yuimenu,.yuimenubar .yuimenu{position:absolute;}.yuimenubar li,.yuimenu li{list-style-type:none;}.yuimenubar ul,.yuimenu ul,.yuimenubar li,.yuimenu li,.yuimenu h6,.yuimenubar h6{margin:0;padding:0;}.yuimenuitemlabel,.yuimenubaritemlabel{text-align:left;white-space:nowrap;}.yuimenubar ul{*zoom:1;}.yuimenubar .yuimenu ul{*zoom:normal;}.yuimenubar>.bd>ul:after{content:".";display:block;clear:both;visibility:hidden;height:0;line-height:0;}.yuimenubaritem{float:left;}.yuimenubaritemlabel,.yuimenuitemlabel{display:block;}.yuimenuitemlabel .helptext{font-style:normal;display:block;margin:-1em 0 0 10em;}.yui-menu-shadow{position:absolute;visibility:hidden;z-index:-1;}.yui-menu-shadow-visible{top:2px;right:-3px;left:-3px;bottom:-3px;visibility:visible;}.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.yuimenu.show-scrollbars,.yuimenubar.show-scrollbars{overflow:visible;}.yuimenu.hide-scrollbars .yui-menu-shadow,.yuimenubar.hide-scrollbars .yui-menu-shadow{overflow:hidden;}.yuimenu.show-scrollbars .yui-menu-shadow,.yuimenubar.show-scrollbars .yui-menu-shadow{overflow:auto;}.yui-overlay.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .yuimenubar{font-size:93%;line-height:2;*line-height:1.9;border:solid 1px #808080;background:url(sprite.png) repeat-x 0 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritem{border-right:solid 1px #ccc;}.yui-skin-sam .yuimenubaritemlabel{padding:0 10px;color:#000;text-decoration:none;cursor:default;border-style:solid;border-color:#808080;border-width:1px 0;*position:relative;margin:-1px 0;}.yui-skin-sam .yuimenubaritemlabel:visited{color:#000;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel{padding-right:20px;*display:inline-block;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu{background:url(menubaritem_submenuindicator.png) right center no-repeat;}.yui-skin-sam .yuimenubaritem-selected{background:url(sprite.png) repeat-x 0 -1700px;}.yui-skin-sam .yuimenubaritemlabel-selected{border-color:#7D98B8;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-selected{border-left-width:1px;margin-left:-1px;*left:-1px;}.yui-skin-sam .yuimenubaritemlabel-disabled,.yui-skin-sam .yuimenubaritemlabel-disabled:visited{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu-disabled{background-image:url(menubaritem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenu{font-size:93%;line-height:1.5;*line-height:1.45;}.yui-skin-sam .yuimenubar .yuimenu,.yui-skin-sam .yuimenu .yuimenu{font-size:100%;}.yui-skin-sam .yuimenu .bd{*zoom:1;_zoom:normal;border:solid 1px #808080;background-color:#fff;}.yui-skin-sam .yuimenu .yuimenu .bd{*zoom:normal;}.yui-skin-sam .yuimenu ul{padding:3px 0;border-width:1px 0 0 0;border-color:#ccc;border-style:solid;}.yui-skin-sam .yuimenu ul.first-of-type{border-width:0;}.yui-skin-sam .yuimenu h6{font-weight:bold;border-style:solid;border-color:#ccc;border-width:1px 0 0 0;color:#a4a4a4;padding:3px 10px 0 10px;}.yui-skin-sam .yuimenu ul.hastitle,.yui-skin-sam .yuimenu h6.first-of-type{border-width:0;}.yui-skin-sam .yuimenu .yui-menu-body-scrolled{border-color:#ccc #808080;overflow:hidden;}.yui-skin-sam .yuimenu .topscrollbar,.yui-skin-sam .yuimenu .bottomscrollbar{height:16px;border:solid 1px #808080;background:#fff url(sprite.png) no-repeat 0 0;}.yui-skin-sam .yuimenu .topscrollbar{border-bottom-width:0;background-position:center -950px;}.yui-skin-sam .yuimenu .topscrollbar_disabled{background-position:center -975px;}.yui-skin-sam .yuimenu .bottomscrollbar{border-top-width:0;background-position:center -850px;}.yui-skin-sam .yuimenu .bottomscrollbar_disabled{background-position:center -875px;}.yui-skin-sam .yuimenuitem{_border-bottom:solid 1px #fff;}.yui-skin-sam .yuimenuitemlabel{padding:0 20px;color:#000;text-decoration:none;cursor:default;}.yui-skin-sam .yuimenuitemlabel:visited{color:#000;}.yui-skin-sam .yuimenuitemlabel .helptext{margin-top:-1.5em;*margin-top:-1.45em;}.yui-skin-sam .yuimenuitem-hassubmenu{background-image:url(menuitem_submenuindicator.png);background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yuimenuitem-checked{background-image:url(menuitem_checkbox.png);background-position:left center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-shadow-visible{background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yuimenuitem-selected{background-color:#B3D4FF;}.yui-skin-sam .yuimenuitemlabel-disabled,.yui-skin-sam .yuimenuitemlabel-disabled:visited{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenuitem-hassubmenu-disabled{background-image:url(menuitem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenuitem-checked-disabled{background-image:url(menuitem_checkbox_disabled.png);}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator.png b/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator.png
new file mode 100644
index 0000000000..030941c9cf
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator_disabled.png b/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator_disabled.png
new file mode 100644
index 0000000000..6c16122305
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menubaritem_submenuindicator_disabled.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox.png b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox.png
new file mode 100644
index 0000000000..1437a4f4b9
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox_disabled.png b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox_disabled.png
new file mode 100644
index 0000000000..5d5b9985e3
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_checkbox_disabled.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator.png b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator.png
new file mode 100644
index 0000000000..ea4f660291
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator_disabled.png b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator_disabled.png
new file mode 100644
index 0000000000..427d60a38a
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/menuitem_submenuindicator_disabled.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/paginator.css b/lib/yui/2.8.0r4/assets/skins/sam/paginator.css
new file mode 100644
index 0000000000..31f0d3369b
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/paginator.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-pg-container{display:block;margin:6px 0;white-space:nowrap;}.yui-skin-sam .yui-pg-first,.yui-skin-sam .yui-pg-previous,.yui-skin-sam .yui-pg-next,.yui-skin-sam .yui-pg-last,.yui-skin-sam .yui-pg-current,.yui-skin-sam .yui-pg-pages,.yui-skin-sam .yui-pg-page{display:inline-block;font-family:arial,helvetica,clean,sans-serif;padding:3px 6px;zoom:1;}.yui-skin-sam .yui-pg-pages{padding:0;}.yui-skin-sam .yui-pg-current{padding:3px 0;}.yui-skin-sam a.yui-pg-first:link,.yui-skin-sam a.yui-pg-first:visited,.yui-skin-sam a.yui-pg-first:active,.yui-skin-sam a.yui-pg-first:hover,.yui-skin-sam a.yui-pg-previous:link,.yui-skin-sam a.yui-pg-previous:visited,.yui-skin-sam a.yui-pg-previous:active,.yui-skin-sam a.yui-pg-previous:hover,.yui-skin-sam a.yui-pg-next:link,.yui-skin-sam a.yui-pg-next:visited,.yui-skin-sam a.yui-pg-next:active,.yui-skin-sam a.yui-pg-next:hover,.yui-skin-sam a.yui-pg-last:link,.yui-skin-sam a.yui-pg-last:visited,.yui-skin-sam a.yui-pg-last:active,.yui-skin-sam a.yui-pg-last:hover,.yui-skin-sam a.yui-pg-page:link,.yui-skin-sam a.yui-pg-page:visited,.yui-skin-sam a.yui-pg-page:active,.yui-skin-sam a.yui-pg-page:hover{color:#06c;text-decoration:underline;outline:0;}.yui-skin-sam span.yui-pg-first,.yui-skin-sam span.yui-pg-previous,.yui-skin-sam span.yui-pg-next,.yui-skin-sam span.yui-pg-last{color:#a6a6a6;}.yui-skin-sam .yui-pg-page{background-color:#fff;border:1px solid #CBCBCB;padding:2px 6px;text-decoration:none;}.yui-skin-sam .yui-pg-current-page{background-color:transparent;border:none;font-weight:bold;padding:3px 6px;}.yui-skin-sam .yui-pg-page{margin-left:1px;margin-right:1px;}.yui-skin-sam .yui-pg-first,.yui-skin-sam .yui-pg-previous{padding-left:0;}.yui-skin-sam .yui-pg-next,.yui-skin-sam .yui-pg-last{padding-right:0;}.yui-skin-sam .yui-pg-current,.yui-skin-sam .yui-pg-rpp-options{margin-left:1em;margin-right:1em;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/picker_mask.png b/lib/yui/2.8.0r4/assets/skins/sam/picker_mask.png
new file mode 100644
index 0000000000..f8d91932b3
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/picker_mask.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/profilerviewer.css b/lib/yui/2.8.0r4/assets/skins/sam/profilerviewer.css
new file mode 100644
index 0000000000..d1e7832276
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/profilerviewer.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-pv{background-color:#4a4a4a;font:arial;position:relative;width:99%;z-index:1000;margin-bottom:1em;overflow:hidden;}.yui-skin-sam .yui-pv .hd{background:url(header_background.png) repeat-x;min-height:30px;overflow:hidden;zoom:1;padding:2px 0;}.yui-skin-sam .yui-pv .hd h4{padding:8px 10px;margin:0;font:bold 14px arial;color:#fff;}.yui-skin-sam .yui-pv .hd a{background:#3f6bc3;font:bold 11px arial;color:#fff;padding:4px;margin:3px 10px 0 0;border:1px solid #3f567d;cursor:pointer;display:block;float:right;}.yui-skin-sam .yui-pv .hd span{display:none;}.yui-skin-sam .yui-pv .hd span.yui-pv-busy{height:18px;width:18px;background:url(wait.gif) no-repeat;overflow:hidden;display:block;float:right;margin:4px 10px 0 0;}.yui-skin-sam .yui-pv .hd:after,.yui-pv .bd:after,.yui-skin-sam .yui-pv-chartlegend dl:after{content:'.';visibility:hidden;clear:left;height:0;display:block;}.yui-skin-sam .yui-pv .bd{position:relative;zoom:1;overflow-x:auto;overflow-y:hidden;}.yui-skin-sam .yui-pv .yui-pv-table{padding:0 10px;margin:5px 0 10px 0;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-bd td{color:#eeee5c;font:12px arial;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd{background:#929292;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even{background:#58637a;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even td.yui-dt-desc{background:#384970;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd td.yui-dt-desc{background:#6F6E6E;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th{background-image:none;background:#2E2D2D;}.yui-skin-sam .yui-pv th.yui-dt-asc .yui-dt-liner{background:transparent url(asc.gif) no-repeat scroll right center;}.yui-skin-sam .yui-pv th.yui-dt-desc .yui-dt-liner{background:transparent url(desc.gif) no-repeat scroll right center;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th a{color:#fff;font:bold 12px arial;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th.yui-dt-desc{background:#333;}.yui-skin-sam .yui-pv-chartcontainer{padding:0 10px;}.yui-skin-sam .yui-pv-chart{height:250px;clear:right;margin:5px 0 0 0;color:#fff;}.yui-skin-sam .yui-pv-chartlegend div{float:right;margin:0 0 0 10px;_width:250px;}.yui-skin-sam .yui-pv-chartlegend dl{border:1px solid #999;padding:.2em 0 .2em .5em;zoom:1;margin:5px 0;}.yui-skin-sam .yui-pv-chartlegend dt{float:left;display:block;height:.7em;width:.7em;padding:0;}.yui-skin-sam .yui-pv-chartlegend dd{float:left;display:block;color:#fff;margin:0 1em 0 .5em;padding:0;font:11px arial;}.yui-skin-sam .yui-pv-minimized{height:35px;}.yui-skin-sam .yui-pv-minimized .bd{top:-3000px;}.yui-skin-sam .yui-pv-minimized .hd a.yui-pv-refresh{display:none;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/progressbar.css b/lib/yui/2.8.0r4/assets/skins/sam/progressbar.css
new file mode 100644
index 0000000000..d71e6e852f
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/progressbar.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-pb-bar,.yui-pb-mask{width:100%;height:100%;}.yui-pb{position:relative;top:0;left:0;width:200px;height:20px;padding:0;border:none;margin:0;text-align:left;}.yui-pb-mask{position:absolute;top:0;left:0;z-index:2;}.yui-pb-mask div{width:50%;height:50%;background-repeat:no-repeat;padding:0;position:absolute;}.yui-pb-tl{background-position:top left;}.yui-pb-tr{background-position:top right;left:50%;}.yui-pb-bl{background-position:bottom left;top:50%;}.yui-pb-br{background-position:bottom right;left:50%;top:50%;}.yui-pb-bar{margin:0;position:absolute;left:0;top:0;z-index:1;}.yui-pb-ltr .yui-pb-bar{_position:static;}.yui-pb-rtl .yui-pb-bar{background-position:right;}.yui-pb-btt .yui-pb-bar{background-position:left bottom;}.yui-pb-bar{background-color:blue;}.yui-pb{border:thin solid #808080;}.yui-skin-sam .yui-pb{background-color:transparent;border:solid #808080;border-width:1px 0;}.yui-skin-sam .yui-pb-rtl,.yui-skin-sam .yui-pb-ltr{background-image:url(back-h.png);background-repeat:repeat-x;}.yui-skin-sam .yui-pb-ttb,.yui-skin-sam .yui-pb-btt{background-image:url(back-v.png);background-repeat:repeat-y;}.yui-skin-sam .yui-pb-bar{background-color:transparent;}.yui-skin-sam .yui-pb-ltr .yui-pb-bar,.yui-skin-sam .yui-pb-rtl .yui-pb-bar{background-image:url(bar-h.png);background-repeat:repeat-x;}.yui-skin-sam .yui-pb-ttb .yui-pb-bar,.yui-skin-sam .yui-pb-btt .yui-pb-bar{background-image:url(bar-v.png);background-repeat:repeat-y;}.yui-skin-sam .yui-pb-mask{border:solid #808080;border-width:0 1px;margin:0 -1px;}.yui-skin-sam .yui-pb-caption{color:#000;text-align:center;margin:0 auto;}.yui-skin-sam .yui-pb-range{color:#a6a6a6;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/resize.css b/lib/yui/2.8.0r4/assets/skins/sam/resize.css
new file mode 100644
index 0000000000..941361c7d8
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/resize.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-resize{position:relative;zoom:1;z-index:0;}.yui-resize-wrap{zoom:1;}.yui-draggable{cursor:move;}.yui-resize .yui-resize-handle{position:absolute;z-index:1;font-size:0;margin:0;padding:0;zoom:1;height:1px;width:1px;}.yui-resize .yui-resize-handle-br{height:5px;width:5px;bottom:0;right:0;cursor:se-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-bl{height:5px;width:5px;bottom:0;left:0;cursor:sw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tl{height:5px;width:5px;top:0;left:0;cursor:nw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tr{height:5px;width:5px;top:0;right:0;cursor:ne-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-r{width:5px;height:100%;top:0;right:0;cursor:e-resize;zoom:1;}.yui-resize .yui-resize-handle-l{height:100%;width:5px;top:0;left:0;cursor:w-resize;zoom:1;}.yui-resize .yui-resize-handle-b{width:100%;height:5px;bottom:0;right:0;cursor:s-resize;zoom:1;}.yui-resize .yui-resize-handle-t{width:100%;height:5px;top:0;right:0;cursor:n-resize;zoom:1;}.yui-resize-proxy{position:absolute;border:1px dashed #000;visibility:hidden;z-index:1000;}.yui-resize-hover .yui-resize-handle,.yui-resize-hidden .yui-resize-handle{opacity:0;filter:alpha(opacity=0);}.yui-resize-ghost{opacity:.5;filter:alpha(opacity=50);}.yui-resize-knob .yui-resize-handle{height:6px;width:6px;}.yui-resize-knob .yui-resize-handle-tr{right:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-tl{left:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-bl{left:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-br{right:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-t{left:45%;top:-3px;}.yui-resize-knob .yui-resize-handle-r{right:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-l{left:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-b{left:45%;bottom:-3px;}.yui-resize-status{position:absolute;top:-999px;left:-999px;padding:2px;font-size:80%;display:none;zoom:1;z-index:9999;}.yui-resize-status strong,.yui-resize-status em{font-weight:normal;font-style:normal;padding:1px;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle{background-color:#F2F2F2;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle-active{background-color:#7D98B8;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle-l,.yui-skin-sam .yui-resize .yui-resize-handle-r,.yui-skin-sam .yui-resize .yui-resize-handle-l-active,.yui-skin-sam .yui-resize .yui-resize-handle-r-active{height:100%;zoom:1;}.yui-skin-sam .yui-resize-knob .yui-resize-handle{border:1px solid #808080;}.yui-skin-sam .yui-resize-hover .yui-resize-handle-active{opacity:1;filter:alpha(opacity=100);}.yui-skin-sam .yui-resize-proxy{border:1px dashed #426FD9;}.yui-skin-sam .yui-resize-status{border:1px solid #A6982B;border-top:1px solid #D4C237;background-color:#FFEE69;color:#000;}.yui-skin-sam .yui-resize-status strong,.yui-skin-sam .yui-resize-status em{float:left;display:block;clear:both;padding:1px;text-align:center;}.yui-skin-sam .yui-resize .yui-resize-handle-inner-r,.yui-skin-sam .yui-resize .yui-resize-handle-inner-l{background:transparent url(layout_sprite.png) no-repeat 0 -5px;height:16px;width:5px;position:absolute;top:45%;}.yui-skin-sam .yui-resize .yui-resize-handle-inner-t,.yui-skin-sam .yui-resize .yui-resize-handle-inner-b{background:transparent url(layout_sprite.png) no-repeat -20px 0;height:5px;width:16px;position:absolute;left:50%;}.yui-skin-sam .yui-resize .yui-resize-handle-br{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -62px;}.yui-skin-sam .yui-resize .yui-resize-handle-tr{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -42px;}.yui-skin-sam .yui-resize .yui-resize-handle-tl{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -82px;}.yui-skin-sam .yui-resize .yui-resize-handle-bl{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -23px;}.yui-skin-sam .yui-resize-knob .yui-resize-handle-t,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-b,.yui-skin-sam .yui-resize-knob .yui-resize-handle-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-tl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-tr,.yui-skin-sam .yui-resize-knob .yui-resize-handle-bl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-br,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-t,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-b,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-tl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-tr,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-bl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-br{background-image:none;}.yui-skin-sam .yui-resize-knob .yui-resize-handle-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-l-active,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r-active{height:6px;width:6px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-r{right:-8px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-b{bottom:-8px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-br{right:-8px;bottom:-8px;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/simpleeditor.css b/lib/yui/2.8.0r4/assets/skins/sam/simpleeditor.css
new file mode 100644
index 0000000000..00451d8c59
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/simpleeditor.css
@@ -0,0 +1,10 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-busy{cursor:wait!important;}.yui-toolbar-container fieldset,.yui-editor-container fieldset{padding:0;margin:0;border:0;}.yui-toolbar-container legend{display:none;}.yui-skin-sam .yui-toolbar-container .yui-button button,.yui-skin-sam .yui-toolbar-container .yui-button a,.yui-skin-sam .yui-toolbar-container .yui-button a:visited{font-size:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a:visited,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a:visited{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{font-size:0;line-height:0;padding:0;}.yui-toolbar-container .yui-toolbar-subcont{padding:.25em 0;zoom:1;}.yui-toolbar-container-collapsed .yui-toolbar-subcont{display:none;}.yui-toolbar-container .yui-toolbar-subcont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container span.yui-toolbar-draghandle{cursor:move;border-left:1px solid #999;border-right:1px solid #999;overflow:hidden;text-indent:77777px;width:2px;height:20px;display:block;clear:none;float:left;margin:0 0 0 .2em;}.yui-toolbar-container .yui-toolbar-titlebar.draggable{cursor:move;}.yui-toolbar-container .yui-toolbar-titlebar{position:relative;}.yui-toolbar-container .yui-toolbar-titlebar h2{font-weight:bold;letter-spacing:0;border:none;color:#000;margin:0;padding:.2em;}.yui-toolbar-container .yui-toolbar-titlebar h2 a{text-decoration:none;color:#000;cursor:default;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-draghandle{height:40px;}.yui-toolbar-container .yui-toolbar-group{float:left;margin-right:.5em;zoom:1;}.yui-toolbar-container .yui-toolbar-group:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container .yui-toolbar-group h3{font-size:75%;padding:0 0 0 .25em;margin:0;}.yui-toolbar-container span.yui-toolbar-separator{width:2px;padding:0;height:18px;margin:.2em 0 .2em .1em;display:none;float:left;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-separator{height:45px;*height:50px;}.yui-toolbar-container.yui-toolbar-grouped .yui-toolbar-group span.yui-toolbar-separator{height:18px;display:block;}.yui-toolbar-container ul li{margin:0;padding:0;list-style-type:none;}.yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-toolbar-container .yui-push-button,.yui-toolbar-container .yui-color-button,.yui-toolbar-container .yui-menu-button{position:relative;cursor:pointer;}.yui-toolbar-container .yui-button .first-child,.yui-toolbar-container .yui-button .first-child a{height:100%;width:100%;overflow:hidden;font-size:0;}.yui-toolbar-container .yui-button-disabled{cursor:default;}.yui-toolbar-container .yui-button-disabled .yui-toolbar-icon{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button-disabled .up,.yui-toolbar-container .yui-button-disabled .down{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button a{overflow:hidden;}.yui-toolbar-container .yui-toolbar-select .first-child a{cursor:pointer;}.yui-toolbar-fontname-arial{font-family:Arial;}.yui-toolbar-fontname-arial-black{font-family:Arial Black;}.yui-toolbar-fontname-comic-sans-ms{font-family:Comic Sans MS;}.yui-toolbar-fontname-courier-new{font-family:Courier New;}.yui-toolbar-fontname-times-new-roman{font-family:Times New Roman;}.yui-toolbar-fontname-verdana{font-family:Verdana;}.yui-toolbar-fontname-impact{font-family:Impact;}.yui-toolbar-fontname-lucida-console{font-family:Lucida Console;}.yui-toolbar-fontname-tahoma{font-family:Tahoma;}.yui-toolbar-fontname-trebuchet-ms{font-family:Trebuchet MS;}.yui-toolbar-container .yui-toolbar-spinbutton{position:relative;}.yui-toolbar-container .yui-toolbar-spinbutton .first-child a{z-index:0;opacity:1;}.yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-toolbar-container .yui-toolbar-spinbutton a.down{position:absolute;display:block;right:0;cursor:pointer;z-index:1;padding:0;margin:0;}.yui-toolbar-container .yui-overlay{position:absolute;}.yui-toolbar-container .yui-overlay ul li{margin:0;list-style-type:none;}.yui-toolbar-container{z-index:1;}.yui-editor-container .yui-editor-editable-container{position:relative;z-index:0;width:100%;}.yui-editor-container .yui-editor-masked{background-color:#CCC;height:100%;width:100%;position:absolute;top:0;left:0;opacity:.5;filter:alpha(opacity=50);}.yui-editor-container iframe{border:0;padding:0;margin:0;zoom:1;display:block;}.yui-editor-container .yui-editor-editable{padding:0;margin:0;}.yui-editor-container .dompath{font-size:85%;}.yui-editor-panel .hd{text-align:left;position:relative;}.yui-editor-panel .hd h3{font-weight:bold;padding:.25em 0 .25em .25em;margin:0;}.yui-editor-panel .bd{width:100%;zoom:1;position:relative;}.yui-editor-panel .bd div.yui-editor-body-cont{padding:.25em .1em;zoom:1;}.yui-editor-panel .bd .gecko form{overflow:auto;}.yui-editor-panel .bd div.yui-editor-body-cont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-editor-panel .ft{text-align:right;width:99%;float:left;clear:both;}.yui-editor-panel .ft span.tip{display:block;position:relative;padding:.5em .5em .5em 23px;text-align:left;zoom:1;}.yui-editor-panel label{clear:both;float:left;padding:0;width:100%;text-align:left;zoom:1;}.yui-editor-panel .gecko label{overflow:auto;}.yui-editor-panel label strong{float:left;width:6em;}.yui-editor-panel .removeLink{width:80%;text-align:right;}.yui-editor-panel label input{margin-left:.25em;float:left;}.yui-editor-panel .yui-toolbar-group{margin-bottom:.75em;}.yui-editor-panel .height-width{float:left;}.yui-editor-panel .height-width span{font-style:italic;display:block;float:left;overflow:visible;}.yui-editor-panel .height-width span.info{font-size:70%;margin-top:3px;float:none;}
+.yui-editor-panel .yui-toolbar-bordersize,.yui-editor-panel .yui-toolbar-bordertype{font-size:75%;}.yui-editor-panel .yui-toolbar-container span.yui-toolbar-separator{border:none;}.yui-editor-panel .yui-toolbar-bordersize span a span,.yui-editor-panel .yui-toolbar-bordertype span a span{display:block;height:8px;left:4px;position:absolute;top:3px;_top:-5px;width:24px;text-indent:52px;font-size:0;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-solid{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dotted{border-bottom:1px dotted black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dashed{border-bottom:1px dashed black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-0{*top:0;text-indent:0;font-size:75%;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-1{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-2{border-bottom:2px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-3{top:2px;*top:-5px;border-bottom:3px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-4{top:1px;*top:-5px;border-bottom:4px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-5{top:1px;*top:-5px;border-bottom:5px solid black;}.yui-toolbar-container .yui-toolbar-bordersize-menu,.yui-toolbar-container .yui-toolbar-bordertype-menu{width:95px!important;}.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel,.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel:hover{margin:0 3px 7px 17px;}.yui-toolbar-bordersize-menu .yuimenuitemlabel .checkedindicator,.yui-toolbar-bordertype-menu .yuimenuitemlabel .checkedindicator{position:absolute;left:-12px;*top:14px;*left:0;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-1 a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-2 a{border-bottom:2px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-3 a{border-bottom:3px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-4 a{border-bottom:4px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-5 a{border-bottom:5px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-solid a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dashed a{border-bottom:1px dashed black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dotted a{border-bottom:1px dotted black;height:14px;}h2.yui-editor-skipheader,h3.yui-editor-skipheader{height:0;margin:0;padding:0;border:none;width:0;overflow:hidden;position:absolute;}.yui-toolbar-colors{width:133px;zoom:1;display:none;z-index:100;overflow:hidden;}.yui-toolbar-colors:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors a{height:9px;width:9px;float:left;display:block;overflow:hidden;text-indent:999px;margin:0;cursor:pointer;border:1px solid #F6F7EE;}.yui-toolbar-colors a:hover{border:1px solid black;}.yui-color-button-menu{overflow:visible;background-color:transparent;}.yui-toolbar-colors span{position:relative;display:block;padding:3px;overflow:hidden;float:left;width:100%;zoom:1;}.yui-toolbar-colors span:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors span em{height:35px;width:30px;float:left;display:block;overflow:hidden;text-indent:999px;margin:.75px;border:1px solid black;}.yui-toolbar-colors span strong{font-weight:normal;padding-left:3px;display:block;font-size:85%;float:left;width:65%;}.yui-toolbar-group-undoredo h3,.yui-toolbar-group-insertitem h3,.yui-toolbar-group-indentlist h3{width:68px;}.yui-toolbar-group-indentlist2 h3{width:122px;}.yui-toolbar-group-alignment h3{width:130px;}.yui-skin-sam .yui-editor-container{border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container{zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar{background:url(sprite.png) repeat-x 0 -200px;position:relative;}.yui-skin-sam .yui-editor-container .draggable .yui-toolbar-titlebar{cursor:move;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar h2{color:#000;font-weight:bold;margin:0;padding:.3em 1em;font-size:100%;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-group h3{color:#808080;font-size:75%;margin:1em 0 0;padding-bottom:0;padding-left:.25em;text-align:left;}.yui-toolbar-container span.yui-toolbar-separator{border:none;text-indent:33px;overflow:hidden;margin:0 .25em;}.yui-skin-sam .yui-toolbar-container{background-color:#F2F2F2;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subcont{padding:0 1em .35em;border-bottom:1px solid #808080;}.yui-skin-sam .yui-toolbar-container-collapsed .yui-toolbar-titlebar{border-bottom:1px solid #808080;}.yui-skin-sam .yui-editor-container .visible .yui-menu-shadow,.yui-skin-sam .yui-editor-panel .visible .yui-menu-shadow{display:none;}.yui-skin-sam .yui-editor-container ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-container ul li{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-toolbar-group ul li.yui-toolbar-groupitem{float:left;}.yui-skin-sam .yui-editor-container .dompath{background-color:#F2F2F2;border-top:1px solid #808080;color:#999;text-align:left;padding:.25em;}.yui-skin-sam .yui-toolbar-container .collapse{background:url(sprite.png) no-repeat 0 -400px;}.yui-skin-sam .yui-toolbar-container .collapsed{background:url(sprite.png) no-repeat 0 -350px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar span.collapse{cursor:pointer;position:absolute;top:4px;right:2px;display:block;overflow:hidden;height:15px;width:15px;text-indent:9999px;}
+.yui-skin-sam .yui-toolbar-container .yui-push-button,.yui-skin-sam .yui-toolbar-container .yui-color-button,.yui-skin-sam .yui-toolbar-container .yui-menu-button{background:url(sprite.png) repeat-x 0 0;position:relative;display:block;height:22px;width:30px;_font-size:0;margin:0;border-color:#808080;color:#f2f2f2;border-style:solid;border-width:1px 0;zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-push-button a,.yui-skin-sam .yui-toolbar-container .yui-color-button a,.yui-skin-sam .yui-toolbar-container .yui-menu-button a{padding-left:35px;height:20px;text-decoration:none;font-size:0;line-height:2;display:block;color:#000;overflow:hidden;white-space:nowrap;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-push-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button .first-child{border-color:#808080;border-style:solid;border-width:0 1px;margin:0 -1px;display:block;position:relative;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-button .first-child{*left:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-fontname{width:135px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-heading{width:92px;}.yui-skin-sam .yui-toolbar-container .yui-button-hover{background:url(sprite.png) repeat-x 0 -1300px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-button-selected{background:url(sprite.png) repeat-x 0 -1700px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels .yui-toolbar-group{margin-top:.75em;}.yui-skin-sam .yui-toolbar-container .yui-push-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-color-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-menu-button span.yui-toolbar-icon{display:block;position:absolute;top:2px;height:18px;width:18px;overflow:hidden;background:url(editor-sprite.gif) no-repeat 30px 30px;}.yui-skin-sam .yui-toolbar-container .yui-button-selected span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-button-hover span.yui-toolbar-icon{background-image:url(editor-sprite-active.gif);}.yui-skin-sam .yui-toolbar-container .visible .yuimenuitemlabel{cursor:pointer;color:#000;*position:relative;}.yui-skin-sam .yui-toolbar-container .yui-button-menu{background-color:#fff;}.yui-skin-sam .yui-toolbar-container .yui-button-menu .yui-menu-body-scrolled{position:relative;}.yui-skin-sam div.yuimenu li.selected{background-color:#B3D4FF;}.yui-skin-sam div.yuimenu li.selected a.selected{color:#000;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bold span.yui-toolbar-icon{background-position:0 0;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-strikethrough span.yui-toolbar-icon{background-position:0 -108px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-italic span.yui-toolbar-icon{background-position:0 -36px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-undo span.yui-toolbar-icon{background-position:0 -1326px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-redo span.yui-toolbar-icon{background-position:0 -1355px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-underline span.yui-toolbar-icon{background-position:0 -72px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subscript span.yui-toolbar-icon{background-position:0 -180px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-superscript span.yui-toolbar-icon{background-position:0 -144px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-forecolor span.yui-toolbar-icon{background-position:0 -216px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-backcolor span.yui-toolbar-icon{background-position:0 -288px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyleft span.yui-toolbar-icon{background-position:0 -324px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifycenter span.yui-toolbar-icon{background-position:0 -360px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyright span.yui-toolbar-icon{background-position:0 -396px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyfull span.yui-toolbar-icon{background-position:0 -432px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-indent span.yui-toolbar-icon{background-position:0 -720px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-outdent span.yui-toolbar-icon{background-position:0 -684px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-createlink span.yui-toolbar-icon{background-position:0 -792px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertimage span.yui-toolbar-icon{background-position:1px -756px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-left span.yui-toolbar-icon{background-position:0 -972px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-right span.yui-toolbar-icon{background-position:0 -936px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-inline span.yui-toolbar-icon{background-position:0 -900px;left:5px;}
+.yui-skin-sam .yui-toolbar-container .yui-toolbar-block span.yui-toolbar-icon{background-position:0 -864px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bordercolor span.yui-toolbar-icon{background-position:0 -252px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-removeformat span.yui-toolbar-icon{background-position:0 -1080px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-hiddenelements span.yui-toolbar-icon{background-position:0 -1044px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertunorderedlist span.yui-toolbar-icon{background-position:0 -468px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertorderedlist span.yui-toolbar-icon{background-position:0 -504px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child{width:35px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child a{padding-left:2px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton span.yui-toolbar-icon{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{right:2px;background:url(editor-sprite.gif) no-repeat 0 -1222px;overflow:hidden;height:6px;width:7px;min-height:0;padding:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up{top:2px;background-position:0 -1222px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{bottom:2px;background-position:0 -1187px;}.yui-skin-sam .yui-toolbar-container select{height:22px;border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select .first-child a{padding-left:5px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select span.yui-toolbar-icon{background:url(editor-sprite.gif) no-repeat 0 -1144px;overflow:hidden;right:-2px;top:0;height:20px;}.yui-skin-sam .yui-editor-panel .yui-color-button-menu .bd{background-color:transparent;border:none;width:135px;}.yui-skin-sam .yui-color-button-menu .yui-toolbar-colors{border:1px solid #808080;}.yui-skin-sam .yui-editor-panel{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;position:absolute;}.yui-skin-sam .yui-editor-panel .hd{margin:10px 0 0;padding:0;border:none;}.yui-skin-sam .yui-editor-panel .hd h3{color:#000;border:1px solid #808080;background:url(sprite.png) repeat-x 0 -200px;width:99%;position:relative;margin:0;padding:3px 0 0 0;font-size:93%;text-indent:5px;height:20px;}.yui-skin-sam .yui-editor-panel .bd{background-color:#F2F2F2;border-left:1px solid #808080;border-right:1px solid #808080;width:99%;margin:0;padding:0;overflow:visible;}.yui-skin-sam .yui-editor-panel ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-panel ul li{margin:0;padding:0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .yui-toolbar-subcont{padding:0;border:none;margin-top:.35em;}.yui-skin-sam .yui-editor-panel .yui-toolbar-bordersize,.yui-skin-sam .yui-editor-panel .yui-toolbar-bordertype{width:50px;}.yui-skin-sam .yui-editor-panel label{display:block;float:none;padding:4px 0;margin-bottom:7px;}.yui-skin-sam .yui-editor-panel label strong{font-weight:normal;font-size:93%;text-align:right;padding-top:2px;}.yui-skin-sam .yui-editor-panel label input{width:75%;}.yui-skin-sam .yui-editor-panel .createlink_target,.yui-skin-sam .yui-editor-panel .insertimage_target{width:auto;margin-right:5px;}.yui-skin-sam .yui-editor-panel .removeLink{width:98%;}.yui-skin-sam .yui-editor-panel label input.warning{background-color:#FFEE69;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group h3{color:#000;float:left;font-weight:normal;font-size:93%;margin:5px 0 0 0;padding:0 3px 0 0;text-align:right;}.yui-skin-sam .yui-editor-panel .height-width h3{margin:3px 0 0 10px;}.yui-skin-sam .yui-editor-panel .height-width{margin:3px 0 0 35px;*margin-left:14px;width:42%;*width:44%;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-border{width:190px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-border{width:210px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding{width:203px;_width:198px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-padding{width:172px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding h3{margin-left:25px;*margin-left:12px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-textflow{width:182px;}.yui-skin-sam .yui-editor-panel .hd{background:none;}.yui-skin-sam .yui-editor-panel .ft{background-color:#F2F2F2;border:1px solid #808080;border-top:none;padding:0;margin:0 0 2px 0;}.yui-skin-sam .yui-editor-panel .hd span.close{background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;display:block;height:16px;overflow:hidden;position:absolute;right:5px;text-indent:500px;top:2px;width:26px;}.yui-skin-sam .yui-editor-panel .ft span.tip{background-color:#EDF5FF;border-top:1px solid #808080;font-size:85%;}.yui-skin-sam .yui-editor-panel .ft span.tip strong{display:block;float:left;margin:0 2px 8px 0;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon{background:url(editor-sprite.gif) no-repeat 0 -1260px;display:block;height:20px;left:2px;position:absolute;top:8px;width:20px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-info{background-position:2px -1260px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-warn{background-position:2px -1296px;}.yui-skin-sam .yui-editor-panel .hd span.knob{position:absolute;height:10px;width:28px;top:-10px;left:25px;text-indent:9999px;overflow:hidden;background:url(editor-knob.gif) no-repeat 0 0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container{float:left;width:100%;background-image:none;border:none;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .bd{background-color:#fff;}.yui-editor-blankimage{background-image:url(blankimage.png);}.yui-skin-sam .yui-editor-container .yui-resize-handle-br{height:11px;width:11px;background-position:-20px -60px;background-color:transparent;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/skin.css b/lib/yui/2.8.0r4/assets/skins/sam/skin.css
new file mode 100644
index 0000000000..5d546a6809
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/skin.css
@@ -0,0 +1,36 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-ac{position:relative;font-family:arial;font-size:100%;}.yui-skin-sam .yui-ac-input{position:absolute;width:100%;}.yui-skin-sam .yui-ac-container{position:absolute;top:1.6em;width:100%;}.yui-skin-sam .yui-ac-content{position:absolute;width:100%;border:1px solid #808080;background:#fff;overflow:hidden;z-index:9050;}.yui-skin-sam .yui-ac-shadow{position:absolute;margin:.3em;width:100%;background:#000;-moz-opacity:.10;opacity:.10;filter:alpha(opacity=10);z-index:9049;}.yui-skin-sam .yui-ac iframe{opacity:0;filter:alpha(opacity=0);padding-right:.3em;padding-bottom:.3em;}.yui-skin-sam .yui-ac-content ul{margin:0;padding:0;width:100%;}.yui-skin-sam .yui-ac-content li{margin:0;padding:2px 5px;cursor:default;white-space:nowrap;list-style:none;zoom:1;}.yui-skin-sam .yui-ac-content li.yui-ac-prehighlight{background:#B3D4FF;}.yui-skin-sam .yui-ac-content li.yui-ac-highlight{background:#426FD9;color:#FFF;}
+.yui-button{display:-moz-inline-box;display:inline-block;vertical-align:text-bottom;}.yui-button .first-child{display:block;*display:inline-block;}.yui-button button,.yui-button a{display:block;*display:inline-block;border:none;margin:0;}.yui-button button{background-color:transparent;*overflow:visible;cursor:pointer;}.yui-button a{text-decoration:none;}.yui-skin-sam .yui-button{border-width:1px 0;border-style:solid;border-color:#808080;background:url(sprite.png) repeat-x 0 0;margin:auto .25em;}.yui-skin-sam .yui-button .first-child{border-width:0 1px;border-style:solid;border-color:#808080;margin:0 -1px;_margin:0;}.yui-skin-sam .yui-button button,.yui-skin-sam .yui-button a,.yui-skin-sam .yui-button a:visited{padding:0 10px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-button a{*line-height:1.875;*padding-bottom:1px;}.yui-skin-sam .yui-split-button button,.yui-skin-sam .yui-menu-button button{padding-right:20px;background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-button button{background-image:url(menu-button-arrow.png);}.yui-skin-sam .yui-split-button button{background-image:url(split-button-arrow.png);}.yui-skin-sam .yui-button-focus{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-focus .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-focus button{background-image:url(split-button-arrow-focus.png);}.yui-skin-sam .yui-button-hover{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-hover .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-hover button{background-image:url(split-button-arrow-hover.png);}.yui-skin-sam .yui-button-active{border-color:#7D98B8;background-position:0 -1700px;}.yui-skin-sam .yui-button-active .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-split-button-activeoption{border-color:#808080;background-position:0 0;}.yui-skin-sam .yui-split-button-activeoption .first-child{border-color:#808080;}.yui-skin-sam .yui-split-button-activeoption button{background-image:url(split-button-arrow-active.png);}.yui-skin-sam .yui-radio-button-checked,.yui-skin-sam .yui-checkbox-button-checked{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-radio-button-checked .first-child,.yui-skin-sam .yui-checkbox-button-checked .first-child{border-color:#304369;}.yui-skin-sam .yui-radio-button-checked button,.yui-skin-sam .yui-checkbox-button-checked button{color:#fff;}.yui-skin-sam .yui-button-disabled{border-color:#ccc;background-position:0 -1500px;}.yui-skin-sam .yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-button-disabled button,.yui-skin-sam .yui-button-disabled a,.yui-skin-sam .yui-button-disabled a:visited{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-menu-button-disabled button{background-image:url(menu-button-arrow-disabled.png);}.yui-skin-sam .yui-split-button-disabled button{background-image:url(split-button-arrow-disabled.png);}
+.yui-calcontainer{position:relative;float:left;_overflow:hidden;}.yui-calcontainer iframe{position:absolute;border:none;margin:0;padding:0;z-index:0;width:100%;height:100%;left:0;top:0;}.yui-calcontainer iframe.fixedsize{width:50em;height:50em;top:-1px;left:-1px;}.yui-calcontainer.multi .groupcal{z-index:1;float:left;position:relative;}.yui-calcontainer .title{position:relative;z-index:1;}.yui-calcontainer .close-icon{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar{position:relative;}.yui-calendar .calnavleft{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calnavright{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calheader{position:relative;width:100%;text-align:center;}.yui-calcontainer .yui-cal-nav-mask{position:absolute;z-index:2;margin:0;padding:0;width:100%;height:100%;_width:0;_height:0;left:0;top:0;display:none;}.yui-calcontainer .yui-cal-nav{position:absolute;z-index:3;top:0;display:none;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{display:-moz-inline-box;display:inline-block;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{display:block;*display:inline-block;*overflow:visible;border:none;background-color:transparent;cursor:pointer;}.yui-calendar .calbody a:hover{background:inherit;}p#clear{clear:left;padding-top:10px;}.yui-skin-sam .yui-calcontainer{background-color:#f2f2f2;border:1px solid #808080;padding:10px;}.yui-skin-sam .yui-calcontainer.multi{padding:0 5px 0 5px;}.yui-skin-sam .yui-calcontainer.multi .groupcal{background-color:transparent;border:none;padding:10px 5px 10px 5px;margin:0;}.yui-skin-sam .yui-calcontainer .title{background:url(sprite.png) repeat-x 0 0;border-bottom:1px solid #ccc;font:100% sans-serif;color:#000;font-weight:bold;height:auto;padding:.4em;margin:0 -10px 10px -10px;top:0;left:0;text-align:left;}.yui-skin-sam .yui-calcontainer.multi .title{margin:0 -5px 0 -5px;}.yui-skin-sam .yui-calcontainer.withtitle{padding-top:0;}.yui-skin-sam .yui-calcontainer .calclose{background:url(sprite.png) no-repeat 0 -300px;width:25px;height:15px;top:.4em;right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar{border-spacing:0;border-collapse:collapse;font:100% sans-serif;text-align:center;margin:0;}.yui-skin-sam .yui-calendar .calhead{background:transparent;border:none;vertical-align:middle;padding:0;}.yui-skin-sam .yui-calendar .calheader{background:transparent;font-weight:bold;padding:0 0 .6em 0;text-align:center;}.yui-skin-sam .yui-calendar .calheader img{border:none;}.yui-skin-sam .yui-calendar .calnavleft{background:url(sprite.png) no-repeat 0 -450px;width:25px;height:15px;top:0;bottom:0;left:-10px;margin-left:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calnavright{background:url(sprite.png) no-repeat 0 -500px;width:25px;height:15px;top:0;bottom:0;right:-10px;margin-right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calweekdayrow{height:2em;}.yui-skin-sam .yui-calendar .calweekdayrow th{padding:0;border:none;}.yui-skin-sam .yui-calendar .calweekdaycell{color:#000;font-weight:bold;text-align:center;width:2em;}.yui-skin-sam .yui-calendar .calfoot{background-color:#f2f2f2;}.yui-skin-sam .yui-calendar .calrowhead,.yui-skin-sam .yui-calendar .calrowfoot{color:#a6a6a6;font-size:85%;font-style:normal;font-weight:normal;border:none;}.yui-skin-sam .yui-calendar .calrowhead{text-align:right;padding:0 2px 0 0;}.yui-skin-sam .yui-calendar .calrowfoot{text-align:left;padding:0 0 0 2px;}.yui-skin-sam .yui-calendar td.calcell{border:1px solid #ccc;background:#fff;padding:1px;height:1.6em;line-height:1.6em;text-align:center;white-space:nowrap;}.yui-skin-sam .yui-calendar td.calcell a{color:#06c;display:block;height:100%;text-decoration:none;}.yui-skin-sam .yui-calendar td.calcell.today{background-color:#000;}.yui-skin-sam .yui-calendar td.calcell.today a{background-color:#fff;}.yui-skin-sam .yui-calendar td.calcell.oom{background-color:#ccc;color:#a6a6a6;cursor:default;}.yui-skin-sam .yui-calendar td.calcell.selected{background-color:#fff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.selected a{background-color:#b3d4ff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.calcellhover{background-color:#426fd9;color:#fff;cursor:pointer;}.yui-skin-sam .yui-calendar td.calcell.calcellhover a{background-color:#426fd9;color:#fff;}.yui-skin-sam .yui-calendar td.calcell.previous{color:#e0e0e0;}.yui-skin-sam .yui-calendar td.calcell.restricted{text-decoration:line-through;}.yui-skin-sam .yui-calendar td.calcell.highlight1{background-color:#cf9;}.yui-skin-sam .yui-calendar td.calcell.highlight2{background-color:#9cf;}.yui-skin-sam .yui-calendar td.calcell.highlight3{background-color:#fcc;}.yui-skin-sam .yui-calendar td.calcell.highlight4{background-color:#cf9;}.yui-skin-sam .yui-calendar a.calnav{border:1px solid #f2f2f2;padding:0 4px;text-decoration:none;color:#000;zoom:1;}.yui-skin-sam .yui-calendar a.calnav:hover{background:url(sprite.png) repeat-x 0 0;border-color:#A0A0A0;cursor:pointer;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-calcontainer .yui-cal-nav{font-family:arial,helvetica,clean,sans-serif;font-size:93%;border:1px solid #808080;left:50%;margin-left:-7em;width:14em;padding:0;top:2.5em;background-color:#f2f2f2;}.yui-skin-sam .yui-calcontainer.withtitle .yui-cal-nav{top:4.5em;}.yui-skin-sam .yui-calcontainer.multi .yui-cal-nav{width:16em;margin-left:-8em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y,.yui-skin-sam .yui-calcontainer .yui-cal-nav-m,.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{padding:5px 10px 5px 10px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{text-align:center;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-e{margin-top:5px;padding:5px;background-color:#EDF5FF;border-top:1px solid black;display:none;}.yui-skin-sam .yui-calcontainer .yui-cal-nav label{display:block;font-weight:bold;}
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-mc{width:100%;_width:auto;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y input.yui-invalid{background-color:#FFEE69;border:1px solid #000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-yc{width:4em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{border:1px solid #808080;background:url(sprite.png) repeat-x 0 0;background-color:#ccc;margin:auto .15em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{padding:0 8px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default{border:1px solid #304369;background-color:#426fd9;background:url(sprite.png) repeat-x 0 -1400px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default button{color:#fff;}
+.yui-carousel{visibility:hidden;overflow:hidden;position:relative;text-align:left;zoom:1;}.yui-carousel.yui-carousel-visible{visibility:visible;}.yui-carousel-content{overflow:hidden;position:relative;text-align:center;}.yui-carousel-element li{border:1px solid #ccc;list-style:none;margin:1px;overflow:hidden;padding:0;position:absolute;text-align:center;}.yui-carousel-vertical .yui-carousel-element li{display:block;float:none;}.yui-log .carousel{background:#f2e886;}.yui-carousel-nav{zoom:1;}.yui-carousel-nav:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-carousel-button-focus{outline:1px dotted #000;}.yui-carousel-min-width{min-width:115px;}.yui-carousel-element{overflow:hidden;position:relative;margin:0 auto;padding:0;text-align:left;*margin:0;}.yui-carousel-horizontal .yui-carousel-element{width:320000px;}.yui-carousel-vertical .yui-carousel-element{height:320000px;}.yui-skin-sam .yui-carousel-nav select{position:static;}.yui-carousel .yui-carousel-item-selected{border:1px dashed #000;margin:1px;}.yui-skin-sam .yui-carousel,.yui-skin-sam .yui-carousel-vertical{border:1px solid #808080;}.yui-skin-sam .yui-carousel-nav{background:url(sprite.png) repeat-x 0 0;padding:3px;text-align:right;}.yui-skin-sam .yui-carousel-button{background:url(sprite.png) no-repeat 0 -600px;float:right;height:19px;margin:5px;overflow:hidden;width:40px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button{background-position:0 -800px;}.yui-skin-sam .yui-carousel-button-disabled{background-position:0 -2000px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button-disabled{background-position:0 -2100px;}.yui-skin-sam .yui-carousel-button input,.yui-skin-sam .yui-carousel-button button{background-color:transparent;border:0;cursor:pointer;display:block;height:44px;margin:-2px 0 0 -2px;padding:0 0 0 50px;}.yui-skin-sam span.yui-carousel-first-button{background-position:0 -550px;margin-left:-100px;margin-right:50px;*margin:5px 5px 5px -90px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button{background-position:0 -750px;}.yui-skin-sam span.yui-carousel-first-button-disabled{background-position:0 -1950px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button-disabled{background-position:0 -2050px;}.yui-skin-sam .yui-carousel-nav ul{float:right;height:19px;margin:0;margin-left:-220px;margin-right:100px;*margin-left:-160px;*margin-right:0;padding:0;}.yui-skin-sam .yui-carousel-min-width .yui-carousel-nav ul{*margin-left:-170px;}.yui-skin-sam .yui-carousel-nav select{position:relative;*right:50px;top:4px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{position:static;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav ul,.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{float:none;margin:0;*zoom:1;}.yui-skin-sam .yui-carousel-nav ul li{background:url(sprite.png) no-repeat 0 -650px;cursor:pointer;float:left;height:9px;list-style:none;margin:10px 0 0 5px;overflow:hidden;padding:0;width:9px;}.yui-skin-sam .yui-carousel-nav ul:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-skin-sam .yui-carousel-nav ul li a{display:block;width:100%;height:100%;text-indent:-10000px;text-align:left;overflow:hidden;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-focus{outline:1px dotted #000;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-selected{background-position:0 -700px;}.yui-skin-sam .yui-carousel-item-loading{background:url(ajax-loader.gif) no-repeat 50% 50%;position:absolute;text-indent:-150px;}
+.yui-picker-panel{background:#e3e3e3;border-color:#888;}.yui-picker-panel .hd{background-color:#ccc;font-size:100%;line-height:100%;border:1px solid #e3e3e3;font-weight:bold;overflow:hidden;padding:6px;color:#000;}.yui-picker-panel .bd{background:#e8e8e8;margin:1px;height:200px;}.yui-picker-panel .ft{background:#e8e8e8;margin:1px;padding:1px;}.yui-picker{position:relative;}.yui-picker-hue-thumb{cursor:default;width:18px;height:18px;top:-8px;left:-2px;z-index:9;position:absolute;}.yui-picker-hue-bg{-moz-outline:none;outline:0 none;position:absolute;left:200px;height:183px;width:14px;background:url(hue_bg.png) no-repeat;top:4px;}.yui-picker-bg{-moz-outline:none;outline:0 none;position:absolute;top:4px;left:4px;height:182px;width:182px;background-color:#F00;background-image:url(picker_mask.png);}*html .yui-picker-bg{background-image:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../build/colorpicker/assets/picker_mask.png',sizingMethod='scale');}.yui-picker-mask{position:absolute;z-index:1;top:0;left:0;}.yui-picker-thumb{cursor:default;width:11px;height:11px;z-index:9;position:absolute;top:-4px;left:-4px;}.yui-picker-swatch{position:absolute;left:240px;top:4px;height:60px;width:55px;border:1px solid #888;}.yui-picker-websafe-swatch{position:absolute;left:304px;top:4px;height:24px;width:24px;border:1px solid #888;}.yui-picker-controls{position:absolute;top:72px;left:226px;font:1em monospace;}.yui-picker-controls .hd{background:transparent;border-width:0!important;}.yui-picker-controls .bd{height:100px;border-width:0!important;}.yui-picker-controls ul{float:left;padding:0 2px 0 0;margin:0;}.yui-picker-controls li{padding:2px;list-style:none;margin:0;}.yui-picker-controls input{font-size:.85em;width:2.4em;}.yui-picker-hex-controls{clear:both;padding:2px;}.yui-picker-hex-controls input{width:4.6em;}.yui-picker-controls a{font:1em arial,helvetica,clean,sans-serif;display:block;*display:inline-block;padding:0;color:#000;}
+.yui-overlay,.yui-panel-container{visibility:hidden;position:absolute;z-index:2;}.yui-panel{position:relative;}.yui-panel-container form{margin:0;}.mask{z-index:1;display:none;position:absolute;top:0;left:0;right:0;bottom:0;}.mask.block-scrollbars{overflow:auto;}.masked select,.drag select,.hide-select select{_visibility:hidden;}.yui-panel-container select{_visibility:inherit;}.hide-scrollbars,.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.show-scrollbars{overflow:auto;}.yui-panel-container.show-scrollbars,.yui-tt.show-scrollbars{overflow:visible;}.yui-panel-container.show-scrollbars .underlay,.yui-tt.show-scrollbars .yui-tt-shadow{overflow:auto;}.yui-panel-container.shadow .underlay.yui-force-redraw{padding-bottom:1px;}.yui-effect-fade .underlay,.yui-effect-fade .yui-tt-shadow{display:none;}.yui-tt-shadow{position:absolute;}.yui-override-padding{padding:0!important;}.yui-panel-container .container-close{overflow:hidden;text-indent:-10000em;text-decoration:none;}.yui-overlay.yui-force-redraw,.yui-panel-container.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-panel-container{padding:0 1px;*padding:2px;}.yui-skin-sam .yui-panel{position:relative;left:0;top:0;border-style:solid;border-width:1px 0;border-color:#808080;z-index:1;*border-width:1px;*zoom:1;_zoom:normal;}.yui-skin-sam .yui-panel .hd,.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{border-style:solid;border-width:0 1px;border-color:#808080;margin:0 -1px;*margin:0;*border:0;}.yui-skin-sam .yui-panel .hd{border-bottom:solid 1px #ccc;}.yui-skin-sam .yui-panel .bd,.yui-skin-sam .yui-panel .ft{background-color:#F2F2F2;}.yui-skin-sam .yui-panel .hd{padding:0 10px;font-size:93%;line-height:2;*line-height:1.9;font-weight:bold;color:#000;background:url(sprite.png) repeat-x 0 -200px;}.yui-skin-sam .yui-panel .bd{padding:10px;}.yui-skin-sam .yui-panel .ft{border-top:solid 1px #808080;padding:5px 10px;font-size:77%;}.yui-skin-sam .container-close{position:absolute;top:5px;right:6px;width:25px;height:15px;background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;}.yui-skin-sam .yui-panel-container .underlay{right:-1px;left:-1px;}.yui-skin-sam .yui-panel-container.matte{padding:9px 10px;background-color:#fff;}.yui-skin-sam .yui-panel-container.shadow{_padding:2px 4px 0 2px;}.yui-skin-sam .yui-panel-container.shadow .underlay{position:absolute;top:2px;left:-3px;right:-3px;bottom:-3px;*top:4px;*left:-1px;*right:-1px;*bottom:-1px;_top:0;_left:0;_right:0;_bottom:0;_margin-top:3px;_margin-left:-1px;background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yui-dialog .ft{border-top:none;padding:0 10px 10px 10px;font-size:100%;}.yui-skin-sam .yui-dialog .ft .button-group{display:block;text-align:right;}.yui-skin-sam .yui-dialog .ft button.default{font-weight:bold;}.yui-skin-sam .yui-dialog .ft span.default{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-dialog .ft span.default .first-child{border-color:#304369;}.yui-skin-sam .yui-dialog .ft span.default button{color:#fff;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled{background-position:0 -1500px;border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-dialog .ft span.yui-button-disabled button{color:#a6a6a6;}.yui-skin-sam .yui-simple-dialog .bd .yui-icon{background:url(sprite.png) no-repeat 0 0;width:16px;height:16px;margin-right:10px;float:left;}.yui-skin-sam .yui-simple-dialog .bd span.blckicon{background-position:0 -1100px;}.yui-skin-sam .yui-simple-dialog .bd span.alrticon{background-position:0 -1050px;}.yui-skin-sam .yui-simple-dialog .bd span.hlpicon{background-position:0 -1150px;}.yui-skin-sam .yui-simple-dialog .bd span.infoicon{background-position:0 -1200px;}.yui-skin-sam .yui-simple-dialog .bd span.warnicon{background-position:0 -1900px;}.yui-skin-sam .yui-simple-dialog .bd span.tipicon{background-position:0 -1250px;}.yui-skin-sam .yui-tt .bd{position:relative;top:0;left:0;z-index:1;color:#000;padding:2px 5px;border-color:#D4C237 #A6982B #A6982B #A6982B;border-width:1px;border-style:solid;background-color:#FFEE69;}.yui-skin-sam .yui-tt.show-scrollbars .bd{overflow:auto;}.yui-skin-sam .yui-tt-shadow{top:2px;right:-3px;left:-3px;bottom:-3px;background-color:#000;}.yui-skin-sam .yui-tt-shadow-visible{opacity:.12;filter:alpha(opacity=12);}
+.yui-skin-sam .yui-dt-mask{position:absolute;z-index:9500;}.yui-dt-tmp{position:absolute;left:-9000px;}.yui-dt-scrollable .yui-dt-bd{overflow:auto;}.yui-dt-scrollable .yui-dt-hd{overflow:hidden;position:relative;}.yui-dt-scrollable .yui-dt-bd thead tr,.yui-dt-scrollable .yui-dt-bd thead th{position:absolute;left:-1500px;}.yui-dt-scrollable tbody{-moz-outline:none;}.yui-skin-sam thead .yui-dt-sortable{cursor:pointer;}.yui-skin-sam thead .yui-dt-draggable{cursor:move;}.yui-dt-coltarget{position:absolute;z-index:999;}.yui-dt-hd{zoom:1;}th.yui-dt-resizeable .yui-dt-resizerliner{position:relative;}.yui-dt-resizer{position:absolute;right:0;bottom:0;height:100%;cursor:e-resize;cursor:col-resize;background-color:#CCC;opacity:0;filter:alpha(opacity=0);}.yui-dt-resizerproxy{visibility:hidden;position:absolute;z-index:9000;background-color:#CCC;opacity:0;filter:alpha(opacity=0);}th.yui-dt-hidden .yui-dt-liner,td.yui-dt-hidden .yui-dt-liner,th.yui-dt-hidden .yui-dt-resizer{display:none;}.yui-dt-editor{position:absolute;z-index:9000;}.yui-skin-sam .yui-dt table{margin:0;padding:0;font-family:arial;font-size:inherit;border-collapse:separate;*border-collapse:collapse;border-spacing:0;border:1px solid #7F7F7F;}.yui-skin-sam .yui-dt thead{border-spacing:0;}.yui-skin-sam .yui-dt caption{color:#000;font-size:85%;font-weight:normal;font-style:italic;line-height:1;padding:1em 0;text-align:center;}.yui-skin-sam .yui-dt th{background:#D8D8DA url(sprite.png) repeat-x 0 0;}.yui-skin-sam .yui-dt th,.yui-skin-sam .yui-dt th a{font-weight:normal;text-decoration:none;color:#000;vertical-align:bottom;}.yui-skin-sam .yui-dt th{margin:0;padding:0;border:none;border-right:1px solid #CBCBCB;}.yui-skin-sam .yui-dt tr.yui-dt-first td{border-top:1px solid #7F7F7F;}.yui-skin-sam .yui-dt th .yui-dt-liner{white-space:nowrap;}.yui-skin-sam .yui-dt-liner{margin:0;padding:0;padding:4px 10px 4px 10px;}.yui-skin-sam .yui-dt-coltarget{width:5px;background-color:red;}.yui-skin-sam .yui-dt td{margin:0;padding:0;border:none;border-right:1px solid #CBCBCB;text-align:left;}.yui-skin-sam .yui-dt-list td{border-right:none;}.yui-skin-sam .yui-dt-resizer{width:6px;}.yui-skin-sam .yui-dt-mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-dt-message{background-color:#FFF;}.yui-skin-sam .yui-dt-scrollable table{border:none;}.yui-skin-sam .yui-dt-scrollable .yui-dt-hd{border-left:1px solid #7F7F7F;border-top:1px solid #7F7F7F;border-right:1px solid #7F7F7F;}.yui-skin-sam .yui-dt-scrollable .yui-dt-bd{border-left:1px solid #7F7F7F;border-bottom:1px solid #7F7F7F;border-right:1px solid #7F7F7F;background-color:#FFF;}.yui-skin-sam .yui-dt-scrollable .yui-dt-data tr.yui-dt-last td{border-bottom:1px solid #7F7F7F;}.yui-skin-sam th.yui-dt-asc,.yui-skin-sam th.yui-dt-desc{background:url(sprite.png) repeat-x 0 -100px;}.yui-skin-sam th.yui-dt-sortable .yui-dt-label{margin-right:10px;}.yui-skin-sam th.yui-dt-asc .yui-dt-liner{background:url(dt-arrow-up.png) no-repeat right;}.yui-skin-sam th.yui-dt-desc .yui-dt-liner{background:url(dt-arrow-dn.png) no-repeat right;}tbody .yui-dt-editable{cursor:pointer;}.yui-dt-editor{text-align:left;background-color:#F2F2F2;border:1px solid #808080;padding:6px;}.yui-dt-editor label{padding-left:4px;padding-right:6px;}.yui-dt-editor .yui-dt-button{padding-top:6px;text-align:right;}.yui-dt-editor .yui-dt-button button{background:url(sprite.png) repeat-x 0 0;border:1px solid #999;width:4em;height:1.8em;margin-left:6px;}.yui-dt-editor .yui-dt-button button.yui-dt-default{background:url(sprite.png) repeat-x 0 -1400px;background-color:#5584E0;border:1px solid #304369;color:#FFF;}.yui-dt-editor .yui-dt-button button:hover{background:url(sprite.png) repeat-x 0 -1300px;color:#000;}.yui-dt-editor .yui-dt-button button:active{background:url(sprite.png) repeat-x 0 -1700px;color:#000;}.yui-skin-sam tr.yui-dt-even{background-color:#FFF;}.yui-skin-sam tr.yui-dt-odd{background-color:#EDF5FF;}.yui-skin-sam tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam tr.yui-dt-even td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam tr.yui-dt-odd td.yui-dt-desc{background-color:#DBEAFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even{background-color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-odd{background-color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-desc{background-color:#EDF5FF;}.yui-skin-sam th.yui-dt-highlighted,.yui-skin-sam th.yui-dt-highlighted a{background-color:#B2D2FF;}.yui-skin-sam tr.yui-dt-highlighted,.yui-skin-sam tr.yui-dt-highlighted td.yui-dt-asc,.yui-skin-sam tr.yui-dt-highlighted td.yui-dt-desc,.yui-skin-sam tr.yui-dt-even td.yui-dt-highlighted,.yui-skin-sam tr.yui-dt-odd td.yui-dt-highlighted{cursor:pointer;background-color:#B2D2FF;}.yui-skin-sam .yui-dt-list th.yui-dt-highlighted,.yui-skin-sam .yui-dt-list th.yui-dt-highlighted a{background-color:#B2D2FF;}.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted,.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-highlighted td.yui-dt-desc,.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-highlighted,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-highlighted{cursor:pointer;background-color:#B2D2FF;}.yui-skin-sam th.yui-dt-selected,.yui-skin-sam th.yui-dt-selected a{background-color:#446CD7;}.yui-skin-sam tr.yui-dt-selected td,.yui-skin-sam tr.yui-dt-selected td.yui-dt-asc,.yui-skin-sam tr.yui-dt-selected td.yui-dt-desc{background-color:#426FD9;color:#FFF;}.yui-skin-sam tr.yui-dt-even td.yui-dt-selected,.yui-skin-sam tr.yui-dt-odd td.yui-dt-selected{background-color:#446CD7;color:#FFF;}.yui-skin-sam .yui-dt-list th.yui-dt-selected,.yui-skin-sam .yui-dt-list th.yui-dt-selected a{background-color:#446CD7;}
+.yui-skin-sam .yui-dt-list tr.yui-dt-selected td,.yui-skin-sam .yui-dt-list tr.yui-dt-selected td.yui-dt-asc,.yui-skin-sam .yui-dt-list tr.yui-dt-selected td.yui-dt-desc{background-color:#426FD9;color:#FFF;}.yui-skin-sam .yui-dt-list tr.yui-dt-even td.yui-dt-selected,.yui-skin-sam .yui-dt-list tr.yui-dt-odd td.yui-dt-selected{background-color:#446CD7;color:#FFF;}.yui-skin-sam .yui-dt-paginator{display:block;margin:6px 0;white-space:nowrap;}.yui-skin-sam .yui-dt-paginator .yui-dt-first,.yui-skin-sam .yui-dt-paginator .yui-dt-last,.yui-skin-sam .yui-dt-paginator .yui-dt-selected{padding:2px 6px;}.yui-skin-sam .yui-dt-paginator a.yui-dt-first,.yui-skin-sam .yui-dt-paginator a.yui-dt-last{text-decoration:none;}.yui-skin-sam .yui-dt-paginator .yui-dt-previous,.yui-skin-sam .yui-dt-paginator .yui-dt-next{display:none;}.yui-skin-sam a.yui-dt-page{border:1px solid #CBCBCB;padding:2px 6px;text-decoration:none;background-color:#fff;}.yui-skin-sam .yui-dt-selected{border:1px solid #fff;background-color:#fff;}
+.yui-busy{cursor:wait!important;}.yui-toolbar-container fieldset,.yui-editor-container fieldset{padding:0;margin:0;border:0;}.yui-toolbar-container legend{display:none;}.yui-skin-sam .yui-toolbar-container .yui-button button,.yui-skin-sam .yui-toolbar-container .yui-button a,.yui-skin-sam .yui-toolbar-container .yui-button a:visited{font-size:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a:visited,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a:visited{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{font-size:0;line-height:0;padding:0;}.yui-toolbar-container .yui-toolbar-subcont{padding:.25em 0;zoom:1;}.yui-toolbar-container-collapsed .yui-toolbar-subcont{display:none;}.yui-toolbar-container .yui-toolbar-subcont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container span.yui-toolbar-draghandle{cursor:move;border-left:1px solid #999;border-right:1px solid #999;overflow:hidden;text-indent:77777px;width:2px;height:20px;display:block;clear:none;float:left;margin:0 0 0 .2em;}.yui-toolbar-container .yui-toolbar-titlebar.draggable{cursor:move;}.yui-toolbar-container .yui-toolbar-titlebar{position:relative;}.yui-toolbar-container .yui-toolbar-titlebar h2{font-weight:bold;letter-spacing:0;border:none;color:#000;margin:0;padding:.2em;}.yui-toolbar-container .yui-toolbar-titlebar h2 a{text-decoration:none;color:#000;cursor:default;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-draghandle{height:40px;}.yui-toolbar-container .yui-toolbar-group{float:left;margin-right:.5em;zoom:1;}.yui-toolbar-container .yui-toolbar-group:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container .yui-toolbar-group h3{font-size:75%;padding:0 0 0 .25em;margin:0;}.yui-toolbar-container span.yui-toolbar-separator{width:2px;padding:0;height:18px;margin:.2em 0 .2em .1em;display:none;float:left;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-separator{height:45px;*height:50px;}.yui-toolbar-container.yui-toolbar-grouped .yui-toolbar-group span.yui-toolbar-separator{height:18px;display:block;}.yui-toolbar-container ul li{margin:0;padding:0;list-style-type:none;}.yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-toolbar-container .yui-push-button,.yui-toolbar-container .yui-color-button,.yui-toolbar-container .yui-menu-button{position:relative;cursor:pointer;}.yui-toolbar-container .yui-button .first-child,.yui-toolbar-container .yui-button .first-child a{height:100%;width:100%;overflow:hidden;font-size:0;}.yui-toolbar-container .yui-button-disabled{cursor:default;}.yui-toolbar-container .yui-button-disabled .yui-toolbar-icon{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button-disabled .up,.yui-toolbar-container .yui-button-disabled .down{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button a{overflow:hidden;}.yui-toolbar-container .yui-toolbar-select .first-child a{cursor:pointer;}.yui-toolbar-fontname-arial{font-family:Arial;}.yui-toolbar-fontname-arial-black{font-family:Arial Black;}.yui-toolbar-fontname-comic-sans-ms{font-family:Comic Sans MS;}.yui-toolbar-fontname-courier-new{font-family:Courier New;}.yui-toolbar-fontname-times-new-roman{font-family:Times New Roman;}.yui-toolbar-fontname-verdana{font-family:Verdana;}.yui-toolbar-fontname-impact{font-family:Impact;}.yui-toolbar-fontname-lucida-console{font-family:Lucida Console;}.yui-toolbar-fontname-tahoma{font-family:Tahoma;}.yui-toolbar-fontname-trebuchet-ms{font-family:Trebuchet MS;}.yui-toolbar-container .yui-toolbar-spinbutton{position:relative;}.yui-toolbar-container .yui-toolbar-spinbutton .first-child a{z-index:0;opacity:1;}.yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-toolbar-container .yui-toolbar-spinbutton a.down{position:absolute;display:block;right:0;cursor:pointer;z-index:1;padding:0;margin:0;}.yui-toolbar-container .yui-overlay{position:absolute;}.yui-toolbar-container .yui-overlay ul li{margin:0;list-style-type:none;}.yui-toolbar-container{z-index:1;}.yui-editor-container .yui-editor-editable-container{position:relative;z-index:0;width:100%;}.yui-editor-container .yui-editor-masked{background-color:#CCC;height:100%;width:100%;position:absolute;top:0;left:0;opacity:.5;filter:alpha(opacity=50);}.yui-editor-container iframe{border:0;padding:0;margin:0;zoom:1;display:block;}.yui-editor-container .yui-editor-editable{padding:0;margin:0;}.yui-editor-container .dompath{font-size:85%;}.yui-editor-panel .hd{text-align:left;position:relative;}.yui-editor-panel .hd h3{font-weight:bold;padding:.25em 0 .25em .25em;margin:0;}.yui-editor-panel .bd{width:100%;zoom:1;position:relative;}.yui-editor-panel .bd div.yui-editor-body-cont{padding:.25em .1em;zoom:1;}.yui-editor-panel .bd .gecko form{overflow:auto;}.yui-editor-panel .bd div.yui-editor-body-cont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-editor-panel .ft{text-align:right;width:99%;float:left;clear:both;}.yui-editor-panel .ft span.tip{display:block;position:relative;padding:.5em .5em .5em 23px;text-align:left;zoom:1;}.yui-editor-panel label{clear:both;float:left;padding:0;width:100%;text-align:left;zoom:1;}.yui-editor-panel .gecko label{overflow:auto;}.yui-editor-panel label strong{float:left;width:6em;}.yui-editor-panel .removeLink{width:80%;text-align:right;}.yui-editor-panel label input{margin-left:.25em;float:left;}.yui-editor-panel .yui-toolbar-group{margin-bottom:.75em;}.yui-editor-panel .height-width{float:left;}.yui-editor-panel .height-width span{font-style:italic;display:block;float:left;overflow:visible;}.yui-editor-panel .height-width span.info{font-size:70%;margin-top:3px;float:none;}
+.yui-editor-panel .yui-toolbar-bordersize,.yui-editor-panel .yui-toolbar-bordertype{font-size:75%;}.yui-editor-panel .yui-toolbar-container span.yui-toolbar-separator{border:none;}.yui-editor-panel .yui-toolbar-bordersize span a span,.yui-editor-panel .yui-toolbar-bordertype span a span{display:block;height:8px;left:4px;position:absolute;top:3px;_top:-5px;width:24px;text-indent:52px;font-size:0;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-solid{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dotted{border-bottom:1px dotted black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dashed{border-bottom:1px dashed black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-0{*top:0;text-indent:0;font-size:75%;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-1{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-2{border-bottom:2px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-3{top:2px;*top:-5px;border-bottom:3px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-4{top:1px;*top:-5px;border-bottom:4px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-5{top:1px;*top:-5px;border-bottom:5px solid black;}.yui-toolbar-container .yui-toolbar-bordersize-menu,.yui-toolbar-container .yui-toolbar-bordertype-menu{width:95px!important;}.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel,.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel:hover{margin:0 3px 7px 17px;}.yui-toolbar-bordersize-menu .yuimenuitemlabel .checkedindicator,.yui-toolbar-bordertype-menu .yuimenuitemlabel .checkedindicator{position:absolute;left:-12px;*top:14px;*left:0;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-1 a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-2 a{border-bottom:2px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-3 a{border-bottom:3px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-4 a{border-bottom:4px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-5 a{border-bottom:5px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-solid a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dashed a{border-bottom:1px dashed black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dotted a{border-bottom:1px dotted black;height:14px;}h2.yui-editor-skipheader,h3.yui-editor-skipheader{height:0;margin:0;padding:0;border:none;width:0;overflow:hidden;position:absolute;}.yui-toolbar-colors{width:133px;zoom:1;display:none;z-index:100;overflow:hidden;}.yui-toolbar-colors:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors a{height:9px;width:9px;float:left;display:block;overflow:hidden;text-indent:999px;margin:0;cursor:pointer;border:1px solid #F6F7EE;}.yui-toolbar-colors a:hover{border:1px solid black;}.yui-color-button-menu{overflow:visible;background-color:transparent;}.yui-toolbar-colors span{position:relative;display:block;padding:3px;overflow:hidden;float:left;width:100%;zoom:1;}.yui-toolbar-colors span:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors span em{height:35px;width:30px;float:left;display:block;overflow:hidden;text-indent:999px;margin:.75px;border:1px solid black;}.yui-toolbar-colors span strong{font-weight:normal;padding-left:3px;display:block;font-size:85%;float:left;width:65%;}.yui-toolbar-group-undoredo h3,.yui-toolbar-group-insertitem h3,.yui-toolbar-group-indentlist h3{width:68px;}.yui-toolbar-group-indentlist2 h3{width:122px;}.yui-toolbar-group-alignment h3{width:130px;}.yui-skin-sam .yui-editor-container{border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container{zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar{background:url(sprite.png) repeat-x 0 -200px;position:relative;}.yui-skin-sam .yui-editor-container .draggable .yui-toolbar-titlebar{cursor:move;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar h2{color:#000;font-weight:bold;margin:0;padding:.3em 1em;font-size:100%;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-group h3{color:#808080;font-size:75%;margin:1em 0 0;padding-bottom:0;padding-left:.25em;text-align:left;}.yui-toolbar-container span.yui-toolbar-separator{border:none;text-indent:33px;overflow:hidden;margin:0 .25em;}.yui-skin-sam .yui-toolbar-container{background-color:#F2F2F2;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subcont{padding:0 1em .35em;border-bottom:1px solid #808080;}.yui-skin-sam .yui-toolbar-container-collapsed .yui-toolbar-titlebar{border-bottom:1px solid #808080;}.yui-skin-sam .yui-editor-container .visible .yui-menu-shadow,.yui-skin-sam .yui-editor-panel .visible .yui-menu-shadow{display:none;}.yui-skin-sam .yui-editor-container ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-container ul li{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-toolbar-group ul li.yui-toolbar-groupitem{float:left;}.yui-skin-sam .yui-editor-container .dompath{background-color:#F2F2F2;border-top:1px solid #808080;color:#999;text-align:left;padding:.25em;}.yui-skin-sam .yui-toolbar-container .collapse{background:url(sprite.png) no-repeat 0 -400px;}.yui-skin-sam .yui-toolbar-container .collapsed{background:url(sprite.png) no-repeat 0 -350px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar span.collapse{cursor:pointer;position:absolute;top:4px;right:2px;display:block;overflow:hidden;height:15px;width:15px;text-indent:9999px;}
+.yui-skin-sam .yui-toolbar-container .yui-push-button,.yui-skin-sam .yui-toolbar-container .yui-color-button,.yui-skin-sam .yui-toolbar-container .yui-menu-button{background:url(sprite.png) repeat-x 0 0;position:relative;display:block;height:22px;width:30px;_font-size:0;margin:0;border-color:#808080;color:#f2f2f2;border-style:solid;border-width:1px 0;zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-push-button a,.yui-skin-sam .yui-toolbar-container .yui-color-button a,.yui-skin-sam .yui-toolbar-container .yui-menu-button a{padding-left:35px;height:20px;text-decoration:none;font-size:0;line-height:2;display:block;color:#000;overflow:hidden;white-space:nowrap;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-push-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button .first-child{border-color:#808080;border-style:solid;border-width:0 1px;margin:0 -1px;display:block;position:relative;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-button .first-child{*left:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-fontname{width:135px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-heading{width:92px;}.yui-skin-sam .yui-toolbar-container .yui-button-hover{background:url(sprite.png) repeat-x 0 -1300px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-button-selected{background:url(sprite.png) repeat-x 0 -1700px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels .yui-toolbar-group{margin-top:.75em;}.yui-skin-sam .yui-toolbar-container .yui-push-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-color-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-menu-button span.yui-toolbar-icon{display:block;position:absolute;top:2px;height:18px;width:18px;overflow:hidden;background:url(editor-sprite.gif) no-repeat 30px 30px;}.yui-skin-sam .yui-toolbar-container .yui-button-selected span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-button-hover span.yui-toolbar-icon{background-image:url(editor-sprite-active.gif);}.yui-skin-sam .yui-toolbar-container .visible .yuimenuitemlabel{cursor:pointer;color:#000;*position:relative;}.yui-skin-sam .yui-toolbar-container .yui-button-menu{background-color:#fff;}.yui-skin-sam .yui-toolbar-container .yui-button-menu .yui-menu-body-scrolled{position:relative;}.yui-skin-sam div.yuimenu li.selected{background-color:#B3D4FF;}.yui-skin-sam div.yuimenu li.selected a.selected{color:#000;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bold span.yui-toolbar-icon{background-position:0 0;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-strikethrough span.yui-toolbar-icon{background-position:0 -108px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-italic span.yui-toolbar-icon{background-position:0 -36px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-undo span.yui-toolbar-icon{background-position:0 -1326px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-redo span.yui-toolbar-icon{background-position:0 -1355px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-underline span.yui-toolbar-icon{background-position:0 -72px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subscript span.yui-toolbar-icon{background-position:0 -180px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-superscript span.yui-toolbar-icon{background-position:0 -144px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-forecolor span.yui-toolbar-icon{background-position:0 -216px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-backcolor span.yui-toolbar-icon{background-position:0 -288px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyleft span.yui-toolbar-icon{background-position:0 -324px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifycenter span.yui-toolbar-icon{background-position:0 -360px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyright span.yui-toolbar-icon{background-position:0 -396px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyfull span.yui-toolbar-icon{background-position:0 -432px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-indent span.yui-toolbar-icon{background-position:0 -720px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-outdent span.yui-toolbar-icon{background-position:0 -684px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-createlink span.yui-toolbar-icon{background-position:0 -792px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertimage span.yui-toolbar-icon{background-position:1px -756px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-left span.yui-toolbar-icon{background-position:0 -972px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-right span.yui-toolbar-icon{background-position:0 -936px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-inline span.yui-toolbar-icon{background-position:0 -900px;left:5px;}
+.yui-skin-sam .yui-toolbar-container .yui-toolbar-block span.yui-toolbar-icon{background-position:0 -864px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bordercolor span.yui-toolbar-icon{background-position:0 -252px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-removeformat span.yui-toolbar-icon{background-position:0 -1080px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-hiddenelements span.yui-toolbar-icon{background-position:0 -1044px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertunorderedlist span.yui-toolbar-icon{background-position:0 -468px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertorderedlist span.yui-toolbar-icon{background-position:0 -504px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child{width:35px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child a{padding-left:2px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton span.yui-toolbar-icon{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{right:2px;background:url(editor-sprite.gif) no-repeat 0 -1222px;overflow:hidden;height:6px;width:7px;min-height:0;padding:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up{top:2px;background-position:0 -1222px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{bottom:2px;background-position:0 -1187px;}.yui-skin-sam .yui-toolbar-container select{height:22px;border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select .first-child a{padding-left:5px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select span.yui-toolbar-icon{background:url(editor-sprite.gif) no-repeat 0 -1144px;overflow:hidden;right:-2px;top:0;height:20px;}.yui-skin-sam .yui-editor-panel .yui-color-button-menu .bd{background-color:transparent;border:none;width:135px;}.yui-skin-sam .yui-color-button-menu .yui-toolbar-colors{border:1px solid #808080;}.yui-skin-sam .yui-editor-panel{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;position:absolute;}.yui-skin-sam .yui-editor-panel .hd{margin:10px 0 0;padding:0;border:none;}.yui-skin-sam .yui-editor-panel .hd h3{color:#000;border:1px solid #808080;background:url(sprite.png) repeat-x 0 -200px;width:99%;position:relative;margin:0;padding:3px 0 0 0;font-size:93%;text-indent:5px;height:20px;}.yui-skin-sam .yui-editor-panel .bd{background-color:#F2F2F2;border-left:1px solid #808080;border-right:1px solid #808080;width:99%;margin:0;padding:0;overflow:visible;}.yui-skin-sam .yui-editor-panel ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-panel ul li{margin:0;padding:0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .yui-toolbar-subcont{padding:0;border:none;margin-top:.35em;}.yui-skin-sam .yui-editor-panel .yui-toolbar-bordersize,.yui-skin-sam .yui-editor-panel .yui-toolbar-bordertype{width:50px;}.yui-skin-sam .yui-editor-panel label{display:block;float:none;padding:4px 0;margin-bottom:7px;}.yui-skin-sam .yui-editor-panel label strong{font-weight:normal;font-size:93%;text-align:right;padding-top:2px;}.yui-skin-sam .yui-editor-panel label input{width:75%;}.yui-skin-sam .yui-editor-panel .createlink_target,.yui-skin-sam .yui-editor-panel .insertimage_target{width:auto;margin-right:5px;}.yui-skin-sam .yui-editor-panel .removeLink{width:98%;}.yui-skin-sam .yui-editor-panel label input.warning{background-color:#FFEE69;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group h3{color:#000;float:left;font-weight:normal;font-size:93%;margin:5px 0 0 0;padding:0 3px 0 0;text-align:right;}.yui-skin-sam .yui-editor-panel .height-width h3{margin:3px 0 0 10px;}.yui-skin-sam .yui-editor-panel .height-width{margin:3px 0 0 35px;*margin-left:14px;width:42%;*width:44%;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-border{width:190px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-border{width:210px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding{width:203px;_width:198px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-padding{width:172px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding h3{margin-left:25px;*margin-left:12px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-textflow{width:182px;}.yui-skin-sam .yui-editor-panel .hd{background:none;}.yui-skin-sam .yui-editor-panel .ft{background-color:#F2F2F2;border:1px solid #808080;border-top:none;padding:0;margin:0 0 2px 0;}.yui-skin-sam .yui-editor-panel .hd span.close{background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;display:block;height:16px;overflow:hidden;position:absolute;right:5px;text-indent:500px;top:2px;width:26px;}.yui-skin-sam .yui-editor-panel .ft span.tip{background-color:#EDF5FF;border-top:1px solid #808080;font-size:85%;}.yui-skin-sam .yui-editor-panel .ft span.tip strong{display:block;float:left;margin:0 2px 8px 0;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon{background:url(editor-sprite.gif) no-repeat 0 -1260px;display:block;height:20px;left:2px;position:absolute;top:8px;width:20px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-info{background-position:2px -1260px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-warn{background-position:2px -1296px;}.yui-skin-sam .yui-editor-panel .hd span.knob{position:absolute;height:10px;width:28px;top:-10px;left:25px;text-indent:9999px;overflow:hidden;background:url(editor-knob.gif) no-repeat 0 0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container{float:left;width:100%;background-image:none;border:none;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .bd{background-color:#fff;}.yui-editor-blankimage{background-image:url(blankimage.png);}.yui-skin-sam .yui-editor-container .yui-resize-handle-br{height:11px;width:11px;background-position:-20px -60px;background-color:transparent;}
+.yui-crop{position:relative;}.yui-crop .yui-crop-mask{position:absolute;top:0;left:0;height:100%;width:100%;}.yui-crop .yui-resize{position:absolute;top:10px;left:10px;border:0;}.yui-crop .yui-crop-resize-mask{position:absolute;top:0;left:0;height:100%;width:100%;background-position:-10px -10px;overflow:hidden;}.yui-skin-sam .yui-crop .yui-crop-mask{background-color:#000;opacity:.5;filter:alpha(opacity=50);}.yui-skin-sam .yui-crop .yui-resize{border:1px dashed #fff;}
+.yui-layout-loading{visibility:hidden;}body.yui-layout{overflow:hidden;position:relative;padding:0;margin:0;}.yui-layout-doc{position:relative;overflow:hidden;padding:0;margin:0;}.yui-layout-unit{height:50px;width:50px;padding:0;margin:0;float:none;z-index:0;}.yui-layout-unit-top{position:absolute;top:0;left:0;width:100%;}.yui-layout-unit-left{position:absolute;top:0;left:0;}.yui-layout-unit-right{position:absolute;top:0;right:0;}.yui-layout-unit-bottom{position:absolute;bottom:0;left:0;width:100%;}.yui-layout-unit-center{position:absolute;top:0;left:0;width:100%;}.yui-layout div.yui-layout-hd{position:absolute;top:0;left:0;zoom:1;width:100%;}.yui-layout div.yui-layout-bd{position:absolute;top:0;left:0;zoom:1;width:100%;}.yui-layout .yui-layout-noscroll div.yui-layout-bd{overflow:hidden;}.yui-layout .yui-layout-scroll div.yui-layout-bd{overflow:auto;}.yui-layout div.yui-layout-ft{position:absolute;bottom:0;left:0;width:100%;zoom:1;}.yui-layout .yui-layout-unit div.yui-layout-hd h2{text-align:left;}.yui-layout .yui-layout-unit div.yui-layout-hd .collapse{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-unit div.yui-layout-hd .close{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-unit div.yui-layout-hd .collapse-close{right:25px;}.yui-layout .yui-layout-clip{position:absolute;height:20px;background-color:#c0c0c0;display:none;}.yui-layout .yui-layout-clip .collapse{cursor:pointer;height:13px;position:absolute;right:2px;top:2px;width:17px;font-size:0;}.yui-layout .yui-layout-wrap{height:100%;width:100%;position:absolute;left:0;}.yui-skin-sam .yui-layout .yui-resize-proxy{border:none;font-size:0;margin:0;padding:0;}.yui-skin-sam .yui-layout .yui-resize-resizing .yui-resize-handle{display:none;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy div{position:absolute;border:1px solid #808080;background-color:#EDF5FF;}.yui-skin-sam .yui-layout .yui-resize .yui-resize-handle-active{zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-l{width:5px;height:100%;top:0;left:0;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-r{width:5px;top:0;right:0;height:100%;position:absolute;zoom:1;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-b{width:100%;bottom:0;left:0;height:5px;}.yui-skin-sam .yui-layout .yui-resize-proxy .yui-layout-handle-t{width:100%;top:0;left:0;height:5px;}.yui-skin-sam .yui-layout .yui-layout-unit-left div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -160px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-left .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -140px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-right div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -200px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-right .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -120px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-top div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -220px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-top .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -240px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit-bottom div.yui-layout-hd .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -260px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip-bottom .collapse{background:transparent url(layout_sprite.png) no-repeat -20px -180px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd .close{background:transparent url(layout_sprite.png) no-repeat -20px -100px;border:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-hd{background:url(sprite.png) repeat-x 0 -1400px;border:1px solid #808080;}.yui-skin-sam .yui-layout{background-color:#EDF5FF;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd h2{font-weight:bold;color:#fff;padding:3px;margin:0;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd{border:1px solid #808080;border-bottom:none;border-top:none;*border-bottom-width:0;*border-top-width:0;background-color:#f2f2f2;text-align:left;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-noft{border-bottom:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd-nohd{border-top:1px solid #808080;}.yui-skin-sam .yui-layout .yui-layout-clip{position:absolute;height:20px;background-color:#EDF5FF;display:none;border:1px solid #808080;}.yui-skin-sam .yui-layout div.yui-layout-ft{border:1px solid #808080;border-top:none;*border-top-width:0;background-color:#f2f2f2;}.yui-skin-sam .yui-layout-unit .yui-resize-handle{background-color:transparent;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-r{right:0;top:0;background-image:none;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-l{left:0;top:0;background-image:none;zoom:1;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-b{right:0;bottom:0;background-image:none;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-t{right:0;top:0;background-image:none;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-r .yui-layout-resize-knob,.yui-skin-sam .yui-layout-unit .yui-resize-handle-l .yui-layout-resize-knob{position:absolute;height:16px;width:6px;top:45%;left:0;display:block;background:transparent url(layout_sprite.png) no-repeat 0 -5px;}.yui-skin-sam .yui-layout-unit .yui-resize-handle-t .yui-layout-resize-knob,.yui-skin-sam .yui-layout-unit .yui-resize-handle-b .yui-layout-resize-knob{position:absolute;height:6px;width:16px;left:45%;background:transparent url(layout_sprite.png) no-repeat -20px 0;zoom:1;}
+.yui-skin-sam .yui-log{padding:1em;width:31em;background-color:#AAA;color:#000;border:1px solid black;font-family:monospace;font-size:77%;text-align:left;z-index:9000;}.yui-skin-sam .yui-log-container{position:absolute;top:1em;right:1em;}.yui-skin-sam .yui-log input{margin:0;padding:0;font-family:arial;font-size:100%;font-weight:normal;}.yui-skin-sam .yui-log .yui-log-btns{position:relative;float:right;bottom:.25em;}.yui-skin-sam .yui-log .yui-log-hd{margin-top:1em;padding:.5em;background-color:#575757;}.yui-skin-sam .yui-log .yui-log-hd h4{margin:0;padding:0;font-size:108%;font-weight:bold;color:#FFF;}.yui-skin-sam .yui-log .yui-log-bd{width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}.yui-skin-sam .yui-log p{margin:1px;padding:.1em;}.yui-skin-sam .yui-log pre{margin:0;padding:0;}.yui-skin-sam .yui-log pre.yui-log-verbose{white-space:pre-wrap;white-space:-moz-pre-wrap!important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;}.yui-skin-sam .yui-log .yui-log-ft{margin-top:.5em;}.yui-skin-sam .yui-log .yui-log-ft .yui-log-sourcefilters{width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}.yui-skin-sam .yui-log .yui-log-filtergrp{margin-right:.5em;}.yui-skin-sam .yui-log .info{background-color:#A7CC25;}.yui-skin-sam .yui-log .warn{background-color:#F58516;}.yui-skin-sam .yui-log .error{background-color:#E32F0B;}.yui-skin-sam .yui-log .time{background-color:#A6C9D7;}.yui-skin-sam .yui-log .window{background-color:#F2E886;}
+.yuimenu{top:-999em;left:-999em;}.yuimenubar{position:static;}.yuimenu .yuimenu,.yuimenubar .yuimenu{position:absolute;}.yuimenubar li,.yuimenu li{list-style-type:none;}.yuimenubar ul,.yuimenu ul,.yuimenubar li,.yuimenu li,.yuimenu h6,.yuimenubar h6{margin:0;padding:0;}.yuimenuitemlabel,.yuimenubaritemlabel{text-align:left;white-space:nowrap;}.yuimenubar ul{*zoom:1;}.yuimenubar .yuimenu ul{*zoom:normal;}.yuimenubar>.bd>ul:after{content:".";display:block;clear:both;visibility:hidden;height:0;line-height:0;}.yuimenubaritem{float:left;}.yuimenubaritemlabel,.yuimenuitemlabel{display:block;}.yuimenuitemlabel .helptext{font-style:normal;display:block;margin:-1em 0 0 10em;}.yui-menu-shadow{position:absolute;visibility:hidden;z-index:-1;}.yui-menu-shadow-visible{top:2px;right:-3px;left:-3px;bottom:-3px;visibility:visible;}.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.yuimenu.show-scrollbars,.yuimenubar.show-scrollbars{overflow:visible;}.yuimenu.hide-scrollbars .yui-menu-shadow,.yuimenubar.hide-scrollbars .yui-menu-shadow{overflow:hidden;}.yuimenu.show-scrollbars .yui-menu-shadow,.yuimenubar.show-scrollbars .yui-menu-shadow{overflow:auto;}.yui-overlay.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .yuimenubar{font-size:93%;line-height:2;*line-height:1.9;border:solid 1px #808080;background:url(sprite.png) repeat-x 0 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritem{border-right:solid 1px #ccc;}.yui-skin-sam .yuimenubaritemlabel{padding:0 10px;color:#000;text-decoration:none;cursor:default;border-style:solid;border-color:#808080;border-width:1px 0;*position:relative;margin:-1px 0;}.yui-skin-sam .yuimenubaritemlabel:visited{color:#000;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel{padding-right:20px;*display:inline-block;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu{background:url(menubaritem_submenuindicator.png) right center no-repeat;}.yui-skin-sam .yuimenubaritem-selected{background:url(sprite.png) repeat-x 0 -1700px;}.yui-skin-sam .yuimenubaritemlabel-selected{border-color:#7D98B8;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-selected{border-left-width:1px;margin-left:-1px;*left:-1px;}.yui-skin-sam .yuimenubaritemlabel-disabled,.yui-skin-sam .yuimenubaritemlabel-disabled:visited{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu-disabled{background-image:url(menubaritem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenu{font-size:93%;line-height:1.5;*line-height:1.45;}.yui-skin-sam .yuimenubar .yuimenu,.yui-skin-sam .yuimenu .yuimenu{font-size:100%;}.yui-skin-sam .yuimenu .bd{*zoom:1;_zoom:normal;border:solid 1px #808080;background-color:#fff;}.yui-skin-sam .yuimenu .yuimenu .bd{*zoom:normal;}.yui-skin-sam .yuimenu ul{padding:3px 0;border-width:1px 0 0 0;border-color:#ccc;border-style:solid;}.yui-skin-sam .yuimenu ul.first-of-type{border-width:0;}.yui-skin-sam .yuimenu h6{font-weight:bold;border-style:solid;border-color:#ccc;border-width:1px 0 0 0;color:#a4a4a4;padding:3px 10px 0 10px;}.yui-skin-sam .yuimenu ul.hastitle,.yui-skin-sam .yuimenu h6.first-of-type{border-width:0;}.yui-skin-sam .yuimenu .yui-menu-body-scrolled{border-color:#ccc #808080;overflow:hidden;}.yui-skin-sam .yuimenu .topscrollbar,.yui-skin-sam .yuimenu .bottomscrollbar{height:16px;border:solid 1px #808080;background:#fff url(sprite.png) no-repeat 0 0;}.yui-skin-sam .yuimenu .topscrollbar{border-bottom-width:0;background-position:center -950px;}.yui-skin-sam .yuimenu .topscrollbar_disabled{background-position:center -975px;}.yui-skin-sam .yuimenu .bottomscrollbar{border-top-width:0;background-position:center -850px;}.yui-skin-sam .yuimenu .bottomscrollbar_disabled{background-position:center -875px;}.yui-skin-sam .yuimenuitem{_border-bottom:solid 1px #fff;}.yui-skin-sam .yuimenuitemlabel{padding:0 20px;color:#000;text-decoration:none;cursor:default;}.yui-skin-sam .yuimenuitemlabel:visited{color:#000;}.yui-skin-sam .yuimenuitemlabel .helptext{margin-top:-1.5em;*margin-top:-1.45em;}.yui-skin-sam .yuimenuitem-hassubmenu{background-image:url(menuitem_submenuindicator.png);background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yuimenuitem-checked{background-image:url(menuitem_checkbox.png);background-position:left center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-shadow-visible{background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yuimenuitem-selected{background-color:#B3D4FF;}.yui-skin-sam .yuimenuitemlabel-disabled,.yui-skin-sam .yuimenuitemlabel-disabled:visited{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenuitem-hassubmenu-disabled{background-image:url(menuitem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenuitem-checked-disabled{background-image:url(menuitem_checkbox_disabled.png);}
+.yui-skin-sam .yui-pg-container{display:block;margin:6px 0;white-space:nowrap;}.yui-skin-sam .yui-pg-first,.yui-skin-sam .yui-pg-previous,.yui-skin-sam .yui-pg-next,.yui-skin-sam .yui-pg-last,.yui-skin-sam .yui-pg-current,.yui-skin-sam .yui-pg-pages,.yui-skin-sam .yui-pg-page{display:inline-block;font-family:arial,helvetica,clean,sans-serif;padding:3px 6px;zoom:1;}.yui-skin-sam .yui-pg-pages{padding:0;}.yui-skin-sam .yui-pg-current{padding:3px 0;}.yui-skin-sam a.yui-pg-first:link,.yui-skin-sam a.yui-pg-first:visited,.yui-skin-sam a.yui-pg-first:active,.yui-skin-sam a.yui-pg-first:hover,.yui-skin-sam a.yui-pg-previous:link,.yui-skin-sam a.yui-pg-previous:visited,.yui-skin-sam a.yui-pg-previous:active,.yui-skin-sam a.yui-pg-previous:hover,.yui-skin-sam a.yui-pg-next:link,.yui-skin-sam a.yui-pg-next:visited,.yui-skin-sam a.yui-pg-next:active,.yui-skin-sam a.yui-pg-next:hover,.yui-skin-sam a.yui-pg-last:link,.yui-skin-sam a.yui-pg-last:visited,.yui-skin-sam a.yui-pg-last:active,.yui-skin-sam a.yui-pg-last:hover,.yui-skin-sam a.yui-pg-page:link,.yui-skin-sam a.yui-pg-page:visited,.yui-skin-sam a.yui-pg-page:active,.yui-skin-sam a.yui-pg-page:hover{color:#06c;text-decoration:underline;outline:0;}.yui-skin-sam span.yui-pg-first,.yui-skin-sam span.yui-pg-previous,.yui-skin-sam span.yui-pg-next,.yui-skin-sam span.yui-pg-last{color:#a6a6a6;}.yui-skin-sam .yui-pg-page{background-color:#fff;border:1px solid #CBCBCB;padding:2px 6px;text-decoration:none;}.yui-skin-sam .yui-pg-current-page{background-color:transparent;border:none;font-weight:bold;padding:3px 6px;}.yui-skin-sam .yui-pg-page{margin-left:1px;margin-right:1px;}.yui-skin-sam .yui-pg-first,.yui-skin-sam .yui-pg-previous{padding-left:0;}.yui-skin-sam .yui-pg-next,.yui-skin-sam .yui-pg-last{padding-right:0;}.yui-skin-sam .yui-pg-current,.yui-skin-sam .yui-pg-rpp-options{margin-left:1em;margin-right:1em;}
+.yui-skin-sam .yui-pv{background-color:#4a4a4a;font:arial;position:relative;width:99%;z-index:1000;margin-bottom:1em;overflow:hidden;}.yui-skin-sam .yui-pv .hd{background:url(header_background.png) repeat-x;min-height:30px;overflow:hidden;zoom:1;padding:2px 0;}.yui-skin-sam .yui-pv .hd h4{padding:8px 10px;margin:0;font:bold 14px arial;color:#fff;}.yui-skin-sam .yui-pv .hd a{background:#3f6bc3;font:bold 11px arial;color:#fff;padding:4px;margin:3px 10px 0 0;border:1px solid #3f567d;cursor:pointer;display:block;float:right;}.yui-skin-sam .yui-pv .hd span{display:none;}.yui-skin-sam .yui-pv .hd span.yui-pv-busy{height:18px;width:18px;background:url(wait.gif) no-repeat;overflow:hidden;display:block;float:right;margin:4px 10px 0 0;}.yui-skin-sam .yui-pv .hd:after,.yui-pv .bd:after,.yui-skin-sam .yui-pv-chartlegend dl:after{content:'.';visibility:hidden;clear:left;height:0;display:block;}.yui-skin-sam .yui-pv .bd{position:relative;zoom:1;overflow-x:auto;overflow-y:hidden;}.yui-skin-sam .yui-pv .yui-pv-table{padding:0 10px;margin:5px 0 10px 0;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-bd td{color:#eeee5c;font:12px arial;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd{background:#929292;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even{background:#58637a;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even td.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-even td.yui-dt-desc{background:#384970;}.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd td.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table tr.yui-dt-odd td.yui-dt-desc{background:#6F6E6E;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th{background-image:none;background:#2E2D2D;}.yui-skin-sam .yui-pv th.yui-dt-asc .yui-dt-liner{background:transparent url(asc.gif) no-repeat scroll right center;}.yui-skin-sam .yui-pv th.yui-dt-desc .yui-dt-liner{background:transparent url(desc.gif) no-repeat scroll right center;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th a{color:#fff;font:bold 12px arial;}.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th.yui-dt-asc,.yui-skin-sam .yui-pv .yui-pv-table .yui-dt-hd th.yui-dt-desc{background:#333;}.yui-skin-sam .yui-pv-chartcontainer{padding:0 10px;}.yui-skin-sam .yui-pv-chart{height:250px;clear:right;margin:5px 0 0 0;color:#fff;}.yui-skin-sam .yui-pv-chartlegend div{float:right;margin:0 0 0 10px;_width:250px;}.yui-skin-sam .yui-pv-chartlegend dl{border:1px solid #999;padding:.2em 0 .2em .5em;zoom:1;margin:5px 0;}.yui-skin-sam .yui-pv-chartlegend dt{float:left;display:block;height:.7em;width:.7em;padding:0;}.yui-skin-sam .yui-pv-chartlegend dd{float:left;display:block;color:#fff;margin:0 1em 0 .5em;padding:0;font:11px arial;}.yui-skin-sam .yui-pv-minimized{height:35px;}.yui-skin-sam .yui-pv-minimized .bd{top:-3000px;}.yui-skin-sam .yui-pv-minimized .hd a.yui-pv-refresh{display:none;}
+.yui-pb-bar,.yui-pb-mask{width:100%;height:100%;}.yui-pb{position:relative;top:0;left:0;width:200px;height:20px;padding:0;border:none;margin:0;text-align:left;}.yui-pb-mask{position:absolute;top:0;left:0;z-index:2;}.yui-pb-mask div{width:50%;height:50%;background-repeat:no-repeat;padding:0;position:absolute;}.yui-pb-tl{background-position:top left;}.yui-pb-tr{background-position:top right;left:50%;}.yui-pb-bl{background-position:bottom left;top:50%;}.yui-pb-br{background-position:bottom right;left:50%;top:50%;}.yui-pb-bar{margin:0;position:absolute;left:0;top:0;z-index:1;}.yui-pb-ltr .yui-pb-bar{_position:static;}.yui-pb-rtl .yui-pb-bar{background-position:right;}.yui-pb-btt .yui-pb-bar{background-position:left bottom;}.yui-pb-bar{background-color:blue;}.yui-pb{border:thin solid #808080;}.yui-skin-sam .yui-pb{background-color:transparent;border:solid #808080;border-width:1px 0;}.yui-skin-sam .yui-pb-rtl,.yui-skin-sam .yui-pb-ltr{background-image:url(back-h.png);background-repeat:repeat-x;}.yui-skin-sam .yui-pb-ttb,.yui-skin-sam .yui-pb-btt{background-image:url(back-v.png);background-repeat:repeat-y;}.yui-skin-sam .yui-pb-bar{background-color:transparent;}.yui-skin-sam .yui-pb-ltr .yui-pb-bar,.yui-skin-sam .yui-pb-rtl .yui-pb-bar{background-image:url(bar-h.png);background-repeat:repeat-x;}.yui-skin-sam .yui-pb-ttb .yui-pb-bar,.yui-skin-sam .yui-pb-btt .yui-pb-bar{background-image:url(bar-v.png);background-repeat:repeat-y;}.yui-skin-sam .yui-pb-mask{border:solid #808080;border-width:0 1px;margin:0 -1px;}.yui-skin-sam .yui-pb-caption{color:#000;text-align:center;margin:0 auto;}.yui-skin-sam .yui-pb-range{color:#a6a6a6;}
+.yui-resize{position:relative;zoom:1;z-index:0;}.yui-resize-wrap{zoom:1;}.yui-draggable{cursor:move;}.yui-resize .yui-resize-handle{position:absolute;z-index:1;font-size:0;margin:0;padding:0;zoom:1;height:1px;width:1px;}.yui-resize .yui-resize-handle-br{height:5px;width:5px;bottom:0;right:0;cursor:se-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-bl{height:5px;width:5px;bottom:0;left:0;cursor:sw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tl{height:5px;width:5px;top:0;left:0;cursor:nw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tr{height:5px;width:5px;top:0;right:0;cursor:ne-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-r{width:5px;height:100%;top:0;right:0;cursor:e-resize;zoom:1;}.yui-resize .yui-resize-handle-l{height:100%;width:5px;top:0;left:0;cursor:w-resize;zoom:1;}.yui-resize .yui-resize-handle-b{width:100%;height:5px;bottom:0;right:0;cursor:s-resize;zoom:1;}.yui-resize .yui-resize-handle-t{width:100%;height:5px;top:0;right:0;cursor:n-resize;zoom:1;}.yui-resize-proxy{position:absolute;border:1px dashed #000;visibility:hidden;z-index:1000;}.yui-resize-hover .yui-resize-handle,.yui-resize-hidden .yui-resize-handle{opacity:0;filter:alpha(opacity=0);}.yui-resize-ghost{opacity:.5;filter:alpha(opacity=50);}.yui-resize-knob .yui-resize-handle{height:6px;width:6px;}.yui-resize-knob .yui-resize-handle-tr{right:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-tl{left:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-bl{left:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-br{right:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-t{left:45%;top:-3px;}.yui-resize-knob .yui-resize-handle-r{right:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-l{left:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-b{left:45%;bottom:-3px;}.yui-resize-status{position:absolute;top:-999px;left:-999px;padding:2px;font-size:80%;display:none;zoom:1;z-index:9999;}.yui-resize-status strong,.yui-resize-status em{font-weight:normal;font-style:normal;padding:1px;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle{background-color:#F2F2F2;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle-active{background-color:#7D98B8;zoom:1;}.yui-skin-sam .yui-resize .yui-resize-handle-l,.yui-skin-sam .yui-resize .yui-resize-handle-r,.yui-skin-sam .yui-resize .yui-resize-handle-l-active,.yui-skin-sam .yui-resize .yui-resize-handle-r-active{height:100%;zoom:1;}.yui-skin-sam .yui-resize-knob .yui-resize-handle{border:1px solid #808080;}.yui-skin-sam .yui-resize-hover .yui-resize-handle-active{opacity:1;filter:alpha(opacity=100);}.yui-skin-sam .yui-resize-proxy{border:1px dashed #426FD9;}.yui-skin-sam .yui-resize-status{border:1px solid #A6982B;border-top:1px solid #D4C237;background-color:#FFEE69;color:#000;}.yui-skin-sam .yui-resize-status strong,.yui-skin-sam .yui-resize-status em{float:left;display:block;clear:both;padding:1px;text-align:center;}.yui-skin-sam .yui-resize .yui-resize-handle-inner-r,.yui-skin-sam .yui-resize .yui-resize-handle-inner-l{background:transparent url(layout_sprite.png) no-repeat 0 -5px;height:16px;width:5px;position:absolute;top:45%;}.yui-skin-sam .yui-resize .yui-resize-handle-inner-t,.yui-skin-sam .yui-resize .yui-resize-handle-inner-b{background:transparent url(layout_sprite.png) no-repeat -20px 0;height:5px;width:16px;position:absolute;left:50%;}.yui-skin-sam .yui-resize .yui-resize-handle-br{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -62px;}.yui-skin-sam .yui-resize .yui-resize-handle-tr{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -42px;}.yui-skin-sam .yui-resize .yui-resize-handle-tl{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -82px;}.yui-skin-sam .yui-resize .yui-resize-handle-bl{background-image:url(layout_sprite.png);background-repeat:no-repeat;background-position:-22px -23px;}.yui-skin-sam .yui-resize-knob .yui-resize-handle-t,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-b,.yui-skin-sam .yui-resize-knob .yui-resize-handle-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-tl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-tr,.yui-skin-sam .yui-resize-knob .yui-resize-handle-bl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-br,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-t,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-b,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-tl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-tr,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-bl,.yui-skin-sam .yui-resize-knob .yui-resize-handle-inner-br{background-image:none;}.yui-skin-sam .yui-resize-knob .yui-resize-handle-l,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r,.yui-skin-sam .yui-resize-knob .yui-resize-handle-l-active,.yui-skin-sam .yui-resize-knob .yui-resize-handle-r-active{height:6px;width:6px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-r{right:-8px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-b{bottom:-8px;}.yui-skin-sam .yui-resize-textarea .yui-resize-handle-br{right:-8px;bottom:-8px;}
+.yui-busy{cursor:wait!important;}.yui-toolbar-container fieldset,.yui-editor-container fieldset{padding:0;margin:0;border:0;}.yui-toolbar-container legend{display:none;}.yui-skin-sam .yui-toolbar-container .yui-button button,.yui-skin-sam .yui-toolbar-container .yui-button a,.yui-skin-sam .yui-toolbar-container .yui-button a:visited{font-size:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a:visited,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton button,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a:visited{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{font-size:0;line-height:0;padding:0;}.yui-toolbar-container .yui-toolbar-subcont{padding:.25em 0;zoom:1;}.yui-toolbar-container-collapsed .yui-toolbar-subcont{display:none;}.yui-toolbar-container .yui-toolbar-subcont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container span.yui-toolbar-draghandle{cursor:move;border-left:1px solid #999;border-right:1px solid #999;overflow:hidden;text-indent:77777px;width:2px;height:20px;display:block;clear:none;float:left;margin:0 0 0 .2em;}.yui-toolbar-container .yui-toolbar-titlebar.draggable{cursor:move;}.yui-toolbar-container .yui-toolbar-titlebar{position:relative;}.yui-toolbar-container .yui-toolbar-titlebar h2{font-weight:bold;letter-spacing:0;border:none;color:#000;margin:0;padding:.2em;}.yui-toolbar-container .yui-toolbar-titlebar h2 a{text-decoration:none;color:#000;cursor:default;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-draghandle{height:40px;}.yui-toolbar-container .yui-toolbar-group{float:left;margin-right:.5em;zoom:1;}.yui-toolbar-container .yui-toolbar-group:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-container .yui-toolbar-group h3{font-size:75%;padding:0 0 0 .25em;margin:0;}.yui-toolbar-container span.yui-toolbar-separator{width:2px;padding:0;height:18px;margin:.2em 0 .2em .1em;display:none;float:left;}.yui-toolbar-container.yui-toolbar-grouped span.yui-toolbar-separator{height:45px;*height:50px;}.yui-toolbar-container.yui-toolbar-grouped .yui-toolbar-group span.yui-toolbar-separator{height:18px;display:block;}.yui-toolbar-container ul li{margin:0;padding:0;list-style-type:none;}.yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-toolbar-container .yui-push-button,.yui-toolbar-container .yui-color-button,.yui-toolbar-container .yui-menu-button{position:relative;cursor:pointer;}.yui-toolbar-container .yui-button .first-child,.yui-toolbar-container .yui-button .first-child a{height:100%;width:100%;overflow:hidden;font-size:0;}.yui-toolbar-container .yui-button-disabled{cursor:default;}.yui-toolbar-container .yui-button-disabled .yui-toolbar-icon{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button-disabled .up,.yui-toolbar-container .yui-button-disabled .down{opacity:.5;filter:alpha(opacity=50);}.yui-toolbar-container .yui-button a{overflow:hidden;}.yui-toolbar-container .yui-toolbar-select .first-child a{cursor:pointer;}.yui-toolbar-fontname-arial{font-family:Arial;}.yui-toolbar-fontname-arial-black{font-family:Arial Black;}.yui-toolbar-fontname-comic-sans-ms{font-family:Comic Sans MS;}.yui-toolbar-fontname-courier-new{font-family:Courier New;}.yui-toolbar-fontname-times-new-roman{font-family:Times New Roman;}.yui-toolbar-fontname-verdana{font-family:Verdana;}.yui-toolbar-fontname-impact{font-family:Impact;}.yui-toolbar-fontname-lucida-console{font-family:Lucida Console;}.yui-toolbar-fontname-tahoma{font-family:Tahoma;}.yui-toolbar-fontname-trebuchet-ms{font-family:Trebuchet MS;}.yui-toolbar-container .yui-toolbar-spinbutton{position:relative;}.yui-toolbar-container .yui-toolbar-spinbutton .first-child a{z-index:0;opacity:1;}.yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-toolbar-container .yui-toolbar-spinbutton a.down{position:absolute;display:block;right:0;cursor:pointer;z-index:1;padding:0;margin:0;}.yui-toolbar-container .yui-overlay{position:absolute;}.yui-toolbar-container .yui-overlay ul li{margin:0;list-style-type:none;}.yui-toolbar-container{z-index:1;}.yui-editor-container .yui-editor-editable-container{position:relative;z-index:0;width:100%;}.yui-editor-container .yui-editor-masked{background-color:#CCC;height:100%;width:100%;position:absolute;top:0;left:0;opacity:.5;filter:alpha(opacity=50);}.yui-editor-container iframe{border:0;padding:0;margin:0;zoom:1;display:block;}.yui-editor-container .yui-editor-editable{padding:0;margin:0;}.yui-editor-container .dompath{font-size:85%;}.yui-editor-panel .hd{text-align:left;position:relative;}.yui-editor-panel .hd h3{font-weight:bold;padding:.25em 0 .25em .25em;margin:0;}.yui-editor-panel .bd{width:100%;zoom:1;position:relative;}.yui-editor-panel .bd div.yui-editor-body-cont{padding:.25em .1em;zoom:1;}.yui-editor-panel .bd .gecko form{overflow:auto;}.yui-editor-panel .bd div.yui-editor-body-cont:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-editor-panel .ft{text-align:right;width:99%;float:left;clear:both;}.yui-editor-panel .ft span.tip{display:block;position:relative;padding:.5em .5em .5em 23px;text-align:left;zoom:1;}.yui-editor-panel label{clear:both;float:left;padding:0;width:100%;text-align:left;zoom:1;}.yui-editor-panel .gecko label{overflow:auto;}.yui-editor-panel label strong{float:left;width:6em;}.yui-editor-panel .removeLink{width:80%;text-align:right;}.yui-editor-panel label input{margin-left:.25em;float:left;}.yui-editor-panel .yui-toolbar-group{margin-bottom:.75em;}.yui-editor-panel .height-width{float:left;}.yui-editor-panel .height-width span{font-style:italic;display:block;float:left;overflow:visible;}.yui-editor-panel .height-width span.info{font-size:70%;margin-top:3px;float:none;}
+.yui-editor-panel .yui-toolbar-bordersize,.yui-editor-panel .yui-toolbar-bordertype{font-size:75%;}.yui-editor-panel .yui-toolbar-container span.yui-toolbar-separator{border:none;}.yui-editor-panel .yui-toolbar-bordersize span a span,.yui-editor-panel .yui-toolbar-bordertype span a span{display:block;height:8px;left:4px;position:absolute;top:3px;_top:-5px;width:24px;text-indent:52px;font-size:0;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-solid{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dotted{border-bottom:1px dotted black;}.yui-editor-panel .yui-toolbar-bordertype span a span.yui-toolbar-bordertype-dashed{border-bottom:1px dashed black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-0{*top:0;text-indent:0;font-size:75%;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-1{border-bottom:1px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-2{border-bottom:2px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-3{top:2px;*top:-5px;border-bottom:3px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-4{top:1px;*top:-5px;border-bottom:4px solid black;}.yui-editor-panel .yui-toolbar-bordersize span a span.yui-toolbar-bordersize-5{top:1px;*top:-5px;border-bottom:5px solid black;}.yui-toolbar-container .yui-toolbar-bordersize-menu,.yui-toolbar-container .yui-toolbar-bordertype-menu{width:95px!important;}.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel,.yui-toolbar-bordersize-menu .yuimenuitemlabel,.yui-toolbar-bordertype-menu .yuimenuitemlabel:hover{margin:0 3px 7px 17px;}.yui-toolbar-bordersize-menu .yuimenuitemlabel .checkedindicator,.yui-toolbar-bordertype-menu .yuimenuitemlabel .checkedindicator{position:absolute;left:-12px;*top:14px;*left:0;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-1 a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-2 a{border-bottom:2px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-3 a{border-bottom:3px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-4 a{border-bottom:4px solid black;height:14px;}.yui-toolbar-bordersize-menu li.yui-toolbar-bordersize-5 a{border-bottom:5px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-solid a{border-bottom:1px solid black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dashed a{border-bottom:1px dashed black;height:14px;}.yui-toolbar-bordertype-menu li.yui-toolbar-bordertype-dotted a{border-bottom:1px dotted black;height:14px;}h2.yui-editor-skipheader,h3.yui-editor-skipheader{height:0;margin:0;padding:0;border:none;width:0;overflow:hidden;position:absolute;}.yui-toolbar-colors{width:133px;zoom:1;display:none;z-index:100;overflow:hidden;}.yui-toolbar-colors:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors a{height:9px;width:9px;float:left;display:block;overflow:hidden;text-indent:999px;margin:0;cursor:pointer;border:1px solid #F6F7EE;}.yui-toolbar-colors a:hover{border:1px solid black;}.yui-color-button-menu{overflow:visible;background-color:transparent;}.yui-toolbar-colors span{position:relative;display:block;padding:3px;overflow:hidden;float:left;width:100%;zoom:1;}.yui-toolbar-colors span:after{display:block;clear:both;visibility:hidden;content:'.';height:0;}.yui-toolbar-colors span em{height:35px;width:30px;float:left;display:block;overflow:hidden;text-indent:999px;margin:.75px;border:1px solid black;}.yui-toolbar-colors span strong{font-weight:normal;padding-left:3px;display:block;font-size:85%;float:left;width:65%;}.yui-toolbar-group-undoredo h3,.yui-toolbar-group-insertitem h3,.yui-toolbar-group-indentlist h3{width:68px;}.yui-toolbar-group-indentlist2 h3{width:122px;}.yui-toolbar-group-alignment h3{width:130px;}.yui-skin-sam .yui-editor-container{border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container{zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar{background:url(sprite.png) repeat-x 0 -200px;position:relative;}.yui-skin-sam .yui-editor-container .draggable .yui-toolbar-titlebar{cursor:move;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar h2{color:#000;font-weight:bold;margin:0;padding:.3em 1em;font-size:100%;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-group h3{color:#808080;font-size:75%;margin:1em 0 0;padding-bottom:0;padding-left:.25em;text-align:left;}.yui-toolbar-container span.yui-toolbar-separator{border:none;text-indent:33px;overflow:hidden;margin:0 .25em;}.yui-skin-sam .yui-toolbar-container{background-color:#F2F2F2;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subcont{padding:0 1em .35em;border-bottom:1px solid #808080;}.yui-skin-sam .yui-toolbar-container-collapsed .yui-toolbar-titlebar{border-bottom:1px solid #808080;}.yui-skin-sam .yui-editor-container .visible .yui-menu-shadow,.yui-skin-sam .yui-editor-panel .visible .yui-menu-shadow{display:none;}.yui-skin-sam .yui-editor-container ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-container ul li{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-toolbar-group ul li.yui-toolbar-groupitem{float:left;}.yui-skin-sam .yui-editor-container .dompath{background-color:#F2F2F2;border-top:1px solid #808080;color:#999;text-align:left;padding:.25em;}.yui-skin-sam .yui-toolbar-container .collapse{background:url(sprite.png) no-repeat 0 -400px;}.yui-skin-sam .yui-toolbar-container .collapsed{background:url(sprite.png) no-repeat 0 -350px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-titlebar span.collapse{cursor:pointer;position:absolute;top:4px;right:2px;display:block;overflow:hidden;height:15px;width:15px;text-indent:9999px;}
+.yui-skin-sam .yui-toolbar-container .yui-push-button,.yui-skin-sam .yui-toolbar-container .yui-color-button,.yui-skin-sam .yui-toolbar-container .yui-menu-button{background:url(sprite.png) repeat-x 0 0;position:relative;display:block;height:22px;width:30px;_font-size:0;margin:0;border-color:#808080;color:#f2f2f2;border-style:solid;border-width:1px 0;zoom:1;}.yui-skin-sam .yui-toolbar-container .yui-push-button a,.yui-skin-sam .yui-toolbar-container .yui-color-button a,.yui-skin-sam .yui-toolbar-container .yui-menu-button a{padding-left:35px;height:20px;text-decoration:none;font-size:0;line-height:2;display:block;color:#000;overflow:hidden;white-space:nowrap;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a,.yui-skin-sam .yui-toolbar-container .yui-toolbar-select a{font-size:12px;}.yui-skin-sam .yui-toolbar-container .yui-push-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button .first-child{border-color:#808080;border-style:solid;border-width:0 1px;margin:0 -1px;display:block;position:relative;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled .first-child,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled a,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-toolbar-container .yui-push-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-color-button-disabled,.yui-skin-sam .yui-toolbar-container .yui-menu-button-disabled{border-color:#ccc;}.yui-skin-sam .yui-toolbar-container .yui-button .first-child{*left:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-fontname{width:135px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-heading{width:92px;}.yui-skin-sam .yui-toolbar-container .yui-button-hover{background:url(sprite.png) repeat-x 0 -1300px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-button-selected{background:url(sprite.png) repeat-x 0 -1700px;border-color:#808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels h3{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-nogrouplabels .yui-toolbar-group{margin-top:.75em;}.yui-skin-sam .yui-toolbar-container .yui-push-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-color-button span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-menu-button span.yui-toolbar-icon{display:block;position:absolute;top:2px;height:18px;width:18px;overflow:hidden;background:url(editor-sprite.gif) no-repeat 30px 30px;}.yui-skin-sam .yui-toolbar-container .yui-button-selected span.yui-toolbar-icon,.yui-skin-sam .yui-toolbar-container .yui-button-hover span.yui-toolbar-icon{background-image:url(editor-sprite-active.gif);}.yui-skin-sam .yui-toolbar-container .visible .yuimenuitemlabel{cursor:pointer;color:#000;*position:relative;}.yui-skin-sam .yui-toolbar-container .yui-button-menu{background-color:#fff;}.yui-skin-sam .yui-toolbar-container .yui-button-menu .yui-menu-body-scrolled{position:relative;}.yui-skin-sam div.yuimenu li.selected{background-color:#B3D4FF;}.yui-skin-sam div.yuimenu li.selected a.selected{color:#000;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bold span.yui-toolbar-icon{background-position:0 0;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-strikethrough span.yui-toolbar-icon{background-position:0 -108px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-italic span.yui-toolbar-icon{background-position:0 -36px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-undo span.yui-toolbar-icon{background-position:0 -1326px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-redo span.yui-toolbar-icon{background-position:0 -1355px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-underline span.yui-toolbar-icon{background-position:0 -72px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-subscript span.yui-toolbar-icon{background-position:0 -180px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-superscript span.yui-toolbar-icon{background-position:0 -144px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-forecolor span.yui-toolbar-icon{background-position:0 -216px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-backcolor span.yui-toolbar-icon{background-position:0 -288px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyleft span.yui-toolbar-icon{background-position:0 -324px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifycenter span.yui-toolbar-icon{background-position:0 -360px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyright span.yui-toolbar-icon{background-position:0 -396px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-justifyfull span.yui-toolbar-icon{background-position:0 -432px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-indent span.yui-toolbar-icon{background-position:0 -720px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-outdent span.yui-toolbar-icon{background-position:0 -684px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-createlink span.yui-toolbar-icon{background-position:0 -792px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertimage span.yui-toolbar-icon{background-position:1px -756px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-left span.yui-toolbar-icon{background-position:0 -972px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-right span.yui-toolbar-icon{background-position:0 -936px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-inline span.yui-toolbar-icon{background-position:0 -900px;left:5px;}
+.yui-skin-sam .yui-toolbar-container .yui-toolbar-block span.yui-toolbar-icon{background-position:0 -864px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-bordercolor span.yui-toolbar-icon{background-position:0 -252px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-removeformat span.yui-toolbar-icon{background-position:0 -1080px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-hiddenelements span.yui-toolbar-icon{background-position:0 -1044px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertunorderedlist span.yui-toolbar-icon{background-position:0 -468px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-insertorderedlist span.yui-toolbar-icon{background-position:0 -504px;left:5px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child{width:35px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton .first-child a{padding-left:2px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton span.yui-toolbar-icon{display:none;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up,.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{right:2px;background:url(editor-sprite.gif) no-repeat 0 -1222px;overflow:hidden;height:6px;width:7px;min-height:0;padding:0;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.up{top:2px;background-position:0 -1222px;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-spinbutton a.down{bottom:2px;background-position:0 -1187px;}.yui-skin-sam .yui-toolbar-container select{height:22px;border:1px solid #808080;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select .first-child a{padding-left:5px;text-align:left;}.yui-skin-sam .yui-toolbar-container .yui-toolbar-select span.yui-toolbar-icon{background:url(editor-sprite.gif) no-repeat 0 -1144px;overflow:hidden;right:-2px;top:0;height:20px;}.yui-skin-sam .yui-editor-panel .yui-color-button-menu .bd{background-color:transparent;border:none;width:135px;}.yui-skin-sam .yui-color-button-menu .yui-toolbar-colors{border:1px solid #808080;}.yui-skin-sam .yui-editor-panel{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;position:absolute;}.yui-skin-sam .yui-editor-panel .hd{margin:10px 0 0;padding:0;border:none;}.yui-skin-sam .yui-editor-panel .hd h3{color:#000;border:1px solid #808080;background:url(sprite.png) repeat-x 0 -200px;width:99%;position:relative;margin:0;padding:3px 0 0 0;font-size:93%;text-indent:5px;height:20px;}.yui-skin-sam .yui-editor-panel .bd{background-color:#F2F2F2;border-left:1px solid #808080;border-right:1px solid #808080;width:99%;margin:0;padding:0;overflow:visible;}.yui-skin-sam .yui-editor-panel ul{list-style-type:none;margin:0;padding:0;}.yui-skin-sam .yui-editor-panel ul li{margin:0;padding:0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .yui-toolbar-subcont{padding:0;border:none;margin-top:.35em;}.yui-skin-sam .yui-editor-panel .yui-toolbar-bordersize,.yui-skin-sam .yui-editor-panel .yui-toolbar-bordertype{width:50px;}.yui-skin-sam .yui-editor-panel label{display:block;float:none;padding:4px 0;margin-bottom:7px;}.yui-skin-sam .yui-editor-panel label strong{font-weight:normal;font-size:93%;text-align:right;padding-top:2px;}.yui-skin-sam .yui-editor-panel label input{width:75%;}.yui-skin-sam .yui-editor-panel .createlink_target,.yui-skin-sam .yui-editor-panel .insertimage_target{width:auto;margin-right:5px;}.yui-skin-sam .yui-editor-panel .removeLink{width:98%;}.yui-skin-sam .yui-editor-panel label input.warning{background-color:#FFEE69;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group h3{color:#000;float:left;font-weight:normal;font-size:93%;margin:5px 0 0 0;padding:0 3px 0 0;text-align:right;}.yui-skin-sam .yui-editor-panel .height-width h3{margin:3px 0 0 10px;}.yui-skin-sam .yui-editor-panel .height-width{margin:3px 0 0 35px;*margin-left:14px;width:42%;*width:44%;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-border{width:190px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-border{width:210px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding{width:203px;_width:198px;}.yui-skin-sam .yui-editor-panel .no-button .yui-toolbar-group-padding{width:172px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-padding h3{margin-left:25px;*margin-left:12px;}.yui-skin-sam .yui-editor-panel .yui-toolbar-group-textflow{width:182px;}.yui-skin-sam .yui-editor-panel .hd{background:none;}.yui-skin-sam .yui-editor-panel .ft{background-color:#F2F2F2;border:1px solid #808080;border-top:none;padding:0;margin:0 0 2px 0;}.yui-skin-sam .yui-editor-panel .hd span.close{background:url(sprite.png) no-repeat 0 -300px;cursor:pointer;display:block;height:16px;overflow:hidden;position:absolute;right:5px;text-indent:500px;top:2px;width:26px;}.yui-skin-sam .yui-editor-panel .ft span.tip{background-color:#EDF5FF;border-top:1px solid #808080;font-size:85%;}.yui-skin-sam .yui-editor-panel .ft span.tip strong{display:block;float:left;margin:0 2px 8px 0;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon{background:url(editor-sprite.gif) no-repeat 0 -1260px;display:block;height:20px;left:2px;position:absolute;top:8px;width:20px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-info{background-position:2px -1260px;}.yui-skin-sam .yui-editor-panel .ft span.tip span.icon-warn{background-position:2px -1296px;}.yui-skin-sam .yui-editor-panel .hd span.knob{position:absolute;height:10px;width:28px;top:-10px;left:25px;text-indent:9999px;overflow:hidden;background:url(editor-knob.gif) no-repeat 0 0;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container{float:left;width:100%;background-image:none;border:none;}.yui-skin-sam .yui-editor-panel .yui-toolbar-container .bd{background-color:#fff;}.yui-editor-blankimage{background-image:url(blankimage.png);}.yui-skin-sam .yui-editor-container .yui-resize-handle-br{height:11px;width:11px;background-position:-20px -60px;background-color:transparent;}
+.yui-h-slider,.yui-v-slider,.yui-region-slider{position:relative;}.yui-h-slider .yui-slider-thumb,.yui-v-slider .yui-slider-thumb,.yui-region-slider .yui-slider-thumb{position:absolute;cursor:default;}.yui-skin-sam .yui-h-slider{background:url(bg-h.gif) no-repeat 5px 0;height:28px;width:228px;}.yui-skin-sam .yui-h-slider .yui-slider-thumb{top:4px;}.yui-skin-sam .yui-v-slider{background:url(bg-v.gif) no-repeat 12px 0;height:228px;width:48px;}.yui-skin-sam .yui-region-slider{height:228px;width:228px;}
+.yui-navset .yui-nav li,.yui-navset .yui-navset-top .yui-nav li,.yui-navset .yui-navset-bottom .yui-nav li{margin:0 .5em 0 0;}.yui-navset-left .yui-nav li,.yui-navset-right .yui-nav li{margin:0 0 .5em;}.yui-navset .yui-content .yui-hidden{border:0;height:0;width:0;padding:0;position:absolute;left:-999999px;overflow:hidden;visibility:hidden;}.yui-navset .yui-navset-left .yui-nav,.yui-navset .yui-navset-right .yui-nav,.yui-navset-left .yui-nav,.yui-navset-right .yui-nav{width:6em;}.yui-navset-top .yui-nav,.yui-navset-bottom .yui-nav{width:auto;}.yui-navset .yui-navset-left,.yui-navset-left{padding:0 0 0 6em;}.yui-navset-right{padding:0 6em 0 0;}.yui-navset-top,.yui-navset-bottom{padding:auto;}.yui-nav,.yui-nav li{margin:0;padding:0;list-style:none;}.yui-navset li em{font-style:normal;}.yui-navset{position:relative;zoom:1;}.yui-navset .yui-content,.yui-navset .yui-content div{zoom:1;}.yui-navset .yui-content:after{content:'';display:block;clear:both;}.yui-navset .yui-nav li,.yui-navset .yui-navset-top .yui-nav li,.yui-navset .yui-navset-bottom .yui-nav li{display:inline-block;display:-moz-inline-stack;*display:inline;vertical-align:bottom;cursor:pointer;zoom:1;}.yui-navset-left .yui-nav li,.yui-navset-right .yui-nav li{display:block;}.yui-navset .yui-nav a{position:relative;}.yui-navset .yui-nav li a,.yui-navset-top .yui-nav li a,.yui-navset-bottom .yui-nav li a{display:block;display:inline-block;vertical-align:bottom;zoom:1;}.yui-navset-left .yui-nav li a,.yui-navset-right .yui-nav li a{display:block;}.yui-navset-bottom .yui-nav li a{vertical-align:text-top;}.yui-navset .yui-nav li a em,.yui-navset-top .yui-nav li a em,.yui-navset-bottom .yui-nav li a em{display:block;}.yui-navset .yui-navset-left .yui-nav,.yui-navset .yui-navset-right .yui-nav,.yui-navset-left .yui-nav,.yui-navset-right .yui-nav{position:absolute;z-index:1;}.yui-navset-top .yui-nav,.yui-navset-bottom .yui-nav{position:static;}.yui-navset .yui-navset-left .yui-nav,.yui-navset-left .yui-nav{left:0;right:auto;}.yui-navset .yui-navset-right .yui-nav,.yui-navset-right .yui-nav{right:0;left:auto;}.yui-skin-sam .yui-navset .yui-nav,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav{border:solid #2647a0;border-width:0 0 5px;zoom:1;}.yui-skin-sam .yui-navset .yui-nav li,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav li{margin:0 .16em 0 0;padding:1px 0 0;zoom:1;}.yui-skin-sam .yui-navset .yui-nav .selected,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav .selected{margin:0 .16em -1px 0;}.yui-skin-sam .yui-navset .yui-nav a,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav a{background:#d8d8d8 url(sprite.png) repeat-x;border:solid #a3a3a3;border-width:0 1px;color:#000;position:relative;text-decoration:none;}.yui-skin-sam .yui-navset .yui-nav a em,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav a em{border:solid #a3a3a3;border-width:1px 0 0;cursor:hand;padding:.25em .75em;left:0;right:0;bottom:0;top:-1px;position:relative;}.yui-skin-sam .yui-navset .yui-nav .selected a,.yui-skin-sam .yui-navset .yui-nav .selected a:focus,.yui-skin-sam .yui-navset .yui-nav .selected a:hover{background:#2647a0 url(sprite.png) repeat-x left -1400px;color:#fff;}.yui-skin-sam .yui-navset .yui-nav a:hover,.yui-skin-sam .yui-navset .yui-nav a:focus{background:#bfdaff url(sprite.png) repeat-x left -1300px;outline:0;}.yui-skin-sam .yui-navset .yui-nav .selected a em{padding:.35em .75em;}.yui-skin-sam .yui-navset .yui-nav .selected a,.yui-skin-sam .yui-navset .yui-nav .selected a em{border-color:#243356;}.yui-skin-sam .yui-navset .yui-content{background:#edf5ff;}.yui-skin-sam .yui-navset .yui-content,.yui-skin-sam .yui-navset .yui-navset-top .yui-content{border:1px solid #808080;border-top-color:#243356;padding:.25em .5em;}.yui-skin-sam .yui-navset-left .yui-nav,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav,.yui-skin-sam .yui-navset .yui-navset-right .yui-nav,.yui-skin-sam .yui-navset-right .yui-nav{border-width:0 5px 0 0;Xposition:absolute;top:0;bottom:0;}.yui-skin-sam .yui-navset .yui-navset-right .yui-nav,.yui-skin-sam .yui-navset-right .yui-nav{border-width:0 0 0 5px;}.yui-skin-sam .yui-navset-left .yui-nav li,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav li,.yui-skin-sam .yui-navset-right .yui-nav li{margin:0 0 .16em;padding:0 0 0 1px;}.yui-skin-sam .yui-navset-right .yui-nav li{padding:0 1px 0 0;}.yui-skin-sam .yui-navset-left .yui-nav .selected,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav .selected{margin:0 -1px .16em 0;}.yui-skin-sam .yui-navset-right .yui-nav .selected{margin:0 0 .16em -1px;}.yui-skin-sam .yui-navset-left .yui-nav a,.yui-skin-sam .yui-navset-right .yui-nav a{border-width:1px 0;}.yui-skin-sam .yui-navset-left .yui-nav a em,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav a em,.yui-skin-sam .yui-navset-right .yui-nav a em{border-width:0 0 0 1px;padding:.2em .75em;top:auto;left:-1px;}.yui-skin-sam .yui-navset-right .yui-nav a em{border-width:0 1px 0 0;left:auto;right:-1px;}.yui-skin-sam .yui-navset-left .yui-nav a,.yui-skin-sam .yui-navset-left .yui-nav .selected a,.yui-skin-sam .yui-navset-left .yui-nav a:hover,.yui-skin-sam .yui-navset-right .yui-nav a,.yui-skin-sam .yui-navset-right .yui-nav .selected a,.yui-skin-sam .yui-navset-right .yui-nav a:hover,.yui-skin-sam .yui-navset-bottom .yui-nav a,.yui-skin-sam .yui-navset-bottom .yui-nav .selected a,.yui-skin-sam .yui-navset-bottom .yui-nav a:hover{background-image:none;}.yui-skin-sam .yui-navset-left .yui-content{border:1px solid #808080;border-left-color:#243356;}.yui-skin-sam .yui-navset-bottom .yui-nav,.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav{border-width:5px 0 0;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav .selected,.yui-skin-sam .yui-navset-bottom .yui-nav .selected{margin:-1px .16em 0 0;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav li,.yui-skin-sam .yui-navset-bottom .yui-nav li{padding:0 0 1px 0;vertical-align:top;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav a em,.yui-skin-sam .yui-navset-bottom .yui-nav a em{border-width:0 0 1px;top:auto;bottom:-1px;}
+.yui-skin-sam .yui-navset-bottom .yui-content,.yui-skin-sam .yui-navset .yui-navset-bottom .yui-content{border:1px solid #808080;border-bottom-color:#243356;}
+table.ygtvtable{margin-bottom:0;border:none;border-collapse:collapse;}td.ygtvcell{border:none;padding:0;}a.ygtvspacer{text-decoration:none;outline-style:none;display:block;}.ygtvtn{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -5600px no-repeat;cursor:pointer;}.ygtvtm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4000px no-repeat;}.ygtvtmh,.ygtvtmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4800px no-repeat;}.ygtvtp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -6400px no-repeat;}.ygtvtph,.ygtvtphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -7200px no-repeat;}.ygtvln{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -1600px no-repeat;cursor:pointer;}.ygtvlm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 0 no-repeat;}.ygtvlmh,.ygtvlmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -800px no-repeat;}.ygtvlp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -2400px no-repeat;}.ygtvlph,.ygtvlphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -3200px no-repeat;cursor:pointer;}.ygtvloading{width:18px;height:22px;background:url(treeview-loading.gif) 0 0 no-repeat;}.ygtvdepthcell{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8000px no-repeat;}.ygtvblankdepthcell{width:18px;height:22px;}* html .ygtvchildren{height:2%;}.ygtvlabel,.ygtvlabel:link,.ygtvlabel:visited,.ygtvlabel:hover{margin-left:2px;text-decoration:none;background-color:white;cursor:pointer;}.ygtvcontent{cursor:default;}.ygtvspacer{height:22px;width:18px;}.ygtvfocus{background-color:#c0e0e0;border:none;}.ygtvfocus .ygtvlabel,.ygtvfocus .ygtvlabel:link,.ygtvfocus .ygtvlabel:visited,.ygtvfocus .ygtvlabel:hover{background-color:#c0e0e0;}.ygtvfocus a{outline-style:none;}.ygtvok{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8800px no-repeat;}.ygtvok:hover{background:url(treeview-sprite.gif) 0 -8844px no-repeat;}.ygtvcancel{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8822px no-repeat;}.ygtvcancel:hover{background:url(treeview-sprite.gif) 0 -8866px no-repeat;}.ygtv-label-editor{background-color:#f2f2f2;border:1px solid silver;position:absolute;display:none;overflow:hidden;margin:auto;z-index:9000;}.ygtv-edit-TextNode{width:190px;}.ygtv-edit-TextNode .ygtvcancel,.ygtv-edit-TextNode .ygtvok{border:none;}.ygtv-edit-TextNode .ygtv-button-container{float:right;}.ygtv-edit-TextNode .ygtv-input input{width:140px;}.ygtv-edit-DateNode .ygtvcancel{border:none;}.ygtv-edit-DateNode .ygtvok{display:none;}.ygtv-edit-DateNode .ygtv-button-container{text-align:right;margin:auto;}.ygtv-highlight .ygtv-highlight1,.ygtv-highlight .ygtv-highlight1 .ygtvlabel{background-color:blue;color:white;}.ygtv-highlight .ygtv-highlight2,.ygtv-highlight .ygtv-highlight2 .ygtvlabel{background-color:silver;}.ygtv-highlight .ygtv-highlight0 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight1 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight2 .ygtvfocus .ygtvlabel{background-color:#c0e0e0;}.ygtv-highlight .ygtvcontent{padding-right:1em;}.ygtv-checkbox .ygtv-highlight0 .ygtvcontent{padding-left:1em;background:url(check0.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight0 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight1 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight2 .ygtvfocus.ygtvcontent{background-color:#c0e0e0;}.ygtv-checkbox .ygtv-highlight1 .ygtvcontent{padding-left:1em;background:url(check1.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight2 .ygtvcontent{padding-left:1em;background:url(check2.gif) no-repeat;}
+
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/slider.css b/lib/yui/2.8.0r4/assets/skins/sam/slider.css
new file mode 100644
index 0000000000..9450e3be74
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/slider.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-h-slider,.yui-v-slider,.yui-region-slider{position:relative;}.yui-h-slider .yui-slider-thumb,.yui-v-slider .yui-slider-thumb,.yui-region-slider .yui-slider-thumb{position:absolute;cursor:default;}.yui-skin-sam .yui-h-slider{background:url(bg-h.gif) no-repeat 5px 0;height:28px;width:228px;}.yui-skin-sam .yui-h-slider .yui-slider-thumb{top:4px;}.yui-skin-sam .yui-v-slider{background:url(bg-v.gif) no-repeat 12px 0;height:228px;width:48px;}.yui-skin-sam .yui-region-slider{height:228px;width:228px;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-active.png b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-active.png
new file mode 100644
index 0000000000..fa58c5030e
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-active.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-disabled.png b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-disabled.png
new file mode 100644
index 0000000000..0a6a82c640
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-disabled.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-focus.png b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-focus.png
new file mode 100644
index 0000000000..167d71eb72
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-focus.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-hover.png b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-hover.png
new file mode 100644
index 0000000000..167d71eb72
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow-hover.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow.png b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow.png
new file mode 100644
index 0000000000..b33a93ff2d
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/split-button-arrow.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/sprite.png b/lib/yui/2.8.0r4/assets/skins/sam/sprite.png
new file mode 100644
index 0000000000..73634d6a22
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/sprite.png differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/sprite.psd b/lib/yui/2.8.0r4/assets/skins/sam/sprite.psd
new file mode 100644
index 0000000000..fff2c34713
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/sprite.psd differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/tabview.css b/lib/yui/2.8.0r4/assets/skins/sam/tabview.css
new file mode 100644
index 0000000000..eb79574672
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/tabview.css
@@ -0,0 +1,8 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-navset .yui-nav li,.yui-navset .yui-navset-top .yui-nav li,.yui-navset .yui-navset-bottom .yui-nav li{margin:0 .5em 0 0;}.yui-navset-left .yui-nav li,.yui-navset-right .yui-nav li{margin:0 0 .5em;}.yui-navset .yui-content .yui-hidden{border:0;height:0;width:0;padding:0;position:absolute;left:-999999px;overflow:hidden;visibility:hidden;}.yui-navset .yui-navset-left .yui-nav,.yui-navset .yui-navset-right .yui-nav,.yui-navset-left .yui-nav,.yui-navset-right .yui-nav{width:6em;}.yui-navset-top .yui-nav,.yui-navset-bottom .yui-nav{width:auto;}.yui-navset .yui-navset-left,.yui-navset-left{padding:0 0 0 6em;}.yui-navset-right{padding:0 6em 0 0;}.yui-navset-top,.yui-navset-bottom{padding:auto;}.yui-nav,.yui-nav li{margin:0;padding:0;list-style:none;}.yui-navset li em{font-style:normal;}.yui-navset{position:relative;zoom:1;}.yui-navset .yui-content,.yui-navset .yui-content div{zoom:1;}.yui-navset .yui-content:after{content:'';display:block;clear:both;}.yui-navset .yui-nav li,.yui-navset .yui-navset-top .yui-nav li,.yui-navset .yui-navset-bottom .yui-nav li{display:inline-block;display:-moz-inline-stack;*display:inline;vertical-align:bottom;cursor:pointer;zoom:1;}.yui-navset-left .yui-nav li,.yui-navset-right .yui-nav li{display:block;}.yui-navset .yui-nav a{position:relative;}.yui-navset .yui-nav li a,.yui-navset-top .yui-nav li a,.yui-navset-bottom .yui-nav li a{display:block;display:inline-block;vertical-align:bottom;zoom:1;}.yui-navset-left .yui-nav li a,.yui-navset-right .yui-nav li a{display:block;}.yui-navset-bottom .yui-nav li a{vertical-align:text-top;}.yui-navset .yui-nav li a em,.yui-navset-top .yui-nav li a em,.yui-navset-bottom .yui-nav li a em{display:block;}.yui-navset .yui-navset-left .yui-nav,.yui-navset .yui-navset-right .yui-nav,.yui-navset-left .yui-nav,.yui-navset-right .yui-nav{position:absolute;z-index:1;}.yui-navset-top .yui-nav,.yui-navset-bottom .yui-nav{position:static;}.yui-navset .yui-navset-left .yui-nav,.yui-navset-left .yui-nav{left:0;right:auto;}.yui-navset .yui-navset-right .yui-nav,.yui-navset-right .yui-nav{right:0;left:auto;}.yui-skin-sam .yui-navset .yui-nav,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav{border:solid #2647a0;border-width:0 0 5px;zoom:1;}.yui-skin-sam .yui-navset .yui-nav li,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav li{margin:0 .16em 0 0;padding:1px 0 0;zoom:1;}.yui-skin-sam .yui-navset .yui-nav .selected,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav .selected{margin:0 .16em -1px 0;}.yui-skin-sam .yui-navset .yui-nav a,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav a{background:#d8d8d8 url(sprite.png) repeat-x;border:solid #a3a3a3;border-width:0 1px;color:#000;position:relative;text-decoration:none;}.yui-skin-sam .yui-navset .yui-nav a em,.yui-skin-sam .yui-navset .yui-navset-top .yui-nav a em{border:solid #a3a3a3;border-width:1px 0 0;cursor:hand;padding:.25em .75em;left:0;right:0;bottom:0;top:-1px;position:relative;}.yui-skin-sam .yui-navset .yui-nav .selected a,.yui-skin-sam .yui-navset .yui-nav .selected a:focus,.yui-skin-sam .yui-navset .yui-nav .selected a:hover{background:#2647a0 url(sprite.png) repeat-x left -1400px;color:#fff;}.yui-skin-sam .yui-navset .yui-nav a:hover,.yui-skin-sam .yui-navset .yui-nav a:focus{background:#bfdaff url(sprite.png) repeat-x left -1300px;outline:0;}.yui-skin-sam .yui-navset .yui-nav .selected a em{padding:.35em .75em;}.yui-skin-sam .yui-navset .yui-nav .selected a,.yui-skin-sam .yui-navset .yui-nav .selected a em{border-color:#243356;}.yui-skin-sam .yui-navset .yui-content{background:#edf5ff;}.yui-skin-sam .yui-navset .yui-content,.yui-skin-sam .yui-navset .yui-navset-top .yui-content{border:1px solid #808080;border-top-color:#243356;padding:.25em .5em;}.yui-skin-sam .yui-navset-left .yui-nav,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav,.yui-skin-sam .yui-navset .yui-navset-right .yui-nav,.yui-skin-sam .yui-navset-right .yui-nav{border-width:0 5px 0 0;Xposition:absolute;top:0;bottom:0;}.yui-skin-sam .yui-navset .yui-navset-right .yui-nav,.yui-skin-sam .yui-navset-right .yui-nav{border-width:0 0 0 5px;}.yui-skin-sam .yui-navset-left .yui-nav li,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav li,.yui-skin-sam .yui-navset-right .yui-nav li{margin:0 0 .16em;padding:0 0 0 1px;}.yui-skin-sam .yui-navset-right .yui-nav li{padding:0 1px 0 0;}.yui-skin-sam .yui-navset-left .yui-nav .selected,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav .selected{margin:0 -1px .16em 0;}.yui-skin-sam .yui-navset-right .yui-nav .selected{margin:0 0 .16em -1px;}.yui-skin-sam .yui-navset-left .yui-nav a,.yui-skin-sam .yui-navset-right .yui-nav a{border-width:1px 0;}.yui-skin-sam .yui-navset-left .yui-nav a em,.yui-skin-sam .yui-navset .yui-navset-left .yui-nav a em,.yui-skin-sam .yui-navset-right .yui-nav a em{border-width:0 0 0 1px;padding:.2em .75em;top:auto;left:-1px;}.yui-skin-sam .yui-navset-right .yui-nav a em{border-width:0 1px 0 0;left:auto;right:-1px;}.yui-skin-sam .yui-navset-left .yui-nav a,.yui-skin-sam .yui-navset-left .yui-nav .selected a,.yui-skin-sam .yui-navset-left .yui-nav a:hover,.yui-skin-sam .yui-navset-right .yui-nav a,.yui-skin-sam .yui-navset-right .yui-nav .selected a,.yui-skin-sam .yui-navset-right .yui-nav a:hover,.yui-skin-sam .yui-navset-bottom .yui-nav a,.yui-skin-sam .yui-navset-bottom .yui-nav .selected a,.yui-skin-sam .yui-navset-bottom .yui-nav a:hover{background-image:none;}.yui-skin-sam .yui-navset-left .yui-content{border:1px solid #808080;border-left-color:#243356;}.yui-skin-sam .yui-navset-bottom .yui-nav,.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav{border-width:5px 0 0;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav .selected,.yui-skin-sam .yui-navset-bottom .yui-nav .selected{margin:-1px .16em 0 0;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav li,.yui-skin-sam .yui-navset-bottom .yui-nav li{padding:0 0 1px 0;vertical-align:top;}.yui-skin-sam .yui-navset .yui-navset-bottom .yui-nav a em,.yui-skin-sam .yui-navset-bottom .yui-nav a em{border-width:0 0 1px;top:auto;bottom:-1px;}
+.yui-skin-sam .yui-navset-bottom .yui-content,.yui-skin-sam .yui-navset .yui-navset-bottom .yui-content{border:1px solid #808080;border-bottom-color:#243356;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/treeview-loading.gif b/lib/yui/2.8.0r4/assets/skins/sam/treeview-loading.gif
new file mode 100644
index 0000000000..0bbf3bc0c0
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/treeview-loading.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/treeview-sprite.gif b/lib/yui/2.8.0r4/assets/skins/sam/treeview-sprite.gif
new file mode 100644
index 0000000000..8fb3f01377
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/treeview-sprite.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/treeview.css b/lib/yui/2.8.0r4/assets/skins/sam/treeview.css
new file mode 100644
index 0000000000..3843d4bdb2
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/treeview.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+table.ygtvtable{margin-bottom:0;border:none;border-collapse:collapse;}td.ygtvcell{border:none;padding:0;}a.ygtvspacer{text-decoration:none;outline-style:none;display:block;}.ygtvtn{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -5600px no-repeat;cursor:pointer;}.ygtvtm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4000px no-repeat;}.ygtvtmh,.ygtvtmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4800px no-repeat;}.ygtvtp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -6400px no-repeat;}.ygtvtph,.ygtvtphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -7200px no-repeat;}.ygtvln{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -1600px no-repeat;cursor:pointer;}.ygtvlm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 0 no-repeat;}.ygtvlmh,.ygtvlmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -800px no-repeat;}.ygtvlp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -2400px no-repeat;}.ygtvlph,.ygtvlphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -3200px no-repeat;cursor:pointer;}.ygtvloading{width:18px;height:22px;background:url(treeview-loading.gif) 0 0 no-repeat;}.ygtvdepthcell{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8000px no-repeat;}.ygtvblankdepthcell{width:18px;height:22px;}* html .ygtvchildren{height:2%;}.ygtvlabel,.ygtvlabel:link,.ygtvlabel:visited,.ygtvlabel:hover{margin-left:2px;text-decoration:none;background-color:white;cursor:pointer;}.ygtvcontent{cursor:default;}.ygtvspacer{height:22px;width:18px;}.ygtvfocus{background-color:#c0e0e0;border:none;}.ygtvfocus .ygtvlabel,.ygtvfocus .ygtvlabel:link,.ygtvfocus .ygtvlabel:visited,.ygtvfocus .ygtvlabel:hover{background-color:#c0e0e0;}.ygtvfocus a{outline-style:none;}.ygtvok{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8800px no-repeat;}.ygtvok:hover{background:url(treeview-sprite.gif) 0 -8844px no-repeat;}.ygtvcancel{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8822px no-repeat;}.ygtvcancel:hover{background:url(treeview-sprite.gif) 0 -8866px no-repeat;}.ygtv-label-editor{background-color:#f2f2f2;border:1px solid silver;position:absolute;display:none;overflow:hidden;margin:auto;z-index:9000;}.ygtv-edit-TextNode{width:190px;}.ygtv-edit-TextNode .ygtvcancel,.ygtv-edit-TextNode .ygtvok{border:none;}.ygtv-edit-TextNode .ygtv-button-container{float:right;}.ygtv-edit-TextNode .ygtv-input input{width:140px;}.ygtv-edit-DateNode .ygtvcancel{border:none;}.ygtv-edit-DateNode .ygtvok{display:none;}.ygtv-edit-DateNode .ygtv-button-container{text-align:right;margin:auto;}.ygtv-highlight .ygtv-highlight1,.ygtv-highlight .ygtv-highlight1 .ygtvlabel{background-color:blue;color:white;}.ygtv-highlight .ygtv-highlight2,.ygtv-highlight .ygtv-highlight2 .ygtvlabel{background-color:silver;}.ygtv-highlight .ygtv-highlight0 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight1 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight2 .ygtvfocus .ygtvlabel{background-color:#c0e0e0;}.ygtv-highlight .ygtvcontent{padding-right:1em;}.ygtv-checkbox .ygtv-highlight0 .ygtvcontent{padding-left:1em;background:url(check0.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight0 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight1 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight2 .ygtvfocus.ygtvcontent{background-color:#c0e0e0;}.ygtv-checkbox .ygtv-highlight1 .ygtvcontent{padding-left:1em;background:url(check1.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight2 .ygtvcontent{padding-left:1em;background:url(check2.gif) no-repeat;}
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/wait.gif b/lib/yui/2.8.0r4/assets/skins/sam/wait.gif
new file mode 100644
index 0000000000..471c1a4f93
Binary files /dev/null and b/lib/yui/2.8.0r4/assets/skins/sam/wait.gif differ
diff --git a/lib/yui/2.8.0r4/assets/skins/sam/yuitest.css b/lib/yui/2.8.0r4/assets/skins/sam/yuitest.css
new file mode 100644
index 0000000000..35183cd0a2
--- /dev/null
+++ b/lib/yui/2.8.0r4/assets/skins/sam/yuitest.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+
diff --git a/lib/yui/2.8.0r4/autocomplete/assets/autocomplete-core.css b/lib/yui/2.8.0r4/autocomplete/assets/autocomplete-core.css
new file mode 100644
index 0000000000..8143532d27
--- /dev/null
+++ b/lib/yui/2.8.0r4/autocomplete/assets/autocomplete-core.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/* This file intentionally left blank */
diff --git a/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete-skin.css b/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete-skin.css
new file mode 100644
index 0000000000..805530e8f9
--- /dev/null
+++ b/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete-skin.css
@@ -0,0 +1,57 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/* styles for entire widget */
+.yui-skin-sam .yui-ac {
+ position:relative;font-family:arial;font-size:100%;
+}
+
+/* styles for input field */
+.yui-skin-sam .yui-ac-input {
+ position:absolute;width:100%;
+}
+
+/* styles for results container */
+.yui-skin-sam .yui-ac-container {
+ position:absolute;top:1.6em;width:100%;
+}
+
+/* styles for header/body/footer wrapper within container */
+.yui-skin-sam .yui-ac-content {
+ position:absolute;width:100%;border:1px solid #808080;background:#fff;overflow:hidden;z-index:9050;
+}
+
+/* styles for container shadow */
+.yui-skin-sam .yui-ac-shadow {
+ position:absolute;margin:.3em;width:100%;background:#000;-moz-opacity: 0.10;opacity:.10;filter:alpha(opacity=10);z-index:9049;
+}
+
+/* styles for container iframe */
+.yui-skin-sam .yui-ac iframe {
+ opacity:0;filter: alpha(opacity=0);
+ padding-right:.3em; padding-bottom:.3em; /* Bug 2026798: extend iframe to shim the shadow */
+}
+
+/* styles for results list */
+.yui-skin-sam .yui-ac-content ul{
+ margin:0;padding:0;width:100%;
+}
+
+/* styles for result item */
+.yui-skin-sam .yui-ac-content li {
+ margin:0;padding:2px 5px;cursor:default;white-space:nowrap;list-style:none;
+ zoom:1; /* For IE to trigger mouse events on LI */
+}
+
+/* styles for prehighlighted result item */
+.yui-skin-sam .yui-ac-content li.yui-ac-prehighlight {
+ background:#B3D4FF;
+}
+
+/* styles for highlighted result item */
+.yui-skin-sam .yui-ac-content li.yui-ac-highlight {
+ background:#426FD9;color:#FFF;
+}
diff --git a/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete.css b/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete.css
new file mode 100644
index 0000000000..07fc0302a9
--- /dev/null
+++ b/lib/yui/2.8.0r4/autocomplete/assets/skins/sam/autocomplete.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-ac{position:relative;font-family:arial;font-size:100%;}.yui-skin-sam .yui-ac-input{position:absolute;width:100%;}.yui-skin-sam .yui-ac-container{position:absolute;top:1.6em;width:100%;}.yui-skin-sam .yui-ac-content{position:absolute;width:100%;border:1px solid #808080;background:#fff;overflow:hidden;z-index:9050;}.yui-skin-sam .yui-ac-shadow{position:absolute;margin:.3em;width:100%;background:#000;-moz-opacity:.10;opacity:.10;filter:alpha(opacity=10);z-index:9049;}.yui-skin-sam .yui-ac iframe{opacity:0;filter:alpha(opacity=0);padding-right:.3em;padding-bottom:.3em;}.yui-skin-sam .yui-ac-content ul{margin:0;padding:0;width:100%;}.yui-skin-sam .yui-ac-content li{margin:0;padding:2px 5px;cursor:default;white-space:nowrap;list-style:none;zoom:1;}.yui-skin-sam .yui-ac-content li.yui-ac-prehighlight{background:#B3D4FF;}.yui-skin-sam .yui-ac-content li.yui-ac-highlight{background:#426FD9;color:#FFF;}
diff --git a/lib/yui/2.8.0r4/autocomplete/autocomplete-debug.js b/lib/yui/2.8.0r4/autocomplete/autocomplete-debug.js
new file mode 100644
index 0000000000..8910282c92
--- /dev/null
+++ b/lib/yui/2.8.0r4/autocomplete/autocomplete-debug.js
@@ -0,0 +1,3009 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/////////////////////////////////////////////////////////////////////////////
+//
+// YAHOO.widget.DataSource Backwards Compatibility
+//
+/////////////////////////////////////////////////////////////////////////////
+
+YAHOO.widget.DS_JSArray = YAHOO.util.LocalDataSource;
+
+YAHOO.widget.DS_JSFunction = YAHOO.util.FunctionDataSource;
+
+YAHOO.widget.DS_XHR = function(sScriptURI, aSchema, oConfigs) {
+ var DS = new YAHOO.util.XHRDataSource(sScriptURI, oConfigs);
+ DS._aDeprecatedSchema = aSchema;
+ return DS;
+};
+
+YAHOO.widget.DS_ScriptNode = function(sScriptURI, aSchema, oConfigs) {
+ var DS = new YAHOO.util.ScriptNodeDataSource(sScriptURI, oConfigs);
+ DS._aDeprecatedSchema = aSchema;
+ return DS;
+};
+
+YAHOO.widget.DS_XHR.TYPE_JSON = YAHOO.util.DataSourceBase.TYPE_JSON;
+YAHOO.widget.DS_XHR.TYPE_XML = YAHOO.util.DataSourceBase.TYPE_XML;
+YAHOO.widget.DS_XHR.TYPE_FLAT = YAHOO.util.DataSourceBase.TYPE_TEXT;
+
+// TODO: widget.DS_ScriptNode.scriptCallbackParam
+
+
+
+ /**
+ * The AutoComplete control provides the front-end logic for text-entry suggestion and
+ * completion functionality.
+ *
+ * @module autocomplete
+ * @requires yahoo, dom, event, datasource
+ * @optional animation
+ * @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:
+ *
+ * Navigate with up/down arrow keys and/or mouse to pick a selection
+ * The drop down container can "roll down" or "fly out" via configurable
+ * animation
+ * UI look-and-feel customizable through CSS, including container
+ * attributes, borders, position, fonts, etc
+ *
+ *
+ * @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 && YAHOO.lang.isFunction(oDataSource.sendRequest)) {
+ this.dataSource = oDataSource;
+ }
+ else {
+ YAHOO.log("Could not instantiate AutoComplete due to an invalid DataSource", "error", this.toString());
+ return;
+ }
+
+ // YAHOO.widget.DataSource schema backwards compatibility
+ // Converted deprecated schema into supported schema
+ // First assume key data is held in position 0 of results array
+ this.key = 0;
+ var schema = oDataSource.responseSchema;
+ // An old school schema has been defined in the deprecated DataSource constructor
+ if(oDataSource._aDeprecatedSchema) {
+ var aDeprecatedSchema = oDataSource._aDeprecatedSchema;
+ if(YAHOO.lang.isArray(aDeprecatedSchema)) {
+
+ if((oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_JSON) ||
+ (oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_UNKNOWN)) { // Used to default to unknown
+ // Store the resultsList
+ schema.resultsList = aDeprecatedSchema[0];
+ // Store the key
+ this.key = aDeprecatedSchema[1];
+ // Only resultsList and key are defined, so grab all the data
+ schema.fields = (aDeprecatedSchema.length < 3) ? null : aDeprecatedSchema.slice(1);
+ }
+ else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_XML) {
+ schema.resultNode = aDeprecatedSchema[0];
+ this.key = aDeprecatedSchema[1];
+ schema.fields = aDeprecatedSchema.slice(1);
+ }
+ else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_TEXT) {
+ schema.recordDelim = aDeprecatedSchema[0];
+ schema.fieldDelim = aDeprecatedSchema[1];
+ }
+ oDataSource.responseSchema = schema;
+ }
+ }
+
+ // Validate input element
+ if(YAHOO.util.Dom.inDocument(elInput)) {
+ if(YAHOO.lang.isString(elInput)) {
+ this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput;
+ this._elTextbox = document.getElementById(elInput);
+ }
+ else {
+ this._sName = (elInput.id) ?
+ "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput.id:
+ "instance" + YAHOO.widget.AutoComplete._nIndex;
+ this._elTextbox = elInput;
+ }
+ YAHOO.util.Dom.addClass(this._elTextbox, "yui-ac-input");
+ }
+ else {
+ YAHOO.log("Could not instantiate AutoComplete due to an invalid input element", "error", this.toString());
+ return;
+ }
+
+ // Validate container element
+ if(YAHOO.util.Dom.inDocument(elContainer)) {
+ if(YAHOO.lang.isString(elContainer)) {
+ this._elContainer = document.getElementById(elContainer);
+ }
+ else {
+ this._elContainer = elContainer;
+ }
+ if(this._elContainer.style.display == "none") {
+ YAHOO.log("The container may not display properly if display is set to \"none\" in CSS", "warn", this.toString());
+ }
+
+ // For skinning
+ var elParent = this._elContainer.parentNode;
+ var elTag = elParent.tagName.toLowerCase();
+ if(elTag == "div") {
+ YAHOO.util.Dom.addClass(elParent, "yui-ac");
+ }
+ else {
+ YAHOO.log("Could not find the wrapper element for skinning", "warn", this.toString());
+ }
+ }
+ else {
+ YAHOO.log("Could not instantiate AutoComplete due to an invalid container element", "error", this.toString());
+ return;
+ }
+
+ // Default applyLocalFilter setting is to enable for local sources
+ if(this.dataSource.dataType === YAHOO.util.DataSourceBase.TYPE_LOCAL) {
+ this.applyLocalFilter = true;
+ }
+
+ // 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._initContainerEl();
+ this._initProps();
+ this._initListEl();
+ this._initContainerHelperEls();
+
+ // Set up events
+ var oSelf = this;
+ var elTextbox = this._elTextbox;
+
+ // Dom events
+ YAHOO.util.Event.addListener(elTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"focus",oSelf._onTextboxFocus,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"blur",oSelf._onTextboxBlur,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"mouseover",oSelf._onContainerMouseover,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"mouseout",oSelf._onContainerMouseout,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"click",oSelf._onContainerClick,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"scroll",oSelf._onContainerScroll,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"resize",oSelf._onContainerResize,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);
+ YAHOO.util.Event.addListener(window,"unload",oSelf._onWindowUnload,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.containerPopulateEvent = new YAHOO.util.CustomEvent("containerPopulate", 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);
+ this.textboxChangeEvent = new YAHOO.util.CustomEvent("textboxChange", this);
+
+ // Finish up
+ elTextbox.setAttribute("autocomplete","off");
+ YAHOO.widget.AutoComplete._nIndex++;
+ YAHOO.log("AutoComplete initialized","info",this.toString());
+ }
+ // Required arguments were not found
+ else {
+ YAHOO.log("Could not instantiate AutoComplete due invalid arguments", "error", this.toString());
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+
+/**
+ * By default, results from local DataSources will pass through the filterResults
+ * method to apply a client-side matching algorithm.
+ *
+ * @property applyLocalFilter
+ * @type Boolean
+ * @default true for local arrays and json, otherwise false
+ */
+YAHOO.widget.AutoComplete.prototype.applyLocalFilter = null;
+
+/**
+ * When applyLocalFilter is true, the local filtering algorthim can have case sensitivity
+ * enabled.
+ *
+ * @property queryMatchCase
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.queryMatchCase = false;
+
+/**
+ * When applyLocalFilter is true, results can be locally filtered to return
+ * matching strings that "contain" the query string rather than simply "start with"
+ * the query string.
+ *
+ * @property queryMatchContains
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.queryMatchContains = false;
+
+/**
+ * Enables query subset matching. When the DataSource's cache is enabled 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.AutoComplete.prototype.queryMatchSubset = false;
+
+/**
+ * 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. If
+ * typeAhead is also enabled, this value must always be less than the typeAheadDelay
+ * in order to avoid certain race conditions.
+ *
+ * @property queryDelay
+ * @type Number
+ * @default 0.2
+ */
+YAHOO.widget.AutoComplete.prototype.queryDelay = 0.2;
+
+/**
+ * If typeAhead is true, number of seconds to delay before updating input with
+ * typeAhead value. In order to prevent certain race conditions, this value must
+ * always be greater than the queryDelay.
+ *
+ * @property typeAheadDelay
+ * @type Number
+ * @default 0.5
+ */
+YAHOO.widget.AutoComplete.prototype.typeAheadDelay = 0.5;
+
+/**
+ * When IME usage is detected or interval detection is explicitly enabled,
+ * AutoComplete will detect the input value at the given interval and send a
+ * query if the value has changed.
+ *
+ * @property queryInterval
+ * @type Number
+ * @default 500
+ */
+YAHOO.widget.AutoComplete.prototype.queryInterval = 500;
+
+/**
+ * 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;
+
+/**
+ * If autohighlight is enabled, whether or not the input field should be automatically updated
+ * with the first query result as the user types, auto-selecting the substring portion
+ * of the first result that the user has not yet 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
+ * <select> 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;
+
+/**
+ * Enabling this feature prevents the toggling of the container to a collapsed state.
+ * Setting to true does not automatically trigger the opening of the container.
+ * Implementers are advised to pre-load the container with an explicit "sendQuery()" call.
+ *
+ * @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
+ * <select> 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;
+
+/**
+ * Whether or not the input field should be updated with selections.
+ *
+ * @property suppressInputUpdate
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.suppressInputUpdate = false;
+
+/**
+ * For backward compatibility to pre-2.6.0 formatResults() signatures, setting
+ * resultsTypeList to true will take each object literal result returned by
+ * DataSource and flatten into an array.
+ *
+ * @property resultTypeList
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.resultTypeList = true;
+
+/**
+ * For XHR DataSources, AutoComplete will automatically insert a "?" between the server URI and
+ * the "query" param/value pair. To prevent this behavior, implementers should
+ * set this value to false. To more fully customize the query syntax, implementers
+ * should override the generateRequest() method.
+ *
+ * @property queryQuestionMark
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.queryQuestionMark = true;
+
+/**
+ * If true, before each time the container expands, the container element will be
+ * positioned to snap to the bottom-left corner of the input element. If
+ * autoSnapContainer is set to false, this positioning will not be done.
+ *
+ * @property autoSnapContainer
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.autoSnapContainer = true;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 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 DOM reference to input element.
+ *
+ * @method getInputEl
+ * @return {HTMLELement} DOM reference to input element.
+ */
+YAHOO.widget.AutoComplete.prototype.getInputEl = function() {
+ return this._elTextbox;
+};
+
+ /**
+ * Returns DOM reference to container element.
+ *
+ * @method getContainerEl
+ * @return {HTMLELement} DOM reference to container element.
+ */
+YAHOO.widget.AutoComplete.prototype.getContainerEl = function() {
+ return this._elContainer;
+};
+
+ /**
+ * Returns true if widget instance is currently active.
+ *
+ * @method isFocused
+ * @return {Boolean} Returns true if widget instance is currently active.
+ */
+YAHOO.widget.AutoComplete.prototype.isFocused = function() {
+ return this._bFocused;
+};
+
+ /**
+ * 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 <ul> element that displays query results within the results container.
+ *
+ * @method getListEl
+ * @return {HTMLElement[]} Reference to <ul> element within the results container.
+ */
+YAHOO.widget.AutoComplete.prototype.getListEl = function() {
+ return this._elList;
+};
+
+/**
+ * Public accessor to the matching string associated with a given <li> result.
+ *
+ * @method getListItemMatch
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {String} Matching string.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemMatch = function(elListItem) {
+ if(elListItem._sResultMatch) {
+ return elListItem._sResultMatch;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Public accessor to the result data associated with a given <li> result.
+ *
+ * @method getListItemData
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {Object} Result data.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemData = function(elListItem) {
+ if(elListItem._oResultData) {
+ return elListItem._oResultData;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Public accessor to the index of the associated with a given <li> result.
+ *
+ * @method getListItemIndex
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {Number} Index.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemIndex = function(elListItem) {
+ if(YAHOO.lang.isNumber(elListItem._nItemIndex)) {
+ return elListItem._nItemIndex;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Sets HTML markup for the results container header. This markup will be
+ * inserted within a <div> 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(this._elHeader) {
+ var elHeader = this._elHeader;
+ if(sHeader) {
+ elHeader.innerHTML = sHeader;
+ elHeader.style.display = "";
+ }
+ else {
+ elHeader.innerHTML = "";
+ elHeader.style.display = "none";
+ }
+ }
+};
+
+/**
+ * Sets HTML markup for the results container footer. This markup will be
+ * inserted within a <div> 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(this._elFooter) {
+ var elFooter = this._elFooter;
+ if(sFooter) {
+ elFooter.innerHTML = sFooter;
+ elFooter.style.display = "";
+ }
+ else {
+ elFooter.innerHTML = "";
+ elFooter.style.display = "none";
+ }
+ }
+};
+
+/**
+ * Sets HTML markup for the results container body. This markup will be
+ * inserted within a <div> 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(this._elBody) {
+ var elBody = this._elBody;
+ YAHOO.util.Event.purgeElement(elBody, true);
+ if(sBody) {
+ elBody.innerHTML = sBody;
+ elBody.style.display = "";
+ }
+ else {
+ elBody.innerHTML = "";
+ elBody.style.display = "none";
+ }
+ this._elList = null;
+ }
+};
+
+/**
+* A function that converts an AutoComplete query into a request value which is then
+* passed to the DataSource's sendRequest method in order to retrieve data for
+* the query. By default, returns a String with the syntax: "query={query}"
+* Implementers can customize this method for custom request syntaxes.
+*
+* @method generateRequest
+* @param sQuery {String} Query string
+* @return {MIXED} Request
+*/
+YAHOO.widget.AutoComplete.prototype.generateRequest = function(sQuery) {
+ var dataType = this.dataSource.dataType;
+
+ // Transform query string in to a request for remote data
+ // By default, local data doesn't need a transformation, just passes along the query as is.
+ if(dataType === YAHOO.util.DataSourceBase.TYPE_XHR) {
+ // By default, XHR GET requests look like "{scriptURI}?{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ if(!this.dataSource.connMethodPost) {
+ sQuery = (this.queryQuestionMark ? "?" : "") + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+ // By default, XHR POST bodies are sent to the {scriptURI} like "{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ else {
+ sQuery = (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+ }
+ // By default, remote script node requests look like "{scriptURI}&{scriptCallbackParam}={callbackString}&{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ else if(dataType === YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE) {
+ sQuery = "&" + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+
+ return sQuery;
+};
+
+/**
+ * Makes query request to the DataSource.
+ *
+ * @method sendQuery
+ * @param sQuery {String} Query string.
+ */
+YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {
+ // Activate focus for a new interaction
+ this._bFocused = true;
+
+ // Adjust programatically sent queries to look like they were input by user
+ // when delimiters are enabled
+ var newQuery = (this.delimChar) ? this._elTextbox.value + sQuery : sQuery;
+ this._sendQuery(newQuery);
+};
+
+/**
+ * Snaps container to bottom-left corner of input element
+ *
+ * @method snapContainer
+ */
+YAHOO.widget.AutoComplete.prototype.snapContainer = function() {
+ var oTextbox = this._elTextbox,
+ pos = YAHOO.util.Dom.getXY(oTextbox);
+ pos[1] += YAHOO.util.Dom.get(oTextbox).offsetHeight + 2;
+ YAHOO.util.Dom.setXY(this._elContainer,pos);
+};
+
+/**
+ * Expands container.
+ *
+ * @method expandContainer
+ */
+YAHOO.widget.AutoComplete.prototype.expandContainer = function() {
+ this._toggleContainer(true);
+};
+
+/**
+ * Collapses container.
+ *
+ * @method collapseContainer
+ */
+YAHOO.widget.AutoComplete.prototype.collapseContainer = function() {
+ this._toggleContainer(false);
+};
+
+/**
+ * Clears entire list of suggestions.
+ *
+ * @method clearList
+ */
+YAHOO.widget.AutoComplete.prototype.clearList = function() {
+ var allItems = this._elList.childNodes,
+ i=allItems.length-1;
+ for(; i>-1; i--) {
+ allItems[i].style.display = "none";
+ }
+};
+
+/**
+ * Handles subset matching for when queryMatchSubset is enabled.
+ *
+ * @method getSubsetMatches
+ * @param sQuery {String} Query string.
+ * @return {Object} oParsedResponse or null.
+ */
+YAHOO.widget.AutoComplete.prototype.getSubsetMatches = function(sQuery) {
+ var subQuery, oCachedResponse, subRequest;
+ // Loop through substrings of each cached element's query property...
+ for(var i = sQuery.length; i >= this.minQueryLength ; i--) {
+ subRequest = this.generateRequest(sQuery.substr(0,i));
+ this.dataRequestEvent.fire(this, subQuery, subRequest);
+ YAHOO.log("Searching for query subset \"" + subQuery + "\" in cache", "info", this.toString());
+
+ // If a substring of the query is found in the cache
+ oCachedResponse = this.dataSource.getCachedResponse(subRequest);
+ if(oCachedResponse) {
+ YAHOO.log("Found match for query subset \"" + subQuery + "\": " + YAHOO.lang.dump(oCachedResponse), "info", this.toString());
+ return this.filterResults.apply(this.dataSource, [sQuery, oCachedResponse, oCachedResponse, {scope:this}]);
+ }
+ }
+ YAHOO.log("Did not find subset match for query subset \"" + sQuery + "\"" , "info", this.toString());
+ return null;
+};
+
+/**
+ * Executed by DataSource (within DataSource scope via doBeforeParseData()) to
+ * handle responseStripAfter cleanup.
+ *
+ * @method preparseRawResponse
+ * @param sQuery {String} Query string.
+ * @return {Object} oParsedResponse or null.
+ */
+YAHOO.widget.AutoComplete.prototype.preparseRawResponse = function(oRequest, oFullResponse, oCallback) {
+ var nEnd = ((this.responseStripAfter !== "") && (oFullResponse.indexOf)) ?
+ oFullResponse.indexOf(this.responseStripAfter) : -1;
+ if(nEnd != -1) {
+ oFullResponse = oFullResponse.substring(0,nEnd);
+ }
+ return oFullResponse;
+};
+
+/**
+ * Executed by DataSource (within DataSource scope via doBeforeCallback()) to
+ * filter results through a simple client-side matching algorithm.
+ *
+ * @method filterResults
+ * @param sQuery {String} Original request.
+ * @param oFullResponse {Object} Full response object.
+ * @param oParsedResponse {Object} Parsed response object.
+ * @param oCallback {Object} Callback object.
+ * @return {Object} Filtered response object.
+ */
+
+YAHOO.widget.AutoComplete.prototype.filterResults = function(sQuery, oFullResponse, oParsedResponse, oCallback) {
+ // If AC has passed a query string value back to itself, grab it
+ if(oCallback && oCallback.argument && oCallback.argument.query) {
+ sQuery = oCallback.argument.query;
+ }
+
+ // Only if a query string is available to match against
+ if(sQuery && sQuery !== "") {
+ // First make a copy of the oParseResponse
+ oParsedResponse = YAHOO.widget.AutoComplete._cloneObject(oParsedResponse);
+
+ var oAC = oCallback.scope,
+ oDS = this,
+ allResults = oParsedResponse.results, // the array of results
+ filteredResults = [], // container for filtered results,
+ nMax = oAC.maxResultsDisplayed, // max to find
+ bMatchCase = (oDS.queryMatchCase || oAC.queryMatchCase), // backward compat
+ bMatchContains = (oDS.queryMatchContains || oAC.queryMatchContains); // backward compat
+
+ // Loop through each result object...
+ for(var i=0, len=allResults.length; i -1))) {
+ // Stash the match
+ filteredResults.push(oResult);
+ }
+ }
+
+ // Filter no more if maxResultsDisplayed is reached
+ if(len>nMax && filteredResults.length===nMax) {
+ break;
+ }
+ }
+ oParsedResponse.results = filteredResults;
+ YAHOO.log("Filtered " + filteredResults.length + " results against query \"" + sQuery + "\": " + YAHOO.lang.dump(filteredResults), "info", this.toString());
+ }
+ else {
+ YAHOO.log("Did not filter results against query", "info", this.toString());
+ }
+
+ return oParsedResponse;
+};
+
+/**
+ * Handles response for display. This is the callback function method passed to
+ * YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are
+ * returned to the AutoComplete instance.
+ *
+ * @method handleResponse
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ */
+YAHOO.widget.AutoComplete.prototype.handleResponse = function(sQuery, oResponse, oPayload) {
+ if((this instanceof YAHOO.widget.AutoComplete) && this._sName) {
+ this._populateList(sQuery, oResponse, oPayload);
+ }
+};
+
+/**
+ * Overridable method called before container is loaded with result data.
+ *
+ * @method doBeforeLoadData
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ * @return {Boolean} Return true to continue loading data, false to cancel.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeLoadData = function(sQuery, oResponse, oPayload) {
+ return true;
+};
+
+/**
+ * Overridable method that returns HTML markup for one result to be populated
+ * as innerHTML of an <LI> element.
+ *
+ * @method formatResult
+ * @param oResultData {Object} Result data object.
+ * @param sQuery {String} The corresponding query string.
+ * @param sResultMatch {HTMLElement} The current query string.
+ * @return {String} HTML markup of formatted result data.
+ */
+YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultData, sQuery, sResultMatch) {
+ var sMarkup = (sResultMatch) ? sResultMatch : "";
+ return sMarkup;
+};
+
+/**
+ * Overridable method called before container expands allows implementers to access data
+ * and DOM elements.
+ *
+ * @method doBeforeExpandContainer
+ * @param elTextbox {HTMLElement} The text input box.
+ * @param elContainer {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(elTextbox, elContainer, sQuery, aResults) {
+ return true;
+};
+
+
+/**
+ * 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 myAutoComplete = null. Use with caution!
+ *
+ * @method destroy
+ */
+YAHOO.widget.AutoComplete.prototype.destroy = function() {
+ var instanceName = this.toString();
+ var elInput = this._elTextbox;
+ var elContainer = this._elContainer;
+
+ // Unhook custom events
+ this.textboxFocusEvent.unsubscribeAll();
+ this.textboxKeyEvent.unsubscribeAll();
+ this.dataRequestEvent.unsubscribeAll();
+ this.dataReturnEvent.unsubscribeAll();
+ this.dataErrorEvent.unsubscribeAll();
+ this.containerPopulateEvent.unsubscribeAll();
+ this.containerExpandEvent.unsubscribeAll();
+ this.typeAheadEvent.unsubscribeAll();
+ this.itemMouseOverEvent.unsubscribeAll();
+ this.itemMouseOutEvent.unsubscribeAll();
+ this.itemArrowToEvent.unsubscribeAll();
+ this.itemArrowFromEvent.unsubscribeAll();
+ this.itemSelectEvent.unsubscribeAll();
+ this.unmatchedItemSelectEvent.unsubscribeAll();
+ this.selectionEnforceEvent.unsubscribeAll();
+ this.containerCollapseEvent.unsubscribeAll();
+ this.textboxBlurEvent.unsubscribeAll();
+ this.textboxChangeEvent.unsubscribeAll();
+
+ // 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;
+ }
+ }
+
+ YAHOO.log("AutoComplete instance destroyed: " + instanceName);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 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 request to the DataSource.
+ *
+ * @event dataRequestEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ * @param oRequest {Object} The request.
+ */
+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.
+ * @param oResponse {Object} The response object, if available.
+ */
+YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;
+
+/**
+ * Fired when the results container is populated.
+ *
+ * @event containerPopulateEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.containerPopulateEvent = 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 <li> 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 <li> 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 <li> 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 <li> 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 <li> 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.
+ * @param sSelection {String} The selected string.
+ */
+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.
+ * @param sClearedValue {String} The cleared value (including delimiters if applicable).
+ */
+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;
+
+/**
+ * Fired when the input field value has changed when it loses focus.
+ *
+ * @event textboxChangeEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.textboxChangeEvent = 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 _elTextbox
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elTextbox = null;
+
+/**
+ * Container DOM element.
+ *
+ * @property _elContainer
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elContainer = null;
+
+/**
+ * Reference to content element within container element.
+ *
+ * @property _elContent
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elContent = null;
+
+/**
+ * Reference to header element within content element.
+ *
+ * @property _elHeader
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elHeader = null;
+
+/**
+ * Reference to body element within content element.
+ *
+ * @property _elBody
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elBody = null;
+
+/**
+ * Reference to footer element within content element.
+ *
+ * @property _elFooter
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elFooter = null;
+
+/**
+ * Reference to shadow element within container element.
+ *
+ * @property _elShadow
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elShadow = null;
+
+/**
+ * Reference to iframe element within container element.
+ *
+ * @property _elIFrame
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elIFrame = null;
+
+/**
+ * Whether or not the widget instance is currently active. 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 = false;
+
+/**
+ * Animation instance for container expand/collapse.
+ *
+ * @property _oAnim
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oAnim = 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;
+
+/**
+ * Internal reference to <ul> elements that contains query results within the
+ * results container.
+ *
+ * @property _elList
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elList = null;
+
+/*
+ * Array of <li> elements references that contain query results within the
+ * results container.
+ *
+ * @property _aListItemEls
+ * @type HTMLElement[]
+ * @private
+ */
+//YAHOO.widget.AutoComplete.prototype._aListItemEls = null;
+
+/**
+ * Number of <li> elements currently displayed in results container.
+ *
+ * @property _nDisplayedItems
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;
+
+/*
+ * Internal count of <li> 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;
+
+/**
+ * Selections from previous queries (for saving delimited queries).
+ *
+ * @property _sPastSelections
+ * @type String
+ * @default ""
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sPastSelections = "";
+
+/**
+ * Stores initial input value used to determine if textboxChangeEvent should be fired.
+ *
+ * @property _sInitInputValue
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sInitInputValue = null;
+
+/**
+ * Pointer to the currently highlighted <li> element in the container.
+ *
+ * @property _elCurListItem
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elCurListItem = null;
+
+/**
+ * Pointer to the currently pre-highlighted <li> element in the container.
+ *
+ * @property _elCurPrehighlightItem
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elCurPrehighlightItem = 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;
+
+/**
+ * TypeAhead delay timeout ID.
+ *
+ * @property _nTypeAheadDelayID
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID = -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 typeAheadDelay = this.typeAheadDelay;
+ if(!YAHOO.lang.isNumber(typeAheadDelay) || (typeAheadDelay < 0)) {
+ this.typeAheadDelay = 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._elContent, {}, this.animSpeed);
+ }
+ else {
+ this._oAnim.duration = this.animSpeed;
+ }
+ }
+ if(this.forceSelection && delimChar) {
+ YAHOO.log("The forceSelection feature has been enabled with delimChar defined.","warn", this.toString());
+ }
+};
+
+/**
+ * Initializes the results container helpers if they are enabled and do
+ * not exist
+ *
+ * @method _initContainerHelperEls
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initContainerHelperEls = function() {
+ if(this.useShadow && !this._elShadow) {
+ var elShadow = document.createElement("div");
+ elShadow.className = "yui-ac-shadow";
+ elShadow.style.width = 0;
+ elShadow.style.height = 0;
+ this._elShadow = this._elContainer.appendChild(elShadow);
+ }
+ if(this.useIFrame && !this._elIFrame) {
+ var elIFrame = document.createElement("iframe");
+ elIFrame.src = this._iFrameSrc;
+ elIFrame.frameBorder = 0;
+ elIFrame.scrolling = "no";
+ elIFrame.style.position = "absolute";
+ elIFrame.style.width = 0;
+ elIFrame.style.height = 0;
+ elIFrame.style.padding = 0;
+ elIFrame.tabIndex = -1;
+ elIFrame.role = "presentation";
+ elIFrame.title = "Presentational iframe shim";
+ this._elIFrame = this._elContainer.appendChild(elIFrame);
+ }
+};
+
+/**
+ * Initializes the results container once at object creation
+ *
+ * @method _initContainerEl
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initContainerEl = function() {
+ YAHOO.util.Dom.addClass(this._elContainer, "yui-ac-container");
+
+ if(!this._elContent) {
+ // The elContent div is assigned DOM listeners and
+ // helps size the iframe and shadow properly
+ var elContent = document.createElement("div");
+ elContent.className = "yui-ac-content";
+ elContent.style.display = "none";
+
+ this._elContent = this._elContainer.appendChild(elContent);
+
+ var elHeader = document.createElement("div");
+ elHeader.className = "yui-ac-hd";
+ elHeader.style.display = "none";
+ this._elHeader = this._elContent.appendChild(elHeader);
+
+ var elBody = document.createElement("div");
+ elBody.className = "yui-ac-bd";
+ this._elBody = this._elContent.appendChild(elBody);
+
+ var elFooter = document.createElement("div");
+ elFooter.className = "yui-ac-ft";
+ elFooter.style.display = "none";
+ this._elFooter = this._elContent.appendChild(elFooter);
+ }
+ else {
+ YAHOO.log("Could not initialize the container","warn",this.toString());
+ }
+};
+
+/**
+ * Clears out contents of container body and creates up to
+ * YAHOO.widget.AutoComplete#maxResultsDisplayed <li> elements in an
+ * <ul> element.
+ *
+ * @method _initListEl
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initListEl = function() {
+ var nListLength = this.maxResultsDisplayed,
+ elList = this._elList || document.createElement("ul"),
+ elListItem;
+
+ while(elList.childNodes.length < nListLength) {
+ elListItem = document.createElement("li");
+ elListItem.style.display = "none";
+ elListItem._nItemIndex = elList.childNodes.length;
+ elList.appendChild(elListItem);
+ }
+ if(!this._elList) {
+ var elBody = this._elBody;
+ YAHOO.util.Event.purgeElement(elBody, true);
+ elBody.innerHTML = "";
+ this._elList = elBody.appendChild(elList);
+ }
+
+ this._elBody.style.display = "";
+};
+
+/**
+ * Focuses input field.
+ *
+ * @method _focus
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._focus = function() {
+ // http://developer.mozilla.org/en/docs/index.php?title=Key-navigable_custom_DHTML_widgets
+ var oSelf = this;
+ setTimeout(function() {
+ try {
+ oSelf._elTextbox.focus();
+ }
+ catch(e) {
+ }
+ },0);
+};
+
+/**
+ * Enables interval detection for IME support.
+ *
+ * @method _enableIntervalDetection
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._enableIntervalDetection = function() {
+ var oSelf = this;
+ if(!oSelf._queryInterval && oSelf.queryInterval) {
+ oSelf._queryInterval = setInterval(function() { oSelf._onInterval(); }, oSelf.queryInterval);
+ YAHOO.log("Interval set", "info", this.toString());
+ }
+};
+
+/**
+ * Enables interval detection for a less performant but brute force mechanism to
+ * detect input values at an interval set by queryInterval and send queries if
+ * input value has changed. Needed to support right-click+paste or shift+insert
+ * edge cases. Please note that intervals are cleared at the end of each interaction,
+ * so enableIntervalDetection must be called for each new interaction. The
+ * recommended approach is to call it in response to textboxFocusEvent.
+ *
+ * @method enableIntervalDetection
+ */
+YAHOO.widget.AutoComplete.prototype.enableIntervalDetection =
+ YAHOO.widget.AutoComplete.prototype._enableIntervalDetection;
+
+/**
+ * Enables query triggers based on text input detection by intervals (rather
+ * than by key events).
+ *
+ * @method _onInterval
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onInterval = function() {
+ var currValue = this._elTextbox.value;
+ var lastValue = this._sLastTextboxValue;
+ if(currValue != lastValue) {
+ this._sLastTextboxValue = currValue;
+ this._sendQuery(currValue);
+ }
+};
+
+/**
+ * Cancels text input detection by intervals.
+ *
+ * @method _clearInterval
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._clearInterval = function() {
+ if(this._queryInterval) {
+ clearInterval(this._queryInterval);
+ this._queryInterval = null;
+ YAHOO.log("Interval cleared", "info", this.toString());
+ }
+};
+
+/**
+ * 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
+ (nKeyCode == 229) // Bug 2041973: Korean XP fires 2 keyup events, the key and 229
+ ) {
+ 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 < 0) {
+ this._toggleContainer(false);
+ YAHOO.log("Property minQueryLength is less than 0", "info", this.toString());
+ return;
+ }
+ // Delimiter has been enabled
+ if(this.delimChar) {
+ var extraction = this._extractQuery(sQuery);
+ // Here is the query itself
+ sQuery = extraction.query;
+ // ...and save the rest of the string for later
+ this._sPastSelections = extraction.previous;
+ }
+
+ // 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);
+ YAHOO.log("Query \"" + sQuery + "\" is too short", "info", this.toString());
+ return;
+ }
+
+ sQuery = encodeURIComponent(sQuery);
+ this._nDelayID = -1; // Reset timeout ID because request is being made
+
+ // Subset matching
+ if(this.dataSource.queryMatchSubset || this.queryMatchSubset) { // backward compat
+ var oResponse = this.getSubsetMatches(sQuery);
+ if(oResponse) {
+ this.handleResponse(sQuery, oResponse, {query: sQuery});
+ return;
+ }
+ }
+
+ if(this.dataSource.responseStripAfter) {
+ this.dataSource.doBeforeParseData = this.preparseRawResponse;
+ }
+ if(this.applyLocalFilter) {
+ this.dataSource.doBeforeCallback = this.filterResults;
+ }
+
+ var sRequest = this.generateRequest(sQuery);
+ this.dataRequestEvent.fire(this, sQuery, sRequest);
+ YAHOO.log("Sending query \"" + sRequest + "\"", "info", this.toString());
+
+ this.dataSource.sendRequest(sRequest, {
+ success : this.handleResponse,
+ failure : this.handleResponse,
+ scope : this,
+ argument: {
+ query: sQuery
+ }
+ });
+};
+
+/**
+ * Populates the given <li> element with return value from formatResult().
+ *
+ * @method _populateListItem
+ * @param elListItem {HTMLElement} The LI element.
+ * @param oResult {Object} The result object.
+ * @param sCurQuery {String} The query string.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._populateListItem = function(elListItem, oResult, sQuery) {
+ elListItem.innerHTML = this.formatResult(oResult, sQuery, elListItem._sResultMatch);
+};
+
+/**
+ * Populates the array of <li> elements in the container with query
+ * results.
+ *
+ * @method _populateList
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, oResponse, oPayload) {
+ // Clear previous timeout
+ if(this._nTypeAheadDelayID != -1) {
+ clearTimeout(this._nTypeAheadDelayID);
+ }
+
+ sQuery = (oPayload && oPayload.query) ? oPayload.query : sQuery;
+
+ // Pass data through abstract method for any transformations
+ var ok = this.doBeforeLoadData(sQuery, oResponse, oPayload);
+
+ // Data is ok
+ if(ok && !oResponse.error) {
+ this.dataReturnEvent.fire(this, sQuery, oResponse.results);
+
+ // Continue only if instance is still active (i.e., user hasn't already moved on)
+ if(this._bFocused) {
+ // Store state for this interaction
+ var sCurQuery = decodeURIComponent(sQuery);
+ this._sCurQuery = sCurQuery;
+ this._bItemSelected = false;
+
+ var allResults = oResponse.results,
+ nItemsToShow = Math.min(allResults.length,this.maxResultsDisplayed),
+ sMatchKey = (this.dataSource.responseSchema.fields) ?
+ (this.dataSource.responseSchema.fields[0].key || this.dataSource.responseSchema.fields[0]) : 0;
+
+ if(nItemsToShow > 0) {
+ // Make sure container and helpers are ready to go
+ if(!this._elList || (this._elList.childNodes.length < nItemsToShow)) {
+ this._initListEl();
+ }
+ this._initContainerHelperEls();
+
+ var allListItemEls = this._elList.childNodes;
+ // Fill items with data from the bottom up
+ for(var i = nItemsToShow-1; i >= 0; i--) {
+ var elListItem = allListItemEls[i],
+ oResult = allResults[i];
+
+ // Backward compatibility
+ if(this.resultTypeList) {
+ // Results need to be converted back to an array
+ var aResult = [];
+ // Match key is first
+ aResult[0] = (YAHOO.lang.isString(oResult)) ? oResult : oResult[sMatchKey] || oResult[this.key];
+ // Add additional data to the result array
+ var fields = this.dataSource.responseSchema.fields;
+ if(YAHOO.lang.isArray(fields) && (fields.length > 1)) {
+ for(var k=1, len=fields.length; k= nItemsToShow; j--) {
+ extraListItem = allListItemEls[j];
+ extraListItem.style.display = "none";
+ }
+ }
+
+ this._nDisplayedItems = nItemsToShow;
+
+ this.containerPopulateEvent.fire(this, sQuery, allResults);
+
+ // Highlight the first item
+ if(this.autoHighlight) {
+ var elFirstListItem = this._elList.firstChild;
+ this._toggleHighlight(elFirstListItem,"to");
+ this.itemArrowToEvent.fire(this, elFirstListItem);
+ YAHOO.log("Arrowed to first item", "info", this.toString());
+ this._typeAhead(elFirstListItem,sQuery);
+ }
+ // Unhighlight any previous time
+ else {
+ this._toggleHighlight(this._elCurListItem,"from");
+ }
+
+ // Pre-expansion stuff
+ ok = this._doBeforeExpandContainer(this._elTextbox, this._elContainer, sQuery, allResults);
+
+ // Expand the container
+ this._toggleContainer(ok);
+ }
+ else {
+ this._toggleContainer(false);
+ }
+
+ YAHOO.log("Container populated with " + nItemsToShow + " list items", "info", this.toString());
+ return;
+ }
+ }
+ // Error
+ else {
+ this.dataErrorEvent.fire(this, sQuery, oResponse);
+ }
+
+ YAHOO.log("Could not populate list", "info", this.toString());
+};
+
+/**
+ * Called before container expands, by default snaps container to the
+ * bottom-left corner of the input element, then calls public overrideable method.
+ *
+ * @method _doBeforeExpandContainer
+ * @param elTextbox {HTMLElement} The text input box.
+ * @param elContainer {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.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._doBeforeExpandContainer = function(elTextbox, elContainer, sQuery, aResults) {
+ if(this.autoSnapContainer) {
+ this.snapContainer();
+ }
+
+ return this.doBeforeExpandContainer(elTextbox, elContainer, 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 extraction = (this.delimChar) ? this._extractQuery(this._elTextbox.value) :
+ {previous:"",query:this._elTextbox.value};
+ this._elTextbox.value = extraction.previous;
+ this.selectionEnforceEvent.fire(this, extraction.query);
+ YAHOO.log("Selection enforced", "info", this.toString());
+};
+
+/**
+ * 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 elMatch = null;
+
+ for(var i=0; i= 0; i--) {
+ 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 in the query so extract the latest query from past selections
+ if(nDelimIndex > -1) {
+ 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
+ sPrevious = sQuery.substring(0,nQueryStart);
+ // Here is the query itself
+ sQuery = sQuery.substr(nQueryStart);
+ }
+ // No delimiter found in the query, so there are no selections from past queries
+ else {
+ sPrevious = "";
+ }
+
+ return {
+ previous: sPrevious,
+ query: sQuery
+ };
+};
+
+/**
+ * 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 width = this._elContent.offsetWidth + "px";
+ var height = this._elContent.offsetHeight + "px";
+
+ if(this.useIFrame && this._elIFrame) {
+ var elIFrame = this._elIFrame;
+ if(bShow) {
+ elIFrame.style.width = width;
+ elIFrame.style.height = height;
+ elIFrame.style.padding = "";
+ YAHOO.log("Iframe expanded", "info", this.toString());
+ }
+ else {
+ elIFrame.style.width = 0;
+ elIFrame.style.height = 0;
+ elIFrame.style.padding = 0;
+ YAHOO.log("Iframe collapsed", "info", this.toString());
+ }
+ }
+ if(this.useShadow && this._elShadow) {
+ var elShadow = this._elShadow;
+ if(bShow) {
+ elShadow.style.width = width;
+ elShadow.style.height = height;
+ YAHOO.log("Shadow expanded", "info", this.toString());
+ }
+ else {
+ elShadow.style.width = 0;
+ elShadow.style.height = 0;
+ YAHOO.log("Shadow collapsed", "info", this.toString());
+ }
+ }
+};
+
+/**
+ * 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) {
+ YAHOO.log("Toggling container " + ((bShow) ? "open" : "closed"), "info", this.toString());
+
+ var elContainer = this._elContainer;
+
+ // If implementer has container always open and it's already open, don't mess with it
+ // Container is initialized with display "none" so it may need to be shown first time through
+ if(this.alwaysShowContainer && this._bContainerOpen) {
+ return;
+ }
+
+ // Reset states
+ if(!bShow) {
+ this._toggleHighlight(this._elCurListItem,"from");
+ this._nDisplayedItems = 0;
+ this._sCurQuery = null;
+
+ // Container is already closed, so don't bother with changing the UI
+ if(this._elContent.style.display == "none") {
+ return;
+ }
+ }
+
+ // If animation is enabled...
+ var oAnim = this._oAnim;
+ if(oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) {
+ if(oAnim.isAnimated()) {
+ oAnim.stop(true);
+ }
+
+ // Clone container to grab current size offscreen
+ var oClone = this._elContent.cloneNode(true);
+ elContainer.appendChild(oClone);
+ oClone.style.top = "-9000px";
+ oClone.style.width = "";
+ oClone.style.height = "";
+ oClone.style.display = "";
+
+ // 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) {
+ this._elContent.style.width = wColl+"px";
+ this._elContent.style.height = hColl+"px";
+ }
+ // Else, set it to its last known size.
+ else {
+ this._elContent.style.width = wExp+"px";
+ this._elContent.style.height = hExp+"px";
+ }
+
+ elContainer.removeChild(oClone);
+ oClone = null;
+
+ var oSelf = this;
+ var onAnimComplete = function() {
+ // Finish the collapse
+ oAnim.onComplete.unsubscribeAll();
+
+ if(bShow) {
+ oSelf._toggleContainerHelpers(true);
+ oSelf._bContainerOpen = bShow;
+ oSelf.containerExpandEvent.fire(oSelf);
+ YAHOO.log("Container expanded", "info", oSelf.toString());
+ }
+ else {
+ oSelf._elContent.style.display = "none";
+ oSelf._bContainerOpen = bShow;
+ oSelf.containerCollapseEvent.fire(oSelf);
+ YAHOO.log("Container collapsed", "info", oSelf.toString());
+ }
+ };
+
+ // Display container and animate it
+ this._toggleContainerHelpers(false); // Bug 1424486: Be early to hide, late to show;
+ this._elContent.style.display = "";
+ oAnim.onComplete.subscribe(onAnimComplete);
+ oAnim.animate();
+ }
+ // Else don't animate, just show or hide
+ else {
+ if(bShow) {
+ this._elContent.style.display = "";
+ this._toggleContainerHelpers(true);
+ this._bContainerOpen = bShow;
+ this.containerExpandEvent.fire(this);
+ YAHOO.log("Container expanded", "info", this.toString());
+ }
+ else {
+ this._toggleContainerHelpers(false);
+ this._elContent.style.display = "none";
+ this._bContainerOpen = bShow;
+ this.containerCollapseEvent.fire(this);
+ YAHOO.log("Container collapsed", "info", this.toString());
+ }
+ }
+
+};
+
+/**
+ * Toggles the highlight on or off for an item in the container, and also cleans
+ * up highlighting of any previous item.
+ *
+ * @method _toggleHighlight
+ * @param elNewListItem {HTMLElement} The <li> 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(elNewListItem, sType) {
+ if(elNewListItem) {
+ var sHighlight = this.highlightClassName;
+ if(this._elCurListItem) {
+ // Remove highlight from old item
+ YAHOO.util.Dom.removeClass(this._elCurListItem, sHighlight);
+ this._elCurListItem = null;
+ }
+
+ if((sType == "to") && sHighlight) {
+ // Apply highlight to new item
+ YAHOO.util.Dom.addClass(elNewListItem, sHighlight);
+ this._elCurListItem = elNewListItem;
+ }
+ }
+};
+
+/**
+ * Toggles the pre-highlight on or off for an item in the container, and also cleans
+ * up pre-highlighting of any previous item.
+ *
+ * @method _togglePrehighlight
+ * @param elNewListItem {HTMLElement} The <li> 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(elNewListItem, sType) {
+ var sPrehighlight = this.prehighlightClassName;
+
+ if(this._elCurPrehighlightItem) {
+ YAHOO.util.Dom.removeClass(this._elCurPrehighlightItem, sPrehighlight);
+ }
+ if(elNewListItem == this._elCurListItem) {
+ return;
+ }
+
+ if((sType == "mouseover") && sPrehighlight) {
+ // Apply prehighlight to new item
+ YAHOO.util.Dom.addClass(elNewListItem, sPrehighlight);
+ this._elCurPrehighlightItem = elNewListItem;
+ }
+ else {
+ // Remove prehighlight from old item
+ YAHOO.util.Dom.removeClass(elNewListItem, 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 elListItem {HTMLElement} The <li> element item with which to update the value.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._updateValue = function(elListItem) {
+ if(!this.suppressInputUpdate) {
+ var elTextbox = this._elTextbox;
+ var sDelimChar = (this.delimChar) ? (this.delimChar[0] || this.delimChar) : null;
+ var sResultMatch = elListItem._sResultMatch;
+
+ // Calculate the new value
+ var sNewValue = "";
+ if(sDelimChar) {
+ // Preserve selections from past queries
+ sNewValue = this._sPastSelections;
+ // Add new selection plus delimiter
+ sNewValue += sResultMatch + sDelimChar;
+ if(sDelimChar != " ") {
+ sNewValue += " ";
+ }
+ }
+ else {
+ sNewValue = sResultMatch;
+ }
+
+ // Update input field
+ elTextbox.value = sNewValue;
+
+ // Scroll to bottom of textarea if necessary
+ if(elTextbox.type == "textarea") {
+ elTextbox.scrollTop = elTextbox.scrollHeight;
+ }
+
+ // Move cursor to end
+ var end = elTextbox.value.length;
+ this._selectText(elTextbox,end,end);
+
+ this._elCurListItem = elListItem;
+ }
+};
+
+/**
+ * Selects a result item from the container
+ *
+ * @method _selectItem
+ * @param elListItem {HTMLElement} The selected <li> element item.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._selectItem = function(elListItem) {
+ this._bItemSelected = true;
+ this._updateValue(elListItem);
+ this._sPastSelections = this._elTextbox.value;
+ this._clearInterval();
+ this.itemSelectEvent.fire(this, elListItem, elListItem._oResultData);
+ YAHOO.log("Item selected: " + YAHOO.lang.dump(elListItem._oResultData), "info", this.toString());
+ 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._elCurListItem) {
+ this._selectItem(this._elCurListItem);
+ }
+ else {
+ this._toggleContainer(false);
+ }
+};
+
+/**
+ * Triggered by up and down arrow keys, changes the current highlighted
+ * <li> 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 elCurListItem = this._elCurListItem,
+ nCurItemIndex = -1;
+
+ if(elCurListItem) {
+ nCurItemIndex = elCurListItem._nItemIndex;
+ }
+
+ var nNewItemIndex = (nKeyCode == 40) ?
+ (nCurItemIndex + 1) : (nCurItemIndex - 1);
+
+ // Out of bounds
+ if(nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) {
+ return;
+ }
+
+ if(elCurListItem) {
+ // Unhighlight current item
+ this._toggleHighlight(elCurListItem, "from");
+ this.itemArrowFromEvent.fire(this, elCurListItem);
+ YAHOO.log("Item arrowed from: " + elCurListItem._nItemIndex, "info", this.toString());
+ }
+ if(nNewItemIndex == -1) {
+ // Go back to query (remove type-ahead string)
+ if(this.delimChar) {
+ this._elTextbox.value = this._sPastSelections + this._sCurQuery;
+ }
+ else {
+ this._elTextbox.value = this._sCurQuery;
+ }
+ return;
+ }
+ if(nNewItemIndex == -2) {
+ // Close container
+ this._toggleContainer(false);
+ return;
+ }
+
+ var elNewListItem = this._elList.childNodes[nNewItemIndex],
+
+ // Scroll the container if necessary
+ elContent = this._elContent,
+ sOF = YAHOO.util.Dom.getStyle(elContent,"overflow"),
+ sOFY = YAHOO.util.Dom.getStyle(elContent,"overflowY"),
+ scrollOn = ((sOF == "auto") || (sOF == "scroll") || (sOFY == "auto") || (sOFY == "scroll"));
+ if(scrollOn && (nNewItemIndex > -1) &&
+ (nNewItemIndex < this._nDisplayedItems)) {
+ // User is keying down
+ if(nKeyCode == 40) {
+ // Bottom of selected item is below scroll area...
+ if((elNewListItem.offsetTop+elNewListItem.offsetHeight) > (elContent.scrollTop + elContent.offsetHeight)) {
+ // Set bottom of scroll area to bottom of selected item
+ elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight;
+ }
+ // Bottom of selected item is above scroll area...
+ else if((elNewListItem.offsetTop+elNewListItem.offsetHeight) < elContent.scrollTop) {
+ // Set top of selected item to top of scroll area
+ elContent.scrollTop = elNewListItem.offsetTop;
+
+ }
+ }
+ // User is keying up
+ else {
+ // Top of selected item is above scroll area
+ if(elNewListItem.offsetTop < elContent.scrollTop) {
+ // Set top of scroll area to top of selected item
+ this._elContent.scrollTop = elNewListItem.offsetTop;
+ }
+ // Top of selected item is below scroll area
+ else if(elNewListItem.offsetTop > (elContent.scrollTop + elContent.offsetHeight)) {
+ // Set bottom of selected item to bottom of scroll area
+ this._elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight;
+ }
+ }
+ }
+
+ this._toggleHighlight(elNewListItem, "to");
+ this.itemArrowToEvent.fire(this, elNewListItem);
+ YAHOO.log("Item arrowed to " + elNewListItem._nItemIndex, "info", this.toString());
+ if(this.typeAhead) {
+ this._updateValue(elNewListItem);
+ }
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private event handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * 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) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ if(oSelf.prehighlightClassName) {
+ oSelf._togglePrehighlight(elTarget,"mouseover");
+ }
+ else {
+ oSelf._toggleHighlight(elTarget,"to");
+ }
+
+ oSelf.itemMouseOverEvent.fire(oSelf, elTarget);
+ YAHOO.log("Item moused over " + elTarget._nItemIndex, "info", oSelf.toString());
+ break;
+ case "div":
+ if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) {
+ oSelf._bOverContainer = true;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+/**
+ * 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) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ if(oSelf.prehighlightClassName) {
+ oSelf._togglePrehighlight(elTarget,"mouseout");
+ }
+ else {
+ oSelf._toggleHighlight(elTarget,"from");
+ }
+
+ oSelf.itemMouseOutEvent.fire(oSelf, elTarget);
+ YAHOO.log("Item moused out " + elTarget._nItemIndex, "info", oSelf.toString());
+ break;
+ case "ul":
+ oSelf._toggleHighlight(oSelf._elCurListItem,"to");
+ break;
+ case "div":
+ if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) {
+ oSelf._bOverContainer = false;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+/**
+ * Handles container click events.
+ *
+ * @method _onContainerClick
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerClick = function(v,oSelf) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ // In case item has not been moused over
+ oSelf._toggleHighlight(elTarget,"to");
+ oSelf._selectItem(elTarget);
+ return;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+
+/**
+ * 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._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;
+
+ // Clear timeout
+ if(oSelf._nTypeAheadDelayID != -1) {
+ clearTimeout(oSelf._nTypeAheadDelayID);
+ }
+
+ switch (nKeyCode) {
+ case 9: // tab
+ if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) {
+ // select an item or clear out
+ if(oSelf._elCurListItem) {
+ if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ }
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 13: // enter
+ if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) {
+ if(oSelf._elCurListItem) {
+ if(oSelf._nKeyCode != nKeyCode) {
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ }
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 27: // esc
+ oSelf._toggleContainer(false);
+ return;
+ case 39: // right
+ oSelf._jumpSelection();
+ break;
+ case 38: // up
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ oSelf._moveSelection(nKeyCode);
+ }
+ break;
+ case 40: // down
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ oSelf._moveSelection(nKeyCode);
+ }
+ break;
+ default:
+ oSelf._bItemSelected = false;
+ oSelf._toggleHighlight(oSelf._elCurListItem, "from");
+
+ oSelf.textboxKeyEvent.fire(oSelf, nKeyCode);
+ YAHOO.log("Textbox keyed", "info", oSelf.toString());
+ break;
+ }
+
+ if(nKeyCode === 18){
+ oSelf._enableIntervalDetection();
+ }
+ oSelf._nKeyCode = nKeyCode;
+};
+
+/**
+ * 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 non SF3 (bug 1978549) Mac browsers (bug 790337) and Opera browsers (bug 583531),
+ // where stopEvent is ineffective on keydown events
+ if(YAHOO.env.ua.opera || (navigator.userAgent.toLowerCase().indexOf("mac") != -1) && (YAHOO.env.ua.webkit < 420)) {
+ switch (nKeyCode) {
+ case 9: // tab
+ // select an item or clear out
+ if(oSelf._bContainerOpen) {
+ if(oSelf.delimChar) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ if(oSelf._elCurListItem) {
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 13: // enter
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ if(oSelf._elCurListItem) {
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ 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._enableIntervalDetection();
+ }
+};
+
+/**
+ * Handles textbox keyup events to 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) {
+ var sText = this.value; //string in textbox
+
+ // Check to see if any of the public properties have been updated
+ oSelf._initProps();
+
+ // Filter out chars that don't trigger queries
+ var nKeyCode = v.keyCode;
+ if(oSelf._isIgnoreKey(nKeyCode)) {
+ return;
+ }
+
+ // Clear previous timeout
+ if(oSelf._nDelayID != -1) {
+ clearTimeout(oSelf._nDelayID);
+ }
+
+ // Set new timeout
+ oSelf._nDelayID = setTimeout(function(){
+ oSelf._sendQuery(sText);
+ },(oSelf.queryDelay * 1000));
+};
+
+/**
+ * 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) {
+ // Start of a new interaction
+ if(!oSelf._bFocused) {
+ oSelf._elTextbox.setAttribute("autocomplete","off");
+ oSelf._bFocused = true;
+ oSelf._sInitInputValue = oSelf._elTextbox.value;
+ oSelf.textboxFocusEvent.fire(oSelf);
+ YAHOO.log("Textbox focused", "info", oSelf.toString());
+ }
+};
+
+/**
+ * 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) {
+ // Is a true blur
+ if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) {
+ // Current query needs to be validated as a selection
+ if(!oSelf._bItemSelected) {
+ var elMatchListItem = oSelf._textMatchesOption();
+ // Container is closed or current query doesn't match any result
+ if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && (elMatchListItem === 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, oSelf._sCurQuery);
+ YAHOO.log("Unmatched item selected: " + oSelf._sCurQuery, "info", oSelf.toString());
+ }
+ }
+ // 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(elMatchListItem);
+ }
+ }
+ }
+
+ oSelf._clearInterval();
+ oSelf._bFocused = false;
+ if(oSelf._sInitInputValue !== oSelf._elTextbox.value) {
+ oSelf.textboxChangeEvent.fire(oSelf);
+ }
+ oSelf.textboxBlurEvent.fire(oSelf);
+ YAHOO.log("Textbox blurred", "info", oSelf.toString());
+
+ oSelf._toggleContainer(false);
+ }
+ // Not a true blur if it was a selection via mouse click
+ else {
+ oSelf._focus();
+ }
+};
+
+/**
+ * Handles window unload event.
+ *
+ * @method _onWindowUnload
+ * @param v {HTMLEvent} The unload event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onWindowUnload = function(v,oSelf) {
+ if(oSelf && oSelf._elTextbox && oSelf.allowBrowserAutocomplete) {
+ oSelf._elTextbox.setAttribute("autocomplete","on");
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Deprecated for Backwards Compatibility
+//
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @method doBeforeSendQuery
+ * @deprecated Use generateRequest.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery = function(sQuery) {
+ return this.generateRequest(sQuery);
+};
+
+/**
+ * @method getListItems
+ * @deprecated Use getListEl().childNodes.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItems = function() {
+ var allListItemEls = [],
+ els = this._elList.childNodes;
+ for(var i=els.length-1; i>=0; i--) {
+ allListItemEls[i] = els[i];
+ }
+ return allListItemEls;
+};
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Private static methods
+//
+/////////////////////////////////////////////////////////////////////////
+
+/**
+ * Clones object literal or array of object literals.
+ *
+ * @method AutoComplete._cloneObject
+ * @param o {Object} Object.
+ * @private
+ * @static
+ */
+YAHOO.widget.AutoComplete._cloneObject = function(o) {
+ if(!YAHOO.lang.isValue(o)) {
+ return o;
+ }
+
+ var copy = {};
+
+ if(YAHOO.lang.isFunction(o)) {
+ copy = o;
+ }
+ else if(YAHOO.lang.isArray(o)) {
+ var array = [];
+ for(var i=0,len=o.length;i-1;A--){B[A].style.display="none";}};YAHOO.widget.AutoComplete.prototype.getSubsetMatches=function(E){var D,C,A;for(var B=E.length;B>=this.minQueryLength;B--){A=this.generateRequest(E.substr(0,B));this.dataRequestEvent.fire(this,D,A);C=this.dataSource.getCachedResponse(A);if(C){return this.filterResults.apply(this.dataSource,[E,C,C,{scope:this}]);}}return null;};YAHOO.widget.AutoComplete.prototype.preparseRawResponse=function(C,B,A){var D=((this.responseStripAfter!=="")&&(B.indexOf))?B.indexOf(this.responseStripAfter):-1;if(D!=-1){B=B.substring(0,D);}return B;};YAHOO.widget.AutoComplete.prototype.filterResults=function(K,M,Q,L){if(L&&L.argument&&L.argument.query){K=L.argument.query;}if(K&&K!==""){Q=YAHOO.widget.AutoComplete._cloneObject(Q);var I=L.scope,P=this,C=Q.results,N=[],B=I.maxResultsDisplayed,J=(P.queryMatchCase||I.queryMatchCase),A=(P.queryMatchContains||I.queryMatchContains);for(var D=0,H=C.length;D-1))){N.push(F);}}if(H>B&&N.length===B){break;}}Q.results=N;}else{}return Q;};YAHOO.widget.AutoComplete.prototype.handleResponse=function(C,A,B){if((this instanceof YAHOO.widget.AutoComplete)&&this._sName){this._populateList(C,A,B);}};YAHOO.widget.AutoComplete.prototype.doBeforeLoadData=function(C,A,B){return true;};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,D,A){var C=(A)?A:"";return C;};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(D,A,C,B){return true;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._elTextbox;var D=this._elContainer;this.textboxFocusEvent.unsubscribeAll();this.textboxKeyEvent.unsubscribeAll();this.dataRequestEvent.unsubscribeAll();this.dataReturnEvent.unsubscribeAll();this.dataErrorEvent.unsubscribeAll();this.containerPopulateEvent.unsubscribeAll();this.containerExpandEvent.unsubscribeAll();this.typeAheadEvent.unsubscribeAll();this.itemMouseOverEvent.unsubscribeAll();this.itemMouseOutEvent.unsubscribeAll();this.itemArrowToEvent.unsubscribeAll();this.itemArrowFromEvent.unsubscribeAll();this.itemSelectEvent.unsubscribeAll();this.unmatchedItemSelectEvent.unsubscribeAll();this.selectionEnforceEvent.unsubscribeAll();this.containerCollapseEvent.unsubscribeAll();this.textboxBlurEvent.unsubscribeAll();this.textboxChangeEvent.unsubscribeAll();YAHOO.util.Event.purgeElement(A,true);YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerPopulateEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;
+YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete.prototype.textboxChangeEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._elTextbox=null;YAHOO.widget.AutoComplete.prototype._elContainer=null;YAHOO.widget.AutoComplete.prototype._elContent=null;YAHOO.widget.AutoComplete.prototype._elHeader=null;YAHOO.widget.AutoComplete.prototype._elBody=null;YAHOO.widget.AutoComplete.prototype._elFooter=null;YAHOO.widget.AutoComplete.prototype._elShadow=null;YAHOO.widget.AutoComplete.prototype._elIFrame=null;YAHOO.widget.AutoComplete.prototype._bFocused=false;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._elList=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sPastSelections="";YAHOO.widget.AutoComplete.prototype._sInitInputValue=null;YAHOO.widget.AutoComplete.prototype._elCurListItem=null;YAHOO.widget.AutoComplete.prototype._elCurPrehighlightItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var E=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(E)||(E<1)){this.maxResultsDisplayed=10;}var F=this.queryDelay;if(!YAHOO.lang.isNumber(F)||(F<0)){this.queryDelay=0.2;}var C=this.typeAheadDelay;if(!YAHOO.lang.isNumber(C)||(C<0)){this.typeAheadDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var D=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(D)||(D<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelperEls=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";A.style.width=0;A.style.height=0;this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width=0;B.style.height=0;B.style.padding=0;B.tabIndex=-1;B.role="presentation";B.title="Presentational iframe shim";this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainerEl=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initListEl=function(){var C=this.maxResultsDisplayed,A=this._elList||document.createElement("ul"),B;while(A.childNodes.length=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)||(A==229)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(D){if(this.minQueryLength<0){this._toggleContainer(false);return;}if(this.delimChar){var A=this._extractQuery(D);D=A.query;this._sPastSelections=A.previous;}if((D&&(D.length0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return;}D=encodeURIComponent(D);this._nDelayID=-1;if(this.dataSource.queryMatchSubset||this.queryMatchSubset){var C=this.getSubsetMatches(D);if(C){this.handleResponse(D,C,{query:D});return;
+}}if(this.dataSource.responseStripAfter){this.dataSource.doBeforeParseData=this.preparseRawResponse;}if(this.applyLocalFilter){this.dataSource.doBeforeCallback=this.filterResults;}var B=this.generateRequest(D);this.dataRequestEvent.fire(this,D,B);this.dataSource.sendRequest(B,{success:this.handleResponse,failure:this.handleResponse,scope:this,argument:{query:D}});};YAHOO.widget.AutoComplete.prototype._populateListItem=function(B,A,C){B.innerHTML=this.formatResult(A,C,B._sResultMatch);};YAHOO.widget.AutoComplete.prototype._populateList=function(K,F,C){if(this._nTypeAheadDelayID!=-1){clearTimeout(this._nTypeAheadDelayID);}K=(C&&C.query)?C.query:K;var H=this.doBeforeLoadData(K,F,C);if(H&&!F.error){this.dataReturnEvent.fire(this,K,F.results);if(this._bFocused){var M=decodeURIComponent(K);this._sCurQuery=M;this._bItemSelected=false;var R=F.results,A=Math.min(R.length,this.maxResultsDisplayed),J=(this.dataSource.responseSchema.fields)?(this.dataSource.responseSchema.fields[0].key||this.dataSource.responseSchema.fields[0]):0;if(A>0){if(!this._elList||(this._elList.childNodes.length=0;Q--){var P=I[Q],E=R[Q];if(this.resultTypeList){var B=[];B[0]=(YAHOO.lang.isString(E))?E:E[J]||E[this.key];var L=this.dataSource.responseSchema.fields;if(YAHOO.lang.isArray(L)&&(L.length>1)){for(var N=1,S=L.length;N=A;O--){G=I[O];G.style.display="none";}}this._nDisplayedItems=A;this.containerPopulateEvent.fire(this,K,R);if(this.autoHighlight){var D=this._elList.firstChild;this._toggleHighlight(D,"to");this.itemArrowToEvent.fire(this,D);this._typeAhead(D,K);}else{this._toggleHighlight(this._elCurListItem,"from");}H=this._doBeforeExpandContainer(this._elTextbox,this._elContainer,K,R);this._toggleContainer(H);}else{this._toggleContainer(false);}return;}}else{this.dataErrorEvent.fire(this,K,F);}};YAHOO.widget.AutoComplete.prototype._doBeforeExpandContainer=function(D,A,C,B){if(this.autoSnapContainer){this.snapContainer();}return this.doBeforeExpandContainer(D,A,C,B);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var A=(this.delimChar)?this._extractQuery(this._elTextbox.value):{previous:"",query:this._elTextbox.value};this._elTextbox.value=A.previous;this.selectionEnforceEvent.fire(this,A.query);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var A=null;for(var B=0;B=0;B--){G=H.lastIndexOf(C[B]);if(G>F){F=G;}}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(H[F-1]==C[A]){F--;break;}}}if(F>-1){E=F+1;while(H.charAt(E)==" "){E+=1;}D=H.substring(0,E);H=H.substr(E);}else{D="";}return{previous:D,query:H};};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(D){var E=this._elContent.offsetWidth+"px";var B=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){var C=this._elIFrame;if(D){C.style.width=E;C.style.height=B;C.style.padding="";}else{C.style.width=0;C.style.height=0;C.style.padding=0;}}if(this.useShadow&&this._elShadow){var A=this._elShadow;if(D){A.style.width=E;A.style.height=B;}else{A.style.width=0;A.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(I){var D=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return;}if(!I){this._toggleHighlight(this._elCurListItem,"from");this._nDisplayedItems=0;this._sCurQuery=null;if(this._elContent.style.display=="none"){return;}}var A=this._oAnim;if(A&&A.getEl()&&(this.animHoriz||this.animVert)){if(A.isAnimated()){A.stop(true);}var G=this._elContent.cloneNode(true);D.appendChild(G);G.style.top="-9000px";G.style.width="";G.style.height="";G.style.display="";var F=G.offsetWidth;var C=G.offsetHeight;var B=(this.animHoriz)?0:F;var E=(this.animVert)?0:C;A.attributes=(I)?{width:{to:F},height:{to:C}}:{width:{to:B},height:{to:E}};if(I&&!this._bContainerOpen){this._elContent.style.width=B+"px";this._elContent.style.height=E+"px";}else{this._elContent.style.width=F+"px";this._elContent.style.height=C+"px";}D.removeChild(G);G=null;var H=this;var J=function(){A.onComplete.unsubscribeAll();if(I){H._toggleContainerHelpers(true);H._bContainerOpen=I;H.containerExpandEvent.fire(H);}else{H._elContent.style.display="none";H._bContainerOpen=I;H.containerCollapseEvent.fire(H);}};this._toggleContainerHelpers(false);this._elContent.style.display="";A.onComplete.subscribe(J);A.animate();}else{if(I){this._elContent.style.display="";this._toggleContainerHelpers(true);this._bContainerOpen=I;this.containerExpandEvent.fire(this);}else{this._toggleContainerHelpers(false);this._elContent.style.display="none";this._bContainerOpen=I;this.containerCollapseEvent.fire(this);}}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){if(A){var B=this.highlightClassName;
+if(this._elCurListItem){YAHOO.util.Dom.removeClass(this._elCurListItem,B);this._elCurListItem=null;}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._elCurListItem=A;}}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(B,C){var A=this.prehighlightClassName;if(this._elCurPrehighlightItem){YAHOO.util.Dom.removeClass(this._elCurPrehighlightItem,A);}if(B==this._elCurListItem){return;}if((C=="mouseover")&&A){YAHOO.util.Dom.addClass(B,A);this._elCurPrehighlightItem=B;}else{YAHOO.util.Dom.removeClass(B,A);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(C){if(!this.suppressInputUpdate){var F=this._elTextbox;var E=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=C._sResultMatch;var D="";if(E){D=this._sPastSelections;D+=B+E;if(E!=" "){D+=" ";}}else{D=B;}F.value=D;if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._elCurListItem=C;}};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._sPastSelections=this._elTextbox.value;this._clearInterval();this.itemSelectEvent.fire(this,A,A._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._elCurListItem){this._selectItem(this._elCurListItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var H=this._elCurListItem,D=-1;if(H){D=H._nItemIndex;}var E=(G==40)?(D+1):(D-1);if(E<-2||E>=this._nDisplayedItems){return;}if(H){this._toggleHighlight(H,"from");this.itemArrowFromEvent.fire(this,H);}if(E==-1){if(this.delimChar){this._elTextbox.value=this._sPastSelections+this._sCurQuery;}else{this._elTextbox.value=this._sCurQuery;}return;}if(E==-2){this._toggleContainer(false);return;}var F=this._elList.childNodes[E],B=this._elContent,C=YAHOO.util.Dom.getStyle(B,"overflow"),I=YAHOO.util.Dom.getStyle(B,"overflowY"),A=((C=="auto")||(C=="scroll")||(I=="auto")||(I=="scroll"));if(A&&(E>-1)&&(E(B.scrollTop+B.offsetHeight)){B.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}else{if((F.offsetTop+F.offsetHeight)(B.scrollTop+B.offsetHeight)){this._elContent.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}}}}this._toggleHighlight(F,"to");this.itemArrowToEvent.fire(this,F);if(this.typeAhead){this._updateValue(F);}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseover");}else{C._toggleHighlight(D,"to");}C.itemMouseOverEvent.fire(C,D);break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=true;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseout");}else{C._toggleHighlight(D,"from");}C.itemMouseOutEvent.fire(C,D);break;case"ul":C._toggleHighlight(C._elCurListItem,"to");break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=false;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerClick=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":C._toggleHighlight(D,"to");C._selectItem(D);return;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;if(B._nTypeAheadDelayID!=-1){clearTimeout(B._nTypeAheadDelayID);}switch(C){case 9:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return;case 39:B._jumpSelection();break;case 38:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;case 40:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;default:B._bItemSelected=false;B._toggleHighlight(B._elCurListItem,"from");B.textboxKeyEvent.fire(B,C);break;}if(C===18){B._enableIntervalDetection();}B._nKeyCode=C;};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if(YAHOO.env.ua.opera||(navigator.userAgent.toLowerCase().indexOf("mac")!=-1)&&(YAHOO.env.ua.webkit<420)){switch(C){case 9:if(B._bContainerOpen){if(B.delimChar){YAHOO.util.Event.stopEvent(A);}if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;default:break;}}else{if(C==229){B._enableIntervalDetection();}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(A,C){var B=this.value;C._initProps();var D=A.keyCode;if(C._isIgnoreKey(D)){return;
+}if(C._nDelayID!=-1){clearTimeout(C._nDelayID);}C._nDelayID=setTimeout(function(){C._sendQuery(B);},(C.queryDelay*1000));};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){if(!B._bFocused){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;B._sInitInputValue=B._elTextbox.value;B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,C){if(!C._bOverContainer||(C._nKeyCode==9)){if(!C._bItemSelected){var B=C._textMatchesOption();if(!C._bContainerOpen||(C._bContainerOpen&&(B===null))){if(C.forceSelection){C._clearSelection();}else{C.unmatchedItemSelectEvent.fire(C,C._sCurQuery);}}else{if(C.forceSelection){C._selectItem(B);}}}C._clearInterval();C._bFocused=false;if(C._sInitInputValue!==C._elTextbox.value){C.textboxChangeEvent.fire(C);}C.textboxBlurEvent.fire(C);C._toggleContainer(false);}else{C._focus();}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return this.generateRequest(A);};YAHOO.widget.AutoComplete.prototype.getListItems=function(){var C=[],B=this._elList.childNodes;for(var A=B.length-1;A>=0;A--){C[A]=B[A];}return C;};YAHOO.widget.AutoComplete._cloneObject=function(D){if(!YAHOO.lang.isValue(D)){return D;}var F={};if(YAHOO.lang.isFunction(D)){F=D;}else{if(YAHOO.lang.isArray(D)){var E=[];for(var C=0,B=D.length;C
+ * Navigate with up/down arrow keys and/or mouse to pick a selection
+ * The drop down container can "roll down" or "fly out" via configurable
+ * animation
+ * UI look-and-feel customizable through CSS, including container
+ * attributes, borders, position, fonts, etc
+ *
+ *
+ * @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 && YAHOO.lang.isFunction(oDataSource.sendRequest)) {
+ this.dataSource = oDataSource;
+ }
+ else {
+ return;
+ }
+
+ // YAHOO.widget.DataSource schema backwards compatibility
+ // Converted deprecated schema into supported schema
+ // First assume key data is held in position 0 of results array
+ this.key = 0;
+ var schema = oDataSource.responseSchema;
+ // An old school schema has been defined in the deprecated DataSource constructor
+ if(oDataSource._aDeprecatedSchema) {
+ var aDeprecatedSchema = oDataSource._aDeprecatedSchema;
+ if(YAHOO.lang.isArray(aDeprecatedSchema)) {
+
+ if((oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_JSON) ||
+ (oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_UNKNOWN)) { // Used to default to unknown
+ // Store the resultsList
+ schema.resultsList = aDeprecatedSchema[0];
+ // Store the key
+ this.key = aDeprecatedSchema[1];
+ // Only resultsList and key are defined, so grab all the data
+ schema.fields = (aDeprecatedSchema.length < 3) ? null : aDeprecatedSchema.slice(1);
+ }
+ else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_XML) {
+ schema.resultNode = aDeprecatedSchema[0];
+ this.key = aDeprecatedSchema[1];
+ schema.fields = aDeprecatedSchema.slice(1);
+ }
+ else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_TEXT) {
+ schema.recordDelim = aDeprecatedSchema[0];
+ schema.fieldDelim = aDeprecatedSchema[1];
+ }
+ oDataSource.responseSchema = schema;
+ }
+ }
+
+ // Validate input element
+ if(YAHOO.util.Dom.inDocument(elInput)) {
+ if(YAHOO.lang.isString(elInput)) {
+ this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput;
+ this._elTextbox = document.getElementById(elInput);
+ }
+ else {
+ this._sName = (elInput.id) ?
+ "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput.id:
+ "instance" + YAHOO.widget.AutoComplete._nIndex;
+ this._elTextbox = elInput;
+ }
+ YAHOO.util.Dom.addClass(this._elTextbox, "yui-ac-input");
+ }
+ else {
+ return;
+ }
+
+ // Validate container element
+ if(YAHOO.util.Dom.inDocument(elContainer)) {
+ if(YAHOO.lang.isString(elContainer)) {
+ this._elContainer = document.getElementById(elContainer);
+ }
+ else {
+ this._elContainer = elContainer;
+ }
+ if(this._elContainer.style.display == "none") {
+ }
+
+ // For skinning
+ var elParent = this._elContainer.parentNode;
+ var elTag = elParent.tagName.toLowerCase();
+ if(elTag == "div") {
+ YAHOO.util.Dom.addClass(elParent, "yui-ac");
+ }
+ else {
+ }
+ }
+ else {
+ return;
+ }
+
+ // Default applyLocalFilter setting is to enable for local sources
+ if(this.dataSource.dataType === YAHOO.util.DataSourceBase.TYPE_LOCAL) {
+ this.applyLocalFilter = true;
+ }
+
+ // 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._initContainerEl();
+ this._initProps();
+ this._initListEl();
+ this._initContainerHelperEls();
+
+ // Set up events
+ var oSelf = this;
+ var elTextbox = this._elTextbox;
+
+ // Dom events
+ YAHOO.util.Event.addListener(elTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"focus",oSelf._onTextboxFocus,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"blur",oSelf._onTextboxBlur,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"mouseover",oSelf._onContainerMouseover,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"mouseout",oSelf._onContainerMouseout,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"click",oSelf._onContainerClick,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"scroll",oSelf._onContainerScroll,oSelf);
+ YAHOO.util.Event.addListener(elContainer,"resize",oSelf._onContainerResize,oSelf);
+ YAHOO.util.Event.addListener(elTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);
+ YAHOO.util.Event.addListener(window,"unload",oSelf._onWindowUnload,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.containerPopulateEvent = new YAHOO.util.CustomEvent("containerPopulate", 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);
+ this.textboxChangeEvent = new YAHOO.util.CustomEvent("textboxChange", this);
+
+ // Finish up
+ elTextbox.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;
+
+/**
+ * By default, results from local DataSources will pass through the filterResults
+ * method to apply a client-side matching algorithm.
+ *
+ * @property applyLocalFilter
+ * @type Boolean
+ * @default true for local arrays and json, otherwise false
+ */
+YAHOO.widget.AutoComplete.prototype.applyLocalFilter = null;
+
+/**
+ * When applyLocalFilter is true, the local filtering algorthim can have case sensitivity
+ * enabled.
+ *
+ * @property queryMatchCase
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.queryMatchCase = false;
+
+/**
+ * When applyLocalFilter is true, results can be locally filtered to return
+ * matching strings that "contain" the query string rather than simply "start with"
+ * the query string.
+ *
+ * @property queryMatchContains
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.queryMatchContains = false;
+
+/**
+ * Enables query subset matching. When the DataSource's cache is enabled 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.AutoComplete.prototype.queryMatchSubset = false;
+
+/**
+ * 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. If
+ * typeAhead is also enabled, this value must always be less than the typeAheadDelay
+ * in order to avoid certain race conditions.
+ *
+ * @property queryDelay
+ * @type Number
+ * @default 0.2
+ */
+YAHOO.widget.AutoComplete.prototype.queryDelay = 0.2;
+
+/**
+ * If typeAhead is true, number of seconds to delay before updating input with
+ * typeAhead value. In order to prevent certain race conditions, this value must
+ * always be greater than the queryDelay.
+ *
+ * @property typeAheadDelay
+ * @type Number
+ * @default 0.5
+ */
+YAHOO.widget.AutoComplete.prototype.typeAheadDelay = 0.5;
+
+/**
+ * When IME usage is detected or interval detection is explicitly enabled,
+ * AutoComplete will detect the input value at the given interval and send a
+ * query if the value has changed.
+ *
+ * @property queryInterval
+ * @type Number
+ * @default 500
+ */
+YAHOO.widget.AutoComplete.prototype.queryInterval = 500;
+
+/**
+ * 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;
+
+/**
+ * If autohighlight is enabled, whether or not the input field should be automatically updated
+ * with the first query result as the user types, auto-selecting the substring portion
+ * of the first result that the user has not yet 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
+ * <select> 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;
+
+/**
+ * Enabling this feature prevents the toggling of the container to a collapsed state.
+ * Setting to true does not automatically trigger the opening of the container.
+ * Implementers are advised to pre-load the container with an explicit "sendQuery()" call.
+ *
+ * @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
+ * <select> 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;
+
+/**
+ * Whether or not the input field should be updated with selections.
+ *
+ * @property suppressInputUpdate
+ * @type Boolean
+ * @default false
+ */
+YAHOO.widget.AutoComplete.prototype.suppressInputUpdate = false;
+
+/**
+ * For backward compatibility to pre-2.6.0 formatResults() signatures, setting
+ * resultsTypeList to true will take each object literal result returned by
+ * DataSource and flatten into an array.
+ *
+ * @property resultTypeList
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.resultTypeList = true;
+
+/**
+ * For XHR DataSources, AutoComplete will automatically insert a "?" between the server URI and
+ * the "query" param/value pair. To prevent this behavior, implementers should
+ * set this value to false. To more fully customize the query syntax, implementers
+ * should override the generateRequest() method.
+ *
+ * @property queryQuestionMark
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.queryQuestionMark = true;
+
+/**
+ * If true, before each time the container expands, the container element will be
+ * positioned to snap to the bottom-left corner of the input element. If
+ * autoSnapContainer is set to false, this positioning will not be done.
+ *
+ * @property autoSnapContainer
+ * @type Boolean
+ * @default true
+ */
+YAHOO.widget.AutoComplete.prototype.autoSnapContainer = true;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 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 DOM reference to input element.
+ *
+ * @method getInputEl
+ * @return {HTMLELement} DOM reference to input element.
+ */
+YAHOO.widget.AutoComplete.prototype.getInputEl = function() {
+ return this._elTextbox;
+};
+
+ /**
+ * Returns DOM reference to container element.
+ *
+ * @method getContainerEl
+ * @return {HTMLELement} DOM reference to container element.
+ */
+YAHOO.widget.AutoComplete.prototype.getContainerEl = function() {
+ return this._elContainer;
+};
+
+ /**
+ * Returns true if widget instance is currently active.
+ *
+ * @method isFocused
+ * @return {Boolean} Returns true if widget instance is currently active.
+ */
+YAHOO.widget.AutoComplete.prototype.isFocused = function() {
+ return this._bFocused;
+};
+
+ /**
+ * 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 <ul> element that displays query results within the results container.
+ *
+ * @method getListEl
+ * @return {HTMLElement[]} Reference to <ul> element within the results container.
+ */
+YAHOO.widget.AutoComplete.prototype.getListEl = function() {
+ return this._elList;
+};
+
+/**
+ * Public accessor to the matching string associated with a given <li> result.
+ *
+ * @method getListItemMatch
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {String} Matching string.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemMatch = function(elListItem) {
+ if(elListItem._sResultMatch) {
+ return elListItem._sResultMatch;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Public accessor to the result data associated with a given <li> result.
+ *
+ * @method getListItemData
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {Object} Result data.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemData = function(elListItem) {
+ if(elListItem._oResultData) {
+ return elListItem._oResultData;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Public accessor to the index of the associated with a given <li> result.
+ *
+ * @method getListItemIndex
+ * @param elListItem {HTMLElement} Reference to <LI> element.
+ * @return {Number} Index.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItemIndex = function(elListItem) {
+ if(YAHOO.lang.isNumber(elListItem._nItemIndex)) {
+ return elListItem._nItemIndex;
+ }
+ else {
+ return null;
+ }
+};
+
+/**
+ * Sets HTML markup for the results container header. This markup will be
+ * inserted within a <div> 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(this._elHeader) {
+ var elHeader = this._elHeader;
+ if(sHeader) {
+ elHeader.innerHTML = sHeader;
+ elHeader.style.display = "";
+ }
+ else {
+ elHeader.innerHTML = "";
+ elHeader.style.display = "none";
+ }
+ }
+};
+
+/**
+ * Sets HTML markup for the results container footer. This markup will be
+ * inserted within a <div> 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(this._elFooter) {
+ var elFooter = this._elFooter;
+ if(sFooter) {
+ elFooter.innerHTML = sFooter;
+ elFooter.style.display = "";
+ }
+ else {
+ elFooter.innerHTML = "";
+ elFooter.style.display = "none";
+ }
+ }
+};
+
+/**
+ * Sets HTML markup for the results container body. This markup will be
+ * inserted within a <div> 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(this._elBody) {
+ var elBody = this._elBody;
+ YAHOO.util.Event.purgeElement(elBody, true);
+ if(sBody) {
+ elBody.innerHTML = sBody;
+ elBody.style.display = "";
+ }
+ else {
+ elBody.innerHTML = "";
+ elBody.style.display = "none";
+ }
+ this._elList = null;
+ }
+};
+
+/**
+* A function that converts an AutoComplete query into a request value which is then
+* passed to the DataSource's sendRequest method in order to retrieve data for
+* the query. By default, returns a String with the syntax: "query={query}"
+* Implementers can customize this method for custom request syntaxes.
+*
+* @method generateRequest
+* @param sQuery {String} Query string
+* @return {MIXED} Request
+*/
+YAHOO.widget.AutoComplete.prototype.generateRequest = function(sQuery) {
+ var dataType = this.dataSource.dataType;
+
+ // Transform query string in to a request for remote data
+ // By default, local data doesn't need a transformation, just passes along the query as is.
+ if(dataType === YAHOO.util.DataSourceBase.TYPE_XHR) {
+ // By default, XHR GET requests look like "{scriptURI}?{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ if(!this.dataSource.connMethodPost) {
+ sQuery = (this.queryQuestionMark ? "?" : "") + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+ // By default, XHR POST bodies are sent to the {scriptURI} like "{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ else {
+ sQuery = (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+ }
+ // By default, remote script node requests look like "{scriptURI}&{scriptCallbackParam}={callbackString}&{scriptQueryParam}={sQuery}&{scriptQueryAppend}"
+ else if(dataType === YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE) {
+ sQuery = "&" + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery +
+ (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : "");
+ }
+
+ return sQuery;
+};
+
+/**
+ * Makes query request to the DataSource.
+ *
+ * @method sendQuery
+ * @param sQuery {String} Query string.
+ */
+YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) {
+ // Activate focus for a new interaction
+ this._bFocused = true;
+
+ // Adjust programatically sent queries to look like they were input by user
+ // when delimiters are enabled
+ var newQuery = (this.delimChar) ? this._elTextbox.value + sQuery : sQuery;
+ this._sendQuery(newQuery);
+};
+
+/**
+ * Snaps container to bottom-left corner of input element
+ *
+ * @method snapContainer
+ */
+YAHOO.widget.AutoComplete.prototype.snapContainer = function() {
+ var oTextbox = this._elTextbox,
+ pos = YAHOO.util.Dom.getXY(oTextbox);
+ pos[1] += YAHOO.util.Dom.get(oTextbox).offsetHeight + 2;
+ YAHOO.util.Dom.setXY(this._elContainer,pos);
+};
+
+/**
+ * Expands container.
+ *
+ * @method expandContainer
+ */
+YAHOO.widget.AutoComplete.prototype.expandContainer = function() {
+ this._toggleContainer(true);
+};
+
+/**
+ * Collapses container.
+ *
+ * @method collapseContainer
+ */
+YAHOO.widget.AutoComplete.prototype.collapseContainer = function() {
+ this._toggleContainer(false);
+};
+
+/**
+ * Clears entire list of suggestions.
+ *
+ * @method clearList
+ */
+YAHOO.widget.AutoComplete.prototype.clearList = function() {
+ var allItems = this._elList.childNodes,
+ i=allItems.length-1;
+ for(; i>-1; i--) {
+ allItems[i].style.display = "none";
+ }
+};
+
+/**
+ * Handles subset matching for when queryMatchSubset is enabled.
+ *
+ * @method getSubsetMatches
+ * @param sQuery {String} Query string.
+ * @return {Object} oParsedResponse or null.
+ */
+YAHOO.widget.AutoComplete.prototype.getSubsetMatches = function(sQuery) {
+ var subQuery, oCachedResponse, subRequest;
+ // Loop through substrings of each cached element's query property...
+ for(var i = sQuery.length; i >= this.minQueryLength ; i--) {
+ subRequest = this.generateRequest(sQuery.substr(0,i));
+ this.dataRequestEvent.fire(this, subQuery, subRequest);
+
+ // If a substring of the query is found in the cache
+ oCachedResponse = this.dataSource.getCachedResponse(subRequest);
+ if(oCachedResponse) {
+ return this.filterResults.apply(this.dataSource, [sQuery, oCachedResponse, oCachedResponse, {scope:this}]);
+ }
+ }
+ return null;
+};
+
+/**
+ * Executed by DataSource (within DataSource scope via doBeforeParseData()) to
+ * handle responseStripAfter cleanup.
+ *
+ * @method preparseRawResponse
+ * @param sQuery {String} Query string.
+ * @return {Object} oParsedResponse or null.
+ */
+YAHOO.widget.AutoComplete.prototype.preparseRawResponse = function(oRequest, oFullResponse, oCallback) {
+ var nEnd = ((this.responseStripAfter !== "") && (oFullResponse.indexOf)) ?
+ oFullResponse.indexOf(this.responseStripAfter) : -1;
+ if(nEnd != -1) {
+ oFullResponse = oFullResponse.substring(0,nEnd);
+ }
+ return oFullResponse;
+};
+
+/**
+ * Executed by DataSource (within DataSource scope via doBeforeCallback()) to
+ * filter results through a simple client-side matching algorithm.
+ *
+ * @method filterResults
+ * @param sQuery {String} Original request.
+ * @param oFullResponse {Object} Full response object.
+ * @param oParsedResponse {Object} Parsed response object.
+ * @param oCallback {Object} Callback object.
+ * @return {Object} Filtered response object.
+ */
+
+YAHOO.widget.AutoComplete.prototype.filterResults = function(sQuery, oFullResponse, oParsedResponse, oCallback) {
+ // If AC has passed a query string value back to itself, grab it
+ if(oCallback && oCallback.argument && oCallback.argument.query) {
+ sQuery = oCallback.argument.query;
+ }
+
+ // Only if a query string is available to match against
+ if(sQuery && sQuery !== "") {
+ // First make a copy of the oParseResponse
+ oParsedResponse = YAHOO.widget.AutoComplete._cloneObject(oParsedResponse);
+
+ var oAC = oCallback.scope,
+ oDS = this,
+ allResults = oParsedResponse.results, // the array of results
+ filteredResults = [], // container for filtered results,
+ nMax = oAC.maxResultsDisplayed, // max to find
+ bMatchCase = (oDS.queryMatchCase || oAC.queryMatchCase), // backward compat
+ bMatchContains = (oDS.queryMatchContains || oAC.queryMatchContains); // backward compat
+
+ // Loop through each result object...
+ for(var i=0, len=allResults.length; i -1))) {
+ // Stash the match
+ filteredResults.push(oResult);
+ }
+ }
+
+ // Filter no more if maxResultsDisplayed is reached
+ if(len>nMax && filteredResults.length===nMax) {
+ break;
+ }
+ }
+ oParsedResponse.results = filteredResults;
+ }
+ else {
+ }
+
+ return oParsedResponse;
+};
+
+/**
+ * Handles response for display. This is the callback function method passed to
+ * YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are
+ * returned to the AutoComplete instance.
+ *
+ * @method handleResponse
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ */
+YAHOO.widget.AutoComplete.prototype.handleResponse = function(sQuery, oResponse, oPayload) {
+ if((this instanceof YAHOO.widget.AutoComplete) && this._sName) {
+ this._populateList(sQuery, oResponse, oPayload);
+ }
+};
+
+/**
+ * Overridable method called before container is loaded with result data.
+ *
+ * @method doBeforeLoadData
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ * @return {Boolean} Return true to continue loading data, false to cancel.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeLoadData = function(sQuery, oResponse, oPayload) {
+ return true;
+};
+
+/**
+ * Overridable method that returns HTML markup for one result to be populated
+ * as innerHTML of an <LI> element.
+ *
+ * @method formatResult
+ * @param oResultData {Object} Result data object.
+ * @param sQuery {String} The corresponding query string.
+ * @param sResultMatch {HTMLElement} The current query string.
+ * @return {String} HTML markup of formatted result data.
+ */
+YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultData, sQuery, sResultMatch) {
+ var sMarkup = (sResultMatch) ? sResultMatch : "";
+ return sMarkup;
+};
+
+/**
+ * Overridable method called before container expands allows implementers to access data
+ * and DOM elements.
+ *
+ * @method doBeforeExpandContainer
+ * @param elTextbox {HTMLElement} The text input box.
+ * @param elContainer {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(elTextbox, elContainer, sQuery, aResults) {
+ return true;
+};
+
+
+/**
+ * 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 myAutoComplete = null. Use with caution!
+ *
+ * @method destroy
+ */
+YAHOO.widget.AutoComplete.prototype.destroy = function() {
+ var instanceName = this.toString();
+ var elInput = this._elTextbox;
+ var elContainer = this._elContainer;
+
+ // Unhook custom events
+ this.textboxFocusEvent.unsubscribeAll();
+ this.textboxKeyEvent.unsubscribeAll();
+ this.dataRequestEvent.unsubscribeAll();
+ this.dataReturnEvent.unsubscribeAll();
+ this.dataErrorEvent.unsubscribeAll();
+ this.containerPopulateEvent.unsubscribeAll();
+ this.containerExpandEvent.unsubscribeAll();
+ this.typeAheadEvent.unsubscribeAll();
+ this.itemMouseOverEvent.unsubscribeAll();
+ this.itemMouseOutEvent.unsubscribeAll();
+ this.itemArrowToEvent.unsubscribeAll();
+ this.itemArrowFromEvent.unsubscribeAll();
+ this.itemSelectEvent.unsubscribeAll();
+ this.unmatchedItemSelectEvent.unsubscribeAll();
+ this.selectionEnforceEvent.unsubscribeAll();
+ this.containerCollapseEvent.unsubscribeAll();
+ this.textboxBlurEvent.unsubscribeAll();
+ this.textboxChangeEvent.unsubscribeAll();
+
+ // 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 request to the DataSource.
+ *
+ * @event dataRequestEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @param sQuery {String} The query string.
+ * @param oRequest {Object} The request.
+ */
+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.
+ * @param oResponse {Object} The response object, if available.
+ */
+YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null;
+
+/**
+ * Fired when the results container is populated.
+ *
+ * @event containerPopulateEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.containerPopulateEvent = 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 <li> 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 <li> 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 <li> 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 <li> 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 <li> 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.
+ * @param sSelection {String} The selected string.
+ */
+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.
+ * @param sClearedValue {String} The cleared value (including delimiters if applicable).
+ */
+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;
+
+/**
+ * Fired when the input field value has changed when it loses focus.
+ *
+ * @event textboxChangeEvent
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ */
+YAHOO.widget.AutoComplete.prototype.textboxChangeEvent = 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 _elTextbox
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elTextbox = null;
+
+/**
+ * Container DOM element.
+ *
+ * @property _elContainer
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elContainer = null;
+
+/**
+ * Reference to content element within container element.
+ *
+ * @property _elContent
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elContent = null;
+
+/**
+ * Reference to header element within content element.
+ *
+ * @property _elHeader
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elHeader = null;
+
+/**
+ * Reference to body element within content element.
+ *
+ * @property _elBody
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elBody = null;
+
+/**
+ * Reference to footer element within content element.
+ *
+ * @property _elFooter
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elFooter = null;
+
+/**
+ * Reference to shadow element within container element.
+ *
+ * @property _elShadow
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elShadow = null;
+
+/**
+ * Reference to iframe element within container element.
+ *
+ * @property _elIFrame
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elIFrame = null;
+
+/**
+ * Whether or not the widget instance is currently active. 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 = false;
+
+/**
+ * Animation instance for container expand/collapse.
+ *
+ * @property _oAnim
+ * @type Boolean
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._oAnim = 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;
+
+/**
+ * Internal reference to <ul> elements that contains query results within the
+ * results container.
+ *
+ * @property _elList
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elList = null;
+
+/*
+ * Array of <li> elements references that contain query results within the
+ * results container.
+ *
+ * @property _aListItemEls
+ * @type HTMLElement[]
+ * @private
+ */
+//YAHOO.widget.AutoComplete.prototype._aListItemEls = null;
+
+/**
+ * Number of <li> elements currently displayed in results container.
+ *
+ * @property _nDisplayedItems
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0;
+
+/*
+ * Internal count of <li> 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;
+
+/**
+ * Selections from previous queries (for saving delimited queries).
+ *
+ * @property _sPastSelections
+ * @type String
+ * @default ""
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sPastSelections = "";
+
+/**
+ * Stores initial input value used to determine if textboxChangeEvent should be fired.
+ *
+ * @property _sInitInputValue
+ * @type String
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._sInitInputValue = null;
+
+/**
+ * Pointer to the currently highlighted <li> element in the container.
+ *
+ * @property _elCurListItem
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elCurListItem = null;
+
+/**
+ * Pointer to the currently pre-highlighted <li> element in the container.
+ *
+ * @property _elCurPrehighlightItem
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._elCurPrehighlightItem = 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;
+
+/**
+ * TypeAhead delay timeout ID.
+ *
+ * @property _nTypeAheadDelayID
+ * @type Number
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID = -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 typeAheadDelay = this.typeAheadDelay;
+ if(!YAHOO.lang.isNumber(typeAheadDelay) || (typeAheadDelay < 0)) {
+ this.typeAheadDelay = 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._elContent, {}, 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 _initContainerHelperEls
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initContainerHelperEls = function() {
+ if(this.useShadow && !this._elShadow) {
+ var elShadow = document.createElement("div");
+ elShadow.className = "yui-ac-shadow";
+ elShadow.style.width = 0;
+ elShadow.style.height = 0;
+ this._elShadow = this._elContainer.appendChild(elShadow);
+ }
+ if(this.useIFrame && !this._elIFrame) {
+ var elIFrame = document.createElement("iframe");
+ elIFrame.src = this._iFrameSrc;
+ elIFrame.frameBorder = 0;
+ elIFrame.scrolling = "no";
+ elIFrame.style.position = "absolute";
+ elIFrame.style.width = 0;
+ elIFrame.style.height = 0;
+ elIFrame.style.padding = 0;
+ elIFrame.tabIndex = -1;
+ elIFrame.role = "presentation";
+ elIFrame.title = "Presentational iframe shim";
+ this._elIFrame = this._elContainer.appendChild(elIFrame);
+ }
+};
+
+/**
+ * Initializes the results container once at object creation
+ *
+ * @method _initContainerEl
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initContainerEl = function() {
+ YAHOO.util.Dom.addClass(this._elContainer, "yui-ac-container");
+
+ if(!this._elContent) {
+ // The elContent div is assigned DOM listeners and
+ // helps size the iframe and shadow properly
+ var elContent = document.createElement("div");
+ elContent.className = "yui-ac-content";
+ elContent.style.display = "none";
+
+ this._elContent = this._elContainer.appendChild(elContent);
+
+ var elHeader = document.createElement("div");
+ elHeader.className = "yui-ac-hd";
+ elHeader.style.display = "none";
+ this._elHeader = this._elContent.appendChild(elHeader);
+
+ var elBody = document.createElement("div");
+ elBody.className = "yui-ac-bd";
+ this._elBody = this._elContent.appendChild(elBody);
+
+ var elFooter = document.createElement("div");
+ elFooter.className = "yui-ac-ft";
+ elFooter.style.display = "none";
+ this._elFooter = this._elContent.appendChild(elFooter);
+ }
+ else {
+ }
+};
+
+/**
+ * Clears out contents of container body and creates up to
+ * YAHOO.widget.AutoComplete#maxResultsDisplayed <li> elements in an
+ * <ul> element.
+ *
+ * @method _initListEl
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._initListEl = function() {
+ var nListLength = this.maxResultsDisplayed,
+ elList = this._elList || document.createElement("ul"),
+ elListItem;
+
+ while(elList.childNodes.length < nListLength) {
+ elListItem = document.createElement("li");
+ elListItem.style.display = "none";
+ elListItem._nItemIndex = elList.childNodes.length;
+ elList.appendChild(elListItem);
+ }
+ if(!this._elList) {
+ var elBody = this._elBody;
+ YAHOO.util.Event.purgeElement(elBody, true);
+ elBody.innerHTML = "";
+ this._elList = elBody.appendChild(elList);
+ }
+
+ this._elBody.style.display = "";
+};
+
+/**
+ * Focuses input field.
+ *
+ * @method _focus
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._focus = function() {
+ // http://developer.mozilla.org/en/docs/index.php?title=Key-navigable_custom_DHTML_widgets
+ var oSelf = this;
+ setTimeout(function() {
+ try {
+ oSelf._elTextbox.focus();
+ }
+ catch(e) {
+ }
+ },0);
+};
+
+/**
+ * Enables interval detection for IME support.
+ *
+ * @method _enableIntervalDetection
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._enableIntervalDetection = function() {
+ var oSelf = this;
+ if(!oSelf._queryInterval && oSelf.queryInterval) {
+ oSelf._queryInterval = setInterval(function() { oSelf._onInterval(); }, oSelf.queryInterval);
+ }
+};
+
+/**
+ * Enables interval detection for a less performant but brute force mechanism to
+ * detect input values at an interval set by queryInterval and send queries if
+ * input value has changed. Needed to support right-click+paste or shift+insert
+ * edge cases. Please note that intervals are cleared at the end of each interaction,
+ * so enableIntervalDetection must be called for each new interaction. The
+ * recommended approach is to call it in response to textboxFocusEvent.
+ *
+ * @method enableIntervalDetection
+ */
+YAHOO.widget.AutoComplete.prototype.enableIntervalDetection =
+ YAHOO.widget.AutoComplete.prototype._enableIntervalDetection;
+
+/**
+ * Enables query triggers based on text input detection by intervals (rather
+ * than by key events).
+ *
+ * @method _onInterval
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onInterval = function() {
+ var currValue = this._elTextbox.value;
+ var lastValue = this._sLastTextboxValue;
+ if(currValue != lastValue) {
+ this._sLastTextboxValue = currValue;
+ this._sendQuery(currValue);
+ }
+};
+
+/**
+ * Cancels text input detection by intervals.
+ *
+ * @method _clearInterval
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._clearInterval = function() {
+ if(this._queryInterval) {
+ clearInterval(this._queryInterval);
+ this._queryInterval = null;
+ }
+};
+
+/**
+ * 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
+ (nKeyCode == 229) // Bug 2041973: Korean XP fires 2 keyup events, the key and 229
+ ) {
+ 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 < 0) {
+ this._toggleContainer(false);
+ return;
+ }
+ // Delimiter has been enabled
+ if(this.delimChar) {
+ var extraction = this._extractQuery(sQuery);
+ // Here is the query itself
+ sQuery = extraction.query;
+ // ...and save the rest of the string for later
+ this._sPastSelections = extraction.previous;
+ }
+
+ // 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 is being made
+
+ // Subset matching
+ if(this.dataSource.queryMatchSubset || this.queryMatchSubset) { // backward compat
+ var oResponse = this.getSubsetMatches(sQuery);
+ if(oResponse) {
+ this.handleResponse(sQuery, oResponse, {query: sQuery});
+ return;
+ }
+ }
+
+ if(this.dataSource.responseStripAfter) {
+ this.dataSource.doBeforeParseData = this.preparseRawResponse;
+ }
+ if(this.applyLocalFilter) {
+ this.dataSource.doBeforeCallback = this.filterResults;
+ }
+
+ var sRequest = this.generateRequest(sQuery);
+ this.dataRequestEvent.fire(this, sQuery, sRequest);
+
+ this.dataSource.sendRequest(sRequest, {
+ success : this.handleResponse,
+ failure : this.handleResponse,
+ scope : this,
+ argument: {
+ query: sQuery
+ }
+ });
+};
+
+/**
+ * Populates the given <li> element with return value from formatResult().
+ *
+ * @method _populateListItem
+ * @param elListItem {HTMLElement} The LI element.
+ * @param oResult {Object} The result object.
+ * @param sCurQuery {String} The query string.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._populateListItem = function(elListItem, oResult, sQuery) {
+ elListItem.innerHTML = this.formatResult(oResult, sQuery, elListItem._sResultMatch);
+};
+
+/**
+ * Populates the array of <li> elements in the container with query
+ * results.
+ *
+ * @method _populateList
+ * @param sQuery {String} Original request.
+ * @param oResponse {Object} Response object.
+ * @param oPayload {MIXED} (optional) Additional argument(s)
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, oResponse, oPayload) {
+ // Clear previous timeout
+ if(this._nTypeAheadDelayID != -1) {
+ clearTimeout(this._nTypeAheadDelayID);
+ }
+
+ sQuery = (oPayload && oPayload.query) ? oPayload.query : sQuery;
+
+ // Pass data through abstract method for any transformations
+ var ok = this.doBeforeLoadData(sQuery, oResponse, oPayload);
+
+ // Data is ok
+ if(ok && !oResponse.error) {
+ this.dataReturnEvent.fire(this, sQuery, oResponse.results);
+
+ // Continue only if instance is still active (i.e., user hasn't already moved on)
+ if(this._bFocused) {
+ // Store state for this interaction
+ var sCurQuery = decodeURIComponent(sQuery);
+ this._sCurQuery = sCurQuery;
+ this._bItemSelected = false;
+
+ var allResults = oResponse.results,
+ nItemsToShow = Math.min(allResults.length,this.maxResultsDisplayed),
+ sMatchKey = (this.dataSource.responseSchema.fields) ?
+ (this.dataSource.responseSchema.fields[0].key || this.dataSource.responseSchema.fields[0]) : 0;
+
+ if(nItemsToShow > 0) {
+ // Make sure container and helpers are ready to go
+ if(!this._elList || (this._elList.childNodes.length < nItemsToShow)) {
+ this._initListEl();
+ }
+ this._initContainerHelperEls();
+
+ var allListItemEls = this._elList.childNodes;
+ // Fill items with data from the bottom up
+ for(var i = nItemsToShow-1; i >= 0; i--) {
+ var elListItem = allListItemEls[i],
+ oResult = allResults[i];
+
+ // Backward compatibility
+ if(this.resultTypeList) {
+ // Results need to be converted back to an array
+ var aResult = [];
+ // Match key is first
+ aResult[0] = (YAHOO.lang.isString(oResult)) ? oResult : oResult[sMatchKey] || oResult[this.key];
+ // Add additional data to the result array
+ var fields = this.dataSource.responseSchema.fields;
+ if(YAHOO.lang.isArray(fields) && (fields.length > 1)) {
+ for(var k=1, len=fields.length; k= nItemsToShow; j--) {
+ extraListItem = allListItemEls[j];
+ extraListItem.style.display = "none";
+ }
+ }
+
+ this._nDisplayedItems = nItemsToShow;
+
+ this.containerPopulateEvent.fire(this, sQuery, allResults);
+
+ // Highlight the first item
+ if(this.autoHighlight) {
+ var elFirstListItem = this._elList.firstChild;
+ this._toggleHighlight(elFirstListItem,"to");
+ this.itemArrowToEvent.fire(this, elFirstListItem);
+ this._typeAhead(elFirstListItem,sQuery);
+ }
+ // Unhighlight any previous time
+ else {
+ this._toggleHighlight(this._elCurListItem,"from");
+ }
+
+ // Pre-expansion stuff
+ ok = this._doBeforeExpandContainer(this._elTextbox, this._elContainer, sQuery, allResults);
+
+ // Expand the container
+ this._toggleContainer(ok);
+ }
+ else {
+ this._toggleContainer(false);
+ }
+
+ return;
+ }
+ }
+ // Error
+ else {
+ this.dataErrorEvent.fire(this, sQuery, oResponse);
+ }
+
+};
+
+/**
+ * Called before container expands, by default snaps container to the
+ * bottom-left corner of the input element, then calls public overrideable method.
+ *
+ * @method _doBeforeExpandContainer
+ * @param elTextbox {HTMLElement} The text input box.
+ * @param elContainer {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.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._doBeforeExpandContainer = function(elTextbox, elContainer, sQuery, aResults) {
+ if(this.autoSnapContainer) {
+ this.snapContainer();
+ }
+
+ return this.doBeforeExpandContainer(elTextbox, elContainer, 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 extraction = (this.delimChar) ? this._extractQuery(this._elTextbox.value) :
+ {previous:"",query:this._elTextbox.value};
+ this._elTextbox.value = extraction.previous;
+ this.selectionEnforceEvent.fire(this, extraction.query);
+};
+
+/**
+ * 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 elMatch = null;
+
+ for(var i=0; i= 0; i--) {
+ 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 in the query so extract the latest query from past selections
+ if(nDelimIndex > -1) {
+ 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
+ sPrevious = sQuery.substring(0,nQueryStart);
+ // Here is the query itself
+ sQuery = sQuery.substr(nQueryStart);
+ }
+ // No delimiter found in the query, so there are no selections from past queries
+ else {
+ sPrevious = "";
+ }
+
+ return {
+ previous: sPrevious,
+ query: sQuery
+ };
+};
+
+/**
+ * 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 width = this._elContent.offsetWidth + "px";
+ var height = this._elContent.offsetHeight + "px";
+
+ if(this.useIFrame && this._elIFrame) {
+ var elIFrame = this._elIFrame;
+ if(bShow) {
+ elIFrame.style.width = width;
+ elIFrame.style.height = height;
+ elIFrame.style.padding = "";
+ }
+ else {
+ elIFrame.style.width = 0;
+ elIFrame.style.height = 0;
+ elIFrame.style.padding = 0;
+ }
+ }
+ if(this.useShadow && this._elShadow) {
+ var elShadow = this._elShadow;
+ if(bShow) {
+ elShadow.style.width = width;
+ elShadow.style.height = height;
+ }
+ else {
+ elShadow.style.width = 0;
+ elShadow.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 elContainer = this._elContainer;
+
+ // If implementer has container always open and it's already open, don't mess with it
+ // Container is initialized with display "none" so it may need to be shown first time through
+ if(this.alwaysShowContainer && this._bContainerOpen) {
+ return;
+ }
+
+ // Reset states
+ if(!bShow) {
+ this._toggleHighlight(this._elCurListItem,"from");
+ this._nDisplayedItems = 0;
+ this._sCurQuery = null;
+
+ // Container is already closed, so don't bother with changing the UI
+ if(this._elContent.style.display == "none") {
+ return;
+ }
+ }
+
+ // If animation is enabled...
+ var oAnim = this._oAnim;
+ if(oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) {
+ if(oAnim.isAnimated()) {
+ oAnim.stop(true);
+ }
+
+ // Clone container to grab current size offscreen
+ var oClone = this._elContent.cloneNode(true);
+ elContainer.appendChild(oClone);
+ oClone.style.top = "-9000px";
+ oClone.style.width = "";
+ oClone.style.height = "";
+ oClone.style.display = "";
+
+ // 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) {
+ this._elContent.style.width = wColl+"px";
+ this._elContent.style.height = hColl+"px";
+ }
+ // Else, set it to its last known size.
+ else {
+ this._elContent.style.width = wExp+"px";
+ this._elContent.style.height = hExp+"px";
+ }
+
+ elContainer.removeChild(oClone);
+ oClone = null;
+
+ var oSelf = this;
+ var onAnimComplete = function() {
+ // Finish the collapse
+ oAnim.onComplete.unsubscribeAll();
+
+ if(bShow) {
+ oSelf._toggleContainerHelpers(true);
+ oSelf._bContainerOpen = bShow;
+ oSelf.containerExpandEvent.fire(oSelf);
+ }
+ else {
+ oSelf._elContent.style.display = "none";
+ oSelf._bContainerOpen = bShow;
+ oSelf.containerCollapseEvent.fire(oSelf);
+ }
+ };
+
+ // Display container and animate it
+ this._toggleContainerHelpers(false); // Bug 1424486: Be early to hide, late to show;
+ this._elContent.style.display = "";
+ oAnim.onComplete.subscribe(onAnimComplete);
+ oAnim.animate();
+ }
+ // Else don't animate, just show or hide
+ else {
+ if(bShow) {
+ this._elContent.style.display = "";
+ this._toggleContainerHelpers(true);
+ this._bContainerOpen = bShow;
+ this.containerExpandEvent.fire(this);
+ }
+ else {
+ this._toggleContainerHelpers(false);
+ this._elContent.style.display = "none";
+ this._bContainerOpen = bShow;
+ this.containerCollapseEvent.fire(this);
+ }
+ }
+
+};
+
+/**
+ * Toggles the highlight on or off for an item in the container, and also cleans
+ * up highlighting of any previous item.
+ *
+ * @method _toggleHighlight
+ * @param elNewListItem {HTMLElement} The <li> 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(elNewListItem, sType) {
+ if(elNewListItem) {
+ var sHighlight = this.highlightClassName;
+ if(this._elCurListItem) {
+ // Remove highlight from old item
+ YAHOO.util.Dom.removeClass(this._elCurListItem, sHighlight);
+ this._elCurListItem = null;
+ }
+
+ if((sType == "to") && sHighlight) {
+ // Apply highlight to new item
+ YAHOO.util.Dom.addClass(elNewListItem, sHighlight);
+ this._elCurListItem = elNewListItem;
+ }
+ }
+};
+
+/**
+ * Toggles the pre-highlight on or off for an item in the container, and also cleans
+ * up pre-highlighting of any previous item.
+ *
+ * @method _togglePrehighlight
+ * @param elNewListItem {HTMLElement} The <li> 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(elNewListItem, sType) {
+ var sPrehighlight = this.prehighlightClassName;
+
+ if(this._elCurPrehighlightItem) {
+ YAHOO.util.Dom.removeClass(this._elCurPrehighlightItem, sPrehighlight);
+ }
+ if(elNewListItem == this._elCurListItem) {
+ return;
+ }
+
+ if((sType == "mouseover") && sPrehighlight) {
+ // Apply prehighlight to new item
+ YAHOO.util.Dom.addClass(elNewListItem, sPrehighlight);
+ this._elCurPrehighlightItem = elNewListItem;
+ }
+ else {
+ // Remove prehighlight from old item
+ YAHOO.util.Dom.removeClass(elNewListItem, 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 elListItem {HTMLElement} The <li> element item with which to update the value.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._updateValue = function(elListItem) {
+ if(!this.suppressInputUpdate) {
+ var elTextbox = this._elTextbox;
+ var sDelimChar = (this.delimChar) ? (this.delimChar[0] || this.delimChar) : null;
+ var sResultMatch = elListItem._sResultMatch;
+
+ // Calculate the new value
+ var sNewValue = "";
+ if(sDelimChar) {
+ // Preserve selections from past queries
+ sNewValue = this._sPastSelections;
+ // Add new selection plus delimiter
+ sNewValue += sResultMatch + sDelimChar;
+ if(sDelimChar != " ") {
+ sNewValue += " ";
+ }
+ }
+ else {
+ sNewValue = sResultMatch;
+ }
+
+ // Update input field
+ elTextbox.value = sNewValue;
+
+ // Scroll to bottom of textarea if necessary
+ if(elTextbox.type == "textarea") {
+ elTextbox.scrollTop = elTextbox.scrollHeight;
+ }
+
+ // Move cursor to end
+ var end = elTextbox.value.length;
+ this._selectText(elTextbox,end,end);
+
+ this._elCurListItem = elListItem;
+ }
+};
+
+/**
+ * Selects a result item from the container
+ *
+ * @method _selectItem
+ * @param elListItem {HTMLElement} The selected <li> element item.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._selectItem = function(elListItem) {
+ this._bItemSelected = true;
+ this._updateValue(elListItem);
+ this._sPastSelections = this._elTextbox.value;
+ this._clearInterval();
+ this.itemSelectEvent.fire(this, elListItem, elListItem._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._elCurListItem) {
+ this._selectItem(this._elCurListItem);
+ }
+ else {
+ this._toggleContainer(false);
+ }
+};
+
+/**
+ * Triggered by up and down arrow keys, changes the current highlighted
+ * <li> 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 elCurListItem = this._elCurListItem,
+ nCurItemIndex = -1;
+
+ if(elCurListItem) {
+ nCurItemIndex = elCurListItem._nItemIndex;
+ }
+
+ var nNewItemIndex = (nKeyCode == 40) ?
+ (nCurItemIndex + 1) : (nCurItemIndex - 1);
+
+ // Out of bounds
+ if(nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) {
+ return;
+ }
+
+ if(elCurListItem) {
+ // Unhighlight current item
+ this._toggleHighlight(elCurListItem, "from");
+ this.itemArrowFromEvent.fire(this, elCurListItem);
+ }
+ if(nNewItemIndex == -1) {
+ // Go back to query (remove type-ahead string)
+ if(this.delimChar) {
+ this._elTextbox.value = this._sPastSelections + this._sCurQuery;
+ }
+ else {
+ this._elTextbox.value = this._sCurQuery;
+ }
+ return;
+ }
+ if(nNewItemIndex == -2) {
+ // Close container
+ this._toggleContainer(false);
+ return;
+ }
+
+ var elNewListItem = this._elList.childNodes[nNewItemIndex],
+
+ // Scroll the container if necessary
+ elContent = this._elContent,
+ sOF = YAHOO.util.Dom.getStyle(elContent,"overflow"),
+ sOFY = YAHOO.util.Dom.getStyle(elContent,"overflowY"),
+ scrollOn = ((sOF == "auto") || (sOF == "scroll") || (sOFY == "auto") || (sOFY == "scroll"));
+ if(scrollOn && (nNewItemIndex > -1) &&
+ (nNewItemIndex < this._nDisplayedItems)) {
+ // User is keying down
+ if(nKeyCode == 40) {
+ // Bottom of selected item is below scroll area...
+ if((elNewListItem.offsetTop+elNewListItem.offsetHeight) > (elContent.scrollTop + elContent.offsetHeight)) {
+ // Set bottom of scroll area to bottom of selected item
+ elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight;
+ }
+ // Bottom of selected item is above scroll area...
+ else if((elNewListItem.offsetTop+elNewListItem.offsetHeight) < elContent.scrollTop) {
+ // Set top of selected item to top of scroll area
+ elContent.scrollTop = elNewListItem.offsetTop;
+
+ }
+ }
+ // User is keying up
+ else {
+ // Top of selected item is above scroll area
+ if(elNewListItem.offsetTop < elContent.scrollTop) {
+ // Set top of scroll area to top of selected item
+ this._elContent.scrollTop = elNewListItem.offsetTop;
+ }
+ // Top of selected item is below scroll area
+ else if(elNewListItem.offsetTop > (elContent.scrollTop + elContent.offsetHeight)) {
+ // Set bottom of selected item to bottom of scroll area
+ this._elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight;
+ }
+ }
+ }
+
+ this._toggleHighlight(elNewListItem, "to");
+ this.itemArrowToEvent.fire(this, elNewListItem);
+ if(this.typeAhead) {
+ this._updateValue(elNewListItem);
+ }
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Private event handlers
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * 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) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ if(oSelf.prehighlightClassName) {
+ oSelf._togglePrehighlight(elTarget,"mouseover");
+ }
+ else {
+ oSelf._toggleHighlight(elTarget,"to");
+ }
+
+ oSelf.itemMouseOverEvent.fire(oSelf, elTarget);
+ break;
+ case "div":
+ if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) {
+ oSelf._bOverContainer = true;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+/**
+ * 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) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ if(oSelf.prehighlightClassName) {
+ oSelf._togglePrehighlight(elTarget,"mouseout");
+ }
+ else {
+ oSelf._toggleHighlight(elTarget,"from");
+ }
+
+ oSelf.itemMouseOutEvent.fire(oSelf, elTarget);
+ break;
+ case "ul":
+ oSelf._toggleHighlight(oSelf._elCurListItem,"to");
+ break;
+ case "div":
+ if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) {
+ oSelf._bOverContainer = false;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+/**
+ * Handles container click events.
+ *
+ * @method _onContainerClick
+ * @param v {HTMLEvent} The click event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onContainerClick = function(v,oSelf) {
+ var elTarget = YAHOO.util.Event.getTarget(v);
+ var elTag = elTarget.nodeName.toLowerCase();
+ while(elTarget && (elTag != "table")) {
+ switch(elTag) {
+ case "body":
+ return;
+ case "li":
+ // In case item has not been moused over
+ oSelf._toggleHighlight(elTarget,"to");
+ oSelf._selectItem(elTarget);
+ return;
+ default:
+ break;
+ }
+
+ elTarget = elTarget.parentNode;
+ if(elTarget) {
+ elTag = elTarget.nodeName.toLowerCase();
+ }
+ }
+};
+
+
+/**
+ * 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._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;
+
+ // Clear timeout
+ if(oSelf._nTypeAheadDelayID != -1) {
+ clearTimeout(oSelf._nTypeAheadDelayID);
+ }
+
+ switch (nKeyCode) {
+ case 9: // tab
+ if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) {
+ // select an item or clear out
+ if(oSelf._elCurListItem) {
+ if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) {
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ }
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 13: // enter
+ if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) {
+ if(oSelf._elCurListItem) {
+ if(oSelf._nKeyCode != nKeyCode) {
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ }
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 27: // esc
+ oSelf._toggleContainer(false);
+ return;
+ case 39: // right
+ oSelf._jumpSelection();
+ break;
+ case 38: // up
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ oSelf._moveSelection(nKeyCode);
+ }
+ break;
+ case 40: // down
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ oSelf._moveSelection(nKeyCode);
+ }
+ break;
+ default:
+ oSelf._bItemSelected = false;
+ oSelf._toggleHighlight(oSelf._elCurListItem, "from");
+
+ oSelf.textboxKeyEvent.fire(oSelf, nKeyCode);
+ break;
+ }
+
+ if(nKeyCode === 18){
+ oSelf._enableIntervalDetection();
+ }
+ oSelf._nKeyCode = nKeyCode;
+};
+
+/**
+ * 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 non SF3 (bug 1978549) Mac browsers (bug 790337) and Opera browsers (bug 583531),
+ // where stopEvent is ineffective on keydown events
+ if(YAHOO.env.ua.opera || (navigator.userAgent.toLowerCase().indexOf("mac") != -1) && (YAHOO.env.ua.webkit < 420)) {
+ switch (nKeyCode) {
+ case 9: // tab
+ // select an item or clear out
+ if(oSelf._bContainerOpen) {
+ if(oSelf.delimChar) {
+ YAHOO.util.Event.stopEvent(v);
+ }
+ if(oSelf._elCurListItem) {
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ break;
+ case 13: // enter
+ if(oSelf._bContainerOpen) {
+ YAHOO.util.Event.stopEvent(v);
+ if(oSelf._elCurListItem) {
+ oSelf._selectItem(oSelf._elCurListItem);
+ }
+ else {
+ oSelf._toggleContainer(false);
+ }
+ }
+ 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._enableIntervalDetection();
+ }
+};
+
+/**
+ * Handles textbox keyup events to 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) {
+ var sText = this.value; //string in textbox
+
+ // Check to see if any of the public properties have been updated
+ oSelf._initProps();
+
+ // Filter out chars that don't trigger queries
+ var nKeyCode = v.keyCode;
+ if(oSelf._isIgnoreKey(nKeyCode)) {
+ return;
+ }
+
+ // Clear previous timeout
+ if(oSelf._nDelayID != -1) {
+ clearTimeout(oSelf._nDelayID);
+ }
+
+ // Set new timeout
+ oSelf._nDelayID = setTimeout(function(){
+ oSelf._sendQuery(sText);
+ },(oSelf.queryDelay * 1000));
+};
+
+/**
+ * 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) {
+ // Start of a new interaction
+ if(!oSelf._bFocused) {
+ oSelf._elTextbox.setAttribute("autocomplete","off");
+ oSelf._bFocused = true;
+ oSelf._sInitInputValue = oSelf._elTextbox.value;
+ 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) {
+ // Is a true blur
+ if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) {
+ // Current query needs to be validated as a selection
+ if(!oSelf._bItemSelected) {
+ var elMatchListItem = oSelf._textMatchesOption();
+ // Container is closed or current query doesn't match any result
+ if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && (elMatchListItem === 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, oSelf._sCurQuery);
+ }
+ }
+ // 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(elMatchListItem);
+ }
+ }
+ }
+
+ oSelf._clearInterval();
+ oSelf._bFocused = false;
+ if(oSelf._sInitInputValue !== oSelf._elTextbox.value) {
+ oSelf.textboxChangeEvent.fire(oSelf);
+ }
+ oSelf.textboxBlurEvent.fire(oSelf);
+
+ oSelf._toggleContainer(false);
+ }
+ // Not a true blur if it was a selection via mouse click
+ else {
+ oSelf._focus();
+ }
+};
+
+/**
+ * Handles window unload event.
+ *
+ * @method _onWindowUnload
+ * @param v {HTMLEvent} The unload event.
+ * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance.
+ * @private
+ */
+YAHOO.widget.AutoComplete.prototype._onWindowUnload = function(v,oSelf) {
+ if(oSelf && oSelf._elTextbox && oSelf.allowBrowserAutocomplete) {
+ oSelf._elTextbox.setAttribute("autocomplete","on");
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Deprecated for Backwards Compatibility
+//
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @method doBeforeSendQuery
+ * @deprecated Use generateRequest.
+ */
+YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery = function(sQuery) {
+ return this.generateRequest(sQuery);
+};
+
+/**
+ * @method getListItems
+ * @deprecated Use getListEl().childNodes.
+ */
+YAHOO.widget.AutoComplete.prototype.getListItems = function() {
+ var allListItemEls = [],
+ els = this._elList.childNodes;
+ for(var i=els.length-1; i>=0; i--) {
+ allListItemEls[i] = els[i];
+ }
+ return allListItemEls;
+};
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Private static methods
+//
+/////////////////////////////////////////////////////////////////////////
+
+/**
+ * Clones object literal or array of object literals.
+ *
+ * @method AutoComplete._cloneObject
+ * @param o {Object} Object.
+ * @private
+ * @static
+ */
+YAHOO.widget.AutoComplete._cloneObject = function(o) {
+ if(!YAHOO.lang.isValue(o)) {
+ return o;
+ }
+
+ var copy = {};
+
+ if(YAHOO.lang.isFunction(o)) {
+ copy = o;
+ }
+ else if(YAHOO.lang.isArray(o)) {
+ var array = [];
+ for(var i=0,len=o.length;iThe Button Control enables the creation of rich, graphical
+* buttons that function like traditional HTML form buttons. Unlike
+* traditional 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
+* Menu Control , 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.
+* The Button Control supports the following types:
+*
+* push
+* Basic push button that can execute a user-specified command when
+* pressed.
+* link
+* Navigates to a specified url when pressed.
+* submit
+* Submits the parent form when pressed.
+* reset
+* Resets the parent form when pressed.
+* checkbox
+* Maintains a "checked" state that can be toggled on and off.
+* radio
+* 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.
+* menu
+* When pressed will show/hide a menu.
+* split
+* Can execute a user-specified command or display a menu when pressed.
+*
+* @title Button
+* @namespace YAHOO.widget
+* @requires yahoo, dom, element, event
+* @optional container, menu
+*/
+
+
+(function () {
+
+
+ /**
+ * The Button class creates a rich, graphical button.
+ * @param {String} p_oElement String specifying the id attribute of the
+ * <input>
, <button>
,
+ * <a>
, or <span>
element to
+ * be used to create the button.
+ * @param {HTMLInputElement |
+ * HTMLButtonElement |HTMLElement } p_oElement Object reference for the
+ * <input>
, <button>
,
+ * <a>
, or <span>
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,
+ UA = YAHOO.env.ua,
+ 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 <input>
element of the
+ * specified type.
+ * @private
+ * @param {String} p_sType String specifying the type of
+ * <input>
element to create.
+ * @param {String} p_sName String specifying the name of
+ * <input>
element to create.
+ * @param {String} p_sValue String specifying the value of
+ * <input>
element to create.
+ * @param {String} p_bChecked Boolean specifying if the
+ * <input>
element is to be checked.
+ * @return {HTMLInputElement }
+ */
+ function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) {
+
+ var oInput,
+ sInput;
+
+ if (Lang.isString(p_sType) && Lang.isString(p_sName)) {
+
+ if (UA.ie) {
+
+ /*
+ For IE it is necessary to create the element with the
+ "type," "name," "value," and "checked" properties set all
+ at once.
+ */
+
+ 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 <input>
or <a>
) that
+ * map to Button configuration attributes and sets them into a collection
+ * that is passed to the Button constructor.
+ * @private
+ * @param {HTMLInputElement |HTMLAnchorElement } p_oElement Object reference to the HTML
+ * element (either <input>
or <span>
+ *
) 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(),
+ sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME),
+ 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 <button>
for the value attribute
+ rather than the value of the "value" attribute.
+ */
+
+ oAttribute = p_oElement.getAttributeNode(p_sAttribute);
+
+
+ if (oAttribute && ("value" in oAttribute)) {
+
+ YAHOO.log("Setting attribute \"" + p_sAttribute +
+ "\" using source element's attribute value of \"" +
+ oAttribute.value + "\"", "info", me.toString());
+
+ 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, sClass + "-checked")) {
+
+ p_oAttributes.checked = true;
+
+ }
+
+ if (Dom.hasClass(oRootNode, sClass + "-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) {
+
+ if (!Overlay && YAHOO.widget.Overlay) {
+
+ Overlay = YAHOO.widget.Overlay;
+
+ }
+
+
+ if (!Menu && YAHOO.widget.Menu) {
+
+ Menu = YAHOO.widget.Menu;
+
+ }
+
+
+ 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();
+
+ YAHOO.log("No value specified for the button's \"id\" " +
+ "attribute. Setting button id to \"" + p_oElement.id +
+ "\".", "info", this.toString());
+
+ }
+
+ YAHOO.log("No source HTML element. Building the button " +
+ "using the set of configuration attributes.", "info", this.toString());
+
+ 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;
+
+ }
+
+ YAHOO.log("Building the button using an existing " +
+ "HTML element as a source element.", "info", this.toString());
+
+
+ oConfig.attributes.srcelement = oElement;
+
+ initConfig.call(this, oConfig);
+
+
+ if (!oConfig.element) {
+
+ YAHOO.log("Source element could not be used " +
+ "as is. Creating a new HTML element for " +
+ "the button.", "info", this.toString());
+
+ 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();
+
+ YAHOO.log("No value specified for the button's " +
+ "\"id\" attribute. Setting button id to \"" +
+ oConfig.attributes.id + "\".", "info", this.toString());
+
+ }
+
+ }
+
+ YAHOO.log("Building the button using an existing HTML " +
+ "element as a source element.", "info", this.toString());
+
+
+ oConfig.attributes.srcelement = p_oElement;
+
+ initConfig.call(this, oConfig);
+
+
+ if (!oConfig.element) {
+
+ YAHOO.log("Source element could not be used as is." +
+ " Creating a new HTML element for the button.",
+ "info", this.toString());
+
+ 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
+ * <a>
or <button>
element.
+ * @default null
+ * @protected
+ * @type HTMLAnchorElement |HTMLButtonElement
+ */
+ _button: null,
+
+
+ /**
+ * @property _menu
+ * @description Object reference to the button's menu.
+ * @default null
+ * @protected
+ * @type {YAHOO.widget.Overlay |
+ * YAHOO.widget.Menu }
+ */
+ _menu: null,
+
+
+ /**
+ * @property _hiddenFields
+ * @description Object reference to the <input>
+ * element, or array of HTML form elements used to represent the button
+ * when its parent form is submitted.
+ * @default null
+ * @protected
+ * @type HTMLInputElement |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,
+
+
+ /**
+ * @property _nOptionRegionX
+ * @description Number representing the X coordinate of the leftmost edge of the Button's
+ * option region. Applies only to Buttons of type "split".
+ * @default 0
+ * @protected
+ * @type Number
+ */
+ _nOptionRegionX: 0,
+
+
+
+ // Constants
+
+ /**
+ * @property CLASS_NAME_PREFIX
+ * @description Prefix used for all class names applied to a Button.
+ * @default "yui-"
+ * @final
+ * @type String
+ */
+ CLASS_NAME_PREFIX: "yui-",
+
+
+ /**
+ * @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 "button"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "button",
+
+
+
+ // 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,
+ nGeckoVersion = UA.gecko;
+
+
+ if (nGeckoVersion && nGeckoVersion < 1.9 && Dom.inDocument(this.get("element"))) {
+
+ sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+ this.removeClass(sClass);
+
+ Lang.later(0, this, this.addClass, sClass);
+
+ }
+
+ },
+
+
+ /**
+ * @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) {
+
+ if (this.get("type") != "link") {
+
+ this._button.title = p_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");
+
+ if (sType == "checkbox" || sType == "radio") {
+
+ if (p_bChecked) {
+ this.addStateCSSClasses("checked");
+ }
+ else {
+ this.removeStateCSSClasses("checked");
+ }
+
+ }
+
+ },
+
+
+ /**
+ * @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,
+
+ /*
+ Boolean indicating if the value of p_oMenu is an instance
+ of YAHOO.widget.Menu or YAHOO.widget.Overlay.
+ */
+
+ bInstance = false,
+ oMenu,
+ oMenuElement,
+ oSrcElement;
+
+
+ function onAppendTo() {
+
+ oMenu.render(oButtonElement.parentNode);
+
+ this.removeListener("appendTo", onAppendTo);
+
+ }
+
+
+ function setMenuContainer() {
+
+ oMenu.cfg.queueProperty("container", oButtonElement.parentNode);
+
+ this.removeListener("appendTo", setMenuContainer);
+
+ }
+
+
+ function initMenu() {
+
+ var oContainer;
+
+ if (oMenu) {
+
+ Dom.addClass(oMenu.element, this.get("menuclassname"));
+ Dom.addClass(oMenu.element, this.CLASS_NAME_PREFIX + 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 (Menu && oMenu instanceof Menu) {
+
+ if (bLazyLoad) {
+
+ oContainer = this.get("container");
+
+ if (oContainer) {
+
+ oMenu.cfg.queueProperty("container", oContainer);
+
+ }
+ else {
+
+ this.on("appendTo", setMenuContainer);
+
+ }
+
+ }
+
+ oMenu.cfg.queueProperty("clicktohide", false);
+
+ oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);
+ oMenu.subscribe("click", this._onMenuClick, this, true);
+
+ this.on("selectedMenuItemChange", this._onSelectedMenuItemChange);
+
+ oSrcElement = oMenu.srcElement;
+
+ if (oSrcElement && oSrcElement.nodeName.toUpperCase() == "SELECT") {
+
+ oSrcElement.style.display = "none";
+ oSrcElement.parentNode.removeChild(oSrcElement);
+
+ }
+
+ }
+ else if (Overlay && oMenu instanceof Overlay) {
+
+ if (!m_oOverlayManager) {
+
+ m_oOverlayManager = new YAHOO.widget.OverlayManager();
+
+ }
+
+ m_oOverlayManager.register(oMenu);
+
+ }
+
+
+ this._menu = oMenu;
+
+
+ if (!bInstance && !bLazyLoad) {
+
+ if (Dom.inDocument(oButtonElement)) {
+
+ oMenu.render(oButtonElement.parentNode);
+
+ }
+ else {
+
+ this.on("appendTo", onAppendTo);
+
+ }
+
+ }
+
+ }
+
+ }
+
+
+ if (Overlay) {
+
+ if (Menu) {
+
+ sMenuCSSClassName = Menu.prototype.CSS_CLASS_NAME;
+
+ }
+
+ if (p_oMenu && Menu && (p_oMenu instanceof Menu)) {
+
+ oMenu = p_oMenu;
+ bInstance = true;
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay && p_oMenu && (p_oMenu instanceof Overlay)) {
+
+ oMenu = p_oMenu;
+ bInstance = true;
+
+ oMenu.cfg.queueProperty("visible", false);
+
+ initMenu.call(this);
+
+ }
+ else if (Menu && Lang.isArray(p_oMenu)) {
+
+ oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, itemdata: p_oMenu });
+
+ this._menu = oMenu;
+
+ this.on("appendTo", initMenu);
+
+ }
+ else if (Lang.isString(p_oMenu)) {
+
+ oMenuElement = Dom.get(p_oMenu);
+
+ if (oMenuElement) {
+
+ if (Menu && Dom.hasClass(oMenuElement, sMenuCSSClassName) ||
+ oMenuElement.nodeName.toUpperCase() == "SELECT") {
+
+ oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay) {
+
+ oMenu = new Overlay(p_oMenu, { visible: false });
+
+ initMenu.call(this);
+
+ }
+
+ }
+
+ }
+ else if (p_oMenu && p_oMenu.nodeName) {
+
+ if (Menu && Dom.hasClass(p_oMenu, sMenuCSSClassName) ||
+ p_oMenu.nodeName.toUpperCase() == "SELECT") {
+
+ oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay) {
+
+ if (!p_oMenu.id) {
+
+ Dom.generateId(p_oMenu);
+
+ }
+
+ oMenu = new Overlay(p_oMenu, { visible: false });
+
+ 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;
+
+ }
+
+ },
+
+
+
+ // 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,
+ bReturnVal = false,
+ i;
+
+
+ if (nKeyCodes > 0) {
+
+ i = nKeyCodes - 1;
+
+ do {
+
+ if (p_nKeyCode == aKeyCodes[i]) {
+
+ bReturnVal = true;
+ break;
+
+ }
+
+ }
+ while (i--);
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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) {
+
+ var bShowMenu = (Event.getCharCode(p_oEvent) == 40);
+
+
+ var onKeyPress = function (p_oEvent) {
+
+ Event.preventDefault(p_oEvent);
+
+ this.removeListener("keypress", onKeyPress);
+
+ };
+
+
+ // Prevent the browser from scrolling the window
+ if (bShowMenu) {
+
+ if (UA.opera) {
+
+ this.on("keypress", onKeyPress);
+
+ }
+
+ Event.preventDefault(p_oEvent);
+ }
+
+ return bShowMenu;
+
+ },
+
+
+ /**
+ * @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._onFormSubmit, 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);
+
+ }
+
+ }
+
+ }
+
+ },
+
+
+
+ /**
+ * @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) {
+
+ if (YAHOO.widget.MenuManager) {
+ YAHOO.widget.MenuManager.hideVisible();
+ }
+
+
+ if (m_oOverlayManager) {
+ m_oOverlayManager.hideAll();
+ }
+
+
+ var oMenu = this._menu,
+ aMenuAlignment = this.get("menualignment"),
+ bFocusMenu = this.get("focusmenu"),
+ fnFocusMethod;
+
+
+ if (this._renderedMenu) {
+
+ oMenu.cfg.setProperty("context",
+ [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]);
+
+ oMenu.cfg.setProperty("preventcontextoverlap", true);
+ oMenu.cfg.setProperty("constraintoviewport", true);
+
+ }
+ else {
+
+ oMenu.cfg.queueProperty("context",
+ [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]);
+
+ oMenu.cfg.queueProperty("preventcontextoverlap", true);
+ oMenu.cfg.queueProperty("constraintoviewport", true);
+
+ }
+
+
+ /*
+ Refocus the Button before showing its Menu in case the call to
+ YAHOO.widget.MenuManager.hideVisible() resulted in another element in the
+ DOM being focused after another Menu was hidden.
+ */
+
+ this.focus();
+
+
+ if (Menu && oMenu && (oMenu instanceof Menu)) {
+
+ // Since Menus automatically focus themselves when made visible, temporarily
+ // replace the Menu focus method so that the value of the Button's "focusmenu"
+ // attribute determines if the Menu should be focus when made visible.
+
+ fnFocusMethod = oMenu.focus;
+
+ oMenu.focus = function () {};
+
+ if (this._renderedMenu) {
+
+ oMenu.cfg.setProperty("minscrollheight", this.get("menuminscrollheight"));
+ oMenu.cfg.setProperty("maxheight", this.get("menumaxheight"));
+
+ }
+ else {
+
+ oMenu.cfg.queueProperty("minscrollheight", this.get("menuminscrollheight"));
+ oMenu.cfg.queueProperty("maxheight", this.get("menumaxheight"));
+
+ }
+
+
+ oMenu.show();
+
+ oMenu.focus = fnFocusMethod;
+
+ oMenu.align();
+
+
+ /*
+ 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 (bFocusMenu) {
+ oMenu.focus();
+ }
+
+ }
+ else if (Overlay && oMenu && (oMenu instanceof Overlay)) {
+
+ if (!this._renderedMenu) {
+ oMenu.render(this.get("element").parentNode);
+ }
+
+ oMenu.show();
+ oMenu.align();
+
+ }
+
+ },
+
+
+ /**
+ * @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) {
+
+ var sType = this.get("type"),
+ oElement,
+ nOptionRegionX;
+
+
+ if (sType === "split") {
+
+ oElement = this.get("element");
+ nOptionRegionX =
+ (Dom.getX(oElement) + (oElement.offsetWidth - this.OPTION_AREA_WIDTH));
+
+ this._nOptionRegionX = nOptionRegionX;
+
+ }
+
+
+ if (!this._hasMouseEventHandlers) {
+
+ if (sType === "split") {
+
+ this.on("mousemove", this._onMouseMove);
+
+ }
+
+ this.on("mouseout", this._onMouseOut);
+
+ this._hasMouseEventHandlers = true;
+
+ }
+
+
+ this.addStateCSSClasses("hover");
+
+
+ if (sType === "split" && (Event.getPageX(p_oEvent) > nOptionRegionX)) {
+
+ this.addStateCSSClasses("hoveroption");
+
+ }
+
+
+ if (this._activationButtonPressed) {
+
+ this.addStateCSSClasses("active");
+
+ }
+
+
+ if (this._bOptionPressed) {
+
+ this.addStateCSSClasses("activeoption");
+
+ }
+
+
+ if (this._activationButtonPressed || this._bOptionPressed) {
+
+ Event.removeListener(document, "mouseup", this._onDocumentMouseUp);
+
+ }
+
+ },
+
+
+ /**
+ * @method _onMouseMove
+ * @description "mousemove" 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).
+ */
+ _onMouseMove: function (p_oEvent) {
+
+ var nOptionRegionX = this._nOptionRegionX;
+
+ if (nOptionRegionX) {
+
+ if (Event.getPageX(p_oEvent) > nOptionRegionX) {
+
+ this.addStateCSSClasses("hoveroption");
+
+ }
+ else {
+
+ this.removeStateCSSClasses("hoveroption");
+
+ }
+
+ }
+
+ },
+
+ /**
+ * @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) {
+
+ var sType = this.get("type");
+
+ this.removeStateCSSClasses("hover");
+
+
+ if (sType != "menu") {
+
+ this.removeStateCSSClasses("active");
+
+ }
+
+
+ if (this._activationButtonPressed || this._bOptionPressed) {
+
+ Event.on(document, "mouseup", this._onDocumentMouseUp, null, this);
+
+ }
+
+
+ if (sType === "split" && (Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
+
+ this.removeStateCSSClasses("hoveroption");
+
+ }
+
+ },
+
+
+ /**
+ * @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"),
+ oTarget,
+ oMenuElement;
+
+ if (sType == "menu" || sType == "split") {
+
+ oTarget = Event.getTarget(p_oEvent);
+ oMenuElement = this._menu.element;
+
+ if (oTarget != oMenuElement &&
+ !Dom.isAncestor(oMenuElement, oTarget)) {
+
+ 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,
+ bReturnVal = true;
+
+
+ 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") {
+
+ if (Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ this.fireEvent("option", p_oEvent);
+ bReturnVal = false;
+
+ }
+ 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") {
+
+ this._hideMenuTimer = Lang.later(250, this, this.on, ["mouseup", onMouseUp]);
+
+ }
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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"),
+ oHideMenuTimer = this._hideMenuTimer,
+ bReturnVal = true;
+
+
+ if (oHideMenuTimer) {
+
+ oHideMenuTimer.cancel();
+
+ }
+
+
+ if (sType == "checkbox" || sType == "radio") {
+
+ this.set("checked", !(this.get("checked")));
+
+ }
+
+
+ this._activationButtonPressed = false;
+
+
+ if (sType != "menu") {
+
+ this.removeStateCSSClasses("active");
+
+ }
+
+
+ if (sType == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ bReturnVal = false;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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"),
+ oForm,
+ oSrcElement,
+ bReturnVal;
+
+
+ switch (sType) {
+
+ case "submit":
+
+ if (p_oEvent.returnValue !== false) {
+
+ this.submitForm();
+
+ }
+
+ break;
+
+ case "reset":
+
+ oForm = this.getForm();
+
+ if (oForm) {
+
+ oForm.reset();
+
+ }
+
+ break;
+
+
+ case "split":
+
+ if (this._nOptionRegionX > 0 &&
+ (Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
+
+ bReturnVal = false;
+
+ }
+ else {
+
+ this._hideMenu();
+
+ oSrcElement = this.get("srcelement");
+
+ if (oSrcElement && oSrcElement.type == "submit" &&
+ p_oEvent.returnValue !== false) {
+
+ this.submitForm();
+
+ }
+
+ }
+
+ break;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @method _onDblClick
+ * @description "dblclick" 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).
+ */
+ _onDblClick: function (p_oEvent) {
+
+ var bReturnVal = true;
+
+ if (this.get("type") == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ bReturnVal = false;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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.
+ */
+
+ Lang.later(0, this, this._addListenersToForm);
+
+ },
+
+
+ /**
+ * @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 (Menu && oMenu && (oMenu instanceof Menu)) {
+
+ this.resetValue("selectedMenuItem");
+
+ }
+
+ },
+
+
+ /**
+ * @method _onFormSubmit
+ * @description "submit" 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).
+ */
+ _onFormSubmit: function (p_oEvent) {
+
+ this.createHiddenFields();
+
+ },
+
+
+ /**
+ * @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();
+
+ // In IE when the user mouses down on a focusable element
+ // that element will be focused and become the "activeElement".
+ // (http://msdn.microsoft.com/en-us/library/ms533065(VS.85).aspx)
+ // However, there is a bug in IE where if there is a
+ // positioned element with a focused descendant that is
+ // hidden in response to the mousedown event, the target of
+ // the mousedown event will appear to have focus, but will
+ // not be set as the activeElement. This will result
+ // in the element not firing key events, even though it
+ // appears to have focus. The following call to "setActive"
+ // fixes this bug.
+
+ if (UA.ie && oTarget.focus) {
+ oTarget.setActive();
+ }
+
+ 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(this.CLASS_NAME_PREFIX + "split-button-activeoption")) {
+
+ this._hideMenu();
+
+ this._bOptionPressed = false;
+
+ }
+ else {
+
+ this._showMenu(p_oEvent);
+
+ this._bOptionPressed = true;
+
+ }
+
+ },
+
+
+ /**
+ * @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 sState = (this.get("type") == "split") ? "activeoption" : "active";
+
+ this.addStateCSSClasses(sState);
+
+ },
+
+
+ /**
+ * @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 sState = (this.get("type") == "split") ? "activeoption" : "active";
+
+ this.removeStateCSSClasses(sState);
+
+
+ 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,
+ oMenu = this._menu,
+ oMenuElement = oMenu.element,
+ oSrcElement = oMenu.srcElement,
+ oItem;
+
+
+ if (oButtonParent != oMenuElement.parentNode) {
+
+ oButtonParent.appendChild(oMenuElement);
+
+ }
+
+ this._renderedMenu = true;
+
+ // If the user has designated an of the Menu's source
+ // element to be selected, sync the selectedIndex with
+ // the "selectedMenuItem" Attribute.
+
+ if (oSrcElement &&
+ oSrcElement.nodeName.toLowerCase() === "select" &&
+ oSrcElement.value) {
+
+
+ oItem = oMenu.getItem(oSrcElement.selectedIndex);
+
+ // Set the value of the "selectedMenuItem" attribute
+ // silently since this is the initial set--synchronizing
+ // the value of the source element in the DOM with
+ // its corresponding Menu instance.
+
+ this.set("selectedMenuItem", oItem, true);
+
+ // Call the "_onSelectedMenuItemChange" method since the
+ // attribute was set silently.
+
+ this._onSelectedMenuItemChange({ newValue: oItem });
+
+ }
+
+ },
+
+
+
+ /**
+ * @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) {
+
+ this.set("selectedMenuItem", oItem);
+
+ oSrcElement = this.get("srcelement");
+
+ if (oSrcElement && oSrcElement.type == "submit") {
+
+ this.submitForm();
+
+ }
+
+ this._hideMenu();
+
+ }
+
+ },
+
+
+ /**
+ * @method _onSelectedMenuItemChange
+ * @description "selectedMenuItemChange" event handler for the Button's
+ * "selectedMenuItem" attribute.
+ * @param {Event} event Object representing the DOM event object
+ * passed back by the event utility (YAHOO.util.Event).
+ */
+ _onSelectedMenuItemChange: function (event) {
+
+ var oSelected = event.prevValue,
+ oItem = event.newValue,
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (oSelected) {
+ Dom.removeClass(oSelected.element, (sPrefix + "button-selectedmenuitem"));
+ }
+
+ if (oItem) {
+ Dom.addClass(oItem.element, (sPrefix + "button-selectedmenuitem"));
+ }
+
+ },
+
+
+ /**
+ * @method _onLabelClick
+ * @description "click" event handler for the Button's
+ * <label>
element.
+ * @param {Event} event Object representing the DOM event object
+ * passed back by the event utility (YAHOO.util.Event).
+ */
+ _onLabelClick: function (event) {
+
+ this.focus();
+
+ var sType = this.get("type");
+
+ if (sType == "radio" || sType == "checkbox") {
+ this.set("checked", (!this.get("checked")));
+ }
+
+ },
+
+
+ // Public methods
+
+
+ /**
+ * @method createButtonElement
+ * @description Creates the button's HTML elements.
+ * @param {String} p_sType String indicating the type of element
+ * to create.
+ * @return {HTMLElement }
+ */
+ createButtonElement: function (p_sType) {
+
+ var sNodeName = this.NODE_NAME,
+ oElement = document.createElement(sNodeName);
+
+ oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" +
+ (p_sType == "link" ? " " :
+ " ") + "" + 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"),
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (Lang.isString(p_sState)) {
+
+ if (p_sState != "activeoption" && p_sState != "hoveroption") {
+
+ this.addClass(sPrefix + this.CSS_CLASS_NAME + ("-" + p_sState));
+
+ }
+
+ this.addClass(sPrefix + 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"),
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (Lang.isString(p_sState)) {
+
+ this.removeClass(sPrefix + this.CSS_CLASS_NAME + ("-" + p_sState));
+ this.removeClass(sPrefix + sType + ("-button-" + p_sState));
+
+ }
+
+ },
+
+
+ /**
+ * @method createHiddenFields
+ * @description Creates the button's hidden form field and appends it
+ * to its parent form.
+ * @return {HTMLInputElement |Array}
+ */
+ createHiddenFields: function () {
+
+ this.removeHiddenFields();
+
+ var oForm = this.getForm(),
+ oButtonField,
+ sType,
+ bCheckable,
+ oMenu,
+ oMenuItem,
+ sButtonName,
+ oValue,
+ oMenuField,
+ oReturnVal,
+ sMenuFieldName,
+ oMenuSrcElement,
+ bMenuSrcElementIsSelect = false;
+
+
+ if (oForm && !this.get("disabled")) {
+
+ sType = this.get("type");
+ bCheckable = (sType == "checkbox" || sType == "radio");
+
+
+ if ((bCheckable && this.get("checked")) || (m_oSubmitTrigger == this)) {
+
+ YAHOO.log("Creating hidden field.", "info", this.toString());
+
+ 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 (Menu && oMenu && (oMenu instanceof Menu)) {
+
+ YAHOO.log("Creating hidden field for menu.", "info", this.toString());
+
+ oMenuItem = this.get("selectedMenuItem");
+ oMenuSrcElement = oMenu.srcElement;
+ bMenuSrcElementIsSelect = (oMenuSrcElement &&
+ oMenuSrcElement.nodeName.toUpperCase() == "SELECT");
+
+ if (oMenuItem) {
+
+ oValue = (oMenuItem.value === null || oMenuItem.value === "") ?
+ oMenuItem.cfg.getProperty("text") : oMenuItem.value;
+
+ sButtonName = this.get("name");
+
+
+ if (bMenuSrcElementIsSelect) {
+
+ sMenuFieldName = oMenuSrcElement.name;
+
+ }
+ else if (sButtonName) {
+
+ sMenuFieldName = (sButtonName + "_options");
+
+ }
+
+
+ if (oValue && sMenuFieldName) {
+
+ oMenuField = createInputElement("hidden", sMenuFieldName, oValue);
+ oForm.appendChild(oMenuField);
+
+ }
+
+ }
+ else if (bMenuSrcElementIsSelect) {
+
+ oMenuField = oForm.appendChild(oMenuSrcElement);
+
+ }
+
+ }
+
+
+ if (oButtonField && oMenuField) {
+
+ this._hiddenFields = [oButtonField, oMenuField];
+
+ }
+ else if (!oButtonField && oMenuField) {
+
+ this._hiddenFields = oMenuField;
+
+ }
+ else if (oButtonField && !oMenuField) {
+
+ this._hiddenFields = oButtonField;
+
+ }
+
+ oReturnVal = this._hiddenFields;
+
+ }
+
+ return oReturnVal;
+
+ },
+
+
+ /**
+ * @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 (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 ((UA.ie || 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
+ * <input>
, <button>
,
+ * <a>
, or <span>
element to
+ * be used to create the button.
+ * @param {HTMLInputElement |HTMLButtonElement |
+ * HTMLElement } p_oElement Object reference for the
+ * <input>
, <button>
,
+ * <a>
, or <span>
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);
+
+
+ var sId = this.get("id"),
+ sButtonId = sId + "-button";
+
+
+ oButton.id = sButtonId;
+
+
+ var aLabels,
+ oLabel;
+
+
+ var hasLabel = function (element) {
+
+ return (element.htmlFor === sId);
+
+ };
+
+
+ var setLabel = function () {
+
+ oLabel.setAttribute((UA.ie ? "htmlFor" : "for"), sButtonId);
+
+ };
+
+
+ if (oSrcElement && this.get("type") != "link") {
+
+ aLabels = Dom.getElementsBy(hasLabel, "label");
+
+ if (Lang.isArray(aLabels) && aLabels.length > 0) {
+
+ oLabel = aLabels[0];
+
+ }
+
+ }
+
+
+ m_oButtons[sId] = this;
+
+ var sPrefix = this.CLASS_NAME_PREFIX;
+
+ this.addClass(sPrefix + this.CSS_CLASS_NAME);
+ this.addClass(sPrefix + this.get("type") + "-button");
+
+ Event.on(this._button, "focus", this._onFocus, null, this);
+ this.on("mouseover", this._onMouseOver);
+ this.on("mousedown", this._onMouseDown);
+ this.on("mouseup", this._onMouseUp);
+ this.on("click", this._onClick);
+
+ // Need to reset the value of the "onclick" Attribute so that any
+ // handlers registered via the "onclick" Attribute are fired after
+ // Button's default "_onClick" listener.
+
+ var fnOnClick = this.get("onclick");
+
+ this.set("onclick", null);
+ this.set("onclick", fnOnClick);
+
+ this.on("dblclick", this._onDblClick);
+
+
+ var oParentNode;
+
+ if (oLabel) {
+
+ if (this.get("replaceLabel")) {
+
+ this.set("label", oLabel.innerHTML);
+
+ oParentNode = oLabel.parentNode;
+
+ oParentNode.removeChild(oLabel);
+
+ }
+ else {
+
+ this.on("appendTo", setLabel);
+
+ Event.on(oLabel, "click", this._onLabelClick, null, this);
+
+ this._label = oLabel;
+
+ }
+
+ }
+
+ this.on("appendTo", this._onAppendTo);
+
+
+
+ var oContainer = this.get("container"),
+ oElement = this.get("element"),
+ bElInDoc = Dom.inDocument(oElement);
+
+
+ if (oContainer) {
+
+ if (oSrcElement && oSrcElement != oElement) {
+
+ oParentNode = oSrcElement.parentNode;
+
+ if (oParentNode) {
+
+ oParentNode.removeChild(oSrcElement);
+
+ }
+
+ }
+
+ if (Lang.isString(oContainer)) {
+
+ Event.onContentReady(oContainer, this.appendTo, oContainer, this);
+
+ }
+ else {
+
+ this.on("init", function () {
+
+ Lang.later(0, this, 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();
+
+ }
+
+ YAHOO.log("Initialization completed.", "info", this.toString());
+
+
+ this.fireEvent("init", {
+ type: "init",
+ target: this
+ });
+
+ },
+
+
+ /**
+ * @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
+ * @writeonce
+ */
+ 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 HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("container", {
+
+ value: oAttributes.container,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute srcelement
+ * @description Object reference to the HTML element (either
+ * <input>
or <span>
)
+ * used to create the button.
+ * @type HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ 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:
+ *
+ * Object specifying a rendered
+ * YAHOO.widget.Menu instance.
+ * Object specifying a rendered
+ * YAHOO.widget.Overlay instance.
+ * String specifying the id attribute of the <div>
+ *
element used to create the menu. By default the menu
+ * will be created as an instance of
+ * YAHOO.widget.Overlay .
+ * If the
+ * default CSS class name for YAHOO.widget.Menu is applied to
+ * the <div>
element, it will be created as an
+ * instance of YAHOO.widget.Menu
+ * . String specifying the id attribute of the
+ * <select>
element used to create the menu.
+ * Object specifying the <div>
element
+ * used to create the menu.
+ * Object specifying the <select>
element
+ * used to create the menu.
+ * Array of object literals, each representing a set of
+ * YAHOO.widget.MenuItem
+ * configuration attributes.
+ * Array of strings representing the text labels for each menu
+ * item in the menu.
+ *
+ * @type YAHOO.widget.Menu |YAHOO.widget.Overlay |HTMLElement |String|Array
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("menu", {
+
+ value: null,
+ method: this._setMenu,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute lazyloadmenu
+ * @description Boolean indicating the value to set for the
+ * "lazyload"
+ * configuration property of the button's menu. Setting
+ * "lazyloadmenu" to true
will defer rendering of
+ * the button's menu until the first time it is made visible.
+ * If "lazyloadmenu" is set to false
, 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.
+ * This attribute does not apply if a
+ * YAHOO.widget.Menu or
+ * YAHOO.widget.Overlay
+ * instance is passed as the value of the button's "menu"
+ * configuration attribute.
+ * YAHOO.widget.Menu or
+ * YAHOO.widget.Overlay instances should be rendered before
+ * being set as the value for the "menu" configuration
+ * attribute.
+ * @default true
+ * @type Boolean
+ * @writeonce
+ */
+ 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"
+ * @writeonce
+ */
+ this.setAttributeConfig("menuclassname", {
+
+ value: (oAttributes.menuclassname || (this.CLASS_NAME_PREFIX + "button-menu")),
+ validator: Lang.isString,
+ method: this._setMenuClassName,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute menuminscrollheight
+ * @description Number defining the minimum threshold for the "menumaxheight"
+ * configuration attribute. When set this attribute is automatically applied
+ * to all submenus.
+ * @default 90
+ * @type Number
+ */
+ this.setAttributeConfig("menuminscrollheight", {
+
+ value: (oAttributes.menuminscrollheight || 90),
+ validator: Lang.isNumber
+
+ });
+
+
+ /**
+ * @attribute menumaxheight
+ * @description Number defining the maximum height (in pixels) for a menu's
+ * body element (<div class="bd"<
). Once a menu's body
+ * exceeds this height, the contents of the body are scrolled to maintain
+ * this value. This value cannot be set lower than the value of the
+ * "minscrollheight" configuration property.
+ * @type Number
+ * @default 0
+ */
+ this.setAttributeConfig("menumaxheight", {
+
+ value: (oAttributes.menumaxheight || 0),
+ validator: Lang.isNumber
+
+ });
+
+
+ /**
+ * @attribute menualignment
+ * @description Array defining how the Button's Menu is aligned to the Button.
+ * The default value of ["tl", "bl"] aligns the Menu's top left corner to the Button's
+ * bottom left corner.
+ * @type Array
+ * @default ["tl", "bl"]
+ */
+ this.setAttributeConfig("menualignment", {
+
+ value: (oAttributes.menualignment || ["tl", "bl"]),
+ validator: Lang.isArray
+
+ });
+
+
+ /**
+ * @attribute selectedMenuItem
+ * @description Object representing the item in the button's menu
+ * that is currently selected.
+ * @type YAHOO.widget.MenuItem
+ * @default null
+ */
+ this.setAttributeConfig("selectedMenuItem", {
+
+ value: null
+
+ });
+
+
+ /**
+ * @attribute onclick
+ * @description Object literal representing the code to be executed
+ * when the button is clicked. Format: {
+ * fn: Function, // The handler to call
+ * when the event fires. obj: Object,
+ * // An object to pass back to the handler.
+ * scope: Object // The object to use
+ * for the scope of the handler. }
+ * @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
+
+ });
+
+
+ /**
+ * @attribute replaceLabel
+ * @description Boolean indicating whether or not the text of the
+ * button's <label>
element should be used as
+ * the source for the button's label configuration attribute and
+ * removed from the DOM.
+ * @type Boolean
+ * @default false
+ */
+ this.setAttributeConfig("replaceLabel", {
+
+ value: false,
+ validator: Lang.isBoolean,
+ writeOnce: true
+
+ });
+
+ },
+
+
+ /**
+ * @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.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME + "-active");
+
+ },
+
+
+ /**
+ * @method getMenu
+ * @description Returns a reference to the button's menu.
+ * @return {
+ * YAHOO.widget.Overlay |YAHOO.widget.Menu }
+ */
+ getMenu: function () {
+
+ return this._menu;
+
+ },
+
+
+ /**
+ * @method getForm
+ * @description Returns a reference to the button's parent form.
+ * @return {HTMLFormElement }
+ */
+ getForm: function () {
+
+ var oButton = this._button,
+ oForm;
+
+ if (oButton) {
+
+ oForm = oButton.form;
+
+ }
+
+ return oForm;
+
+ },
+
+
+ /**
+ * @method getHiddenFields
+ * @description Returns an <input>
element or
+ * array of form elements used to represent the button when its parent
+ * form is submitted.
+ * @return {HTMLInputElement |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 () {
+
+ YAHOO.log("Destroying ...", "info", this.toString());
+
+ var oElement = this.get("element"),
+ oMenu = this._menu,
+ oLabel = this._label,
+ oParentNode,
+ aButtons;
+
+ if (oMenu) {
+
+ YAHOO.log("Destroying menu.", "info", this.toString());
+
+ if (m_oOverlayManager && m_oOverlayManager.find(oMenu)) {
+
+ m_oOverlayManager.remove(oMenu);
+
+ }
+
+ oMenu.destroy();
+
+ }
+
+ YAHOO.log("Removing DOM event listeners.", "info", this.toString());
+
+ 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);
+
+
+ if (oLabel) {
+
+ Event.removeListener(oLabel, "click", this._onLabelClick);
+
+ oParentNode = oLabel.parentNode;
+ oParentNode.removeChild(oLabel);
+
+ }
+
+
+ var oForm = this.getForm();
+
+ if (oForm) {
+
+ Event.removeListener(oForm, "reset", this._onFormReset);
+ Event.removeListener(oForm, "submit", this._onFormSubmit);
+
+ }
+
+ YAHOO.log("Removing CustomEvent listeners.", "info", this.toString());
+
+ this.unsubscribeAll();
+
+ oParentNode = oElement.parentNode;
+
+ if (oParentNode) {
+
+ oParentNode.removeChild(oElement);
+
+ }
+
+ YAHOO.log("Removing from document.", "info", this.toString());
+
+ delete m_oButtons[this.get("id")];
+
+ var sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+ aButtons = Dom.getElementsByClassName(sClass,
+ this.NODE_NAME, oForm);
+
+ if (Lang.isArray(aButtons) && aButtons.length === 0) {
+
+ Event.removeListener(oForm, "keypress",
+ YAHOO.widget.Button.onFormKeyPress);
+
+ }
+
+ YAHOO.log("Destroyed.", "info", this.toString());
+
+ },
+
+
+ fireEvent: function (p_sType , p_aArgs) {
+
+ var sType = arguments[0];
+
+ // Disabled buttons should not respond to DOM events
+
+ if (this.DOM_EVENTS[sType] && this.get("disabled")) {
+
+ return false;
+
+ }
+
+ return YAHOO.widget.Button.superclass.fireEvent.apply(this, arguments);
+
+ },
+
+
+ /**
+ * @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,
+
+ oEvent;
+
+
+ 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;
+
+ }
+
+ }
+
+ 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) {
+
+ /*
+ Need to call "preventDefault" to ensure that the form doesn't end up getting
+ submitted twice.
+ */
+
+ Event.preventDefault(p_oEvent);
+
+
+ if (UA.ie) {
+
+ oYUISubmitButton.get("element").fireEvent("onclick");
+
+ }
+ else {
+
+ oEvent = document.createEvent("HTMLEvents");
+ oEvent.initEvent("click", true, true);
+
+
+ if (UA.gecko < 1.9) {
+
+ oYUISubmitButton.fireEvent("click", oEvent);
+
+ }
+ else {
+
+ oYUISubmitButton.get("element").dispatchEvent(oEvent);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * @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 {HTMLFormElement } p_oForm Object reference
+ * for the form to search.
+ */
+ YAHOO.widget.Button.addHiddenFieldsToForm = function (p_oForm) {
+
+ var proto = YAHOO.widget.Button.prototype,
+ aButtons = Dom.getElementsByClassName(
+ (proto.CLASS_NAME_PREFIX + proto.CSS_CLASS_NAME),
+ "*",
+ p_oForm),
+
+ nButtons = aButtons.length,
+ oButton,
+ sId,
+ i;
+
+ if (nButtons > 0) {
+
+ YAHOO.log("Form contains " + nButtons + " YUI buttons.", "info", this.toString());
+
+ for (i = 0; i < nButtons; i++) {
+
+ sId = aButtons[i].id;
+
+ if (sId) {
+
+ oButton = m_oButtons[sId];
+
+ if (oButton) {
+
+ oButton.createHiddenFields();
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * @method YAHOO.widget.Button.getButton
+ * @description Returns a button with the specified id.
+ * @param {String} p_sId String specifying the id of the root node of the
+ * HTML element representing the button to be retrieved.
+ * @return {YAHOO.widget.Button}
+ */
+ YAHOO.widget.Button.getButton = function (p_sId) {
+
+ return m_oButtons[p_sId];
+
+ };
+
+
+ // 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
+ * Element.addListener
+ * 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
+ * Element.addListener 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
+ * Element.addListener
+ * 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
+ * <div>
element of the button group.
+ * @param {HTMLDivElement } p_oElement Object
+ * specifying the <div>
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;
+
+ YAHOO.log("No value specified for the button group's \"id\"" +
+ " attribute. Setting button group id to \"" + sId + "\".",
+ "info");
+
+ }
+
+ this.logger = new YAHOO.widget.LogWriter("ButtonGroup " + sId);
+
+ this.logger.log("No source HTML element. Building the button " +
+ "group using the set of configuration attributes.");
+
+ 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) {
+
+ this.logger =
+ new YAHOO.widget.LogWriter("ButtonGroup " + p_oElement);
+
+ 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();
+
+ YAHOO.log("No value specified for the button group's" +
+ " \"id\" attribute. Setting button group id " +
+ "to \"" + p_oElement.id + "\".", "warn");
+
+ }
+
+ this.logger =
+ new YAHOO.widget.LogWriter("ButtonGroup " + p_oElement.id);
+
+ 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 CLASS_NAME_PREFIX
+ * @description Prefix used for all class names applied to a ButtonGroup.
+ * @default "yui-"
+ * @final
+ * @type String
+ */
+ CLASS_NAME_PREFIX: "yui-",
+
+
+ /**
+ * @property CSS_CLASS_NAME
+ * @description String representing the CSS class(es) to be applied
+ * to the button group's element.
+ * @default "buttongroup"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "buttongroup",
+
+
+
+ // Protected methods
+
+
+ /**
+ * @method _createGroupElement
+ * @description Creates the button group's element.
+ * @protected
+ * @return {HTMLDivElement }
+ */
+ _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 {YAHOO.widget.Button }
+ * 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
+ * <div>
element of the button group.
+ * @param {HTMLDivElement } p_oElement Object
+ * specifying the <div>
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.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+
+ var sClass = (YAHOO.widget.Button.prototype.CLASS_NAME_PREFIX + "radio-button"),
+ aButtons = this.getElementsByClassName(sClass);
+
+ this.logger.log("Searching for child nodes with the class name " +
+ sClass + " to add to the button group.");
+
+
+ if (aButtons.length > 0) {
+
+ this.logger.log("Found " + aButtons.length +
+ " child nodes with the class name " + sClass +
+ " Attempting to add to button group.");
+
+ this.addButtons(aButtons);
+
+ }
+
+
+ this.logger.log("Searching for child nodes with the type of " +
+ " \"radio\" to add to the button group.");
+
+ function isRadioButton(p_oElement) {
+
+ return (p_oElement.type == "radio");
+
+ }
+
+ aButtons =
+ Dom.getElementsBy(isRadioButton, "input", this.get("element"));
+
+
+ if (aButtons.length > 0) {
+
+ this.logger.log("Found " + aButtons.length + " child nodes" +
+ " with the type of \"radio.\" Attempting to add to" +
+ " button group.");
+
+ 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);
+
+ }
+
+ }
+
+
+ this.logger.log("Initialization completed.");
+
+ },
+
+
+ /**
+ * @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 HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("container", {
+
+ value: oAttributes.container,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute checkedButton
+ * @description Reference for the button in the button group that
+ * is checked.
+ * @type {YAHOO.widget.Button }
+ * @default null
+ */
+ this.setAttributeConfig("checkedButton", {
+
+ value: null
+
+ });
+
+ },
+
+
+ /**
+ * @method addButton
+ * @description Adds the button to the button group.
+ * @param {YAHOO.widget.Button }
+ * p_oButton Object reference for the
+ * YAHOO.widget.Button instance to be added to the button group.
+ * @param {String} p_oButton String specifying the id attribute of the
+ * <input>
or <span>
element
+ * to be used to create the button to be added to the button group.
+ * @param {HTMLInputElement |HTMLElement } p_oButton Object reference for the
+ * <input>
or <span>
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
+ * YAHOO.widget.Button
+ * configuration attributes used to configure the button to be added to
+ * the button group.
+ * @return {YAHOO.widget.Button }
+ */
+ 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);
+
+ this.logger.log("Button " + oButton.get("id") + " added.");
+
+ }
+
+ return oButton;
+
+ },
+
+
+ /**
+ * @method addButtons
+ * @description Adds the array of buttons to the button group.
+ * @param {Array} p_aButtons Array of
+ * YAHOO.widget.Button instances to be added
+ * to the button group.
+ * @param {Array} p_aButtons Array of strings specifying the id
+ * attribute of the <input>
or <span>
+ *
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
+ * <input>
or <span>
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 YAHOO.widget.Button
+ * 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;
+
+ }
+
+ }
+
+ }
+
+ }
+
+ 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.logger.log("Removing button " + oButton.get("id") + ".");
+
+ 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--);
+
+ }
+
+ this.logger.log("Button " + oButton.get("id") + " removed.");
+
+ }
+
+ },
+
+
+ /**
+ * @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 {YAHOO.widget.Button }
+ */
+ getButton: function (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 () {
+
+ this.logger.log("Destroying...");
+
+ 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--);
+
+ }
+
+ this.logger.log("Removing DOM event handlers.");
+
+ Event.purgeElement(oElement);
+
+ this.logger.log("Removing from document.");
+
+ 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.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/button/button-min.js b/lib/yui/2.8.0r4/button/button-min.js
new file mode 100644
index 0000000000..6a81b63e6e
--- /dev/null
+++ b/lib/yui/2.8.0r4/button/button-min.js
@@ -0,0 +1,11 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function(){var G=YAHOO.util.Dom,M=YAHOO.util.Event,I=YAHOO.lang,L=YAHOO.env.ua,B=YAHOO.widget.Overlay,J=YAHOO.widget.Menu,D={},K=null,E=null,C=null;function F(O,N,R,P){var S,Q;if(I.isString(O)&&I.isString(N)){if(L.ie){Q=' ";S=document.createElement(Q);}else{S=document.createElement("input");S.name=N;S.type=O;if(P){S.checked=true;}}S.value=R;}return S;}function H(O,V){var N=O.nodeName.toUpperCase(),S=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME),T=this,U,P,Q;function W(X){if(!(X in V)){U=O.getAttributeNode(X);if(U&&("value" in U)){V[X]=U.value;}}}function R(){W("type");if(V.type=="button"){V.type="push";}if(!("disabled" in V)){V.disabled=O.disabled;}W("name");W("value");W("title");}switch(N){case"A":V.type="link";W("href");W("target");break;case"INPUT":R();if(!("checked" in V)){V.checked=O.checked;}break;case"BUTTON":R();P=O.parentNode.parentNode;if(G.hasClass(P,S+"-checked")){V.checked=true;}if(G.hasClass(P,S+"-disabled")){V.disabled=true;}O.removeAttribute("value");O.setAttribute("type","button");break;}O.removeAttribute("id");O.removeAttribute("name");if(!("tabindex" in V)){V.tabindex=O.tabIndex;}if(!("label" in V)){Q=N=="INPUT"?O.value:O.innerHTML;if(Q&&Q.length>0){V.label=Q;}}}function A(P){var O=P.attributes,N=O.srcelement,R=N.nodeName.toUpperCase(),Q=this;if(R==this.NODE_NAME){P.element=N;P.id=N.id;G.getElementsBy(function(S){switch(S.nodeName.toUpperCase()){case"BUTTON":case"A":case"INPUT":H.call(Q,S,O);break;}},"*",N);}else{switch(R){case"BUTTON":case"A":case"INPUT":H.call(this,N,O);break;}}}YAHOO.widget.Button=function(R,O){if(!B&&YAHOO.widget.Overlay){B=YAHOO.widget.Overlay;}if(!J&&YAHOO.widget.Menu){J=YAHOO.widget.Menu;}var Q=YAHOO.widget.Button.superclass.constructor,P,N;if(arguments.length==1&&!I.isString(R)&&!R.nodeName){if(!R.id){R.id=G.generateId();}Q.call(this,(this.createButtonElement(R.type)),R);}else{P={element:null,attributes:(O||{})};if(I.isString(R)){N=G.get(R);if(N){if(!P.attributes.id){P.attributes.id=R;}P.attributes.srcelement=N;A.call(this,P);if(!P.element){P.element=this.createButtonElement(P.attributes.type);}Q.call(this,P.element,P.attributes);}}else{if(R.nodeName){if(!P.attributes.id){if(R.id){P.attributes.id=R.id;}else{P.attributes.id=G.generateId();}}P.attributes.srcelement=R;A.call(this,P);if(!P.element){P.element=this.createButtonElement(P.attributes.type);}Q.call(this,P.element,P.attributes);}}}};YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenFields:null,_onclickAttributeValue:null,_activationKeyPressed:false,_activationButtonPressed:false,_hasKeyEventHandlers:false,_hasMouseEventHandlers:false,_nOptionRegionX:0,CLASS_NAME_PREFIX:"yui-",NODE_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"button",_setType:function(N){if(N=="split"){this.on("option",this._onOption);}},_setLabel:function(O){this._button.innerHTML=O;var P,N=L.gecko;if(N&&N<1.9&&G.inDocument(this.get("element"))){P=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);this.removeClass(P);I.later(0,this,this.addClass,P);}},_setTabIndex:function(N){this._button.tabIndex=N;},_setTitle:function(N){if(this.get("type")!="link"){this._button.title=N;}},_setDisabled:function(N){if(this.get("type")!="link"){if(N){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");}}},_setHref:function(N){if(this.get("type")=="link"){this._button.href=N;}},_setTarget:function(N){if(this.get("type")=="link"){this._button.setAttribute("target",N);}},_setChecked:function(N){var O=this.get("type");if(O=="checkbox"||O=="radio"){if(N){this.addStateCSSClasses("checked");}else{this.removeStateCSSClasses("checked");}}},_setMenu:function(U){var P=this.get("lazyloadmenu"),R=this.get("element"),N,W=false,X,O,Q;function V(){X.render(R.parentNode);this.removeListener("appendTo",V);}function T(){X.cfg.queueProperty("container",R.parentNode);this.removeListener("appendTo",T);}function S(){var Y;if(X){G.addClass(X.element,this.get("menuclassname"));G.addClass(X.element,this.CLASS_NAME_PREFIX+this.get("type")+"-button-menu");X.showEvent.subscribe(this._onMenuShow,null,this);X.hideEvent.subscribe(this._onMenuHide,null,this);X.renderEvent.subscribe(this._onMenuRender,null,this);if(J&&X instanceof J){if(P){Y=this.get("container");if(Y){X.cfg.queueProperty("container",Y);}else{this.on("appendTo",T);}}X.cfg.queueProperty("clicktohide",false);X.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);X.subscribe("click",this._onMenuClick,this,true);this.on("selectedMenuItemChange",this._onSelectedMenuItemChange);Q=X.srcElement;if(Q&&Q.nodeName.toUpperCase()=="SELECT"){Q.style.display="none";Q.parentNode.removeChild(Q);}}else{if(B&&X instanceof B){if(!K){K=new YAHOO.widget.OverlayManager();}K.register(X);}}this._menu=X;if(!W&&!P){if(G.inDocument(R)){X.render(R.parentNode);}else{this.on("appendTo",V);}}}}if(B){if(J){N=J.prototype.CSS_CLASS_NAME;}if(U&&J&&(U instanceof J)){X=U;W=true;S.call(this);}else{if(B&&U&&(U instanceof B)){X=U;W=true;X.cfg.queueProperty("visible",false);S.call(this);}else{if(J&&I.isArray(U)){X=new J(G.generateId(),{lazyload:P,itemdata:U});this._menu=X;this.on("appendTo",S);}else{if(I.isString(U)){O=G.get(U);if(O){if(J&&G.hasClass(O,N)||O.nodeName.toUpperCase()=="SELECT"){X=new J(U,{lazyload:P});S.call(this);}else{if(B){X=new B(U,{visible:false});S.call(this);}}}}else{if(U&&U.nodeName){if(J&&G.hasClass(U,N)||U.nodeName.toUpperCase()=="SELECT"){X=new J(U,{lazyload:P});S.call(this);}else{if(B){if(!U.id){G.generateId(U);}X=new B(U,{visible:false});S.call(this);}}}}}}}}},_setOnClick:function(N){if(this._onclickAttributeValue&&(this._onclickAttributeValue!=N)){this.removeListener("click",this._onclickAttributeValue.fn);
+this._onclickAttributeValue=null;}if(!this._onclickAttributeValue&&I.isObject(N)&&I.isFunction(N.fn)){this.on("click",N.fn,N.obj,N.scope);this._onclickAttributeValue=N;}},_isActivationKey:function(N){var S=this.get("type"),O=(S=="checkbox"||S=="radio")?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,Q=O.length,R=false,P;if(Q>0){P=Q-1;do{if(N==O[P]){R=true;break;}}while(P--);}return R;},_isSplitButtonOptionKey:function(P){var O=(M.getCharCode(P)==40);var N=function(Q){M.preventDefault(Q);this.removeListener("keypress",N);};if(O){if(L.opera){this.on("keypress",N);}M.preventDefault(P);}return O;},_addListenersToForm:function(){var T=this.getForm(),S=YAHOO.widget.Button.onFormKeyPress,R,N,Q,P,O;if(T){M.on(T,"reset",this._onFormReset,null,this);M.on(T,"submit",this._onFormSubmit,null,this);N=this.get("srcelement");if(this.get("type")=="submit"||(N&&N.type=="submit")){Q=M.getListeners(T,"keypress");R=false;if(Q){P=Q.length;if(P>0){O=P-1;do{if(Q[O].fn==S){R=true;break;}}while(O--);}}if(!R){M.on(T,"keypress",S);}}}},_showMenu:function(R){if(YAHOO.widget.MenuManager){YAHOO.widget.MenuManager.hideVisible();}if(K){K.hideAll();}var N=this._menu,Q=this.get("menualignment"),P=this.get("focusmenu"),O;if(this._renderedMenu){N.cfg.setProperty("context",[this.get("element"),Q[0],Q[1]]);N.cfg.setProperty("preventcontextoverlap",true);N.cfg.setProperty("constraintoviewport",true);}else{N.cfg.queueProperty("context",[this.get("element"),Q[0],Q[1]]);N.cfg.queueProperty("preventcontextoverlap",true);N.cfg.queueProperty("constraintoviewport",true);}this.focus();if(J&&N&&(N instanceof J)){O=N.focus;N.focus=function(){};if(this._renderedMenu){N.cfg.setProperty("minscrollheight",this.get("menuminscrollheight"));N.cfg.setProperty("maxheight",this.get("menumaxheight"));}else{N.cfg.queueProperty("minscrollheight",this.get("menuminscrollheight"));N.cfg.queueProperty("maxheight",this.get("menumaxheight"));}N.show();N.focus=O;N.align();if(R.type=="mousedown"){M.stopPropagation(R);}if(P){N.focus();}}else{if(B&&N&&(N instanceof B)){if(!this._renderedMenu){N.render(this.get("element").parentNode);}N.show();N.align();}}},_hideMenu:function(){var N=this._menu;if(N){N.hide();}},_onMouseOver:function(O){var Q=this.get("type"),N,P;if(Q==="split"){N=this.get("element");P=(G.getX(N)+(N.offsetWidth-this.OPTION_AREA_WIDTH));this._nOptionRegionX=P;}if(!this._hasMouseEventHandlers){if(Q==="split"){this.on("mousemove",this._onMouseMove);}this.on("mouseout",this._onMouseOut);this._hasMouseEventHandlers=true;}this.addStateCSSClasses("hover");if(Q==="split"&&(M.getPageX(O)>P)){this.addStateCSSClasses("hoveroption");}if(this._activationButtonPressed){this.addStateCSSClasses("active");}if(this._bOptionPressed){this.addStateCSSClasses("activeoption");}if(this._activationButtonPressed||this._bOptionPressed){M.removeListener(document,"mouseup",this._onDocumentMouseUp);}},_onMouseMove:function(N){var O=this._nOptionRegionX;if(O){if(M.getPageX(N)>O){this.addStateCSSClasses("hoveroption");}else{this.removeStateCSSClasses("hoveroption");}}},_onMouseOut:function(N){var O=this.get("type");this.removeStateCSSClasses("hover");if(O!="menu"){this.removeStateCSSClasses("active");}if(this._activationButtonPressed||this._bOptionPressed){M.on(document,"mouseup",this._onDocumentMouseUp,null,this);}if(O==="split"&&(M.getPageX(N)>this._nOptionRegionX)){this.removeStateCSSClasses("hoveroption");}},_onDocumentMouseUp:function(P){this._activationButtonPressed=false;this._bOptionPressed=false;var Q=this.get("type"),N,O;if(Q=="menu"||Q=="split"){N=M.getTarget(P);O=this._menu.element;if(N!=O&&!G.isAncestor(O,N)){this.removeStateCSSClasses((Q=="menu"?"active":"activeoption"));this._hideMenu();}}M.removeListener(document,"mouseup",this._onDocumentMouseUp);},_onMouseDown:function(P){var Q,O=true;function N(){this._hideMenu();this.removeListener("mouseup",N);}if((P.which||P.button)==1){if(!this.hasFocus()){this.focus();}Q=this.get("type");if(Q=="split"){if(M.getPageX(P)>this._nOptionRegionX){this.fireEvent("option",P);O=false;}else{this.addStateCSSClasses("active");this._activationButtonPressed=true;}}else{if(Q=="menu"){if(this.isActive()){this._hideMenu();this._activationButtonPressed=false;}else{this._showMenu(P);this._activationButtonPressed=true;}}else{this.addStateCSSClasses("active");this._activationButtonPressed=true;}}if(Q=="split"||Q=="menu"){this._hideMenuTimer=I.later(250,this,this.on,["mouseup",N]);}}return O;},_onMouseUp:function(P){var Q=this.get("type"),N=this._hideMenuTimer,O=true;if(N){N.cancel();}if(Q=="checkbox"||Q=="radio"){this.set("checked",!(this.get("checked")));}this._activationButtonPressed=false;if(Q!="menu"){this.removeStateCSSClasses("active");}if(Q=="split"&&M.getPageX(P)>this._nOptionRegionX){O=false;}return O;},_onFocus:function(O){var N;this.addStateCSSClasses("focus");if(this._activationKeyPressed){this.addStateCSSClasses("active");}C=this;if(!this._hasKeyEventHandlers){N=this._button;M.on(N,"blur",this._onBlur,null,this);M.on(N,"keydown",this._onKeyDown,null,this);M.on(N,"keyup",this._onKeyUp,null,this);this._hasKeyEventHandlers=true;}this.fireEvent("focus",O);},_onBlur:function(N){this.removeStateCSSClasses("focus");if(this.get("type")!="menu"){this.removeStateCSSClasses("active");}if(this._activationKeyPressed){M.on(document,"keyup",this._onDocumentKeyUp,null,this);}C=null;this.fireEvent("blur",N);},_onDocumentKeyUp:function(N){if(this._isActivationKey(M.getCharCode(N))){this._activationKeyPressed=false;M.removeListener(document,"keyup",this._onDocumentKeyUp);}},_onKeyDown:function(O){var N=this._menu;if(this.get("type")=="split"&&this._isSplitButtonOptionKey(O)){this.fireEvent("option",O);}else{if(this._isActivationKey(M.getCharCode(O))){if(this.get("type")=="menu"){this._showMenu(O);}else{this._activationKeyPressed=true;this.addStateCSSClasses("active");}}}if(N&&N.cfg.getProperty("visible")&&M.getCharCode(O)==27){N.hide();this.focus();}},_onKeyUp:function(N){var O;if(this._isActivationKey(M.getCharCode(N))){O=this.get("type");if(O=="checkbox"||O=="radio"){this.set("checked",!(this.get("checked")));
+}this._activationKeyPressed=false;if(this.get("type")!="menu"){this.removeStateCSSClasses("active");}}},_onClick:function(P){var R=this.get("type"),Q,N,O;switch(R){case"submit":if(P.returnValue!==false){this.submitForm();}break;case"reset":Q=this.getForm();if(Q){Q.reset();}break;case"split":if(this._nOptionRegionX>0&&(M.getPageX(P)>this._nOptionRegionX)){O=false;}else{this._hideMenu();N=this.get("srcelement");if(N&&N.type=="submit"&&P.returnValue!==false){this.submitForm();}}break;}return O;},_onDblClick:function(O){var N=true;if(this.get("type")=="split"&&M.getPageX(O)>this._nOptionRegionX){N=false;}return N;},_onAppendTo:function(N){I.later(0,this,this._addListenersToForm);},_onFormReset:function(O){var P=this.get("type"),N=this._menu;if(P=="checkbox"||P=="radio"){this.resetValue("checked");}if(J&&N&&(N instanceof J)){this.resetValue("selectedMenuItem");}},_onFormSubmit:function(N){this.createHiddenFields();},_onDocumentMouseDown:function(Q){var N=M.getTarget(Q),P=this.get("element"),O=this._menu.element;if(N!=P&&!G.isAncestor(P,N)&&N!=O&&!G.isAncestor(O,N)){this._hideMenu();if(L.ie&&N.focus){N.setActive();}M.removeListener(document,"mousedown",this._onDocumentMouseDown);}},_onOption:function(N){if(this.hasClass(this.CLASS_NAME_PREFIX+"split-button-activeoption")){this._hideMenu();this._bOptionPressed=false;}else{this._showMenu(N);this._bOptionPressed=true;}},_onMenuShow:function(N){M.on(document,"mousedown",this._onDocumentMouseDown,null,this);var O=(this.get("type")=="split")?"activeoption":"active";this.addStateCSSClasses(O);},_onMenuHide:function(N){var O=(this.get("type")=="split")?"activeoption":"active";this.removeStateCSSClasses(O);if(this.get("type")=="split"){this._bOptionPressed=false;}},_onMenuKeyDown:function(P,O){var N=O[0];if(M.getCharCode(N)==27){this.focus();if(this.get("type")=="split"){this._bOptionPressed=false;}}},_onMenuRender:function(P){var S=this.get("element"),O=S.parentNode,N=this._menu,R=N.element,Q=N.srcElement,T;if(O!=R.parentNode){O.appendChild(R);}this._renderedMenu=true;if(Q&&Q.nodeName.toLowerCase()==="select"&&Q.value){T=N.getItem(Q.selectedIndex);this.set("selectedMenuItem",T,true);this._onSelectedMenuItemChange({newValue:T});}},_onMenuClick:function(O,N){var Q=N[1],P;if(Q){this.set("selectedMenuItem",Q);P=this.get("srcelement");if(P&&P.type=="submit"){this.submitForm();}this._hideMenu();}},_onSelectedMenuItemChange:function(O){var P=O.prevValue,Q=O.newValue,N=this.CLASS_NAME_PREFIX;if(P){G.removeClass(P.element,(N+"button-selectedmenuitem"));}if(Q){G.addClass(Q.element,(N+"button-selectedmenuitem"));}},_onLabelClick:function(N){this.focus();var O=this.get("type");if(O=="radio"||O=="checkbox"){this.set("checked",(!this.get("checked")));}},createButtonElement:function(N){var P=this.NODE_NAME,O=document.createElement(P);O.innerHTML="<"+P+' class="first-child">'+(N=="link"?" ":' ')+""+P+">";return O;},addStateCSSClasses:function(O){var P=this.get("type"),N=this.CLASS_NAME_PREFIX;if(I.isString(O)){if(O!="activeoption"&&O!="hoveroption"){this.addClass(N+this.CSS_CLASS_NAME+("-"+O));}this.addClass(N+P+("-button-"+O));}},removeStateCSSClasses:function(O){var P=this.get("type"),N=this.CLASS_NAME_PREFIX;if(I.isString(O)){this.removeClass(N+this.CSS_CLASS_NAME+("-"+O));this.removeClass(N+P+("-button-"+O));}},createHiddenFields:function(){this.removeHiddenFields();var V=this.getForm(),Z,O,S,X,Y,T,U,N,R,W,P,Q=false;if(V&&!this.get("disabled")){O=this.get("type");S=(O=="checkbox"||O=="radio");if((S&&this.get("checked"))||(E==this)){Z=F((S?O:"hidden"),this.get("name"),this.get("value"),this.get("checked"));if(Z){if(S){Z.style.display="none";}V.appendChild(Z);}}X=this._menu;if(J&&X&&(X instanceof J)){Y=this.get("selectedMenuItem");P=X.srcElement;Q=(P&&P.nodeName.toUpperCase()=="SELECT");if(Y){U=(Y.value===null||Y.value==="")?Y.cfg.getProperty("text"):Y.value;T=this.get("name");if(Q){W=P.name;}else{if(T){W=(T+"_options");}}if(U&&W){N=F("hidden",W,U);V.appendChild(N);}}else{if(Q){N=V.appendChild(P);}}}if(Z&&N){this._hiddenFields=[Z,N];}else{if(!Z&&N){this._hiddenFields=N;}else{if(Z&&!N){this._hiddenFields=Z;}}}R=this._hiddenFields;}return R;},removeHiddenFields:function(){var Q=this._hiddenFields,O,P;function N(R){if(G.inDocument(R)){R.parentNode.removeChild(R);}}if(Q){if(I.isArray(Q)){O=Q.length;if(O>0){P=O-1;do{N(Q[P]);}while(P--);}}else{N(Q);}this._hiddenFields=null;}},submitForm:function(){var Q=this.getForm(),P=this.get("srcelement"),O=false,N;if(Q){if(this.get("type")=="submit"||(P&&P.type=="submit")){E=this;}if(L.ie){O=Q.fireEvent("onsubmit");}else{N=document.createEvent("HTMLEvents");N.initEvent("submit",true,true);O=Q.dispatchEvent(N);}if((L.ie||L.webkit)&&O){Q.submit();}}return O;},init:function(P,d){var V=d.type=="link"?"a":"button",a=d.srcelement,S=P.getElementsByTagName(V)[0],U;if(!S){U=P.getElementsByTagName("input")[0];if(U){S=document.createElement("button");S.setAttribute("type","button");U.parentNode.replaceChild(S,U);}}this._button=S;YAHOO.widget.Button.superclass.init.call(this,P,d);var T=this.get("id"),Z=T+"-button";S.id=Z;var X,Q;var e=function(f){return(f.htmlFor===T);};var c=function(){Q.setAttribute((L.ie?"htmlFor":"for"),Z);};if(a&&this.get("type")!="link"){X=G.getElementsBy(e,"label");if(I.isArray(X)&&X.length>0){Q=X[0];}}D[T]=this;var b=this.CLASS_NAME_PREFIX;this.addClass(b+this.CSS_CLASS_NAME);this.addClass(b+this.get("type")+"-button");M.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this.on("click",this._onClick);var R=this.get("onclick");this.set("onclick",null);this.set("onclick",R);this.on("dblclick",this._onDblClick);var O;if(Q){if(this.get("replaceLabel")){this.set("label",Q.innerHTML);O=Q.parentNode;O.removeChild(Q);}else{this.on("appendTo",c);M.on(Q,"click",this._onLabelClick,null,this);this._label=Q;}}this.on("appendTo",this._onAppendTo);var N=this.get("container"),Y=this.get("element"),W=G.inDocument(Y);
+if(N){if(a&&a!=Y){O=a.parentNode;if(O){O.removeChild(a);}}if(I.isString(N)){M.onContentReady(N,this.appendTo,N,this);}else{this.on("init",function(){I.later(0,this,this.appendTo,N);});}}else{if(!W&&a&&a!=Y){O=a.parentNode;if(O){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:O});O.replaceChild(Y,a);this.fireEvent("appendTo",{type:"appendTo",target:O});}}else{if(this.get("type")!="link"&&W&&a&&a==Y){this._addListenersToForm();}}}this.fireEvent("init",{type:"init",target:this});},initAttributes:function(O){var N=O||{};YAHOO.widget.Button.superclass.initAttributes.call(this,N);this.setAttributeConfig("type",{value:(N.type||"push"),validator:I.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:N.label,validator:I.isString,method:this._setLabel});this.setAttributeConfig("value",{value:N.value});this.setAttributeConfig("name",{value:N.name,validator:I.isString});this.setAttributeConfig("tabindex",{value:N.tabindex,validator:I.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:N.title,validator:I.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(N.disabled||false),validator:I.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:N.href,validator:I.isString,method:this._setHref});this.setAttributeConfig("target",{value:N.target,validator:I.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(N.checked||false),validator:I.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:N.container,writeOnce:true});this.setAttributeConfig("srcelement",{value:N.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:true});this.setAttributeConfig("lazyloadmenu",{value:(N.lazyloadmenu===false?false:true),validator:I.isBoolean,writeOnce:true});this.setAttributeConfig("menuclassname",{value:(N.menuclassname||(this.CLASS_NAME_PREFIX+"button-menu")),validator:I.isString,method:this._setMenuClassName,writeOnce:true});this.setAttributeConfig("menuminscrollheight",{value:(N.menuminscrollheight||90),validator:I.isNumber});this.setAttributeConfig("menumaxheight",{value:(N.menumaxheight||0),validator:I.isNumber});this.setAttributeConfig("menualignment",{value:(N.menualignment||["tl","bl"]),validator:I.isArray});this.setAttributeConfig("selectedMenuItem",{value:null});this.setAttributeConfig("onclick",{value:N.onclick,method:this._setOnClick});this.setAttributeConfig("focusmenu",{value:(N.focusmenu===false?false:true),validator:I.isBoolean});this.setAttributeConfig("replaceLabel",{value:false,validator:I.isBoolean,writeOnce:true});},focus:function(){if(!this.get("disabled")){this._button.focus();}},blur:function(){if(!this.get("disabled")){this._button.blur();}},hasFocus:function(){return(C==this);},isActive:function(){return this.hasClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME+"-active");},getMenu:function(){return this._menu;},getForm:function(){var N=this._button,O;if(N){O=N.form;}return O;},getHiddenFields:function(){return this._hiddenFields;},destroy:function(){var P=this.get("element"),N=this._menu,T=this._label,O,S;if(N){if(K&&K.find(N)){K.remove(N);}N.destroy();}M.purgeElement(P);M.purgeElement(this._button);M.removeListener(document,"mouseup",this._onDocumentMouseUp);M.removeListener(document,"keyup",this._onDocumentKeyUp);M.removeListener(document,"mousedown",this._onDocumentMouseDown);if(T){M.removeListener(T,"click",this._onLabelClick);O=T.parentNode;O.removeChild(T);}var Q=this.getForm();if(Q){M.removeListener(Q,"reset",this._onFormReset);M.removeListener(Q,"submit",this._onFormSubmit);}this.unsubscribeAll();O=P.parentNode;if(O){O.removeChild(P);}delete D[this.get("id")];var R=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);S=G.getElementsByClassName(R,this.NODE_NAME,Q);if(I.isArray(S)&&S.length===0){M.removeListener(Q,"keypress",YAHOO.widget.Button.onFormKeyPress);}},fireEvent:function(O,N){var P=arguments[0];if(this.DOM_EVENTS[P]&&this.get("disabled")){return false;}return YAHOO.widget.Button.superclass.fireEvent.apply(this,arguments);},toString:function(){return("Button "+this.get("id"));}});YAHOO.widget.Button.onFormKeyPress=function(R){var P=M.getTarget(R),S=M.getCharCode(R),Q=P.nodeName&&P.nodeName.toUpperCase(),N=P.type,T=false,V,X,O,W;function U(a){var Z,Y;switch(a.nodeName.toUpperCase()){case"INPUT":case"BUTTON":if(a.type=="submit"&&!a.disabled){if(!T&&!O){O=a;}}break;default:Z=a.id;if(Z){V=D[Z];if(V){T=true;if(!V.get("disabled")){Y=V.get("srcelement");if(!X&&(V.get("type")=="submit"||(Y&&Y.type=="submit"))){X=V;}}}}break;}}if(S==13&&((Q=="INPUT"&&(N=="text"||N=="password"||N=="checkbox"||N=="radio"||N=="file"))||Q=="SELECT")){G.getElementsBy(U,"*",this);if(O){O.focus();}else{if(!O&&X){M.preventDefault(R);if(L.ie){X.get("element").fireEvent("onclick");}else{W=document.createEvent("HTMLEvents");W.initEvent("click",true,true);if(L.gecko<1.9){X.fireEvent("click",W);}else{X.get("element").dispatchEvent(W);}}}}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(N){var R=YAHOO.widget.Button.prototype,T=G.getElementsByClassName((R.CLASS_NAME_PREFIX+R.CSS_CLASS_NAME),"*",N),Q=T.length,S,O,P;if(Q>0){for(P=0;P0){F=H-1;do{this._buttons[F].set("disabled",G);}while(F--);}},_onKeyDown:function(K){var G=B.getTarget(K),I=B.getCharCode(K),H=G.parentNode.parentNode.id,J=E[H],F=-1;if(I==37||I==38){F=(J.index===0)?(this._buttons.length-1):(J.index-1);}else{if(I==39||I==40){F=(J.index===(this._buttons.length-1))?0:(J.index+1);}}if(F>-1){this.check(F);this.getButton(F).focus();}},_onAppendTo:function(H){var I=this._buttons,G=I.length,F;for(F=0;F0){this.addButtons(J);}function F(L){return(L.type=="radio");}J=C.getElementsBy(F,"input",this.get("element"));if(J.length>0){this.addButtons(J);}this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var G=this.get("container");if(G){if(D.isString(G)){B.onContentReady(G,function(){this.appendTo(G);},null,this);}else{this.appendTo(G);}}},initAttributes:function(G){var F=G||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,F);this.setAttributeConfig("name",{value:F.name,validator:D.isString});this.setAttributeConfig("disabled",{value:(F.disabled||false),validator:D.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:F.value});this.setAttributeConfig("container",{value:F.container,writeOnce:true});this.setAttributeConfig("checkedButton",{value:null});},addButton:function(J){var L,K,G,F,H,I;if(J instanceof A&&J.get("type")=="radio"){L=J;}else{if(!D.isString(J)&&!J.nodeName){J.type="radio";L=new A(J);}else{L=new A(J,{type:"radio"});}}if(L){F=this._buttons.length;H=L.get("name");I=this.get("name");L.index=F;this._buttons[F]=L;E[L.get("id")]=L;if(H!=I){L.set("name",I);}if(this.get("disabled")){L.set("disabled",true);}if(L.get("checked")){this.set("checkedButton",L);}K=L.get("element");G=this.get("element");if(K.parentNode!=G){G.appendChild(K);}L.on("checkedChange",this._onButtonCheckedChange,L,this);}return L;},addButtons:function(G){var H,I,J,F;if(D.isArray(G)){H=G.length;J=[];if(H>0){for(F=0;F0){F=this._buttons.length-1;do{this._buttons[F].index=F;}while(F--);}}},getButton:function(F){return this._buttons[F];},getButtons:function(){return this._buttons;},getCount:function(){return this._buttons.length;},focus:function(H){var I,G,F;if(D.isNumber(H)){I=this._buttons[H];if(I){I.focus();}}else{G=this.getCount();for(F=0;F0){G=this._buttons.length-1;do{this._buttons[G].destroy();}while(G--);}B.purgeElement(H);F.removeChild(H);},toString:function(){return("ButtonGroup "+this.get("id"));}});})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.8.0r4",build:"2449"});
\ No newline at end of file
diff --git a/lib/yui/2.8.0r4/button/button.js b/lib/yui/2.8.0r4/button/button.js
new file mode 100644
index 0000000000..b57c819e43
--- /dev/null
+++ b/lib/yui/2.8.0r4/button/button.js
@@ -0,0 +1,4633 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/**
+* @module button
+* @description The Button Control enables the creation of rich, graphical
+* buttons that function like traditional HTML form buttons. Unlike
+* traditional 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
+* Menu Control , 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.
+* The Button Control supports the following types:
+*
+* push
+* Basic push button that can execute a user-specified command when
+* pressed.
+* link
+* Navigates to a specified url when pressed.
+* submit
+* Submits the parent form when pressed.
+* reset
+* Resets the parent form when pressed.
+* checkbox
+* Maintains a "checked" state that can be toggled on and off.
+* radio
+* 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.
+* menu
+* When pressed will show/hide a menu.
+* split
+* Can execute a user-specified command or display a menu when pressed.
+*
+* @title Button
+* @namespace YAHOO.widget
+* @requires yahoo, dom, element, event
+* @optional container, menu
+*/
+
+
+(function () {
+
+
+ /**
+ * The Button class creates a rich, graphical button.
+ * @param {String} p_oElement String specifying the id attribute of the
+ * <input>
, <button>
,
+ * <a>
, or <span>
element to
+ * be used to create the button.
+ * @param {HTMLInputElement |
+ * HTMLButtonElement |HTMLElement } p_oElement Object reference for the
+ * <input>
, <button>
,
+ * <a>
, or <span>
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,
+ UA = YAHOO.env.ua,
+ 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 <input>
element of the
+ * specified type.
+ * @private
+ * @param {String} p_sType String specifying the type of
+ * <input>
element to create.
+ * @param {String} p_sName String specifying the name of
+ * <input>
element to create.
+ * @param {String} p_sValue String specifying the value of
+ * <input>
element to create.
+ * @param {String} p_bChecked Boolean specifying if the
+ * <input>
element is to be checked.
+ * @return {HTMLInputElement }
+ */
+ function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) {
+
+ var oInput,
+ sInput;
+
+ if (Lang.isString(p_sType) && Lang.isString(p_sName)) {
+
+ if (UA.ie) {
+
+ /*
+ For IE it is necessary to create the element with the
+ "type," "name," "value," and "checked" properties set all
+ at once.
+ */
+
+ 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 <input>
or <a>
) that
+ * map to Button configuration attributes and sets them into a collection
+ * that is passed to the Button constructor.
+ * @private
+ * @param {HTMLInputElement |HTMLAnchorElement } p_oElement Object reference to the HTML
+ * element (either <input>
or <span>
+ *
) 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(),
+ sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME),
+ 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 <button>
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, sClass + "-checked")) {
+
+ p_oAttributes.checked = true;
+
+ }
+
+ if (Dom.hasClass(oRootNode, sClass + "-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) {
+
+ if (!Overlay && YAHOO.widget.Overlay) {
+
+ Overlay = YAHOO.widget.Overlay;
+
+ }
+
+
+ if (!Menu && YAHOO.widget.Menu) {
+
+ Menu = YAHOO.widget.Menu;
+
+ }
+
+
+ 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
+ * <a>
or <button>
element.
+ * @default null
+ * @protected
+ * @type HTMLAnchorElement |HTMLButtonElement
+ */
+ _button: null,
+
+
+ /**
+ * @property _menu
+ * @description Object reference to the button's menu.
+ * @default null
+ * @protected
+ * @type {YAHOO.widget.Overlay |
+ * YAHOO.widget.Menu }
+ */
+ _menu: null,
+
+
+ /**
+ * @property _hiddenFields
+ * @description Object reference to the <input>
+ * element, or array of HTML form elements used to represent the button
+ * when its parent form is submitted.
+ * @default null
+ * @protected
+ * @type HTMLInputElement |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,
+
+
+ /**
+ * @property _nOptionRegionX
+ * @description Number representing the X coordinate of the leftmost edge of the Button's
+ * option region. Applies only to Buttons of type "split".
+ * @default 0
+ * @protected
+ * @type Number
+ */
+ _nOptionRegionX: 0,
+
+
+
+ // Constants
+
+ /**
+ * @property CLASS_NAME_PREFIX
+ * @description Prefix used for all class names applied to a Button.
+ * @default "yui-"
+ * @final
+ * @type String
+ */
+ CLASS_NAME_PREFIX: "yui-",
+
+
+ /**
+ * @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 "button"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "button",
+
+
+
+ // 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,
+ nGeckoVersion = UA.gecko;
+
+
+ if (nGeckoVersion && nGeckoVersion < 1.9 && Dom.inDocument(this.get("element"))) {
+
+ sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+ this.removeClass(sClass);
+
+ Lang.later(0, this, this.addClass, sClass);
+
+ }
+
+ },
+
+
+ /**
+ * @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) {
+
+ if (this.get("type") != "link") {
+
+ this._button.title = p_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");
+
+ if (sType == "checkbox" || sType == "radio") {
+
+ if (p_bChecked) {
+ this.addStateCSSClasses("checked");
+ }
+ else {
+ this.removeStateCSSClasses("checked");
+ }
+
+ }
+
+ },
+
+
+ /**
+ * @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,
+
+ /*
+ Boolean indicating if the value of p_oMenu is an instance
+ of YAHOO.widget.Menu or YAHOO.widget.Overlay.
+ */
+
+ bInstance = false,
+ oMenu,
+ oMenuElement,
+ oSrcElement;
+
+
+ function onAppendTo() {
+
+ oMenu.render(oButtonElement.parentNode);
+
+ this.removeListener("appendTo", onAppendTo);
+
+ }
+
+
+ function setMenuContainer() {
+
+ oMenu.cfg.queueProperty("container", oButtonElement.parentNode);
+
+ this.removeListener("appendTo", setMenuContainer);
+
+ }
+
+
+ function initMenu() {
+
+ var oContainer;
+
+ if (oMenu) {
+
+ Dom.addClass(oMenu.element, this.get("menuclassname"));
+ Dom.addClass(oMenu.element, this.CLASS_NAME_PREFIX + 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 (Menu && oMenu instanceof Menu) {
+
+ if (bLazyLoad) {
+
+ oContainer = this.get("container");
+
+ if (oContainer) {
+
+ oMenu.cfg.queueProperty("container", oContainer);
+
+ }
+ else {
+
+ this.on("appendTo", setMenuContainer);
+
+ }
+
+ }
+
+ oMenu.cfg.queueProperty("clicktohide", false);
+
+ oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);
+ oMenu.subscribe("click", this._onMenuClick, this, true);
+
+ this.on("selectedMenuItemChange", this._onSelectedMenuItemChange);
+
+ oSrcElement = oMenu.srcElement;
+
+ if (oSrcElement && oSrcElement.nodeName.toUpperCase() == "SELECT") {
+
+ oSrcElement.style.display = "none";
+ oSrcElement.parentNode.removeChild(oSrcElement);
+
+ }
+
+ }
+ else if (Overlay && oMenu instanceof Overlay) {
+
+ if (!m_oOverlayManager) {
+
+ m_oOverlayManager = new YAHOO.widget.OverlayManager();
+
+ }
+
+ m_oOverlayManager.register(oMenu);
+
+ }
+
+
+ this._menu = oMenu;
+
+
+ if (!bInstance && !bLazyLoad) {
+
+ if (Dom.inDocument(oButtonElement)) {
+
+ oMenu.render(oButtonElement.parentNode);
+
+ }
+ else {
+
+ this.on("appendTo", onAppendTo);
+
+ }
+
+ }
+
+ }
+
+ }
+
+
+ if (Overlay) {
+
+ if (Menu) {
+
+ sMenuCSSClassName = Menu.prototype.CSS_CLASS_NAME;
+
+ }
+
+ if (p_oMenu && Menu && (p_oMenu instanceof Menu)) {
+
+ oMenu = p_oMenu;
+ bInstance = true;
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay && p_oMenu && (p_oMenu instanceof Overlay)) {
+
+ oMenu = p_oMenu;
+ bInstance = true;
+
+ oMenu.cfg.queueProperty("visible", false);
+
+ initMenu.call(this);
+
+ }
+ else if (Menu && Lang.isArray(p_oMenu)) {
+
+ oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, itemdata: p_oMenu });
+
+ this._menu = oMenu;
+
+ this.on("appendTo", initMenu);
+
+ }
+ else if (Lang.isString(p_oMenu)) {
+
+ oMenuElement = Dom.get(p_oMenu);
+
+ if (oMenuElement) {
+
+ if (Menu && Dom.hasClass(oMenuElement, sMenuCSSClassName) ||
+ oMenuElement.nodeName.toUpperCase() == "SELECT") {
+
+ oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay) {
+
+ oMenu = new Overlay(p_oMenu, { visible: false });
+
+ initMenu.call(this);
+
+ }
+
+ }
+
+ }
+ else if (p_oMenu && p_oMenu.nodeName) {
+
+ if (Menu && Dom.hasClass(p_oMenu, sMenuCSSClassName) ||
+ p_oMenu.nodeName.toUpperCase() == "SELECT") {
+
+ oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad });
+
+ initMenu.call(this);
+
+ }
+ else if (Overlay) {
+
+ if (!p_oMenu.id) {
+
+ Dom.generateId(p_oMenu);
+
+ }
+
+ oMenu = new Overlay(p_oMenu, { visible: false });
+
+ 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;
+
+ }
+
+ },
+
+
+
+ // 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,
+ bReturnVal = false,
+ i;
+
+
+ if (nKeyCodes > 0) {
+
+ i = nKeyCodes - 1;
+
+ do {
+
+ if (p_nKeyCode == aKeyCodes[i]) {
+
+ bReturnVal = true;
+ break;
+
+ }
+
+ }
+ while (i--);
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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) {
+
+ var bShowMenu = (Event.getCharCode(p_oEvent) == 40);
+
+
+ var onKeyPress = function (p_oEvent) {
+
+ Event.preventDefault(p_oEvent);
+
+ this.removeListener("keypress", onKeyPress);
+
+ };
+
+
+ // Prevent the browser from scrolling the window
+ if (bShowMenu) {
+
+ if (UA.opera) {
+
+ this.on("keypress", onKeyPress);
+
+ }
+
+ Event.preventDefault(p_oEvent);
+ }
+
+ return bShowMenu;
+
+ },
+
+
+ /**
+ * @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._onFormSubmit, 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);
+
+ }
+
+ }
+
+ }
+
+ },
+
+
+
+ /**
+ * @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) {
+
+ if (YAHOO.widget.MenuManager) {
+ YAHOO.widget.MenuManager.hideVisible();
+ }
+
+
+ if (m_oOverlayManager) {
+ m_oOverlayManager.hideAll();
+ }
+
+
+ var oMenu = this._menu,
+ aMenuAlignment = this.get("menualignment"),
+ bFocusMenu = this.get("focusmenu"),
+ fnFocusMethod;
+
+
+ if (this._renderedMenu) {
+
+ oMenu.cfg.setProperty("context",
+ [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]);
+
+ oMenu.cfg.setProperty("preventcontextoverlap", true);
+ oMenu.cfg.setProperty("constraintoviewport", true);
+
+ }
+ else {
+
+ oMenu.cfg.queueProperty("context",
+ [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]);
+
+ oMenu.cfg.queueProperty("preventcontextoverlap", true);
+ oMenu.cfg.queueProperty("constraintoviewport", true);
+
+ }
+
+
+ /*
+ Refocus the Button before showing its Menu in case the call to
+ YAHOO.widget.MenuManager.hideVisible() resulted in another element in the
+ DOM being focused after another Menu was hidden.
+ */
+
+ this.focus();
+
+
+ if (Menu && oMenu && (oMenu instanceof Menu)) {
+
+ // Since Menus automatically focus themselves when made visible, temporarily
+ // replace the Menu focus method so that the value of the Button's "focusmenu"
+ // attribute determines if the Menu should be focus when made visible.
+
+ fnFocusMethod = oMenu.focus;
+
+ oMenu.focus = function () {};
+
+ if (this._renderedMenu) {
+
+ oMenu.cfg.setProperty("minscrollheight", this.get("menuminscrollheight"));
+ oMenu.cfg.setProperty("maxheight", this.get("menumaxheight"));
+
+ }
+ else {
+
+ oMenu.cfg.queueProperty("minscrollheight", this.get("menuminscrollheight"));
+ oMenu.cfg.queueProperty("maxheight", this.get("menumaxheight"));
+
+ }
+
+
+ oMenu.show();
+
+ oMenu.focus = fnFocusMethod;
+
+ oMenu.align();
+
+
+ /*
+ 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 (bFocusMenu) {
+ oMenu.focus();
+ }
+
+ }
+ else if (Overlay && oMenu && (oMenu instanceof Overlay)) {
+
+ if (!this._renderedMenu) {
+ oMenu.render(this.get("element").parentNode);
+ }
+
+ oMenu.show();
+ oMenu.align();
+
+ }
+
+ },
+
+
+ /**
+ * @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) {
+
+ var sType = this.get("type"),
+ oElement,
+ nOptionRegionX;
+
+
+ if (sType === "split") {
+
+ oElement = this.get("element");
+ nOptionRegionX =
+ (Dom.getX(oElement) + (oElement.offsetWidth - this.OPTION_AREA_WIDTH));
+
+ this._nOptionRegionX = nOptionRegionX;
+
+ }
+
+
+ if (!this._hasMouseEventHandlers) {
+
+ if (sType === "split") {
+
+ this.on("mousemove", this._onMouseMove);
+
+ }
+
+ this.on("mouseout", this._onMouseOut);
+
+ this._hasMouseEventHandlers = true;
+
+ }
+
+
+ this.addStateCSSClasses("hover");
+
+
+ if (sType === "split" && (Event.getPageX(p_oEvent) > nOptionRegionX)) {
+
+ this.addStateCSSClasses("hoveroption");
+
+ }
+
+
+ if (this._activationButtonPressed) {
+
+ this.addStateCSSClasses("active");
+
+ }
+
+
+ if (this._bOptionPressed) {
+
+ this.addStateCSSClasses("activeoption");
+
+ }
+
+
+ if (this._activationButtonPressed || this._bOptionPressed) {
+
+ Event.removeListener(document, "mouseup", this._onDocumentMouseUp);
+
+ }
+
+ },
+
+
+ /**
+ * @method _onMouseMove
+ * @description "mousemove" 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).
+ */
+ _onMouseMove: function (p_oEvent) {
+
+ var nOptionRegionX = this._nOptionRegionX;
+
+ if (nOptionRegionX) {
+
+ if (Event.getPageX(p_oEvent) > nOptionRegionX) {
+
+ this.addStateCSSClasses("hoveroption");
+
+ }
+ else {
+
+ this.removeStateCSSClasses("hoveroption");
+
+ }
+
+ }
+
+ },
+
+ /**
+ * @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) {
+
+ var sType = this.get("type");
+
+ this.removeStateCSSClasses("hover");
+
+
+ if (sType != "menu") {
+
+ this.removeStateCSSClasses("active");
+
+ }
+
+
+ if (this._activationButtonPressed || this._bOptionPressed) {
+
+ Event.on(document, "mouseup", this._onDocumentMouseUp, null, this);
+
+ }
+
+
+ if (sType === "split" && (Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
+
+ this.removeStateCSSClasses("hoveroption");
+
+ }
+
+ },
+
+
+ /**
+ * @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"),
+ oTarget,
+ oMenuElement;
+
+ if (sType == "menu" || sType == "split") {
+
+ oTarget = Event.getTarget(p_oEvent);
+ oMenuElement = this._menu.element;
+
+ if (oTarget != oMenuElement &&
+ !Dom.isAncestor(oMenuElement, oTarget)) {
+
+ 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,
+ bReturnVal = true;
+
+
+ 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") {
+
+ if (Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ this.fireEvent("option", p_oEvent);
+ bReturnVal = false;
+
+ }
+ 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") {
+
+ this._hideMenuTimer = Lang.later(250, this, this.on, ["mouseup", onMouseUp]);
+
+ }
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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"),
+ oHideMenuTimer = this._hideMenuTimer,
+ bReturnVal = true;
+
+
+ if (oHideMenuTimer) {
+
+ oHideMenuTimer.cancel();
+
+ }
+
+
+ if (sType == "checkbox" || sType == "radio") {
+
+ this.set("checked", !(this.get("checked")));
+
+ }
+
+
+ this._activationButtonPressed = false;
+
+
+ if (sType != "menu") {
+
+ this.removeStateCSSClasses("active");
+
+ }
+
+
+ if (sType == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ bReturnVal = false;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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"),
+ oForm,
+ oSrcElement,
+ bReturnVal;
+
+
+ switch (sType) {
+
+ case "submit":
+
+ if (p_oEvent.returnValue !== false) {
+
+ this.submitForm();
+
+ }
+
+ break;
+
+ case "reset":
+
+ oForm = this.getForm();
+
+ if (oForm) {
+
+ oForm.reset();
+
+ }
+
+ break;
+
+
+ case "split":
+
+ if (this._nOptionRegionX > 0 &&
+ (Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
+
+ bReturnVal = false;
+
+ }
+ else {
+
+ this._hideMenu();
+
+ oSrcElement = this.get("srcelement");
+
+ if (oSrcElement && oSrcElement.type == "submit" &&
+ p_oEvent.returnValue !== false) {
+
+ this.submitForm();
+
+ }
+
+ }
+
+ break;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @method _onDblClick
+ * @description "dblclick" 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).
+ */
+ _onDblClick: function (p_oEvent) {
+
+ var bReturnVal = true;
+
+ if (this.get("type") == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) {
+
+ bReturnVal = false;
+
+ }
+
+ return bReturnVal;
+
+ },
+
+
+ /**
+ * @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.
+ */
+
+ Lang.later(0, this, this._addListenersToForm);
+
+ },
+
+
+ /**
+ * @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 (Menu && oMenu && (oMenu instanceof Menu)) {
+
+ this.resetValue("selectedMenuItem");
+
+ }
+
+ },
+
+
+ /**
+ * @method _onFormSubmit
+ * @description "submit" 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).
+ */
+ _onFormSubmit: function (p_oEvent) {
+
+ this.createHiddenFields();
+
+ },
+
+
+ /**
+ * @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();
+
+ // In IE when the user mouses down on a focusable element
+ // that element will be focused and become the "activeElement".
+ // (http://msdn.microsoft.com/en-us/library/ms533065(VS.85).aspx)
+ // However, there is a bug in IE where if there is a
+ // positioned element with a focused descendant that is
+ // hidden in response to the mousedown event, the target of
+ // the mousedown event will appear to have focus, but will
+ // not be set as the activeElement. This will result
+ // in the element not firing key events, even though it
+ // appears to have focus. The following call to "setActive"
+ // fixes this bug.
+
+ if (UA.ie && oTarget.focus) {
+ oTarget.setActive();
+ }
+
+ 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(this.CLASS_NAME_PREFIX + "split-button-activeoption")) {
+
+ this._hideMenu();
+
+ this._bOptionPressed = false;
+
+ }
+ else {
+
+ this._showMenu(p_oEvent);
+
+ this._bOptionPressed = true;
+
+ }
+
+ },
+
+
+ /**
+ * @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 sState = (this.get("type") == "split") ? "activeoption" : "active";
+
+ this.addStateCSSClasses(sState);
+
+ },
+
+
+ /**
+ * @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 sState = (this.get("type") == "split") ? "activeoption" : "active";
+
+ this.removeStateCSSClasses(sState);
+
+
+ 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,
+ oMenu = this._menu,
+ oMenuElement = oMenu.element,
+ oSrcElement = oMenu.srcElement,
+ oItem;
+
+
+ if (oButtonParent != oMenuElement.parentNode) {
+
+ oButtonParent.appendChild(oMenuElement);
+
+ }
+
+ this._renderedMenu = true;
+
+ // If the user has designated an of the Menu's source
+ // element to be selected, sync the selectedIndex with
+ // the "selectedMenuItem" Attribute.
+
+ if (oSrcElement &&
+ oSrcElement.nodeName.toLowerCase() === "select" &&
+ oSrcElement.value) {
+
+
+ oItem = oMenu.getItem(oSrcElement.selectedIndex);
+
+ // Set the value of the "selectedMenuItem" attribute
+ // silently since this is the initial set--synchronizing
+ // the value of the source element in the DOM with
+ // its corresponding Menu instance.
+
+ this.set("selectedMenuItem", oItem, true);
+
+ // Call the "_onSelectedMenuItemChange" method since the
+ // attribute was set silently.
+
+ this._onSelectedMenuItemChange({ newValue: oItem });
+
+ }
+
+ },
+
+
+
+ /**
+ * @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) {
+
+ this.set("selectedMenuItem", oItem);
+
+ oSrcElement = this.get("srcelement");
+
+ if (oSrcElement && oSrcElement.type == "submit") {
+
+ this.submitForm();
+
+ }
+
+ this._hideMenu();
+
+ }
+
+ },
+
+
+ /**
+ * @method _onSelectedMenuItemChange
+ * @description "selectedMenuItemChange" event handler for the Button's
+ * "selectedMenuItem" attribute.
+ * @param {Event} event Object representing the DOM event object
+ * passed back by the event utility (YAHOO.util.Event).
+ */
+ _onSelectedMenuItemChange: function (event) {
+
+ var oSelected = event.prevValue,
+ oItem = event.newValue,
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (oSelected) {
+ Dom.removeClass(oSelected.element, (sPrefix + "button-selectedmenuitem"));
+ }
+
+ if (oItem) {
+ Dom.addClass(oItem.element, (sPrefix + "button-selectedmenuitem"));
+ }
+
+ },
+
+
+ /**
+ * @method _onLabelClick
+ * @description "click" event handler for the Button's
+ * <label>
element.
+ * @param {Event} event Object representing the DOM event object
+ * passed back by the event utility (YAHOO.util.Event).
+ */
+ _onLabelClick: function (event) {
+
+ this.focus();
+
+ var sType = this.get("type");
+
+ if (sType == "radio" || sType == "checkbox") {
+ this.set("checked", (!this.get("checked")));
+ }
+
+ },
+
+
+ // Public methods
+
+
+ /**
+ * @method createButtonElement
+ * @description Creates the button's HTML elements.
+ * @param {String} p_sType String indicating the type of element
+ * to create.
+ * @return {HTMLElement }
+ */
+ createButtonElement: function (p_sType) {
+
+ var sNodeName = this.NODE_NAME,
+ oElement = document.createElement(sNodeName);
+
+ oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" +
+ (p_sType == "link" ? " " :
+ " ") + "" + 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"),
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (Lang.isString(p_sState)) {
+
+ if (p_sState != "activeoption" && p_sState != "hoveroption") {
+
+ this.addClass(sPrefix + this.CSS_CLASS_NAME + ("-" + p_sState));
+
+ }
+
+ this.addClass(sPrefix + 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"),
+ sPrefix = this.CLASS_NAME_PREFIX;
+
+ if (Lang.isString(p_sState)) {
+
+ this.removeClass(sPrefix + this.CSS_CLASS_NAME + ("-" + p_sState));
+ this.removeClass(sPrefix + sType + ("-button-" + p_sState));
+
+ }
+
+ },
+
+
+ /**
+ * @method createHiddenFields
+ * @description Creates the button's hidden form field and appends it
+ * to its parent form.
+ * @return {HTMLInputElement |Array}
+ */
+ createHiddenFields: function () {
+
+ this.removeHiddenFields();
+
+ var oForm = this.getForm(),
+ oButtonField,
+ sType,
+ bCheckable,
+ oMenu,
+ oMenuItem,
+ sButtonName,
+ oValue,
+ oMenuField,
+ oReturnVal,
+ sMenuFieldName,
+ oMenuSrcElement,
+ bMenuSrcElementIsSelect = false;
+
+
+ if (oForm && !this.get("disabled")) {
+
+ sType = this.get("type");
+ bCheckable = (sType == "checkbox" || sType == "radio");
+
+
+ if ((bCheckable && this.get("checked")) || (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 (Menu && oMenu && (oMenu instanceof Menu)) {
+
+
+ oMenuItem = this.get("selectedMenuItem");
+ oMenuSrcElement = oMenu.srcElement;
+ bMenuSrcElementIsSelect = (oMenuSrcElement &&
+ oMenuSrcElement.nodeName.toUpperCase() == "SELECT");
+
+ if (oMenuItem) {
+
+ oValue = (oMenuItem.value === null || oMenuItem.value === "") ?
+ oMenuItem.cfg.getProperty("text") : oMenuItem.value;
+
+ sButtonName = this.get("name");
+
+
+ if (bMenuSrcElementIsSelect) {
+
+ sMenuFieldName = oMenuSrcElement.name;
+
+ }
+ else if (sButtonName) {
+
+ sMenuFieldName = (sButtonName + "_options");
+
+ }
+
+
+ if (oValue && sMenuFieldName) {
+
+ oMenuField = createInputElement("hidden", sMenuFieldName, oValue);
+ oForm.appendChild(oMenuField);
+
+ }
+
+ }
+ else if (bMenuSrcElementIsSelect) {
+
+ oMenuField = oForm.appendChild(oMenuSrcElement);
+
+ }
+
+ }
+
+
+ if (oButtonField && oMenuField) {
+
+ this._hiddenFields = [oButtonField, oMenuField];
+
+ }
+ else if (!oButtonField && oMenuField) {
+
+ this._hiddenFields = oMenuField;
+
+ }
+ else if (oButtonField && !oMenuField) {
+
+ this._hiddenFields = oButtonField;
+
+ }
+
+ oReturnVal = this._hiddenFields;
+
+ }
+
+ return oReturnVal;
+
+ },
+
+
+ /**
+ * @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 (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 ((UA.ie || 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
+ * <input>
, <button>
,
+ * <a>
, or <span>
element to
+ * be used to create the button.
+ * @param {HTMLInputElement |HTMLButtonElement |
+ * HTMLElement } p_oElement Object reference for the
+ * <input>
, <button>
,
+ * <a>
, or <span>
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);
+
+
+ var sId = this.get("id"),
+ sButtonId = sId + "-button";
+
+
+ oButton.id = sButtonId;
+
+
+ var aLabels,
+ oLabel;
+
+
+ var hasLabel = function (element) {
+
+ return (element.htmlFor === sId);
+
+ };
+
+
+ var setLabel = function () {
+
+ oLabel.setAttribute((UA.ie ? "htmlFor" : "for"), sButtonId);
+
+ };
+
+
+ if (oSrcElement && this.get("type") != "link") {
+
+ aLabels = Dom.getElementsBy(hasLabel, "label");
+
+ if (Lang.isArray(aLabels) && aLabels.length > 0) {
+
+ oLabel = aLabels[0];
+
+ }
+
+ }
+
+
+ m_oButtons[sId] = this;
+
+ var sPrefix = this.CLASS_NAME_PREFIX;
+
+ this.addClass(sPrefix + this.CSS_CLASS_NAME);
+ this.addClass(sPrefix + this.get("type") + "-button");
+
+ Event.on(this._button, "focus", this._onFocus, null, this);
+ this.on("mouseover", this._onMouseOver);
+ this.on("mousedown", this._onMouseDown);
+ this.on("mouseup", this._onMouseUp);
+ this.on("click", this._onClick);
+
+ // Need to reset the value of the "onclick" Attribute so that any
+ // handlers registered via the "onclick" Attribute are fired after
+ // Button's default "_onClick" listener.
+
+ var fnOnClick = this.get("onclick");
+
+ this.set("onclick", null);
+ this.set("onclick", fnOnClick);
+
+ this.on("dblclick", this._onDblClick);
+
+
+ var oParentNode;
+
+ if (oLabel) {
+
+ if (this.get("replaceLabel")) {
+
+ this.set("label", oLabel.innerHTML);
+
+ oParentNode = oLabel.parentNode;
+
+ oParentNode.removeChild(oLabel);
+
+ }
+ else {
+
+ this.on("appendTo", setLabel);
+
+ Event.on(oLabel, "click", this._onLabelClick, null, this);
+
+ this._label = oLabel;
+
+ }
+
+ }
+
+ this.on("appendTo", this._onAppendTo);
+
+
+
+ var oContainer = this.get("container"),
+ oElement = this.get("element"),
+ bElInDoc = Dom.inDocument(oElement);
+
+
+ if (oContainer) {
+
+ if (oSrcElement && oSrcElement != oElement) {
+
+ oParentNode = oSrcElement.parentNode;
+
+ if (oParentNode) {
+
+ oParentNode.removeChild(oSrcElement);
+
+ }
+
+ }
+
+ if (Lang.isString(oContainer)) {
+
+ Event.onContentReady(oContainer, this.appendTo, oContainer, this);
+
+ }
+ else {
+
+ this.on("init", function () {
+
+ Lang.later(0, this, 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();
+
+ }
+
+
+
+ this.fireEvent("init", {
+ type: "init",
+ target: this
+ });
+
+ },
+
+
+ /**
+ * @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
+ * @writeonce
+ */
+ 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 HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("container", {
+
+ value: oAttributes.container,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute srcelement
+ * @description Object reference to the HTML element (either
+ * <input>
or <span>
)
+ * used to create the button.
+ * @type HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ 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:
+ *
+ * Object specifying a rendered
+ * YAHOO.widget.Menu instance.
+ * Object specifying a rendered
+ * YAHOO.widget.Overlay instance.
+ * String specifying the id attribute of the <div>
+ *
element used to create the menu. By default the menu
+ * will be created as an instance of
+ * YAHOO.widget.Overlay .
+ * If the
+ * default CSS class name for YAHOO.widget.Menu is applied to
+ * the <div>
element, it will be created as an
+ * instance of YAHOO.widget.Menu
+ * . String specifying the id attribute of the
+ * <select>
element used to create the menu.
+ * Object specifying the <div>
element
+ * used to create the menu.
+ * Object specifying the <select>
element
+ * used to create the menu.
+ * Array of object literals, each representing a set of
+ * YAHOO.widget.MenuItem
+ * configuration attributes.
+ * Array of strings representing the text labels for each menu
+ * item in the menu.
+ *
+ * @type YAHOO.widget.Menu |YAHOO.widget.Overlay |HTMLElement |String|Array
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("menu", {
+
+ value: null,
+ method: this._setMenu,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute lazyloadmenu
+ * @description Boolean indicating the value to set for the
+ * "lazyload"
+ * configuration property of the button's menu. Setting
+ * "lazyloadmenu" to true
will defer rendering of
+ * the button's menu until the first time it is made visible.
+ * If "lazyloadmenu" is set to false
, 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.
+ * This attribute does not apply if a
+ * YAHOO.widget.Menu or
+ * YAHOO.widget.Overlay
+ * instance is passed as the value of the button's "menu"
+ * configuration attribute.
+ * YAHOO.widget.Menu or
+ * YAHOO.widget.Overlay instances should be rendered before
+ * being set as the value for the "menu" configuration
+ * attribute.
+ * @default true
+ * @type Boolean
+ * @writeonce
+ */
+ 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"
+ * @writeonce
+ */
+ this.setAttributeConfig("menuclassname", {
+
+ value: (oAttributes.menuclassname || (this.CLASS_NAME_PREFIX + "button-menu")),
+ validator: Lang.isString,
+ method: this._setMenuClassName,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute menuminscrollheight
+ * @description Number defining the minimum threshold for the "menumaxheight"
+ * configuration attribute. When set this attribute is automatically applied
+ * to all submenus.
+ * @default 90
+ * @type Number
+ */
+ this.setAttributeConfig("menuminscrollheight", {
+
+ value: (oAttributes.menuminscrollheight || 90),
+ validator: Lang.isNumber
+
+ });
+
+
+ /**
+ * @attribute menumaxheight
+ * @description Number defining the maximum height (in pixels) for a menu's
+ * body element (<div class="bd"<
). Once a menu's body
+ * exceeds this height, the contents of the body are scrolled to maintain
+ * this value. This value cannot be set lower than the value of the
+ * "minscrollheight" configuration property.
+ * @type Number
+ * @default 0
+ */
+ this.setAttributeConfig("menumaxheight", {
+
+ value: (oAttributes.menumaxheight || 0),
+ validator: Lang.isNumber
+
+ });
+
+
+ /**
+ * @attribute menualignment
+ * @description Array defining how the Button's Menu is aligned to the Button.
+ * The default value of ["tl", "bl"] aligns the Menu's top left corner to the Button's
+ * bottom left corner.
+ * @type Array
+ * @default ["tl", "bl"]
+ */
+ this.setAttributeConfig("menualignment", {
+
+ value: (oAttributes.menualignment || ["tl", "bl"]),
+ validator: Lang.isArray
+
+ });
+
+
+ /**
+ * @attribute selectedMenuItem
+ * @description Object representing the item in the button's menu
+ * that is currently selected.
+ * @type YAHOO.widget.MenuItem
+ * @default null
+ */
+ this.setAttributeConfig("selectedMenuItem", {
+
+ value: null
+
+ });
+
+
+ /**
+ * @attribute onclick
+ * @description Object literal representing the code to be executed
+ * when the button is clicked. Format: {
+ * fn: Function, // The handler to call
+ * when the event fires. obj: Object,
+ * // An object to pass back to the handler.
+ * scope: Object // The object to use
+ * for the scope of the handler. }
+ * @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
+
+ });
+
+
+ /**
+ * @attribute replaceLabel
+ * @description Boolean indicating whether or not the text of the
+ * button's <label>
element should be used as
+ * the source for the button's label configuration attribute and
+ * removed from the DOM.
+ * @type Boolean
+ * @default false
+ */
+ this.setAttributeConfig("replaceLabel", {
+
+ value: false,
+ validator: Lang.isBoolean,
+ writeOnce: true
+
+ });
+
+ },
+
+
+ /**
+ * @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.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME + "-active");
+
+ },
+
+
+ /**
+ * @method getMenu
+ * @description Returns a reference to the button's menu.
+ * @return {
+ * YAHOO.widget.Overlay |YAHOO.widget.Menu }
+ */
+ getMenu: function () {
+
+ return this._menu;
+
+ },
+
+
+ /**
+ * @method getForm
+ * @description Returns a reference to the button's parent form.
+ * @return {HTMLFormElement }
+ */
+ getForm: function () {
+
+ var oButton = this._button,
+ oForm;
+
+ if (oButton) {
+
+ oForm = oButton.form;
+
+ }
+
+ return oForm;
+
+ },
+
+
+ /**
+ * @method getHiddenFields
+ * @description Returns an <input>
element or
+ * array of form elements used to represent the button when its parent
+ * form is submitted.
+ * @return {HTMLInputElement |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"),
+ oMenu = this._menu,
+ oLabel = this._label,
+ oParentNode,
+ aButtons;
+
+ if (oMenu) {
+
+
+ if (m_oOverlayManager && 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);
+
+
+ if (oLabel) {
+
+ Event.removeListener(oLabel, "click", this._onLabelClick);
+
+ oParentNode = oLabel.parentNode;
+ oParentNode.removeChild(oLabel);
+
+ }
+
+
+ var oForm = this.getForm();
+
+ if (oForm) {
+
+ Event.removeListener(oForm, "reset", this._onFormReset);
+ Event.removeListener(oForm, "submit", this._onFormSubmit);
+
+ }
+
+
+ this.unsubscribeAll();
+
+ oParentNode = oElement.parentNode;
+
+ if (oParentNode) {
+
+ oParentNode.removeChild(oElement);
+
+ }
+
+
+ delete m_oButtons[this.get("id")];
+
+ var sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+ aButtons = Dom.getElementsByClassName(sClass,
+ 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) {
+
+ var sType = arguments[0];
+
+ // Disabled buttons should not respond to DOM events
+
+ if (this.DOM_EVENTS[sType] && this.get("disabled")) {
+
+ return false;
+
+ }
+
+ return YAHOO.widget.Button.superclass.fireEvent.apply(this, arguments);
+
+ },
+
+
+ /**
+ * @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,
+
+ oEvent;
+
+
+ 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;
+
+ }
+
+ }
+
+ 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) {
+
+ /*
+ Need to call "preventDefault" to ensure that the form doesn't end up getting
+ submitted twice.
+ */
+
+ Event.preventDefault(p_oEvent);
+
+
+ if (UA.ie) {
+
+ oYUISubmitButton.get("element").fireEvent("onclick");
+
+ }
+ else {
+
+ oEvent = document.createEvent("HTMLEvents");
+ oEvent.initEvent("click", true, true);
+
+
+ if (UA.gecko < 1.9) {
+
+ oYUISubmitButton.fireEvent("click", oEvent);
+
+ }
+ else {
+
+ oYUISubmitButton.get("element").dispatchEvent(oEvent);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * @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 {HTMLFormElement } p_oForm Object reference
+ * for the form to search.
+ */
+ YAHOO.widget.Button.addHiddenFieldsToForm = function (p_oForm) {
+
+ var proto = YAHOO.widget.Button.prototype,
+ aButtons = Dom.getElementsByClassName(
+ (proto.CLASS_NAME_PREFIX + proto.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();
+
+ }
+
+ }
+
+ }
+
+ }
+
+ };
+
+
+ /**
+ * @method YAHOO.widget.Button.getButton
+ * @description Returns a button with the specified id.
+ * @param {String} p_sId String specifying the id of the root node of the
+ * HTML element representing the button to be retrieved.
+ * @return {YAHOO.widget.Button}
+ */
+ YAHOO.widget.Button.getButton = function (p_sId) {
+
+ return m_oButtons[p_sId];
+
+ };
+
+
+ // 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
+ * Element.addListener
+ * 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
+ * Element.addListener 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
+ * Element.addListener
+ * 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
+ * <div>
element of the button group.
+ * @param {HTMLDivElement } p_oElement Object
+ * specifying the <div>
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 CLASS_NAME_PREFIX
+ * @description Prefix used for all class names applied to a ButtonGroup.
+ * @default "yui-"
+ * @final
+ * @type String
+ */
+ CLASS_NAME_PREFIX: "yui-",
+
+
+ /**
+ * @property CSS_CLASS_NAME
+ * @description String representing the CSS class(es) to be applied
+ * to the button group's element.
+ * @default "buttongroup"
+ * @final
+ * @type String
+ */
+ CSS_CLASS_NAME: "buttongroup",
+
+
+
+ // Protected methods
+
+
+ /**
+ * @method _createGroupElement
+ * @description Creates the button group's element.
+ * @protected
+ * @return {HTMLDivElement }
+ */
+ _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 {YAHOO.widget.Button }
+ * 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
+ * <div>
element of the button group.
+ * @param {HTMLDivElement } p_oElement Object
+ * specifying the <div>
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.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME);
+
+
+ var sClass = (YAHOO.widget.Button.prototype.CLASS_NAME_PREFIX + "radio-button"),
+ aButtons = this.getElementsByClassName(sClass);
+
+
+
+ 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 HTMLElement |String
+ * @default null
+ * @writeonce
+ */
+ this.setAttributeConfig("container", {
+
+ value: oAttributes.container,
+ writeOnce: true
+
+ });
+
+
+ /**
+ * @attribute checkedButton
+ * @description Reference for the button in the button group that
+ * is checked.
+ * @type {YAHOO.widget.Button }
+ * @default null
+ */
+ this.setAttributeConfig("checkedButton", {
+
+ value: null
+
+ });
+
+ },
+
+
+ /**
+ * @method addButton
+ * @description Adds the button to the button group.
+ * @param {YAHOO.widget.Button }
+ * p_oButton Object reference for the
+ * YAHOO.widget.Button instance to be added to the button group.
+ * @param {String} p_oButton String specifying the id attribute of the
+ * <input>
or <span>
element
+ * to be used to create the button to be added to the button group.
+ * @param {HTMLInputElement |HTMLElement } p_oButton Object reference for the
+ * <input>
or <span>
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
+ * YAHOO.widget.Button
+ * configuration attributes used to configure the button to be added to
+ * the button group.
+ * @return {YAHOO.widget.Button }
+ */
+ 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
+ * YAHOO.widget.Button instances to be added
+ * to the button group.
+ * @param {Array} p_aButtons Array of strings specifying the id
+ * attribute of the <input>
or <span>
+ *
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
+ * <input>
or <span>
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 YAHOO.widget.Button
+ * 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;
+
+ }
+
+ }
+
+ }
+
+ }
+
+ 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 {YAHOO.widget.Button }
+ */
+ getButton: function (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.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/calendar/assets/calendar-core.css b/lib/yui/2.8.0r4/calendar/assets/calendar-core.css
new file mode 100644
index 0000000000..6dee4a48df
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/assets/calendar-core.css
@@ -0,0 +1,132 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/**
+ * CORE
+ *
+ * This is the set of CSS rules required by Calendar to drive core functionality and structure.
+ * Changes to these rules may result in the Calendar not functioning or rendering correctly.
+ *
+ * They should not be modified for skinning.
+ **/
+
+/* CALENDAR BOUNDING BOX */
+.yui-calcontainer {
+ position:relative;
+ float:left;
+ _overflow:hidden; /* IE6 only, to clip iframe shim */
+}
+
+/* IFRAME SHIM */
+.yui-calcontainer iframe {
+ position:absolute;
+ border:none;
+ margin:0;padding:0;
+ z-index:0;
+ width:100%;
+ height:100%;
+ left:0px;
+ top:0px;
+}
+
+/* IFRAME SHIM IE6 only */
+.yui-calcontainer iframe.fixedsize {
+ width:50em;
+ height:50em;
+ top:-1px;
+ left:-1px;
+}
+
+/* BOUNDING BOX FOR EACH CALENDAR GROUP PAGE */
+.yui-calcontainer.multi .groupcal {
+ z-index:1;
+ float:left;
+ position:relative;
+}
+
+/* TITLE BAR */
+.yui-calcontainer .title {
+ position:relative;
+ z-index:1;
+}
+
+/* CLOSE ICON CONTAINER */
+.yui-calcontainer .close-icon {
+ position:absolute;
+ z-index:1;
+ text-indent:-10000em;
+ overflow:hidden;
+}
+
+/* CALENDAR TABLE */
+.yui-calendar {
+ position:relative;
+}
+
+/* NAVBAR LEFT ARROW CONTAINER */
+.yui-calendar .calnavleft {
+ position:absolute;
+ z-index:1;
+ text-indent:-10000em;
+ overflow:hidden;
+}
+
+/* NAVBAR RIGHT ARROW CONTAINER */
+.yui-calendar .calnavright {
+ position:absolute;
+ z-index:1;
+ text-indent:-10000em;
+ overflow:hidden;
+}
+
+/* NAVBAR TEXT CONTAINER */
+.yui-calendar .calheader {
+ position:relative;
+ width:100%;
+ text-align:center;
+}
+
+/* CalendarNavigator */
+.yui-calcontainer .yui-cal-nav-mask {
+ position:absolute;
+ z-index:2;
+ margin:0;
+ padding:0;
+ width:100%;
+ height:100%;
+ _width:0; /* IE6, IE7 quirks - width/height set programmatically to match container */
+ _height:0;
+ left:0;
+ top:0;
+ display:none;
+}
+
+/* NAVIGATOR BOUNDING BOX */
+.yui-calcontainer .yui-cal-nav {
+ position:absolute;
+ z-index:3;
+ top:0;
+ display:none;
+}
+
+/* NAVIGATOR BUTTONS (based on button-core.css) */
+.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn {
+ display: -moz-inline-box; /* Gecko */
+ display: inline-block; /* IE, Opera and Safari */
+}
+
+.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button {
+ display: block;
+ *display: inline-block; /* IE */
+ *overflow: visible; /* Remove superfluous padding for IE */
+ border: none;
+ background-color: transparent;
+ cursor: pointer;
+}
+
+/* Specific changes for calendar running under fonts/reset */
+.yui-calendar .calbody a:hover {background:inherit;}
+p#clear {clear:left; padding-top:10px;}
\ No newline at end of file
diff --git a/lib/yui/2.8.0r4/calendar/assets/calendar.css b/lib/yui/2.8.0r4/calendar/assets/calendar.css
new file mode 100644
index 0000000000..1faa711f2d
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/assets/calendar.css
@@ -0,0 +1,320 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-calcontainer {
+ position:relative;
+ padding:5px;
+ background-color:#F7F9FB;
+ border:1px solid #7B9EBD;
+ float:left;
+ _overflow:hidden; /* IE6 only, to clip iframe shim */
+}
+
+.yui-calcontainer iframe {
+ position:absolute;
+ border:none;
+ margin:0;padding:0;
+ z-index:0;
+ width:100%;
+ height:100%;
+ left:0px;
+ top:0px;
+}
+
+/* IE6 only */
+.yui-calcontainer iframe.fixedsize {
+ width:50em;
+ height:50em;
+ top:-1px;
+ left:-1px;
+}
+
+.yui-calcontainer.multi {
+ padding:0;
+}
+
+.yui-calcontainer.multi .groupcal {
+ padding:5px;
+ background-color:transparent;
+ z-index:1;
+ float:left;
+ position:relative;
+ border:none;
+}
+
+.yui-calcontainer .title {
+ font:100% sans-serif;
+ color:#000;
+ font-weight:bold;
+ margin-bottom:5px;
+ height:25px;
+ position:absolute;
+ top:3px;left:5px;
+ z-index:1;
+}
+
+.yui-calcontainer .close-icon {
+ position:absolute;
+ overflow:hidden;
+ text-indent:-10000em;
+ right:3px;
+ top:3px;
+ border:none;
+ z-index:1;
+}
+
+.yui-calcontainer .calclose {
+ background: url("calx.gif") no-repeat;
+ width:17px;
+ height:13px;
+ cursor:pointer;
+}
+
+/* Calendar element styles */
+
+.yui-calendar {
+ font:100% sans-serif;
+ text-align:center;
+ border-spacing:0;
+ border-collapse:separate;
+ position:relative;
+}
+
+.yui-calcontainer.withtitle {
+ padding-top:1.5em;
+}
+
+.yui-calendar .calnavleft {
+ position:absolute;
+ overflow:hidden;
+ text-indent:-10000em;
+ cursor:pointer;
+ top:2px;
+ bottom:0;
+ width:9px;
+ height:12px;
+ left:2px;
+ z-index:1;
+ background: url("callt.gif") no-repeat;
+}
+
+.yui-calendar .calnavright {
+ position:absolute;
+ overflow:hidden;
+ text-indent:-10000em;
+ cursor:pointer;
+ top:2px;
+ bottom:0;
+ width:9px;
+ height:12px;
+ right:2px;
+ z-index:1;
+ background: url("calrt.gif") no-repeat;
+}
+
+.yui-calendar td.calcell {
+ padding:.1em .2em;
+ border:1px solid #E0E0E0;
+ text-align:center;
+}
+
+.yui-calendar td.calcell a {
+ color:#003DB8;
+ text-decoration:none;
+}
+
+.yui-calendar td.calcell.today {
+ border:1px solid #000;
+}
+
+.yui-calendar td.calcell.oom {
+ cursor:default;
+ color:#999;
+ background-color:#EEE;
+ border:1px solid #E0E0E0;
+}
+
+.yui-calendar td.calcell.selected {
+ color:#003DB8;
+ background-color:#FFF19F;
+ border:1px solid #FF9900;
+}
+
+.yui-calendar td.calcell.calcellhover {
+ cursor:pointer;
+ color:#FFF;
+ background-color:#FF9900;
+ border:1px solid #FF9900;
+}
+
+.yui-calendar td.calcell.calcellhover a {
+ color:#FFF;
+}
+
+.yui-calendar td.calcell.restricted {
+ text-decoration:line-through;
+}
+
+.yui-calendar td.calcell.previous {
+ color:#CCC;
+}
+
+.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }
+.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }
+.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }
+.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }
+
+.yui-calendar .calhead {
+ border:1px solid #E0E0E0;
+ vertical-align:middle;
+ background-color:#FFF;
+}
+
+.yui-calendar .calheader {
+ position:relative;
+ width:100%;
+ text-align:center;
+}
+
+.yui-calendar .calheader img {
+ border:none;
+}
+
+.yui-calendar .calweekdaycell {
+ color:#666;
+ font-weight:normal;
+ text-align:center;
+ width:1.5em;
+}
+
+.yui-calendar .calfoot {
+ background-color:#EEE;
+}
+
+.yui-calendar .calrowhead, .yui-calendar .calrowfoot {
+ color:#666;
+ font-size:9px;
+ font-style:italic;
+ font-weight:normal;
+ width:15px;
+}
+
+.yui-calendar .calrowhead {
+ border-right-width:2px;
+}
+
+/* CalendarNavigator */
+.yui-calendar a.calnav {
+ _position:relative;
+ padding-left:2px;
+ padding-right:2px;
+ text-decoration:none;
+ color:#000;
+}
+
+.yui-calendar a.calnav:hover {
+ border:1px solid #003366;
+ background-color:#6699cc;
+ background: url(calgrad.png) repeat-x;
+ color:#fff;
+ cursor:pointer;
+}
+
+.yui-calcontainer .yui-cal-nav-mask {
+ position:absolute;
+ z-index:2;
+ display:none;
+
+ margin:0;
+ padding:0;
+
+ left:0;
+ top:0;
+ width:100%;
+ height:100%;
+ _width:0; /* IE6, IE7 Quirks - width/height set programmatically to match container */
+ _height:0;
+
+ background-color:#000;
+ opacity:0.25;
+ *filter:alpha(opacity=25);
+}
+
+.yui-calcontainer .yui-cal-nav {
+ position:absolute;
+ z-index:3;
+ display:none;
+
+ padding:0;
+ top:1.5em;
+ left:50%;
+ width:12em;
+ margin-left:-6em;
+
+ border:1px solid #7B9EBD;
+ background-color:#F7F9FB;
+ font-size:93%;
+}
+
+.yui-calcontainer.withtitle .yui-cal-nav {
+ top:3.5em;
+}
+
+.yui-calcontainer .yui-cal-nav-y,
+.yui-calcontainer .yui-cal-nav-m,
+.yui-calcontainer .yui-cal-nav-b {
+ padding:2px 5px 2px 5px;
+}
+
+.yui-calcontainer .yui-cal-nav-b {
+ text-align:center;
+}
+
+.yui-calcontainer .yui-cal-nav-e {
+ margin-top:2px;
+ padding:2px;
+ background-color:#EDF5FF;
+ border-top:1px solid black;
+ display:none;
+}
+
+.yui-calcontainer .yui-cal-nav label {
+ display:block;
+ font-weight:bold;
+}
+
+.yui-calcontainer .yui-cal-nav-mc {
+ width:100%;
+ _width:auto; /* IE6 doesn't like width 100% */
+}
+
+.yui-calcontainer .yui-cal-nav-y input.yui-invalid {
+ background-color:#FFEE69;
+ border: 1px solid #000;
+}
+
+.yui-calcontainer .yui-cal-nav-yc {
+ width:3em;
+}
+
+.yui-calcontainer .yui-cal-nav-b button {
+ font-size:93%;
+ text-decoration:none;
+ cursor: pointer;
+ background-color: #79b2ea;
+ border: 1px solid #003366;
+ border-top-color:#FFF;
+ border-left-color:#FFF;
+ margin:1px;
+}
+
+.yui-calcontainer .yui-cal-nav-b .yui-default button {
+ /* not implemented */
+}
+
+/* Specific changes for calendar running under fonts/reset */
+.yui-calendar .calbody a:hover {background:inherit;}
+p#clear {clear:left; padding-top:10px;}
diff --git a/lib/yui/2.8.0r4/calendar/assets/calgrad.png b/lib/yui/2.8.0r4/calendar/assets/calgrad.png
new file mode 100644
index 0000000000..9be3d958c7
Binary files /dev/null and b/lib/yui/2.8.0r4/calendar/assets/calgrad.png differ
diff --git a/lib/yui/2.8.0r4/calendar/assets/callt.gif b/lib/yui/2.8.0r4/calendar/assets/callt.gif
new file mode 100644
index 0000000000..a6cc8da5b2
Binary files /dev/null and b/lib/yui/2.8.0r4/calendar/assets/callt.gif differ
diff --git a/lib/yui/2.8.0r4/calendar/assets/calrt.gif b/lib/yui/2.8.0r4/calendar/assets/calrt.gif
new file mode 100644
index 0000000000..ee137b2ff7
Binary files /dev/null and b/lib/yui/2.8.0r4/calendar/assets/calrt.gif differ
diff --git a/lib/yui/2.8.0r4/calendar/assets/calx.gif b/lib/yui/2.8.0r4/calendar/assets/calx.gif
new file mode 100644
index 0000000000..27e7bc36e4
Binary files /dev/null and b/lib/yui/2.8.0r4/calendar/assets/calx.gif differ
diff --git a/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar-skin.css b/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar-skin.css
new file mode 100644
index 0000000000..f659c32640
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar-skin.css
@@ -0,0 +1,361 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/**
+ * SAM
+ *
+ * Skin colors used:
+ *
+ * - Control Border : 808080
+ * - Control Chrome : f2f2f2
+ * - Cell Borders : cccccc
+ * - Normal Cell BG : ffffff
+ * - Date Links : 0066cc
+ * - Selected Cells BG : b3d4ff
+ * - Cell Hover BG : 426fd9
+ * - Disabled BG : cccccc
+ * - Disabled Text Color : a6a6a6
+ **/
+
+/* CALENDAR BOUNDING BOX */
+.yui-skin-sam .yui-calcontainer {
+ background-color:#f2f2f2;
+ border:1px solid #808080;
+ padding:10px;
+}
+
+/* CALENDARGROUP BOUNDING BOX */
+.yui-skin-sam .yui-calcontainer.multi {
+ padding:0 5px 0 5px;
+}
+
+/* BOUNDING BOX FOR EACH CALENDAR GROUP PAGE */
+.yui-skin-sam .yui-calcontainer.multi .groupcal {
+ background-color:transparent;
+ border:none;
+ padding:10px 5px 10px 5px;
+ margin:0;
+}
+
+/* TITLE BAR */
+.yui-skin-sam .yui-calcontainer .title {
+ background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;
+ border-bottom:1px solid #cccccc;
+ font:100% sans-serif;
+ color:#000;
+ font-weight:bold;
+ height:auto;
+ padding:.4em;
+ margin:0 -10px 10px -10px;
+ top:0;
+ left:0;
+ text-align:left;
+}
+
+.yui-skin-sam .yui-calcontainer.multi .title {
+ margin:0 -5px 0 -5px;
+}
+
+.yui-skin-sam .yui-calcontainer.withtitle {
+ padding-top:0;
+}
+
+/* CLOSE BUTTON */
+.yui-skin-sam .yui-calcontainer .calclose {
+ background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -300px;
+ width:25px;
+ height:15px;
+ top:.4em;
+ right:.4em;
+ cursor:pointer;
+}
+
+/* CALENDAR TABLE */
+.yui-skin-sam .yui-calendar {
+ border-spacing:0;
+ border-collapse:collapse;
+ font:100% sans-serif;
+ text-align:center;
+ margin:0;
+}
+
+/* NAVBAR BOUNDING BOX */
+.yui-skin-sam .yui-calendar .calhead {
+ background:transparent;
+ border:none;
+ vertical-align:middle;
+ padding:0;
+}
+
+/* NAVBAR TEXT CONTAINER */
+.yui-skin-sam .yui-calendar .calheader {
+ background:transparent;
+ font-weight:bold;
+ padding:0 0 .6em 0;
+ text-align:center;
+}
+
+.yui-skin-sam .yui-calendar .calheader img {
+ border:none;
+}
+
+/* NAVBAR LEFT ARROW */
+.yui-skin-sam .yui-calendar .calnavleft {
+ background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -450px;
+ width:25px;
+ height:15px;
+ top:0;
+ bottom:0;
+ left:-10px;
+ margin-left:.4em;
+ cursor:pointer;
+}
+
+/* NAVBAR RIGHT ARROW */
+.yui-skin-sam .yui-calendar .calnavright {
+ background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -500px;
+ width:25px;
+ height:15px;
+ top:0;
+ bottom:0;
+ right:-10px;
+ margin-right:.4em;
+ cursor:pointer;
+}
+
+/* WEEKDAY HEADER ROW */
+.yui-skin-sam .yui-calendar .calweekdayrow {
+ height:2em;
+}
+
+.yui-skin-sam .yui-calendar .calweekdayrow th {
+ padding:0;
+ border:none;
+}
+
+/* WEEKDAY (Su, Mo, Tu...) HEADER CELLS */
+.yui-skin-sam .yui-calendar .calweekdaycell {
+ color:#000;
+ font-weight:bold;
+ text-align:center;
+ width:2em;
+}
+
+/* CALENDAR FOOTER. NOT IMPLEMENTED BY DEFAULT */
+.yui-skin-sam .yui-calendar .calfoot {
+ background-color:#f2f2f2;
+}
+
+/* WEEK NUMBERS (ROW HEADERS/FOOTERS) */
+.yui-skin-sam .yui-calendar .calrowhead, .yui-skin-sam .yui-calendar .calrowfoot {
+ color:#a6a6a6;
+ font-size:85%;
+ font-style:normal;
+ font-weight:normal;
+ border:none;
+}
+
+.yui-skin-sam .yui-calendar .calrowhead {
+ text-align:right;
+ padding:0 2px 0 0;
+}
+
+.yui-skin-sam .yui-calendar .calrowfoot {
+ text-align:left;
+ padding:0 0 0 2px;
+}
+
+/* NORMAL CELLS */
+.yui-skin-sam .yui-calendar td.calcell {
+ border:1px solid #cccccc;
+ background:#fff;
+ padding:1px;
+ height:1.6em;
+ line-height:1.6em; /* set line height equal to cell height to center vertically */
+ text-align:center;
+ white-space:nowrap;
+}
+
+/* LINK INSIDE NORMAL CELLS */
+.yui-skin-sam .yui-calendar td.calcell a {
+ color:#0066cc;
+ display:block;
+ height:100%;
+ text-decoration:none;
+}
+
+/* TODAY'S DATE */
+.yui-skin-sam .yui-calendar td.calcell.today {
+ background-color:#000;
+}
+
+.yui-skin-sam .yui-calendar td.calcell.today a {
+ background-color:#fff;
+}
+
+/* OOM DATES */
+.yui-skin-sam .yui-calendar td.calcell.oom {
+ background-color:#cccccc;
+ color:#a6a6a6;
+ cursor:default;
+}
+
+/* SELECTED DATE */
+.yui-skin-sam .yui-calendar td.calcell.selected {
+ background-color:#fff;
+ color:#000;
+}
+
+.yui-skin-sam .yui-calendar td.calcell.selected a {
+ background-color:#b3d4ff;
+ color:#000;
+}
+
+/* HOVER DATE */
+.yui-skin-sam .yui-calendar td.calcell.calcellhover {
+ background-color:#426fd9;
+ color:#fff;
+ cursor:pointer;
+}
+
+.yui-skin-sam .yui-calendar td.calcell.calcellhover a {
+ background-color:#426fd9;
+ color:#fff;
+}
+
+/* DEFAULT OOB DATES */
+.yui-skin-sam .yui-calendar td.calcell.previous {
+ color:#e0e0e0;
+}
+
+/* CUSTOM RENDERERS */
+.yui-skin-sam .yui-calendar td.calcell.restricted { text-decoration:line-through; }
+.yui-skin-sam .yui-calendar td.calcell.highlight1 { background-color:#ccff99; }
+.yui-skin-sam .yui-calendar td.calcell.highlight2 { background-color:#99ccff; }
+.yui-skin-sam .yui-calendar td.calcell.highlight3 { background-color:#ffcccc; }
+.yui-skin-sam .yui-calendar td.calcell.highlight4 { background-color:#ccff99; }
+
+/* CalendarNavigator */
+
+/* MONTH/YEAR LABEL */
+.yui-skin-sam .yui-calendar a.calnav {
+ border: 1px solid #f2f2f2;
+ padding:0 4px;
+ text-decoration:none;
+ color:#000;
+ zoom:1;
+}
+
+.yui-skin-sam .yui-calendar a.calnav:hover {
+ background: url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;
+ border-color:#A0A0A0;
+ cursor:pointer;
+}
+
+/* NAVIGATOR MASK */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-mask {
+ background-color:#000;
+ opacity:0.25;
+ filter:alpha(opacity=25); /* IE */
+}
+
+/* NAVIGATOR BOUNDING BOX */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav {
+ font-family:arial,helvetica,clean,sans-serif;
+ font-size:93%;
+ border:1px solid #808080;
+ left:50%;
+ margin-left:-7em;
+ width:14em;
+ padding:0;
+ top:2.5em;
+ background-color:#f2f2f2;
+}
+
+.yui-skin-sam .yui-calcontainer.withtitle .yui-cal-nav {
+ top:4.5em;
+}
+
+/* NAVIGATOR BOUNDING BOX */
+.yui-skin-sam .yui-calcontainer.multi .yui-cal-nav {
+ width:16em;
+ margin-left:-8em;
+}
+
+/* NAVIGATOR YEAR/MONTH/BUTTON/ERROR BOUNDING BLOCKS */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-y,
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-m,
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-b {
+ padding:5px 10px 5px 10px;
+}
+
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-b {
+ text-align:center;
+}
+
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-e {
+ margin-top:5px;
+ padding:5px;
+ background-color:#EDF5FF;
+ border-top:1px solid black;
+ display:none;
+}
+
+/* NAVIGATOR LABELS */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav label {
+ display:block;
+ font-weight:bold;
+}
+
+/* NAVIGATOR MONTH CONTROL */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-mc {
+ width:100%;
+ _width:auto; /* IE6, IE7 Quirks don't handle 100% well */
+}
+
+/* NAVIGATOR MONTH CONTROL, VALIDATION ERROR */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-y input.yui-invalid {
+ background-color:#FFEE69;
+ border: 1px solid #000;
+}
+
+/* NAVIGATOR YEAR CONTROL */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-yc {
+ width:4em;
+}
+
+/* NAVIGATOR BUTTONS */
+
+/* BUTTON WRAPPER */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn {
+ border:1px solid #808080;
+ background: url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;
+ background-color:#ccc;
+ margin: auto .15em;
+}
+
+/* BUTTON (based on button-skin.css) */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button {
+ padding:0 8px;
+ font-size:93%;
+ line-height: 2; /* ~24px */
+ *line-height: 1.7; /* For IE */
+ min-height: 2em; /* For Gecko */
+ *min-height: auto; /* For IE */
+ color: #000;
+}
+
+/* DEFAULT BUTTONS */
+/* NOTE: IE6 will only pickup the yui-default specifier from the multiple class specifier */
+.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default {
+ border:1px solid #304369;
+ background-color: #426fd9;
+ background: url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1400px;
+}
+
+.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default button {
+ color:#fff;
+}
diff --git a/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar.css b/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar.css
new file mode 100644
index 0000000000..b72d26289b
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/assets/skins/sam/calendar.css
@@ -0,0 +1,8 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-calcontainer{position:relative;float:left;_overflow:hidden;}.yui-calcontainer iframe{position:absolute;border:none;margin:0;padding:0;z-index:0;width:100%;height:100%;left:0;top:0;}.yui-calcontainer iframe.fixedsize{width:50em;height:50em;top:-1px;left:-1px;}.yui-calcontainer.multi .groupcal{z-index:1;float:left;position:relative;}.yui-calcontainer .title{position:relative;z-index:1;}.yui-calcontainer .close-icon{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar{position:relative;}.yui-calendar .calnavleft{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calnavright{position:absolute;z-index:1;text-indent:-10000em;overflow:hidden;}.yui-calendar .calheader{position:relative;width:100%;text-align:center;}.yui-calcontainer .yui-cal-nav-mask{position:absolute;z-index:2;margin:0;padding:0;width:100%;height:100%;_width:0;_height:0;left:0;top:0;display:none;}.yui-calcontainer .yui-cal-nav{position:absolute;z-index:3;top:0;display:none;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{display:-moz-inline-box;display:inline-block;}.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{display:block;*display:inline-block;*overflow:visible;border:none;background-color:transparent;cursor:pointer;}.yui-calendar .calbody a:hover{background:inherit;}p#clear{clear:left;padding-top:10px;}.yui-skin-sam .yui-calcontainer{background-color:#f2f2f2;border:1px solid #808080;padding:10px;}.yui-skin-sam .yui-calcontainer.multi{padding:0 5px 0 5px;}.yui-skin-sam .yui-calcontainer.multi .groupcal{background-color:transparent;border:none;padding:10px 5px 10px 5px;margin:0;}.yui-skin-sam .yui-calcontainer .title{background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;border-bottom:1px solid #ccc;font:100% sans-serif;color:#000;font-weight:bold;height:auto;padding:.4em;margin:0 -10px 10px -10px;top:0;left:0;text-align:left;}.yui-skin-sam .yui-calcontainer.multi .title{margin:0 -5px 0 -5px;}.yui-skin-sam .yui-calcontainer.withtitle{padding-top:0;}.yui-skin-sam .yui-calcontainer .calclose{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -300px;width:25px;height:15px;top:.4em;right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar{border-spacing:0;border-collapse:collapse;font:100% sans-serif;text-align:center;margin:0;}.yui-skin-sam .yui-calendar .calhead{background:transparent;border:none;vertical-align:middle;padding:0;}.yui-skin-sam .yui-calendar .calheader{background:transparent;font-weight:bold;padding:0 0 .6em 0;text-align:center;}.yui-skin-sam .yui-calendar .calheader img{border:none;}.yui-skin-sam .yui-calendar .calnavleft{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -450px;width:25px;height:15px;top:0;bottom:0;left:-10px;margin-left:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calnavright{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -500px;width:25px;height:15px;top:0;bottom:0;right:-10px;margin-right:.4em;cursor:pointer;}.yui-skin-sam .yui-calendar .calweekdayrow{height:2em;}.yui-skin-sam .yui-calendar .calweekdayrow th{padding:0;border:none;}.yui-skin-sam .yui-calendar .calweekdaycell{color:#000;font-weight:bold;text-align:center;width:2em;}.yui-skin-sam .yui-calendar .calfoot{background-color:#f2f2f2;}.yui-skin-sam .yui-calendar .calrowhead,.yui-skin-sam .yui-calendar .calrowfoot{color:#a6a6a6;font-size:85%;font-style:normal;font-weight:normal;border:none;}.yui-skin-sam .yui-calendar .calrowhead{text-align:right;padding:0 2px 0 0;}.yui-skin-sam .yui-calendar .calrowfoot{text-align:left;padding:0 0 0 2px;}.yui-skin-sam .yui-calendar td.calcell{border:1px solid #ccc;background:#fff;padding:1px;height:1.6em;line-height:1.6em;text-align:center;white-space:nowrap;}.yui-skin-sam .yui-calendar td.calcell a{color:#06c;display:block;height:100%;text-decoration:none;}.yui-skin-sam .yui-calendar td.calcell.today{background-color:#000;}.yui-skin-sam .yui-calendar td.calcell.today a{background-color:#fff;}.yui-skin-sam .yui-calendar td.calcell.oom{background-color:#ccc;color:#a6a6a6;cursor:default;}.yui-skin-sam .yui-calendar td.calcell.selected{background-color:#fff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.selected a{background-color:#b3d4ff;color:#000;}.yui-skin-sam .yui-calendar td.calcell.calcellhover{background-color:#426fd9;color:#fff;cursor:pointer;}.yui-skin-sam .yui-calendar td.calcell.calcellhover a{background-color:#426fd9;color:#fff;}.yui-skin-sam .yui-calendar td.calcell.previous{color:#e0e0e0;}.yui-skin-sam .yui-calendar td.calcell.restricted{text-decoration:line-through;}.yui-skin-sam .yui-calendar td.calcell.highlight1{background-color:#cf9;}.yui-skin-sam .yui-calendar td.calcell.highlight2{background-color:#9cf;}.yui-skin-sam .yui-calendar td.calcell.highlight3{background-color:#fcc;}.yui-skin-sam .yui-calendar td.calcell.highlight4{background-color:#cf9;}.yui-skin-sam .yui-calendar a.calnav{border:1px solid #f2f2f2;padding:0 4px;text-decoration:none;color:#000;zoom:1;}.yui-skin-sam .yui-calendar a.calnav:hover{background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;border-color:#A0A0A0;cursor:pointer;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-mask{background-color:#000;opacity:.25;filter:alpha(opacity=25);}.yui-skin-sam .yui-calcontainer .yui-cal-nav{font-family:arial,helvetica,clean,sans-serif;font-size:93%;border:1px solid #808080;left:50%;margin-left:-7em;width:14em;padding:0;top:2.5em;background-color:#f2f2f2;}.yui-skin-sam .yui-calcontainer.withtitle .yui-cal-nav{top:4.5em;}.yui-skin-sam .yui-calcontainer.multi .yui-cal-nav{width:16em;margin-left:-8em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y,.yui-skin-sam .yui-calcontainer .yui-cal-nav-m,.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{padding:5px 10px 5px 10px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-b{text-align:center;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-e{margin-top:5px;padding:5px;background-color:#EDF5FF;border-top:1px solid black;display:none;}.yui-skin-sam .yui-calcontainer .yui-cal-nav label{display:block;font-weight:bold;}
+.yui-skin-sam .yui-calcontainer .yui-cal-nav-mc{width:100%;_width:auto;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-y input.yui-invalid{background-color:#FFEE69;border:1px solid #000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav-yc{width:4em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn{border:1px solid #808080;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;background-color:#ccc;margin:auto .15em;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button{padding:0 8px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default{border:1px solid #304369;background-color:#426fd9;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1400px;}.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default button{color:#fff;}
diff --git a/lib/yui/2.8.0r4/calendar/calendar-debug.js b/lib/yui/2.8.0r4/calendar/calendar-debug.js
new file mode 100644
index 0000000000..8d52753665
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/calendar-debug.js
@@ -0,0 +1,7324 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(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) { YAHOO.log("No owner specified for Config object", "error", "Config"); }
+
+ };
+
+
+ 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 ) {
+ YAHOO.log("Firing Config event: " + key + "=" + value, "info", "Config");
+ 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();
+ YAHOO.log("Added property: " + key, "info", "Config");
+
+ 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 = {},
+ currCfg = this.config,
+ prop,
+ property;
+
+ for (prop in currCfg) {
+ if (Lang.hasOwnProperty(currCfg, prop)) {
+ property = currCfg[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();
+ YAHOO.log("setProperty: " + key + "=" + value, "info", "Config");
+
+ 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();
+ YAHOO.log("queueProperty: " + key + "=" + value, "info", "Config");
+
+ 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;
+
+ }
+ }
+ }
+ }
+ }
+
+ YAHOO.log("Config event queue: " + this.outputEventQueue(), "info", "Config");
+
+ 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,
+ 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) {
+ if (Lang.hasOwnProperty(this.config, prop)) {
+ 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;
+
+ // Clear out queue entry, to avoid it being
+ // re-added to the queue by any queueProperty/supercedes
+ // calls which are invoked during fireEvent
+ this.eventQueue[i] = null;
+
+ 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} overrideContext 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, overrideContext) {
+
+ var property = this.config[key.toLowerCase()];
+
+ if (property && property.event) {
+ if (!Config.alreadySubscribed(property.event, handler, obj)) {
+ property.event.subscribe(handler, obj, overrideContext);
+ }
+ 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);
+
+}());
+/**
+* The datemath module provides utility methods for basic JavaScript Date object manipulation and
+* comparison.
+*
+* @module datemath
+*/
+
+/**
+* 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,
+
+ /**
+ * Constant field representing the date in first week of January
+ * which identifies the first week of the year.
+ *
+ * In the U.S, Jan 1st is normally used based on a Sunday start of week.
+ * ISO 8601, used widely throughout Europe, uses Jan 4th, based on a Monday start of week.
+ *
+ * @property WEEK_ONE_JAN_DATE
+ * @static
+ * @type Number
+ */
+ WEEK_ONE_JAN_DATE : 1,
+
+ /**
+ * 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:
+ this._addDays(d, amount);
+ // d.setDate(date.getDate() + amount);
+ break;
+ case this.YEAR:
+ d.setFullYear(date.getFullYear() + amount);
+ break;
+ case this.WEEK:
+ this._addDays(d, (amount * 7));
+ // d.setDate(date.getDate() + (amount * 7));
+ break;
+ }
+ return d;
+ },
+
+ /**
+ * Private helper method to account for bug in Safari 2 (webkit < 420)
+ * when Date.setDate(n) is called with n less than -128 or greater than 127.
+ *
+ * Fix approach and original findings are available here:
+ * http://brianary.blogspot.com/2006/03/safari-date-bug.html
+ *
+ * @method _addDays
+ * @param {Date} d JavaScript date object
+ * @param {Number} nDays The number of days to add to the date object (can be negative)
+ * @private
+ */
+ _addDays : function(d, nDays) {
+ if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
+ if (nDays < 0) {
+ // Ensure we don't go below -128 (getDate() is always 1 to 31, so we won't go above 127)
+ for(var min = -128; nDays < min; nDays -= min) {
+ d.setDate(d.getDate() + min);
+ }
+ } else {
+ // Ensure we don't go above 96 + 31 = 127
+ for(var max = 96; nDays > max; nDays -= max) {
+ d.setDate(d.getDate() + max);
+ }
+ }
+ // nDays should be remainder between -128 and 96
+ }
+ d.setDate(d.getDate() + nDays);
+ },
+
+ /**
+ * 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 this.getDate(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. Can currently support standard
+ * U.S. week numbers, based on Jan 1st defining the 1st week of the year, and
+ * ISO8601 week numbers, based on Jan 4th defining the 1st week of the year.
+ *
+ * @method getWeekNumber
+ * @param {Date} date The JavaScript date for which to find the week number
+ * @param {Number} firstDayOfWeek The index of the first day of the week (0 = Sun, 1 = Mon ... 6 = Sat).
+ * Defaults to 0
+ * @param {Number} janDate The date in the first week of January which defines week one for the year
+ * Defaults to the value of YAHOO.widget.DateMath.WEEK_ONE_JAN_DATE, which is 1 (Jan 1st).
+ * For the U.S, this is normally Jan 1st. ISO8601 uses Jan 4th to define the first week of the year.
+ *
+ * @return {Number} The number of the week containing the given date.
+ */
+ getWeekNumber : function(date, firstDayOfWeek, janDate) {
+
+ // Setup Defaults
+ firstDayOfWeek = firstDayOfWeek || 0;
+ janDate = janDate || this.WEEK_ONE_JAN_DATE;
+
+ var targetDate = this.clearTime(date),
+ startOfWeek,
+ endOfWeek;
+
+ if (targetDate.getDay() === firstDayOfWeek) {
+ startOfWeek = targetDate;
+ } else {
+ startOfWeek = this.getFirstDayOfWeek(targetDate, firstDayOfWeek);
+ }
+
+ var startYear = startOfWeek.getFullYear();
+
+ // DST shouldn't be a problem here, math is quicker than setDate();
+ endOfWeek = new Date(startOfWeek.getTime() + 6*this.ONE_DAY_MS);
+
+ var weekNum;
+ if (startYear !== endOfWeek.getFullYear() && endOfWeek.getDate() >= janDate) {
+ // If years don't match, endOfWeek is in Jan. and if the
+ // week has WEEK_ONE_JAN_DATE in it, it's week one by definition.
+ weekNum = 1;
+ } else {
+ // Get the 1st day of the 1st week, and
+ // find how many days away we are from it.
+ var weekOne = this.clearTime(this.getDate(startYear, 0, janDate)),
+ weekOneDayOne = this.getFirstDayOfWeek(weekOne, firstDayOfWeek);
+
+ // Round days to smoothen out 1 hr DST diff
+ var daysDiff = Math.round((targetDate.getTime() - weekOneDayOne.getTime())/this.ONE_DAY_MS);
+
+ // Calc. Full Weeks
+ var rem = daysDiff % 7;
+ var weeksDiff = (daysDiff - rem)/7;
+ weekNum = weeksDiff + 1;
+ }
+ return weekNum;
+ },
+
+ /**
+ * Get the first day of the week, for the give date.
+ * @param {Date} dt The date in the week for which the first day is required.
+ * @param {Number} startOfWeek The index for the first day of the week, 0 = Sun, 1 = Mon ... 6 = Sat (defaults to 0)
+ * @return {Date} The first day of the week
+ */
+ getFirstDayOfWeek : function (dt, startOfWeek) {
+ startOfWeek = startOfWeek || 0;
+ var dayOfWeekIndex = dt.getDay(),
+ dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;
+
+ return this.subtract(dt, this.DAY, dayOfWeek);
+ },
+
+ /**
+ * 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 = this.getDate(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;
+ },
+
+ /**
+ * Returns a new JavaScript Date object, representing the given year, month and date. Time fields (hr, min, sec, ms) on the new Date object
+ * are set to 0. The method allows Date instances to be created with the a year less than 100. "new Date(year, month, date)" implementations
+ * set the year to 19xx if a year (xx) which is less than 100 is provided.
+ *
+ * NOTE: Validation on argument values is not performed. It is the caller's responsibility to ensure
+ * arguments are valid as per the ECMAScript-262 Date object specification for the new Date(year, month[, date]) constructor.
+ *
+ * @method getDate
+ * @param {Number} y Year.
+ * @param {Number} m Month index from 0 (Jan) to 11 (Dec).
+ * @param {Number} d (optional) Date from 1 to 31. If not provided, defaults to 1.
+ * @return {Date} The JavaScript date object with year, month, date set as provided.
+ */
+ getDate : function(y, m, d) {
+ var dt = null;
+ if (YAHOO.lang.isUndefined(d)) {
+ d = 1;
+ }
+ if (y >= 100) {
+ dt = new Date(y, m, d);
+ } else {
+ dt = new Date();
+ dt.setFullYear(y);
+ dt.setMonth(m);
+ dt.setDate(d);
+ dt.setHours(0,0,0,0);
+ }
+ return dt;
+ }
+};
+/**
+* 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
+*/
+(function(){
+
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event,
+ Lang = YAHOO.lang,
+ DateMath = YAHOO.widget.DateMath;
+
+/**
+* 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.
+* To construct the placeholder for the calendar widget, the code is as
+* follows:
+*
+*
+*
+*
+*
+* NOTE: As of 2.4.0, the constructor's ID argument is optional.
+* The Calendar can be constructed by simply providing a container ID string,
+* or a reference to a container DIV HTMLElement (the element needs to exist
+* in the document).
+*
+* E.g.:
+*
+* var c = new YAHOO.widget.Calendar("calContainer", configOptions);
+*
+* or:
+*
+* var containerDiv = YAHOO.util.Dom.get("calContainer");
+* var c = new YAHOO.widget.Calendar(containerDiv, configOptions);
+*
+*
+*
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the Calendar's ID will be set to "calContainer_t".
+*
+*
+* @namespace YAHOO.widget
+* @class Calendar
+* @constructor
+* @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
+*/
+function Calendar(id, containerId, config) {
+ this.init.apply(this, arguments);
+}
+
+/**
+* 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
+*/
+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
+*/
+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
+*/
+Calendar.MONTH_DAY = "MD";
+
+/**
+* Type constant used for renderers to represent a weekday
+* @property YAHOO.widget.Calendar.WEEKDAY
+* @static
+* @final
+* @type String
+*/
+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
+*/
+Calendar.RANGE = "R";
+
+/**
+* Type constant used for renderers to represent a month across any year
+* @property YAHOO.widget.Calendar.MONTH
+* @static
+* @final
+* @type String
+*/
+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
+*/
+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
+*/
+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
+*/
+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
+*/
+Calendar.LONG = "long";
+
+/**
+* Constant used to represent medium date field string formats (e.g. Mon)
+* @property YAHOO.widget.Calendar.MEDIUM
+* @static
+* @final
+* @type String
+*/
+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
+*/
+Calendar.ONE_CHAR = "1char";
+
+/**
+* The set of default Config property keys and values for the Calendar.
+*
+*
+* NOTE: This property is made public in order to allow users to change
+* the default values of configuration properties. Users should not
+* modify the key string, unless they are overriding the Calendar implementation
+*
+*
+*
+* The property is an object with key/value pairs, the key being the
+* uppercase configuration property name and the value being an object
+* literal with a key string property, and a value property, specifying the
+* default value of the property. To override a default value, you can set
+* the value property, for example, YAHOO.widget.Calendar.DEFAULT_CONFIG.MULTI_SELECT.value = true;
+*
+* @property YAHOO.widget.Calendar.DEFAULT_CONFIG
+* @static
+* @type Object
+*/
+
+Calendar.DEFAULT_CONFIG = {
+ YEAR_OFFSET : {key:"year_offset", value:0, supercedes:["pagedate", "selected", "mindate","maxdate"]},
+ TODAY : {key:"today", value:new Date(), supercedes:["pagedate"]},
+ PAGEDATE : {key:"pagedate", value:null},
+ SELECTED : {key:"selected", value:[]},
+ 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:""},
+ NAV: {key:"navigator", value: null},
+ STRINGS : {
+ key:"strings",
+ value: {
+ previousMonth : "Previous Month",
+ nextMonth : "Next Month",
+ close: "Close"
+ },
+ supercedes : ["close", "title"]
+ }
+};
+
+/**
+* The set of default Config property keys and values for the Calendar
+* @property YAHOO.widget.Calendar._DEFAULT_CONFIG
+* @deprecated Made public. See the public DEFAULT_CONFIG property for details
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
+
+var DEF_CFG = Calendar.DEFAULT_CONFIG;
+
+/**
+* The set of Custom Event types supported by the Calendar
+* @property YAHOO.widget.Calendar._EVENT_TYPES
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._EVENT_TYPES = {
+ BEFORE_SELECT : "beforeSelect",
+ SELECT : "select",
+ BEFORE_DESELECT : "beforeDeselect",
+ DESELECT : "deselect",
+ CHANGE_PAGE : "changePage",
+ BEFORE_RENDER : "beforeRender",
+ RENDER : "render",
+ BEFORE_DESTROY : "beforeDestroy",
+ DESTROY : "destroy",
+ RESET : "reset",
+ CLEAR : "clear",
+ BEFORE_HIDE : "beforeHide",
+ HIDE : "hide",
+ BEFORE_SHOW : "beforeShow",
+ SHOW : "show",
+ BEFORE_HIDE_NAV : "beforeHideNav",
+ HIDE_NAV : "hideNav",
+ BEFORE_SHOW_NAV : "beforeShowNav",
+ SHOW_NAV : "showNav",
+ BEFORE_RENDER_NAV : "beforeRenderNav",
+ RENDER_NAV : "renderNav"
+};
+
+/**
+* The set of default style constants for the Calendar
+* @property YAHOO.widget.Calendar.STYLES
+* @static
+* @type Object An object with name/value pairs for the class name identifier/value.
+*/
+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_NAV : "calnav",
+ 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",
+ CSS_WITH_TITLE: "withtitle",
+ CSS_FIXED_SIZE: "fixedsize",
+ CSS_LINK_CLOSE: "link-close"
+};
+
+/**
+* The set of default style constants for the Calendar
+* @property YAHOO.widget.Calendar._STYLES
+* @deprecated Made public. See the public STYLES property for details
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._STYLES = Calendar.STYLES;
+
+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.
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The unique id associated with the Calendar's container
+ * @property containerId
+ * @type String
+ */
+ containerId: 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.
+ * @deprecated Use the "today" configuration property
+ * @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,
+
+ /**
+ * A reference to the CalendarNavigator instance created for this Calendar.
+ * Will be null if the "navigator" configuration property has not been set
+ * @property oNavigator
+ * @type CalendarNavigator
+ */
+ oNavigator : 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,
+
+ /**
+ * Protected helper used to parse Calendar constructor/init arguments.
+ *
+ * As of 2.4.0, Calendar supports a simpler constructor
+ * signature. This method reconciles arguments
+ * received in the pre 2.4.0 and 2.4.0 formats.
+ *
+ * @protected
+ * @method _parseArgs
+ * @param {Array} Function "arguments" array
+ * @return {Object} Object with id, container, config properties containing
+ * the reconciled argument values.
+ **/
+ _parseArgs : function(args) {
+ /*
+ 2.4.0 Constructors signatures
+
+ new Calendar(String)
+ new Calendar(HTMLElement)
+ new Calendar(String, ConfigObject)
+ new Calendar(HTMLElement, ConfigObject)
+
+ Pre 2.4.0 Constructor signatures
+
+ new Calendar(String, String)
+ new Calendar(String, HTMLElement)
+ new Calendar(String, String, ConfigObject)
+ new Calendar(String, HTMLElement, ConfigObject)
+ */
+ var nArgs = {id:null, container:null, config:null};
+
+ if (args && args.length && args.length > 0) {
+ switch (args.length) {
+ case 1:
+ nArgs.id = null;
+ nArgs.container = args[0];
+ nArgs.config = null;
+ break;
+ case 2:
+ if (Lang.isObject(args[1]) && !args[1].tagName && !(args[1] instanceof String)) {
+ nArgs.id = null;
+ nArgs.container = args[0];
+ nArgs.config = args[1];
+ } else {
+ nArgs.id = args[0];
+ nArgs.container = args[1];
+ nArgs.config = null;
+ }
+ break;
+ default: // 3+
+ nArgs.id = args[0];
+ nArgs.container = args[1];
+ nArgs.config = args[2];
+ break;
+ }
+ } else {
+ this.logger.log("Invalid constructor/init arguments", "error");
+ }
+ return nArgs;
+ },
+
+ /**
+ * Initializes the Calendar widget.
+ * @method init
+ *
+ * @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+ * @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+ * @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
+ */
+ init : function(id, container, config) {
+ // Normalize 2.4.0, pre 2.4.0 args
+ var nArgs = this._parseArgs(arguments);
+
+ id = nArgs.id;
+ container = nArgs.container;
+ config = nArgs.config;
+
+ this.oDomContainer = Dom.get(container);
+ if (!this.oDomContainer) { this.logger.log("Container not found in document.", "error"); }
+
+ if (!this.oDomContainer.id) {
+ this.oDomContainer.id = Dom.generateId();
+ }
+ if (!id) {
+ id = this.oDomContainer.id + "_t";
+ }
+
+ this.id = id;
+ this.containerId = this.oDomContainer.id;
+
+ this.logger = new YAHOO.widget.LogWriter("Calendar " + this.id);
+ this.initEvents();
+
+ /**
+ * 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();
+
+ Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
+ 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();
+
+ this.today = this.cfg.getProperty("today");
+ },
+
+ /**
+ * 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
+ */
+ configIframe : function(type, args, obj) {
+ var useIframe = args[0];
+
+ if (!this.parent) {
+ if (Dom.inDocument(this.oDomContainer)) {
+ if (useIframe) {
+ var pos = Dom.getStyle(this.oDomContainer, "position");
+
+ if (pos == "absolute" || pos == "relative") {
+
+ if (!Dom.inDocument(this.iframe)) {
+ this.iframe = document.createElement("iframe");
+ this.iframe.src = "javascript:false;";
+
+ Dom.setStyle(this.iframe, "opacity", "0");
+
+ if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+ Dom.addClass(this.iframe, this.Style.CSS_FIXED_SIZE);
+ }
+
+ 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
+ */
+ configTitle : function(type, args, obj) {
+ var title = args[0];
+
+ // "" disables title bar
+ if (title) {
+ this.createTitleBar(title);
+ } else {
+ var close = this.cfg.getProperty(DEF_CFG.CLOSE.key);
+ if (!close) {
+ this.removeTitleBar();
+ } else {
+ this.createTitleBar(" ");
+ }
+ }
+ },
+
+ /**
+ * Default handler for the "close" property
+ * @method configClose
+ */
+ configClose : function(type, args, obj) {
+ var close = args[0],
+ title = this.cfg.getProperty(DEF_CFG.TITLE.key);
+
+ if (close) {
+ if (!title) {
+ this.createTitleBar(" ");
+ }
+ this.createCloseButton();
+ } else {
+ this.removeCloseButton();
+ if (!title) {
+ this.removeTitleBar();
+ }
+ }
+ },
+
+ /**
+ * Initializes Calendar's built-in CustomEvents
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ var defEvents = Calendar._EVENT_TYPES,
+ CE = YAHOO.util.CustomEvent,
+ cal = this; // To help with minification
+
+ /**
+ * Fired before a date selection is made
+ * @event beforeSelectEvent
+ */
+ cal.beforeSelectEvent = new CE(defEvents.BEFORE_SELECT);
+
+ /**
+ * Fired when a date selection is made
+ * @event selectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ cal.selectEvent = new CE(defEvents.SELECT);
+
+ /**
+ * Fired before a date or set of dates is deselected
+ * @event beforeDeselectEvent
+ */
+ cal.beforeDeselectEvent = new CE(defEvents.BEFORE_DESELECT);
+
+ /**
+ * Fired when a date or set of dates is deselected
+ * @event deselectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ cal.deselectEvent = new CE(defEvents.DESELECT);
+
+ /**
+ * Fired when the Calendar page is changed
+ * @event changePageEvent
+ * @param {Date} prevDate The date before the page was changed
+ * @param {Date} newDate The date after the page was changed
+ */
+ cal.changePageEvent = new CE(defEvents.CHANGE_PAGE);
+
+ /**
+ * Fired before the Calendar is rendered
+ * @event beforeRenderEvent
+ */
+ cal.beforeRenderEvent = new CE(defEvents.BEFORE_RENDER);
+
+ /**
+ * Fired when the Calendar is rendered
+ * @event renderEvent
+ */
+ cal.renderEvent = new CE(defEvents.RENDER);
+
+ /**
+ * Fired just before the Calendar is to be destroyed
+ * @event beforeDestroyEvent
+ */
+ cal.beforeDestroyEvent = new CE(defEvents.BEFORE_DESTROY);
+
+ /**
+ * Fired after the Calendar is destroyed. This event should be used
+ * for notification only. When this event is fired, important Calendar instance
+ * properties, dom references and event listeners have already been
+ * removed/dereferenced, and hence the Calendar instance is not in a usable
+ * state.
+ *
+ * @event destroyEvent
+ */
+ cal.destroyEvent = new CE(defEvents.DESTROY);
+
+ /**
+ * Fired when the Calendar is reset
+ * @event resetEvent
+ */
+ cal.resetEvent = new CE(defEvents.RESET);
+
+ /**
+ * Fired when the Calendar is cleared
+ * @event clearEvent
+ */
+ cal.clearEvent = new CE(defEvents.CLEAR);
+
+ /**
+ * Fired just before the Calendar is to be shown
+ * @event beforeShowEvent
+ */
+ cal.beforeShowEvent = new CE(defEvents.BEFORE_SHOW);
+
+ /**
+ * Fired after the Calendar is shown
+ * @event showEvent
+ */
+ cal.showEvent = new CE(defEvents.SHOW);
+
+ /**
+ * Fired just before the Calendar is to be hidden
+ * @event beforeHideEvent
+ */
+ cal.beforeHideEvent = new CE(defEvents.BEFORE_HIDE);
+
+ /**
+ * Fired after the Calendar is hidden
+ * @event hideEvent
+ */
+ cal.hideEvent = new CE(defEvents.HIDE);
+
+ /**
+ * Fired just before the CalendarNavigator is to be shown
+ * @event beforeShowNavEvent
+ */
+ cal.beforeShowNavEvent = new CE(defEvents.BEFORE_SHOW_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is shown
+ * @event showNavEvent
+ */
+ cal.showNavEvent = new CE(defEvents.SHOW_NAV);
+
+ /**
+ * Fired just before the CalendarNavigator is to be hidden
+ * @event beforeHideNavEvent
+ */
+ cal.beforeHideNavEvent = new CE(defEvents.BEFORE_HIDE_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is hidden
+ * @event hideNavEvent
+ */
+ cal.hideNavEvent = new CE(defEvents.HIDE_NAV);
+
+ /**
+ * Fired just before the CalendarNavigator is to be rendered
+ * @event beforeRenderNavEvent
+ */
+ cal.beforeRenderNavEvent = new CE(defEvents.BEFORE_RENDER_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is rendered
+ * @event renderNavEvent
+ */
+ cal.renderNavEvent = new CE(defEvents.RENDER_NAV);
+
+ cal.beforeSelectEvent.subscribe(cal.onBeforeSelect, this, true);
+ cal.selectEvent.subscribe(cal.onSelect, this, true);
+ cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect, this, true);
+ cal.deselectEvent.subscribe(cal.onDeselect, this, true);
+ cal.changePageEvent.subscribe(cal.onChangePage, this, true);
+ cal.renderEvent.subscribe(cal.onRender, this, true);
+ cal.resetEvent.subscribe(cal.onReset, this, true);
+ cal.clearEvent.subscribe(cal.onClear, this, true);
+ },
+
+ /**
+ * The default event handler for clicks on the "Previous Month" navigation UI
+ *
+ * @method doPreviousMonthNav
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doPreviousMonthNav : function(e, cal) {
+ Event.preventDefault(e);
+ // previousMonth invoked in a timeout, to allow
+ // event to bubble up, with correct target. Calling
+ // previousMonth, will call render which will remove
+ // HTML which generated the event, resulting in an
+ // invalid event target in certain browsers.
+ setTimeout(function() {
+ cal.previousMonth();
+ var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT, "a", cal.oDomContainer);
+ if (navs && navs[0]) {
+ try {
+ navs[0].focus();
+ } catch (ex) {
+ // ignore
+ }
+ }
+ }, 0);
+ },
+
+ /**
+ * The default event handler for clicks on the "Next Month" navigation UI
+ *
+ * @method doNextMonthNav
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doNextMonthNav : function(e, cal) {
+ Event.preventDefault(e);
+ setTimeout(function() {
+ cal.nextMonth();
+ var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT, "a", cal.oDomContainer);
+ if (navs && navs[0]) {
+ try {
+ navs[0].focus();
+ } catch (ex) {
+ // ignore
+ }
+ }
+ }, 0);
+ },
+
+ /**
+ * The default event handler for date cell selection. Currently attached to
+ * the Calendar's bounding box, referenced by it's oDomContainer property.
+ *
+ * @method doSelectCell
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doSelectCell : function(e, cal) {
+ var cell, d, date, index;
+
+ var target = Event.getTarget(e),
+ tagName = target.tagName.toLowerCase(),
+ defSelector = false;
+
+ while (tagName != "td" && !Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+
+ if (!defSelector && tagName == "a" && Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
+ defSelector = true;
+ }
+
+ target = target.parentNode;
+ tagName = target.tagName.toLowerCase();
+
+ if (target == this.oDomContainer || tagName == "html") {
+ return;
+ }
+ }
+
+ if (defSelector) {
+ // Stop link href navigation for default renderer
+ Event.preventDefault(e);
+ }
+
+ cell = target;
+
+ if (Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+ index = cal.getIndexFromId(cell.id);
+ if (index > -1) {
+ d = cal.cellDates[index];
+ if (d) {
+ date = DateMath.getDate(d[0],d[1]-1,d[2]);
+
+ var link;
+
+ cal.logger.log("Selecting cell " + index + " via click", "info");
+ 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
+ */
+ doCellMouseOver : function(e, cal) {
+ var target;
+ if (e) {
+ target = Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName && target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (!target.tagName || target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ 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
+ */
+ doCellMouseOut : function(e, cal) {
+ var target;
+ if (e) {
+ target = Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName && target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (!target.tagName || target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+ },
+
+ setupConfig : function() {
+
+ var cfg = this.cfg;
+
+ /**
+ * The date to use to represent "Today".
+ *
+ * @config today
+ * @type Date
+ * @default The client side date (new Date()) when the Calendar is instantiated.
+ */
+ cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler:this.configToday, suppressEvent:true } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String | Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ cfg.addProperty(DEF_CFG.SELECTED.key, { value:DEF_CFG.SELECTED.value.concat(), handler:this.configSelected } );
+
+ /**
+ * The title to display above the Calendar's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this Calendar
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.configMinDate } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday = 0, Monday = 1 ... Saturday = 6).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.configOptions, validator:cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key, { value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator: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
+ */
+ cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key, { value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator: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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.WEEKDAYS_LONG.value, handler:this.configLocale } );
+
+ /**
+ * Refreshes the locale values used to build the Calendar.
+ * @method refreshLocale
+ * @private
+ */
+ var refreshLocale = function() {
+ cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
+ cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
+ };
+
+ cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
+
+ /**
+ * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
+ * be used when displaying and parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
+ * methods will always represent the Gregorian year, in order to maintain date/month/week values.
+ *
+ * @config YEAR_OFFSET
+ * @type Number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, handler:this.configLocale } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.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 "/"
+ */
+ cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key, { value:DEF_CFG.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 "-"
+ */
+ cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.configLocale, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The suffix used after the month when rendering the Calendar header
+ * @config MY_LABEL_MONTH_SUFFIX
+ * @type String
+ * @default " "
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.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 ""
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
+
+ /**
+ * Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a
+ * specific Month/Year without having to scroll sequentially through months.
+ *
+ * Setting this property to null (default value) or false, will disable the CalendarNavigator UI.
+ *
+ *
+ * Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.
+ *
+ *
+ * This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
+ * The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
+ * Any properties which are not provided will use the default values (defined in the CalendarNavigator class).
+ *
+ *
+ * strings
+ * Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
+ *
+ * month String : The string to use for the month label. Defaults to "Month".
+ * year String : The string to use for the year label. Defaults to "Year".
+ * submit String : The string to use for the submit button label. Defaults to "Okay".
+ * cancel String : The string to use for the cancel button label. Defaults to "Cancel".
+ * invalidYear String : The string to use for invalid year values. Defaults to "Year needs to be a number".
+ *
+ *
+ * monthFormat String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
+ * initialFocus String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
+ *
+ * E.g.
+ *
+ * var navConfig = {
+ * strings: {
+ * month:"Calendar Month",
+ * year:"Calendar Year",
+ * submit: "Submit",
+ * cancel: "Cancel",
+ * invalidYear: "Please enter a valid year"
+ * },
+ * monthFormat: YAHOO.widget.Calendar.SHORT,
+ * initialFocus: "month"
+ * }
+ *
+ * @config navigator
+ * @type {Object|Boolean}
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
+
+ /**
+ * The map of UI strings which the Calendar UI uses.
+ *
+ * @config strings
+ * @type {Object}
+ * @default An object with the properties shown below:
+ *
+ * previousMonth String : The string to use for the "Previous Month" navigation UI. Defaults to "Previous Month".
+ * nextMonth String : The string to use for the "Next Month" navigation UI. Defaults to "Next Month".
+ * close String : The string to use for the close button label. Defaults to "Close".
+ *
+ */
+ cfg.addProperty(DEF_CFG.STRINGS.key, {
+ value:DEF_CFG.STRINGS.value,
+ handler:this.configStrings,
+ validator: function(val) {
+ return Lang.isObject(val);
+ },
+ supercedes:DEF_CFG.STRINGS.supercedes
+ });
+ },
+
+ /**
+ * The default handler for the "strings" property
+ * @method configStrings
+ */
+ configStrings : function(type, args, obj) {
+ var val = Lang.merge(DEF_CFG.STRINGS.value, args[0]);
+ this.cfg.setProperty(DEF_CFG.STRINGS.key, val, true);
+ },
+
+ /**
+ * The default handler for the "pagedate" property
+ * @method configPageDate
+ */
+ configPageDate : function(type, args, obj) {
+ this.cfg.setProperty(DEF_CFG.PAGEDATE.key, this._parsePageDate(args[0]), true);
+ },
+
+ /**
+ * The default handler for the "mindate" property
+ * @method configMinDate
+ */
+ configMinDate : function(type, args, obj) {
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ this.cfg.setProperty(DEF_CFG.MINDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
+ }
+ },
+
+ /**
+ * The default handler for the "maxdate" property
+ * @method configMaxDate
+ */
+ configMaxDate : function(type, args, obj) {
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ this.cfg.setProperty(DEF_CFG.MAXDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
+ }
+ },
+
+ /**
+ * The default handler for the "today" property
+ * @method configToday
+ */
+ configToday : function(type, args, obj) {
+ // Only do this for initial set. Changing the today property after the initial
+ // set, doesn't affect pagedate
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ }
+ var today = DateMath.clearTime(val);
+ if (!this.cfg.initialConfig[DEF_CFG.PAGEDATE.key]) {
+ this.cfg.setProperty(DEF_CFG.PAGEDATE.key, today);
+ }
+ this.today = today;
+ this.cfg.setProperty(DEF_CFG.TODAY.key, today, true);
+ },
+
+ /**
+ * The default handler for the "selected" property
+ * @method configSelected
+ */
+ configSelected : function(type, args, obj) {
+ var selected = args[0],
+ cfgSelected = DEF_CFG.SELECTED.key;
+
+ if (selected) {
+ if (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
+ */
+ configOptions : function(type, args, obj) {
+ this.Options[type.toUpperCase()] = args[0];
+ },
+
+ /**
+ * The default handler for all configuration locale properties
+ * @method configLocale
+ */
+ configLocale : function(type, args, obj) {
+ this.Locale[type.toUpperCase()] = args[0];
+
+ this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
+ this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
+ },
+
+ /**
+ * The default handler for all configuration locale field length properties
+ * @method configLocaleValues
+ */
+ configLocaleValues : function(type, args, obj) {
+
+ type = type.toLowerCase();
+
+ var val = args[0],
+ cfg = this.cfg,
+ Locale = this.Locale;
+
+ switch (type) {
+ case DEF_CFG.LOCALE_MONTHS.key:
+ switch (val) {
+ case Calendar.SHORT:
+ Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();
+ break;
+ case Calendar.LONG:
+ Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();
+ break;
+ }
+ break;
+ case DEF_CFG.LOCALE_WEEKDAYS.key:
+ switch (val) {
+ case Calendar.ONE_CHAR:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();
+ break;
+ case Calendar.SHORT:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();
+ break;
+ case Calendar.MEDIUM:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();
+ break;
+ case Calendar.LONG:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();
+ break;
+ }
+
+ var START_WEEKDAY = cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
+
+ if (START_WEEKDAY > 0) {
+ for (var w=0; w < START_WEEKDAY; ++w) {
+ Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());
+ }
+ }
+ break;
+ }
+ },
+
+ /**
+ * The default handler for the "navigator" property
+ * @method configNavigator
+ */
+ configNavigator : function(type, args, obj) {
+ var val = args[0];
+ if (YAHOO.widget.CalendarNavigator && (val === true || Lang.isObject(val))) {
+ if (!this.oNavigator) {
+ this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
+ // Cleanup DOM Refs/Events before innerHTML is removed.
+ this.beforeRenderEvent.subscribe(function () {
+ if (!this.pages) {
+ this.oNavigator.erase();
+ }
+ }, this, true);
+ }
+ } else {
+ if (this.oNavigator) {
+ this.oNavigator.destroy();
+ this.oNavigator = null;
+ }
+ }
+ },
+
+ /**
+ * Defines the style constants for the Calendar
+ * @method initStyles
+ */
+ initStyles : function() {
+
+ var defStyle = 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_NAV
+ */
+ CSS_NAV : defStyle.CSS_NAV,
+ /**
+ * @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,
+ /**
+ * @property Style.CSS_WITH_TITLE
+ */
+ CSS_WITH_TITLE : defStyle.CSS_WITH_TITLE,
+ /**
+ * @property Style.CSS_FIXED_SIZE
+ */
+ CSS_FIXED_SIZE : defStyle.CSS_FIXED_SIZE,
+ /**
+ * @property Style.CSS_LINK_CLOSE
+ */
+ CSS_LINK_CLOSE : defStyle.CSS_LINK_CLOSE
+ };
+ },
+
+ /**
+ * 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
+ */
+ buildMonthLabel : function() {
+ return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
+ },
+
+ /**
+ * Helper method, to format a Month Year string, given a JavaScript Date, based on the
+ * Calendar localization settings
+ *
+ * @method _buildMonthLabel
+ * @private
+ * @param {Date} date
+ * @return {String} Formated month, year string
+ */
+ _buildMonthLabel : function(date) {
+ var monthLabel = this.Locale.LOCALE_MONTHS[date.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX,
+ yearLabel = (date.getFullYear() + this.Locale.YEAR_OFFSET) + 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
+ */
+ 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
+ */
+ createTitleBar : function(strTitle) {
+ var tDiv = 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);
+
+ Dom.addClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
+
+ return tDiv;
+ },
+
+ /**
+ * Removes the title bar element from the DOM
+ *
+ * @method removeTitleBar
+ */
+ removeTitleBar : function() {
+ var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+ if (tDiv) {
+ Event.purgeElement(tDiv);
+ this.oDomContainer.removeChild(tDiv);
+ }
+ Dom.removeClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
+ },
+
+ /**
+ * Creates the close button HTML element and adds it to Calendar container DIV
+ *
+ * @method createCloseButton
+ * @return The close HTML element created
+ */
+ createCloseButton : function() {
+ var cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
+ cssLinkClose = this.Style.CSS_LINK_CLOSE,
+ DEPR_CLOSE_PATH = "us/my/bn/x_d.gif",
+
+ lnk = Dom.getElementsByClassName(cssLinkClose, "a", this.oDomContainer)[0],
+ strings = this.cfg.getProperty(DEF_CFG.STRINGS.key),
+ closeStr = (strings && strings.close) ? strings.close : "";
+
+ if (!lnk) {
+ lnk = document.createElement("a");
+ Event.addListener(lnk, "click", function(e, cal) {
+ cal.hide();
+ Event.preventDefault(e);
+ }, this);
+ }
+
+ lnk.href = "#";
+ lnk.className = cssLinkClose;
+
+ if (Calendar.IMG_ROOT !== null) {
+ var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
+ img.src = Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
+ img.className = cssClose;
+ lnk.appendChild(img);
+ } else {
+ lnk.innerHTML = '' + closeStr + ' ';
+ }
+ this.oDomContainer.appendChild(lnk);
+
+ return lnk;
+ },
+
+ /**
+ * Removes the close button HTML element from the DOM
+ *
+ * @method removeCloseButton
+ */
+ removeCloseButton : function() {
+ var btn = Dom.getElementsByClassName(this.Style.CSS_LINK_CLOSE, "a", this.oDomContainer)[0] || null;
+ if (btn) {
+ 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
+ */
+ renderHeader : function(html) {
+
+ this.logger.log("Rendering header", "render");
+
+ var colSpan = 7,
+ DEPR_NAV_LEFT = "us/tr/callt.gif",
+ DEPR_NAV_RIGHT = "us/tr/calrt.gif",
+ cfg = this.cfg,
+ pageDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
+ strings= cfg.getProperty(DEF_CFG.STRINGS.key),
+ prevStr = (strings && strings.previousMonth) ? strings.previousMonth : "",
+ nextStr = (strings && strings.nextMonth) ? strings.nextMonth : "",
+ monthLabel;
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
+ colSpan += 1;
+ }
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
+ colSpan += 1;
+ }
+
+ html[html.length] = "";
+ html[html.length] = "";
+ html[html.length] = '\n ';
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)) {
+ html = this.buildWeekdays(html);
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ buildWeekdays : function(html) {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
+ html[html.length] = ' ';
+ }
+
+ for(var i=0;i < this.Locale.LOCALE_WEEKDAYS.length; ++i) {
+ html[html.length] = '' + this.Locale.LOCALE_WEEKDAYS[i] + ' ';
+ }
+
+ if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
+ html[html.length] = ' ';
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ renderBody : function(workingDate, html) {
+ this.logger.log("Rendering body", "render");
+
+ var startDay = this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
+
+ this.preMonthDays = workingDate.getDay();
+ if (startDay > 0) {
+ this.preMonthDays -= startDay;
+ }
+ if (this.preMonthDays < 0) {
+ this.preMonthDays += 7;
+ }
+
+ this.monthDays = DateMath.findMonthEnd(workingDate).getDate();
+ this.postMonthDays = Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+
+ this.logger.log(this.preMonthDays + " preciding out-of-month days", "render");
+ this.logger.log(this.monthDays + " month days", "render");
+ this.logger.log(this.postMonthDays + " post-month days", "render");
+
+ workingDate = DateMath.subtract(workingDate, DateMath.DAY, this.preMonthDays);
+ this.logger.log("Calendar page starts on " + workingDate, "render");
+
+ var weekNum,
+ weekClass,
+ weekPrefix = "w",
+ cellPrefix = "_cell",
+ workingDayPrefix = "wd",
+ dayPrefix = "d",
+ cellRenderers,
+ renderer,
+ t = this.today,
+ cfg = this.cfg,
+ todayYear = t.getFullYear(),
+ todayMonth = t.getMonth(),
+ todayDate = t.getDate(),
+ useDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
+ hideBlankWeeks = cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),
+ showWeekFooter = cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),
+ showWeekHeader = cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),
+ mindate = cfg.getProperty(DEF_CFG.MINDATE.key),
+ maxdate = cfg.getProperty(DEF_CFG.MAXDATE.key),
+ yearOffset = this.Locale.YEAR_OFFSET;
+
+ if (mindate) {
+ mindate = DateMath.clearTime(mindate);
+ }
+ if (maxdate) {
+ maxdate = DateMath.clearTime(maxdate);
+ }
+
+ html[html.length] = '';
+
+ var i = 0,
+ tempDiv = document.createElement("div"),
+ cell = document.createElement("td");
+
+ tempDiv.appendChild(cell);
+
+ var cal = this.parent || this;
+
+ for (var r=0;r<6;r++) {
+ weekNum = DateMath.getWeekNumber(workingDate, 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] = '';
+
+ if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
+
+ for (var d=0; d < 7; d++){ // Render actual days
+
+ cellRenderers = [];
+
+ this.clearElement(cell);
+ cell.className = this.Style.CSS_CELL;
+ cell.id = this.id + cellPrefix + i;
+ this.logger.log("Rendering cell " + cell.id + " (" + workingDate.getFullYear() + yearOffset + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");
+
+ 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 {
+ Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
+ Dom.addClass(cell, dayPrefix + workingDate.getDate());
+
+ for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
+ renderer = rArray[2];
+
+ if (workingDate.getTime()==d2.getTime()) {
+ this.renderStack.splice(s,1);
+ }
+ }
+ break;
+ case Calendar.WEEKDAY:
+ var weekday = rArray[1][0];
+ if (workingDate.getDay()+1 == weekday) {
+ renderer = rArray[2];
+ }
+ break;
+ case 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) {
+ this.logger.log("renderer[" + x + "] for (" + workingDate.getFullYear() + yearOffset + "-" + (workingDate.getMonth()+1) + "-" + workingDate.getDate() + ")", "cellrender");
+ if (cellRenderers[x].call(cal, workingDate, cell) == Calendar.STOP_RENDER) {
+ break;
+ }
+ }
+
+ workingDate.setTime(workingDate.getTime() + DateMath.ONE_DAY_MS);
+ // Just in case we crossed DST/Summertime boundaries
+ workingDate = DateMath.clearTime(workingDate);
+
+ if (i >= 0 && i <= 6) {
+ Dom.addClass(cell, this.Style.CSS_CELL_TOP);
+ }
+ if ((i % 7) === 0) {
+ Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
+ }
+ if (((i+1) % 7) === 0) {
+ 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= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+ Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+ }
+
+ html[html.length] = tempDiv.innerHTML;
+ i++;
+ }
+
+ if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
+
+ html[html.length] = ' ';
+ }
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ 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
+ */
+ render : function() {
+ this.beforeRenderEvent.fire();
+
+ // Find starting day of the current month
+ var workingDate = DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
+
+ this.resetRenderers();
+ this.cellDates.length = 0;
+
+ Event.purgeElement(this.oDomContainer, true);
+
+ var html = [];
+
+ html[html.length] = '';
+ html = this.renderHeader(html);
+ html = this.renderBody(workingDate, html);
+ html = this.renderFooter(html);
+ html[html.length] = '
';
+
+ this.oDomContainer.innerHTML = html.join("\n");
+
+ this.applyListeners();
+ this.cells = Dom.getElementsByClassName(this.Style.CSS_CELL, "td", this.id);
+
+ this.cfg.refireEvent(DEF_CFG.TITLE.key);
+ this.cfg.refireEvent(DEF_CFG.CLOSE.key);
+ this.cfg.refireEvent(DEF_CFG.IFRAME.key);
+
+ this.renderEvent.fire();
+ },
+
+ /**
+ * Applies the Calendar's DOM listeners to applicable elements.
+ * @method applyListeners
+ */
+ applyListeners : function() {
+ var root = this.oDomContainer,
+ cal = this.parent || this,
+ anchor = "a",
+ click = "click";
+
+ var linkLeft = Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root),
+ linkRight = Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
+
+ if (linkLeft && linkLeft.length > 0) {
+ this.linkLeft = linkLeft[0];
+ Event.addListener(this.linkLeft, click, this.doPreviousMonthNav, cal, true);
+ }
+
+ if (linkRight && linkRight.length > 0) {
+ this.linkRight = linkRight[0];
+ Event.addListener(this.linkRight, click, this.doNextMonthNav, cal, true);
+ }
+
+ if (cal.cfg.getProperty("navigator") !== null) {
+ this.applyNavListeners();
+ }
+
+ if (this.domEventMap) {
+ var el,elements;
+ for (var cls in this.domEventMap) {
+ if (Lang.hasOwnProperty(this.domEventMap, cls)) {
+ var items = this.domEventMap[cls];
+
+ if (! (items instanceof Array)) {
+ items = [items];
+ }
+
+ for (var i=0;i 0) {
+
+ Event.addListener(navBtns, "click", function (e, obj) {
+ var target = Event.getTarget(e);
+ // this == navBtn
+ if (this === target || Dom.isAncestor(this, target)) {
+ Event.preventDefault(e);
+ }
+ var navigator = calParent.oNavigator;
+ if (navigator) {
+ var pgdate = cal.cfg.getProperty("pagedate");
+ navigator.setYear(pgdate.getFullYear() + cal.Locale.YEAR_OFFSET);
+ navigator.setMonth(pgdate.getMonth());
+ navigator.show();
+ }
+ });
+ }
+ },
+
+ /**
+ * 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
+ */
+ getDateByCellId : function(id) {
+ var date = this.getDateFieldsByCellId(id);
+ return (date) ? DateMath.getDate(date[0],date[1]-1,date[2]) : null;
+ },
+
+ /**
+ * 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
+ */
+ getDateFieldsByCellId : function(id) {
+ id = this.getIndexFromId(id);
+ return (id > -1) ? this.cellDates[id] : null;
+ },
+
+ /**
+ * Find the Calendar's cell index for a given date.
+ * If the date is not found, the method returns -1.
+ *
+ * The returned index can be used to lookup the cell HTMLElement
+ * using the Calendar's cells array or passed to selectCell to select
+ * cells by index.
+ *
+ *
+ * See cells , selectCell .
+ *
+ * @method getCellIndex
+ * @param {Date} date JavaScript Date object, for which to find a cell index.
+ * @return {Number} The index of the date in Calendars cellDates/cells arrays, or -1 if the date
+ * is not on the curently rendered Calendar page.
+ */
+ getCellIndex : function(date) {
+ var idx = -1;
+ if (date) {
+ var m = date.getMonth(),
+ y = date.getFullYear(),
+ d = date.getDate(),
+ dates = this.cellDates;
+
+ for (var i = 0; i < dates.length; ++i) {
+ var cellDate = dates[i];
+ if (cellDate[0] === y && cellDate[1] === m+1 && cellDate[2] === d) {
+ idx = i;
+ break;
+ }
+ }
+ }
+ return idx;
+ },
+
+ /**
+ * Given the id used to mark each Calendar cell, this method
+ * extracts the index number from the id.
+ *
+ * @param {String} strId The cell id
+ * @return {Number} The index of the cell, or -1 if id does not contain an index number
+ */
+ getIndexFromId : function(strId) {
+ var idx = -1,
+ li = strId.lastIndexOf("_cell");
+
+ if (li > -1) {
+ idx = parseInt(strId.substring(li + 5), 10);
+ }
+
+ return idx;
+ },
+
+ // 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
+ */
+ renderOutOfBoundsDate : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL_OOB);
+ cell.innerHTML = workingDate.getDate();
+ return 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
+ */
+ renderRowHeader : function(weekNum, html) {
+ html[html.length] = '';
+ 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
+ */
+ renderRowFooter : function(weekNum, html) {
+ html[html.length] = '';
+ 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
+ */
+ renderCellDefault : function(workingDate, cell) {
+ cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
+ },
+
+ /**
+ * 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
+ */
+ styleCellDefault : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight1 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight2 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight3 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight4 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleToday : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleSelected : function(workingDate, cell) {
+ 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
+ */
+ renderCellNotThisMonth : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+ cell.innerHTML=workingDate.getDate();
+ return 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
+ */
+ renderBodyCellRestricted : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL);
+ Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+ cell.innerHTML=workingDate.getDate();
+ return 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
+ */
+ addMonths : function(count) {
+ var cfgPageDate = DEF_CFG.PAGEDATE.key,
+
+ prevDate = this.cfg.getProperty(cfgPageDate),
+ newDate = DateMath.add(prevDate, DateMath.MONTH, count);
+
+ this.cfg.setProperty(cfgPageDate, newDate);
+ this.resetRenderers();
+ this.changePageEvent.fire(prevDate, newDate);
+ },
+
+ /**
+ * 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
+ */
+ subtractMonths : function(count) {
+ this.addMonths(-1*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
+ */
+ addYears : function(count) {
+ var cfgPageDate = DEF_CFG.PAGEDATE.key,
+
+ prevDate = this.cfg.getProperty(cfgPageDate),
+ newDate = DateMath.add(prevDate, DateMath.YEAR, count);
+
+ this.cfg.setProperty(cfgPageDate, newDate);
+ this.resetRenderers();
+ this.changePageEvent.fire(prevDate, newDate);
+ },
+
+ /**
+ * 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
+ */
+ subtractYears : function(count) {
+ this.addYears(-1*count);
+ },
+
+ /**
+ * Navigates to the next month page in the calendar widget.
+ * @method nextMonth
+ */
+ nextMonth : function() {
+ this.addMonths(1);
+ },
+
+ /**
+ * Navigates to the previous month page in the calendar widget.
+ * @method previousMonth
+ */
+ previousMonth : function() {
+ this.addMonths(-1);
+ },
+
+ /**
+ * Navigates to the next year in the currently selected month in the calendar widget.
+ * @method nextYear
+ */
+ nextYear : function() {
+ this.addYears(1);
+ },
+
+ /**
+ * Navigates to the previous year in the currently selected month in the calendar widget.
+ * @method previousYear
+ */
+ previousYear : function() {
+ this.addYears(-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
+ */
+ reset : function() {
+ this.cfg.resetProperty(DEF_CFG.SELECTED.key);
+ this.cfg.resetProperty(DEF_CFG.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
+ */
+ clear : function() {
+ this.cfg.setProperty(DEF_CFG.SELECTED.key, []);
+ this.cfg.setProperty(DEF_CFG.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.
+ */
+ select : function(date) {
+ this.logger.log("Select: " + date, "info");
+
+ var aToBeSelected = this._toFieldArray(date),
+ validDates = [],
+ selected = [],
+ cfgSelected = DEF_CFG.SELECTED.key;
+
+ this.logger.log("Selection field array: " + aToBeSelected, "info");
+
+ 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) { this.logger.log("All provided dates were OOB. beforeSelect and select events not fired", "info"); }
+
+ 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.
+ */
+ selectCell : function(cellIndex) {
+
+ var cell = this.cells[cellIndex],
+ cellDate = this.cellDates[cellIndex],
+ dCellDate = this._toDate(cellDate),
+ selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+
+ this.logger.log("Select: " + dCellDate, "info");
+ if (!selectable) {this.logger.log("The cell at cellIndex:" + cellIndex + " is not a selectable cell. beforeSelect, select events not fired", "info"); }
+
+ if (selectable) {
+
+ this.beforeSelectEvent.fire();
+
+ var cfgSelected = DEF_CFG.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.
+ */
+ deselect : function(date) {
+ this.logger.log("Deselect: " + date, "info");
+
+ var aToBeDeselected = this._toFieldArray(date),
+ validDates = [],
+ selected = [],
+ cfgSelected = DEF_CFG.SELECTED.key;
+
+ this.logger.log("Deselection field array: " + aToBeDeselected, "info");
+
+ 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) { this.logger.log("All provided dates were OOB. beforeDeselect and deselect events not fired");}
+
+ 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.
+ */
+ deselectCell : function(cellIndex) {
+ var cell = this.cells[cellIndex],
+ cellDate = this.cellDates[cellIndex],
+ cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
+
+ var selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+ if (!selectable) { this.logger.log("The cell at cellIndex:" + cellIndex + " is not a selectable/deselectable cell", "info"); }
+
+ if (selectable) {
+
+ this.beforeDeselectEvent.fire();
+
+ var selected = this.cfg.getProperty(DEF_CFG.SELECTED.key),
+ dCellDate = this._toDate(cellDate),
+ selectDate = cellDate.concat();
+
+ if (cellDateIndex > -1) {
+ if (this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
+ this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
+ Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+ }
+ selected.splice(cellDateIndex, 1);
+ }
+
+ if (this.parent) {
+ this.parent.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
+ } else {
+ this.cfg.setProperty(DEF_CFG.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.
+ */
+ deselectAll : function() {
+ this.beforeDeselectEvent.fire();
+
+ var cfgSelected = DEF_CFG.SELECTED.key,
+ selected = this.cfg.getProperty(cfgSelected),
+ count = selected.length,
+ 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
+ */
+ _toFieldArray : function(date) {
+ var returnDate = [];
+
+ if (date instanceof Date) {
+ returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+ } else if (Lang.isString(date)) {
+ returnDate = this._parseDates(date);
+ } else if (Lang.isArray(date)) {
+ for (var i=0;i 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
+ */
+ _parsePageDate : function(date) {
+ var parsedDate;
+
+ if (date) {
+ if (date instanceof Date) {
+ parsedDate = DateMath.findMonthStart(date);
+ } else {
+ var month, year, aMonthYear;
+ aMonthYear = date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));
+ month = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key)-1], 10)-1;
+ year = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key)-1], 10) - this.Locale.YEAR_OFFSET;
+
+ parsedDate = DateMath.getDate(year, month, 1);
+ }
+ } else {
+ parsedDate = DateMath.getDate(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.
+ */
+ onBeforeSelect : function() {
+ if (this.cfg.getProperty(DEF_CFG.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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ onChangePage : function() {
+ this.render();
+ },
+
+ /**
+ * Event executed when the calendar widget is rendered.
+ * @deprecated Event handlers for this event should be susbcribed to renderEvent.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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
+ */
+ 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[])
+ */
+ _parseDate : function(sDate) {
+ var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER),
+ rArray;
+
+ if (aDate.length == 2) {
+ rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
+ rArray.type = Calendar.MONTH_DAY;
+ } else {
+ rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1] - this.Locale.YEAR_OFFSET, aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
+ rArray.type = Calendar.DATE;
+ }
+
+ for (var i=0;i
+*
+*
+*
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+*
+*
+* NOTE: As of 2.4.0, the constructor's ID argument is optional.
+* The CalendarGroup can be constructed by simply providing a container ID string,
+* or a reference to a container DIV HTMLElement (the element needs to exist
+* in the document).
+*
+* E.g.:
+*
+* var c = new YAHOO.widget.CalendarGroup("calContainer", configOptions);
+*
+* or:
+*
+* var containerDiv = YAHOO.util.Dom.get("calContainer");
+* var c = new YAHOO.widget.CalendarGroup(containerDiv, configOptions);
+*
+*
+*
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the CalendarGroup's ID will be set to "calContainer_t".
+*
+*
+* @namespace YAHOO.widget
+* @class CalendarGroup
+* @constructor
+* @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
+*/
+function CalendarGroup(id, containerId, config) {
+ if (arguments.length > 0) {
+ this.init.apply(this, arguments);
+ }
+}
+
+/**
+* The set of default Config property keys and values for the CalendarGroup.
+*
+*
+* NOTE: This property is made public in order to allow users to change
+* the default values of configuration properties. Users should not
+* modify the key string, unless they are overriding the Calendar implementation
+*
+*
+* @property YAHOO.widget.CalendarGroup.DEFAULT_CONFIG
+* @static
+* @type Object An object with key/value pairs, the key being the
+* uppercase configuration property name and the value being an objec
+* literal with a key string property, and a value property, specifying the
+* default value of the property
+*/
+
+/**
+* The set of default Config property keys and values for the CalendarGroup
+* @property YAHOO.widget.CalendarGroup._DEFAULT_CONFIG
+* @deprecated Made public. See the public DEFAULT_CONFIG property for details
+* @private
+* @static
+* @type Object
+*/
+CalendarGroup.DEFAULT_CONFIG = CalendarGroup._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
+CalendarGroup.DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
+
+var DEF_CFG = CalendarGroup.DEFAULT_CONFIG;
+
+CalendarGroup.prototype = {
+
+ /**
+ * Initializes the calendar group. All subclasses must call this method in order for the
+ * group to be initialized properly.
+ * @method init
+ * @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+ * @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+ * @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
+ */
+ init : function(id, container, config) {
+
+ // Normalize 2.4.0, pre 2.4.0 args
+ var nArgs = this._parseArgs(arguments);
+
+ id = nArgs.id;
+ container = nArgs.container;
+ config = nArgs.config;
+
+ this.oDomContainer = Dom.get(container);
+ if (!this.oDomContainer) { this.logger.log("Container not found in document.", "error"); }
+
+ if (!this.oDomContainer.id) {
+ this.oDomContainer.id = Dom.generateId();
+ }
+ if (!id) {
+ id = this.oDomContainer.id + "_t";
+ }
+
+ /**
+ * 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 = this.oDomContainer.id;
+
+ this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + this.id);
+ this.initEvents();
+ this.initStyles();
+
+ /**
+ * The collection of Calendar pages contained within the CalendarGroup
+ * @property pages
+ * @type YAHOO.widget.Calendar[]
+ */
+ this.pages = [];
+
+ Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
+ Dom.addClass(this.oDomContainer, 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);
+ this.showEvent.subscribe(this._fixWidth, this, true);
+ }
+
+ this.logger.log("Initialized " + this.pages.length + "-page CalendarGroup", "info");
+ },
+
+ setupConfig : function() {
+
+ var cfg = this.cfg;
+
+ /**
+ * 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
+ */
+ cfg.addProperty(DEF_CFG.PAGES.key, { value:DEF_CFG.PAGES.value, validator:cfg.checkNumber, handler:this.configPages } );
+
+ /**
+ * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
+ * be used when displaying or parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
+ * methods will always represent the Gregorian year, in order to maintain date/month/week values.
+ *
+ * @config year_offset
+ * @type Number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, handler: this.delegateConfig, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, suppressEvent:true } );
+
+ /**
+ * The date to use to represent "Today".
+ *
+ * @config today
+ * @type Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler: this.configToday, suppressEvent:false } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String | Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ *
+ * @config selected
+ * @type String
+ * @default []
+ */
+ cfg.addProperty(DEF_CFG.SELECTED.key, { value:[], handler:this.configSelected } );
+
+ /**
+ * The title to display above the CalendarGroup's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this CalendarGroup
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.delegateConfig } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{ value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{ value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.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 ","
+ */
+ cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.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 "/"
+ */
+ cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{ value:DEF_CFG.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 "-"
+ */
+ cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{ value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The suffix used after the month when rendering the Calendar header
+ * @config MY_LABEL_MONTH_SUFFIX
+ * @type String
+ * @default " "
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.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 ""
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
+
+ /**
+ * Configuration for the Month Year Navigation UI. By default it is disabled
+ * @config NAV
+ * @type Object
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
+
+ /**
+ * The map of UI strings which the CalendarGroup UI uses.
+ *
+ * @config strings
+ * @type {Object}
+ * @default An object with the properties shown below:
+ *
+ * previousMonth String : The string to use for the "Previous Month" navigation UI. Defaults to "Previous Month".
+ * nextMonth String : The string to use for the "Next Month" navigation UI. Defaults to "Next Month".
+ * close String : The string to use for the close button label. Defaults to "Close".
+ *
+ */
+ cfg.addProperty(DEF_CFG.STRINGS.key, {
+ value:DEF_CFG.STRINGS.value,
+ handler:this.configStrings,
+ validator: function(val) {
+ return Lang.isObject(val);
+ },
+ supercedes: DEF_CFG.STRINGS.supercedes
+ });
+ },
+
+ /**
+ * Initializes CalendarGroup's built-in CustomEvents
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ var me = this,
+ strEvent = "Event",
+ CE = YAHOO.util.CustomEvent;
+
+ /**
+ * 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 0) {
+ caldate = new Date(firstPageDate);
+ this._setMonthOnDate(caldate, caldate.getMonth() + p);
+ childConfig.pageDate = caldate;
+ }
+
+ var cal = this.constructChild(calId, calContainerId, childConfig);
+
+ Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
+ Dom.addClass(cal.oDomContainer, groupCalClass);
+
+ if (p===0) {
+ firstPageDate = cal.cfg.getProperty(cfgPageDate);
+ Dom.addClass(cal.oDomContainer, firstClass);
+ }
+
+ if (p==(pageCount-1)) {
+ 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.
+ */
+ configPageDate : function(type, args, obj) {
+ var val = args[0],
+ firstPageDate;
+
+ var cfgPageDate = DEF_CFG.PAGEDATE.key;
+
+ for (var p=0;p 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.
+ */
+ delegateConfig : function(type, args, obj) {
+ var val = args[0];
+ var cal;
+
+ for (var p=0;p0) {
+ year+=1;
+ }
+ cal.setYear(year);
+ }
+ },
+
+ /**
+ * Calls the render function of all child calendars within the group.
+ * @method render
+ */
+ render : function() {
+ this.renderHeader();
+ for (var p=0;p
+ * If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.
+ * If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.
+ *
+ * @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.
+ */
+ selectCell : function(cellIndex) {
+ for (var p=0;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
+ */
+ nextYear : function() {
+ for (var p=0;p 11)) {
+ var newDate = DateMath.add(date, DateMath.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
+ */
+ _fixWidth : function() {
+ var w = 0;
+ for (var p=0;p 0) {
+ this.oDomContainer.style.width = w + "px";
+ }
+ },
+
+ /**
+ * Returns a string representation of the object.
+ * @method toString
+ * @return {String} A string representation of the CalendarGroup object.
+ */
+ toString : function() {
+ return "CalendarGroup " + this.id;
+ },
+
+ /**
+ * Destroys the CalendarGroup instance. The method will remove references
+ * to HTML elements, remove any event listeners added by the CalendarGroup.
+ *
+ * It will also destroy the Config and CalendarNavigator instances created by the
+ * CalendarGroup and the individual Calendar instances created for each page.
+ *
+ * @method destroy
+ */
+ destroy : function() {
+
+ if (this.beforeDestroyEvent.fire()) {
+
+ var cal = this;
+
+ // Child objects
+ if (cal.navigator) {
+ cal.navigator.destroy();
+ }
+
+ if (cal.cfg) {
+ cal.cfg.destroy();
+ }
+
+ // DOM event listeners
+ Event.purgeElement(cal.oDomContainer, true);
+
+ // Generated markup/DOM - Not removing the container DIV since we didn't create it.
+ Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_CONTAINER);
+ Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_MULTI_UP);
+
+ for (var i = 0, l = cal.pages.length; i < l; i++) {
+ cal.pages[i].destroy();
+ cal.pages[i] = null;
+ }
+
+ cal.oDomContainer.innerHTML = "";
+
+ // JS-to-DOM references
+ cal.oDomContainer = null;
+
+ this.destroyEvent.fire();
+ }
+ }
+};
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
+* @static
+* @final
+* @type String
+*/
+CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_MULTI_UP
+* @static
+* @final
+* @type String
+*/
+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
+*/
+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 Style.CSS_CLOSE property now represents the CSS class used to render the close icon
+* @type String
+*/
+CalendarGroup.CSS_2UPCLOSE = "close-icon";
+
+YAHOO.lang.augmentProto(CalendarGroup, Calendar, "buildDayLabel",
+ "buildMonthLabel",
+ "renderOutOfBoundsDate",
+ "renderRowHeader",
+ "renderRowFooter",
+ "renderCellDefault",
+ "styleCellDefault",
+ "renderCellStyleHighlight1",
+ "renderCellStyleHighlight2",
+ "renderCellStyleHighlight3",
+ "renderCellStyleHighlight4",
+ "renderCellStyleToday",
+ "renderCellStyleSelected",
+ "renderCellNotThisMonth",
+ "renderBodyCellRestricted",
+ "initStyles",
+ "configTitle",
+ "configClose",
+ "configIframe",
+ "configStrings",
+ "configToday",
+ "configNavigator",
+ "createTitleBar",
+ "createCloseButton",
+ "removeTitleBar",
+ "removeCloseButton",
+ "hide",
+ "show",
+ "toDate",
+ "_toDate",
+ "_parseArgs",
+ "browser");
+
+YAHOO.widget.CalGrp = CalendarGroup;
+YAHOO.widget.CalendarGroup = 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, 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;
+
+})();
+/**
+ * The CalendarNavigator is used along with a Calendar/CalendarGroup to
+ * provide a Month/Year popup navigation control, allowing the user to navigate
+ * to a specific month/year in the Calendar/CalendarGroup without having to
+ * scroll through months sequentially
+ *
+ * @namespace YAHOO.widget
+ * @class CalendarNavigator
+ * @constructor
+ * @param {Calendar|CalendarGroup} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached.
+ */
+YAHOO.widget.CalendarNavigator = function(cal) {
+ this.init(cal);
+};
+
+(function() {
+ // Setup static properties (inside anon fn, so that we can use shortcuts)
+ var CN = YAHOO.widget.CalendarNavigator;
+
+ /**
+ * YAHOO.widget.CalendarNavigator.CLASSES contains constants
+ * for the class values applied to the CalendarNaviatgator's
+ * DOM elements
+ * @property YAHOO.widget.CalendarNavigator.CLASSES
+ * @type Object
+ * @static
+ */
+ CN.CLASSES = {
+ /**
+ * Class applied to the Calendar Navigator's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV
+ * @type String
+ * @static
+ */
+ NAV :"yui-cal-nav",
+ /**
+ * Class applied to the Calendar/CalendarGroup's bounding box to indicate
+ * the Navigator is currently visible
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV_VISIBLE
+ * @type String
+ * @static
+ */
+ NAV_VISIBLE: "yui-cal-nav-visible",
+ /**
+ * Class applied to the Navigator mask's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MASK
+ * @type String
+ * @static
+ */
+ MASK : "yui-cal-nav-mask",
+ /**
+ * Class applied to the year label/control bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR
+ * @type String
+ * @static
+ */
+ YEAR : "yui-cal-nav-y",
+ /**
+ * Class applied to the month label/control bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH
+ * @type String
+ * @static
+ */
+ MONTH : "yui-cal-nav-m",
+ /**
+ * Class applied to the submit/cancel button's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTONS
+ * @type String
+ * @static
+ */
+ BUTTONS : "yui-cal-nav-b",
+ /**
+ * Class applied to buttons wrapping element
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTON
+ * @type String
+ * @static
+ */
+ BUTTON : "yui-cal-nav-btn",
+ /**
+ * Class applied to the validation error area's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.ERROR
+ * @type String
+ * @static
+ */
+ ERROR : "yui-cal-nav-e",
+ /**
+ * Class applied to the year input control
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR_CTRL
+ * @type String
+ * @static
+ */
+ YEAR_CTRL : "yui-cal-nav-yc",
+ /**
+ * Class applied to the month input control
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH_CTRL
+ * @type String
+ * @static
+ */
+ MONTH_CTRL : "yui-cal-nav-mc",
+ /**
+ * Class applied to controls with invalid data (e.g. a year input field with invalid an year)
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.INVALID
+ * @type String
+ * @static
+ */
+ INVALID : "yui-invalid",
+ /**
+ * Class applied to default controls
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.DEFAULT
+ * @type String
+ * @static
+ */
+ DEFAULT : "yui-default"
+ };
+
+ /**
+ * Object literal containing the default configuration values for the CalendarNavigator
+ * The configuration object is expected to follow the format below, with the properties being
+ * case sensitive.
+ *
+ * strings
+ * Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
+ *
+ * month String : The string to use for the month label. Defaults to "Month".
+ * year String : The string to use for the year label. Defaults to "Year".
+ * submit String : The string to use for the submit button label. Defaults to "Okay".
+ * cancel String : The string to use for the cancel button label. Defaults to "Cancel".
+ * invalidYear String : The string to use for invalid year values. Defaults to "Year needs to be a number".
+ *
+ *
+ * monthFormat String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
+ * initialFocus String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
+ *
+ * @property DEFAULT_CONFIG
+ * @type Object
+ * @static
+ */
+ CN.DEFAULT_CONFIG = {
+ strings : {
+ month: "Month",
+ year: "Year",
+ submit: "Okay",
+ cancel: "Cancel",
+ invalidYear : "Year needs to be a number"
+ },
+ monthFormat: YAHOO.widget.Calendar.LONG,
+ initialFocus: "year"
+ };
+
+ /**
+ * Object literal containing the default configuration values for the CalendarNavigator
+ * @property _DEFAULT_CFG
+ * @protected
+ * @deprecated Made public. See the public DEFAULT_CONFIG property
+ * @type Object
+ * @static
+ */
+ CN._DEFAULT_CFG = CN.DEFAULT_CONFIG;
+
+
+ /**
+ * The suffix added to the Calendar/CalendarGroup's ID, to generate
+ * a unique ID for the Navigator and it's bounding box.
+ * @property YAHOO.widget.CalendarNavigator.ID_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.ID_SUFFIX = "_nav";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the month control.
+ * @property YAHOO.widget.CalendarNavigator.MONTH_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.MONTH_SUFFIX = "_month";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the year control.
+ * @property YAHOO.widget.CalendarNavigator.YEAR_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.YEAR_SUFFIX = "_year";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the error bounding box.
+ * @property YAHOO.widget.CalendarNavigator.ERROR_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.ERROR_SUFFIX = "_error";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the "Cancel" button.
+ * @property YAHOO.widget.CalendarNavigator.CANCEL_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.CANCEL_SUFFIX = "_cancel";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the "Submit" button.
+ * @property YAHOO.widget.CalendarNavigator.SUBMIT_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.SUBMIT_SUFFIX = "_submit";
+
+ /**
+ * The number of digits to which the year input control is to be limited.
+ * @property YAHOO.widget.CalendarNavigator.YR_MAX_DIGITS
+ * @static
+ * @type Number
+ */
+ CN.YR_MAX_DIGITS = 4;
+
+ /**
+ * The amount by which to increment the current year value,
+ * when the arrow up/down key is pressed on the year control
+ * @property YAHOO.widget.CalendarNavigator.YR_MINOR_INC
+ * @static
+ * @type Number
+ */
+ CN.YR_MINOR_INC = 1;
+
+ /**
+ * The amount by which to increment the current year value,
+ * when the page up/down key is pressed on the year control
+ * @property YAHOO.widget.CalendarNavigator.YR_MAJOR_INC
+ * @static
+ * @type Number
+ */
+ CN.YR_MAJOR_INC = 10;
+
+ /**
+ * Artificial delay (in ms) between the time the Navigator is hidden
+ * and the Calendar/CalendarGroup state is updated. Allows the user
+ * the see the Calendar/CalendarGroup page changing. If set to 0
+ * the Calendar/CalendarGroup page will be updated instantly
+ * @property YAHOO.widget.CalendarNavigator.UPDATE_DELAY
+ * @static
+ * @type Number
+ */
+ CN.UPDATE_DELAY = 50;
+
+ /**
+ * Regular expression used to validate the year input
+ * @property YAHOO.widget.CalendarNavigator.YR_PATTERN
+ * @static
+ * @type RegExp
+ */
+ CN.YR_PATTERN = /^\d+$/;
+ /**
+ * Regular expression used to trim strings
+ * @property YAHOO.widget.CalendarNavigator.TRIM
+ * @static
+ * @type RegExp
+ */
+ CN.TRIM = /^\s*(.*?)\s*$/;
+})();
+
+YAHOO.widget.CalendarNavigator.prototype = {
+
+ /**
+ * The unique ID for this CalendarNavigator instance
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The Calendar/CalendarGroup instance to which the navigator belongs
+ * @property cal
+ * @type {Calendar|CalendarGroup}
+ */
+ cal : null,
+
+ /**
+ * Reference to the HTMLElement used to render the navigator's bounding box
+ * @property navEl
+ * @type HTMLElement
+ */
+ navEl : null,
+
+ /**
+ * Reference to the HTMLElement used to render the navigator's mask
+ * @property maskEl
+ * @type HTMLElement
+ */
+ maskEl : null,
+
+ /**
+ * Reference to the HTMLElement used to input the year
+ * @property yearEl
+ * @type HTMLElement
+ */
+ yearEl : null,
+
+ /**
+ * Reference to the HTMLElement used to input the month
+ * @property monthEl
+ * @type HTMLElement
+ */
+ monthEl : null,
+
+ /**
+ * Reference to the HTMLElement used to display validation errors
+ * @property errorEl
+ * @type HTMLElement
+ */
+ errorEl : null,
+
+ /**
+ * Reference to the HTMLElement used to update the Calendar/Calendar group
+ * with the month/year values
+ * @property submitEl
+ * @type HTMLElement
+ */
+ submitEl : null,
+
+ /**
+ * Reference to the HTMLElement used to hide the navigator without updating the
+ * Calendar/Calendar group
+ * @property cancelEl
+ * @type HTMLElement
+ */
+ cancelEl : null,
+
+ /**
+ * Reference to the first focusable control in the navigator (by default monthEl)
+ * @property firstCtrl
+ * @type HTMLElement
+ */
+ firstCtrl : null,
+
+ /**
+ * Reference to the last focusable control in the navigator (by default cancelEl)
+ * @property lastCtrl
+ * @type HTMLElement
+ */
+ lastCtrl : null,
+
+ /**
+ * The document containing the Calendar/Calendar group instance
+ * @protected
+ * @property _doc
+ * @type HTMLDocument
+ */
+ _doc : null,
+
+ /**
+ * Internal state property for the current year displayed in the navigator
+ * @protected
+ * @property _year
+ * @type Number
+ */
+ _year: null,
+
+ /**
+ * Internal state property for the current month index displayed in the navigator
+ * @protected
+ * @property _month
+ * @type Number
+ */
+ _month: 0,
+
+ /**
+ * Private internal state property which indicates whether or not the
+ * Navigator has been rendered.
+ * @private
+ * @property __rendered
+ * @type Boolean
+ */
+ __rendered: false,
+
+ /**
+ * Init lifecycle method called as part of construction
+ *
+ * @method init
+ * @param {Calendar} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached
+ */
+ init : function(cal) {
+ var calBox = cal.oDomContainer;
+
+ this.cal = cal;
+ this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
+ this._doc = calBox.ownerDocument;
+
+ /**
+ * Private flag, to identify IE Quirks
+ * @private
+ * @property __isIEQuirks
+ */
+ var ie = YAHOO.env.ua.ie;
+ this.__isIEQuirks = (ie && ((ie <= 6) || (this._doc.compatMode == "BackCompat")));
+ },
+
+ /**
+ * Displays the navigator and mask, updating the input controls to reflect the
+ * currently set month and year. The show method will invoke the render method
+ * if the navigator has not been renderered already, allowing for lazy rendering
+ * of the control.
+ *
+ * The show method will fire the Calendar/CalendarGroup's beforeShowNav and showNav events
+ *
+ * @method show
+ */
+ show : function() {
+ var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ if (this.cal.beforeShowNavEvent.fire()) {
+ if (!this.__rendered) {
+ this.render();
+ }
+ this.clearErrors();
+
+ this._updateMonthUI();
+ this._updateYearUI();
+ this._show(this.navEl, true);
+
+ this.setInitialFocus();
+ this.showMask();
+
+ YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+ this.cal.showNavEvent.fire();
+ }
+ },
+
+ /**
+ * Hides the navigator and mask
+ *
+ * The show method will fire the Calendar/CalendarGroup's beforeHideNav event and hideNav events
+ * @method hide
+ */
+ hide : function() {
+ var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ if (this.cal.beforeHideNavEvent.fire()) {
+ this._show(this.navEl, false);
+ this.hideMask();
+ YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+ this.cal.hideNavEvent.fire();
+ }
+ },
+
+
+ /**
+ * Displays the navigator's mask element
+ *
+ * @method showMask
+ */
+ showMask : function() {
+ this._show(this.maskEl, true);
+ if (this.__isIEQuirks) {
+ this._syncMask();
+ }
+ },
+
+ /**
+ * Hides the navigator's mask element
+ *
+ * @method hideMask
+ */
+ hideMask : function() {
+ this._show(this.maskEl, false);
+ },
+
+ /**
+ * Returns the current month set on the navigator
+ *
+ * Note: This may not be the month set in the UI, if
+ * the UI contains an invalid value.
+ *
+ * @method getMonth
+ * @return {Number} The Navigator's current month index
+ */
+ getMonth: function() {
+ return this._month;
+ },
+
+ /**
+ * Returns the current year set on the navigator
+ *
+ * Note: This may not be the year set in the UI, if
+ * the UI contains an invalid value.
+ *
+ * @method getYear
+ * @return {Number} The Navigator's current year value
+ */
+ getYear: function() {
+ return this._year;
+ },
+
+ /**
+ * Sets the current month on the Navigator, and updates the UI
+ *
+ * @method setMonth
+ * @param {Number} nMonth The month index, from 0 (Jan) through 11 (Dec).
+ */
+ setMonth : function(nMonth) {
+ if (nMonth >= 0 && nMonth < 12) {
+ this._month = nMonth;
+ }
+ this._updateMonthUI();
+ },
+
+ /**
+ * Sets the current year on the Navigator, and updates the UI. If the
+ * provided year is invalid, it will not be set.
+ *
+ * @method setYear
+ * @param {Number} nYear The full year value to set the Navigator to.
+ */
+ setYear : function(nYear) {
+ var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
+ if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
+ this._year = nYear;
+ }
+ this._updateYearUI();
+ },
+
+ /**
+ * Renders the HTML for the navigator, adding it to the
+ * document and attaches event listeners if it has not
+ * already been rendered.
+ *
+ * @method render
+ */
+ render: function() {
+ this.cal.beforeRenderNavEvent.fire();
+ if (!this.__rendered) {
+ this.createNav();
+ this.createMask();
+ this.applyListeners();
+ this.__rendered = true;
+ }
+ this.cal.renderNavEvent.fire();
+ },
+
+ /**
+ * Creates the navigator's containing HTMLElement, it's contents, and appends
+ * the containg element to the Calendar/CalendarGroup's container.
+ *
+ * @method createNav
+ */
+ createNav : function() {
+ var NAV = YAHOO.widget.CalendarNavigator;
+ var doc = this._doc;
+
+ var d = doc.createElement("div");
+ d.className = NAV.CLASSES.NAV;
+
+ var htmlBuf = this.renderNavContents([]);
+
+ d.innerHTML = htmlBuf.join('');
+ this.cal.oDomContainer.appendChild(d);
+
+ this.navEl = d;
+
+ this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
+ this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
+ this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
+ this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
+ this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
+
+ if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
+ // Avoid XUL error on focus, select [ https://bugzilla.mozilla.org/show_bug.cgi?id=236791,
+ // supposedly fixed in 1.8.1, but there are reports of it still being around for methods other than blur ]
+ this.yearEl.setAttribute("autocomplete", "off");
+ }
+
+ this._setFirstLastElements();
+ },
+
+ /**
+ * Creates the Mask HTMLElement and appends it to the Calendar/CalendarGroups
+ * container.
+ *
+ * @method createMask
+ */
+ createMask : function() {
+ var C = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ var d = this._doc.createElement("div");
+ d.className = C.MASK;
+
+ this.cal.oDomContainer.appendChild(d);
+ this.maskEl = d;
+ },
+
+ /**
+ * Used to set the width/height of the mask in pixels to match the Calendar Container.
+ * Currently only used for IE6 or IE in quirks mode. The other A-Grade browser are handled using CSS (width/height 100%).
+ *
+ * The method is also registered as an HTMLElement resize listener on the Calendars container element.
+ *
+ * @protected
+ * @method _syncMask
+ */
+ _syncMask : function() {
+ var c = this.cal.oDomContainer;
+ if (c && this.maskEl) {
+ var r = YAHOO.util.Dom.getRegion(c);
+ YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
+ YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
+ }
+ },
+
+ /**
+ * Renders the contents of the navigator
+ *
+ * @method renderNavContents
+ *
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderNavContents : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES,
+ h = html; // just to use a shorter name
+
+ h[h.length] = '';
+ this.renderMonth(h);
+ h[h.length] = '
';
+ h[h.length] = '';
+ this.renderYear(h);
+ h[h.length] = '
';
+ h[h.length] = '';
+ this.renderButtons(h);
+ h[h.length] = '
';
+ h[h.length] = '
';
+
+ return h;
+ },
+
+ /**
+ * Renders the month label and control for the navigator
+ *
+ * @method renderNavContents
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderMonth : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES;
+
+ var id = this.id + NAV.MONTH_SUFFIX,
+ mf = this.__getCfg("monthFormat"),
+ months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),
+ h = html;
+
+ if (months && months.length > 0) {
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("month", true);
+ h[h.length] = ' ';
+ h[h.length] = '';
+ for (var i = 0; i < months.length; i++) {
+ h[h.length] = '';
+ h[h.length] = months[i];
+ h[h.length] = ' ';
+ }
+ h[h.length] = ' ';
+ }
+ return h;
+ },
+
+ /**
+ * Renders the year label and control for the navigator
+ *
+ * @method renderYear
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderYear : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES;
+
+ var id = this.id + NAV.YEAR_SUFFIX,
+ size = NAV.YR_MAX_DIGITS,
+ h = html;
+
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("year", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+ return h;
+ },
+
+ /**
+ * Renders the submit/cancel buttons for the navigator
+ *
+ * @method renderButton
+ * @return {String} The HTML created for the Button UI
+ */
+ renderButtons : function(html) {
+ var C = YAHOO.widget.CalendarNavigator.CLASSES;
+ var h = html;
+
+ h[h.length] = '';
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("submit", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+ h[h.length] = '';
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("cancel", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+
+ return h;
+ },
+
+ /**
+ * Attaches DOM event listeners to the rendered elements
+ *
+ * The method will call applyKeyListeners, to setup keyboard specific
+ * listeners
+ *
+ * @method applyListeners
+ */
+ applyListeners : function() {
+ var E = YAHOO.util.Event;
+
+ function yearUpdateHandler() {
+ if (this.validate()) {
+ this.setYear(this._getYearFromUI());
+ }
+ }
+
+ function monthUpdateHandler() {
+ this.setMonth(this._getMonthFromUI());
+ }
+
+ E.on(this.submitEl, "click", this.submit, this, true);
+ E.on(this.cancelEl, "click", this.cancel, this, true);
+ E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
+ E.on(this.monthEl, "change", monthUpdateHandler, this, true);
+
+ if (this.__isIEQuirks) {
+ YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
+ }
+
+ this.applyKeyListeners();
+ },
+
+ /**
+ * Removes/purges DOM event listeners from the rendered elements
+ *
+ * @method purgeListeners
+ */
+ purgeListeners : function() {
+ var E = YAHOO.util.Event;
+ E.removeListener(this.submitEl, "click", this.submit);
+ E.removeListener(this.cancelEl, "click", this.cancel);
+ E.removeListener(this.yearEl, "blur");
+ E.removeListener(this.monthEl, "change");
+ if (this.__isIEQuirks) {
+ E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
+ }
+
+ this.purgeKeyListeners();
+ },
+
+ /**
+ * Attaches DOM listeners for keyboard support.
+ * Tab/Shift-Tab looping, Enter Key Submit on Year element,
+ * Up/Down/PgUp/PgDown year increment on Year element
+ *
+ * NOTE: MacOSX Safari 2.x doesn't let you tab to buttons and
+ * MacOSX Gecko does not let you tab to buttons or select controls,
+ * so for these browsers, Tab/Shift-Tab looping is limited to the
+ * elements which can be reached using the tab key.
+ *
+ * @method applyKeyListeners
+ */
+ applyKeyListeners : function() {
+ var E = YAHOO.util.Event,
+ ua = YAHOO.env.ua;
+
+ // IE/Safari 3.1 doesn't fire keypress for arrow/pg keys (non-char keys)
+ var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
+
+ // - IE/Safari 3.1 doesn't fire keypress for non-char keys
+ // - Opera doesn't allow us to cancel keydown or keypress for tab, but
+ // changes focus successfully on keydown (keypress is too late to change focus - opera's already moved on).
+ var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
+
+ // Everyone likes keypress for Enter (char keys) - whoo hoo!
+ E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
+
+ E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
+ E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
+ E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
+ },
+
+ /**
+ * Removes/purges DOM listeners for keyboard support
+ *
+ * @method purgeKeyListeners
+ */
+ purgeKeyListeners : function() {
+ var E = YAHOO.util.Event,
+ ua = YAHOO.env.ua;
+
+ var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
+ var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
+
+ E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
+ E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
+ E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
+ E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
+ },
+
+ /**
+ * Updates the Calendar/CalendarGroup's pagedate with the currently set month and year if valid.
+ *
+ * If the currently set month/year is invalid, a validation error will be displayed and the
+ * Calendar/CalendarGroup's pagedate will not be updated.
+ *
+ * @method submit
+ */
+ submit : function() {
+ if (this.validate()) {
+ this.hide();
+
+ this.setMonth(this._getMonthFromUI());
+ this.setYear(this._getYearFromUI());
+
+ var cal = this.cal;
+
+ // Artificial delay, just to help the user see something changed
+ var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
+ if (delay > 0) {
+ var nav = this;
+ window.setTimeout(function(){ nav._update(cal); }, delay);
+ } else {
+ this._update(cal);
+ }
+ }
+ },
+
+ /**
+ * Updates the Calendar rendered state, based on the state of the CalendarNavigator
+ * @method _update
+ * @param cal The Calendar instance to update
+ * @protected
+ */
+ _update : function(cal) {
+ var date = YAHOO.widget.DateMath.getDate(this.getYear() - cal.cfg.getProperty("YEAR_OFFSET"), this.getMonth(), 1);
+ cal.cfg.setProperty("pagedate", date);
+ cal.render();
+ },
+
+ /**
+ * Hides the navigator and mask, without updating the Calendar/CalendarGroup's state
+ *
+ * @method cancel
+ */
+ cancel : function() {
+ this.hide();
+ },
+
+ /**
+ * Validates the current state of the UI controls
+ *
+ * @method validate
+ * @return {Boolean} true, if the current UI state contains valid values, false if not
+ */
+ validate : function() {
+ if (this._getYearFromUI() !== null) {
+ this.clearErrors();
+ return true;
+ } else {
+ this.setYearError();
+ this.setError(this.__getCfg("invalidYear", true));
+ return false;
+ }
+ },
+
+ /**
+ * Displays an error message in the Navigator's error panel
+ * @method setError
+ * @param {String} msg The error message to display
+ */
+ setError : function(msg) {
+ if (this.errorEl) {
+ this.errorEl.innerHTML = msg;
+ this._show(this.errorEl, true);
+ }
+ },
+
+ /**
+ * Clears the navigator's error message and hides the error panel
+ * @method clearError
+ */
+ clearError : function() {
+ if (this.errorEl) {
+ this.errorEl.innerHTML = "";
+ this._show(this.errorEl, false);
+ }
+ },
+
+ /**
+ * Displays the validation error UI for the year control
+ * @method setYearError
+ */
+ setYearError : function() {
+ YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+ },
+
+ /**
+ * Removes the validation error UI for the year control
+ * @method clearYearError
+ */
+ clearYearError : function() {
+ YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+ },
+
+ /**
+ * Clears all validation and error messages in the UI
+ * @method clearErrors
+ */
+ clearErrors : function() {
+ this.clearError();
+ this.clearYearError();
+ },
+
+ /**
+ * Sets the initial focus, based on the configured value
+ * @method setInitialFocus
+ */
+ setInitialFocus : function() {
+ var el = this.submitEl,
+ f = this.__getCfg("initialFocus");
+
+ if (f && f.toLowerCase) {
+ f = f.toLowerCase();
+ if (f == "year") {
+ el = this.yearEl;
+ try {
+ this.yearEl.select();
+ } catch (selErr) {
+ // Ignore;
+ }
+ } else if (f == "month") {
+ el = this.monthEl;
+ }
+ }
+
+ if (el && YAHOO.lang.isFunction(el.focus)) {
+ try {
+ el.focus();
+ } catch (focusErr) {
+ // TODO: Fall back if focus fails?
+ }
+ }
+ },
+
+ /**
+ * Removes all renderered HTML elements for the Navigator from
+ * the DOM, purges event listeners and clears (nulls) any property
+ * references to HTML references
+ * @method erase
+ */
+ erase : function() {
+ if (this.__rendered) {
+ this.purgeListeners();
+
+ // Clear out innerHTML references
+ this.yearEl = null;
+ this.monthEl = null;
+ this.errorEl = null;
+ this.submitEl = null;
+ this.cancelEl = null;
+ this.firstCtrl = null;
+ this.lastCtrl = null;
+ if (this.navEl) {
+ this.navEl.innerHTML = "";
+ }
+
+ var p = this.navEl.parentNode;
+ if (p) {
+ p.removeChild(this.navEl);
+ }
+ this.navEl = null;
+
+ var pm = this.maskEl.parentNode;
+ if (pm) {
+ pm.removeChild(this.maskEl);
+ }
+ this.maskEl = null;
+ this.__rendered = false;
+ }
+ },
+
+ /**
+ * Destroys the Navigator object and any HTML references
+ * @method destroy
+ */
+ destroy : function() {
+ this.erase();
+ this._doc = null;
+ this.cal = null;
+ this.id = null;
+ },
+
+ /**
+ * Protected implementation to handle how UI elements are
+ * hidden/shown.
+ *
+ * @method _show
+ * @protected
+ */
+ _show : function(el, bShow) {
+ if (el) {
+ YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block" : "none");
+ }
+ },
+
+ /**
+ * Returns the month value (index), from the month UI element
+ * @protected
+ * @method _getMonthFromUI
+ * @return {Number} The month index, or 0 if a UI element for the month
+ * is not found
+ */
+ _getMonthFromUI : function() {
+ if (this.monthEl) {
+ return this.monthEl.selectedIndex;
+ } else {
+ return 0; // Default to Jan
+ }
+ },
+
+ /**
+ * Returns the year value, from the Navitator's year UI element
+ * @protected
+ * @method _getYearFromUI
+ * @return {Number} The year value set in the UI, if valid. null is returned if
+ * the UI does not contain a valid year value.
+ */
+ _getYearFromUI : function() {
+ var NAV = YAHOO.widget.CalendarNavigator;
+
+ var yr = null;
+ if (this.yearEl) {
+ var value = this.yearEl.value;
+ value = value.replace(NAV.TRIM, "$1");
+
+ if (NAV.YR_PATTERN.test(value)) {
+ yr = parseInt(value, 10);
+ }
+ }
+ return yr;
+ },
+
+ /**
+ * Updates the Navigator's year UI, based on the year value set on the Navigator object
+ * @protected
+ * @method _updateYearUI
+ */
+ _updateYearUI : function() {
+ if (this.yearEl && this._year !== null) {
+ this.yearEl.value = this._year;
+ }
+ },
+
+ /**
+ * Updates the Navigator's month UI, based on the month value set on the Navigator object
+ * @protected
+ * @method _updateMonthUI
+ */
+ _updateMonthUI : function() {
+ if (this.monthEl) {
+ this.monthEl.selectedIndex = this._month;
+ }
+ },
+
+ /**
+ * Sets up references to the first and last focusable element in the Navigator's UI
+ * in terms of tab order (Naviagator's firstEl and lastEl properties). The references
+ * are used to control modality by looping around from the first to the last control
+ * and visa versa for tab/shift-tab navigation.
+ *
+ * See applyKeyListeners
+ *
+ * @protected
+ * @method _setFirstLastElements
+ */
+ _setFirstLastElements : function() {
+ this.firstCtrl = this.monthEl;
+ this.lastCtrl = this.cancelEl;
+
+ // Special handling for MacOSX.
+ // - Safari 2.x can't focus on buttons
+ // - Gecko can't focus on select boxes or buttons
+ if (this.__isMac) {
+ if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420){
+ this.firstCtrl = this.monthEl;
+ this.lastCtrl = this.yearEl;
+ }
+ if (YAHOO.env.ua.gecko) {
+ this.firstCtrl = this.yearEl;
+ this.lastCtrl = this.yearEl;
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Enter
+ * on the Navigator's year control (yearEl)
+ *
+ * @method _handleEnterKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleEnterKey : function(e) {
+ var KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
+ YAHOO.util.Event.preventDefault(e);
+ this.submit();
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture up/down/pgup/pgdown
+ * on the Navigator's year control (yearEl).
+ *
+ * @method _handleDirectionKeys
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleDirectionKeys : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY,
+ NAV = YAHOO.widget.CalendarNavigator;
+
+ var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
+ if (isFinite(value)) {
+ var dir = false;
+ switch(E.getCharCode(e)) {
+ case KEYS.UP:
+ this.yearEl.value = value + NAV.YR_MINOR_INC;
+ dir = true;
+ break;
+ case KEYS.DOWN:
+ this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
+ dir = true;
+ break;
+ case KEYS.PAGE_UP:
+ this.yearEl.value = value + NAV.YR_MAJOR_INC;
+ dir = true;
+ break;
+ case KEYS.PAGE_DOWN:
+ this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
+ dir = true;
+ break;
+ default:
+ break;
+ }
+ if (dir) {
+ E.preventDefault(e);
+ try {
+ this.yearEl.select();
+ } catch(err) {
+ // Ignore
+ }
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Tab
+ * on the last control (lastCtrl) in the Navigator.
+ *
+ * @method _handleTabKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleTabKey : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
+ try {
+ E.preventDefault(e);
+ this.firstCtrl.focus();
+ } catch (err) {
+ // Ignore - mainly for focus edge cases
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Shift-Tab
+ * on the first control (firstCtrl) in the Navigator.
+ *
+ * @method _handleShiftTabKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleShiftTabKey : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
+ try {
+ E.preventDefault(e);
+ this.lastCtrl.focus();
+ } catch (err) {
+ // Ignore - mainly for focus edge cases
+ }
+ }
+ },
+
+ /**
+ * Retrieve Navigator configuration values from
+ * the parent Calendar/CalendarGroup's config value.
+ *
+ * If it has not been set in the user provided configuration, the method will
+ * return the default value of the configuration property, as set in DEFAULT_CONFIG
+ *
+ * @private
+ * @method __getCfg
+ * @param {String} Case sensitive property name.
+ * @param {Boolean} true, if the property is a string property, false if not.
+ * @return The value of the configuration property
+ */
+ __getCfg : function(prop, bIsStr) {
+ var DEF_CFG = YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;
+ var cfg = this.cal.cfg.getProperty("navigator");
+
+ if (bIsStr) {
+ return (cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
+ } else {
+ return (cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
+ }
+ },
+
+ /**
+ * Private flag, to identify MacOS
+ * @private
+ * @property __isMac
+ */
+ __isMac : (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)
+
+};
+YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/calendar/calendar-min.js b/lib/yui/2.8.0r4/calendar/calendar-min.js
new file mode 100644
index 0000000000..98f45eeb21
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/calendar-min.js
@@ -0,0 +1,18 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,WEEK_ONE_JAN_DATE:1,add:function(A,D,C){var F=new Date(A.getTime());switch(D){case this.MONTH:var E=A.getMonth()+C;var B=0;if(E<0){while(E<0){E+=12;B-=1;}}else{if(E>11){while(E>11){E-=12;B+=1;}}}F.setMonth(E);F.setFullYear(A.getFullYear()+B);break;case this.DAY:this._addDays(F,C);break;case this.YEAR:F.setFullYear(A.getFullYear()+C);break;case this.WEEK:this._addDays(F,(C*7));break;}return F;},_addDays:function(D,C){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){if(C<0){for(var B=-128;CA;C-=A){D.setDate(D.getDate()+A);}}}D.setDate(D.getDate()+C);},subtract:function(A,C,B){return this.add(A,C,(B*-1));},before:function(C,B){var A=B.getTime();if(C.getTime()A){return true;}else{return false;}},between:function(B,A,C){if(this.after(B,A)&&this.before(B,C)){return true;}else{return false;}},getJan1:function(A){return this.getDate(A,0,1);},getDayOffset:function(B,D){var C=this.getJan1(D);var A=Math.ceil((B.getTime()-C.getTime())/this.ONE_DAY_MS);return A;},getWeekNumber:function(D,B,G){B=B||0;G=G||this.WEEK_ONE_JAN_DATE;var H=this.clearTime(D),L,M;if(H.getDay()===B){L=H;}else{L=this.getFirstDayOfWeek(H,B);}var I=L.getFullYear();M=new Date(L.getTime()+6*this.ONE_DAY_MS);var F;if(I!==M.getFullYear()&&M.getDate()>=G){F=1;}else{var E=this.clearTime(this.getDate(I,0,G)),A=this.getFirstDayOfWeek(E,B);var J=Math.round((H.getTime()-A.getTime())/this.ONE_DAY_MS);var K=J%7;var C=(J-K)/7;
+F=C+1;}return F;},getFirstDayOfWeek:function(D,A){A=A||0;var B=D.getDay(),C=(B-A+7)%7;return this.subtract(D,this.DAY,C);},isYearOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getFullYear()!=A.getFullYear()){C=true;}return C;},isMonthOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getMonth()!=A.getMonth()){C=true;}return C;},findMonthStart:function(A){var B=this.getDate(A.getFullYear(),A.getMonth(),1);return B;},findMonthEnd:function(B){var D=this.findMonthStart(B);var C=this.add(D,this.MONTH,1);var A=this.subtract(C,this.DAY,1);return A;},clearTime:function(A){A.setHours(12,0,0,0);return A;},getDate:function(D,A,C){var B=null;if(YAHOO.lang.isUndefined(C)){C=1;}if(D>=100){B=new Date(D,A,C);}else{B=new Date();B.setFullYear(D);B.setMonth(A);B.setDate(C);B.setHours(0,0,0,0);}return B;}};(function(){var C=YAHOO.util.Dom,A=YAHOO.util.Event,E=YAHOO.lang,D=YAHOO.widget.DateMath;function F(I,G,H){this.init.apply(this,arguments);}F.IMG_ROOT=null;F.DATE="D";F.MONTH_DAY="MD";F.WEEKDAY="WD";F.RANGE="R";F.MONTH="M";F.DISPLAY_DAYS=42;F.STOP_RENDER="S";F.SHORT="short";F.LONG="long";F.MEDIUM="medium";F.ONE_CHAR="1char";F.DEFAULT_CONFIG={YEAR_OFFSET:{key:"year_offset",value:0,supercedes:["pagedate","selected","mindate","maxdate"]},TODAY:{key:"today",value:new Date(),supercedes:["pagedate"]},PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:[]},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:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};F._DEFAULT_CONFIG=F.DEFAULT_CONFIG;var B=F.DEFAULT_CONFIG;F._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};F.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_NAV:"calnav",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",CSS_WITH_TITLE:"withtitle",CSS_FIXED_SIZE:"fixedsize",CSS_LINK_CLOSE:"link-close"};F._STYLES=F.STYLES;F.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(H){var G={id:null,container:null,config:null};if(H&&H.length&&H.length>0){switch(H.length){case 1:G.id=null;G.container=H[0];G.config=null;break;case 2:if(E.isObject(H[1])&&!H[1].tagName&&!(H[1] instanceof String)){G.id=null;G.container=H[0];G.config=H[1];}else{G.id=H[0];G.container=H[1];G.config=null;}break;default:G.id=H[0];G.container=H[1];G.config=H[2];break;}}else{}return G;},init:function(J,H,I){var G=this._parseArgs(arguments);J=G.id;H=G.container;I=G.config;this.oDomContainer=C.get(H);if(!this.oDomContainer.id){this.oDomContainer.id=C.generateId();
+}if(!J){J=this.oDomContainer.id+"_t";}this.id=J;this.containerId=this.oDomContainer.id;this.initEvents();this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();C.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);C.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();this.today=this.cfg.getProperty("today");},configIframe:function(I,H,J){var G=H[0];if(!this.parent){if(C.inDocument(this.oDomContainer)){if(G){var K=C.getStyle(this.oDomContainer,"position");if(K=="absolute"||K=="relative"){if(!C.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";C.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){C.addClass(this.iframe,this.Style.CSS_FIXED_SIZE);}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;}}}}},configTitle:function(H,G,I){var K=G[0];if(K){this.createTitleBar(K);}else{var J=this.cfg.getProperty(B.CLOSE.key);if(!J){this.removeTitleBar();}else{this.createTitleBar(" ");}}},configClose:function(H,G,I){var K=G[0],J=this.cfg.getProperty(B.TITLE.key);if(K){if(!J){this.createTitleBar(" ");}this.createCloseButton();}else{this.removeCloseButton();if(!J){this.removeTitleBar();}}},initEvents:function(){var G=F._EVENT_TYPES,I=YAHOO.util.CustomEvent,H=this;H.beforeSelectEvent=new I(G.BEFORE_SELECT);H.selectEvent=new I(G.SELECT);H.beforeDeselectEvent=new I(G.BEFORE_DESELECT);H.deselectEvent=new I(G.DESELECT);H.changePageEvent=new I(G.CHANGE_PAGE);H.beforeRenderEvent=new I(G.BEFORE_RENDER);H.renderEvent=new I(G.RENDER);H.beforeDestroyEvent=new I(G.BEFORE_DESTROY);H.destroyEvent=new I(G.DESTROY);H.resetEvent=new I(G.RESET);H.clearEvent=new I(G.CLEAR);H.beforeShowEvent=new I(G.BEFORE_SHOW);H.showEvent=new I(G.SHOW);H.beforeHideEvent=new I(G.BEFORE_HIDE);H.hideEvent=new I(G.HIDE);H.beforeShowNavEvent=new I(G.BEFORE_SHOW_NAV);H.showNavEvent=new I(G.SHOW_NAV);H.beforeHideNavEvent=new I(G.BEFORE_HIDE_NAV);H.hideNavEvent=new I(G.HIDE_NAV);H.beforeRenderNavEvent=new I(G.BEFORE_RENDER_NAV);H.renderNavEvent=new I(G.RENDER_NAV);H.beforeSelectEvent.subscribe(H.onBeforeSelect,this,true);H.selectEvent.subscribe(H.onSelect,this,true);H.beforeDeselectEvent.subscribe(H.onBeforeDeselect,this,true);H.deselectEvent.subscribe(H.onDeselect,this,true);H.changePageEvent.subscribe(H.onChangePage,this,true);H.renderEvent.subscribe(H.onRender,this,true);H.resetEvent.subscribe(H.onReset,this,true);H.clearEvent.subscribe(H.onClear,this,true);},doPreviousMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.previousMonth();var J=C.getElementsByClassName(G.Style.CSS_NAV_LEFT,"a",G.oDomContainer);if(J&&J[0]){try{J[0].focus();}catch(I){}}},0);},doNextMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.nextMonth();var J=C.getElementsByClassName(G.Style.CSS_NAV_RIGHT,"a",G.oDomContainer);if(J&&J[0]){try{J[0].focus();}catch(I){}}},0);},doSelectCell:function(M,G){var R,O,I,L;var N=A.getTarget(M),H=N.tagName.toLowerCase(),K=false;while(H!="td"&&!C.hasClass(N,G.Style.CSS_CELL_SELECTABLE)){if(!K&&H=="a"&&C.hasClass(N,G.Style.CSS_CELL_SELECTOR)){K=true;}N=N.parentNode;H=N.tagName.toLowerCase();if(N==this.oDomContainer||H=="html"){return;}}if(K){A.preventDefault(M);}R=N;if(C.hasClass(R,G.Style.CSS_CELL_SELECTABLE)){L=G.getIndexFromId(R.id);if(L>-1){O=G.cellDates[L];if(O){I=D.getDate(O[0],O[1]-1,O[2]);var Q;if(G.Options.MULTI_SELECT){Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}var J=G.cellDates[L];var P=G._indexOfSelectedFieldArray(J);if(P>-1){G.deselectCell(L);}else{G.selectCell(L);}}else{Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}G.selectCell(L);}}}}},doCellMouseOver:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.addClass(G,H.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.removeClass(G,H.Style.CSS_CELL_HOVER);}},setupConfig:function(){var G=this.cfg;G.addProperty(B.TODAY.key,{value:new Date(B.TODAY.value.getTime()),supercedes:B.TODAY.supercedes,handler:this.configToday,suppressEvent:true});G.addProperty(B.PAGEDATE.key,{value:B.PAGEDATE.value||new Date(B.TODAY.value.getTime()),handler:this.configPageDate});G.addProperty(B.SELECTED.key,{value:B.SELECTED.value.concat(),handler:this.configSelected});G.addProperty(B.TITLE.key,{value:B.TITLE.value,handler:this.configTitle});G.addProperty(B.CLOSE.key,{value:B.CLOSE.value,handler:this.configClose});G.addProperty(B.IFRAME.key,{value:B.IFRAME.value,handler:this.configIframe,validator:G.checkBoolean});G.addProperty(B.MINDATE.key,{value:B.MINDATE.value,handler:this.configMinDate});G.addProperty(B.MAXDATE.key,{value:B.MAXDATE.value,handler:this.configMaxDate});G.addProperty(B.MULTI_SELECT.key,{value:B.MULTI_SELECT.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.START_WEEKDAY.key,{value:B.START_WEEKDAY.value,handler:this.configOptions,validator:G.checkNumber});G.addProperty(B.SHOW_WEEKDAYS.key,{value:B.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_HEADER.key,{value:B.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_FOOTER.key,{value:B.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.HIDE_BLANK_WEEKS.key,{value:B.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.NAV_ARROW_LEFT.key,{value:B.NAV_ARROW_LEFT.value,handler:this.configOptions});
+G.addProperty(B.NAV_ARROW_RIGHT.key,{value:B.NAV_ARROW_RIGHT.value,handler:this.configOptions});G.addProperty(B.MONTHS_SHORT.key,{value:B.MONTHS_SHORT.value,handler:this.configLocale});G.addProperty(B.MONTHS_LONG.key,{value:B.MONTHS_LONG.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_1CHAR.key,{value:B.WEEKDAYS_1CHAR.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_SHORT.key,{value:B.WEEKDAYS_SHORT.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_MEDIUM.key,{value:B.WEEKDAYS_MEDIUM.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_LONG.key,{value:B.WEEKDAYS_LONG.value,handler:this.configLocale});var H=function(){G.refireEvent(B.LOCALE_MONTHS.key);G.refireEvent(B.LOCALE_WEEKDAYS.key);};G.subscribeToConfigEvent(B.START_WEEKDAY.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_LONG.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_1CHAR.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_MEDIUM.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_LONG.key,H,this,true);G.addProperty(B.LOCALE_MONTHS.key,{value:B.LOCALE_MONTHS.value,handler:this.configLocaleValues});G.addProperty(B.LOCALE_WEEKDAYS.key,{value:B.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});G.addProperty(B.YEAR_OFFSET.key,{value:B.YEAR_OFFSET.value,supercedes:B.YEAR_OFFSET.supercedes,handler:this.configLocale});G.addProperty(B.DATE_DELIMITER.key,{value:B.DATE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_FIELD_DELIMITER.key,{value:B.DATE_FIELD_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_RANGE_DELIMITER.key,{value:B.DATE_RANGE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.MY_MONTH_POSITION.key,{value:B.MY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_YEAR_POSITION.key,{value:B.MY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_MONTH_POSITION.key,{value:B.MD_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_DAY_POSITION.key,{value:B.MD_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_MONTH_POSITION.key,{value:B.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_DAY_POSITION.key,{value:B.MDY_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_YEAR_POSITION.key,{value:B.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_POSITION.key,{value:B.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_YEAR_POSITION.key,{value:B.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_SUFFIX.key,{value:B.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});G.addProperty(B.MY_LABEL_YEAR_SUFFIX.key,{value:B.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});G.addProperty(B.NAV.key,{value:B.NAV.value,handler:this.configNavigator});G.addProperty(B.STRINGS.key,{value:B.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:B.STRINGS.supercedes});},configStrings:function(H,G,I){var J=E.merge(B.STRINGS.value,G[0]);this.cfg.setProperty(B.STRINGS.key,J,true);},configPageDate:function(H,G,I){this.cfg.setProperty(B.PAGEDATE.key,this._parsePageDate(G[0]),true);},configMinDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MINDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configMaxDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MAXDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configToday:function(I,H,J){var K=H[0];if(E.isString(K)){K=this._parseDate(K);}var G=D.clearTime(K);if(!this.cfg.initialConfig[B.PAGEDATE.key]){this.cfg.setProperty(B.PAGEDATE.key,G);}this.today=G;this.cfg.setProperty(B.TODAY.key,G,true);},configSelected:function(I,G,K){var H=G[0],J=B.SELECTED.key;if(H){if(E.isString(H)){this.cfg.setProperty(J,this._parseDates(H),true);}}if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(J);}},configOptions:function(H,G,I){this.Options[H.toUpperCase()]=G[0];},configLocale:function(H,G,I){this.Locale[H.toUpperCase()]=G[0];this.cfg.refireEvent(B.LOCALE_MONTHS.key);this.cfg.refireEvent(B.LOCALE_WEEKDAYS.key);},configLocaleValues:function(J,I,K){J=J.toLowerCase();var M=I[0],H=this.cfg,N=this.Locale;switch(J){case B.LOCALE_MONTHS.key:switch(M){case F.SHORT:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_SHORT.key).concat();break;case F.LONG:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_LONG.key).concat();break;}break;case B.LOCALE_WEEKDAYS.key:switch(M){case F.ONE_CHAR:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_1CHAR.key).concat();break;case F.SHORT:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_SHORT.key).concat();break;case F.MEDIUM:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_MEDIUM.key).concat();break;case F.LONG:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_LONG.key).concat();break;}var L=H.getProperty(B.START_WEEKDAY.key);if(L>0){for(var G=0;G'+H+"";}this.oDomContainer.appendChild(L);return L;},removeCloseButton:function(){var G=C.getElementsByClassName(this.Style.CSS_LINK_CLOSE,"a",this.oDomContainer)[0]||null;if(G){A.purgeElement(G);this.oDomContainer.removeChild(G);}},renderHeader:function(Q){var P=7,O="us/tr/callt.gif",G="us/tr/calrt.gif",N=this.cfg,K=N.getProperty(B.PAGEDATE.key),L=N.getProperty(B.STRINGS.key),V=(L&&L.previousMonth)?L.previousMonth:"",H=(L&&L.nextMonth)?L.nextMonth:"",M;if(N.getProperty(B.SHOW_WEEK_HEADER.key)){P+=1;}if(N.getProperty(B.SHOW_WEEK_FOOTER.key)){P+=1;}Q[Q.length]="";Q[Q.length]="";Q[Q.length]='\n ";if(N.getProperty(B.SHOW_WEEKDAYS.key)){Q=this.buildWeekdays(Q);}Q[Q.length]=" ";return Q;},buildWeekdays:function(H){H[H.length]='';if(this.cfg.getProperty(B.SHOW_WEEK_HEADER.key)){H[H.length]=" ";}for(var G=0;G'+this.Locale.LOCALE_WEEKDAYS[G]+"";}if(this.cfg.getProperty(B.SHOW_WEEK_FOOTER.key)){H[H.length]=" ";}H[H.length]=" ";return H;},renderBody:function(m,k){var AK=this.cfg.getProperty(B.START_WEEKDAY.key);this.preMonthDays=m.getDay();if(AK>0){this.preMonthDays-=AK;}if(this.preMonthDays<0){this.preMonthDays+=7;}this.monthDays=D.findMonthEnd(m).getDate();this.postMonthDays=F.DISPLAY_DAYS-this.preMonthDays-this.monthDays;m=D.subtract(m,D.DAY,this.preMonthDays);var Y,N,M="w",f="_cell",c="wd",w="d",P,u,AC=this.today,O=this.cfg,W=AC.getFullYear(),v=AC.getMonth(),J=AC.getDate(),AB=O.getProperty(B.PAGEDATE.key),I=O.getProperty(B.HIDE_BLANK_WEEKS.key),j=O.getProperty(B.SHOW_WEEK_FOOTER.key),b=O.getProperty(B.SHOW_WEEK_HEADER.key),U=O.getProperty(B.MINDATE.key),a=O.getProperty(B.MAXDATE.key),T=this.Locale.YEAR_OFFSET;if(U){U=D.clearTime(U);}if(a){a=D.clearTime(a);}k[k.length]='';var AI=0,Q=document.createElement("div"),l=document.createElement("td");Q.appendChild(l);var AA=this.parent||this;for(var AE=0;AE<6;AE++){Y=D.getWeekNumber(m,AK);N=M+Y;if(AE!==0&&I===true&&m.getMonth()!=AB.getMonth()){break;}else{k[k.length]='';if(b){k=this.renderRowHeader(Y,k);}for(var AJ=0;AJ<7;AJ++){P=[];this.clearElement(l);l.className=this.Style.CSS_CELL;l.id=this.id+f+AI;if(m.getDate()==J&&m.getMonth()==v&&m.getFullYear()==W){P[P.length]=AA.renderCellStyleToday;}var Z=[m.getFullYear(),m.getMonth()+1,m.getDate()];this.cellDates[this.cellDates.length]=Z;if(m.getMonth()!=AB.getMonth()){P[P.length]=AA.renderCellNotThisMonth;}else{C.addClass(l,c+m.getDay());C.addClass(l,w+m.getDate());for(var AD=0;AD=AH.getTime()&&m.getTime()<=AG.getTime()){u=y[2];if(m.getTime()==AG.getTime()){this.renderStack.splice(AD,1);}}break;case F.WEEKDAY:var R=y[1][0];
+if(m.getDay()+1==R){u=y[2];}break;case F.MONTH:H=y[1][0];if(m.getMonth()+1==H){u=y[2];}break;}if(u){P[P.length]=u;}}}if(this._indexOfSelectedFieldArray(Z)>-1){P[P.length]=AA.renderCellStyleSelected;}if((U&&(m.getTime()a.getTime()))){P[P.length]=AA.renderOutOfBoundsDate;}else{P[P.length]=AA.styleCellDefault;P[P.length]=AA.renderCellDefault;}for(var z=0;z=0&&AI<=6){C.addClass(l,this.Style.CSS_CELL_TOP);}if((AI%7)===0){C.addClass(l,this.Style.CSS_CELL_LEFT);}if(((AI+1)%7)===0){C.addClass(l,this.Style.CSS_CELL_RIGHT);}var o=this.postMonthDays;if(I&&o>=7){var V=Math.floor(o/7);for(var AF=0;AF=((this.preMonthDays+o+this.monthDays)-7)){C.addClass(l,this.Style.CSS_CELL_BOTTOM);}k[k.length]=Q.innerHTML;AI++;}if(j){k=this.renderRowFooter(Y,k);}k[k.length]=" ";}}k[k.length]=" ";return k;},renderFooter:function(G){return G;},render:function(){this.beforeRenderEvent.fire();var H=D.findMonthStart(this.cfg.getProperty(B.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;A.purgeElement(this.oDomContainer,true);var G=[];G[G.length]='';G=this.renderHeader(G);G=this.renderBody(H,G);G=this.renderFooter(G);G[G.length]="
";this.oDomContainer.innerHTML=G.join("\n");this.applyListeners();this.cells=C.getElementsByClassName(this.Style.CSS_CELL,"td",this.id);this.cfg.refireEvent(B.TITLE.key);this.cfg.refireEvent(B.CLOSE.key);this.cfg.refireEvent(B.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var P=this.oDomContainer,H=this.parent||this,L="a",S="click";var M=C.getElementsByClassName(this.Style.CSS_NAV_LEFT,L,P),I=C.getElementsByClassName(this.Style.CSS_NAV_RIGHT,L,P);if(M&&M.length>0){this.linkLeft=M[0];A.addListener(this.linkLeft,S,this.doPreviousMonthNav,H,true);}if(I&&I.length>0){this.linkRight=I[0];A.addListener(this.linkRight,S,this.doNextMonthNav,H,true);}if(H.cfg.getProperty("navigator")!==null){this.applyNavListeners();}if(this.domEventMap){var J,G;for(var R in this.domEventMap){if(E.hasOwnProperty(this.domEventMap,R)){var N=this.domEventMap[R];if(!(N instanceof Array)){N=[N];}for(var K=0;K0){A.addListener(G,"click",function(N,M){var L=A.getTarget(N);if(this===L||C.isAncestor(this,L)){A.preventDefault(N);}var J=H.oNavigator;if(J){var K=I.cfg.getProperty("pagedate");J.setYear(K.getFullYear()+I.Locale.YEAR_OFFSET);J.setMonth(K.getMonth());J.show();}});}},getDateByCellId:function(H){var G=this.getDateFieldsByCellId(H);return(G)?D.getDate(G[0],G[1]-1,G[2]):null;},getDateFieldsByCellId:function(G){G=this.getIndexFromId(G);return(G>-1)?this.cellDates[G]:null;},getCellIndex:function(I){var H=-1;if(I){var G=I.getMonth(),N=I.getFullYear(),M=I.getDate(),K=this.cellDates;for(var J=0;J-1){H=parseInt(I.substring(G+5),10);}return H;},renderOutOfBoundsDate:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOB);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderRowHeader:function(H,G){G[G.length]='";return G;},renderRowFooter:function(H,G){G[G.length]='";return G;},renderCellDefault:function(H,G){G.innerHTML=''+this.buildDayLabel(H)+" ";},styleCellDefault:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(H,G){C.addClass(G,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOM);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderBodyCellRestricted:function(H,G){C.addClass(G,this.Style.CSS_CELL);C.addClass(G,this.Style.CSS_CELL_RESTRICTED);G.innerHTML=H.getDate();return F.STOP_RENDER;},addMonths:function(I){var H=B.PAGEDATE.key,J=this.cfg.getProperty(H),G=D.add(J,D.MONTH,I);this.cfg.setProperty(H,G);this.resetRenderers();this.changePageEvent.fire(J,G);},subtractMonths:function(G){this.addMonths(-1*G);},addYears:function(I){var H=B.PAGEDATE.key,J=this.cfg.getProperty(H),G=D.add(J,D.YEAR,I);this.cfg.setProperty(H,G);this.resetRenderers();this.changePageEvent.fire(J,G);},subtractYears:function(G){this.addYears(-1*G);},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.addMonths(-1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.addYears(-1);},reset:function(){this.cfg.resetProperty(B.SELECTED.key);this.cfg.resetProperty(B.PAGEDATE.key);this.resetEvent.fire();},clear:function(){this.cfg.setProperty(B.SELECTED.key,[]);this.cfg.setProperty(B.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(I){var L=this._toFieldArray(I),H=[],K=[],M=B.SELECTED.key;for(var G=0;G0){if(this.parent){this.parent.cfg.setProperty(M,K);}else{this.cfg.setProperty(M,K);}this.selectEvent.fire(H);}return this.getSelectedDates();},selectCell:function(J){var H=this.cells[J],N=this.cellDates[J],M=this._toDate(N),I=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(I){this.beforeSelectEvent.fire();var L=B.SELECTED.key;var K=this.cfg.getProperty(L);var G=N.concat();if(this._indexOfSelectedFieldArray(G)==-1){K[K.length]=G;}if(this.parent){this.parent.cfg.setProperty(L,K);}else{this.cfg.setProperty(L,K);}this.renderCellStyleSelected(M,H);this.selectEvent.fire([G]);this.doCellMouseOut.call(H,null,this);}return this.getSelectedDates();},deselect:function(K){var G=this._toFieldArray(K),J=[],M=[],N=B.SELECTED.key;for(var H=0;H0){if(this.parent){this.parent.cfg.setProperty(N,M);}else{this.cfg.setProperty(N,M);}this.deselectEvent.fire(J);}return this.getSelectedDates();},deselectCell:function(K){var H=this.cells[K],N=this.cellDates[K],I=this._indexOfSelectedFieldArray(N);var J=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(J){this.beforeDeselectEvent.fire();var L=this.cfg.getProperty(B.SELECTED.key),M=this._toDate(N),G=N.concat();if(I>-1){if(this.cfg.getProperty(B.PAGEDATE.key).getMonth()==M.getMonth()&&this.cfg.getProperty(B.PAGEDATE.key).getFullYear()==M.getFullYear()){C.removeClass(H,this.Style.CSS_CELL_SELECTED);}L.splice(I,1);}if(this.parent){this.parent.cfg.setProperty(B.SELECTED.key,L);}else{this.cfg.setProperty(B.SELECTED.key,L);}this.deselectEvent.fire([G]);}return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var J=B.SELECTED.key,G=this.cfg.getProperty(J),H=G.length,I=G.concat();if(this.parent){this.parent.cfg.setProperty(J,[]);}else{this.cfg.setProperty(J,[]);}if(H>0){this.deselectEvent.fire(I);}return this.getSelectedDates();},_toFieldArray:function(H){var G=[];if(H instanceof Date){G=[[H.getFullYear(),H.getMonth()+1,H.getDate()]];}else{if(E.isString(H)){G=this._parseDates(H);}else{if(E.isArray(H)){for(var I=0;IK.getTime()));},_parsePageDate:function(G){var J;if(G){if(G instanceof Date){J=D.findMonthStart(G);}else{var K,I,H;H=G.split(this.cfg.getProperty(B.DATE_FIELD_DELIMITER.key));K=parseInt(H[this.cfg.getProperty(B.MY_MONTH_POSITION.key)-1],10)-1;I=parseInt(H[this.cfg.getProperty(B.MY_YEAR_POSITION.key)-1],10)-this.Locale.YEAR_OFFSET;J=D.getDate(I,K,1);}}else{J=D.getDate(this.today.getFullYear(),this.today.getMonth(),1);}return J;},onBeforeSelect:function(){if(this.cfg.getProperty(B.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();}}},onSelect:function(G){},onBeforeDeselect:function(){},onDeselect:function(G){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(I){var J=I.split(this.Locale.DATE_FIELD_DELIMITER),G;if(J.length==2){G=[J[this.Locale.MD_MONTH_POSITION-1],J[this.Locale.MD_DAY_POSITION-1]];G.type=F.MONTH_DAY;}else{G=[J[this.Locale.MDY_YEAR_POSITION-1]-this.Locale.YEAR_OFFSET,J[this.Locale.MDY_MONTH_POSITION-1],J[this.Locale.MDY_DAY_POSITION-1]];G.type=F.DATE;}for(var H=0;H0){this.init.apply(this,arguments);}}B.DEFAULT_CONFIG=B._DEFAULT_CONFIG=G.DEFAULT_CONFIG;B.DEFAULT_CONFIG.PAGES={key:"pages",value:2};var C=B.DEFAULT_CONFIG;B.prototype={init:function(K,I,J){var H=this._parseArgs(arguments);K=H.id;I=H.container;J=H.config;this.oDomContainer=D.get(I);if(!this.oDomContainer.id){this.oDomContainer.id=D.generateId();}if(!K){K=this.oDomContainer.id+"_t";}this.id=K;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];D.addClass(this.oDomContainer,B.CSS_CONTAINER);D.addClass(this.oDomContainer,B.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(J){this.cfg.applyConfig(J,true);}this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var H=this.cfg;H.addProperty(C.PAGES.key,{value:C.PAGES.value,validator:H.checkNumber,handler:this.configPages});H.addProperty(C.YEAR_OFFSET.key,{value:C.YEAR_OFFSET.value,handler:this.delegateConfig,supercedes:C.YEAR_OFFSET.supercedes,suppressEvent:true});H.addProperty(C.TODAY.key,{value:new Date(C.TODAY.value.getTime()),supercedes:C.TODAY.supercedes,handler:this.configToday,suppressEvent:false});H.addProperty(C.PAGEDATE.key,{value:C.PAGEDATE.value||new Date(C.TODAY.value.getTime()),handler:this.configPageDate});H.addProperty(C.SELECTED.key,{value:[],handler:this.configSelected});H.addProperty(C.TITLE.key,{value:C.TITLE.value,handler:this.configTitle});H.addProperty(C.CLOSE.key,{value:C.CLOSE.value,handler:this.configClose});H.addProperty(C.IFRAME.key,{value:C.IFRAME.value,handler:this.configIframe,validator:H.checkBoolean});H.addProperty(C.MINDATE.key,{value:C.MINDATE.value,handler:this.delegateConfig});H.addProperty(C.MAXDATE.key,{value:C.MAXDATE.value,handler:this.delegateConfig});H.addProperty(C.MULTI_SELECT.key,{value:C.MULTI_SELECT.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.START_WEEKDAY.key,{value:C.START_WEEKDAY.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.SHOW_WEEKDAYS.key,{value:C.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_HEADER.key,{value:C.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_FOOTER.key,{value:C.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.HIDE_BLANK_WEEKS.key,{value:C.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.NAV_ARROW_LEFT.key,{value:C.NAV_ARROW_LEFT.value,handler:this.delegateConfig});H.addProperty(C.NAV_ARROW_RIGHT.key,{value:C.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_SHORT.key,{value:C.MONTHS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_LONG.key,{value:C.MONTHS_LONG.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_1CHAR.key,{value:C.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_SHORT.key,{value:C.WEEKDAYS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_MEDIUM.key,{value:C.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_LONG.key,{value:C.WEEKDAYS_LONG.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_MONTHS.key,{value:C.LOCALE_MONTHS.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_WEEKDAYS.key,{value:C.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});H.addProperty(C.DATE_DELIMITER.key,{value:C.DATE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_FIELD_DELIMITER.key,{value:C.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_RANGE_DELIMITER.key,{value:C.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.MY_MONTH_POSITION.key,{value:C.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_YEAR_POSITION.key,{value:C.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MD_MONTH_POSITION.key,{value:C.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});
+H.addProperty(C.MD_DAY_POSITION.key,{value:C.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_MONTH_POSITION.key,{value:C.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_DAY_POSITION.key,{value:C.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_YEAR_POSITION.key,{value:C.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_MONTH_POSITION.key,{value:C.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_YEAR_POSITION.key,{value:C.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_MONTH_SUFFIX.key,{value:C.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.MY_LABEL_YEAR_SUFFIX.key,{value:C.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.NAV.key,{value:C.NAV.value,handler:this.configNavigator});H.addProperty(C.STRINGS.key,{value:C.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:C.STRINGS.supercedes});},initEvents:function(){var J=this,L="Event",M=YAHOO.util.CustomEvent;var I=function(O,R,N){for(var Q=0;Q0){M=new Date(O);this._setMonthOnDate(M,M.getMonth()+I);P.pageDate=M;}var H=this.constructChild(U,Q,P);D.removeClass(H.oDomContainer,this.Style.CSS_SINGLE);D.addClass(H.oDomContainer,S);if(I===0){O=H.cfg.getProperty(J);D.addClass(H.oDomContainer,V);}if(I==(L-1)){D.addClass(H.oDomContainer,K);}H.parent=this;H.index=I;this.pages[this.pages.length]=H;}},configPageDate:function(O,N,L){var J=N[0],M;var K=C.PAGEDATE.key;for(var I=0;I0)?this.pages[0].cfg.getProperty(K):[];this.cfg.setProperty(K,I,true);},delegateConfig:function(I,H,L){var M=H[0];var K;for(var J=0;J0){J+=1;}K.setYear(J);}},render:function(){this.renderHeader();for(var I=0;I=0;--I){var H=this.pages[I];H.previousMonth();}},nextYear:function(){for(var I=0;I11)){var H=F.add(I,F.MONTH,J-I.getMonth());I.setTime(H.getTime());}else{I.setMonth(J);}},_fixWidth:function(){var H=0;for(var J=0;J0){this.oDomContainer.style.width=H+"px";}},toString:function(){return"CalendarGroup "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var J=this;if(J.navigator){J.navigator.destroy();}if(J.cfg){J.cfg.destroy();}A.purgeElement(J.oDomContainer,true);D.removeClass(J.oDomContainer,B.CSS_CONTAINER);D.removeClass(J.oDomContainer,B.CSS_MULTI_UP);for(var I=0,H=J.pages.length;I=0&&A<12){this._month=A;}this._updateMonthUI();},setYear:function(B){var A=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(B)&&A.test(B+"")){this._year=B;}this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}this.cal.renderNavEvent.fire();},createNav:function(){var B=YAHOO.widget.CalendarNavigator;var C=this._doc;var D=C.createElement("div");D.className=B.CLASSES.NAV;var A=this.renderNavContents([]);D.innerHTML=A.join("");this.cal.oDomContainer.appendChild(D);
+this.navEl=D;this.yearEl=C.getElementById(this.id+B.YEAR_SUFFIX);this.monthEl=C.getElementById(this.id+B.MONTH_SUFFIX);this.errorEl=C.getElementById(this.id+B.ERROR_SUFFIX);this.submitEl=C.getElementById(this.id+B.SUBMIT_SUFFIX);this.cancelEl=C.getElementById(this.id+B.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}this._setFirstLastElements();},createMask:function(){var B=YAHOO.widget.CalendarNavigator.CLASSES;var A=this._doc.createElement("div");A.className=B.MASK;this.cal.oDomContainer.appendChild(A);this.maskEl=A;},_syncMask:function(){var B=this.cal.oDomContainer;if(B&&this.maskEl){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(this.maskEl,"width",A.right-A.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",A.bottom-A.top+"px");}},renderNavContents:function(A){var D=YAHOO.widget.CalendarNavigator,E=D.CLASSES,B=A;B[B.length]='';this.renderMonth(B);B[B.length]="
";B[B.length]='';this.renderYear(B);B[B.length]="
";B[B.length]='';this.renderButtons(B);B[B.length]="
";B[B.length]='
';return B;},renderMonth:function(D){var G=YAHOO.widget.CalendarNavigator,H=G.CLASSES;var I=this.id+G.MONTH_SUFFIX,F=this.__getCfg("monthFormat"),A=this.cal.cfg.getProperty((F==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),E=D;if(A&&A.length>0){E[E.length]='';E[E.length]=this.__getCfg("month",true);E[E.length]=" ";E[E.length]='';for(var B=0;B';E[E.length]=A[B];E[E.length]=" ";}E[E.length]=" ";}return E;},renderYear:function(B){var E=YAHOO.widget.CalendarNavigator,F=E.CLASSES;var G=this.id+E.YEAR_SUFFIX,A=E.YR_MAX_DIGITS,D=B;D[D.length]='';D[D.length]=this.__getCfg("year",true);D[D.length]=" ";D[D.length]=' ';return D;},renderButtons:function(A){var D=YAHOO.widget.CalendarNavigator.CLASSES;var B=A;B[B.length]='';B[B.length]='';B[B.length]=this.__getCfg("submit",true);B[B.length]=" ";B[B.length]=" ";B[B.length]='';B[B.length]='';B[B.length]=this.__getCfg("cancel",true);B[B.length]=" ";B[B.length]=" ";return B;},applyListeners:function(){var B=YAHOO.util.Event;function A(){if(this.validate()){this.setYear(this._getYearFromUI());}}function C(){this.setMonth(this._getMonthFromUI());}B.on(this.submitEl,"click",this.submit,this,true);B.on(this.cancelEl,"click",this.cancel,this,true);B.on(this.yearEl,"blur",A,this,true);B.on(this.monthEl,"change",C,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}this.applyKeyListeners();},purgeListeners:function(){var A=YAHOO.util.Event;A.removeListener(this.submitEl,"click",this.submit);A.removeListener(this.cancelEl,"click",this.cancel);A.removeListener(this.yearEl,"blur");A.removeListener(this.monthEl,"change");if(this.__isIEQuirks){A.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}this.purgeKeyListeners();},applyKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.on(this.yearEl,"keypress",this._handleEnterKey,this,true);D.on(this.yearEl,C,this._handleDirectionKeys,this,true);D.on(this.lastCtrl,B,this._handleTabKey,this,true);D.on(this.firstCtrl,B,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.removeListener(this.yearEl,"keypress",this._handleEnterKey);D.removeListener(this.yearEl,C,this._handleDirectionKeys);D.removeListener(this.lastCtrl,B,this._handleTabKey);D.removeListener(this.firstCtrl,B,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var B=this.cal;var A=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(A>0){var C=this;window.setTimeout(function(){C._update(B);},A);}else{this._update(B);}}},_update:function(B){var A=YAHOO.widget.DateMath.getDate(this.getYear()-B.cfg.getProperty("YEAR_OFFSET"),this.getMonth(),1);B.cfg.setProperty("pagedate",A);B.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(A){if(this.errorEl){this.errorEl.innerHTML=A;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var A=this.submitEl,C=this.__getCfg("initialFocus");if(C&&C.toLowerCase){C=C.toLowerCase();if(C=="year"){A=this.yearEl;try{this.yearEl.select();}catch(B){}}else{if(C=="month"){A=this.monthEl;}}}if(A&&YAHOO.lang.isFunction(A.focus)){try{A.focus();}catch(D){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}var B=this.navEl.parentNode;if(B){B.removeChild(this.navEl);}this.navEl=null;var A=this.maskEl.parentNode;
+if(A){A.removeChild(this.maskEl);}this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(B,A){if(B){YAHOO.util.Dom.setStyle(B,"display",(A)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var B=YAHOO.widget.CalendarNavigator;var A=null;if(this.yearEl){var C=this.yearEl.value;C=C.replace(B.TRIM,"$1");if(B.YR_PATTERN.test(C)){A=parseInt(C,10);}}return A;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(B){var A=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(B)==A.ENTER){YAHOO.util.Event.preventDefault(B);this.submit();}},_handleDirectionKeys:function(H){var G=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY,D=YAHOO.widget.CalendarNavigator;var F=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(F)){var B=false;switch(G.getCharCode(H)){case A.UP:this.yearEl.value=F+D.YR_MINOR_INC;B=true;break;case A.DOWN:this.yearEl.value=Math.max(F-D.YR_MINOR_INC,0);B=true;break;case A.PAGE_UP:this.yearEl.value=F+D.YR_MAJOR_INC;B=true;break;case A.PAGE_DOWN:this.yearEl.value=Math.max(F-D.YR_MAJOR_INC,0);B=true;break;default:break;}if(B){G.preventDefault(H);try{this.yearEl.select();}catch(C){}}}},_handleTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(C.getCharCode(D)==A.TAB&&!D.shiftKey){try{C.preventDefault(D);this.firstCtrl.focus();}catch(B){}}},_handleShiftTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(D.shiftKey&&C.getCharCode(D)==A.TAB){try{C.preventDefault(D);this.lastCtrl.focus();}catch(B){}}},__getCfg:function(D,B){var C=YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;var A=this.cal.cfg.getProperty("navigator");if(B){return(A!==true&&A.strings&&A.strings[D])?A.strings[D]:C.strings[D];}else{return(A!==true&&A[D])?A[D]:C[D];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.8.0r4",build:"2449"});
\ No newline at end of file
diff --git a/lib/yui/2.8.0r4/calendar/calendar.js b/lib/yui/2.8.0r4/calendar/calendar.js
new file mode 100644
index 0000000000..d6e20162d7
--- /dev/null
+++ b/lib/yui/2.8.0r4/calendar/calendar.js
@@ -0,0 +1,7294 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(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);
+ }
+
+
+ };
+
+
+ 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 = {},
+ currCfg = this.config,
+ prop,
+ property;
+
+ for (prop in currCfg) {
+ if (Lang.hasOwnProperty(currCfg, prop)) {
+ property = currCfg[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,
+ 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) {
+ if (Lang.hasOwnProperty(this.config, prop)) {
+ 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;
+
+ // Clear out queue entry, to avoid it being
+ // re-added to the queue by any queueProperty/supercedes
+ // calls which are invoked during fireEvent
+ this.eventQueue[i] = null;
+
+ 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} overrideContext 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, overrideContext) {
+
+ var property = this.config[key.toLowerCase()];
+
+ if (property && property.event) {
+ if (!Config.alreadySubscribed(property.event, handler, obj)) {
+ property.event.subscribe(handler, obj, overrideContext);
+ }
+ 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);
+
+}());
+/**
+* The datemath module provides utility methods for basic JavaScript Date object manipulation and
+* comparison.
+*
+* @module datemath
+*/
+
+/**
+* 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,
+
+ /**
+ * Constant field representing the date in first week of January
+ * which identifies the first week of the year.
+ *
+ * In the U.S, Jan 1st is normally used based on a Sunday start of week.
+ * ISO 8601, used widely throughout Europe, uses Jan 4th, based on a Monday start of week.
+ *
+ * @property WEEK_ONE_JAN_DATE
+ * @static
+ * @type Number
+ */
+ WEEK_ONE_JAN_DATE : 1,
+
+ /**
+ * 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:
+ this._addDays(d, amount);
+ // d.setDate(date.getDate() + amount);
+ break;
+ case this.YEAR:
+ d.setFullYear(date.getFullYear() + amount);
+ break;
+ case this.WEEK:
+ this._addDays(d, (amount * 7));
+ // d.setDate(date.getDate() + (amount * 7));
+ break;
+ }
+ return d;
+ },
+
+ /**
+ * Private helper method to account for bug in Safari 2 (webkit < 420)
+ * when Date.setDate(n) is called with n less than -128 or greater than 127.
+ *
+ * Fix approach and original findings are available here:
+ * http://brianary.blogspot.com/2006/03/safari-date-bug.html
+ *
+ * @method _addDays
+ * @param {Date} d JavaScript date object
+ * @param {Number} nDays The number of days to add to the date object (can be negative)
+ * @private
+ */
+ _addDays : function(d, nDays) {
+ if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
+ if (nDays < 0) {
+ // Ensure we don't go below -128 (getDate() is always 1 to 31, so we won't go above 127)
+ for(var min = -128; nDays < min; nDays -= min) {
+ d.setDate(d.getDate() + min);
+ }
+ } else {
+ // Ensure we don't go above 96 + 31 = 127
+ for(var max = 96; nDays > max; nDays -= max) {
+ d.setDate(d.getDate() + max);
+ }
+ }
+ // nDays should be remainder between -128 and 96
+ }
+ d.setDate(d.getDate() + nDays);
+ },
+
+ /**
+ * 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 this.getDate(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. Can currently support standard
+ * U.S. week numbers, based on Jan 1st defining the 1st week of the year, and
+ * ISO8601 week numbers, based on Jan 4th defining the 1st week of the year.
+ *
+ * @method getWeekNumber
+ * @param {Date} date The JavaScript date for which to find the week number
+ * @param {Number} firstDayOfWeek The index of the first day of the week (0 = Sun, 1 = Mon ... 6 = Sat).
+ * Defaults to 0
+ * @param {Number} janDate The date in the first week of January which defines week one for the year
+ * Defaults to the value of YAHOO.widget.DateMath.WEEK_ONE_JAN_DATE, which is 1 (Jan 1st).
+ * For the U.S, this is normally Jan 1st. ISO8601 uses Jan 4th to define the first week of the year.
+ *
+ * @return {Number} The number of the week containing the given date.
+ */
+ getWeekNumber : function(date, firstDayOfWeek, janDate) {
+
+ // Setup Defaults
+ firstDayOfWeek = firstDayOfWeek || 0;
+ janDate = janDate || this.WEEK_ONE_JAN_DATE;
+
+ var targetDate = this.clearTime(date),
+ startOfWeek,
+ endOfWeek;
+
+ if (targetDate.getDay() === firstDayOfWeek) {
+ startOfWeek = targetDate;
+ } else {
+ startOfWeek = this.getFirstDayOfWeek(targetDate, firstDayOfWeek);
+ }
+
+ var startYear = startOfWeek.getFullYear();
+
+ // DST shouldn't be a problem here, math is quicker than setDate();
+ endOfWeek = new Date(startOfWeek.getTime() + 6*this.ONE_DAY_MS);
+
+ var weekNum;
+ if (startYear !== endOfWeek.getFullYear() && endOfWeek.getDate() >= janDate) {
+ // If years don't match, endOfWeek is in Jan. and if the
+ // week has WEEK_ONE_JAN_DATE in it, it's week one by definition.
+ weekNum = 1;
+ } else {
+ // Get the 1st day of the 1st week, and
+ // find how many days away we are from it.
+ var weekOne = this.clearTime(this.getDate(startYear, 0, janDate)),
+ weekOneDayOne = this.getFirstDayOfWeek(weekOne, firstDayOfWeek);
+
+ // Round days to smoothen out 1 hr DST diff
+ var daysDiff = Math.round((targetDate.getTime() - weekOneDayOne.getTime())/this.ONE_DAY_MS);
+
+ // Calc. Full Weeks
+ var rem = daysDiff % 7;
+ var weeksDiff = (daysDiff - rem)/7;
+ weekNum = weeksDiff + 1;
+ }
+ return weekNum;
+ },
+
+ /**
+ * Get the first day of the week, for the give date.
+ * @param {Date} dt The date in the week for which the first day is required.
+ * @param {Number} startOfWeek The index for the first day of the week, 0 = Sun, 1 = Mon ... 6 = Sat (defaults to 0)
+ * @return {Date} The first day of the week
+ */
+ getFirstDayOfWeek : function (dt, startOfWeek) {
+ startOfWeek = startOfWeek || 0;
+ var dayOfWeekIndex = dt.getDay(),
+ dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;
+
+ return this.subtract(dt, this.DAY, dayOfWeek);
+ },
+
+ /**
+ * 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 = this.getDate(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;
+ },
+
+ /**
+ * Returns a new JavaScript Date object, representing the given year, month and date. Time fields (hr, min, sec, ms) on the new Date object
+ * are set to 0. The method allows Date instances to be created with the a year less than 100. "new Date(year, month, date)" implementations
+ * set the year to 19xx if a year (xx) which is less than 100 is provided.
+ *
+ * NOTE: Validation on argument values is not performed. It is the caller's responsibility to ensure
+ * arguments are valid as per the ECMAScript-262 Date object specification for the new Date(year, month[, date]) constructor.
+ *
+ * @method getDate
+ * @param {Number} y Year.
+ * @param {Number} m Month index from 0 (Jan) to 11 (Dec).
+ * @param {Number} d (optional) Date from 1 to 31. If not provided, defaults to 1.
+ * @return {Date} The JavaScript date object with year, month, date set as provided.
+ */
+ getDate : function(y, m, d) {
+ var dt = null;
+ if (YAHOO.lang.isUndefined(d)) {
+ d = 1;
+ }
+ if (y >= 100) {
+ dt = new Date(y, m, d);
+ } else {
+ dt = new Date();
+ dt.setFullYear(y);
+ dt.setMonth(m);
+ dt.setDate(d);
+ dt.setHours(0,0,0,0);
+ }
+ return dt;
+ }
+};
+/**
+* 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
+*/
+(function(){
+
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event,
+ Lang = YAHOO.lang,
+ DateMath = YAHOO.widget.DateMath;
+
+/**
+* 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.
+* To construct the placeholder for the calendar widget, the code is as
+* follows:
+*
+*
+*
+*
+*
+* NOTE: As of 2.4.0, the constructor's ID argument is optional.
+* The Calendar can be constructed by simply providing a container ID string,
+* or a reference to a container DIV HTMLElement (the element needs to exist
+* in the document).
+*
+* E.g.:
+*
+* var c = new YAHOO.widget.Calendar("calContainer", configOptions);
+*
+* or:
+*
+* var containerDiv = YAHOO.util.Dom.get("calContainer");
+* var c = new YAHOO.widget.Calendar(containerDiv, configOptions);
+*
+*
+*
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the Calendar's ID will be set to "calContainer_t".
+*
+*
+* @namespace YAHOO.widget
+* @class Calendar
+* @constructor
+* @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
+*/
+function Calendar(id, containerId, config) {
+ this.init.apply(this, arguments);
+}
+
+/**
+* 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
+*/
+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
+*/
+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
+*/
+Calendar.MONTH_DAY = "MD";
+
+/**
+* Type constant used for renderers to represent a weekday
+* @property YAHOO.widget.Calendar.WEEKDAY
+* @static
+* @final
+* @type String
+*/
+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
+*/
+Calendar.RANGE = "R";
+
+/**
+* Type constant used for renderers to represent a month across any year
+* @property YAHOO.widget.Calendar.MONTH
+* @static
+* @final
+* @type String
+*/
+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
+*/
+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
+*/
+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
+*/
+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
+*/
+Calendar.LONG = "long";
+
+/**
+* Constant used to represent medium date field string formats (e.g. Mon)
+* @property YAHOO.widget.Calendar.MEDIUM
+* @static
+* @final
+* @type String
+*/
+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
+*/
+Calendar.ONE_CHAR = "1char";
+
+/**
+* The set of default Config property keys and values for the Calendar.
+*
+*
+* NOTE: This property is made public in order to allow users to change
+* the default values of configuration properties. Users should not
+* modify the key string, unless they are overriding the Calendar implementation
+*
+*
+*
+* The property is an object with key/value pairs, the key being the
+* uppercase configuration property name and the value being an object
+* literal with a key string property, and a value property, specifying the
+* default value of the property. To override a default value, you can set
+* the value property, for example, YAHOO.widget.Calendar.DEFAULT_CONFIG.MULTI_SELECT.value = true;
+*
+* @property YAHOO.widget.Calendar.DEFAULT_CONFIG
+* @static
+* @type Object
+*/
+
+Calendar.DEFAULT_CONFIG = {
+ YEAR_OFFSET : {key:"year_offset", value:0, supercedes:["pagedate", "selected", "mindate","maxdate"]},
+ TODAY : {key:"today", value:new Date(), supercedes:["pagedate"]},
+ PAGEDATE : {key:"pagedate", value:null},
+ SELECTED : {key:"selected", value:[]},
+ 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:""},
+ NAV: {key:"navigator", value: null},
+ STRINGS : {
+ key:"strings",
+ value: {
+ previousMonth : "Previous Month",
+ nextMonth : "Next Month",
+ close: "Close"
+ },
+ supercedes : ["close", "title"]
+ }
+};
+
+/**
+* The set of default Config property keys and values for the Calendar
+* @property YAHOO.widget.Calendar._DEFAULT_CONFIG
+* @deprecated Made public. See the public DEFAULT_CONFIG property for details
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
+
+var DEF_CFG = Calendar.DEFAULT_CONFIG;
+
+/**
+* The set of Custom Event types supported by the Calendar
+* @property YAHOO.widget.Calendar._EVENT_TYPES
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._EVENT_TYPES = {
+ BEFORE_SELECT : "beforeSelect",
+ SELECT : "select",
+ BEFORE_DESELECT : "beforeDeselect",
+ DESELECT : "deselect",
+ CHANGE_PAGE : "changePage",
+ BEFORE_RENDER : "beforeRender",
+ RENDER : "render",
+ BEFORE_DESTROY : "beforeDestroy",
+ DESTROY : "destroy",
+ RESET : "reset",
+ CLEAR : "clear",
+ BEFORE_HIDE : "beforeHide",
+ HIDE : "hide",
+ BEFORE_SHOW : "beforeShow",
+ SHOW : "show",
+ BEFORE_HIDE_NAV : "beforeHideNav",
+ HIDE_NAV : "hideNav",
+ BEFORE_SHOW_NAV : "beforeShowNav",
+ SHOW_NAV : "showNav",
+ BEFORE_RENDER_NAV : "beforeRenderNav",
+ RENDER_NAV : "renderNav"
+};
+
+/**
+* The set of default style constants for the Calendar
+* @property YAHOO.widget.Calendar.STYLES
+* @static
+* @type Object An object with name/value pairs for the class name identifier/value.
+*/
+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_NAV : "calnav",
+ 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",
+ CSS_WITH_TITLE: "withtitle",
+ CSS_FIXED_SIZE: "fixedsize",
+ CSS_LINK_CLOSE: "link-close"
+};
+
+/**
+* The set of default style constants for the Calendar
+* @property YAHOO.widget.Calendar._STYLES
+* @deprecated Made public. See the public STYLES property for details
+* @final
+* @static
+* @private
+* @type Object
+*/
+Calendar._STYLES = Calendar.STYLES;
+
+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.
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The unique id associated with the Calendar's container
+ * @property containerId
+ * @type String
+ */
+ containerId: 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.
+ * @deprecated Use the "today" configuration property
+ * @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,
+
+ /**
+ * A reference to the CalendarNavigator instance created for this Calendar.
+ * Will be null if the "navigator" configuration property has not been set
+ * @property oNavigator
+ * @type CalendarNavigator
+ */
+ oNavigator : 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,
+
+ /**
+ * Protected helper used to parse Calendar constructor/init arguments.
+ *
+ * As of 2.4.0, Calendar supports a simpler constructor
+ * signature. This method reconciles arguments
+ * received in the pre 2.4.0 and 2.4.0 formats.
+ *
+ * @protected
+ * @method _parseArgs
+ * @param {Array} Function "arguments" array
+ * @return {Object} Object with id, container, config properties containing
+ * the reconciled argument values.
+ **/
+ _parseArgs : function(args) {
+ /*
+ 2.4.0 Constructors signatures
+
+ new Calendar(String)
+ new Calendar(HTMLElement)
+ new Calendar(String, ConfigObject)
+ new Calendar(HTMLElement, ConfigObject)
+
+ Pre 2.4.0 Constructor signatures
+
+ new Calendar(String, String)
+ new Calendar(String, HTMLElement)
+ new Calendar(String, String, ConfigObject)
+ new Calendar(String, HTMLElement, ConfigObject)
+ */
+ var nArgs = {id:null, container:null, config:null};
+
+ if (args && args.length && args.length > 0) {
+ switch (args.length) {
+ case 1:
+ nArgs.id = null;
+ nArgs.container = args[0];
+ nArgs.config = null;
+ break;
+ case 2:
+ if (Lang.isObject(args[1]) && !args[1].tagName && !(args[1] instanceof String)) {
+ nArgs.id = null;
+ nArgs.container = args[0];
+ nArgs.config = args[1];
+ } else {
+ nArgs.id = args[0];
+ nArgs.container = args[1];
+ nArgs.config = null;
+ }
+ break;
+ default: // 3+
+ nArgs.id = args[0];
+ nArgs.container = args[1];
+ nArgs.config = args[2];
+ break;
+ }
+ } else {
+ }
+ return nArgs;
+ },
+
+ /**
+ * Initializes the Calendar widget.
+ * @method init
+ *
+ * @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+ * @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+ * @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
+ */
+ init : function(id, container, config) {
+ // Normalize 2.4.0, pre 2.4.0 args
+ var nArgs = this._parseArgs(arguments);
+
+ id = nArgs.id;
+ container = nArgs.container;
+ config = nArgs.config;
+
+ this.oDomContainer = Dom.get(container);
+
+ if (!this.oDomContainer.id) {
+ this.oDomContainer.id = Dom.generateId();
+ }
+ if (!id) {
+ id = this.oDomContainer.id + "_t";
+ }
+
+ this.id = id;
+ this.containerId = this.oDomContainer.id;
+
+ this.initEvents();
+
+ /**
+ * 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();
+
+ Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
+ 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();
+
+ this.today = this.cfg.getProperty("today");
+ },
+
+ /**
+ * 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
+ */
+ configIframe : function(type, args, obj) {
+ var useIframe = args[0];
+
+ if (!this.parent) {
+ if (Dom.inDocument(this.oDomContainer)) {
+ if (useIframe) {
+ var pos = Dom.getStyle(this.oDomContainer, "position");
+
+ if (pos == "absolute" || pos == "relative") {
+
+ if (!Dom.inDocument(this.iframe)) {
+ this.iframe = document.createElement("iframe");
+ this.iframe.src = "javascript:false;";
+
+ Dom.setStyle(this.iframe, "opacity", "0");
+
+ if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+ Dom.addClass(this.iframe, this.Style.CSS_FIXED_SIZE);
+ }
+
+ 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
+ */
+ configTitle : function(type, args, obj) {
+ var title = args[0];
+
+ // "" disables title bar
+ if (title) {
+ this.createTitleBar(title);
+ } else {
+ var close = this.cfg.getProperty(DEF_CFG.CLOSE.key);
+ if (!close) {
+ this.removeTitleBar();
+ } else {
+ this.createTitleBar(" ");
+ }
+ }
+ },
+
+ /**
+ * Default handler for the "close" property
+ * @method configClose
+ */
+ configClose : function(type, args, obj) {
+ var close = args[0],
+ title = this.cfg.getProperty(DEF_CFG.TITLE.key);
+
+ if (close) {
+ if (!title) {
+ this.createTitleBar(" ");
+ }
+ this.createCloseButton();
+ } else {
+ this.removeCloseButton();
+ if (!title) {
+ this.removeTitleBar();
+ }
+ }
+ },
+
+ /**
+ * Initializes Calendar's built-in CustomEvents
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ var defEvents = Calendar._EVENT_TYPES,
+ CE = YAHOO.util.CustomEvent,
+ cal = this; // To help with minification
+
+ /**
+ * Fired before a date selection is made
+ * @event beforeSelectEvent
+ */
+ cal.beforeSelectEvent = new CE(defEvents.BEFORE_SELECT);
+
+ /**
+ * Fired when a date selection is made
+ * @event selectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ cal.selectEvent = new CE(defEvents.SELECT);
+
+ /**
+ * Fired before a date or set of dates is deselected
+ * @event beforeDeselectEvent
+ */
+ cal.beforeDeselectEvent = new CE(defEvents.BEFORE_DESELECT);
+
+ /**
+ * Fired when a date or set of dates is deselected
+ * @event deselectEvent
+ * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
+ */
+ cal.deselectEvent = new CE(defEvents.DESELECT);
+
+ /**
+ * Fired when the Calendar page is changed
+ * @event changePageEvent
+ * @param {Date} prevDate The date before the page was changed
+ * @param {Date} newDate The date after the page was changed
+ */
+ cal.changePageEvent = new CE(defEvents.CHANGE_PAGE);
+
+ /**
+ * Fired before the Calendar is rendered
+ * @event beforeRenderEvent
+ */
+ cal.beforeRenderEvent = new CE(defEvents.BEFORE_RENDER);
+
+ /**
+ * Fired when the Calendar is rendered
+ * @event renderEvent
+ */
+ cal.renderEvent = new CE(defEvents.RENDER);
+
+ /**
+ * Fired just before the Calendar is to be destroyed
+ * @event beforeDestroyEvent
+ */
+ cal.beforeDestroyEvent = new CE(defEvents.BEFORE_DESTROY);
+
+ /**
+ * Fired after the Calendar is destroyed. This event should be used
+ * for notification only. When this event is fired, important Calendar instance
+ * properties, dom references and event listeners have already been
+ * removed/dereferenced, and hence the Calendar instance is not in a usable
+ * state.
+ *
+ * @event destroyEvent
+ */
+ cal.destroyEvent = new CE(defEvents.DESTROY);
+
+ /**
+ * Fired when the Calendar is reset
+ * @event resetEvent
+ */
+ cal.resetEvent = new CE(defEvents.RESET);
+
+ /**
+ * Fired when the Calendar is cleared
+ * @event clearEvent
+ */
+ cal.clearEvent = new CE(defEvents.CLEAR);
+
+ /**
+ * Fired just before the Calendar is to be shown
+ * @event beforeShowEvent
+ */
+ cal.beforeShowEvent = new CE(defEvents.BEFORE_SHOW);
+
+ /**
+ * Fired after the Calendar is shown
+ * @event showEvent
+ */
+ cal.showEvent = new CE(defEvents.SHOW);
+
+ /**
+ * Fired just before the Calendar is to be hidden
+ * @event beforeHideEvent
+ */
+ cal.beforeHideEvent = new CE(defEvents.BEFORE_HIDE);
+
+ /**
+ * Fired after the Calendar is hidden
+ * @event hideEvent
+ */
+ cal.hideEvent = new CE(defEvents.HIDE);
+
+ /**
+ * Fired just before the CalendarNavigator is to be shown
+ * @event beforeShowNavEvent
+ */
+ cal.beforeShowNavEvent = new CE(defEvents.BEFORE_SHOW_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is shown
+ * @event showNavEvent
+ */
+ cal.showNavEvent = new CE(defEvents.SHOW_NAV);
+
+ /**
+ * Fired just before the CalendarNavigator is to be hidden
+ * @event beforeHideNavEvent
+ */
+ cal.beforeHideNavEvent = new CE(defEvents.BEFORE_HIDE_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is hidden
+ * @event hideNavEvent
+ */
+ cal.hideNavEvent = new CE(defEvents.HIDE_NAV);
+
+ /**
+ * Fired just before the CalendarNavigator is to be rendered
+ * @event beforeRenderNavEvent
+ */
+ cal.beforeRenderNavEvent = new CE(defEvents.BEFORE_RENDER_NAV);
+
+ /**
+ * Fired after the CalendarNavigator is rendered
+ * @event renderNavEvent
+ */
+ cal.renderNavEvent = new CE(defEvents.RENDER_NAV);
+
+ cal.beforeSelectEvent.subscribe(cal.onBeforeSelect, this, true);
+ cal.selectEvent.subscribe(cal.onSelect, this, true);
+ cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect, this, true);
+ cal.deselectEvent.subscribe(cal.onDeselect, this, true);
+ cal.changePageEvent.subscribe(cal.onChangePage, this, true);
+ cal.renderEvent.subscribe(cal.onRender, this, true);
+ cal.resetEvent.subscribe(cal.onReset, this, true);
+ cal.clearEvent.subscribe(cal.onClear, this, true);
+ },
+
+ /**
+ * The default event handler for clicks on the "Previous Month" navigation UI
+ *
+ * @method doPreviousMonthNav
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doPreviousMonthNav : function(e, cal) {
+ Event.preventDefault(e);
+ // previousMonth invoked in a timeout, to allow
+ // event to bubble up, with correct target. Calling
+ // previousMonth, will call render which will remove
+ // HTML which generated the event, resulting in an
+ // invalid event target in certain browsers.
+ setTimeout(function() {
+ cal.previousMonth();
+ var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT, "a", cal.oDomContainer);
+ if (navs && navs[0]) {
+ try {
+ navs[0].focus();
+ } catch (ex) {
+ // ignore
+ }
+ }
+ }, 0);
+ },
+
+ /**
+ * The default event handler for clicks on the "Next Month" navigation UI
+ *
+ * @method doNextMonthNav
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doNextMonthNav : function(e, cal) {
+ Event.preventDefault(e);
+ setTimeout(function() {
+ cal.nextMonth();
+ var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT, "a", cal.oDomContainer);
+ if (navs && navs[0]) {
+ try {
+ navs[0].focus();
+ } catch (ex) {
+ // ignore
+ }
+ }
+ }, 0);
+ },
+
+ /**
+ * The default event handler for date cell selection. Currently attached to
+ * the Calendar's bounding box, referenced by it's oDomContainer property.
+ *
+ * @method doSelectCell
+ * @param {DOMEvent} e The DOM event
+ * @param {Calendar} cal A reference to the calendar
+ */
+ doSelectCell : function(e, cal) {
+ var cell, d, date, index;
+
+ var target = Event.getTarget(e),
+ tagName = target.tagName.toLowerCase(),
+ defSelector = false;
+
+ while (tagName != "td" && !Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+
+ if (!defSelector && tagName == "a" && Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
+ defSelector = true;
+ }
+
+ target = target.parentNode;
+ tagName = target.tagName.toLowerCase();
+
+ if (target == this.oDomContainer || tagName == "html") {
+ return;
+ }
+ }
+
+ if (defSelector) {
+ // Stop link href navigation for default renderer
+ Event.preventDefault(e);
+ }
+
+ cell = target;
+
+ if (Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+ index = cal.getIndexFromId(cell.id);
+ if (index > -1) {
+ d = cal.cellDates[index];
+ if (d) {
+ date = DateMath.getDate(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
+ */
+ doCellMouseOver : function(e, cal) {
+ var target;
+ if (e) {
+ target = Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName && target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (!target.tagName || target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ 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
+ */
+ doCellMouseOut : function(e, cal) {
+ var target;
+ if (e) {
+ target = Event.getTarget(e);
+ } else {
+ target = this;
+ }
+
+ while (target.tagName && target.tagName.toLowerCase() != "td") {
+ target = target.parentNode;
+ if (!target.tagName || target.tagName.toLowerCase() == "html") {
+ return;
+ }
+ }
+
+ if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+ Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+ }
+ },
+
+ setupConfig : function() {
+
+ var cfg = this.cfg;
+
+ /**
+ * The date to use to represent "Today".
+ *
+ * @config today
+ * @type Date
+ * @default The client side date (new Date()) when the Calendar is instantiated.
+ */
+ cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler:this.configToday, suppressEvent:true } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String | Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ * @config selected
+ * @type String
+ * @default []
+ */
+ cfg.addProperty(DEF_CFG.SELECTED.key, { value:DEF_CFG.SELECTED.value.concat(), handler:this.configSelected } );
+
+ /**
+ * The title to display above the Calendar's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this Calendar
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.configMinDate } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday = 0, Monday = 1 ... Saturday = 6).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.configOptions, validator:cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key, { value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator: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
+ */
+ cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key, { value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator: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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.WEEKDAYS_LONG.value, handler:this.configLocale } );
+
+ /**
+ * Refreshes the locale values used to build the Calendar.
+ * @method refreshLocale
+ * @private
+ */
+ var refreshLocale = function() {
+ cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
+ cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
+ };
+
+ cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
+ cfg.subscribeToConfigEvent(DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
+
+ /**
+ * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
+ * be used when displaying and parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
+ * methods will always represent the Gregorian year, in order to maintain date/month/week values.
+ *
+ * @config YEAR_OFFSET
+ * @type Number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, handler:this.configLocale } );
+
+ /**
+ * The value used to delimit individual dates in a date string passed to various Calendar functions.
+ * @config DATE_DELIMITER
+ * @type String
+ * @default ","
+ */
+ cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.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 "/"
+ */
+ cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key, { value:DEF_CFG.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 "-"
+ */
+ cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.configLocale, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
+
+ /**
+ * The suffix used after the month when rendering the Calendar header
+ * @config MY_LABEL_MONTH_SUFFIX
+ * @type String
+ * @default " "
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.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 ""
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
+
+ /**
+ * Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a
+ * specific Month/Year without having to scroll sequentially through months.
+ *
+ * Setting this property to null (default value) or false, will disable the CalendarNavigator UI.
+ *
+ *
+ * Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.
+ *
+ *
+ * This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
+ * The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
+ * Any properties which are not provided will use the default values (defined in the CalendarNavigator class).
+ *
+ *
+ * strings
+ * Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
+ *
+ * month String : The string to use for the month label. Defaults to "Month".
+ * year String : The string to use for the year label. Defaults to "Year".
+ * submit String : The string to use for the submit button label. Defaults to "Okay".
+ * cancel String : The string to use for the cancel button label. Defaults to "Cancel".
+ * invalidYear String : The string to use for invalid year values. Defaults to "Year needs to be a number".
+ *
+ *
+ * monthFormat String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
+ * initialFocus String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
+ *
+ * E.g.
+ *
+ * var navConfig = {
+ * strings: {
+ * month:"Calendar Month",
+ * year:"Calendar Year",
+ * submit: "Submit",
+ * cancel: "Cancel",
+ * invalidYear: "Please enter a valid year"
+ * },
+ * monthFormat: YAHOO.widget.Calendar.SHORT,
+ * initialFocus: "month"
+ * }
+ *
+ * @config navigator
+ * @type {Object|Boolean}
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
+
+ /**
+ * The map of UI strings which the Calendar UI uses.
+ *
+ * @config strings
+ * @type {Object}
+ * @default An object with the properties shown below:
+ *
+ * previousMonth String : The string to use for the "Previous Month" navigation UI. Defaults to "Previous Month".
+ * nextMonth String : The string to use for the "Next Month" navigation UI. Defaults to "Next Month".
+ * close String : The string to use for the close button label. Defaults to "Close".
+ *
+ */
+ cfg.addProperty(DEF_CFG.STRINGS.key, {
+ value:DEF_CFG.STRINGS.value,
+ handler:this.configStrings,
+ validator: function(val) {
+ return Lang.isObject(val);
+ },
+ supercedes:DEF_CFG.STRINGS.supercedes
+ });
+ },
+
+ /**
+ * The default handler for the "strings" property
+ * @method configStrings
+ */
+ configStrings : function(type, args, obj) {
+ var val = Lang.merge(DEF_CFG.STRINGS.value, args[0]);
+ this.cfg.setProperty(DEF_CFG.STRINGS.key, val, true);
+ },
+
+ /**
+ * The default handler for the "pagedate" property
+ * @method configPageDate
+ */
+ configPageDate : function(type, args, obj) {
+ this.cfg.setProperty(DEF_CFG.PAGEDATE.key, this._parsePageDate(args[0]), true);
+ },
+
+ /**
+ * The default handler for the "mindate" property
+ * @method configMinDate
+ */
+ configMinDate : function(type, args, obj) {
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ this.cfg.setProperty(DEF_CFG.MINDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
+ }
+ },
+
+ /**
+ * The default handler for the "maxdate" property
+ * @method configMaxDate
+ */
+ configMaxDate : function(type, args, obj) {
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ this.cfg.setProperty(DEF_CFG.MAXDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
+ }
+ },
+
+ /**
+ * The default handler for the "today" property
+ * @method configToday
+ */
+ configToday : function(type, args, obj) {
+ // Only do this for initial set. Changing the today property after the initial
+ // set, doesn't affect pagedate
+ var val = args[0];
+ if (Lang.isString(val)) {
+ val = this._parseDate(val);
+ }
+ var today = DateMath.clearTime(val);
+ if (!this.cfg.initialConfig[DEF_CFG.PAGEDATE.key]) {
+ this.cfg.setProperty(DEF_CFG.PAGEDATE.key, today);
+ }
+ this.today = today;
+ this.cfg.setProperty(DEF_CFG.TODAY.key, today, true);
+ },
+
+ /**
+ * The default handler for the "selected" property
+ * @method configSelected
+ */
+ configSelected : function(type, args, obj) {
+ var selected = args[0],
+ cfgSelected = DEF_CFG.SELECTED.key;
+
+ if (selected) {
+ if (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
+ */
+ configOptions : function(type, args, obj) {
+ this.Options[type.toUpperCase()] = args[0];
+ },
+
+ /**
+ * The default handler for all configuration locale properties
+ * @method configLocale
+ */
+ configLocale : function(type, args, obj) {
+ this.Locale[type.toUpperCase()] = args[0];
+
+ this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
+ this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
+ },
+
+ /**
+ * The default handler for all configuration locale field length properties
+ * @method configLocaleValues
+ */
+ configLocaleValues : function(type, args, obj) {
+
+ type = type.toLowerCase();
+
+ var val = args[0],
+ cfg = this.cfg,
+ Locale = this.Locale;
+
+ switch (type) {
+ case DEF_CFG.LOCALE_MONTHS.key:
+ switch (val) {
+ case Calendar.SHORT:
+ Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();
+ break;
+ case Calendar.LONG:
+ Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();
+ break;
+ }
+ break;
+ case DEF_CFG.LOCALE_WEEKDAYS.key:
+ switch (val) {
+ case Calendar.ONE_CHAR:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();
+ break;
+ case Calendar.SHORT:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();
+ break;
+ case Calendar.MEDIUM:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();
+ break;
+ case Calendar.LONG:
+ Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();
+ break;
+ }
+
+ var START_WEEKDAY = cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
+
+ if (START_WEEKDAY > 0) {
+ for (var w=0; w < START_WEEKDAY; ++w) {
+ Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());
+ }
+ }
+ break;
+ }
+ },
+
+ /**
+ * The default handler for the "navigator" property
+ * @method configNavigator
+ */
+ configNavigator : function(type, args, obj) {
+ var val = args[0];
+ if (YAHOO.widget.CalendarNavigator && (val === true || Lang.isObject(val))) {
+ if (!this.oNavigator) {
+ this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
+ // Cleanup DOM Refs/Events before innerHTML is removed.
+ this.beforeRenderEvent.subscribe(function () {
+ if (!this.pages) {
+ this.oNavigator.erase();
+ }
+ }, this, true);
+ }
+ } else {
+ if (this.oNavigator) {
+ this.oNavigator.destroy();
+ this.oNavigator = null;
+ }
+ }
+ },
+
+ /**
+ * Defines the style constants for the Calendar
+ * @method initStyles
+ */
+ initStyles : function() {
+
+ var defStyle = 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_NAV
+ */
+ CSS_NAV : defStyle.CSS_NAV,
+ /**
+ * @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,
+ /**
+ * @property Style.CSS_WITH_TITLE
+ */
+ CSS_WITH_TITLE : defStyle.CSS_WITH_TITLE,
+ /**
+ * @property Style.CSS_FIXED_SIZE
+ */
+ CSS_FIXED_SIZE : defStyle.CSS_FIXED_SIZE,
+ /**
+ * @property Style.CSS_LINK_CLOSE
+ */
+ CSS_LINK_CLOSE : defStyle.CSS_LINK_CLOSE
+ };
+ },
+
+ /**
+ * 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
+ */
+ buildMonthLabel : function() {
+ return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
+ },
+
+ /**
+ * Helper method, to format a Month Year string, given a JavaScript Date, based on the
+ * Calendar localization settings
+ *
+ * @method _buildMonthLabel
+ * @private
+ * @param {Date} date
+ * @return {String} Formated month, year string
+ */
+ _buildMonthLabel : function(date) {
+ var monthLabel = this.Locale.LOCALE_MONTHS[date.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX,
+ yearLabel = (date.getFullYear() + this.Locale.YEAR_OFFSET) + 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
+ */
+ 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
+ */
+ createTitleBar : function(strTitle) {
+ var tDiv = 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);
+
+ Dom.addClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
+
+ return tDiv;
+ },
+
+ /**
+ * Removes the title bar element from the DOM
+ *
+ * @method removeTitleBar
+ */
+ removeTitleBar : function() {
+ var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+ if (tDiv) {
+ Event.purgeElement(tDiv);
+ this.oDomContainer.removeChild(tDiv);
+ }
+ Dom.removeClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
+ },
+
+ /**
+ * Creates the close button HTML element and adds it to Calendar container DIV
+ *
+ * @method createCloseButton
+ * @return The close HTML element created
+ */
+ createCloseButton : function() {
+ var cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
+ cssLinkClose = this.Style.CSS_LINK_CLOSE,
+ DEPR_CLOSE_PATH = "us/my/bn/x_d.gif",
+
+ lnk = Dom.getElementsByClassName(cssLinkClose, "a", this.oDomContainer)[0],
+ strings = this.cfg.getProperty(DEF_CFG.STRINGS.key),
+ closeStr = (strings && strings.close) ? strings.close : "";
+
+ if (!lnk) {
+ lnk = document.createElement("a");
+ Event.addListener(lnk, "click", function(e, cal) {
+ cal.hide();
+ Event.preventDefault(e);
+ }, this);
+ }
+
+ lnk.href = "#";
+ lnk.className = cssLinkClose;
+
+ if (Calendar.IMG_ROOT !== null) {
+ var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
+ img.src = Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
+ img.className = cssClose;
+ lnk.appendChild(img);
+ } else {
+ lnk.innerHTML = '' + closeStr + ' ';
+ }
+ this.oDomContainer.appendChild(lnk);
+
+ return lnk;
+ },
+
+ /**
+ * Removes the close button HTML element from the DOM
+ *
+ * @method removeCloseButton
+ */
+ removeCloseButton : function() {
+ var btn = Dom.getElementsByClassName(this.Style.CSS_LINK_CLOSE, "a", this.oDomContainer)[0] || null;
+ if (btn) {
+ 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
+ */
+ renderHeader : function(html) {
+
+
+ var colSpan = 7,
+ DEPR_NAV_LEFT = "us/tr/callt.gif",
+ DEPR_NAV_RIGHT = "us/tr/calrt.gif",
+ cfg = this.cfg,
+ pageDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
+ strings= cfg.getProperty(DEF_CFG.STRINGS.key),
+ prevStr = (strings && strings.previousMonth) ? strings.previousMonth : "",
+ nextStr = (strings && strings.nextMonth) ? strings.nextMonth : "",
+ monthLabel;
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
+ colSpan += 1;
+ }
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
+ colSpan += 1;
+ }
+
+ html[html.length] = "";
+ html[html.length] = "";
+ html[html.length] = '\n ';
+
+ if (cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)) {
+ html = this.buildWeekdays(html);
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ buildWeekdays : function(html) {
+
+ html[html.length] = '';
+
+ if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
+ html[html.length] = ' ';
+ }
+
+ for(var i=0;i < this.Locale.LOCALE_WEEKDAYS.length; ++i) {
+ html[html.length] = '' + this.Locale.LOCALE_WEEKDAYS[i] + ' ';
+ }
+
+ if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
+ html[html.length] = ' ';
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ renderBody : function(workingDate, html) {
+
+ var startDay = this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
+
+ this.preMonthDays = workingDate.getDay();
+ if (startDay > 0) {
+ this.preMonthDays -= startDay;
+ }
+ if (this.preMonthDays < 0) {
+ this.preMonthDays += 7;
+ }
+
+ this.monthDays = DateMath.findMonthEnd(workingDate).getDate();
+ this.postMonthDays = Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+
+
+ workingDate = DateMath.subtract(workingDate, DateMath.DAY, this.preMonthDays);
+
+ var weekNum,
+ weekClass,
+ weekPrefix = "w",
+ cellPrefix = "_cell",
+ workingDayPrefix = "wd",
+ dayPrefix = "d",
+ cellRenderers,
+ renderer,
+ t = this.today,
+ cfg = this.cfg,
+ todayYear = t.getFullYear(),
+ todayMonth = t.getMonth(),
+ todayDate = t.getDate(),
+ useDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
+ hideBlankWeeks = cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),
+ showWeekFooter = cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),
+ showWeekHeader = cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),
+ mindate = cfg.getProperty(DEF_CFG.MINDATE.key),
+ maxdate = cfg.getProperty(DEF_CFG.MAXDATE.key),
+ yearOffset = this.Locale.YEAR_OFFSET;
+
+ if (mindate) {
+ mindate = DateMath.clearTime(mindate);
+ }
+ if (maxdate) {
+ maxdate = DateMath.clearTime(maxdate);
+ }
+
+ html[html.length] = '';
+
+ var i = 0,
+ tempDiv = document.createElement("div"),
+ cell = document.createElement("td");
+
+ tempDiv.appendChild(cell);
+
+ var cal = this.parent || this;
+
+ for (var r=0;r<6;r++) {
+ weekNum = DateMath.getWeekNumber(workingDate, 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] = '';
+
+ if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
+
+ for (var d=0; d < 7; d++){ // Render actual days
+
+ cellRenderers = [];
+
+ 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 {
+ Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
+ Dom.addClass(cell, dayPrefix + workingDate.getDate());
+
+ for (var s=0;s= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
+ renderer = rArray[2];
+
+ if (workingDate.getTime()==d2.getTime()) {
+ this.renderStack.splice(s,1);
+ }
+ }
+ break;
+ case Calendar.WEEKDAY:
+ var weekday = rArray[1][0];
+ if (workingDate.getDay()+1 == weekday) {
+ renderer = rArray[2];
+ }
+ break;
+ case 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) == Calendar.STOP_RENDER) {
+ break;
+ }
+ }
+
+ workingDate.setTime(workingDate.getTime() + DateMath.ONE_DAY_MS);
+ // Just in case we crossed DST/Summertime boundaries
+ workingDate = DateMath.clearTime(workingDate);
+
+ if (i >= 0 && i <= 6) {
+ Dom.addClass(cell, this.Style.CSS_CELL_TOP);
+ }
+ if ((i % 7) === 0) {
+ Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
+ }
+ if (((i+1) % 7) === 0) {
+ 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= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+ Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+ }
+
+ html[html.length] = tempDiv.innerHTML;
+ i++;
+ }
+
+ if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
+
+ html[html.length] = ' ';
+ }
+ }
+
+ html[html.length] = ' ';
+
+ 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
+ */
+ 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
+ */
+ render : function() {
+ this.beforeRenderEvent.fire();
+
+ // Find starting day of the current month
+ var workingDate = DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
+
+ this.resetRenderers();
+ this.cellDates.length = 0;
+
+ Event.purgeElement(this.oDomContainer, true);
+
+ var html = [];
+
+ html[html.length] = '';
+ html = this.renderHeader(html);
+ html = this.renderBody(workingDate, html);
+ html = this.renderFooter(html);
+ html[html.length] = '
';
+
+ this.oDomContainer.innerHTML = html.join("\n");
+
+ this.applyListeners();
+ this.cells = Dom.getElementsByClassName(this.Style.CSS_CELL, "td", this.id);
+
+ this.cfg.refireEvent(DEF_CFG.TITLE.key);
+ this.cfg.refireEvent(DEF_CFG.CLOSE.key);
+ this.cfg.refireEvent(DEF_CFG.IFRAME.key);
+
+ this.renderEvent.fire();
+ },
+
+ /**
+ * Applies the Calendar's DOM listeners to applicable elements.
+ * @method applyListeners
+ */
+ applyListeners : function() {
+ var root = this.oDomContainer,
+ cal = this.parent || this,
+ anchor = "a",
+ click = "click";
+
+ var linkLeft = Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root),
+ linkRight = Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
+
+ if (linkLeft && linkLeft.length > 0) {
+ this.linkLeft = linkLeft[0];
+ Event.addListener(this.linkLeft, click, this.doPreviousMonthNav, cal, true);
+ }
+
+ if (linkRight && linkRight.length > 0) {
+ this.linkRight = linkRight[0];
+ Event.addListener(this.linkRight, click, this.doNextMonthNav, cal, true);
+ }
+
+ if (cal.cfg.getProperty("navigator") !== null) {
+ this.applyNavListeners();
+ }
+
+ if (this.domEventMap) {
+ var el,elements;
+ for (var cls in this.domEventMap) {
+ if (Lang.hasOwnProperty(this.domEventMap, cls)) {
+ var items = this.domEventMap[cls];
+
+ if (! (items instanceof Array)) {
+ items = [items];
+ }
+
+ for (var i=0;i 0) {
+
+ Event.addListener(navBtns, "click", function (e, obj) {
+ var target = Event.getTarget(e);
+ // this == navBtn
+ if (this === target || Dom.isAncestor(this, target)) {
+ Event.preventDefault(e);
+ }
+ var navigator = calParent.oNavigator;
+ if (navigator) {
+ var pgdate = cal.cfg.getProperty("pagedate");
+ navigator.setYear(pgdate.getFullYear() + cal.Locale.YEAR_OFFSET);
+ navigator.setMonth(pgdate.getMonth());
+ navigator.show();
+ }
+ });
+ }
+ },
+
+ /**
+ * 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
+ */
+ getDateByCellId : function(id) {
+ var date = this.getDateFieldsByCellId(id);
+ return (date) ? DateMath.getDate(date[0],date[1]-1,date[2]) : null;
+ },
+
+ /**
+ * 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
+ */
+ getDateFieldsByCellId : function(id) {
+ id = this.getIndexFromId(id);
+ return (id > -1) ? this.cellDates[id] : null;
+ },
+
+ /**
+ * Find the Calendar's cell index for a given date.
+ * If the date is not found, the method returns -1.
+ *
+ * The returned index can be used to lookup the cell HTMLElement
+ * using the Calendar's cells array or passed to selectCell to select
+ * cells by index.
+ *
+ *
+ * See cells , selectCell .
+ *
+ * @method getCellIndex
+ * @param {Date} date JavaScript Date object, for which to find a cell index.
+ * @return {Number} The index of the date in Calendars cellDates/cells arrays, or -1 if the date
+ * is not on the curently rendered Calendar page.
+ */
+ getCellIndex : function(date) {
+ var idx = -1;
+ if (date) {
+ var m = date.getMonth(),
+ y = date.getFullYear(),
+ d = date.getDate(),
+ dates = this.cellDates;
+
+ for (var i = 0; i < dates.length; ++i) {
+ var cellDate = dates[i];
+ if (cellDate[0] === y && cellDate[1] === m+1 && cellDate[2] === d) {
+ idx = i;
+ break;
+ }
+ }
+ }
+ return idx;
+ },
+
+ /**
+ * Given the id used to mark each Calendar cell, this method
+ * extracts the index number from the id.
+ *
+ * @param {String} strId The cell id
+ * @return {Number} The index of the cell, or -1 if id does not contain an index number
+ */
+ getIndexFromId : function(strId) {
+ var idx = -1,
+ li = strId.lastIndexOf("_cell");
+
+ if (li > -1) {
+ idx = parseInt(strId.substring(li + 5), 10);
+ }
+
+ return idx;
+ },
+
+ // 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
+ */
+ renderOutOfBoundsDate : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL_OOB);
+ cell.innerHTML = workingDate.getDate();
+ return 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
+ */
+ renderRowHeader : function(weekNum, html) {
+ html[html.length] = '';
+ 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
+ */
+ renderRowFooter : function(weekNum, html) {
+ html[html.length] = '';
+ 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
+ */
+ renderCellDefault : function(workingDate, cell) {
+ cell.innerHTML = '' + this.buildDayLabel(workingDate) + " ";
+ },
+
+ /**
+ * 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
+ */
+ styleCellDefault : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight1 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight2 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight3 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleHighlight4 : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleToday : function(workingDate, cell) {
+ 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
+ */
+ renderCellStyleSelected : function(workingDate, cell) {
+ 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
+ */
+ renderCellNotThisMonth : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+ cell.innerHTML=workingDate.getDate();
+ return 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
+ */
+ renderBodyCellRestricted : function(workingDate, cell) {
+ Dom.addClass(cell, this.Style.CSS_CELL);
+ Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+ cell.innerHTML=workingDate.getDate();
+ return 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
+ */
+ addMonths : function(count) {
+ var cfgPageDate = DEF_CFG.PAGEDATE.key,
+
+ prevDate = this.cfg.getProperty(cfgPageDate),
+ newDate = DateMath.add(prevDate, DateMath.MONTH, count);
+
+ this.cfg.setProperty(cfgPageDate, newDate);
+ this.resetRenderers();
+ this.changePageEvent.fire(prevDate, newDate);
+ },
+
+ /**
+ * 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
+ */
+ subtractMonths : function(count) {
+ this.addMonths(-1*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
+ */
+ addYears : function(count) {
+ var cfgPageDate = DEF_CFG.PAGEDATE.key,
+
+ prevDate = this.cfg.getProperty(cfgPageDate),
+ newDate = DateMath.add(prevDate, DateMath.YEAR, count);
+
+ this.cfg.setProperty(cfgPageDate, newDate);
+ this.resetRenderers();
+ this.changePageEvent.fire(prevDate, newDate);
+ },
+
+ /**
+ * 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
+ */
+ subtractYears : function(count) {
+ this.addYears(-1*count);
+ },
+
+ /**
+ * Navigates to the next month page in the calendar widget.
+ * @method nextMonth
+ */
+ nextMonth : function() {
+ this.addMonths(1);
+ },
+
+ /**
+ * Navigates to the previous month page in the calendar widget.
+ * @method previousMonth
+ */
+ previousMonth : function() {
+ this.addMonths(-1);
+ },
+
+ /**
+ * Navigates to the next year in the currently selected month in the calendar widget.
+ * @method nextYear
+ */
+ nextYear : function() {
+ this.addYears(1);
+ },
+
+ /**
+ * Navigates to the previous year in the currently selected month in the calendar widget.
+ * @method previousYear
+ */
+ previousYear : function() {
+ this.addYears(-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
+ */
+ reset : function() {
+ this.cfg.resetProperty(DEF_CFG.SELECTED.key);
+ this.cfg.resetProperty(DEF_CFG.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
+ */
+ clear : function() {
+ this.cfg.setProperty(DEF_CFG.SELECTED.key, []);
+ this.cfg.setProperty(DEF_CFG.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.
+ */
+ select : function(date) {
+
+ var aToBeSelected = this._toFieldArray(date),
+ validDates = [],
+ selected = [],
+ cfgSelected = DEF_CFG.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.
+ */
+ selectCell : function(cellIndex) {
+
+ var cell = this.cells[cellIndex],
+ cellDate = this.cellDates[cellIndex],
+ dCellDate = this._toDate(cellDate),
+ selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+
+
+ if (selectable) {
+
+ this.beforeSelectEvent.fire();
+
+ var cfgSelected = DEF_CFG.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.
+ */
+ deselect : function(date) {
+
+ var aToBeDeselected = this._toFieldArray(date),
+ validDates = [],
+ selected = [],
+ cfgSelected = DEF_CFG.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.
+ */
+ deselectCell : function(cellIndex) {
+ var cell = this.cells[cellIndex],
+ cellDate = this.cellDates[cellIndex],
+ cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
+
+ var selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+
+ if (selectable) {
+
+ this.beforeDeselectEvent.fire();
+
+ var selected = this.cfg.getProperty(DEF_CFG.SELECTED.key),
+ dCellDate = this._toDate(cellDate),
+ selectDate = cellDate.concat();
+
+ if (cellDateIndex > -1) {
+ if (this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
+ this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
+ Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+ }
+ selected.splice(cellDateIndex, 1);
+ }
+
+ if (this.parent) {
+ this.parent.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
+ } else {
+ this.cfg.setProperty(DEF_CFG.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.
+ */
+ deselectAll : function() {
+ this.beforeDeselectEvent.fire();
+
+ var cfgSelected = DEF_CFG.SELECTED.key,
+ selected = this.cfg.getProperty(cfgSelected),
+ count = selected.length,
+ 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
+ */
+ _toFieldArray : function(date) {
+ var returnDate = [];
+
+ if (date instanceof Date) {
+ returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+ } else if (Lang.isString(date)) {
+ returnDate = this._parseDates(date);
+ } else if (Lang.isArray(date)) {
+ for (var i=0;i 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
+ */
+ _parsePageDate : function(date) {
+ var parsedDate;
+
+ if (date) {
+ if (date instanceof Date) {
+ parsedDate = DateMath.findMonthStart(date);
+ } else {
+ var month, year, aMonthYear;
+ aMonthYear = date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));
+ month = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key)-1], 10)-1;
+ year = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key)-1], 10) - this.Locale.YEAR_OFFSET;
+
+ parsedDate = DateMath.getDate(year, month, 1);
+ }
+ } else {
+ parsedDate = DateMath.getDate(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.
+ */
+ onBeforeSelect : function() {
+ if (this.cfg.getProperty(DEF_CFG.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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ onChangePage : function() {
+ this.render();
+ },
+
+ /**
+ * Event executed when the calendar widget is rendered.
+ * @deprecated Event handlers for this event should be susbcribed to renderEvent.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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
+ */
+ 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[])
+ */
+ _parseDate : function(sDate) {
+ var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER),
+ rArray;
+
+ if (aDate.length == 2) {
+ rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
+ rArray.type = Calendar.MONTH_DAY;
+ } else {
+ rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1] - this.Locale.YEAR_OFFSET, aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
+ rArray.type = Calendar.DATE;
+ }
+
+ for (var i=0;i
+*
+*
+*
+* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+*
+*
+* NOTE: As of 2.4.0, the constructor's ID argument is optional.
+* The CalendarGroup can be constructed by simply providing a container ID string,
+* or a reference to a container DIV HTMLElement (the element needs to exist
+* in the document).
+*
+* E.g.:
+*
+* var c = new YAHOO.widget.CalendarGroup("calContainer", configOptions);
+*
+* or:
+*
+* var containerDiv = YAHOO.util.Dom.get("calContainer");
+* var c = new YAHOO.widget.CalendarGroup(containerDiv, configOptions);
+*
+*
+*
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the CalendarGroup's ID will be set to "calContainer_t".
+*
+*
+* @namespace YAHOO.widget
+* @class CalendarGroup
+* @constructor
+* @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
+*/
+function CalendarGroup(id, containerId, config) {
+ if (arguments.length > 0) {
+ this.init.apply(this, arguments);
+ }
+}
+
+/**
+* The set of default Config property keys and values for the CalendarGroup.
+*
+*
+* NOTE: This property is made public in order to allow users to change
+* the default values of configuration properties. Users should not
+* modify the key string, unless they are overriding the Calendar implementation
+*
+*
+* @property YAHOO.widget.CalendarGroup.DEFAULT_CONFIG
+* @static
+* @type Object An object with key/value pairs, the key being the
+* uppercase configuration property name and the value being an objec
+* literal with a key string property, and a value property, specifying the
+* default value of the property
+*/
+
+/**
+* The set of default Config property keys and values for the CalendarGroup
+* @property YAHOO.widget.CalendarGroup._DEFAULT_CONFIG
+* @deprecated Made public. See the public DEFAULT_CONFIG property for details
+* @private
+* @static
+* @type Object
+*/
+CalendarGroup.DEFAULT_CONFIG = CalendarGroup._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
+CalendarGroup.DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
+
+var DEF_CFG = CalendarGroup.DEFAULT_CONFIG;
+
+CalendarGroup.prototype = {
+
+ /**
+ * Initializes the calendar group. All subclasses must call this method in order for the
+ * group to be initialized properly.
+ * @method init
+ * @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+ * @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+ * @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
+ */
+ init : function(id, container, config) {
+
+ // Normalize 2.4.0, pre 2.4.0 args
+ var nArgs = this._parseArgs(arguments);
+
+ id = nArgs.id;
+ container = nArgs.container;
+ config = nArgs.config;
+
+ this.oDomContainer = Dom.get(container);
+
+ if (!this.oDomContainer.id) {
+ this.oDomContainer.id = Dom.generateId();
+ }
+ if (!id) {
+ id = this.oDomContainer.id + "_t";
+ }
+
+ /**
+ * 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 = this.oDomContainer.id;
+
+ this.initEvents();
+ this.initStyles();
+
+ /**
+ * The collection of Calendar pages contained within the CalendarGroup
+ * @property pages
+ * @type YAHOO.widget.Calendar[]
+ */
+ this.pages = [];
+
+ Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
+ Dom.addClass(this.oDomContainer, 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);
+ this.showEvent.subscribe(this._fixWidth, this, true);
+ }
+
+ },
+
+ setupConfig : function() {
+
+ var cfg = this.cfg;
+
+ /**
+ * 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
+ */
+ cfg.addProperty(DEF_CFG.PAGES.key, { value:DEF_CFG.PAGES.value, validator:cfg.checkNumber, handler:this.configPages } );
+
+ /**
+ * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
+ * be used when displaying or parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
+ * methods will always represent the Gregorian year, in order to maintain date/month/week values.
+ *
+ * @config year_offset
+ * @type Number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, handler: this.delegateConfig, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, suppressEvent:true } );
+
+ /**
+ * The date to use to represent "Today".
+ *
+ * @config today
+ * @type Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler: this.configToday, suppressEvent:false } );
+
+ /**
+ * The month/year representing the current visible Calendar date (mm/yyyy)
+ * @config pagedate
+ * @type String | Date
+ * @default Today's date
+ */
+ cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
+
+ /**
+ * The date or range of dates representing the current Calendar selection
+ *
+ * @config selected
+ * @type String
+ * @default []
+ */
+ cfg.addProperty(DEF_CFG.SELECTED.key, { value:[], handler:this.configSelected } );
+
+ /**
+ * The title to display above the CalendarGroup's month header
+ * @config title
+ * @type String
+ * @default ""
+ */
+ cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
+
+ /**
+ * Whether or not a close button should be displayed for this CalendarGroup
+ * @config close
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
+
+ /**
+ * The minimum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config mindate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.delegateConfig } );
+
+ /**
+ * The maximum selectable date in the current Calendar (mm/dd/yyyy)
+ * @config maxdate
+ * @type String | Date
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * The weekday the week begins on. Default is 0 (Sunday).
+ * @config START_WEEKDAY
+ * @type number
+ * @default 0
+ */
+ cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * True if the Calendar should show weekday labels. True by default.
+ * @config SHOW_WEEKDAYS
+ * @type Boolean
+ * @default true
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row headers. False by default.
+ * @config SHOW_WEEK_HEADER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{ value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
+
+ /**
+ * True if the Calendar should show week row footers. False by default.
+ * @config SHOW_WEEK_FOOTER
+ * @type Boolean
+ * @default false
+ */
+ cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{ value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.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"]
+ */
+ cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.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"
+ */
+ cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.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 ","
+ */
+ cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.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 "/"
+ */
+ cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{ value:DEF_CFG.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 "-"
+ */
+ cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{ value:DEF_CFG.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
+ */
+ cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/year date string
+ * @config MY_YEAR_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day date string
+ * @config MD_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/year date string
+ * @config MD_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the month in a month/day/year date string
+ * @config MDY_MONTH_POSITION
+ * @type Number
+ * @default 1
+ */
+ cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the day in a month/day/year date string
+ * @config MDY_DAY_POSITION
+ * @type Number
+ * @default 2
+ */
+ cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The position of the year in a month/day/year date string
+ * @config MDY_YEAR_POSITION
+ * @type Number
+ * @default 3
+ */
+ cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator: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
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
+
+ /**
+ * The suffix used after the month when rendering the Calendar header
+ * @config MY_LABEL_MONTH_SUFFIX
+ * @type String
+ * @default " "
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.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 ""
+ */
+ cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
+
+ /**
+ * Configuration for the Month Year Navigation UI. By default it is disabled
+ * @config NAV
+ * @type Object
+ * @default null
+ */
+ cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
+
+ /**
+ * The map of UI strings which the CalendarGroup UI uses.
+ *
+ * @config strings
+ * @type {Object}
+ * @default An object with the properties shown below:
+ *
+ * previousMonth String : The string to use for the "Previous Month" navigation UI. Defaults to "Previous Month".
+ * nextMonth String : The string to use for the "Next Month" navigation UI. Defaults to "Next Month".
+ * close String : The string to use for the close button label. Defaults to "Close".
+ *
+ */
+ cfg.addProperty(DEF_CFG.STRINGS.key, {
+ value:DEF_CFG.STRINGS.value,
+ handler:this.configStrings,
+ validator: function(val) {
+ return Lang.isObject(val);
+ },
+ supercedes: DEF_CFG.STRINGS.supercedes
+ });
+ },
+
+ /**
+ * Initializes CalendarGroup's built-in CustomEvents
+ * @method initEvents
+ */
+ initEvents : function() {
+
+ var me = this,
+ strEvent = "Event",
+ CE = YAHOO.util.CustomEvent;
+
+ /**
+ * 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 0) {
+ caldate = new Date(firstPageDate);
+ this._setMonthOnDate(caldate, caldate.getMonth() + p);
+ childConfig.pageDate = caldate;
+ }
+
+ var cal = this.constructChild(calId, calContainerId, childConfig);
+
+ Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
+ Dom.addClass(cal.oDomContainer, groupCalClass);
+
+ if (p===0) {
+ firstPageDate = cal.cfg.getProperty(cfgPageDate);
+ Dom.addClass(cal.oDomContainer, firstClass);
+ }
+
+ if (p==(pageCount-1)) {
+ 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.
+ */
+ configPageDate : function(type, args, obj) {
+ var val = args[0],
+ firstPageDate;
+
+ var cfgPageDate = DEF_CFG.PAGEDATE.key;
+
+ for (var p=0;p 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.
+ */
+ delegateConfig : function(type, args, obj) {
+ var val = args[0];
+ var cal;
+
+ for (var p=0;p0) {
+ year+=1;
+ }
+ cal.setYear(year);
+ }
+ },
+
+ /**
+ * Calls the render function of all child calendars within the group.
+ * @method render
+ */
+ render : function() {
+ this.renderHeader();
+ for (var p=0;p
+ * If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.
+ * If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.
+ *
+ * @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.
+ */
+ selectCell : function(cellIndex) {
+ for (var p=0;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
+ */
+ nextYear : function() {
+ for (var p=0;p 11)) {
+ var newDate = DateMath.add(date, DateMath.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
+ */
+ _fixWidth : function() {
+ var w = 0;
+ for (var p=0;p 0) {
+ this.oDomContainer.style.width = w + "px";
+ }
+ },
+
+ /**
+ * Returns a string representation of the object.
+ * @method toString
+ * @return {String} A string representation of the CalendarGroup object.
+ */
+ toString : function() {
+ return "CalendarGroup " + this.id;
+ },
+
+ /**
+ * Destroys the CalendarGroup instance. The method will remove references
+ * to HTML elements, remove any event listeners added by the CalendarGroup.
+ *
+ * It will also destroy the Config and CalendarNavigator instances created by the
+ * CalendarGroup and the individual Calendar instances created for each page.
+ *
+ * @method destroy
+ */
+ destroy : function() {
+
+ if (this.beforeDestroyEvent.fire()) {
+
+ var cal = this;
+
+ // Child objects
+ if (cal.navigator) {
+ cal.navigator.destroy();
+ }
+
+ if (cal.cfg) {
+ cal.cfg.destroy();
+ }
+
+ // DOM event listeners
+ Event.purgeElement(cal.oDomContainer, true);
+
+ // Generated markup/DOM - Not removing the container DIV since we didn't create it.
+ Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_CONTAINER);
+ Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_MULTI_UP);
+
+ for (var i = 0, l = cal.pages.length; i < l; i++) {
+ cal.pages[i].destroy();
+ cal.pages[i] = null;
+ }
+
+ cal.oDomContainer.innerHTML = "";
+
+ // JS-to-DOM references
+ cal.oDomContainer = null;
+
+ this.destroyEvent.fire();
+ }
+ }
+};
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
+* @static
+* @final
+* @type String
+*/
+CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
+
+/**
+* CSS class representing the container for the calendar
+* @property YAHOO.widget.CalendarGroup.CSS_MULTI_UP
+* @static
+* @final
+* @type String
+*/
+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
+*/
+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 Style.CSS_CLOSE property now represents the CSS class used to render the close icon
+* @type String
+*/
+CalendarGroup.CSS_2UPCLOSE = "close-icon";
+
+YAHOO.lang.augmentProto(CalendarGroup, Calendar, "buildDayLabel",
+ "buildMonthLabel",
+ "renderOutOfBoundsDate",
+ "renderRowHeader",
+ "renderRowFooter",
+ "renderCellDefault",
+ "styleCellDefault",
+ "renderCellStyleHighlight1",
+ "renderCellStyleHighlight2",
+ "renderCellStyleHighlight3",
+ "renderCellStyleHighlight4",
+ "renderCellStyleToday",
+ "renderCellStyleSelected",
+ "renderCellNotThisMonth",
+ "renderBodyCellRestricted",
+ "initStyles",
+ "configTitle",
+ "configClose",
+ "configIframe",
+ "configStrings",
+ "configToday",
+ "configNavigator",
+ "createTitleBar",
+ "createCloseButton",
+ "removeTitleBar",
+ "removeCloseButton",
+ "hide",
+ "show",
+ "toDate",
+ "_toDate",
+ "_parseArgs",
+ "browser");
+
+YAHOO.widget.CalGrp = CalendarGroup;
+YAHOO.widget.CalendarGroup = 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, 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;
+
+})();
+/**
+ * The CalendarNavigator is used along with a Calendar/CalendarGroup to
+ * provide a Month/Year popup navigation control, allowing the user to navigate
+ * to a specific month/year in the Calendar/CalendarGroup without having to
+ * scroll through months sequentially
+ *
+ * @namespace YAHOO.widget
+ * @class CalendarNavigator
+ * @constructor
+ * @param {Calendar|CalendarGroup} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached.
+ */
+YAHOO.widget.CalendarNavigator = function(cal) {
+ this.init(cal);
+};
+
+(function() {
+ // Setup static properties (inside anon fn, so that we can use shortcuts)
+ var CN = YAHOO.widget.CalendarNavigator;
+
+ /**
+ * YAHOO.widget.CalendarNavigator.CLASSES contains constants
+ * for the class values applied to the CalendarNaviatgator's
+ * DOM elements
+ * @property YAHOO.widget.CalendarNavigator.CLASSES
+ * @type Object
+ * @static
+ */
+ CN.CLASSES = {
+ /**
+ * Class applied to the Calendar Navigator's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV
+ * @type String
+ * @static
+ */
+ NAV :"yui-cal-nav",
+ /**
+ * Class applied to the Calendar/CalendarGroup's bounding box to indicate
+ * the Navigator is currently visible
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV_VISIBLE
+ * @type String
+ * @static
+ */
+ NAV_VISIBLE: "yui-cal-nav-visible",
+ /**
+ * Class applied to the Navigator mask's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MASK
+ * @type String
+ * @static
+ */
+ MASK : "yui-cal-nav-mask",
+ /**
+ * Class applied to the year label/control bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR
+ * @type String
+ * @static
+ */
+ YEAR : "yui-cal-nav-y",
+ /**
+ * Class applied to the month label/control bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH
+ * @type String
+ * @static
+ */
+ MONTH : "yui-cal-nav-m",
+ /**
+ * Class applied to the submit/cancel button's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTONS
+ * @type String
+ * @static
+ */
+ BUTTONS : "yui-cal-nav-b",
+ /**
+ * Class applied to buttons wrapping element
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTON
+ * @type String
+ * @static
+ */
+ BUTTON : "yui-cal-nav-btn",
+ /**
+ * Class applied to the validation error area's bounding box
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.ERROR
+ * @type String
+ * @static
+ */
+ ERROR : "yui-cal-nav-e",
+ /**
+ * Class applied to the year input control
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR_CTRL
+ * @type String
+ * @static
+ */
+ YEAR_CTRL : "yui-cal-nav-yc",
+ /**
+ * Class applied to the month input control
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH_CTRL
+ * @type String
+ * @static
+ */
+ MONTH_CTRL : "yui-cal-nav-mc",
+ /**
+ * Class applied to controls with invalid data (e.g. a year input field with invalid an year)
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.INVALID
+ * @type String
+ * @static
+ */
+ INVALID : "yui-invalid",
+ /**
+ * Class applied to default controls
+ * @property YAHOO.widget.CalendarNavigator.CLASSES.DEFAULT
+ * @type String
+ * @static
+ */
+ DEFAULT : "yui-default"
+ };
+
+ /**
+ * Object literal containing the default configuration values for the CalendarNavigator
+ * The configuration object is expected to follow the format below, with the properties being
+ * case sensitive.
+ *
+ * strings
+ * Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
+ *
+ * month String : The string to use for the month label. Defaults to "Month".
+ * year String : The string to use for the year label. Defaults to "Year".
+ * submit String : The string to use for the submit button label. Defaults to "Okay".
+ * cancel String : The string to use for the cancel button label. Defaults to "Cancel".
+ * invalidYear String : The string to use for invalid year values. Defaults to "Year needs to be a number".
+ *
+ *
+ * monthFormat String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
+ * initialFocus String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
+ *
+ * @property DEFAULT_CONFIG
+ * @type Object
+ * @static
+ */
+ CN.DEFAULT_CONFIG = {
+ strings : {
+ month: "Month",
+ year: "Year",
+ submit: "Okay",
+ cancel: "Cancel",
+ invalidYear : "Year needs to be a number"
+ },
+ monthFormat: YAHOO.widget.Calendar.LONG,
+ initialFocus: "year"
+ };
+
+ /**
+ * Object literal containing the default configuration values for the CalendarNavigator
+ * @property _DEFAULT_CFG
+ * @protected
+ * @deprecated Made public. See the public DEFAULT_CONFIG property
+ * @type Object
+ * @static
+ */
+ CN._DEFAULT_CFG = CN.DEFAULT_CONFIG;
+
+
+ /**
+ * The suffix added to the Calendar/CalendarGroup's ID, to generate
+ * a unique ID for the Navigator and it's bounding box.
+ * @property YAHOO.widget.CalendarNavigator.ID_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.ID_SUFFIX = "_nav";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the month control.
+ * @property YAHOO.widget.CalendarNavigator.MONTH_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.MONTH_SUFFIX = "_month";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the year control.
+ * @property YAHOO.widget.CalendarNavigator.YEAR_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.YEAR_SUFFIX = "_year";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the error bounding box.
+ * @property YAHOO.widget.CalendarNavigator.ERROR_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.ERROR_SUFFIX = "_error";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the "Cancel" button.
+ * @property YAHOO.widget.CalendarNavigator.CANCEL_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.CANCEL_SUFFIX = "_cancel";
+ /**
+ * The suffix added to the Navigator's ID, to generate
+ * a unique ID for the "Submit" button.
+ * @property YAHOO.widget.CalendarNavigator.SUBMIT_SUFFIX
+ * @static
+ * @type String
+ * @final
+ */
+ CN.SUBMIT_SUFFIX = "_submit";
+
+ /**
+ * The number of digits to which the year input control is to be limited.
+ * @property YAHOO.widget.CalendarNavigator.YR_MAX_DIGITS
+ * @static
+ * @type Number
+ */
+ CN.YR_MAX_DIGITS = 4;
+
+ /**
+ * The amount by which to increment the current year value,
+ * when the arrow up/down key is pressed on the year control
+ * @property YAHOO.widget.CalendarNavigator.YR_MINOR_INC
+ * @static
+ * @type Number
+ */
+ CN.YR_MINOR_INC = 1;
+
+ /**
+ * The amount by which to increment the current year value,
+ * when the page up/down key is pressed on the year control
+ * @property YAHOO.widget.CalendarNavigator.YR_MAJOR_INC
+ * @static
+ * @type Number
+ */
+ CN.YR_MAJOR_INC = 10;
+
+ /**
+ * Artificial delay (in ms) between the time the Navigator is hidden
+ * and the Calendar/CalendarGroup state is updated. Allows the user
+ * the see the Calendar/CalendarGroup page changing. If set to 0
+ * the Calendar/CalendarGroup page will be updated instantly
+ * @property YAHOO.widget.CalendarNavigator.UPDATE_DELAY
+ * @static
+ * @type Number
+ */
+ CN.UPDATE_DELAY = 50;
+
+ /**
+ * Regular expression used to validate the year input
+ * @property YAHOO.widget.CalendarNavigator.YR_PATTERN
+ * @static
+ * @type RegExp
+ */
+ CN.YR_PATTERN = /^\d+$/;
+ /**
+ * Regular expression used to trim strings
+ * @property YAHOO.widget.CalendarNavigator.TRIM
+ * @static
+ * @type RegExp
+ */
+ CN.TRIM = /^\s*(.*?)\s*$/;
+})();
+
+YAHOO.widget.CalendarNavigator.prototype = {
+
+ /**
+ * The unique ID for this CalendarNavigator instance
+ * @property id
+ * @type String
+ */
+ id : null,
+
+ /**
+ * The Calendar/CalendarGroup instance to which the navigator belongs
+ * @property cal
+ * @type {Calendar|CalendarGroup}
+ */
+ cal : null,
+
+ /**
+ * Reference to the HTMLElement used to render the navigator's bounding box
+ * @property navEl
+ * @type HTMLElement
+ */
+ navEl : null,
+
+ /**
+ * Reference to the HTMLElement used to render the navigator's mask
+ * @property maskEl
+ * @type HTMLElement
+ */
+ maskEl : null,
+
+ /**
+ * Reference to the HTMLElement used to input the year
+ * @property yearEl
+ * @type HTMLElement
+ */
+ yearEl : null,
+
+ /**
+ * Reference to the HTMLElement used to input the month
+ * @property monthEl
+ * @type HTMLElement
+ */
+ monthEl : null,
+
+ /**
+ * Reference to the HTMLElement used to display validation errors
+ * @property errorEl
+ * @type HTMLElement
+ */
+ errorEl : null,
+
+ /**
+ * Reference to the HTMLElement used to update the Calendar/Calendar group
+ * with the month/year values
+ * @property submitEl
+ * @type HTMLElement
+ */
+ submitEl : null,
+
+ /**
+ * Reference to the HTMLElement used to hide the navigator without updating the
+ * Calendar/Calendar group
+ * @property cancelEl
+ * @type HTMLElement
+ */
+ cancelEl : null,
+
+ /**
+ * Reference to the first focusable control in the navigator (by default monthEl)
+ * @property firstCtrl
+ * @type HTMLElement
+ */
+ firstCtrl : null,
+
+ /**
+ * Reference to the last focusable control in the navigator (by default cancelEl)
+ * @property lastCtrl
+ * @type HTMLElement
+ */
+ lastCtrl : null,
+
+ /**
+ * The document containing the Calendar/Calendar group instance
+ * @protected
+ * @property _doc
+ * @type HTMLDocument
+ */
+ _doc : null,
+
+ /**
+ * Internal state property for the current year displayed in the navigator
+ * @protected
+ * @property _year
+ * @type Number
+ */
+ _year: null,
+
+ /**
+ * Internal state property for the current month index displayed in the navigator
+ * @protected
+ * @property _month
+ * @type Number
+ */
+ _month: 0,
+
+ /**
+ * Private internal state property which indicates whether or not the
+ * Navigator has been rendered.
+ * @private
+ * @property __rendered
+ * @type Boolean
+ */
+ __rendered: false,
+
+ /**
+ * Init lifecycle method called as part of construction
+ *
+ * @method init
+ * @param {Calendar} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached
+ */
+ init : function(cal) {
+ var calBox = cal.oDomContainer;
+
+ this.cal = cal;
+ this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
+ this._doc = calBox.ownerDocument;
+
+ /**
+ * Private flag, to identify IE Quirks
+ * @private
+ * @property __isIEQuirks
+ */
+ var ie = YAHOO.env.ua.ie;
+ this.__isIEQuirks = (ie && ((ie <= 6) || (this._doc.compatMode == "BackCompat")));
+ },
+
+ /**
+ * Displays the navigator and mask, updating the input controls to reflect the
+ * currently set month and year. The show method will invoke the render method
+ * if the navigator has not been renderered already, allowing for lazy rendering
+ * of the control.
+ *
+ * The show method will fire the Calendar/CalendarGroup's beforeShowNav and showNav events
+ *
+ * @method show
+ */
+ show : function() {
+ var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ if (this.cal.beforeShowNavEvent.fire()) {
+ if (!this.__rendered) {
+ this.render();
+ }
+ this.clearErrors();
+
+ this._updateMonthUI();
+ this._updateYearUI();
+ this._show(this.navEl, true);
+
+ this.setInitialFocus();
+ this.showMask();
+
+ YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+ this.cal.showNavEvent.fire();
+ }
+ },
+
+ /**
+ * Hides the navigator and mask
+ *
+ * The show method will fire the Calendar/CalendarGroup's beforeHideNav event and hideNav events
+ * @method hide
+ */
+ hide : function() {
+ var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ if (this.cal.beforeHideNavEvent.fire()) {
+ this._show(this.navEl, false);
+ this.hideMask();
+ YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+ this.cal.hideNavEvent.fire();
+ }
+ },
+
+
+ /**
+ * Displays the navigator's mask element
+ *
+ * @method showMask
+ */
+ showMask : function() {
+ this._show(this.maskEl, true);
+ if (this.__isIEQuirks) {
+ this._syncMask();
+ }
+ },
+
+ /**
+ * Hides the navigator's mask element
+ *
+ * @method hideMask
+ */
+ hideMask : function() {
+ this._show(this.maskEl, false);
+ },
+
+ /**
+ * Returns the current month set on the navigator
+ *
+ * Note: This may not be the month set in the UI, if
+ * the UI contains an invalid value.
+ *
+ * @method getMonth
+ * @return {Number} The Navigator's current month index
+ */
+ getMonth: function() {
+ return this._month;
+ },
+
+ /**
+ * Returns the current year set on the navigator
+ *
+ * Note: This may not be the year set in the UI, if
+ * the UI contains an invalid value.
+ *
+ * @method getYear
+ * @return {Number} The Navigator's current year value
+ */
+ getYear: function() {
+ return this._year;
+ },
+
+ /**
+ * Sets the current month on the Navigator, and updates the UI
+ *
+ * @method setMonth
+ * @param {Number} nMonth The month index, from 0 (Jan) through 11 (Dec).
+ */
+ setMonth : function(nMonth) {
+ if (nMonth >= 0 && nMonth < 12) {
+ this._month = nMonth;
+ }
+ this._updateMonthUI();
+ },
+
+ /**
+ * Sets the current year on the Navigator, and updates the UI. If the
+ * provided year is invalid, it will not be set.
+ *
+ * @method setYear
+ * @param {Number} nYear The full year value to set the Navigator to.
+ */
+ setYear : function(nYear) {
+ var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
+ if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
+ this._year = nYear;
+ }
+ this._updateYearUI();
+ },
+
+ /**
+ * Renders the HTML for the navigator, adding it to the
+ * document and attaches event listeners if it has not
+ * already been rendered.
+ *
+ * @method render
+ */
+ render: function() {
+ this.cal.beforeRenderNavEvent.fire();
+ if (!this.__rendered) {
+ this.createNav();
+ this.createMask();
+ this.applyListeners();
+ this.__rendered = true;
+ }
+ this.cal.renderNavEvent.fire();
+ },
+
+ /**
+ * Creates the navigator's containing HTMLElement, it's contents, and appends
+ * the containg element to the Calendar/CalendarGroup's container.
+ *
+ * @method createNav
+ */
+ createNav : function() {
+ var NAV = YAHOO.widget.CalendarNavigator;
+ var doc = this._doc;
+
+ var d = doc.createElement("div");
+ d.className = NAV.CLASSES.NAV;
+
+ var htmlBuf = this.renderNavContents([]);
+
+ d.innerHTML = htmlBuf.join('');
+ this.cal.oDomContainer.appendChild(d);
+
+ this.navEl = d;
+
+ this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
+ this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
+ this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
+ this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
+ this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
+
+ if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
+ // Avoid XUL error on focus, select [ https://bugzilla.mozilla.org/show_bug.cgi?id=236791,
+ // supposedly fixed in 1.8.1, but there are reports of it still being around for methods other than blur ]
+ this.yearEl.setAttribute("autocomplete", "off");
+ }
+
+ this._setFirstLastElements();
+ },
+
+ /**
+ * Creates the Mask HTMLElement and appends it to the Calendar/CalendarGroups
+ * container.
+ *
+ * @method createMask
+ */
+ createMask : function() {
+ var C = YAHOO.widget.CalendarNavigator.CLASSES;
+
+ var d = this._doc.createElement("div");
+ d.className = C.MASK;
+
+ this.cal.oDomContainer.appendChild(d);
+ this.maskEl = d;
+ },
+
+ /**
+ * Used to set the width/height of the mask in pixels to match the Calendar Container.
+ * Currently only used for IE6 or IE in quirks mode. The other A-Grade browser are handled using CSS (width/height 100%).
+ *
+ * The method is also registered as an HTMLElement resize listener on the Calendars container element.
+ *
+ * @protected
+ * @method _syncMask
+ */
+ _syncMask : function() {
+ var c = this.cal.oDomContainer;
+ if (c && this.maskEl) {
+ var r = YAHOO.util.Dom.getRegion(c);
+ YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
+ YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
+ }
+ },
+
+ /**
+ * Renders the contents of the navigator
+ *
+ * @method renderNavContents
+ *
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderNavContents : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES,
+ h = html; // just to use a shorter name
+
+ h[h.length] = '';
+ this.renderMonth(h);
+ h[h.length] = '
';
+ h[h.length] = '';
+ this.renderYear(h);
+ h[h.length] = '
';
+ h[h.length] = '';
+ this.renderButtons(h);
+ h[h.length] = '
';
+ h[h.length] = '
';
+
+ return h;
+ },
+
+ /**
+ * Renders the month label and control for the navigator
+ *
+ * @method renderNavContents
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderMonth : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES;
+
+ var id = this.id + NAV.MONTH_SUFFIX,
+ mf = this.__getCfg("monthFormat"),
+ months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),
+ h = html;
+
+ if (months && months.length > 0) {
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("month", true);
+ h[h.length] = ' ';
+ h[h.length] = '';
+ for (var i = 0; i < months.length; i++) {
+ h[h.length] = '';
+ h[h.length] = months[i];
+ h[h.length] = ' ';
+ }
+ h[h.length] = ' ';
+ }
+ return h;
+ },
+
+ /**
+ * Renders the year label and control for the navigator
+ *
+ * @method renderYear
+ * @param {Array} html The HTML buffer to append the HTML to.
+ * @return {Array} A reference to the buffer passed in.
+ */
+ renderYear : function(html) {
+ var NAV = YAHOO.widget.CalendarNavigator,
+ C = NAV.CLASSES;
+
+ var id = this.id + NAV.YEAR_SUFFIX,
+ size = NAV.YR_MAX_DIGITS,
+ h = html;
+
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("year", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+ return h;
+ },
+
+ /**
+ * Renders the submit/cancel buttons for the navigator
+ *
+ * @method renderButton
+ * @return {String} The HTML created for the Button UI
+ */
+ renderButtons : function(html) {
+ var C = YAHOO.widget.CalendarNavigator.CLASSES;
+ var h = html;
+
+ h[h.length] = '';
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("submit", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+ h[h.length] = '';
+ h[h.length] = '';
+ h[h.length] = this.__getCfg("cancel", true);
+ h[h.length] = ' ';
+ h[h.length] = ' ';
+
+ return h;
+ },
+
+ /**
+ * Attaches DOM event listeners to the rendered elements
+ *
+ * The method will call applyKeyListeners, to setup keyboard specific
+ * listeners
+ *
+ * @method applyListeners
+ */
+ applyListeners : function() {
+ var E = YAHOO.util.Event;
+
+ function yearUpdateHandler() {
+ if (this.validate()) {
+ this.setYear(this._getYearFromUI());
+ }
+ }
+
+ function monthUpdateHandler() {
+ this.setMonth(this._getMonthFromUI());
+ }
+
+ E.on(this.submitEl, "click", this.submit, this, true);
+ E.on(this.cancelEl, "click", this.cancel, this, true);
+ E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
+ E.on(this.monthEl, "change", monthUpdateHandler, this, true);
+
+ if (this.__isIEQuirks) {
+ YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
+ }
+
+ this.applyKeyListeners();
+ },
+
+ /**
+ * Removes/purges DOM event listeners from the rendered elements
+ *
+ * @method purgeListeners
+ */
+ purgeListeners : function() {
+ var E = YAHOO.util.Event;
+ E.removeListener(this.submitEl, "click", this.submit);
+ E.removeListener(this.cancelEl, "click", this.cancel);
+ E.removeListener(this.yearEl, "blur");
+ E.removeListener(this.monthEl, "change");
+ if (this.__isIEQuirks) {
+ E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
+ }
+
+ this.purgeKeyListeners();
+ },
+
+ /**
+ * Attaches DOM listeners for keyboard support.
+ * Tab/Shift-Tab looping, Enter Key Submit on Year element,
+ * Up/Down/PgUp/PgDown year increment on Year element
+ *
+ * NOTE: MacOSX Safari 2.x doesn't let you tab to buttons and
+ * MacOSX Gecko does not let you tab to buttons or select controls,
+ * so for these browsers, Tab/Shift-Tab looping is limited to the
+ * elements which can be reached using the tab key.
+ *
+ * @method applyKeyListeners
+ */
+ applyKeyListeners : function() {
+ var E = YAHOO.util.Event,
+ ua = YAHOO.env.ua;
+
+ // IE/Safari 3.1 doesn't fire keypress for arrow/pg keys (non-char keys)
+ var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
+
+ // - IE/Safari 3.1 doesn't fire keypress for non-char keys
+ // - Opera doesn't allow us to cancel keydown or keypress for tab, but
+ // changes focus successfully on keydown (keypress is too late to change focus - opera's already moved on).
+ var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
+
+ // Everyone likes keypress for Enter (char keys) - whoo hoo!
+ E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
+
+ E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
+ E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
+ E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
+ },
+
+ /**
+ * Removes/purges DOM listeners for keyboard support
+ *
+ * @method purgeKeyListeners
+ */
+ purgeKeyListeners : function() {
+ var E = YAHOO.util.Event,
+ ua = YAHOO.env.ua;
+
+ var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
+ var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
+
+ E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
+ E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
+ E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
+ E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
+ },
+
+ /**
+ * Updates the Calendar/CalendarGroup's pagedate with the currently set month and year if valid.
+ *
+ * If the currently set month/year is invalid, a validation error will be displayed and the
+ * Calendar/CalendarGroup's pagedate will not be updated.
+ *
+ * @method submit
+ */
+ submit : function() {
+ if (this.validate()) {
+ this.hide();
+
+ this.setMonth(this._getMonthFromUI());
+ this.setYear(this._getYearFromUI());
+
+ var cal = this.cal;
+
+ // Artificial delay, just to help the user see something changed
+ var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
+ if (delay > 0) {
+ var nav = this;
+ window.setTimeout(function(){ nav._update(cal); }, delay);
+ } else {
+ this._update(cal);
+ }
+ }
+ },
+
+ /**
+ * Updates the Calendar rendered state, based on the state of the CalendarNavigator
+ * @method _update
+ * @param cal The Calendar instance to update
+ * @protected
+ */
+ _update : function(cal) {
+ var date = YAHOO.widget.DateMath.getDate(this.getYear() - cal.cfg.getProperty("YEAR_OFFSET"), this.getMonth(), 1);
+ cal.cfg.setProperty("pagedate", date);
+ cal.render();
+ },
+
+ /**
+ * Hides the navigator and mask, without updating the Calendar/CalendarGroup's state
+ *
+ * @method cancel
+ */
+ cancel : function() {
+ this.hide();
+ },
+
+ /**
+ * Validates the current state of the UI controls
+ *
+ * @method validate
+ * @return {Boolean} true, if the current UI state contains valid values, false if not
+ */
+ validate : function() {
+ if (this._getYearFromUI() !== null) {
+ this.clearErrors();
+ return true;
+ } else {
+ this.setYearError();
+ this.setError(this.__getCfg("invalidYear", true));
+ return false;
+ }
+ },
+
+ /**
+ * Displays an error message in the Navigator's error panel
+ * @method setError
+ * @param {String} msg The error message to display
+ */
+ setError : function(msg) {
+ if (this.errorEl) {
+ this.errorEl.innerHTML = msg;
+ this._show(this.errorEl, true);
+ }
+ },
+
+ /**
+ * Clears the navigator's error message and hides the error panel
+ * @method clearError
+ */
+ clearError : function() {
+ if (this.errorEl) {
+ this.errorEl.innerHTML = "";
+ this._show(this.errorEl, false);
+ }
+ },
+
+ /**
+ * Displays the validation error UI for the year control
+ * @method setYearError
+ */
+ setYearError : function() {
+ YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+ },
+
+ /**
+ * Removes the validation error UI for the year control
+ * @method clearYearError
+ */
+ clearYearError : function() {
+ YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+ },
+
+ /**
+ * Clears all validation and error messages in the UI
+ * @method clearErrors
+ */
+ clearErrors : function() {
+ this.clearError();
+ this.clearYearError();
+ },
+
+ /**
+ * Sets the initial focus, based on the configured value
+ * @method setInitialFocus
+ */
+ setInitialFocus : function() {
+ var el = this.submitEl,
+ f = this.__getCfg("initialFocus");
+
+ if (f && f.toLowerCase) {
+ f = f.toLowerCase();
+ if (f == "year") {
+ el = this.yearEl;
+ try {
+ this.yearEl.select();
+ } catch (selErr) {
+ // Ignore;
+ }
+ } else if (f == "month") {
+ el = this.monthEl;
+ }
+ }
+
+ if (el && YAHOO.lang.isFunction(el.focus)) {
+ try {
+ el.focus();
+ } catch (focusErr) {
+ // TODO: Fall back if focus fails?
+ }
+ }
+ },
+
+ /**
+ * Removes all renderered HTML elements for the Navigator from
+ * the DOM, purges event listeners and clears (nulls) any property
+ * references to HTML references
+ * @method erase
+ */
+ erase : function() {
+ if (this.__rendered) {
+ this.purgeListeners();
+
+ // Clear out innerHTML references
+ this.yearEl = null;
+ this.monthEl = null;
+ this.errorEl = null;
+ this.submitEl = null;
+ this.cancelEl = null;
+ this.firstCtrl = null;
+ this.lastCtrl = null;
+ if (this.navEl) {
+ this.navEl.innerHTML = "";
+ }
+
+ var p = this.navEl.parentNode;
+ if (p) {
+ p.removeChild(this.navEl);
+ }
+ this.navEl = null;
+
+ var pm = this.maskEl.parentNode;
+ if (pm) {
+ pm.removeChild(this.maskEl);
+ }
+ this.maskEl = null;
+ this.__rendered = false;
+ }
+ },
+
+ /**
+ * Destroys the Navigator object and any HTML references
+ * @method destroy
+ */
+ destroy : function() {
+ this.erase();
+ this._doc = null;
+ this.cal = null;
+ this.id = null;
+ },
+
+ /**
+ * Protected implementation to handle how UI elements are
+ * hidden/shown.
+ *
+ * @method _show
+ * @protected
+ */
+ _show : function(el, bShow) {
+ if (el) {
+ YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block" : "none");
+ }
+ },
+
+ /**
+ * Returns the month value (index), from the month UI element
+ * @protected
+ * @method _getMonthFromUI
+ * @return {Number} The month index, or 0 if a UI element for the month
+ * is not found
+ */
+ _getMonthFromUI : function() {
+ if (this.monthEl) {
+ return this.monthEl.selectedIndex;
+ } else {
+ return 0; // Default to Jan
+ }
+ },
+
+ /**
+ * Returns the year value, from the Navitator's year UI element
+ * @protected
+ * @method _getYearFromUI
+ * @return {Number} The year value set in the UI, if valid. null is returned if
+ * the UI does not contain a valid year value.
+ */
+ _getYearFromUI : function() {
+ var NAV = YAHOO.widget.CalendarNavigator;
+
+ var yr = null;
+ if (this.yearEl) {
+ var value = this.yearEl.value;
+ value = value.replace(NAV.TRIM, "$1");
+
+ if (NAV.YR_PATTERN.test(value)) {
+ yr = parseInt(value, 10);
+ }
+ }
+ return yr;
+ },
+
+ /**
+ * Updates the Navigator's year UI, based on the year value set on the Navigator object
+ * @protected
+ * @method _updateYearUI
+ */
+ _updateYearUI : function() {
+ if (this.yearEl && this._year !== null) {
+ this.yearEl.value = this._year;
+ }
+ },
+
+ /**
+ * Updates the Navigator's month UI, based on the month value set on the Navigator object
+ * @protected
+ * @method _updateMonthUI
+ */
+ _updateMonthUI : function() {
+ if (this.monthEl) {
+ this.monthEl.selectedIndex = this._month;
+ }
+ },
+
+ /**
+ * Sets up references to the first and last focusable element in the Navigator's UI
+ * in terms of tab order (Naviagator's firstEl and lastEl properties). The references
+ * are used to control modality by looping around from the first to the last control
+ * and visa versa for tab/shift-tab navigation.
+ *
+ * See applyKeyListeners
+ *
+ * @protected
+ * @method _setFirstLastElements
+ */
+ _setFirstLastElements : function() {
+ this.firstCtrl = this.monthEl;
+ this.lastCtrl = this.cancelEl;
+
+ // Special handling for MacOSX.
+ // - Safari 2.x can't focus on buttons
+ // - Gecko can't focus on select boxes or buttons
+ if (this.__isMac) {
+ if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420){
+ this.firstCtrl = this.monthEl;
+ this.lastCtrl = this.yearEl;
+ }
+ if (YAHOO.env.ua.gecko) {
+ this.firstCtrl = this.yearEl;
+ this.lastCtrl = this.yearEl;
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Enter
+ * on the Navigator's year control (yearEl)
+ *
+ * @method _handleEnterKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleEnterKey : function(e) {
+ var KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
+ YAHOO.util.Event.preventDefault(e);
+ this.submit();
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture up/down/pgup/pgdown
+ * on the Navigator's year control (yearEl).
+ *
+ * @method _handleDirectionKeys
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleDirectionKeys : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY,
+ NAV = YAHOO.widget.CalendarNavigator;
+
+ var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
+ if (isFinite(value)) {
+ var dir = false;
+ switch(E.getCharCode(e)) {
+ case KEYS.UP:
+ this.yearEl.value = value + NAV.YR_MINOR_INC;
+ dir = true;
+ break;
+ case KEYS.DOWN:
+ this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
+ dir = true;
+ break;
+ case KEYS.PAGE_UP:
+ this.yearEl.value = value + NAV.YR_MAJOR_INC;
+ dir = true;
+ break;
+ case KEYS.PAGE_DOWN:
+ this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
+ dir = true;
+ break;
+ default:
+ break;
+ }
+ if (dir) {
+ E.preventDefault(e);
+ try {
+ this.yearEl.select();
+ } catch(err) {
+ // Ignore
+ }
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Tab
+ * on the last control (lastCtrl) in the Navigator.
+ *
+ * @method _handleTabKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleTabKey : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
+ try {
+ E.preventDefault(e);
+ this.firstCtrl.focus();
+ } catch (err) {
+ // Ignore - mainly for focus edge cases
+ }
+ }
+ },
+
+ /**
+ * Default Keyboard event handler to capture Shift-Tab
+ * on the first control (firstCtrl) in the Navigator.
+ *
+ * @method _handleShiftTabKey
+ * @protected
+ * @param {Event} e The DOM event being handled
+ */
+ _handleShiftTabKey : function(e) {
+ var E = YAHOO.util.Event,
+ KEYS = YAHOO.util.KeyListener.KEY;
+
+ if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
+ try {
+ E.preventDefault(e);
+ this.lastCtrl.focus();
+ } catch (err) {
+ // Ignore - mainly for focus edge cases
+ }
+ }
+ },
+
+ /**
+ * Retrieve Navigator configuration values from
+ * the parent Calendar/CalendarGroup's config value.
+ *
+ * If it has not been set in the user provided configuration, the method will
+ * return the default value of the configuration property, as set in DEFAULT_CONFIG
+ *
+ * @private
+ * @method __getCfg
+ * @param {String} Case sensitive property name.
+ * @param {Boolean} true, if the property is a string property, false if not.
+ * @return The value of the configuration property
+ */
+ __getCfg : function(prop, bIsStr) {
+ var DEF_CFG = YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;
+ var cfg = this.cal.cfg.getProperty("navigator");
+
+ if (bIsStr) {
+ return (cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
+ } else {
+ return (cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
+ }
+ },
+
+ /**
+ * Private flag, to identify MacOS
+ * @private
+ * @property __isMac
+ */
+ __isMac : (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)
+
+};
+YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/carousel/assets/ajax-loader.gif b/lib/yui/2.8.0r4/carousel/assets/ajax-loader.gif
new file mode 100644
index 0000000000..fe2cd23b3a
Binary files /dev/null and b/lib/yui/2.8.0r4/carousel/assets/ajax-loader.gif differ
diff --git a/lib/yui/2.8.0r4/carousel/assets/carousel-core.css b/lib/yui/2.8.0r4/carousel/assets/carousel-core.css
new file mode 100644
index 0000000000..444c21f5ac
--- /dev/null
+++ b/lib/yui/2.8.0r4/carousel/assets/carousel-core.css
@@ -0,0 +1,88 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-carousel {
+ visibility: hidden;
+ overflow: hidden;
+ position: relative;
+ text-align: left;
+ zoom: 1;
+}
+
+.yui-carousel.yui-carousel-visible {
+ visibility: visible;
+}
+
+.yui-carousel-content {
+ overflow: hidden;
+ position: relative;
+ text-align:center;
+}
+
+.yui-carousel-element li {
+ border: 1px solid #ccc;
+ list-style: none;
+ margin: 1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+ text-align: center;
+}
+
+.yui-carousel-vertical .yui-carousel-element li {
+ display: block;
+ float: none;
+}
+
+.yui-log .carousel {
+ background: #f2e886;
+}
+
+.yui-carousel-nav {
+ zoom: 1;
+}
+
+.yui-carousel-nav:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.yui-carousel-button-focus {
+ outline: 1px dotted #000;
+}
+
+.yui-carousel-min-width {
+ min-width: 115px;
+}
+
+.yui-carousel-element {
+ overflow: hidden;
+ position:relative;
+ margin: 0 auto;
+ padding:0;
+ text-align:left;
+ *margin:0;
+}
+
+.yui-carousel-horizontal .yui-carousel-element {
+ width: 320000px;
+}
+
+.yui-carousel-vertical .yui-carousel-element {
+ height:320000px;
+}
+
+.yui-skin-sam .yui-carousel-nav select {
+ position:static;
+}
+
+.yui-carousel .yui-carousel-item-selected {
+ border: 1px dashed #000;
+ margin: 1px;
+}
\ No newline at end of file
diff --git a/lib/yui/2.8.0r4/carousel/assets/skins/sam/ajax-loader.gif b/lib/yui/2.8.0r4/carousel/assets/skins/sam/ajax-loader.gif
new file mode 100644
index 0000000000..fe2cd23b3a
Binary files /dev/null and b/lib/yui/2.8.0r4/carousel/assets/skins/sam/ajax-loader.gif differ
diff --git a/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel-skin.css b/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel-skin.css
new file mode 100644
index 0000000000..efa48ebda9
--- /dev/null
+++ b/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel-skin.css
@@ -0,0 +1,142 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-skin-sam .yui-carousel,
+.yui-skin-sam .yui-carousel-vertical {
+ border: 1px solid #808080;
+}
+
+.yui-skin-sam .yui-carousel-nav {
+ background: url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;
+ padding: 3px;
+ text-align: right;
+}
+
+.yui-skin-sam .yui-carousel-button {
+ background: url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -600px;
+ float: right;
+ height: 19px;
+ margin: 5px;
+ overflow: hidden;
+ width: 40px;
+}
+
+.yui-skin-sam .yui-carousel-vertical .yui-carousel-button {
+ background-position: 0 -800px;
+}
+
+.yui-skin-sam .yui-carousel-button-disabled {
+ background-position: 0 -2000px;
+}
+
+.yui-skin-sam .yui-carousel-vertical .yui-carousel-button-disabled {
+ background-position: 0 -2100px;
+}
+
+.yui-skin-sam .yui-carousel-button input,
+.yui-skin-sam .yui-carousel-button button {
+ background-color: transparent;
+ border: 0;
+ cursor: pointer;
+ display: block;
+ height: 44px;
+ margin: -2px 0 0 -2px;
+ padding: 0 0 0 50px;
+}
+
+.yui-skin-sam span.yui-carousel-first-button {
+ background-position: 0px -550px;
+ margin-left: -100px;
+ margin-right: 50px;
+ *margin: 5px 5px 5px -90px;
+}
+
+.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button {
+ background-position: 0px -750px;
+}
+
+.yui-skin-sam span.yui-carousel-first-button-disabled {
+ background-position: 0 -1950px;
+}
+
+.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button-disabled {
+ background-position: 0 -2050px;
+}
+
+.yui-skin-sam .yui-carousel-nav ul {
+ float: right;
+ height: 19px;
+ margin: 0;
+ margin-left: -220px;
+ margin-right: 100px;
+ *margin-left: -160px;
+ *margin-right: 0;
+ padding: 0;
+}
+
+.yui-skin-sam .yui-carousel-min-width .yui-carousel-nav ul {
+ *margin-left: -170px;
+}
+
+.yui-skin-sam .yui-carousel-nav select {
+ position: relative;
+ *right: 50px;
+ top: 4px;
+}
+
+.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select {
+ position: static;
+}
+
+.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav ul,
+.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select {
+ float: none;
+ margin: 0;
+ *zoom: 1;
+}
+
+.yui-skin-sam .yui-carousel-nav ul li {
+ background: url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -650px;
+ cursor: pointer;
+ float: left;
+ height: 9px;
+ list-style: none;
+ margin: 10px 0 0 5px;
+ overflow: hidden;
+ padding: 0;
+ width: 9px;
+}
+
+.yui-skin-sam .yui-carousel-nav ul:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.yui-skin-sam .yui-carousel-nav ul li a {
+ display:block;
+ width: 100%;
+ height: 100%;
+ text-indent: -10000px;
+ text-align:left;
+ overflow:hidden;
+}
+
+.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-focus {
+ outline: 1px dotted #000;
+}
+
+.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-selected {
+ background-position: 0 -700px;
+}
+
+.yui-skin-sam .yui-carousel-item-loading {
+ background: url(ajax-loader.gif) no-repeat 50% 50%;
+ position: absolute;
+ text-indent: -150px;
+}
diff --git a/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel.css b/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel.css
new file mode 100644
index 0000000000..8dbb121307
--- /dev/null
+++ b/lib/yui/2.8.0r4/carousel/assets/skins/sam/carousel.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+.yui-carousel{visibility:hidden;overflow:hidden;position:relative;text-align:left;zoom:1;}.yui-carousel.yui-carousel-visible{visibility:visible;}.yui-carousel-content{overflow:hidden;position:relative;text-align:center;}.yui-carousel-element li{border:1px solid #ccc;list-style:none;margin:1px;overflow:hidden;padding:0;position:absolute;text-align:center;}.yui-carousel-vertical .yui-carousel-element li{display:block;float:none;}.yui-log .carousel{background:#f2e886;}.yui-carousel-nav{zoom:1;}.yui-carousel-nav:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-carousel-button-focus{outline:1px dotted #000;}.yui-carousel-min-width{min-width:115px;}.yui-carousel-element{overflow:hidden;position:relative;margin:0 auto;padding:0;text-align:left;*margin:0;}.yui-carousel-horizontal .yui-carousel-element{width:320000px;}.yui-carousel-vertical .yui-carousel-element{height:320000px;}.yui-skin-sam .yui-carousel-nav select{position:static;}.yui-carousel .yui-carousel-item-selected{border:1px dashed #000;margin:1px;}.yui-skin-sam .yui-carousel,.yui-skin-sam .yui-carousel-vertical{border:1px solid #808080;}.yui-skin-sam .yui-carousel-nav{background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;padding:3px;text-align:right;}.yui-skin-sam .yui-carousel-button{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -600px;float:right;height:19px;margin:5px;overflow:hidden;width:40px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button{background-position:0 -800px;}.yui-skin-sam .yui-carousel-button-disabled{background-position:0 -2000px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-button-disabled{background-position:0 -2100px;}.yui-skin-sam .yui-carousel-button input,.yui-skin-sam .yui-carousel-button button{background-color:transparent;border:0;cursor:pointer;display:block;height:44px;margin:-2px 0 0 -2px;padding:0 0 0 50px;}.yui-skin-sam span.yui-carousel-first-button{background-position:0 -550px;margin-left:-100px;margin-right:50px;*margin:5px 5px 5px -90px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button{background-position:0 -750px;}.yui-skin-sam span.yui-carousel-first-button-disabled{background-position:0 -1950px;}.yui-skin-sam .yui-carousel-vertical span.yui-carousel-first-button-disabled{background-position:0 -2050px;}.yui-skin-sam .yui-carousel-nav ul{float:right;height:19px;margin:0;margin-left:-220px;margin-right:100px;*margin-left:-160px;*margin-right:0;padding:0;}.yui-skin-sam .yui-carousel-min-width .yui-carousel-nav ul{*margin-left:-170px;}.yui-skin-sam .yui-carousel-nav select{position:relative;*right:50px;top:4px;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{position:static;}.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav ul,.yui-skin-sam .yui-carousel-vertical .yui-carousel-nav select{float:none;margin:0;*zoom:1;}.yui-skin-sam .yui-carousel-nav ul li{background:url(../../../../assets/skins/sam/sprite.png) no-repeat 0 -650px;cursor:pointer;float:left;height:9px;list-style:none;margin:10px 0 0 5px;overflow:hidden;padding:0;width:9px;}.yui-skin-sam .yui-carousel-nav ul:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.yui-skin-sam .yui-carousel-nav ul li a{display:block;width:100%;height:100%;text-indent:-10000px;text-align:left;overflow:hidden;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-focus{outline:1px dotted #000;}.yui-skin-sam .yui-carousel-nav ul li.yui-carousel-nav-page-selected{background-position:0 -700px;}.yui-skin-sam .yui-carousel-item-loading{background:url(ajax-loader.gif) no-repeat 50% 50%;position:absolute;text-indent:-150px;}
diff --git a/lib/yui/2.8.0r4/carousel/carousel-debug.js b/lib/yui/2.8.0r4/carousel/carousel-debug.js
new file mode 100644
index 0000000000..63dcba8347
--- /dev/null
+++ b/lib/yui/2.8.0r4/carousel/carousel-debug.js
@@ -0,0 +1,4390 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+/**
+ * The Carousel module provides a widget for browsing among a set of like
+ * objects represented pictorially.
+ *
+ * @module carousel
+ * @requires yahoo, dom, event, element
+ * @optional animation
+ * @namespace YAHOO.widget
+ * @title Carousel Widget
+ * @beta
+ */
+(function () {
+
+ var WidgetName; // forward declaration
+
+ /**
+ * The Carousel widget.
+ *
+ * @class Carousel
+ * @extends YAHOO.util.Element
+ * @constructor
+ * @param el {HTMLElement | String} The HTML element that represents the
+ * the container that houses the Carousel.
+ * @param cfg {Object} (optional) The configuration values
+ */
+ YAHOO.widget.Carousel = function (el, cfg) {
+ YAHOO.log("Component creation", WidgetName);
+
+ YAHOO.widget.Carousel.superclass.constructor.call(this, el, cfg);
+ };
+
+ /*
+ * Private variables of the Carousel component
+ */
+
+ /* Some abbreviations to avoid lengthy typing and lookups. */
+ var Carousel = YAHOO.widget.Carousel,
+ Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event,
+ JS = YAHOO.lang;
+
+ /**
+ * The widget name.
+ * @private
+ * @static
+ */
+ WidgetName = "Carousel";
+
+ /**
+ * The internal table of Carousel instances.
+ * @private
+ * @static
+ */
+ var instances = {},
+
+ /*
+ * Custom events of the Carousel component
+ */
+
+ /**
+ * @event afterScroll
+ * @description Fires when the Carousel has scrolled to the previous or
+ * next page. Passes back the index of the first and last visible items in
+ * the Carousel. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ afterScrollEvent = "afterScroll",
+
+ /**
+ * @event allItemsRemovedEvent
+ * @description Fires when all items have been removed from the Carousel.
+ * See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ allItemsRemovedEvent = "allItemsRemoved",
+
+ /**
+ * @event beforeHide
+ * @description Fires before the Carousel is hidden. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ beforeHideEvent = "beforeHide",
+
+ /**
+ * @event beforePageChange
+ * @description Fires when the Carousel is about to scroll to the previous
+ * or next page. Passes back the page number of the current page. Note
+ * that the first page number is zero. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ beforePageChangeEvent = "beforePageChange",
+
+ /**
+ * @event beforeScroll
+ * @description Fires when the Carousel is about to scroll to the previous
+ * or next page. Passes back the index of the first and last visible items
+ * in the Carousel and the direction (backward/forward) of the scroll. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ beforeScrollEvent = "beforeScroll",
+
+ /**
+ * @event beforeShow
+ * @description Fires when the Carousel is about to be shown. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ beforeShowEvent = "beforeShow",
+
+ /**
+ * @event blur
+ * @description Fires when the Carousel loses focus. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ blurEvent = "blur",
+
+ /**
+ * @event focus
+ * @description Fires when the Carousel gains focus. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ focusEvent = "focus",
+
+ /**
+ * @event hide
+ * @description Fires when the Carousel is hidden. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ hideEvent = "hide",
+
+ /**
+ * @event itemAdded
+ * @description Fires when an item has been added to the Carousel. Passes
+ * back the content of the item that would be added, the index at which the
+ * item would be added, and the event itself. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ itemAddedEvent = "itemAdded",
+
+ /**
+ * @event itemRemoved
+ * @description Fires when an item has been removed from the Carousel.
+ * Passes back the content of the item that would be removed, the index
+ * from which the item would be removed, and the event itself. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ itemRemovedEvent = "itemRemoved",
+
+ /**
+ * @event itemReplaced
+ * @description Fires when an item has been replaced in the Carousel.
+ * Passes back the content of the item that was replaced, the content
+ * of the new item, the index where the replacement occurred, and the event
+ * itself. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ itemReplacedEvent = "itemReplaced",
+
+ /**
+ * @event itemSelected
+ * @description Fires when an item has been selected in the Carousel.
+ * Passes back the index of the selected item in the Carousel. Note, that
+ * the index begins from zero. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ itemSelectedEvent = "itemSelected",
+
+ /**
+ * @event loadItems
+ * @description Fires when the Carousel needs more items to be loaded for
+ * displaying them. Passes back the first and last visible items in the
+ * Carousel, and the number of items needed to be loaded. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ loadItemsEvent = "loadItems",
+
+ /**
+ * @event navigationStateChange
+ * @description Fires when the state of either one of the navigation
+ * buttons are changed from enabled to disabled or vice versa. Passes back
+ * the state (true/false) of the previous and next buttons. The value true
+ * signifies the button is enabled, false signifies disabled. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ navigationStateChangeEvent = "navigationStateChange",
+
+ /**
+ * @event pageChange
+ * @description Fires after the Carousel has scrolled to the previous or
+ * next page. Passes back the page number of the current page. Note
+ * that the first page number is zero. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ pageChangeEvent = "pageChange",
+
+ /*
+ * Internal event.
+ * @event render
+ * @description Fires when the Carousel is rendered. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ renderEvent = "render",
+
+ /**
+ * @event show
+ * @description Fires when the Carousel is shown. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ showEvent = "show",
+
+ /**
+ * @event startAutoPlay
+ * @description Fires when the auto play has started in the Carousel. See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ startAutoPlayEvent = "startAutoPlay",
+
+ /**
+ * @event stopAutoPlay
+ * @description Fires when the auto play has been stopped in the Carousel.
+ * See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ stopAutoPlayEvent = "stopAutoPlay",
+
+ /*
+ * Internal event.
+ * @event uiUpdateEvent
+ * @description Fires when the UI has been updated.
+ * See
+ * Element.addListener
+ * for more information on listening for this event.
+ * @type YAHOO.util.CustomEvent
+ */
+ uiUpdateEvent = "uiUpdate";
+
+ /*
+ * Private helper functions used by the Carousel component
+ */
+
+ /**
+ * Set multiple styles on one element.
+ * @method setStyles
+ * @param el {HTMLElement} The element to set styles on
+ * @param style {Object} top:"10px", left:"0px", etc.
+ * @private
+ */
+ function setStyles(el, styles) {
+ var which;
+
+ for (which in styles) {
+ if (styles.hasOwnProperty(which)) {
+ Dom.setStyle(el, which, styles[which]);
+ }
+ }
+ }
+
+ /**
+ * Create an element, set its class name and optionally install the element
+ * to its parent.
+ * @method createElement
+ * @param el {String} The element to be created
+ * @param attrs {Object} Configuration of parent, class and id attributes.
+ * If the content is specified, it is inserted after creation of the
+ * element. The content can also be an HTML element in which case it would
+ * be appended as a child node of the created element.
+ * @private
+ */
+ function createElement(el, attrs) {
+ var newEl = document.createElement(el);
+
+ attrs = attrs || {};
+ if (attrs.className) {
+ Dom.addClass(newEl, attrs.className);
+ }
+
+ if (attrs.styles) {
+ setStyles(newEl, attrs.styles);
+ }
+
+ if (attrs.parent) {
+ attrs.parent.appendChild(newEl);
+ }
+
+ if (attrs.id) {
+ newEl.setAttribute("id", attrs.id);
+ }
+
+ if (attrs.content) {
+ if (attrs.content.nodeName) {
+ newEl.appendChild(attrs.content);
+ } else {
+ newEl.innerHTML = attrs.content;
+ }
+ }
+
+ return newEl;
+ }
+
+ /**
+ * Get the computed style of an element.
+ *
+ * @method getStyle
+ * @param el {HTMLElement} The element for which the style needs to be
+ * returned.
+ * @param style {String} The style attribute
+ * @param type {String} "int", "float", etc. (defaults to int)
+ * @private
+ */
+ function getStyle(el, style, type) {
+ var value;
+
+ if (!el) {
+ return 0;
+ }
+
+ function getStyleIntVal(el, style) {
+ var val;
+
+ /*
+ * XXX: Safari calculates incorrect marginRight for an element
+ * which has its parent element style set to overflow: hidden
+ * https://bugs.webkit.org/show_bug.cgi?id=13343
+ * Let us assume marginLeft == marginRight
+ */
+ if (style == "marginRight" && YAHOO.env.ua.webkit) {
+ val = parseInt(Dom.getStyle(el, "marginLeft"), 10);
+ } else {
+ val = parseInt(Dom.getStyle(el, style), 10);
+ }
+
+ return JS.isNumber(val) ? val : 0;
+ }
+
+ function getStyleFloatVal(el, style) {
+ var val;
+
+ /*
+ * XXX: Safari calculates incorrect marginRight for an element
+ * which has its parent element style set to overflow: hidden
+ * https://bugs.webkit.org/show_bug.cgi?id=13343
+ * Let us assume marginLeft == marginRight
+ */
+ if (style == "marginRight" && YAHOO.env.ua.webkit) {
+ val = parseFloat(Dom.getStyle(el, "marginLeft"));
+ } else {
+ val = parseFloat(Dom.getStyle(el, style));
+ }
+
+ return JS.isNumber(val) ? val : 0;
+ }
+
+ if (typeof type == "undefined") {
+ type = "int";
+ }
+
+ switch (style) {
+ case "height":
+ value = el.offsetHeight;
+ if (value > 0) {
+ value += getStyleIntVal(el, "marginTop") +
+ getStyleIntVal(el, "marginBottom");
+ } else {
+ value = getStyleFloatVal(el, "height") +
+ getStyleIntVal(el, "marginTop") +
+ getStyleIntVal(el, "marginBottom") +
+ getStyleIntVal(el, "borderTopWidth") +
+ getStyleIntVal(el, "borderBottomWidth") +
+ getStyleIntVal(el, "paddingTop") +
+ getStyleIntVal(el, "paddingBottom");
+ }
+ break;
+ case "width":
+ value = el.offsetWidth;
+ if (value > 0) {
+ value += getStyleIntVal(el, "marginLeft") +
+ getStyleIntVal(el, "marginRight");
+ } else {
+ value = getStyleFloatVal(el, "width") +
+ getStyleIntVal(el, "marginLeft") +
+ getStyleIntVal(el, "marginRight") +
+ getStyleIntVal(el, "borderLeftWidth") +
+ getStyleIntVal(el, "borderRightWidth") +
+ getStyleIntVal(el, "paddingLeft") +
+ getStyleIntVal(el, "paddingRight");
+ }
+ break;
+ default:
+ if (type == "int") {
+ value = getStyleIntVal(el, style);
+ } else if (type == "float") {
+ value = getStyleFloatVal(el, style);
+ } else {
+ value = Dom.getStyle(el, style);
+ }
+ break;
+ }
+
+ return value;
+ }
+
+ /**
+ * Compute and return the height or width of a single Carousel item
+ * depending upon the orientation.
+ *
+ * @method getCarouselItemSize
+ * @param which {String} "height" or "width" to be returned. If this is
+ * passed explicitly, the calculated size is not cached.
+ * @private
+ */
+ function getCarouselItemSize(which) {
+ var carousel = this,
+ child,
+ item,
+ size = 0,
+ first = carousel.get("firstVisible"),
+ vertical = false;
+
+ if (carousel._itemsTable.numItems === 0) {
+ return 0;
+ }
+
+ item = carousel._itemsTable.items[first] ||
+ carousel._itemsTable.loading[first];
+
+ if (JS.isUndefined(item)) {
+ return 0;
+ }
+
+ child = Dom.get(item.id);
+
+ if (typeof which == "undefined") {
+ vertical = carousel.get("isVertical");
+ } else {
+ vertical = which == "height";
+ }
+
+ if (this._itemAttrCache[which]) {
+ return this._itemAttrCache[which];
+ }
+
+ if (vertical) {
+ size = getStyle(child, "height");
+ } else {
+ size = getStyle(child, "width");
+ }
+
+ this._itemAttrCache[which] = size;
+
+ return size;
+ }
+
+ /**
+ * Return the size of a part of the item (reveal).
+ *
+ * @method getRevealSize
+ * @private
+ */
+ function getRevealSize() {
+ var carousel = this, isVertical, sz;
+
+ isVertical = carousel.get("isVertical");
+ sz = getCarouselItemSize.call(carousel,
+ isVertical ? "height" : "width");
+ return (sz * carousel.get("revealAmount") / 100);
+ }
+
+ /**
+ * Compute and return the position of a Carousel item based on its
+ * position.
+ *
+ * @method getCarouselItemPosition
+ * @param position {Number} The position of the Carousel item.
+ * @private
+ */
+ function getCarouselItemPosition(pos) {
+ var carousel = this,
+ itemsPerRow = carousel._cols,
+ itemsPerCol = carousel._rows,
+ page,
+ sz,
+ isVertical,
+ itemsCol,
+ itemsRow,
+ sentinel,
+ delta = 0,
+ top,
+ left,
+ rsz,
+ styles = {},
+ index = 0,
+ itemsTable = carousel._itemsTable,
+ items = itemsTable.items,
+ loading = itemsTable.loading;
+
+ isVertical = carousel.get("isVertical");
+ sz = getCarouselItemSize.call(carousel,
+ isVertical ? "height" : "width");
+ rsz = getRevealSize.call(carousel);
+
+ // adjust for items not yet loaded
+ while (index < pos) {
+ if (!items[index] && !loading[index]) {
+ delta++;
+ }
+ index++;
+ }
+ pos -= delta;
+
+ if (itemsPerCol) {
+ page = this.getPageForItem(pos);
+ if (isVertical) {
+ itemsRow = Math.floor(pos/itemsPerRow);
+ delta = itemsRow;
+ top = delta * sz;
+ styles.top = (top + rsz) + "px";
+
+ sz = getCarouselItemSize.call(carousel, "width");
+
+ itemsCol = pos % itemsPerRow;
+ delta = itemsCol;
+ left = delta * sz;
+ styles.left = left + "px";
+ } else {
+ itemsCol = pos % itemsPerRow;
+ sentinel = (page - 1) * itemsPerRow;
+ delta = itemsCol + sentinel;
+ left = delta * sz;
+ styles.left = (left + rsz) + "px";
+
+ sz = getCarouselItemSize.call(carousel, "height");
+
+ itemsRow = Math.floor(pos/itemsPerRow);
+ sentinel = (page - 1) * itemsPerCol;
+ delta = itemsRow - sentinel;
+ top = delta * sz;
+
+ styles.top = top + "px";
+ }
+ } else {
+ if (isVertical) {
+ styles.left = 0;
+ styles.top = ((pos * sz) + rsz) + "px";
+ } else {
+ styles.top = 0;
+ styles.left = ((pos * sz) + rsz) + "px";
+ }
+ }
+
+ return styles;
+ }
+
+ /**
+ * Return the index of the first item in the view port for displaying item
+ * in "pos".
+ *
+ * @method getFirstVisibleForPosition
+ * @param pos {Number} The position of the item to be displayed
+ * @private
+ */
+ function getFirstVisibleForPosition(pos) {
+ var num = this.get("numVisible");
+ return Math.floor(pos / num) * num;
+ }
+
+ /**
+ * Return the scrolling offset size given the number of elements to
+ * scroll.
+ *
+ * @method getScrollOffset
+ * @param delta {Number} The delta number of elements to scroll by.
+ * @private
+ */
+ function getScrollOffset(delta) {
+ var itemSize = 0,
+ size = 0;
+
+ itemSize = getCarouselItemSize.call(this);
+ size = itemSize * delta;
+
+ return size;
+ }
+
+ /**
+ * Scroll the Carousel by a page backward.
+ *
+ * @method scrollPageBackward
+ * @param {Event} ev The event object
+ * @param {Object} obj The context object
+ * @private
+ */
+ function scrollPageBackward(ev, obj) {
+ obj.scrollPageBackward();
+ Event.preventDefault(ev);
+ }
+
+ /**
+ * Scroll the Carousel by a page forward.
+ *
+ * @method scrollPageForward
+ * @param {Event} ev The event object
+ * @param {Object} obj The context object
+ * @private
+ */
+ function scrollPageForward(ev, obj) {
+ obj.scrollPageForward();
+ Event.preventDefault(ev);
+ }
+
+ /**
+ * Set the selected item.
+ *
+ * @method setItemSelection
+ * @param {Number} newpos The index of the new position
+ * @param {Number} oldpos The index of the previous position
+ * @private
+ */
+ function setItemSelection(newpos, oldpos) {
+ var carousel = this,
+ cssClass = carousel.CLASSES,
+ el,
+ firstItem = carousel._firstItem,
+ isCircular = carousel.get("isCircular"),
+ numItems = carousel.get("numItems"),
+ numVisible = carousel.get("numVisible"),
+ position = oldpos,
+ sentinel = firstItem + numVisible - 1;
+
+ if (position >= 0 && position < numItems) {
+ if (!JS.isUndefined(carousel._itemsTable.items[position])) {
+ el = Dom.get(carousel._itemsTable.items[position].id);
+ if (el) {
+ Dom.removeClass(el, cssClass.SELECTED_ITEM);
+ }
+ }
+ }
+
+ if (JS.isNumber(newpos)) {
+ newpos = parseInt(newpos, 10);
+ newpos = JS.isNumber(newpos) ? newpos : 0;
+ } else {
+ newpos = firstItem;
+ }
+
+ if (JS.isUndefined(carousel._itemsTable.items[newpos])) {
+ newpos = getFirstVisibleForPosition.call(carousel, newpos);
+ carousel.scrollTo(newpos); // still loading the item
+ }
+
+ if (!JS.isUndefined(carousel._itemsTable.items[newpos])) {
+ el = Dom.get(carousel._itemsTable.items[newpos].id);
+ if (el) {
+ Dom.addClass(el, cssClass.SELECTED_ITEM);
+ }
+ }
+
+ if (newpos < firstItem || newpos > sentinel) { // out of focus
+ newpos = getFirstVisibleForPosition.call(carousel, newpos);
+ carousel.scrollTo(newpos);
+ }
+ }
+
+ /**
+ * Fire custom events for enabling/disabling navigation elements.
+ *
+ * @method syncNavigation
+ * @private
+ */
+ function syncNavigation() {
+ var attach = false,
+ carousel = this,
+ cssClass = carousel.CLASSES,
+ i,
+ navigation,
+ sentinel;
+
+ // Don't do anything if the Carousel is not rendered
+ if (!carousel._hasRendered) {
+ return;
+ }
+
+ navigation = carousel.get("navigation");
+ sentinel = carousel._firstItem + carousel.get("numVisible");
+
+ if (navigation.prev) {
+ if (carousel.get("numItems") === 0 || carousel._firstItem === 0) {
+ if (carousel.get("numItems") === 0 ||
+ !carousel.get("isCircular")) {
+ Event.removeListener(navigation.prev, "click",
+ scrollPageBackward);
+ Dom.addClass(navigation.prev, cssClass.FIRST_NAV_DISABLED);
+ for (i = 0; i < carousel._navBtns.prev.length; i++) {
+ carousel._navBtns.prev[i].setAttribute("disabled",
+ "true");
+ }
+ carousel._prevEnabled = false;
+ } else {
+ attach = !carousel._prevEnabled;
+ }
+ } else {
+ attach = !carousel._prevEnabled;
+ }
+
+ if (attach) {
+ Event.on(navigation.prev, "click", scrollPageBackward,
+ carousel);
+ Dom.removeClass(navigation.prev, cssClass.FIRST_NAV_DISABLED);
+ for (i = 0; i < carousel._navBtns.prev.length; i++) {
+ carousel._navBtns.prev[i].removeAttribute("disabled");
+ }
+ carousel._prevEnabled = true;
+ }
+ }
+
+ attach = false;
+ if (navigation.next) {
+ if (sentinel >= carousel.get("numItems")) {
+ if (!carousel.get("isCircular")) {
+ Event.removeListener(navigation.next, "click",
+ scrollPageForward);
+ Dom.addClass(navigation.next, cssClass.DISABLED);
+ for (i = 0; i < carousel._navBtns.next.length; i++) {
+ carousel._navBtns.next[i].setAttribute("disabled",
+ "true");
+ }
+ carousel._nextEnabled = false;
+ } else {
+ attach = !carousel._nextEnabled;
+ }
+ } else {
+ attach = !carousel._nextEnabled;
+ }
+
+ if (attach) {
+ Event.on(navigation.next, "click", scrollPageForward,
+ carousel);
+ Dom.removeClass(navigation.next, cssClass.DISABLED);
+ for (i = 0; i < carousel._navBtns.next.length; i++) {
+ carousel._navBtns.next[i].removeAttribute("disabled");
+ }
+ carousel._nextEnabled = true;
+ }
+ }
+
+ carousel.fireEvent(navigationStateChangeEvent,
+ { next: carousel._nextEnabled, prev: carousel._prevEnabled });
+ }
+
+ /**
+ * Synchronize and redraw the Pager UI if necessary.
+ *
+ * @method syncPagerUi
+ * @private
+ */
+ function syncPagerUi(page) {
+ var carousel = this, numPages, numVisible;
+
+ // Don't do anything if the Carousel is not rendered
+ if (!carousel._hasRendered) {
+ return;
+ }
+
+ numVisible = carousel.get("numVisible");
+
+ if (!JS.isNumber(page)) {
+ page = Math.floor(carousel.get("selectedItem") / numVisible);
+ }
+
+ numPages = Math.ceil(carousel.get("numItems") / numVisible);
+
+ carousel._pages.num = numPages;
+ carousel._pages.cur = page;
+
+ if (numPages > carousel.CONFIG.MAX_PAGER_BUTTONS) {
+ carousel._updatePagerMenu();
+ } else {
+ carousel._updatePagerButtons();
+ }
+ }
+
+ /**
+ * Get full dimensions of an element.
+ *
+ * @method getDimensions
+ * @param {Object} el The element to get the dimensions of
+ * @param {String} which Get the height or width of an element
+ * @private
+ */
+ function getDimensions(el, which) {
+ switch (which) {
+ case 'height':
+ return getStyle(el, "marginTop") +
+ getStyle(el, "marginBottom") +
+ getStyle(el, "paddingTop") +
+ getStyle(el, "paddingBottom") +
+ getStyle(el, "borderTopWidth") +
+ getStyle(el, "borderBottomWidth");
+ case 'width':
+ return getStyle(el, "marginLeft") +
+ getStyle(el, "marginRight") +
+ getStyle(el, "paddingLeft") +
+ getStyle(el, "paddingRight") +
+ getStyle(el, "borderLeftWidth") +
+ getStyle(el, "borderRightWidth");
+ default:
+ break;
+ }
+
+ return getStyle(el, which);
+ }
+
+ /**
+ * Handle UI update.
+ * Call the appropriate methods on events fired when an item is added, or
+ * removed for synchronizing the DOM.
+ *
+ * @method syncUi
+ * @param {Object} o The item that needs to be added or removed
+ * @private
+ */
+ function syncUi(o) {
+ var carousel = this;
+
+ if (!JS.isObject(o)) {
+ return;
+ }
+
+ switch (o.ev) {
+ case itemAddedEvent:
+ carousel._syncUiForItemAdd(o);
+ break;
+ case itemRemovedEvent:
+ carousel._syncUiForItemRemove(o);
+ break;
+ case itemReplacedEvent:
+ carousel._syncUiForItemReplace(o);
+ break;
+ case loadItemsEvent:
+ carousel._syncUiForLazyLoading(o);
+ break;
+ }
+
+ carousel.fireEvent(uiUpdateEvent);
+ }
+
+ /**
+ * Update the state variables after scrolling the Carousel view port.
+ *
+ * @method updateStateAfterScroll
+ * @param {Integer} item The index to which the Carousel has scrolled to.
+ * @param {Integer} sentinel The last element in the view port.
+ * @private
+ */
+ function updateStateAfterScroll(item, sentinel) {
+ var carousel = this,
+ page = carousel.get("currentPage"),
+ newPage,
+ numPerPage = carousel.get("numVisible");
+
+ newPage = parseInt(carousel._firstItem / numPerPage, 10);
+ if (newPage != page) {
+ carousel.setAttributeConfig("currentPage", { value: newPage });
+ carousel.fireEvent(pageChangeEvent, newPage);
+ }
+
+ if (carousel.get("selectOnScroll")) {
+ if (carousel.get("selectedItem") != carousel._selectedItem) {
+ carousel.set("selectedItem", carousel._selectedItem);
+ }
+ }
+
+ clearTimeout(carousel._autoPlayTimer);
+ delete carousel._autoPlayTimer;
+ if (carousel.isAutoPlayOn()) {
+ carousel.startAutoPlay();
+ }
+
+ carousel.fireEvent(afterScrollEvent,
+ { first: carousel._firstItem,
+ last: sentinel },
+ carousel);
+ }
+
+ /*
+ * Static members and methods of the Carousel component
+ */
+
+ /**
+ * Return the appropriate Carousel object based on the id associated with
+ * the Carousel element or false if none match.
+ * @method getById
+ * @public
+ * @static
+ */
+ Carousel.getById = function (id) {
+ return instances[id] ? instances[id].object : false;
+ };
+
+ YAHOO.extend(Carousel, YAHOO.util.Element, {
+
+ /*
+ * Internal variables used within the Carousel component
+ */
+
+ /**
+ * Number of rows for a multirow carousel.
+ *
+ * @property _rows
+ * @private
+ */
+ _rows: null,
+
+ /**
+ * Number of cols for a multirow carousel.
+ *
+ * @property _cols
+ * @private
+ */
+ _cols: null,
+
+ /**
+ * The Animation object.
+ *
+ * @property _animObj
+ * @private
+ */
+ _animObj: null,
+
+ /**
+ * The Carousel element.
+ *
+ * @property _carouselEl
+ * @private
+ */
+ _carouselEl: null,
+
+ /**
+ * The Carousel clipping container element.
+ *
+ * @property _clipEl
+ * @private
+ */
+ _clipEl: null,
+
+ /**
+ * The current first index of the Carousel.
+ *
+ * @property _firstItem
+ * @private
+ */
+ _firstItem: 0,
+
+ /**
+ * Does the Carousel element have focus?
+ *
+ * @property _hasFocus
+ * @private
+ */
+ _hasFocus: false,
+
+ /**
+ * Is the Carousel rendered already?
+ *
+ * @property _hasRendered
+ * @private
+ */
+ _hasRendered: false,
+
+ /**
+ * Is the animation still in progress?
+ *
+ * @property _isAnimationInProgress
+ * @private
+ */
+ _isAnimationInProgress: false,
+
+ /**
+ * Is the auto-scrolling of Carousel in progress?
+ *
+ * @property _isAutoPlayInProgress
+ * @private
+ */
+ _isAutoPlayInProgress: false,
+
+ /**
+ * The table of items in the Carousel.
+ * The numItems is the number of items in the Carousel, items being the
+ * array of items in the Carousel. The size is the size of a single
+ * item in the Carousel. It is cached here for efficiency (to avoid
+ * computing the size multiple times).
+ *
+ * @property _itemsTable
+ * @private
+ */
+ _itemsTable: null,
+
+ /**
+ * The Carousel navigation buttons.
+ *
+ * @property _navBtns
+ * @private
+ */
+ _navBtns: null,
+
+ /**
+ * The Carousel navigation.
+ *
+ * @property _navEl
+ * @private
+ */
+ _navEl: null,
+
+ /**
+ * Status of the next navigation item.
+ *
+ * @property _nextEnabled
+ * @private
+ */
+ _nextEnabled: true,
+
+ /**
+ * The Carousel pages structure.
+ * This is an object of the total number of pages and the current page.
+ *
+ * @property _pages
+ * @private
+ */
+ _pages: null,
+
+ /**
+ * The Carousel pagination structure.
+ *
+ * @property _pagination
+ * @private
+ */
+ _pagination: {},
+
+ /**
+ * Status of the previous navigation item.
+ *
+ * @property _prevEnabled
+ * @private
+ */
+ _prevEnabled: true,
+
+ /**
+ * Whether the Carousel size needs to be recomputed or not?
+ *
+ * @property _recomputeSize
+ * @private
+ */
+ _recomputeSize: true,
+
+ /**
+ * Cache the Carousel item attributes.
+ *
+ * @property _itemAttrCache
+ * @private
+ */
+ _itemAttrCache: {},
+
+ /*
+ * CSS classes used by the Carousel component
+ */
+
+ CLASSES: {
+
+ /**
+ * The class name of the Carousel navigation buttons.
+ *
+ * @property BUTTON
+ * @default "yui-carousel-button"
+ */
+ BUTTON: "yui-carousel-button",
+
+ /**
+ * The class name of the Carousel element.
+ *
+ * @property CAROUSEL
+ * @default "yui-carousel"
+ */
+ CAROUSEL: "yui-carousel",
+
+ /**
+ * The class name of the container of the items in the Carousel.
+ *
+ * @property CAROUSEL_EL
+ * @default "yui-carousel-element"
+ */
+ CAROUSEL_EL: "yui-carousel-element",
+
+ /**
+ * The class name of the Carousel's container element.
+ *
+ * @property CONTAINER
+ * @default "yui-carousel-container"
+ */
+ CONTAINER: "yui-carousel-container",
+
+ /**
+ * The class name of the Carousel's container element.
+ *
+ * @property CONTENT
+ * @default "yui-carousel-content"
+ */
+ CONTENT: "yui-carousel-content",
+
+ /**
+ * The class name of a disabled navigation button.
+ *
+ * @property DISABLED
+ * @default "yui-carousel-button-disabled"
+ */
+ DISABLED: "yui-carousel-button-disabled",
+
+ /**
+ * The class name of the first Carousel navigation button.
+ *
+ * @property FIRST_NAV
+ * @default " yui-carousel-first-button"
+ */
+ FIRST_NAV: " yui-carousel-first-button",
+
+ /**
+ * The class name of a first disabled navigation button.
+ *
+ * @property FIRST_NAV_DISABLED
+ * @default "yui-carousel-first-button-disabled"
+ */
+ FIRST_NAV_DISABLED: "yui-carousel-first-button-disabled",
+
+ /**
+ * The class name of a first page element.
+ *
+ * @property FIRST_PAGE
+ * @default "yui-carousel-nav-first-page"
+ */
+ FIRST_PAGE: "yui-carousel-nav-first-page",
+
+ /**
+ * The class name of the Carousel navigation button that has focus.
+ *
+ * @property FOCUSSED_BUTTON
+ * @default "yui-carousel-button-focus"
+ */
+ FOCUSSED_BUTTON: "yui-carousel-button-focus",
+
+ /**
+ * The class name of a horizontally oriented Carousel.
+ *
+ * @property HORIZONTAL
+ * @default "yui-carousel-horizontal"
+ */
+ HORIZONTAL: "yui-carousel-horizontal",
+
+ /**
+ * The element to be used as the progress indicator when the item
+ * is still being loaded.
+ *
+ * @property ITEM_LOADING
+ * @default The progress indicator (spinner) image CSS class
+ */
+ ITEM_LOADING: "yui-carousel-item-loading",
+
+ /**
+ * The class name that will be set if the Carousel adjusts itself
+ * for a minimum width.
+ *
+ * @property MIN_WIDTH
+ * @default "yui-carousel-min-width"
+ */
+ MIN_WIDTH: "yui-carousel-min-width",
+
+ /**
+ * The navigation element container class name.
+ *
+ * @property NAVIGATION
+ * @default "yui-carousel-nav"
+ */
+ NAVIGATION: "yui-carousel-nav",
+
+ /**
+ * The class name of the next Carousel navigation button.
+ *
+ * @property NEXT_NAV
+ * @default " yui-carousel-next-button"
+ */
+ NEXT_NAV: " yui-carousel-next-button",
+
+ /**
+ * The class name of the next navigation link. This variable is
+ * not only used for styling, but also for identifying the link
+ * within the Carousel container.
+ *
+ * @property NEXT_PAGE
+ * @default "yui-carousel-next"
+ */
+ NEXT_PAGE: "yui-carousel-next",
+
+ /**
+ * The class name for the navigation container for prev/next.
+ *
+ * @property NAV_CONTAINER
+ * @default "yui-carousel-buttons"
+ */
+ NAV_CONTAINER: "yui-carousel-buttons",
+
+ /**
+ * The class name for an item in the pager UL or dropdown menu.
+ *
+ * @property PAGER_ITEM
+ * @default "yui-carousel-pager-item"
+ */
+ PAGER_ITEM: "yui-carousel-pager-item",
+
+ /**
+ * The class name for the pagination container
+ *
+ * @property PAGINATION
+ * @default "yui-carousel-pagination"
+ */
+ PAGINATION: "yui-carousel-pagination",
+
+ /**
+ * The class name of the focussed page navigation. This class is
+ * specifically used for the ugly focus handling in Opera.
+ *
+ * @property PAGE_FOCUS
+ * @default "yui-carousel-nav-page-focus"
+ */
+ PAGE_FOCUS: "yui-carousel-nav-page-focus",
+
+ /**
+ * The class name of the previous navigation link. This variable
+ * is not only used for styling, but also for identifying the link
+ * within the Carousel container.
+ *
+ * @property PREV_PAGE
+ * @default "yui-carousel-prev"
+ */
+ PREV_PAGE: "yui-carousel-prev",
+
+ /**
+ * The class name of the selected item.
+ *
+ * @property SELECTED_ITEM
+ * @default "yui-carousel-item-selected"
+ */
+ SELECTED_ITEM: "yui-carousel-item-selected",
+
+ /**
+ * The class name of the selected paging navigation.
+ *
+ * @property SELECTED_NAV
+ * @default "yui-carousel-nav-page-selected"
+ */
+ SELECTED_NAV: "yui-carousel-nav-page-selected",
+
+ /**
+ * The class name of a vertically oriented Carousel.
+ *
+ * @property VERTICAL
+ * @default "yui-carousel-vertical"
+ */
+ VERTICAL: "yui-carousel-vertical",
+
+ /**
+ * The class name of a multirow Carousel.
+ *
+ * @property MULTI_ROW
+ * @default "yui-carousel-multi-row"
+ */
+ MULTI_ROW: "yui-carousel-multi-row",
+
+ /**
+ * The class name of a row in a multirow Carousel.
+ *
+ * @property ROW
+ * @default "yui-carousel-new-row"
+ */
+ ROW: "yui-carousel-row",
+
+ /**
+ * The class name of a vertical Carousel's container element.
+ *
+ * @property VERTICAL_CONTAINER
+ * @default "yui-carousel-vertical-container"
+ */
+ VERTICAL_CONTAINER: "yui-carousel-vertical-container",
+
+ /**
+ * The class name of a visible Carousel.
+ *
+ * @property VISIBLE
+ * @default "yui-carousel-visible"
+ */
+ VISIBLE: "yui-carousel-visible"
+
+ },
+
+ /*
+ * Configuration attributes for configuring the Carousel component
+ */
+
+ CONFIG: {
+
+ /**
+ * The offset of the first visible item in the Carousel.
+ *
+ * @property FIRST_VISIBLE
+ * @default 0
+ */
+ FIRST_VISIBLE: 0,
+
+ /**
+ * The minimum width of the horizontal Carousel container to support
+ * the navigation buttons.
+ *
+ * @property HORZ_MIN_WIDTH
+ * @default 180
+ */
+ HORZ_MIN_WIDTH: 180,
+
+ /**
+ * The maximum number of pager buttons allowed beyond which the UI
+ * of the pager would be a drop-down of pages instead of buttons.
+ *
+ * @property MAX_PAGER_BUTTONS
+ * @default 5
+ */
+ MAX_PAGER_BUTTONS: 5,
+
+ /**
+ * The minimum width of the vertical Carousel container to support
+ * the navigation buttons.
+ *
+ * @property VERT_MIN_WIDTH
+ * @default 155
+ */
+ VERT_MIN_WIDTH: 115,
+
+ /**
+ * The number of visible items in the Carousel.
+ *
+ * @property NUM_VISIBLE
+ * @default 3
+ */
+ NUM_VISIBLE: 3
+
+ },
+
+ /*
+ * Internationalizable strings in the Carousel component
+ */
+
+ STRINGS: {
+
+ /**
+ * The content to be used as the progress indicator when the item
+ * is still being loaded.
+ *
+ * @property ITEM_LOADING_CONTENT
+ * @default "Loading"
+ */
+ ITEM_LOADING_CONTENT: "Loading",
+
+ /**
+ * The next navigation button name/text.
+ *
+ * @property NEXT_BUTTON_TEXT
+ * @default "Next Page"
+ */
+ NEXT_BUTTON_TEXT: "Next Page",
+
+ /**
+ * The prefix text for the pager in case the UI is a drop-down.
+ *
+ * @property PAGER_PREFIX_TEXT
+ * @default "Go to page "
+ */
+ PAGER_PREFIX_TEXT: "Go to page ",
+
+ /**
+ * The previous navigation button name/text.
+ *
+ * @property PREVIOUS_BUTTON_TEXT
+ * @default "Previous Page"
+ */
+ PREVIOUS_BUTTON_TEXT: "Previous Page"
+
+ },
+
+ /*
+ * Public methods of the Carousel component
+ */
+
+ /**
+ * Insert or append an item to the Carousel.
+ * E.g. if Object: ({content:"Your Content", id:"", className:""}, index)
+ *
+ * @method addItem
+ * @public
+ * @param item {String | Object | HTMLElement} The item to be appended
+ * to the Carousel. If the parameter is a string, it is assumed to be
+ * the content of the newly created item. If the parameter is an
+ * object, it is assumed to supply the content and an optional class
+ * and an optional id of the newly created item.
+ * @param index {Number} optional The position to where in the list
+ * (starts from zero).
+ * @return {Boolean} Return true on success, false otherwise
+ */
+ addItem: function (item, index) {
+ var carousel = this,
+ className,
+ content,
+ elId,
+ replaceItems = 0,
+ newIndex, // Add newIndex as workaround for undefined pos
+ numItems = carousel.get("numItems");
+
+ if (!item) {
+ return false;
+ }
+
+ if (JS.isString(item) || item.nodeName) {
+ content = item.nodeName ? item.innerHTML : item;
+ } else if (JS.isObject(item)) {
+ content = item.content;
+ } else {
+ YAHOO.log("Invalid argument to addItem", "error", WidgetName);
+ return false;
+ }
+
+ className = item.className || "";
+ elId = item.id ? item.id : Dom.generateId();
+
+ if (JS.isUndefined(index)) {
+ carousel._itemsTable.items.push({
+ item : content,
+ className : className,
+ id : elId
+ });
+ // Add newIndex as workaround for undefined pos
+ newIndex = carousel._itemsTable.items.length-1;
+ } else {
+ if (index < 0 || index > numItems) {
+ YAHOO.log("Index out of bounds", "error", WidgetName);
+ return false;
+ }
+
+ // make sure we splice into the correct position
+ if(!carousel._itemsTable.items[index]){
+ carousel._itemsTable.items[index] = undefined;
+ replaceItems = 1;
+ }
+
+ carousel._itemsTable.items.splice(index, replaceItems, {
+ item : content,
+ className : className,
+ id : elId
+ });
+ }
+ carousel._itemsTable.numItems++;
+
+ if (numItems < carousel._itemsTable.items.length) {
+ carousel.set("numItems", carousel._itemsTable.items.length);
+ }
+
+ // Add newPos as workaround for undefined pos
+ carousel.fireEvent(itemAddedEvent, { pos: index, ev: itemAddedEvent, newPos:newIndex });
+
+ return true;
+ },
+
+ /**
+ * Insert or append multiple items to the Carousel.
+ *
+ * @method addItems
+ * @public
+ * @param items {Array} An array containing an array of new items each linked to the
+ * index where the insertion should take place.
+ * E.g. [[{content:' '}, index1], [{content:' '}, index2]]
+ * NOTE: An item at index must already exist.
+ * @return {Boolean} Return true on success, false otherwise
+ */
+ addItems: function (items) {
+ var i, n, rv = true;
+
+ if (!JS.isArray(items)) {
+ return false;
+ }
+
+ for (i = 0, n = items.length; i < n; i++) {
+ if (this.addItem(items[i][0], items[i][1]) === false) {
+ rv = false;
+ }
+ }
+
+ return rv;
+ },
+
+ /**
+ * Remove focus from the Carousel.
+ *
+ * @method blur
+ * @public
+ */
+ blur: function () {
+ this._carouselEl.blur();
+ this.fireEvent(blurEvent);
+ },
+
+ /**
+ * Clears the items from Carousel.
+ *
+ * @method clearItems
+ * @public
+ */
+ clearItems: function () {
+ var carousel = this, n = carousel.get("numItems");
+
+ while (n > 0) {
+ if (!carousel.removeItem(0)) {
+ YAHOO.log("Item could not be removed - missing?",
+ "warn", WidgetName);
+ }
+ /*
+ For dynamic loading, the numItems may be much larger than
+ the actual number of items in the table. So, set the
+ numItems to zero, and break out of the loop if the table
+ is already empty.
+ */
+ if (carousel._itemsTable.numItems === 0) {
+ carousel.set("numItems", 0);
+ break;
+ }
+ n--;
+ }
+
+ carousel.fireEvent(allItemsRemovedEvent);
+ },
+
+ /**
+ * Set focus on the Carousel.
+ *
+ * @method focus
+ * @public
+ */
+ focus: function () {
+ var carousel = this,
+ first,
+ focusEl,
+ isSelectionInvisible,
+ itemsTable,
+ last,
+ numVisible,
+ selectOnScroll,
+ selected,
+ selItem;
+
+ // Don't do anything if the Carousel is not rendered
+ if (!carousel._hasRendered) {
+ return;
+ }
+
+ if (carousel.isAnimating()) {
+ // this messes up real bad!
+ return;
+ }
+
+ selItem = carousel.get("selectedItem");
+ numVisible = carousel.get("numVisible");
+ selectOnScroll = carousel.get("selectOnScroll");
+ selected = (selItem >= 0) ?
+ carousel.getItem(selItem) : null;
+ first = carousel.get("firstVisible");
+ last = first + numVisible - 1;
+ isSelectionInvisible = (selItem < first || selItem > last);
+ focusEl = (selected && selected.id) ?
+ Dom.get(selected.id) : null;
+ itemsTable = carousel._itemsTable;
+
+ if (!selectOnScroll && isSelectionInvisible) {
+ focusEl = (itemsTable && itemsTable.items &&
+ itemsTable.items[first]) ?
+ Dom.get(itemsTable.items[first].id) : null;
+ }
+
+ if (focusEl) {
+ try {
+ focusEl.focus();
+ } catch (ex) {
+ // ignore focus errors
+ }
+ }
+
+ carousel.fireEvent(focusEvent);
+ },
+
+ /**
+ * Hide the Carousel.
+ *
+ * @method hide
+ * @public
+ */
+ hide: function () {
+ var carousel = this;
+
+ if (carousel.fireEvent(beforeHideEvent) !== false) {
+ carousel.removeClass(carousel.CLASSES.VISIBLE);
+ carousel.fireEvent(hideEvent);
+ }
+ },
+
+ /**
+ * Initialize the Carousel.
+ *
+ * @method init
+ * @public
+ * @param el {HTMLElement | String} The html element that represents
+ * the Carousel container.
+ * @param attrs {Object} The set of configuration attributes for
+ * creating the Carousel.
+ */
+ init: function (el, attrs) {
+ var carousel = this,
+ elId = el, // save for a rainy day
+ parse = false,
+ selected;
+
+ if (!el) {
+ YAHOO.log(el + " is neither an HTML element, nor a string",
+ "error", WidgetName);
+ return;
+ }
+
+ carousel._hasRendered = false;
+ carousel._navBtns = { prev: [], next: [] };
+ carousel._pages = { el: null, num: 0, cur: 0 };
+ carousel._pagination = {};
+ carousel._itemAttrCache = {};
+
+ carousel._itemsTable = { loading: {}, numItems: 0,
+ items: [], size: 0 };
+
+ YAHOO.log("Component initialization", WidgetName);
+
+ if (JS.isString(el)) {
+ el = Dom.get(el);
+ } else if (!el.nodeName) {
+ YAHOO.log(el + " is neither an HTML element, nor a string",
+ "error", WidgetName);
+ return;
+ }
+
+ Carousel.superclass.init.call(carousel, el, attrs);
+
+ // check if we're starting somewhere in the middle
+ selected = carousel.get("selectedItem");
+ if(selected > 0){
+ carousel.set("firstVisible",getFirstVisibleForPosition.call(carousel,selected));
+ }
+
+ if (el) {
+ if (!el.id) { // in case the HTML element is passed
+ el.setAttribute("id", Dom.generateId());
+ }
+ parse = carousel._parseCarousel(el);
+ if (!parse) {
+ carousel._createCarousel(elId);
+ }
+ } else {
+ el = carousel._createCarousel(elId);
+ }
+ elId = el.id;
+
+ carousel.initEvents();
+
+ if (parse) {
+ carousel._parseCarouselItems();
+ }
+
+ // add the selected class
+ if(selected > 0){
+ setItemSelection.call(carousel,selected,0);
+ }
+
+ if (!attrs || typeof attrs.isVertical == "undefined") {
+ carousel.set("isVertical", false);
+ }
+
+ carousel._parseCarouselNavigation(el);
+ carousel._navEl = carousel._setupCarouselNavigation();
+
+ instances[elId] = { object: carousel };
+ carousel._loadItems(Math.min(carousel.get("firstVisible")+carousel.get("numVisible"),carousel.get("numItems"))-1);
+ },
+
+ /**
+ * Initialize the configuration attributes used to create the Carousel.
+ *
+ * @method initAttributes
+ * @public
+ * @param attrs {Object} The set of configuration attributes for
+ * creating the Carousel.
+ */
+ initAttributes: function (attrs) {
+ var carousel = this;
+
+ attrs = attrs || {};
+ Carousel.superclass.initAttributes.call(carousel, attrs);
+
+ /**
+ * @attribute carouselEl
+ * @description The type of the Carousel element.
+ * @default OL
+ * @type Boolean
+ */
+ carousel.setAttributeConfig("carouselEl", {
+ validator : JS.isString,
+ value : attrs.carouselEl || "OL"
+ });
+
+ /**
+ * @attribute carouselItemEl
+ * @description The type of the list of items within the Carousel.
+ * @default LI
+ * @type Boolean
+ */
+ carousel.setAttributeConfig("carouselItemEl", {
+ validator : JS.isString,
+ value : attrs.carouselItemEl || "LI"
+ });
+
+ /**
+ * @attribute currentPage
+ * @description The current page number (read-only.)
+ * @type Number
+ */
+ carousel.setAttributeConfig("currentPage", {
+ readOnly : true,
+ value : 0
+ });
+
+ /**
+ * @attribute firstVisible
+ * @description The index to start the Carousel from (indexes begin
+ * from zero)
+ * @default 0
+ * @type Number
+ */
+ carousel.setAttributeConfig("firstVisible", {
+ method : carousel._setFirstVisible,
+ validator : carousel._validateFirstVisible,
+ value :
+ attrs.firstVisible || carousel.CONFIG.FIRST_VISIBLE
+ });
+
+ /**
+ * @attribute selectOnScroll
+ * @description Set this to true to automatically set focus to
+ * follow scrolling in the Carousel.
+ * @default true
+ * @type Boolean
+ */
+ carousel.setAttributeConfig("selectOnScroll", {
+ validator : JS.isBoolean,
+ value : attrs.selectOnScroll || true
+ });
+
+ /**
+ * @attribute numVisible
+ * @description The number of visible items in the Carousel's
+ * viewport.
+ * @default 3
+ * @type Number
+ */
+ carousel.setAttributeConfig("numVisible", {
+ setter : carousel._numVisibleSetter,
+ method : carousel._setNumVisible,
+ validator : carousel._validateNumVisible,
+ value : attrs.numVisible || carousel.CONFIG.NUM_VISIBLE
+ });
+
+ /**
+ * @attribute numItems
+ * @description The number of items in the Carousel.
+ * @type Number
+ */
+ carousel.setAttributeConfig("numItems", {
+ method : carousel._setNumItems,
+ validator : carousel._validateNumItems,
+ value : carousel._itemsTable.numItems
+ });
+
+ /**
+ * @attribute scrollIncrement
+ * @description The number of items to scroll by for arrow keys.
+ * @default 1
+ * @type Number
+ */
+ carousel.setAttributeConfig("scrollIncrement", {
+ validator : carousel._validateScrollIncrement,
+ value : attrs.scrollIncrement || 1
+ });
+
+ /**
+ * @attribute selectedItem
+ * @description The index of the selected item.
+ * @type Number
+ */
+ carousel.setAttributeConfig("selectedItem", {
+ setter : carousel._selectedItemSetter,
+ method : carousel._setSelectedItem,
+ validator : JS.isNumber,
+ value : -1
+ });
+
+ /**
+ * @attribute revealAmount
+ * @description The percentage of the item to be revealed on each
+ * side of the Carousel (before and after the first and last item
+ * in the Carousel's viewport.)
+ * @default 0
+ * @type Number
+ */
+ carousel.setAttributeConfig("revealAmount", {
+ method : carousel._setRevealAmount,
+ validator : carousel._validateRevealAmount,
+ value : attrs.revealAmount || 0
+ });
+
+ /**
+ * @attribute isCircular
+ * @description Set this to true to wrap scrolling of the contents
+ * in the Carousel.
+ * @default false
+ * @type Boolean
+ */
+ carousel.setAttributeConfig("isCircular", {
+ validator : JS.isBoolean,
+ value : attrs.isCircular || false
+ });
+
+ /**
+ * @attribute isVertical
+ * @description True if the orientation of the Carousel is vertical
+ * @default false
+ * @type Boolean
+ */
+ carousel.setAttributeConfig("isVertical", {
+ method : carousel._setOrientation,
+ validator : JS.isBoolean,
+ value : attrs.isVertical || false
+ });
+
+ /**
+ * @attribute navigation
+ * @description The set of navigation controls for Carousel
+ * @default
+ * { prev: null, // the previous navigation element
+ * next: null } // the next navigation element
+ * @type Object
+ */
+ carousel.setAttributeConfig("navigation", {
+ method : carousel._setNavigation,
+ validator : carousel._validateNavigation,
+ value :
+ attrs.navigation || {prev: null,next: null,page: null}
+ });
+
+ /**
+ * @attribute animation
+ * @description The optional animation attributes for the Carousel.
+ * @default
+ * { speed: 0, // the animation speed (in seconds)
+ * effect: null } // the animation effect (like
+ * YAHOO.util.Easing.easeOut)
+ * @type Object
+ */
+ carousel.setAttributeConfig("animation", {
+ validator : carousel._validateAnimation,
+ value : attrs.animation || { speed: 0, effect: null }
+ });
+
+ /**
+ * @attribute autoPlay
+ * @description Set this to time in milli-seconds to have the
+ * Carousel automatically scroll the contents.
+ * @type Number
+ * @deprecated Use autoPlayInterval instead.
+ */
+ carousel.setAttributeConfig("autoPlay", {
+ validator : JS.isNumber,
+ value : attrs.autoPlay || 0
+ });
+
+ /**
+ * @attribute autoPlayInterval
+ * @description The delay in milli-seconds for scrolling the
+ * Carousel during auto-play.
+ * Note: The startAutoPlay() method needs to be invoked to trigger
+ * automatic scrolling of Carousel.
+ * @type Number
+ */
+ carousel.setAttributeConfig("autoPlayInterval", {
+ validator : JS.isNumber,
+ value : attrs.autoPlayInterval || 0
+ });
+
+ /**
+ * @attribute numPages
+ * @description The number of pages in the carousel.
+ * @type Number
+ */
+ carousel.setAttributeConfig("numPages", {
+ readOnly : true,
+ getter : carousel._getNumPages
+ });
+
+ /**
+ * @attribute lastVisible
+ * @description The last item visible in the carousel.
+ * @type Number
+ */
+ carousel.setAttributeConfig("lastVisible", {
+ readOnly : true,
+ getter : carousel._getLastVisible
+ });
+ },
+
+ /**
+ * Initialize and bind the event handlers.
+ *
+ * @method initEvents
+ * @public
+ */
+ initEvents: function () {
+ var carousel = this,
+ cssClass = carousel.CLASSES,
+ focussedLi;
+
+ carousel.on("keydown", carousel._keyboardEventHandler);
+
+ carousel.on(afterScrollEvent, syncNavigation);
+
+ carousel.on(itemAddedEvent, syncUi);
+
+ carousel.on(itemRemovedEvent, syncUi);
+
+ carousel.on(itemReplacedEvent, syncUi);
+
+ carousel.on(itemSelectedEvent, function () {
+ if (carousel._hasFocus) {
+ carousel.focus();
+ }
+ });
+
+ carousel.on(loadItemsEvent, syncUi);
+
+ carousel.on(allItemsRemovedEvent, function (ev) {
+ carousel.scrollTo(0);
+ syncNavigation.call(carousel);
+ syncPagerUi.call(carousel);
+ });
+
+ carousel.on(pageChangeEvent, syncPagerUi, carousel);
+
+ carousel.on(renderEvent, function (ev) {
+ if (carousel.get("selectedItem") === null ||
+ carousel.get("selectedItem") <= 0) { //in either case
+ carousel.set("selectedItem", carousel.get("firstVisible"));
+ }
+ syncNavigation.call(carousel, ev);
+ syncPagerUi.call(carousel, ev);
+ carousel._setClipContainerSize();
+ carousel.show();
+ });
+
+ carousel.on("selectedItemChange", function (ev) {
+ setItemSelection.call(carousel, ev.newValue, ev.prevValue);
+ if (ev.newValue >= 0) {
+ carousel._updateTabIndex(
+ carousel.getElementForItem(ev.newValue));
+ }
+ carousel.fireEvent(itemSelectedEvent, ev.newValue);
+ });
+
+ carousel.on(uiUpdateEvent, function (ev) {
+ syncNavigation.call(carousel, ev);
+ syncPagerUi.call(carousel, ev);
+ });
+
+ carousel.on("firstVisibleChange", function (ev) {
+ if (!carousel.get("selectOnScroll")) {
+ if (ev.newValue >= 0) {
+ carousel._updateTabIndex(
+ carousel.getElementForItem(ev.newValue));
+ }
+ }
+ });
+
+ // Handle item selection on mouse click
+ carousel.on("click", function (ev) {
+ if (carousel.isAutoPlayOn()) {
+ carousel.stopAutoPlay();
+ }
+ carousel._itemClickHandler(ev);
+ carousel._pagerClickHandler(ev);
+ });
+
+ // Restore the focus on the navigation buttons
+
+ Event.onFocus(carousel.get("element"), function (ev, obj) {
+ var target = Event.getTarget(ev);
+
+ if (target && target.nodeName.toUpperCase() == "A" &&
+ Dom.getAncestorByClassName(target, cssClass.NAVIGATION)) {
+ if (focussedLi) {
+ Dom.removeClass(focussedLi, cssClass.PAGE_FOCUS);
+ }
+ focussedLi = target.parentNode;
+ Dom.addClass(focussedLi, cssClass.PAGE_FOCUS);
+ } else {
+ if (focussedLi) {
+ Dom.removeClass(focussedLi, cssClass.PAGE_FOCUS);
+ }
+ }
+
+ obj._hasFocus = true;
+ obj._updateNavButtons(Event.getTarget(ev), true);
+ }, carousel);
+
+ Event.onBlur(carousel.get("element"), function (ev, obj) {
+ obj._hasFocus = false;
+ obj._updateNavButtons(Event.getTarget(ev), false);
+ }, carousel);
+ },
+
+ /**
+ * Return true if the Carousel is still animating, or false otherwise.
+ *
+ * @method isAnimating
+ * @return {Boolean} Return true if animation is still in progress, or
+ * false otherwise.
+ * @public
+ */
+ isAnimating: function () {
+ return this._isAnimationInProgress;
+ },
+
+ /**
+ * Return true if the auto-scrolling of Carousel is "on", or false
+ * otherwise.
+ *
+ * @method isAutoPlayOn
+ * @return {Boolean} Return true if autoPlay is "on", or false
+ * otherwise.
+ * @public
+ */
+ isAutoPlayOn: function () {
+ return this._isAutoPlayInProgress;
+ },
+
+ /**
+ * Return the carouselItemEl at index or null if the index is not
+ * found.
+ *
+ * @method getElementForItem
+ * @param index {Number} The index of the item to be returned
+ * @return {Element} Return the item at index or null if not found
+ * @public
+ */
+ getElementForItem: function (index) {
+ var carousel = this;
+
+ if (index < 0 || index >= carousel.get("numItems")) {
+ YAHOO.log("Index out of bounds", "error", WidgetName);
+ return null;
+ }
+
+ if (carousel._itemsTable.items[index]) {
+ return Dom.get(carousel._itemsTable.items[index].id);
+ }
+
+ return null;
+ },
+
+ /**
+ * Return the carouselItemEl for all items in the Carousel.
+ *
+ * @method getElementForItems
+ * @return {Array} Return all the items
+ * @public
+ */
+ getElementForItems: function () {
+ var carousel = this, els = [], i;
+
+ for (i = 0; i < carousel._itemsTable.numItems; i++) {
+ els.push(carousel.getElementForItem(i));
+ }
+
+ return els;
+ },
+
+ /**
+ * Return the item at index or null if the index is not found.
+ *
+ * @method getItem
+ * @param index {Number} The index of the item to be returned
+ * @return {Object} Return the item at index or null if not found
+ * @public
+ */
+ getItem: function (index) {
+ var carousel = this;
+
+ if (index < 0 || index >= carousel.get("numItems")) {
+ YAHOO.log("Index out of bounds", "error", WidgetName);
+ return null;
+ }
+
+ if (carousel._itemsTable.numItems > index) {
+ if (!JS.isUndefined(carousel._itemsTable.items[index])) {
+ return carousel._itemsTable.items[index];
+ }
+ }
+
+ return null;
+ },
+
+ /**
+ * Return all items as an array.
+ *
+ * @method getItems
+ * @return {Array} Return all items in the Carousel
+ * @public
+ */
+ getItems: function () {
+ return this._itemsTable.items;
+ },
+
+ /**
+ * Return all loading items as an array.
+ *
+ * @method getLoadingItems
+ * @return {Array} Return all items that are loading in the Carousel.
+ * @public
+ */
+ getLoadingItems: function () {
+ return this._itemsTable.loading;
+ },
+
+ /**
+ * For a multirow carousel, return the number of rows specified by user.
+ *
+ * @method getItems
+ * @return {Number} Number of rows
+ * @public
+ */
+ getRows: function () {
+ return this._rows;
+ },
+
+ /**
+ * For a multirow carousel, return the number of cols specified by user.
+ *
+ * @method getItems
+ * @return {Array} Return all items in the Carousel
+ * @public
+ */
+ getCols: function () {
+ return this._cols;
+ },
+
+ /**
+ * Return the position of the Carousel item that has the id "id", or -1
+ * if the id is not found.
+ *
+ * @method getItemPositionById
+ * @param index {Number} The index of the item to be returned
+ * @public
+ */
+ getItemPositionById: function (id) {
+ var carousel = this,
+ n = carousel.get("numItems"),
+ i = 0,
+ items = carousel._itemsTable.items,
+ item;
+
+ while (i < n) {
+ item = items[i] || {};
+ if(item.id == id) {
+ return i;
+ }
+ i++;
+ }
+
+ return -1;
+ },
+
+ /**
+ * Return all visible items as an array.
+ *
+ * @method getVisibleItems
+ * @return {Array} The array of visible items
+ * @public
+ */
+ getVisibleItems: function () {
+ var carousel = this,
+ i = carousel.get("firstVisible"),
+ n = i + carousel.get("numVisible"),
+ r = [];
+
+ while (i < n) {
+ r.push(carousel.getElementForItem(i));
+ i++;
+ }
+
+ return r;
+ },
+
+ /**
+ * Remove an item at index from the Carousel.
+ *
+ * @method removeItem
+ * @public
+ * @param index {Number} The position to where in the list (starts from
+ * zero).
+ * @return {Boolean} Return true on success, false otherwise
+ */
+ removeItem: function (index) {
+ var carousel = this,
+ item,
+ num = carousel.get("numItems");
+
+ if (index < 0 || index >= num) {
+ YAHOO.log("Index out of bounds", "error", WidgetName);
+ return false;
+ }
+
+ item = carousel._itemsTable.items.splice(index, 1);
+ if (item && item.length == 1) {
+ carousel._itemsTable.numItems--;
+ carousel.set("numItems", num - 1);
+
+ carousel.fireEvent(itemRemovedEvent,
+ { item: item[0], pos: index, ev: itemRemovedEvent });
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Replace an item at index witin Carousel.
+ *
+ * @method replaceItem
+ * @public
+ * @param item {String | Object | HTMLElement} The item to be appended
+ * to the Carousel. If the parameter is a string, it is assumed to be
+ * the content of the newly created item. If the parameter is an
+ * object, it is assumed to supply the content and an optional class
+ * and an optional id of the newly created item.
+ * @param index {Number} The position to where in the list (starts from
+ * zero).
+ * @return {Boolean} Return true on success, false otherwise
+ */
+ replaceItem: function (item, index) {
+ var carousel = this,
+ className,
+ content,
+ elId,
+ numItems = carousel.get("numItems"),
+ oel,
+ el = item;
+
+ if (!item) {
+ return false;
+ }
+
+ if (JS.isString(item) || item.nodeName) {
+ content = item.nodeName ? item.innerHTML : item;
+ } else if (JS.isObject(item)) {
+ content = item.content;
+ } else {
+ YAHOO.log("Invalid argument to replaceItem", "error", WidgetName);
+ return false;
+ }
+
+ if (JS.isUndefined(index)) {
+ YAHOO.log("Index must be defined for replaceItem", "error", WidgetName);
+ return false;
+ } else {
+ if (index < 0 || index >= numItems) {
+ YAHOO.log("Index out of bounds in replaceItem", "error", WidgetName);
+ return false;
+ }
+
+ oel = carousel._itemsTable.items[index];
+ if(!oel){
+ oel = carousel._itemsTable.loading[index];
+ carousel._itemsTable.items[index] = undefined;
+ }
+
+ carousel._itemsTable.items.splice(index, 1, {
+ item : content,
+ className : item.className || "",
+ id : Dom.generateId()
+ });
+
+ el = carousel._itemsTable.items[index];
+ }
+ carousel.fireEvent(itemReplacedEvent,
+ { newItem: el, oldItem: oel, pos: index, ev: itemReplacedEvent });
+
+ return true;
+ },
+
+ /**
+ * Replace multiple items at specified indexes.
+ * NOTE: item at index must already exist.
+ *
+ * @method replaceItems
+ * @public
+ * @param items {Array} An array containing an array of replacement items each linked to the
+ * index where the substitution should take place.
+ * E.g. [[{content:' '}, index1], [{content:' '}, index2]]
+ * @return {Boolean} Return true on success, false otherwise
+ */
+ replaceItems: function (items) {
+ var i, n, rv = true;
+
+ if (!JS.isArray(items)) {
+ return false;
+ }
+
+ for (i = 0, n = items.length; i < n; i++) {
+ if (this.replaceItem(items[i][0], items[i][1]) === false) {
+ rv = false;
+ }
+ }
+
+ return rv;
+ },
+
+ /**
+ * Render the Carousel.
+ *
+ * @method render
+ * @public
+ * @param appendTo {HTMLElement | String} The element to which the
+ * Carousel should be appended prior to rendering.
+ * @return {Boolean} Status of the operation
+ */
+ render: function (appendTo) {
+ var carousel = this,
+ cssClass = carousel.CLASSES,
+ rows = carousel._rows;
+
+ carousel.addClass(cssClass.CAROUSEL);
+
+ if (!carousel._clipEl) {
+ carousel._clipEl = carousel._createCarouselClip();
+ carousel._clipEl.appendChild(carousel._carouselEl);
+ }
+
+ if (appendTo) {
+ carousel.appendChild(carousel._clipEl);
+ carousel.appendTo(appendTo);
+ } else {
+ if (!Dom.inDocument(carousel.get("element"))) {
+ YAHOO.log("Nothing to render. The container should be " +
+ "within the document if appendTo is not " +
+ "specified", "error", WidgetName);
+ return false;
+ }
+ carousel.appendChild(carousel._clipEl);
+ }
+
+ if (rows) {
+ Dom.addClass(carousel._clipEl, cssClass.MULTI_ROW);
+ }
+
+ if (carousel.get("isVertical")) {
+ carousel.addClass(cssClass.VERTICAL);
+ } else {
+ carousel.addClass(cssClass.HORIZONTAL);
+ }
+
+ if (carousel.get("numItems") < 1) {
+ YAHOO.log("No items in the Carousel to render", "warn",
+ WidgetName);
+ return false;
+ }
+
+ carousel._refreshUi();
+
+ return true;
+ },
+
+ /**
+ * Scroll the Carousel by an item backward.
+ *
+ * @method scrollBackward
+ * @public
+ */
+ scrollBackward: function () {
+ var carousel = this;
+ carousel.scrollTo(carousel._firstItem -
+ carousel.get("scrollIncrement"));
+ },
+
+ /**
+ * Scroll the Carousel by an item forward.
+ *
+ * @method scrollForward
+ * @public
+ */
+ scrollForward: function () {
+ var carousel = this;
+ carousel.scrollTo(carousel._firstItem +
+ carousel.get("scrollIncrement"));
+ },
+
+ /**
+ * Scroll the Carousel by a page backward.
+ *
+ * @method scrollPageBackward
+ * @public
+ */
+ scrollPageBackward: function () {
+ var carousel = this,
+ isVertical = carousel.get("isVertical"),
+ cols = carousel._cols,
+ item = carousel._firstItem - carousel.get("numVisible");
+
+ if (item < 0) { // only account for multi-row when scrolling backwards from item 0
+ if (cols) {
+ item = carousel._firstItem - cols;
+ }
+ }
+
+ if (carousel.get("selectOnScroll")) {
+ carousel._selectedItem = carousel._getSelectedItem(item);
+ }
+
+ carousel.scrollTo(item);
+ },
+
+ /**
+ * Scroll the Carousel by a page forward.
+ *
+ * @method scrollPageForward
+ * @public
+ */
+ scrollPageForward: function () {
+ var carousel = this,
+ item = carousel._firstItem + carousel.get("numVisible");
+
+ if (item > carousel.get("numItems")) {
+ item = 0;
+ }
+
+ if (carousel.get("selectOnScroll")) {
+ carousel._selectedItem = carousel._getSelectedItem(item);
+ }
+
+ carousel.scrollTo(item);
+ },
+
+ /**
+ * Scroll the Carousel to make the item the first visible item.
+ *
+ * @method scrollTo
+ * @public
+ * @param item Number The index of the element to position at.
+ * @param dontSelect Boolean True if select should be avoided
+ */
+ scrollTo: function (item, dontSelect) {
+ var carousel = this, animate, animCfg, isCircular, isVertical,
+ rows, delta, direction, firstItem, lastItem, itemsPerRow,
+ itemsPerCol, numItems, numPerPage, offset, page, rv, sentinel,
+ index, stopAutoScroll,
+ itemsTable = carousel._itemsTable,
+ items = itemsTable.items,
+ loading = itemsTable.loading;
+
+ if (JS.isUndefined(item) || item == carousel._firstItem ||
+ carousel.isAnimating()) {
+ return; // nothing to do!
+ }
+
+ animCfg = carousel.get("animation");
+ isCircular = carousel.get("isCircular");
+ isVertical = carousel.get("isVertical");
+ itemsPerRow = carousel._cols;
+ itemsPerCol = carousel._rows;
+ firstItem = carousel._firstItem;
+ numItems = carousel.get("numItems");
+ numPerPage = carousel.get("numVisible");
+ page = carousel.get("currentPage");
+
+ stopAutoScroll = function () {
+ if (carousel.isAutoPlayOn()) {
+ carousel.stopAutoPlay();
+ }
+ };
+
+ if (item < 0) {
+ if (isCircular) {
+ item = numItems + item;
+ } else {
+ stopAutoScroll.call(carousel);
+ return;
+ }
+ } else if (numItems > 0 && item > numItems - 1) {
+
+ if (carousel.get("isCircular")) {
+ item = numItems - item;
+ } else {
+ stopAutoScroll.call(carousel);
+ return;
+ }
+ }
+
+ if (isNaN(item)) {
+ return;
+ }
+
+ direction = (carousel._firstItem > item) ? "backward" : "forward";
+
+ sentinel = firstItem + numPerPage;
+ sentinel = (sentinel > numItems - 1) ? numItems - 1 : sentinel;
+ rv = carousel.fireEvent(beforeScrollEvent,
+ { dir: direction, first: firstItem, last: sentinel });
+ if (rv === false) { // scrolling is prevented
+ return;
+ }
+
+ carousel.fireEvent(beforePageChangeEvent, { page: page });
+
+ // call loaditems to check if we have all the items to display
+ lastItem = item + numPerPage - 1;
+ carousel._loadItems(lastItem > numItems-1 ? numItems-1 : lastItem);
+
+ // Calculate the delta relative to the first item, the delta is
+ // always negative.
+ delta = 0 - item;
+
+ if (itemsPerCol) {
+ // offset calculations for multirow Carousel
+ if (isVertical) {
+ delta = parseInt(delta / itemsPerRow, 10);
+ } else {
+ delta = parseInt(delta / itemsPerCol, 10);
+ }
+ }
+
+ // adjust for items not yet loaded
+ index = 0;
+ while (delta < 0 && index < item+numPerPage-1 && index < numItems) {
+ if (!items[index] && !loading[index]) {
+ delta++;
+ }
+ index += itemsPerCol ? itemsPerCol : 1;
+ }
+
+ carousel._firstItem = item;
+ carousel.set("firstVisible", item);
+
+ YAHOO.log("Scrolling to " + item + " delta = " + delta, WidgetName);
+
+ sentinel = item + numPerPage;
+ sentinel = (sentinel > numItems - 1) ? numItems - 1 : sentinel;
+
+ offset = getScrollOffset.call(carousel, delta);
+ YAHOO.log("Scroll offset = " + offset, WidgetName);
+
+ animate = animCfg.speed > 0;
+
+ if (animate) {
+ carousel._animateAndSetCarouselOffset(offset, item, sentinel,
+ dontSelect);
+ } else {
+ carousel._setCarouselOffset(offset);
+ updateStateAfterScroll.call(carousel, item, sentinel);
+ }
+ },
+
+ /**
+ * Get the page an item is on within carousel.
+ *
+ * @method getPageForItem
+ * @public
+ * @param index {Number} Index of item
+ * @return {Number} Page item is on
+ */
+ getPageForItem : function(item) {
+ return Math.ceil(
+ (item+1) / parseInt(this.get("numVisible"),10)
+ );
+ },
+
+ /**
+ * Get the first visible item's index on any given page.
+ *
+ * @method getFirstVisibleOnpage
+ * @public
+ * @param page {Number} Page
+ * @return {Number} First item's index
+ */
+ getFirstVisibleOnPage : function(page) {
+ return (page - 1) * this.get("numVisible");
+ },
+
+ /**
+ * Select the previous item in the Carousel.
+ *
+ * @method selectPreviousItem
+ * @public
+ */
+ selectPreviousItem: function () {
+ var carousel = this,
+ newpos = 0,
+ selected = carousel.get("selectedItem");
+
+ if (selected == this._firstItem) {
+ newpos = selected - carousel.get("numVisible");
+ carousel._selectedItem = carousel._getSelectedItem(selected-1);
+ carousel.scrollTo(newpos);
+ } else {
+ newpos = carousel.get("selectedItem") -
+ carousel.get("scrollIncrement");
+ carousel.set("selectedItem",carousel._getSelectedItem(newpos));
+ }
+ },
+
+ /**
+ * Select the next item in the Carousel.
+ *
+ * @method selectNextItem
+ * @public
+ */
+ selectNextItem: function () {
+ var carousel = this, newpos = 0;
+
+ newpos = carousel.get("selectedItem") +
+ carousel.get("scrollIncrement");
+ carousel.set("selectedItem", carousel._getSelectedItem(newpos));
+ },
+
+ /**
+ * Display the Carousel.
+ *
+ * @method show
+ * @public
+ */
+ show: function () {
+ var carousel = this,
+ cssClass = carousel.CLASSES;
+
+ if (carousel.fireEvent(beforeShowEvent) !== false) {
+ carousel.addClass(cssClass.VISIBLE);
+ carousel.fireEvent(showEvent);
+ }
+ },
+
+ /**
+ * Start auto-playing the Carousel.
+ *
+ * @method startAutoPlay
+ * @public
+ */
+ startAutoPlay: function () {
+ var carousel = this, timer;
+
+ if (JS.isUndefined(carousel._autoPlayTimer)) {
+ timer = carousel.get("autoPlayInterval");
+ if (timer <= 0) {
+ return;
+ }
+ carousel._isAutoPlayInProgress = true;
+ carousel.fireEvent(startAutoPlayEvent);
+ carousel._autoPlayTimer = setTimeout(function () {
+ carousel._autoScroll();
+ }, timer);
+ }
+ },
+
+ /**
+ * Stop auto-playing the Carousel.
+ *
+ * @method stopAutoPlay
+ * @public
+ */
+ stopAutoPlay: function () {
+ var carousel = this;
+
+ if (!JS.isUndefined(carousel._autoPlayTimer)) {
+ clearTimeout(carousel._autoPlayTimer);
+ delete carousel._autoPlayTimer;
+ carousel._isAutoPlayInProgress = false;
+ carousel.fireEvent(stopAutoPlayEvent);
+ }
+ },
+
+ /**
+ * Update interface's pagination data within a registered template.
+ *
+ * @method updatePagination
+ * @public
+ */
+ updatePagination: function () {
+ var carousel = this,
+ pagination = carousel._pagination;
+ if(!pagination.el){ return false; }
+
+ var numItems = carousel.get('numItems'),
+ numVisible = carousel.get('numVisible'),
+ firstVisible = carousel.get('firstVisible')+1,
+ currentPage = carousel.get('currentPage')+1,
+ numPages = carousel.get('numPages'),
+ replacements = {
+ 'numVisible' : numVisible,
+ 'numPages' : numPages,
+ 'numItems' : numItems,
+ 'selectedItem' : carousel.get('selectedItem')+1,
+ 'currentPage' : currentPage,
+ 'firstVisible' : firstVisible,
+ 'lastVisible' : carousel.get("lastVisible")+1
+ },
+ cb = pagination.callback || {},
+ scope = cb.scope && cb.obj ? cb.obj : carousel;
+
+ pagination.el.innerHTML = JS.isFunction(cb.fn) ? cb.fn.apply(scope, [pagination.template, replacements]) : YAHOO.lang.substitute(pagination.template, replacements);
+ },
+
+ /**
+ * Register carousels pagination template, append to interface, and populate.
+ *
+ * @method registerPagination
+ * @param template {String} Pagination template as passed to lang.substitute
+ * @public
+ */
+ registerPagination: function (tpl, pos, cb) {
+ var carousel = this;
+
+ carousel._pagination.template = tpl;
+ carousel._pagination.callback = cb || {};
+
+ if(!carousel._pagination.el){
+ carousel._pagination.el = createElement('DIV', {className:carousel.CLASSES.PAGINATION});
+
+ if(pos == "before"){
+ carousel._navEl.insertBefore(carousel._pagination.el, carousel._navEl.firstChild);
+ } else {
+ carousel._navEl.appendChild(carousel._pagination.el);
+ }
+
+ carousel.on('itemSelected', carousel.updatePagination);
+ carousel.on('pageChange', carousel.updatePagination);
+ }
+
+ carousel.updatePagination();
+ },
+
+ /**
+ * Return the string representation of the Carousel.
+ *
+ * @method toString
+ * @public
+ * @return {String}
+ */
+ toString: function () {
+ return WidgetName + (this.get ? " (#" + this.get("id") + ")" : "");
+ },
+
+ /*
+ * Protected methods of the Carousel component
+ */
+
+ /**
+ * Set the Carousel offset to the passed offset after animating.
+ *
+ * @method _animateAndSetCarouselOffset
+ * @param {Integer} offset The offset to which the Carousel has to be
+ * scrolled to.
+ * @param {Integer} item The index to which the Carousel will scroll.
+ * @param {Integer} sentinel The last element in the view port.
+ * @protected
+ */
+ _animateAndSetCarouselOffset: function (offset, item, sentinel) {
+ var carousel = this,
+ animCfg = carousel.get("animation"),
+ animObj = null;
+
+ if (carousel.get("isVertical")) {
+ animObj = new YAHOO.util.Motion(carousel._carouselEl,
+ { top: { to: offset } },
+ animCfg.speed, animCfg.effect);
+ } else {
+ animObj = new YAHOO.util.Motion(carousel._carouselEl,
+ { left: { to: offset } },
+ animCfg.speed, animCfg.effect);
+ }
+
+ carousel._isAnimationInProgress = true;
+ animObj.onComplete.subscribe(carousel._animationCompleteHandler,
+ { scope: carousel, item: item,
+ last: sentinel });
+ animObj.animate();
+ },
+
+ /**
+ * Handle the animation complete event.
+ *
+ * @method _animationCompleteHandler
+ * @param {Event} ev The event.
+ * @param {Array} p The event parameters.
+ * @param {Object} o The object that has the state of the Carousel
+ * @protected
+ */
+ _animationCompleteHandler: function (ev, p, o) {
+ o.scope._isAnimationInProgress = false;
+ updateStateAfterScroll.call(o.scope, o.item, o.last);
+ },
+
+ /**
+ * Automatically scroll the contents of the Carousel.
+ * @method _autoScroll
+ * @protected
+ */
+ _autoScroll: function() {
+ var carousel = this,
+ currIndex = carousel._firstItem,
+ index;
+
+ if (currIndex >= carousel.get("numItems") - 1) {
+ if (carousel.get("isCircular")) {
+ index = 0;
+ } else {
+ carousel.stopAutoPlay();
+ }
+ } else {
+ index = currIndex + carousel.get("numVisible");
+ }
+
+ carousel._selectedItem = carousel._getSelectedItem(index);
+ carousel.scrollTo.call(carousel, index);
+ },
+
+ /**
+ * Create the Carousel.
+ *
+ * @method createCarousel
+ * @param elId {String} The id of the element to be created
+ * @protected
+ */
+ _createCarousel: function (elId) {
+ var carousel = this,
+ cssClass = carousel.CLASSES,
+ el = Dom.get(elId);
+
+ if (!el) {
+ el = createElement("DIV", {
+ className : cssClass.CAROUSEL,
+ id : elId
+ });
+ }
+
+ if (!carousel._carouselEl) {
+ carousel._carouselEl=createElement(carousel.get("carouselEl"),
+ { className: cssClass.CAROUSEL_EL });
+ }
+
+ return el;
+ },
+
+ /**
+ * Create the Carousel clip container.
+ *
+ * @method createCarouselClip
+ * @protected
+ */
+ _createCarouselClip: function () {
+ return createElement("DIV", { className: this.CLASSES.CONTENT });
+ },
+
+ /**
+ * Create the Carousel item.
+ *
+ * @method createCarouselItem
+ * @param obj {Object} The attributes of the element to be created
+ * @protected
+ */
+ _createCarouselItem: function (obj) {
+ var attr, carousel = this,
+ styles = getCarouselItemPosition.call(carousel, obj.pos);
+
+ return createElement(carousel.get("carouselItemEl"), {
+ className : obj.className,
+ styles : obj.styles,
+ content : obj.content,
+ id : obj.id
+ });
+ },
+
+ /**
+ * Return a valid item for a possibly out of bounds index considering
+ * the isCircular property.
+ *
+ * @method _getValidIndex
+ * @param index {Number} The index of the item to be returned
+ * @return {Object} Return a valid item index
+ * @protected
+ */
+ _getValidIndex: function (index) {
+ var carousel = this,
+ isCircular = carousel.get("isCircular"),
+ numItems = carousel.get("numItems"),
+ numVisible = carousel.get("numVisible"),
+ sentinel = numItems - 1;
+
+ if (index < 0) {
+ index = isCircular ?
+ Math.ceil(numItems/numVisible)*numVisible + index : 0;
+ } else if (index > sentinel) {
+ index = isCircular ? 0 : sentinel;
+ }
+
+ return index;
+ },
+
+ /**
+ * Get the value for the selected item.
+ *
+ * @method _getSelectedItem
+ * @param val {Number} The new value for "selected" item
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _getSelectedItem: function (val) {
+ var carousel = this,
+ isCircular = carousel.get("isCircular"),
+ numItems = carousel.get("numItems"),
+ sentinel = numItems - 1;
+
+ if (val < 0) {
+ if (isCircular) {
+ val = numItems + val;
+ } else {
+ val = carousel.get("selectedItem");
+ }
+ } else if (val > sentinel) {
+ if (isCircular) {
+ val = val - numItems;
+ } else {
+ val = carousel.get("selectedItem");
+ }
+ }
+ return val;
+ },
+
+ /**
+ * The "click" handler for the item.
+ *
+ * @method _itemClickHandler
+ * @param {Event} ev The event object
+ * @protected
+ */
+ _itemClickHandler: function (ev) {
+ var carousel = this,
+ carouselItem = carousel.get("carouselItemEl"),
+ container = carousel.get("element"),
+ el,
+ item,
+ target = Event.getTarget(ev),
+ tag = target.tagName.toUpperCase();
+
+ if(tag === "INPUT" ||
+ tag === "SELECT" ||
+ tag === "TEXTAREA") {
+ return;
+ }
+
+ while (target && target != container &&
+ target.id != carousel._carouselEl) {
+ el = target.nodeName;
+ if (el.toUpperCase() == carouselItem) {
+ break;
+ }
+ target = target.parentNode;
+ }
+
+ if ((item = carousel.getItemPositionById(target.id)) >= 0) {
+ YAHOO.log("Setting selection to " + item, WidgetName);
+ carousel.set("selectedItem", carousel._getSelectedItem(item));
+ carousel.focus();
+ }
+ },
+
+ /**
+ * The keyboard event handler for Carousel.
+ *
+ * @method _keyboardEventHandler
+ * @param ev {Event} The event that is being handled.
+ * @protected
+ */
+ _keyboardEventHandler: function (ev) {
+ var carousel = this,
+ key = Event.getCharCode(ev),
+ target = Event.getTarget(ev),
+ prevent = false;
+
+ // do not mess while animation is in progress or naving via select
+ if (carousel.isAnimating() || target.tagName.toUpperCase() === "SELECT") {
+ return;
+ }
+
+ switch (key) {
+ case 0x25: // left arrow
+ case 0x26: // up arrow
+ carousel.selectPreviousItem();
+ prevent = true;
+ break;
+ case 0x27: // right arrow
+ case 0x28: // down arrow
+ carousel.selectNextItem();
+ prevent = true;
+ break;
+ case 0x21: // page-up
+ carousel.scrollPageBackward();
+ prevent = true;
+ break;
+ case 0x22: // page-down
+ carousel.scrollPageForward();
+ prevent = true;
+ break;
+ }
+
+ if (prevent) {
+ if (carousel.isAutoPlayOn()) {
+ carousel.stopAutoPlay();
+ }
+ Event.preventDefault(ev);
+ }
+ },
+
+ /**
+ * The load the required set of items that are needed for display.
+ *
+ * @method _loadItems
+ * @protected
+ */
+ _loadItems: function(last) {
+ var carousel = this,
+ numItems = carousel.get("numItems"),
+ numVisible = carousel.get("numVisible"),
+ reveal = carousel.get("revealAmount"),
+ first = carousel._itemsTable.items.length,
+ lastVisible = carousel.get("lastVisible");
+
+ // adjust if going backwards
+ if(first > last && last+1 >= numVisible){
+ // need to get first a bit differently for the last page
+ first = last % numVisible || last == lastVisible ? last - last % numVisible : last - numVisible + 1;
+ }
+
+ if(reveal && last < numItems - 1){ last++; }
+
+ if (last >= first && (!carousel.getItem(first) || !carousel.getItem(last))) {
+ carousel.fireEvent(loadItemsEvent, {
+ ev: loadItemsEvent, first: first, last: last,
+ num: last - first + 1
+ });
+ }
+
+ },
+
+ /**
+ * The "onchange" handler for select box pagination.
+ *
+ * @method _pagerChangeHandler
+ * @param {Event} ev The event object
+ * @protected
+ */
+ _pagerChangeHandler: function (ev) {
+ var carousel = this,
+ target = Event.getTarget(ev),
+ page = target.value,
+ item;
+
+ if (page) {
+ item = carousel.getFirstVisibleOnPage(page);
+ carousel._selectedItem = item;
+ carousel.scrollTo(item);
+ carousel.focus();
+ }
+ },
+ /**
+ * The "click" handler for anchor pagination.
+ *
+ * @method _pagerClickHandler
+ * @param {Event} ev The event object
+ * @protected
+ */
+ _pagerClickHandler: function (ev) {
+ var carousel = this,
+ css = carousel.CLASSES,
+ target = Event.getTarget(ev),
+ elNode = target.nodeName.toUpperCase(),
+ val,
+ stringIndex,
+ page,
+ item;
+
+ if (Dom.hasClass(target, css.PAGER_ITEM) || Dom.hasClass(target.parentNode, css.PAGER_ITEM)) {
+ if (elNode == "EM") {
+ target = target.parentNode;// item is an em and not an anchor (when text is visible)
+ }
+ val = target.href;
+ stringIndex = val.lastIndexOf("#");
+ page = parseInt(val.substring(stringIndex+1), 10);
+ if (page != -1) {
+ item = carousel.getFirstVisibleOnPage(page);
+ carousel._selectedItem = item;
+ carousel.scrollTo(item);
+ carousel.focus();
+ }
+ Event.preventDefault(ev);
+ }
+ },
+
+ /**
+ * Find the Carousel within a container. The Carousel is identified by
+ * the first element that matches the carousel element tag or the
+ * element that has the Carousel class.
+ *
+ * @method parseCarousel
+ * @param parent {HTMLElement} The parent element to look under
+ * @return {Boolean} True if Carousel is found, false otherwise
+ * @protected
+ */
+ _parseCarousel: function (parent) {
+ var carousel = this, child, cssClass, domEl, found, node;
+
+ cssClass = carousel.CLASSES;
+ domEl = carousel.get("carouselEl");
+ found = false;
+
+ for (child = parent.firstChild; child; child = child.nextSibling) {
+ if (child.nodeType == 1) {
+ node = child.nodeName;
+ if (node.toUpperCase() == domEl) {
+ carousel._carouselEl = child;
+ Dom.addClass(carousel._carouselEl,
+ carousel.CLASSES.CAROUSEL_EL);
+ YAHOO.log("Found Carousel - " + node +
+ (child.id ? " (#" + child.id + ")" : ""),
+ WidgetName);
+ found = true;
+ }
+ }
+ }
+
+ return found;
+ },
+
+ /**
+ * Find the items within the Carousel and add them to the items table.
+ * A Carousel item is identified by elements that matches the carousel
+ * item element tag.
+ *
+ * @method parseCarouselItems
+ * @protected
+ */
+ _parseCarouselItems: function () {
+ var carousel = this,
+ cssClass = carousel.CLASSES,
+ i=0,
+ rows,
+ child,
+ domItemEl,
+ elId,
+ node,
+ index = carousel.get("firstVisible"),
+ parent = carousel._carouselEl;
+
+ rows = carousel._rows;
+ domItemEl = carousel.get("carouselItemEl");
+
+ for (child = parent.firstChild; child; child = child.nextSibling) {
+ if (child.nodeType == 1) {
+ node = child.nodeName;
+ if (node.toUpperCase() == domItemEl) {
+ if (child.id) {
+ elId = child.id;
+ } else {
+ elId = Dom.generateId();
+ child.setAttribute("id", elId);
+ }
+ carousel.addItem(child,index);
+ index++;
+ }
+ }
+ }
+ },
+
+ /**
+ * Find the Carousel navigation within a container. The navigation
+ * elements need to match the carousel navigation class names.
+ *
+ * @method parseCarouselNavigation
+ * @param parent {HTMLElement} The parent element to look under
+ * @return {Boolean} True if at least one is found, false otherwise
+ * @protected
+ */
+ _parseCarouselNavigation: function (parent) {
+ var carousel = this,
+ cfg,
+ cssClass = carousel.CLASSES,
+ el,
+ i,
+ j,
+ nav,
+ rv = false;
+
+ nav = Dom.getElementsByClassName(cssClass.PREV_PAGE, "*", parent);
+ if (nav.length > 0) {
+ for (i in nav) {
+ if (nav.hasOwnProperty(i)) {
+ el = nav[i];
+ YAHOO.log("Found Carousel previous page navigation - " +
+ el + (el.id ? " (#" + el.id + ")" : ""),
+ WidgetName);
+ if (el.nodeName == "INPUT" ||
+ el.nodeName == "BUTTON" ||
+ el.nodeName == "A") {// Anchor support in Nav (for SEO)
+ carousel._navBtns.prev.push(el);
+ } else {
+ j = el.getElementsByTagName("INPUT");
+ if (JS.isArray(j) && j.length > 0) {
+ carousel._navBtns.prev.push(j[0]);
+ } else {
+ j = el.getElementsByTagName("BUTTON");
+ if (JS.isArray(j) && j.length > 0) {
+ carousel._navBtns.prev.push(j[0]);
+ }
+ }
+ }
+ }
+ }
+ cfg = { prev: nav };
+ }
+
+ nav = Dom.getElementsByClassName(cssClass.NEXT_PAGE, "*", parent);
+ if (nav.length > 0) {
+ for (i in nav) {
+ if (nav.hasOwnProperty(i)) {
+ el = nav[i];
+ YAHOO.log("Found Carousel next page navigation - " +
+ el + (el.id ? " (#" + el.id + ")" : ""),
+ WidgetName);
+ if (el.nodeName == "INPUT" ||
+ el.nodeName == "BUTTON" ||
+ el.nodeName == "A") {// Anchor support in Nav (for SEO)
+ carousel._navBtns.next.push(el);
+ } else {
+ j = el.getElementsByTagName("INPUT");
+ if (JS.isArray(j) && j.length > 0) {
+ carousel._navBtns.next.push(j[0]);
+ } else {
+ j = el.getElementsByTagName("BUTTON");
+ if (JS.isArray(j) && j.length > 0) {
+ carousel._navBtns.next.push(j[0]);
+ }
+ }
+ }
+ }
+ }
+ if (cfg) {
+ cfg.next = nav;
+ } else {
+ cfg = { next: nav };
+ }
+ }
+
+ if (cfg) {
+ carousel.set("navigation", cfg);
+ rv = true;
+ }
+
+ return rv;
+ },
+
+ /**
+ * Refresh the widget UI if it is not already rendered, on first item
+ * addition.
+ *
+ * @method _refreshUi
+ * @protected
+ */
+ _refreshUi: function () {
+ var carousel = this, i, isVertical = carousel.get("isVertical"), firstVisible = carousel.get("firstVisible"), item, n, rsz, sz;
+
+ if (carousel._itemsTable.numItems < 1) {
+ return;
+ }
+
+ sz = getCarouselItemSize.call(carousel,
+ isVertical ? "height" : "width");
+ // This fixes the widget to auto-adjust height/width for absolute
+ // positioned children.
+ item = carousel._itemsTable.items[firstVisible].id;
+
+ sz = isVertical ? getStyle(item, "width") :
+ getStyle(item, "height");
+
+ Dom.setStyle(carousel._carouselEl,
+ isVertical ? "width" : "height", sz + "px");
+
+ // Set the rendered state appropriately.
+ carousel._hasRendered = true;
+ carousel.fireEvent(renderEvent);
+ },
+
+ /**
+ * Set the Carousel offset to the passed offset.
+ *
+ * @method _setCarouselOffset
+ * @protected
+ */
+ _setCarouselOffset: function (offset) {
+ var carousel = this, which;
+
+ which = carousel.get("isVertical") ? "top" : "left";
+ Dom.setStyle(carousel._carouselEl, which, offset + "px");
+ },
+
+ /**
+ * Setup/Create the Carousel navigation element (if needed).
+ *
+ * @method _setupCarouselNavigation
+ * @protected
+ */
+ _setupCarouselNavigation: function () {
+ var carousel = this,
+ btn, cfg, cssClass, nav, navContainer, nextButton, prevButton;
+
+ cssClass = carousel.CLASSES;
+
+ // TODO: can the _navBtns be tested against instead?
+ navContainer = Dom.getElementsByClassName(cssClass.NAVIGATION,
+ "DIV", carousel.get("element"));
+
+ if (navContainer.length === 0) {
+ navContainer = createElement("DIV",
+ { className: cssClass.NAVIGATION });
+ carousel.insertBefore(navContainer,
+ Dom.getFirstChild(carousel.get("element")));
+ } else {
+ navContainer = navContainer[0];
+ }
+
+ carousel._pages.el = createElement("UL");
+ navContainer.appendChild(carousel._pages.el);
+
+ nav = carousel.get("navigation");
+ if (JS.isString(nav.prev) || JS.isArray(nav.prev)) {
+ if (JS.isString(nav.prev)) {
+ nav.prev = [nav.prev];
+ }
+ for (btn in nav.prev) {
+ if (nav.prev.hasOwnProperty(btn)) {
+ carousel._navBtns.prev.push(Dom.get(nav.prev[btn]));
+ }
+ }
+ } else {
+ // TODO: separate method for creating a navigation button
+ prevButton = createElement("SPAN",
+ { className: cssClass.BUTTON + cssClass.FIRST_NAV });
+ // XXX: for IE 6.x
+ Dom.setStyle(prevButton, "visibility", "visible");
+ btn = Dom.generateId();
+ prevButton.innerHTML = "" +
+ carousel.STRINGS.PREVIOUS_BUTTON_TEXT + " ";
+ navContainer.appendChild(prevButton);
+ btn = Dom.get(btn);
+ carousel._navBtns.prev = [btn];
+ cfg = { prev: [prevButton] };
+ }
+
+ if (JS.isString(nav.next) || JS.isArray(nav.next)) {
+ if (JS.isString(nav.next)) {
+ nav.next = [nav.next];
+ }
+ for (btn in nav.next) {
+ if (nav.next.hasOwnProperty(btn)) {
+ carousel._navBtns.next.push(Dom.get(nav.next[btn]));
+ }
+ }
+ } else {
+ // TODO: separate method for creating a navigation button
+ nextButton = createElement("SPAN",
+ { className: cssClass.BUTTON + cssClass.NEXT_NAV });
+ // XXX: for IE 6.x
+ Dom.setStyle(nextButton, "visibility", "visible");
+ btn = Dom.generateId();
+ nextButton.innerHTML = "" +
+ carousel.STRINGS.NEXT_BUTTON_TEXT + " ";
+ navContainer.appendChild(nextButton);
+ btn = Dom.get(btn);
+ carousel._navBtns.next = [btn];
+ if (cfg) {
+ cfg.next = [nextButton];
+ } else {
+ cfg = { next: [nextButton] };
+ }
+ }
+
+ if (cfg) {
+ carousel.set("navigation", cfg);
+ }
+
+ return navContainer;
+ },
+
+ /**
+ * Set the clip container size (based on the new numVisible value).
+ *
+ * @method _setClipContainerSize
+ * @param clip {HTMLElement} The clip container element.
+ * @param num {Number} optional The number of items per page.
+ * @protected
+ */
+ _setClipContainerSize: function (clip, num) {
+ var carousel = this,
+ isVertical = carousel.get("isVertical"),
+ rows = carousel._rows,
+ cols = carousel._cols,
+ reveal = carousel.get("revealAmount"),
+ itemHeight = getCarouselItemSize.call(carousel, "height"),
+ itemWidth = getCarouselItemSize.call(carousel, "width"),
+ containerHeight,
+ containerWidth;
+
+ clip = clip || carousel._clipEl;
+
+ if (rows) {
+ containerHeight = itemHeight * rows;
+ containerWidth = itemWidth * cols;
+ } else {
+ num = num || carousel.get("numVisible");
+ if (isVertical) {
+ containerHeight = itemHeight * num;
+ } else {
+ containerWidth = itemWidth * num;
+ }
+ }
+
+ // TODO: try to re-use the _hasRendered indicator
+
+ carousel._recomputeSize = (containerHeight === 0); // bleh!
+ if (carousel._recomputeSize) {
+ carousel._hasRendered = false;
+ return; // no use going further, bail out!
+ }
+
+ reveal = getRevealSize.call(carousel);
+ if (isVertical) {
+ containerHeight += (reveal * 2);
+ } else {
+ containerWidth += (reveal * 2);
+ }
+
+ if (isVertical) {
+ containerHeight += getDimensions(carousel._carouselEl,"height");
+ Dom.setStyle(clip, "height", containerHeight + "px");
+ // For multi-row Carousel
+ if (cols) {
+ containerWidth += getDimensions(carousel._carouselEl,
+ "width");
+ Dom.setStyle(clip, "width", containerWidth + (0) + "px");
+ }
+ } else {
+ containerWidth += getDimensions(carousel._carouselEl, "width");
+ Dom.setStyle(clip, "width", containerWidth + "px");
+ // For multi-row Carousel
+ if (rows) {
+ containerHeight += getDimensions(carousel._carouselEl,
+ "height");
+ Dom.setStyle(clip, "height", containerHeight + "px");
+ }
+ }
+
+ carousel._setContainerSize(clip); // adjust the container size too
+ },
+
+ /**
+ * Set the container size.
+ *
+ * @method _setContainerSize
+ * @param clip {HTMLElement} The clip container element.
+ * @param attr {String} Either set the height or width.
+ * @protected
+ */
+ _setContainerSize: function (clip, attr) {
+ var carousel = this,
+ config = carousel.CONFIG,
+ cssClass = carousel.CLASSES,
+ isVertical,
+ rows,
+ cols,
+ size;
+
+ isVertical = carousel.get("isVertical");
+ rows = carousel._rows;
+ cols = carousel._cols;
+ clip = clip || carousel._clipEl;
+ attr = attr || (isVertical ? "height" : "width");
+ size = parseFloat(Dom.getStyle(clip, attr), 10);
+
+ size = JS.isNumber(size) ? size : 0;
+
+ if (isVertical) {
+ size += getDimensions(carousel._carouselEl, "height") +
+ getStyle(carousel._navEl, "height");
+ } else {
+ size += getDimensions(carousel._carouselEl, "width");
+ }
+
+ if (!isVertical) {
+ if (size < config.HORZ_MIN_WIDTH) {
+ size = config.HORZ_MIN_WIDTH;
+ carousel.addClass(cssClass.MIN_WIDTH);
+ }
+ }
+ carousel.setStyle(attr, size + "px");
+
+ // Additionally the width of the container should be set for
+ // the vertical Carousel
+ if (isVertical) {
+ size = getCarouselItemSize.call(carousel, "width");
+ if(cols) {
+ size = size * cols;
+ }
+ Dom.setStyle(carousel._carouselEl, "width", size + "px");// Bug fix for vertical carousel (goes in conjunction with .yui-carousel-element {... 3200px removed from styles), and allows for multirows in IEs).
+ if (size < config.VERT_MIN_WIDTH) {
+ size = config.VERT_MIN_WIDTH;
+ carousel.addClass(cssClass.MIN_WIDTH);// set a min width on vertical carousel, don't see why this shouldn't always be set...
+ }
+ carousel.setStyle("width", size + "px");
+ } else {
+ if(rows) {
+ size = getCarouselItemSize.call(carousel, "height");
+ size = size * rows;
+ Dom.setStyle(carousel._carouselEl, "height", size + "px");
+ }
+ }
+ },
+
+ /**
+ * Set the value for the Carousel's first visible item.
+ *
+ * @method _setFirstVisible
+ * @param val {Number} The new value for firstVisible
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _setFirstVisible: function (val) {
+ var carousel = this;
+
+ if (val >= 0 && val < carousel.get("numItems")) {
+ carousel.scrollTo(val);
+ } else {
+ val = carousel.get("firstVisible");
+ }
+ return val;
+ },
+
+ /**
+ * Set the value for the Carousel's navigation.
+ *
+ * @method _setNavigation
+ * @param cfg {Object} The navigation configuration
+ * @return {Object} The new value that would be set
+ * @protected
+ */
+ _setNavigation: function (cfg) {
+ var carousel = this;
+
+ if (cfg.prev) {
+ Event.on(cfg.prev, "click", scrollPageBackward, carousel);
+ }
+ if (cfg.next) {
+ Event.on(cfg.next, "click", scrollPageForward, carousel);
+ }
+ },
+
+ /**
+ * Clip the container size every time numVisible is set.
+ *
+ * @method _setNumVisible
+ * @param val {Number} The new value for numVisible
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _setNumVisible: function (val) { // TODO: _setNumVisible should just be reserved for setting numVisible.
+ var carousel = this;
+
+ carousel._setClipContainerSize(carousel._clipEl, val);
+ },
+
+ /**
+ * Set the value for the number of visible items in the Carousel.
+ *
+ * @method _numVisibleSetter
+ * @param val {Number} The new value for numVisible
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _numVisibleSetter: function (val) {
+ var carousel = this,
+ numVisible = val;
+
+ if(JS.isArray(val)) {
+ carousel._cols = val[0];
+ carousel._rows = val[1];
+ numVisible = val[0] * val[1];
+ }
+ return numVisible;
+ },
+
+ /**
+ * Set the value for selectedItem.
+ *
+ * @method _selectedItemSetter
+ * @param val {Number} The new value for selectedItem
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _selectedItemSetter: function (val) {
+ var carousel = this;
+ return (val < carousel.get("numItems")) ? val : 0;
+ },
+
+ /**
+ * Set the number of items in the Carousel.
+ * Warning: Setting this to a lower number than the current removes
+ * items from the end.
+ *
+ * @method _setNumItems
+ * @param val {Number} The new value for numItems
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _setNumItems: function (val) {
+ var carousel = this,
+ num = carousel._itemsTable.numItems;
+
+ if (JS.isArray(carousel._itemsTable.items)) {
+ if (carousel._itemsTable.items.length != num) { // out of sync
+ num = carousel._itemsTable.items.length;
+ carousel._itemsTable.numItems = num;
+ }
+ }
+
+ if (val < num) {
+ while (num > val) {
+ carousel.removeItem(num - 1);
+ num--;
+ }
+ }
+
+ return val;
+ },
+
+ /**
+ * Set the orientation of the Carousel.
+ *
+ * @method _setOrientation
+ * @param val {Boolean} The new value for isVertical
+ * @return {Boolean} The new value that would be set
+ * @protected
+ */
+ _setOrientation: function (val) {
+ var carousel = this,
+ cssClass = carousel.CLASSES;
+
+ if (val) {
+ carousel.replaceClass(cssClass.HORIZONTAL, cssClass.VERTICAL);
+ } else {
+ carousel.replaceClass(cssClass.VERTICAL, cssClass.HORIZONTAL);
+ }
+ this._itemAttrCache = {}; // force recomputed next time
+
+ return val;
+ },
+
+ /**
+ * Set the value for the reveal amount percentage in the Carousel.
+ *
+ * @method _setRevealAmount
+ * @param val {Number} The new value for revealAmount
+ * @return {Number} The new value that would be set
+ * @protected
+ */
+ _setRevealAmount: function (val) {
+ var carousel = this;
+
+ if (val >= 0 && val <= 100) {
+ val = parseInt(val, 10);
+ val = JS.isNumber(val) ? val : 0;
+ carousel._setClipContainerSize();
+ } else {
+ val = carousel.get("revealAmount");
+ }
+ return val;
+ },
+
+ /**
+ * Set the value for the selected item.
+ *
+ * @method _setSelectedItem
+ * @param val {Number} The new value for "selected" item
+ * @protected
+ */
+ _setSelectedItem: function (val) {
+ this._selectedItem = val;
+ },
+
+ /**
+ * Get the total number of pages.
+ *
+ * @method _getNumPages
+ * @protected
+ */
+ _getNumPages: function () {
+ return Math.ceil(
+ parseInt(this.get("numItems"),10) / parseInt(this.get("numVisible"),10)
+ );
+ },
+
+ /**
+ * Get the index of the last visible item
+ *
+ * @method _getLastVisible
+ * @protected
+ */
+ _getLastVisible: function () {
+ var carousel = this;
+ return carousel.get("currentPage") + 1 == carousel.get("numPages") ?
+ carousel.get("numItems") - 1:
+ carousel.get("firstVisible") + carousel.get("numVisible") - 1;
+ },
+
+ /**
+ * Synchronize and redraw the UI after an item is added.
+ *
+ * @method _syncUiForItemAdd
+ * @protected
+ */
+ _syncUiForItemAdd: function (obj) {
+ var attr,
+ carousel = this,
+ carouselEl = carousel._carouselEl,
+ el,
+ item,
+ itemsTable = carousel._itemsTable,
+ oel,
+ pos,
+ sibling,
+ styles;
+
+ pos = JS.isUndefined(obj.pos) ?
+ obj.newPos || itemsTable.numItems - 1 : obj.pos;
+
+ if (!oel) {
+ item = itemsTable.items[pos] || {};
+ el = carousel._createCarouselItem({
+ className : item.className,
+ styles : item.styles,
+ content : item.item,
+ id : item.id,
+ pos : pos
+ });
+ if (JS.isUndefined(obj.pos)) {
+ if (!JS.isUndefined(itemsTable.loading[pos])) {
+ oel = itemsTable.loading[pos];
+ // if oel is null, it is a problem ...
+ }
+ if (oel) {
+ // replace the node
+ carouselEl.replaceChild(el, oel);
+ // ... and remove the item from the data structure
+ delete itemsTable.loading[pos];
+ } else {
+ carouselEl.appendChild(el);
+ }
+ } else {
+ if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) {
+ sibling = Dom.get(itemsTable.items[obj.pos + 1].id);
+ }
+ if (sibling) {
+ carouselEl.insertBefore(el, sibling);
+ } else {
+ YAHOO.log("Unable to find sibling","error",WidgetName);
+ }
+ }
+ } else {
+ if (JS.isUndefined(obj.pos)) {
+ if (!Dom.isAncestor(carousel._carouselEl, oel)) {
+ carouselEl.appendChild(oel);
+ }
+ } else {
+ if (!Dom.isAncestor(carouselEl, oel)) {
+ if (!JS.isUndefined(itemsTable.items[obj.pos + 1])) {
+ carouselEl.insertBefore(oel,
+ Dom.get(itemsTable.items[obj.pos + 1].id));
+ }
+ }
+ }
+ }
+
+ if (!carousel._hasRendered) {
+ carousel._refreshUi();
+ }
+
+ if (carousel.get("selectedItem") < 0) {
+ carousel.set("selectedItem", carousel.get("firstVisible"));
+ }
+
+ carousel._syncUiItems();
+ },
+
+ /**
+ * Synchronize and redraw the UI after an item is replaced.
+ *
+ * @method _syncUiForItemReplace
+ * @protected
+ */
+ _syncUiForItemReplace: function (o) {
+ var carousel = this,
+ carouselEl = carousel._carouselEl,
+ itemsTable = carousel._itemsTable,
+ pos = o.pos,
+ item = o.newItem,
+ oel = o.oldItem,
+ el;
+
+ el = carousel._createCarouselItem({
+ className : item.className,
+ styles : item.styles,
+ content : item.item,
+ id : item.id,
+ pos : pos
+ });
+
+ if(el && oel) {
+ Event.purgeElement(oel, true);
+ carouselEl.replaceChild(el, Dom.get(oel.id));
+ if (!JS.isUndefined(itemsTable.loading[pos])) {
+ itemsTable.numItems++;
+ delete itemsTable.loading[pos];
+ }
+ }
+ // TODO: should we add the item if oel is undefined?
+
+ if (!carousel._hasRendered) {
+ carousel._refreshUi();
+ }
+
+ carousel._syncUiItems();
+ },
+
+ /**
+ * Synchronize and redraw the UI after an item is removed.
+ *
+ * @method _syncUiForItemAdd
+ * @protected
+ */
+ _syncUiForItemRemove: function (obj) {
+ var carousel = this,
+ carouselEl = carousel._carouselEl,
+ el, item, num, pos;
+
+ num = carousel.get("numItems");
+ item = obj.item;
+ pos = obj.pos;
+
+ if (item && (el = Dom.get(item.id))) {
+ if (el && Dom.isAncestor(carouselEl, el)) {
+ Event.purgeElement(el, true);
+ carouselEl.removeChild(el);
+ }
+
+ if (carousel.get("selectedItem") == pos) {
+ pos = pos >= num ? num - 1 : pos;
+ }
+ } else {
+ YAHOO.log("Unable to find item", "warn", WidgetName);
+ }
+
+ carousel._syncUiItems();
+ },
+
+ /**
+ * Synchronize and redraw the UI for lazy loading.
+ *
+ * @method _syncUiForLazyLoading
+ * @protected
+ */
+ _syncUiForLazyLoading: function (obj) {
+ var carousel = this,
+ carouselEl = carousel._carouselEl,
+ itemsTable = carousel._itemsTable,
+ len = itemsTable.items.length,
+ sibling = itemsTable.items[obj.last + 1],
+ el,
+ j;
+
+ // attempt to find the next closest sibling
+ if(!sibling && obj.last < len){
+ j = obj.first;
+ do {
+ sibling = itemsTable.items[j];
+ j++;
+ } while (j" +
+ carousel.STRINGS.PAGER_PREFIX_TEXT + " " + (i+1) +
+ " ";
+ el.innerHTML = html;
+
+ pager.appendChild(el);
+ }
+
+ // Show the pager now
+ Dom.setStyle(pager, "visibility", "visible");
+ },
+
+ /**
+ * Update the UI for the pager menu based on the current page and
+ * the number of pages. If the number of pages is greater than
+ * MAX_PAGER_BUTTONS, then the selection of pages is provided by a drop
+ * down menu instead of a set of buttons.
+ *
+ * @method _updatePagerMenu
+ * @protected
+ */
+ _updatePagerMenu: function () {
+ var carousel = this,
+ css = carousel.CLASSES,
+ cur = carousel._pages.cur, // current page
+ el,
+ i,
+ item,
+ n = carousel.get("numVisible"),
+ num = carousel._pages.num, // total pages
+ pager = carousel._pages.el, // the pager container element
+ sel;
+
+ if (num === 0) {
+ return;// don't do anything if number of pages is 0
+ }
+
+ sel = document.createElement("SELECT");
+
+
+ if (!sel) {
+ YAHOO.log("Unable to create the pager menu", "error",
+ WidgetName);
+ return;
+ }
+
+ // Hide the pager before redrawing it
+ Dom.setStyle(pager, "visibility", "hidden");
+
+ // Remove all nodes from the pager
+ while (pager.firstChild) {
+ pager.removeChild(pager.firstChild);
+ }
+
+ for (i = 0; i < num; i++) {
+
+ el = document.createElement("OPTION");
+ el.value = i+1;
+ el.innerHTML = carousel.STRINGS.PAGER_PREFIX_TEXT+" "+(i+1);
+
+ if (i == cur) {
+ el.setAttribute("selected", "selected");
+ }
+
+ sel.appendChild(el);
+ }
+
+ el = document.createElement("FORM");
+ if (!el) {
+ YAHOO.log("Unable to create the pager menu", "error",
+ WidgetName);
+ } else {
+ el.appendChild(sel);
+ pager.appendChild(el);
+ }
+
+ // Show the pager now
+ Event.addListener(sel, "change", carousel._pagerChangeHandler, this, true);
+ Dom.setStyle(pager, "visibility", "visible");
+ },
+
+ /**
+ * Set the correct tab index for the Carousel items.
+ *
+ * @method _updateTabIndex
+ * @param el {Object} The element to be focussed
+ * @protected
+ */
+ _updateTabIndex: function (el) {
+ var carousel = this;
+
+ if (el) {
+ if (carousel._focusableItemEl) {
+ carousel._focusableItemEl.tabIndex = -1;
+ }
+ carousel._focusableItemEl = el;
+ el.tabIndex = 0;
+ }
+ },
+
+ /**
+ * Validate animation parameters.
+ *
+ * @method _validateAnimation
+ * @param cfg {Object} The animation configuration
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateAnimation: function (cfg) {
+ var rv = true;
+
+ if (JS.isObject(cfg)) {
+ if (cfg.speed) {
+ rv = rv && JS.isNumber(cfg.speed);
+ }
+ if (cfg.effect) {
+ rv = rv && JS.isFunction(cfg.effect);
+ } else if (!JS.isUndefined(YAHOO.util.Easing)) {
+ cfg.effect = YAHOO.util.Easing.easeOut;
+ }
+ } else {
+ rv = false;
+ }
+
+ return rv;
+ },
+
+ /**
+ * Validate the firstVisible value.
+ *
+ * @method _validateFirstVisible
+ * @param val {Number} The first visible value
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateFirstVisible: function (val) {
+ var carousel = this, numItems = carousel.get("numItems");
+
+ if (JS.isNumber(val)) {
+ if (numItems === 0 && val == numItems) {
+ return true;
+ } else {
+ return (val >= 0 && val < numItems);
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Validate and navigation parameters.
+ *
+ * @method _validateNavigation
+ * @param cfg {Object} The navigation configuration
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateNavigation : function (cfg) {
+ var i;
+
+ if (!JS.isObject(cfg)) {
+ return false;
+ }
+
+ if (cfg.prev) {
+ if (!JS.isArray(cfg.prev)) {
+ return false;
+ }
+ for (i in cfg.prev) {
+ if (cfg.prev.hasOwnProperty(i)) {
+ if (!JS.isString(cfg.prev[i].nodeName)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ if (cfg.next) {
+ if (!JS.isArray(cfg.next)) {
+ return false;
+ }
+ for (i in cfg.next) {
+ if (cfg.next.hasOwnProperty(i)) {
+ if (!JS.isString(cfg.next[i].nodeName)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Validate the numItems value.
+ *
+ * @method _validateNumItems
+ * @param val {Number} The numItems value
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateNumItems: function (val) {
+ return JS.isNumber(val) && (val >= 0);
+ },
+
+ /**
+ * Validate the numVisible value.
+ *
+ * @method _validateNumVisible
+ * @param val {Number} The numVisible value
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateNumVisible: function (val) {
+ var rv = false;
+
+ if (JS.isNumber(val)) {
+ rv = val > 0 && val <= this.get("numItems");
+ } else if (JS.isArray(val)) {
+ if (JS.isNumber(val[0]) && JS.isNumber(val[1])) {
+ rv = val[0] * val[1] > 0 && val.length == 2;
+ }
+ }
+
+ return rv;
+ },
+
+ /**
+ * Validate the revealAmount value.
+ *
+ * @method _validateRevealAmount
+ * @param val {Number} The revealAmount value
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateRevealAmount: function (val) {
+ var rv = false;
+
+ if (JS.isNumber(val)) {
+ rv = val >= 0 && val < 100;
+ }
+
+ return rv;
+ },
+
+ /**
+ * Validate the scrollIncrement value.
+ *
+ * @method _validateScrollIncrement
+ * @param val {Number} The scrollIncrement value
+ * @return {Boolean} The status of the validation
+ * @protected
+ */
+ _validateScrollIncrement: function (val) {
+ var rv = false;
+
+ if (JS.isNumber(val)) {
+ rv = (val > 0 && val < this.get("numItems"));
+ }
+
+ return rv;
+ }
+
+ });
+
+})();
+/*
+;; Local variables: **
+;; mode: js2 **
+;; indent-tabs-mode: nil **
+;; End: **
+*/
+YAHOO.register("carousel", YAHOO.widget.Carousel, {version: "2.8.0r4", build: "2449"});
diff --git a/lib/yui/2.8.0r4/carousel/carousel-min.js b/lib/yui/2.8.0r4/carousel/carousel-min.js
new file mode 100644
index 0000000000..ec1d60809b
--- /dev/null
+++ b/lib/yui/2.8.0r4/carousel/carousel-min.js
@@ -0,0 +1,12 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+(function(){var P;YAHOO.widget.Carousel=function(s,r){YAHOO.widget.Carousel.superclass.constructor.call(this,s,r);};var U=YAHOO.widget.Carousel,e=YAHOO.util.Dom,c=YAHOO.util.Event,p=YAHOO.lang;P="Carousel";var T={},F="afterScroll",g="allItemsRemoved",b="beforeHide",J="beforePageChange",i="beforeScroll",Y="beforeShow",B="blur",X="focus",a="hide",S="itemAdded",o="itemRemoved",Q="itemReplaced",C="itemSelected",L="loadItems",I="navigationStateChange",h="pageChange",H="render",V="show",Z="startAutoPlay",q="stopAutoPlay",K="uiUpdate";function G(r,s){var t;for(t in s){if(s.hasOwnProperty(t)){e.setStyle(r,t,s[t]);}}}function W(s,r){var t=document.createElement(s);r=r||{};if(r.className){e.addClass(t,r.className);}if(r.styles){G(t,r.styles);}if(r.parent){r.parent.appendChild(t);}if(r.id){t.setAttribute("id",r.id);}if(r.content){if(r.content.nodeName){t.appendChild(r.content);}else{t.innerHTML=r.content;}}return t;}function d(t,s,r){var v;if(!t){return 0;}function u(y,x){var z;if(x=="marginRight"&&YAHOO.env.ua.webkit){z=parseInt(e.getStyle(y,"marginLeft"),10);}else{z=parseInt(e.getStyle(y,x),10);}return p.isNumber(z)?z:0;}function w(y,x){var z;if(x=="marginRight"&&YAHOO.env.ua.webkit){z=parseFloat(e.getStyle(y,"marginLeft"));}else{z=parseFloat(e.getStyle(y,x));}return p.isNumber(z)?z:0;}if(typeof r=="undefined"){r="int";}switch(s){case"height":v=t.offsetHeight;if(v>0){v+=u(t,"marginTop")+u(t,"marginBottom");}else{v=w(t,"height")+u(t,"marginTop")+u(t,"marginBottom")+u(t,"borderTopWidth")+u(t,"borderBottomWidth")+u(t,"paddingTop")+u(t,"paddingBottom");}break;case"width":v=t.offsetWidth;if(v>0){v+=u(t,"marginLeft")+u(t,"marginRight");}else{v=w(t,"width")+u(t,"marginLeft")+u(t,"marginRight")+u(t,"borderLeftWidth")+u(t,"borderRightWidth")+u(t,"paddingLeft")+u(t,"paddingRight");}break;default:if(r=="int"){v=u(t,s);}else{if(r=="float"){v=w(t,s);}else{v=e.getStyle(t,s);}}break;}return v;}function O(w){var u=this,x,t,s=0,v=u.get("firstVisible"),r=false;if(u._itemsTable.numItems===0){return 0;}t=u._itemsTable.items[v]||u._itemsTable.loading[v];if(p.isUndefined(t)){return 0;}x=e.get(t.id);if(typeof w=="undefined"){r=u.get("isVertical");}else{r=w=="height";}if(this._itemAttrCache[w]){return this._itemAttrCache[w];}if(r){s=d(x,"height");}else{s=d(x,"width");}this._itemAttrCache[w]=s;return s;}function N(){var s=this,t,r;t=s.get("isVertical");r=O.call(s,t?"height":"width");return(r*s.get("revealAmount")/100);}function m(w){var AH=this,z=AH._cols,v=AH._rows,u,AC,AB,t,x,AD,AJ=0,AE,s,AG,AA={},y=0,AI=AH._itemsTable,AF=AI.items,r=AI.loading;AB=AH.get("isVertical");AC=O.call(AH,AB?"height":"width");AG=N.call(AH);while(y=0&&vu){w=D.call(AA,w);AA.scrollTo(w);}}function l(){var t=false,w=this,s=w.CLASSES,v,r,u;if(!w._hasRendered){return;}r=w.get("navigation");u=w._firstItem+w.get("numVisible");if(r.prev){if(w.get("numItems")===0||w._firstItem===0){if(w.get("numItems")===0||!w.get("isCircular")){c.removeListener(r.prev,"click",f);e.addClass(r.prev,s.FIRST_NAV_DISABLED);for(v=0;v=w.get("numItems")){if(!w.get("isCircular")){c.removeListener(r.next,"click",k);e.addClass(r.next,s.DISABLED);for(v=0;vu.CONFIG.MAX_PAGER_BUTTONS){u._updatePagerMenu();}else{u._updatePagerButtons();}}function M(r,s){switch(s){case"height":return d(r,"marginTop")+d(r,"marginBottom")+d(r,"paddingTop")+d(r,"paddingBottom")+d(r,"borderTopWidth")+d(r,"borderBottomWidth");case"width":return d(r,"marginLeft")+d(r,"marginRight")+d(r,"paddingLeft")+d(r,"paddingRight")+d(r,"borderLeftWidth")+d(r,"borderRightWidth");default:break;}return d(r,s);}function A(s){var r=this;if(!p.isObject(s)){return;}switch(s.ev){case S:r._syncUiForItemAdd(s);break;case o:r._syncUiForItemRemove(s);break;case Q:r._syncUiForItemReplace(s);break;case L:r._syncUiForLazyLoading(s);break;}r.fireEvent(K);}function E(u,s){var w=this,v=w.get("currentPage"),t,r=w.get("numVisible");
+t=parseInt(w._firstItem/r,10);if(t!=v){w.setAttributeConfig("currentPage",{value:t});w.fireEvent(h,t);}if(w.get("selectOnScroll")){if(w.get("selectedItem")!=w._selectedItem){w.set("selectedItem",w._selectedItem);}}clearTimeout(w._autoPlayTimer);delete w._autoPlayTimer;if(w.isAutoPlayOn()){w.startAutoPlay();}w.fireEvent(F,{first:w._firstItem,last:s},w);}U.getById=function(r){return T[r]?T[r].object:false;};YAHOO.extend(U,YAHOO.util.Element,{_rows:null,_cols:null,_animObj:null,_carouselEl:null,_clipEl:null,_firstItem:0,_hasFocus:false,_hasRendered:false,_isAnimationInProgress:false,_isAutoPlayInProgress:false,_itemsTable:null,_navBtns:null,_navEl:null,_nextEnabled:true,_pages:null,_pagination:{},_prevEnabled:true,_recomputeSize:true,_itemAttrCache:{},CLASSES:{BUTTON:"yui-carousel-button",CAROUSEL:"yui-carousel",CAROUSEL_EL:"yui-carousel-element",CONTAINER:"yui-carousel-container",CONTENT:"yui-carousel-content",DISABLED:"yui-carousel-button-disabled",FIRST_NAV:" yui-carousel-first-button",FIRST_NAV_DISABLED:"yui-carousel-first-button-disabled",FIRST_PAGE:"yui-carousel-nav-first-page",FOCUSSED_BUTTON:"yui-carousel-button-focus",HORIZONTAL:"yui-carousel-horizontal",ITEM_LOADING:"yui-carousel-item-loading",MIN_WIDTH:"yui-carousel-min-width",NAVIGATION:"yui-carousel-nav",NEXT_NAV:" yui-carousel-next-button",NEXT_PAGE:"yui-carousel-next",NAV_CONTAINER:"yui-carousel-buttons",PAGER_ITEM:"yui-carousel-pager-item",PAGINATION:"yui-carousel-pagination",PAGE_FOCUS:"yui-carousel-nav-page-focus",PREV_PAGE:"yui-carousel-prev",SELECTED_ITEM:"yui-carousel-item-selected",SELECTED_NAV:"yui-carousel-nav-page-selected",VERTICAL:"yui-carousel-vertical",MULTI_ROW:"yui-carousel-multi-row",ROW:"yui-carousel-row",VERTICAL_CONTAINER:"yui-carousel-vertical-container",VISIBLE:"yui-carousel-visible"},CONFIG:{FIRST_VISIBLE:0,HORZ_MIN_WIDTH:180,MAX_PAGER_BUTTONS:5,VERT_MIN_WIDTH:115,NUM_VISIBLE:3},STRINGS:{ITEM_LOADING_CONTENT:"Loading",NEXT_BUTTON_TEXT:"Next Page",PAGER_PREFIX_TEXT:"Go to page ",PREVIOUS_BUTTON_TEXT:"Previous Page"},addItem:function(y,s){var x=this,u,t,r,z=0,w,v=x.get("numItems");if(!y){return false;}if(p.isString(y)||y.nodeName){t=y.nodeName?y.innerHTML:y;}else{if(p.isObject(y)){t=y.content;}else{return false;}}u=y.className||"";r=y.id?y.id:e.generateId();if(p.isUndefined(s)){x._itemsTable.items.push({item:t,className:u,id:r});w=x._itemsTable.items.length-1;}else{if(s<0||s>v){return false;}if(!x._itemsTable.items[s]){x._itemsTable.items[s]=undefined;z=1;}x._itemsTable.items.splice(s,z,{item:t,className:u,id:r});}x._itemsTable.numItems++;if(v0){if(!r.removeItem(0)){}if(r._itemsTable.numItems===0){r.set("numItems",0);break;}s--;}r.fireEvent(g);},focus:function(){var AA=this,v,w,x,u,z,AB,s,t,r;if(!AA._hasRendered){return;}if(AA.isAnimating()){return;}r=AA.get("selectedItem");AB=AA.get("numVisible");s=AA.get("selectOnScroll");t=(r>=0)?AA.getItem(r):null;v=AA.get("firstVisible");z=v+AB-1;x=(rz);w=(t&&t.id)?e.get(t.id):null;u=AA._itemsTable;if(!s&&x){w=(u&&u.items&&u.items[v])?e.get(u.items[v].id):null;}if(w){try{w.focus();}catch(y){}}AA.fireEvent(X);},hide:function(){var r=this;if(r.fireEvent(b)!==false){r.removeClass(r.CLASSES.VISIBLE);r.fireEvent(a);}},init:function(u,s){var v=this,r=u,w=false,t;if(!u){return;}v._hasRendered=false;v._navBtns={prev:[],next:[]};v._pages={el:null,num:0,cur:0};v._pagination={};v._itemAttrCache={};v._itemsTable={loading:{},numItems:0,items:[],size:0};if(p.isString(u)){u=e.get(u);}else{if(!u.nodeName){return;}}U.superclass.init.call(v,u,s);t=v.get("selectedItem");if(t>0){v.set("firstVisible",D.call(v,t));}if(u){if(!u.id){u.setAttribute("id",e.generateId());}w=v._parseCarousel(u);if(!w){v._createCarousel(r);}}else{u=v._createCarousel(r);}r=u.id;v.initEvents();if(w){v._parseCarouselItems();}if(t>0){n.call(v,t,0);}if(!s||typeof s.isVertical=="undefined"){v.set("isVertical",false);}v._parseCarouselNavigation(u);v._navEl=v._setupCarouselNavigation();T[r]={object:v};v._loadItems(Math.min(v.get("firstVisible")+v.get("numVisible"),v.get("numItems"))-1);},initAttributes:function(r){var s=this;r=r||{};U.superclass.initAttributes.call(s,r);s.setAttributeConfig("carouselEl",{validator:p.isString,value:r.carouselEl||"OL"});s.setAttributeConfig("carouselItemEl",{validator:p.isString,value:r.carouselItemEl||"LI"});s.setAttributeConfig("currentPage",{readOnly:true,value:0});s.setAttributeConfig("firstVisible",{method:s._setFirstVisible,validator:s._validateFirstVisible,value:r.firstVisible||s.CONFIG.FIRST_VISIBLE});s.setAttributeConfig("selectOnScroll",{validator:p.isBoolean,value:r.selectOnScroll||true});s.setAttributeConfig("numVisible",{setter:s._numVisibleSetter,method:s._setNumVisible,validator:s._validateNumVisible,value:r.numVisible||s.CONFIG.NUM_VISIBLE});s.setAttributeConfig("numItems",{method:s._setNumItems,validator:s._validateNumItems,value:s._itemsTable.numItems});s.setAttributeConfig("scrollIncrement",{validator:s._validateScrollIncrement,value:r.scrollIncrement||1});s.setAttributeConfig("selectedItem",{setter:s._selectedItemSetter,method:s._setSelectedItem,validator:p.isNumber,value:-1});s.setAttributeConfig("revealAmount",{method:s._setRevealAmount,validator:s._validateRevealAmount,value:r.revealAmount||0});s.setAttributeConfig("isCircular",{validator:p.isBoolean,value:r.isCircular||false});s.setAttributeConfig("isVertical",{method:s._setOrientation,validator:p.isBoolean,value:r.isVertical||false});s.setAttributeConfig("navigation",{method:s._setNavigation,validator:s._validateNavigation,value:r.navigation||{prev:null,next:null,page:null}});s.setAttributeConfig("animation",{validator:s._validateAnimation,value:r.animation||{speed:0,effect:null}});
+s.setAttributeConfig("autoPlay",{validator:p.isNumber,value:r.autoPlay||0});s.setAttributeConfig("autoPlayInterval",{validator:p.isNumber,value:r.autoPlayInterval||0});s.setAttributeConfig("numPages",{readOnly:true,getter:s._getNumPages});s.setAttributeConfig("lastVisible",{readOnly:true,getter:s._getLastVisible});},initEvents:function(){var t=this,s=t.CLASSES,r;t.on("keydown",t._keyboardEventHandler);t.on(F,l);t.on(S,A);t.on(o,A);t.on(Q,A);t.on(C,function(){if(t._hasFocus){t.focus();}});t.on(L,A);t.on(g,function(u){t.scrollTo(0);l.call(t);R.call(t);});t.on(h,R,t);t.on(H,function(u){if(t.get("selectedItem")===null||t.get("selectedItem")<=0){t.set("selectedItem",t.get("firstVisible"));}l.call(t,u);R.call(t,u);t._setClipContainerSize();t.show();});t.on("selectedItemChange",function(u){n.call(t,u.newValue,u.prevValue);if(u.newValue>=0){t._updateTabIndex(t.getElementForItem(u.newValue));}t.fireEvent(C,u.newValue);});t.on(K,function(u){l.call(t,u);R.call(t,u);});t.on("firstVisibleChange",function(u){if(!t.get("selectOnScroll")){if(u.newValue>=0){t._updateTabIndex(t.getElementForItem(u.newValue));}}});t.on("click",function(u){if(t.isAutoPlayOn()){t.stopAutoPlay();}t._itemClickHandler(u);t._pagerClickHandler(u);});c.onFocus(t.get("element"),function(u,w){var v=c.getTarget(u);if(v&&v.nodeName.toUpperCase()=="A"&&e.getAncestorByClassName(v,s.NAVIGATION)){if(r){e.removeClass(r,s.PAGE_FOCUS);}r=v.parentNode;e.addClass(r,s.PAGE_FOCUS);}else{if(r){e.removeClass(r,s.PAGE_FOCUS);}}w._hasFocus=true;w._updateNavButtons(c.getTarget(u),true);},t);c.onBlur(t.get("element"),function(u,v){v._hasFocus=false;v._updateNavButtons(c.getTarget(u),false);},t);},isAnimating:function(){return this._isAnimationInProgress;},isAutoPlayOn:function(){return this._isAutoPlayInProgress;},getElementForItem:function(r){var s=this;if(r<0||r>=s.get("numItems")){return null;}if(s._itemsTable.items[r]){return e.get(s._itemsTable.items[r].id);}return null;},getElementForItems:function(){var t=this,s=[],r;for(r=0;r=s.get("numItems")){return null;}if(s._itemsTable.numItems>r){if(!p.isUndefined(s._itemsTable.items[r])){return s._itemsTable.items[r];}}return null;},getItems:function(){return this._itemsTable.items;},getLoadingItems:function(){return this._itemsTable.loading;},getRows:function(){return this._rows;},getCols:function(){return this._cols;},getItemPositionById:function(w){var u=this,v=u.get("numItems"),s=0,r=u._itemsTable.items,t;while(s=r){return false;}t=u._itemsTable.items.splice(s,1);if(t&&t.length==1){u._itemsTable.numItems--;u.set("numItems",r-1);u.fireEvent(o,{item:t[0],pos:s,ev:o});return true;}return false;},replaceItem:function(z,u){var y=this,w,v,t,x=y.get("numItems"),s,r=z;if(!z){return false;}if(p.isString(z)||z.nodeName){v=z.nodeName?z.innerHTML:z;}else{if(p.isObject(z)){v=z.content;}else{return false;}}if(p.isUndefined(u)){return false;}else{if(u<0||u>=x){return false;}s=y._itemsTable.items[u];if(!s){s=y._itemsTable.loading[u];y._itemsTable.items[u]=undefined;}y._itemsTable.items.splice(u,1,{item:v,className:z.className||"",id:e.generateId()});r=y._itemsTable.items[u];}y.fireEvent(Q,{newItem:r,oldItem:s,pos:u,ev:Q});return true;},replaceItems:function(r){var s,u,t=true;if(!p.isArray(r)){return false;}for(s=0,u=r.length;ss.get("numItems")){r=0;}if(s.get("selectOnScroll")){s._selectedItem=s._getSelectedItem(r);}s.scrollTo(r);},scrollTo:function(AL,AI){var AH=this,u,AJ,z,AB,AC,AM,AN,AO,AD,AA,v,AF,s,w,t,x,AE,y,AP,AK=AH._itemsTable,AG=AK.items,r=AK.loading;if(p.isUndefined(AL)||AL==AH._firstItem||AH.isAnimating()){return;}AJ=AH.get("animation");z=AH.get("isCircular");AB=AH.get("isVertical");AA=AH._cols;v=AH._rows;AO=AH._firstItem;AF=AH.get("numItems");s=AH.get("numVisible");t=AH.get("currentPage");AP=function(){if(AH.isAutoPlayOn()){AH.stopAutoPlay();}};if(AL<0){if(z){AL=AF+AL;}else{AP.call(AH);return;}}else{if(AF>0&&AL>AF-1){if(AH.get("isCircular")){AL=AF-AL;}else{AP.call(AH);return;}}}if(isNaN(AL)){return;}AN=(AH._firstItem>AL)?"backward":"forward";AE=AO+s;AE=(AE>AF-1)?AF-1:AE;x=AH.fireEvent(i,{dir:AN,first:AO,last:AE});if(x===false){return;}AH.fireEvent(J,{page:t});AD=AL+s-1;AH._loadItems(AD>AF-1?AF-1:AD);AM=0-AL;if(v){if(AB){AM=parseInt(AM/AA,10);}else{AM=parseInt(AM/v,10);}}y=0;while(AM<0&&yAF-1)?AF-1:AE;w=j.call(AH,AM);u=AJ.speed>0;if(u){AH._animateAndSetCarouselOffset(w,AL,AE,AI);}else{AH._setCarouselOffset(w);E.call(AH,AL,AE);}},getPageForItem:function(r){return Math.ceil((r+1)/parseInt(this.get("numVisible"),10));},getFirstVisibleOnPage:function(r){return(r-1)*this.get("numVisible");
+},selectPreviousItem:function(){var t=this,s=0,r=t.get("selectedItem");if(r==this._firstItem){s=r-t.get("numVisible");t._selectedItem=t._getSelectedItem(r-1);t.scrollTo(s);}else{s=t.get("selectedItem")-t.get("scrollIncrement");t.set("selectedItem",t._getSelectedItem(s));}},selectNextItem:function(){var s=this,r=0;r=s.get("selectedItem")+s.get("scrollIncrement");s.set("selectedItem",s._getSelectedItem(r));},show:function(){var s=this,r=s.CLASSES;if(s.fireEvent(Y)!==false){s.addClass(r.VISIBLE);s.fireEvent(V);}},startAutoPlay:function(){var r=this,s;if(p.isUndefined(r._autoPlayTimer)){s=r.get("autoPlayInterval");if(s<=0){return;}r._isAutoPlayInProgress=true;r.fireEvent(Z);r._autoPlayTimer=setTimeout(function(){r._autoScroll();},s);}},stopAutoPlay:function(){var r=this;if(!p.isUndefined(r._autoPlayTimer)){clearTimeout(r._autoPlayTimer);delete r._autoPlayTimer;r._isAutoPlayInProgress=false;r.fireEvent(q);}},updatePagination:function(){var z=this,x=z._pagination;if(!x.el){return false;}var w=z.get("numItems"),AA=z.get("numVisible"),u=z.get("firstVisible")+1,v=z.get("currentPage")+1,r=z.get("numPages"),t={"numVisible":AA,"numPages":r,"numItems":w,"selectedItem":z.get("selectedItem")+1,"currentPage":v,"firstVisible":u,"lastVisible":z.get("lastVisible")+1},s=x.callback||{},y=s.scope&&s.obj?s.obj:z;x.el.innerHTML=p.isFunction(s.fn)?s.fn.apply(y,[x.template,t]):YAHOO.lang.substitute(x.template,t);},registerPagination:function(s,u,r){var t=this;t._pagination.template=s;t._pagination.callback=r||{};if(!t._pagination.el){t._pagination.el=W("DIV",{className:t.CLASSES.PAGINATION});if(u=="before"){t._navEl.insertBefore(t._pagination.el,t._navEl.firstChild);}else{t._navEl.appendChild(t._pagination.el);}t.on("itemSelected",t.updatePagination);t.on("pageChange",t.updatePagination);}t.updatePagination();},toString:function(){return P+(this.get?" (#"+this.get("id")+")":"");},_animateAndSetCarouselOffset:function(w,u,s){var v=this,t=v.get("animation"),r=null;if(v.get("isVertical")){r=new YAHOO.util.Motion(v._carouselEl,{top:{to:w}},t.speed,t.effect);}else{r=new YAHOO.util.Motion(v._carouselEl,{left:{to:w}},t.speed,t.effect);}v._isAnimationInProgress=true;r.onComplete.subscribe(v._animationCompleteHandler,{scope:v,item:u,last:s});r.animate();},_animationCompleteHandler:function(r,s,t){t.scope._isAnimationInProgress=false;E.call(t.scope,t.item,t.last);},_autoScroll:function(){var s=this,t=s._firstItem,r;if(t>=s.get("numItems")-1){if(s.get("isCircular")){r=0;}else{s.stopAutoPlay();}}else{r=t+s.get("numVisible");}s._selectedItem=s._getSelectedItem(r);s.scrollTo.call(s,r);},_createCarousel:function(s){var u=this,r=u.CLASSES,t=e.get(s);if(!t){t=W("DIV",{className:r.CAROUSEL,id:s});}if(!u._carouselEl){u._carouselEl=W(u.get("carouselEl"),{className:r.CAROUSEL_EL});}return t;},_createCarouselClip:function(){return W("DIV",{className:this.CLASSES.CONTENT});},_createCarouselItem:function(u){var r,t=this,s=m.call(t,u.pos);return W(t.get("carouselItemEl"),{className:u.className,styles:u.styles,content:u.content,id:u.id});},_getValidIndex:function(t){var w=this,r=w.get("isCircular"),u=w.get("numItems"),v=w.get("numVisible"),s=u-1;if(t<0){t=r?Math.ceil(u/v)*v+t:0;}else{if(t>s){t=r?0:s;}}return t;},_getSelectedItem:function(v){var u=this,r=u.get("isCircular"),t=u.get("numItems"),s=t-1;if(v<0){if(r){v=t+v;}else{v=u.get("selectedItem");}}else{if(v>s){if(r){v=v-t;}else{v=u.get("selectedItem");}}}return v;},_itemClickHandler:function(v){var y=this,w=y.get("carouselItemEl"),s=y.get("element"),t,u,x=c.getTarget(v),r=x.tagName.toUpperCase();if(r==="INPUT"||r==="SELECT"||r==="TEXTAREA"){return;}while(x&&x!=s&&x.id!=y._carouselEl){t=x.nodeName;if(t.toUpperCase()==w){break;}x=x.parentNode;}if((u=y.getItemPositionById(x.id))>=0){y.set("selectedItem",y._getSelectedItem(u));y.focus();}},_keyboardEventHandler:function(t){var v=this,s=c.getCharCode(t),u=c.getTarget(t),r=false;if(v.isAnimating()||u.tagName.toUpperCase()==="SELECT"){return;}switch(s){case 37:case 38:v.selectPreviousItem();r=true;break;case 39:case 40:v.selectNextItem();r=true;break;case 33:v.scrollPageBackward();r=true;break;case 34:v.scrollPageForward();r=true;break;}if(r){if(v.isAutoPlayOn()){v.stopAutoPlay();}c.preventDefault(t);}},_loadItems:function(t){var w=this,s=w.get("numItems"),u=w.get("numVisible"),v=w.get("revealAmount"),x=w._itemsTable.items.length,r=w.get("lastVisible");if(x>t&&t+1>=u){x=t%u||t==r?t-t%u:t-u+1;}if(v&&t=x&&(!w.getItem(x)||!w.getItem(t))){w.fireEvent(L,{ev:L,first:x,last:t,num:t-x+1});}},_pagerChangeHandler:function(s){var v=this,u=c.getTarget(s),t=u.value,r;if(t){r=v.getFirstVisibleOnPage(t);v._selectedItem=r;v.scrollTo(r);v.focus();}},_pagerClickHandler:function(x){var z=this,t=z.CLASSES,u=c.getTarget(x),s=u.nodeName.toUpperCase(),r,w,v,y;if(e.hasClass(u,t.PAGER_ITEM)||e.hasClass(u.parentNode,t.PAGER_ITEM)){if(s=="EM"){u=u.parentNode;}r=u.href;w=r.lastIndexOf("#");v=parseInt(r.substring(w+1),10);if(v!=-1){y=z.getFirstVisibleOnPage(v);z._selectedItem=y;z.scrollTo(y);z.focus();}c.preventDefault(x);}},_parseCarousel:function(t){var w=this,x,r,s,v,u;r=w.CLASSES;s=w.get("carouselEl");v=false;for(x=t.firstChild;x;x=x.nextSibling){if(x.nodeType==1){u=x.nodeName;if(u.toUpperCase()==s){w._carouselEl=x;e.addClass(w._carouselEl,w.CLASSES.CAROUSEL_EL);v=true;}}}return v;},_parseCarouselItems:function(){var y=this,AA=y.CLASSES,v=0,z,r,t,u,s,w=y.get("firstVisible"),x=y._carouselEl;z=y._rows;t=y.get("carouselItemEl");for(r=x.firstChild;r;r=r.nextSibling){if(r.nodeType==1){s=r.nodeName;if(s.toUpperCase()==t){if(r.id){u=r.id;}else{u=e.generateId();r.setAttribute("id",u);}y.addItem(r,w);w++;}}}},_parseCarouselNavigation:function(x){var y=this,w,z=y.CLASSES,s,v,u,r,t=false;r=e.getElementsByClassName(z.PREV_PAGE,"*",x);if(r.length>0){for(v in r){if(r.hasOwnProperty(v)){s=r[v];if(s.nodeName=="INPUT"||s.nodeName=="BUTTON"||s.nodeName=="A"){y._navBtns.prev.push(s);}else{u=s.getElementsByTagName("INPUT");if(p.isArray(u)&&u.length>0){y._navBtns.prev.push(u[0]);
+}else{u=s.getElementsByTagName("BUTTON");if(p.isArray(u)&&u.length>0){y._navBtns.prev.push(u[0]);}}}}}w={prev:r};}r=e.getElementsByClassName(z.NEXT_PAGE,"*",x);if(r.length>0){for(v in r){if(r.hasOwnProperty(v)){s=r[v];if(s.nodeName=="INPUT"||s.nodeName=="BUTTON"||s.nodeName=="A"){y._navBtns.next.push(s);}else{u=s.getElementsByTagName("INPUT");if(p.isArray(u)&&u.length>0){y._navBtns.next.push(u[0]);}else{u=s.getElementsByTagName("BUTTON");if(p.isArray(u)&&u.length>0){y._navBtns.next.push(u[0]);}}}}}if(w){w.next=r;}else{w={next:r};}}if(w){y.set("navigation",w);t=true;}return t;},_refreshUi:function(){var v=this,s,w=v.get("isVertical"),y=v.get("firstVisible"),t,x,r,u;if(v._itemsTable.numItems<1){return;}u=O.call(v,w?"height":"width");t=v._itemsTable.items[y].id;u=w?d(t,"width"):d(t,"height");e.setStyle(v._carouselEl,w?"width":"height",u+"px");v._hasRendered=true;v.fireEvent(H);},_setCarouselOffset:function(t){var r=this,s;s=r.get("isVertical")?"top":"left";e.setStyle(r._carouselEl,s,t+"px");},_setupCarouselNavigation:function(){var w=this,u,s,r,y,v,x,t;r=w.CLASSES;v=e.getElementsByClassName(r.NAVIGATION,"DIV",w.get("element"));if(v.length===0){v=W("DIV",{className:r.NAVIGATION});w.insertBefore(v,e.getFirstChild(w.get("element")));}else{v=v[0];}w._pages.el=W("UL");v.appendChild(w._pages.el);y=w.get("navigation");if(p.isString(y.prev)||p.isArray(y.prev)){if(p.isString(y.prev)){y.prev=[y.prev];}for(u in y.prev){if(y.prev.hasOwnProperty(u)){w._navBtns.prev.push(e.get(y.prev[u]));}}}else{t=W("SPAN",{className:r.BUTTON+r.FIRST_NAV});e.setStyle(t,"visibility","visible");u=e.generateId();t.innerHTML=''+w.STRINGS.PREVIOUS_BUTTON_TEXT+" ";v.appendChild(t);u=e.get(u);w._navBtns.prev=[u];s={prev:[t]};}if(p.isString(y.next)||p.isArray(y.next)){if(p.isString(y.next)){y.next=[y.next];}for(u in y.next){if(y.next.hasOwnProperty(u)){w._navBtns.next.push(e.get(y.next[u]));}}}else{x=W("SPAN",{className:r.BUTTON+r.NEXT_NAV});e.setStyle(x,"visibility","visible");u=e.generateId();x.innerHTML=''+w.STRINGS.NEXT_BUTTON_TEXT+" ";v.appendChild(x);u=e.get(u);w._navBtns.next=[u];if(s){s.next=[x];}else{s={next:[x]};}}if(s){w.set("navigation",s);}return v;},_setClipContainerSize:function(r,t){var z=this,x=z.get("isVertical"),AB=z._rows,v=z._cols,y=z.get("revealAmount"),s=O.call(z,"height"),u=O.call(z,"width"),AA,w;r=r||z._clipEl;if(AB){AA=s*AB;w=u*v;}else{t=t||z.get("numVisible");if(x){AA=s*t;}else{w=u*t;}}z._recomputeSize=(AA===0);if(z._recomputeSize){z._hasRendered=false;return;}y=N.call(z);if(x){AA+=(y*2);}else{w+=(y*2);}if(x){AA+=M(z._carouselEl,"height");e.setStyle(r,"height",AA+"px");if(v){w+=M(z._carouselEl,"width");e.setStyle(r,"width",w+(0)+"px");}}else{w+=M(z._carouselEl,"width");e.setStyle(r,"width",w+"px");if(AB){AA+=M(z._carouselEl,"height");e.setStyle(r,"height",AA+"px");}}z._setContainerSize(r);},_setContainerSize:function(s,t){var w=this,r=w.CONFIG,z=w.CLASSES,v,y,u,x;v=w.get("isVertical");y=w._rows;u=w._cols;s=s||w._clipEl;t=t||(v?"height":"width");x=parseFloat(e.getStyle(s,t),10);x=p.isNumber(x)?x:0;if(v){x+=M(w._carouselEl,"height")+d(w._navEl,"height");}else{x+=M(w._carouselEl,"width");}if(!v){if(x=0&&st){s.removeItem(r-1);r--;}}return t;},_setOrientation:function(t){var s=this,r=s.CLASSES;if(t){s.replaceClass(r.HORIZONTAL,r.VERTICAL);}else{s.replaceClass(r.VERTICAL,r.HORIZONTAL);}this._itemAttrCache={};return t;},_setRevealAmount:function(s){var r=this;if(s>=0&&s<=100){s=parseInt(s,10);s=p.isNumber(s)?s:0;r._setClipContainerSize();}else{s=r.get("revealAmount");}return s;},_setSelectedItem:function(r){this._selectedItem=r;},_getNumPages:function(){return Math.ceil(parseInt(this.get("numItems"),10)/parseInt(this.get("numVisible"),10));},_getLastVisible:function(){var r=this;return r.get("currentPage")+1==r.get("numPages")?r.get("numItems")-1:r.get("firstVisible")+r.get("numVisible")-1;},_syncUiForItemAdd:function(u){var v,AA=this,x=AA._carouselEl,r,AB,t=AA._itemsTable,s,w,y,z;w=p.isUndefined(u.pos)?u.newPos||t.numItems-1:u.pos;if(!s){AB=t.items[w]||{};r=AA._createCarouselItem({className:AB.className,styles:AB.styles,content:AB.item,id:AB.id,pos:w});if(p.isUndefined(u.pos)){if(!p.isUndefined(t.loading[w])){s=t.loading[w];}if(s){x.replaceChild(r,s);delete t.loading[w];}else{x.appendChild(r);}}else{if(!p.isUndefined(t.items[u.pos+1])){y=e.get(t.items[u.pos+1].id);}if(y){x.insertBefore(r,y);}else{}}}else{if(p.isUndefined(u.pos)){if(!e.isAncestor(AA._carouselEl,s)){x.appendChild(s);}}else{if(!e.isAncestor(x,s)){if(!p.isUndefined(t.items[u.pos+1])){x.insertBefore(s,e.get(t.items[u.pos+1].id));}}}}if(!AA._hasRendered){AA._refreshUi();}if(AA.get("selectedItem")<0){AA.set("selectedItem",AA.get("firstVisible"));}AA._syncUiItems();},_syncUiForItemReplace:function(x){var w=this,t=w._carouselEl,r=w._itemsTable,y=x.pos,v=x.newItem,s=x.oldItem,u;
+u=w._createCarouselItem({className:v.className,styles:v.styles,content:v.item,id:v.id,pos:y});if(u&&s){c.purgeElement(s,true);t.replaceChild(u,e.get(s.id));if(!p.isUndefined(r.loading[y])){r.numItems++;delete r.loading[y];}}if(!w._hasRendered){w._refreshUi();}w._syncUiItems();},_syncUiForItemRemove:function(w){var v=this,r=v._carouselEl,t,u,s,x;s=v.get("numItems");u=w.item;x=w.pos;if(u&&(t=e.get(u.id))){if(t&&e.isAncestor(r,t)){c.purgeElement(t,true);r.removeChild(t);}if(v.get("selectedItem")==x){x=x>=s?s-1:x;}}else{}v._syncUiItems();},_syncUiForLazyLoading:function(v){var z=this,x=z._carouselEl,t=z._itemsTable,w=t.items.length,y=t.items[v.last+1],r,s;if(!y&&v.last