PageSourceSearch

https://phuketresortandspa.com/script/jquery-ui.js

js phuketresortandspa.com collected 2026-10-08 12:37:48 UTC 133,229 bytes, 4,021 lines download raw bytes

1/*! jQuery UI - v1.11.4 - 2016-05-21
2* http://jqueryui.com
3* Includes: core.js, widget.js, mouse.js, position.js, button.js, datepicker.js
4* Copyright
vendor: 32,932 bytes, lines 4-1203
4 jQuery Foundation and other contributors; Licensed MIT */
5
6(function( factory ) {
7	if ( typeof define === "function" && define.amd ) {
8
9		// AMD. Register as an anonymous module.
10		define([ "jquery" ], factory );
11	} else {
12
13		// Browser globals
14		factory( jQuery );
15	}
16}(function( $ ) {
17/*!
18 * jQuery UI Core 1.11.4
19 * http://jqueryui.com
20 *
21 * Copyright jQuery Foundation and other contributors
22 * Released under the MIT license.
23 * http://jquery.org/license
24 *
25 * http://api.jqueryui.com/category/ui-core/
26 */
27
28
29// $.ui might exist from components with no dependencies, e.g., $.ui.position
30$.ui = $.ui || {};
31
32$.extend( $.ui, {
33	version: "1.11.4",
34
35	keyCode: {
36		BACKSPACE: 8,
37		COMMA: 188,
38		DELETE: 46,
39		DOWN: 40,
40		END: 35,
41		ENTER: 13,
42		ESCAPE: 27,
43		HOME: 36,
44		LEFT: 37,
45		PAGE_DOWN: 34,
46		PAGE_UP: 33,
47		PERIOD: 190,
48		RIGHT: 39,
49		SPACE: 32,
50		TAB: 9,
51		UP: 38
52	}
53});
54
55// plugins
56$.fn.extend({
57	scrollParent: function( includeHidden ) {
58		var position = this.css( "position" ),
59			excludeStaticParent = position === "absolute",
60			overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
61			scrollParent = this.parents().filter( function() {
62				var parent = $( this );
63				if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
64					return false;
65				}
66				return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
67			}).eq( 0 );
68
69		return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
70	},
71
72	uniqueId: (function() {
73		var uuid = 0;
74
75		return function() {
76			return this.each(function() {
77				if ( !this.id ) {
78					this.id = "ui-id-" + ( ++uuid );
79				}
80			});
81		};
82	})(),
83
84	removeUniqueId: function() {
85		return this.each(function() {
86			if ( /^ui-id-\d+$/.test( this.id ) ) {
87				$( this ).removeAttr( "id" );
88			}
89		});
90	}
91});
92
93// selectors
94function focusable( element, isTabIndexNotNaN ) {
95	var map, mapName, img,
96		nodeName = element.nodeName.toLowerCase();
97	if ( "area" === nodeName ) {
98		map = element.parentNode;
99		mapName = map.name;
100		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
101			return false;
102		}
103		img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
104		return !!img && visible( img );
105	}
106	return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
107		!element.disabled :
108		"a" === nodeName ?
109			element.href || isTabIndexNotNaN :
110			isTabIndexNotNaN) &&
111		// the element and all of its ancestors must be visible
112		visible( element );
113}
114
115function visible( element ) {
116	return $.expr.filters.visible( element ) &&
117		!$( element ).parents().addBack().filter(function() {
118			return $.css( this, "visibility" ) === "hidden";
119		}).length;
120}
121
122$.extend( $.expr[ ":" ], {
123	data: $.expr.createPseudo ?
124		$.expr.createPseudo(function( dataName ) {
125			return function( elem ) {
126				return !!$.data( elem, dataName );
127			};
128		}) :
129		// support: jQuery <1.8
130		function( elem, i, match ) {
131			return !!$.data( elem, match[ 3 ] );
132		},
133
134	focusable: function( element ) {
135		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
136	},
137
138	tabbable: function( element ) {
139		var tabIndex = $.attr( element, "tabindex" ),
140			isTabIndexNaN = isNaN( tabIndex );
141		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
142	}
143});
144
145// support: jQuery <1.8
146if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
147	$.each( [ "Width", "Height" ], function( i, name ) {
148		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
149			type = name.toLowerCase(),
150			orig = {
151				innerWidth: $.fn.innerWidth,
152				innerHeight: $.fn.innerHeight,
153				outerWidth: $.fn.outerWidth,
154				outerHeight: $.fn.outerHeight
155			};
156
157		function reduce( elem, size, border, margin ) {
158			$.each( side, function() {
159				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
160				if ( border ) {
161					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
162				}
163				if ( margin ) {
164					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
165				}
166			});
167			return size;
168		}
169
170		$.fn[ "inner" + name ] = function( size ) {
171			if ( size === undefined ) {
172				return orig[ "inner" + name ].call( this );
173			}
174
175			return this.each(function() {
176				$( this ).css( type, reduce( this, size ) + "px" );
177			});
178		};
179
180		$.fn[ "outer" + name] = function( size, margin ) {
181			if ( typeof size !== "number" ) {
182				return orig[ "outer" + name ].call( this, size );
183			}
184
185			return this.each(function() {
186				$( this).css( type, reduce( this, size, true, margin ) + "px" );
187			});
188		};
189	});
190}
191
192// support: jQuery <1.8
193if ( !$.fn.addBack ) {
194	$.fn.addBack = function( selector ) {
195		return this.add( selector == null ?
196			this.prevObject : this.prevObject.filter( selector )
197		);
198	};
199}
200
201// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
202if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
203	$.fn.removeData = (function( removeData ) {
204		return function( key ) {
205			if ( arguments.length ) {
206				return removeData.call( this, $.camelCase( key ) );
207			} else {
208				return removeData.call( this );
209			}
210		};
211	})( $.fn.removeData );
212}
213
214// deprecated
215$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
216
217$.fn.extend({
218	focus: (function( orig ) {
219		return function( delay, fn ) {
220			return typeof delay === "number" ?
221				this.each(function() {
222					var elem = this;
223					setTimeout(function() {
224						$( elem ).focus();
225						if ( fn ) {
226							fn.call( elem );
227						}
228					}, delay );
229				}) :
230				orig.apply( this, arguments );
231		};
232	})( $.fn.focus ),
233
234	disableSelection: (function() {
235		var eventType = "onselectstart" in document.createElement( "div" ) ?
236			"selectstart" :
237			"mousedown";
238
239		return function() {
240			return this.bind( eventType + ".ui-disableSelection", function( event ) {
241				event.preventDefault();
242			});
243		};
244	})(),
245
246	enableSelection: function() {
247		return this.unbind( ".ui-disableSelection" );
248	},
249
250	zIndex: function( zIndex ) {
251		if ( zIndex !== undefined ) {
252			return this.css( "zIndex", zIndex );
253		}
254
255		if ( this.length ) {
256			var elem = $( this[ 0 ] ), position, value;
257			while ( elem.length && elem[ 0 ] !== document ) {
258				// Ignore z-index if position is set to a value where z-index is ignored by the browser
259				// This makes behavior of this function consistent across browsers
260				// WebKit always returns auto if the element is positioned
261				position = elem.css( "position" );
262				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
263					// IE returns 0 when zIndex is not specified
264					// other browsers return a string
265					// we ignore the case of nested elements with an explicit value of 0
266					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
267					value = parseInt( elem.css( "zIndex" ), 10 );
268					if ( !isNaN( value ) && value !== 0 ) {
269						return value;
270					}
271				}
272				elem = elem.parent();
273			}
274		}
275
276		return 0;
277	}
278});
279
280// $.ui.plugin is deprecated. Use $.widget() extensions instead.
281$.ui.plugin = {
282	add: function( module, option, set ) {
283		var i,
284			proto = $.ui[ module ].prototype;
285		for ( i in set ) {
286			proto.plugins[ i ] = proto.plugins[ i ] || [];
287			proto.plugins[ i ].push( [ option, set[ i ] ] );
288		}
289	},
290	call: function( instance, name, args, allowDisconnected ) {
291		var i,
292			set = instance.plugins[ name ];
293
294		if ( !set ) {
295			return;
296		}
297
298		if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
299			return;
300		}
301
302		for ( i = 0; i < set.length; i++ ) {
303			if ( instance.options[ set[ i ][ 0 ] ] ) {
304				set[ i ][ 1 ].apply( instance.element, args );
305			}
306		}
307	}
308};
309
310
311/*!
312 * jQuery UI Widget 1.11.4
313 * http://jqueryui.com
314 *
315 * Copyright jQuery Foundation and other contributors
316 * Released under the MIT license.
317 * http://jquery.org/license
318 *
319 * http://api.jqueryui.com/jQuery.widget/
320 */
321
322
323var widget_uuid = 0,
324	widget_slice = Array.prototype.slice;
325
326$.cleanData = (function( orig ) {
327	return function( elems ) {
328		var events, elem, i;
329		for ( i = 0; (elem = elems[i]) != null; i++ ) {
330			try {
331
332				// Only trigger remove when necessary to save time
333				events = $._data( elem, "events" );
334				if ( events && events.remove ) {
335					$( elem ).triggerHandler( "remove" );
336				}
337
338			// http://bugs.jquery.com/ticket/8235
339			} catch ( e ) {}
340		}
341		orig( elems );
342	};
343})( $.cleanData );
344
345$.widget = function( name, base, prototype ) {
346	var fullName, existingConstructor, constructor, basePrototype,
347		// proxiedPrototype allows the provided prototype to remain unmodified
348		// so that it can be used as a mixin for multiple widgets (#8876)
349		proxiedPrototype = {},
350		namespace = name.split( "." )[ 0 ];
351
352	name = name.split( "." )[ 1 ];
353	fullName = namespace + "-" + name;
354
355	if ( !prototype ) {
356		prototype = base;
357		base = $.Widget;
358	}
359
360	// create selector for plugin
361	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
362		return !!$.data( elem, fullName );
363	};
364
365	$[ namespace ] = $[ namespace ] || {};
366	existingConstructor = $[ namespace ][ name ];
367	constructor = $[ namespace ][ name ] = function( options, element ) {
368		// allow instantiation without "new" keyword
369		if ( !this._createWidget ) {
370			return new constructor( options, element );
371		}
372
373		// allow instantiation without initializing for simple inheritance
374		// must use "new" keyword (the code above always passes args)
375		if ( arguments.length ) {
376			this._createWidget( options, element );
377		}
378	};
379	// extend with the existing constructor to carry over any static properties
380	$.extend( constructor, existingConstructor, {
381		version: prototype.version,
382		// copy the object used to create the prototype in case we need to
383		// redefine the widget later
384		_proto: $.extend( {}, prototype ),
385		// track widgets that inherit from this widget in case this widget is
386		// redefined after a widget inherits from it
387		_childConstructors: []
388	});
389
390	basePrototype = new base();
391	// we need to make the options hash a property directly on the new instance
392	// otherwise we'll modify the options hash on the prototype that we're
393	// inheriting from
394	basePrototype.options = $.widget.extend( {}, basePrototype.options );
395	$.each( prototype, function( prop, value ) {
396		if ( !$.isFunction( value ) ) {
397			proxiedPrototype[ prop ] = value;
398			return;
399		}
400		proxiedPrototype[ prop ] = (function() {
401			var _super = function() {
402					return base.prototype[ prop ].apply( this, arguments );
403				},
404				_superApply = function( args ) {
405					return base.prototype[ prop ].apply( this, args );
406				};
407			return function() {
408				var __super = this._super,
409					__superApply = this._superApply,
410					returnValue;
411
412				this._super = _super;
413				this._superApply = _superApply;
414
415				returnValue = value.apply( this, arguments );
416
417				this._super = __super;
418				this._superApply = __superApply;
419
420				return returnValue;
421			};
422		})();
423	});
424	constructor.prototype = $.widget.extend( basePrototype, {
425		// TODO: remove support for widgetEventPrefix
426		// always use the name + a colon as the prefix, e.g., draggable:start
427		// don't prefix for widgets that aren't DOM-based
428		widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
429	}, proxiedPrototype, {
430		constructor: constructor,
431		namespace: namespace,
432		widgetName: name,
433		widgetFullName: fullName
434	});
435
436	// If this widget is being redefined then we need to find all widgets that
437	// are inheriting from it and redefine all of them so that they inherit from
438	// the new version of this widget. We're essentially trying to replace one
439	// level in the prototype chain.
440	if ( existingConstructor ) {
441		$.each( existingConstructor._childConstructors, function( i, child ) {
442			var childPrototype = child.prototype;
443
444			// redefine the child widget using the same prototype that was
445			// originally used, but inherit from the new version of the base
446			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
447		});
448		// remove the list of existing child constructors from the old constructor
449		// so the old child constructors can be garbage collected
450		delete existingConstructor._childConstructors;
451	} else {
452		base._childConstructors.push( constructor );
453	}
454
455	$.widget.bridge( name, constructor );
456
457	return constructor;
458};
459
460$.widget.extend = function( target ) {
461	var input = widget_slice.call( arguments, 1 ),
462		inputIndex = 0,
463		inputLength = input.length,
464		key,
465		value;
466	for ( ; inputIndex < inputLength; inputIndex++ ) {
467		for ( key in input[ inputIndex ] ) {
468			value = input[ inputIndex ][ key ];
469			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
470				// Clone objects
471				if ( $.isPlainObject( value ) ) {
472					target[ key ] = $.isPlainObject( target[ key ] ) ?
473						$.widget.extend( {}, target[ key ], value ) :
474						// Don't extend strings, arrays, etc. with objects
475						$.widget.extend( {}, value );
476				// Copy everything else by reference
477				} else {
478					target[ key ] = value;
479				}
480			}
481		}
482	}
483	return target;
484};
485
486$.widget.bridge = function( name, object ) {
487	var fullName = object.prototype.widgetFullName || name;
488	$.fn[ name ] = function( options ) {
489		var isMethodCall = typeof options === "string",
490			args = widget_slice.call( arguments, 1 ),
491			returnValue = this;
492
493		if ( isMethodCall ) {
494			this.each(function() {
495				var methodValue,
496					instance = $.data( this, fullName );
497				if ( options === "instance" ) {
498					returnValue = instance;
499					return false;
500				}
501				if ( !instance ) {
502					return $.error( "cannot call methods on " + name + " prior to initialization; " +
503						"attempted to call method '" + options + "'" );
504				}
505				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
506					return $.error( "no such method '" + options + "' for " + name + " widget instance" );
507				}
508				methodValue = instance[ options ].apply( instance, args );
509				if ( methodValue !== instance && methodValue !== undefined ) {
510					returnValue = methodValue && methodValue.jquery ?
511						returnValue.pushStack( methodValue.get() ) :
512						methodValue;
513					return false;
514				}
515			});
516		} else {
517
518			// Allow multiple hashes to be passed on init
519			if ( args.length ) {
520				options = $.widget.extend.apply( null, [ options ].concat(args) );
521			}
522
523			this.each(function() {
524				var instance = $.data( this, fullName );
525				if ( instance ) {
526					instance.option( options || {} );
527					if ( instance._init ) {
528						instance._init();
529					}
530				} else {
531					$.data( this, fullName, new object( options, this ) );
532				}
533			});
534		}
535
536		return returnValue;
537	};
538};
539
540$.Widget = function( /* options, element */ ) {};
541$.Widget._childConstructors = [];
542
543$.Widget.prototype = {
544	widgetName: "widget",
545	widgetEventPrefix: "",
546	defaultElement: "<div>",
547	options: {
548		disabled: false,
549
550		// callbacks
551		create: null
552	},
553	_createWidget: function( options, element ) {
554		element = $( element || this.defaultElement || this )[ 0 ];
555		this.element = $( element );
556		this.uuid = widget_uuid++;
557		this.eventNamespace = "." + this.widgetName + this.uuid;
558
559		this.bindings = $();
560		this.hoverable = $();
561		this.focusable = $();
562
563		if ( element !== this ) {
564			$.data( element, this.widgetFullName, this );
565			this._on( true, this.element, {
566				remove: function( event ) {
567					if ( event.target === element ) {
568						this.destroy();
569					}
570				}
571			});
572			this.document = $( element.style ?
573				// element within the document
574				element.ownerDocument :
575				// element is window or document
576				element.document || element );
577			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
578		}
579
580		this.options = $.widget.extend( {},
581			this.options,
582			this._getCreateOptions(),
583			options );
584
585		this._create();
586		this._trigger( "create", null, this._getCreateEventData() );
587		this._init();
588	},
589	_getCreateOptions: $.noop,
590	_getCreateEventData: $.noop,
591	_create: $.noop,
592	_init: $.noop,
593
594	destroy: function() {
595		this._destroy();
596		// we can probably remove the unbind calls in 2.0
597		// all event bindings should go through this._on()
598		this.element
599			.unbind( this.eventNamespace )
600			.removeData( this.widgetFullName )
601			// support: jquery <1.6.3
602			// http://bugs.jquery.com/ticket/9413
603			.removeData( $.camelCase( this.widgetFullName ) );
604		this.widget()
605			.unbind( this.eventNamespace )
606			.removeAttr( "aria-disabled" )
607			.removeClass(
608				this.widgetFullName + "-disabled " +
609				"ui-state-disabled" );
610
611		// clean up events and states
612		this.bindings.unbind( this.eventNamespace );
613		this.hoverable.removeClass( "ui-state-hover" );
614		this.focusable.removeClass( "ui-state-focus" );
615	},
616	_destroy: $.noop,
617
618	widget: function() {
619		return this.element;
620	},
621
622	option: function( key, value ) {
623		var options = key,
624			parts,
625			curOption,
626			i;
627
628		if ( arguments.length === 0 ) {
629			// don't return a reference to the internal hash
630			return $.widget.extend( {}, this.options );
631		}
632
633		if ( typeof key === "string" ) {
634			// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
635			options = {};
636			parts = key.split( "." );
637			key = parts.shift();
638			if ( parts.length ) {
639				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
640				for ( i = 0; i < parts.length - 1; i++ ) {
641					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
642					curOption = curOption[ parts[ i ] ];
643				}
644				key = parts.pop();
645				if ( arguments.length === 1 ) {
646					return curOption[ key ] === undefined ? null : curOption[ key ];
647				}
648				curOption[ key ] = value;
649			} else {
650				if ( arguments.length === 1 ) {
651					return this.options[ key ] === undefined ? null : this.options[ key ];
652				}
653				options[ key ] = value;
654			}
655		}
656
657		this._setOptions( options );
658
659		return this;
660	},
661	_setOptions: function( options ) {
662		var key;
663
664		for ( key in options ) {
665			this._setOption( key, options[ key ] );
666		}
667
668		return this;
669	},
670	_setOption: function( key, value ) {
671		this.options[ key ] = value;
672
673		if ( key === "disabled" ) {
674			this.widget()
675				.toggleClass( this.widgetFullName + "-disabled", !!value );
676
677			// If the widget is becoming disabled, then nothing is interactive
678			if ( value ) {
679				this.hoverable.removeClass( "ui-state-hover" );
680				this.focusable.removeClass( "ui-state-focus" );
681			}
682		}
683
684		return this;
685	},
686
687	enable: function() {
688		return this._setOptions({ disabled: false });
689	},
690	disable: function() {
691		return this._setOptions({ disabled: true });
692	},
693
694	_on: function( suppressDisabledCheck, element, handlers ) {
695		var delegateElement,
696			instance = this;
697
698		// no suppressDisabledCheck flag, shuffle arguments
699		if ( typeof suppressDisabledCheck !== "boolean" ) {
700			handlers = element;
701			element = suppressDisabledCheck;
702			suppressDisabledCheck = false;
703		}
704
705		// no element argument, shuffle and use this.element
706		if ( !handlers ) {
707			handlers = element;
708			element = this.element;
709			delegateElement = this.widget();
710		} else {
711			element = delegateElement = $( element );
712			this.bindings = this.bindings.add( element );
713		}
714
715		$.each( handlers, function( event, handler ) {
716			function handlerProxy() {
717				// allow widgets to customize the disabled handling
718				// - disabled as an array instead of boolean
719				// - disabled class as method for disabling individual parts
720				if ( !suppressDisabledCheck &&
721						( instance.options.disabled === true ||
722							$( this ).hasClass( "ui-state-disabled" ) ) ) {
723					return;
724				}
725				return ( typeof handler === "string" ? instance[ handler ] : handler )
726					.apply( instance, arguments );
727			}
728
729			// copy the guid so direct unbinding works
730			if ( typeof handler !== "string" ) {
731				handlerProxy.guid = handler.guid =
732					handler.guid || handlerProxy.guid || $.guid++;
733			}
734
735			var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
736				eventName = match[1] + instance.eventNamespace,
737				selector = match[2];
738			if ( selector ) {
739				delegateElement.delegate( selector, eventName, handlerProxy );
740			} else {
741				element.bind( eventName, handlerProxy );
742			}
743		});
744	},
745
746	_off: function( element, eventName ) {
747		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
748			this.eventNamespace;
749		element.unbind( eventName ).undelegate( eventName );
750
751		// Clear the stack to avoid memory leaks (#10056)
752		this.bindings = $( this.bindings.not( element ).get() );
753		this.focusable = $( this.focusable.not( element ).get() );
754		this.hoverable = $( this.hoverable.not( element ).get() );
755	},
756
757	_delay: function( handler, delay ) {
758		function handlerProxy() {
759			return ( typeof handler === "string" ? instance[ handler ] : handler )
760				.apply( instance, arguments );
761		}
762		var instance = this;
763		return setTimeout( handlerProxy, delay || 0 );
764	},
765
766	_hoverable: function( element ) {
767		this.hoverable = this.hoverable.add( element );
768		this._on( element, {
769			mouseenter: function( event ) {
770				$( event.currentTarget ).addClass( "ui-state-hover" );
771			},
772			mouseleave: function( event ) {
773				$( event.currentTarget ).removeClass( "ui-state-hover" );
774			}
775		});
776	},
777
778	_focusable: function( element ) {
779		this.focusable = this.focusable.add( element );
780		this._on( element, {
781			focusin: function( event ) {
782				$( event.currentTarget ).addClass( "ui-state-focus" );
783			},
784			focusout: function( event ) {
785				$( event.currentTarget ).removeClass( "ui-state-focus" );
786			}
787		});
788	},
789
790	_trigger: function( type, event, data ) {
791		var prop, orig,
792			callback = this.options[ type ];
793
794		data = data || {};
795		event = $.Event( event );
796		event.type = ( type === this.widgetEventPrefix ?
797			type :
798			this.widgetEventPrefix + type ).toLowerCase();
799		// the original event may come from any element
800		// so we need to reset the target on the new event
801		event.target = this.element[ 0 ];
802
803		// copy original event properties over to the new event
804		orig = event.originalEvent;
805		if ( orig ) {
806			for ( prop in orig ) {
807				if ( !( prop in event ) ) {
808					event[ prop ] = orig[ prop ];
809				}
810			}
811		}
812
813		this.element.trigger( event, data );
814		return !( $.isFunction( callback ) &&
815			callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
816			event.isDefaultPrevented() );
817	}
818};
819
820$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
821	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
822		if ( typeof options === "string" ) {
823			options = { effect: options };
824		}
825		var hasOptions,
826			effectName = !options ?
827				method :
828				options === true || typeof options === "number" ?
829					defaultEffect :
830					options.effect || defaultEffect;
831		options = options || {};
832		if ( typeof options === "number" ) {
833			options = { duration: options };
834		}
835		hasOptions = !$.isEmptyObject( options );
836		options.complete = callback;
837		if ( options.delay ) {
838			element.delay( options.delay );
839		}
840		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
841			element[ method ]( options );
842		} else if ( effectName !== method && element[ effectName ] ) {
843			element[ effectName ]( options.duration, options.easing, callback );
844		} else {
845			element.queue(function( next ) {
846				$( this )[ method ]();
847				if ( callback ) {
848					callback.call( element[ 0 ] );
849				}
850				next();
851			});
852		}
853	};
854});
855
856var widget = $.widget;
857
858
859/*!
860 * jQuery UI Mouse 1.11.4
861 * http://jqueryui.com
862 *
863 * Copyright jQuery Foundation and other contributors
864 * Released under the MIT license.
865 * http://jquery.org/license
866 *
867 * http://api.jqueryui.com/mouse/
868 */
869
870
871var mouseHandled = false;
872$( document ).mouseup( function() {
873	mouseHandled = false;
874});
875
876var mouse = $.widget("ui.mouse", {
877	version: "1.11.4",
878	options: {
879		cancel: "input,textarea,button,select,option",
880		distance: 1,
881		delay: 0
882	},
883	_mouseInit: function() {
884		var that = this;
885
886		this.element
887			.bind("mousedown." + this.widgetName, function(event) {
888				return that._mouseDown(event);
889			})
890			.bind("click." + this.widgetName, function(event) {
891				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
892					$.removeData(event.target, that.widgetName + ".preventClickEvent");
893					event.stopImmediatePropagation();
894					return false;
895				}
896			});
897
898		this.started = false;
899	},
900
901	// TODO: make sure destroying one instance of mouse doesn't mess with
902	// other instances of mouse
903	_mouseDestroy: function() {
904		this.element.unbind("." + this.widgetName);
905		if ( this._mouseMoveDelegate ) {
906			this.document
907				.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
908				.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
909		}
910	},
911
912	_mouseDown: function(event) {
913		// don't let more than one widget handle mouseStart
914		if ( mouseHandled ) {
915			return;
916		}
917
918		this._mouseMoved = false;
919
920		// we may have missed mouseup (out of window)
921		(this._mouseStarted && this._mouseUp(event));
922
923		this._mouseDownEvent = event;
924
925		var that = this,
926			btnIsLeft = (event.which === 1),
927			// event.target.nodeName works around a bug in IE 8 with
928			// disabled inputs (#7620)
929			elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
930		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
931			return true;
932		}
933
934		this.mouseDelayMet = !this.options.delay;
935		if (!this.mouseDelayMet) {
936			this._mouseDelayTimer = setTimeout(function() {
937				that.mouseDelayMet = true;
938			}, this.options.delay);
939		}
940
941		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
942			this._mouseStarted = (this._mouseStart(event) !== false);
943			if (!this._mouseStarted) {
944				event.preventDefault();
945				return true;
946			}
947		}
948
949		// Click event may never have fired (Gecko & Opera)
950		if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
951			$.removeData(event.target, this.widgetName + ".preventClickEvent");
952		}
953
954		// these delegates are required to keep context
955		this._mouseMoveDelegate = function(event) {
956			return that._mouseMove(event);
957		};
958		this._mouseUpDelegate = function(event) {
959			return that._mouseUp(event);
960		};
961
962		this.document
963			.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
964			.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
965
966		event.preventDefault();
967
968		mouseHandled = true;
969		return true;
970	},
971
972	_mouseMove: function(event) {
973		// Only check for mouseups outside the document if you've moved inside the document
974		// at least once. This prevents the firing of mouseup in the case of IE<9, which will
975		// fire a mousemove event if content is placed under the cursor. See #7778
976		// Support: IE <9
977		if ( this._mouseMoved ) {
978			// IE mouseup check - mouseup happened when mouse was out of window
979			if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
980				return this._mouseUp(event);
981
982			// Iframe mouseup check - mouseup occurred in another document
983			} else if ( !event.which ) {
984				return this._mouseUp( event );
985			}
986		}
987
988		if ( event.which || event.button ) {
989			this._mouseMoved = true;
990		}
991
992		if (this._mouseStarted) {
993			this._mouseDrag(event);
994			return event.preventDefault();
995		}
996
997		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
998			this._mouseStarted =
999				(this._mouseStart(this._mouseDownEvent, event) !== false);
1000			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
1001		}
1002
1003		return !this._mouseStarted;
1004	},
1005
1006	_mouseUp: function(event) {
1007		this.document
1008			.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
1009			.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
1010
1011		if (this._mouseStarted) {
1012			this._mouseStarted = false;
1013
1014			if (event.target === this._mouseDownEvent.target) {
1015				$.data(event.target, this.widgetName + ".preventClickEvent", true);
1016			}
1017
1018			this._mouseStop(event);
1019		}
1020
1021		mouseHandled = false;
1022		return false;
1023	},
1024
1025	_mouseDistanceMet: function(event) {
1026		return (Math.max(
1027				Math.abs(this._mouseDownEvent.pageX - event.pageX),
1028				Math.abs(this._mouseDownEvent.pageY - event.pageY)
1029			) >= this.options.distance
1030		);
1031	},
1032
1033	_mouseDelayMet: function(/* event */) {
1034		return this.mouseDelayMet;
1035	},
1036
1037	// These are placeholder methods, to be overriden by extending plugin
1038	_mouseStart: function(/* event */) {},
1039	_mouseDrag: function(/* event */) {},
1040	_mouseStop: function(/* event */) {},
1041	_mouseCapture: function(/* event */) { return true; }
1042});
1043
1044
1045/*!
1046 * jQuery UI Position 1.11.4
1047 * http://jqueryui.com
1048 *
1049 * Copyright jQuery Foundation and other contributors
1050 * Released under the MIT license.
1051 * http://jquery.org/license
1052 *
1053 * http://api.jqueryui.com/position/
1054 */
1055
1056(function() {
1057
1058$.ui = $.ui || {};
1059
1060var cachedScrollbarWidth, supportsOffsetFractions,
1061	max = Math.max,
1062	abs = Math.abs,
1063	round = Math.round,
1064	rhorizontal = /left|center|right/,
1065	rvertical = /top|center|bottom/,
1066	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
1067	rposition = /^\w+/,
1068	rpercent = /%$/,
1069	_position = $.fn.position;
1070
1071function getOffsets( offsets, width, height ) {
1072	return [
1073		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
1074		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
1075	];
1076}
1077
1078function parseCss( element, property ) {
1079	return parseInt( $.css( element, property ), 10 ) || 0;
1080}
1081
1082function getDimensions( elem ) {
1083	var raw = elem[0];
1084	if ( raw.nodeType === 9 ) {
1085		return {
1086			width: elem.width(),
1087			height: elem.height(),
1088			offset: { top: 0, left: 0 }
1089		};
1090	}
1091	if ( $.isWindow( raw ) ) {
1092		return {
1093			width: elem.width(),
1094			height: elem.height(),
1095			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
1096		};
1097	}
1098	if ( raw.preventDefault ) {
1099		return {
1100			width: 0,
1101			height: 0,
1102			offset: { top: raw.pageY, left: raw.pageX }
1103		};
1104	}
1105	return {
1106		width: elem.outerWidth(),
1107		height: elem.outerHeight(),
1108		offset: elem.offset()
1109	};
1110}
1111
1112$.position = {
1113	scrollbarWidth: function() {
1114		if ( cachedScrollbarWidth !== undefined ) {
1115			return cachedScrollbarWidth;
1116		}
1117		var w1, w2,
1118			div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
1119			innerDiv = div.children()[0];
1120
1121		$( "body" ).append( div );
1122		w1 = innerDiv.offsetWidth;
1123		div.css( "overflow", "scroll" );
1124
1125		w2 = innerDiv.offsetWidth;
1126
1127		if ( w1 === w2 ) {
1128			w2 = div[0].clientWidth;
1129		}
1130
1131		div.remove();
1132
1133		return (cachedScrollbarWidth = w1 - w2);
1134	},
1135	getScrollInfo: function( within ) {
1136		var overflowX = within.isWindow || within.isDocument ? "" :
1137				within.element.css( "overflow-x" ),
1138			overflowY = within.isWindow || within.isDocument ? "" :
1139				within.element.css( "overflow-y" ),
1140			hasOverflowX = overflowX === "scroll" ||
1141				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
1142			hasOverflowY = overflowY === "scroll" ||
1143				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
1144		return {
1145			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
1146			height: hasOverflowX ? $.position.scrollbarWidth() : 0
1147		};
1148	},
1149	getWithinInfo: function( element ) {
1150		var withinElement = $( element || window ),
1151			isWindow = $.isWindow( withinElement[0] ),
1152			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
1153		return {
1154			element: withinElement,
1155			isWindow: isWindow,
1156			isDocument: isDocument,
1157			offset: withinElement.offset() || { left: 0, top: 0 },
1158			scrollLeft: withinElement.scrollLeft(),
1159			scrollTop: withinElement.scrollTop(),
1160
1161			// support: jQuery 1.6.x
1162			// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
1163			width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
1164			height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
1165		};
1166	}
1167};
1168
1169$.fn.position = function( options ) {
1170	if ( !options || !options.of ) {
1171		return _position.apply( this, arguments );
1172	}
1173
1174	// make a copy, we don't want to modify arguments
1175	options = $.extend( {}, options );
1176
1177	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
1178		target = $( options.of ),
1179		within = $.position.getWithinInfo( options.within ),
1180		scrollInfo = $.position.getScrollInfo( within ),
1181		collision = ( options.collision || "flip" ).split( " " ),
1182		offsets = {};
1183
1184	dimensions = getDimensions( target );
1185	if ( target[0].preventDefault ) {
1186		// force left top to allow flipping
1187		options.at = "left top";
1188	}
1189	targetWidth = dimensions.width;
1190	targetHeight = dimensions.height;
1191	targetOffset = dimensions.offset;
1192	// clone to reuse original targetOffset later
1193	basePosition = $.extend( {}, targetOffset );
1194
1195	// force my and at to have valid horizontal and vertical positions
1196	// if a value is missing or invalid, it will be converted to center
1197	$.each( [ "my", "at" ], function() {
1198		var pos = ( options[ this ] || "" ).split( " " ),
1199			horizontalOffset,
1200			verticalOffset;
1201
1202		if ( pos.length === 1) {
1203			pos = rhorizontal.test( pos[ 0 ] ) ?
vendor: 9,546 bytes, lines 1204-1485
1204				pos.concat( [ "center" ] ) :
1205				rvertical.test( pos[ 0 ] ) ?
1206					[ "center" ].concat( pos ) :
1207					[ "center", "center" ];
1208		}
1209		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
1210		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
1211
1212		// calculate offsets
1213		horizontalOffset = roffset.exec( pos[ 0 ] );
1214		verticalOffset = roffset.exec( pos[ 1 ] );
1215		offsets[ this ] = [
1216			horizontalOffset ? horizontalOffset[ 0 ] : 0,
1217			verticalOffset ? verticalOffset[ 0 ] : 0
1218		];
1219
1220		// reduce to just the positions without the offsets
1221		options[ this ] = [
1222			rposition.exec( pos[ 0 ] )[ 0 ],
1223			rposition.exec( pos[ 1 ] )[ 0 ]
1224		];
1225	});
1226
1227	// normalize collision option
1228	if ( collision.length === 1 ) {
1229		collision[ 1 ] = collision[ 0 ];
1230	}
1231
1232	if ( options.at[ 0 ] === "right" ) {
1233		basePosition.left += targetWidth;
1234	} else if ( options.at[ 0 ] === "center" ) {
1235		basePosition.left += targetWidth / 2;
1236	}
1237
1238	if ( options.at[ 1 ] === "bottom" ) {
1239		basePosition.top += targetHeight;
1240	} else if ( options.at[ 1 ] === "center" ) {
1241		basePosition.top += targetHeight / 2;
1242	}
1243
1244	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
1245	basePosition.left += atOffset[ 0 ];
1246	basePosition.top += atOffset[ 1 ];
1247
1248	return this.each(function() {
1249		var collisionPosition, using,
1250			elem = $( this ),
1251			elemWidth = elem.outerWidth(),
1252			elemHeight = elem.outerHeight(),
1253			marginLeft = parseCss( this, "marginLeft" ),
1254			marginTop = parseCss( this, "marginTop" ),
1255			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
1256			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
1257			position = $.extend( {}, basePosition ),
1258			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
1259
1260		if ( options.my[ 0 ] === "right" ) {
1261			position.left -= elemWidth;
1262		} else if ( options.my[ 0 ] === "center" ) {
1263			position.left -= elemWidth / 2;
1264		}
1265
1266		if ( options.my[ 1 ] === "bottom" ) {
1267			position.top -= elemHeight;
1268		} else if ( options.my[ 1 ] === "center" ) {
1269			position.top -= elemHeight / 2;
1270		}
1271
1272		position.left += myOffset[ 0 ];
1273		position.top += myOffset[ 1 ];
1274
1275		// if the browser doesn't support fractions, then round for consistent results
1276		if ( !supportsOffsetFractions ) {
1277			position.left = round( position.left );
1278			position.top = round( position.top );
1279		}
1280
1281		collisionPosition = {
1282			marginLeft: marginLeft,
1283			marginTop: marginTop
1284		};
1285
1286		$.each( [ "left", "top" ], function( i, dir ) {
1287			if ( $.ui.position[ collision[ i ] ] ) {
1288				$.ui.position[ collision[ i ] ][ dir ]( position, {
1289					targetWidth: targetWidth,
1290					targetHeight: targetHeight,
1291					elemWidth: elemWidth,
1292					elemHeight: elemHeight,
1293					collisionPosition: collisionPosition,
1294					collisionWidth: collisionWidth,
1295					collisionHeight: collisionHeight,
1296					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
1297					my: options.my,
1298					at: options.at,
1299					within: within,
1300					elem: elem
1301				});
1302			}
1303		});
1304
1305		if ( options.using ) {
1306			// adds feedback as second argument to using callback, if present
1307			using = function( props ) {
1308				var left = targetOffset.left - position.left,
1309					right = left + targetWidth - elemWidth,
1310					top = targetOffset.top - position.top,
1311					bottom = top + targetHeight - elemHeight,
1312					feedback = {
1313						target: {
1314							element: target,
1315							left: targetOffset.left,
1316							top: targetOffset.top,
1317							width: targetWidth,
1318							height: targetHeight
1319						},
1320						element: {
1321							element: elem,
1322							left: position.left,
1323							top: position.top,
1324							width: elemWidth,
1325							height: elemHeight
1326						},
1327						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
1328						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
1329					};
1330				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
1331					feedback.horizontal = "center";
1332				}
1333				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
1334					feedback.vertical = "middle";
1335				}
1336				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
1337					feedback.important = "horizontal";
1338				} else {
1339					feedback.important = "vertical";
1340				}
1341				options.using.call( this, props, feedback );
1342			};
1343		}
1344
1345		elem.offset( $.extend( position, { using: using } ) );
1346	});
1347};
1348
1349$.ui.position = {
1350	fit: {
1351		left: function( position, data ) {
1352			var within = data.within,
1353				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
1354				outerWidth = within.width,
1355				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
1356				overLeft = withinOffset - collisionPosLeft,
1357				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
1358				newOverRight;
1359
1360			// element is wider than within
1361			if ( data.collisionWidth > outerWidth ) {
1362				// element is initially over the left side of within
1363				if ( overLeft > 0 && overRight <= 0 ) {
1364					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
1365					position.left += overLeft - newOverRight;
1366				// element is initially over right side of within
1367				} else if ( overRight > 0 && overLeft <= 0 ) {
1368					position.left = withinOffset;
1369				// element is initially over both left and right sides of within
1370				} else {
1371					if ( overLeft > overRight ) {
1372						position.left = withinOffset + outerWidth - data.collisionWidth;
1373					} else {
1374						position.left = withinOffset;
1375					}
1376				}
1377			// too far left -> align with left edge
1378			} else if ( overLeft > 0 ) {
1379				position.left += overLeft;
1380			// too far right -> align with right edge
1381			} else if ( overRight > 0 ) {
1382				position.left -= overRight;
1383			// adjust based on position and margin
1384			} else {
1385				position.left = max( position.left - collisionPosLeft, position.left );
1386			}
1387		},
1388		top: function( position, data ) {
1389			var within = data.within,
1390				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
1391				outerHeight = data.within.height,
1392				collisionPosTop = position.top - data.collisionPosition.marginTop,
1393				overTop = withinOffset - collisionPosTop,
1394				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
1395				newOverBottom;
1396
1397			// element is taller than within
1398			if ( data.collisionHeight > outerHeight ) {
1399				// element is initially over the top of within
1400				if ( overTop > 0 && overBottom <= 0 ) {
1401					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
1402					position.top += overTop - newOverBottom;
1403				// element is initially over bottom of within
1404				} else if ( overBottom > 0 && overTop <= 0 ) {
1405					position.top = withinOffset;
1406				// element is initially over both top and bottom of within
1407				} else {
1408					if ( overTop > overBottom ) {
1409						position.top = withinOffset + outerHeight - data.collisionHeight;
1410					} else {
1411						position.top = withinOffset;
1412					}
1413				}
1414			// too far up -> align with top
1415			} else if ( overTop > 0 ) {
1416				position.top += overTop;
1417			// too far down -> align with bottom edge
1418			} else if ( overBottom > 0 ) {
1419				position.top -= overBottom;
1420			// adjust based on position and margin
1421			} else {
1422				position.top = max( position.top - collisionPosTop, position.top );
1423			}
1424		}
1425	},
1426	flip: {
1427		left: function( position, data ) {
1428			var within = data.within,
1429				withinOffset = within.offset.left + within.scrollLeft,
1430				outerWidth = within.width,
1431				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
1432				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
1433				overLeft = collisionPosLeft - offsetLeft,
1434				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
1435				myOffset = data.my[ 0 ] === "left" ?
1436					-data.elemWidth :
1437					data.my[ 0 ] === "right" ?
1438						data.elemWidth :
1439						0,
1440				atOffset = data.at[ 0 ] === "left" ?
1441					data.targetWidth :
1442					data.at[ 0 ] === "right" ?
1443						-data.targetWidth :
1444						0,
1445				offset = -2 * data.offset[ 0 ],
1446				newOverRight,
1447				newOverLeft;
1448
1449			if ( overLeft < 0 ) {
1450				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
1451				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
1452					position.left += myOffset + atOffset + offset;
1453				}
1454			} else if ( overRight > 0 ) {
1455				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
1456				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
1457					position.left += myOffset + atOffset + offset;
1458				}
1459			}
1460		},
1461		top: function( position, data ) {
1462			var within = data.within,
1463				withinOffset = within.offset.top + within.scrollTop,
1464				outerHeight = within.height,
1465				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
1466				collisionPosTop = position.top - data.collisionPosition.marginTop,
1467				overTop = collisionPosTop - offsetTop,
1468				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
1469				top = data.my[ 1 ] === "top",
1470				myOffset = top ?
1471					-data.elemHeight :
1472					data.my[ 1 ] === "bottom" ?
1473						data.elemHeight :
1474						0,
1475				atOffset = data.at[ 1 ] === "top" ?
1476					data.targetHeight :
1477					data.at[ 1 ] === "bottom" ?
1478						-data.targetHeight :
1479						0,
1480				offset = -2 * data.offset[ 1 ],
1481				newOverTop,
1482				newOverBottom;
1483			if ( overTop < 0 ) {
1484				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
1485				if ( 
vendor: 2,864 bytes, lines 1485-1592
1485newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
1486					position.top += myOffset + atOffset + offset;
1487				}
1488			} else if ( overBottom > 0 ) {
1489				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
1490				if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
1491					position.top += myOffset + atOffset + offset;
1492				}
1493			}
1494		}
1495	},
1496	flipfit: {
1497		left: function() {
1498			$.ui.position.flip.left.apply( this, arguments );
1499			$.ui.position.fit.left.apply( this, arguments );
1500		},
1501		top: function() {
1502			$.ui.position.flip.top.apply( this, arguments );
1503			$.ui.position.fit.top.apply( this, arguments );
1504		}
1505	}
1506};
1507
1508// fraction support test
1509(function() {
1510	var testElement, testElementParent, testElementStyle, offsetLeft, i,
1511		body = document.getElementsByTagName( "body" )[ 0 ],
1512		div = document.createElement( "div" );
1513
1514	//Create a "fake body" for testing based on method used in jQuery.support
1515	testElement = document.createElement( body ? "div" : "body" );
1516	testElementStyle = {
1517		visibility: "hidden",
1518		width: 0,
1519		height: 0,
1520		border: 0,
1521		margin: 0,
1522		background: "none"
1523	};
1524	if ( body ) {
1525		$.extend( testElementStyle, {
1526			position: "absolute",
1527			left: "-1000px",
1528			top: "-1000px"
1529		});
1530	}
1531	for ( i in testElementStyle ) {
1532		testElement.style[ i ] = testElementStyle[ i ];
1533	}
1534	testElement.appendChild( div );
1535	testElementParent = body || document.documentElement;
1536	testElementParent.insertBefore( testElement, testElementParent.firstChild );
1537
1538	div.style.cssText = "position: absolute; left: 10.7432222px;";
1539
1540	offsetLeft = $( div ).offset().left;
1541	supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
1542
1543	testElement.innerHTML = "";
1544	testElementParent.removeChild( testElement );
1545})();
1546
1547})();
1548
1549var position = $.ui.position;
1550
1551
1552/*!
1553 * jQuery UI Button 1.11.4
1554 * http://jqueryui.com
1555 *
1556 * Copyright jQuery Foundation and other contributors
1557 * Released under the MIT license.
1558 * http://jquery.org/license
1559 *
1560 * http://api.jqueryui.com/button/
1561 */
1562
1563
1564var lastActive,
1565	baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
1566	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",
1567	formResetHandler = function() {
1568		var form = $( this );
1569		setTimeout(function() {
1570			form.find( ":ui-button" ).button( "refresh" );
1571		}, 1 );
1572	},
1573	radioGroup = function( radio ) {
1574		var name = radio.name,
1575			form = radio.form,
1576			radios = $( [] );
1577		if ( name ) {
1578			name = name.replace( /'/g, "\\'" );
1579			if ( form ) {
1580				radios = $( form ).find( "[name='" + name + "'][type=radio]" );
1581			} else {
1582				radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
1583					.filter(function() {
1584						return !this.form;
1585					});
1586			}
1587		}
1588		return radios;
1589	};
1590
1591$.widget( "ui.button", {
1592	version: "1.11.4
vendor: 7,678 bytes, lines 1592-1857
1592",
1593	defaultElement: "<button>",
1594	options: {
1595		disabled: null,
1596		text: true,
1597		label: null,
1598		icons: {
1599			primary: null,
1600			secondary: null
1601		}
1602	},
1603	_create: function() {
1604		this.element.closest( "form" )
1605			.unbind( "reset" + this.eventNamespace )
1606			.bind( "reset" + this.eventNamespace, formResetHandler );
1607
1608		if ( typeof this.options.disabled !== "boolean" ) {
1609			this.options.disabled = !!this.element.prop( "disabled" );
1610		} else {
1611			this.element.prop( "disabled", this.options.disabled );
1612		}
1613
1614		this._determineButtonType();
1615		this.hasTitle = !!this.buttonElement.attr( "title" );
1616
1617		var that = this,
1618			options = this.options,
1619			toggleButton = this.type === "checkbox" || this.type === "radio",
1620			activeClass = !toggleButton ? "ui-state-active" : "";
1621
1622		if ( options.label === null ) {
1623			options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
1624		}
1625
1626		this._hoverable( this.buttonElement );
1627
1628		this.buttonElement
1629			.addClass( baseClasses )
1630			.attr( "role", "button" )
1631			.bind( "mouseenter" + this.eventNamespace, function() {
1632				if ( options.disabled ) {
1633					return;
1634				}
1635				if ( this === lastActive ) {
1636					$( this ).addClass( "ui-state-active" );
1637				}
1638			})
1639			.bind( "mouseleave" + this.eventNamespace, function() {
1640				if ( options.disabled ) {
1641					return;
1642				}
1643				$( this ).removeClass( activeClass );
1644			})
1645			.bind( "click" + this.eventNamespace, function( event ) {
1646				if ( options.disabled ) {
1647					event.preventDefault();
1648					event.stopImmediatePropagation();
1649				}
1650			});
1651
1652		// Can't use _focusable() because the element that receives focus
1653		// and the element that gets the ui-state-focus class are different
1654		this._on({
1655			focus: function() {
1656				this.buttonElement.addClass( "ui-state-focus" );
1657			},
1658			blur: function() {
1659				this.buttonElement.removeClass( "ui-state-focus" );
1660			}
1661		});
1662
1663		if ( toggleButton ) {
1664			this.element.bind( "change" + this.eventNamespace, function() {
1665				that.refresh();
1666			});
1667		}
1668
1669		if ( this.type === "checkbox" ) {
1670			this.buttonElement.bind( "click" + this.eventNamespace, function() {
1671				if ( options.disabled ) {
1672					return false;
1673				}
1674			});
1675		} else if ( this.type === "radio" ) {
1676			this.buttonElement.bind( "click" + this.eventNamespace, function() {
1677				if ( options.disabled ) {
1678					return false;
1679				}
1680				$( this ).addClass( "ui-state-active" );
1681				that.buttonElement.attr( "aria-pressed", "true" );
1682
1683				var radio = that.element[ 0 ];
1684				radioGroup( radio )
1685					.not( radio )
1686					.map(function() {
1687						return $( this ).button( "widget" )[ 0 ];
1688					})
1689					.removeClass( "ui-state-active" )
1690					.attr( "aria-pressed", "false" );
1691			});
1692		} else {
1693			this.buttonElement
1694				.bind( "mousedown" + this.eventNamespace, function() {
1695					if ( options.disabled ) {
1696						return false;
1697					}
1698					$( this ).addClass( "ui-state-active" );
1699					lastActive = this;
1700					that.document.one( "mouseup", function() {
1701						lastActive = null;
1702					});
1703				})
1704				.bind( "mouseup" + this.eventNamespace, function() {
1705					if ( options.disabled ) {
1706						return false;
1707					}
1708					$( this ).removeClass( "ui-state-active" );
1709				})
1710				.bind( "keydown" + this.eventNamespace, function(event) {
1711					if ( options.disabled ) {
1712						return false;
1713					}
1714					if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
1715						$( this ).addClass( "ui-state-active" );
1716					}
1717				})
1718				// see #8559, we bind to blur here in case the button element loses
1719				// focus between keydown and keyup, it would be left in an "active" state
1720				.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
1721					$( this ).removeClass( "ui-state-active" );
1722				});
1723
1724			if ( this.buttonElement.is("a") ) {
1725				this.buttonElement.keyup(function(event) {
1726					if ( event.keyCode === $.ui.keyCode.SPACE ) {
1727						// TODO pass through original event correctly (just as 2nd argument doesn't work)
1728						$( this ).click();
1729					}
1730				});
1731			}
1732		}
1733
1734		this._setOption( "disabled", options.disabled );
1735		this._resetButton();
1736	},
1737
1738	_determineButtonType: function() {
1739		var ancestor, labelSelector, checked;
1740
1741		if ( this.element.is("[type=checkbox]") ) {
1742			this.type = "checkbox";
1743		} else if ( this.element.is("[type=radio]") ) {
1744			this.type = "radio";
1745		} else if ( this.element.is("input") ) {
1746			this.type = "input";
1747		} else {
1748			this.type = "button";
1749		}
1750
1751		if ( this.type === "checkbox" || this.type === "radio" ) {
1752			// we don't search against the document in case the element
1753			// is disconnected from the DOM
1754			ancestor = this.element.parents().last();
1755			labelSelector = "label[for='" + this.element.attr("id") + "']";
1756			this.buttonElement = ancestor.find( labelSelector );
1757			if ( !this.buttonElement.length ) {
1758				ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
1759				this.buttonElement = ancestor.filter( labelSelector );
1760				if ( !this.buttonElement.length ) {
1761					this.buttonElement = ancestor.find( labelSelector );
1762				}
1763			}
1764			this.element.addClass( "ui-helper-hidden-accessible" );
1765
1766			checked = this.element.is( ":checked" );
1767			if ( checked ) {
1768				this.buttonElement.addClass( "ui-state-active" );
1769			}
1770			this.buttonElement.prop( "aria-pressed", checked );
1771		} else {
1772			this.buttonElement = this.element;
1773		}
1774	},
1775
1776	widget: function() {
1777		return this.buttonElement;
1778	},
1779
1780	_destroy: function() {
1781		this.element
1782			.removeClass( "ui-helper-hidden-accessible" );
1783		this.buttonElement
1784			.removeClass( baseClasses + " ui-state-active " + typeClasses )
1785			.removeAttr( "role" )
1786			.removeAttr( "aria-pressed" )
1787			.html( this.buttonElement.find(".ui-button-text").html() );
1788
1789		if ( !this.hasTitle ) {
1790			this.buttonElement.removeAttr( "title" );
1791		}
1792	},
1793
1794	_setOption: function( key, value ) {
1795		this._super( key, value );
1796		if ( key === "disabled" ) {
1797			this.widget().toggleClass( "ui-state-disabled", !!value );
1798			this.element.prop( "disabled", !!value );
1799			if ( value ) {
1800				if ( this.type === "checkbox" || this.type === "radio" ) {
1801					this.buttonElement.removeClass( "ui-state-focus" );
1802				} else {
1803					this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
1804				}
1805			}
1806			return;
1807		}
1808		this._resetButton();
1809	},
1810
1811	refresh: function() {
1812		//See #8237 & #8828
1813		var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
1814
1815		if ( isDisabled !== this.options.disabled ) {
1816			this._setOption( "disabled", isDisabled );
1817		}
1818		if ( this.type === "radio" ) {
1819			radioGroup( this.element[0] ).each(function() {
1820				if ( $( this ).is( ":checked" ) ) {
1821					$( this ).button( "widget" )
1822						.addClass( "ui-state-active" )
1823						.attr( "aria-pressed", "true" );
1824				} else {
1825					$( this ).button( "widget" )
1826						.removeClass( "ui-state-active" )
1827						.attr( "aria-pressed", "false" );
1828				}
1829			});
1830		} else if ( this.type === "checkbox" ) {
1831			if ( this.element.is( ":checked" ) ) {
1832				this.buttonElement
1833					.addClass( "ui-state-active" )
1834					.attr( "aria-pressed", "true" );
1835			} else {
1836				this.buttonElement
1837					.removeClass( "ui-state-active" )
1838					.attr( "aria-pressed", "false" );
1839			}
1840		}
1841	},
1842
1843	_resetButton: function() {
1844		if ( this.type === "input" ) {
1845			if ( this.options.label ) {
1846				this.element.val( this.options.label );
1847			}
1848			return;
1849		}
1850		var buttonElement = this.buttonElement.removeClass( typeClasses ),
1851			buttonText = $( "<span></span>", this.document[0] )
1852				.addClass( "ui-button-text" )
1853				.html( this.options.label )
1854				.appendTo( buttonElement.empty() )
1855				.text(),
1856			icons = this.options.icons,
1857			multipleIcons = icons.primary && icons.secondary,
vendor: 6,515 bytes, lines 1858-2028
1858			buttonClasses = [];
1859
1860		if ( icons.primary || icons.secondary ) {
1861			if ( this.options.text ) {
1862				buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
1863			}
1864
1865			if ( icons.primary ) {
1866				buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
1867			}
1868
1869			if ( icons.secondary ) {
1870				buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
1871			}
1872
1873			if ( !this.options.text ) {
1874				buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
1875
1876				if ( !this.hasTitle ) {
1877					buttonElement.attr( "title", $.trim( buttonText ) );
1878				}
1879			}
1880		} else {
1881			buttonClasses.push( "ui-button-text-only" );
1882		}
1883		buttonElement.addClass( buttonClasses.join( " " ) );
1884	}
1885});
1886
1887$.widget( "ui.buttonset", {
1888	version: "1.11.4",
1889	options: {
1890		items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
1891	},
1892
1893	_create: function() {
1894		this.element.addClass( "ui-buttonset" );
1895	},
1896
1897	_init: function() {
1898		this.refresh();
1899	},
1900
1901	_setOption: function( key, value ) {
1902		if ( key === "disabled" ) {
1903			this.buttons.button( "option", key, value );
1904		}
1905
1906		this._super( key, value );
1907	},
1908
1909	refresh: function() {
1910		var rtl = this.element.css( "direction" ) === "rtl",
1911			allButtons = this.element.find( this.options.items ),
1912			existingButtons = allButtons.filter( ":ui-button" );
1913
1914		// Initialize new buttons
1915		allButtons.not( ":ui-button" ).button();
1916
1917		// Refresh existing buttons
1918		existingButtons.button( "refresh" );
1919
1920		this.buttons = allButtons
1921			.map(function() {
1922				return $( this ).button( "widget" )[ 0 ];
1923			})
1924				.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
1925				.filter( ":first" )
1926					.addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
1927				.end()
1928				.filter( ":last" )
1929					.addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
1930				.end()
1931			.end();
1932	},
1933
1934	_destroy: function() {
1935		this.element.removeClass( "ui-buttonset" );
1936		this.buttons
1937			.map(function() {
1938				return $( this ).button( "widget" )[ 0 ];
1939			})
1940				.removeClass( "ui-corner-left ui-corner-right" )
1941			.end()
1942			.button( "destroy" );
1943	}
1944});
1945
1946var button = $.ui.button;
1947
1948
1949/*!
1950 * jQuery UI Datepicker 1.11.4
1951 * http://jqueryui.com
1952 *
1953 * Copyright jQuery Foundation and other contributors
1954 * Released under the MIT license.
1955 * http://jquery.org/license
1956 *
1957 * http://api.jqueryui.com/datepicker/
1958 */
1959
1960
1961$.extend($.ui, { datepicker: { version: "1.11.4" } });
1962
1963var datepicker_instActive;
1964
1965function datepicker_getZindex( elem ) {
1966	var position, value;
1967	while ( elem.length && elem[ 0 ] !== document ) {
1968		// Ignore z-index if position is set to a value where z-index is ignored by the browser
1969		// This makes behavior of this function consistent across browsers
1970		// WebKit always returns auto if the element is positioned
1971		position = elem.css( "position" );
1972		if ( position === "absolute" || position === "relative" || position === "fixed" ) {
1973			// IE returns 0 when zIndex is not specified
1974			// other browsers return a string
1975			// we ignore the case of nested elements with an explicit value of 0
1976			// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
1977			value = parseInt( elem.css( "zIndex" ), 10 );
1978			if ( !isNaN( value ) && value !== 0 ) {
1979				return value;
1980			}
1981		}
1982		elem = elem.parent();
1983	}
1984
1985	return 0;
1986}
1987/* Date picker manager.
1988   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
1989   Settings for (groups of) date pickers are maintained in an instance object,
1990   allowing multiple different settings on the same page. */
1991
1992function Datepicker() {
1993	this._curInst = null; // The current instance in use
1994	this._keyEvent = false; // If the last event was a key event
1995	this._disabledInputs = []; // List of date picker inputs that have been disabled
1996	this._datepickerShowing = false; // True if the popup picker is showing , false if not
1997	this._inDialog = false; // True if showing within a "dialog", false if not
1998	this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
1999	this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
2000	this._appendClass = "ui-datepicker-append"; // The name of the append marker class
2001	this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
2002	this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
2003	this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
2004	this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
2005	this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
2006	this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
2007	this.regional = []; // Available regional settings, indexed by language code
2008	this.regional[""] = { // Default regional settings
2009		closeText: "Done", // Display text for close link
2010		prevText: "Prev", // Display text for previous month link
2011		nextText: "Next", // Display text for next month link
2012		currentText: "Today", // Display text for current month link
2013		monthNames: ["January","February","March","April","May","June",
2014			"July","August","September","October","November","December"], // Names of months for drop-down and formatting
2015		monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
2016		dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
2017		dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
2018		dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
2019		weekHeader: "Wk", // Column header for week of the year
2020		dateFormat: "mm/dd/yy", // See format options on parseDate
2021		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
2022		isRTL: false, // True if right-to-left language, false if left-to-right
2023		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
2024		yearSuffix: "" // Additional text to append to the year in the month headers
2025	};
2026	this._defaults = { // Global defaults for all the date picker instances
2027		showOn: "focus", // "focus" for popup on focus,
2028			// "button" for trigger button, or "both" for either
vendor: 19,263 bytes, lines 2029-2528
2029		showAnim: "fadeIn", // Name of jQuery animation for popup
2030		showOptions: {}, // Options for enhanced animations
2031		defaultDate: null, // Used when field is blank: actual date,
2032			// +/-number for offset from today, null for today
2033		appendText: "", // Display text following the input box, e.g. showing the format
2034		buttonText: "...", // Text for trigger button
2035		buttonImage: "", // URL for trigger button image
2036		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
2037		hideIfNoPrevNext: false, // True to hide next/previous month links
2038			// if not applicable, false to just disable them
2039		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
2040		gotoCurrent: false, // True if today link goes back to current selection instead
2041		changeMonth: false, // True if month can be selected directly, false if only prev/next
2042		changeYear: false, // True if year can be selected directly, false if only prev/next
2043		yearRange: "c-10:c+10", // Range of years to display in drop-down,
2044			// either relative to today's year (-nn:+nn), relative to currently displayed year
2045			// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
2046		showOtherMonths: false, // True to show dates in other months, false to leave blank
2047		selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
2048		showWeek: false, // True to show week of the year, false to not show it
2049		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
2050			// takes a Date and returns the number of the week for it
2051		shortYearCutoff: "+10", // Short year values < this are in the current century,
2052			// > this are in the previous century,
2053			// string value starting with "+" for current year + value
2054		minDate: null, // The earliest selectable date, or null for no limit
2055		maxDate: null, // The latest selectable date, or null for no limit
2056		duration: "fast", // Duration of display/closure
2057		beforeShowDay: null, // Function that takes a date and returns an array with
2058			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
2059			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
2060		beforeShow: null, // Function that takes an input field and
2061			// returns a set of custom settings for the date picker
2062		onSelect: null, // Define a callback function when a date is selected
2063		onChangeMonthYear: null, // Define a callback function when the month or year is changed
2064		onClose: null, // Define a callback function when the datepicker is closed
2065		numberOfMonths: 1, // Number of months to show at a time
2066		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
2067		stepMonths: 1, // Number of months to step back/forward
2068		stepBigMonths: 12, // Number of months to step back/forward for the big links
2069		altField: "", // Selector for an alternate field to store selected dates into
2070		altFormat: "", // The date format to use for the alternate field
2071		constrainInput: true, // The input is constrained by the current date format
2072		showButtonPanel: false, // True to show button panel, false to not show it
2073		autoSize: false, // True to size the input for the date format, false to leave as is
2074		disabled: false // The initial disabled state
2075	};
2076	$.extend(this._defaults, this.regional[""]);
2077	this.regional.en = $.extend( true, {}, this.regional[ "" ]);
2078	this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
2079	this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
2080}
2081
2082$.extend(Datepicker.prototype, {
2083	/* Class name added to elements to indicate already configured with a date picker. */
2084	markerClassName: "hasDatepicker",
2085
2086	//Keep track of the maximum number of rows displayed (see #7043)
2087	maxRows: 4,
2088
2089	// TODO rename to "widget" when switching to widget factory
2090	_widgetDatepicker: function() {
2091		return this.dpDiv;
2092	},
2093
2094	/* Override the default settings for all instances of the date picker.
2095	 * @param  settings  object - the new settings to use as defaults (anonymous object)
2096	 * @return the manager object
2097	 */
2098	setDefaults: function(settings) {
2099		datepicker_extendRemove(this._defaults, settings || {});
2100		return this;
2101	},
2102
2103	/* Attach the date picker to a jQuery selection.
2104	 * @param  target	element - the target input field or division or span
2105	 * @param  settings  object - the new settings to use for this date picker instance (anonymous)
2106	 */
2107	_attachDatepicker: function(target, settings) {
2108		var nodeName, inline, inst;
2109		nodeName = target.nodeName.toLowerCase();
2110		inline = (nodeName === "div" || nodeName === "span");
2111		if (!target.id) {
2112			this.uuid += 1;
2113			target.id = "dp" + this.uuid;
2114		}
2115		inst = this._newInst($(target), inline);
2116		inst.settings = $.extend({}, settings || {});
2117		if (nodeName === "input") {
2118			this._connectDatepicker(target, inst);
2119		} else if (inline) {
2120			this._inlineDatepicker(target, inst);
2121		}
2122	},
2123
2124	/* Create a new instance object. */
2125	_newInst: function(target, inline) {
2126		var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
2127		return {id: id, input: target, // associated target
2128			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
2129			drawMonth: 0, drawYear: 0, // month being drawn
2130			inline: inline, // is datepicker inline or not
2131			dpDiv: (!inline ? this.dpDiv : // presentation div
2132			datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
2133	},
2134
2135	/* Attach the date picker to an input field. */
2136	_connectDatepicker: function(target, inst) {
2137		var input = $(target);
2138		inst.append = $([]);
2139		inst.trigger = $([]);
2140		if (input.hasClass(this.markerClassName)) {
2141			return;
2142		}
2143		this._attachments(input, inst);
2144		input.addClass(this.markerClassName).keydown(this._doKeyDown).
2145			keypress(this._doKeyPress).keyup(this._doKeyUp);
2146		this._autoSize(inst);
2147		$.data(target, "datepicker", inst);
2148		//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
2149		if( inst.settings.disabled ) {
2150			this._disableDatepicker( target );
2151		}
2152	},
2153
2154	/* Make attachments based on settings. */
2155	_attachments: function(input, inst) {
2156		var showOn, buttonText, buttonImage,
2157			appendText = this._get(inst, "appendText"),
2158			isRTL = this._get(inst, "isRTL");
2159
2160		if (inst.append) {
2161			inst.append.remove();
2162		}
2163		if (appendText) {
2164			inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
2165			input[isRTL ? "before" : "after"](inst.append);
2166		}
2167
2168		input.unbind("focus", this._showDatepicker);
2169
2170		if (inst.trigger) {
2171			inst.trigger.remove();
2172		}
2173
2174		showOn = this._get(inst, "showOn");
2175		if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
2176			input.focus(this._showDatepicker);
2177		}
2178		if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
2179			buttonText = this._get(inst, "buttonText");
2180			buttonImage = this._get(inst, "buttonImage");
2181			inst.trigger = $(this._get(inst, "buttonImageOnly") ?
2182				$("<img/>").addClass(this._triggerClass).
2183					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
2184				$("<button type='button'></button>").addClass(this._triggerClass).
2185					html(!buttonImage ? buttonText : $("<img/>").attr(
2186					{ src:buttonImage, alt:buttonText, title:buttonText })));
2187			input[isRTL ? "before" : "after"](inst.trigger);
2188			inst.trigger.click(function() {
2189				if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
2190					$.datepicker._hideDatepicker();
2191				} else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
2192					$.datepicker._hideDatepicker();
2193					$.datepicker._showDatepicker(input[0]);
2194				} else {
2195					$.datepicker._showDatepicker(input[0]);
2196				}
2197				return false;
2198			});
2199		}
2200	},
2201
2202	/* Apply the maximum length for the date format. */
2203	_autoSize: function(inst) {
2204		if (this._get(inst, "autoSize") && !inst.inline) {
2205			var findMax, max, maxI, i,
2206				date = new Date(2009, 12 - 1, 20), // Ensure double digits
2207				dateFormat = this._get(inst, "dateFormat");
2208
2209			if (dateFormat.match(/[DM]/)) {
2210				findMax = function(names) {
2211					max = 0;
2212					maxI = 0;
2213					for (i = 0; i < names.length; i++) {
2214						if (names[i].length > max) {
2215							max = names[i].length;
2216							maxI = i;
2217						}
2218					}
2219					return maxI;
2220				};
2221				date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
2222					"monthNames" : "monthNamesShort"))));
2223				date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
2224					"dayNames" : "dayNamesShort"))) + 20 - date.getDay());
2225			}
2226			inst.input.attr("size", this._formatDate(inst, date).length);
2227		}
2228	},
2229
2230	/* Attach an inline date picker to a div. */
2231	_inlineDatepicker: function(target, inst) {
2232		var divSpan = $(target);
2233		if (divSpan.hasClass(this.markerClassName)) {
2234			return;
2235		}
2236		divSpan.addClass(this.markerClassName).append(inst.dpDiv);
2237		$.data(target, "datepicker", inst);
2238		this._setDate(inst, this._getDefaultDate(inst), true);
2239		this._updateDatepicker(inst);
2240		this._updateAlternate(inst);
2241		//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
2242		if( inst.settings.disabled ) {
2243			this._disableDatepicker( target );
2244		}
2245		// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
2246		// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
2247		inst.dpDiv.css( "display", "block" );
2248	},
2249
2250	/* Pop-up the date picker in a "dialog" box.
2251	 * @param  input element - ignored
2252	 * @param  date	string or Date - the initial date to display
2253	 * @param  onSelect  function - the function to call when a date is selected
2254	 * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
2255	 * @param  pos int[2] - coordinates for the dialog's position within the screen or
2256	 *					event - with x/y coordinates or
2257	 *					leave empty for default (screen centre)
2258	 * @return the manager object
2259	 */
2260	_dialogDatepicker: function(input, date, onSelect, settings, pos) {
2261		var id, browserWidth, browserHeight, scrollX, scrollY,
2262			inst = this._dialogInst; // internal instance
2263
2264		if (!inst) {
2265			this.uuid += 1;
2266			id = "dp" + this.uuid;
2267			this._dialogInput = $("<input type='text' id='" + id +
2268				"' style='position: absolute; top: -100px; width: 0px;'/>");
2269			this._dialogInput.keydown(this._doKeyDown);
2270			$("body").append(this._dialogInput);
2271			inst = this._dialogInst = this._newInst(this._dialogInput, false);
2272			inst.settings = {};
2273			$.data(this._dialogInput[0], "datepicker", inst);
2274		}
2275		datepicker_extendRemove(inst.settings, settings || {});
2276		date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
2277		this._dialogInput.val(date);
2278
2279		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
2280		if (!this._pos) {
2281			browserWidth = document.documentElement.clientWidth;
2282			browserHeight = document.documentElement.clientHeight;
2283			scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
2284			scrollY = document.documentElement.scrollTop || document.body.scrollTop;
2285			this._pos = // should use actual width/height below
2286				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
2287		}
2288
2289		// move input on screen for focus, but hidden behind dialog
2290		this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
2291		inst.settings.onSelect = onSelect;
2292		this._inDialog = true;
2293		this.dpDiv.addClass(this._dialogClass);
2294		this._showDatepicker(this._dialogInput[0]);
2295		if ($.blockUI) {
2296			$.blockUI(this.dpDiv);
2297		}
2298		$.data(this._dialogInput[0], "datepicker", inst);
2299		return this;
2300	},
2301
2302	/* Detach a datepicker from its control.
2303	 * @param  target	element - the target input field or division or span
2304	 */
2305	_destroyDatepicker: function(target) {
2306		var nodeName,
2307			$target = $(target),
2308			inst = $.data(target, "datepicker");
2309
2310		if (!$target.hasClass(this.markerClassName)) {
2311			return;
2312		}
2313
2314		nodeName = target.nodeName.toLowerCase();
2315		$.removeData(target, "datepicker");
2316		if (nodeName === "input") {
2317			inst.append.remove();
2318			inst.trigger.remove();
2319			$target.removeClass(this.markerClassName).
2320				unbind("focus", this._showDatepicker).
2321				unbind("keydown", this._doKeyDown).
2322				unbind("keypress", this._doKeyPress).
2323				unbind("keyup", this._doKeyUp);
2324		} else if (nodeName === "div" || nodeName === "span") {
2325			$target.removeClass(this.markerClassName).empty();
2326		}
2327
2328		if ( datepicker_instActive === inst ) {
2329			datepicker_instActive = null;
2330		}
2331	},
2332
2333	/* Enable the date picker to a jQuery selection.
2334	 * @param  target	element - the target input field or division or span
2335	 */
2336	_enableDatepicker: function(target) {
2337		var nodeName, inline,
2338			$target = $(target),
2339			inst = $.data(target, "datepicker");
2340
2341		if (!$target.hasClass(this.markerClassName)) {
2342			return;
2343		}
2344
2345		nodeName = target.nodeName.toLowerCase();
2346		if (nodeName === "input") {
2347			target.disabled = false;
2348			inst.trigger.filter("button").
2349				each(function() { this.disabled = false; }).end().
2350				filter("img").css({opacity: "1.0", cursor: ""});
2351		} else if (nodeName === "div" || nodeName === "span") {
2352			inline = $target.children("." + this._inlineClass);
2353			inline.children().removeClass("ui-state-disabled");
2354			inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
2355				prop("disabled", false);
2356		}
2357		this._disabledInputs = $.map(this._disabledInputs,
2358			function(value) { return (value === target ? null : value); }); // delete entry
2359	},
2360
2361	/* Disable the date picker to a jQuery selection.
2362	 * @param  target	element - the target input field or division or span
2363	 */
2364	_disableDatepicker: function(target) {
2365		var nodeName, inline,
2366			$target = $(target),
2367			inst = $.data(target, "datepicker");
2368
2369		if (!$target.hasClass(this.markerClassName)) {
2370			return;
2371		}
2372
2373		nodeName = target.nodeName.toLowerCase();
2374		if (nodeName === "input") {
2375			target.disabled = true;
2376			inst.trigger.filter("button").
2377				each(function() { this.disabled = true; }).end().
2378				filter("img").css({opacity: "0.5", cursor: "default"});
2379		} else if (nodeName === "div" || nodeName === "span") {
2380			inline = $target.children("." + this._inlineClass);
2381			inline.children().addClass("ui-state-disabled");
2382			inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
2383				prop("disabled", true);
2384		}
2385		this._disabledInputs = $.map(this._disabledInputs,
2386			function(value) { return (value === target ? null : value); }); // delete entry
2387		this._disabledInputs[this._disabledInputs.length] = target;
2388	},
2389
2390	/* Is the first field in a jQuery collection disabled as a datepicker?
2391	 * @param  target	element - the target input field or division or span
2392	 * @return boolean - true if disabled, false if enabled
2393	 */
2394	_isDisabledDatepicker: function(target) {
2395		if (!target) {
2396			return false;
2397		}
2398		for (var i = 0; i < this._disabledInputs.length; i++) {
2399			if (this._disabledInputs[i] === target) {
2400				return true;
2401			}
2402		}
2403		return false;
2404	},
2405
2406	/* Retrieve the instance data for the target control.
2407	 * @param  target  element - the target input field or division or span
2408	 * @return  object - the associated instance data
2409	 * @throws  error if a jQuery problem getting data
2410	 */
2411	_getInst: function(target) {
2412		try {
2413			return $.data(target, "datepicker");
2414		}
2415		catch (err) {
2416			throw "Missing instance data for this datepicker";
2417		}
2418	},
2419
2420	/* Update or retrieve the settings for a date picker attached to an input field or division.
2421	 * @param  target  element - the target input field or division or span
2422	 * @param  name	object - the new settings to update or
2423	 *				string - the name of the setting to change or retrieve,
2424	 *				when retrieving also "all" for all instance settings or
2425	 *				"defaults" for all global defaults
2426	 * @param  value   any - the new value for the setting
2427	 *				(omit if above is an object or to retrieve a value)
2428	 */
2429	_optionDatepicker: function(target, name, value) {
2430		var settings, date, minDate, maxDate,
2431			inst = this._getInst(target);
2432
2433		if (arguments.length === 2 && typeof name === "string") {
2434			return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
2435				(inst ? (name === "all" ? $.extend({}, inst.settings) :
2436				this._get(inst, name)) : null));
2437		}
2438
2439		settings = name || {};
2440		if (typeof name === "string") {
2441			settings = {};
2442			settings[name] = value;
2443		}
2444
2445		if (inst) {
2446			if (this._curInst === inst) {
2447				this._hideDatepicker();
2448			}
2449
2450			date = this._getDateDatepicker(target, true);
2451			minDate = this._getMinMaxDate(inst, "min");
2452			maxDate = this._getMinMaxDate(inst, "max");
2453			datepicker_extendRemove(inst.settings, settings);
2454			// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
2455			if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
2456				inst.settings.minDate = this._formatDate(inst, minDate);
2457			}
2458			if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
2459				inst.settings.maxDate = this._formatDate(inst, maxDate);
2460			}
2461			if ( "disabled" in settings ) {
2462				if ( settings.disabled ) {
2463					this._disableDatepicker(target);
2464				} else {
2465					this._enableDatepicker(target);
2466				}
2467			}
2468			this._attachments($(target), inst);
2469			this._autoSize(inst);
2470			this._setDate(inst, date);
2471			this._updateAlternate(inst);
2472			this._updateDatepicker(inst);
2473		}
2474	},
2475
2476	// change method deprecated
2477	_changeDatepicker: function(target, name, value) {
2478		this._optionDatepicker(target, name, value);
2479	},
2480
2481	/* Redraw the date picker attached to an input field or division.
2482	 * @param  target  element - the target input field or division or span
2483	 */
2484	_refreshDatepicker: function(target) {
2485		var inst = this._getInst(target);
2486		if (inst) {
2487			this._updateDatepicker(inst);
2488		}
2489	},
2490
2491	/* Set the dates for a jQuery selection.
2492	 * @param  target element - the target input field or division or span
2493	 * @param  date	Date - the new date
2494	 */
2495	_setDateDatepicker: function(target, date) {
2496		var inst = this._getInst(target);
2497		if (inst) {
2498			this._setDate(inst, date);
2499			this._updateDatepicker(inst);
2500			this._updateAlternate(inst);
2501		}
2502	},
2503
2504	/* Get the date(s) for the first entry in a jQuery selection.
2505	 * @param  target element - the target input field or division or span
2506	 * @param  noDefault boolean - true if no default date is to be used
2507	 * @return Date - the current date
2508	 */
2509	_getDateDatepicker: function(target, noDefault) {
2510		var inst = this._getInst(target);
2511		if (inst && !inst.inline) {
2512			this._setDateFromField(inst, noDefault);
2513		}
2514		return (inst ? this._getDate(inst) : null);
2515	},
2516
2517	/* Handle keystrokes. */
2518	_doKeyDown: function(event) {
2519		var onSelect, dateStr, sel,
2520			inst = $.datepicker._getInst(event.target),
2521			handled = true,
2522			isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
2523
2524		inst._keyEvent = true;
2525		if ($.datepicker._datepickerShowing) {
2526			switch (event.keyCode) {
2527				case 9: $.datepicker._hideDatepicker();
2528						handled = false;
vendor: 4,495 bytes, lines 2529-2652
2529						break; // hide on tab out
2530				case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
2531									$.datepicker._currentClass + ")", inst.dpDiv);
2532						if (sel[0]) {
2533							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
2534						}
2535
2536						onSelect = $.datepicker._get(inst, "onSelect");
2537						if (onSelect) {
2538							dateStr = $.datepicker._formatDate(inst);
2539
2540							// trigger custom callback
2541							onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
2542						} else {
2543							$.datepicker._hideDatepicker();
2544						}
2545
2546						return false; // don't submit the form
2547				case 27: $.datepicker._hideDatepicker();
2548						break; // hide on escape
2549				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
2550							-$.datepicker._get(inst, "stepBigMonths") :
2551							-$.datepicker._get(inst, "stepMonths")), "M");
2552						break; // previous month/year on page up/+ ctrl
2553				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
2554							+$.datepicker._get(inst, "stepBigMonths") :
2555							+$.datepicker._get(inst, "stepMonths")), "M");
2556						break; // next month/year on page down/+ ctrl
2557				case 35: if (event.ctrlKey || event.metaKey) {
2558							$.datepicker._clearDate(event.target);
2559						}
2560						handled = event.ctrlKey || event.metaKey;
2561						break; // clear on ctrl or command +end
2562				case 36: if (event.ctrlKey || event.metaKey) {
2563							$.datepicker._gotoToday(event.target);
2564						}
2565						handled = event.ctrlKey || event.metaKey;
2566						break; // current on ctrl or command +home
2567				case 37: if (event.ctrlKey || event.metaKey) {
2568							$.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
2569						}
2570						handled = event.ctrlKey || event.metaKey;
2571						// -1 day on ctrl or command +left
2572						if (event.originalEvent.altKey) {
2573							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
2574								-$.datepicker._get(inst, "stepBigMonths") :
2575								-$.datepicker._get(inst, "stepMonths")), "M");
2576						}
2577						// next month/year on alt +left on Mac
2578						break;
2579				case 38: if (event.ctrlKey || event.metaKey) {
2580							$.datepicker._adjustDate(event.target, -7, "D");
2581						}
2582						handled = event.ctrlKey || event.metaKey;
2583						break; // -1 week on ctrl or command +up
2584				case 39: if (event.ctrlKey || event.metaKey) {
2585							$.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
2586						}
2587						handled = event.ctrlKey || event.metaKey;
2588						// +1 day on ctrl or command +right
2589						if (event.originalEvent.altKey) {
2590							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
2591								+$.datepicker._get(inst, "stepBigMonths") :
2592								+$.datepicker._get(inst, "stepMonths")), "M");
2593						}
2594						// next month/year on alt +right
2595						break;
2596				case 40: if (event.ctrlKey || event.metaKey) {
2597							$.datepicker._adjustDate(event.target, +7, "D");
2598						}
2599						handled = event.ctrlKey || event.metaKey;
2600						break; // +1 week on ctrl or command +down
2601				default: handled = false;
2602			}
2603		} else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
2604			$.datepicker._showDatepicker(this);
2605		} else {
2606			handled = false;
2607		}
2608
2609		if (handled) {
2610			event.preventDefault();
2611			event.stopPropagation();
2612		}
2613	},
2614
2615	/* Filter entered characters - based on date format. */
2616	_doKeyPress: function(event) {
2617		var chars, chr,
2618			inst = $.datepicker._getInst(event.target);
2619
2620		if ($.datepicker._get(inst, "constrainInput")) {
2621			chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
2622			chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
2623			return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
2624		}
2625	},
2626
2627	/* Synchronise manual entry and field/alternate field. */
2628	_doKeyUp: function(event) {
2629		var date,
2630			inst = $.datepicker._getInst(event.target);
2631
2632		if (inst.input.val() !== inst.lastVal) {
2633			try {
2634				date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
2635					(inst.input ? inst.input.val() : null),
2636					$.datepicker._getFormatConfig(inst));
2637
2638				if (date) { // only if valid
2639					$.datepicker._setDateFromField(inst);
2640					$.datepicker._updateAlternate(inst);
2641					$.datepicker._updateDatepicker(inst);
2642				}
2643			}
2644			catch (err) {
2645			}
2646		}
2647		return true;
2648	},
2649
2650	/* Pop-up the date picker for a given input field.
2651	 * If false returned from beforeShow event handler do not show.
2652	 * @param  input  element - the input field attached to the date picker or
vendor: 9,398 bytes, lines 2653-2927
2653	 *					event - if triggered by focus
2654	 */
2655	_showDatepicker: function(input) {
2656		input = input.target || input;
2657		if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
2658			input = $("input", input.parentNode)[0];
2659		}
2660
2661		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
2662			return;
2663		}
2664
2665		var inst, beforeShow, beforeShowSettings, isFixed,
2666			offset, showAnim, duration;
2667
2668		inst = $.datepicker._getInst(input);
2669		if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
2670			$.datepicker._curInst.dpDiv.stop(true, true);
2671			if ( inst && $.datepicker._datepickerShowing ) {
2672				$.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
2673			}
2674		}
2675
2676		beforeShow = $.datepicker._get(inst, "beforeShow");
2677		beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
2678		if(beforeShowSettings === false){
2679			return;
2680		}
2681		datepicker_extendRemove(inst.settings, beforeShowSettings);
2682
2683		inst.lastVal = null;
2684		$.datepicker._lastInput = input;
2685		$.datepicker._setDateFromField(inst);
2686
2687		if ($.datepicker._inDialog) { // hide cursor
2688			input.value = "";
2689		}
2690		if (!$.datepicker._pos) { // position below input
2691			$.datepicker._pos = $.datepicker._findPos(input);
2692			$.datepicker._pos[1] += input.offsetHeight; // add the height
2693		}
2694
2695		isFixed = false;
2696		$(input).parents().each(function() {
2697			isFixed |= $(this).css("position") === "fixed";
2698			return !isFixed;
2699		});
2700
2701		offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
2702		$.datepicker._pos = null;
2703		//to avoid flashes on Firefox
2704		inst.dpDiv.empty();
2705		// determine sizing offscreen
2706		inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
2707		$.datepicker._updateDatepicker(inst);
2708		// fix width for dynamic number of date pickers
2709		// and adjust position before showing
2710		offset = $.datepicker._checkOffset(inst, offset, isFixed);
2711		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
2712			"static" : (isFixed ? "fixed" : "absolute")), display: "none",
2713			left: offset.left + "px", top: offset.top + "px"});
2714
2715		if (!inst.inline) {
2716			showAnim = $.datepicker._get(inst, "showAnim");
2717			duration = $.datepicker._get(inst, "duration");
2718			inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
2719			$.datepicker._datepickerShowing = true;
2720
2721			if ( $.effects && $.effects.effect[ showAnim ] ) {
2722				inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
2723			} else {
2724				inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
2725			}
2726
2727			if ( $.datepicker._shouldFocusInput( inst ) ) {
2728				inst.input.focus();
2729			}
2730
2731			$.datepicker._curInst = inst;
2732		}
2733	},
2734
2735	/* Generate the date picker content. */
2736	_updateDatepicker: function(inst) {
2737		this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
2738		datepicker_instActive = inst; // for delegate hover events
2739		inst.dpDiv.empty().append(this._generateHTML(inst));
2740		this._attachHandlers(inst);
2741
2742		var origyearshtml,
2743			numMonths = this._getNumberOfMonths(inst),
2744			cols = numMonths[1],
2745			width = 17,
2746			activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
2747
2748		if ( activeCell.length > 0 ) {
2749			datepicker_handleMouseover.apply( activeCell.get( 0 ) );
2750		}
2751
2752		inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
2753		if (cols > 1) {
2754			inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
2755		}
2756		inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
2757			"Class"]("ui-datepicker-multi");
2758		inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
2759			"Class"]("ui-datepicker-rtl");
2760
2761		if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
2762			inst.input.focus();
2763		}
2764
2765		// deffered render of the years select (to avoid flashes on Firefox)
2766		if( inst.yearshtml ){
2767			origyearshtml = inst.yearshtml;
2768			setTimeout(function(){
2769				//assure that inst.yearshtml didn't change.
2770				if( origyearshtml === inst.yearshtml && inst.yearshtml ){
2771					inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
2772				}
2773				origyearshtml = inst.yearshtml = null;
2774			}, 0);
2775		}
2776	},
2777
2778	// #6694 - don't focus the input if it's already focused
2779	// this breaks the change event in IE
2780	// Support: IE and jQuery <1.9
2781	_shouldFocusInput: function( inst ) {
2782		return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
2783	},
2784
2785	/* Check positioning to remain on screen. */
2786	_checkOffset: function(inst, offset, isFixed) {
2787		var dpWidth = inst.dpDiv.outerWidth(),
2788			dpHeight = inst.dpDiv.outerHeight(),
2789			inputWidth = inst.input ? inst.input.outerWidth() : 0,
2790			inputHeight = inst.input ? inst.input.outerHeight() : 0,
2791			viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
2792			viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
2793
2794		offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
2795		offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
2796		offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
2797
2798		// now check if datepicker is showing outside window viewport - move to a better place if so.
2799		offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
2800			Math.abs(offset.left + dpWidth - viewWidth) : 0);
2801		offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
2802			Math.abs(dpHeight + inputHeight) : 0);
2803
2804		return offset;
2805	},
2806
2807	/* Find an object's position on the screen. */
2808	_findPos: function(obj) {
2809		var position,
2810			inst = this._getInst(obj),
2811			isRTL = this._get(inst, "isRTL");
2812
2813		while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
2814			obj = obj[isRTL ? "previousSibling" : "nextSibling"];
2815		}
2816
2817		position = $(obj).offset();
2818		return [position.left, position.top];
2819	},
2820
2821	/* Hide the date picker from view.
2822	 * @param  input  element - the input field attached to the date picker
2823	 */
2824	_hideDatepicker: function(input) {
2825		var showAnim, duration, postProcess, onClose,
2826			inst = this._curInst;
2827
2828		if (!inst || (input && inst !== $.data(input, "datepicker"))) {
2829			return;
2830		}
2831
2832		if (this._datepickerShowing) {
2833			showAnim = this._get(inst, "showAnim");
2834			duration = this._get(inst, "duration");
2835			postProcess = function() {
2836				$.datepicker._tidyDialog(inst);
2837			};
2838
2839			// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
2840			if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
2841				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
2842			} else {
2843				inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
2844					(showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
2845			}
2846
2847			if (!showAnim) {
2848				postProcess();
2849			}
2850			this._datepickerShowing = false;
2851
2852			onClose = this._get(inst, "onClose");
2853			if (onClose) {
2854				onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
2855			}
2856
2857			this._lastInput = null;
2858			if (this._inDialog) {
2859				this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
2860				if ($.blockUI) {
2861					$.unblockUI();
2862					$("body").append(this.dpDiv);
2863				}
2864			}
2865			this._inDialog = false;
2866		}
2867	},
2868
2869	/* Tidy up after a dialog display. */
2870	_tidyDialog: function(inst) {
2871		inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
2872	},
2873
2874	/* Close date picker if clicked elsewhere. */
2875	_checkExternalClick: function(event) {
2876		if (!$.datepicker._curInst) {
2877			return;
2878		}
2879
2880		var $target = $(event.target),
2881			inst = $.datepicker._getInst($target[0]);
2882
2883		if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
2884				$target.parents("#" + $.datepicker._mainDivId).length === 0 &&
2885				!$target.hasClass($.datepicker.markerClassName) &&
2886				!$target.closest("." + $.datepicker._triggerClass).length &&
2887				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
2888			( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
2889				$.datepicker._hideDatepicker();
2890		}
2891	},
2892
2893	/* Adjust one of the date sub-fields. */
2894	_adjustDate: function(id, offset, period) {
2895		var target = $(id),
2896			inst = this._getInst(target[0]);
2897
2898		if (this._isDisabledDatepicker(target[0])) {
2899			return;
2900		}
2901		this._adjustInstDate(inst, offset +
2902			(period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
2903			period);
2904		this._updateDatepicker(inst);
2905	},
2906
2907	/* Action for current link. */
2908	_gotoToday: function(id) {
2909		var date,
2910			target = $(id),
2911			inst = this._getInst(target[0]);
2912
2913		if (this._get(inst, "gotoCurrent") && inst.currentDay) {
2914			inst.selectedDay = inst.currentDay;
2915			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
2916			inst.drawYear = inst.selectedYear = inst.currentYear;
2917		} else {
2918			date = new Date();
2919			inst.selectedDay = date.getDate();
2920			inst.drawMonth = inst.selectedMonth = date.getMonth();
2921			inst.drawYear = inst.selectedYear = date.getFullYear();
2922		}
2923		this._notifyChange(inst);
2924		this._adjustDate(target);
2925	},
2926
2927	/* Action for selecting a new month/year. */
vendor: 4,436 bytes, lines 2928-3059
2928	_selectMonthYear: function(id, select, period) {
2929		var target = $(id),
2930			inst = this._getInst(target[0]);
2931
2932		inst["selected" + (period === "M" ? "Month" : "Year")] =
2933		inst["draw" + (period === "M" ? "Month" : "Year")] =
2934			parseInt(select.options[select.selectedIndex].value,10);
2935
2936		this._notifyChange(inst);
2937		this._adjustDate(target);
2938	},
2939
2940	/* Action for selecting a day. */
2941	_selectDay: function(id, month, year, td) {
2942		var inst,
2943			target = $(id);
2944
2945		if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
2946			return;
2947		}
2948
2949		inst = this._getInst(target[0]);
2950		inst.selectedDay = inst.currentDay = $("a", td).html();
2951		inst.selectedMonth = inst.currentMonth = month;
2952		inst.selectedYear = inst.currentYear = year;
2953		this._selectDate(id, this._formatDate(inst,
2954			inst.currentDay, inst.currentMonth, inst.currentYear));
2955	},
2956
2957	/* Erase the input field and hide the date picker. */
2958	_clearDate: function(id) {
2959		var target = $(id);
2960		this._selectDate(target, "");
2961	},
2962
2963	/* Update the input field with the selected date. */
2964	_selectDate: function(id, dateStr) {
2965		var onSelect,
2966			target = $(id),
2967			inst = this._getInst(target[0]);
2968
2969		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
2970		if (inst.input) {
2971			inst.input.val(dateStr);
2972		}
2973		this._updateAlternate(inst);
2974
2975		onSelect = this._get(inst, "onSelect");
2976		if (onSelect) {
2977			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
2978		} else if (inst.input) {
2979			inst.input.trigger("change"); // fire the change event
2980		}
2981
2982		if (inst.inline){
2983			this._updateDatepicker(inst);
2984		} else {
2985			this._hideDatepicker();
2986			this._lastInput = inst.input[0];
2987			if (typeof(inst.input[0]) !== "object") {
2988				inst.input.focus(); // restore focus
2989			}
2990			this._lastInput = null;
2991		}
2992	},
2993
2994	/* Update any alternate field to synchronise with the main field. */
2995	_updateAlternate: function(inst) {
2996		var altFormat, date, dateStr,
2997			altField = this._get(inst, "altField");
2998
2999		if (altField) { // update alternate field too
3000			altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
3001			date = this._getDate(inst);
3002			dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
3003			$(altField).each(function() { $(this).val(dateStr); });
3004		}
3005	},
3006
3007	/* Set as beforeShowDay function to prevent selection of weekends.
3008	 * @param  date  Date - the date to customise
3009	 * @return [boolean, string] - is this date selectable?, what is its CSS class?
3010	 */
3011	noWeekends: function(date) {
3012		var day = date.getDay();
3013		return [(day > 0 && day < 6), ""];
3014	},
3015
3016	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
3017	 * @param  date  Date - the date to get the week for
3018	 * @return  number - the number of the week within the year that contains this date
3019	 */
3020	iso8601Week: function(date) {
3021		var time,
3022			checkDate = new Date(date.getTime());
3023
3024		// Find Thursday of this week starting on Monday
3025		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
3026
3027		time = checkDate.getTime();
3028		checkDate.setMonth(0); // Compare with Jan 1
3029		checkDate.setDate(1);
3030		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
3031	},
3032
3033	/* Parse a string value into a date object.
3034	 * See formatDate below for the possible formats.
3035	 *
3036	 * @param  format string - the expected format of the date
3037	 * @param  value string - the date in the above format
3038	 * @param  settings Object - attributes include:
3039	 *					shortYearCutoff  number - the cutoff year for determining the century (optional)
3040	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
3041	 *					dayNames		string[7] - names of the days from Sunday (optional)
3042	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
3043	 *					monthNames		string[12] - names of the months (optional)
3044	 * @return  Date - the extracted date value or null if value is blank
3045	 */
3046	parseDate: function (format, value, settings) {
3047		if (format == null || value == null) {
3048			throw "Invalid arguments";
3049		}
3050
3051		value = (typeof value === "object" ? value.toString() : value + "");
3052		if (value === "") {
3053			return null;
3054		}
3055
3056		var iFormat, dim, extra,
3057			iValue = 0,
3058			shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
3059			shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp 
vendor: 5,261 bytes, lines 3059-3245
3059:
3060				new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
3061			dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
3062			dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
3063			monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
3064			monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
3065			year = -1,
3066			month = -1,
3067			day = -1,
3068			doy = -1,
3069			literal = false,
3070			date,
3071			// Check whether a format character is doubled
3072			lookAhead = function(match) {
3073				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
3074				if (matches) {
3075					iFormat++;
3076				}
3077				return matches;
3078			},
3079			// Extract a number from the string value
3080			getNumber = function(match) {
3081				var isDoubled = lookAhead(match),
3082					size = (match === "@" ? 14 : (match === "!" ? 20 :
3083					(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
3084					minSize = (match === "y" ? size : 1),
3085					digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
3086					num = value.substring(iValue).match(digits);
3087				if (!num) {
3088					throw "Missing number at position " + iValue;
3089				}
3090				iValue += num[0].length;
3091				return parseInt(num[0], 10);
3092			},
3093			// Extract a name from the string value and convert to an index
3094			getName = function(match, shortNames, longNames) {
3095				var index = -1,
3096					names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
3097						return [ [k, v] ];
3098					}).sort(function (a, b) {
3099						return -(a[1].length - b[1].length);
3100					});
3101
3102				$.each(names, function (i, pair) {
3103					var name = pair[1];
3104					if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
3105						index = pair[0];
3106						iValue += name.length;
3107						return false;
3108					}
3109				});
3110				if (index !== -1) {
3111					return index + 1;
3112				} else {
3113					throw "Unknown name at position " + iValue;
3114				}
3115			},
3116			// Confirm that a literal character matches the string value
3117			checkLiteral = function() {
3118				if (value.charAt(iValue) !== format.charAt(iFormat)) {
3119					throw "Unexpected literal at position " + iValue;
3120				}
3121				iValue++;
3122			};
3123
3124		for (iFormat = 0; iFormat < format.length; iFormat++) {
3125			if (literal) {
3126				if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
3127					literal = false;
3128				} else {
3129					checkLiteral();
3130				}
3131			} else {
3132				switch (format.charAt(iFormat)) {
3133					case "d":
3134						day = getNumber("d");
3135						break;
3136					case "D":
3137						getName("D", dayNamesShort, dayNames);
3138						break;
3139					case "o":
3140						doy = getNumber("o");
3141						break;
3142					case "m":
3143						month = getNumber("m");
3144						break;
3145					case "M":
3146						month = getName("M", monthNamesShort, monthNames);
3147						break;
3148					case "y":
3149						year = getNumber("y");
3150						break;
3151					case "@":
3152						date = new Date(getNumber("@"));
3153						year = date.getFullYear();
3154						month = date.getMonth() + 1;
3155						day = date.getDate();
3156						break;
3157					case "!":
3158						date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
3159						year = date.getFullYear();
3160						month = date.getMonth() + 1;
3161						day = date.getDate();
3162						break;
3163					case "'":
3164						if (lookAhead("'")){
3165							checkLiteral();
3166						} else {
3167							literal = true;
3168						}
3169						break;
3170					default:
3171						checkLiteral();
3172				}
3173			}
3174		}
3175
3176		if (iValue < value.length){
3177			extra = value.substr(iValue);
3178			if (!/^\s+/.test(extra)) {
3179				throw "Extra/unparsed characters found in date: " + extra;
3180			}
3181		}
3182
3183		if (year === -1) {
3184			year = new Date().getFullYear();
3185		} else if (year < 100) {
3186			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
3187				(year <= shortYearCutoff ? 0 : -100);
3188		}
3189
3190		if (doy > -1) {
3191			month = 1;
3192			day = doy;
3193			do {
3194				dim = this._getDaysInMonth(year, month - 1);
3195				if (day <= dim) {
3196					break;
3197				}
3198				month++;
3199				day -= dim;
3200			} while (true);
3201		}
3202
3203		date = this._daylightSavingAdjust(new Date(year, month - 1, day));
3204		if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
3205			throw "Invalid date"; // E.g. 31/02/00
3206		}
3207		return date;
3208	},
3209
3210	/* Standard date formats. */
3211	ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
3212	COOKIE: "D, dd M yy",
3213	ISO_8601: "yy-mm-dd",
3214	RFC_822: "D, d M y",
3215	RFC_850: "DD, dd-M-y",
3216	RFC_1036: "D, d M y",
3217	RFC_1123: "D, d M yy",
3218	RFC_2822: "D, d M yy",
3219	RSS: "D, d M y", // RFC 822
3220	TICKS: "!",
3221	TIMESTAMP: "@",
3222	W3C: "yy-mm-dd", // ISO 8601
3223
3224	_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
3225		Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
3226
3227	/* Format a date object into a string value.
3228	 * The format can be combinations of the following:
3229	 * d  - day of month (no leading zero)
3230	 * dd - day of month (two digit)
3231	 * o  - day of year (no leading zeros)
3232	 * oo - day of year (three digit)
3233	 * D  - day name short
3234	 * DD - day name long
3235	 * m  - month of year (no leading zero)
3236	 * mm - month of year (two digit)
3237	 * M  - month name short
3238	 * MM - month name long
3239	 * y  - year (two digit)
3240	 * yy - year (four digit)
3241	 * @ - Unix timestamp (ms since 01/01/1970)
3242	 * ! - Windows ticks (100ns since 01/01/0001)
3243	 * "..." - literal text
3244	 * '' - single quote
3245	 *
vendor: 11,157 bytes, lines 3246-3579
3246	 * @param  format string - the desired format of the date
3247	 * @param  date Date - the date value to format
3248	 * @param  settings Object - attributes include:
3249	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
3250	 *					dayNames		string[7] - names of the days from Sunday (optional)
3251	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
3252	 *					monthNames		string[12] - names of the months (optional)
3253	 * @return  string - the date in the above format
3254	 */
3255	formatDate: function (format, date, settings) {
3256		if (!date) {
3257			return "";
3258		}
3259
3260		var iFormat,
3261			dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
3262			dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
3263			monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
3264			monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
3265			// Check whether a format character is doubled
3266			lookAhead = function(match) {
3267				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
3268				if (matches) {
3269					iFormat++;
3270				}
3271				return matches;
3272			},
3273			// Format a number, with leading zero if necessary
3274			formatNumber = function(match, value, len) {
3275				var num = "" + value;
3276				if (lookAhead(match)) {
3277					while (num.length < len) {
3278						num = "0" + num;
3279					}
3280				}
3281				return num;
3282			},
3283			// Format a name, short or long as requested
3284			formatName = function(match, value, shortNames, longNames) {
3285				return (lookAhead(match) ? longNames[value] : shortNames[value]);
3286			},
3287			output = "",
3288			literal = false;
3289
3290		if (date) {
3291			for (iFormat = 0; iFormat < format.length; iFormat++) {
3292				if (literal) {
3293					if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
3294						literal = false;
3295					} else {
3296						output += format.charAt(iFormat);
3297					}
3298				} else {
3299					switch (format.charAt(iFormat)) {
3300						case "d":
3301							output += formatNumber("d", date.getDate(), 2);
3302							break;
3303						case "D":
3304							output += formatName("D", date.getDay(), dayNamesShort, dayNames);
3305							break;
3306						case "o":
3307							output += formatNumber("o",
3308								Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
3309							break;
3310						case "m":
3311							output += formatNumber("m", date.getMonth() + 1, 2);
3312							break;
3313						case "M":
3314							output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
3315							break;
3316						case "y":
3317							output += (lookAhead("y") ? date.getFullYear() :
3318								(date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
3319							break;
3320						case "@":
3321							output += date.getTime();
3322							break;
3323						case "!":
3324							output += date.getTime() * 10000 + this._ticksTo1970;
3325							break;
3326						case "'":
3327							if (lookAhead("'")) {
3328								output += "'";
3329							} else {
3330								literal = true;
3331							}
3332							break;
3333						default:
3334							output += format.charAt(iFormat);
3335					}
3336				}
3337			}
3338		}
3339		return output;
3340	},
3341
3342	/* Extract all possible characters from the date format. */
3343	_possibleChars: function (format) {
3344		var iFormat,
3345			chars = "",
3346			literal = false,
3347			// Check whether a format character is doubled
3348			lookAhead = function(match) {
3349				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
3350				if (matches) {
3351					iFormat++;
3352				}
3353				return matches;
3354			};
3355
3356		for (iFormat = 0; iFormat < format.length; iFormat++) {
3357			if (literal) {
3358				if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
3359					literal = false;
3360				} else {
3361					chars += format.charAt(iFormat);
3362				}
3363			} else {
3364				switch (format.charAt(iFormat)) {
3365					case "d": case "m": case "y": case "@":
3366						chars += "0123456789";
3367						break;
3368					case "D": case "M":
3369						return null; // Accept anything
3370					case "'":
3371						if (lookAhead("'")) {
3372							chars += "'";
3373						} else {
3374							literal = true;
3375						}
3376						break;
3377					default:
3378						chars += format.charAt(iFormat);
3379				}
3380			}
3381		}
3382		return chars;
3383	},
3384
3385	/* Get a setting value, defaulting if necessary. */
3386	_get: function(inst, name) {
3387		return inst.settings[name] !== undefined ?
3388			inst.settings[name] : this._defaults[name];
3389	},
3390
3391	/* Parse existing date and initialise date picker. */
3392	_setDateFromField: function(inst, noDefault) {
3393		if (inst.input.val() === inst.lastVal) {
3394			return;
3395		}
3396
3397		var dateFormat = this._get(inst, "dateFormat"),
3398			dates = inst.lastVal = inst.input ? inst.input.val() : null,
3399			defaultDate = this._getDefaultDate(inst),
3400			date = defaultDate,
3401			settings = this._getFormatConfig(inst);
3402
3403		try {
3404			date = this.parseDate(dateFormat, dates, settings) || defaultDate;
3405		} catch (event) {
3406			dates = (noDefault ? "" : dates);
3407		}
3408		inst.selectedDay = date.getDate();
3409		inst.drawMonth = inst.selectedMonth = date.getMonth();
3410		inst.drawYear = inst.selectedYear = date.getFullYear();
3411		inst.currentDay = (dates ? date.getDate() : 0);
3412		inst.currentMonth = (dates ? date.getMonth() : 0);
3413		inst.currentYear = (dates ? date.getFullYear() : 0);
3414		this._adjustInstDate(inst);
3415	},
3416
3417	/* Retrieve the default date shown on opening. */
3418	_getDefaultDate: function(inst) {
3419		return this._restrictMinMax(inst,
3420			this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
3421	},
3422
3423	/* A date may be specified as an exact value or a relative one. */
3424	_determineDate: function(inst, date, defaultDate) {
3425		var offsetNumeric = function(offset) {
3426				var date = new Date();
3427				date.setDate(date.getDate() + offset);
3428				return date;
3429			},
3430			offsetString = function(offset) {
3431				try {
3432					return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
3433						offset, $.datepicker._getFormatConfig(inst));
3434				}
3435				catch (e) {
3436					// Ignore
3437				}
3438
3439				var date = (offset.toLowerCase().match(/^c/) ?
3440					$.datepicker._getDate(inst) : null) || new Date(),
3441					year = date.getFullYear(),
3442					month = date.getMonth(),
3443					day = date.getDate(),
3444					pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
3445					matches = pattern.exec(offset);
3446
3447				while (matches) {
3448					switch (matches[2] || "d") {
3449						case "d" : case "D" :
3450							day += parseInt(matches[1],10); break;
3451						case "w" : case "W" :
3452							day += parseInt(matches[1],10) * 7; break;
3453						case "m" : case "M" :
3454							month += parseInt(matches[1],10);
3455							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
3456							break;
3457						case "y": case "Y" :
3458							year += parseInt(matches[1],10);
3459							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
3460							break;
3461					}
3462					matches = pattern.exec(offset);
3463				}
3464				return new Date(year, month, day);
3465			},
3466			newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
3467				(typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
3468
3469		newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
3470		if (newDate) {
3471			newDate.setHours(0);
3472			newDate.setMinutes(0);
3473			newDate.setSeconds(0);
3474			newDate.setMilliseconds(0);
3475		}
3476		return this._daylightSavingAdjust(newDate);
3477	},
3478
3479	/* Handle switch to/from daylight saving.
3480	 * Hours may be non-zero on daylight saving cut-over:
3481	 * > 12 when midnight changeover, but then cannot generate
3482	 * midnight datetime, so jump to 1AM, otherwise reset.
3483	 * @param  date  (Date) the date to check
3484	 * @return  (Date) the corrected date
3485	 */
3486	_daylightSavingAdjust: function(date) {
3487		if (!date) {
3488			return null;
3489		}
3490		date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
3491		return date;
3492	},
3493
3494	/* Set the date(s) directly. */
3495	_setDate: function(inst, date, noChange) {
3496		var clear = !date,
3497			origMonth = inst.selectedMonth,
3498			origYear = inst.selectedYear,
3499			newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
3500
3501		inst.selectedDay = inst.currentDay = newDate.getDate();
3502		inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
3503		inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
3504		if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
3505			this._notifyChange(inst);
3506		}
3507		this._adjustInstDate(inst);
3508		if (inst.input) {
3509			inst.input.val(clear ? "" : this._formatDate(inst));
3510		}
3511	},
3512
3513	/* Retrieve the date(s) directly. */
3514	_getDate: function(inst) {
3515		var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
3516			this._daylightSavingAdjust(new Date(
3517			inst.currentYear, inst.currentMonth, inst.currentDay)));
3518			return startDate;
3519	},
3520
3521	/* Attach the onxxx handlers.  These are declared statically so
3522	 * they work with static code transformers like Caja.
3523	 */
3524	_attachHandlers: function(inst) {
3525		var stepMonths = this._get(inst, "stepMonths"),
3526			id = "#" + inst.id.replace( /\\\\/g, "\\" );
3527		inst.dpDiv.find("[data-handler]").map(function () {
3528			var handler = {
3529				prev: function () {
3530					$.datepicker._adjustDate(id, -stepMonths, "M");
3531				},
3532				next: function () {
3533					$.datepicker._adjustDate(id, +stepMonths, "M");
3534				},
3535				hide: function () {
3536					$.datepicker._hideDatepicker();
3537				},
3538				today: function () {
3539					$.datepicker._gotoToday(id);
3540				},
3541				selectDay: function () {
3542					$.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
3543					return false;
3544				},
3545				selectMonth: function () {
3546					$.datepicker._selectMonthYear(id, this, "M");
3547					return false;
3548				},
3549				selectYear: function () {
3550					$.datepicker._selectMonthYear(id, this, "Y");
3551					return false;
3552				}
3553			};
3554			$(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
3555		});
3556	},
3557
3558	/* Generate the HTML for the current state of the date picker. */
3559	_generateHTML: function(inst) {
3560		var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
3561			controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
3562			monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
3563			selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
3564			cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
3565			printDate, dRow, tbody, daySettings, otherMonth, unselectable,
3566			tempDate = new Date(),
3567			today = this._daylightSavingAdjust(
3568				new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
3569			isRTL = this._get(inst, "isRTL"),
3570			showButtonPanel = this._get(inst, "showButtonPanel"),
3571			hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
3572			navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
3573			numMonths = this._getNumberOfMonths(inst),
3574			showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
3575			stepMonths = this._get(inst, "stepMonths"),
3576			isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
3577			currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
3578				new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
3579			minDate = this._getMinMaxDate(inst, "min"),
vendor: 9,139 bytes, lines 3580-3738
3580			maxDate = this._getMinMaxDate(inst, "max"),
3581			drawMonth = inst.drawMonth - showCurrentAtPos,
3582			drawYear = inst.drawYear;
3583
3584		if (drawMonth < 0) {
3585			drawMonth += 12;
3586			drawYear--;
3587		}
3588		if (maxDate) {
3589			maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
3590				maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
3591			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
3592			while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
3593				drawMonth--;
3594				if (drawMonth < 0) {
3595					drawMonth = 11;
3596					drawYear--;
3597				}
3598			}
3599		}
3600		inst.drawMonth = drawMonth;
3601		inst.drawYear = drawYear;
3602
3603		prevText = this._get(inst, "prevText");
3604		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
3605			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
3606			this._getFormatConfig(inst)));
3607
3608		prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
3609			"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
3610			" title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
3611			(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
3612
3613		nextText = this._get(inst, "nextText");
3614		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
3615			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
3616			this._getFormatConfig(inst)));
3617
3618		next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
3619			"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
3620			" title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
3621			(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
3622
3623		currentText = this._get(inst, "currentText");
3624		gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
3625		currentText = (!navigationAsDateFormat ? currentText :
3626			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
3627
3628		controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
3629			this._get(inst, "closeText") + "</button>" : "");
3630
3631		buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
3632			(this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
3633			">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
3634
3635		firstDay = parseInt(this._get(inst, "firstDay"),10);
3636		firstDay = (isNaN(firstDay) ? 0 : firstDay);
3637
3638		showWeek = this._get(inst, "showWeek");
3639		dayNames = this._get(inst, "dayNames");
3640		dayNamesMin = this._get(inst, "dayNamesMin");
3641		monthNames = this._get(inst, "monthNames");
3642		monthNamesShort = this._get(inst, "monthNamesShort");
3643		beforeShowDay = this._get(inst, "beforeShowDay");
3644		showOtherMonths = this._get(inst, "showOtherMonths");
3645		selectOtherMonths = this._get(inst, "selectOtherMonths");
3646		defaultDate = this._getDefaultDate(inst);
3647		html = "";
3648		dow;
3649		for (row = 0; row < numMonths[0]; row++) {
3650			group = "";
3651			this.maxRows = 4;
3652			for (col = 0; col < numMonths[1]; col++) {
3653				selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
3654				cornerClass = " ui-corner-all";
3655				calender = "";
3656				if (isMultiMonth) {
3657					calender += "<div class='ui-datepicker-group";
3658					if (numMonths[1] > 1) {
3659						switch (col) {
3660							case 0: calender += " ui-datepicker-group-first";
3661								cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
3662							case numMonths[1]-1: calender += " ui-datepicker-group-last";
3663								cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
3664							default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
3665						}
3666					}
3667					calender += "'>";
3668				}
3669				calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
3670					(/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
3671					(/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
3672					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
3673					row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
3674					"</div><table class='ui-datepicker-calendar'><thead>" +
3675					"<tr>";
3676				thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
3677				for (dow = 0; dow < 7; dow++) { // days of the week
3678					day = (dow + firstDay) % 7;
3679					thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
3680						"<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
3681				}
3682				calender += thead + "</tr></thead><tbody>";
3683				daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
3684				if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
3685					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
3686				}
3687				leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
3688				curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
3689				numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
3690				this.maxRows = numRows;
3691				printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
3692				for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
3693					calender += "<tr>";
3694					tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
3695						this._get(inst, "calculateWeek")(printDate) + "</td>");
3696					for (dow = 0; dow < 7; dow++) { // create date picker days
3697						daySettings = (beforeShowDay ?
3698							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
3699						otherMonth = (printDate.getMonth() !== drawMonth);
3700						unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
3701							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
3702						tbody += "<td class='" +
3703							((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
3704							(otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
3705							((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
3706							(defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
3707							// or defaultDate is current printedDate and defaultDate is selectedDate
3708							" " + this._dayOverClass : "") + // highlight selected day
3709							(unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
3710							(otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
3711							(printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
3712							(printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
3713							((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
3714							(unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
3715							(otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
3716							(unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
3717							(printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
3718							(printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
3719							(otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
3720							"' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
3721						printDate.setDate(printDate.getDate() + 1);
3722						printDate = this._daylightSavingAdjust(printDate);
3723					}
3724					calender += tbody + "</tr>";
3725				}
3726				drawMonth++;
3727				if (drawMonth > 11) {
3728					drawMonth = 0;
3729					drawYear++;
3730				}
3731				calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
3732							((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
3733				group += calender;
3734			}
3735			html += group;
3736		}
3737		html += buttonPanel;
3738		inst._keyEvent = false;
vendor: 5,431 bytes, lines 3739-3882
3739		return html;
3740	},
3741
3742	/* Generate the month and year header. */
3743	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
3744			secondary, monthNames, monthNamesShort) {
3745
3746		var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
3747			changeMonth = this._get(inst, "changeMonth"),
3748			changeYear = this._get(inst, "changeYear"),
3749			showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
3750			html = "<div class='ui-datepicker-title'>",
3751			monthHtml = "";
3752
3753		// month selection
3754		if (secondary || !changeMonth) {
3755			monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
3756		} else {
3757			inMinYear = (minDate && minDate.getFullYear() === drawYear);
3758			inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
3759			monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
3760			for ( month = 0; month < 12; month++) {
3761				if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
3762					monthHtml += "<option value='" + month + "'" +
3763						(month === drawMonth ? " selected='selected'" : "") +
3764						">" + monthNamesShort[month] + "</option>";
3765				}
3766			}
3767			monthHtml += "</select>";
3768		}
3769
3770		if (!showMonthAfterYear) {
3771			html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
3772		}
3773
3774		// year selection
3775		if ( !inst.yearshtml ) {
3776			inst.yearshtml = "";
3777			if (secondary || !changeYear) {
3778				html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
3779			} else {
3780				// determine range of years to display
3781				years = this._get(inst, "yearRange").split(":");
3782				thisYear = new Date().getFullYear();
3783				determineYear = function(value) {
3784					var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
3785						(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
3786						parseInt(value, 10)));
3787					return (isNaN(year) ? thisYear : year);
3788				};
3789				year = determineYear(years[0]);
3790				endYear = Math.max(year, determineYear(years[1] || ""));
3791				year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
3792				endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
3793				inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
3794				for (; year <= endYear; year++) {
3795					inst.yearshtml += "<option value='" + year + "'" +
3796						(year === drawYear ? " selected='selected'" : "") +
3797						">" + year + "</option>";
3798				}
3799				inst.yearshtml += "</select>";
3800
3801				html += inst.yearshtml;
3802				inst.yearshtml = null;
3803			}
3804		}
3805
3806		html += this._get(inst, "yearSuffix");
3807		if (showMonthAfterYear) {
3808			html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
3809		}
3810		html += "</div>"; // Close datepicker_header
3811		return html;
3812	},
3813
3814	/* Adjust one of the date sub-fields. */
3815	_adjustInstDate: function(inst, offset, period) {
3816		var year = inst.drawYear + (period === "Y" ? offset : 0),
3817			month = inst.drawMonth + (period === "M" ? offset : 0),
3818			day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
3819			date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
3820
3821		inst.selectedDay = date.getDate();
3822		inst.drawMonth = inst.selectedMonth = date.getMonth();
3823		inst.drawYear = inst.selectedYear = date.getFullYear();
3824		if (period === "M" || period === "Y") {
3825			this._notifyChange(inst);
3826		}
3827	},
3828
3829	/* Ensure a date is within any min/max bounds. */
3830	_restrictMinMax: function(inst, date) {
3831		var minDate = this._getMinMaxDate(inst, "min"),
3832			maxDate = this._getMinMaxDate(inst, "max"),
3833			newDate = (minDate && date < minDate ? minDate : date);
3834		return (maxDate && newDate > maxDate ? maxDate : newDate);
3835	},
3836
3837	/* Notify change of month/year. */
3838	_notifyChange: function(inst) {
3839		var onChange = this._get(inst, "onChangeMonthYear");
3840		if (onChange) {
3841			onChange.apply((inst.input ? inst.input[0] : null),
3842				[inst.selectedYear, inst.selectedMonth + 1, inst]);
3843		}
3844	},
3845
3846	/* Determine the number of months to show. */
3847	_getNumberOfMonths: function(inst) {
3848		var numMonths = this._get(inst, "numberOfMonths");
3849		return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
3850	},
3851
3852	/* Determine the current maximum date - ensure no time components are set. */
3853	_getMinMaxDate: function(inst, minMax) {
3854		return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
3855	},
3856
3857	/* Find the number of days in a given month. */
3858	_getDaysInMonth: function(year, month) {
3859		return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
3860	},
3861
3862	/* Find the day of the week of the first of a month. */
3863	_getFirstDayOfMonth: function(year, month) {
3864		return new Date(year, month, 1).getDay();
3865	},
3866
3867	/* Determines if we should allow a "next/prev" month display change. */
3868	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
3869		var numMonths = this._getNumberOfMonths(inst),
3870			date = this._daylightSavingAdjust(new Date(curYear,
3871			curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
3872
3873		if (offset < 0) {
3874			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
3875		}
3876		return this._isInRange(inst, date);
3877	},
3878
3879	/* Is the given date in the accepted range? */
3880	_isInRange: function(inst, date) {
3881		var yearSplit, currentYear,
3882			minDate = this._getMinMaxDate(inst, "min"),
vendor: 4,958 bytes, lines 3883-4018
3883			maxDate = this._getMinMaxDate(inst, "max"),
3884			minYear = null,
3885			maxYear = null,
3886			years = this._get(inst, "yearRange");
3887			if (years){
3888				yearSplit = years.split(":");
3889				currentYear = new Date().getFullYear();
3890				minYear = parseInt(yearSplit[0], 10);
3891				maxYear = parseInt(yearSplit[1], 10);
3892				if ( yearSplit[0].match(/[+\-].*/) ) {
3893					minYear += currentYear;
3894				}
3895				if ( yearSplit[1].match(/[+\-].*/) ) {
3896					maxYear += currentYear;
3897				}
3898			}
3899
3900		return ((!minDate || date.getTime() >= minDate.getTime()) &&
3901			(!maxDate || date.getTime() <= maxDate.getTime()) &&
3902			(!minYear || date.getFullYear() >= minYear) &&
3903			(!maxYear || date.getFullYear() <= maxYear));
3904	},
3905
3906	/* Provide the configuration settings for formatting/parsing. */
3907	_getFormatConfig: function(inst) {
3908		var shortYearCutoff = this._get(inst, "shortYearCutoff");
3909		shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
3910			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
3911		return {shortYearCutoff: shortYearCutoff,
3912			dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
3913			monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
3914	},
3915
3916	/* Format the given date for display. */
3917	_formatDate: function(inst, day, month, year) {
3918		if (!day) {
3919			inst.currentDay = inst.selectedDay;
3920			inst.currentMonth = inst.selectedMonth;
3921			inst.currentYear = inst.selectedYear;
3922		}
3923		var date = (day ? (typeof day === "object" ? day :
3924			this._daylightSavingAdjust(new Date(year, month, day))) :
3925			this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
3926		return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
3927	}
3928});
3929
3930/*
3931 * Bind hover events for datepicker elements.
3932 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
3933 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
3934 */
3935function datepicker_bindHover(dpDiv) {
3936	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
3937	return dpDiv.delegate(selector, "mouseout", function() {
3938			$(this).removeClass("ui-state-hover");
3939			if (this.className.indexOf("ui-datepicker-prev") !== -1) {
3940				$(this).removeClass("ui-datepicker-prev-hover");
3941			}
3942			if (this.className.indexOf("ui-datepicker-next") !== -1) {
3943				$(this).removeClass("ui-datepicker-next-hover");
3944			}
3945		})
3946		.delegate( selector, "mouseover", datepicker_handleMouseover );
3947}
3948
3949function datepicker_handleMouseover() {
3950	if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
3951		$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
3952		$(this).addClass("ui-state-hover");
3953		if (this.className.indexOf("ui-datepicker-prev") !== -1) {
3954			$(this).addClass("ui-datepicker-prev-hover");
3955		}
3956		if (this.className.indexOf("ui-datepicker-next") !== -1) {
3957			$(this).addClass("ui-datepicker-next-hover");
3958		}
3959	}
3960}
3961
3962/* jQuery extend now ignores nulls! */
3963function datepicker_extendRemove(target, props) {
3964	$.extend(target, props);
3965	for (var name in props) {
3966		if (props[name] == null) {
3967			target[name] = props[name];
3968		}
3969	}
3970	return target;
3971}
3972
3973/* Invoke the datepicker functionality.
3974   @param  options  string - a command, optionally followed by additional parameters or
3975					Object - settings for attaching new datepicker functionality
3976   @return  jQuery object */
3977$.fn.datepicker = function(options){
3978
3979	/* Verify an empty collection wasn't passed - Fixes #6976 */
3980	if ( !this.length ) {
3981		return this;
3982	}
3983
3984	/* Initialise the date picker. */
3985	if (!$.datepicker.initialized) {
3986		$(document).mousedown($.datepicker._checkExternalClick);
3987		$.datepicker.initialized = true;
3988	}
3989
3990	/* Append datepicker main container to body if not exist. */
3991	if ($("#"+$.datepicker._mainDivId).length === 0) {
3992		$("body").append($.datepicker.dpDiv);
3993	}
3994
3995	var otherArgs = Array.prototype.slice.call(arguments, 1);
3996	if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
3997		return $.datepicker["_" + options + "Datepicker"].
3998			apply($.datepicker, [this[0]].concat(otherArgs));
3999	}
4000	if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
4001		return $.datepicker["_" + options + "Datepicker"].
4002			apply($.datepicker, [this[0]].concat(otherArgs));
4003	}
4004	return this.each(function() {
4005		typeof options === "string" ?
4006			$.datepicker["_" + options + "Datepicker"].
4007				apply($.datepicker, [this].concat(otherArgs)) :
4008			$.datepicker._attachDatepicker(this, options);
4009	});
4010};
4011
4012$.datepicker = new Datepicker(); // singleton instance
4013$.datepicker.initialized = false;
4014$.datepicker.uuid = new Date().getTime();
4015$.datepicker.version = "1.11.4";
4016
4017var datepicker = $.datepicker;
4018
4019
4020
4021}));

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.