Commits

ranjith committed 7be2423

Completed Design layout and added color picker functionality

Comments (0)

Files changed (82)

example/resources/canvasphoto/canvasElement.js

+var Canvas = window.Canvas || {};
+
+(function () {
+
+	/**
+	 * Canvas Element Class
+	 *
+	 * @namespace Canvas.Element
+	 * @class Element
+	 * @constructor
+	 */
+	Canvas.Element = function() {};
+	
+	/**
+	 * Constant for the default CSS class name that represents a Canvas
+	 * @property Canvas.Element.CSS_CANVAS
+	 * @static
+	 * @final
+	 * @type String
+	 */
+	/// Canvas.Element.CSS_CANVAS = "canvas-module";	
+	Canvas.Element.prototype.fillBackground = true;
+	Canvas.Element.prototype.showcorners = false;
+	Canvas.Element.prototype.photoborder = true;
+	Canvas.Element.prototype.polaroid = false;
+	Canvas.Element.prototype._backgroundImg = null;
+	
+	/**
+	 * The object literal containing mouse position if clicked in an empty area (no image)
+	 * @property _groupSelector
+	 * @type object
+	 */
+	Canvas.Element.prototype._groupSelector = null;
+	
+	/**
+	 * The array element that contains all the images of the canvas
+	 * @property _aImages
+	 * @type object
+	 */
+	Canvas.Element.prototype._aImages = null;
+	
+	/**
+	 * The element that references the canvas interface implementation
+	 * @property _oContext
+	 * @type object
+	 */
+	Canvas.Element.prototype._oContext = null;
+	
+	/**
+	 * The main element that contains the canvas
+	 * @property _oElement
+	 * @type object
+	 */
+	Canvas.Element.prototype._oElement = null;
+
+	/**
+	 * The object literal containing config parameters
+	 * @property _oConfig
+	 * @type object
+	 */
+	Canvas.Element.prototype._oConfig = null;
+	
+	/**
+	 * The object literal containing the current x,y params of the transformation
+	 * @property _currentTransform
+	 * @type object
+	 */
+	Canvas.Element.prototype._currentTransform = null;
+	
+	/**
+	 * Init method
+	 * @method init
+	 * @param el {HTMLElement | String} Container element for the canvas.
+	 * @param oConfig {Object} userConfig The configuration Object literal 
+	 */
+	Canvas.Element.prototype.init = function(el, oConfig) {
+		if (el == '') {
+			return;
+		}
+		this._initElement(el);
+		this._initConfig(oConfig);
+		this._createCanvasBackground();
+		this._createContainer();
+		this._initEvents();
+		this._initCustomEvents();
+	};
+	
+	/**
+	 * The Canvas class's initialization method. This method is automatically 
+	 * called by the constructor, and sets up all DOM references for 
+	 * pre-existing markup, and creates required markup if it is not 
+	 * already present.
+	 * @method _initElement
+	 * @param el {HTMLElement | String} el The element representing the Canvas
+	 */
+	Canvas.Element.prototype._initElement = function(el) {
+		if(YAHOO.util.Dom.inDocument(el)) {
+			if(YAHOO.lang.isString(el)) {
+				this._oElement = document.getElementById(el);
+			} else {
+				this._oElement = el;
+			}
+			/// YAHOO.util.Dom.addClass(this._oElement, Canvas.Element.CSS_CANVAS);
+		}
+		else {
+			if (YAHOO.env.ua.ie) {
+				var canvasEl = excanvas(document.createElement('canvas'));	
+			}
+			else {
+				var canvasEl = document.createElement('canvas');
+			}
+			canvasEl.id = el + '';
+			var oCanvas = document.body.insertBefore(canvasEl, document.body.firstChild);
+			this._oElement = document.getElementById(el + '');
+		}
+	
+		// it contains the active image and the listeners
+		this._oContextTop = this._oElement.getContext('2d');
+	};
+
+	/**
+	 * The custom events initialization method. 
+	 * @method _initCustomEvents
+	 */
+	Canvas.Element.prototype._initCustomEvents = function() {
+		this.onRotateStart = new Canvas.CustomEvent('onRotateStart');
+		this.onRotateMove = new Canvas.CustomEvent('onRotateMove');		
+		this.onRotateComplete = new Canvas.CustomEvent('onRotateComplete');
+		this.onDragStart = new Canvas.CustomEvent('onDragStart');	
+		this.onDragMove = new Canvas.CustomEvent('onDragMove');
+		this.onDragComplete = new Canvas.CustomEvent('onDragComplete');
+	}
+	
+	/**
+	 * For now we use an object literal without methods to store the config params
+	 * @method _initConfig
+	 * @param oConfig {Object} userConfig The configuration Object literal 
+	 * containing the configuration that should be set for this module. 
+	 * See configuration documentation for more details.
+	 */
+	Canvas.Element.prototype._initConfig = function(oConfig) {
+		this._oConfig = oConfig;
+		this._oElement.width = this._oConfig.width;
+		this._oElement.height = this._oConfig.height;
+		this._oElement.style.width = this._oConfig.width + 'px';
+		this._oElement.style.height = this._oConfig.height + 'px';
+	};
+
+	/**
+	 * Adds main mouse listeners to the whole canvas
+	 * @method _initEvents
+	 * See configuration documentation for more details.
+	 */
+	Canvas.Element.prototype._initEvents = function() {
+		YAHOO.util.Event.on(this._oElement, 'mousedown', this.onMouseDown, this, true);
+		YAHOO.util.Event.on(this._oElement, 'mouseup', this.onMouseUp, this, true);
+		YAHOO.util.Event.on(this._oElement, 'mousemove', this.onMouseMove, this, true);
+		// Canvas.Element.addEventListener("mousedown", function(evt) { startTransform(evt); }, false);
+	};
+	
+	/**
+	 * It creates a secondary canvas to contain all the images are not being translated/rotated/scaled
+	 * @method _createContainer
+	 */
+	Canvas.Element.prototype._createContainer = function() {
+		if (YAHOO.env.ua.ie) {
+			var canvasEl = excanvas(document.createElement('canvas'));	
+		}
+		else {
+			var canvasEl = document.createElement('canvas');
+		}
+		canvasEl.id = this._oElement.id + '-canvas-container';
+		var oContainer = this._oElement.parentNode.insertBefore(canvasEl, this._oElement);
+		oContainer.width = this._oConfig.width;
+		oContainer.height = this._oConfig.height;
+		oContainer.style.width = this._oConfig.width + 'px';
+		oContainer.style.height = this._oConfig.height + 'px';
+		// this will contain all images that are not on the top
+		this._oContextContainer = oContainer.getContext('2d'); 
+	};
+	
+	Canvas.Element.prototype._createCanvasBackground = function() {
+		if (YAHOO.env.ua.ie) {
+			var canvasEl = excanvas(document.createElement('canvas'));	
+		}
+		else {
+			var canvasEl = document.createElement('canvas');
+		}
+		canvasEl.id = this._oElement.id + '-canvas-background';
+		var oBackground = this._oElement.parentNode.insertBefore(canvasEl, this._oElement);
+		oBackground.width = this._oConfig.width;
+		oBackground.height = this._oConfig.height;
+		oBackground.style.width = this._oConfig.width + 'px';
+		oBackground.style.height = this._oConfig.height + 'px';
+		// this will contain the background
+		this._oContextBackground = oBackground.getContext('2d'); 
+	};
+	
+	Canvas.Element.prototype.setCanvasBackground = function(oImg) {
+		this._backgroundImg = oImg;
+		var originalImgSize = oImg.getOriginalSize();
+		
+		this._oContextBackground.drawImage(oImg._oElement, 0, 0, originalImgSize.width, originalImgSize.height);
+	};
+	
+	/**
+	 * Method that defines the actions when mouse is released on canvas.
+	 * The method resets the currentTransform parameters, store the image corner
+	 * position in the image object and render the canvas on top.
+	 * @method onMouseUp
+	 * @param e {Event} Event object fired on mouseup
+	 */
+	Canvas.Element.prototype.onMouseUp = function(e) {
+		if (this._aImages == null) {
+			return;
+		}
+		if (this._currentTransform) {
+			// determine the new coords everytime the image changes its position
+			this._currentTransform.target.setImageCoords();
+		}
+		if (this._currentTransform != null && this._currentTransform.action == "rotate") {
+			// fire custom rotate event handler
+			this.onRotateComplete.fire(e);
+		} else if (this._currentTransform != null && this._currentTransform.action == "drag") {
+			// fire custom drag event handler
+			this.onDragComplete.fire(e);
+		}
+		this._currentTransform = null;
+		this._groupSelector = null;
+		
+		// this is to clear the selector box
+		this.renderTop();
+	};
+	
+	/**
+	 * Method that defines the actions when mouse is clicked on canvas.
+	 * The method inits the currentTransform parameters and renders all the
+	 * canvas so the current image can be placed on the top canvas and the rest
+	 * in on the container one.
+	 * @method onMouseDown
+	 * @param e {Event} Event object fired on mousedown
+	 */
+	Canvas.Element.prototype.onMouseDown = function(e) {
+		var mp = this.findMousePosition(e);
+		// ignore if something else is already going on
+		if (this._currentTransform != null || this._aImages == null) {
+			return;
+		}
+		
+		// determine whether we clicked the image
+		var oImg = this.findTargetImage(mp, false);
+		if (!oImg) {
+			this._groupSelector = { ex: mp.ex, ey: mp.ey,
+				 					top: 0, left: 0 };
+		}
+		else { 
+			// determine if it's a drag or rotate case
+			// rotate and scale will happen at the same time
+			var action = (!this.findTargetCorner(mp, oImg)) ? 'drag' : 'rotate';
+			if (action == "rotate") {
+				// fire custom rotate event handler
+				this.onRotateMove.fire(e);
+			} else if (action == "drag") {
+				// fire custom drag event handler
+				this.onDragMove.fire(e);
+			}
+			
+			this._currentTransform = { 
+				target: oImg,
+				action: action,
+				scalex: oImg.scalex,
+				offsetX: mp.ex - oImg.left,
+				offsetY: mp.ey - oImg.top,
+				ex: mp.ex, ey: mp.ey,
+				left: oImg.left, top: oImg.top,
+				theta: oImg.theta 
+			};
+									
+			// we must render all so the active image is placed in the canvastop
+			this.renderAll(false);
+		}
+	};
+	
+	/**
+	 * Method that defines the actions when mouse is hovering the canvas.
+	 * The currentTransform parameter will definde whether the user is rotating/scaling/translating
+	 * an image or neither of them (only hovering). A group selection is also possible and would cancel
+	 * all any other type of action.
+	 * In case of an image transformation only the top canvas will be rendered.
+	 * @method onMouseMove
+	 * @param e {Event} Event object fired on mousemove
+	 */
+	Canvas.Element.prototype.onMouseMove = function(e) {
+		var mp = this.findMousePosition(e);
+		if (this._aImages == null) {
+			return;
+		}
+		if (this._groupSelector != null) {
+			// We initially clicked in an empty area, so we draw a box for multiple selection.
+			this._groupSelector.left = mp.ex - this._groupSelector.ex;
+			this._groupSelector.top = mp.ey - this._groupSelector.ey;
+			this.renderTop();
+		}
+		else if (this._currentTransform == null) {
+			// Here we are hovering the canvas then we will determine
+			// what part of the pictures we are hovering to change the caret symbol.
+			// We won't do that while dragging or rotating in order to improve the
+			// performance.
+			var targetImg = this.findTargetImage(mp, true);
+
+			// set mouse image
+			this.setCursor(mp, targetImg);
+		}
+		else {
+			if (this._currentTransform.action == 'rotate') {
+				this.rotateImage(mp);
+				this.scaleImage(mp);
+				this.onRotateMove.fire(e);
+			}		
+			else {
+				this.translateImage(mp);
+				this.onDragMove.fire(e);
+			}
+			// only commit here. when we are actually moving the pictures
+			this.renderTop();
+		}		
+	};
+
+	/**
+	 * Translate image
+	 * @method translateImage
+	 * @param e {Event} the mouse event
+	 */	
+	Canvas.Element.prototype.translateImage = function(mp) {
+		this._currentTransform.target.left = mp.ex - this._currentTransform.offsetX;
+		this._currentTransform.target.top = mp.ey - this._currentTransform.offsetY;
+	};
+	
+	/**
+	 * Scale image
+	 * @method scaleImage
+	 * @param e {Event} the mouse event
+	 */	
+	Canvas.Element.prototype.scaleImage = function(mp) {
+		var lastLen = 
+			Math.sqrt(Math.pow(this._currentTransform.ey - this._currentTransform.top, 2) +
+			Math.pow(this._currentTransform.ex - this._currentTransform.left, 2));
+		var curLen = 
+			Math.sqrt(Math.pow(mp.ey - this._currentTransform.top, 2) +
+			Math.pow(mp.ex - this._currentTransform.left, 2));
+
+		this._currentTransform.target.scalex = this._currentTransform.scalex * (curLen / lastLen);
+		this._currentTransform.target.scaley = this._currentTransform.target.scalex;
+	};
+
+	/**
+	 * Rotate image
+	 * @method rotateImage
+	 * @param e {Event} the mouse event
+	 */	
+	Canvas.Element.prototype.rotateImage = function(mp) {
+		var lastAngle = Math.atan2(
+				this._currentTransform.ey - this._currentTransform.top,
+				this._currentTransform.ex - this._currentTransform.left
+		);
+		
+		var curAngle = Math.atan2(
+			mp.ey - this._currentTransform.top,
+			mp.ex - this._currentTransform.left
+		);
+				
+		this._currentTransform.target.theta = (curAngle - lastAngle) + this._currentTransform.theta;
+	};
+	
+	/**
+	 * Method to set the cursor image depending on where the user is hovering.
+ 	 * Note: very buggy in Opera
+	 * @method setCursor
+	 * @param e {Event} the mouse event
+	 * @param targetImg {Object} image that the mouse is hovering, if so.
+	 */
+	Canvas.Element.prototype.setCursor = function(mp, targetImg) {
+		if (!targetImg) {
+			this._oElement.style.cursor = 'default';
+		}
+		else { 
+			var corner = this.findTargetCorner(mp, targetImg);
+			if (!corner) {
+				this._oElement.style.cursor = 'move';
+			}
+			else {
+				if(corner == 'tr') {
+					this._oElement.style.cursor = 'ne-resize';
+				}
+				else if(corner == 'br') {
+					this._oElement.style.cursor = 'se-resize';
+				}
+				else if(corner == 'bl') {
+					this._oElement.style.cursor = 'sw-resize';
+				}
+				else if(corner == 'tl') {
+					this._oElement.style.cursor = 'nw-resize';
+				}									
+				else {
+					this._oElement.style.cursor = 'default';
+				}
+			}
+		}
+	};
+	
+	/**
+	 * Method to add an image to the canvas.
+ 	 * It actually only pushes the images in an array that will be rendered later in the canvas.
+	 * @method addImage
+	 * @param oImg {Object} Image elment to attach
+	 */
+	Canvas.Element.prototype.addImage = function(oImg) {
+		// this._aImages[this._aImages.length] = oImg;
+		if(YAHOO.lang.isNull(this._aImages)) {
+			this._aImages = [];
+		}
+		this._aImages.push(oImg);
+		this.renderAll(false);
+
+	};
+
+	/**
+	 * Method to render both the top canvas and the secondary container canvas.
+	 * @method renderAll
+	 * @param allOnTop {Boolean} Whether we want to force all images to be rendered on the top canvas
+	 */	
+	Canvas.Element.prototype.renderAll = function(allOnTop) {
+		// when allOnTop equals true all images will be rendered in the top canvas.
+		// This is used for actions like toDataUrl that needs to take some actions on a unique canvas.
+		var containerCanvas = (allOnTop) ? this._oContextTop : this._oContextContainer;
+		
+		this._oContextTop.clearRect(0,0,parseInt(this._oConfig.width), parseInt(this._oConfig.height));
+		containerCanvas.clearRect(0,0,parseInt(this._oConfig.width), parseInt(this._oConfig.height));
+		
+		if (allOnTop) {
+			var originalImgSize = this._backgroundImg.getOriginalSize();
+			this._oContextTop.drawImage(this._backgroundImg._oElement, 0, 0, originalImgSize.width, originalImgSize.height);
+		}
+		
+		// we render the rest of images
+		for (var i = 0, l = this._aImages.length-1; i < l; i += 1) {
+			this.drawImageElement(containerCanvas, this._aImages[i]);			
+		}
+		// we render the top context
+		this.drawImageElement(this._oContextTop, this._aImages[this._aImages.length-1]);
+	};
+	
+	/**
+	 * Method to render only the top canvas.
+	 * Also used to render the group selection box.
+	 * @method renderTop
+	 */
+	Canvas.Element.prototype.renderTop = function() {
+		// this.beforeRenderEvent.fire();  // placeholder
+		this._oContextTop.clearRect(0,0,parseInt(this._oConfig.width), parseInt(this._oConfig.height));
+		
+		// we render the top context
+		this.drawImageElement(this._oContextTop, this._aImages[this._aImages.length-1]);
+		
+		if (this._groupSelector != null) {
+			this._oContextTop.fillStyle = "rgba(0, 0, 200, 0.5)";
+			this._oContextTop.fillRect(
+				this._groupSelector.ex - ((this._groupSelector.left > 0) ?
+					0 : - this._groupSelector.left), 
+				this._groupSelector.ey - ((this._groupSelector.top > 0) ? 
+					0 : - this._groupSelector.top), 
+				Math.abs(this._groupSelector.left), 
+				Math.abs(this._groupSelector.top)
+			);
+			this._oContextTop.strokeRect(
+				this._groupSelector.ex - ((this._groupSelector.left > 0) ? 
+					0 : Math.abs(this._groupSelector.left)), 
+				this._groupSelector.ey - ((this._groupSelector.top > 0) ? 
+					0 : Math.abs(this._groupSelector.top)), 
+				Math.abs(this._groupSelector.left), 
+				Math.abs(this._groupSelector.top)
+			);
+		}
+	};
+	
+	/**
+	 * Method that finally uses the canvas function to render the image
+	 * @method drawImageElement
+	 * @param context {Object} canvas context where the image must be rendered
+	 * @param oImg {Object} the image object
+	 */
+	Canvas.Element.prototype.drawImageElement = function(context, oImg) {
+		var offsetY = oImg.height / 2;
+		var offsetX = oImg.width / 2;
+
+		context.save();
+		context.translate(oImg.left, oImg.top);
+		context.rotate(oImg.theta);
+		context.scale(oImg.scalex, oImg.scaley);
+		
+		this.drawBorder(context, oImg, offsetX, offsetY);
+		
+		var originalImgSize = oImg.getOriginalSize();
+		
+		// drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh)
+		// A = oImg.width - oImg._oElement.width = oImg.borderwidth (if any)
+		// B = oImg.height - oImg._oElement.height = oImg.borderwidth + oImg.polaroidheight
+		// B - A = oImg.polaroidheight
+		var polaroidHeight = ((oImg.height - originalImgSize.height) - (oImg.width - originalImgSize.width))/2;
+		
+		context.drawImage(
+			oImg._oElement, 
+			- originalImgSize.width/2,  
+			(- originalImgSize.height)/2 - polaroidHeight, 
+			originalImgSize.width, 
+			originalImgSize.height
+		);
+					
+		if (oImg.cornervisibility) {
+			this.drawCorners(context, oImg, offsetX, offsetY);
+		}
+		context.restore();
+	};
+		
+	/**
+	 * Method that returns an object with the image lines in it given the coordinates of the corners
+	 * @method _getImageLines
+	 * @param oCoords {Object} coordinates of the image corners
+	 */
+	Canvas.Element.prototype._getImageLines = function(oCoords) {
+		return {
+			topline: { 
+				o: oCoords.tl,
+				d: oCoords.tr 
+			},
+			rightline: { 
+				o: oCoords.tr,
+				d: oCoords.br 
+			},
+			bottomline: { 
+				o: oCoords.br,
+				d: oCoords.bl 
+			},
+			leftline: { 
+				o: oCoords.bl,
+				d: oCoords.tl 
+			}
+		}
+	};
+
+	/**
+	 * Method that determines what picture are we clicking on
+	 * Applied one implementation of 'point inside polygon' algorithm
+	 * @method findTargetImage
+	 * @param e {Event} the mouse event
+	 * @param hovering {Boolean} whether or not we have the mouse button pressed
+	 */	
+	Canvas.Element.prototype.findTargetImage = function(mp, hovering) {
+		// http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html
+		// http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html
+		for (var i = this._aImages.length-1; i >= 0; i -= 1) {
+			// we iterate through each image. If target found then return target
+			var iLines = this._getImageLines(this._aImages[i].oCoords);
+			var xpoints = this._findCrossPoints(mp, iLines);
+			
+			// if xcount is odd then we clicked inside the image
+			// For the specific case of square images xcount == 1 in all true cases
+			if (xpoints % 2 == 1 && xpoints != 0) {
+				var target = this._aImages[i];
+				//reorder array
+				if (!hovering) {
+					this._aImages.splice(i, 1);
+					this._aImages.push(target);
+				}
+				return target;
+			}
+		}
+		return false;
+	};
+
+	/**
+	 * Helper method to determine how many cross points are between the 4 image edges
+	 * and the horizontal line determined by the position of our mouse when clicked on canvas
+	 * @method _findCrossPoints
+	 * @param ex {Number} x coordinate of the mouse
+	 * @param ey {Number} y coordinate of the mouse
+	 * @param oCoords {Object} Coordinates of the image being evaluated
+	 */		
+	Canvas.Element.prototype._findCrossPoints = function(mp, oCoords) {
+		var b1, b2, a1, a2, xi, yi;
+		var xcount = 0;
+		var iLine = null;
+		for (lineKey in oCoords) {
+			iLine = oCoords[lineKey];
+			// optimisation 1: line below dot. no cross
+			if ((iLine.o.y < mp.ey) && (iLine.d.y < mp.ey)) {
+				continue;
+			}
+			// optimisation 2: line above dot. no cross
+			if ((iLine.o.y >= mp.ey) && (iLine.d.y >= mp.ey)) {
+				continue;
+			}
+			// optimisation 3: vertical line case
+			if ((iLine.o.x == iLine.d.x) && (iLine.o.x >= mp.ex)) { 
+				xi = iLine.o.x;
+				yi = mp.ey;
+			}
+			// calculate the intersection point
+			else {
+				b1 = 0; //(y2-mp.ey)/(x2-mp.ex); 
+				b2 = (iLine.d.y-iLine.o.y)/(iLine.d.x-iLine.o.x); 
+				a1 = mp.ey-b1*mp.ex;
+				a2 = iLine.o.y-b2*iLine.o.x;
+
+				xi = - (a1-a2)/(b1-b2); 
+				yi = a1+b1*xi; 
+			}
+		
+			// dont count xi < mp.ex cases
+			if (xi >= mp.ex) { 
+				xcount += 1;
+			}
+			// optimisation 4: specific for square images
+			if (xcount == 2) {
+				break;
+			}
+		}
+		return xcount;
+	};
+	
+	/**
+	 * Determine which one of the four corners has been clicked
+	 * @method findTargetCorner
+	 * @param e {Event} the mouse event
+	 * @param oImg {Object} the image object
+	 */
+	Canvas.Element.prototype.findTargetCorner = function(mp, oImg) {
+		var xpoints = null;
+		
+		var corners = ['tl','tr','br','bl'];
+		for (var i in oImg.oCoords) {
+			xpoints = this._findCrossPoints(mp, this._getImageLines(oImg.oCoords[i].corner));
+			if (xpoints % 2 == 1 && xpoints != 0) {
+				return i;
+			}		
+		}
+		return false;
+	};
+
+	/**
+	 * Determine which one of the four corners has been clicked
+	 * @method findTargetCorner
+	 * @param e {Event} the mouse event
+	 * @param oImg {Object} the image object
+	 */
+	Canvas.Element.prototype.findMousePosition = function(e) {
+		// srcElement = IE
+		var parentNode = (e.srcElement) ? e.srcElement.parentNode : e.target.parentNode;
+		var isSafari2 = (YAHOO.env.ua.webkit != 0 && YAHOO.env.ua.webkit < 420);
+		var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
+		var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
+		var safariOffsetLeft = (isSafari2) ? e.target.ownerDocument.body.offsetLeft + scrollLeft : 0;
+		var safariOffsetTop = (isSafari2) ? e.target.ownerDocument.body.offsetTop + scrollTop : 0;
+		return {
+			ex: e.clientX + scrollLeft - parentNode.offsetLeft - safariOffsetLeft,
+			ey: e.clientY + scrollTop - parentNode.offsetTop - safariOffsetTop,
+			screenX: e.screenX,
+			screenY: e.screenY
+		};
+	};
+
+	/**
+	 * Draw image border, if any. That includes both normal border and polaroid border
+	 * @method drawBorder
+	 * @param context {Object} context (layer) where the border will be drawn
+	 * @param oImg {Object} the Image object
+	 * @param offsetX {Number} The horizontal offset applied from the (0,0) of the canvas axis
+	 * @param offsetY {Number} The vertical offset applied from the (0,0) of the canvas axis
+	 */	
+	Canvas.Element.prototype.drawBorder = function(context, oImg, offsetX, offsetY) {
+		var outlinewidth = 2;
+		context.fillStyle = 'rgba(0, 0, 0, .3)';
+		context.fillRect(-2 - offsetX, -2 - offsetY, oImg.width + (2 * outlinewidth), oImg.height + (2 * outlinewidth));
+		context.fillStyle = '#fff';
+		context.fillRect(-offsetX, -offsetY, oImg.width, oImg.height);
+	};
+
+	/**
+	 * Draw image corners to help visual understanding of the UI (if required)
+	 * @method drawCorners
+	 * @param context {Object} context (layer) where the corners will be drawn
+	 * @param oImg {Object} the Image object
+	 * @param offsetX {Number} The horizontal offset applied from the (0,0) of the canvas axis
+	 * @param offsetY {Number} The vertical offset applied from the (0,0) of the canvas axis
+	 */	
+	Canvas.Element.prototype.drawCorners = function(context, oImg, offsetX, offsetY) {
+		context.fillStyle = "rgba(0, 200, 50, 0.5)";
+		context.fillRect(-offsetX, -offsetY, oImg.cornersize, oImg.cornersize);
+		context.fillRect(oImg.width - offsetX - oImg.cornersize, -offsetY, oImg.cornersize, oImg.cornersize);
+		context.fillRect(-offsetX, oImg.height - offsetY - oImg.cornersize, oImg.cornersize, oImg.cornersize);
+		context.fillRect(oImg.width - offsetX - oImg.cornersize, oImg.height - offsetY - oImg.cornersize, oImg.cornersize, oImg.cornersize);
+	};
+
+	/**
+	 * Export the specific canvas element to an Image. Created and rendered on the browser.
+	 * Beware of crossbrowser support.
+	 * @method canvasTo
+	 * @param format {String} the format of the output image. Either jpeg or png.
+	 */	
+	Canvas.Element.prototype.canvasTo = function(format) {
+		this.renderAll(true);
+		if (format == 'jpeg' || format == 'png') {
+			return this._oElement.toDataURL('image/'+format);
+		}
+	};
+	
+	/**
+	 * Hook onto "interesting moments" in the lifecycle of Canvas Element
+	 * @method subscribe
+	 * @param type {String} The type of event.
+	 * @param fn {Function} The handler function
+	 * @param scope {Object} An object to become the execution scope of the handler.
+	 */
+	Canvas.Element.prototype.subscribe = function(type, fn, scope) {
+		if(typeof this[type] == "undefined") {
+			throw new Error("Invalid custom event name: " + type);
+		}
+		if(typeof fn != "function") {
+			throw new Error("Invalid handler function.");
+		}
+		this[type].scope = scope || window;
+		this[type].handler = fn;
+	};
+	
+	Canvas.CustomEvent = function(type) {
+		this.type = type;
+		this.scope = null;
+		this.handler = null;
+		var self = this;
+		this.fire = function(e) {
+			if(this.handler != null) {
+				self.handler.call(self.scope, e);
+			}
+		};
+	};
+	
+	
+}());

example/resources/canvasphoto/canvasImg.js

+var Canvas = window.Canvas || {};
+
+(function () {
+
+	/**
+	 * Img (Image) Element Class
+	 *
+	 * @namespace Canvas.Img
+	 * @class Element
+	 * @constructor
+	 * @param el {HTMLElement | String} Container element for the canvas.
+	 */
+	Canvas.Img = function(el, oConfig) {
+		/// this.rotateImage = new YAHOO.util.CustomEvent('rotateImage', this);
+		this._initElement(el);
+		this._initConfig(oConfig);
+		this.setImageCoords();
+	};
+	
+		
+	/**
+	 * Constant for the default CSS class name that represents a Canvas
+	 * @property Canvas.Img.CSS_CANVAS
+	 * @static
+	 * @final
+	 * @type String
+	 */
+	Canvas.Img.CSS_CANVAS = "canvas-img";
+	
+	/**
+	 * Constant representing the Module's configuration properties
+	 * @property DEFAULT_CONFIG
+	 * @private
+	 * @final
+	 * @type Object
+	 */
+	var DEFAULT_CONFIG = {	
+		"TOP": { 
+		    key: "top", 
+		    value: 10 
+		},
+		
+		"LEFT": { 
+		    key: "left", 
+		    value: 10
+		},
+		
+		"ANGLE": { 
+		    key: "angle", 
+		    value: 0  
+		},
+		
+		"SCALE-X": { 
+		    key: "scalex", 
+		    value: 1
+		},
+		
+		"SCALE-Y": { 
+		    key: "scaley", 
+		    value: 1
+		},
+		"CORNERSIZE": { 
+		    key: "cornersize", 
+		    value: 25
+		},
+		"BORDERWIDTH": { 
+		    key: "borderwidth", 
+		    value: 10
+		},
+		"POLAROIDHEIGHT": {
+			key: "polaroidheight",
+			value: 40
+		},
+		"RANDOMPOSITION": {
+			key: "randomposition",
+			value: true
+		}
+	};
+	
+	/**
+	 * The main element that contains the canvas
+	 * @property _oElement
+	 * @type object
+	 */
+	Canvas.Img.prototype._oElement = null;
+
+	/**
+	 * The object literal containing config parameters
+	 * @property oConfig
+	 * @type object
+	 */
+	Canvas.Img.prototype.top = null;
+	Canvas.Img.prototype.left = null;
+	Canvas.Img.prototype.maxwidth = null;
+	Canvas.Img.prototype.maxheight = null;
+	Canvas.Img.prototype.oCoords = null;
+	Canvas.Img.prototype.angle = null;
+	Canvas.Img.prototype.theta = null;
+	Canvas.Img.prototype.scalex = null;
+	Canvas.Img.prototype.scaley = null;
+	Canvas.Img.prototype.cornersize = null;
+	Canvas.Img.prototype.polaroidheight = null;
+	Canvas.Img.prototype.randomposition = null;
+	
+	Canvas.Img.prototype.selected = false;
+	Canvas.Img.prototype.bordervisibility = false;
+	Canvas.Img.prototype.cornervisibility = false;
+	
+	/**
+	 * The Image class's initialization method. This method is automatically 
+	 * called by the constructor.
+	 * @method _initElement
+	 * @param {HTMLElement | String} el The element representing the image
+	 */
+	Canvas.Img.prototype._initElement = function(el) {
+		if(YAHOO.util.Dom.inDocument(el)) {
+			if(YAHOO.lang.isString(el)) {
+				this._oElement = document.getElementById(el);
+			} 
+			else {
+				this._oElement = el;
+			}
+			YAHOO.util.Dom.addClass(this._oElement, Canvas.Img.CSS_CANVAS);
+		}
+		else {
+			// add element to the document: module.js
+		}
+	};
+
+	/**
+	 * For now we use an object literal without methods to store the config params
+	 * It checks if the user has passed any values through oConfig. Otherwise,
+	 * it sets the values defined in DEFAULT_CONFIG
+	 * @method _initConfig
+	 * @param {Object} userConfig The configuration Object literal 
+	 * containing the configuration that should be set for this module. 
+	 * See configuration documentation for more details.
+	 */
+	Canvas.Img.prototype._initConfig = function(oConfig) {
+		var sKey;
+		for (sKey in DEFAULT_CONFIG) {
+			var defaultKey = DEFAULT_CONFIG[sKey].key;
+			if (!oConfig.hasOwnProperty(defaultKey)) { // = !(defaultKey in oConfig)
+				this[defaultKey] = DEFAULT_CONFIG[sKey].value;
+			}
+			else {
+				this[defaultKey] = oConfig[defaultKey];
+			}
+		}
+		
+		if (this.bordervisibility) {
+			this.currentBorder = this.borderwidth;
+		}
+		else {
+			this.currentBorder = 0;
+		}
+		
+		var normalizedSize = this.getNormalizedSize(this._oElement, parseInt(oConfig.maxwidth), parseInt(oConfig.maxheight));
+		this._oElement.width = normalizedSize.width;
+		this._oElement.height = normalizedSize.height;
+		this.width = normalizedSize.width + (2 * this.currentBorder);
+		this.height = normalizedSize.height + (2 * this.currentBorder);
+		
+		// set initial random position and angle if user hasnt specified them
+		if (this.randomposition) {
+			this._setRandomProperties(oConfig);
+		}
+		
+		this.theta = this.angle * (Math.PI/180);
+		
+	};
+
+	/**
+	 * Method that resizes an image depending on whether maxwidth and maxheight are set up.
+	 * Width and height have to mantain the same proportion in the final image as it was in the 
+	 * initial one.
+	 * @method getNormalizedSize
+	 * @param {Object} userConfig The configuration Object literal 
+	 * @param {Integer} maximum width of the image in px 
+	 * @param {Integer} maximum height of the image in px 
+	 */	
+	Canvas.Img.prototype.getNormalizedSize = function(oImg, maxwidth, maxheight) {
+		if (maxheight && maxwidth && (oImg.width > oImg.height && (oImg.width / oImg.height) < (maxwidth / maxheight))) {
+			// console.log('cas 2');
+			// height is the constraining dimension.
+			normalizedWidth = Math.floor((oImg.width * maxheight) / oImg.height);
+			normalizedHeight = maxheight;
+		}
+		else if (maxheight && ((oImg.height == oImg.width) || (oImg.height > oImg.width) || (oImg.height > maxheight))) {
+			// console.log('cas 1'); 
+			// height is the constraining dimension.
+			normalizedWidth = Math.floor((oImg.width * maxheight) / oImg.height);
+			normalizedHeight = maxheight;
+		}
+		
+		else if (maxwidth && (maxwidth < oImg.width)){ 
+			// console.log('cas 3');
+			// width is the constraining dimension.
+			normalizedHeight = Math.floor((oImg.height * maxwidth) / oImg.width);
+			normalizedWidth = maxwidth;
+		}
+		else {
+			// console.log('cas 4');
+			normalizedWidth = oImg.width;
+			normalizedHeight = oImg.height;			
+		}
+		// console.log(normalizedWidth+":"+normalizedHeight);
+		return { width: normalizedWidth, height: normalizedHeight }
+	},
+	
+	Canvas.Img.prototype.getOriginalSize = function() {
+		return { width: this._oElement.width, height: this._oElement.height }
+	};
+	
+	/**
+	 * Sets random angle, top and left of the image if the user hasnt specified
+	 * specific ones.
+	 * @method _setRandomProperties
+	 * @param oConfig {Object} userConfig The configuration Object literal 
+	 * containing the configuration that should be set for this module. 
+	 * See configuration documentation for more details.
+	 */
+	Canvas.Img.prototype._setRandomProperties = function(oConfig) {
+		if (oConfig.angle == null) { // use YUI.lang
+			this.angle = (Math.random() * 40) - 20;
+		}
+		
+		if (oConfig.top == null) {
+			this.top = this.height / 2 + Math.random() * 500;
+		}
+		
+		if (oConfig.left == null) {
+			this.left = this.width / 2 + Math.random() * 700;
+		}
+	};
+	
+	Canvas.Img.prototype.setBorderVisibility = function(showBorder) {
+		// reset values
+		this.width = this._oElement.width;
+		this.height = this._oElement.height;
+	
+		if (showBorder) {
+			this.currentBorder = this.borderwidth;
+			this.width += (2 * this.currentBorder);
+			this.height += (2 * this.currentBorder);
+		}
+		else {
+			this.currentBorder = 0;
+		}
+		
+		this.setImageCoords();
+	};
+	
+	Canvas.Img.prototype.setCornersVisibility = function(visible) {
+		this.cornervisibility = visible;
+	};
+	
+	Canvas.Img.prototype.setPolaroidVisibility = function(showPolaroidFooter) {
+		// reset values
+		this.width = this._oElement.width;
+		this.height = this._oElement.height;
+		
+		if (showPolaroidFooter) {
+			// add borders and polaroid padding
+			this.currentBorder = this.borderwidth;
+			this.width += (2 * this.currentBorder);
+			this.height += this.currentBorder + this.polaroidheight;
+		}
+		
+		this.setImageCoords();
+	};
+	
+	/**
+	 * It sets image corner position coordinates based on current angle,
+	 * width and height.
+	 * @method setImageCoords
+	 */
+	Canvas.Img.prototype.setImageCoords = function() {
+		this.left = parseInt(this.left);
+		this.top = parseInt(this.top);
+		
+		this.currentWidth = parseInt(this.width) * this.scalex;
+		this.currentHeight = parseInt(this.height) * this.scalex;
+		this._hypotenuse = Math.sqrt(Math.pow(this.currentWidth / 2, 2) + Math.pow(this.currentHeight / 2, 2));
+		this._angle = Math.atan(this.currentHeight / this.currentWidth);
+		
+		// offset added for rotate and scale actions
+		var offsetX = Math.cos(this._angle + this.theta) * this._hypotenuse;
+		var offsetY = Math.sin(this._angle + this.theta) * this._hypotenuse;
+		var theta = this.theta;
+		var sinTh = Math.sin(theta);
+		var cosTh = Math.cos(theta);
+		
+		var tl = {
+			x: this.left - offsetX,
+			y: this.top - offsetY
+		};
+		var tr = {
+			x: tl.x + (this.currentWidth * cosTh),
+			y: tl.y + (this.currentWidth * sinTh)
+		};
+		var br = {
+			x: tr.x - (this.currentHeight * sinTh),
+			y: tr.y + (this.currentHeight * cosTh)
+		};
+		var bl = {
+			x: tl.x - (this.currentHeight * sinTh),
+			y: tl.y + (this.currentHeight * cosTh)
+		};
+		// clockwise
+		this.oCoords = { tl: tl, tr: tr, br: br, bl: bl };
+		
+		// set coordinates of the draggable boxes in the corners used to scale/rotate the image
+		this.setCornerCoords();			
+	};
+
+	/**
+	 * It sets the coordinates of the draggable boxes in the corners of
+	 * the image used to scale/rotate it.
+	 * @method setCornerCoords
+	 */	
+	Canvas.Img.prototype.setCornerCoords = function() {
+		// Calculate the rotate boxes.
+		var coords = this.oCoords;
+		var theta = this.theta;
+		var cosOffset = this.cornersize * this.scalex * Math.cos(theta);
+		var sinOffset = this.cornersize * this.scalex * Math.sin(theta);
+		coords.tl.corner = {
+			tl: {
+				x: coords.tl.x,
+				y: coords.tl.y
+			},
+			tr: {
+				x: coords.tl.x + cosOffset,
+				y: coords.tl.y + sinOffset
+			},
+			bl: {
+				x: coords.tl.x - sinOffset,
+				y: coords.tl.y + cosOffset
+			}
+		};
+		coords.tl.corner.br = {
+			x: coords.tl.corner.tr.x - sinOffset,
+			y: coords.tl.corner.tr.y + cosOffset
+		};
+		
+		coords.tr.corner = {
+			tl: {
+				x: coords.tr.x - cosOffset,
+				y: coords.tr.y - sinOffset
+			},
+			tr: {
+				x: coords.tr.x,
+				y: coords.tr.y
+			},
+			br: {
+				x: coords.tr.x - sinOffset,
+				y: coords.tr.y + cosOffset
+			}
+		};
+		coords.tr.corner.bl = {
+			x: coords.tr.corner.tl.x - sinOffset,
+			y: coords.tr.corner.tl.y + cosOffset
+		};
+		
+		coords.bl.corner = {
+			tl: {
+				x: coords.bl.x + sinOffset,
+				y: coords.bl.y - cosOffset
+			},
+			bl: {
+				x: coords.bl.x,
+				y: coords.bl.y
+			},
+			br: {
+				x: coords.bl.x + cosOffset,
+				y: coords.bl.y + sinOffset
+			}
+		};
+		coords.bl.corner.tr = {
+			x: coords.bl.corner.br.x + sinOffset,
+			y: coords.bl.corner.br.y - cosOffset
+		};
+		
+		coords.br.corner = {
+			tr: {
+				x: coords.br.x + sinOffset,
+				y: coords.br.y - cosOffset
+			},
+			bl: {
+				x: coords.br.x - cosOffset,
+				y: coords.br.y - sinOffset
+			},
+			br: {
+				x: coords.br.x,
+				y: coords.br.y
+			}
+		};
+		coords.br.corner.tl = {
+			x: coords.br.corner.bl.x + sinOffset,
+			y: coords.br.corner.bl.y - cosOffset
+		};
+	};
+	
+}());

example/resources/canvasphoto/img/4.jpg

Added
New image

example/resources/canvasphoto/img/5.jpg

Added
New image

example/resources/canvasphoto/img/7.jpg

Added
New image

example/resources/canvasphoto/img/8.jpg

Added
New image

example/resources/canvasphoto/img/9.jpg

Added
New image

example/resources/canvasphoto/img/bg.jpg

Added
New image

example/resources/canvasphoto/index.html

+<html>
+<head>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<title>canvas</title>
+		<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
+		<style type="text/css" media="screen">
+		body 	{ font: 75% "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; }
+		canvas 	{ background-color: transparent; border: 1px solid gray; top: 0; left: 0; position: absolute;}
+		canvas.resize-ne { cursor: ne-resize; }
+		canvas.resize-se { cursor: se-resize; }
+		canvas.resize-sw { cursor: sw-resize; }
+		canvas.resize-nw { cursor: nw-resize; }
+		canvas.move { cursor: move; }
+		canvas.default { cursor: default; }
+		img 	{ display: block; visibility: hidden; position: absolute; top: -1000; left: -1000; }
+		input 	{ margin-left: 20px; }
+		fieldset { width: 280px; float: left; }
+		.fieldset { width: 200px; float: left; }
+		#ft 	{ background-color: #eee; height: 70px; width: 99%; border-top: 1px solid #ccc; padding: 5px; position: absolute; top: 0; left: 0; }
+		#ft span { width: 100%; }
+	</style>
+	<script src="utilities.js" type="text/javascript" charset="utf-8"></script>
+	<script src="canvasElement.js" type="text/javascript" charset="utf-8"></script>
+	<script src="canvasImg.js" type="text/javascript" charset="utf-8"></script>
+	<script type="text/javascript" charset="utf-8">
+		var CanvasDemo = function() {
+			var YD = YAHOO.util.Dom;
+			var YE = YAHOO.util.Event;
+			var canvas1;
+			var img = [];
+			return {
+				init: function() {
+					canvas1 = new Canvas.Element();
+					canvas1.init('canvid1',  { width: YD.getViewportWidth() - 5, height: YD.getViewportHeight() - 5 });			
+					img[img.length] = new Canvas.Img('img1', {});
+					img[img.length] = new Canvas.Img('img2', {});
+					img[img.length] = new Canvas.Img('img3', {});
+					img[img.length] = new Canvas.Img('bg', {});
+					img[img.length] = new Canvas.Img('img4', {});
+					img[img.length] = new Canvas.Img('img4', {});
+				
+					
+					
+					
+					
+					
+					// @param array of images ToDo: individual images
+					
+					canvas1.addImage(img[0]);
+					canvas1.addImage(img[1]);
+					canvas1.addImage(img[2]);
+					canvas1.setCanvasBackground(img[3]);
+					canvas1.addImage(img[4]);
+					
+				
+					
+					
+					
+					
+					this.initEvents();
+				},
+				initEvents: function() {
+					YE.on('togglebg','click', this.toggleBg, this, true);
+					YE.on('showcorners','click', this.showCorners, this, true);
+					YE.on('togglenone','click', this.toggleNone, this, true);
+					YE.on('toggleborders','click', this.toggleBorders, this, true);
+					YE.on('togglepolaroid','click', this.togglePolaroid, this, true);
+					YE.on('pngbutton','click', function() { this.convertTo('png') }, this, true);
+					YE.on('jpegbutton','click', function() { this.convertTo('jpeg') }, this, true);
+				},
+				switchBg: function() {
+					canvas1.fillBackground = (canvas1.fillBackground) ? false : true;							
+					canvas1.renderAll();
+				},
+				
+				//! insert these functions to the library. No access to _aImages should be done from here
+				showCorners: function() {
+					this.cornersvisible = (this.cornersvisible) ? false : true;
+					for (var i = 0, l = canvas1._aImages.length; i < l; i += 1) {
+						canvas1._aImages[i].setCornersVisibility(this.cornersvisible);
+					}
+					canvas1.renderAll();
+				},
+				toggleNone: function() {
+					for (var i = 0, l = canvas1._aImages.length; i < l; i += 1) {
+						canvas1._aImages[i].setBorderVisibility(false);
+					}
+					canvas1.renderAll();
+				},
+				toggleBorders: function() {
+					for (var i = 0, l = canvas1._aImages.length; i < l; i += 1) {
+						canvas1._aImages[i].setBorderVisibility(true);
+					}
+					canvas1.renderAll();
+				},
+				togglePolaroid: function() {
+					for (var i = 0, l = canvas1._aImages.length; i < l; i += 1) {
+						canvas1._aImages[i].setPolaroidVisibility(true);
+					}
+					canvas1.renderAll();
+				},
+				convertTo: function(format) {
+					var imgData = canvas1.canvasTo(format);
+					window.open(imgData, "_blank");
+				},
+				whatever: function(e, o) {
+					// console.log(e);
+					// console.log(o);
+				}
+			}
+		}();
+		
+		
+		
+		
+		YAHOO.util.Event.on(window, 'load', CanvasDemo.init, CanvasDemo, true);
+	</script>
+</head>
+<body id="canvasdemo" onload="">	
+	<canvas id="canvid1"></canvas>
+	
+	<img id="img4" src="img/4.jpg" />
+	<img id="img1" src="img/7.jpg" />
+	<img id="img2" src="img/8.jpg" />
+	<img id="img3" src="img/9.jpg" />
+	<img id="img4" src="img/5.jpg" />
+	<img id="bg" src="img/bg.jpg" />
+	
+	<div id="ft">
+		<div class="fieldset">
+			<input type="button" id="jpegbutton" value="Export to JPEG" />
+			<input type="button" id="pngbutton" value="Export to PNG (heavy)" />
+		</div>
+		<fieldset>
+			<legend>Photo</legend>
+			<span><input type="radio" name="some_name" value="" id="togglenone" /> None</span>
+			<span><input type="radio" name="some_name" value="" id="toggleborders" /> Border</span>
+			<span><input type="radio" name="some_name" value="" id="togglepolaroid" /> Polaroid</span>
+		</fieldset>
+		<span><input type="checkbox" name="some_name" value="" id="showcorners" /> Show corners<span>
+	</div>
+</body>
+</html>

example/resources/canvasphoto/utilities.js

+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.3.0
+*/
+
+if(typeof YAHOO=="undefined"){var YAHOO={};}
+YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
+return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
+var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
+if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(name){return YAHOO.env.modules[name]||null;};YAHOO.env.ua=function(){var o={ie:0,opera:0,gecko:0,webkit:0};var ua=navigator.userAgent,m;if((/KHTML/).test(ua)){o.webkit=1;}
+m=ua.match(/AppleWebKit\/([^\s]*)/);if(m&&m[1]){o.webkit=parseFloat(m[1]);}
+if(!o.webkit){m=ua.match(/Opera[\s\/]([^\s]*)/);if(m&&m[1]){o.opera=parseFloat(m[1]);}else{m=ua.match(/MSIE\s([^;]*)/);if(m&&m[1]){o.ie=parseFloat(m[1]);}else{m=ua.match(/Gecko\/([^\s]*)/);if(m){o.gecko=1;m=ua.match(/rv:([^\s\)]*)/);if(m&&m[1]){o.gecko=parseFloat(m[1]);}}}}}
+return o;}();(function(){YAHOO.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
+if(unique){ls.push(l);}}}})();YAHOO.lang={isArray:function(o){if(o){var l=YAHOO.lang;return l.isNumber(o.length)&&l.isFunction(o.splice)&&!l.hasOwnProperty(o.length);}
+return false;},isBoolean:function(o){return typeof o==='boolean';},isFunction:function(o){return typeof o==='function';},isNull:function(o){return o===null;},isNumber:function(o){return typeof o==='number'&&isFinite(o);},isObject:function(o){return(o&&(typeof o==='object'||YAHOO.lang.isFunction(o)))||false;},isString:function(o){return typeof o==='string';},isUndefined:function(o){return typeof o==='undefined';},hasOwnProperty:function(o,prop){if(Object.prototype.hasOwnProperty){return o.hasOwnProperty(prop);}
+return!YAHOO.lang.isUndefined(o[prop])&&o.constructor.prototype[prop]!==o[prop];},_IEEnumFix:function(r,s){if(YAHOO.env.ua.ie){var add=["toString","valueOf"];for(i=0;i<add.length;i=i+1){var fname=add[i],f=s[fname];if(YAHOO.lang.isFunction(f)&&f!=Object.prototype[fname]){r[fname]=f;}}}},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}
+var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
+if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}
+YAHOO.lang._IEEnumFix(subc.prototype,overrides);}},augmentObject:function(r,s){if(!s||!r){throw new Error("Absorb failed, verify dependencies.");}
+var a=arguments,i,p,override=a[2];if(override&&override!==true){for(i=2;i<a.length;i=i+1){r[a[i]]=s[a[i]];}}else{for(p in s){if(override||!r[p]){r[p]=s[p];}}
+YAHOO.lang._IEEnumFix(r,s);}},augmentProto:function(r,s){if(!s||!r){throw new Error("Augment failed, verify dependencies.");}
+var a=[r.prototype,s.prototype];for(var i=2;i<arguments.length;i=i+1){a.push(arguments[i]);}
+YAHOO.lang.augmentObject.apply(this,a);},dump:function(o,d){var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",COMMA=', ',ARROW=' => ';if(!l.isObject(o)||o instanceof Date||("nodeType"in o&&"tagName"in o)){return o;}else if(l.isFunction(o)){return FUN;}
+d=(l.isNumber(d))?d:3;if(l.isArray(o)){s.push("[");for(i=0,len=o.length;i<len;i=i+1){if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
+s.push(COMMA);}
+if(s.length>1){s.pop();}
+s.push("]");}else{s.push("{");for(i in o){if(l.hasOwnProperty(o,i)){s.push(i+ARROW);if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);}
+s.push(COMMA);}}
+if(s.length>1){s.pop();}
+s.push("}");}
+return s.join("");},substitute:function(s,o,f){var i,j,k,key,v,meta,l=YAHOO.lang,saved=[],token,DUMP='dump',SPACE=' ',LBRACE='{',RBRACE='}';for(;;){i=s.lastIndexOf(LBRACE);if(i<0){break;}
+j=s.indexOf(RBRACE,i);if(i+1>=j){break;}
+token=s.substring(i+1,j);key=token;meta=null;k=key.indexOf(SPACE);if(k>-1){meta=key.substring(k+1);key=key.substring(0,k);}
+v=o[key];if(f){v=f(key,v,meta);}
+if(l.isObject(v)){if(l.isArray(v)){v=l.dump(v,parseInt(meta,10));}else{meta=meta||"";var dump=meta.indexOf(DUMP);if(dump>-1){meta=meta.substring(4);}
+if(v.toString===Object.prototype.toString||dump>-1){v=l.dump(v,parseInt(meta,10));}else{v=v.toString();}}}else if(!l.isString(v)&&!l.isNumber(v)){v="~-"+saved.length+"-~";saved[saved.length]=token;}
+s=s.substring(0,i)+v+s.substring(j+1);}
+for(i=saved.length-1;i>=0;i=i-1){s=s.replace(new RegExp("~-"+i+"-~"),"{"+saved[i]+"}","g");}
+return s;},trim:function(s){try{return s.replace(/^\s+|\s+$/g,"");}catch(e){return s;}},merge:function(){var o={},a=arguments,i;for(i=0;i<a.length;i=i+1){YAHOO.lang.augmentObject(o,a[i],true);}
+return o;},isValue:function(o){var l=YAHOO.lang;return(l.isObject(o)||l.isString(o)||l.isNumber(o)||l.isBoolean(o));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.0",build:"442"});
+(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={},reClassNameCache={};var isOpera=YAHOO.env.ua.opera,isSafari=YAHOO.env.ua.webkit,isGecko=YAHOO.env.ua.gecko,isIE=YAHOO.env.ua.ie;var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}
+if(propertyCache[property]){return propertyCache[property];}
+var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}
+propertyCache[property]=converted;return converted;};var getClassRegEx=function(className){var re=reClassNameCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');reClassNameCache[className]=re;}
+return re;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';}
+var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}
+return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}
+return val/100;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}
+if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(YAHOO.lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}
+break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';}
+el.style[property]=val;};}
+var testElement=function(node,method){return node&&node.nodeType==1&&(!method||method(node));};YAHOO.util.Dom={get:function(el){if(!el||el.tagName||el.item){return el;}
+if(YAHOO.lang.isString(el)){return document.getElementById(el);}
+if(el.splice){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);}
+return c;}
+return el;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
+var parentNode=null;var pos=[];var box;var doc=el.ownerDocument;if(el.getBoundingClientRect){box=el.getBoundingClientRect();return[box.left+Y.Dom.getDocumentScrollLeft(el.ownerDocument),box.top+Y.Dom.getDocumentScrollTop(el.ownerDocument)];}
+else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;var hasAbs=this.getStyle(el,'position')=='absolute';if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(isSafari&&!hasAbs&&this.getStyle(parentNode,'position')=='absolute'){hasAbs=true;}
+parentNode=parentNode.offsetParent;}}
+if(isSafari&&hasAbs){pos[0]-=el.ownerDocument.body.offsetLeft;pos[1]-=el.ownerDocument.body.offsetTop;}}
+parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName))
+{if(Y.Dom.getStyle(parentNode,'display').search(/^inline|table-row.*$/i)){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
+parentNode=parentNode.parentNode;}
+return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}
+var pageXY=this.getXY(el);if(pageXY===false){return false;}
+var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}
+if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}
+if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
+if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
+if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
+var region=Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
+var nodes=[],elements=root.getElementsByTagName(tag),re=getClassRegEx(className);for(var i=0,len=elements.length;i<len;++i){if(re.test(elements[i].className)){nodes[nodes.length]=elements[i];if(apply){apply.call(elements[i],elements[i]);}}}
+return nodes;},hasClass:function(el,className){var re=getClassRegEx(className);var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return false;}
+el.className=YAHOO.lang.trim([el.className,className].join(' '));return true;};return Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=getClassRegEx(className);var f=function(el){if(!this.hasClass(el,className)){return false;}
+var c=el.className;el.className=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}
+el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(!newClassName||oldClassName===newClassName){return false;}
+var re=getClassRegEx(oldClassName);var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return true;}
+el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}
+el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';var f=function(el){if(el&&el.id){return el.id;}
+var id=prefix+id_counter++;if(el){el.id=id;}
+return id;};return Y.Dom.batch(el,f,Y.Dom,true)||f.apply(Y.Dom,arguments);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}
+var f=function(node){if(haystack.contains&&node.nodeType&&!isSafari){return haystack.contains(node);}
+else if(haystack.compareDocumentPosition&&node.nodeType){return!!(haystack.compareDocumentPosition(node)&16);}else if(node.nodeType){return!!this.getAncestorBy(node,function(el){return el==haystack;});}
+return false;};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){if(isSafari){while(el=el.parentNode){if(el==document.documentElement){return true;}}
+return false;}
+return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];}
+var nodes=[],elements=root.getElementsByTagName(tag);for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];if(apply){apply(elements[i]);}}}
+return nodes;},batch:function(el,method,o,override){el=(el&&el.tagName)?el:Y.Dom.get(el);if(!el||!method){return false;}
+var scope=(override)?o:window;if(el.tagName||(!el.item&&!el.slice)){return method.call(scope,el,o);}
+var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=method.call(scope,el[i],o);}
+return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
+return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
+return width;},getAncestorBy:function(node,method){while(node=node.parentNode){if(testElement(node,method)){return node;}}
+return null;},getAncestorByClassName:function(node,className){node=Y.Dom.get(node);if(!node){return null;}
+var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getAncestorBy(node,method);},getAncestorByTagName:function(node,tagName){node=Y.Dom.get(node);if(!node){return null;}
+var method=function(el){return el.tagName&&el.tagName.toUpperCase()==tagName.toUpperCase();};return Y.Dom.getAncestorBy(node,method);},getPreviousSiblingBy:function(node,method){while(node){node=node.previousSibling;if(testElement(node,method)){return node;}}
+return null;},getPreviousSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
+return Y.Dom.getPreviousSiblingBy(node);},getNextSiblingBy:function(node,method){while(node){node=node.nextSibling;if(testElement(node,method)){return node;}}
+return null;},getNextSibling:function(node){node=Y.Dom.get(node);if(!node){return null;}
+return Y.Dom.getNextSiblingBy(node);},getFirstChildBy:function(node,method){var child=(testElement(node.firstChild,method))?node.firstChild:null;return child||Y.Dom.getNextSiblingBy(node.firstChild,method);},getFirstChild:function(node,method){node=Y.Dom.get(node);if(!node){return null;}
+return Y.Dom.getFirstChildBy(node);},getLastChildBy:function(node,method){if(!node){return null;}
+var child=(testElement(node.lastChild,method))?node.lastChild:null;return child||Y.Dom.getPreviousSiblingBy(node.lastChild,method);},getLastChild:function(node){node=Y.Dom.get(node);return Y.Dom.getLastChildBy(node);},getChildrenBy:function(node,method){var child=Y.Dom.getFirstChildBy(node,method);var children=child?[child]:[];Y.Dom.getNextSiblingBy(child,function(node){if(!method||method(node)){children[children.length]=node;}
+return false;});return children;},getChildren:function(node){node=Y.Dom.get(node);if(!node){}
+return Y.Dom.getChildrenBy(node);},getDocumentScrollLeft:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);},getDocumentScrollTop:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);},insertBefore:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
+return referenceNode.parentNode.insertBefore(newNode,referenceNode);},insertAfter:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;}
+if(referenceNode.nextSibling){return referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);}else{return referenceNode.parentNode.appendChild(newNode);}}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(YAHOO.lang.isArray(x)){y=x[1];x=x[0];}
+this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.0",build:"442"});
+YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
+var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
+if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
+this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
+var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
+return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
+var args=[],ret=true,i,rebuild=false;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
+var argslength=args.length;if(!this.silent){}
+for(i=0;i<len;++i){var s=this.subscribers[i];if(!s){rebuild=true;}else{if(!this.silent){}
+var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
+ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
+if(false===ret){if(!this.silent){}
+return false;}}}
+if(rebuild){var newlist=[],subs=this.subscribers;for(i=0,len=subs.length;i<len;++i){s=subs[i];newlist.push(subs[i]);}
+this.subscribers=newlist;}
+return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
+this.subscribers=[];return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
+this.subscribers[index]=null;},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=YAHOO.lang.isUndefined(obj)?null:obj;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
+return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var webkitKeymap={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){if(DOMReady){setTimeout(function(){var s=window;if(p_override){if(p_override===true){s=p_obj;}else{s=p_override;}}
+p_fn.call(s,"DOMReady",[],p_obj);},0);}else{this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);}},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
+if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
+return ok;}else if(YAHOO.lang.isString(el)){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
+if(!el){return false;}
+if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
+var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
+var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
+legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
+return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
+le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
+return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
+return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
+return ok;}
+if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
+if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners[i]=null;return true;}}
+return false;}
+var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
+if(index>=0){cacheItem=listeners[index];}
+if(!el||!cacheItem){return false;}
+if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist[i]=null;break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
+delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners[index]=null;return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
+return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
+return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
+return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
+return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
+c=c.caller;}}
+return ev;},getCharCode:function(ev){var code=ev.keyCode||ev.charCode||0;if(YAHOO.env.ua.webkit&&(code in webkitKeymap)){code=webkitKeymap[code];}
+return code;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
+return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
+return id;},_isValidCollection:function(o){try{return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");}catch(e){return false;}},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();EU._tryPreloadAttach();}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}
+if(this.isIE){if(!DOMReady){this.startInterval();return false;}}
+this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
+var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
+item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}}
+for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
+retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
+this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn,l.index);}}
+if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
+for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
+return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
+l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
+unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
+j=j-1;}
+l=null;EU.clearCache();}
+for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
+legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var el,d=document,b=d.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){el=document.createElement("script");var p=d.getElementsByTagName("head")[0]||b;p.insertBefore(el,p.firstChild);}else{d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');el=document.getElementById("_yui_eu_dr");}
+if(el){el.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}
+el=null;}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}
+EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}
+YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
+subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var evts=this.__yui_events;if(p_type){var ce=evts[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}}else{for(var i in evts){var ret=true;if(YAHOO.lang.hasOwnProperty(evts,i)){ret=ret&&evts[i].unsubscribe(p_fn,p_obj);}}
+return ret;}
+return false;},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=(opts.silent);var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
+this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
+return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(!ce){return null;}
+var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
+return ce.fire.apply(ce,args);},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
+return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
+if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
+var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
+if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
+function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
+if(!keyData.alt){keyData.alt=false;}
+if(!keyData.ctrl){keyData.ctrl=false;}
+if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
+this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
+this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
+this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
+(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.0",build:"442"});
+YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',_use_default_xhr_header:true,_default_xhr_header:'XMLHttpRequest',_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function()
+{if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,'click',function(e){var obj=YAHOO.util.Event.getTarget(e);if(obj.type=='submit'){YAHOO.util.Connect._submitElementValue=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.value);}});return true;}
+return false;})(),startEvent:new YAHOO.util.CustomEvent('start'),completeEvent:new YAHOO.util.CustomEvent('complete'),successEvent:new YAHOO.util.CustomEvent('success'),failureEvent:new YAHOO.util.CustomEvent('failure'),uploadEvent:new YAHOO.util.CustomEvent('upload'),abortEvent:new YAHOO.util.CustomEvent('abort'),_customEvents:{onStart:['startEvent','start'],onComplete:['completeEvent','complete'],onSuccess:['successEvent','success'],onFailure:['failureEvent','failure'],onUpload:['uploadEvent','upload'],onAbort:['abortEvent','abort']},setProgId:function(id)
+{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
+{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
+{this._use_default_xhr_header=b;},setPollingInterval:function(i)
+{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
+{var obj,http;try
+{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
+catch(e)
+{for(var i=0;i<this._msxml_progid.length;++i){try
+{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
+catch(e){}}}
+finally
+{return obj;}},getConnectionObject:function(isFileUpload)
+{var o;var tId=this._transaction_id;try
+{if(!isFileUpload){o=this.createXhrObject(tId);}
+else{o={};o.tId=tId;o.isUpload=true;}
+if(o){this._transaction_id++;}}
+catch(e){}
+finally
+{return o;}},asyncRequest:function(method,uri,callback,postData)
+{var o=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();if(!o){return null;}
+else{if(callback&&callback.customevents){this.initCustomEvents(o,callback);}
+if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o,callback,uri,postData);return o;}
+if(method.toUpperCase()=='GET'){if(this._sFormData.length!==0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
+else{uri+="?"+this._sFormData;}}
+else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
+o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
+if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
+if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
+this.handleReadyState(o,callback);o.conn.send(postData||null);this.startEvent.fire(o);if(o.startEvent){o.startEvent.fire(o);}
+return o;}},initCustomEvents:function(o,callback)
+{for(var prop in callback.customevents){if(this._customEvents[prop][0]){o[this._customEvents[prop][0]]=new YAHOO.util.CustomEvent(this._customEvents[prop][1],(callback.scope)?callback.scope:null);o[this._customEvents[prop][0]].subscribe(callback.customevents[prop]);}}},handleReadyState:function(o,callback)
+{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
+this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){window.clearTimeout(oConn._timeOut[o.tId]);delete oConn._timeOut[o.tId];}
+oConn.completeEvent.fire(o);if(o.completeEvent){o.completeEvent.fire(o);}
+oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
+{if(!callback){this.releaseObject(o);return;}
+var httpStatus,responseObject;try
+{if(o.conn.status!==undefined&&o.conn.status!==0){httpStatus=o.conn.status;}
+else{httpStatus=13030;}}
+catch(e){httpStatus=13030;}
+if(httpStatus>=200&&httpStatus<300||httpStatus===1223){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
+else{callback.success.apply(callback.scope,[responseObject]);}}
+this.successEvent.fire(responseObject);if(o.successEvent){o.successEvent.fire(responseObject);}}
+else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}
+break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
+else{callback.failure.apply(callback.scope,[responseObject]);}}}
+this.failureEvent.fire(responseObject);if(o.failureEvent){o.failureEvent.fire(responseObject);}}
+this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
+{var obj={};var headerObj={};try
+{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
+catch(e){}
+obj.tId=o.tId;obj.status=(o.conn.status==1223)?204:o.conn.status;obj.statusText=(o.conn.status==1223)?"No Content":o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
+return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
+{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
+else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
+if(callbackArg){obj.argument=callbackArg;}
+return obj;},initHeader:function(label,value,isDefault)
+{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
+else{headerObj[label]=value+","+headerObj[label];}
+if(isDefault){this._has_default_headers=true;}
+else{this._has_http_headers=true;}},setHeader:function(o)
+{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
+if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
+delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
+{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
+else if(typeof formId=='object'){oForm=formId;}
+else{return;}
+if(isUpload){var io=this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
+var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
+{switch(oElement.type)
+{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
+else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
+break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
+break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+'&';}
+else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
+hasSubmit=true;}
+break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}}}
+this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;var io;if(window.ActiveXObject){io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
+else if(typeof secureURI=='string'){io.src=secureUri;}}
+else{io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
+io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
+{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
+return formElements;},uploadFile:function(o,callback,uri,postData){var frameId='yuiIO'+o.tId;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);var oConn=this;var rawFormAttributes={action:this._formNode.getAttribute('action'),method:this._formNode.getAttribute('method'),target:this._formNode.getAttribute('target')};this._formNode.setAttribute('action',uri);this._formNode.setAttribute('method','POST');this._formNode.setAttribute('target',frameId);if(this._formNode.encoding){this._formNode.setAttribute('encoding',uploadEncoding);}
+else{this._formNode.setAttribute('enctype',uploadEncoding);}
+if(postData){var oElements=this.appendPostData(postData);}
+this._formNode.submit();this.startEvent.fire(o);if(o.startEvent){o.startEvent.fire(o);}
+if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
+if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
+for(var prop in rawFormAttributes){if(YAHOO.lang.hasOwnProperty(rawFormAttributes,prop)){if(rawFormAttributes[prop]){this._formNode.setAttribute(prop,rawFormAttributes[prop]);}
+else{this._formNode.removeAttribute(prop);}}}
+this.resetFormState();var uploadCallback=function()
+{if(callback&&callback.timeout){window.clearTimeout(oConn._timeOut[o.tId]);delete oConn._timeOut[o.tId];}
+oConn.completeEvent.fire(o);if(o.completeEvent){o.completeEvent.fire(o);}
+var obj={};obj.tId=o.tId;obj.argument=callback.argument;try
+{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:io.contentWindow.document.documentElement.textContent;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
+catch(e){}
+if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
+else{callback.upload.apply(callback.scope,[obj]);}}
+oConn.uploadEvent.fire(obj);if(o.uploadEvent){o.uploadEvent.fire(obj);}
+if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
+else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
+else{io.removeEventListener('load',uploadCallback,false);}
+setTimeout(function(){document.body.removeChild(io);oConn.releaseObject(o);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
+else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
+else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
+{var abortStatus;if(o.conn){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){window.clearTimeout(this._timeOut[o.tId]);delete this._timeOut[o.tId];}
+abortStatus=true;}}
+else if(o.isUpload===true){var frameId='yuiIO'+o.tId;var io=document.getElementById(frameId);if(io){document.body.removeChild(io);if(isTimeout){window.clearTimeout(this._timeOut[o.tId]);delete this._timeOut[o.tId];}
+abortStatus=true;}}
+else{abortStatus=false;}
+if(abortStatus===true){this.abortEvent.fire(o);if(o.abortEvent){o.abortEvent.fire(o);}
+this.handleTransactionResponse(o,callback,true);}
+else{}
+return abortStatus;},isCallInProgress:function(o)
+{if(o&&o.conn){return o.conn.readyState!==4&&o.conn.readyState!==0;}
+else if(o&&o.isUpload===true){var frameId='yuiIO'+o.tId;return document.getElementById(frameId)?true:false;}
+else{return false;}},releaseObject:function(o)
+{if(o.conn){o.conn=null;}
+o=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.3.0",build:"442"});
+YAHOO.util.Anim=function(el,attributes,duration,method){if(!el){}
+this.init(el,attributes,duration,method);};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName||el;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}
+YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}
+var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}
+return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}
+return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}
+start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i]*1;}}else{end=start+attributes[attr]['by']*1;}}
+this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);return true;},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=!YAHOO.lang.isUndefined(duration)?duration:1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(element){el=YAHOO.util.Dom.get(element);};this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}
+this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}
+YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}
+YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}
+isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
+actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index==-1){return false;}
+queue.splice(index,1);tweenCount-=1;if(tweenCount<=0){this.stop();}
+return true;};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
+queue=[];thread=null;tweenCount=0;}
+else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
+if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
+{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
+tween._onTween.fire();}
+else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}
+return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
+if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
+tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
+for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
+return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}
+var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
+c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
+c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
+return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}
+return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
+val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
+else{val=superclass.doMethod.call(this,attr,start,end);}
+return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}
+this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
+return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
+return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}
+if((t/=d)==1){return b+c;}
+if(!p){p=d*.3;}
+if(!a||a<Math.abs(c)){a=c;var s=p/4;}
+else{var s=p/(2*Math.PI)*Math.asin(c/a);}
+return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}
+if((t/=d)==1){return b+c;}
+if(!p){p=d*.3;}
+if(!a||a<Math.abs(c)){a=c;var s=p/4;}
+else{var s=p/(2*Math.PI)*Math.asin(c/a);}
+return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}
+if((t/=d/2)==2){return b+c;}
+if(!p){p=d*(.3*1.5);}
+if(!a||a<Math.abs(c)){a=c;var s=p/4;}
+else{var s=p/(2*Math.PI)*Math.asin(c/a);}
+if(t<1){return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
+return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
+return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
+return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
+if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
+return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
+return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
+return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}
+return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}
+return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}
+control=tmp;}
+if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}
+if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}
+else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
+start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
+this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
+this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
+else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}
+return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}
+return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.3.0",build:"442"});
+if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
+oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
+if(!this.ids[sGroup]){this.ids[sGroup]={};}
+this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
+var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}
+delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
+this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
+if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
+return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;i<len;++i){if(targets[i].id==oTargetDD.id){return true;}}
+return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(sDDId,sHandleId){return(this.handleIds[sDDId]&&this.handleIds[sDDId][sHandleId]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}
+return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);var dc=this.dragCurrent;if(dc){dc.b4StartDrag(x,y);}
+if(dc){dc.startDrag(x,y);}
+this.dragThreshMet=true;},handleMouseUp:function(e){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}
+this.stopDrag(e);this.stopEvent(e);}},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}
+if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e,silent){if(this.dragCurrent&&!silent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}
+this.dragCurrent.onMouseUp(e);}
+this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){var dc=this.dragCurrent;if(dc){if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}
+if(!this.dragThreshMet){var diffX=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var diffY=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(diffX>this.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
+if(this.dragThreshMet){dc.b4Drag(e);if(dc){dc.onDrag(e);}
+if(dc){this.fireEvents(e,false);}}
+this.stopEvent(e);}},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}
+var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
+if(!this.isOverTarget(pt,ddo,this.mode,curRegion)){outEvts.push(ddo);}
+oldOvers[i]=true;delete this.dragOvers[i];}
+for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
+for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
+if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode,curRegion)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);}
+this.dragOvers[oDD.id]=oDD;}}}}}
+this.interactionInfo={out:outEvts,enter:enterEvts,over:overEvts,drop:dropEvts,point:pt,draggedRegion:curRegion,sourceRegion:this.locationCache[dc.id],validDrop:isDrop};if(isDrop&&!dropEvts.length){this.interactionInfo.validDrop=false;dc.onInvalidDrop(e);}
+if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);if(dc){dc.onDragOut(e,outEvts);}}
+if(enterEvts.length){if(dc){dc.onDragEnter(e,enterEvts);}}
+if(overEvts.length){if(dc){dc.b4DragOver(e,overEvts);}
+if(dc){dc.onDragOver(e,overEvts);}}
+if(dropEvts.length){if(dc){dc.b4DragDrop(e,dropEvts);}
+if(dc){dc.onDragDrop(e,dropEvts);}}}else{var len=0;for(i=0,len=outEvts.length;i<len;++i){if(dc){dc.b4DragOut(e,outEvts[i].id);}
+if(dc){dc.onDragOut(e,outEvts[i].id);}}
+for(i=0,len=enterEvts.length;i<len;++i){if(dc){dc.onDragEnter(e,enterEvts[i].id);}}
+for(i=0,len=overEvts.length;i<len;++i){if(dc){dc.b4DragOver(e,overEvts[i].id);}
+if(dc){dc.onDragOver(e,overEvts[i].id);}}