PageSourceSearch

https://hannarae.net/comm/js/jquery-ui-1.8.4.custom.js

js hannarae.net collected 2026-10-08 01:51:29 UTC 368,427 bytes, 11,280 lines download raw bytes

1/*!
2 * jQuery UI 1.8.4
3 *
4 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://jquery.org/license
7 *
8 * http://docs.jquery.com/UI
9 */
10(function( $, undefined ) {
11
12// prevent duplicate loading
13// this is only a problem because we proxy existing functions
14// and we don't want to double proxy them
15$.ui = $.ui || {};
16if ( $.ui.version ) {
17	return;
18}
19
20//Helper functions and ui object
21$.extend( $.ui, {
22	version: "1.8.4",
23
24	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
25	plugin: {
26		add: function( module, option, set ) {
27			var proto = $.ui[ module ].prototype;
28			for ( var i in set ) {
29				proto.plugins[ i ] = proto.plugins[ i ] || [];
30				proto.plugins[ i ].push( [ option, set[ i ] ] );
31			}
32		},
33		call: function( instance, name, args ) {
34			var set = instance.plugins[ name ];
35			if ( !set || !instance.element[ 0 ].parentNode ) {
36				return;
37			}
38
39			for ( var i = 0; i < set.length; i++ ) {
40				if ( instance.options[ set[ i ][ 0 ] ] ) {
41					set[ i ][ 1 ].apply( instance.element, args );
42				}
43			}
44		}
45	},
46
47	contains: function( a, b ) {
48		return document.compareDocumentPosition ?
49			a.compareDocumentPosition( b ) & 16 :
50			a !== b && a.contains( b );
51	},
52
53	hasScroll: function( el, a ) {
54
55		//If overflow is hidden, the element might have extra content, but the user wants to hide it
56		if ( $( el ).css( "overflow" ) === "hidden") {
57			return false;
58		}
59
60		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
61			has = false;
62
63		if ( el[ scroll ] > 0 ) {
64			return true;
65		}
66
67		// TODO: determine which cases actually cause this to happen
68		// if the element doesn't have the scroll set, see if it's possible to
69		// set the scroll
70		el[ scroll ] = 1;
71		has = ( el[ scroll ] > 0 );
72		el[ scroll ] = 0;
73		return has;
74	},
75
76	isOverAxis: function( x, reference, size ) {
77		//Determines when x coordinate is over "b" element axis
78		return ( x > reference ) && ( x < ( reference + size ) );
79	},
80
81	isOver: function( y, x, top, left, height, width ) {
82		//Determines when x, y coordinates is over "b" element
83		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
84	},
85
86	keyCode: {
87		ALT: 18,
88		BACKSPACE: 8,
89		CAPS_LOCK: 20,
90		COMMA: 188,
91		COMMAND: 91,
92		COMMAND_LEFT: 91, // COMMAND
93		COMMAND_RIGHT: 93,
94		CONTROL: 17,
95		DELETE: 46,
96		DOWN: 40,
97		END: 35,
98		ENTER: 13,
99		ESCAPE: 27,
100		HOME: 36,
101		INSERT: 45,
102		LEFT: 37,
103		MENU: 93, // COMMAND_RIGHT
104		NUMPAD_ADD: 107,
105		NUMPAD_DECIMAL: 110,
106		NUMPAD_DIVIDE: 111,
107		NUMPAD_ENTER: 108,
108		NUMPAD_MULTIPLY: 106,
109		NUMPAD_SUBTRACT: 109,
110		PAGE_DOWN: 34,
111		PAGE_UP: 33,
112		PERIOD: 190,
113		RIGHT: 39,
114		SHIFT: 16,
115		SPACE: 32,
116		TAB: 9,
117		UP: 38,
118		WINDOWS: 91 // COMMAND
119	}
120});
121
122//jQuery plugins
123$.fn.extend({
124	_focus: $.fn.focus,
125	focus: function( delay, fn ) {
126		return typeof delay === "number" ?
127			this.each(function() {
128				var elem = this;
129				setTimeout(function() {
130					$( elem ).focus();
131					if ( fn ) {
132						fn.call( elem );
133					}
134				}, delay );
135			}) :
136			this._focus.apply( this, arguments );
137	},
138
139	enableSelection: function() {
140		return this
141			.attr( "unselectable", "off" )
142			.css( "MozUserSelect", "" );
143	},
144
145	disableSelection: function() {
146		return this
147			.attr( "unselectable", "on" )
148			.css( "MozUserSelect", "none" );
149	},
150
151	scrollParent: function() {
152		var scrollParent;
153		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
154			scrollParent = this.parents().filter(function() {
155				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
156			}).eq(0);
157		} else {
158			scrollParent = this.parents().filter(function() {
159				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)
159);
160			}).eq(0);
161		}
162
163		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
164	},
165
166	zIndex: function( zIndex ) {
167		if ( zIndex !== undefined ) {
168			return this.css( "zIndex", zIndex );
169		}
170
171		if ( this.length ) {
172			var elem = $( this[ 0 ] ), position, value;
173			while ( elem.length && elem[ 0 ] !== document ) {
174				// Ignore z-index if position is set to a value where z-index is ignored by the browser
175				// This makes behavior of this function consistent across browsers
176				// WebKit always returns auto if the element is positioned
177				position = elem.css( "position" );
178				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
179					// IE returns 0 when zIndex is not specified
180					// other browsers return a string
181					// we ignore the case of nested elements with an explicit value of 0
182					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
183					value = parseInt( elem.css( "zIndex" ) );
184					if ( !isNaN( value ) && value != 0 ) {
185						return value;
186					}
187				}
188				elem = elem.parent();
189			}
190		}
191
192		return 0;
193	}
194});
195
196$.each( [ "Width", "Height" ], function( i, name ) {
197	var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
198		type = name.toLowerCase(),
199		orig = {
200			innerWidth: $.fn.innerWidth,
201			innerHeight: $.fn.innerHeight,
202			outerWidth: $.fn.outerWidth,
203			outerHeight: $.fn.outerHeight
204		};
205
206	function reduce( elem, size, border, margin ) {
207		$.each( side, function() {
208			size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
209			if ( border ) {
210				size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
211			}
212			if ( margin ) {
213				size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
214			}
215		});
216		return size;
217	}
218
219	$.fn[ "inner" + name ] = function( size ) {
220		if ( size === undefined ) {
221			return orig[ "inner" + name ].call( this );
222		}
223
224		return this.each(function() {
225			$.style( this, type, reduce( this, size ) + "px" );
226		});
227	};
228
229	$.fn[ "outer" + name] = function( size, margin ) {
230		if ( typeof size !== "number" ) {
231			return orig[ "outer" + name ].call( this, size );
232		}
233
234		return this.each(function() {
235			$.style( this, type, reduce( this, size, true, margin ) + "px" );
236		});
237	};
238});
239
240//Additional selectors
241function visible( element ) {
242	return !$( element ).parents().andSelf().filter(function() {
243		return $.curCSS( this, "visibility" ) === "hidden" ||
244			$.expr.filters.hidden( this );
245	}).length;
246}
247
248$.extend( $.expr[ ":" ], {
249	data: function( elem, i, match ) {
250		return !!$.data( elem, match[ 3 ] );
251	},
252
253	focusable: function( element ) {
254		var nodeName = element.nodeName.toLowerCase(),
255			tabIndex = $.attr( element, "tabindex" );
256		if ( "area" === nodeName ) {
257			var map = element.parentNode,
258				mapName = map.name,
259				img;
260			if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
261				return false;
262			}
263			img = $( "img[usemap=#" + mapName + "]" )[0];
264			return !!img && visible( img );
265		}
266		return ( /input|select|textarea|button|object/.test( nodeName )
267			? !element.disabled
268			: "a" == nodeName
269				? element.href || !isNaN( tabIndex )
270				: !isNaN( tabIndex ))
271			// the element and all of its ancestors must be visible
272			&& visible( element );
273	},
274
275	tabbable: function( element ) {
276		var tabIndex = $.attr( element, "tabindex" );
277		return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
278	}
279});
280
281})( jQuery );
282/*!
283 * jQuery UI Widget 1.8.4
284 *
285 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
286 * Dual licensed under the MIT or GPL Version 2 licenses.
287 * http://jquery.org/license
288 *
289 * http://docs.jquery.com/UI/Widget
290 */
291(function( $, undefined ) {
292
293var _remove = $.fn.remove;
294
295$.fn.remove = function( selector, keepData ) {
296	return this.each(function() {
297		if ( !keepData ) {
298			if ( !selector || $.filter( selector, [ this ] ).length ) {
299				$( "*", this ).add( [ this ] ).each(function() {
300					$( this ).triggerHandler( "remove" );
301				});
302			}
303		}
304		return _remove.call( $(this), selector, keepData );
305	});
306};
307
308$.widget = function( name, base, prototype ) {
309	var namespace = name.split( "." )[ 0 ],
310		fullName;
311	name = name.split( "." )[ 1 ];
312	fullName = namespace + "-" + name;
313
314	if ( !prototype ) {
315		prototype = base;
316		base = $.Widget;
317	}
318
319	// create selector for plugin
320	$.expr[ ":" ][ fullName ] = function( elem ) {
321		return !!$.data( elem, name );
322	};
323
324	$[ namespace ] = $[ namespace ] || {};
325	$[ namespace ][ name ] = function( options, element ) {
326		// allow instantiation without initializing for simple inheritance
327		if ( arguments.length ) {
328			this._createWidget( options, element );
329		}
330	};
331
332	var basePrototype = new base();
333	// we need to make the options hash a property directly on the new instance
334	// otherwise we'll modify the options hash on the prototype that we're
335	// inheriting from
336//	$.each( basePrototype, function( key, val ) {
337//		if ( $.isPlainObject(val) ) {
338//			basePrototype[ key ] = $.extend( {}, val );
339//		}
340//	});
341	basePrototype.options = $.extend( true, {}, basePrototype.options );
342	$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
343		namespace: namespace,
344		widgetName: name,
345		widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
346		widgetBaseClass: fullName
347	}, prototype );
348
349	$.widget.bridge( name, $[ namespace ][ name ] );
350};
351
352$.widget.bridge = function( name, object ) {
353	$.fn[ name ] = function( options ) {
354		var isMethodCall = typeof options === "string",
355			args = Array.prototype.slice.call( arguments, 1 ),
356			returnValue = this;
357
358		// allow multiple hashes to be passed on init
359		options = !isMethodCall && args.length ?
360			$.extend.apply( null, [ true, options ].concat(args) ) :
361			options;
362
363		// prevent calls to internal methods
364		if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
365			return returnValue;
366		}
367
368		if ( isMethodCall ) {
369			this.each(function() {
370				var instance = $.data( this, name ),
371					methodValue = instance && $.isFunction( instance[options] ) ?
372						instance[ options ].apply( instance, args ) :
373						instance;
374				if ( methodValue !== instance && methodValue !== undefined ) {
375					returnValue = methodValue;
376					return false;
377				}
378			});
379		} else {
380			this.each(function() {
381				var instance = $.data( this, name );
382				if ( instance ) {
383					if ( options ) {
384						instance.option( options );
385					}
386					instance._init();
387				} else {
388					$.data( this, name, new object( options, this ) );
389				}
390			});
391		}
392
393		return returnValue;
394	};
395};
396
397$.Widget = function( options, element ) {
398	// allow instantiation without initializing for simple inheritance
399	if ( arguments.length ) {
400		this._createWidget( options, element );
401	}
402};
403
404$.Widget.prototype = {
405	widgetName: "widget",
406	widgetEventPrefix: "",
407	options: {
408		disabled: false
409	},
410	_createWidget: function( options, element ) {
411		// $.widget.bridge stores the plugin instance, but we do it anyway
412		// so that it's stored even before the _create function runs
413		$.data( element, this.widgetName, this );
414		this.element = $( element );
415		this.options = $.extend( true, {},
416			this.options,
417			$.metadata && $.metadata.get( element )[ this.widgetName ],
418			options );
419
420		var self = this;
421		this.element.bind( "remove." + this.widgetName, function() {
422			self.destroy();
423		});
424
425		this._create();
426		this._init();
427	},
428	_create: function() {},
429	_init: function() {},
430
431	destroy: function() {
432		this.element
433			.unbind( "." + this.widgetName )
434			.removeData( this.widgetName );
435		this.widget()
436			.unbind( "." + this.widgetName )
437			.removeAttr( "aria-disabled" )
438			.removeClass(
439				this.widgetBaseClass + "-disabled " +
440				"ui-state-disabled" );
441	},
442
443	widget: function() {
444		return this.element;
445	},
446
447	option: function( key, value ) {
448		var options = key,
449			self = this;
450
451		if ( arguments.length === 0 ) {
452			// don't return a reference to the internal hash
453			return $.extend( {}, self.options );
454		}
455
456		if  (typeof key === "string" ) {
457			if ( value === undefined ) {
458				return this.options[ key ];
459			}
460			options = {};
461			options[ key ] = value;
462		}
463
464		$.each( options, function( key, value ) {
465			self._setOption( key, value );
466		});
467
468		return self;
469	},
470	_setOption: function( key, value ) {
471		this.options[ key ] = value;
472
473		if ( key === "disabled" ) {
474			this.widget()
475				[ value ? "addClass" : "removeClass"](
476					this.widgetBaseClass + "-disabled" + " " +
477					"ui-state-disabled" )
478				.attr( "aria-disabled", value );
479		}
480
481		return this;
482	},
483
484	enable: function() {
485		return this._setOption( "disabled", false );
486	},
487	disable: function() {
488		return this._setOption( "disabled", true );
489	},
490
491	_trigger: function( type, event, data ) {
492		var callback = this.options[ type ];
493
494		event = $.Event( event );
495		event.type = ( type === this.widgetEventPrefix ?
496			type :
497			this.widgetEventPrefix + type ).toLowerCase();
498		data = data || {};
499
500		// copy original event properties over to the new event
501		// this would happen if we could call $.event.fix instead of $.Event
502		// but we don't have a way to force an event to be fixed multiple times
503		if ( event.originalEvent ) {
504			for ( var i = $.event.props.length, prop; i; ) {
505				prop = $.event.props[ --i ];
506				event[ prop ] = event.originalEvent[ prop ];
507			}
508		}
509
510		this.element.trigger( event, data );
511
512		return !( $.isFunction(callback) &&
513			callback.call( this.element[0], event, data ) === false ||
514			event.isDefaultPrevented() );
515	}
516};
517
518})( jQuery );
519/*!
520 * jQuery UI Mouse 1.8.4
521 *
522 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
523 * Dual licensed under the MIT or GPL Version 2 licenses.
524 * http://jquery.org/license
525 *
526 * http://docs.jquery.com/UI/Mouse
527 *
528 * Depends:
529 *	jquery.ui.widget.js
530 */
531(function( $, undefined ) {
532
533$.widget("ui.mouse", {
534	options: {
535		cancel: ':input,option',
536		distance: 1,
537		delay: 0
538	},
539	_mouseInit: function() {
540		var self = this;
541
542		this.element
543			.bind('mousedown.'+this.widgetName, function(event) {
544				return self._mouseDown(event);
545			})
546			.bind('click.'+this.widgetName, function(event) {
547				if(self._preventClickEvent) {
548					self._preventClickEvent = false;
549					event.stopImmediatePropagation();
550					return false;
551				}
552			});
553
554		this.started = false;
555	},
556
557	// TODO: make sure destroying one instance of mouse doesn't mess with
558	// other instances of mouse
559	_mouseDestroy: function() {
560		this.element.unbind('.'+this.widgetName);
561	},
562
563	_mouseDown: function(event) {
564		// don't let more than one widget handle mouseStart
565		// TODO: figure out why we have to use originalEvent
566		event.originalEvent = event.originalEvent || {};
567		if (event.originalEvent.mouseHandled) { return; }
568
569		// we may have missed mouseup (out of window)
570		(this._mouseStarted && this._mouseUp(event));
571
572		this._mouseDownEvent = event;
573
574		var self = this,
575			btnIsLeft = (event.which == 1),
576			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
577		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
578			return true;
579		}
580
581		this.mouseDelayMet = !this.options.delay;
582		if (!this.mouseDelayMet) {
583			this._mouseDelayTimer = setTimeout(function() {
584				self.mouseDelayMet = true;
585			}, this.options.delay);
586		}
587
588		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
589			this._mouseStarted = (this._mouseStart(event) !== false);
590			if (!this._mouseStarted) {
591				event.preventDefault();
592				return true;
593			}
594		}
595
596		// these delegates are required to keep context
597		this._mouseMoveDelegate = function(event) {
598			return self._mouseMove(event);
599		};
600		this._mouseUpDelegate = function(event) {
601			return self._mouseUp(event);
602		};
603		$(document)
604			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
605			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
606
607		// preventDefault() is used to prevent the selection of text here -
608		// however, in Safari, this causes select boxes not to be selectable
609		// anymore, so this fix is needed
610		($.browser.safari || event.preventDefault());
611
612		event.originalEvent.mouseHandled = true;
613		return true;
614	},
615
616	_mouseMove: function(event) {
617		// IE mouseup check - mouseup happened when mouse was out of window
618		if ($.browser.msie && !event.button) {
619			return this._mouseUp(event);
620		}
621
622		if (this._mouseStarted) {
623			this._mouseDrag(event);
624			return event.preventDefault();
625		}
626
627		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
628			this._mouseStarted =
629				(this._mouseStart(this._mouseDownEvent, event) !== false);
630			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
631		}
632
633		return !this._mouseStarted;
634	},
635
636	_mouseUp: function(event) {
637		$(document)
638			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
639			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
640
641		if (this._mouseStarted) {
642			this._mouseStarted = false;
643			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
644			this._mouseStop(event);
645		}
646
647		return false;
648	},
649
650	_mouseDistanceMet: function(event) {
651		return (Math.max(
652				Math.abs(this._mouseDownEvent.pageX - event.pageX),
653				Math.abs(this._mouseDownEvent.pageY - event.pageY)
654			) >= this.options.distance
655		);
656	},
657
658	_mouseDelayMet: function(event) {
659		return this.mouseDelayMet;
660	},
661
662	// These are placeholder methods, to be overriden by extending plugin
663	_mouseStart: function(event) {},
664	_mouseDrag: function(event) {},
665	_mouseStop: function(event) {},
666	_mouseCapture: function(event) { return true; }
667});
668
669})(jQuery);
670/*
671 * jQuery UI Position 1.8.4
672 *
673 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
674 * Dual licensed under the MIT or GPL Version 2 licenses.
675 * http://jquery.org/license
676 *
677 * http://docs.jquery.com/UI/Position
678 */
679(function( $, undefined ) {
680
681$.ui = $.ui || {};
682
683var horizontalPositions = /left|center|right/,
684	horizontalDefault = "center",
685	verticalPositions = /top|center|bottom/,
686	verticalDefault = "center",
687	_position = $.fn.position,
688	_offset = $.fn.offset;
689
690$.fn.position = function( options ) {
691	if ( !options || !options.of ) {
692		return _position.apply( this, arguments );
693	}
694
695	// make a copy, we don't want to modify arguments
696	options = $.extend( {}, options );
697
698	var target = $( options.of ),
699		collision = ( options.collision || "flip" ).split( " " ),
700		offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
701		targetWidth,
702		targetHeight,
703		basePosition;
704
705	if ( options.of.nodeType === 9 ) {
706		targetWidth = target.width();
707		targetHeight = target.height();
708		basePosition = { top: 0, left: 0 };
709	} else if ( options.of.scrollTo && options.of.document ) {
710		targetWidth = target.width();
711		targetHeight = target.height();
712		basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
713	} else if ( options.of.preventDefault ) {
714		// force left top to allow flipping
715		options.at = "left top";
716		targetWidth = targetHeight = 0;
717		basePosition = { top: options.of.pageY, left: options.of.pageX };
718	} else {
719		targetWidth = target.outerWidth();
720		targetHeight = target.outerHeight();
721		basePosition = target.offset();
722	}
723
724	// force my and at to have valid horizontal and veritcal positions
725	// if a value is missing or invalid, it will be converted to center
726	$.each( [ "my", "at" ], function() {
727		var pos = ( options[this] || "" ).split( " " );
728		if ( pos.length === 1) {
729			pos = horizontalPositions.test( pos[0] ) ?
730				pos.concat( [verticalDefault] ) :
731				verticalPositions.test( pos[0] ) ?
732					[ horizontalDefault ].concat( pos ) :
733					[ horizontalDefault, verticalDefault ];
734		}
735		pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
736		pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
737		options[ this ] = pos;
738	});
739
740	// normalize collision option
741	if ( collision.length === 1 ) {
742		collision[ 1 ] = collision[ 0 ];
743	}
744
745	// normalize offset option
746	offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
747	if ( offset.length === 1 ) {
748		offset[ 1 ] = offset[ 0 ];
749	}
750	offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
751
752	if ( options.at[0] === "right" ) {
753		basePosition.left += targetWidth;
754	} else if (options.at[0] === horizontalDefault ) {
755		basePosition.left += targetWidth / 2;
756	}
757
758	if ( options.at[1] === "bottom" ) {
759		basePosition.top += targetHeight;
760	} else if ( options.at[1] === verticalDefault ) {
761		basePosition.top += targetHeight / 2;
762	}
763
764	basePosition.left += offset[ 0 ];
765	basePosition.top += offset[ 1 ];
766
767	return this.each(function() {
768		var elem = $( this ),
769			elemWidth = elem.outerWidth(),
770			elemHeight = elem.outerHeight(),
771			position = $.extend( {}, basePosition );
772
773		if ( options.my[0] === "right" ) {
774			position.left -= elemWidth;
775		} else if ( options.my[0] === horizontalDefault ) {
776			position.left -= elemWidth / 2;
777		}
778
779		if ( options.my[1] === "bottom" ) {
780			position.top -= elemHeight;
781		} else if ( options.my[1] === verticalDefault ) {
782			position.top -= elemHeight / 2;
783		}
784
785		// prevent fractions (see #5280)
786		position.left = parseInt( position.left );
787		position.top = parseInt( position.top );
788
789		$.each( [ "left", "top" ], function( i, dir ) {
790			if ( $.ui.position[ collision[i] ] ) {
791				$.ui.position[ collision[i] ][ dir ]( position, {
792					targetWidth: targetWidth,
793					targetHeight: targetHeight,
794					elemWidth: elemWidth,
795					elemHeight: elemHeight,
796					offset: offset,
797					my: options.my,
798					at: options.at
799				});
800			}
801		});
802
803		if ( $.fn.bgiframe ) {
804			elem.bgiframe();
805		}
806		elem.offset( $.extend( position, { using: options.using } ) );
807	});
808};
809
810$.ui.position = {
811	fit: {
812		left: function( position, data ) {
813			var win = $( window ),
814				over = position.left + data.elemWidth - win.width() - win.scrollLeft();
815			position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
816		},
817		top: function( position, data ) {
818			var win = $( window ),
819				over = position.top + data.elemHeight - win.height() - win.scrollTop();
820			position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
821		}
822	},
823
824	flip: {
825		left: function( position, data ) {
826			if ( data.at[0] === "center" ) {
827				return;
828			}
829			var win = $( window ),
830				over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
831				myOffset = data.my[ 0 ] === "left" ?
832					-data.elemWidth :
833					data.my[ 0 ] === "right" ?
834						data.elemWidth :
835						0,
836				offset = -2 * data.offset[ 0 ];
837			position.left += position.left < 0 ?
838				myOffset + data.targetWidth + offset :
839				over > 0 ?
840					myOffset - data.targetWidth + offset :
841					0;
842		},
843		top: function( position, data ) {
844			if ( data.at[1] === "center" ) {
845				return;
846			}
847			var win = $( window ),
848				over = position.top + data.elemHeight - win.height() - win.scrollTop(),
849				myOffset = data.my[ 1 ] === "top" ?
850					-data.elemHeight :
851					data.my[ 1 ] === "bottom" ?
852						data.elemHeight :
853						0,
854				atOffset = data.at[ 1 ] === "top" ?
855					data.targetHeight :
856					-data.targetHeight,
857				offset = -2 * data.offset[ 1 ];
858			position.top += position.top < 0 ?
859				myOffset + data.targetHeight + offset :
860				over > 0 ?
861					myOffset + atOffset + offset :
862					0;
863		}
864	}
865};
866
867// offset setter from jQuery 1.4
868if ( !$.offset.setOffset ) {
869	$.offset.setOffset = function( elem, options ) {
870		// set position first, in-case top/left are set even on static elem
871		if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
872			elem.style.position = "relative";
873		}
874		var curElem   = $( elem ),
875			curOffset = curElem.offset(),
876			curTop    = parseInt( $.curCSS( elem, "top",  true ), 10 ) || 0,
877			curLeft   = parseInt( $.curCSS( elem, "left", true ), 10)  || 0,
878			props     = {
879				top:  (options.top  - curOffset.top)  + curTop,
880				left: (options.left - curOffset.left) + curLeft
881			};
882
883		if ( 'using' in options ) {
884			options.using.call( elem, props );
885		} else {
886			curElem.css( props );
887		}
888	};
889
890	$.fn.offset = function( options ) {
891		var elem = this[ 0 ];
892		if ( !elem || !elem.ownerDocument ) { return null; }
893		if ( options ) {
894			return this.each(function() {
895				$.offset.setOffset( this, options );
896			});
897		}
898		return _offset.call( this );
899	};
900}
901
902}( jQuery ));
903/*
904 * jQuery UI Draggable 1.8.4
905 *
906 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
907 * Dual licensed under the MIT or GPL Version 2 licenses.
908 * http://jquery.org/license
909 *
910 * http://docs.jquery.com/UI/Draggables
911 *
912 * Depends:
913 *	jquery.ui.core.js
914 *	jquery.ui.mouse.js
915 *	jquery.ui.widget.js
916 */
917(function( $, undefined ) {
918
919$.widget("ui.draggable", $.ui.mouse, {
920	widgetEventPrefix: "drag",
921	options: {
922		addClasses: true,
923		appendTo: "parent",
924		axis: false,
925		connectToSortable: false,
926		containment: false,
927		cursor: "auto",
928		cursorAt: false,
929		grid: false,
930		handle: false,
931		helper: "original",
932		iframeFix: false,
933		opacity: false,
934		refreshPositions: false,
935		revert: false,
936		revertDuration: 500,
937		scope: "default",
938		scroll: true,
939		scrollSensitivity: 20,
940		scrollSpeed: 20,
941		snap: false,
942		snapMode: "both",
943		snapTolerance: 20,
944		stack: false,
945		zIndex: false
946	},
947	_create: function() {
948
949		if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
950			this.element[0].style.position = 'relative';
951
952		(this.options.addClasses && this.element.addClass("ui-draggable"));
953		(this.options.disabled && this.element.addClass("ui-draggable-disabled"));
954
955		this._mouseInit();
956
957	},
958
959	destroy: function() {
960		if(!this.element.data('draggable')) return;
961		this.element
962			.removeData("draggable")
963			.unbind(".draggable")
964			.removeClass("ui-draggable"
965				+ " ui-draggable-dragging"
966				+ " ui-draggable-disabled");
967		this._mouseDestroy();
968
969		return this;
970	},
971
972	_mouseCapture: function(event) {
973
974		var o = this.options;
975
976		// among others, prevent a drag on a resizable-handle
977		if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
978			return false;
979
980		//Quit if we're not on a valid handle
981		this.handle = this._getHandle(event);
982		if (!this.handle)
983			return false;
984
985		return true;
986
987	},
988
989	_mouseStart: function(event) {
990
991		var o = this.options;
992
993		//Create and append the visible helper
994		this.helper = this._createHelper(event);
995
996		//Cache the helper size
997		this._cacheHelperProportions();
998
999		//If ddmanager is used for droppables, set the global draggable
1000		if($.ui.ddmanager)
1001			$.ui.ddmanager.current = this;
1002
1003		/*
1004		 * - Position generation -
1005		 * This block generates everything position related - it's the core of draggables.
1006		 */
1007
1008		//Cache the margins of the original element
1009		this._cacheMargins();
1010
1011		//Store the helper's css position
1012		this.cssPosition = this.helper.css("position");
1013		this.scrollParent = this.helper.scrollParent();
1014
1015		//The element's absolute position on the page minus margins
1016		this.offset = this.positionAbs = this.element.offset();
1017		this.offset = {
1018			top: this.offset.top - this.margins.top,
1019			left: this.offset.left - this.margins.left
1020		};
1021
1022		$.extend(this.offset, {
1023			click: { //Where the click happened, relative to the element
1024				left: event.pageX - this.offset.left,
1025				top: event.pageY - this.offset.top
1026			},
1027			parent: this._getParentOffset(),
1028			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
1029		});
1030
1031		//Generate the original position
1032		this.originalPosition = this.position = this._generatePosition(event);
1033		this.originalPageX = event.pageX;
1034		this.originalPageY = event.pageY;
1035
1036		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
1037		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
1038
1039		//Set a containment if given in the options
1040		if(o.containment)
1041			this._setContainment();
1042
1043		//Trigger event + callbacks
1044		if(this._trigger("start", event) === false) {
1045			this._clear();
1046			return false;
1047		}
1048
1049		//Recache the helper size
1050		this._cacheHelperProportions();
1051
1052		//Prepare the droppable offsets
1053		if ($.ui.ddmanager && !o.dropBehaviour)
1054			$.ui.ddmanager.prepareOffsets(this, event);
1055
1056		this.helper.addClass("ui-draggable-dragging");
1057		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1058		return true;
1059	},
1060
1061	_mouseDrag: function(event, noPropagation) {
1062
1063		//Compute the helpers position
1064		this.position = this._generatePosition(event);
1065		this.positionAbs = this._convertPositionTo("absolute");
1066
1067		//Call plugins and callbacks and use the resulting position if something is returned
1068		if (!noPropagation) {
1069			var ui = this._uiHash();
1070			if(this._trigger('drag', event, ui) === false) {
1071				this._mouseUp({});
1072				return false;
1073			}
1074			this.position = ui.position;
1075		}
1076
1077		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
1078		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
1079		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
1080
1081		return false;
1082	},
1083
1084	_mouseStop: function(event) {
1085
1086		//If we are using droppables, inform the manager about the drop
1087		var dropped = false;
1088		if ($.ui.ddmanager && !this.options.dropBehaviour)
1089			dropped = $.ui.ddmanager.drop(this, event);
1090
1091		//if a drop comes from outside (a sortable)
1092		if(this.dropped) {
1093			dropped = this.dropped;
1094			this.dropped = false;
1095		}
1096
1097		//if the original element is removed, don't bother to continue
1098		if(!this.element[0] || !this.element[0].parentNode)
1099			return false;
1100
1101		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
1102			var self = this;
1103			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
1104				if(self._trigger("stop", event) !== false) {
1105					self._clear();
1106				}
1107			});
1108		} else {
1109			if(this._trigger("stop", event) !== false) {
1110				this._clear();
1111			}
1112		}
1113
1114		return false;
1115	},
1116
1117	cancel: function() {
1118
1119		if(this.helper.is(".ui-draggable-dragging")) {
1120			this._mouseUp({});
1121		} else {
1122			this._clear();
1123		}
1124
1125		return this;
1126
1127	},
1128
1129	_getHandle: function(event) {
1130
1131		var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
1132		$(this.options.handle, this.element)
1133			.find("*")
1134			.andSelf()
1135			.each(function() {
1136				if(this == event.target) handle = true;
1137			});
1138
1139		return handle;
1140
1141	},
1142
1143	_createHelper: function(event) {
1144
1145		var o = this.options;
1146		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
1147
1148		if(!helper.parents('body').length)
1149			helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
1150
1151		if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
1152			helper.css("position", "absolute");
1153
1154		return helper;
1155
1156	},
1157
1158	_adjustOffsetFromHelper: function(obj) {
1159		if (typeof obj == 'string') {
1160			obj = obj.split(' ');
1161		}
1162		if ($.isArray(obj)) {
1163			obj = {left: +obj[0], top: +obj[1] || 0};
1164		}
1165		if ('left' in obj) {
1166			this.offset.click.left = obj.left + this.margins.left;
1167		}
1168		if ('right' in obj) {
1169			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1170		}
1171		if ('top' in obj) {
1172			this.offset.click.top = obj.top + this.margins.top;
1173		}
1174		if ('bottom' in obj) {
1175			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1176		}
1177	},
1178
1179	_getParentOffset: function() {
1180
1181		//Get the offsetParent and cache its position
1182		this.offsetParent = this.helper.offsetParent();
1183		var po = this.offsetParent.offset();
1184
1185		// This is a special case where we need to modify a offset calculated on start, since the following happened:
1186		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
1187		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
1188		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
1189		if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
1190			po.left += this.scrollParent.scrollLeft();
1191			po.top += this.scrollParent.scrollTop();
1192		}
1193
1194		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
1195		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
1196			po = { top: 0, left: 0 };
1197
1198		return {
1199			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
1200			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
1201		};
1202
1203	},
1204
1205	_getRelativeOffset: function() {
1206
1207		if(this.cssPosition == "relative") {
1208			var p = this.element.position();
1209			return {
1210				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
1211				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
1212			};
1213		} else {
1214			return { top: 0, left: 0 };
1215		}
1216
1217	},
1218
1219	_cacheMargins: function() {
1220		this.margins = {
1221			left: (parseInt(this.element.css("marginLeft"),10) || 0),
1222			top: (parseInt(this.element.css("marginTop"),10) || 0)
1223		};
1224	},
1225
1226	_cacheHelperProportions: function() {
1227		this.helperProportions = {
1228			width: this.helper.outerWidth(),
1229			height: this.helper.outerHeight()
1230		};
1231	},
1232
1233	_setContainment: function() {
1234
1235		var o = this.options;
1236		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
1237		if(o.containment == 'document' || o.containment == 'window') this.containment = [
1238			0 - this.offset.relative.left - this.offset.parent.left,
1239			0 - this.offset.relative.top - this.offset.parent.top,
1240			$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
1241			($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
1242		];
1243
1244		if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
1245			var ce = $(o.containment)[0]; if(!ce) return;
1246			var co = $(o.containment).offset();
1247			var over = ($(ce).css("overflow") != 'hidden');
1248
1249			this.containment = [
1250				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
1251				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
1252				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
1253				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
1254			];
1255		} else if(o.containment.constructor == Array) {
1256			this.containment = o.containment;
1257		}
1258
1259	},
1260
1261	_convertPositionTo: function(d, pos) {
1262
1263		if(!pos) pos = this.position;
1264		var mod = d == "absolute" ? 1 : -1;
1265		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1266
1267		return {
1268			top: (
1269				pos.top																	// The absolute mouse position
1270				+ this.offset.relative.top * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
1271				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
1272				- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
1273			),
1274			left: (
1275				pos.left																// The absolute mouse position
1276				+ this.offset.relative.left * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
1277				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
1278				- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
1279			)
1280		};
1281
1282	},
1283
1284	_generatePosition: function(event) {
1285
1286		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1287		var pageX = event.pageX;
1288		var pageY = event.pageY;
1289
1290		/*
1291		 * - Position constraining -
1292		 * Constrain the position to a mix of grid, containment.
1293		 */
1294
1295		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
1296
1297			if(this.containment) {
1298				if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
1299				if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
1300				if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
1301				if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
1302			}
1303
1304			if(o.grid) {
1305				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
1306				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
1307
1308				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
1309				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
1310			}
1311
1312		}
1313
1314		return {
1315			top: (
1316				pageY																// The absolute mouse position
1317				- this.offset.click.top													// Click offset (relative to the element)
1318				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
1319				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
1320				+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
1321			),
1322			left: (
1323				pageX																// The absolute mouse position
1324				- this.offset.click.left												// Click offset (relative to the element)
1325				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
1326				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
1327				+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
1328			)
1329		};
1330
1331	},
1332
1333	_clear: function() {
1334		this.helper.removeClass("ui-draggable-dragging");
1335		if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
1336		//if($.ui.ddmanager) $.ui.ddmanager.current = null;
1337		this.helper = null;
1338		this.cancelHelperRemoval = false;
1339	},
1340
1341	// From now on bulk stuff - mainly helpers
1342
1343	_trigger: function(type, event, ui) {
1344		ui = ui || this._uiHash();
1345		$.ui.plugin.call(this, type, [event, ui]);
1346		if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
1347		return $.Widget.prototype._trigger.call(this, type, event, ui);
1348	},
1349
1350	plugins: {},
1351
1352	_uiHash: function(event) {
1353		return {
1354			helper: this.helper,
1355			position: this.position,
1356			originalPosition: this.originalPosition,
1357			offset: this.positionAbs
1358		};
1359	}
1360
1361});
1362
1363$.extend($.ui.draggable, {
1364	version: "1.8.4"
1365});
1366
1367$.ui.plugin.add("draggable", "connectToSortable", {
1368	start: function(event, ui) {
1369
1370		var inst = $(this).data("draggable"), o = inst.options,
1371			uiSortable = $.extend({}, ui, { item: inst.element });
1372		inst.sortables = [];
1373		$(o.connectToSortable).each(function() {
1374			var sortable = $.data(this, 'sortable');
1375			if (sortable && !sortable.options.disabled) {
1376				inst.sortables.push({
1377					instance: sortable,
1378					shouldRevert: sortable.options.revert
1379				});
1380				sortable._refreshItems();	//Do a one-time refresh at start to refresh the containerCache
1381				sortable._trigger("activate", event, uiSortable);
1382			}
1383		});
1384
1385	},
1386	stop: function(event, ui) {
1387
1388		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
1389		var inst = $(this).data("draggable"),
1390			uiSortable = $.extend({}, ui, { item: inst.element });
1391
1392		$.each(inst.sortables, function() {
1393			if(this.instance.isOver) {
1394
1395				this.instance.isOver = 0;
1396
1397				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
1398				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
1399
1400				//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
1401				if(this.shouldRevert) this.instance.options.revert = true;
1402
1403				//Trigger the stop of the sortable
1404				this.instance._mouseStop(event);
1405
1406				this.instance.options.helper = this.instance.options._helper;
1407
1408				//If the helper has been the original item, restore properties in the sortable
1409				if(inst.options.helper == 'original')
1410					this.instance.currentItem.css({ top: 'auto', left: 'auto' });
1411
1412			} else {
1413				this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
1414				this.instance._trigger("deactivate", event, uiSortable);
1415			}
1416
1417		});
1418
1419	},
1420	drag: function(event, ui) {
1421
1422		var inst = $(this).data("draggable"), self = this;
1423
1424		var checkPos = function(o) {
1425			var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
1426			var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
1427			var itemHeight = o.height, itemWidth = o.width;
1428			var itemTop = o.top, itemLeft = o.left;
1429
1430			return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
1431		};
1432
1433		$.each(inst.sortables, function(i) {
1434
1435			//Copy over some variables to allow calling the sortable's native _intersectsWith
1436			this.instance.positionAbs = inst.positionAbs;
1437			this.instance.helperProportions = inst.helperProportions;
1438			this.instance.offset.click = inst.offset.click;
1439
1440			if(this.instance._intersectsWith(this.instance.containerCache)) {
1441
1442				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
1443				if(!this.instance.isOver) {
1444
1445					this.instance.isOver = 1;
1446					//Now we fake the start of dragging for the sortable instance,
1447					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
1448					//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
1449					this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
1450					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
1451					this.instance.options.helper = function() { return ui.helper[0]; };
1452
1453					event.target = this.instance.currentItem[0];
1454					this.instance._mouseCapture(event, true);
1455					this.instance._mouseStart(event, true, true);
1456
1457					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
1458					this.instance.offset.click.top = inst.offset.click.top;
1459					this.instance.offset.click.left = inst.offset.click.left;
1460					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
1461					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
1462
1463					inst._trigger("toSortable", event);
1464					inst.dropped = this.instance.element; //draggable revert needs that
1465					//hack so receive/update callbacks work (mostly)
1466					inst.currentItem = inst.element;
1467					this.instance.fromOutside = inst;
1468
1469				}
1470
1471				//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
1472				if(this.instance.currentItem) this.instance._mouseDrag(event);
1473
1474			} else {
1475
1476				//If it doesn't intersect with the sortable, and it intersected before,
1477				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
1478				if(this.instance.isOver) {
1479
1480					this.instance.isOver = 0;
1481					this.instance.cancelHelperRemoval = true;
1482
1483					//Prevent reverting on this forced stop
1484					this.instance.options.revert = false;
1485
1486					// The out event needs to be triggered independently
1487					this.instance._trigger('out', event, this.instance._uiHash(this.instance));
1488
1489					this.instance._mouseStop(event, true);
1490					this.instance.options.helper = this.instance.options._helper;
1491
1492					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
1493					this.instance.currentItem.remove();
1494					if(this.instance.placeholder) this.instance.placeholder.remove();
1495
1496					inst._trigger("fromSortable", event);
1497					inst.dropped = false; //draggable revert needs that
1498				}
1499
1500			};
1501
1502		});
1503
1504	}
1505});
1506
1507$.ui.plugin.add("draggable", "cursor", {
1508	start: function(event, ui) {
1509		var t = $('body'), o = $(this).data('draggable').options;
1510		if (t.css("cursor")) o._cursor = t.css("cursor");
1511		t.css("cursor", o.cursor);
1512	},
1513	stop: function(event, ui) {
1514		var o = $(this).data('draggable').options;
1515		if (o._cursor) $('body').css("cursor", o._cursor);
1516	}
1517});
1518
1519$.ui.plugin.add("draggable", "iframeFix", {
1520	start: function(event, ui) {
1521		var o = $(this).data('draggable').options;
1522		$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1523			$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1524			.css({
1525				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1526				position: "absolute", opacity: "0.001", zIndex: 1000
1527			})
1528			.css($(this).offset())
1529			.appendTo("body");
1530		});
1531	},
1532	stop: function(event, ui) {
1533		$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
1534	}
1535});
1536
1537$.ui.plugin.add("draggable", "opacity", {
1538	start: function(event, ui) {
1539		var t = $(ui.helper), o = $(this).data('draggable').options;
1540		if(t.css("opacity")) o._opacity = t.css("opacity");
1541		t.css('opacity', o.opacity);
1542	},
1543	stop: function(event, ui) {
1544		var o = $(this).data('draggable').options;
1545		if(o._opacity) $(ui.helper).css('opacity', o._opacity);
1546	}
1547});
1548
1549$.ui.plugin.add("draggable", "scroll", {
1550	start: function(event, ui) {
1551		var i = $(this).data("draggable");
1552		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
1553	},
1554	drag: function(event, ui) {
1555
1556		var i = $(this).data("draggable"), o = i.options, scrolled = false;
1557
1558		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
1559
1560			if(!o.axis || o.axis != 'x') {
1561				if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
1562					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
1563				else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
1564					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
1565			}
1566
1567			if(!o.axis || o.axis != 'y') {
1568				if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
1569					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
1570				else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
1571					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
1572			}
1573
1574		} else {
1575
1576			if(!o.axis || o.axis != 'x') {
1577				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
1578					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1579				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
1580					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1581			}
1582
1583			if(!o.axis || o.axis != 'y') {
1584				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
1585					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1586				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
1587					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1588			}
1589
1590		}
1591
1592		if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
1593			$.ui.ddmanager.prepareOffsets(i, event);
1594
1595	}
1596});
1597
1598$.ui.plugin.add("draggable", "snap", {
1599	start: function(event, ui) {
1600
1601		var i = $(this).data("draggable"), o = i.options;
1602		i.snapElements = [];
1603
1604		$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
1605			var $t = $(this); var $o = $t.offset();
1606			if(this != i.element[0]) i.snapElements.push({
1607				item: this,
1608				width: $t.outerWidth(), height: $t.outerHeight(),
1609				top: $o.top, left: $o.left
1610			});
1611		});
1612
1613	},
1614	drag: function(event, ui) {
1615
1616		var inst = $(this).data("draggable"), o = inst.options;
1617		var d = o.snapTolerance;
1618
1619		var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1620			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1621
1622		for (var i = inst.snapElements.length - 1; i >= 0; i--){
1623
1624			var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
1625				t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
1626
1627			//Yes, I know, this is insane ;)
1628			if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
1629				if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1630				inst.snapElements[i].snapping = false;
1631				continue;
1632			}
1633
1634			if(o.snapMode != 'inner') {
1635				var ts = Math.abs(t - y2) <= d;
1636				var bs = Math.abs(b - y1) <= d;
1637				var ls = Math.abs(l - x2) <= d;
1638				var rs = Math.abs(r - x1) <= d;
1639				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1640				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
1641				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
1642				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
1643			}
1644
1645			var first = (ts || bs || ls || rs);
1646
1647			if(o.snapMode != 'outer') {
1648				var ts = Math.abs(t - y1) <= d;
1649				var bs = Math.abs(b - y2) <= d;
1650				var ls = Math.abs(l - x1) <= d;
1651				var rs = Math.abs(r - x2) <= d;
1652				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
1653				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1654				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
1655				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
1656			}
1657
1658			if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
1659				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1660			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
1661
1662		};
1663
1664	}
1665});
1666
1667$.ui.plugin.add("draggable", "stack", {
1668	start: function(event, ui) {
1669
1670		var o = $(this).data("draggable").options;
1671
1672		var group = $.makeArray($(o.stack)).sort(function(a,b) {
1673			return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
1674		});
1675		if (!group.length) { return; }
1676
1677		var min = parseInt(group[0].style.zIndex) || 0;
1678		$(group).each(function(i) {
1679			this.style.zIndex = min + i;
1680		});
1681
1682		this[0].style.zIndex = min + group.length;
1683
1684	}
1685});
1686
1687$.ui.plugin.add("draggable", "zIndex", {
1688	start: function(event, ui) {
1689		var t = $(ui.helper), o = $(this).data("draggable").options;
1690		if(t.css("zIndex")) o._zIndex = t.css("zIndex");
1691		t.css('zIndex', o.zIndex);
1692	},
1693	stop: function(event, ui) {
1694		var o = $(this).data("draggable").options;
1695		if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
1696	}
1697});
1698
1699})(jQuery);
1700/*
1701 * jQuery UI Droppable 1.8.4
1702 *
1703 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
1704 * Dual licensed under the MIT or GPL Version 2 licenses.
1705 * http://jquery.org/license
1706 *
1707 * http://docs.jquery.com/UI/Droppables
1708 *
1709 * Depends:
1710 *	jquery.ui.core.js
1711 *	jquery.ui.widget.js
1712 *	jquery.ui.mouse.js
1713 *	jquery.ui.draggable.js
1714 */
1715(function( $, undefined ) {
1716
1717$.widget("ui.droppable", {
1718	widgetEventPrefix: "drop",
1719	options: {
1720		accept: '*',
1721		activeClass: false,
1722		addClasses: true,
1723		greedy: false,
1724		hoverClass: false,
1725		scope: 'default',
1726		tolerance: 'intersect'
1727	},
1728	_create: function() {
1729
1730		var o = this.options, accept = o.accept;
1731		this.isover = 0; this.isout = 1;
1732
1733		this.accept = $.isFunction(accept) ? accept : function(d) {
1734			return d.is(accept);
1735		};
1736
1737		//Store the droppable's proportions
1738		this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
1739
1740		// Add the reference and positions to the manager
1741		$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
1742		$.ui.ddmanager.droppables[o.scope].push(this);
1743
1744		(o.addClasses && this.element.addClass("ui-droppable"));
1745
1746	},
1747
1748	destroy: function() {
1749		var drop = $.ui.ddmanager.droppables[this.options.scope];
1750		for ( var i = 0; i < drop.length; i++ )
1751			if ( drop[i] == this )
1752				drop.splice(i, 1);
1753
1754		this.element
1755			.removeClass("ui-droppable ui-droppable-disabled")
1756			.removeData("droppable")
1757			.unbind(".droppable");
1758
1759		return this;
1760	},
1761
1762	_setOption: function(key, value) {
1763
1764		if(key == 'accept') {
1765			this.accept = $.isFunction(value) ? value : function(d) {
1766				return d.is(value);
1767			};
1768		}
1769		$.Widget.prototype._setOption.apply(this, arguments);
1770	},
1771
1772	_activate: function(event) {
1773		var draggable = $.ui.ddmanager.current;
1774		if(this.options.activeClass) this.element.addClass(this.options.activeClass);
1775		(draggable && this._trigger('activate', event, this.ui(draggable)));
1776	},
1777
1778	_deactivate: function(event) {
1779		var draggable = $.ui.ddmanager.current;
1780		if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1781		(draggable && this._trigger('deactivate', event, this.ui(draggable)));
1782	},
1783
1784	_over: function(event) {
1785
1786		var draggable = $.ui.ddmanager.current;
1787		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1788
1789		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1790			if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
1791			this._trigger('over', event, this.ui(draggable));
1792		}
1793
1794	},
1795
1796	_out: function(event) {
1797
1798		var draggable = $.ui.ddmanager.current;
1799		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1800
1801		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1802			if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1803			this._trigger('out', event, this.ui(draggable));
1804		}
1805
1806	},
1807
1808	_drop: function(event,custom) {
1809
1810		var draggable = custom || $.ui.ddmanager.current;
1811		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
1812
1813		var childrenIntersection = false;
1814		this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
1815			var inst = $.data(this, 'droppable');
1816			if(
1817				inst.options.greedy
1818				&& !inst.options.disabled
1819				&& inst.options.scope == draggable.options.scope
1820				&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
1821				&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
1822			) { childrenIntersection = true; return false; }
1823		});
1824		if(childrenIntersection) return false;
1825
1826		if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1827			if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1828			if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1829			this._trigger('drop', event, this.ui(draggable));
1830			return this.element;
1831		}
1832
1833		return false;
1834
1835	},
1836
1837	ui: function(c) {
1838		return {
1839			draggable: (c.currentItem || c.element),
1840			helper: c.helper,
1841			position: c.position,
1842			offset: c.positionAbs
1843		};
1844	}
1845
1846});
1847
1848$.extend($.ui.droppable, {
1849	version: "1.8.4"
1850});
1851
1852$.ui.intersect = function(draggable, droppable, toleranceMode) {
1853
1854	if (!droppable.offset) return false;
1855
1856	var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
1857		y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
1858	var l = droppable.offset.left, r = l + droppable.proportions.width,
1859		t = droppable.offset.top, b = t + droppable.proportions.height;
1860
1861	switch (toleranceMode) {
1862		case 'fit':
1863			return (l <= x1 && x2 <= r
1864				&& t <= y1 && y2 <= b);
1865			break;
1866		case 'intersect':
1867			return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
1868				&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
1869				&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
1870				&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
1871			break;
1872		case 'pointer':
1873			var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
1874				draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
1875				isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
1876			return isOver;
1877			break;
1878		case 'touch':
1879			return (
1880					(y1 >= t && y1 <= b) ||	// Top edge touching
1881					(y2 >= t && y2 <= b) ||	// Bottom edge touching
1882					(y1 < t && y2 > b)		// Surrounded vertically
1883				) && (
1884					(x1 >= l && x1 <= r) ||	// Left edge touching
1885					(x2 >= l && x2 <= r) ||	// Right edge touching
1886					(x1 < l && x2 > r)		// Surrounded horizontally
1887				);
1888			break;
1889		default:
1890			return false;
1891			break;
1892		}
1893
1894};
1895
1896/*
1897	This manager tracks offsets of draggables and droppables
1898*/
1899$.ui.ddmanager = {
1900	current: null,
1901	droppables: { 'default': [] },
1902	prepareOffsets: function(t, event) {
1903
1904		var m = $.ui.ddmanager.droppables[t.options.scope] || [];
1905		var type = event ? event.type : null; // workaround for #2317
1906		var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
1907
1908		droppablesLoop: for (var i = 0; i < m.length; i++) {
1909
1910			if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue;	//No disabled and non-accepted
1911			for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
1912			m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; 									//If the element is not visible, continue
1913
1914			m[i].offset = m[i].element.offset();
1915			m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
1916
1917			if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
1918
1919		}
1920
1921	},
1922	drop: function(draggable, event) {
1923
1924		var dropped = false;
1925		$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
1926
1927			if(!this.options) return;
1928			if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
1929				dropped = dropped || this._drop.call(this, event);
1930
1931			if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1932				this.isout = 1; this.isover = 0;
1933				this._deactivate.call(this, event);
1934			}
1935
1936		});
1937		return dropped;
1938
1939	},
1940	drag: function(draggable, event) {
1941
1942		//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
1943		if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
1944
1945		//Run through all droppables and check their positions based on specific tolerance options
1946		$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
1947
1948			if(this.options.disabled || this.greedyChild || !this.visible) return;
1949			var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
1950
1951			var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
1952			if(!c) return;
1953
1954			var parentInstance;
1955			if (this.options.greedy) {
1956				var parent = this.element.parents(':data(droppable):eq(0)');
1957				if (parent.length) {
1958					parentInstance = $.data(parent[0], 'droppable');
1959					parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
1960				}
1961			}
1962
1963			// we just moved into a greedy child
1964			if (parentInstance && c == 'isover') {
1965				parentInstance['isover'] = 0;
1966				parentInstance['isout'] = 1;
1967				parentInstance._out.call(parentInstance, event);
1968			}
1969
1970			this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
1971			this[c == "isover" ? "_over" : "_out"].call(this, event);
1972
1973			// we just moved out of a greedy child
1974			if (parentInstance && c == 'isout') {
1975				parentInstance['isout'] = 0;
1976				parentInstance['isover'] = 1;
1977				parentInstance._over.call(parentInstance, event);
1978			}
1979		});
1980
1981	}
1982};
1983
1984})(jQuery);
1985/*
1986 * jQuery UI Resizable 1.8.4
1987 *
1988 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
1989 * Dual licensed under the MIT or GPL Version 2 licenses.
1990 * http://jquery.org/license
1991 *
1992 * http://docs.jquery.com/UI/Resizables
1993 *
1994 * Depends:
1995 *	jquery.ui.core.js
1996 *	jquery.ui.mouse.js
1997 *	jquery.ui.widget.js
1998 */
1999(function( $, undefined ) {
2000
2001$.widget("ui.resizable", $.ui.mouse, {
2002	widgetEventPrefix: "resize",
2003	options: {
2004		alsoResize: false,
2005		animate: false,
2006		animateDuration: "slow",
2007		animateEasing: "swing",
2008		aspectRatio: false,
2009		autoHide: false,
2010		containment: false,
2011		ghost: false,
2012		grid: false,
2013		handles: "e,s,se",
2014		helper: false,
2015		maxHeight: null,
2016		maxWidth: null,
2017		minHeight: 10,
2018		minWidth: 10,
2019		zIndex: 1000
2020	},
2021	_create: function() {
2022
2023		var self = this, o = this.options;
2024		this.element.addClass("ui-resizable");
2025
2026		$.extend(this, {
2027			_aspectRatio: !!(o.aspectRatio),
2028			aspectRatio: o.aspectRatio,
2029			originalElement: this.element,
2030			_proportionallyResizeElements: [],
2031			_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
2032		});
2033
2034		//Wrap the element if it cannot hold child nodes
2035		if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
2036
2037			//Opera fix for relative positioning
2038			if (/relative/.test(this.element.css('position')) && $.browser.opera)
2039				this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
2040
2041			//Create a wrapper element and set the wrapper to the new current internal element
2042			this.element.wrap(
2043				$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
2044					position: this.element.css('position'),
2045					width: this.element.outerWidth(),
2046					height: this.element.outerHeight(),
2047					top: this.element.css('top'),
2048					left: this.element.css('left')
2049				})
2050			);
2051
2052			//Overwrite the original this.element
2053			this.element = this.element.parent().data(
2054				"resizable", this.element.data('resizable')
2055			);
2056
2057			this.elementIsWrapper = true;
2058
2059			//Move margins to the wrapper
2060			this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
2061			this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
2062
2063			//Prevent Safari textarea resize
2064			this.originalResizeStyle = this.originalElement.css('resize');
2065			this.originalElement.css('resize', 'none');
2066
2067			//Push the actual element to our proportionallyResize internal array
2068			this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
2069
2070			// avoid IE jump (hard set the margin)
2071			this.originalElement.css({ margin: this.originalElement.css('margin') });
2072
2073			// fix handlers offset
2074			this._proportionallyResize();
2075
2076		}
2077
2078		this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
2079		if(this.handles.constructor == String) {
2080
2081			if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
2082			var n = this.handles.split(","); this.handles = {};
2083
2084			for(var i = 0; i < n.length; i++) {
2085
2086				var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
2087				var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
2088
2089				// increase zIndex of sw, se, ne, nw axis
2090				//TODO : this modifies original option
2091				if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
2092
2093				//TODO : What's going on here?
2094				if ('se' == handle) {
2095					axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
2096				};
2097
2098				//Insert into internal handles object and append to element
2099				this.handles[handle] = '.ui-resizable-'+handle;
2100				this.element.append(axis);
2101			}
2102
2103		}
2104
2105		this._renderAxis = function(target) {
2106
2107			target = target || this.element;
2108
2109			for(var i in this.handles) {
2110
2111				if(this.handles[i].constructor == String)
2112					this.handles[i] = $(this.handles[i], this.element).show();
2113
2114				//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
2115				if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
2116
2117					var axis = $(this.handles[i], this.element), padWrapper = 0;
2118
2119					//Checking the correct pad and border
2120					padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
2121
2122					//The padding type i have to apply...
2123					var padPos = [ 'padding',
2124						/ne|nw|n/.test(i) ? 'Top' :
2125						/se|sw|s/.test(i) ? 'Bottom' :
2126						/^e$/.test(i) ? 'Right' : 'Left' ].join("");
2127
2128					target.css(padPos, padWrapper);
2129
2130					this._proportionallyResize();
2131
2132				}
2133
2134				//TODO: What's that good for? There's not anything to be executed left
2135				if(!$(this.handles[i]).length)
2136					continue;
2137
2138			}
2139		};
2140
2141		//TODO: make renderAxis a prototype function
2142		this._renderAxis(this.element);
2143
2144		this._handles = $('.ui-resizable-handle', this.element)
2145			.disableSelection();
2146
2147		//Matching axis name
2148		this._handles.mouseover(function() {
2149			if (!self.resizing) {
2150				if (this.className)
2151					var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
2152				//Axis, default = se
2153				self.axis = axis && axis[1] ? axis[1] : 'se';
2154			}
2155		});
2156
2157		//If we want to auto hide the elements
2158		if (o.autoHide) {
2159			this._handles.hide();
2160			$(this.element)
2161				.addClass("ui-resizable-autohide")
2162				.hover(function() {
2163					$(this).removeClass("ui-resizable-autohide");
2164					self._handles.show();
2165				},
2166				function(){
2167					if (!self.resizing) {
2168						$(this).addClass("ui-resizable-autohide");
2169						self._handles.hide();
2170					}
2171				});
2172		}
2173
2174		//Initialize the mouse interaction
2175		this._mouseInit();
2176
2177	},
2178
2179	destroy: function() {
2180
2181		this._mouseDestroy();
2182
2183		var _destroy = function(exp) {
2184			$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
2185				.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
2186		};
2187
2188		//TODO: Unwrap at same DOM position
2189		if (this.elementIsWrapper) {
2190			_destroy(this.element);
2191			var wrapper = this.element;
2192			wrapper.after(
2193				this.originalElement.css({
2194					position: wrapper.css('position'),
2195					width: wrapper.outerWidth(),
2196					height: wrapper.outerHeight(),
2197					top: wrapper.css('top'),
2198					left: wrapper.css('left')
2199				})
2200			).remove();
2201		}
2202
2203		this.originalElement.css('resize', this.originalResizeStyle);
2204		_destroy(this.originalElement);
2205
2206		return this;
2207	},
2208
2209	_mouseCapture: function(event) {
2210		var handle = false;
2211		for (var i in this.handles) {
2212			if ($(this.handles[i])[0] == event.target) {
2213				handle = true;
2214			}
2215		}
2216
2217		return !this.options.disabled && handle;
2218	},
2219
2220	_mouseStart: function(event) {
2221
2222		var o = this.options, iniPos = this.element.position(), el = this.element;
2223
2224		this.resizing = true;
2225		this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
2226
2227		// bugfix for http://dev.jquery.com/ticket/1749
2228		if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
2229			el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
2230		}
2231
2232		//Opera fixing relative position
2233		if ($.browser.opera && (/relative/).test(el.css('position')))
2234			el.css({ position: 'relative', top: 'auto', left: 'auto' });
2235
2236		this._renderProxy();
2237
2238		var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
2239
2240		if (o.containment) {
2241			curleft += $(o.containment).scrollLeft() || 0;
2242			curtop += $(o.containment).scrollTop() || 0;
2243		}
2244
2245		//Store needed variables
2246		this.offset = this.helper.offset();
2247		this.position = { left: curleft, top: curtop };
2248		this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2249		this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2250		this.originalPosition = { left: curleft, top: curtop };
2251		this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
2252		this.originalMousePosition = { left: event.pageX, top: event.pageY };
2253
2254		//Aspect Ratio
2255		this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
2256
2257	    var cursor = $('.ui-resizable-' + this.axis).css('cursor');
2258	    $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
2259
2260		el.addClass("ui-resizable-resizing");
2261		this._propagate("start", event);
2262		return true;
2263	},
2264
2265	_mouseDrag: function(event) {
2266
2267		//Increase performance, avoid regex
2268		var el = this.helper, o = this.options, props = {},
2269			self = this, smp = this.originalMousePosition, a = this.axis;
2270
2271		var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
2272		var trigger = this._change[a];
2273		if (!trigger) return false;
2274
2275		// Calculate the attrs that will be change
2276		var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
2277
2278		if (this._aspectRatio || event.shiftKey)
2279			data = this._updateRatio(data, event);
2280
2281		data = this._respectSize(data, event);
2282
2283		// plugins callbacks need to be called first
2284		this._propagate("resize", event);
2285
2286		el.css({
2287			top: this.position.top + "px", left: this.position.left + "px",
2288			width: this.size.width + "px", height: this.size.height + "px"
2289		});
2290
2291		if (!this._helper && this._proportionallyResizeElements.length)
2292			this._proportionallyResize();
2293
2294		this._updateCache(data);
2295
2296		// calling the user callback at the end
2297		this._trigger('resize', event, this.ui());
2298
2299		return false;
2300	},
2301
2302	_mouseStop: function(event) {
2303
2304		this.resizing = false;
2305		var o = this.options, self = this;
2306
2307		if(this._helper) {
2308			var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2309						soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
2310							soffsetw = ista ? 0 : self.sizeDiff.width;
2311
2312			var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
2313				left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
2314				top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
2315
2316			if (!o.animate)
2317				this.element.css($.extend(s, { top: top, left: left }));
2318
2319			self.helper.height(self.size.height);
2320			self.helper.width(self.size.width);
2321
2322			if (this._helper && !o.animate) this._proportionallyResize();
2323		}
2324
2325		$('body').css('cursor', 'auto');
2326
2327		this.element.removeClass("ui-resizable-resizing");
2328
2329		this._propagate("stop", event);
2330
2331		if (this._helper) this.helper.remove();
2332		return false;
2333
2334	},
2335
2336	_updateCache: function(data) {
2337		var o = this.options;
2338		this.offset = this.helper.offset();
2339		if (isNumber(data.left)) this.position.left = data.left;
2340		if (isNumber(data.top)) this.position.top = data.top;
2341		if (isNumber(data.height)) this.size.height = data.height;
2342		if (isNumber(data.width)) this.size.width = data.width;
2343	},
2344
2345	_updateRatio: function(data, event) {
2346
2347		var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
2348
2349		if (data.height) data.width = (csize.height * this.aspectRatio);
2350		else if (data.width) data.height = (csize.width / this.aspectRatio);
2351
2352		if (a == 'sw') {
2353			data.left = cpos.left + (csize.width - data.width);
2354			data.top = null;
2355		}
2356		if (a == 'nw') {
2357			data.top = cpos.top + (csize.height - data.height);
2358			data.left = cpos.left + (csize.width - data.width);
2359		}
2360
2361		return data;
2362	},
2363
2364	_respectSize: function(data, event) {
2365
2366		var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
2367				ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
2368					isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
2369
2370		if (isminw) data.width = o.minWidth;
2371		if (isminh) data.height = o.minHeight;
2372		if (ismaxw) data.width = o.maxWidth;
2373		if (ismaxh) data.height = o.maxHeight;
2374
2375		var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
2376		var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
2377
2378		if (isminw && cw) data.left = dw - o.minWidth;
2379		if (ismaxw && cw) data.left = dw - o.maxWidth;
2380		if (isminh && ch)	data.top = dh - o.minHeight;
2381		if (ismaxh && ch)	data.top = dh - o.maxHeight;
2382
2383		// fixing jump error on top/left - bug #2330
2384		var isNotwh = !data.width && !data.height;
2385		if (isNotwh && !data.left && data.top) data.top = null;
2386		else if (isNotwh && !data.top && data.left) data.left = null;
2387
2388		return data;
2389	},
2390
2391	_proportionallyResize: function() {
2392
2393		var o = this.options;
2394		if (!this._proportionallyResizeElements.length) return;
2395		var element = this.helper || this.element;
2396
2397		for (var i=0; i < this._proportionallyResizeElements.length; i++) {
2398
2399			var prel = this._proportionallyResizeElements[i];
2400
2401			if (!this.borderDif) {
2402				var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
2403					p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
2404
2405				this.borderDif = $.map(b, function(v, i) {
2406					var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
2407					return border + padding;
2408				});
2409			}
2410
2411			if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
2412				continue;
2413
2414			prel.css({
2415				height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
2416				width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
2417			});
2418
2419		};
2420
2421	},
2422
2423	_renderProxy: function() {
2424
2425		var el = this.element, o = this.options;
2426		this.elementOffset = el.offset();
2427
2428		if(this._helper) {
2429
2430			this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
2431
2432			// fix ie6 offset TODO: This seems broken
2433			var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
2434			pxyoffset = ( ie6 ? 2 : -1 );
2435
2436			this.helper.addClass(this._helper).css({
2437				width: this.element.outerWidth() + pxyoffset,
2438				height: this.element.outerHeight() + pxyoffset,
2439				position: 'absolute',
2440				left: this.elementOffset.left - ie6offset +'px',
2441				top: this.elementOffset.top - ie6offset +'px',
2442				zIndex: ++o.zIndex //TODO: Don't modify option
2443			});
2444
2445			this.helper
2446				.appendTo("body")
2447				.disableSelection();
2448
2449		} else {
2450			this.helper = this.element;
2451		}
2452
2453	},
2454
2455	_change: {
2456		e: function(event, dx, dy) {
2457			return { width: this.originalSize.width + dx };
2458		},
2459		w: function(event, dx, dy) {
2460			var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2461			return { left: sp.left + dx, width: cs.width - dx };
2462		},
2463		n: function(event, dx, dy) {
2464			var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2465			return { top: sp.top + dy, height: cs.height - dy };
2466		},
2467		s: function(event, dx, dy) {
2468			return { height: this.originalSize.height + dy };
2469		},
2470		se: function(event, dx, dy) {
2471			return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2472		},
2473		sw: function(event, dx, dy) {
2474			return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2475		},
2476		ne: function(event, dx, dy) {
2477			return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2478		},
2479		nw: function(event, dx, dy) {
2480			return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2481		}
2482	},
2483
2484	_propagate: function(n, event) {
2485		$.ui.plugin.call(this, n, [event, this.ui()]);
2486		(n != "resize" && this._trigger(n, event, this.ui()));
2487	},
2488
2489	plugins: {},
2490
2491	ui: function() {
2492		return {
2493			originalElement: this.originalElement,
2494			element: this.element,
2495			helper: this.helper,
2496			position: this.position,
2497			size: this.size,
2498			originalSize: this.originalSize,
2499			originalPosition: this.originalPosition
2500		};
2501	}
2502
2503});
2504
2505$.extend($.ui.resizable, {
2506	version: "1.8.4"
2507});
2508
2509/*
2510 * Resizable Extensions
2511 */
2512
2513$.ui.plugin.add("resizable", "alsoResize", {
2514
2515	start: function (event, ui) {
2516		var self = $(this).data("resizable"), o = self.options;
2517
2518		var _store = function (exp) {
2519			$(exp).each(function() {
2520				var el = $(this);
2521				el.data("resizable-alsoresize", {
2522					width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
2523					left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
2524					position: el.css('position') // to reset Opera on stop()
2525				});
2526			});
2527		};
2528
2529		if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
2530			if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
2531			else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
2532		}else{
2533			_store(o.alsoResize);
2534		}
2535	},
2536
2537	resize: function (event, ui) {
2538		var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
2539
2540		var delta = {
2541			height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
2542			top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
2543		},
2544
2545		_alsoResize = function (exp, c) {
2546			$(exp).each(function() {
2547				var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
2548					css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
2549
2550				$.each(css, function (i, prop) {
2551					var sum = (start[prop]||0) + (delta[prop]||0);
2552					if (sum && sum >= 0)
2553						style[prop] = sum || null;
2554				});
2555
2556				// Opera fixing relative position
2557				if ($.browser.opera && /relative/.test(el.css('position'))) {
2558					self._revertToRelativePosition = true;
2559					el.css({ position: 'absolute', top: 'auto', left: 'auto' });
2560				}
2561
2562				el.css(style);
2563			});
2564		};
2565
2566		if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
2567			$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
2568		}else{
2569			_alsoResize(o.alsoResize);
2570		}
2571	},
2572
2573	stop: function (event, ui) {
2574		var self = $(this).data("resizable"), o = self.options;
2575
2576		var _reset = function (exp) {
2577			$(exp).each(function() {
2578				var el = $(this);
2579				// reset position for Opera - no need to verify it was changed
2580				el.css({ position: el.data("resizable-alsoresize").position });
2581			});
2582		}
2583
2584		if (self._revertToRelativePosition) {
2585			self._revertToRelativePosition = false;
2586			if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
2587				$.each(o.alsoResize, function (exp) { _reset(exp); });
2588			}else{
2589				_reset(o.alsoResize);
2590			}
2591		}
2592
2593		$(this).removeData("resizable-alsoresize");
2594	}
2595});
2596
2597$.ui.plugin.add("resizable", "animate", {
2598
2599	stop: function(event, ui) {
2600		var self = $(this).data("resizable"), o = self.options;
2601
2602		var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2603					soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
2604						soffsetw = ista ? 0 : self.sizeDiff.width;
2605
2606		var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
2607					left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
2608						top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
2609
2610		self.element.animate(
2611			$.extend(style, top && left ? { top: top, left: left } : {}), {
2612				duration: o.animateDuration,
2613				easing: o.animateEasing,
2614				step: function() {
2615
2616					var data = {
2617						width: parseInt(self.element.css('width'), 10),
2618						height: parseInt(self.element.css('height'), 10),
2619						top: parseInt(self.element.css('top'), 10),
2620						left: parseInt(self.element.css('left'), 10)
2621					};
2622
2623					if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
2624
2625					// propagating resize, and updating values for each animation step
2626					self._updateCache(data);
2627					self._propagate("resize", event);
2628
2629				}
2630			}
2631		);
2632	}
2633
2634});
2635
2636$.ui.plugin.add("resizable", "containment", {
2637
2638	start: function(event, ui) {
2639		var self = $(this).data("resizable"), o = self.options, el = self.element;
2640		var oc = o.containment,	ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
2641		if (!ce) return;
2642
2643		self.containerElement = $(ce);
2644
2645		if (/document/.test(oc) || oc == document) {
2646			self.containerOffset = { left: 0, top: 0 };
2647			self.containerPosition = { left: 0, top: 0 };
2648
2649			self.parentData = {
2650				element: $(document), left: 0, top: 0,
2651				width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
2652			};
2653		}
2654
2655		// i'm a node, so compute top, left, right, bottom
2656		else {
2657			var element = $(ce), p = [];
2658			$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
2659
2660			self.containerOffset = element.offset();
2661			self.containerPosition = element.position();
2662			self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
2663
2664			var co = self.containerOffset, ch = self.containerSize.height,	cw = self.containerSize.width,
2665						width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
2666
2667			self.parentData = {
2668				element: ce, left: co.left, top: co.top, width: width, height: height
2669			};
2670		}
2671	},
2672
2673	resize: function(event, ui) {
2674		var self = $(this).data("resizable"), o = self.options,
2675				ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
2676				pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
2677
2678		if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
2679
2680		if (cp.left < (self._helper ? co.left : 0)) {
2681			self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
2682			if (pRatio) self.size.height = self.size.width / o.aspectRatio;
2683			self.position.left = o.helper ? co.left : 0;
2684		}
2685
2686		if (cp.top < (self._helper ? co.top : 0)) {
2687			self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
2688			if (pRatio) self.size.width = self.size.height * o.aspectRatio;
2689			self.position.top = self._helper ? co.top : 0;
2690		}
2691
2692		self.offset.left = self.parentData.left+self.position.left;
2693		self.offset.top = self.parentData.top+self.position.top;
2694
2695		var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
2696					hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
2697
2698		var isParent = self.containerElement.get(0) == self.element.parent().get(0),
2699		    isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
2700
2701		if(isParent && isOffsetRelative) woset -= self.parentData.left;
2702
2703		if (woset + self.size.width >= self.parentData.width) {
2704			self.size.width = self.parentData.width - woset;
2705			if (pRatio) self.size.height = self.size.width / self.aspectRatio;
2706		}
2707
2708		if (hoset + self.size.height >= self.parentData.height) {
2709			self.size.height = self.parentData.height - hoset;
2710			if (pRatio) self.size.width = self.size.height * self.aspectRatio;
2711		}
2712	},
2713
2714	stop: function(event, ui){
2715		var self = $(this).data("resizable"), o = self.options, cp = self.position,
2716				co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
2717
2718		var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
2719
2720		if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
2721			$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2722
2723		if (self._helper && !o.animate && (/static/).test(ce.css('position')))
2724			$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2725
2726	}
2727});
2728
2729$.ui.plugin.add("resizable", "ghost", {
2730
2731	start: function(event, ui) {
2732
2733		var self = $(this).data("resizable"), o = self.options, cs = self.size;
2734
2735		self.ghost = self.originalElement.clone();
2736		self.ghost
2737			.css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
2738			.addClass('ui-resizable-ghost')
2739			.addClass(typeof o.ghost == 'string' ? o.ghost : '');
2740
2741		self.ghost.appendTo(self.helper);
2742
2743	},
2744
2745	resize: function(event, ui){
2746		var self = $(this).data("resizable"), o = self.options;
2747		if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
2748	},
2749
2750	stop: function(event, ui){
2751		var self = $(this).data("resizable"), o = self.options;
2752		if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
2753	}
2754
2755});
2756
2757$.ui.plugin.add("resizable", "grid", {
2758
2759	resize: function(event, ui) {
2760		var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
2761		o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
2762		var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
2763
2764		if (/^(se|s|e)$/.test(a)) {
2765			self.size.width = os.width + ox;
2766			self.size.height = os.height + oy;
2767		}
2768		else if (/^(ne)$/.test(a)) {
2769			self.size.width = os.width + ox;
2770			self.size.height = os.height + oy;
2771			self.position.top = op.top - oy;
2772		}
2773		else if (/^(sw)$/.test(a)) {
2774			self.size.width = os.width + ox;
2775			self.size.height = os.height + oy;
2776			self.position.left = op.left - ox;
2777		}
2778		else {
2779			self.size.width = os.width + ox;
2780			self.size.height = os.height + oy;
2781			self.position.top = op.top - oy;
2782			self.position.left = op.left - ox;
2783		}
2784	}
2785
2786});
2787
2788var num = function(v) {
2789	return parseInt(v, 10) || 0;
2790};
2791
2792var isNumber = function(value) {
2793	return !isNaN(parseInt(value, 10));
2794};
2795
2796})(jQuery);
2797/*
2798 * jQuery UI Selectable 1.8.4
2799 *
2800 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
2801 * Dual licensed under the MIT or GPL Version 2 licenses.
2802 * http://jquery.org/license
2803 *
2804 * http://docs.jquery.com/UI/Selectables
2805 *
2806 * Depends:
2807 *	jquery.ui.core.js
2808 *	jquery.ui.mouse.js
2809 *	jquery.ui.widget.js
2810 */
2811(function( $, undefined ) {
2812
2813$.widget("ui.selectable", $.ui.mouse, {
2814	options: {
2815		appendTo: 'body',
2816		autoRefresh: true,
2817		distance: 0,
2818		filter: '*',
2819		tolerance: 'touch'
2820	},
2821	_create: function() {
2822		var self = this;
2823
2824		this.element.addClass("ui-selectable");
2825
2826		this.dragged = false;
2827
2828		// cache selectee children based on filter
2829		var selectees;
2830		this.refresh = function() {
2831			selectees = $(self.options.filter, self.element[0]);
2832			selectees.each(function() {
2833				var $this = $(this);
2834				var pos = $this.offset();
2835				$.data(this, "selectable-item", {
2836					element: this,
2837					$element: $this,
2838					left: pos.left,
2839					top: pos.top,
2840					right: pos.left + $this.outerWidth(),
2841					bottom: pos.top + $this.outerHeight(),
2842					startselected: false,
2843					selected: $this.hasClass('ui-selected'),
2844					selecting: $this.hasClass('ui-selecting'),
2845					unselecting: $this.hasClass('ui-unselecting')
2846				});
2847			});
2848		};
2849		this.refresh();
2850
2851		this.selectees = selectees.addClass("ui-selectee");
2852
2853		this._mouseInit();
2854
2855		this.helper = $("<div class='ui-selectable-helper'></div>");
2856	},
2857
2858	destroy: function() {
2859		this.selectees
2860			.removeClass("ui-selectee")
2861			.removeData("selectable-item");
2862		this.element
2863			.removeClass("ui-selectable ui-selectable-disabled")
2864			.removeData("selectable")
2865			.unbind(".selectable");
2866		this._mouseDestroy();
2867
2868		return this;
2869	},
2870
2871	_mouseStart: function(event) {
2872		var self = this;
2873
2874		this.opos = [event.pageX, event.pageY];
2875
2876		if (this.options.disabled)
2877			return;
2878
2879		var options = this.options;
2880
2881		this.selectees = $(options.filter, this.element[0]);
2882
2883		this._trigger("start", event);
2884
2885		$(options.appendTo).append(this.helper);
2886		// position helper (lasso)
2887		this.helper.css({
2888			"left": event.clientX,
2889			"top": event.clientY,
2890			"width": 0,
2891			"height": 0
2892		});
2893
2894		if (options.autoRefresh) {
2895			this.refresh();
2896		}
2897
2898		this.selectees.filter('.ui-selected').each(function() {
2899			var selectee = $.data(this, "selectable-item");
2900			selectee.startselected = true;
2901			if (!event.metaKey) {
2902				selectee.$element.removeClass('ui-selected');
2903				selectee.selected = false;
2904				selectee.$element.addClass('ui-unselecting');
2905				selectee.unselecting = true;
2906				// selectable UNSELECTING callback
2907				self._trigger("unselecting", event, {
2908					unselecting: selectee.element
2909				});
2910			}
2911		});
2912
2913		$(event.target).parents().andSelf().each(function() {
2914			var selectee = $.data(this, "selectable-item");
2915			if (selectee) {
2916				var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
2917				selectee.$element
2918					.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
2919					.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
2920				selectee.unselecting = !doSelect;
2921				selectee.selecting = doSelect;
2922				selectee.selected = doSelect;
2923				// selectable (UN)SELECTING callback
2924				if (doSelect) {
2925					self._trigger("selecting", event, {
2926						selecting: selectee.element
2927					});
2928				} else {
2929					self._trigger("unselecting", event, {
2930						unselecting: selectee.element
2931					});
2932				}
2933				return false;
2934			}
2935		});
2936
2937	},
2938
2939	_mouseDrag: function(event) {
2940		var self = this;
2941		this.dragged = true;
2942
2943		if (this.options.disabled)
2944			return;
2945
2946		var options = this.options;
2947
2948		var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
2949		if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
2950		if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
2951		this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
2952
2953		this.selectees.each(function() {
2954			var selectee = $.data(this, "selectable-item");
2955			//prevent helper from being selected if appendTo: selectable
2956			if (!selectee || selectee.element == self.element[0])
2957				return;
2958			var hit = false;
2959			if (options.tolerance == 'touch') {
2960				hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
2961			} else if (options.tolerance == 'fit') {
2962				hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
2963			}
2964
2965			if (hit) {
2966				// SELECT
2967				if (selectee.selected) {
2968					selectee.$element.removeClass('ui-selected');
2969					selectee.selected = false;
2970				}
2971				if (selectee.unselecting) {
2972					selectee.$element.removeClass('ui-unselecting');
2973					selectee.unselecting = false;
2974				}
2975				if (!selectee.selecting) {
2976					selectee.$element.addClass('ui-selecting');
2977					selectee.selecting = true;
2978					// selectable SELECTING callback
2979					self._trigger("selecting", event, {
2980						selecting: selectee.element
2981					});
2982				}
2983			} else {
2984				// UNSELECT
2985				if (selectee.selecting) {
2986					if (event.metaKey && selectee.startselected) {
2987						selectee.$element.removeClass('ui-selecting');
2988						selectee.selecting = false;
2989						selectee.$element.addClass('ui-selected');
2990						selectee.selected = true;
2991					} else {
2992						selectee.$element.removeClass('ui-selecting');
2993						selectee.selecting = false;
2994						if (selectee.startselected) {
2995							selectee.$element.addClass('ui-unselecting');
2996							selectee.unselecting = true;
2997						}
2998						// selectable UNSELECTING callback
2999						self._trigger("unselecting", event, {
3000							unselecting: selectee.element
3001						});
3002					}
3003				}
3004				if (selectee.selected) {
3005					if (!event.metaKey && !selectee.startselected) {
3006						selectee.$element.removeClass('ui-selected');
3007						selectee.selected = false;
3008
3009						selectee.$element.addClass('ui-unselecting');
3010						selectee.unselecting = true;
3011						// selectable UNSELECTING callback
3012						self._trigger("unselecting", event, {
3013							unselecting: selectee.element
3014						});
3015					}
3016				}
3017			}
3018		});
3019
3020		return false;
3021	},
3022
3023	_mouseStop: function(event) {
3024		var self = this;
3025
3026		this.dragged = false;
3027
3028		var options = this.options;
3029
3030		$('.ui-unselecting', this.element[0]).each(function() {
3031			var selectee = $.data(this, "selectable-item");
3032			selectee.$element.removeClass('ui-unselecting');
3033			selectee.unselecting = false;
3034			selectee.startselected = false;
3035			self._trigger("unselected", event, {
3036				unselected: selectee.element
3037			});
3038		});
3039		$('.ui-selecting', this.element[0]).each(function() {
3040			var selectee = $.data(this, "selectable-item");
3041			selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
3042			selectee.selecting = false;
3043			selectee.selected = true;
3044			selectee.startselected = true;
3045			self._trigger("selected", event, {
3046				selected: selectee.element
3047			});
3048		});
3049		this._trigger("stop", event);
3050
3051		this.helper.remove();
3052
3053		return false;
3054	}
3055
3056});
3057
3058$.extend($.ui.selectable, {
3059	version: "1.8.4"
3060});
3061
3062})(jQuery);
3063/*
3064 * jQuery UI Sortable 1.8.4
3065 *
3066 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
3067 * Dual licensed under the MIT or GPL Version 2 licenses.
3068 * http://jquery.org/license
3069 *
3070 * http://docs.jquery.com/UI/Sortables
3071 *
3072 * Depends:
3073 *	jquery.ui.core.js
3074 *	jquery.ui.mouse.js
3075 *	jquery.ui.widget.js
3076 */
3077(function( $, undefined ) {
3078
3079$.widget("ui.sortable", $.ui.mouse, {
3080	widgetEventPrefix: "sort",
3081	options: {
3082		appendTo: "parent",
3083		axis: false,
3084		connectWith: false,
3085		containment: false,
3086		cursor: 'auto',
3087		cursorAt: false,
3088		dropOnEmpty: true,
3089		forcePlaceholderSize: false,
3090		forceHelperSize: false,
3091		grid: false,
3092		handle: false,
3093		helper: "original",
3094		items: '> *',
3095		opacity: false,
3096		placeholder: false,
3097		revert: false,
3098		scroll: true,
3099		scrollSensitivity: 20,
3100		scrollSpeed: 20,
3101		scope: "default",
3102		tolerance: "intersect",
3103		zIndex: 1000
3104	},
3105	_create: function() {
3106
3107		var o = this.options;
3108		this.containerCache = {};
3109		this.element.addClass("ui-sortable");
3110
3111		//Get the items
3112		this.refresh();
3113
3114		//Let's determine if the items are floating
3115		this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
3116
3117		//Let's determine the parent's offset
3118		this.offset = this.element.offset();
3119
3120		//Initialize mouse events for interaction
3121		this._mouseInit();
3122
3123	},
3124
3125	destroy: function() {
3126		this.element
3127			.removeClass("ui-sortable ui-sortable-disabled")
3128			.removeData("sortable")
3129			.unbind(".sortable");
3130		this._mouseDestroy();
3131
3132		for ( var i = this.items.length - 1; i >= 0; i-- )
3133			this.items[i].item.removeData("sortable-item");
3134
3135		return this;
3136	},
3137
3138	_setOption: function(key, value){
3139		if ( key === "disabled" ) {
3140			this.options[ key ] = value;
3141
3142			this.widget()
3143				[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
3144		} else {
3145			// Don't call widget base _setOption for disable as it adds ui-state-disabled class
3146			$.Widget.prototype._setOption.apply(this, arguments);
3147		}
3148	},
3149
3150	_mouseCapture: function(event, overrideHandle) {
3151
3152		if (this.reverting) {
3153			return false;
3154		}
3155
3156		if(this.options.disabled || this.options.type == 'static') return false;
3157
3158		//We have to refresh the items data once first
3159		this._refreshItems(event);
3160
3161		//Find out if the clicked node (or one of its parents) is a actual item in this.items
3162		var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
3163			if($.data(this, 'sortable-item') == self) {
3164				currentItem = $(this);
3165				return false;
3166			}
3167		});
3168		if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
3169
3170		if(!currentItem) return false;
3171		if(this.options.handle && !overrideHandle) {
3172			var validHandle = false;
3173
3174			$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
3175			if(!validHandle) return false;
3176		}
3177
3178		this.currentItem = currentItem;
3179		this._removeCurrentsFromItems();
3180		return true;
3181
3182	},
3183
3184	_mouseStart: function(event, overrideHandle, noActivation) {
3185
3186		var o = this.options, self = this;
3187		this.currentContainer = this;
3188
3189		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
3190		this.refreshPositions();
3191
3192		//Create and append the visible helper
3193		this.helper = this._createHelper(event);
3194
3195		//Cache the helper size
3196		this._cacheHelperProportions();
3197
3198		/*
3199		 * - Position generation -
3200		 * This block generates everything position related - it's the core of draggables.
3201		 */
3202
3203		//Cache the margins of the original element
3204		this._cacheMargins();
3205
3206		//Get the next scrolling parent
3207		this.scrollParent = this.helper.scrollParent();
3208
3209		//The element's absolute position on the page minus margins
3210		this.offset = this.currentItem.offset();
3211		this.offset = {
3212			top: this.offset.top - this.margins.top,
3213			left: this.offset.left - this.margins.left
3214		};
3215
3216		// Only after we got the offset, we can change the helper's position to absolute
3217		// TODO: Still need to figure out a way to make relative sorting possible
3218		this.helper.css("position", "absolute");
3219		this.cssPosition = this.helper.css("position");
3220
3221		$.extend(this.offset, {
3222			click: { //Where the click happened, relative to the element
3223				left: event.pageX - this.offset.left,
3224				top: event.pageY - this.offset.top
3225			},
3226			parent: this._getParentOffset(),
3227			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
3228		});
3229
3230		//Generate the original position
3231		this.originalPosition = this._generatePosition(event);
3232		this.originalPageX = event.pageX;
3233		this.originalPageY = event.pageY;
3234
3235		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
3236		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
3237
3238		//Cache the former DOM position
3239		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
3240
3241		//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
3242		if(this.helper[0] != this.currentItem[0]) {
3243			this.currentItem.hide();
3244		}
3245
3246		//Create the placeholder
3247		this._createPlaceholder();
3248
3249		//Set a containment if given in the options
3250		if(o.containment)
3251			this._setContainment();
3252
3253		if(o.cursor) { // cursor option
3254			if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
3255			$('body').css("cursor", o.cursor);
3256		}
3257
3258		if(o.opacity) { // opacity option
3259			if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
3260			this.helper.css("opacity", o.opacity);
3261		}
3262
3263		if(o.zIndex) { // zIndex option
3264			if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
3265			this.helper.css("zIndex", o.zIndex);
3266		}
3267
3268		//Prepare scrolling
3269		if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
3270			this.overflowOffset = this.scrollParent.offset();
3271
3272		//Call callbacks
3273		this._trigger("start", event, this._uiHash());
3274
3275		//Recache the helper size
3276		if(!this._preserveHelperProportions)
3277			this._cacheHelperProportions();
3278
3279
3280		//Post 'activate' events to possible containers
3281		if(!noActivation) {
3282			 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
3283		}
3284
3285		//Prepare possible droppables
3286		if($.ui.ddmanager)
3287			$.ui.ddmanager.current = this;
3288
3289		if ($.ui.ddmanager && !o.dropBehaviour)
3290			$.ui.ddmanager.prepareOffsets(this, event);
3291
3292		this.dragging = true;
3293
3294		this.helper.addClass("ui-sortable-helper");
3295		this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
3296		return true;
3297
3298	},
3299
3300	_mouseDrag: function(event) {
3301
3302		//Compute the helpers position
3303		this.position = this._generatePosition(event);
3304		this.positionAbs = this._convertPositionTo("absolute");
3305
3306		if (!this.lastPositionAbs) {
3307			this.lastPositionAbs = this.positionAbs;
3308		}
3309
3310		//Do scrolling
3311		if(this.options.scroll) {
3312			var o = this.options, scrolled = false;
3313			if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
3314
3315				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
3316					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
3317				else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
3318					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
3319
3320				if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
3321					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
3322				else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
3323					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
3324
3325			} else {
3326
3327				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
3328					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
3329				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
3330					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
3331
3332				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
3333					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
3334				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
3335					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
3336
3337			}
3338
3339			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
3340				$.ui.ddmanager.prepareOffsets(this, event);
3341		}
3342
3343		//Regenerate the absolute position used for position checks
3344		this.positionAbs = this._convertPositionTo("absolute");
3345
3346		//Set the helper position
3347		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
3348		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
3349
3350		//Rearrange
3351		for (var i = this.items.length - 1; i >= 0; i--) {
3352
3353			//Cache variables and intersection, continue if no intersection
3354			var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
3355			if (!intersection) continue;
3356
3357			if(itemElement != this.currentItem[0] //cannot intersect with itself
3358				&&	this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
3359				&&	!$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
3360				&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
3361				//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
3362			) {
3363
3364				this.direction = intersection == 1 ? "down" : "up";
3365
3366				if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
3367					this._rearrange(event, item);
3368				} else {
3369					break;
3370				}
3371
3372				this._trigger("change", event, this._uiHash());
3373				break;
3374			}
3375		}
3376
3377		//Post events to containers
3378		this._contactContainers(event);
3379
3380		//Interconnect with droppables
3381		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
3382
3383		//Call callbacks
3384		this._trigger('sort', event, this._uiHash());
3385
3386		this.lastPositionAbs = this.positionAbs;
3387		return false;
3388
3389	},
3390
3391	_mouseStop: function(event, noPropagation) {
3392
3393		if(!event) return;
3394
3395		//If we are using droppables, inform the manager about the drop
3396		if ($.ui.ddmanager && !this.options.dropBehaviour)
3397			$.ui.ddmanager.drop(this, event);
3398
3399		if(this.options.revert) {
3400			var self = this;
3401			var cur = self.placeholder.offset();
3402
3403			self.reverting = true;
3404
3405			$(this.helper).animate({
3406				left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
3407				top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
3408			}, parseInt(this.options.revert, 10) || 500, function() {
3409				self._clear(event);
3410			});
3411		} else {
3412			this._clear(event, noPropagation);
3413		}
3414
3415		return false;
3416
3417	},
3418
3419	cancel: function() {
3420
3421		var self = this;
3422
3423		if(this.dragging) {
3424
3425			this._mouseUp();
3426
3427			if(this.options.helper == "original")
3428				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
3429			else
3430				this.currentItem.show();
3431
3432			//Post deactivating events to containers
3433			for (var i = this.containers.length - 1; i >= 0; i--){
3434				this.containers[i]._trigger("deactivate", null, self._uiHash(this));
3435				if(this.containers[i].containerCache.over) {
3436					this.containers[i]._trigger("out", null, self._uiHash(this));
3437					this.containers[i].containerCache.over = 0;
3438				}
3439			}
3440
3441		}
3442
3443		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
3444		if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
3445		if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
3446
3447		$.extend(this, {
3448			helper: null,
3449			dragging: false,
3450			reverting: false,
3451			_noFinalSort: null
3452		});
3453
3454		if(this.domPosition.prev) {
3455			$(this.domPosition.prev).after(this.currentItem);
3456		} else {
3457			$(this.domPosition.parent).prepend(this.currentItem);
3458		}
3459
3460		return this;
3461
3462	},
3463
3464	serialize: function(o) {
3465
3466		var items = this._getItemsAsjQuery(o && o.connected);
3467		var str = []; o = o || {};
3468
3469		$(items).each(function() {
3470			var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
3471			if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
3472		});
3473
3474		if(!str.length && o.key) {
3475			str.push(o.key + '=');
3476		}
3477
3478		return str.join('&');
3479
3480	},
3481
3482	toArray: function(o) {
3483
3484		var items = this._getItemsAsjQuery(o && o.connected);
3485		var ret = []; o = o || {};
3486
3487		items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
3488		return ret;
3489
3490	},
3491
3492	/* Be careful with the following core functions */
3493	_intersectsWith: function(item) {
3494
3495		var x1 = this.positionAbs.left,
3496			x2 = x1 + this.helperProportions.width,
3497			y1 = this.positionAbs.top,
3498			y2 = y1 + this.helperProportions.height;
3499
3500		var l = item.left,
3501			r = l + item.width,
3502			t = item.top,
3503			b = t + item.height;
3504
3505		var dyClick = this.offset.click.top,
3506			dxClick = this.offset.click.left;
3507
3508		var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
3509
3510		if(	   this.options.tolerance == "pointer"
3511			|| this.options.forcePointerForContainers
3512			|| (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
3513		) {
3514			return isOverElement;
3515		} else {
3516
3517			return (l < x1 + (this.helperProportions.width / 2) // Right Half
3518				&& x2 - (this.helperProportions.width / 2) < r // Left Half
3519				&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
3520				&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
3521
3522		}
3523	},
3524
3525	_intersectsWithPointer: function(item) {
3526
3527		var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
3528			isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
3529			isOverElement = isOverElementHeight && isOverElementWidth,
3530			verticalDirection = this._getDragVerticalDirection(),
3531			horizontalDirection = this._getDragHorizontalDirection();
3532
3533		if (!isOverElement)
3534			return false;
3535
3536		return this.floating ?
3537			( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
3538			: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
3539
3540	},
3541
3542	_intersectsWithSides: function(item) {
3543
3544		var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
3545			isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
3546			verticalDirection = this._getDragVerticalDirection(),
3547			horizontalDirection = this._getDragHorizontalDirection();
3548
3549		if (this.floating && horizontalDirection) {
3550			return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
3551		} else {
3552			return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
3553		}
3554
3555	},
3556
3557	_getDragVerticalDirection: function() {
3558		var delta = this.positionAbs.top - this.lastPositionAbs.top;
3559		return delta != 0 && (delta > 0 ? "down" : "up");
3560	},
3561
3562	_getDragHorizontalDirection: function() {
3563		var delta = this.positionAbs.left - this.lastPositionAbs.left;
3564		return delta != 0 && (delta > 0 ? "right" : "left");
3565	},
3566
3567	refresh: function(event) {
3568		this._refreshItems(event);
3569		this.refreshPositions();
3570		return this;
3571	},
3572
3573	_connectWith: function() {
3574		var options = this.options;
3575		return options.connectWith.constructor == String
3576			? [options.connectWith]
3577			: options.connectWith;
3578	},
3579
3580	_getItemsAsjQuery: function(connected) {
3581
3582		var self = this;
3583		var items = [];
3584		var queries = [];
3585		var connectWith = this._connectWith();
3586
3587		if(connectWith && connected) {
3588			for (var i = connectWith.length - 1; i >= 0; i--){
3589				var cur = $(connectWith[i]);
3590				for (var j = cur.length - 1; j >= 0; j--){
3591					var inst = $.data(cur[j], 'sortable');
3592					if(inst && inst != this && !inst.options.disabled) {
3593						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
3594					}
3595				};
3596			};
3597		}
3598
3599		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
3600
3601		for (var i = queries.length - 1; i >= 0; i--){
3602			queries[i][0].each(function() {
3603				items.push(this);
3604			});
3605		};
3606
3607		return $(items);
3608
3609	},
3610
3611	_removeCurrentsFromItems: function() {
3612
3613		var list = this.currentItem.find(":data(sortable-item)");
3614
3615		for (var i=0; i < this.items.length; i++) {
3616
3617			for (var j=0; j < list.length; j++) {
3618				if(list[j] == this.items[i].item[0])
3619					this.items.splice(i,1);
3620			};
3621
3622		};
3623
3624	},
3625
3626	_refreshItems: function(event) {
3627
3628		this.items = [];
3629		this.containers = [this];
3630		var items = this.items;
3631		var self = this;
3632		var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
3633		var connectWith = this._connectWith();
3634
3635		if(connectWith) {
3636			for (var i = connectWith.length - 1; i >= 0; i--){
3637				var cur = $(connectWith[i]);
3638				for (var j = cur.length - 1; j >= 0; j--){
3639					var inst = $.data(cur[j], 'sortable');
3640					if(inst && inst != this && !inst.options.disabled) {
3641						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
3642						this.containers.push(inst);
3643					}
3644				};
3645			};
3646		}
3647
3648		for (var i = queries.length - 1; i >= 0; i--) {
3649			var targetData = queries[i][1];
3650			var _queries = queries[i][0];
3651
3652			for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
3653				var item = $(_queries[j]);
3654
3655				item.data('sortable-item', targetData); // Data for target checking (mouse manager)
3656
3657				items.push({
3658					item: item,
3659					instance: targetData,
3660					width: 0, height: 0,
3661					left: 0, top: 0
3662				});
3663			};
3664		};
3665
3666	},
3667
3668	refreshPositions: function(fast) {
3669
3670		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
3671		if(this.offsetParent && this.helper) {
3672			this.offset.parent = this._getParentOffset();
3673		}
3674
3675		for (var i = this.items.length - 1; i >= 0; i--){
3676			var item = this.items[i];
3677
3678			var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
3679
3680			if (!fast) {
3681				item.width = t.outerWidth();
3682				item.height = t.outerHeight();
3683			}
3684
3685			var p = t.offset();
3686			item.left = p.left;
3687			item.top = p.top;
3688		};
3689
3690		if(this.options.custom && this.options.custom.refreshContainers
3690) {
3691			this.options.custom.refreshContainers.call(this);
3692		} else {
3693			for (var i = this.containers.length - 1; i >= 0; i--){
3694				var p = this.containers[i].element.offset();
3695				this.containers[i].containerCache.left = p.left;
3696				this.containers[i].containerCache.top = p.top;
3697				this.containers[i].containerCache.width	= this.containers[i].element.outerWidth();
3698				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
3699			};
3700		}
3701
3702		return this;
3703	},
3704
3705	_createPlaceholder: function(that) {
3706
3707		var self = that || this, o = self.options;
3708
3709		if(!o.placeholder || o.placeholder.constructor == String) {
3710			var className = o.placeholder;
3711			o.placeholder = {
3712				element: function() {
3713
3714					var el = $(document.createElement(self.currentItem[0].nodeName))
3715						.addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
3716						.removeClass("ui-sortable-helper")[0];
3717
3718					if(!className)
3719						el.style.visibility = "hidden";
3720
3721					return el;
3722				},
3723				update: function(container, p) {
3724
3725					// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
3726					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
3727					if(className && !o.forcePlaceholderSize) return;
3728
3729					//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
3730					if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
3731					if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
3732				}
3733			};
3734		}
3735
3736		//Create the placeholder
3737		self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
3738
3739		//Append it after the actual current item
3740		self.currentItem.after(self.placeholder);
3741
3742		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
3743		o.placeholder.update(self, self.placeholder);
3744
3745	},
3746
3747	_contactContainers: function(event) {
3748
3749		// get innermost container that intersects with item
3750		var innermostContainer = null, innermostIndex = null;
3751
3752
3753		for (var i = this.containers.length - 1; i >= 0; i--){
3754
3755			// never consider a container that's located within the item itself
3756			if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
3757				continue;
3758
3759			if(this._intersectsWith(this.containers[i].containerCache)) {
3760
3761				// if we've already found a container and it's more "inner" than this, then continue
3762				if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
3763					continue;
3764
3765				innermostContainer = this.containers[i];
3766				innermostIndex = i;
3767
3768			} else {
3769				// container doesn't intersect. trigger "out" event if necessary
3770				if(this.containers[i].containerCache.over) {
3771					this.containers[i]._trigger("out", event, this._uiHash(this));
3772					this.containers[i].containerCache.over = 0;
3773				}
3774			}
3775
3776		}
3777
3778		// if no intersecting containers found, return
3779		if(!innermostContainer) return;
3780
3781		// move the item into the container if it's not there already
3782		if(this.containers.length === 1) {
3783			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
3784			this.containers[innermostIndex].containerCache.over = 1;
3785		} else if(this.currentContainer != this.containers[innermostIndex]) {
3786
3787			//When entering a new container, we will find the item with the least distance and append our item near it
3788			var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
3789			for (var j = this.items.length - 1; j >= 0; j--) {
3790				if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
3791				var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
3792				if(Math.abs(cur - base) < dist) {
3793					dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
3794				}
3795			}
3796
3797			if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
3798				return;
3799
3800			this.currentContainer = this.containers[innermostIndex];
3801			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
3802			this._trigger("change", event, this._uiHash());
3803			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
3804
3805			//Update the placeholder
3806			this.options.placeholder.update(this.currentContainer, this.placeholder);
3807
3808			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
3809			this.containers[innermostIndex].containerCache.over = 1;
3810		}
3811
3812
3813	},
3814
3815	_createHelper: function(event) {
3816
3817		var o = this.options;
3818		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
3819
3820		if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
3821			$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
3822
3823		if(helper[0] == this.currentItem[0])
3824			this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left
3824: this.currentItem.css("left") };
3825
3826		if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
3827		if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
3828
3829		return helper;
3830
3831	},
3832
3833	_adjustOffsetFromHelper: function(obj) {
3834		if (typeof obj == 'string') {
3835			obj = obj.split(' ');
3836		}
3837		if ($.isArray(obj)) {
3838			obj = {left: +obj[0], top: +obj[1] || 0};
3839		}
3840		if ('left' in obj) {
3841			this.offset.click.left = obj.left + this.margins.left;
3842		}
3843		if ('right' in obj) {
3844			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
3845		}
3846		if ('top' in obj) {
3847			this.offset.click.top = obj.top + this.margins.top;
3848		}
3849		if ('bottom' in obj) {
3850			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
3851		}
3852	},
3853
3854	_getParentOffset: function() {
3855
3856
3857		//Get the offsetParent and cache its position
3858		this.offsetParent = this.helper.offsetParent();
3859		var po = this.offsetParent.offset();
3860
3861		// This is a special case where we need to modify a offset calculated on start, since the following happened:
3862		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
3863		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
3864		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
3865		if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
3866			po.left += this.scrollParent.scrollLeft();
3867			po.top += this.scrollParent.scrollTop();
3868		}
3869
3870		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
3871		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
3872			po = { top: 0, left: 0 };
3873
3874		return {
3875			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
3876			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
3877		};
3878
3879	},
3880
3881	_getRelativeOffset: function() {
3882
3883		if(this.cssPosition == "relative") {
3884			var p = this.currentItem.position();
3885			return {
3886				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
3887				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
3888			};
3889		} else {
3890			return { top: 0, left: 0 };
3891		}
3892
3893	},
3894
3895	_cacheMargins: function() {
3896		this.margins = {
3897			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
3898			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
3899		};
3900	},
3901
3902	_cacheHelperProportions: function() {
3903		this.helperProportions = {
3904			width: this.helper.outerWidth(),
3905			height: this.helper.outerHeight()
3906		};
3907	},
3908
3909	_setContainment: function() {
3910
3911		var o = this.options;
3912		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
3913		if(o.containment == 'document' || o.containment == 'window') this.containment = [
3914			0 - this.offset.relative.left - this.offset.parent.left,
3915			0 - this.offset.relative.top - this.offset.parent.top,
3916			$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
3917			($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
3918		];
3919
3920		if(!(/^(document|window|parent)$/).test(o.containment)) {
3921			var ce = $(o.containment)[0];
3922			var co = $(o.containment).offset();
3923			var over = ($(ce).css("overflow") != 'hidden');
3924
3925			this.containment = [
3926				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
3927				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
3928				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
3929				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),
392910) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
3930			];
3931		}
3932
3933	},
3934
3935	_convertPositionTo: function(d, pos) {
3936
3937		if(!pos) pos = this.position;
3938		var mod = d == "absolute" ? 1 : -1;
3939		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
3940
3941		return {
3942			top: (
3943				pos.top																	// The absolute mouse position
3944				+ this.offset.relative.top * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
3945				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
3946				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
3947			),
3948			left: (
3949				pos.left																// The absolute mouse position
3950				+ this.offset.relative.left * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
3951				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
3952				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
3953			)
3954		};
3955
3956	},
3957
3958	_generatePosition: function(event) {
3959
3960		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
3961
3962		// This is another very weird special case that only happens for relative elements:
3963		// 1. If the css position is relative
3964		// 2. and the scroll parent is the document or similar to the offset parent
3965		// we have to refresh the relative offset during the scroll so there are no jumps
3966		if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
3967			this.offset.relative = this._getRelativeOffset();
3968		}
3969
3970		var pageX = event.pageX;
3971		var pageY = event.pageY;
3972
3973		/*
3974		 * - Position constraining -
3975		 * Constrain the position to a mix of grid, containment.
3976		 */
3977
3978		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
3979
3980			if(this.containment) {
3981				if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
3982				if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
3983				if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
3984				if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
3985			}
3986
3987			if(o.grid) {
3988				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
3989				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
3990
3991				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
3992				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
3993			}
3994
3995		}
3996
3997		return {
3998			top: (
3999				pageY																// The absolute mouse position
4000				- this.offset.click.top													// Click offset (relative to the element)
4001				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
4002				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
4003				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
4004			),
4005			left: (
4006				pageX																// The absolute mouse position
4007				- this.offset.click.left												// Click offset (relative to the element)
4008				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
4009				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
4010				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
4011			)
4012		};
4013
4014	},
4015
4016	_rearrange: function(event, i, a, hardRefresh) {
4017
4018		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
4019
4020		//Various things done here to improve the performance:
4021		// 1. we create a setTimeout, that calls refreshPositions
4022		// 2. on the instance, we have a counter variable, that get's higher after every append
4023		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
4024		// 4. this lets only the last addition to the timeout stack through
4025		this.counter = this.counter ? ++this.counter : 1;
4026		var self = this, counter = this.counter;
4027
4028		window.setTimeout(function() {
4029			if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
4030		},0);
4031
4032	},
4033
4034	_clear: function(event, noPropagation) {
4035
4036		this.reverting = false;
4037		// We delay all events that have to be triggered to after the point where the placeholder has been removed and
4038		// everything else normalized again
4039		var delayedTriggers = [], self = this;
4040
4041		// We first have to update the dom position of the actual currentItem
4042		// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
4043		if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
4044		this._noFinalSort = null;
4045
4046		if(this.helper[0] == this.currentItem[0]) {
4047			for(var i in this._storedCSS) {
4048				if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
4049			}
4050			this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
4051		} else {
4052			this.currentItem.show();
4053		}
4054
4055		if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
4056		if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
4057		if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
4058			if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
4059			for (var i = this.containers.length - 1; i >= 0; i--){
4060				if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
4061					delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
4062					delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.containers[i]));
4063				}
4064			};
4065		};
4066
4067		//Post events to containers
4068		for (var i = this.containers.length - 1; i >= 0; i--){
4069			if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
4070			if(this.containers[i].containerCache.over) {
4071				delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
4072				this.containers[i].containerCache.over = 0;
4073			}
4074		}
4075
4076		//Do what was originally in plugins
4077		if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
4078		if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
4079		if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
4080
4081		this.dragging = false;
4082		if(this.cancelHelperRemoval) {
4083			if(!noPropagation) {
4084				this._trigger("beforeStop", event, this._uiHash());
4085				for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4086				this._trigger("stop", event, this._uiHash());
4087			}
4088			return false;
4089		}
4090
4091		if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
4092
4093		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
4094		this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
4095
4096		if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
4097
4098		if(!noPropagation) {
4099			for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4100			this._trigger("stop", event, this._uiHash());
4101		}
4102
4103		this.fromOutside = false;
4104		return true;
4105
4106	},
4107
4108	_trigger: function() {
4109		if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
4110			this.cancel();
4111		}
4112	},
4113
4114	_uiHash: function(inst) {
4115		var self = inst || this;
4116		return {
4117			helper: self.helper,
4118			placeholder: self.placeholder || $([]),
4119			position: self.position,
4120			originalPosition: self.originalPosition,
4121			offset: self.positionAbs,
4122			item: self.currentItem,
4123			sender: inst ? inst.element : null
4124		};
4125	}
4126
4127});
4128
4129$.extend($.ui.sortable, {
4130	version: "1.8.4"
4131});
4132
4133})(jQuery);
4134/*
4135 * jQuery UI Accordion 1.8.4
4136 *
4137 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
4138 * Dual licensed under the MIT or GPL Version 2 licenses.
4139 * http://jquery.org/license
4140 *
4141 * http://docs.jquery.com/UI/Accordion
4142 *
4143 * Depends:
4144 *	jquery.ui.core.js
4145 *	jquery.ui.widget.js
4146 */
4147(function( $, undefined ) {
4148
4149$.widget( "ui.accordion", {
4150	options: {
4151		active: 0,
4152		animated: "slide",
4153		autoHeight: true,
4154		clearStyle: false,
4155		collapsible: false,
4156		event: "click",
4157		fillSpace: false,
4158		header: "> li > :first-child,> :not(li):even",
4159		icons: {
4160			header: "ui-icon-triangle-1-e",
4161			headerSelected: "ui-icon-triangle-1-s"
4162		},
4163		navigation: false,
4164		navigationFilter: function() {
4165			return this.href.toLowerCase() === location.href.toLowerCase();
4166		}
4167	},
4168
4169	_create: function() {
4170		var self = this,
4171			options = self.options;
4172
4173		self.running = 0;
4174
4175		self.element
4176			.addClass( "ui-accordion ui-widget ui-helper-reset" )
4177			// in lack of child-selectors in CSS
4178			// we need to mark top-LIs in a UL-accordion for some IE-fix
4179			.children( "li" )
4180				.addClass( "ui-accordion-li-fix" );
4181
4182		self.headers = self.element.find( options.header )
4183			.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
4184			.bind( "mouseenter.accordion", function() {
4185				if ( options.disabled ) {
4186					return;
4187				}
4188				$( this ).addClass( "ui-state-hover" );
4189			})
4190			.bind( "mouseleave.accordion", function() {
4191				if ( options.disabled ) {
4192					return;
4193				}
4194				$( this ).removeClass( "ui-state-hover" );
4195			})
4196			.bind( "focus.accordion", function() {
4197				if ( options.disabled ) {
4198					return;
4199				}
4200				$( this ).addClass( "ui-state-focus" );
4201			})
4202			.bind( "blur.accordion", function() {
4203				if ( options.disabled ) {
4204					return;
4205				}
4206				$( this ).removeClass( "ui-state-focus" );
4207			});
4208
4209		self.headers.next()
4210			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
4211
4212		if ( options.navigation ) {
4213			var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
4214			if ( current.length ) {
4215				var header = current.closest( ".ui-accordion-header" );
4216				if ( header.length ) {
4217					// anchor within header
4218					self.active = header;
4219				} else {
4220					// anchor within content
4221					self.active = current.closest( ".ui-accordion-content" ).prev();
4222				}
4223			}
4224		}
4225
4226		self.active = self._findActive( self.active || options.active )
4227			.addClass( "ui-state-default ui-state-active" )
4228			.toggleClass( "ui-corner-all ui-corner-top" );
4229		self.active.next().addClass( "ui-accordion-content-active" );
4230
4231		self._createIcons();
4232		self.resize();
4233
4234		// ARIA
4235		self.element.attr( "role", "tablist" );
4236
4237		self.headers
4238			.attr( "role", "tab" )
4239			.bind( "keydown.accordion", function( event ) {
4240				return self._keydown( event );
4241			})
4242			.next()
4243				.attr( "role", "tabpanel" );
4244
4245		self.headers
4246			.not( self.active || "" )
4247			.attr({
4248				"aria-expanded": "false",
4249				tabIndex: -1
4250			})
4251			.next()
4252				.hide();
4253
4254		// make sure at least one header is in the tab order
4255		if ( !self.active.length ) {
4256			self.headers.eq( 0 ).attr( "tabIndex", 0 );
4257		} else {
4258			self.active
4259				.attr({
4260					"aria-expanded": "true",
4261					tabIndex: 0
4262				});
4263		}
4264
4265		// only need links in tab order for Safari
4266		if ( !$.browser.safari ) {
4267			self.headers.find( "a" ).attr( "tabIndex", -1 );
4268		}
4269
4270		if ( options.event ) {
4271			self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
4272				self._clickHandler.call( self, event, this );
4273				event.preventDefault();
4274			});
4275		}
4276	},
4277
4278	_createIcons: function() {
4279		var options = this.options;
4280		if ( options.icons ) {
4281			$( "<span></span>" )
4282				.addClass( "ui-icon " + options.icons.header )
4283				.prependTo( this.headers );
4284			this.active.children( ".ui-icon" )
4285				.toggleClass(options.icons.header)
4286				.toggleClass(options.icons.headerSelected);
4287			this.element.addClass( "ui-accordion-icons" );
4288		}
4289	},
4290
4291	_destroyIcons: function() {
4292		this.headers.children( ".ui-icon" ).remove();
4293		this.element.removeClass( "ui-accordion-icons" );
4294	},
4295
4296	destroy: function() {
4297		var options = this.options;
4298
4299		this.element
4300			.removeClass( "ui-accordion ui-widget ui-helper-reset" )
4301			.removeAttr( "role" );
4302
4303		this.headers
4304			.unbind( ".accordion" )
4305			.removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
4306			.removeAttr( "role" )
4307			.removeAttr( "aria-expanded" )
4308			.removeAttr( "tabIndex" );
4309
4310		this.headers.find( "a" ).removeAttr( "tabIndex" );
4311		this._destroyIcons();
4312		var contents = this.headers.next()
4313			.css( "display", "" )
4314			.removeAttr( "role" )
4315			.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
4316		if ( options.autoHeight || options.fillHeight ) {
4317			contents.css( "height", "" );
4318		}
4319
4320		return $.Widget.prototype.destroy.call( this );
4321	},
4322
4323	_setOption: function( key, value ) {
4324		$.Widget.prototype._setOption.apply( this, arguments );
4325
4326		if ( key == "active" ) {
4327			this.activate( value );
4328		}
4329		if ( key == "icons" ) {
4330			this._destroyIcons();
4331			if ( value ) {
4332				this._createIcons();
4333			}
4334		}
4335		// #5332 - opacity doesn't cascade to positioned elements in IE
4336		// so we need to add the disabled class to the headers and panels
4337		if ( key == "disabled" ) {
4338			this.headers.add(this.headers.next())
4339				[ value ? "addClass" : "removeClass" ](
4340					"ui-accordion-disabled ui-state-disabled" );
4341		}
4342	},
4343
4344	_keydown: function( event ) {
4345		if ( this.options.disabled || event.altKey || event.ctrlKey ) {
4346			return;
4347		}
4348
4349		var keyCode = $.ui.keyCode,
4350			length = this.headers.length,
4351			currentIndex = this.headers.index( event.target ),
4352			toFocus = false;
4353
4354		switch ( event.keyCode ) {
4355			case keyCode.RIGHT:
4356			case keyCode.DOWN:
4357				toFocus = this.headers[ ( currentIndex + 1 ) % length ];
4358				break;
4359			case keyCode.LEFT:
4360			case keyCode.UP:
4361				toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
4362				break;
4363			case keyCode.SPACE:
4364			case keyCode.ENTER:
4365				this._clickHandler( { target: event.target }, event.target );
4366				event.preventDefault();
4367		}
4368
4369		if ( toFocus ) {
4370			$( event.target ).attr( "tabIndex", -1 );
4371			$( toFocus ).attr( "tabIndex", 0 );
4372			toFocus.focus();
4373			return false;
4374		}
4375
4376		return true;
4377	},
4378
4379	resize: function() {
4380		var options = this.options,
4381			maxHeight;
4382
4383		if ( options.fillSpace ) {
4384			if ( $.browser.msie ) {
4385				var defOverflow = this.element.parent().css( "overflow" );
4386				this.element.parent().css( "overflow", "hidden");
4387			}
4388			maxHeight = this.element.parent().height();
4389			if ($.browser.msie) {
4390				this.element.parent().css( "overflow", defOverflow );
4391			}
4392
4393			this.headers.each(function() {
4394				maxHeight -= $( this ).outerHeight( true );
4395			});
4396
4397			this.headers.next()
4398				.each(function() {
4399					$( this ).height( Math.max( 0, maxHeight -
4400						$( this ).innerHeight() + $( this ).height() ) );
4401				})
4402				.css( "overflow", "auto" );
4403		} else if ( options.autoHeight ) {
4404			maxHeight = 0;
4405			this.headers.next()
4406				.each(function() {
4407					maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
4408				})
4409				.height( maxHeight );
4410		}
4411
4412		return this;
4413	},
4414
4415	activate: function( index ) {
4416		// TODO this gets called on init, changing the option without an explicit call for that
4417		this.options.active = index;
4418		// call clickHandler with custom event
4419		var active = this._findActive( index )[ 0 ];
4420		this._clickHandler( { target: active }, active );
4421
4422		return this;
4423	},
4424
4425	_findActive: function( selector ) {
4426		return selector
4427			? typeof selector === "number"
4428				? this.headers.filter( ":eq(" + selector + ")" )
4429				: this.headers.not( this.headers.not( selector ) )
4430			: selector === false
4431				? $( [] )
4432				: this.headers.filter( ":eq(0)" );
4433	},
4434
4435	// TODO isn't event.target enough? why the separate target argument?
4436	_clickHandler: function( event, target ) {
4437		var options = this.options;
4438		if ( options.disabled ) {
4439			return;
4440		}
4441
4442		// called only when using activate(false) to close all parts programmatically
4443		if ( !event.target ) {
4444			if ( !options.collapsible ) {
4445				return;
4446			}
4447			this.active
4448				.removeClass( "ui-state-active ui-corner-top" )
4449				.addClass( "ui-state-default ui-corner-all" )
4450				.children( ".ui-icon" )
4451					.removeClass( options.icons.headerSelected )
4452					.addClass( options.icons.header );
4453			this.active.next().addClass( "ui-accordion-content-active" );
4454			var toHide = this.active.next(),
4455				data = {
4456					options: options,
4457					newHeader: $( [] ),
4458					oldHeader: options.active,
4459					newContent: $( [] ),
4460					oldContent: toHide
4461				},
4462				toShow = ( this.active = $( [] ) );
4463			this._toggle( toShow, toHide, data );
4464			return;
4465		}
4466
4467		// get the click target
4468		var clicked = $( event.currentTarget || target ),
4469			clickedIsActive = clicked[0] === this.active[0];
4470
4471		// TODO the option is changed, is that correct?
4472		// TODO if it is correct, shouldn't that happen after determining that the click is valid?
4473		options.active = options.collapsible && clickedIsActive ?
4474			false :
4475			this.headers.index( clicked );
4476
4477		// if animations are still active, or the active header is the target, ignore click
4478		if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
4479			return;
4480		}
4481
4482		// switch classes
4483		this.active
4484			.removeClass( "ui-state-active ui-corner-top" )
4485			.addClass( "ui-state-default ui-corner-all" )
4486			.children( ".ui-icon" )
4487				.removeClass( options.icons.headerSelected )
4488				.addClass( options.icons.header );
4489		if ( !clickedIsActive ) {
4490			clicked
4491				.removeClass( "ui-state-default ui-corner-all" )
4492				.addClass( "ui-state-active ui-corner-top" )
4493				.children( ".ui-icon" )
4494					.removeClass( options.icons.header )
4495					.addClass( options.icons.headerSelected );
4496			clicked
4497				.next()
4498				.addClass( "ui-accordion-content-active" );
4499		}
4500
4501		// find elements to show and hide
4502		var toShow = clicked.next(),
4503			toHide = this.active.next(),
4504			data = {
4505				options: options,
4506				newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
4507				oldHeader: this.active,
4508				newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
4509				oldContent: toHide
4510			},
4511			down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
4512
4513		this.active = clickedIsActive ? $([]) : clicked;
4514		this._toggle( toShow, toHide, data, clickedIsActive, down );
4515
4516		return;
4517	},
4518
4519	_toggle: function( toShow, toHide, data, clickedIsActive, down ) {
4520		var self = this,
4521			options = self.options;
4522
4523		self.toShow = toShow;
4524		self.toHide = toHide;
4525		self.data = data;
4526
4527		var complete = function() {
4528			if ( !self ) {
4529				return;
4530			}
4531			return self._completed.apply( self, arguments );
4532		};
4533
4534		// trigger changestart event
4535		self._trigger( "changestart", null, self.data );
4536
4537		// count elements to animate
4538		self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
4539
4540		if ( options.animated ) {
4541			var animOptions = {};
4542
4543			if ( options.collapsible && clickedIsActive ) {
4544				animOptions = {
4545					toShow: $( [] ),
4546					toHide: toHide,
4547					complete: complete,
4548					down: down,
4549					autoHeight: options.autoHeight || options.fillSpace
4550				};
4551			} else {
4552				animOptions = {
4553					toShow: toShow,
4554					toHide: toHide,
4555					complete: complete,
4556					down: down,
4557					autoHeight: options.autoHeight || options.fillSpace
4558				};
4559			}
4560
4561			if ( !options.proxied ) {
4562				options.proxied = options.animated;
4563			}
4564
4565			if ( !options.proxiedDuration ) {
4566				options.proxiedDuration = options.duration;
4567			}
4568
4569			options.animated = $.isFunction( options.proxied ) ?
4570				options.proxied( animOptions ) :
4571				options.proxied;
4572
4573			options.duration = $.isFunction( options.proxiedDuration ) ?
4574				options.proxiedDuration( animOptions ) :
4575				options.proxiedDuration;
4576
4577			var animations = $.ui.accordion.animations,
4578				duration = options.duration,
4579				easing = options.animated;
4580
4581			if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
4582				easing = "slide";
4583			}
4584			if ( !animations[ easing ] ) {
4585				animations[ easing ] = function( options ) {
4586					this.slide( options, {
4587						easing: easing,
4588						duration: duration || 700
4589					});
4590				};
4591			}
4592
4593			animations[ easing ]( animOptions );
4594		} else {
4595			if ( options.collapsible && clickedIsActive ) {
4596				toShow.toggle();
4597			} else {
4598				toHide.hide();
4599				toShow.show();
4600			}
4601
4602			complete( true );
4603		}
4604
4605		// TODO assert that the blur and focus triggers are really necessary, remove otherwise
4606		toHide.prev()
4607			.attr({
4608				"aria-expanded": "false",
4609				tabIndex: -1
4610			})
4611			.blur();
4612		toShow.prev()
4613			.attr({
4614				"aria-expanded": "true",
4615				tabIndex: 0
4616			})
4617			.focus();
4618	},
4619
4620	_completed: function( cancel ) {
4621		this.running = cancel ? 0 : --this.running;
4622		if ( this.running ) {
4623			return;
4624		}
4625
4626		if ( this.options.clearStyle ) {
4627			this.toShow.add( this.toHide ).css({
4628				height: "",
4629				overflow: ""
4630			});
4631		}
4632
4633		// other classes are removed before the animation; this one needs to stay until completed
4634		this.toHide.removeClass( "ui-accordion-content-active" );
4635
4636		this._trigger( "change", null, this.data );
4637	}
4638});
4639
4640$.extend( $.ui.accordion, {
4641	version: "1.8.4",
4642	animations: {
4643		slide: function( options, additions ) {
4644			options = $.extend({
4645				easing: "swing",
4646				duration: 300
4647			}, options, additions );
4648			if ( !options.toHide.size() ) {
4649				options.toShow.animate({
4650					height: "show",
4651					paddingTop: "show",
4652					paddingBottom: "show"
4653				}, options );
4654				return;
4655			}
4656			if ( !options.toShow.size() ) {
4657				options.toHide.animate({
4658					height: "hide",
4659					paddingTop: "hide",
4660					paddingBottom: "hide"
4661				}, options );
4662				return;
4663			}
4664			var overflow = options.toShow.css( "overflow" ),
4665				percentDone = 0,
4666				showProps = {},
4667				hideProps = {},
4668				fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
4669				originalWidth;
4670			// fix width before calculating height of hidden element
4671			var s = options.toShow;
4672			originalWidth = s[0].style.width;
4673			s.width( parseInt( s.parent().width(), 10 )
4674				- parseInt( s.css( "paddingLeft" ), 10 )
4675				- parseInt( s.css( "paddingRight" ), 10 )
4676				- ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
4677				- ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
4678
4679			$.each( fxAttrs, function( i, prop ) {
4680				hideProps[ prop ] = "hide";
4681
4682				var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
4683				showProps[ prop ] = {
4684					value: parts[ 1 ],
4685					unit: parts[ 2 ] || "px"
4686				};
4687			});
4688			options.toShow.css({ height: 0, overflow: "hidden" }).show();
4689			options.toHide
4690				.filter( ":hidden" )
4691					.each( options.complete )
4692				.end()
4693				.filter( ":visible" )
4694				.animate( hideProps, {
4695				step: function( now, settings ) {
4696					// only calculate the percent when animating height
4697					// IE gets very inconsistent results when animating elements
4698					// with small values, which is common for padding
4699					if ( settings.prop == "height" ) {
4700						percentDone = ( settings.end - settings.start === 0 ) ? 0 :
4701							( settings.now - settings.start ) / ( settings.end - settings.start );
4702					}
4703
4704					options.toShow[ 0 ].style[ settings.prop ] =
4705						( percentDone * showProps[ settings.prop ].value )
4706						+ showProps[ settings.prop ].unit;
4707				},
4708				duration: options.duration,
4709				easing: options.easing,
4710				complete: function() {
4711					if ( !options.autoHeight ) {
4712						options.toShow.css( "height", "" );
4713					}
4714					options.toShow.css({
4715						width: originalWidth,
4716						overflow: overflow
4717					});
4718					options.complete();
4719				}
4720			});
4721		},
4722		bounceslide: function( options ) {
4723			this.slide( options, {
4724				easing: options.down ? "easeOutBounce" : "swing",
4725				duration: options.down ? 1000 : 200
4726			});
4727		}
4728	}
4729});
4730
4731})( jQuery );
4732/*
4733 * jQuery UI Autocomplete 1.8.4
4734 *
4735 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
4736 * Dual licensed under the MIT or GPL Version 2 licenses.
4737 * http://jquery.org/license
4738 *
4739 * http://docs.jquery.com/UI/Autocomplete
4740 *
4741 * Depends:
4742 *	jquery.ui.core.js
4743 *	jquery.ui.widget.js
4744 *	jquery.ui.position.js
4745 */
4746(function( $, undefined ) {
4747
4748$.widget( "ui.autocomplete", {
4749	options: {
4750		appendTo: "body",
4751		delay: 300,
4752		minLength: 1,
4753		position: {
4754			my: "left top",
4755			at: "left bottom",
4756			collision: "none"
4757		},
4758		source: null
4759	},
4760	_create: function() {
4761		var self = this,
4762			doc = this.element[ 0 ].ownerDocument;
4763		this.element
4764			.addClass( "ui-autocomplete-input" )
4765			.attr( "autocomplete", "off" )
4766			// TODO verify these actually work as intended
4767			.attr({
4768				role: "textbox",
4769				"aria-autocomplete": "list",
4770				"aria-haspopup": "true"
4771			})
4772			.bind( "keydown.autocomplete", function( event ) {
4773				if ( self.options.disabled ) {
4774					return;
4775				}
4776
4777				var keyCode = $.ui.keyCode;
4778				switch( event.keyCode ) {
4779				case keyCode.PAGE_UP:
4780					self._move( "previousPage", event );
4781					break;
4782				case keyCode.PAGE_DOWN:
4783					self._move( "nextPage", event );
4784					break;
4785				case keyCode.UP:
4786					self._move( "previous", event );
4787					// prevent moving cursor to beginning of text field in some browsers
4788					event.preventDefault();
4789					break;
4790				case keyCode.DOWN:
4791					self._move( "next", event );
4792					// prevent moving cursor to end of text field in some browsers
4793					event.preventDefault();
4794					break;
4795				case keyCode.ENTER:
4796				case keyCode.NUMPAD_ENTER:
4797					// when menu is open or has focus
4798					if ( self.menu.element.is( ":visible" ) ) {
4799						event.preventDefault();
4800					}
4801					//passthrough - ENTER and TAB both select the current element
4802				case keyCode.TAB:
4803					if ( !self.menu.active ) {
4804						return;
4805					}
4806					self.menu.select( event );
4807					break;
4808				case keyCode.ESCAPE:
4809					self.element.val( self.term );
4810					self.close( event );
4811					break;
4812				default:
4813					// keypress is triggered before the input value is changed
4814					clearTimeout( self.searching );
4815					self.searching = setTimeout(function() {
4816						// only search if the value has changed
4817						if ( self.term != self.element.val() ) {
4818							self.selectedItem = null;
4819							self.search( null, event );
4820						}
4821					}, self.options.delay );
4822					break;
4823				}
4824			})
4825			.bind( "focus.autocomplete", function() {
4826				if ( self.options.disabled ) {
4827					return;
4828				}
4829
4830				self.selectedItem = null;
4831				self.previous = self.element.val();
4832			})
4833			.bind( "blur.autocomplete", function( event ) {
4834				if ( self.options.disabled ) {
4835					return;
4836				}
4837
4838				clearTimeout( self.searching );
4839				// clicks on the menu (or a button to trigger a search) will cause a blur event
4840				self.closing = setTimeout(function() {
4841					self.close( event );
4842					self._change( event );
4843				}, 150 );
4844			});
4845		this._initSource();
4846		this.response = function() {
4847			return self._response.apply( self, arguments );
4848		};
4849		this.menu = $( "<ul></ul>" )
4850			.addClass( "ui-autocomplete" )
4851			.appendTo( $( this.options.appendTo || "body", doc )[0] )
4852			// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
4853			.mousedown(function( event ) {
4854				// clicking on the scrollbar causes focus to shift to the body
4855				// but we can't detect a mouseup or a click immediately afterward
4856				// so we have to track the next mousedown and close the menu if
4857				// the user clicks somewhere outside of the autocomplete
4858				var menuElement = self.menu.element[ 0 ];
4859				if ( event.target === menuElement ) {
4860					setTimeout(function() {
4861						$( document ).one( 'mousedown', function( event ) {
4862							if ( event.target !== self.element[ 0 ] &&
4863								event.target !== menuElement &&
4864								!$.ui.contains( menuElement, event.target ) ) {
4865								self.close();
4866							}
4867						});
4868					}, 1 );
4869				}
4870
4871				// use another timeout to make sure the blur-event-handler on the input was already triggered
4872				setTimeout(function() {
4873					clearTimeout( self.closing );
4874				}, 13);
4875			})
4876			.menu({
4877				focus: function( event, ui ) {
4878					var item = ui.item.data( "item.autocomplete" );
4879					if ( false !== self._trigger( "focus", null, { item: item } ) ) {
4880						// use value to match what will end up in the input, if it was a key event
4881						if ( /^key/.test(event.originalEvent.type) ) {
4882							self.element.val( item.value );
4883						}
4884					}
4885				},
4886				selected: function( event, ui ) {
4887					var item = ui.item.data( "item.autocomplete" ),
4888						previous = self.previous;
4889
4890					// only trigger when focus was lost (click on menu)
4891					if ( self.element[0] !== doc.activeElement ) {
4892						self.element.focus();
4893						self.previous = previous;
4894					}
4895
4896					if ( false !== self._trigger( "select", event, { item: item } ) ) {
4897						self.element.val( item.value );
4898					}
4899
4900					self.close( event );
4901					self.selectedItem = item;
4902				},
4903				blur: function( event, ui ) {
4904					// don't set the value of the text field if it's already correct
4905					// this prevents moving the cursor unnecessarily
4906					if ( self.menu.element.is(":visible") &&
4907						( self.element.val() !== self.term ) ) {
4908						self.element.val( self.term );
4909					}
4910				}
4911			})
4912			.zIndex( this.element.zIndex() + 1 )
4913			// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
4914			.css({ top: 0, left: 0 })
4915			.hide()
4916			.data( "menu" );
4917		if ( $.fn.bgiframe ) {
4918			 this.menu.element.bgiframe();
4919		}
4920	},
4921
4922	destroy: function() {
4923		this.element
4924			.removeClass( "ui-autocomplete-input" )
4925			.removeAttr( "autocomplete" )
4926			.removeAttr( "role" )
4927			.removeAttr( "aria-autocomplete" )
4928			.removeAttr( "aria-haspopup" );
4929		this.menu.element.remove();
4930		$.Widget.prototype.destroy.call( this );
4931	},
4932
4933	_setOption: function( key, value ) {
4934		$.Widget.prototype._setOption.apply( this, arguments );
4935		if ( key === "source" ) {
4936			this._initSource();
4937		}
4938		if ( key === "appendTo" ) {
4939			this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
4940		}
4941	},
4942
4943	_initSource: function() {
4944		var array,
4945			url;
4946		if ( $.isArray(this.options.source) ) {
4947			array = this.options.source;
4948			this.source = function( request, response ) {
4949				response( $.ui.autocomplete.filter(array, request.term) );
4950			};
4951		} else if ( typeof this.options.source === "string" ) {
4952			url = this.options.source;
4953			this.source = function( request, response ) {
4954				$.getJSON( url, request, response );
4955			};
4956		} else {
4957			this.source = this.options.source;
4958		}
4959	},
4960
4961	search: function( value, event ) {
4962		value = value != null ? value : this.element.val();
4963		if ( value.length < this.options.minLength ) {
4964			return this.close( event );
4965		}
4966
4967		clearTimeout( this.closing );
4968		if ( this._trigger("search") === false ) {
4969			return;
4970		}
4971
4972		return this._search( value );
4973	},
4974
4975	_search: function( value ) {
4976		this.term = this.element
4977			.addClass( "ui-autocomplete-loading" )
4978			// always save the actual value, not the one passed as an argument
4979			.val();
4980
4981		this.source( { term: value }, this.response );
4982	},
4983
4984	_response: function( content ) {
4985		if ( content.length ) {
4986			content = this._normalize( content );
4987			this._suggest( content );
4988			this._trigger( "open" );
4989		} else {
4990			this.close();
4991		}
4992		this.element.removeClass( "ui-autocomplete-loading" );
4993	},
4994
4995	close: function( event ) {
4996		clearTimeout( this.closing );
4997		if ( this.menu.element.is(":visible") ) {
4998			this._trigger( "close", event );
4999			this.menu.element.hide();
5000			this.menu.deactivate();
5001		}
5002	},
5003
5004	_change: function( event ) {
5005		if ( this.previous !== this.element.val() ) {
5006			this._trigger( "change", event, { item: this.selectedItem } );
5007		}
5008	},
5009
5010	_normalize: function( items ) {
5011		// assume all items have the right format when the first item is complete
5012		if ( items.length && items[0].label && items[0].value ) {
5013			return items;
5014		}
5015		return $.map( items, function(item) {
5016			if ( typeof item === "string" ) {
5017				return {
5018					label: item,
5019					value: item
5020				};
5021			}
5022			return $.extend({
5023				label: item.label || item.value,
5024				value: item.value || item.label
5025			}, item );
5026		});
5027	},
5028
5029	_suggest: function( items ) {
5030		var ul = this.menu.element
5031				.empty()
5032				.zIndex( this.element.zIndex() + 1 ),
5033			menuWidth,
5034			textWidth;
5035		this._renderMenu( ul, items );
5036		// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
5037		this.menu.deactivate();
5038		this.menu.refresh();
5039		this.menu.element.show().position( $.extend({
5040			of: this.element
5041		}, this.options.position ));
5042
5043		menuWidth = ul.width( "" ).outerWidth();
5044		textWidth = this.element.outerWidth();
5045		ul.outerWidth( Math.max( menuWidth, textWidth ) );
5046	},
5047
5048	_renderMenu: function( ul, items ) {
5049		var self = this;
5050		$.each( items, function( index, item ) {
5051			self._renderItem( ul, item );
5052		});
5053	},
5054
5055	_renderItem: function( ul, item) {
5056		return $( "<li></li>" )
5057			.data( "item.autocomplete", item )
5058			.append( $( "<a></a>" ).text( item.label ) )
5059			.appendTo( ul );
5060	},
5061
5062	_move: function( direction, event ) {
5063		if ( !this.menu.element.is(":visible") ) {
5064			this.search( null, event );
5065			return;
5066		}
5067		if ( this.menu.first() && /^previous/.test(direction) ||
5068				this.menu.last() && /^next/.test(direction) ) {
5069			this.element.val( this.term );
5070			this.menu.deactivate();
5071			return;
5072		}
5073		this.menu[ direction ]( event );
5074	},
5075
5076	widget: function() {
5077		return this.menu.element;
5078	}
5079});
5080
5081$.extend( $.ui.autocomplete, {
5082	escapeRegex: function( value ) {
5083		return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
5084	},
5085	filter: function(array, term) {
5086		var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
5087		return $.grep( array, function(value) {
5088			return matcher.test( value.label || value.value || value );
5089		});
5090	}
5091});
5092
5093}( jQuery ));
5094
5095/*
5096 * jQuery UI Menu (not officially released)
5097 *
5098 * This widget isn't yet finished and the API is subject to change. We plan to finish
5099 * it for the next release. You're welcome to give it a try anyway and give us feedback,
5100 * as long as you're okay with migrating your code later on. We can help with that, too.
5101 *
5102 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5103 * Dual licensed under the MIT or GPL Version 2 licenses.
5104 * http://jquery.org/license
5105 *
5106 * http://docs.jquery.com/UI/Menu
5107 *
5108 * Depends:
5109 *	jquery.ui.core.js
5110 *  jquery.ui.widget.js
5111 */
5112(function($) {
5113
5114$.widget("ui.menu", {
5115	_create: function() {
5116		var self = this;
5117		this.element
5118			.addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
5119			.attr({
5120				role: "listbox",
5121				"aria-activedescendant": "ui-active-menuitem"
5122			})
5123			.click(function( event ) {
5124				if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
5125					return;
5126				}
5127				// temporary
5128				event.preventDefault();
5129				self.select( event );
5130			});
5131		this.refresh();
5132	},
5133
5134	refresh: function() {
5135		var self = this;
5136
5137		// don't refresh list items that are already adapted
5138		var items = this.element.children("li:not(.ui-menu-item):has(a)")
5139			.addClass("ui-menu-item")
5140			.attr("role", "menuitem");
5141
5142		items.children("a")
5143			.addClass("ui-corner-all")
5144			.attr("tabindex", -1)
5145			// mouseenter doesn't work with event delegation
5146			.mouseenter(function( event ) {
5147				self.activate( event, $(this).parent() );
5148			})
5149			.mouseleave(function() {
5150				self.deactivate();
5151			});
5152	},
5153
5154	activate: function( event, item ) {
5155		this.deactivate();
5156		if (this.hasScroll()) {
5157			var offset = item.offset().top - this.element.offset().top,
5158				scroll = this.element.attr("scrollTop"),
5159				elementHeight = this.element.height();
5160			if (offset < 0) {
5161				this.element.attr("scrollTop", scroll + offset);
5162			} else if (offset > elementHeight) {
5163				this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
5164			}
5165		}
5166		this.active = item.eq(0)
5167			.children("a")
5168				.addClass("ui-state-hover")
5169				.attr("id", "ui-active-menuitem")
5170			.end();
5171		this._trigger("focus", event, { item: item });
5172	},
5173
5174	deactivate: function() {
5175		if (!this.active) { return; }
5176
5177		this.active.children("a")
5178			.removeClass("ui-state-hover")
5179			.removeAttr("id");
5180		this._trigger("blur");
5181		this.active = null;
5182	},
5183
5184	next: function(event) {
5185		this.move("next", ".ui-menu-item:first", event);
5186	},
5187
5188	previous: function(event) {
5189		this.move("prev", ".ui-menu-item:last", event);
5190	},
5191
5192	first: function() {
5193		return this.active && !this.active.prevAll(".ui-menu-item").length;
5194	},
5195
5196	last: function() {
5197		return this.active && !this.active.nextAll(".ui-menu-item").length;
5198	},
5199
5200	move: function(direction, edge, event) {
5201		if (!this.active) {
5202			this.activate(event, this.element.children(edge));
5203			return;
5204		}
5205		var next = this.active[direction + "All"](".ui-menu-item").eq(0);
5206		if (next.length) {
5207			this.activate(event, next);
5208		} else {
5209			this.activate(event, this.element.children(edge));
5210		}
5211	},
5212
5213	// TODO merge with previousPage
5214	nextPage: function(event) {
5215		if (this.hasScroll()) {
5216			// TODO merge with no-scroll-else
5217			if (!this.active || this.last()) {
5218				this.activate(event, this.element.children(":first"));
5219				return;
5220			}
5221			var base = this.active.offset().top,
5222				height = this.element.height(),
5223				result = this.element.children("li").filter(function() {
5224					var close = $(this).offset().top - base - height + $(this).height();
5225					// TODO improve approximation
5226					return close < 10 && close > -10;
5227				});
5228
5229			// TODO try to catch this earlier when scrollTop indicates the last page anyway
5230			if (!result.length) {
5231				result = this.element.children(":last");
5232			}
5233			this.activate(event, result);
5234		} else {
5235			this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last"));
5236		}
5237	},
5238
5239	// TODO merge with nextPage
5240	previousPage: function(event) {
5241		if (this.hasScroll()) {
5242			// TODO merge with no-scroll-else
5243			if (!this.active || this.first()) {
5244				this.activate(event, this.element.children(":last"));
5245				return;
5246			}
5247
5248			var base = this.active.offset().top,
5249				height = this.element.height();
5250				result = this.element.children("li").filter(function() {
5251					var close = $(this).offset().top - base + height - $(this).height();
5252					// TODO improve approximation
5253					return close < 10 && close > -10;
5254				});
5255
5256			// TODO try to catch this earlier when scrollTop indicates the last page anyway
5257			if (!result.length) {
5258				result = this.element.children(":first");
5259			}
5260			this.activate(event, result);
5261		} else {
5262			this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first"));
5263		}
5264	},
5265
5266	hasScroll: function() {
5267		return this.element.height() < this.element.attr("scrollHeight");
5268	},
5269
5270	select: function( event ) {
5271		this._trigger("selected", event, { item: this.active });
5272	}
5273});
5274
5275}(jQuery));
5276/*
5277 * jQuery UI Button 1.8.4
5278 *
5279 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5280 * Dual licensed under the MIT or GPL Version 2 licenses.
5281 * http://jquery.org/license
5282 *
5283 * http://docs.jquery.com/UI/Button
5284 *
5285 * Depends:
5286 *	jquery.ui.core.js
5287 *	jquery.ui.widget.js
5288 */
5289(function( $, undefined ) {
5290
5291var lastActive,
5292	baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
5293	stateClasses = "ui-state-hover ui-state-active ",
5294	typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
5295	formResetHandler = function( event ) {
5296		$( ":ui-button", event.target.form ).each(function() {
5297			var inst = $( this ).data( "button" );
5298			setTimeout(function() {
5299				inst.refresh();
5300			}, 1 );
5301		});
5302	},
5303	radioGroup = function( radio ) {
5304		var name = radio.name,
5305			form = radio.form,
5306			radios = $( [] );
5307		if ( name ) {
5308			if ( form ) {
5309				radios = $( form ).find( "[name='" + name + "']" );
5310			} else {
5311				radios = $( "[name='" + name + "']", radio.ownerDocument )
5312					.filter(function() {
5313						return !this.form;
5314					});
5315			}
5316		}
5317		return radios;
5318	};
5319
5320$.widget( "ui.button", {
5321	options: {
5322		text: true,
5323		label: null,
5324		icons: {
5325			primary: null,
5326			secondary: null
5327		}
5328	},
5329	_create: function() {
5330		this.element.closest( "form" )
5331			.unbind( "reset.button" )
5332			.bind( "reset.button", formResetHandler );
5333
5334		this._determineButtonType();
5335		this.hasTitle = !!this.buttonElement.attr( "title" );
5336
5337		var self = this,
5338			options = this.options,
5339			toggleButton = this.type === "checkbox" || this.type === "radio",
5340			hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
5341			focusClass = "ui-state-focus";
5342
5343		if ( options.label === null ) {
5344			options.label = this.buttonElement.html();
5345		}
5346
5347		if ( this.element.is( ":disabled" ) ) {
5348			options.disabled = true;
5349		}
5350
5351		this.buttonElement
5352			.addClass( baseClasses )
5353			.attr( "role", "button" )
5354			.bind( "mouseenter.button", function() {
5355				if ( options.disabled ) {
5356					return;
5357				}
5358				$( this ).addClass( "ui-state-hover" );
5359				if ( this === lastActive ) {
5360					$( this ).addClass( "ui-state-active" );
5361				}
5362			})
5363			.bind( "mouseleave.button", function() {
5364				if ( options.disabled ) {
5365					return;
5366				}
5367				$( this ).removeClass( hoverClass );
5368			})
5369			.bind( "focus.button", function() {
5370				// no need to check disabled, focus won't be triggered anyway
5371				$( this ).addClass( focusClass );
5372			})
5373			.bind( "blur.button", function() {
5374				$( this ).removeClass( focusClass );
5375			});
5376
5377		if ( toggleButton ) {
5378			this.element.bind( "change.button", function() {
5379				self.refresh();
5380			});
5381		}
5382
5383		if ( this.type === "checkbox" ) {
5384			this.buttonElement.bind( "click.button", function() {
5385				if ( options.disabled ) {
5386					return false;
5387				}
5388				$( this ).toggleClass( "ui-state-active" );
5389				self.buttonElement.attr( "aria-pressed", self.element[0].checked );
5390			});
5391		} else if ( this.type === "radio" ) {
5392			this.buttonElement.bind( "click.button", function() {
5393				if ( options.disabled ) {
5394					return false;
5395				}
5396				$( this ).addClass( "ui-state-active" );
5397				self.buttonElement.attr( "aria-pressed", true );
5398
5399				var radio = self.element[ 0 ];
5400				radioGroup( radio )
5401					.not( radio )
5402					.map(function() {
5403						return $( this ).button( "widget" )[ 0 ];
5404					})
5405					.removeClass( "ui-state-active" )
5406					.attr( "aria-pressed", false );
5407			});
5408		} else {
5409			this.buttonElement
5410				.bind( "mousedown.button", function() {
5411					if ( options.disabled ) {
5412						return false;
5413					}
5414					$( this ).addClass( "ui-state-active" );
5415					lastActive = this;
5416					$( document ).one( "mouseup", function() {
5417						lastActive = null;
5418					});
5419				})
5420				.bind( "mouseup.button", function() {
5421					if ( options.disabled ) {
5422						return false;
5423					}
5424					$( this ).removeClass( "ui-state-active" );
5425				})
5426				.bind( "keydown.button", function(event) {
5427					if ( options.disabled ) {
5428						return false;
5429					}
5430					if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
5431						$( this ).addClass( "ui-state-active" );
5432					}
5433				})
5434				.bind( "keyup.button", function() {
5435					$( this ).removeClass( "ui-state-active" );
5436				});
5437
5438			if ( this.buttonElement.is("a") ) {
5439				this.buttonElement.keyup(function(event) {
5440					if ( event.keyCode === $.ui.keyCode.SPACE ) {
5441						// TODO pass through original event correctly (just as 2nd argument doesn't work)
5442						$( this ).click();
5443					}
5444				});
5445			}
5446		}
5447
5448		// TODO: pull out $.Widget's handling for the disabled option into
5449		// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
5450		// be overridden by individual plugins
5451		this._setOption( "disabled", options.disabled );
5452	},
5453
5454	_determineButtonType: function() {
5455
5456		if ( this.element.is(":checkbox") ) {
5457			this.type = "checkbox";
5458		} else {
5459			if ( this.element.is(":radio") ) {
5460				this.type = "radio";
5461			} else {
5462				if ( this.element.is("input") ) {
5463					this.type = "input";
5464				} else {
5465					this.type = "button";
5466				}
5467			}
5468		}
5469
5470		if ( this.type === "checkbox" || this.type === "radio" ) {
5471			// we don't search against the document in case the element
5472			// is disconnected from the DOM
5473			this.buttonElement = this.element.parents().last()
5474				.find( "label[for=" + this.element.attr("id") + "]" );
5475			this.element.addClass( "ui-helper-hidden-accessible" );
5476
5477			var checked = this.element.is( ":checked" );
5478			if ( checked ) {
5479				this.buttonElement.addClass( "ui-state-active" );
5480			}
5481			this.buttonElement.attr( "aria-pressed", checked );
5482		} else {
5483			this.buttonElement = this.element;
5484		}
5485	},
5486
5487	widget: function() {
5488		return this.buttonElement;
5489	},
5490
5491	destroy: function() {
5492		this.element
5493			.removeClass( "ui-helper-hidden-accessible" );
5494		this.buttonElement
5495			.removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
5496			.removeAttr( "role" )
5497			.removeAttr( "aria-pressed" )
5498			.html( this.buttonElement.find(".ui-button-text").html() );
5499
5500		if ( !this.hasTitle ) {
5501			this.buttonElement.removeAttr( "title" );
5502		}
5503
5504		$.Widget.prototype.destroy.call( this );
5505	},
5506
5507	_setOption: function( key, value ) {
5508		$.Widget.prototype._setOption.apply( this, arguments );
5509		if ( key === "disabled" ) {
5510			if ( value ) {
5511				this.element.attr( "disabled", true );
5512			} else {
5513				this.element.removeAttr( "disabled" );
5514			}
5515		}
5516		this._resetButton();
5517	},
5518
5519	refresh: function() {
5520		var isDisabled = this.element.is( ":disabled" );
5521		if ( isDisabled !== this.options.disabled ) {
5522			this._setOption( "disabled", isDisabled );
5523		}
5524		if ( this.type === "radio" ) {
5525			radioGroup( this.element[0] ).each(function() {
5526				if ( $( this ).is( ":checked" ) ) {
5527					$( this ).button( "widget" )
5528						.addClass( "ui-state-active" )
5529						.attr( "aria-pressed", true );
5530				} else {
5531					$( this ).button( "widget" )
5532						.removeClass( "ui-state-active" )
5533						.attr( "aria-pressed", false );
5534				}
5535			});
5536		} else if ( this.type === "checkbox" ) {
5537			if ( this.element.is( ":checked" ) ) {
5538				this.buttonElement
5539					.addClass( "ui-state-active" )
5540					.attr( "aria-pressed", true );
5541			} else {
5542				this.buttonElement
5543					.removeClass( "ui-state-active" )
5544					.attr( "aria-pressed", false );
5545			}
5546		}
5547	},
5548
5549	_resetButton: function() {
5550		if ( this.type === "input" ) {
5551			if ( this.options.label ) {
5552				this.element.val( this.options.label );
5553			}
5554			return;
5555		}
5556		var buttonElement = this.buttonElement.removeClass( typeClasses ),
5557			buttonText = $( "<span></span>" )
5558				.addClass( "ui-button-text" )
5559				.html( this.options.label )
5560				.appendTo( buttonElement.empty() )
5561				.text(),
5562			icons = this.options.icons,
5563			multipleIcons = icons.primary && icons.secondary;
5564		if ( icons.primary || icons.secondary ) {
5565			buttonElement.addClass( "ui-button-text-icon" +
5566				( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
5567			if ( icons.primary ) {
5568				buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
5569			}
5570			if ( icons.secondary ) {
5571				buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
5572			}
5573			if ( !this.options.text ) {
5574				buttonElement
5575					.addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
5576					.removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
5577				if ( !this.hasTitle ) {
5578					buttonElement.attr( "title", buttonText );
5579				}
5580			}
5581		} else {
5582			buttonElement.addClass( "ui-button-text-only" );
5583		}
5584	}
5585});
5586
5587$.widget( "ui.buttonset", {
5588	_create: function() {
5589		this.element.addClass( "ui-buttonset" );
5590		this._init();
5591	},
5592
5593	_init: function() {
5594		this.refresh();
5595	},
5596
5597	_setOption: function( key, value ) {
5598		if ( key === "disabled" ) {
5599			this.buttons.button( "option", key, value );
5600		}
5601
5602		$.Widget.prototype._setOption.apply( this, arguments );
5603	},
5604
5605	refresh: function() {
5606		this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
5607			.filter( ":ui-button" )
5608				.button( "refresh" )
5609			.end()
5610			.not( ":ui-button" )
5611				.button()
5612			.end()
5613			.map(function() {
5614				return $( this ).button( "widget" )[ 0 ];
5615			})
5616				.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
5617				.filter( ":first" )
5618					.addClass( "ui-corner-left" )
5619				.end()
5620				.filter( ":last" )
5621					.addClass( "ui-corner-right" )
5622				.end()
5623			.end();
5624	},
5625
5626	destroy: function() {
5627		this.element.removeClass( "ui-buttonset" );
5628		this.buttons
5629			.map(function() {
5630				return $( this ).button( "widget" )[ 0 ];
5631			})
5632				.removeClass( "ui-corner-left ui-corner-right" )
5633			.end()
5634			.button( "destroy" );
5635
5636		$.Widget.prototype.destroy.call( this );
5637	}
5638});
5639
5640}( jQuery ) );
5641/*
5642 * jQuery UI Dialog 1.8.4
5643 *
5644 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5645 * Dual licensed under the MIT or GPL Version 2 licenses.
5646 * http://jquery.org/license
5647 *
5648 * http://docs.jquery.com/UI/Dialog
5649 *
5650 * Depends:
5651 *	jquery.ui.core.js
5652 *	jquery.ui.widget.js
5653 *  jquery.ui.button.js
5654 *	jquery.ui.draggable.js
5655 *	jquery.ui.mouse.js
5656 *	jquery.ui.position.js
5657 *	jquery.ui.resizable.js
5658 */
5659(function( $, undefined ) {
5660
5661var uiDialogClasses =
5662	'ui-dialog ' +
5663	'ui-widget ' +
5664	'ui-widget-content ' +
5665	'ui-corner-all ';
5666
5667$.widget("ui.dialog", {
5668	options: {
5669		autoOpen: true,
5670		buttons: {},
5671		closeOnEscape: true,
5672		closeText: 'close',
5673		dialogClass: '',
5674		draggable: true,
5675		hide: null,
5676		height: 'auto',
5677		maxHeight: false,
5678		maxWidth: false,
5679		minHeight: 150,
5680		minWidth: 150,
5681		modal: false,
5682		position: {
5683			my: 'center',
5684			at: 'center',
5685			of: window,
5686			collision: 'fit',
5687			// ensure that the titlebar is never outside the document
5688			using: function(pos) {
5689				var topOffset = $(this).css(pos).offset().top;
5690				if (topOffset < 0) {
5691					$(this).css('top', pos.top - topOffset);
5692				}
5693			}
5694		},
5695		resizable: true,
5696		show: null,
5697		stack: true,
5698		title: '',
5699		width: 300,
5700		zIndex: 1000
5701	},
5702
5703	_create: function() {
5704		this.originalTitle = this.element.attr('title');
5705		// #5742 - .attr() might return a DOMElement
5706		if ( typeof this.originalTitle !== "string" ) {
5707			this.originalTitle = "";
5708		}
5709
5710		var self = this,
5711			options = self.options,
5712
5713			title = options.title || self.originalTitle || '&#160;',
5714			titleId = $.ui.dialog.getTitleId(self.element),
5715
5716			uiDialog = (self.uiDialog = $('<div></div>'))
5717				.appendTo(document.body)
5718				.hide()
5719				.addClass(uiDialogClasses + options.dialogClass)
5720				.css({
5721					zIndex: options.zIndex
5722				})
5723				// setting tabIndex makes the div focusable
5724				// setting outline to 0 prevents a border on focus in Mozilla
5725				.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
5726					if (options.closeOnEscape && event.keyCode &&
5727						event.keyCode === $.ui.keyCode.ESCAPE) {
5728
5729						self.close(event);
5730						event.preventDefault();
5731					}
5732				})
5733				.attr({
5734					role: 'dialog',
5735					'aria-labelledby': titleId
5736				})
5737				.mousedown(function(event) {
5738					self.moveToTop(false, event);
5739				}),
5740
5741			uiDialogContent = self.element
5742				.show()
5743				.removeAttr('title')
5744				.addClass(
5745					'ui-dialog-content ' +
5746					'ui-widget-content')
5747				.appendTo(uiDialog),
5748
5749			uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
5750				.addClass(
5751					'ui-dialog-titlebar ' +
5752					'ui-widget-header ' +
5753					'ui-corner-all ' +
5754					'ui-helper-clearfix'
5755				)
5756				.prependTo(uiDialog),
5757
5758			uiDialogTitlebarClose = $('<a href="#"></a>')
5759				.addClass(
5760					'ui-dialog-titlebar-close ' +
5761					'ui-corner-all'
5762				)
5763				.attr('role', 'button')
5764				.hover(
5765					function() {
5766						uiDialogTitlebarClose.addClass('ui-state-hover');
5767					},
5768					function() {
5769						uiDialogTitlebarClose.removeClass('ui-state-hover');
5770					}
5771				)
5772				.focus(function() {
5773					uiDialogTitlebarClose.addClass('ui-state-focus');
5774				})
5775				.blur(function() {
5776					uiDialogTitlebarClose.removeClass('ui-state-focus');
5777				})
5778				.click(function(event) {
5779					self.close(event);
5780					return false;
5781				})
5782				.appendTo(uiDialogTitlebar),
5783
5784			uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
5785				.addClass(
5786					'ui-icon ' +
5787					'ui-icon-closethick'
5788				)
5789				.text(options.closeText)
5790				.appendTo(uiDialogTitlebarClose),
5791
5792			uiDialogTitle = $('<span></span>')
5793				.addClass('ui-dialog-title')
5794				.attr('id', titleId)
5795				.html(title)
5796				.prependTo(uiDialogTitlebar);
5797
5798		//handling of deprecated beforeclose (vs beforeClose) option
5799		//Ticket #4669 http://dev.jqueryui.com/ticket/4669
5800		//TODO: remove in 1.9pre
5801		if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
5802			options.beforeClose = options.beforeclose;
5803		}
5804
5805		uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
5806
5807		if (options.draggable && $.fn.draggable) {
5808			self._makeDraggable();
5809		}
5810		if (options.resizable && $.fn.resizable) {
5811			self._makeResizable();
5812		}
5813
5814		self._createButtons(options.buttons);
5815		self._isOpen = false;
5816
5817		if ($.fn.bgiframe) {
5818			uiDialog.bgiframe();
5819		}
5820	},
5821
5822	_init: function() {
5823		if ( this.options.autoOpen ) {
5824			this.open();
5825		}
5826	},
5827
5828	destroy: function() {
5829		var self = this;
5830
5831		if (self.overlay) {
5832			self.overlay.destroy();
5833		}
5834		self.uiDialog.hide();
5835		self.element
5836			.unbind('.dialog')
5837			.removeData('dialog')
5838			.removeClass('ui-dialog-content ui-widget-content')
5839			.hide().appendTo('body');
5840		self.uiDialog.remove();
5841
5842		if (self.originalTitle) {
5843			self.element.attr('title', self.originalTitle);
5844		}
5845
5846		return self;
5847	},
5848
5849	widget: function() {
5850		return this.uiDialog;
5851	},
5852
5853	close: function(event) {
5854		var self = this,
5855			maxZ;
5856
5857		if (false === self._trigger('beforeClose', event)) {
5858			return;
5859		}
5860
5861		if (self.overlay) {
5862			self.overlay.destroy();
5863		}
5864		self.uiDialog.unbind('keypress.ui-dialog');
5865
5866		self._isOpen = false;
5867
5868		if (self.options.hide) {
5869			self.uiDialog.hide(self.options.hide, function() {
5870				self._trigger('close', event);
5871			});
5872		} else {
5873			self.uiDialog.hide();
5874			self._trigger('close', event);
5875		}
5876
5877		$.ui.dialog.overlay.resize();
5878
5879		// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
5880		if (self.options.modal) {
5881			maxZ = 0;
5882			$('.ui-dialog').each(function() {
5883				if (this !== self.uiDialog[0]) {
5884					maxZ = Math.max(maxZ, $(this).css('z-index'));
5885				}
5886			});
5887			$.ui.dialog.maxZ = maxZ;
5888		}
5889
5890		return self;
5891	},
5892
5893	isOpen: function() {
5894		return this._isOpen;
5895	},
5896
5897	// the force parameter allows us to move modal dialogs to their correct
5898	// position on open
5899	moveToTop: function(force, event) {
5900		var self = this,
5901			options = self.options,
5902			saveScroll;
5903
5904		if ((options.modal && !force) ||
5905			(!options.stack && !options.modal)) {
5906			return self._trigger('focus', event);
5907		}
5908
5909		if (options.zIndex > $.ui.dialog.maxZ) {
5910			$.ui.dialog.maxZ = options.zIndex;
5911		}
5912		if (self.overlay) {
5913			$.ui.dialog.maxZ += 1;
5914			self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
5915		}
5916
5917		//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
5918		//  http://ui.jquery.com/bugs/ticket/3193
5919		saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
5920		$.ui.dialog.maxZ += 1;
5921		self.uiDialog.css('z-index', $.ui.dialog.maxZ);
5922		self.element.attr(saveScroll);
5923		self._trigger('focus', event);
5924
5925		return self;
5926	},
5927
5928	open: function() {
5929		if (this._isOpen) { return; }
5930
5931		var self = this,
5932			options = self.options,
5933			uiDialog = self.uiDialog;
5934
5935		self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
5936		if (uiDialog.next().length) {
5937			uiDialog.appendTo('body');
5938		}
5939		self._size();
5940		self._position(options.position);
5941		uiDialog.show(options.show);
5942		self.moveToTop(true);
5943
5944		// prevent tabbing out of modal dialogs
5945		if (options.modal) {
5946			uiDialog.bind('keypress.ui-dialog', function(event) {
5947				if (event.keyCode !== $.ui.keyCode.TAB) {
5948					return;
5949				}
5950
5951				var tabbables = $(':tabbable', this),
5952					first = tabbables.filter(':first'),
5953					last  = tabbables.filter(':last');
5954
5955				if (event.target === last[0] && !event.shiftKey) {
5956					first.focus(1);
5957					return false;
5958				} else if (event.target === first[0] && event.shiftKey) {
5959					last.focus(1);
5960					return false;
5961				}
5962			});
5963		}
5964
5965		// set focus to the first tabbable element in the content area or the first button
5966		// if there are no tabbable elements, set focus on the dialog itself
5967		$(self.element.find(':tabbable').get().concat(
5968			uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
5969				uiDialog.get()))).eq(0).focus();
5970
5971		self._trigger('open');
5972		self._isOpen = true;
5973
5974		return self;
5975	},
5976
5977	_createButtons: function(buttons) {
5978		var self = this,
5979			hasButtons = false,
5980			uiDialogButtonPane = $('<div></div>')
5981				.addClass(
5982					'ui-dialog-buttonpane ' +
5983					'ui-widget-content ' +
5984					'ui-helper-clearfix'
5985				),
5986			uiButtonSet = $( "<div></div>" )
5987				.addClass( "ui-dialog-buttonset" )
5988				.appendTo( uiDialogButtonPane );
5989
5990		// if we already have a button pane, remove it
5991		self.uiDialog.find('.ui-dialog-buttonpane').remove();
5992
5993		if (typeof buttons === 'object' && buttons !== null) {
5994			$.each(buttons, function() {
5995				return !(hasButtons = true);
5996			});
5997		}
5998		if (hasButtons) {
5999			$.each(buttons, function(name, fn) {
6000				var button = $('<button type="button"></button>')
6001					.text(name)
6002					.click(function() { fn.apply(self.element[0], arguments); })
6003					.appendTo(uiButtonSet);
6004				if ($.fn.button) {
6005					button.button();
6006				}
6007			});
6008			uiDialogButtonPane.appendTo(self.uiDialog);
6009		}
6010	},
6011
6012	_makeDraggable: function() {
6013		var self = this,
6014			options = self.options,
6015			doc = $(document),
6016			heightBeforeDrag;
6017
6018		function filteredUi(ui) {
6019			return {
6020				position: ui.position,
6021				offset: ui.offset
6022			};
6023		}
6024
6025		self.uiDialog.draggable({
6026			cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
6027			handle: '.ui-dialog-titlebar',
6028			containment: 'document',
6029			start: function(event, ui) {
6030				heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
6031				$(this).height($(this).height()).addClass("ui-dialog-dragging");
6032				self._trigger('dragStart', event, filteredUi(ui));
6033			},
6034			drag: function(event, ui) {
6035				self._trigger('drag', event, filteredUi(ui));
6036			},
6037			stop: function(event, ui) {
6038				options.position = [ui.position.left - doc.scrollLeft(),
6039					ui.position.top - doc.scrollTop()];
6040				$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
6041				self._trigger('dragStop', event, filteredUi(ui));
6042				$.ui.dialog.overlay.resize();
6043			}
6044		});
6045	},
6046
6047	_makeResizable: function(handles) {
6048		handles = (handles === undefined ? this.options.resizable : handles);
6049		var self = this,
6050			options = self.options,
6051			// .ui-resizable has position: relative defined in the stylesheet
6052			// but dialogs have to use absolute or fixed positioning
6053			position = self.uiDialog.css('position'),
6054			resizeHandles = (typeof handles === 'string' ?
6055				handles	:
6056				'n,e,s,w,se,sw,ne,nw'
6057			);
6058
6059		function filteredUi(ui) {
6060			return {
6061				originalPosition: ui.originalPosition,
6062				originalSize: ui.originalSize,
6063				position: ui.position,
6064				size: ui.size
6065			};
6066		}
6067
6068		self.uiDialog.resizable({
6069			cancel: '.ui-dialog-content',
6070			containment: 'document',
6071			alsoResize: self.element,
6072			maxWidth: options.maxWidth,
6073			maxHeight: options.maxHeight,
6074			minWidth: options.minWidth,
6075			minHeight: self._minHeight(),
6076			handles: resizeHandles,
6077			start: function(event, ui) {
6078				$(this).addClass("ui-dialog-resizing");
6079				self._trigger('resizeStart', event, filteredUi(ui));
6080			},
6081			resize: function(event, ui) {
6082				self._trigger('resize', event, filteredUi(ui));
6083			},
6084			stop: function(event, ui) {
6085				$(this).removeClass("ui-dialog-resizing");
6086				options.height = $(this).height();
6087				options.width = $(this).width();
6088				self._trigger('resizeStop', event, filteredUi(ui));
6089				$.ui.dialog.overlay.resize();
6090			}
6091		})
6092		.css('position', position)
6093		.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
6094	},
6095
6096	_minHeight: function() {
6097		var options = this.options;
6098
6099		if (options.height === 'auto') {
6100			return options.minHeight;
6101		} else {
6102			return Math.min(options.minHeight, options.height);
6103		}
6104	},
6105
6106	_position: function(position) {
6107		var myAt = [],
6108			offset = [0, 0],
6109			isVisible;
6110
6111		if (position) {
6112			// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
6113	//		if (typeof position == 'string' || $.isArray(position)) {
6114	//			myAt = $.isArray(position) ? position : position.split(' ');
6115
6116			if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
6117				myAt = position.split ? position.split(' ') : [position[0], position[1]];
6118				if (myAt.length === 1) {
6119					myAt[1] = myAt[0];
6120				}
6121
6122				$.each(['left', 'top'], function(i, offsetPosition) {
6123					if (+myAt[i] === myAt[i]) {
6124						offset[i] = myAt[i];
6125						myAt[i] = offsetPosition;
6126					}
6127				});
6128
6129				position = {
6130					my: myAt.join(" "),
6131					at: myAt.join(" "),
6132					offset: offset.join(" ")
6133				};
6134			}
6135
6136			position = $.extend({}, $.ui.dialog.prototype.options.position, position);
6137		} else {
6138			position = $.ui.dialog.prototype.options.position;
6139		}
6140
6141		// need to show the dialog to get the actual offset in the position plugin
6142		isVisible = this.uiDialog.is(':visible');
6143		if (!isVisible) {
6144			this.uiDialog.show();
6145		}
6146		this.uiDialog
6147			// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
6148			.css({ top: 0, left: 0 })
6149			.position(position);
6150		if (!isVisible) {
6151			this.uiDialog.hide();
6152		}
6153	},
6154
6155	_setOption: function(key, value){
6156		var self = this,
6157			uiDialog = self.uiDialog,
6158			isResizable = uiDialog.is(':data(resizable)'),
6159			resize = false;
6160
6161		switch (key) {
6162			//handling of deprecated beforeclose (vs beforeClose) option
6163			//Ticket #4669 http://dev.jqueryui.com/ticket/4669
6164			//TODO: remove in 1.9pre
6165			case "beforeclose":
6166				key = "beforeClose";
6167				break;
6168			case "buttons":
6169				self._createButtons(value);
6170				resize = true;
6171				break;
6172			case "closeText":
6173				// convert whatever was passed in to a string, for text() to not throw up
6174				self.uiDialogTitlebarCloseText.text("" + value);
6175				break;
6176			case "dialogClass":
6177				uiDialog
6178					.removeClass(self.options.dialogClass)
6179					.addClass(uiDialogClasses + value);
6180				break;
6181			case "disabled":
6182				if (value) {
6183					uiDialog.addClass('ui-dialog-disabled');
6184				} else {
6185					uiDialog.removeClass('ui-dialog-disabled');
6186				}
6187				break;
6188			case "draggable":
6189				if (value) {
6190					self._makeDraggable();
6191				} else {
6192					uiDialog.draggable('destroy');
6193				}
6194				break;
6195			case "height":
6196				resize = true;
6197				break;
6198			case "maxHeight":
6199				if (isResizable) {
6200					uiDialog.resizable('option', 'maxHeight', value);
6201				}
6202				resize = true;
6203				break;
6204			case "maxWidth":
6205				if (isResizable) {
6206					uiDialog.resizable('option', 'maxWidth', value);
6207				}
6208				resize = true;
6209				break;
6210			case "minHeight":
6211				if (isResizable) {
6212					uiDialog.resizable('option', 'minHeight', value);
6213				}
6214				resize = true;
6215				break;
6216			case "minWidth":
6217				if (isResizable) {
6218					uiDialog.resizable('option', 'minWidth', value);
6219				}
6220				resize = true;
6221				break;
6222			case "position":
6223				self._position(value);
6224				break;
6225			case "resizable":
6226				// currently resizable, becoming non-resizable
6227				if (isResizable && !value) {
6228					uiDialog.resizable('destroy');
6229				}
6230
6231				// currently resizable, changing handles
6232				if (isResizable && typeof value === 'string') {
6233					uiDialog.resizable('option', 'handles', value);
6234				}
6235
6236				// currently non-resizable, becoming resizable
6237				if (!isResizable && value !== false) {
6238					self._makeResizable(value);
6239				}
6240				break;
6241			case "title":
6242				// convert whatever was passed in o a string, for html() to not throw up
6243				$(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
6244				break;
6245			case "width":
6246				resize = true;
6247				break;
6248		}
6249
6250		$.Widget.prototype._setOption.apply(self, arguments);
6251		if (resize) {
6252			self._size();
6253		}
6254	},
6255
6256	_size: function() {
6257		/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
6258		 * divs will both have width and height set, so we need to reset them
6259		 */
6260		var options = this.options,
6261			nonContentHeight;
6262
6263		// reset content sizing
6264		// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
6265		this.element.css({
6266			width: 'auto',
6267			minHeight: 0,
6268			height: 0
6269		});
6270
6271		if (options.minWidth > options.width) {
6272			options.width = options.minWidth;
6273		}
6274
6275		// reset wrapper sizing
6276		// determine the height of all the non-content elements
6277		nonContentHeight = this.uiDialog.css({
6278				height: 'auto',
6279				width: options.width
6280			})
6281			.height();
6282
6283		this.element
6284			.css(options.height === 'auto' ? {
6285					minHeight: Math.max(options.minHeight - nonContentHeight, 0),
6286					height: 'auto'
6287				} : {
6288					minHeight: 0,
6289					height: Math.max(options.height - nonContentHeight, 0)
6290			})
6291			.show();
6292
6293		if (this.uiDialog.is(':data(resizable)')) {
6294			this.uiDialog.resizable('option', 'minHeight', this._minHeight());
6295		}
6296	}
6297});
6298
6299$.extend($.ui.dialog, {
6300	version: "1.8.4",
6301
6302	uuid: 0,
6303	maxZ: 0,
6304
6305	getTitleId: function($el) {
6306		var id = $el.attr('id');
6307		if (!id) {
6308			this.uuid += 1;
6309			id = this.uuid;
6310		}
6311		return 'ui-dialog-title-' + id;
6312	},
6313
6314	overlay: function(dialog) {
6315		this.$el = $.ui.dialog.overlay.create(dialog);
6316	}
6317});
6318
6319$.extend($.ui.dialog.overlay, {
6320	instances: [],
6321	// reuse old instances due to IE memory leak with alpha transparency (see #5185)
6322	oldInstances: [],
6323	maxZ: 0,
6324	events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
6325		function(event) { return event + '.dialog-overlay'; }).join(' '),
6326	create: function(dialog) {
6327		if (this.instances.length === 0) {
6328			// prevent use of anchors and inputs
6329			// we use a setTimeout in case the overlay is created from an
6330			// event that we're going to be cancelling (see #2804)
6331			setTimeout(function() {
6332				// handle $(el).dialog().dialog('close') (see #4065)
6333				if ($.ui.dialog.overlay.instances.length) {
6334					$(document).bind($.ui.dialog.overlay.events, function(event) {
6335						// stop events if the z-index of the target is < the z-index of the overlay
6336						return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
6337					});
6338				}
6339			}, 1);
6340
6341			// allow closing by pressing the escape key
6342			$(document).bind('keydown.dialog-overlay', function(event) {
6343				if (dialog.options.closeOnEscape && event.keyCode &&
6344					event.keyCode === $.ui.keyCode.ESCAPE) {
6345
6346					dialog.close(event);
6347					event.preventDefault();
6348				}
6349			});
6350
6351			// handle window resize
6352			$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
6353		}
6354
6355		var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
6356			.appendTo(document.body)
6357			.css({
6358				width: this.width(),
6359				height: this.height()
6360			});
6361
6362		if ($.fn.bgiframe) {
6363			$el.bgiframe();
6364		}
6365
6366		this.instances.push($el);
6367		return $el;
6368	},
6369
6370	destroy: function($el) {
6371		this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
6372
6373		if (this.instances.length === 0) {
6374			$([document, window]).unbind('.dialog-overlay');
6375		}
6376
6377		$el.remove();
6378
6379		// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
6380		var maxZ = 0;
6381		$.each(this.instances, function() {
6382			maxZ = Math.max(maxZ, this.css('z-index'));
6383		});
6384		this.maxZ = maxZ;
6385	},
6386
6387	height: function() {
6388		var scrollHeight,
6389			offsetHeight;
6390		// handle IE 6
6391		if ($.browser.msie && $.browser.version < 7) {
6392			scrollHeight = Math.max(
6393				document.documentElement.scrollHeight,
6394				document.body.scrollHeight
6395			);
6396			offsetHeight = Math.max(
6397				document.documentElement.offsetHeight,
6398				document.body.offsetHeight
6399			);
6400
6401			if (scrollHeight < offsetHeight) {
6402				return $(window).height() + 'px';
6403			} else {
6404				return scrollHeight + 'px';
6405			}
6406		// handle "good" browsers
6407		} else {
6408			return $(document).height() + 'px';
6409		}
6410	},
6411
6412	width: function() {
6413		var scrollWidth,
6414			offsetWidth;
6415		// handle IE 6
6416		if ($.browser.msie && $.browser.version < 7) {
6417			scrollWidth = Math.max(
6418				document.documentElement.scrollWidth,
6419				document.body.scrollWidth
6420			);
6421			offsetWidth = Math.max(
6422				document.documentElement.offsetWidth,
6423				document.body.offsetWidth
6424			);
6425
6426			if (scrollWidth < offsetWidth) {
6427				return $(window).width() + 'px';
6428			} else {
6429				return scrollWidth + 'px';
6430			}
6431		// handle "good" browsers
6432		} else {
6433			return $(document).width() + 'px';
6434		}
6435	},
6436
6437	resize: function() {
6438		/* If the dialog is draggable and the user drags it past the
6439		 * right edge of the window, the document becomes wider so we
6440		 * need to stretch the overlay. If the user then drags the
6441		 * dialog back to the left, the document will become narrower,
6442		 * so we need to shrink the overlay to the appropriate size.
6443		 * This is handled by shrinking the overlay before setting it
6444		 * to the full document size.
6445		 */
6446		var $overlays = $([]);
6447		$.each($.ui.dialog.overlay.instances, function() {
6448			$overlays = $overlays.add(this);
6449		});
6450
6451		$overlays.css({
6452			width: 0,
6453			height: 0
6454		}).css({
6455			width: $.ui.dialog.overlay.width(),
6456			height: $.ui.dialog.overlay.height()
6457		});
6458	}
6459});
6460
6461$.extend($.ui.dialog.overlay.prototype, {
6462	destroy: function() {
6463		$.ui.dialog.overlay.destroy(this.$el);
6464	}
6465});
6466
6467}(jQuery));
6468/*
6469 * jQuery UI Slider 1.8.4
6470 *
6471 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
6472 * Dual licensed under the MIT or GPL Version 2 licenses.
6473 * http://jquery.org/license
6474 *
6475 * http://docs.jquery.com/UI/Slider
6476 *
6477 * Depends:
6478 *	jquery.ui.core.js
6479 *	jquery.ui.mouse.js
6480 *	jquery.ui.widget.js
6481 */
6482(function( $, undefined ) {
6483
6484// number of pages in a slider
6485// (how many times can you page up/down to go through the whole range)
6486var numPages = 5;
6487
6488$.widget( "ui.slider", $.ui.mouse, {
6489
6490	widgetEventPrefix: "slide",
6491
6492	options: {
6493		animate: false,
6494		distance: 0,
6495		max: 100,
6496		min: 0,
6497		orientation: "horizontal",
6498		range: false,
6499		step: 1,
6500		value: 0,
6501		values: null
6502	},
6503
6504	_create: function() {
6505		var self = this,
6506			o = this.options;
6507
6508		this._keySliding = false;
6509		this._mouseSliding = false;
6510		this._animateOff = true;
6511		this._handleIndex = null;
6512		this._detectOrientation();
6513		this._mouseInit();
6514
6515		this.element
6516			.addClass( "ui-slider" +
6517				" ui-slider-" + this.orientation +
6518				" ui-widget" +
6519				" ui-widget-content" +
6520				" ui-corner-all" );
6521
6522		if ( o.disabled ) {
6523			this.element.addClass( "ui-slider-disabled ui-disabled" );
6524		}
6525
6526		this.range = $([]);
6527
6528		if ( o.range ) {
6529			if ( o.range === true ) {
6530				this.range = $( "<div></div>" );
6531				if ( !o.values ) {
6532					o.values = [ this._valueMin(), this._valueMin() ];
6533				}
6534				if ( o.values.length && o.values.length !== 2 ) {
6535					o.values = [ o.values[0], o.values[0] ];
6536				}
6537			} else {
6538				this.range = $( "<div></div>" );
6539			}
6540
6541			this.range
6542				.appendTo( this.element )
6543				.addClass( "ui-slider-range" );
6544
6545			if ( o.range === "min" || o.range === "max" ) {
6546				this.range.addClass( "ui-slider-range-" + o.range );
6547			}
6548
6549			// note: this isn't the most fittingly semantic framework class for this element,
6550			// but worked best visually with a variety of themes
6551			this.range.addClass( "ui-widget-header" );
6552		}
6553
6554		if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
6555			$( "<a href='#'></a>" )
6556				.appendTo( this.element )
6557				.addClass( "ui-slider-handle" );
6558		}
6559
6560		if ( o.values && o.values.length ) {
6561			while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
6562				$( "<a href='#'></a>" )
6563					.appendTo( this.element )
6564					.addClass( "ui-slider-handle" );
6565			}
6566		}
6567
6568		this.handles = $( ".ui-slider-handle", this.element )
6569			.addClass( "ui-state-default" +
6570				" ui-corner-all" );
6571
6572		this.handle = this.handles.eq( 0 );
6573
6574		this.handles.add( this.range ).filter( "a" )
6575			.click(function( event ) {
6576				event.preventDefault();
6577			})
6578			.hover(function() {
6579				if ( !o.disabled ) {
6580					$( this ).addClass( "ui-state-hover" );
6581				}
6582			}, function() {
6583				$( this ).removeClass( "ui-state-hover" );
6584			})
6585			.focus(function() {
6586				if ( !o.disabled ) {
6587					$( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
6588					$( this ).addClass( "ui-state-focus" );
6589				} else {
6590					$( this ).blur();
6591				}
6592			})
6593			.blur(function() {
6594				$( this ).removeClass( "ui-state-focus" );
6595			});
6596
6597		this.handles.each(function( i ) {
6598			$( this ).data( "index.ui-slider-handle", i );
6599		});
6600
6601		this.handles
6602			.keydown(function( event ) {
6603				var ret = true,
6604					index = $( this ).data( "index.ui-slider-handle" ),
6605					allowed,
6606					curVal,
6607					newVal,
6608					step;
6609
6610				if ( self.options.disabled ) {
6611					return;
6612				}
6613
6614				switch ( event.keyCode ) {
6615					case $.ui.keyCode.HOME:
6616					case $.ui.keyCode.END:
6617					case $.ui.keyCode.PAGE_UP:
6618					case $.ui.keyCode.PAGE_DOWN:
6619					case $.ui.keyCode.UP:
6620					case $.ui.keyCode.RIGHT:
6621					case $.ui.keyCode.DOWN:
6622					case $.ui.keyCode.LEFT:
6623						ret = false;
6624						if ( !self._keySliding ) {
6625							self._keySliding = true;
6626							$( this ).addClass( "ui-state-active" );
6627							allowed = self._start( event, index );
6628							if ( allowed === false ) {
6629								return;
6630							}
6631						}
6632						break;
6633				}
6634
6635				step = self.options.step;
6636				if ( self.options.values && self.options.values.length ) {
6637					curVal = newVal = self.values( index );
6638				} else {
6639					curVal = newVal = self.value();
6640				}
6641
6642				switch ( event.keyCode ) {
6643					case $.ui.keyCode.HOME:
6644						newVal = self._valueMin();
6645						break;
6646					case $.ui.keyCode.END:
6647						newVal = self._valueMax();
6648						break;
6649					case $.ui.keyCode.PAGE_UP:
6650						newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
6651						break;
6652					case $.ui.keyCode.PAGE_DOWN:
6653						newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
6654						break;
6655					case $.ui.keyCode.UP:
6656					case $.ui.keyCode.RIGHT:
6657						if ( curVal === self._valueMax() ) {
6658							return;
6659						}
6660						newVal = self._trimAlignValue( curVal + step );
6661						break;
6662					case $.ui.keyCode.DOWN:
6663					case $.ui.keyCode.LEFT:
6664						if ( curVal === self._valueMin() ) {
6665							return;
6666						}
6667						newVal = self._trimAlignValue( curVal - step );
6668						break;
6669				}
6670
6671				self._slide( event, index, newVal );
6672
6673				return ret;
6674
6675			})
6676			.keyup(function( event ) {
6677				var index = $( this ).data( "index.ui-slider-handle" );
6678
6679				if ( self._keySliding ) {
6680					self._keySliding = false;
6681					self._stop( event, index );
6682					self._change( event, index );
6683					$( this ).removeClass( "ui-state-active" );
6684				}
6685
6686			});
6687
6688		this._refreshValue();
6689
6690		this._animateOff = false;
6691	},
6692
6693	destroy: function() {
6694		this.handles.remove();
6695		this.range.remove();
6696
6697		this.element
6698			.removeClass( "ui-slider" +
6699				" ui-slider-horizontal" +
6700				" ui-slider-vertical" +
6701				" ui-slider-disabled" +
6702				" ui-widget" +
6703				" ui-widget-content" +
6704				" ui-corner-all" )
6705			.removeData( "slider" )
6706			.unbind( ".slider" );
6707
6708		this._mouseDestroy();
6709
6710		return this;
6711	},
6712
6713	_mouseCapture: function( event ) {
6714		var o = this.options,
6715			position,
6716			normValue,
6717			distance,
6718			closestHandle,
6719			self,
6720			index,
6721			allowed,
6722			offset,
6723			mouseOverHandle;
6724
6725		if ( o.disabled ) {
6726			return false;
6727		}
6728
6729		this.elementSize = {
6730			width: this.element.outerWidth(),
6731			height: this.element.outerHeight()
6732		};
6733		this.elementOffset = this.element.offset();
6734
6735		position = { x: event.pageX, y: event.pageY };
6736		normValue = this._normValueFromMouse( position );
6737		distance = this._valueMax() - this._valueMin() + 1;
6738		self = this;
6739		this.handles.each(function( i ) {
6740			var thisDistance = Math.abs( normValue - self.values(i) );
6741			if ( distance > thisDistance ) {
6742				distance = thisDistance;
6743				closestHandle = $( this );
6744				index = i;
6745			}
6746		});
6747
6748		// workaround for bug #3736 (if both handles of a range are at 0,
6749		// the first is always used as the one with least distance,
6750		// and moving it is obviously prevented by preventing negative ranges)
6751		if( o.range === true && this.values(1) === o.min ) {
6752			index += 1;
vendor: 10,044 bytes, lines 6753-7113
6753			closestHandle = $( this.handles[index] );
6754		}
6755
6756		allowed = this._start( event, index );
6757		if ( allowed === false ) {
6758			return false;
6759		}
6760		this._mouseSliding = true;
6761
6762		self._handleIndex = index;
6763
6764		closestHandle
6765			.addClass( "ui-state-active" )
6766			.focus();
6767
6768		offset = closestHandle.offset();
6769		mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
6770		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
6771			left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
6772			top: event.pageY - offset.top -
6773				( closestHandle.height() / 2 ) -
6774				( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
6775				( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
6776				( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
6777		};
6778
6779		this._slide( event, index, normValue );
6780		this._animateOff = true;
6781		return true;
6782	},
6783
6784	_mouseStart: function( event ) {
6785		return true;
6786	},
6787
6788	_mouseDrag: function( event ) {
6789		var position = { x: event.pageX, y: event.pageY },
6790			normValue = this._normValueFromMouse( position );
6791
6792		this._slide( event, this._handleIndex, normValue );
6793
6794		return false;
6795	},
6796
6797	_mouseStop: function( event ) {
6798		this.handles.removeClass( "ui-state-active" );
6799		this._mouseSliding = false;
6800
6801		this._stop( event, this._handleIndex );
6802		this._change( event, this._handleIndex );
6803
6804		this._handleIndex = null;
6805		this._clickOffset = null;
6806		this._animateOff = false;
6807
6808		return false;
6809	},
6810
6811	_detectOrientation: function() {
6812		this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
6813	},
6814
6815	_normValueFromMouse: function( position ) {
6816		var pixelTotal,
6817			pixelMouse,
6818			percentMouse,
6819			valueTotal,
6820			valueMouse;
6821
6822		if ( this.orientation === "horizontal" ) {
6823			pixelTotal = this.elementSize.width;
6824			pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
6825		} else {
6826			pixelTotal = this.elementSize.height;
6827			pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
6828		}
6829
6830		percentMouse = ( pixelMouse / pixelTotal );
6831		if ( percentMouse > 1 ) {
6832			percentMouse = 1;
6833		}
6834		if ( percentMouse < 0 ) {
6835			percentMouse = 0;
6836		}
6837		if ( this.orientation === "vertical" ) {
6838			percentMouse = 1 - percentMouse;
6839		}
6840
6841		valueTotal = this._valueMax() - this._valueMin();
6842		valueMouse = this._valueMin() + percentMouse * valueTotal;
6843
6844		return this._trimAlignValue( valueMouse );
6845	},
6846
6847	_start: function( event, index ) {
6848		var uiHash = {
6849			handle: this.handles[ index ],
6850			value: this.value()
6851		};
6852		if ( this.options.values && this.options.values.length ) {
6853			uiHash.value = this.values( index );
6854			uiHash.values = this.values();
6855		}
6856		return this._trigger( "start", event, uiHash );
6857	},
6858
6859	_slide: function( event, index, newVal ) {
6860		var otherVal,
6861			newValues,
6862			allowed;
6863
6864		if ( this.options.values && this.options.values.length ) {
6865			otherVal = this.values( index ? 0 : 1 );
6866
6867			if ( ( this.options.values.length === 2 && this.options.range === true ) &&
6868					( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
6869				) {
6870				newVal = otherVal;
6871			}
6872
6873			if ( newVal !== this.values( index ) ) {
6874				newValues = this.values();
6875				newValues[ index ] = newVal;
6876				// A slide can be canceled by returning false from the slide callback
6877				allowed = this._trigger( "slide", event, {
6878					handle: this.handles[ index ],
6879					value: newVal,
6880					values: newValues
6881				} );
6882				otherVal = this.values( index ? 0 : 1 );
6883				if ( allowed !== false ) {
6884					this.values( index, newVal, true );
6885				}
6886			}
6887		} else {
6888			if ( newVal !== this.value() ) {
6889				// A slide can be canceled by returning false from the slide callback
6890				allowed = this._trigger( "slide", event, {
6891					handle: this.handles[ index ],
6892					value: newVal
6893				} );
6894				if ( allowed !== false ) {
6895					this.value( newVal );
6896				}
6897			}
6898		}
6899	},
6900
6901	_stop: function( event, index ) {
6902		var uiHash = {
6903			handle: this.handles[ index ],
6904			value: this.value()
6905		};
6906		if ( this.options.values && this.options.values.length ) {
6907			uiHash.value = this.values( index );
6908			uiHash.values = this.values();
6909		}
6910
6911		this._trigger( "stop", event, uiHash );
6912	},
6913
6914	_change: function( event, index ) {
6915		if ( !this._keySliding && !this._mouseSliding ) {
6916			var uiHash = {
6917				handle: this.handles[ index ],
6918				value: this.value()
6919			};
6920			if ( this.options.values && this.options.values.length ) {
6921				uiHash.value = this.values( index );
6922				uiHash.values = this.values();
6923			}
6924
6925			this._trigger( "change", event, uiHash );
6926		}
6927	},
6928
6929	value: function( newValue ) {
6930		if ( arguments.length ) {
6931			this.options.value = this._trimAlignValue( newValue );
6932			this._refreshValue();
6933			this._change( null, 0 );
6934		}
6935
6936		return this._value();
6937	},
6938
6939	values: function( index, newValue ) {
6940		var vals,
6941			newValues,
6942			i;
6943
6944		if ( arguments.length > 1 ) {
6945			this.options.values[ index ] = this._trimAlignValue( newValue );
6946			this._refreshValue();
6947			this._change( null, index );
6948		}
6949
6950		if ( arguments.length ) {
6951			if ( $.isArray( arguments[ 0 ] ) ) {
6952				vals = this.options.values;
6953				newValues = arguments[ 0 ];
6954				for ( i = 0; i < vals.length; i += 1 ) {
6955					vals[ i ] = this._trimAlignValue( newValues[ i ] );
6956					this._change( null, i );
6957				}
6958				this._refreshValue();
6959			} else {
6960				if ( this.options.values && this.options.values.length ) {
6961					return this._values( index );
6962				} else {
6963					return this.value();
6964				}
6965			}
6966		} else {
6967			return this._values();
6968		}
6969	},
6970
6971	_setOption: function( key, value ) {
6972		var i,
6973			valsLength = 0;
6974
6975		if ( $.isArray( this.options.values ) ) {
6976			valsLength = this.options.values.length;
6977		}
6978
6979		$.Widget.prototype._setOption.apply( this, arguments );
6980
6981		switch ( key ) {
6982			case "disabled":
6983				if ( value ) {
6984					this.handles.filter( ".ui-state-focus" ).blur();
6985					this.handles.removeClass( "ui-state-hover" );
6986					this.handles.attr( "disabled", "disabled" );
6987					this.element.addClass( "ui-disabled" );
6988				} else {
6989					this.handles.removeAttr( "disabled" );
6990					this.element.removeClass( "ui-disabled" );
6991				}
6992				break;
6993			case "orientation":
6994				this._detectOrientation();
6995				this.element
6996					.removeClass( "ui-slider-horizontal ui-slider-vertical" )
6997					.addClass( "ui-slider-" + this.orientation );
6998				this._refreshValue();
6999				break;
7000			case "value":
7001				this._animateOff = true;
7002				this._refreshValue();
7003				this._change( null, 0 );
7004				this._animateOff = false;
7005				break;
7006			case "values":
7007				this._animateOff = true;
7008				this._refreshValue();
7009				for ( i = 0; i < valsLength; i += 1 ) {
7010					this._change( null, i );
7011				}
7012				this._animateOff = false;
7013				break;
7014		}
7015	},
7016
7017	//internal value getter
7018	// _value() returns value trimmed by min and max, aligned by step
7019	_value: function() {
7020		var val = this.options.value;
7021		val = this._trimAlignValue( val );
7022
7023		return val;
7024	},
7025
7026	//internal values getter
7027	// _values() returns array of values trimmed by min and max, aligned by step
7028	// _values( index ) returns single value trimmed by min and max, aligned by step
7029	_values: function( index ) {
7030		var val,
7031			vals,
7032			i;
7033
7034		if ( arguments.length ) {
7035			val = this.options.values[ index ];
7036			val = this._trimAlignValue( val );
7037
7038			return val;
7039		} else {
7040			// .slice() creates a copy of the array
7041			// this copy gets trimmed by min and max and then returned
7042			vals = this.options.values.slice();
7043			for ( i = 0; i < vals.length; i+= 1) {
7044				vals[ i ] = this._trimAlignValue( vals[ i ] );
7045			}
7046
7047			return vals;
7048		}
7049	},
7050
7051	// returns the step-aligned value that val is closest to, between (inclusive) min and max
7052	_trimAlignValue: function( val ) {
7053		if ( val < this._valueMin() ) {
7054			return this._valueMin();
7055		}
7056		if ( val > this._valueMax() ) {
7057			return this._valueMax();
7058		}
7059		var step = ( this.options.step > 0 ) ? this.options.step : 1,
7060			valModStep = val % step,
7061			alignValue = val - valModStep;
7062
7063		if ( Math.abs(valModStep) * 2 >= step ) {
7064			alignValue += ( valModStep > 0 ) ? step : ( -step );
7065		}
7066
7067		// Since JavaScript has problems with large floats, round
7068		// the final value to 5 digits after the decimal point (see #4124)
7069		return parseFloat( alignValue.toFixed(5) );
7070	},
7071
7072	_valueMin: function() {
7073		return this.options.min;
7074	},
7075
7076	_valueMax: function() {
7077		return this.options.max;
7078	},
7079
7080	_refreshValue: function() {
7081		var oRange = this.options.range,
7082			o = this.options,
7083			self = this,
7084			animate = ( !this._animateOff ) ? o.animate : false,
7085			valPercent,
7086			_set = {},
7087			lastValPercent,
7088			value,
7089			valueMin,
7090			valueMax;
7091
7092		if ( this.options.values && this.options.values.length ) {
7093			this.handles.each(function( i, j ) {
7094				valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
7095				_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
7096				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
7097				if ( self.options.range === true ) {
7098					if ( self.orientation === "horizontal" ) {
7099						if ( i === 0 ) {
7100							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
7101						}
7102						if ( i === 1 ) {
7103							self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
7104						}
7105					} else {
7106						if ( i === 0 ) {
7107							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
7108						}
7109						if ( i === 1 ) {
7110							self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
7111						}
7112					}
7113				}
7114				lastValPercent = valPercent;
7115			});
7116		} else {
7117			value = this.value();
7118			valueMin = this._valueMin();
7119			valueMax = this._valueMax();
7120			valPercent = ( valueMax !== valueMin ) ?
7121					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
7122					0;
7123			_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
7124			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
7125
7126			if ( oRange === "min" && this.orientation === "horizontal" ) {
7127				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
7128			}
7129			if ( oRange === "max" && this.orientation === "horizontal" ) {
7130				this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
7131			}
7132			if ( oRange === "min" && this.orientation === "vertical" ) {
7133				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
7134			}
7135			if ( oRange === "max" && this.orientation === "vertical" ) {
7136				this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
7137			}
7138		}
7139	}
7140
7141});
7142
7143$.extend( $.ui.slider, {
7144	version: "1.8.4"
7145});
7146
7147}(jQuery));
7148/*
7149 * jQuery UI Tabs 1.8.4
7150 *
7151 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
7152 * Dual licensed under the MIT or GPL Version 2 licenses.
7153 * http://jquery.org/license
7154 *
7155 * http://docs.jquery.com/UI/Tabs
7156 *
7157 * Depends:
7158 *	jquery.ui.core.js
7159 *	jquery.ui.widget.js
7160 */
7161(function( $, undefined ) {
7162
7163var tabId = 0,
7164	listId = 0;
7165
7166function getNextTabId() {
7167	return ++tabId;
7168}
7169
7170function getNextListId() {
7171	return ++listId;
7172}
7173
7174$.widget( "ui.tabs", {
7175	options: {
7176		add: null,
7177		ajaxOptions: null,
7178		cache: false,
7179		cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
7180		collapsible: false,
7181		disable: null,
7182		disabled: [],
7183		enable: null,
7184		event: "click",
7185		fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
7186		idPrefix: "ui-tabs-",
7187		load: null,
7188		panelTemplate: "<div></div>",
7189		remove: null,
7190		select: null,
7191		show: null,
7192		spinner: "<em>Loading&#8230;</em>",
7193		tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
7194	},
7195
7196	_create: function() {
7197		this._tabify( true );
7198	},
7199
7200	_setOption: function( key, value ) {
7201		if ( key == "selected" ) {
7202			if (this.options.collapsible && value == this.options.selected ) {
7203				return;
7204			}
7205			this.select( value );
7206		} else {
7207			this.options[ key ] = value;
7208			this._tabify();
7209		}
7210	},
7211
7212	_tabId: function( a ) {
7213		return a.title && a.title.replace( /\s/g, "_" ).replace( /[^A-Za-z0-9\-_:\.]/g, "" ) ||
7214			this.options.idPrefix + getNextTabId();
7215	},
7216
7217	_sanitizeSelector: function( hash ) {
7218		// we need this because an id may contain a ":"
7219		return hash.replace( /:/g, "\\:" );
7220	},
7221
7222	_cookie: function() {
7223		var cookie = this.cookie ||
7224			( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
7225		return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
7226	},
7227
7228	_ui: function( tab, panel ) {
7229		return {
7230			tab: tab,
7231			panel: panel,
7232			index: this.anchors.index( tab )
7233		};
7234	},
7235
7236	_cleanup: function() {
7237		// restore all former loading tabs labels
7238		this.lis.filter( ".ui-state-processing" )
7239			.removeClass( "ui-state-processing" )
7240			.find( "span:data(label.tabs)" )
7241				.each(function() {
7242					var el = $( this );
7243					el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
7244				});
7245	},
7246
7247	_tabify: function( init ) {
7248		var self = this,
7249			o = this.options,
7250			fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
7251
7252		this.list = this.element.find( "ol,ul" ).eq( 0 );
7253		this.lis = $( "li:has(a[href])", this.list );
7254		this.anchors = this.lis.map(function() {
7255			return $( "a", this )[ 0 ];
7256		});
7257		this.panels = $( [] );
7258
7259		this.anchors.each(function( i, a ) {
7260			var href = $( a ).attr( "href" );
7261			// For dynamically created HTML that contains a hash as href IE < 8 expands
7262			// such href to the full page url with hash and then misinterprets tab as ajax.
7263			// Same consideration applies for an added tab with a fragment identifier
7264			// since a[href=#fragment-identifier] does unexpectedly not match.
7265			// Thus normalize href attribute...
7266			var hrefBase = href.split( "#" )[ 0 ],
7267				baseEl;
7268			if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
7269					( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
7270				href = a.hash;
7271				a.href = href;
7272			}
7273
7274			// inline tab
7275			if ( fragmentId.test( href ) ) {
7276				self.panels = self.panels.add( self._sanitizeSelector( href ) );
7277			// remote tab
7278			// prevent loading the page itself if href is just "#"
7279			} else if ( href !== "#" ) {
7280				// required for restore on destroy
7281				$.data( a, "href.tabs", href );
7282
7283				// TODO until #3808 is fixed strip fragment identifier from url
7284				// (IE fails to load from such url)
7285				$.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
7286
7287				var id = self._tabId( a );
7288				a.href = "#" + id;
7289				var $panel = $( "#" + id );
7290				if ( !$panel.length ) {
7291					$panel = $( o.panelTemplate )
7292						.attr( "id", id )
7293						.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
7294						.insertAfter( self.panels[ i - 1 ] || self.list );
7295					$panel.data( "destroy.tabs", true );
7296				}
7297				self.panels = self.panels.add( $panel );
7298			// invalid tab href
7299			} else {
7300				o.disabled.push( i );
7301			}
7302		});
7303
7304		// initialization from scratch
7305		if ( init ) {
7306			// attach necessary classes for styling
7307			this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
7308			this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
7309			this.lis.addClass( "ui-state-default ui-corner-top" );
7310			this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
7311
7312			// Selected tab
7313			// use "selected" option or try to retrieve:
7314			// 1. from fragment identifier in url
7315			// 2. from cookie
7316			// 3. from selected class attribute on <li>
7317			if ( o.selected === undefined ) {
7318				if ( location.hash ) {
7319					this.anchors.each(function( i, a ) {
7320						if ( a.hash == location.hash ) {
7321							o.selected = i;
7322							return false;
7323						}
7324					});
7325				}
7326				if ( typeof o.selected !== "number" && o.cookie ) {
7327					o.selected = parseInt( self._cookie(), 10 );
7328				}
7329				if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
7330					o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
7331				}
7332				o.selected = o.selected || ( this.lis.length ? 0 : -1 );
7333			} else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
7334				o.selected = -1;
7335			}
7336
7337			// sanity check - default to first tab...
7338			o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
7339				? o.selected
7340				: 0;
7341
7342			// Take disabling tabs via class attribute from HTML
7343			// into account and update option properly.
7344			// A selected tab cannot become disabled.
7345			o.disabled = $.unique( o.disabled.concat(
7346				$.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
7347					return self.lis.index( n );
7348				})
7349			) ).sort();
7350
7351			if ( $.inArray( o.selected, o.disabled ) != -1 ) {
7352				o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
7353			}
7354
7355			// highlight selected tab
7356			this.panels.addClass( "ui-tabs-hide" );
7357			this.lis.removeClass( "ui-tabs-selected ui-state-active" );
7358			// check for length avoids error when initializing empty list
7359			if ( o.selected >= 0 && this.anchors.length ) {
7360				this.panels.eq( o.selected ).removeClass( "ui-tabs-hide" );
7361				this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
7362
7363				// seems to be expected behavior that the show callback is fired
7364				self.element.queue( "tabs", function() {
7365					self._trigger( "show", null,
7366						self._ui( self.anchors[ o.selected ], self.panels[ o.selected ] ) );
7367				});
7368
7369				this.load( o.selected );
7370			}
7371
7372			// clean up to avoid memory leaks in certain versions of IE 6
7373			// TODO: namespace this event
7374			$( window ).bind( "unload", function() {
7375				self.lis.add( self.anchors ).unbind( ".tabs" );
7376				self.lis = self.anchors = self.panels = null;
7377			});
7378		// update selected after add/remove
7379		} else {
7380			o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
7381		}
7382
7383		// update collapsible
7384		// TODO: use .toggleClass()
7385		this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
7386
7387		// set or update cookie after init and add/remove respectively
7388		if ( o.cookie ) {
7389			this._cookie( o.selected, o.cookie );
7390		}
7391
7392		// disable tabs
7393		for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
7394			$( li )[ $.inArray( i, o.disabled ) != -1 &&
7395				// TODO: use .toggleClass()
7396				!$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
7397		}
7398
7399		// reset cache if switching from cached to not cached
7400		if ( o.cache === false ) {
7401			this.anchors.removeData( "cache.tabs" );
7402		}
7403
7404		// remove all handlers before, tabify may run on existing tabs after add or option change
7405		this.lis.add( this.anchors ).unbind( ".tabs" );
7406
7407		if ( o.event !== "mouseover" ) {
7408			var addState = function( state, el ) {
7409				if ( el.is( ":not(.ui-state-disabled)" ) ) {
7410					el.addClass( "ui-state-" + state );
7411				}
7412			};
7413			var removeState = function( state, el ) {
7414				el.removeClass( "ui-state-" + state );
7415			};
7416			this.lis.bind( "mouseover.tabs" , function() {
7417				addState( "hover", $( this ) );
7418			});
7419			this.lis.bind( "mouseout.tabs", function() {
7420				removeState( "hover", $( this ) );
7421			});
7422			this.anchors.bind( "focus.tabs", function() {
7423				addState( "focus", $( this ).closest( "li" ) );
7424			});
7425			this.anchors.bind( "blur.tabs", function() {
7426				removeState( "focus", $( this ).closest( "li" ) );
7427			});
7428		}
7429
7430		// set up animations
7431		var hideFx, showFx;
7432		if ( o.fx ) {
7433			if ( $.isArray( o.fx ) ) {
7434				hideFx = o.fx[ 0 ];
7435				showFx = o.fx[ 1 ];
7436			} else {
7437				hideFx = showFx = o.fx;
7438			}
7439		}
7440
7441		// Reset certain styles left over from animation
7442		// and prevent IE's ClearType bug...
7443		function resetStyle( $el, fx ) {
7444			$el.css( "display", "" );
7445			if ( !$.support.opacity && fx.opacity ) {
7446				$el[ 0 ].style.removeAttribute( "filter" );
7447			}
7448		}
7449
7450		// Show a tab...
7451		var showTab = showFx
7452			? function( clicked, $show ) {
7453				$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
7454				$show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
7455					.animate( showFx, showFx.duration || "normal", function() {
7456						resetStyle( $show, showFx );
7457						self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
7458					});
7459			}
7460			: function( clicked, $show ) {
7461				$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
7462				$show.removeClass( "ui-tabs-hide" );
7463				self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
7464			};
7465
7466		// Hide a tab, $show is optional...
7467		var hideTab = hideFx
7468			? function( clicked, $hide ) {
7469				$hide.animate( hideFx, hideFx.duration || "normal", function() {
7470					self.lis.removeClass( "ui-tabs-selected ui-state-active" );
7471					$hide.addClass( "ui-tabs-hide" );
7472					resetStyle( $hide, hideFx );
7473					self.element.dequeue( "tabs" );
7474				});
7475			}
7476			: function( clicked, $hide, $show ) {
7477				self.lis.removeClass( "ui-tabs-selected ui-state-active" );
7478				$hide.addClass( "ui-tabs-hide" );
7479				self.element.dequeue( "tabs" );
7480			};
7481
7482		// attach tab event handler, unbind to avoid duplicates from former tabifying...
7483		this.anchors.bind( o.event + ".tabs", function() {
7484			var el = this,
7485				$li = $(el).closest( "li" ),
7486				$hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
7487				$show = $( self._sanitizeSelector( el.hash ) );
7488
7489			// If tab is already selected and not collapsible or tab disabled or
7490			// or is already loading or click callback returns false stop here.
7491			// Check if click handler returns false last so that it is not executed
7492			// for a disabled or loading tab!
7493			if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
7494				$li.hasClass( "ui-state-disabled" ) ||
7495				$li.hasClass( "ui-state-processing" ) ||
7496				self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
7497				this.blur();
7498				return false;
7499			}
7500
7501			o.selected = self.anchors.index( this );
7502
7503			self.abort();
7504
7505			// if tab may be closed
7506			if ( o.collapsible ) {
7507				if ( $li.hasClass( "ui-tabs-selected" ) ) {
7508					o.selected = -1;
7509
7510					if ( o.cookie ) {
7511						self._cookie( o.selected, o.cookie );
7512					}
7513
7514					self.element.queue( "tabs", function() {
7515						hideTab( el, $hide );
7516					}).dequeue( "tabs" );
7517
7518					this.blur();
7519					return false;
7520				} else if ( !$hide.length ) {
7521					if ( o.cookie ) {
7522						self._cookie( o.selected, o.cookie );
7523					}
7524
7525					self.element.queue( "tabs", function() {
7526						showTab( el, $show );
7527					});
7528
7529					// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
7530					self.load( self.anchors.index( this ) );
7531
7532					this.blur();
7533					return false;
7534				}
7535			}
7536
7537			if ( o.cookie ) {
7538				self._cookie( o.selected, o.cookie );
7539			}
7540
7541			// show new tab
7542			if ( $show.length ) {
7543				if ( $hide.length ) {
7544					self.element.queue( "tabs", function() {
7545						hideTab( el, $hide );
7546					});
7547				}
7548				self.element.queue( "tabs", function() {
7549					showTab( el, $show );
7550				});
7551
7552				self.load( self.anchors.index( this ) );
7553			} else {
7554				throw "jQuery UI Tabs: Mismatching fragment identifier.";
7555			}
7556
7557			// Prevent IE from keeping other link focussed when using the back button
7558			// and remove dotted border from clicked link. This is controlled via CSS
7559			// in modern browsers; blur() removes focus from address bar in Firefox
7560			// which can become a usability and annoying problem with tabs('rotate').
7561			if ( $.browser.msie ) {
7562				this.blur();
7563			}
7564		});
7565
7566		// disable click in any case
7567		this.anchors.bind( "click.tabs", function(){
7568			return false;
7569		});
7570	},
7571
7572    _getIndex: function( index ) {
7573		// meta-function to give users option to provide a href string instead of a numerical index.
7574		// also sanitizes numerical indexes to valid values.
7575		if ( typeof index == "string" ) {
7576			index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
7577		}
7578
7579		return index;
7580	},
7581
7582	destroy: function() {
7583		var o = this.options;
7584
7585		this.abort();
7586
7587		this.element
7588			.unbind( ".tabs" )
7589			.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
7590			.removeData( "tabs" );
7591
7592		this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
7593
7594		this.anchors.each(function() {
7595			var href = $.data( this, "href.tabs" );
7596			if ( href ) {
7597				this.href = href;
7598			}
7599			var $this = $( this ).unbind( ".tabs" );
7600			$.each( [ "href", "load", "cache" ], function( i, prefix ) {
7601				$this.removeData( prefix + ".tabs" );
7602			});
7603		});
7604
7605		this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
7606			if ( $.data( this, "destroy.tabs" ) ) {
7607				$( this ).remove();
7608			} else {
7609				$( this ).removeClass([
7610					"ui-state-default",
7611					"ui-corner-top",
7612					"ui-tabs-selected",
7613					"ui-state-active",
7614					"ui-state-hover",
7615					"ui-state-focus",
7616					"ui-state-disabled",
7617					"ui-tabs-panel",
7618					"ui-widget-content",
7619					"ui-corner-bottom",
7620					"ui-tabs-hide"
7621				].join( " " ) );
7622			}
7623		});
7624
7625		if ( o.cookie ) {
7626			this._cookie( null, o.cookie );
7627		}
7628
7629		return this;
7630	},
7631
7632	add: function( url, label, index ) {
7633		if ( index === undefined ) {
7634			index = this.anchors.length;
7635		}
7636
7637		var self = this,
7638			o = this.options,
7639			$li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
7640			id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
7641
7642		$li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
7643
7644		// try to find an existing element before creating a new one
7645		var $panel = $( "#" + id );
7646		if ( !$panel.length ) {
7647			$panel = $( o.panelTemplate )
7648				.attr( "id", id )
7649				.data( "destroy.tabs", true );
7650		}
7651		$panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
7652
7653		if ( index >= this.lis.length ) {
7654			$li.appendTo( this.list );
7655			$panel.appendTo( this.list[ 0 ].parentNode );
7656		} else {
7657			$li.insertBefore( this.lis[ index ] );
7658			$panel.insertBefore( this.panels[ index ] );
7659		}
7660
7661		o.disabled = $.map( o.disabled, function( n, i ) {
7662			return n >= index ? ++n : n;
7663		});
7664
7665		this._tabify();
7666
7667		if ( this.anchors.length == 1 ) {
7668			o.selected = 0;
7669			$li.addClass( "ui-tabs-selected ui-state-active" );
7670			$panel.removeClass( "ui-tabs-hide" );
7671			this.element.queue( "tabs", function() {
7672				self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
7673			});
7674
7675			this.load( 0 );
7676		}
7677
7678		this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
7679		return this;
7680	},
7681
7682	remove: function( index ) {
7683		index = this._getIndex( index );
7684		var o = this.options,
7685			$li = this.lis.eq( index ).remove(),
7686			$panel = this.panels.eq( index ).remove();
7687
7688		// If selected tab was removed focus tab to the right or
7689		// in case the last tab was removed the tab to the left.
7690		if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
7691			this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
7692		}
7693
7694		o.disabled = $.map(
7695			$.grep( o.disabled, function(n, i) {
7696				return n != index;
7697			}),
7698			function( n, i ) {
7699				return n >= index ? --n : n;
7700			});
7701
7702		this._tabify();
7703
7704		this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
7705		return this;
7706	},
7707
7708	enable: function( index ) {
7709		index = this._getIndex( index );
7710		var o = this.options;
7711		if ( $.inArray( index, o.disabled ) == -1 ) {
7712			return;
7713		}
7714
7715		this.lis.eq( index ).removeClass( "ui-state-disabled" );
7716		o.disabled = $.grep( o.disabled, function( n, i ) {
7717			return n != index;
7718		});
7719
7720		this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
7721		return this;
7722	},
7723
7724	disable: function( index ) {
7725		index = this._getIndex( index );
7726		var self = this, o = this.options;
7727		// cannot disable already selected tab
7728		if ( index != o.selected ) {
7729			this.lis.eq( index ).addClass( "ui-state-disabled" );
7730
7731			o.disabled.push( index );
7732			o.disabled.sort();
7733
7734			this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
7735		}
7736
7737		return this;
7738	},
7739
7740	select: function( index ) {
7741		index = this._getIndex( index );
7742		if ( index == -1 ) {
7743			if ( this.options.collapsible && this.options.selected != -1 ) {
7744				index = this.options.selected;
7745			} else {
7746				return this;
7747			}
7748		}
7749		this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
7750		return this;
7751	},
7752
7753	load: function( index ) {
7754		index = this._getIndex( index );
7755		var self = this,
7756			o = this.options,
7757			a = this.anchors.eq( index )[ 0 ],
7758			url = $.data( a, "load.tabs" );
7759
7760		this.abort();
7761
7762		// not remote or from cache
7763		if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
7764			this.element.dequeue( "tabs" );
7765			return;
7766		}
7767
7768		// load remote from here on
7769		this.lis.eq( index ).addClass( "ui-state-processing" );
7770
7771		if ( o.spinner ) {
7772			var span = $( "span", a );
7773			span.data( "label.tabs", span.html() ).html( o.spinner );
7774		}
7775
7776		this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
7777			url: url,
7778			success: function( r, s ) {
7779				$( self._sanitizeSelector( a.hash ) ).html( r );
7780
7781				// take care of tab labels
7782				self._cleanup();
7783
7784				if ( o.cache ) {
7785					$.data( a, "cache.tabs", true );
7786				}
7787
7788				self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
7789				try {
7790					o.ajaxOptions.success( r, s );
7791				}
7792				catch ( e ) {}
7793			},
7794			error: function( xhr, s, e ) {
7795				// take care of tab labels
7796				self._cleanup();
7797
7798				self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
7799				try {
7800					// Passing index avoid a race condition when this method is
7801					// called after the user has selected another tab.
7802					// Pass the anchor that initiated this request allows
7803					// loadError to manipulate the tab content panel via $(a.hash)
7804					o.ajaxOptions.error( xhr, s, index, a );
7805				}
7806				catch ( e ) {}
7807			}
7808		} ) );
7809
7810		// last, so that load event is fired before show...
7811		self.element.dequeue( "tabs" );
7812
7813		return this;
7814	},
7815
7816	abort: function() {
7817		// stop possibly running animations
7818		this.element.queue( [] );
7819		this.panels.stop( false, true );
7820
7821		// "tabs" queue must not contain more than two elements,
7822		// which are the callbacks for the latest clicked tab...
7823		this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
7824
7825		// terminate pending requests from other tabs
7826		if ( this.xhr ) {
7827			this.xhr.abort();
7828			delete this.xhr;
7829		}
7830
7831		// take care of tab labels
7832		this._cleanup();
7833		return this;
7834	},
7835
7836	url: function( index, url ) {
7837		this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
7838		return this;
7839	},
7840
7841	length: function() {
7842		return this.anchors.length;
7843	}
7844});
7845
7846$.extend( $.ui.tabs, {
7847	version: "1.8.4"
7848});
7849
7850/*
7851 * Tabs Extensions
7852 */
7853
7854/*
7855 * Rotate
7856 */
7857$.extend( $.ui.tabs.prototype, {
7858	rotation: null,
7859	rotate: function( ms, continuing ) {
7860		var self = this,
7861			o = this.options;
7862
7863		var rotate = self._rotate || ( self._rotate = function( e ) {
7864			clearTimeout( self.rotation );
7865			self.rotation = setTimeout(function() {
7866				var t = o.selected;
7867				self.select( ++t < self.anchors.length ? t : 0 );
7868			}, ms );
7869
7870			if ( e ) {
7871				e.stopPropagation();
7872			}
7873		});
7874
7875		var stop = self._unrotate || ( self._unrotate = !continuing
7876			? function(e) {
7877				if (e.clientX) { // in case of a true click
7878					self.rotate(null);
7879				}
7880			}
7881			: function( e ) {
7882				t = o.selected;
7883				rotate();
7884			});
7885
7886		// start rotation
7887		if ( ms ) {
7888			this.element.bind( "tabsshow", rotate );
7889			this.anchors.bind( o.event + ".tabs", stop );
7890			rotate();
7891		// stop rotation
7892		} else {
7893			clearTimeout( self.rotation );
7894			this.element.unbind( "tabsshow", rotate );
7895			this.anchors.unbind( o.event + ".tabs", stop );
7896			delete this._rotate;
7897			delete this._unrotate;
7898		}
7899
7900		return this;
7901	}
7902});
7903
7904})( jQuery );
7905/*
7906 * jQuery UI Datepicker 1.8.4
7907 *
7908 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
7909 * Dual licensed under the MIT or GPL Version 2 licenses.
7910 * http://jquery.org/license
7911 *
7912 * http://docs.jquery.com/UI/Datepicker
7913 *
7914 * Depends:
7915 *	jquery.ui.core.js
7916 */
7917(function( $, undefined ) {
7918
7919$.extend($.ui, { datepicker: { version: "1.8.4" } });
7920
7921var PROP_NAME = 'datepicker';
7922var dpuuid = new Date().getTime();
7923
7924/* Date picker manager.
7925   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
7926   Settings for (groups of) date pickers are maintained in an instance object,
7927   allowing multiple different settings on the same page. */
7928
7929function Datepicker() {
7930	this.debug = false; // Change this to true to start debugging
7931	this._curInst = null; // The current instance in use
7932	this._keyEvent = false; // If the last event was a key event
7933	this._disabledInputs = []; // List of date picker inputs that have been disabled
7934	this._datepickerShowing = false; // True if the popup picker is showing , false if not
7935	this._inDialog = false; // True if showing within a "dialog", false if not
7936	this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
7937	this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
7938	this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
7939	this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
7940	this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
7941	this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
7942	this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
7943	this._currentClass = 't'; // The name of the current day marker class
7944	this._dayOverClass = 't'; // The name of the day hover marker class
7945	this.regional = []; // Available regional settings, indexed by language code
7946	this.regional[''] = { // Default regional settings
7947		closeText: 'Done', // Display text for close link
7948		prevText: 'Prev', // Display text for previous month link
7949		nextText: 'Next', // Display text for next month link
7950		currentText: 'Today', // Display text for current month link
7951		monthNames: ['January','February','March','April','May','June',
7952			'July','August','September','October','November','December'], // Names of months for drop-down and formatting
7953		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
7954		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
7955		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
7956		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
7957		weekHeader: 'Wk', // Column header for week of the year
7958		dateFormat: 'mm/dd/yy', // See format options on parseDate
7959		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
7960		isRTL: false, // True if right-to-left language, false if left-to-right
7961		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
7962		yearSuffix: '' // Additional text to append to the year in the month headers
7963	};
7964	this._defaults = { // Global defaults for all the date picker instances
7965		showOn: 'focus', // 'focus' for popup on focus,
7966			// 'button' for trigger button, or 'both' for either
7967		showAnim: 'fadeIn', // Name of jQuery animation for popup
7968		showOptions: {}, // Options for enhanced animations
7969		defaultDate: null, // Used when field is blank: actual date,
7970			// +/-number for offset from today, null for today
7971		appendText: '', // Display text following the input box, e.g. showing the format
7972		buttonText: '...', // Text for trigger button
7973		buttonImage: '', // URL for trigger button image
7974		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
7975		hideIfNoPrevNext: false, // True to hide next/previous month links
7976			// if not applicable, false to just disable them
7977		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
7978		gotoCurrent: false, // True if today link goes back to current selection instead
7979		changeMonth: false, // True if month can be selected directly, false if only prev/next
7980		changeYear: false, // True if year can be selected directly, false if only prev/next
7981		yearRange: 'c-10:c+10', // Range of years to display in drop-down,
7982			// either relative to today's year (-nn:+nn), relative to currently displayed year
7983			// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
7984		showOtherMonths: false, // True to show dates in other months, false to leave blank
7985		selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
7986		showWeek: false, // True to show week of the year, false to not show it
7987		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
7988			// takes a Date and returns the number of the week for it
7989		shortYearCutoff: '+10', // Short year values < this are in the current century,
7990			// > this are in the previous century,
7991			// string value starting with '+' for current year + value
7992		minDate: null, // The earliest selectable date, or null for no limit
7993		maxDate: null, // The latest selectable date, or null for no limit
7994		duration: 'fast', // Duration of display/closure
7995		beforeShowDay: null, // Function that takes a date and returns an array with
7996			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
7997			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
7998		beforeShow: null, // Function that takes an input field and
7999			// returns a set of custom settings for the date picker
8000		onSelect: null, // Define a callback function when a date is selected
8001		onChangeMonthYear: null, // Define a callback function when the month or year is changed
8002		onClose: null, // Define a callback function when the datepicker is closed
8003		numberOfMonths: 1, // Number of months to show at a time
8004		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
8005		stepMonths: 1, // Number of months to step back/forward
8006		stepBigMonths: 12, // Number of months to step back/forward for the big links
8007		altField: '', // Selector for an alternate field to store selected dates into
8008		altFormat: '', // The date format to use for the alternate field
8009		constrainInput: true, // The input is constrained by the current date format
8010		showButtonPanel: false, // True to show button panel, false to not show it
8011		autoSize: false // True to size the input for the date format, false to leave as is
8012	};
8013	$.extend(this._defaults, this.regional['']);
vendor: 4,935 bytes, lines 8014-8133
8014	this.dpDiv = $('<div id="' + this._mainDivId + '" class="calendar" style="display:none;"></div>');
8015//	this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
8016}
8017
8018$.extend(Datepicker.prototype, {
8019	/* Class name added to elements to indicate already configured with a date picker. */
8020	markerClassName: 'hasDatepicker',
8021
8022	/* Debug logging (if enabled). */
8023	log: function () {
8024		if (this.debug)
8025			console.log.apply('', arguments);
8026	},
8027
8028	// TODO rename to "widget" when switching to widget factory
8029	_widgetDatepicker: function() {
8030		return this.dpDiv;
8031	},
8032
8033	/* Override the default settings for all instances of the date picker.
8034	   @param  settings  object - the new settings to use as defaults (anonymous object)
8035	   @return the manager object */
8036	setDefaults: function(settings) {
8037		extendRemove(this._defaults, settings || {});
8038		return this;
8039	},
8040
8041	/* Attach the date picker to a jQuery selection.
8042	   @param  target    element - the target input field or division or span
8043	   @param  settings  object - the new settings to use for this date picker instance (anonymous) */
8044	_attachDatepicker: function(target, settings) {
8045		// check for settings on the control itself - in namespace 'date:'
8046		var inlineSettings = null;
8047		for (var attrName in this._defaults) {
8048			var attrValue = target.getAttribute('date:' + attrName);
8049			if (attrValue) {
8050				inlineSettings = inlineSettings || {};
8051				try {
8052					inlineSettings[attrName] = eval(attrValue);
8053				} catch (err) {
8054					inlineSettings[attrName] = attrValue;
8055				}
8056			}
8057		}
8058		var nodeName = target.nodeName.toLowerCase();
8059		var inline = (nodeName == 'div' || nodeName == 'span');
8060		if (!target.id) {
8061			this.uuid += 1;
8062			target.id = 'dp' + this.uuid;
8063		}
8064		var inst = this._newInst($(target), inline);
8065		inst.settings = $.extend({}, settings || {}, inlineSettings || {});
8066		if (nodeName == 'input') {
8067			this._connectDatepicker(target, inst);
8068		} else if (inline) {
8069			this._inlineDatepicker(target, inst);
8070		}
8071	},
8072
8073	/* Create a new instance object. */
8074	_newInst: function(target, inline) {
8075		var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
8076		return {id: id, input: target, // associated target
8077			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
8078			drawMonth: 0, drawYear: 0, // month being drawn
8079			inline: inline, // is datepicker inline or not
8080			dpDiv: (!inline ? this.dpDiv : // presentation div
8081			$('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
8082	},
8083
8084	/* Attach the date picker to an input field. */
8085	_connectDatepicker: function(target, inst) {
8086		var input = $(target);
8087		inst.append = $([]);
8088		inst.trigger = $([]);
8089		if (input.hasClass(this.markerClassName))
8090			return;
8091		this._attachments(input, inst);
8092		input.addClass(this.markerClassName).keydown(this._doKeyDown).
8093			keypress(this._doKeyPress).keyup(this._doKeyUp).
8094			bind("setData.datepicker", function(event, key, value) {
8095				inst.settings[key] = value;
8096			}).bind("getData.datepicker", function(event, key) {
8097				return this._get(inst, key);
8098			});
8099		this._autoSize(inst);
8100		$.data(target, PROP_NAME, inst);
8101	},
8102
8103	/* Make attachments based on settings. */
8104	_attachments: function(input, inst) {
8105		var appendText = this._get(inst, 'appendText');
8106		var isRTL = this._get(inst, 'isRTL');
8107		if (inst.append)
8108			inst.append.remove();
8109//		if (appendText) {
8110//			inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
8111//			input[isRTL ? 'before' : 'after'](inst.append);
8112//		}
8113		input.unbind('focus', this._showDatepicker);
8114		if (inst.trigger)
8115			inst.trigger.remove();
8116		var showOn = this._get(inst, 'showOn');
8117		if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
8118			input.focus(this._showDatepicker);
8119		if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
8120			var buttonText = this._get(inst, 'buttonText');
8121			var buttonImage = this._get(inst, 'buttonImage');
8122			inst.trigger = $('<button type="button"></button>').html($('<img/>').attr(
8123					{ src:buttonImage, alt:buttonText, title:buttonText }));
8124
8125//			inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
8126//				$('<img/>').addClass(this._triggerClass).
8127//					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
8128//				$('<button type="button"></button>').addClass(this._triggerClass).
8129//					html(buttonImage == '' ? buttonText : $('<img/>').attr(
8130//					{ src:buttonImage, alt:buttonText, title:buttonText })));
8131			input[isRTL ? 'before' : 'after'](inst.trigger);
8132			inst.trigger.click(function() {
8133				if ($.datepicker._datepickerShowing && $.datepicker._lastInput == 
8133input[0])
8134					$.datepicker._hideDatepicker();
8135				else
8136					$.datepicker._showDatepicker(input[0]);
8137
8138				return false;
8139			});
8140		}
8141	},
8142
8143	/* Apply the maximum length for the date format. */
8144	_autoSize: function(inst) {
8145		if (this._get(inst, 'autoSize') && !inst.inline) {
8146			var date = new Date(2009, 12 - 1, 20); // Ensure double digits
8147			var dateFormat = this._get(inst, 'dateFormat');
8148			if (dateFormat.match(/[DM]/)) {
8149				var findMax = function(names) {
8150					var max = 0;
8151					var maxI = 0;
8152					for (var i = 0; i < names.length; i++) {
8153						if (names[i].length > max) {
8154							max = names[i].length;
8155							maxI = i;
8156						}
8157					}
8158					return maxI;
8159				};
8160				date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
8161					'monthNames' : 'monthNamesShort'))));
8162				date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
8163					'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
8164			}
8165			inst.input.attr('size', this._formatDate(inst, date).length);
8166		}
8167	},
8168
8169	/* Attach an inline date picker to a div. */
8170	_inlineDatepicker: function(target, inst) {
8171		var divSpan = $(target);
8172		if (divSpan.hasClass(this.markerClassName))
8173			return;
8174		divSpan.addClass(this.markerClassName).append(inst.dpDiv).
8175			bind("setData.datepicker", function(event, key, value){
8176				inst.settings[key] = value;
8177			}).bind("getData.datepicker", function(event, key){
8178				return this._get(inst, key);
8179			});
8180		$.data(target, PROP_NAME, inst);
8181		this._setDate(inst, this._getDefaultDate(inst), true);
8182		this._updateDatepicker(inst);
8183		this._updateAlternate(inst);
8184	},
8185
8186	/* Pop-up the date picker in a "dialog" box.
8187	   @param  input     element - ignored
8188	   @param  date      string or Date - the initial date to display
8189	   @param  onSelect  function - the function to call when a date is selected
8190	   @param  settings  object - update the dialog date picker instance's settings (anonymous object)
8191	   @param  pos       int[2] - coordinates for the dialog's position within the screen or
8192	                     event - with x/y coordinates or
8193	                     leave empty for default (screen centre)
8194	   @return the manager object */
8195	_dialogDatepicker: function(input, date, onSelect, settings, pos) {
8196		var inst = this._dialogInst; // internal instance
8197		if (!inst) {
8198			this.uuid += 1;
8199			var id = 'dp' + this.uuid;
8200			this._dialogInput = $('<input type="text" id="' + id +
8201				'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
8202			this._dialogInput.keydown(this._doKeyDown);
8203			$('body').append(this._dialogInput);
8204			inst = this._dialogInst = this._newInst(this._dialogInput, false);
8205			inst.settings = {};
8206			$.data(this._dialogInput[0], PROP_NAME, inst);
8207		}
8208		extendRemove(inst.settings, settings || {});
8209		date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
8210		this._dialogInput.val(date);
8211
8212		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
8213		if (!this._pos) {
8214			var browserWidth = document.documentElement.clientWidth;
8215			var browserHeight = document.documentElement.clientHeight;
8216			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
8217			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
8218			this._pos = // should use actual width/height below
8219				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
8220		}
8221
8222		// move input on screen for focus, but hidden behind dialog
8223		this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
8224		inst.settings.onSelect = onSelect;
8225		this._inDialog = true;
8226		this.dpDiv.addClass(this._dialogClass);
8227		this._showDatepicker(this._dialogInput[0]);
8228		if ($.blockUI)
8229			$.blockUI(this.dpDiv);
8230		$.data(this._dialogInput[0], PROP_NAME, inst);
8231		return this;
8232	},
8233
8234	/* Detach a datepicker from its control.
8235	   @param  target    element - the target input field or division or span */
8236	_destroyDatepicker: function(target) {
8237		var $target = $(target);
8238		var inst = $.data(target, PROP_NAME);
8239		if (!$target.hasClass(this.markerClassName)) {
8240			return;
8241		}
8242		var nodeName = target.nodeName.toLowerCase();
8243		$.removeData(target, PROP_NAME);
8244		if (nodeName == 'input') {
8245			inst.append.remove();
8246			inst.trigger.remove();
8247			$target.removeClass(this.markerClassName).
8248				unbind('focus', this._showDatepicker).
8249				unbind('keydown', this._doKeyDown).
8250				unbind('keypress', this._doKeyPress).
8251				unbind('keyup', this._doKeyUp);
8252		} else if (nodeName == 'div' || nodeName == 'span')
8253			$target.removeClass(this.markerClassName).empty();
8254	},
8255
8256	/* Enable the date picker to a jQuery selection.
8257	   @param  target    element - the target input field or division or span */
8258	_enableDatepicker: function(target) {
8259		var $target = $(target);
8260		var inst = $.data(target, PROP_NAME);
8261		if (!$target.hasClass(this.markerClassName)) {
8262			return;
8263		}
8264		var nodeName = target.nodeName.toLowerCase();
8265		if (nodeName == 'input') {
8266			target.disabled = false;
8267			inst.trigger.filter('button').
8268				each(function() { this.disabled = false; }).end().
8269				filter('img').css({opacity: '1.0', cursor: ''});
8270		}
8271		else if (nodeName == 'div' || nodeName == 'span') {
8272			var inline = $target.children('.' + this._inlineClass);
8273			inline.children().removeClass('ui-state-disabled');
8274		}
8275		this._disabledInputs = $.map(this._disabledInputs,
8276			function(value) { return (value == target ? null : value); }); // delete entry
8277	},
8278
8279	/* Disable the date picker to a jQuery selection.
8280	   @param  target    element - the target input field or division or span */
8281	_disableDatepicker: function(target) {
8282		var $target = $(target);
8283		var inst = $.data(target, PROP_NAME);
8284		if (!$target.hasClass(this.markerClassName)) {
8285			return;
8286		}
8287		var nodeName = target.nodeName.toLowerCase();
8288		if (nodeName == 'input') {
8289			target.disabled = true;
8290			inst.trigger.filter('button').
8291				each(function() { this.disabled = true; }).end().
8292				filter('img').css({opacity: '0.5', cursor: 'default'});
8293		}
8294		else if (nodeName == 'div' || nodeName == 'span') {
8295			var inline = $target.children('.' + this._inlineClass);
8296			inline.children().addClass('ui-state-disabled');
8297		}
8298		this._disabledInputs = $.map(this._disabledInputs,
8299			function(value) { return (value == target ? null : value); }); // delete entry
8300		this._disabledInputs[this._disabledInputs.length] = target;
8301	},
8302
8303	/* Is the first field in a jQuery collection disabled as a datepicker?
8304	   @param  target    element - the target input field or division or span
8305	   @return boolean - true if disabled, false if enabled */
8306	_isDisabledDatepicker: function(target) {
8307		if (!target) {
8308			return false;
8309		}
8310		for (var i = 0; i < this._disabledInputs.length; i++) {
8311			if (this._disabledInputs[i] == target)
8312				return true;
8313		}
8314		return false;
8315	},
8316
8317	/* Retrieve the instance data for the target control.
8318	   @param  target  element - the target input field or division or span
8319	   @return  object - the associated instance data
8320	   @throws  error if a jQuery problem getting data */
8321	_getInst: function(target) {
8322		try {
8323			return $.data(target, PROP_NAME);
8324		}
8325		catch (err) {
8326			throw 'Missing instance data for this datepicker';
8327		}
8328	},
8329
8330	/* Update or retrieve the settings for a date picker attached to an input field or division.
8331	   @param  target  element - the target input field or division or span
8332	   @param  name    object - the new settings to update or
8333	                   string - the name of the setting to change or retrieve,
8334	                   when retrieving also 'all' for all instance settings or
8335	                   'defaults' for all global defaults
8336	   @param  value   any - the new value for the setting
8337	                   (omit if above is an object or to retrieve a value) */
8338	_optionDatepicker: function(target, name, value) {
8339		var inst = this._getInst(target);
8340		if (arguments.length == 2 && typeof name == 'string') {
8341			return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
8342				(inst ? (name == 'all' ? $.extend({}, inst.settings) :
8343				this._get(inst, name)) : null));
8344		}
8345		var settings = name || {};
8346		if (typeof name == 'string') {
8347			settings = {};
8348			settings[name] = value;
8349		}
8350		if (inst) {
8351			if (this._curInst == inst) {
8352				this._hideDatepicker();
8353			}
8354			var date = this._getDateDatepicker(target, true);
8355			extendRemove(inst.settings, settings);
8356			this._attachments($(target), inst);
8357			this._autoSize(inst);
8358			this._setDateDatepicker(target, date);
8359			this._updateDatepicker(inst);
8360		}
8361	},
8362
8363	// change method deprecated
8364	_changeDatepicker: function(target, name, value) {
8365		this._optionDatepicker(target, name, value);
8366	},
8367
8368	/* Redraw the date picker attached to an input field or division.
8369	   @param  target  element - the target input field or division or span */
8370	_refreshDatepicker: function(target) {
8371		var inst = this._getInst(target);
8372		if (inst) {
8373			this._updateDatepicker(inst);
8374		}
8375	},
8376
8377	/* Set the dates for a jQuery selection.
8378	   @param  target   element - the target input field or division or span
8379	   @param  date     Date - the new date */
8380	_setDateDatepicker: function(target, date) {
8381		var inst = this._getInst(target);
8382		if (inst) {
8383			this._setDate(inst, date);
8384			this._updateDatepicker(inst);
8385			this._updateAlternate(inst);
8386		}
8387	},
8388
8389	/* Get the date(s) for the first entry in a jQuery selection.
8390	   @param  target     element - the target input field or division or span
8391	   @param  noDefault  boolean - true if no default date is to be used
8392	   @return Date - the current date */
8393	_getDateDatepicker: function(target, noDefault) {
8394		var inst = this._getInst(target);
8395		if (inst && !inst.inline)
8396			this._setDateFromField(inst, noDefault);
8397		return (inst ? this._getDate(inst) : null);
8398	},
8399
8400	/* Handle keystrokes. */
8401	_doKeyDown: function(event) {
8402		var inst = $.datepicker._getInst(event.target);
8403		var handled = true;
8404		var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
8405		inst._keyEvent = true;
8406		if ($.datepicker._datepickerShowing)
8407			switch (event.keyCode) {
8408				case 9: $.datepicker._hideDatepicker();
8409						handled = false;
8410						break; // hide on tab out
8411				case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
8412							add($('td.' + $.datepicker._currentClass, inst.dpDiv));
8413						if (sel[0])
8414							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, inst.selectedDay);
8415						else
8416							$.datepicker._hideDatepicker();
8417						return false; // don't submit the form
8418						break; // select the value on enter
8419				case 27: $.datepicker._hideDatepicker();
8420						break; // hide on escape
8421				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8422							-$.datepicker._get(inst, 'stepBigMonths') :
8423							-$.datepicker._get(inst, 'stepMonths')), 'M');
8424						break; // previous month/year on page up/+ ctrl
8425				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8426							+$.datepicker._get(inst, 'stepBigMonths') :
8427							+$.datepicker._get(inst, 'stepMonths')), 'M');
8428						break; // next month/year on page down/+ ctrl
8429				case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
8430						handled = event.ctrlKey || event.metaKey;
8431						break; // clear on ctrl or command +end
8432				case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
8433						handled = event.ctrlKey || event.metaKey;
8434						break; // current on ctrl or command +home
8435				case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
8436						handled = event.ctrlKey || event.metaKey;
8437						// -1 day on ctrl or command +left
8438						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8439									-$.datepicker._get(inst, 'stepBigMonths') :
8440									-$.datepicker._get(inst, 'stepMonths')), 'M');
8441						// next month/year on alt +left on Mac
8442						break;
8443				case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
8444						handled = event.ctrlKey || event.metaKey;
8445						break; // -1 week on ctrl or command +up
8446				case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
8447						handled = event.ctrlKey || event.metaKey;
8448						// +1 day on ctrl or command +right
8449						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8450									+$.datepicker._get(inst, 'stepBigMonths') :
8451									+$.datepicker._get(inst, 'stepMonths')), 'M');
8452						// next month/year on alt +right
8453						break;
8454				case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
8455						handled = event.ctrlKey || event.metaKey;
8456						break; // +1 week on ctrl or command +down
8457				default: handled = false;
8458			}
8459		else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
8460			$.datepicker._showDatepicker(this);
8461		else {
8462			handled = false;
8463		}
8464		if (handled) {
8465			event.preventDefault();
8466			event.stopPropagation();
8467		}
8468	},
8469
8470	/* Filter entered characters - based on date format. */
8471	_doKeyPress: function(event) {
8472		var inst = $.datepicker._getInst(event.target);
8473		if ($.datepicker._get(inst, 'constrainInput')) {
8474			var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
8475			var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
8476			return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
8477		}
8478	},
8479
8480	/* Synchronise manual entry and field/alternate field. */
8481	_doKeyUp: function(event) {
8482		var inst = $.datepicker._getInst(event.target);
8483		if (inst.input.val() != inst.lastVal) {
8484			try {
8485				var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
8486					(inst.input ? inst.input.val() : null),
8487					$.datepicker._getFormatConfig(inst));
8488				if (date) { // only if valid
8489					$.datepicker._setDateFromField(inst);
8490					$.datepicker._updateAlternate(inst);
8491					$.datepicker._updateDatepicker(inst);
8492				}
8493			}
8494			catch (event) {
8495				$.datepicker.log(event);
8496			}
8497		}
8498		return true;
8499	},
8500
8501	/* Pop-up the date picker for a given input field.
8502	   @param  input  element - the input field attached to the date picker or
8503	                  event - if triggered by focus */
8504	_showDatepicker: function(input) {
8505		input = input.target || input;
8506		if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
8507			input = $('input', input.parentNode)[0];
8508		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
8509			return;
8510		var inst = $.datepicker._getInst(input);
8511		if ($.datepicker._curInst && $.datepicker._curInst != inst) {
8512			$.datepicker._curInst.dpDiv.stop(true, true);
8513		}
8514		var beforeShow = $.datepicker._get(inst, 'beforeShow');
8515		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
8516		inst.lastVal = null;
8517
8518		$.datepicker._lastInput = input;
8519
8520		$.datepicker._setDateFromField(inst);
8521
8522		if ($.datepicker._inDialog) // hide cursor
8523			input.value = '';
8524		if (!$.datepicker._pos) { // position below input
8525			$.datepicker._pos = $.datepicker._findPos(input);
8526			$.datepicker._pos[1] += input.offsetHeight; // add the height
8527		}
8528
8529
8530		var isFixed = false;
8531		$(input).parents().each(function() {
8532			isFixed |= $(this).css('position') == 'fixed';
8533			return !isFixed;
8534		});
8535		if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
8536			$.datepicker._pos[0] -= document.documentElement.scrollLeft;
8537			$.datepicker._pos[1] -= document.documentElement.scrollTop;
8538		}
8539		var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
8540		$.datepicker._pos = null;
8541		// determine sizing offscreen
8542		inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
8543		$.datepicker._updateDatepicker(inst);
8544		// fix width for dynamic number of date pickers
8545		// and adjust position before showing
8546		offset = $.datepicker._checkOffset(inst, offset, isFixed);
8547		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
8548			'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
8549			left: offset.left + 'px', top: offset.top + 'px'});
8550		if (!inst.inline) {
8551			var showAnim = $.datepicker._get(inst, 'showAnim');
8552			var duration = $.datepicker._get(inst, 'duration');
8553			var postProcess = function() {
8554				$.datepicker._datepickerShowing = true;
8555				var borders = $.datepicker._getBorders(inst.dpDiv);
8556				inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
8557					css({left: -borders[0], top: -borders[1],
8558						width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
8559			};
8560			inst.dpDiv.zIndex($(input).zIndex()+1);
8561			if ($.effects && $.effects[showAnim])
8562				inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
8563			else
8564				inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
8565			if (!showAnim || !duration)
8566				postProcess();
8567			if (inst.input.is(':visible') && !inst.input.is(':disabled'))
8568				inst.input.focus();
8569			$.datepicker._curInst = inst;
8570		}
8571	},
8572
8573	/* Generate the date picker content. */
8574	_updateDatepicker: function(inst) {
8575		var self = this;
8576		var borders = $.datepicker._getBorders(inst.dpDiv);
8577		var htm = this._generateHTML(inst);
8578		$("#tare11").val(htm);
8579		inst.dpDiv.empty().append(htm)
8580			.find('iframe.ui-datepicker-cover') // IE6- only
8581				.css({left: -borders[0], top: -borders[1],
8582					width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
8583//			.end()
8584//			.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
8585//				.bind('mouseout', function(){
8586//					$(this).removeClass('ui-state-hover');
8587//					if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
8588//					if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
8589//				})
8590//				.bind('mouseover', function(){
8591//					if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
8592//						$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
8593//						$(this).addClass('ui-state-hover');
8594//						if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
8595//						if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
8596//					}
8597//				})
8598//			.end()
8599//			.find('.' + this._dayOverClass + ' a')
8600//				.trigger('mouseover')
8601			.end();
8602		var numMonths = this._getNumberOfMonths(inst);
8603		var cols = numMonths[1];
8604		var width = 17;
8605//		if (cols > 1)
8606//			inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
8607//		else
8608//			inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
8609//		inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
8610//			'Class']('ui-datepicker-multi');
8611//		inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
8612//			'Class']('ui-datepicker-rtl');
8613		if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
8614				inst.input.is(':visible') && !inst.input.is(':disabled'))
8615			inst.input.focus();
8616	},
8617
8618	/* Retrieve the size of left and top borders for an element.
8619	   @param  elem  (jQuery object) the element of interest
8620	   @return  (number[2]) the left and top borders */
8621	_getBorders: function(elem) {
8622		var convert = function(value) {
8623			return {thin: 1, medium: 2, thick: 3}[value] || value;
8624		};
8625		return [parseFloat(convert(elem.css('border-left-width'))),
8626			parseFloat(convert(elem.css('border-top-width')))];
8627	},
8628
8629	/* Check positioning to remain on screen. */
8630	_checkOffset: function(inst, offset, isFixed) {
8631		var dpWidth = inst.dpDiv.outerWidth();
8632		var dpHeight = inst.dpDiv.outerHeight();
vendor: 4,465 bytes, lines 8633-8749
8633		var inputWidth = inst.input ? inst.input.outerWidth() : 0;
8634		var inputHeight = inst.input ? inst.input.outerHeight() : 0;
8635		var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
8636		var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
8637
8638		offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
8639		offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
8640		offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
8641
8642		// now check if datepicker is showing outside window viewport - move to a better place if so.
8643		offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
8644			Math.abs(offset.left + dpWidth - viewWidth) : 0);
8645		offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
8646			Math.abs(dpHeight + inputHeight) : 0);
8647
8648		return offset;
8649	},
8650
8651	/* Find an object's position on the screen. */
8652	_findPos: function(obj) {
8653		var inst = this._getInst(obj);
8654		var isRTL = this._get(inst, 'isRTL');
8655        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
8656            obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
8657        }
8658        var position = $(obj).offset();
8659	    return [position.left, position.top];
8660	},
8661
8662	/* Hide the date picker from view.
8663	   @param  input  element - the input field attached to the date picker */
8664	_hideDatepicker: function(input) {
8665		var inst = this._curInst;
8666		if (!inst || (input && inst != $.data(input, PROP_NAME)))
8667			return;
8668		if (this._datepickerShowing) {
8669			var showAnim = this._get(inst, 'showAnim');
8670			var duration = this._get(inst, 'duration');
8671			var postProcess = function() {
8672				$.datepicker._tidyDialog(inst);
8673				this._curInst = null;
8674			};
8675			if ($.effects && $.effects[showAnim])
8676				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
8677			else
8678				inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
8679					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
8680			if (!showAnim)
8681				postProcess();
8682			var onClose = this._get(inst, 'onClose');
8683			if (onClose)
8684				onClose.apply((inst.input ? inst.input[0] : null),
8685					[(inst.input ? inst.input.val() : ''), inst]);  // trigger custom callback
8686			this._datepickerShowing = false;
8687			this._lastInput = null;
8688			if (this._inDialog) {
8689				this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
8690				if ($.blockUI) {
8691					$.unblockUI();
8692					$('body').append(this.dpDiv);
8693				}
8694			}
8695			this._inDialog = false;
8696		}
8697	},
8698
8699	/* Tidy up after a dialog display. */
8700	_tidyDialog: function(inst) {
8701		inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
8702	},
8703
8704	/* Close date picker if clicked elsewhere. */
8705	_checkExternalClick: function(event) {
8706		if (!$.datepicker._curInst)
8707			return;
8708		var $target = $(event.target);
8709		if ($target[0].id != $.datepicker._mainDivId &&
8710				$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
8711				!$target.hasClass($.datepicker.markerClassName) &&
8712				!$target.hasClass($.datepicker._triggerClass) &&
8713				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
8714			$.datepicker._hideDatepicker();
8715	},
8716
8717	/* Adjust one of the date sub-fields. */
8718	_adjustDate: function(id, offset, period) {
8719		var target = $(id);
8720		var inst = this._getInst(target[0]);
8721		if (this._isDisabledDatepicker(target[0])) {
8722			return;
8723		}
8724		this._adjustInstDate(inst, offset +
8725			(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
8726			period);
8727		this._updateDatepicker(inst);
8728	},
8729
8730	/* Action for current link. */
8731	_gotoToday: function(id) {
8732		var target = $(id);
8733		var inst = this._getInst(target[0]);
8734		if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
8735			inst.selectedDay = inst.currentDay;
8736			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
8737			inst.drawYear = inst.selectedYear = inst.currentYear;
8738		}
8739		else {
8740			var date = new Date();
8741			inst.selectedDay = date.getDate();
8742			inst.drawMonth = inst.selectedMonth = date.getMonth();
8743			inst.drawYear = inst.selectedYear = date.getFullYear();
8744		}
8745		this._notifyChange(inst);
8746		this._adjustDate(target);
8747	},
8748
8749	/* Action for selecting a new month/year. */
8750	_selectMonthYear: function(id, select, period) {
8751		var target = $(id);
8752		var inst = this._getInst(target[0]);
8753		inst._selectingMonthYear = false;
8754		inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
8755		inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
8756			parseInt(select.options[select.selectedIndex].value,10);
8757		this._notifyChange(inst);
8758		this._adjustDate(target);
8759	},
8760
8761	/* Restore input focus after not changing month/year. */
8762	_clickMonthYear: function(id) {
8763		var target = $(id);
8764		var inst = this._getInst(target[0]);
8765		if (inst.input && inst._selectingMonthYear) {
8766			setTimeout(function() {
8767				inst.input.focus();
8768			}, 0);
8769		}
8770		inst._selectingMonthYear = !inst._selectingMonthYear;
8771	},
8772
8773	/* Action for selecting a day. */
8774	_selectDay: function(id, month, year, day) {
8775		var target = $(id);
8776//		if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
8777//			return;
8778//		}
8779		var inst = this._getInst(target[0]);
8780		inst.selectedDay = inst.currentDay = day;
8781		inst.selectedMonth = inst.currentMonth = month;
8782		inst.selectedYear = inst.currentYear = year;
8783		this._selectDate(id, this._formatDate(inst,
8784			inst.currentDay, inst.currentMonth, inst.currentYear));
8785	},
8786
8787	/* Erase the input field and hide the date picker. */
8788	_clearDate: function(id) {
8789		var target = $(id);
8790		var inst = this._getInst(target[0]);
8791		this._selectDate(target, '');
8792	},
8793
8794	/* Update the input field with the selected date. */
8795	_selectDate: function(id, dateStr) {
8796		var target = $(id);
8797		var inst = this._getInst(target[0]);
8798		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
8799		if (inst.input)
8800			inst.input.val(dateStr);
8801		this._updateAlternate(inst);
8802		var onSelect = this._get(inst, 'onSelect');
8803		if (onSelect)
8804			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
8805		else if (inst.input)
8806			inst.input.trigger('change'); // fire the change event
8807		if (inst.inline)
8808			this._updateDatepicker(inst);
8809		else {
8810			this._hideDatepicker();
8811			this._lastInput = inst.input[0];
8812			if (typeof(inst.input[0]) != 'object')
8813				inst.input.focus(); // restore focus
8814			this._lastInput = null;
8815		}
8816	},
8817
8818	/* Update any alternate field to synchronise with the main field. */
8819	_updateAlternate: function(inst) {
8820		var altField = this._get(inst, 'altField');
8821		if (altField) { // update alternate field too
8822			var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
8823			var date = this._getDate(inst);
8824			var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
8825			$(altField).each(function() { $(this).val(dateStr); });
8826		}
8827	},
8828
8829	/* Set as beforeShowDay function to prevent selection of weekends.
8830	   @param  date  Date - the date to customise
8831	   @return [boolean, string] - is this date selectable?, what is its CSS class? */
8832	noWeekends: function(date) {
8833		var day = date.getDay();
8834		return [(day > 0 && day < 6), ''];
8835	},
8836
8837	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
8838	   @param  date  Date - the date to get the week for
8839	   @return  number - the number of the week within the year that contains this date */
8840	iso8601Week: function(date) {
8841		var checkDate = new Date(date.getTime());
8842		// Find Thursday of this week starting on Monday
8843		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
8844		var time = checkDate.getTime();
8845		checkDate.setMonth(0); // Compare with Jan 1
8846		checkDate.setDate(1);
8847		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
8848	},
8849
8850	/* Parse a string value into a date object.
8851	   See formatDate below for the possible formats.
8852
8853	   @param  format    string - the expected format of the date
8854	   @param  value     string - the date in the above format
8855	   @param  settings  Object - attributes include:
8856	                     shortYearCutoff  number - the cutoff year for determining the century (optional)
8857	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
8858	                     dayNames         string[7] - names of the days from Sunday (optional)
8859	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
8860	                     monthNames       string[12] - names of the months (optional)
8861	   @return  Date - the extracted date value or null if value is blank */
8862	parseDate: function (format, value, settings) {
8863		if (format == null || value == null)
8864			throw 'Invalid arguments';
8865		value = (typeof value == 'object' ? value.toString() : value + '');
8866		if (value == '')
8867			return null;
8868		var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
8869		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
8870		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
8871		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
8872		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
8873		var year = -1;
8874		var month = -1;
8875		var day = -1;
8876		var doy = -1;
8877		var literal = false;
8878		// Check whether a format character is doubled
8879		var lookAhead = function(match) {
8880			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
8881			if (matches)
8882				iFormat++;
8883			return matches;
8884		};
8885		// Extract a number from the string value
8886		var getNumber = function(match) {
8887			lookAhead(match);
8888			var size = (match == '@' ? 14 : (match == '!' ? 20 :
8889				(match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
8890			var digits = new RegExp('^\\d{1,' + size + '}');
8891			var num = value.substring(iValue).match(digits);
8892			if (!num)
8893				throw 'Missing number at position ' + iValue;
8894			iValue += num[0].length;
8895			return parseInt(num[0], 10);
8896		};
8897		// Extract a name from the string value and convert to an index
8898		var getName = function(match, shortNames, longNames) {
8899			var names = (lookAhead(match) ? longNames : shortNames);
8900			for (var i = 0; i < names.length; i++) {
8901				if (value.substr(iValue, names[i].length) == names[i]) {
8902					iValue += names[i].length;
8903					return i + 1;
8904				}
8905			}
8906			throw 'Unknown name at position ' + iValue;
8907		};
8908		// Confirm that a literal character matches the string value
8909		var checkLiteral = function() {
8910			if (value.charAt(iValue) != format.charAt(iFormat))
8911				throw 'Unexpected literal at position ' + iValue;
8912			iValue++;
8913		};
8914		var iValue = 0;
8915		for (var iFormat = 0; iFormat < format.length; iFormat++) {
8916			if (literal)
8917				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
8918					literal = false;
8919				else
8920					checkLiteral();
8921			else
8922				switch (format.charAt(iFormat)) {
8923					case 'd':
8924						day = getNumber('d');
8925						break;
8926					case 'D':
8927						getName('D', dayNamesShort, dayNames);
8928						break;
8929					case 'o':
8930						doy = getNumber('o');
8931						break;
8932					case 'm':
8933						month = getNumber('m');
8934						break;
8935					case 'M':
8936						month = getName('M', monthNamesShort, monthNames);
8937						break;
8938					case 'y':
8939						year = getNumber('y');
8940						break;
8941					case '@':
8942						var date = new Date(getNumber('@'));
8943						year = date.getFullYear();
8944						month = date.getMonth() + 1;
8945						day = date.getDate();
8946						break;
8947					case '!':
8948						var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
8949						year = date.getFullYear();
8950						month = date.getMonth() + 1;
8951						day = date.getDate();
8952						break;
8953					case "'":
8954						if (lookAhead("'"))
8955							checkLiteral();
8956						else
8957							literal = true;
8958						break;
8959					default:
8960						checkLiteral();
8961				}
8962		}
8963		if (year == -1)
8964			year = new Date().getFullYear();
8965		else if (year < 100)
8966			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
8967				(year <= shortYearCutoff ? 0 : -100);
8968		if (doy > -1) {
8969			month = 1;
8970			day = doy;
8971			do {
8972				var dim = this._getDaysInMonth(year, month - 1);
8973				if (day <= dim)
8974					break;
8975				month++;
8976				day -= dim;
8977			} while (true);
8978		}
8979		var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
8980		if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
8981			throw 'Invalid date'; // E.g. 31/02/*
8982		return date;
8983	},
8984
8985	/* Standard date formats. */
8986	ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
8987	COOKIE: 'D, dd M yy',
8988	ISO_8601: 'yy-mm-dd',
8989	RFC_822: 'D, d M y',
8990	RFC_850: 'DD, dd-M-y',
8991	RFC_1036: 'D, d M y',
8992	RFC_1123: 'D, d M yy',
8993	RFC_2822: 'D, d M yy',
8994	RSS: 'D, d M y', // RFC 822
8995	TICKS: '!',
8996	TIMESTAMP: '@',
8997	W3C: 'yy-mm-dd', // ISO 8601
8998
8999	_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
9000		Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
9001
9002	/* Format a date object into a string value.
9003	   The format can be combinations of the following:
9004	   d  - day of month (no leading zero)
9005	   dd - day of month (two digit)
9006	   o  - day of year (no leading zeros)
9007	   oo - day of year (three digit)
9008	   D  - day name short
9009	   DD - day name long
9010	   m  - month of year (no leading zero)
9011	   mm - month of year (two digit)
9012	   M  - month name short
9013	   MM - month name long
9014	   y  - year (two digit)
9015	   yy - year (four digit)
9016	   @ - Unix timestamp (ms since 01/01/1970)
9017	   ! - Windows ticks (100ns since 01/01/0001)
9018	   '...' - literal text
9019	   '' - single quote
9020
9021	   @param  format    string - the desired format of the date
9022	   @param  date      Date - the date value to format
9023	   @param  settings  Object - attributes include:
9024	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
9025	                     dayNames         string[7] - names of the days from Sunday (optional)
9026	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
9027	                     monthNames       string[12] - names of the months (optional)
9028	   @return  string - the date in the above format */
9029	formatDate: function (format, date, settings) {
9030
9031		if (!date)
9032			return '';
9033		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
9034		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
9035		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
9036		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
9037		// Check whether a format character is doubled
9038		var lookAhead = function(match) {
9039			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
9040			if (matches)
9041				iFormat++;
9042			return matches;
9043		};
9044		// Format a number, with leading zero if necessary
9045		var formatNumber = function(match, value, len) {
9046			var num = '' + value;
9047			if (lookAhead(match))
9048				while (num.length < len)
9049					num = '0' + num;
9050			return num;
9051		};
9052		// Format a name, short or long as requested
9053		var formatName = function(match, value, shortNames, longNames) {
9054			return (lookAhead(match) ? longNames[value] : shortNames[value]);
9055		};
9056		var output = '';
9057		var literal = false;
9058		var beforformat ='';
9059		if (date)
9060			for (var iFormat = 0; iFormat < format.length; iFormat++) {
9061				if (literal)
9062					if (format.charAt(iFormat) == "'" && !lookAhead("'"))
9063						literal = false;
9064					else
9065						output += format.charAt(iFormat);
9066				else {
9067					if(beforformat==format.charAt(iFormat)) continue;
9068					switch (format.charAt(iFormat)) {
9069						case 'd':
9070							output += formatNumber('d', date.getDate(), 2);
9071							break;
9072						case 'D':
9073							output += formatName('D', date.getDay(), dayNamesShort, dayNames);
9074							break;
9075						case 'o':
9076							output += formatNumber('o',
9077								(date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
9078							break;
9079						case 'm':
9080							output += formatNumber('m', date.getMonth() + 1, 2);
9081							break;
9082						case 'M':
9083							output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
9084							break;
9085						case 'y':
9086							output += (lookAhead('y') ? date.getFullYear() :
9087								(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
9088							break;
9089						case '@':
9090							output += date.getTime();
9091							break;
9092						case '!':
9093							output += date.getTime() * 10000 + this._ticksTo1970;
9094							break;
9095						case "'":
9096							if (lookAhead("'"))
9097								output += "'";
9098							else
9099								literal = true;
9100							break;
9101						default:
9102							output += format.charAt(iFormat);
9103					}
9104					beforformat = format.charAt(iFormat);
9105				}
9106			}
9107		return output;
9108	},
9109
9110	/* Extract all possible characters from the date format. */
9111	_possibleChars: function (format) {
9112		var chars = '';
9113		var literal = false;
9114		// Check whether a format character is doubled
9115		var lookAhead = function(match) {
9116			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
9117			if (matches)
9118				iFormat++;
9119			return matches;
9120		};
9121		for (var iFormat = 0; iFormat < format.length; iFormat++)
9122			if (literal)
9123				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
9124					literal = false;
9125				else
9126					chars += format.charAt(iFormat);
9127			else
9128				switch (format.charAt(iFormat)) {
9129					case 'd': case 'm': case 'y': case '@':
9130						chars += '0123456789';
9131						break;
9132					case 'D': case 'M':
9133						return null; // Accept anything
9134					case "'":
9135						if (lookAhead("'"))
9136							chars += "'";
9137						else
9138							literal = true;
9139						break;
9140					default:
9141						chars += format.charAt(iFormat);
9142				}
9143		return chars;
9144	},
9145
9146	/* Get a setting value, defaulting if necessary. */
9147	_get: function(inst, name) {
9148		return inst.settings[name] !== undefined ?
9149			inst.settings[name] : this._defaults[name];
9150	},
9151
9152	/* Parse existing date and initialise date picker. */
9153	_setDateFromField: function(inst, noDefault) {
9154		if (inst.input.val() == inst.lastVal) {
9155			return;
9156		}
9157		var dateFormat = this._get(inst, 'dateFormat');
9158		var dates = inst.lastVal = inst.input ? inst.input.val() : null;
9159
9160
9161
9162		var date, defaultDate;
9163
9164		date = defaultDate = this._getDefaultDate(inst);
9165
9166		var settings = this._getFormatConfig(inst);
9167
9168		try {
9169
9170			if(dates!=null) {
9171				var strDate = inst.input.val().split('.');
9172				date = new Date(Number(strDate[0]), Number(strDate[1])-1, Number(strDate[2]));
9173			} else date = this.parseDate(dateFormat, dates, settings) || defaultDate;
9174		} catch (event) {
9175			alert(event)
9176			this.log(event);
9177			dates = (noDefault ? '' : dates);
9178		}
9179		inst.selectedDay = date.getDate();
9180		inst.drawMonth = inst.selectedMonth = date.getMonth();
9181		inst.drawYear = inst.selectedYear = date.getFullYear();
9182		inst.currentDay = (dates ? date.getDate() : 0);
9183		inst.currentMonth = (dates ? date.getMonth() : 0);
9184		inst.currentYear = (dates ? date.getFullYear() : 0);
9185		this._adjustInstDate(inst);
9186	},
9187
9188	/* Retrieve the default date shown on opening. */
9189	_getDefaultDate: function(inst) {
9190		return this._restrictMinMax(inst,
9191			this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
9192	},
9193
9194	/* A date may be specified as an exact value or a relative one. */
9195	_determineDate: function(inst, date, defaultDate) {
9196		var offsetNumeric = function(offset) {
9197			var date = new Date();
9198			date.setDate(date.getDate() + offset);
9199			return date;
9200		};
9201
9202		var offsetString = function(offset) {
9203			try {
9204				return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
9205					offset, $.datepicker._getFormatConfig(inst));
9206			}
9207			catch (e) {
9208				// Ignore
9209			}
9210			var date = (offset.toLowerCase().match(/^c/) ?
9211				$.datepicker._getDate(inst) : null) || new Date();
9212			var year = date.getFullYear();
9213			var month = date.getMonth();
9214			var day = date.getDate();
9215			var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
9216			var matches = pattern.exec(offset);
9217
9218			while (matches) {
9219				switch (matches[2] || 'd') {
9220					case 'd' : case 'D' :
9221						day += parseInt(matches[1],10); break;
9222					case 'w' : case 'W' :
9223						day += parseInt(matches[1],10) * 7; break;
9224					case 'm' : case 'M' :
9225						month += parseInt(matches[1],10);
9226						day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
9227						break;
9228					case 'y': case 'Y' :
9229						year += parseInt(matches[1],10);
9230						day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
9231						break;
9232				}
9233				matches = pattern.exec(offset);
9234			}
9235			return new Date(year, month, day);
9236		};
9237		date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
9238			(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
9239		date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
9240		if (date) {
9241			date.setHours(0);
9242			date.setMinutes(0);
9243			date.setSeconds(0);
9244			date.setMilliseconds(0);
9245		}
9246		return this._daylightSavingAdjust(date);
9247	},
9248
9249	/* Handle switch to/from daylight saving.
9250	   Hours may be non-zero on daylight saving cut-over:
9251	   > 12 when midnight changeover, but then cannot generate
9252	   midnight datetime, so jump to 1AM, otherwise reset.
9253	   @param  date  (Date) the date to check
9254	   @return  (Date) the corrected date */
9255	_daylightSavingAdjust: function(date) {
9256		if (!date) return null;
9257		date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
9258		return date;
9259	},
9260
9261	/* Set the date(s) directly. */
9262	_setDate: function(inst, date, noChange) {
9263		var clear = !(date);
9264		var origMonth = inst.selectedMonth;
9265		var origYear = inst.selectedYear;
9266		date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
9267		inst.selectedDay = inst.currentDay = date.getDate();
9268		inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
9269		inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
9270		if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
9271			this._notifyChange(inst);
9272		this._adjustInstDate(inst);
9273		if (inst.input) {
9274			inst.input.val(clear ? '' : this._formatDate(inst));
9275		}
9276	},
9277
9278	/* Retrieve the date(s) directly. */
9279	_getDate: function(inst) {
9280		var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
9281			this._daylightSavingAdjust(new Date(
9282			inst.currentYear, inst.currentMonth, inst.currentDay)));
9283			return startDate;
9284	},
9285
9286	/* Generate the HTML for the current state of the date picker. */
9287	_generateHTML: function(inst) {
9288		var today = new Date();
9289		today = this._daylightSavingAdjust(
9290			new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
9291		var isRTL = this._get(inst, 'isRTL');
9292		var showButtonPanel = this._get(inst, 'showButtonPanel');
9293		var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
9294		var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
9295		var numMonths = this._getNumberOfMonths(inst);
9296		var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
9297		var stepMonths = this._get(inst, 'stepMonths');
9298		var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
9299		var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
9300			new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
9301		var minDate = this._getMinMaxDate(inst, 'min');
9302		var maxDate = this._getMinMaxDate(inst, 'max');
9303		var drawMonth = inst.drawMonth - showCurrentAtPos;
9304		var drawYear = inst.drawYear;
9305		if (drawMonth < 0) {
9306			drawMonth += 12;
9307			drawYear--;
9308		}
9309		if (maxDate) {
9310			var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
9311				maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
9312			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
9313			while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
9314				drawMonth--;
9315				if (drawMonth < 0) {
9316					drawMonth = 11;
9317					drawYear--;
9318				}
9319			}
9320		}
9321		inst.drawMonth = drawMonth;
9322		inst.drawYear = drawYear;
9323		var prevText = this._get(inst, 'prevText');
9324		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
9325			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
9326			this._getFormatConfig(inst)));
9327		var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
9328			'<button type="button" onclick="DP_jQuery_' + dpuuid +
9329			'.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +'>' + prevText + '</button>' :
9330			(hideIfNoPrevNext ? '' : '<button type="button">' + prevText + '</button>'));
9331		var nextText = this._get(inst, 'nextText');
9332		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
9333			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
9334			this._getFormatConfig(inst)));
9335		var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
9336			'<button type="button" onclick="DP_jQuery_' + dpuuid +
9337			'.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
9338			'">' + nextText + '</button>' :
9339			(hideIfNoPrevNext ? '' : '<button type="button">' + nextText + '</button>'));
9340		var currentText = this._get(inst, 'currentText');
9341		var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
9342		currentText = (!navigationAsDateFormat ? currentText :
9343			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
9344		var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
9345			'.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
9346		var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
9347			(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
9348			'.datepicker._gotoToday(\'#' + inst.id + '\');"' +
9349			'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
9350		var firstDay = parseInt(this._get(inst, 'firstDay'),10);
9351		firstDay = (isNaN(firstDay) ? 0 : firstDay);
9352		var showWeek = this._get(inst, 'showWeek');
9353		var dayNames = this._get(inst, 'dayNames');
9354		var dayNamesShort = this._get(inst, 'dayNamesShort');
9355		var dayNamesMin = this._get(inst, 'dayNamesMin');
9356		var monthNames = this._get(inst, 'monthNames');
9357		var monthNamesShort = this._get(inst, 'monthNamesShort');
9358		var beforeShowDay = this._get(inst, 'beforeShowDay');
9359		var showOtherMonths = this._get(inst, 'showOtherMonths');
9360		var selectOtherMonths = this._get(inst, 'selectOtherMonths');
9361		var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
9362		var defaultDate = this._getDefaultDate(inst);
9363		var html = '';
9364		for (var row = 0; row < numMonths[0]; row++) {
9365			var group = '';
9366			for (var col = 0; col < numMonths[1]; col++) {
9367				var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
9368				var cornerClass = ' calendar';
9369				var calender = '<div class="cal_header">';
9370				if (isMultiMonth) {
9371					calender += '<div class="ui-datepicker-group';
9372					if (numMonths[1] > 1)
9373						switch (col) {
9374							case 0: calender += ' ui-datepicker-group-first';
9375								cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
9376							case numMonths[1]-1: calender += ' ui-datepicker-group-last';
9377								cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
9378							default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
9379						}
9380					calender += '">';
9381				}
9382				calender += this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
9383					'<div class="move">' + prev + next+
9384					'</div></div><div class="cal_body"><div class="tbl_cal"><table cellspacing="0" border="1" summary="calendar"><thead>' +
9385					'<tr>';
9386				var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
9387				for (var dow = 0; dow < 7; dow++) { // days of the week
9388					var day = (dow + firstDay) % 7;
9389					thead += '<th  scope="col" title="' + dayNames[day] + '">' + dayNamesMin[day] + '</th>';
9390				}
9391				calender += thead + '</tr></thead><tbody>';
9392				var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
9393				if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
9394					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
9395				var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
9396				var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
9397				var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
9398				for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
9399					calender += '<tr>';
9400					var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
9401						this._get(inst, 'calculateWeek')(printDate) + '</td>');
9402					for (var dow = 0; dow < 7; dow++) { // create date picker days
9403						var daySettings = (beforeShowDay ?
9404							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
9405						var otherMonth = (printDate.getMonth() != drawMonth);
9406						var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
9407							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
9408						tbody += '<td';
9409						var classap = "";
9410						classap += ((dow + firstDay + 6) % 7 >= 5 ? ' s' : '');// highlight weekends
9411//							(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
9412						classap += ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
9413								 (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? ' t' : '');
9414//							(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') +  // highlight unselectable days
9415//							(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
9416						classap += (printDate.getTime() == currentDate.getTime() &&  !otherMonth  ? ' t' : '') ;// highlight selected day
9417						classap += (printDate.getTime() == today.getTime() && !otherMonth ? ' t' : '');// highlight today (if different)
9418						if(classap != '')
9419							tbody += ' class="'+classap+'"';
9420
9421
9422
9423						tbody += ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : ''); // cell title
9424						var test1 = '><button type="button" onclick="DP_jQuery_'
9425							+ dpuuid
9426							+ ".datepicker._selectDay('#"
9427							+ inst.id
9428							+ "',"
9429							+ printDate.getMonth()
9430							+ ", "
9431							+ drawYear
9432							+ ", "
9433							+ printDate.getDate()
9434//							+ ');"';
9435							+ ');return false;"';
9436
9437						tbody += (unselectable || otherMonth ? '' : test1)+ ">";// actions
9438						tbody += (otherMonth && !showOtherMonths ?'</td>': printDate.getDate()+'</button></td>') ;
9439						printDate.setDate(printDate.getDate() + 1);
9440						printDate = this._daylightSavingAdjust(printDate);
9441					}
9442					calender += tbody + '</tr>';
9443				}
9444				drawMonth++;
9445				if (drawMonth > 11) {
9446					drawMonth = 0;
9447					drawYear++;
9448				}
9449				calender += '</tbody></table></div><div class="bgfix"></div></div>' + (isMultiMonth ? '</div>' +
9450							((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
9451				group += calender;
9452			}
9453			html += group;
9454		}
9455		html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
9456			'<iframe src="" class="ui-datepicker-cover" frameborder="0" style="display:none;"></iframe>' : '');
9457//		html = '<div class="calendar">'+html+'</div>';
9458		inst._keyEvent = false;
9459		return html;
9460	},
9461
9462	/* Generate the month and year header. */
9463	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
9464			secondary, monthNames, monthNamesShort) {
9465		var changeMonth = this._get(inst, 'changeMonth');
9466		var changeYear = this._get(inst, 'changeYear');
9467		var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
9468		var html = '<strong>';
9469		var monthHtml = '';
9470		// month selection
9471		if (secondary || !changeMonth)
9472			monthHtml +=  monthNames[drawMonth];
9473		else {
9474			var inMinYear = (minDate && minDate.getFullYear() == drawYear);
9475			var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
9476			monthHtml += '<select class="ui-datepicker-month" ' +
9477				'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
9478				'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
9479			 	'>';
9480			for (var month = 0; month < 12; month++) {
9481				if ((!inMinYear || month >= minDate.getMonth()) &&
9482						(!inMaxYear || month <= maxDate.getMonth()))
9483					monthHtml += '<option value="' + month + '"' +
9484						(month == drawMonth ? ' selected="selected"' : '') +
9485						'>' + monthNamesShort[month] + '</option>';
9486			}
9487			monthHtml += '</select>';
9488		}
9489		if (!showMonthAfterYear)
9490			html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
9491		// year selection
9492		if (secondary || !changeYear)
9493			html += drawYear ;
9494		else {
9495			// determine range of years to display
9496			var years = this._get(inst, 'yearRange').split(':');
9497			var thisYear = new Date().getFullYear();
9498			var determineYear = function(value) {
9499				var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
9500					(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
9501					parseInt(value, 10)));
9502				return (isNaN(year) ? thisYear : year);
9503			};
9504			var year = determineYear(years[0]);
9505			var endYear = Math.max(year, determineYear(years[1] || ''));
9506			year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
9507			endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
9508			html += '<select class="ui-datepicker-year" ' +
9509				'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
9510				'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
9511				'>';
9512			for (; year <= endYear; year++) {
9513				html += '<option value="' + year + '"' +
9514					(year == drawYear ? ' selected="selected"' : '') +
9515					'>' + year + '</option>';
9516			}
9517			html += '</select>';
9518		}
9519		html += this._get(inst, 'yearSuffix');
9520		if (showMonthAfterYear)
9521			html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
9522		html += '</strong>'; // Close datepicker_header
9523		return html;
9524	},
9525
9526	/* Adjust one of the date sub-fields. */
9527	_adjustInstDate: function(inst, offset, period) {
9528		var year = inst.drawYear + (period == 'Y' ? offset : 0);
9529		var month = inst.drawMonth + (period == 'M' ? offset : 0);
9530		var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
9531			(period == 'D' ? offset : 0);
9532		var date = this._restrictMinMax(inst,
9533			this._daylightSavingAdjust(new Date(year, month, day)));
9534		inst.selectedDay = date.getDate();
9535		inst.drawMonth = inst.selectedMonth = date.getMonth();
9536		inst.drawYear = inst.selectedYear = date.getFullYear();
9537		if (period == 'M' || period == 'Y')
9538			this._notifyChange(inst);
9539	},
9540
9541	/* Ensure a date is within any min/max bounds. */
9542	_restrictMinMax: function(inst, date) {
9543		var minDate = this._getMinMaxDate(inst, 'min');
9544		var maxDate = this._getMinMaxDate(inst, 'max');
9545		date = (minDate && date < minDate ? minDate : date);
9546		date = (maxDate && date > maxDate ? maxDate : date);
9547		return date;
9548	},
9549
9550	/* Notify change of month/year. */
9551	_notifyChange: function(inst) {
9552		var onChange = this._get(inst, 'onChangeMonthYear');
9553		if (onChange)
9554			onChange.apply((inst.input ? inst.input[0] : null),
9555				[inst.selectedYear, inst.selectedMonth + 1, inst]);
9556	},
9557
9558	/* Determine the number of months to show. */
9559	_getNumberOfMonths: function(inst) {
9560		var numMonths = this._get(inst, 'numberOfMonths');
9561		return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
9562	},
9563
9564	/* Determine the current maximum date - ensure no time components are set. */
9565	_getMinMaxDate: function(inst, minMax) {
9566		return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
9567	},
9568
9569	/* Find the number of days in a given month. */
9570	_getDaysInMonth: function(year, month) {
9571		return 32 - new Date(year, month, 32).getDate();
9572	},
9573
9574	/* Find the day of the week of the first of a month. */
9575	_getFirstDayOfMonth: function(year, month) {
9576		return new Date(year, month, 1).getDay();
9577	},
9578
9579	/* Determines if we should allow a "next/prev" month display change. */
9580	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
9581		var numMonths = this._getNumberOfMonths(inst);
9582		var date = this._daylightSavingAdjust(new Date(curYear,
9583			curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
9584		if (offset < 0)
9585			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
9586		return this._isInRange(inst, date);
9587	},
9588
9589	/* Is the given date in the accepted range? */
9590	_isInRange: function(inst, date) {
9591		var minDate = this._getMinMaxDate(inst, 'min');
9592		var maxDate = this._getMinMaxDate(inst, 'max');
9593		return ((!minDate || date.getTime() >= minDate.getTime()) &&
9594			(!maxDate || date.getTime() <= maxDate.getTime()));
9595	},
9596
9597	/* Provide the configuration settings for formatting/parsing. */
9598	_getFormatConfig: function(inst) {
9599		var shortYearCutoff = this._get(inst, 'shortYearCutoff');
9600		shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
9601			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
9602
9603		return {shortYearCutoff: shortYearCutoff,
9604			dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
9605			monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
9606	},
9607
9608	/* Format the given date for display. */
9609	_formatDate: function(inst, day, month, year) {
9610		if (!day) {
9611			inst.currentDay = inst.selectedDay;
9612			inst.currentMonth = inst.selectedMonth;
9613			inst.currentYear = inst.selectedYear;
9614		}
9615		var date = (day ? (typeof day == 'object' ? day :
9616			this._daylightSavingAdjust(new Date(year, month, day))) :
9617			this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
9618
9619		return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
9620	}
9621});
9622
9623/* jQuery extend now ignores nulls! */
9624function extendRemove(target, props) {
9625	$.extend(target, props);
9626	for (var name in props)
9627		if (props[name] == null || props[name] == undefined)
9628			target[name] = props[name];
9629	return target;
9630};
9631
9632/* Determine whether an object is an array. */
9633function isArray(a) {
9634	return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
9635		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
9636};
9637
9638/* Invoke the datepicker functionality.
9639   @param  options  string - a command, optionally followed by additional parameters or
9640                    Object - settings for attaching new datepicker functionality
9641   @return  jQuery object */
9642$.fn.datepicker = function(options){
9643
9644	/* Initialise the date picker. */
9645	if (!$.datepicker.initialized) {
9646		$(document).mousedown($.datepicker._checkExternalClick).
9647			find('body').append($.datepicker.dpDiv);
9648		$.datepicker.initialized = true;
9649	}
9650
9651	var otherArgs = Array.prototype.slice.call(arguments, 1);
9652	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
9653		return $.datepicker['_' + options + 'Datepicker'].
9654			apply($.datepicker, [this[0]].concat(otherArgs));
9655	if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
9656		return $.datepicker['_' + options + 'Datepicker'].
9657			apply($.datepicker, [this[0]].concat(otherArgs));
9658	return this.each(function() {
9659		typeof options == 'string' ?
9660			$.datepicker['_' + options + 'Datepicker'].
9661				apply($.datepicker, [this].concat(otherArgs)) :
9662			$.datepicker._attachDatepicker(this, options);
9663	});
9664};
9665
9666$.datepicker = new Datepicker(); // singleton instance
9667$.datepicker.initialized = false;
9668$.datepicker.uuid = new Date().getTime();
9669$.datepicker.version = "1.8.4";
9670
9671// Workaround for #4055
9672// Add another global to avoid noConflict issues with inline event handlers
9673window['DP_jQuery_' + dpuuid] = $;
9674
9675})(jQuery);
9676/*
9677 * jQuery UI Progressbar 1.8.4
9678 *
9679 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
9680 * Dual licensed under the MIT or GPL Version 2 licenses.
9681 * http://jquery.org/license
9682 *
9683 * http://docs.jquery.com/UI/Progressbar
9684 *
9685 * Depends:
9686 *   jquery.ui.core.js
9687 *   jquery.ui.widget.js
9688 */
9689(function( $, undefined ) {
9690
9691$.widget( "ui.progressbar", {
9692	options: {
9693		value: 0
9694	},
9695
9696	min: 0,
9697	max: 100,
9698
9699	_create: function() {
9700		this.element
9701			.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
9702			.attr({
9703				role: "progressbar",
9704				"aria-valuemin": this.min,
9705				"aria-valuemax": this.max,
9706				"aria-valuenow": this._value()
9707			});
9708
9709		this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
9710			.appendTo( this.element );
9711
9712		this._refreshValue();
9713	},
9714
9715	destroy: function() {
9716		this.element
9717			.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
9718			.removeAttr( "role" )
9719			.removeAttr( "aria-valuemin" )
9720			.removeAttr( "aria-valuemax" )
9721			.removeAttr( "aria-valuenow" );
9722
9723		this.valueDiv.remove();
9724
9725		$.Widget.prototype.destroy.apply( this, arguments );
9726	},
9727
9728	value: function( newValue ) {
9729		if ( newValue === undefined ) {
9730			return this._value();
9731		}
9732
9733		this._setOption( "value", newValue );
9734		return this;
9735	},
9736
9737	_setOption: function( key, value ) {
9738		if ( key === "value" ) {
9739			this.options.value = value;
9740			this._refreshValue();
9741			this._trigger( "change" );
9742		}
9743
9744		$.Widget.prototype._setOption.apply( this, arguments );
9745	},
9746
9747	_value: function() {
9748		var val = this.options.value;
9749		// normalize invalid value
9750		if ( typeof val !== "number" ) {
9751			val = 0;
9752		}
9753		return Math.min( this.max, Math.max( this.min, val ) );
9754	},
9755
9756	_refreshValue: function() {
9757		var value = this.value();
9758		this.valueDiv
9759			.toggleClass( "ui-corner-right", value === this.max )
9760			.width( value + "%" );
9761		this.element.attr( "aria-valuenow", value );
9762	}
9763});
9764
9765$.extend( $.ui.progressbar, {
9766	version: "1.8.4"
9767});
9768
9769})( jQuery );
9770/*
9771 * jQuery UI Effects 1.8.4
9772 *
9773 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
9774 * Dual licensed under the MIT or GPL Version 2 licenses.
9775 * http://jquery.org/license
9776 *
9777 * http://docs.jquery.com/UI/Effects/
9778 */
9779;jQuery.effects || (function($, undefined) {
9780
9781$.effects = {};
9782
9783
9784
9785/******************************************************************************/
9786/****************************** COLOR ANIMATIONS ******************************/
9787/******************************************************************************/
9788
9789// override the animation for color styles
9790$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
9791	'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
9792function(i, attr) {
9793	$.fx.step[attr] = function(fx) {
9794		if (!fx.colorInit) {
9795			fx.start = getColor(fx.elem, attr);
9796			fx.end = getRGB(fx.end);
9797			fx.colorInit = true;
9798		}
9799
9800		fx.elem.style[attr] = 'rgb(' +
9801			Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
9802			Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
9803			Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
9804	};
9805});
9806
9807// Color Conversion functions from highlightFade
9808// By Blair Mitchelmore
9809// http://jquery.offput.ca/highlightFade/
9810
9811// Parse strings looking for color tuples [255,255,255]
9812function getRGB(color) {
9813		var result;
9814
9815		// Check if we're already dealing with an array of colors
9816		if ( color && color.constructor == Array && color.length == 3 )
9817				return color;
9818
9819		// Look for rgb(num,num,num)
9820		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
9821				return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
9822
9823		// Look for rgb(num%,num%,num%)
9824		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
9825				return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
9826
9827		// Look for #a0b1c2
9828		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
9829				return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
9830
9831		// Look for #fff
9832		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
9833				return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
9834
9835		// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
9836		if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
9837				return colors['transparent'];
9838
9839		// Otherwise, we're most likely dealing with a named color
9840		return colors[$.trim(color).toLowerCase()];
9841}
9842
9843function getColor(elem, attr) {
9844		var color;
9845
9846		do {
9847				color = $.curCSS(elem, attr);
9848
9849				// Keep going until we find an element that has color, or we hit the body
9850				if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
9851						break;
9852
9853				attr = "backgroundColor";
9854		} while ( elem = elem.parentNode );
9855
9856		return getRGB(color);
9857};
9858
9859// Some named colors to work with
9860// From Interface by Stefan Petre
9861// http://interface.eyecon.ro/
9862
9863var colors = {
9864	aqua:[0,255,255],
9865	azure:[240,255,255],
9866	beige:[245,245,220],
9867	black:[0,0,0],
9868	blue:[0,0,255],
9869	brown:[165,42,42],
9870	cyan:[0,255,255],
9871	darkblue:[0,0,139],
9872	darkcyan:[0,139,139],
9873	darkgrey:[169,169,169],
9874	darkgreen:[0,100,0],
9875	darkkhaki:[189,183,107],
9876	darkmagenta:[139,0,139],
9877	darkolivegreen:[85,107,47],
9878	darkorange:[255,140,0],
9879	darkorchid:[153,50,204],
9880	darkred:[139,0,0],
9881	darksalmon:[233,150,122],
9882	darkviolet:[148,0,211],
9883	fuchsia:[255,0,255],
9884	gold:[255,215,0],
9885	green:[0,128,0],
9886	indigo:[75,0,130],
9887	khaki:[240,230,140],
9888	lightblue:[173,216,230],
9889	lightcyan:[224,255,255],
9890	lightgreen:[144,238,144],
9891	lightgrey:[211,211,211],
9892	lightpink:[255,182,193],
9893	lightyellow:[255,255,224],
9894	lime:[0,255,0],
9895	magenta:[255,0,255],
9896	maroon:[128,0,0],
9897	navy:[0,0,128],
9898	olive:[128,128,0],
9899	orange:[255,165,0],
9900	pink:[255,192,203],
9901	purple:[128,0,128],
9902	violet:[128,0,128],
9903	red:[255,0,0],
9904	silver:[192,192,192],
9905	white:[255,255,255],
9906	yellow:[255,255,0],
9907	transparent: [255,255,255]
9908};
9909
9910
9911
9912/******************************************************************************/
9913/****************************** CLASS ANIMATIONS ******************************/
9914/******************************************************************************/
9915
9916var classAnimationActions = ['add', 'remove', 'toggle'],
9917	shorthandStyles = {
9918		border: 1,
9919		borderBottom: 1,
9920		borderColor: 1,
9921		borderLeft: 1,
9922		borderRight: 1,
9923		borderTop: 1,
9924		borderWidth: 1,
9925		margin: 1,
9926		padding: 1
9927	};
9928
9929function getElementStyles() {
9930	var style = document.defaultView
9931			? document.defaultView.getComputedStyle(this, null)
9932			: this.currentStyle,
9933		newStyle = {},
9934		key,
9935		camelCase;
9936
9937	// webkit enumerates style porperties
9938	if (style && style.length && style[0] && style[style[0]]) {
9939		var len = style.length;
9940		while (len--) {
9941			key = style[len];
9942			if (typeof style[key] == 'string') {
9943				camelCase = key.replace(/\-(\w)/g, function(all, letter){
9944					return letter.toUpperCase();
9945				});
9946				newStyle[camelCase] = style[key];
9947			}
9948		}
9949	} else {
9950		for (key in style) {
9951			if (typeof style[key] === 'string') {
9952				newStyle[key] = style[key];
9953			}
9954		}
9955	}
9956
9957	return newStyle;
9958}
9959
9960function filterStyles(styles) {
9961	var name, value;
9962	for (name in styles) {
9963		value = styles[name];
9964		if (
9965			// ignore null and undefined values
9966			value == null ||
9967			// ignore functions (when does this occur?)
9968			$.isFunction(value) ||
9969			// shorthand styles that need to be expanded
9970			name in shorthandStyles ||
9971			// ignore scrollbars (break in IE)
9972			(/scrollbar/).test(name) ||
9973
9974			// only colors or values that can be converted to numbers
9975			(!(/color/i).test(name) && isNaN(parseFloat(value)))
9976		) {
9977			delete styles[name];
9978		}
9979	}
9980
9981	return styles;
9982}
9983
9984function styleDifference(oldStyle, newStyle) {
9985	var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
9986		name;
9987
9988	for (name in newStyle) {
9989		if (oldStyle[name] != newStyle[name]) {
9990			diff[name] = newStyle[name];
9991		}
9992	}
9993
9994	return diff;
9995}
9996
9997$.effects.animateClass = function(value, duration, easing, callback) {
9998	if ($.isFunction(easing)) {
9999		callback = easing;
10000		easing = null;
10001	}
10002
10003	return this.each(function() {
10004
10005		var that = $(this),
10006			originalStyleAttr = that.attr('style') || ' ',
10007			originalStyle = filterStyles(getElementStyles.call(this)),
10008			newStyle,
10009			className = that.attr('className');
10010
10011		$.each(classAnimationActions, function(i, action) {
10012			if (value[action]) {
10013				that[action + 'Class'](value[action]);
10014			}
10015		});
10016		newStyle = filterStyles(getElementStyles.call(this));
10017		that.attr('className', className);
10018
10019		that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
10020			$.each(classAnimationActions, function(i, action) {
10021				if (value[action]) { that[action + 'Class'](value[action]); }
10022			});
10023			// work around bug in IE by clearing the cssText before setting it
10024			if (typeof that.attr('style') == 'object') {
10025				that.attr('style').cssText = '';
10026				that.attr('style').cssText = originalStyleAttr;
10027			} else {
10028				that.attr('style', originalStyleAttr);
10029			}
10030			if (callback) { callback.apply(this, arguments); }
10031		});
10032	});
10033};
10034
10035$.fn.extend({
10036	_addClass: $.fn.addClass,
10037	addClass: function(classNames, speed, easing, callback) {
10038		return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
10039	},
10040
10041	_removeClass: $.fn.removeClass,
10042	removeClass: function(classNames,speed,easing,callback) {
10043		return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
10044	},
10045
10046	_toggleClass: $.fn.toggleClass,
10047	toggleClass: function(classNames, force, speed, easing, callback) {
10048		if ( typeof force == "boolean" || force === undefined ) {
10049			if ( !speed ) {
10050				// without speed parameter;
10051				return this._toggleClass(classNames, force);
10052			} else {
10053				return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
10054			}
10055		} else {
10056			// without switch parameter;
10057			return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
10058		}
10059	},
10060
10061	switchClass: function(remove,add,speed,easing,callback) {
10062		return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
10063	}
10064});
10065
10066
10067
10068/******************************************************************************/
10069/*********************************** EFFECTS **********************************/
10070/******************************************************************************/
10071
10072$.extend($.effects, {
10073	version: "1.8.4",
10074
10075	// Saves a set of properties in a data storage
10076	save: function(element, set) {
10077		for(var i=0; i < set.length; i++) {
10078			if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
10079		}
10080	},
10081
10082	// Restores a set of previously saved properties from a data storage
10083	restore: function(element, set) {
10084		for(var i=0; i < set.length; i++) {
10085			if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
10086		}
10087	},
10088
10089	setMode: function(el, mode) {
10090		if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
10091		return mode;
10092	},
10093
10094	getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
10095		// this should be a little more flexible in the future to handle a string & hash
10096		var y, x;
10097		switch (origin[0]) {
10098			case 'top': y = 0; break;
10099			case 'middle': y = 0.5; break;
10100			case 'bottom': y = 1; break;
10101			default: y = origin[0] / original.height;
10102		};
10103		switch (origin[1]) {
10104			case 'left': x = 0; break;
10105			case 'center': x = 0.5; break;
10106			case 'right': x = 1; break;
10107			default: x = origin[1] / original.width;
10108		};
10109		return {x: x, y: y};
10110	},
10111
10112	// Wraps the element around a wrapper that copies position properties
10113	createWrapper: function(element) {
10114
10115		// if the element is already wrapped, return it
10116		if (element.parent().is('.ui-effects-wrapper')) {
10117			return element.parent();
10118		}
10119
10120		// wrap the element
10121		var props = {
10122				width: element.outerWidth(true),
10123				height: element.outerHeight(true),
10124				'float': element.css('float')
10125			},
10126			wrapper = $('<div></div>')
10127				.addClass('ui-effects-wrapper')
10128				.css({
10129					fontSize: '100%',
10130					background: 'transparent',
10131					border: 'none',
10132					margin: 0,
10133					padding: 0
10134				});
10135
10136		element.wrap(wrapper);
10137		wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
10138
10139		// transfer positioning properties to the wrapper
10140		if (element.css('position') == 'static') {
10141			wrapper.css({ position: 'relative' });
10142			element.css({ position: 'relative' });
10143		} else {
10144			$.extend(props, {
10145				position: element.css('position'),
10146				zIndex: element.css('z-index')
10147			});
10148			$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
10149				props[pos] = element.css(pos);
10150				if (isNaN(parseInt(props[pos], 10))) {
10151					props[pos] = 'auto';
10152				}
10153			});
10154			element.css({position: 'relative', top: 0, left: 0 });
10155		}
10156
10157		return wrapper.css(props).show();
10158	},
10159
10160	removeWrapper: function(element) {
10161		if (element.parent().is('.ui-effects-wrapper'))
10162			return element.parent().replaceWith(element);
10163		return element;
10164	},
10165
10166	setTransition: function(element, list, factor, value) {
10167		value = value || {};
10168		$.each(list, function(i, x){
10169			unit = element.cssUnit(x);
10170			if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
10171		});
10172		return value;
10173	}
10174});
10175
10176
10177function _normalizeArguments(effect, options, speed, callback) {
10178	// shift params for method overloading
10179	if (typeof effect == 'object') {
10180		callback = options;
10181		speed = null;
10182		options = effect;
10183		effect = options.effect;
10184	}
10185	if ($.isFunction(options)) {
10186		callback = options;
10187		speed = null;
10188		options = {};
10189	}
10190        if (typeof options == 'number' || $.fx.speeds[options]) {
10191		callback = speed;
10192		speed = options;
10193		options = {};
10194	}
10195	if ($.isFunction(speed)) {
10196		callback = speed;
10197		speed = null;
10198	}
10199
10200	options = options || {};
10201
10202	speed = speed || options.duration;
10203	speed = $.fx.off ? 0 : typeof speed == 'number'
10204		? speed : $.fx.speeds[speed] || $.fx.speeds._default;
10205
10206	callback = callback || options.complete;
10207
10208	return [effect, options, speed, callback];
10209}
10210
10211$.fn.extend({
10212	effect: function(effect, options, speed, callback) {
10213		var args = _normalizeArguments.apply(this, arguments),
10214			// TODO: make effects takes actual parameters instead of a hash
10215			args2 = {
10216				options: args[1],
10217				duration: args[2],
10218				callback: args[3]
10219			},
10220			effectMethod = $.effects[effect];
10221
10222		return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
10223	},
10224
10225	_show: $.fn.show,
10226	show: function(speed) {
10227		if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
10228			return this._show.apply(this, arguments);
10229		} else {
10230			var args = _normalizeArguments.apply(this, arguments);
10231			args[1].mode = 'show';
10232			return this.effect.apply(this, args);
10233		}
10234	},
10235
10236	_hide: $.fn.hide,
10237	hide: function(speed) {
10238		if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
10239			return this._hide.apply(this, arguments);
10240		} else {
10241			var args = _normalizeArguments.apply(this, arguments);
10242			args[1].mode = 'hide';
10243			return this.effect.apply(this, args);
10244		}
10245	},
10246
10247	// jQuery core overloads toggle and create _toggle
10248	__toggle: $.fn.toggle,
10249	toggle: function(speed) {
10250		if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
10251			typeof speed == 'boolean' || $.isFunction(speed)) {
10252			return this.__toggle.apply(this, arguments);
10253		} else {
10254			var args = _normalizeArguments.apply(this, arguments);
10255			args[1].mode = 'toggle';
10256			return this.effect.apply(this, args);
10257		}
10258	},
10259
10260	// helper functions
10261	cssUnit: function(key) {
10262		var style = this.css(key), val = [];
10263		$.each( ['em','px','%','pt'], function(i, unit){
10264			if(style.indexOf(unit) > 0)
10265				val = [parseFloat(style), unit];
10266		});
10267		return val;
10268	}
10269});
10270
10271
10272
10273/******************************************************************************/
10274/*********************************** EASING ***********************************/
10275/******************************************************************************/
10276
10277/*
10278 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
10279 *
10280 * Uses the built in easing capabilities added In jQuery 1.1
10281 * to offer multiple easing options
10282 *
10283 * TERMS OF USE - jQuery Easing
10284 *
10285 * Open source under the BSD License.
10286 *
10287 * Copyright 2008 George McGinley Smith
10288 * All rights reserved.
10289 *
10290 * Redistribution and use in source and binary forms, with or without modification,
10291 * are permitted provided that the following conditions are met:
10292 *
10293 * Redistributions of source code must retain the above copyright notice, this list of
10294 * conditions and the following disclaimer.
10295 * Redistributions in binary form must reproduce the above copyright notice, this list
10296 * of conditions and the following disclaimer in the documentation and/or other materials
10297 * provided with the distribution.
10298 *
10299 * Neither the name of the author nor the names of contributors may be used to endorse
vendor: 5,639 bytes, lines 10300-10451
10300 * or promote products derived from this software without specific prior written permission.
10301 *
10302 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
10303 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
10304 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
10305 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
10306 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
10307 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
10308 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10309 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
10310 * OF THE POSSIBILITY OF SUCH DAMAGE.
10311 *
10312*/
10313
10314// t: current time, b: begInnIng value, c: change In value, d: duration
10315$.easing.jswing = $.easing.swing;
10316
10317$.extend($.easing,
10318{
10319	def: 'easeOutQuad',
10320	swing: function (x, t, b, c, d) {
10321		//alert($.easing.default);
10322		return $.easing[$.easing.def](x, t, b, c, d);
10323	},
10324	easeInQuad: function (x, t, b, c, d) {
10325		return c*(t/=d)*t + b;
10326	},
10327	easeOutQuad: function (x, t, b, c, d) {
10328		return -c *(t/=d)*(t-2) + b;
10329	},
10330	easeInOutQuad: function (x, t, b, c, d) {
10331		if ((t/=d/2) < 1) return c/2*t*t + b;
10332		return -c/2 * ((--t)*(t-2) - 1) + b;
10333	},
10334	easeInCubic: function (x, t, b, c, d) {
10335		return c*(t/=d)*t*t + b;
10336	},
10337	easeOutCubic: function (x, t, b, c, d) {
10338		return c*((t=t/d-1)*t*t + 1) + b;
10339	},
10340	easeInOutCubic: function (x, t, b, c, d) {
10341		if ((t/=d/2) < 1) return c/2*t*t*t + b;
10342		return c/2*((t-=2)*t*t + 2) + b;
10343	},
10344	easeInQuart: function (x, t, b, c, d) {
10345		return c*(t/=d)*t*t*t + b;
10346	},
10347	easeOutQuart: function (x, t, b, c, d) {
10348		return -c * ((t=t/d-1)*t*t*t - 1) + b;
10349	},
10350	easeInOutQuart: function (x, t, b, c, d) {
10351		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
10352		return -c/2 * ((t-=2)*t*t*t - 2) + b;
10353	},
10354	easeInQuint: function (x, t, b, c, d) {
10355		return c*(t/=d)*t*t*t*t + b;
10356	},
10357	easeOutQuint: function (x, t, b, c, d) {
10358		return c*((t=t/d-1)*t*t*t*t + 1) + b;
10359	},
10360	easeInOutQuint: function (x, t, b, c, d) {
10361		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
10362		return c/2*((t-=2)*t*t*t*t + 2) + b;
10363	},
10364	easeInSine: function (x, t, b, c, d) {
10365		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
10366	},
10367	easeOutSine: function (x, t, b, c, d) {
10368		return c * Math.sin(t/d * (Math.PI/2)) + b;
10369	},
10370	easeInOutSine: function (x, t, b, c, d) {
10371		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
10372	},
10373	easeInExpo: function (x, t, b, c, d) {
10374		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
10375	},
10376	easeOutExpo: function (x, t, b, c, d) {
10377		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
10378	},
10379	easeInOutExpo: function (x, t, b, c, d) {
10380		if (t==0) return b;
10381		if (t==d) return b+c;
10382		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
10383		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
10384	},
10385	easeInCirc: function (x, t, b, c, d) {
10386		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
10387	},
10388	easeOutCirc: function (x, t, b, c, d) {
10389		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
10390	},
10391	easeInOutCirc: function (x, t, b, c, d) {
10392		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
10393		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
10394	},
10395	easeInElastic: function (x, t, b, c, d) {
10396		var s=1.70158;var p=0;var a=c;
10397		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
10398		if (a < Math.abs(c)) { a=c; var s=p/4; }
10399		else var s = p/(2*Math.PI) * Math.asin (c/a);
10400		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
10401	},
10402	easeOutElastic: function (x, t, b, c, d) {
10403		var s=1.70158;var p=0;var a=c;
10404		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
10405		if (a < Math.abs(c)) { a=c; var s=p/4; }
10406		else var s = p/(2*Math.PI) * Math.asin (c/a);
10407		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
10408	},
10409	easeInOutElastic: function (x, t, b, c, d) {
10410		var s=1.70158;var p=0;var a=c;
10411		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
10412		if (a < Math.abs(c)) { a=c; var s=p/4; }
10413		else var s = p/(2*Math.PI) * Math.asin (c/a);
10414		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
10415		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
10416	},
10417	easeInBack: function (x, t, b, c, d, s) {
10418		if (s == undefined) s = 1.70158;
10419		return c*(t/=d)*t*((s+1)*t - s) + b;
10420	},
10421	easeOutBack: function (x, t, b, c, d, s) {
10422		if (s == undefined) s = 1.70158;
10423		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
10424	},
10425	easeInOutBack: function (x, t, b, c, d, s) {
10426		if (s == undefined) s = 1.70158;
10427		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
10428		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
10429	},
10430	easeInBounce: function (x, t, b, c, d) {
10431		return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
10432	},
10433	easeOutBounce: function (x, t, b, c, d) {
10434		if ((t/=d) < (1/2.75)) {
10435			return c*(7.5625*t*t) + b;
10436		} else if (t < (2/2.75)) {
10437			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
10438		} else if (t < (2.5/2.75)) {
10439			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
10440		} else {
10441			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
10442		}
10443	},
10444	easeInOutBounce: function (x, t, b, c, d) {
10445		if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
10446		return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
10447	}
10448});
10449
10450/*
10451 *
10452 * TERMS OF USE - EASING EQUATIONS
10453 *
10454 * Open source under the BSD License.
10455 *
10456 * Copyright 2001 Robert Penner
10457 * All rights reserved.
10458 *
10459 * Redistribution and use in source and binary forms, with or without modification,
10460 * are permitted provided that the following conditions are met:
10461 *
10462 * Redistributions of source code must retain the above copyright notice, this list of
10463 * conditions and the following disclaimer.
10464 * Redistributions in binary form must reproduce the above copyright notice, this list
10465 * of conditions and the following disclaimer in the documentation and/or other materials
10466 * provided with the distribution.
10467 *
10468 * Neither the name of the author nor the names of contributors may be used to endorse
10469 * or promote products derived from this software without specific prior written permission.
10470 *
10471 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
10472 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
10473 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
10474 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
10475 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
10476 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
10477 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10478 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
10479 * OF THE POSSIBILITY OF SUCH DAMAGE.
10480 *
10481 */
10482
10483})(jQuery);
10484/*
10485 * jQuery UI Effects Blind 1.8.4
10486 *
10487 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10488 * Dual licensed under the MIT or GPL Version 2 licenses.
10489 * http://jquery.org/license
10490 *
10491 * http://docs.jquery.com/UI/Effects/Blind
10492 *
10493 * Depends:
10494 *	jquery.effects.core.js
10495 */
10496(function( $, undefined ) {
10497
10498$.effects.blind = function(o) {
10499
10500	return this.queue(function() {
10501
10502		// Create element
10503		var el = $(this), props = ['position','top','left'];
10504
10505		// Set options
10506		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
10507		var direction = o.options.direction || 'vertical'; // Default direction
10508
10509		// Adjust
10510		$.effects.save(el, props); el.show(); // Save & Show
10511		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
10512		var ref = (direction == 'vertical') ? 'height' : 'width';
10513		var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
10514		if(mode == 'show') wrapper.css(ref, 0); // Shift
10515
10516		// Animation
10517		var animation = {};
10518		animation[ref] = mode == 'show' ? distance : 0;
10519
10520		// Animate
10521		wrapper.animate(animation, o.duration, o.options.easing, function() {
10522			if(mode == 'hide') el.hide(); // Hide
10523			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10524			if(o.callback) o.callback.apply(el[0], arguments); // Callback
10525			el.dequeue();
10526		});
10527
10528	});
10529
10530};
10531
10532})(jQuery);
10533/*
10534 * jQuery UI Effects Bounce 1.8.4
10535 *
10536 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10537 * Dual licensed under the MIT or GPL Version 2 licenses.
10538 * http://jquery.org/license
10539 *
10540 * http://docs.jquery.com/UI/Effects/Bounce
10541 *
10542 * Depends:
10543 *	jquery.effects.core.js
10544 */
10545(function( $, undefined ) {
10546
10547$.effects.bounce = function(o) {
10548
10549	return this.queue(function() {
10550
10551		// Create element
10552		var el = $(this), props = ['position','top','left'];
10553
10554		// Set options
10555		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
10556		var direction = o.options.direction || 'up'; // Default direction
10557		var distance = o.options.distance || 20; // Default distance
10558		var times = o.options.times || 5; // Default # of times
10559		var speed = o.duration || 250; // Default speed per bounce
10560		if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
10561
10562		// Adjust
10563		$.effects.save(el, props); el.show(); // Save & Show
10564		$.effects.createWrapper(el); // Create Wrapper
10565		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
10566		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
10567		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
10568		if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
10569		if (mode == 'hide') distance = distance / (times * 2);
10570		if (mode != 'hide') times--;
10571
10572		// Animate
10573		if (mode == 'show') { // Show Bounce
10574			var animation = {opacity: 1};
10575			animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
10576			el.animate(animation, speed / 2, o.options.easing);
10577			distance = distance / 2;
10578			times--;
10579		};
10580		for (var i = 0; i < times; i++) { // Bounces
10581			var animation1 = {}, animation2 = {};
10582			animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
10583			animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
10584			el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
10585			distance = (mode == 'hide') ? distance * 2 : distance / 2;
10586		};
10587		if (mode == 'hide') { // Last Bounce
10588			var animation = {opacity: 0};
10589			animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;
10590			el.animate(animation, speed / 2, o.options.easing, function(){
10591				el.hide(); // Hide
10592				$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10593				if(o.callback) o.callback.apply(this, arguments); // Callback
10594			});
10595		} else {
10596			var animation1 = {}, animation2 = {};
10597			animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
10598			animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
10599			el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
10600				$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10601				if(o.callback) o.callback.apply(this, arguments); // Callback
10602			});
10603		};
10604		el.queue('fx', function() { el.dequeue(); });
10605		el.dequeue();
10606	});
10607
10608};
10609
10610})(jQuery);
10611/*
10612 * jQuery UI Effects Clip 1.8.4
10613 *
10614 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10615 * Dual licensed under the MIT or GPL Version 2 licenses.
10616 * http://jquery.org/license
10617 *
10618 * http://docs.jquery.com/UI/Effects/Clip
10619 *
10620 * Depends:
10621 *	jquery.effects.core.js
10622 */
10623(function( $, undefined ) {
10624
10625$.effects.clip = function(o) {
10626
10627	return this.queue(function() {
10628
10629		// Create element
10630		var el = $(this), props = ['position','top','left','height','width'];
10631
10632		// Set options
10633		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
10634		var direction = o.options.direction || 'vertical'; // Default direction
10635
10636		// Adjust
10637		$.effects.save(el, props); el.show(); // Save & Show
10638		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
10639		var animate = el[0].tagName == 'IMG' ? wrapper : el;
10640		var ref = {
10641			size: (direction == 'vertical') ? 'height' : 'width',
10642			position: (direction == 'vertical') ? 'top' : 'left'
10643		};
10644		var distance = (direction == 'vertical') ? animate.height() : animate.width();
10645		if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
10646
10647		// Animation
10648		var animation = {};
10649		animation[ref.size] = mode == 'show' ? distance : 0;
10650		animation[ref.position] = mode == 'show' ? 0 : distance / 2;
10651
10652		// Animate
10653		animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
10654			if(mode == 'hide') el.hide(); // Hide
10655			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10656			if(o.callback) o.callback.apply(el[0], arguments); // Callback
10657			el.dequeue();
10658		}});
10659
10660	});
10661
10662};
10663
10664})(jQuery);
10665/*
10666 * jQuery UI Effects Drop 1.8.4
10667 *
10668 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10669 * Dual licensed under the MIT or GPL Version 2 licenses.
10670 * http://jquery.org/license
10671 *
10672 * http://docs.jquery.com/UI/Effects/Drop
10673 *
10674 * Depends:
10675 *	jquery.effects.core.js
10676 */
10677(function( $, undefined ) {
10678
10679$.effects.drop = function(o) {
10680
10681	return this.queue(function() {
10682
10683		// Create element
10684		var el = $(this), props = ['position','top','left','opacity'];
10685
10686		// Set options
10687		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
10688		var direction = o.options.direction || 'left'; // Default Direction
10689
10690		// Adjust
10691		$.effects.save(el, props); el.show(); // Save & Show
10692		$.effects.createWrapper(el); // Create Wrapper
10693		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
10694		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
10695		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
10696		if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
10697
10698		// Animation
10699		var animation = {opacity: mode == 'show' ? 1 : 0};
10700		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
10701
10702		// Animate
10703		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
10704			if(mode == 'hide') el.hide(); // Hide
10705			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10706			if(o.callback) o.callback.apply(this, arguments); // Callback
10707			el.dequeue();
10708		}});
10709
10710	});
10711
10712};
10713
10714})(jQuery);
10715/*
10716 * jQuery UI Effects Explode 1.8.4
10717 *
10718 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10719 * Dual licensed under the MIT or GPL Version 2 licenses.
10720 * http://jquery.org/license
10721 *
10722 * http://docs.jquery.com/UI/Effects/Explode
10723 *
10724 * Depends:
10725 *	jquery.effects.core.js
10726 */
10727(function( $, undefined ) {
10728
10729$.effects.explode = function(o) {
10730
10731	return this.queue(function() {
10732
10733	var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
10734	var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
10735
10736	o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
10737	var el = $(this).show().css('visibility', 'hidden');
10738	var offset = el.offset();
10739
10740	//Substract the margins - not fixing the problem yet.
10741	offset.top -= parseInt(el.css("marginTop"),10) || 0;
10742	offset.left -= parseInt(el.css("marginLeft"),10) || 0;
10743
10744	var width = el.outerWidth(true);
10745	var height = el.outerHeight(true);
10746
10747	for(var i=0;i<rows;i++) { // =
10748		for(var j=0;j<cells;j++) { // ||
10749			el
10750				.clone()
10751				.appendTo('body')
10752				.wrap('<div></div>')
10753				.css({
10754					position: 'absolute',
10755					visibility: 'visible',
10756					left: -j*(width/cells),
10757					top: -i*(height/rows)
10758				})
10759				.parent()
10760				.addClass('ui-effects-explode')
10761				.css({
10762					position: 'absolute',
10763					overflow: 'hidden',
10764					width: width/cells,
10765					height: height/rows,
10766					left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
10767					top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
10768					opacity: o.options.mode == 'show' ? 0 : 1
10769				}).animate({
10770					left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
10771					top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
10772					opacity: o.options.mode == 'show' ? 1 : 0
10773				}, o.duration || 500);
10774		}
10775	}
10776
10777	// Set a timeout, to call the callback approx. when the other animations have finished
10778	setTimeout(function() {
10779
10780		o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
10781				if(o.callback) o.callback.apply(el[0]); // Callback
10782				el.dequeue();
10783
10784				$('div.ui-effects-explode').remove();
10785
10786	}, o.duration || 500);
10787
10788
10789	});
10790
10791};
10792
10793})(jQuery);
10794/*
10795 * jQuery UI Effects Fold 1.8.4
10796 *
10797 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10798 * Dual licensed under the MIT or GPL Version 2 licenses.
10799 * http://jquery.org/license
10800 *
10801 * http://docs.jquery.com/UI/Effects/Fold
10802 *
10803 * Depends:
10804 *	jquery.effects.core.js
10805 */
10806(function( $, undefined ) {
10807
10808$.effects.fold = function(o) {
10809
10810	return this.queue(function() {
10811
10812		// Create element
10813		var el = $(this), props = ['position','top','left'];
10814
10815		// Set options
10816		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
10817		var size = o.options.size || 15; // Default fold size
10818		var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
10819		var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
10820
10821		// Adjust
10822		$.effects.save(el, props); el.show(); // Save & Show
10823		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
10824		var widthFirst = ((mode == 'show') != horizFirst);
10825		var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
10826		var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
10827		var percent = /([0-9]+)%/.exec(size);
10828		if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
10829		if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
10830
10831		// Animation
10832		var animation1 = {}, animation2 = {};
10833		animation1[ref[0]] = mode == 'show' ? distance[0] : size;
10834		animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
10835
10836		// Animate
10837		wrapper.animate(animation1, duration, o.options.easing)
10838		.animate(animation2, duration, o.options.easing, function() {
10839			if(mode == 'hide') el.hide(); // Hide
10840			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10841			if(o.callback) o.callback.apply(el[0], arguments); // Callback
10842			el.dequeue();
10843		});
10844
10845	});
10846
10847};
10848
10849})(jQuery);
10850/*
10851 * jQuery UI Effects Highlight 1.8.4
10852 *
10853 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10854 * Dual licensed under the MIT or GPL Version 2 licenses.
10855 * http://jquery.org/license
10856 *
10857 * http://docs.jquery.com/UI/Effects/Highlight
10858 *
10859 * Depends:
10860 *	jquery.effects.core.js
10861 */
10862(function( $, undefined ) {
10863
10864$.effects.highlight = function(o) {
10865	return this.queue(function() {
10866		var elem = $(this),
10867			props = ['backgroundImage', 'backgroundColor', 'opacity'],
10868			mode = $.effects.setMode(elem, o.options.mode || 'show'),
10869			animation = {
10870				backgroundColor: elem.css('backgroundColor')
10871			};
10872
10873		if (mode == 'hide') {
10874			animation.opacity = 0;
10875		}
10876
10877		$.effects.save(elem, props);
10878		elem
10879			.show()
10880			.css({
10881				backgroundImage: 'none',
10882				backgroundColor: o.options.color || '#ffff99'
10883			})
10884			.animate(animation, {
10885				queue: false,
10886				duration: o.duration,
10887				easing: o.options.easing,
10888				complete: function() {
10889					(mode == 'hide' && elem.hide());
10890					$.effects.restore(elem, props);
10891					(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
10892					(o.callback && o.callback.apply(this, arguments));
10893					elem.dequeue();
10894				}
10895			});
10896	});
10897};
10898
10899})(jQuery);
10900/*
10901 * jQuery UI Effects Pulsate 1.8.4
10902 *
10903 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10904 * Dual licensed under the MIT or GPL Version 2 licenses.
10905 * http://jquery.org/license
10906 *
10907 * http://docs.jquery.com/UI/Effects/Pulsate
10908 *
10909 * Depends:
10910 *	jquery.effects.core.js
10911 */
10912(function( $, undefined ) {
10913
10914$.effects.pulsate = function(o) {
10915	return this.queue(function() {
10916		var elem = $(this),
10917			mode = $.effects.setMode(elem, o.options.mode || 'show');
10918			times = ((o.options.times || 5) * 2) - 1;
10919			duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
10920			isVisible = elem.is(':visible'),
10921			animateTo = 0;
10922
10923		if (!isVisible) {
10924			elem.css('opacity', 0).show();
10925			animateTo = 1;
10926		}
10927
10928		if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
10929			times--;
10930		}
10931
10932		for (var i = 0; i < times; i++) {
10933			elem.animate({ opacity: animateTo }, duration, o.options.easing);
10934			animateTo = (animateTo + 1) % 2;
10935		}
10936
10937		elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
10938			if (animateTo == 0) {
10939				elem.hide();
10940			}
10941			(o.callback && o.callback.apply(this, arguments));
10942		});
10943
10944		elem
10945			.queue('fx', function() { elem.dequeue(); })
10946			.dequeue();
10947	});
10948};
10949
10950})(jQuery);
10951/*
10952 * jQuery UI Effects Scale 1.8.4
10953 *
10954 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
10955 * Dual licensed under the MIT or GPL Version 2 licenses.
10956 * http://jquery.org/license
10957 *
10958 * http://docs.jquery.com/UI/Effects/Scale
10959 *
10960 * Depends:
10961 *	jquery.effects.core.js
10962 */
10963(function( $, undefined ) {
10964
10965$.effects.puff = function(o) {
10966	return this.queue(function() {
10967		var elem = $(this),
10968			mode = $.effects.setMode(elem, o.options.mode || 'hide'),
10969			percent = parseInt(o.options.percent, 10) || 150,
10970			factor = percent / 100,
10971			original = { height: elem.height(), width: elem.width() };
10972
10973		$.extend(o.options, {
10974			fade: true,
10975			mode: mode,
10976			percent: mode == 'hide' ? percent : 100,
10977			from: mode == 'hide'
10978				? original
10979				: {
10980					height: original.height * factor,
10981					width: original.width * factor
10982				}
10983		});
10984
10985		elem.effect('scale', o.options, o.duration, o.callback);
10986		elem.dequeue();
10987	});
10988};
10989
10990$.effects.scale = function(o) {
10991
10992	return this.queue(function() {
10993
10994		// Create element
10995		var el = $(this);
10996
10997		// Set options
10998		var options = $.extend(true, {}, o.options);
10999		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11000		var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
11001		var direction = o.options.direction || 'both'; // Set default axis
11002		var origin = o.options.origin; // The origin of the scaling
11003		if (mode != 'effect') { // Set default origin and restore for show/hide
11004			options.origin = origin || ['middle','center'];
11005			options.restore = true;
11006		}
11007		var original = {height: el.height(), width: el.width()}; // Save original
11008		el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
11009
11010		// Adjust
11011		var factor = { // Set scaling factor
11012			y: direction != 'horizontal' ? (percent / 100) : 1,
11013			x: direction != 'vertical' ? (percent / 100) : 1
11014		};
11015		el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
11016
11017		if (o.options.fade) { // Fade option to support puff
11018			if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
11019			if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
11020		};
11021
11022		// Animation
11023		options.from = el.from; options.to = el.to; options.mode = mode;
11024
11025		// Animate
11026		el.effect('size', options, o.duration, o.callback);
11027		el.dequeue();
11028	});
11029
11030};
11031
11032$.effects.size = function(o) {
11033
11034	return this.queue(function() {
11035
11036		// Create element
11037		var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
11038		var props1 = ['position','top','left','overflow','opacity']; // Always restore
11039		var props2 = ['width','height','overflow']; // Copy for children
11040		var cProps = ['fontSize'];
11041		var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
11042		var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
11043
11044		// Set options
11045		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11046		var restore = o.options.restore || false; // Default restore
11047		var scale = o.options.scale || 'both'; // Default scale mode
11048		var origin = o.options.origin; // The origin of the sizing
11049		var original = {height: el.height(), width: el.width()}; // Save original
11050		el.from = o.options.from || original; // Default from state
11051		el.to = o.options.to || original; // Default to state
11052		// Adjust
11053		if (origin) { // Calculate baseline shifts
11054			var baseline = $.effects.getBaseline(origin, original);
11055			el.from.top = (original.height - el.from.height) * baseline.y;
11056			el.from.left = (original.width - el.from.width) * baseline.x;
11057			el.to.top = (original.height - el.to.height) * baseline.y;
11058			el.to.left = (original.width - el.to.width) * baseline.x;
11059		};
11060		var factor = { // Set scaling factor
11061			from: {y: el.from.height / original.height, x: el.from.width / original.width},
11062			to: {y: el.to.height / original.height, x: el.to.width / original.width}
11063		};
11064		if (scale == 'box' || scale == 'both') { // Scale the css box
11065			if (factor.from.y != factor.to.y) { // Vertical props scaling
11066				props = props.concat(vProps);
11067				el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
11068				el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
11069			};
11070			if (factor.from.x != factor.to.x) { // Horizontal props scaling
11071				props = props.concat(hProps);
11072				el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
11073				el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
11074			};
11075		};
11076		if (scale == 'content' || scale == 'both') { // Scale the content
11077			if (factor.from.y != factor.to.y) { // Vertical props scaling
11078				props = props.concat(cProps);
11079				el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
11080				el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
11081			};
11082		};
11083		$.effects.save(el, restore ? props : props1); el.show(); // Save & Show
11084		$.effects.createWrapper(el); // Create Wrapper
11085		el.css('overflow','hidden').css(el.from); // Shift
11086
11087		// Animate
11088		if (scale == 'content' || scale == 'both') { // Scale the children
11089			vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
11090			hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
11091			props2 = props.concat(vProps).concat(hProps); // Concat
11092			el.find("*[width]").each(function(){
11093				child = $(this);
11094				if (restore) $.effects.save(child, props2);
11095				var c_original = {height: child.height(), width: child.width()}; // Save original
11096				child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
11097				child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
11098				if (factor.from.y != factor.to.y) { // Vertical props scaling
11099					child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
11100					child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
11101				};
11102				if (factor.from.x != factor.to.x) { // Horizontal props scaling
11103					child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
11104					child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
11105				};
11106				child.css(child.from); // Shift children
11107				child.animate(child.to, o.duration, o.options.easing, function(){
11108					if (restore) $.effects.restore(child, props2); // Restore children
11109				}); // Animate children
11110			});
11111		};
11112
11113		// Animate
11114		el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11115			if (el.to.opacity === 0) {
11116				el.css('opacity', el.from.opacity);
11117			}
11118			if(mode == 'hide') el.hide(); // Hide
11119			$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
11120			if(o.callback) o.callback.apply(this, arguments); // Callback
11121			el.dequeue();
11122		}});
11123
11124	});
11125
11126};
11127
11128})(jQuery);
11129/*
11130 * jQuery UI Effects Shake 1.8.4
11131 *
11132 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
11133 * Dual licensed under the MIT or GPL Version 2 licenses.
11134 * http://jquery.org/license
11135 *
11136 * http://docs.jquery.com/UI/Effects/Shake
11137 *
11138 * Depends:
11139 *	jquery.effects.core.js
11140 */
11141(function( $, undefined ) {
11142
11143$.effects.shake = function(o) {
11144
11145	return this.queue(function() {
11146
11147		// Create element
11148		var el = $(this), props = ['position','top','left'];
11149
11150		// Set options
11151		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11152		var direction = o.options.direction || 'left'; // Default direction
11153		var distance = o.options.distance || 20; // Default distance
11154		var times = o.options.times || 3; // Default # of times
11155		var speed = o.duration || o.options.duration || 140; // Default speed per shake
11156
11157		// Adjust
11158		$.effects.save(el, props); el.show(); // Save & Show
11159		$.effects.createWrapper(el); // Create Wrapper
11160		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
11161		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
11162
11163		// Animation
11164		var animation = {}, animation1 = {}, animation2 = {};
11165		animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;
11166		animation1[ref] = (motion == 'pos' ? '+=' : '-=')  + distance * 2;
11167		animation2[ref] = (motion == 'pos' ? '-=' : '+=')  + distance * 2;
11168
11169		// Animate
11170		el.animate(animation, speed, o.options.easing);
11171		for (var i = 1; i < times; i++) { // Shakes
11172			el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
11173		};
11174		el.animate(animation1, speed, o.options.easing).
11175		animate(animation, speed / 2, o.options.easing, function(){ // Last shake
11176			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11177			if(o.callback) o.callback.apply(this, arguments); // Callback
11178		});
11179		el.queue('fx', function() { el.dequeue(); });
11180		el.dequeue();
11181	});
11182
11183};
11184
11185})(jQuery);
11186/*
11187 * jQuery UI Effects Slide 1.8.4
11188 *
11189 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
11190 * Dual licensed under the MIT or GPL Version 2 licenses.
11191 * http://jquery.org/license
11192 *
11193 * http://docs.jquery.com/UI/Effects/Slide
11194 *
11195 * Depends:
11196 *	jquery.effects.core.js
11197 */
11198(function( $, undefined ) {
11199
11200$.effects.slide = function(o) {
11201
11202	return this.queue(function() {
11203
11204		// Create element
11205		var el = $(this), props = ['position','top','left'];
11206
11207		// Set options
11208		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
11209		var direction = o.options.direction || 'left'; // Default Direction
11210
11211		// Adjust
11212		$.effects.save(el, props); el.show(); // Save & Show
11213		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
11214		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
11215		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
11216		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
11217		if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
11218
11219		// Animation
11220		var animation = {};
11221		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
11222
11223		// Animate
11224		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11225			if(mode == 'hide') el.hide(); // Hide
11226			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11227			if(o.callback) o.callback.apply(this, arguments); // Callback
11228			el.dequeue();
11229		}});
11230
11231	});
11232
11233};
11234
11235})(jQuery);
11236/*
11237 * jQuery UI Effects Transfer 1.8.4
11238 *
11239 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
11240 * Dual licensed under the MIT or GPL Version 2 licenses.
11241 * http://jquery.org/license
11242 *
11243 * http://docs.jquery.com/UI/Effects/Transfer
11244 *
11245 * Depends:
11246 *	jquery.effects.core.js
11247 */
11248(function( $, undefined ) {
11249
11250$.effects.transfer = function(o) {
11251	return this.queue(function() {
11252		var elem = $(this),
11253			target = $(o.options.to),
11254			endPosition = target.offset(),
11255			animation = {
11256				top: endPosition.top,
11257				left: endPosition.left,
11258				height: target.innerHeight(),
11259				width: target.innerWidth()
11260			},
11261			startPosition = elem.offset(),
11262			transfer = $('<div class="ui-effects-transfer"></div>')
11263				.appendTo(document.body)
11264				.addClass(o.options.className)
11265				.css({
11266					top: startPosition.top,
11267					left: startPosition.left,
11268					height: elem.innerHeight(),
11269					width: elem.innerWidth(),
11270					position: 'absolute'
11271				})
11272				.animate(animation, o.duration, o.options.easing, function() {
11273					transfer.remove();
11274					(o.callback && o.callback.apply(elem[0], arguments));
11275					elem.dequeue();
11276				});
11277	});
11278};
11279
11280})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.