]> git.sesse.net Git - remoteglot/blob - www/js/jquery-deprecated-sizzle.js
When a position comes in with the same position but new result, copy the result over...
[remoteglot] / www / js / jquery-deprecated-sizzle.js
1 /*!
2  * jQuery JavaScript Library v2.1.1 -deprecated,-css/hiddenVisibleSelectors,-effects/animatedSelector
3  * http://jquery.com/
4  *
5  * Includes Sizzle.js
6  * http://sizzlejs.com/
7  *
8  * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
9  * Released under the MIT license
10  * http://jquery.org/license
11  *
12  * Date: 2014-09-28T02:59Z
13  */
14
15 (function( global, factory ) {
16
17         if ( typeof module === "object" && typeof module.exports === "object" ) {
18                 // For CommonJS and CommonJS-like environments where a proper window is present,
19                 // execute the factory and get jQuery
20                 // For environments that do not inherently posses a window with a document
21                 // (such as Node.js), expose a jQuery-making factory as module.exports
22                 // This accentuates the need for the creation of a real window
23                 // e.g. var jQuery = require("jquery")(window);
24                 // See ticket #14549 for more info
25                 module.exports = global.document ?
26                         factory( global, true ) :
27                         function( w ) {
28                                 if ( !w.document ) {
29                                         throw new Error( "jQuery requires a window with a document" );
30                                 }
31                                 return factory( w );
32                         };
33         } else {
34                 factory( global );
35         }
36
37 // Pass this if window is not defined yet
38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
39
40 // Can't do this because several apps including ASP.NET trace
41 // the stack via arguments.caller.callee and Firefox dies if
42 // you try to trace through "use strict" call chains. (#13335)
43 // Support: Firefox 18+
44 //
45
46 var arr = [];
47
48 var slice = arr.slice;
49
50 var concat = arr.concat;
51
52 var push = arr.push;
53
54 var indexOf = arr.indexOf;
55
56 var class2type = {};
57
58 var toString = class2type.toString;
59
60 var hasOwn = class2type.hasOwnProperty;
61
62 var support = {};
63
64
65
66 var
67         // Use the correct document accordingly with window argument (sandbox)
68         document = window.document,
69
70         version = "2.1.1 -deprecated,-css/hiddenVisibleSelectors,-effects/animatedSelector",
71
72         // Define a local copy of jQuery
73         jQuery = function( selector, context ) {
74                 // The jQuery object is actually just the init constructor 'enhanced'
75                 // Need init if jQuery is called (just allow error to be thrown if not included)
76                 return new jQuery.fn.init( selector, context );
77         },
78
79         // Support: Android<4.1
80         // Make sure we trim BOM and NBSP
81         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
82
83         // Matches dashed string for camelizing
84         rmsPrefix = /^-ms-/,
85         rdashAlpha = /-([\da-z])/gi,
86
87         // Used by jQuery.camelCase as callback to replace()
88         fcamelCase = function( all, letter ) {
89                 return letter.toUpperCase();
90         };
91
92 jQuery.fn = jQuery.prototype = {
93         // The current version of jQuery being used
94         jquery: version,
95
96         constructor: jQuery,
97
98         // Start with an empty selector
99         selector: "",
100
101         // The default length of a jQuery object is 0
102         length: 0,
103
104         toArray: function() {
105                 return slice.call( this );
106         },
107
108         // Get the Nth element in the matched element set OR
109         // Get the whole matched element set as a clean array
110         get: function( num ) {
111                 return num != null ?
112
113                         // Return just the one element from the set
114                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
115
116                         // Return all the elements in a clean array
117                         slice.call( this );
118         },
119
120         // Take an array of elements and push it onto the stack
121         // (returning the new matched element set)
122         pushStack: function( elems ) {
123
124                 // Build a new jQuery matched element set
125                 var ret = jQuery.merge( this.constructor(), elems );
126
127                 // Add the old object onto the stack (as a reference)
128                 ret.prevObject = this;
129                 ret.context = this.context;
130
131                 // Return the newly-formed element set
132                 return ret;
133         },
134
135         // Execute a callback for every element in the matched set.
136         // (You can seed the arguments with an array of args, but this is
137         // only used internally.)
138         each: function( callback, args ) {
139                 return jQuery.each( this, callback, args );
140         },
141
142         map: function( callback ) {
143                 return this.pushStack( jQuery.map(this, function( elem, i ) {
144                         return callback.call( elem, i, elem );
145                 }));
146         },
147
148         slice: function() {
149                 return this.pushStack( slice.apply( this, arguments ) );
150         },
151
152         first: function() {
153                 return this.eq( 0 );
154         },
155
156         last: function() {
157                 return this.eq( -1 );
158         },
159
160         eq: function( i ) {
161                 var len = this.length,
162                         j = +i + ( i < 0 ? len : 0 );
163                 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
164         },
165
166         end: function() {
167                 return this.prevObject || this.constructor(null);
168         },
169
170         // For internal use only.
171         // Behaves like an Array's method, not like a jQuery method.
172         push: push,
173         sort: arr.sort,
174         splice: arr.splice
175 };
176
177 jQuery.extend = jQuery.fn.extend = function() {
178         var options, name, src, copy, copyIsArray, clone,
179                 target = arguments[0] || {},
180                 i = 1,
181                 length = arguments.length,
182                 deep = false;
183
184         // Handle a deep copy situation
185         if ( typeof target === "boolean" ) {
186                 deep = target;
187
188                 // skip the boolean and the target
189                 target = arguments[ i ] || {};
190                 i++;
191         }
192
193         // Handle case when target is a string or something (possible in deep copy)
194         if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
195                 target = {};
196         }
197
198         // extend jQuery itself if only one argument is passed
199         if ( i === length ) {
200                 target = this;
201                 i--;
202         }
203
204         for ( ; i < length; i++ ) {
205                 // Only deal with non-null/undefined values
206                 if ( (options = arguments[ i ]) != null ) {
207                         // Extend the base object
208                         for ( name in options ) {
209                                 src = target[ name ];
210                                 copy = options[ name ];
211
212                                 // Prevent never-ending loop
213                                 if ( target === copy ) {
214                                         continue;
215                                 }
216
217                                 // Recurse if we're merging plain objects or arrays
218                                 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
219                                         if ( copyIsArray ) {
220                                                 copyIsArray = false;
221                                                 clone = src && jQuery.isArray(src) ? src : [];
222
223                                         } else {
224                                                 clone = src && jQuery.isPlainObject(src) ? src : {};
225                                         }
226
227                                         // Never move original objects, clone them
228                                         target[ name ] = jQuery.extend( deep, clone, copy );
229
230                                 // Don't bring in undefined values
231                                 } else if ( copy !== undefined ) {
232                                         target[ name ] = copy;
233                                 }
234                         }
235                 }
236         }
237
238         // Return the modified object
239         return target;
240 };
241
242 jQuery.extend({
243         // Unique for each copy of jQuery on the page
244         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
245
246         // Assume jQuery is ready without the ready module
247         isReady: true,
248
249         error: function( msg ) {
250                 throw new Error( msg );
251         },
252
253         noop: function() {},
254
255         // See test/unit/core.js for details concerning isFunction.
256         // Since version 1.3, DOM methods and functions like alert
257         // aren't supported. They return false on IE (#2968).
258         isFunction: function( obj ) {
259                 return jQuery.type(obj) === "function";
260         },
261
262         isArray: Array.isArray,
263
264         isWindow: function( obj ) {
265                 return obj != null && obj === obj.window;
266         },
267
268         isNumeric: function( obj ) {
269                 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
270                 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
271                 // subtraction forces infinities to NaN
272                 return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
273         },
274
275         isPlainObject: function( obj ) {
276                 // Not plain objects:
277                 // - Any object or value whose internal [[Class]] property is not "[object Object]"
278                 // - DOM nodes
279                 // - window
280                 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
281                         return false;
282                 }
283
284                 if ( obj.constructor &&
285                                 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
286                         return false;
287                 }
288
289                 // If the function hasn't returned already, we're confident that
290                 // |obj| is a plain object, created by {} or constructed with new Object
291                 return true;
292         },
293
294         isEmptyObject: function( obj ) {
295                 var name;
296                 for ( name in obj ) {
297                         return false;
298                 }
299                 return true;
300         },
301
302         type: function( obj ) {
303                 if ( obj == null ) {
304                         return obj + "";
305                 }
306                 // Support: Android < 4.0, iOS < 6 (functionish RegExp)
307                 return typeof obj === "object" || typeof obj === "function" ?
308                         class2type[ toString.call(obj) ] || "object" :
309                         typeof obj;
310         },
311
312         // Evaluates a script in a global context
313         globalEval: function( code ) {
314                 var script,
315                         indirect = eval;
316
317                 code = jQuery.trim( code );
318
319                 if ( code ) {
320                         // If the code includes a valid, prologue position
321                         // strict mode pragma, execute code by injecting a
322                         // script tag into the document.
323                         if ( code.indexOf("use strict") === 1 ) {
324                                 script = document.createElement("script");
325                                 script.text = code;
326                                 document.head.appendChild( script ).parentNode.removeChild( script );
327                         } else {
328                         // Otherwise, avoid the DOM node creation, insertion
329                         // and removal by using an indirect global eval
330                                 indirect( code );
331                         }
332                 }
333         },
334
335         // Convert dashed to camelCase; used by the css and data modules
336         // Microsoft forgot to hump their vendor prefix (#9572)
337         camelCase: function( string ) {
338                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
339         },
340
341         nodeName: function( elem, name ) {
342                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
343         },
344
345         // args is for internal usage only
346         each: function( obj, callback, args ) {
347                 var value,
348                         i = 0,
349                         length = obj.length,
350                         isArray = isArraylike( obj );
351
352                 if ( args ) {
353                         if ( isArray ) {
354                                 for ( ; i < length; i++ ) {
355                                         value = callback.apply( obj[ i ], args );
356
357                                         if ( value === false ) {
358                                                 break;
359                                         }
360                                 }
361                         } else {
362                                 for ( i in obj ) {
363                                         value = callback.apply( obj[ i ], args );
364
365                                         if ( value === false ) {
366                                                 break;
367                                         }
368                                 }
369                         }
370
371                 // A special, fast, case for the most common use of each
372                 } else {
373                         if ( isArray ) {
374                                 for ( ; i < length; i++ ) {
375                                         value = callback.call( obj[ i ], i, obj[ i ] );
376
377                                         if ( value === false ) {
378                                                 break;
379                                         }
380                                 }
381                         } else {
382                                 for ( i in obj ) {
383                                         value = callback.call( obj[ i ], i, obj[ i ] );
384
385                                         if ( value === false ) {
386                                                 break;
387                                         }
388                                 }
389                         }
390                 }
391
392                 return obj;
393         },
394
395         // Support: Android<4.1
396         trim: function( text ) {
397                 return text == null ?
398                         "" :
399                         ( text + "" ).replace( rtrim, "" );
400         },
401
402         // results is for internal usage only
403         makeArray: function( arr, results ) {
404                 var ret = results || [];
405
406                 if ( arr != null ) {
407                         if ( isArraylike( Object(arr) ) ) {
408                                 jQuery.merge( ret,
409                                         typeof arr === "string" ?
410                                         [ arr ] : arr
411                                 );
412                         } else {
413                                 push.call( ret, arr );
414                         }
415                 }
416
417                 return ret;
418         },
419
420         inArray: function( elem, arr, i ) {
421                 return arr == null ? -1 : indexOf.call( arr, elem, i );
422         },
423
424         merge: function( first, second ) {
425                 var len = +second.length,
426                         j = 0,
427                         i = first.length;
428
429                 for ( ; j < len; j++ ) {
430                         first[ i++ ] = second[ j ];
431                 }
432
433                 first.length = i;
434
435                 return first;
436         },
437
438         grep: function( elems, callback, invert ) {
439                 var callbackInverse,
440                         matches = [],
441                         i = 0,
442                         length = elems.length,
443                         callbackExpect = !invert;
444
445                 // Go through the array, only saving the items
446                 // that pass the validator function
447                 for ( ; i < length; i++ ) {
448                         callbackInverse = !callback( elems[ i ], i );
449                         if ( callbackInverse !== callbackExpect ) {
450                                 matches.push( elems[ i ] );
451                         }
452                 }
453
454                 return matches;
455         },
456
457         // arg is for internal usage only
458         map: function( elems, callback, arg ) {
459                 var value,
460                         i = 0,
461                         length = elems.length,
462                         isArray = isArraylike( elems ),
463                         ret = [];
464
465                 // Go through the array, translating each of the items to their new values
466                 if ( isArray ) {
467                         for ( ; i < length; i++ ) {
468                                 value = callback( elems[ i ], i, arg );
469
470                                 if ( value != null ) {
471                                         ret.push( value );
472                                 }
473                         }
474
475                 // Go through every key on the object,
476                 } else {
477                         for ( i in elems ) {
478                                 value = callback( elems[ i ], i, arg );
479
480                                 if ( value != null ) {
481                                         ret.push( value );
482                                 }
483                         }
484                 }
485
486                 // Flatten any nested arrays
487                 return concat.apply( [], ret );
488         },
489
490         // A global GUID counter for objects
491         guid: 1,
492
493         // Bind a function to a context, optionally partially applying any
494         // arguments.
495         proxy: function( fn, context ) {
496                 var tmp, args, proxy;
497
498                 if ( typeof context === "string" ) {
499                         tmp = fn[ context ];
500                         context = fn;
501                         fn = tmp;
502                 }
503
504                 // Quick check to determine if target is callable, in the spec
505                 // this throws a TypeError, but we will just return undefined.
506                 if ( !jQuery.isFunction( fn ) ) {
507                         return undefined;
508                 }
509
510                 // Simulated bind
511                 args = slice.call( arguments, 2 );
512                 proxy = function() {
513                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
514                 };
515
516                 // Set the guid of unique handler to the same of original handler, so it can be removed
517                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
518
519                 return proxy;
520         },
521
522         now: Date.now,
523
524         // jQuery.support is not used in Core but other projects attach their
525         // properties to it so it needs to exist.
526         support: support
527 });
528
529 // Populate the class2type map
530 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
531         class2type[ "[object " + name + "]" ] = name.toLowerCase();
532 });
533
534 function isArraylike( obj ) {
535         var length = obj.length,
536                 type = jQuery.type( obj );
537
538         if ( type === "function" || jQuery.isWindow( obj ) ) {
539                 return false;
540         }
541
542         if ( obj.nodeType === 1 && length ) {
543                 return true;
544         }
545
546         return type === "array" || length === 0 ||
547                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
548 }
549
550
551 /*
552  * Optional (non-Sizzle) selector module for custom builds.
553  *
554  * Note that this DOES NOT SUPPORT many documented jQuery
555  * features in exchange for its smaller size:
556  *
557  * Attribute not equal selector
558  * Positional selectors (:first; :eq(n); :odd; etc.)
559  * Type selectors (:input; :checkbox; :button; etc.)
560  * State-based selectors (:animated; :visible; :hidden; etc.)
561  * :has(selector)
562  * :not(complex selector)
563  * custom selectors via Sizzle extensions
564  * Leading combinators (e.g., $collection.find("> *"))
565  * Reliable functionality on XML fragments
566  * Requiring all parts of a selector to match elements under context
567  *   (e.g., $div.find("div > *") now matches children of $div)
568  * Matching against non-elements
569  * Reliable sorting of disconnected nodes
570  * querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
571  *
572  * If any of these are unacceptable tradeoffs, either use Sizzle or
573  * customize this stub for the project's specific needs.
574  */
575
576 var docElem = window.document.documentElement,
577         selector_hasDuplicate,
578         matches = docElem.matches ||
579                 docElem.webkitMatchesSelector ||
580                 docElem.mozMatchesSelector ||
581                 docElem.oMatchesSelector ||
582                 docElem.msMatchesSelector,
583         selector_sortOrder = function( a, b ) {
584                 // Flag for duplicate removal
585                 if ( a === b ) {
586                         selector_hasDuplicate = true;
587                         return 0;
588                 }
589
590                 var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
591
592                 if ( compare ) {
593                         // Disconnected nodes
594                         if ( compare & 1 ) {
595
596                                 // Choose the first element that is related to our document
597                                 if ( a === document || jQuery.contains(document, a) ) {
598                                         return -1;
599                                 }
600                                 if ( b === document || jQuery.contains(document, b) ) {
601                                         return 1;
602                                 }
603
604                                 // Maintain original order
605                                 return 0;
606                         }
607
608                         return compare & 4 ? -1 : 1;
609                 }
610
611                 // Not directly comparable, sort on existence of method
612                 return a.compareDocumentPosition ? -1 : 1;
613         };
614
615 jQuery.extend({
616         find: function( selector, context, results, seed ) {
617                 var elem, nodeType,
618                         i = 0;
619
620                 results = results || [];
621                 context = context || document;
622
623                 // Same basic safeguard as Sizzle
624                 if ( !selector || typeof selector !== "string" ) {
625                         return results;
626                 }
627
628                 // Early return if context is not an element or document
629                 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
630                         return [];
631                 }
632
633                 if ( seed ) {
634                         while ( (elem = seed[i++]) ) {
635                                 if ( jQuery.find.matchesSelector(elem, selector) ) {
636                                         results.push( elem );
637                                 }
638                         }
639                 } else {
640                         jQuery.merge( results, context.querySelectorAll(selector) );
641                 }
642
643                 return results;
644         },
645         unique: function( results ) {
646                 var elem,
647                         duplicates = [],
648                         i = 0,
649                         j = 0;
650
651                 selector_hasDuplicate = false;
652                 results.sort( selector_sortOrder );
653
654                 if ( selector_hasDuplicate ) {
655                         while ( (elem = results[i++]) ) {
656                                 if ( elem === results[ i ] ) {
657                                         j = duplicates.push( i );
658                                 }
659                         }
660                         while ( j-- ) {
661                                 results.splice( duplicates[ j ], 1 );
662                         }
663                 }
664
665                 return results;
666         },
667         text: function( elem ) {
668                 var node,
669                         ret = "",
670                         i = 0,
671                         nodeType = elem.nodeType;
672
673                 if ( !nodeType ) {
674                         // If no nodeType, this is expected to be an array
675                         while ( (node = elem[i++]) ) {
676                                 // Do not traverse comment nodes
677                                 ret += jQuery.text( node );
678                         }
679                 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
680                         // Use textContent for elements
681                         return elem.textContent;
682                 } else if ( nodeType === 3 || nodeType === 4 ) {
683                         return elem.nodeValue;
684                 }
685                 // Do not include comment or processing instruction nodes
686
687                 return ret;
688         },
689         contains: function( a, b ) {
690                 var adown = a.nodeType === 9 ? a.documentElement : a,
691                         bup = b && b.parentNode;
692                 return a === bup || !!( bup && bup.nodeType === 1 && adown.contains(bup) );
693         },
694         isXMLDoc: function( elem ) {
695                 return (elem.ownerDocument || elem).documentElement.nodeName !== "HTML";
696         },
697         expr: {
698                 attrHandle: {},
699                 match: {
700                         bool: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
701                         needsContext: /^[\x20\t\r\n\f]*[>+~]/
702                 }
703         }
704 });
705
706 jQuery.extend( jQuery.find, {
707         matches: function( expr, elements ) {
708                 return jQuery.find( expr, null, null, elements );
709         },
710         matchesSelector: function( elem, expr ) {
711                 return matches.call( elem, expr );
712         },
713         attr: function( elem, name ) {
714                 return elem.getAttribute( name );
715         }
716 });
717
718
719
720 var rneedsContext = jQuery.expr.match.needsContext;
721
722 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
723
724
725
726 var risSimple = /^.[^:#\[\.,]*$/;
727
728 // Implement the identical functionality for filter and not
729 function winnow( elements, qualifier, not ) {
730         if ( jQuery.isFunction( qualifier ) ) {
731                 return jQuery.grep( elements, function( elem, i ) {
732                         /* jshint -W018 */
733                         return !!qualifier.call( elem, i, elem ) !== not;
734                 });
735
736         }
737
738         if ( qualifier.nodeType ) {
739                 return jQuery.grep( elements, function( elem ) {
740                         return ( elem === qualifier ) !== not;
741                 });
742
743         }
744
745         if ( typeof qualifier === "string" ) {
746                 if ( risSimple.test( qualifier ) ) {
747                         return jQuery.filter( qualifier, elements, not );
748                 }
749
750                 qualifier = jQuery.filter( qualifier, elements );
751         }
752
753         return jQuery.grep( elements, function( elem ) {
754                 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
755         });
756 }
757
758 jQuery.filter = function( expr, elems, not ) {
759         var elem = elems[ 0 ];
760
761         if ( not ) {
762                 expr = ":not(" + expr + ")";
763         }
764
765         return elems.length === 1 && elem.nodeType === 1 ?
766                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
767                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
768                         return elem.nodeType === 1;
769                 }));
770 };
771
772 jQuery.fn.extend({
773         find: function( selector ) {
774                 var i,
775                         len = this.length,
776                         ret = [],
777                         self = this;
778
779                 if ( typeof selector !== "string" ) {
780                         return this.pushStack( jQuery( selector ).filter(function() {
781                                 for ( i = 0; i < len; i++ ) {
782                                         if ( jQuery.contains( self[ i ], this ) ) {
783                                                 return true;
784                                         }
785                                 }
786                         }) );
787                 }
788
789                 for ( i = 0; i < len; i++ ) {
790                         jQuery.find( selector, self[ i ], ret );
791                 }
792
793                 // Needed because $( selector, context ) becomes $( context ).find( selector )
794                 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
795                 ret.selector = this.selector ? this.selector + " " + selector : selector;
796                 return ret;
797         },
798         filter: function( selector ) {
799                 return this.pushStack( winnow(this, selector || [], false) );
800         },
801         not: function( selector ) {
802                 return this.pushStack( winnow(this, selector || [], true) );
803         },
804         is: function( selector ) {
805                 return !!winnow(
806                         this,
807
808                         // If this is a positional/relative selector, check membership in the returned set
809                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
810                         typeof selector === "string" && rneedsContext.test( selector ) ?
811                                 jQuery( selector ) :
812                                 selector || [],
813                         false
814                 ).length;
815         }
816 });
817
818
819 // Initialize a jQuery object
820
821
822 // A central reference to the root jQuery(document)
823 var rootjQuery,
824
825         // A simple way to check for HTML strings
826         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
827         // Strict HTML recognition (#11290: must start with <)
828         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
829
830         init = jQuery.fn.init = function( selector, context ) {
831                 var match, elem;
832
833                 // HANDLE: $(""), $(null), $(undefined), $(false)
834                 if ( !selector ) {
835                         return this;
836                 }
837
838                 // Handle HTML strings
839                 if ( typeof selector === "string" ) {
840                         if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
841                                 // Assume that strings that start and end with <> are HTML and skip the regex check
842                                 match = [ null, selector, null ];
843
844                         } else {
845                                 match = rquickExpr.exec( selector );
846                         }
847
848                         // Match html or make sure no context is specified for #id
849                         if ( match && (match[1] || !context) ) {
850
851                                 // HANDLE: $(html) -> $(array)
852                                 if ( match[1] ) {
853                                         context = context instanceof jQuery ? context[0] : context;
854
855                                         // scripts is true for back-compat
856                                         // Intentionally let the error be thrown if parseHTML is not present
857                                         jQuery.merge( this, jQuery.parseHTML(
858                                                 match[1],
859                                                 context && context.nodeType ? context.ownerDocument || context : document,
860                                                 true
861                                         ) );
862
863                                         // HANDLE: $(html, props)
864                                         if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
865                                                 for ( match in context ) {
866                                                         // Properties of context are called as methods if possible
867                                                         if ( jQuery.isFunction( this[ match ] ) ) {
868                                                                 this[ match ]( context[ match ] );
869
870                                                         // ...and otherwise set as attributes
871                                                         } else {
872                                                                 this.attr( match, context[ match ] );
873                                                         }
874                                                 }
875                                         }
876
877                                         return this;
878
879                                 // HANDLE: $(#id)
880                                 } else {
881                                         elem = document.getElementById( match[2] );
882
883                                         // Check parentNode to catch when Blackberry 4.6 returns
884                                         // nodes that are no longer in the document #6963
885                                         if ( elem && elem.parentNode ) {
886                                                 // Inject the element directly into the jQuery object
887                                                 this.length = 1;
888                                                 this[0] = elem;
889                                         }
890
891                                         this.context = document;
892                                         this.selector = selector;
893                                         return this;
894                                 }
895
896                         // HANDLE: $(expr, $(...))
897                         } else if ( !context || context.jquery ) {
898                                 return ( context || rootjQuery ).find( selector );
899
900                         // HANDLE: $(expr, context)
901                         // (which is just equivalent to: $(context).find(expr)
902                         } else {
903                                 return this.constructor( context ).find( selector );
904                         }
905
906                 // HANDLE: $(DOMElement)
907                 } else if ( selector.nodeType ) {
908                         this.context = this[0] = selector;
909                         this.length = 1;
910                         return this;
911
912                 // HANDLE: $(function)
913                 // Shortcut for document ready
914                 } else if ( jQuery.isFunction( selector ) ) {
915                         return typeof rootjQuery.ready !== "undefined" ?
916                                 rootjQuery.ready( selector ) :
917                                 // Execute immediately if ready is not present
918                                 selector( jQuery );
919                 }
920
921                 if ( selector.selector !== undefined ) {
922                         this.selector = selector.selector;
923                         this.context = selector.context;
924                 }
925
926                 return jQuery.makeArray( selector, this );
927         };
928
929 // Give the init function the jQuery prototype for later instantiation
930 init.prototype = jQuery.fn;
931
932 // Initialize central reference
933 rootjQuery = jQuery( document );
934
935
936 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
937         // methods guaranteed to produce a unique set when starting from a unique set
938         guaranteedUnique = {
939                 children: true,
940                 contents: true,
941                 next: true,
942                 prev: true
943         };
944
945 jQuery.extend({
946         dir: function( elem, dir, until ) {
947                 var matched = [],
948                         truncate = until !== undefined;
949
950                 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
951                         if ( elem.nodeType === 1 ) {
952                                 if ( truncate && jQuery( elem ).is( until ) ) {
953                                         break;
954                                 }
955                                 matched.push( elem );
956                         }
957                 }
958                 return matched;
959         },
960
961         sibling: function( n, elem ) {
962                 var matched = [];
963
964                 for ( ; n; n = n.nextSibling ) {
965                         if ( n.nodeType === 1 && n !== elem ) {
966                                 matched.push( n );
967                         }
968                 }
969
970                 return matched;
971         }
972 });
973
974 jQuery.fn.extend({
975         has: function( target ) {
976                 var targets = jQuery( target, this ),
977                         l = targets.length;
978
979                 return this.filter(function() {
980                         var i = 0;
981                         for ( ; i < l; i++ ) {
982                                 if ( jQuery.contains( this, targets[i] ) ) {
983                                         return true;
984                                 }
985                         }
986                 });
987         },
988
989         closest: function( selectors, context ) {
990                 var cur,
991                         i = 0,
992                         l = this.length,
993                         matched = [],
994                         pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
995                                 jQuery( selectors, context || this.context ) :
996                                 0;
997
998                 for ( ; i < l; i++ ) {
999                         for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
1000                                 // Always skip document fragments
1001                                 if ( cur.nodeType < 11 && (pos ?
1002                                         pos.index(cur) > -1 :
1003
1004                                         // Don't pass non-elements to Sizzle
1005                                         cur.nodeType === 1 &&
1006                                                 jQuery.find.matchesSelector(cur, selectors)) ) {
1007
1008                                         matched.push( cur );
1009                                         break;
1010                                 }
1011                         }
1012                 }
1013
1014                 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
1015         },
1016
1017         // Determine the position of an element within
1018         // the matched set of elements
1019         index: function( elem ) {
1020
1021                 // No argument, return index in parent
1022                 if ( !elem ) {
1023                         return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
1024                 }
1025
1026                 // index in selector
1027                 if ( typeof elem === "string" ) {
1028                         return indexOf.call( jQuery( elem ), this[ 0 ] );
1029                 }
1030
1031                 // Locate the position of the desired element
1032                 return indexOf.call( this,
1033
1034                         // If it receives a jQuery object, the first element is used
1035                         elem.jquery ? elem[ 0 ] : elem
1036                 );
1037         },
1038
1039         add: function( selector, context ) {
1040                 return this.pushStack(
1041                         jQuery.unique(
1042                                 jQuery.merge( this.get(), jQuery( selector, context ) )
1043                         )
1044                 );
1045         },
1046
1047         addBack: function( selector ) {
1048                 return this.add( selector == null ?
1049                         this.prevObject : this.prevObject.filter(selector)
1050                 );
1051         }
1052 });
1053
1054 function sibling( cur, dir ) {
1055         while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
1056         return cur;
1057 }
1058
1059 jQuery.each({
1060         parent: function( elem ) {
1061                 var parent = elem.parentNode;
1062                 return parent && parent.nodeType !== 11 ? parent : null;
1063         },
1064         parents: function( elem ) {
1065                 return jQuery.dir( elem, "parentNode" );
1066         },
1067         parentsUntil: function( elem, i, until ) {
1068                 return jQuery.dir( elem, "parentNode", until );
1069         },
1070         next: function( elem ) {
1071                 return sibling( elem, "nextSibling" );
1072         },
1073         prev: function( elem ) {
1074                 return sibling( elem, "previousSibling" );
1075         },
1076         nextAll: function( elem ) {
1077                 return jQuery.dir( elem, "nextSibling" );
1078         },
1079         prevAll: function( elem ) {
1080                 return jQuery.dir( elem, "previousSibling" );
1081         },
1082         nextUntil: function( elem, i, until ) {
1083                 return jQuery.dir( elem, "nextSibling", until );
1084         },
1085         prevUntil: function( elem, i, until ) {
1086                 return jQuery.dir( elem, "previousSibling", until );
1087         },
1088         siblings: function( elem ) {
1089                 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
1090         },
1091         children: function( elem ) {
1092                 return jQuery.sibling( elem.firstChild );
1093         },
1094         contents: function( elem ) {
1095                 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
1096         }
1097 }, function( name, fn ) {
1098         jQuery.fn[ name ] = function( until, selector ) {
1099                 var matched = jQuery.map( this, fn, until );
1100
1101                 if ( name.slice( -5 ) !== "Until" ) {
1102                         selector = until;
1103                 }
1104
1105                 if ( selector && typeof selector === "string" ) {
1106                         matched = jQuery.filter( selector, matched );
1107                 }
1108
1109                 if ( this.length > 1 ) {
1110                         // Remove duplicates
1111                         if ( !guaranteedUnique[ name ] ) {
1112                                 jQuery.unique( matched );
1113                         }
1114
1115                         // Reverse order for parents* and prev-derivatives
1116                         if ( rparentsprev.test( name ) ) {
1117                                 matched.reverse();
1118                         }
1119                 }
1120
1121                 return this.pushStack( matched );
1122         };
1123 });
1124 var rnotwhite = (/\S+/g);
1125
1126
1127
1128 // String to Object options format cache
1129 var optionsCache = {};
1130
1131 // Convert String-formatted options into Object-formatted ones and store in cache
1132 function createOptions( options ) {
1133         var object = optionsCache[ options ] = {};
1134         jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
1135                 object[ flag ] = true;
1136         });
1137         return object;
1138 }
1139
1140 /*
1141  * Create a callback list using the following parameters:
1142  *
1143  *      options: an optional list of space-separated options that will change how
1144  *                      the callback list behaves or a more traditional option object
1145  *
1146  * By default a callback list will act like an event callback list and can be
1147  * "fired" multiple times.
1148  *
1149  * Possible options:
1150  *
1151  *      once:                   will ensure the callback list can only be fired once (like a Deferred)
1152  *
1153  *      memory:                 will keep track of previous values and will call any callback added
1154  *                                      after the list has been fired right away with the latest "memorized"
1155  *                                      values (like a Deferred)
1156  *
1157  *      unique:                 will ensure a callback can only be added once (no duplicate in the list)
1158  *
1159  *      stopOnFalse:    interrupt callings when a callback returns false
1160  *
1161  */
1162 jQuery.Callbacks = function( options ) {
1163
1164         // Convert options from String-formatted to Object-formatted if needed
1165         // (we check in cache first)
1166         options = typeof options === "string" ?
1167                 ( optionsCache[ options ] || createOptions( options ) ) :
1168                 jQuery.extend( {}, options );
1169
1170         var // Last fire value (for non-forgettable lists)
1171                 memory,
1172                 // Flag to know if list was already fired
1173                 fired,
1174                 // Flag to know if list is currently firing
1175                 firing,
1176                 // First callback to fire (used internally by add and fireWith)
1177                 firingStart,
1178                 // End of the loop when firing
1179                 firingLength,
1180                 // Index of currently firing callback (modified by remove if needed)
1181                 firingIndex,
1182                 // Actual callback list
1183                 list = [],
1184                 // Stack of fire calls for repeatable lists
1185                 stack = !options.once && [],
1186                 // Fire callbacks
1187                 fire = function( data ) {
1188                         memory = options.memory && data;
1189                         fired = true;
1190                         firingIndex = firingStart || 0;
1191                         firingStart = 0;
1192                         firingLength = list.length;
1193                         firing = true;
1194                         for ( ; list && firingIndex < firingLength; firingIndex++ ) {
1195                                 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
1196                                         memory = false; // To prevent further calls using add
1197                                         break;
1198                                 }
1199                         }
1200                         firing = false;
1201                         if ( list ) {
1202                                 if ( stack ) {
1203                                         if ( stack.length ) {
1204                                                 fire( stack.shift() );
1205                                         }
1206                                 } else if ( memory ) {
1207                                         list = [];
1208                                 } else {
1209                                         self.disable();
1210                                 }
1211                         }
1212                 },
1213                 // Actual Callbacks object
1214                 self = {
1215                         // Add a callback or a collection of callbacks to the list
1216                         add: function() {
1217                                 if ( list ) {
1218                                         // First, we save the current length
1219                                         var start = list.length;
1220                                         (function add( args ) {
1221                                                 jQuery.each( args, function( _, arg ) {
1222                                                         var type = jQuery.type( arg );
1223                                                         if ( type === "function" ) {
1224                                                                 if ( !options.unique || !self.has( arg ) ) {
1225                                                                         list.push( arg );
1226                                                                 }
1227                                                         } else if ( arg && arg.length && type !== "string" ) {
1228                                                                 // Inspect recursively
1229                                                                 add( arg );
1230                                                         }
1231                                                 });
1232                                         })( arguments );
1233                                         // Do we need to add the callbacks to the
1234                                         // current firing batch?
1235                                         if ( firing ) {
1236                                                 firingLength = list.length;
1237                                         // With memory, if we're not firing then
1238                                         // we should call right away
1239                                         } else if ( memory ) {
1240                                                 firingStart = start;
1241                                                 fire( memory );
1242                                         }
1243                                 }
1244                                 return this;
1245                         },
1246                         // Remove a callback from the list
1247                         remove: function() {
1248                                 if ( list ) {
1249                                         jQuery.each( arguments, function( _, arg ) {
1250                                                 var index;
1251                                                 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
1252                                                         list.splice( index, 1 );
1253                                                         // Handle firing indexes
1254                                                         if ( firing ) {
1255                                                                 if ( index <= firingLength ) {
1256                                                                         firingLength--;
1257                                                                 }
1258                                                                 if ( index <= firingIndex ) {
1259                                                                         firingIndex--;
1260                                                                 }
1261                                                         }
1262                                                 }
1263                                         });
1264                                 }
1265                                 return this;
1266                         },
1267                         // Check if a given callback is in the list.
1268                         // If no argument is given, return whether or not list has callbacks attached.
1269                         has: function( fn ) {
1270                                 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
1271                         },
1272                         // Remove all callbacks from the list
1273                         empty: function() {
1274                                 list = [];
1275                                 firingLength = 0;
1276                                 return this;
1277                         },
1278                         // Have the list do nothing anymore
1279                         disable: function() {
1280                                 list = stack = memory = undefined;
1281                                 return this;
1282                         },
1283                         // Is it disabled?
1284                         disabled: function() {
1285                                 return !list;
1286                         },
1287                         // Lock the list in its current state
1288                         lock: function() {
1289                                 stack = undefined;
1290                                 if ( !memory ) {
1291                                         self.disable();
1292                                 }
1293                                 return this;
1294                         },
1295                         // Is it locked?
1296                         locked: function() {
1297                                 return !stack;
1298                         },
1299                         // Call all callbacks with the given context and arguments
1300                         fireWith: function( context, args ) {
1301                                 if ( list && ( !fired || stack ) ) {
1302                                         args = args || [];
1303                                         args = [ context, args.slice ? args.slice() : args ];
1304                                         if ( firing ) {
1305                                                 stack.push( args );
1306                                         } else {
1307                                                 fire( args );
1308                                         }
1309                                 }
1310                                 return this;
1311                         },
1312                         // Call all the callbacks with the given arguments
1313                         fire: function() {
1314                                 self.fireWith( this, arguments );
1315                                 return this;
1316                         },
1317                         // To know if the callbacks have already been called at least once
1318                         fired: function() {
1319                                 return !!fired;
1320                         }
1321                 };
1322
1323         return self;
1324 };
1325
1326
1327 jQuery.extend({
1328
1329         Deferred: function( func ) {
1330                 var tuples = [
1331                                 // action, add listener, listener list, final state
1332                                 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
1333                                 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
1334                                 [ "notify", "progress", jQuery.Callbacks("memory") ]
1335                         ],
1336                         state = "pending",
1337                         promise = {
1338                                 state: function() {
1339                                         return state;
1340                                 },
1341                                 always: function() {
1342                                         deferred.done( arguments ).fail( arguments );
1343                                         return this;
1344                                 },
1345                                 then: function( /* fnDone, fnFail, fnProgress */ ) {
1346                                         var fns = arguments;
1347                                         return jQuery.Deferred(function( newDefer ) {
1348                                                 jQuery.each( tuples, function( i, tuple ) {
1349                                                         var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
1350                                                         // deferred[ done | fail | progress ] for forwarding actions to newDefer
1351                                                         deferred[ tuple[1] ](function() {
1352                                                                 var returned = fn && fn.apply( this, arguments );
1353                                                                 if ( returned && jQuery.isFunction( returned.promise ) ) {
1354                                                                         returned.promise()
1355                                                                                 .done( newDefer.resolve )
1356                                                                                 .fail( newDefer.reject )
1357                                                                                 .progress( newDefer.notify );
1358                                                                 } else {
1359                                                                         newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
1360                                                                 }
1361                                                         });
1362                                                 });
1363                                                 fns = null;
1364                                         }).promise();
1365                                 },
1366                                 // Get a promise for this deferred
1367                                 // If obj is provided, the promise aspect is added to the object
1368                                 promise: function( obj ) {
1369                                         return obj != null ? jQuery.extend( obj, promise ) : promise;
1370                                 }
1371                         },
1372                         deferred = {};
1373
1374                 // Keep pipe for back-compat
1375                 promise.pipe = promise.then;
1376
1377                 // Add list-specific methods
1378                 jQuery.each( tuples, function( i, tuple ) {
1379                         var list = tuple[ 2 ],
1380                                 stateString = tuple[ 3 ];
1381
1382                         // promise[ done | fail | progress ] = list.add
1383                         promise[ tuple[1] ] = list.add;
1384
1385                         // Handle state
1386                         if ( stateString ) {
1387                                 list.add(function() {
1388                                         // state = [ resolved | rejected ]
1389                                         state = stateString;
1390
1391                                 // [ reject_list | resolve_list ].disable; progress_list.lock
1392                                 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1393                         }
1394
1395                         // deferred[ resolve | reject | notify ]
1396                         deferred[ tuple[0] ] = function() {
1397                                 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
1398                                 return this;
1399                         };
1400                         deferred[ tuple[0] + "With" ] = list.fireWith;
1401                 });
1402
1403                 // Make the deferred a promise
1404                 promise.promise( deferred );
1405
1406                 // Call given func if any
1407                 if ( func ) {
1408                         func.call( deferred, deferred );
1409                 }
1410
1411                 // All done!
1412                 return deferred;
1413         },
1414
1415         // Deferred helper
1416         when: function( subordinate /* , ..., subordinateN */ ) {
1417                 var i = 0,
1418                         resolveValues = slice.call( arguments ),
1419                         length = resolveValues.length,
1420
1421                         // the count of uncompleted subordinates
1422                         remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1423
1424                         // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1425                         deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1426
1427                         // Update function for both resolve and progress values
1428                         updateFunc = function( i, contexts, values ) {
1429                                 return function( value ) {
1430                                         contexts[ i ] = this;
1431                                         values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
1432                                         if ( values === progressValues ) {
1433                                                 deferred.notifyWith( contexts, values );
1434                                         } else if ( !( --remaining ) ) {
1435                                                 deferred.resolveWith( contexts, values );
1436                                         }
1437                                 };
1438                         },
1439
1440                         progressValues, progressContexts, resolveContexts;
1441
1442                 // add listeners to Deferred subordinates; treat others as resolved
1443                 if ( length > 1 ) {
1444                         progressValues = new Array( length );
1445                         progressContexts = new Array( length );
1446                         resolveContexts = new Array( length );
1447                         for ( ; i < length; i++ ) {
1448                                 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1449                                         resolveValues[ i ].promise()
1450                                                 .done( updateFunc( i, resolveContexts, resolveValues ) )
1451                                                 .fail( deferred.reject )
1452                                                 .progress( updateFunc( i, progressContexts, progressValues ) );
1453                                 } else {
1454                                         --remaining;
1455                                 }
1456                         }
1457                 }
1458
1459                 // if we're not waiting on anything, resolve the master
1460                 if ( !remaining ) {
1461                         deferred.resolveWith( resolveContexts, resolveValues );
1462                 }
1463
1464                 return deferred.promise();
1465         }
1466 });
1467
1468
1469 // The deferred used on DOM ready
1470 var readyList;
1471
1472 jQuery.fn.ready = function( fn ) {
1473         // Add the callback
1474         jQuery.ready.promise().done( fn );
1475
1476         return this;
1477 };
1478
1479 jQuery.extend({
1480         // Is the DOM ready to be used? Set to true once it occurs.
1481         isReady: false,
1482
1483         // A counter to track how many items to wait for before
1484         // the ready event fires. See #6781
1485         readyWait: 1,
1486
1487         // Hold (or release) the ready event
1488         holdReady: function( hold ) {
1489                 if ( hold ) {
1490                         jQuery.readyWait++;
1491                 } else {
1492                         jQuery.ready( true );
1493                 }
1494         },
1495
1496         // Handle when the DOM is ready
1497         ready: function( wait ) {
1498
1499                 // Abort if there are pending holds or we're already ready
1500                 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
1501                         return;
1502                 }
1503
1504                 // Remember that the DOM is ready
1505                 jQuery.isReady = true;
1506
1507                 // If a normal DOM Ready event fired, decrement, and wait if need be
1508                 if ( wait !== true && --jQuery.readyWait > 0 ) {
1509                         return;
1510                 }
1511
1512                 // If there are functions bound, to execute
1513                 readyList.resolveWith( document, [ jQuery ] );
1514
1515                 // Trigger any bound ready events
1516                 if ( jQuery.fn.triggerHandler ) {
1517                         jQuery( document ).triggerHandler( "ready" );
1518                         jQuery( document ).off( "ready" );
1519                 }
1520         }
1521 });
1522
1523 /**
1524  * The ready event handler and self cleanup method
1525  */
1526 function completed() {
1527         document.removeEventListener( "DOMContentLoaded", completed, false );
1528         window.removeEventListener( "load", completed, false );
1529         jQuery.ready();
1530 }
1531
1532 jQuery.ready.promise = function( obj ) {
1533         if ( !readyList ) {
1534
1535                 readyList = jQuery.Deferred();
1536
1537                 // Catch cases where $(document).ready() is called after the browser event has already occurred.
1538                 // we once tried to use readyState "interactive" here, but it caused issues like the one
1539                 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
1540                 if ( document.readyState === "complete" ) {
1541                         // Handle it asynchronously to allow scripts the opportunity to delay ready
1542                         setTimeout( jQuery.ready );
1543
1544                 } else {
1545
1546                         // Use the handy event callback
1547                         document.addEventListener( "DOMContentLoaded", completed, false );
1548
1549                         // A fallback to window.onload, that will always work
1550                         window.addEventListener( "load", completed, false );
1551                 }
1552         }
1553         return readyList.promise( obj );
1554 };
1555
1556 // Kick off the DOM ready check even if the user does not
1557 jQuery.ready.promise();
1558
1559
1560
1561
1562 // Multifunctional method to get and set values of a collection
1563 // The value/s can optionally be executed if it's a function
1564 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
1565         var i = 0,
1566                 len = elems.length,
1567                 bulk = key == null;
1568
1569         // Sets many values
1570         if ( jQuery.type( key ) === "object" ) {
1571                 chainable = true;
1572                 for ( i in key ) {
1573                         jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
1574                 }
1575
1576         // Sets one value
1577         } else if ( value !== undefined ) {
1578                 chainable = true;
1579
1580                 if ( !jQuery.isFunction( value ) ) {
1581                         raw = true;
1582                 }
1583
1584                 if ( bulk ) {
1585                         // Bulk operations run against the entire set
1586                         if ( raw ) {
1587                                 fn.call( elems, value );
1588                                 fn = null;
1589
1590                         // ...except when executing function values
1591                         } else {
1592                                 bulk = fn;
1593                                 fn = function( elem, key, value ) {
1594                                         return bulk.call( jQuery( elem ), value );
1595                                 };
1596                         }
1597                 }
1598
1599                 if ( fn ) {
1600                         for ( ; i < len; i++ ) {
1601                                 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
1602                         }
1603                 }
1604         }
1605
1606         return chainable ?
1607                 elems :
1608
1609                 // Gets
1610                 bulk ?
1611                         fn.call( elems ) :
1612                         len ? fn( elems[0], key ) : emptyGet;
1613 };
1614
1615
1616 /**
1617  * Determines whether an object can have data
1618  */
1619 jQuery.acceptData = function( owner ) {
1620         // Accepts only:
1621         //  - Node
1622         //    - Node.ELEMENT_NODE
1623         //    - Node.DOCUMENT_NODE
1624         //  - Object
1625         //    - Any
1626         /* jshint -W018 */
1627         return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
1628 };
1629
1630
1631 function Data() {
1632         // Support: Android < 4,
1633         // Old WebKit does not have Object.preventExtensions/freeze method,
1634         // return new empty object instead with no [[set]] accessor
1635         Object.defineProperty( this.cache = {}, 0, {
1636                 get: function() {
1637                         return {};
1638                 }
1639         });
1640
1641         this.expando = jQuery.expando + Math.random();
1642 }
1643
1644 Data.uid = 1;
1645 Data.accepts = jQuery.acceptData;
1646
1647 Data.prototype = {
1648         key: function( owner ) {
1649                 // We can accept data for non-element nodes in modern browsers,
1650                 // but we should not, see #8335.
1651                 // Always return the key for a frozen object.
1652                 if ( !Data.accepts( owner ) ) {
1653                         return 0;
1654                 }
1655
1656                 var descriptor = {},
1657                         // Check if the owner object already has a cache key
1658                         unlock = owner[ this.expando ];
1659
1660                 // If not, create one
1661                 if ( !unlock ) {
1662                         unlock = Data.uid++;
1663
1664                         // Secure it in a non-enumerable, non-writable property
1665                         try {
1666                                 descriptor[ this.expando ] = { value: unlock };
1667                                 Object.defineProperties( owner, descriptor );
1668
1669                         // Support: Android < 4
1670                         // Fallback to a less secure definition
1671                         } catch ( e ) {
1672                                 descriptor[ this.expando ] = unlock;
1673                                 jQuery.extend( owner, descriptor );
1674                         }
1675                 }
1676
1677                 // Ensure the cache object
1678                 if ( !this.cache[ unlock ] ) {
1679                         this.cache[ unlock ] = {};
1680                 }
1681
1682                 return unlock;
1683         },
1684         set: function( owner, data, value ) {
1685                 var prop,
1686                         // There may be an unlock assigned to this node,
1687                         // if there is no entry for this "owner", create one inline
1688                         // and set the unlock as though an owner entry had always existed
1689                         unlock = this.key( owner ),
1690                         cache = this.cache[ unlock ];
1691
1692                 // Handle: [ owner, key, value ] args
1693                 if ( typeof data === "string" ) {
1694                         cache[ data ] = value;
1695
1696                 // Handle: [ owner, { properties } ] args
1697                 } else {
1698                         // Fresh assignments by object are shallow copied
1699                         if ( jQuery.isEmptyObject( cache ) ) {
1700                                 jQuery.extend( this.cache[ unlock ], data );
1701                         // Otherwise, copy the properties one-by-one to the cache object
1702                         } else {
1703                                 for ( prop in data ) {
1704                                         cache[ prop ] = data[ prop ];
1705                                 }
1706                         }
1707                 }
1708                 return cache;
1709         },
1710         get: function( owner, key ) {
1711                 // Either a valid cache is found, or will be created.
1712                 // New caches will be created and the unlock returned,
1713                 // allowing direct access to the newly created
1714                 // empty data object. A valid owner object must be provided.
1715                 var cache = this.cache[ this.key( owner ) ];
1716
1717                 return key === undefined ?
1718                         cache : cache[ key ];
1719         },
1720         access: function( owner, key, value ) {
1721                 var stored;
1722                 // In cases where either:
1723                 //
1724                 //   1. No key was specified
1725                 //   2. A string key was specified, but no value provided
1726                 //
1727                 // Take the "read" path and allow the get method to determine
1728                 // which value to return, respectively either:
1729                 //
1730                 //   1. The entire cache object
1731                 //   2. The data stored at the key
1732                 //
1733                 if ( key === undefined ||
1734                                 ((key && typeof key === "string") && value === undefined) ) {
1735
1736                         stored = this.get( owner, key );
1737
1738                         return stored !== undefined ?
1739                                 stored : this.get( owner, jQuery.camelCase(key) );
1740                 }
1741
1742                 // [*]When the key is not a string, or both a key and value
1743                 // are specified, set or extend (existing objects) with either:
1744                 //
1745                 //   1. An object of properties
1746                 //   2. A key and value
1747                 //
1748                 this.set( owner, key, value );
1749
1750                 // Since the "set" path can have two possible entry points
1751                 // return the expected data based on which path was taken[*]
1752                 return value !== undefined ? value : key;
1753         },
1754         remove: function( owner, key ) {
1755                 var i, name, camel,
1756                         unlock = this.key( owner ),
1757                         cache = this.cache[ unlock ];
1758
1759                 if ( key === undefined ) {
1760                         this.cache[ unlock ] = {};
1761
1762                 } else {
1763                         // Support array or space separated string of keys
1764                         if ( jQuery.isArray( key ) ) {
1765                                 // If "name" is an array of keys...
1766                                 // When data is initially created, via ("key", "val") signature,
1767                                 // keys will be converted to camelCase.
1768                                 // Since there is no way to tell _how_ a key was added, remove
1769                                 // both plain key and camelCase key. #12786
1770                                 // This will only penalize the array argument path.
1771                                 name = key.concat( key.map( jQuery.camelCase ) );
1772                         } else {
1773                                 camel = jQuery.camelCase( key );
1774                                 // Try the string as a key before any manipulation
1775                                 if ( key in cache ) {
1776                                         name = [ key, camel ];
1777                                 } else {
1778                                         // If a key with the spaces exists, use it.
1779                                         // Otherwise, create an array by matching non-whitespace
1780                                         name = camel;
1781                                         name = name in cache ?
1782                                                 [ name ] : ( name.match( rnotwhite ) || [] );
1783                                 }
1784                         }
1785
1786                         i = name.length;
1787                         while ( i-- ) {
1788                                 delete cache[ name[ i ] ];
1789                         }
1790                 }
1791         },
1792         hasData: function( owner ) {
1793                 return !jQuery.isEmptyObject(
1794                         this.cache[ owner[ this.expando ] ] || {}
1795                 );
1796         },
1797         discard: function( owner ) {
1798                 if ( owner[ this.expando ] ) {
1799                         delete this.cache[ owner[ this.expando ] ];
1800                 }
1801         }
1802 };
1803 var data_priv = new Data();
1804
1805 var data_user = new Data();
1806
1807
1808
1809 /*
1810         Implementation Summary
1811
1812         1. Enforce API surface and semantic compatibility with 1.9.x branch
1813         2. Improve the module's maintainability by reducing the storage
1814                 paths to a single mechanism.
1815         3. Use the same single mechanism to support "private" and "user" data.
1816         4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
1817         5. Avoid exposing implementation details on user objects (eg. expando properties)
1818         6. Provide a clear path for implementation upgrade to WeakMap in 2014
1819 */
1820 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
1821         rmultiDash = /([A-Z])/g;
1822
1823 function dataAttr( elem, key, data ) {
1824         var name;
1825
1826         // If nothing was found internally, try to fetch any
1827         // data from the HTML5 data-* attribute
1828         if ( data === undefined && elem.nodeType === 1 ) {
1829                 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1830                 data = elem.getAttribute( name );
1831
1832                 if ( typeof data === "string" ) {
1833                         try {
1834                                 data = data === "true" ? true :
1835                                         data === "false" ? false :
1836                                         data === "null" ? null :
1837                                         // Only convert to a number if it doesn't change the string
1838                                         +data + "" === data ? +data :
1839                                         rbrace.test( data ) ? jQuery.parseJSON( data ) :
1840                                         data;
1841                         } catch( e ) {}
1842
1843                         // Make sure we set the data so it isn't changed later
1844                         data_user.set( elem, key, data );
1845                 } else {
1846                         data = undefined;
1847                 }
1848         }
1849         return data;
1850 }
1851
1852 jQuery.extend({
1853         hasData: function( elem ) {
1854                 return data_user.hasData( elem ) || data_priv.hasData( elem );
1855         },
1856
1857         data: function( elem, name, data ) {
1858                 return data_user.access( elem, name, data );
1859         },
1860
1861         removeData: function( elem, name ) {
1862                 data_user.remove( elem, name );
1863         },
1864
1865         // TODO: Now that all calls to _data and _removeData have been replaced
1866         // with direct calls to data_priv methods, these can be deprecated.
1867         _data: function( elem, name, data ) {
1868                 return data_priv.access( elem, name, data );
1869         },
1870
1871         _removeData: function( elem, name ) {
1872                 data_priv.remove( elem, name );
1873         }
1874 });
1875
1876 jQuery.fn.extend({
1877         data: function( key, value ) {
1878                 var i, name, data,
1879                         elem = this[ 0 ],
1880                         attrs = elem && elem.attributes;
1881
1882                 // Gets all values
1883                 if ( key === undefined ) {
1884                         if ( this.length ) {
1885                                 data = data_user.get( elem );
1886
1887                                 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
1888                                         i = attrs.length;
1889                                         while ( i-- ) {
1890
1891                                                 // Support: IE11+
1892                                                 // The attrs elements can be null (#14894)
1893                                                 if ( attrs[ i ] ) {
1894                                                         name = attrs[ i ].name;
1895                                                         if ( name.indexOf( "data-" ) === 0 ) {
1896                                                                 name = jQuery.camelCase( name.slice(5) );
1897                                                                 dataAttr( elem, name, data[ name ] );
1898                                                         }
1899                                                 }
1900                                         }
1901                                         data_priv.set( elem, "hasDataAttrs", true );
1902                                 }
1903                         }
1904
1905                         return data;
1906                 }
1907
1908                 // Sets multiple values
1909                 if ( typeof key === "object" ) {
1910                         return this.each(function() {
1911                                 data_user.set( this, key );
1912                         });
1913                 }
1914
1915                 return access( this, function( value ) {
1916                         var data,
1917                                 camelKey = jQuery.camelCase( key );
1918
1919                         // The calling jQuery object (element matches) is not empty
1920                         // (and therefore has an element appears at this[ 0 ]) and the
1921                         // `value` parameter was not undefined. An empty jQuery object
1922                         // will result in `undefined` for elem = this[ 0 ] which will
1923                         // throw an exception if an attempt to read a data cache is made.
1924                         if ( elem && value === undefined ) {
1925                                 // Attempt to get data from the cache
1926                                 // with the key as-is
1927                                 data = data_user.get( elem, key );
1928                                 if ( data !== undefined ) {
1929                                         return data;
1930                                 }
1931
1932                                 // Attempt to get data from the cache
1933                                 // with the key camelized
1934                                 data = data_user.get( elem, camelKey );
1935                                 if ( data !== undefined ) {
1936                                         return data;
1937                                 }
1938
1939                                 // Attempt to "discover" the data in
1940                                 // HTML5 custom data-* attrs
1941                                 data = dataAttr( elem, camelKey, undefined );
1942                                 if ( data !== undefined ) {
1943                                         return data;
1944                                 }
1945
1946                                 // We tried really hard, but the data doesn't exist.
1947                                 return;
1948                         }
1949
1950                         // Set the data...
1951                         this.each(function() {
1952                                 // First, attempt to store a copy or reference of any
1953                                 // data that might've been store with a camelCased key.
1954                                 var data = data_user.get( this, camelKey );
1955
1956                                 // For HTML5 data-* attribute interop, we have to
1957                                 // store property names with dashes in a camelCase form.
1958                                 // This might not apply to all properties...*
1959                                 data_user.set( this, camelKey, value );
1960
1961                                 // *... In the case of properties that might _actually_
1962                                 // have dashes, we need to also store a copy of that
1963                                 // unchanged property.
1964                                 if ( key.indexOf("-") !== -1 && data !== undefined ) {
1965                                         data_user.set( this, key, value );
1966                                 }
1967                         });
1968                 }, null, value, arguments.length > 1, null, true );
1969         },
1970
1971         removeData: function( key ) {
1972                 return this.each(function() {
1973                         data_user.remove( this, key );
1974                 });
1975         }
1976 });
1977
1978
1979 jQuery.extend({
1980         queue: function( elem, type, data ) {
1981                 var queue;
1982
1983                 if ( elem ) {
1984                         type = ( type || "fx" ) + "queue";
1985                         queue = data_priv.get( elem, type );
1986
1987                         // Speed up dequeue by getting out quickly if this is just a lookup
1988                         if ( data ) {
1989                                 if ( !queue || jQuery.isArray( data ) ) {
1990                                         queue = data_priv.access( elem, type, jQuery.makeArray(data) );
1991                                 } else {
1992                                         queue.push( data );
1993                                 }
1994                         }
1995                         return queue || [];
1996                 }
1997         },
1998
1999         dequeue: function( elem, type ) {
2000                 type = type || "fx";
2001
2002                 var queue = jQuery.queue( elem, type ),
2003                         startLength = queue.length,
2004                         fn = queue.shift(),
2005                         hooks = jQuery._queueHooks( elem, type ),
2006                         next = function() {
2007                                 jQuery.dequeue( elem, type );
2008                         };
2009
2010                 // If the fx queue is dequeued, always remove the progress sentinel
2011                 if ( fn === "inprogress" ) {
2012                         fn = queue.shift();
2013                         startLength--;
2014                 }
2015
2016                 if ( fn ) {
2017
2018                         // Add a progress sentinel to prevent the fx queue from being
2019                         // automatically dequeued
2020                         if ( type === "fx" ) {
2021                                 queue.unshift( "inprogress" );
2022                         }
2023
2024                         // clear up the last queue stop function
2025                         delete hooks.stop;
2026                         fn.call( elem, next, hooks );
2027                 }
2028
2029                 if ( !startLength && hooks ) {
2030                         hooks.empty.fire();
2031                 }
2032         },
2033
2034         // not intended for public consumption - generates a queueHooks object, or returns the current one
2035         _queueHooks: function( elem, type ) {
2036                 var key = type + "queueHooks";
2037                 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
2038                         empty: jQuery.Callbacks("once memory").add(function() {
2039                                 data_priv.remove( elem, [ type + "queue", key ] );
2040                         })
2041                 });
2042         }
2043 });
2044
2045 jQuery.fn.extend({
2046         queue: function( type, data ) {
2047                 var setter = 2;
2048
2049                 if ( typeof type !== "string" ) {
2050                         data = type;
2051                         type = "fx";
2052                         setter--;
2053                 }
2054
2055                 if ( arguments.length < setter ) {
2056                         return jQuery.queue( this[0], type );
2057                 }
2058
2059                 return data === undefined ?
2060                         this :
2061                         this.each(function() {
2062                                 var queue = jQuery.queue( this, type, data );
2063
2064                                 // ensure a hooks for this queue
2065                                 jQuery._queueHooks( this, type );
2066
2067                                 if ( type === "fx" && queue[0] !== "inprogress" ) {
2068                                         jQuery.dequeue( this, type );
2069                                 }
2070                         });
2071         },
2072         dequeue: function( type ) {
2073                 return this.each(function() {
2074                         jQuery.dequeue( this, type );
2075                 });
2076         },
2077         clearQueue: function( type ) {
2078                 return this.queue( type || "fx", [] );
2079         },
2080         // Get a promise resolved when queues of a certain type
2081         // are emptied (fx is the type by default)
2082         promise: function( type, obj ) {
2083                 var tmp,
2084                         count = 1,
2085                         defer = jQuery.Deferred(),
2086                         elements = this,
2087                         i = this.length,
2088                         resolve = function() {
2089                                 if ( !( --count ) ) {
2090                                         defer.resolveWith( elements, [ elements ] );
2091                                 }
2092                         };
2093
2094                 if ( typeof type !== "string" ) {
2095                         obj = type;
2096                         type = undefined;
2097                 }
2098                 type = type || "fx";
2099
2100                 while ( i-- ) {
2101                         tmp = data_priv.get( elements[ i ], type + "queueHooks" );
2102                         if ( tmp && tmp.empty ) {
2103                                 count++;
2104                                 tmp.empty.add( resolve );
2105                         }
2106                 }
2107                 resolve();
2108                 return defer.promise( obj );
2109         }
2110 });
2111 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2112
2113 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
2114
2115 var isHidden = function( elem, el ) {
2116                 // isHidden might be called from jQuery#filter function;
2117                 // in that case, element will be second argument
2118                 elem = el || elem;
2119                 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
2120         };
2121
2122 var rcheckableType = (/^(?:checkbox|radio)$/i);
2123
2124
2125
2126 (function() {
2127         var fragment = document.createDocumentFragment(),
2128                 div = fragment.appendChild( document.createElement( "div" ) ),
2129                 input = document.createElement( "input" );
2130
2131         // #11217 - WebKit loses check when the name is after the checked attribute
2132         // Support: Windows Web Apps (WWA)
2133         // `name` and `type` need .setAttribute for WWA
2134         input.setAttribute( "type", "radio" );
2135         input.setAttribute( "checked", "checked" );
2136         input.setAttribute( "name", "t" );
2137
2138         div.appendChild( input );
2139
2140         // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
2141         // old WebKit doesn't clone checked state correctly in fragments
2142         support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
2143
2144         // Make sure textarea (and checkbox) defaultValue is properly cloned
2145         // Support: IE9-IE11+
2146         div.innerHTML = "<textarea>x</textarea>";
2147         support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
2148 })();
2149 var strundefined = typeof undefined;
2150
2151
2152
2153 support.focusinBubbles = "onfocusin" in window;
2154
2155
2156 var
2157         rkeyEvent = /^key/,
2158         rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2159         rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2160         rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2161
2162 function returnTrue() {
2163         return true;
2164 }
2165
2166 function returnFalse() {
2167         return false;
2168 }
2169
2170 function safeActiveElement() {
2171         try {
2172                 return document.activeElement;
2173         } catch ( err ) { }
2174 }
2175
2176 /*
2177  * Helper functions for managing events -- not part of the public interface.
2178  * Props to Dean Edwards' addEvent library for many of the ideas.
2179  */
2180 jQuery.event = {
2181
2182         global: {},
2183
2184         add: function( elem, types, handler, data, selector ) {
2185
2186                 var handleObjIn, eventHandle, tmp,
2187                         events, t, handleObj,
2188                         special, handlers, type, namespaces, origType,
2189                         elemData = data_priv.get( elem );
2190
2191                 // Don't attach events to noData or text/comment nodes (but allow plain objects)
2192                 if ( !elemData ) {
2193                         return;
2194                 }
2195
2196                 // Caller can pass in an object of custom data in lieu of the handler
2197                 if ( handler.handler ) {
2198                         handleObjIn = handler;
2199                         handler = handleObjIn.handler;
2200                         selector = handleObjIn.selector;
2201                 }
2202
2203                 // Make sure that the handler has a unique ID, used to find/remove it later
2204                 if ( !handler.guid ) {
2205                         handler.guid = jQuery.guid++;
2206                 }
2207
2208                 // Init the element's event structure and main handler, if this is the first
2209                 if ( !(events = elemData.events) ) {
2210                         events = elemData.events = {};
2211                 }
2212                 if ( !(eventHandle = elemData.handle) ) {
2213                         eventHandle = elemData.handle = function( e ) {
2214                                 // Discard the second event of a jQuery.event.trigger() and
2215                                 // when an event is called after a page has unloaded
2216                                 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
2217                                         jQuery.event.dispatch.apply( elem, arguments ) : undefined;
2218                         };
2219                 }
2220
2221                 // Handle multiple events separated by a space
2222                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
2223                 t = types.length;
2224                 while ( t-- ) {
2225                         tmp = rtypenamespace.exec( types[t] ) || [];
2226                         type = origType = tmp[1];
2227                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
2228
2229                         // There *must* be a type, no attaching namespace-only handlers
2230                         if ( !type ) {
2231                                 continue;
2232                         }
2233
2234                         // If event changes its type, use the special event handlers for the changed type
2235                         special = jQuery.event.special[ type ] || {};
2236
2237                         // If selector defined, determine special event api type, otherwise given type
2238                         type = ( selector ? special.delegateType : special.bindType ) || type;
2239
2240                         // Update special based on newly reset type
2241                         special = jQuery.event.special[ type ] || {};
2242
2243                         // handleObj is passed to all event handlers
2244                         handleObj = jQuery.extend({
2245                                 type: type,
2246                                 origType: origType,
2247                                 data: data,
2248                                 handler: handler,
2249                                 guid: handler.guid,
2250                                 selector: selector,
2251                                 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
2252                                 namespace: namespaces.join(".")
2253                         }, handleObjIn );
2254
2255                         // Init the event handler queue if we're the first
2256                         if ( !(handlers = events[ type ]) ) {
2257                                 handlers = events[ type ] = [];
2258                                 handlers.delegateCount = 0;
2259
2260                                 // Only use addEventListener if the special events handler returns false
2261                                 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2262                                         if ( elem.addEventListener ) {
2263                                                 elem.addEventListener( type, eventHandle, false );
2264                                         }
2265                                 }
2266                         }
2267
2268                         if ( special.add ) {
2269                                 special.add.call( elem, handleObj );
2270
2271                                 if ( !handleObj.handler.guid ) {
2272                                         handleObj.handler.guid = handler.guid;
2273                                 }
2274                         }
2275
2276                         // Add to the element's handler list, delegates in front
2277                         if ( selector ) {
2278                                 handlers.splice( handlers.delegateCount++, 0, handleObj );
2279                         } else {
2280                                 handlers.push( handleObj );
2281                         }
2282
2283                         // Keep track of which events have ever been used, for event optimization
2284                         jQuery.event.global[ type ] = true;
2285                 }
2286
2287         },
2288
2289         // Detach an event or set of events from an element
2290         remove: function( elem, types, handler, selector, mappedTypes ) {
2291
2292                 var j, origCount, tmp,
2293                         events, t, handleObj,
2294                         special, handlers, type, namespaces, origType,
2295                         elemData = data_priv.hasData( elem ) && data_priv.get( elem );
2296
2297                 if ( !elemData || !(events = elemData.events) ) {
2298                         return;
2299                 }
2300
2301                 // Once for each type.namespace in types; type may be omitted
2302                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
2303                 t = types.length;
2304                 while ( t-- ) {
2305                         tmp = rtypenamespace.exec( types[t] ) || [];
2306                         type = origType = tmp[1];
2307                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
2308
2309                         // Unbind all events (on this namespace, if provided) for the element
2310                         if ( !type ) {
2311                                 for ( type in events ) {
2312                                         jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2313                                 }
2314                                 continue;
2315                         }
2316
2317                         special = jQuery.event.special[ type ] || {};
2318                         type = ( selector ? special.delegateType : special.bindType ) || type;
2319                         handlers = events[ type ] || [];
2320                         tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
2321
2322                         // Remove matching events
2323                         origCount = j = handlers.length;
2324                         while ( j-- ) {
2325                                 handleObj = handlers[ j ];
2326
2327                                 if ( ( mappedTypes || origType === handleObj.origType ) &&
2328                                         ( !handler || handler.guid === handleObj.guid ) &&
2329                                         ( !tmp || tmp.test( handleObj.namespace ) ) &&
2330                                         ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2331                                         handlers.splice( j, 1 );
2332
2333                                         if ( handleObj.selector ) {
2334                                                 handlers.delegateCount--;
2335                                         }
2336                                         if ( special.remove ) {
2337                                                 special.remove.call( elem, handleObj );
2338                                         }
2339                                 }
2340                         }
2341
2342                         // Remove generic event handler if we removed something and no more handlers exist
2343                         // (avoids potential for endless recursion during removal of special event handlers)
2344                         if ( origCount && !handlers.length ) {
2345                                 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2346                                         jQuery.removeEvent( elem, type, elemData.handle );
2347                                 }
2348
2349                                 delete events[ type ];
2350                         }
2351                 }
2352
2353                 // Remove the expando if it's no longer used
2354                 if ( jQuery.isEmptyObject( events ) ) {
2355                         delete elemData.handle;
2356                         data_priv.remove( elem, "events" );
2357                 }
2358         },
2359
2360         trigger: function( event, data, elem, onlyHandlers ) {
2361
2362                 var i, cur, tmp, bubbleType, ontype, handle, special,
2363                         eventPath = [ elem || document ],
2364                         type = hasOwn.call( event, "type" ) ? event.type : event,
2365                         namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
2366
2367                 cur = tmp = elem = elem || document;
2368
2369                 // Don't do events on text and comment nodes
2370                 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2371                         return;
2372                 }
2373
2374                 // focus/blur morphs to focusin/out; ensure we're not firing them right now
2375                 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2376                         return;
2377                 }
2378
2379                 if ( type.indexOf(".") >= 0 ) {
2380                         // Namespaced trigger; create a regexp to match event type in handle()
2381                         namespaces = type.split(".");
2382                         type = namespaces.shift();
2383                         namespaces.sort();
2384                 }
2385                 ontype = type.indexOf(":") < 0 && "on" + type;
2386
2387                 // Caller can pass in a jQuery.Event object, Object, or just an event type string
2388                 event = event[ jQuery.expando ] ?
2389                         event :
2390                         new jQuery.Event( type, typeof event === "object" && event );
2391
2392                 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
2393                 event.isTrigger = onlyHandlers ? 2 : 3;
2394                 event.namespace = namespaces.join(".");
2395                 event.namespace_re = event.namespace ?
2396                         new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
2397                         null;
2398
2399                 // Clean up the event in case it is being reused
2400                 event.result = undefined;
2401                 if ( !event.target ) {
2402                         event.target = elem;
2403                 }
2404
2405                 // Clone any incoming data and prepend the event, creating the handler arg list
2406                 data = data == null ?
2407                         [ event ] :
2408                         jQuery.makeArray( data, [ event ] );
2409
2410                 // Allow special events to draw outside the lines
2411                 special = jQuery.event.special[ type ] || {};
2412                 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
2413                         return;
2414                 }
2415
2416                 // Determine event propagation path in advance, per W3C events spec (#9951)
2417                 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2418                 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2419
2420                         bubbleType = special.delegateType || type;
2421                         if ( !rfocusMorph.test( bubbleType + type ) ) {
2422                                 cur = cur.parentNode;
2423                         }
2424                         for ( ; cur; cur = cur.parentNode ) {
2425                                 eventPath.push( cur );
2426                                 tmp = cur;
2427                         }
2428
2429                         // Only add window if we got to document (e.g., not plain obj or detached DOM)
2430                         if ( tmp === (elem.ownerDocument || document) ) {
2431                                 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
2432                         }
2433                 }
2434
2435                 // Fire handlers on the event path
2436                 i = 0;
2437                 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
2438
2439                         event.type = i > 1 ?
2440                                 bubbleType :
2441                                 special.bindType || type;
2442
2443                         // jQuery handler
2444                         handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
2445                         if ( handle ) {
2446                                 handle.apply( cur, data );
2447                         }
2448
2449                         // Native handler
2450                         handle = ontype && cur[ ontype ];
2451                         if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
2452                                 event.result = handle.apply( cur, data );
2453                                 if ( event.result === false ) {
2454                                         event.preventDefault();
2455                                 }
2456                         }
2457                 }
2458                 event.type = type;
2459
2460                 // If nobody prevented the default action, do it now
2461                 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2462
2463                         if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
2464                                 jQuery.acceptData( elem ) ) {
2465
2466                                 // Call a native DOM method on the target with the same name name as the event.
2467                                 // Don't do default actions on window, that's where global variables be (#6170)
2468                                 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
2469
2470                                         // Don't re-trigger an onFOO event when we call its FOO() method
2471                                         tmp = elem[ ontype ];
2472
2473                                         if ( tmp ) {
2474                                                 elem[ ontype ] = null;
2475                                         }
2476
2477                                         // Prevent re-triggering of the same event, since we already bubbled it above
2478                                         jQuery.event.triggered = type;
2479                                         elem[ type ]();
2480                                         jQuery.event.triggered = undefined;
2481
2482                                         if ( tmp ) {
2483                                                 elem[ ontype ] = tmp;
2484                                         }
2485                                 }
2486                         }
2487                 }
2488
2489                 return event.result;
2490         },
2491
2492         dispatch: function( event ) {
2493
2494                 // Make a writable jQuery.Event from the native event object
2495                 event = jQuery.event.fix( event );
2496
2497                 var i, j, ret, matched, handleObj,
2498                         handlerQueue = [],
2499                         args = slice.call( arguments ),
2500                         handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
2501                         special = jQuery.event.special[ event.type ] || {};
2502
2503                 // Use the fix-ed jQuery.Event rather than the (read-only) native event
2504                 args[0] = event;
2505                 event.delegateTarget = this;
2506
2507                 // Call the preDispatch hook for the mapped type, and let it bail if desired
2508                 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
2509                         return;
2510                 }
2511
2512                 // Determine handlers
2513                 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
2514
2515                 // Run delegates first; they may want to stop propagation beneath us
2516                 i = 0;
2517                 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
2518                         event.currentTarget = matched.elem;
2519
2520                         j = 0;
2521                         while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
2522
2523                                 // Triggered event must either 1) have no namespace, or
2524                                 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
2525                                 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
2526
2527                                         event.handleObj = handleObj;
2528                                         event.data = handleObj.data;
2529
2530                                         ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
2531                                                         .apply( matched.elem, args );
2532
2533                                         if ( ret !== undefined ) {
2534                                                 if ( (event.result = ret) === false ) {
2535                                                         event.preventDefault();
2536                                                         event.stopPropagation();
2537                                                 }
2538                                         }
2539                                 }
2540                         }
2541                 }
2542
2543                 // Call the postDispatch hook for the mapped type
2544                 if ( special.postDispatch ) {
2545                         special.postDispatch.call( this, event );
2546                 }
2547
2548                 return event.result;
2549         },
2550
2551         handlers: function( event, handlers ) {
2552                 var i, matches, sel, handleObj,
2553                         handlerQueue = [],
2554                         delegateCount = handlers.delegateCount,
2555                         cur = event.target;
2556
2557                 // Find delegate handlers
2558                 // Black-hole SVG <use> instance trees (#13180)
2559                 // Avoid non-left-click bubbling in Firefox (#3861)
2560                 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
2561
2562                         for ( ; cur !== this; cur = cur.parentNode || this ) {
2563
2564                                 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
2565                                 if ( cur.disabled !== true || event.type !== "click" ) {
2566                                         matches = [];
2567                                         for ( i = 0; i < delegateCount; i++ ) {
2568                                                 handleObj = handlers[ i ];
2569
2570                                                 // Don't conflict with Object.prototype properties (#13203)
2571                                                 sel = handleObj.selector + " ";
2572
2573                                                 if ( matches[ sel ] === undefined ) {
2574                                                         matches[ sel ] = handleObj.needsContext ?
2575                                                                 jQuery( sel, this ).index( cur ) >= 0 :
2576                                                                 jQuery.find( sel, this, null, [ cur ] ).length;
2577                                                 }
2578                                                 if ( matches[ sel ] ) {
2579                                                         matches.push( handleObj );
2580                                                 }
2581                                         }
2582                                         if ( matches.length ) {
2583                                                 handlerQueue.push({ elem: cur, handlers: matches });
2584                                         }
2585                                 }
2586                         }
2587                 }
2588
2589                 // Add the remaining (directly-bound) handlers
2590                 if ( delegateCount < handlers.length ) {
2591                         handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
2592                 }
2593
2594                 return handlerQueue;
2595         },
2596
2597         // Includes some event props shared by KeyEvent and MouseEvent
2598         props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
2599
2600         fixHooks: {},
2601
2602         keyHooks: {
2603                 props: "char charCode key keyCode".split(" "),
2604                 filter: function( event, original ) {
2605
2606                         // Add which for key events
2607                         if ( event.which == null ) {
2608                                 event.which = original.charCode != null ? original.charCode : original.keyCode;
2609                         }
2610
2611                         return event;
2612                 }
2613         },
2614
2615         mouseHooks: {
2616                 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
2617                 filter: function( event, original ) {
2618                         var eventDoc, doc, body,
2619                                 button = original.button;
2620
2621                         // Calculate pageX/Y if missing and clientX/Y available
2622                         if ( event.pageX == null && original.clientX != null ) {
2623                                 eventDoc = event.target.ownerDocument || document;
2624                                 doc = eventDoc.documentElement;
2625                                 body = eventDoc.body;
2626
2627                                 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
2628                                 event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
2629                         }
2630
2631                         // Add which for click: 1 === left; 2 === middle; 3 === right
2632                         // Note: button is not normalized, so don't use it
2633                         if ( !event.which && button !== undefined ) {
2634                                 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
2635                         }
2636
2637                         return event;
2638                 }
2639         },
2640
2641         fix: function( event ) {
2642                 if ( event[ jQuery.expando ] ) {
2643                         return event;
2644                 }
2645
2646                 // Create a writable copy of the event object and normalize some properties
2647                 var i, prop, copy,
2648                         type = event.type,
2649                         originalEvent = event,
2650                         fixHook = this.fixHooks[ type ];
2651
2652                 if ( !fixHook ) {
2653                         this.fixHooks[ type ] = fixHook =
2654                                 rmouseEvent.test( type ) ? this.mouseHooks :
2655                                 rkeyEvent.test( type ) ? this.keyHooks :
2656                                 {};
2657                 }
2658                 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
2659
2660                 event = new jQuery.Event( originalEvent );
2661
2662                 i = copy.length;
2663                 while ( i-- ) {
2664                         prop = copy[ i ];
2665                         event[ prop ] = originalEvent[ prop ];
2666                 }
2667
2668                 // Support: Cordova 2.5 (WebKit) (#13255)
2669                 // All events should have a target; Cordova deviceready doesn't
2670                 if ( !event.target ) {
2671                         event.target = document;
2672                 }
2673
2674                 // Support: Safari 6.0+, Chrome < 28
2675                 // Target should not be a text node (#504, #13143)
2676                 if ( event.target.nodeType === 3 ) {
2677                         event.target = event.target.parentNode;
2678                 }
2679
2680                 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
2681         },
2682
2683         special: {
2684                 load: {
2685                         // Prevent triggered image.load events from bubbling to window.load
2686                         noBubble: true
2687                 },
2688                 focus: {
2689                         // Fire native event if possible so blur/focus sequence is correct
2690                         trigger: function() {
2691                                 if ( this !== safeActiveElement() && this.focus ) {
2692                                         this.focus();
2693                                         return false;
2694                                 }
2695                         },
2696                         delegateType: "focusin"
2697                 },
2698                 blur: {
2699                         trigger: function() {
2700                                 if ( this === safeActiveElement() && this.blur ) {
2701                                         this.blur();
2702                                         return false;
2703                                 }
2704                         },
2705                         delegateType: "focusout"
2706                 },
2707                 click: {
2708                         // For checkbox, fire native event so checked state will be right
2709                         trigger: function() {
2710                                 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
2711                                         this.click();
2712                                         return false;
2713                                 }
2714                         },
2715
2716                         // For cross-browser consistency, don't fire native .click() on links
2717                         _default: function( event ) {
2718                                 return jQuery.nodeName( event.target, "a" );
2719                         }
2720                 },
2721
2722                 beforeunload: {
2723                         postDispatch: function( event ) {
2724
2725                                 // Support: Firefox 20+
2726                                 // Firefox doesn't alert if the returnValue field is not set.
2727                                 if ( event.result !== undefined && event.originalEvent ) {
2728                                         event.originalEvent.returnValue = event.result;
2729                                 }
2730                         }
2731                 }
2732         },
2733
2734         simulate: function( type, elem, event, bubble ) {
2735                 // Piggyback on a donor event to simulate a different one.
2736                 // Fake originalEvent to avoid donor's stopPropagation, but if the
2737                 // simulated event prevents default then we do the same on the donor.
2738                 var e = jQuery.extend(
2739                         new jQuery.Event(),
2740                         event,
2741                         {
2742                                 type: type,
2743                                 isSimulated: true,
2744                                 originalEvent: {}
2745                         }
2746                 );
2747                 if ( bubble ) {
2748                         jQuery.event.trigger( e, null, elem );
2749                 } else {
2750                         jQuery.event.dispatch.call( elem, e );
2751                 }
2752                 if ( e.isDefaultPrevented() ) {
2753                         event.preventDefault();
2754                 }
2755         }
2756 };
2757
2758 jQuery.removeEvent = function( elem, type, handle ) {
2759         if ( elem.removeEventListener ) {
2760                 elem.removeEventListener( type, handle, false );
2761         }
2762 };
2763
2764 jQuery.Event = function( src, props ) {
2765         // Allow instantiation without the 'new' keyword
2766         if ( !(this instanceof jQuery.Event) ) {
2767                 return new jQuery.Event( src, props );
2768         }
2769
2770         // Event object
2771         if ( src && src.type ) {
2772                 this.originalEvent = src;
2773                 this.type = src.type;
2774
2775                 // Events bubbling up the document may have been marked as prevented
2776                 // by a handler lower down the tree; reflect the correct value.
2777                 this.isDefaultPrevented = src.defaultPrevented ||
2778                                 src.defaultPrevented === undefined &&
2779                                 // Support: Android < 4.0
2780                                 src.returnValue === false ?
2781                         returnTrue :
2782                         returnFalse;
2783
2784         // Event type
2785         } else {
2786                 this.type = src;
2787         }
2788
2789         // Put explicitly provided properties onto the event object
2790         if ( props ) {
2791                 jQuery.extend( this, props );
2792         }
2793
2794         // Create a timestamp if incoming event doesn't have one
2795         this.timeStamp = src && src.timeStamp || jQuery.now();
2796
2797         // Mark it as fixed
2798         this[ jQuery.expando ] = true;
2799 };
2800
2801 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2802 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2803 jQuery.Event.prototype = {
2804         isDefaultPrevented: returnFalse,
2805         isPropagationStopped: returnFalse,
2806         isImmediatePropagationStopped: returnFalse,
2807
2808         preventDefault: function() {
2809                 var e = this.originalEvent;
2810
2811                 this.isDefaultPrevented = returnTrue;
2812
2813                 if ( e && e.preventDefault ) {
2814                         e.preventDefault();
2815                 }
2816         },
2817         stopPropagation: function() {
2818                 var e = this.originalEvent;
2819
2820                 this.isPropagationStopped = returnTrue;
2821
2822                 if ( e && e.stopPropagation ) {
2823                         e.stopPropagation();
2824                 }
2825         },
2826         stopImmediatePropagation: function() {
2827                 var e = this.originalEvent;
2828
2829                 this.isImmediatePropagationStopped = returnTrue;
2830
2831                 if ( e && e.stopImmediatePropagation ) {
2832                         e.stopImmediatePropagation();
2833                 }
2834
2835                 this.stopPropagation();
2836         }
2837 };
2838
2839 // Create mouseenter/leave events using mouseover/out and event-time checks
2840 // Support: Chrome 15+
2841 jQuery.each({
2842         mouseenter: "mouseover",
2843         mouseleave: "mouseout",
2844         pointerenter: "pointerover",
2845         pointerleave: "pointerout"
2846 }, function( orig, fix ) {
2847         jQuery.event.special[ orig ] = {
2848                 delegateType: fix,
2849                 bindType: fix,
2850
2851                 handle: function( event ) {
2852                         var ret,
2853                                 target = this,
2854                                 related = event.relatedTarget,
2855                                 handleObj = event.handleObj;
2856
2857                         // For mousenter/leave call the handler if related is outside the target.
2858                         // NB: No relatedTarget if the mouse left/entered the browser window
2859                         if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
2860                                 event.type = handleObj.origType;
2861                                 ret = handleObj.handler.apply( this, arguments );
2862                                 event.type = fix;
2863                         }
2864                         return ret;
2865                 }
2866         };
2867 });
2868
2869 // Create "bubbling" focus and blur events
2870 // Support: Firefox, Chrome, Safari
2871 if ( !support.focusinBubbles ) {
2872         jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2873
2874                 // Attach a single capturing handler on the document while someone wants focusin/focusout
2875                 var handler = function( event ) {
2876                                 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
2877                         };
2878
2879                 jQuery.event.special[ fix ] = {
2880                         setup: function() {
2881                                 var doc = this.ownerDocument || this,
2882                                         attaches = data_priv.access( doc, fix );
2883
2884                                 if ( !attaches ) {
2885                                         doc.addEventListener( orig, handler, true );
2886                                 }
2887                                 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
2888                         },
2889                         teardown: function() {
2890                                 var doc = this.ownerDocument || this,
2891                                         attaches = data_priv.access( doc, fix ) - 1;
2892
2893                                 if ( !attaches ) {
2894                                         doc.removeEventListener( orig, handler, true );
2895                                         data_priv.remove( doc, fix );
2896
2897                                 } else {
2898                                         data_priv.access( doc, fix, attaches );
2899                                 }
2900                         }
2901                 };
2902         });
2903 }
2904
2905 jQuery.fn.extend({
2906
2907         on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
2908                 var origFn, type;
2909
2910                 // Types can be a map of types/handlers
2911                 if ( typeof types === "object" ) {
2912                         // ( types-Object, selector, data )
2913                         if ( typeof selector !== "string" ) {
2914                                 // ( types-Object, data )
2915                                 data = data || selector;
2916                                 selector = undefined;
2917                         }
2918                         for ( type in types ) {
2919                                 this.on( type, selector, data, types[ type ], one );
2920                         }
2921                         return this;
2922                 }
2923
2924                 if ( data == null && fn == null ) {
2925                         // ( types, fn )
2926                         fn = selector;
2927                         data = selector = undefined;
2928                 } else if ( fn == null ) {
2929                         if ( typeof selector === "string" ) {
2930                                 // ( types, selector, fn )
2931                                 fn = data;
2932                                 data = undefined;
2933                         } else {
2934                                 // ( types, data, fn )
2935                                 fn = data;
2936                                 data = selector;
2937                                 selector = undefined;
2938                         }
2939                 }
2940                 if ( fn === false ) {
2941                         fn = returnFalse;
2942                 } else if ( !fn ) {
2943                         return this;
2944                 }
2945
2946                 if ( one === 1 ) {
2947                         origFn = fn;
2948                         fn = function( event ) {
2949                                 // Can use an empty set, since event contains the info
2950                                 jQuery().off( event );
2951                                 return origFn.apply( this, arguments );
2952                         };
2953                         // Use same guid so caller can remove using origFn
2954                         fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
2955                 }
2956                 return this.each( function() {
2957                         jQuery.event.add( this, types, fn, data, selector );
2958                 });
2959         },
2960         one: function( types, selector, data, fn ) {
2961                 return this.on( types, selector, data, fn, 1 );
2962         },
2963         off: function( types, selector, fn ) {
2964                 var handleObj, type;
2965                 if ( types && types.preventDefault && types.handleObj ) {
2966                         // ( event )  dispatched jQuery.Event
2967                         handleObj = types.handleObj;
2968                         jQuery( types.delegateTarget ).off(
2969                                 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
2970                                 handleObj.selector,
2971                                 handleObj.handler
2972                         );
2973                         return this;
2974                 }
2975                 if ( typeof types === "object" ) {
2976                         // ( types-object [, selector] )
2977                         for ( type in types ) {
2978                                 this.off( type, selector, types[ type ] );
2979                         }
2980                         return this;
2981                 }
2982                 if ( selector === false || typeof selector === "function" ) {
2983                         // ( types [, fn] )
2984                         fn = selector;
2985                         selector = undefined;
2986                 }
2987                 if ( fn === false ) {
2988                         fn = returnFalse;
2989                 }
2990                 return this.each(function() {
2991                         jQuery.event.remove( this, types, fn, selector );
2992                 });
2993         },
2994
2995         trigger: function( type, data ) {
2996                 return this.each(function() {
2997                         jQuery.event.trigger( type, data, this );
2998                 });
2999         },
3000         triggerHandler: function( type, data ) {
3001                 var elem = this[0];
3002                 if ( elem ) {
3003                         return jQuery.event.trigger( type, data, elem, true );
3004                 }
3005         }
3006 });
3007
3008
3009 var
3010         rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
3011         rtagName = /<([\w:]+)/,
3012         rhtml = /<|&#?\w+;/,
3013         rnoInnerhtml = /<(?:script|style|link)/i,
3014         // checked="checked" or checked
3015         rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
3016         rscriptType = /^$|\/(?:java|ecma)script/i,
3017         rscriptTypeMasked = /^true\/(.*)/,
3018         rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
3019
3020         // We have to close these tags to support XHTML (#13200)
3021         wrapMap = {
3022
3023                 // Support: IE 9
3024                 option: [ 1, "<select multiple='multiple'>", "</select>" ],
3025
3026                 thead: [ 1, "<table>", "</table>" ],
3027                 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
3028                 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
3029                 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
3030
3031                 _default: [ 0, "", "" ]
3032         };
3033
3034 // Support: IE 9
3035 wrapMap.optgroup = wrapMap.option;
3036
3037 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3038 wrapMap.th = wrapMap.td;
3039
3040 // Support: 1.x compatibility
3041 // Manipulating tables requires a tbody
3042 function manipulationTarget( elem, content ) {
3043         return jQuery.nodeName( elem, "table" ) &&
3044                 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
3045
3046                 elem.getElementsByTagName("tbody")[0] ||
3047                         elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
3048                 elem;
3049 }
3050
3051 // Replace/restore the type attribute of script elements for safe DOM manipulation
3052 function disableScript( elem ) {
3053         elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
3054         return elem;
3055 }
3056 function restoreScript( elem ) {
3057         var match = rscriptTypeMasked.exec( elem.type );
3058
3059         if ( match ) {
3060                 elem.type = match[ 1 ];
3061         } else {
3062                 elem.removeAttribute("type");
3063         }
3064
3065         return elem;
3066 }
3067
3068 // Mark scripts as having already been evaluated
3069 function setGlobalEval( elems, refElements ) {
3070         var i = 0,
3071                 l = elems.length;
3072
3073         for ( ; i < l; i++ ) {
3074                 data_priv.set(
3075                         elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
3076                 );
3077         }
3078 }
3079
3080 function cloneCopyEvent( src, dest ) {
3081         var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
3082
3083         if ( dest.nodeType !== 1 ) {
3084                 return;
3085         }
3086
3087         // 1. Copy private data: events, handlers, etc.
3088         if ( data_priv.hasData( src ) ) {
3089                 pdataOld = data_priv.access( src );
3090                 pdataCur = data_priv.set( dest, pdataOld );
3091                 events = pdataOld.events;
3092
3093                 if ( events ) {
3094                         delete pdataCur.handle;
3095                         pdataCur.events = {};
3096
3097                         for ( type in events ) {
3098                                 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
3099                                         jQuery.event.add( dest, type, events[ type ][ i ] );
3100                                 }
3101                         }
3102                 }
3103         }
3104
3105         // 2. Copy user data
3106         if ( data_user.hasData( src ) ) {
3107                 udataOld = data_user.access( src );
3108                 udataCur = jQuery.extend( {}, udataOld );
3109
3110                 data_user.set( dest, udataCur );
3111         }
3112 }
3113
3114 function getAll( context, tag ) {
3115         var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
3116                         context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
3117                         [];
3118
3119         return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
3120                 jQuery.merge( [ context ], ret ) :
3121                 ret;
3122 }
3123
3124 // Support: IE >= 9
3125 function fixInput( src, dest ) {
3126         var nodeName = dest.nodeName.toLowerCase();
3127
3128         // Fails to persist the checked state of a cloned checkbox or radio button.
3129         if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
3130                 dest.checked = src.checked;
3131
3132         // Fails to return the selected option to the default selected state when cloning options
3133         } else if ( nodeName === "input" || nodeName === "textarea" ) {
3134                 dest.defaultValue = src.defaultValue;
3135         }
3136 }
3137
3138 jQuery.extend({
3139         clone: function( elem, dataAndEvents, deepDataAndEvents ) {
3140                 var i, l, srcElements, destElements,
3141                         clone = elem.cloneNode( true ),
3142                         inPage = jQuery.contains( elem.ownerDocument, elem );
3143
3144                 // Support: IE >= 9
3145                 // Fix Cloning issues
3146                 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
3147                                 !jQuery.isXMLDoc( elem ) ) {
3148
3149                         // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
3150                         destElements = getAll( clone );
3151                         srcElements = getAll( elem );
3152
3153                         for ( i = 0, l = srcElements.length; i < l; i++ ) {
3154                                 fixInput( srcElements[ i ], destElements[ i ] );
3155                         }
3156                 }
3157
3158                 // Copy the events from the original to the clone
3159                 if ( dataAndEvents ) {
3160                         if ( deepDataAndEvents ) {
3161                                 srcElements = srcElements || getAll( elem );
3162                                 destElements = destElements || getAll( clone );
3163
3164                                 for ( i = 0, l = srcElements.length; i < l; i++ ) {
3165                                         cloneCopyEvent( srcElements[ i ], destElements[ i ] );
3166                                 }
3167                         } else {
3168                                 cloneCopyEvent( elem, clone );
3169                         }
3170                 }
3171
3172                 // Preserve script evaluation history
3173                 destElements = getAll( clone, "script" );
3174                 if ( destElements.length > 0 ) {
3175                         setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
3176                 }
3177
3178                 // Return the cloned set
3179                 return clone;
3180         },
3181
3182         buildFragment: function( elems, context, scripts, selection ) {
3183                 var elem, tmp, tag, wrap, contains, j,
3184                         fragment = context.createDocumentFragment(),
3185                         nodes = [],
3186                         i = 0,
3187                         l = elems.length;
3188
3189                 for ( ; i < l; i++ ) {
3190                         elem = elems[ i ];
3191
3192                         if ( elem || elem === 0 ) {
3193
3194                                 // Add nodes directly
3195                                 if ( jQuery.type( elem ) === "object" ) {
3196                                         // Support: QtWebKit
3197                                         // jQuery.merge because push.apply(_, arraylike) throws
3198                                         jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
3199
3200                                 // Convert non-html into a text node
3201                                 } else if ( !rhtml.test( elem ) ) {
3202                                         nodes.push( context.createTextNode( elem ) );
3203
3204                                 // Convert html into DOM nodes
3205                                 } else {
3206                                         tmp = tmp || fragment.appendChild( context.createElement("div") );
3207
3208                                         // Deserialize a standard representation
3209                                         tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
3210                                         wrap = wrapMap[ tag ] || wrapMap._default;
3211                                         tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
3212
3213                                         // Descend through wrappers to the right content
3214                                         j = wrap[ 0 ];
3215                                         while ( j-- ) {
3216                                                 tmp = tmp.lastChild;
3217                                         }
3218
3219                                         // Support: QtWebKit
3220                                         // jQuery.merge because push.apply(_, arraylike) throws
3221                                         jQuery.merge( nodes, tmp.childNodes );
3222
3223                                         // Remember the top-level container
3224                                         tmp = fragment.firstChild;
3225
3226                                         // Fixes #12346
3227                                         // Support: Webkit, IE
3228                                         tmp.textContent = "";
3229                                 }
3230                         }
3231                 }
3232
3233                 // Remove wrapper from fragment
3234                 fragment.textContent = "";
3235
3236                 i = 0;
3237                 while ( (elem = nodes[ i++ ]) ) {
3238
3239                         // #4087 - If origin and destination elements are the same, and this is
3240                         // that element, do not do anything
3241                         if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
3242                                 continue;
3243                         }
3244
3245                         contains = jQuery.contains( elem.ownerDocument, elem );
3246
3247                         // Append to fragment
3248                         tmp = getAll( fragment.appendChild( elem ), "script" );
3249
3250                         // Preserve script evaluation history
3251                         if ( contains ) {
3252                                 setGlobalEval( tmp );
3253                         }
3254
3255                         // Capture executables
3256                         if ( scripts ) {
3257                                 j = 0;
3258                                 while ( (elem = tmp[ j++ ]) ) {
3259                                         if ( rscriptType.test( elem.type || "" ) ) {
3260                                                 scripts.push( elem );
3261                                         }
3262                                 }
3263                         }
3264                 }
3265
3266                 return fragment;
3267         },
3268
3269         cleanData: function( elems ) {
3270                 var data, elem, type, key,
3271                         special = jQuery.event.special,
3272                         i = 0;
3273
3274                 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
3275                         if ( jQuery.acceptData( elem ) ) {
3276                                 key = elem[ data_priv.expando ];
3277
3278                                 if ( key && (data = data_priv.cache[ key ]) ) {
3279                                         if ( data.events ) {
3280                                                 for ( type in data.events ) {
3281                                                         if ( special[ type ] ) {
3282                                                                 jQuery.event.remove( elem, type );
3283
3284                                                         // This is a shortcut to avoid jQuery.event.remove's overhead
3285                                                         } else {
3286                                                                 jQuery.removeEvent( elem, type, data.handle );
3287                                                         }
3288                                                 }
3289                                         }
3290                                         if ( data_priv.cache[ key ] ) {
3291                                                 // Discard any remaining `private` data
3292                                                 delete data_priv.cache[ key ];
3293                                         }
3294                                 }
3295                         }
3296                         // Discard any remaining `user` data
3297                         delete data_user.cache[ elem[ data_user.expando ] ];
3298                 }
3299         }
3300 });
3301
3302 jQuery.fn.extend({
3303         text: function( value ) {
3304                 return access( this, function( value ) {
3305                         return value === undefined ?
3306                                 jQuery.text( this ) :
3307                                 this.empty().each(function() {
3308                                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
3309                                                 this.textContent = value;
3310                                         }
3311                                 });
3312                 }, null, value, arguments.length );
3313         },
3314
3315         append: function() {
3316                 return this.domManip( arguments, function( elem ) {
3317                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
3318                                 var target = manipulationTarget( this, elem );
3319                                 target.appendChild( elem );
3320                         }
3321                 });
3322         },
3323
3324         prepend: function() {
3325                 return this.domManip( arguments, function( elem ) {
3326                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
3327                                 var target = manipulationTarget( this, elem );
3328                                 target.insertBefore( elem, target.firstChild );
3329                         }
3330                 });
3331         },
3332
3333         before: function() {
3334                 return this.domManip( arguments, function( elem ) {
3335                         if ( this.parentNode ) {
3336                                 this.parentNode.insertBefore( elem, this );
3337                         }
3338                 });
3339         },
3340
3341         after: function() {
3342                 return this.domManip( arguments, function( elem ) {
3343                         if ( this.parentNode ) {
3344                                 this.parentNode.insertBefore( elem, this.nextSibling );
3345                         }
3346                 });
3347         },
3348
3349         remove: function( selector, keepData /* Internal Use Only */ ) {
3350                 var elem,
3351                         elems = selector ? jQuery.filter( selector, this ) : this,
3352                         i = 0;
3353
3354                 for ( ; (elem = elems[i]) != null; i++ ) {
3355                         if ( !keepData && elem.nodeType === 1 ) {
3356                                 jQuery.cleanData( getAll( elem ) );
3357                         }
3358
3359                         if ( elem.parentNode ) {
3360                                 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
3361                                         setGlobalEval( getAll( elem, "script" ) );
3362                                 }
3363                                 elem.parentNode.removeChild( elem );
3364                         }
3365                 }
3366
3367                 return this;
3368         },
3369
3370         empty: function() {
3371                 var elem,
3372                         i = 0;
3373
3374                 for ( ; (elem = this[i]) != null; i++ ) {
3375                         if ( elem.nodeType === 1 ) {
3376
3377                                 // Prevent memory leaks
3378                                 jQuery.cleanData( getAll( elem, false ) );
3379
3380                                 // Remove any remaining nodes
3381                                 elem.textContent = "";
3382                         }
3383                 }
3384
3385                 return this;
3386         },
3387
3388         clone: function( dataAndEvents, deepDataAndEvents ) {
3389                 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
3390                 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
3391
3392                 return this.map(function() {
3393                         return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
3394                 });
3395         },
3396
3397         html: function( value ) {
3398                 return access( this, function( value ) {
3399                         var elem = this[ 0 ] || {},
3400                                 i = 0,
3401                                 l = this.length;
3402
3403                         if ( value === undefined && elem.nodeType === 1 ) {
3404                                 return elem.innerHTML;
3405                         }
3406
3407                         // See if we can take a shortcut and just use innerHTML
3408                         if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
3409                                 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
3410
3411                                 value = value.replace( rxhtmlTag, "<$1></$2>" );
3412
3413                                 try {
3414                                         for ( ; i < l; i++ ) {
3415                                                 elem = this[ i ] || {};
3416
3417                                                 // Remove element nodes and prevent memory leaks
3418                                                 if ( elem.nodeType === 1 ) {
3419                                                         jQuery.cleanData( getAll( elem, false ) );
3420                                                         elem.innerHTML = value;
3421                                                 }
3422                                         }
3423
3424                                         elem = 0;
3425
3426                                 // If using innerHTML throws an exception, use the fallback method
3427                                 } catch( e ) {}
3428                         }
3429
3430                         if ( elem ) {
3431                                 this.empty().append( value );
3432                         }
3433                 }, null, value, arguments.length );
3434         },
3435
3436         replaceWith: function() {
3437                 var arg = arguments[ 0 ];
3438
3439                 // Make the changes, replacing each context element with the new content
3440                 this.domManip( arguments, function( elem ) {
3441                         arg = this.parentNode;
3442
3443                         jQuery.cleanData( getAll( this ) );
3444
3445                         if ( arg ) {
3446                                 arg.replaceChild( elem, this );
3447                         }
3448                 });
3449
3450                 // Force removal if there was no new content (e.g., from empty arguments)
3451                 return arg && (arg.length || arg.nodeType) ? this : this.remove();
3452         },
3453
3454         detach: function( selector ) {
3455                 return this.remove( selector, true );
3456         },
3457
3458         domManip: function( args, callback ) {
3459
3460                 // Flatten any nested arrays
3461                 args = concat.apply( [], args );
3462
3463                 var fragment, first, scripts, hasScripts, node, doc,
3464                         i = 0,
3465                         l = this.length,
3466                         set = this,
3467                         iNoClone = l - 1,
3468                         value = args[ 0 ],
3469                         isFunction = jQuery.isFunction( value );
3470
3471                 // We can't cloneNode fragments that contain checked, in WebKit
3472                 if ( isFunction ||
3473                                 ( l > 1 && typeof value === "string" &&
3474                                         !support.checkClone && rchecked.test( value ) ) ) {
3475                         return this.each(function( index ) {
3476                                 var self = set.eq( index );
3477                                 if ( isFunction ) {
3478                                         args[ 0 ] = value.call( this, index, self.html() );
3479                                 }
3480                                 self.domManip( args, callback );
3481                         });
3482                 }
3483
3484                 if ( l ) {
3485                         fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
3486                         first = fragment.firstChild;
3487
3488                         if ( fragment.childNodes.length === 1 ) {
3489                                 fragment = first;
3490                         }
3491
3492                         if ( first ) {
3493                                 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
3494                                 hasScripts = scripts.length;
3495
3496                                 // Use the original fragment for the last item instead of the first because it can end up
3497                                 // being emptied incorrectly in certain situations (#8070).
3498                                 for ( ; i < l; i++ ) {
3499                                         node = fragment;
3500
3501                                         if ( i !== iNoClone ) {
3502                                                 node = jQuery.clone( node, true, true );
3503
3504                                                 // Keep references to cloned scripts for later restoration
3505                                                 if ( hasScripts ) {
3506                                                         // Support: QtWebKit
3507                                                         // jQuery.merge because push.apply(_, arraylike) throws
3508                                                         jQuery.merge( scripts, getAll( node, "script" ) );
3509                                                 }
3510                                         }
3511
3512                                         callback.call( this[ i ], node, i );
3513                                 }
3514
3515                                 if ( hasScripts ) {
3516                                         doc = scripts[ scripts.length - 1 ].ownerDocument;
3517
3518                                         // Reenable scripts
3519                                         jQuery.map( scripts, restoreScript );
3520
3521                                         // Evaluate executable scripts on first document insertion
3522                                         for ( i = 0; i < hasScripts; i++ ) {
3523                                                 node = scripts[ i ];
3524                                                 if ( rscriptType.test( node.type || "" ) &&
3525                                                         !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
3526
3527                                                         if ( node.src ) {
3528                                                                 // Optional AJAX dependency, but won't run scripts if not present
3529                                                                 if ( jQuery._evalUrl ) {
3530                                                                         jQuery._evalUrl( node.src );
3531                                                                 }
3532                                                         } else {
3533                                                                 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
3534                                                         }
3535                                                 }
3536                                         }
3537                                 }
3538                         }
3539                 }
3540
3541                 return this;
3542         }
3543 });
3544
3545 jQuery.each({
3546         appendTo: "append",
3547         prependTo: "prepend",
3548         insertBefore: "before",
3549         insertAfter: "after",
3550         replaceAll: "replaceWith"
3551 }, function( name, original ) {
3552         jQuery.fn[ name ] = function( selector ) {
3553                 var elems,
3554                         ret = [],
3555                         insert = jQuery( selector ),
3556                         last = insert.length - 1,
3557                         i = 0;
3558
3559                 for ( ; i <= last; i++ ) {
3560                         elems = i === last ? this : this.clone( true );
3561                         jQuery( insert[ i ] )[ original ]( elems );
3562
3563                         // Support: QtWebKit
3564                         // .get() because push.apply(_, arraylike) throws
3565                         push.apply( ret, elems.get() );
3566                 }
3567
3568                 return this.pushStack( ret );
3569         };
3570 });
3571
3572
3573 var iframe,
3574         elemdisplay = {};
3575
3576 /**
3577  * Retrieve the actual display of a element
3578  * @param {String} name nodeName of the element
3579  * @param {Object} doc Document object
3580  */
3581 // Called only from within defaultDisplay
3582 function actualDisplay( name, doc ) {
3583         var style,
3584                 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
3585
3586                 // getDefaultComputedStyle might be reliably used only on attached element
3587                 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
3588
3589                         // Use of this method is a temporary fix (more like optmization) until something better comes along,
3590                         // since it was removed from specification and supported only in FF
3591                         style.display : jQuery.css( elem[ 0 ], "display" );
3592
3593         // We don't have any data stored on the element,
3594         // so use "detach" method as fast way to get rid of the element
3595         elem.detach();
3596
3597         return display;
3598 }
3599
3600 /**
3601  * Try to determine the default display value of an element
3602  * @param {String} nodeName
3603  */
3604 function defaultDisplay( nodeName ) {
3605         var doc = document,
3606                 display = elemdisplay[ nodeName ];
3607
3608         if ( !display ) {
3609                 display = actualDisplay( nodeName, doc );
3610
3611                 // If the simple way fails, read from inside an iframe
3612                 if ( display === "none" || !display ) {
3613
3614                         // Use the already-created iframe if possible
3615                         iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
3616
3617                         // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
3618                         doc = iframe[ 0 ].contentDocument;
3619
3620                         // Support: IE
3621                         doc.write();
3622                         doc.close();
3623
3624                         display = actualDisplay( nodeName, doc );
3625                         iframe.detach();
3626                 }
3627
3628                 // Store the correct default display
3629                 elemdisplay[ nodeName ] = display;
3630         }
3631
3632         return display;
3633 }
3634 var rmargin = (/^margin/);
3635
3636 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
3637
3638 var getStyles = function( elem ) {
3639                 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
3640         };
3641
3642
3643
3644 function curCSS( elem, name, computed ) {
3645         var width, minWidth, maxWidth, ret,
3646                 style = elem.style;
3647
3648         computed = computed || getStyles( elem );
3649
3650         // Support: IE9
3651         // getPropertyValue is only needed for .css('filter') in IE9, see #12537
3652         if ( computed ) {
3653                 ret = computed.getPropertyValue( name ) || computed[ name ];
3654         }
3655
3656         if ( computed ) {
3657
3658                 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
3659                         ret = jQuery.style( elem, name );
3660                 }
3661
3662                 // Support: iOS < 6
3663                 // A tribute to the "awesome hack by Dean Edwards"
3664                 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
3665                 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
3666                 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
3667
3668                         // Remember the original values
3669                         width = style.width;
3670                         minWidth = style.minWidth;
3671                         maxWidth = style.maxWidth;
3672
3673                         // Put in the new values to get a computed value out
3674                         style.minWidth = style.maxWidth = style.width = ret;
3675                         ret = computed.width;
3676
3677                         // Revert the changed values
3678                         style.width = width;
3679                         style.minWidth = minWidth;
3680                         style.maxWidth = maxWidth;
3681                 }
3682         }
3683
3684         return ret !== undefined ?
3685                 // Support: IE
3686                 // IE returns zIndex value as an integer.
3687                 ret + "" :
3688                 ret;
3689 }
3690
3691
3692 function addGetHookIf( conditionFn, hookFn ) {
3693         // Define the hook, we'll check on the first run if it's really needed.
3694         return {
3695                 get: function() {
3696                         if ( conditionFn() ) {
3697                                 // Hook not needed (or it's not possible to use it due to missing dependency),
3698                                 // remove it.
3699                                 // Since there are no other hooks for marginRight, remove the whole object.
3700                                 delete this.get;
3701                                 return;
3702                         }
3703
3704                         // Hook needed; redefine it so that the support test is not executed again.
3705
3706                         return (this.get = hookFn).apply( this, arguments );
3707                 }
3708         };
3709 }
3710
3711
3712 (function() {
3713         var pixelPositionVal, boxSizingReliableVal,
3714                 docElem = document.documentElement,
3715                 container = document.createElement( "div" ),
3716                 div = document.createElement( "div" );
3717
3718         if ( !div.style ) {
3719                 return;
3720         }
3721
3722         div.style.backgroundClip = "content-box";
3723         div.cloneNode( true ).style.backgroundClip = "";
3724         support.clearCloneStyle = div.style.backgroundClip === "content-box";
3725
3726         container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
3727                 "position:absolute";
3728         container.appendChild( div );
3729
3730         // Executing both pixelPosition & boxSizingReliable tests require only one layout
3731         // so they're executed at the same time to save the second computation.
3732         function computePixelPositionAndBoxSizingReliable() {
3733                 div.style.cssText =
3734                         // Support: Firefox<29, Android 2.3
3735                         // Vendor-prefix box-sizing
3736                         "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
3737                         "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
3738                         "border:1px;padding:1px;width:4px;position:absolute";
3739                 div.innerHTML = "";
3740                 docElem.appendChild( container );
3741
3742                 var divStyle = window.getComputedStyle( div, null );
3743                 pixelPositionVal = divStyle.top !== "1%";
3744                 boxSizingReliableVal = divStyle.width === "4px";
3745
3746                 docElem.removeChild( container );
3747         }
3748
3749         // Support: node.js jsdom
3750         // Don't assume that getComputedStyle is a property of the global object
3751         if ( window.getComputedStyle ) {
3752                 jQuery.extend( support, {
3753                         pixelPosition: function() {
3754                                 // This test is executed only once but we still do memoizing
3755                                 // since we can use the boxSizingReliable pre-computing.
3756                                 // No need to check if the test was already performed, though.
3757                                 computePixelPositionAndBoxSizingReliable();
3758                                 return pixelPositionVal;
3759                         },
3760                         boxSizingReliable: function() {
3761                                 if ( boxSizingReliableVal == null ) {
3762                                         computePixelPositionAndBoxSizingReliable();
3763                                 }
3764                                 return boxSizingReliableVal;
3765                         },
3766                         reliableMarginRight: function() {
3767                                 // Support: Android 2.3
3768                                 // Check if div with explicit width and no margin-right incorrectly
3769                                 // gets computed margin-right based on width of container. (#3333)
3770                                 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
3771                                 // This support function is only executed once so no memoizing is needed.
3772                                 var ret,
3773                                         marginDiv = div.appendChild( document.createElement( "div" ) );
3774
3775                                 // Reset CSS: box-sizing; display; margin; border; padding
3776                                 marginDiv.style.cssText = div.style.cssText =
3777                                         // Support: Firefox<29, Android 2.3
3778                                         // Vendor-prefix box-sizing
3779                                         "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
3780                                         "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
3781                                 marginDiv.style.marginRight = marginDiv.style.width = "0";
3782                                 div.style.width = "1px";
3783                                 docElem.appendChild( container );
3784
3785                                 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
3786
3787                                 docElem.removeChild( container );
3788
3789                                 return ret;
3790                         }
3791                 });
3792         }
3793 })();
3794
3795
3796 // A method for quickly swapping in/out CSS properties to get correct calculations.
3797 jQuery.swap = function( elem, options, callback, args ) {
3798         var ret, name,
3799                 old = {};
3800
3801         // Remember the old values, and insert the new ones
3802         for ( name in options ) {
3803                 old[ name ] = elem.style[ name ];
3804                 elem.style[ name ] = options[ name ];
3805         }
3806
3807         ret = callback.apply( elem, args || [] );
3808
3809         // Revert the old values
3810         for ( name in options ) {
3811                 elem.style[ name ] = old[ name ];
3812         }
3813
3814         return ret;
3815 };
3816
3817
3818 var
3819         // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
3820         // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
3821         rdisplayswap = /^(none|table(?!-c[ea]).+)/,
3822         rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
3823         rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
3824
3825         cssShow = { position: "absolute", visibility: "hidden", display: "block" },
3826         cssNormalTransform = {
3827                 letterSpacing: "0",
3828                 fontWeight: "400"
3829         },
3830
3831         cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
3832
3833 // return a css property mapped to a potentially vendor prefixed property
3834 function vendorPropName( style, name ) {
3835
3836         // shortcut for names that are not vendor prefixed
3837         if ( name in style ) {
3838                 return name;
3839         }
3840
3841         // check for vendor prefixed names
3842         var capName = name[0].toUpperCase() + name.slice(1),
3843                 origName = name,
3844                 i = cssPrefixes.length;
3845
3846         while ( i-- ) {
3847                 name = cssPrefixes[ i ] + capName;
3848                 if ( name in style ) {
3849                         return name;
3850                 }
3851         }
3852
3853         return origName;
3854 }
3855
3856 function setPositiveNumber( elem, value, subtract ) {
3857         var matches = rnumsplit.exec( value );
3858         return matches ?
3859                 // Guard against undefined "subtract", e.g., when used as in cssHooks
3860                 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
3861                 value;
3862 }
3863
3864 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
3865         var i = extra === ( isBorderBox ? "border" : "content" ) ?
3866                 // If we already have the right measurement, avoid augmentation
3867                 4 :
3868                 // Otherwise initialize for horizontal or vertical properties
3869                 name === "width" ? 1 : 0,
3870
3871                 val = 0;
3872
3873         for ( ; i < 4; i += 2 ) {
3874                 // both box models exclude margin, so add it if we want it
3875                 if ( extra === "margin" ) {
3876                         val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
3877                 }
3878
3879                 if ( isBorderBox ) {
3880                         // border-box includes padding, so remove it if we want content
3881                         if ( extra === "content" ) {
3882                                 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
3883                         }
3884
3885                         // at this point, extra isn't border nor margin, so remove border
3886                         if ( extra !== "margin" ) {
3887                                 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
3888                         }
3889                 } else {
3890                         // at this point, extra isn't content, so add padding
3891                         val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
3892
3893                         // at this point, extra isn't content nor padding, so add border
3894                         if ( extra !== "padding" ) {
3895                                 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
3896                         }
3897                 }
3898         }
3899
3900         return val;
3901 }
3902
3903 function getWidthOrHeight( elem, name, extra ) {
3904
3905         // Start with offset property, which is equivalent to the border-box value
3906         var valueIsBorderBox = true,
3907                 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
3908                 styles = getStyles( elem ),
3909                 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
3910
3911         // some non-html elements return undefined for offsetWidth, so check for null/undefined
3912         // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
3913         // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
3914         if ( val <= 0 || val == null ) {
3915                 // Fall back to computed then uncomputed css if necessary
3916                 val = curCSS( elem, name, styles );
3917                 if ( val < 0 || val == null ) {
3918                         val = elem.style[ name ];
3919                 }
3920
3921                 // Computed unit is not pixels. Stop here and return.
3922                 if ( rnumnonpx.test(val) ) {
3923                         return val;
3924                 }
3925
3926                 // we need the check for style in case a browser which returns unreliable values
3927                 // for getComputedStyle silently falls back to the reliable elem.style
3928                 valueIsBorderBox = isBorderBox &&
3929                         ( support.boxSizingReliable() || val === elem.style[ name ] );
3930
3931                 // Normalize "", auto, and prepare for extra
3932                 val = parseFloat( val ) || 0;
3933         }
3934
3935         // use the active box-sizing model to add/subtract irrelevant styles
3936         return ( val +
3937                 augmentWidthOrHeight(
3938                         elem,
3939                         name,
3940                         extra || ( isBorderBox ? "border" : "content" ),
3941                         valueIsBorderBox,
3942                         styles
3943                 )
3944         ) + "px";
3945 }
3946
3947 function showHide( elements, show ) {
3948         var display, elem, hidden,
3949                 values = [],
3950                 index = 0,
3951                 length = elements.length;
3952
3953         for ( ; index < length; index++ ) {
3954                 elem = elements[ index ];
3955                 if ( !elem.style ) {
3956                         continue;
3957                 }
3958
3959                 values[ index ] = data_priv.get( elem, "olddisplay" );
3960                 display = elem.style.display;
3961                 if ( show ) {
3962                         // Reset the inline display of this element to learn if it is
3963                         // being hidden by cascaded rules or not
3964                         if ( !values[ index ] && display === "none" ) {
3965                                 elem.style.display = "";
3966                         }
3967
3968                         // Set elements which have been overridden with display: none
3969                         // in a stylesheet to whatever the default browser style is
3970                         // for such an element
3971                         if ( elem.style.display === "" && isHidden( elem ) ) {
3972                                 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
3973                         }
3974                 } else {
3975                         hidden = isHidden( elem );
3976
3977                         if ( display !== "none" || !hidden ) {
3978                                 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
3979                         }
3980                 }
3981         }
3982
3983         // Set the display of most of the elements in a second loop
3984         // to avoid the constant reflow
3985         for ( index = 0; index < length; index++ ) {
3986                 elem = elements[ index ];
3987                 if ( !elem.style ) {
3988                         continue;
3989                 }
3990                 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
3991                         elem.style.display = show ? values[ index ] || "" : "none";
3992                 }
3993         }
3994
3995         return elements;
3996 }
3997
3998 jQuery.extend({
3999         // Add in style property hooks for overriding the default
4000         // behavior of getting and setting a style property
4001         cssHooks: {
4002                 opacity: {
4003                         get: function( elem, computed ) {
4004                                 if ( computed ) {
4005                                         // We should always get a number back from opacity
4006                                         var ret = curCSS( elem, "opacity" );
4007                                         return ret === "" ? "1" : ret;
4008                                 }
4009                         }
4010                 }
4011         },
4012
4013         // Don't automatically add "px" to these possibly-unitless properties
4014         cssNumber: {
4015                 "columnCount": true,
4016                 "fillOpacity": true,
4017                 "flexGrow": true,
4018                 "flexShrink": true,
4019                 "fontWeight": true,
4020                 "lineHeight": true,
4021                 "opacity": true,
4022                 "order": true,
4023                 "orphans": true,
4024                 "widows": true,
4025                 "zIndex": true,
4026                 "zoom": true
4027         },
4028
4029         // Add in properties whose names you wish to fix before
4030         // setting or getting the value
4031         cssProps: {
4032                 // normalize float css property
4033                 "float": "cssFloat"
4034         },
4035
4036         // Get and set the style property on a DOM Node
4037         style: function( elem, name, value, extra ) {
4038                 // Don't set styles on text and comment nodes
4039                 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
4040                         return;
4041                 }
4042
4043                 // Make sure that we're working with the right name
4044                 var ret, type, hooks,
4045                         origName = jQuery.camelCase( name ),
4046                         style = elem.style;
4047
4048                 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
4049
4050                 // gets hook for the prefixed version
4051                 // followed by the unprefixed version
4052                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
4053
4054                 // Check if we're setting a value
4055                 if ( value !== undefined ) {
4056                         type = typeof value;
4057
4058                         // convert relative number strings (+= or -=) to relative numbers. #7345
4059                         if ( type === "string" && (ret = rrelNum.exec( value )) ) {
4060                                 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
4061                                 // Fixes bug #9237
4062                                 type = "number";
4063                         }
4064
4065                         // Make sure that null and NaN values aren't set. See: #7116
4066                         if ( value == null || value !== value ) {
4067                                 return;
4068                         }
4069
4070                         // If a number was passed in, add 'px' to the (except for certain CSS properties)
4071                         if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
4072                                 value += "px";
4073                         }
4074
4075                         // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
4076                         // but it would mean to define eight (for every problematic property) identical functions
4077                         if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
4078                                 style[ name ] = "inherit";
4079                         }
4080
4081                         // If a hook was provided, use that value, otherwise just set the specified value
4082                         if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
4083                                 style[ name ] = value;
4084                         }
4085
4086                 } else {
4087                         // If a hook was provided get the non-computed value from there
4088                         if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
4089                                 return ret;
4090                         }
4091
4092                         // Otherwise just get the value from the style object
4093                         return style[ name ];
4094                 }
4095         },
4096
4097         css: function( elem, name, extra, styles ) {
4098                 var val, num, hooks,
4099                         origName = jQuery.camelCase( name );
4100
4101                 // Make sure that we're working with the right name
4102                 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
4103
4104                 // gets hook for the prefixed version
4105                 // followed by the unprefixed version
4106                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
4107
4108                 // If a hook was provided get the computed value from there
4109                 if ( hooks && "get" in hooks ) {
4110                         val = hooks.get( elem, true, extra );
4111                 }
4112
4113                 // Otherwise, if a way to get the computed value exists, use that
4114                 if ( val === undefined ) {
4115                         val = curCSS( elem, name, styles );
4116                 }
4117
4118                 //convert "normal" to computed value
4119                 if ( val === "normal" && name in cssNormalTransform ) {
4120                         val = cssNormalTransform[ name ];
4121                 }
4122
4123                 // Return, converting to number if forced or a qualifier was provided and val looks numeric
4124                 if ( extra === "" || extra ) {
4125                         num = parseFloat( val );
4126                         return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
4127                 }
4128                 return val;
4129         }
4130 });
4131
4132 jQuery.each([ "height", "width" ], function( i, name ) {
4133         jQuery.cssHooks[ name ] = {
4134                 get: function( elem, computed, extra ) {
4135                         if ( computed ) {
4136                                 // certain elements can have dimension info if we invisibly show them
4137                                 // however, it must have a current display style that would benefit from this
4138                                 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
4139                                         jQuery.swap( elem, cssShow, function() {
4140                                                 return getWidthOrHeight( elem, name, extra );
4141                                         }) :
4142                                         getWidthOrHeight( elem, name, extra );
4143                         }
4144                 },
4145
4146                 set: function( elem, value, extra ) {
4147                         var styles = extra && getStyles( elem );
4148                         return setPositiveNumber( elem, value, extra ?
4149                                 augmentWidthOrHeight(
4150                                         elem,
4151                                         name,
4152                                         extra,
4153                                         jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
4154                                         styles
4155                                 ) : 0
4156                         );
4157                 }
4158         };
4159 });
4160
4161 // Support: Android 2.3
4162 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
4163         function( elem, computed ) {
4164                 if ( computed ) {
4165                         // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
4166                         // Work around by temporarily setting element display to inline-block
4167                         return jQuery.swap( elem, { "display": "inline-block" },
4168                                 curCSS, [ elem, "marginRight" ] );
4169                 }
4170         }
4171 );
4172
4173 // These hooks are used by animate to expand properties
4174 jQuery.each({
4175         margin: "",
4176         padding: "",
4177         border: "Width"
4178 }, function( prefix, suffix ) {
4179         jQuery.cssHooks[ prefix + suffix ] = {
4180                 expand: function( value ) {
4181                         var i = 0,
4182                                 expanded = {},
4183
4184                                 // assumes a single number if not a string
4185                                 parts = typeof value === "string" ? value.split(" ") : [ value ];
4186
4187                         for ( ; i < 4; i++ ) {
4188                                 expanded[ prefix + cssExpand[ i ] + suffix ] =
4189                                         parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
4190                         }
4191
4192                         return expanded;
4193                 }
4194         };
4195
4196         if ( !rmargin.test( prefix ) ) {
4197                 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
4198         }
4199 });
4200
4201 jQuery.fn.extend({
4202         css: function( name, value ) {
4203                 return access( this, function( elem, name, value ) {
4204                         var styles, len,
4205                                 map = {},
4206                                 i = 0;
4207
4208                         if ( jQuery.isArray( name ) ) {
4209                                 styles = getStyles( elem );
4210                                 len = name.length;
4211
4212                                 for ( ; i < len; i++ ) {
4213                                         map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
4214                                 }
4215
4216                                 return map;
4217                         }
4218
4219                         return value !== undefined ?
4220                                 jQuery.style( elem, name, value ) :
4221                                 jQuery.css( elem, name );
4222                 }, name, value, arguments.length > 1 );
4223         },
4224         show: function() {
4225                 return showHide( this, true );
4226         },
4227         hide: function() {
4228                 return showHide( this );
4229         },
4230         toggle: function( state ) {
4231                 if ( typeof state === "boolean" ) {
4232                         return state ? this.show() : this.hide();
4233                 }
4234
4235                 return this.each(function() {
4236                         if ( isHidden( this ) ) {
4237                                 jQuery( this ).show();
4238                         } else {
4239                                 jQuery( this ).hide();
4240                         }
4241                 });
4242         }
4243 });
4244
4245
4246 function Tween( elem, options, prop, end, easing ) {
4247         return new Tween.prototype.init( elem, options, prop, end, easing );
4248 }
4249 jQuery.Tween = Tween;
4250
4251 Tween.prototype = {
4252         constructor: Tween,
4253         init: function( elem, options, prop, end, easing, unit ) {
4254                 this.elem = elem;
4255                 this.prop = prop;
4256                 this.easing = easing || "swing";
4257                 this.options = options;
4258                 this.start = this.now = this.cur();
4259                 this.end = end;
4260                 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
4261         },
4262         cur: function() {
4263                 var hooks = Tween.propHooks[ this.prop ];
4264
4265                 return hooks && hooks.get ?
4266                         hooks.get( this ) :
4267                         Tween.propHooks._default.get( this );
4268         },
4269         run: function( percent ) {
4270                 var eased,
4271                         hooks = Tween.propHooks[ this.prop ];
4272
4273                 if ( this.options.duration ) {
4274                         this.pos = eased = jQuery.easing[ this.easing ](
4275                                 percent, this.options.duration * percent, 0, 1, this.options.duration
4276                         );
4277                 } else {
4278                         this.pos = eased = percent;
4279                 }
4280                 this.now = ( this.end - this.start ) * eased + this.start;
4281
4282                 if ( this.options.step ) {
4283                         this.options.step.call( this.elem, this.now, this );
4284                 }
4285
4286                 if ( hooks && hooks.set ) {
4287                         hooks.set( this );
4288                 } else {
4289                         Tween.propHooks._default.set( this );
4290                 }
4291                 return this;
4292         }
4293 };
4294
4295 Tween.prototype.init.prototype = Tween.prototype;
4296
4297 Tween.propHooks = {
4298         _default: {
4299                 get: function( tween ) {
4300                         var result;
4301
4302                         if ( tween.elem[ tween.prop ] != null &&
4303                                 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
4304                                 return tween.elem[ tween.prop ];
4305                         }
4306
4307                         // passing an empty string as a 3rd parameter to .css will automatically
4308                         // attempt a parseFloat and fallback to a string if the parse fails
4309                         // so, simple values such as "10px" are parsed to Float.
4310                         // complex values such as "rotate(1rad)" are returned as is.
4311                         result = jQuery.css( tween.elem, tween.prop, "" );
4312                         // Empty strings, null, undefined and "auto" are converted to 0.
4313                         return !result || result === "auto" ? 0 : result;
4314                 },
4315                 set: function( tween ) {
4316                         // use step hook for back compat - use cssHook if its there - use .style if its
4317                         // available and use plain properties where available
4318                         if ( jQuery.fx.step[ tween.prop ] ) {
4319                                 jQuery.fx.step[ tween.prop ]( tween );
4320                         } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
4321                                 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
4322                         } else {
4323                                 tween.elem[ tween.prop ] = tween.now;
4324                         }
4325                 }
4326         }
4327 };
4328
4329 // Support: IE9
4330 // Panic based approach to setting things on disconnected nodes
4331
4332 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
4333         set: function( tween ) {
4334                 if ( tween.elem.nodeType && tween.elem.parentNode ) {
4335                         tween.elem[ tween.prop ] = tween.now;
4336                 }
4337         }
4338 };
4339
4340 jQuery.easing = {
4341         linear: function( p ) {
4342                 return p;
4343         },
4344         swing: function( p ) {
4345                 return 0.5 - Math.cos( p * Math.PI ) / 2;
4346         }
4347 };
4348
4349 jQuery.fx = Tween.prototype.init;
4350
4351 // Back Compat <1.8 extension point
4352 jQuery.fx.step = {};
4353
4354
4355
4356
4357 var
4358         fxNow, timerId,
4359         rfxtypes = /^(?:toggle|show|hide)$/,
4360         rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
4361         rrun = /queueHooks$/,
4362         animationPrefilters = [ defaultPrefilter ],
4363         tweeners = {
4364                 "*": [ function( prop, value ) {
4365                         var tween = this.createTween( prop, value ),
4366                                 target = tween.cur(),
4367                                 parts = rfxnum.exec( value ),
4368                                 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4369
4370                                 // Starting value computation is required for potential unit mismatches
4371                                 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
4372                                         rfxnum.exec( jQuery.css( tween.elem, prop ) ),
4373                                 scale = 1,
4374                                 maxIterations = 20;
4375
4376                         if ( start && start[ 3 ] !== unit ) {
4377                                 // Trust units reported by jQuery.css
4378                                 unit = unit || start[ 3 ];
4379
4380                                 // Make sure we update the tween properties later on
4381                                 parts = parts || [];
4382
4383                                 // Iteratively approximate from a nonzero starting point
4384                                 start = +target || 1;
4385
4386                                 do {
4387                                         // If previous iteration zeroed out, double until we get *something*
4388                                         // Use a string for doubling factor so we don't accidentally see scale as unchanged below
4389                                         scale = scale || ".5";
4390
4391                                         // Adjust and apply
4392                                         start = start / scale;
4393                                         jQuery.style( tween.elem, prop, start + unit );
4394
4395                                 // Update scale, tolerating zero or NaN from tween.cur()
4396                                 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
4397                                 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
4398                         }
4399
4400                         // Update tween properties
4401                         if ( parts ) {
4402                                 start = tween.start = +start || +target || 0;
4403                                 tween.unit = unit;
4404                                 // If a +=/-= token was provided, we're doing a relative animation
4405                                 tween.end = parts[ 1 ] ?
4406                                         start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
4407                                         +parts[ 2 ];
4408                         }
4409
4410                         return tween;
4411                 } ]
4412         };
4413
4414 // Animations created synchronously will run synchronously
4415 function createFxNow() {
4416         setTimeout(function() {
4417                 fxNow = undefined;
4418         });
4419         return ( fxNow = jQuery.now() );
4420 }
4421
4422 // Generate parameters to create a standard animation
4423 function genFx( type, includeWidth ) {
4424         var which,
4425                 i = 0,
4426                 attrs = { height: type };
4427
4428         // if we include width, step value is 1 to do all cssExpand values,
4429         // if we don't include width, step value is 2 to skip over Left and Right
4430         includeWidth = includeWidth ? 1 : 0;
4431         for ( ; i < 4 ; i += 2 - includeWidth ) {
4432                 which = cssExpand[ i ];
4433                 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
4434         }
4435
4436         if ( includeWidth ) {
4437                 attrs.opacity = attrs.width = type;
4438         }
4439
4440         return attrs;
4441 }
4442
4443 function createTween( value, prop, animation ) {
4444         var tween,
4445                 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
4446                 index = 0,
4447                 length = collection.length;
4448         for ( ; index < length; index++ ) {
4449                 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
4450
4451                         // we're done with this property
4452                         return tween;
4453                 }
4454         }
4455 }
4456
4457 function defaultPrefilter( elem, props, opts ) {
4458         /* jshint validthis: true */
4459         var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
4460                 anim = this,
4461                 orig = {},
4462                 style = elem.style,
4463                 hidden = elem.nodeType && isHidden( elem ),
4464                 dataShow = data_priv.get( elem, "fxshow" );
4465
4466         // handle queue: false promises
4467         if ( !opts.queue ) {
4468                 hooks = jQuery._queueHooks( elem, "fx" );
4469                 if ( hooks.unqueued == null ) {
4470                         hooks.unqueued = 0;
4471                         oldfire = hooks.empty.fire;
4472                         hooks.empty.fire = function() {
4473                                 if ( !hooks.unqueued ) {
4474                                         oldfire();
4475                                 }
4476                         };
4477                 }
4478                 hooks.unqueued++;
4479
4480                 anim.always(function() {
4481                         // doing this makes sure that the complete handler will be called
4482                         // before this completes
4483                         anim.always(function() {
4484                                 hooks.unqueued--;
4485                                 if ( !jQuery.queue( elem, "fx" ).length ) {
4486                                         hooks.empty.fire();
4487                                 }
4488                         });
4489                 });
4490         }
4491
4492         // height/width overflow pass
4493         if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
4494                 // Make sure that nothing sneaks out
4495                 // Record all 3 overflow attributes because IE9-10 do not
4496                 // change the overflow attribute when overflowX and
4497                 // overflowY are set to the same value
4498                 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
4499
4500                 // Set display property to inline-block for height/width
4501                 // animations on inline elements that are having width/height animated
4502                 display = jQuery.css( elem, "display" );
4503
4504                 // Test default display if display is currently "none"
4505                 checkDisplay = display === "none" ?
4506                         data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
4507
4508                 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
4509                         style.display = "inline-block";
4510                 }
4511         }
4512
4513         if ( opts.overflow ) {
4514                 style.overflow = "hidden";
4515                 anim.always(function() {
4516                         style.overflow = opts.overflow[ 0 ];
4517                         style.overflowX = opts.overflow[ 1 ];
4518                         style.overflowY = opts.overflow[ 2 ];
4519                 });
4520         }
4521
4522         // show/hide pass
4523         for ( prop in props ) {
4524                 value = props[ prop ];
4525                 if ( rfxtypes.exec( value ) ) {
4526                         delete props[ prop ];
4527                         toggle = toggle || value === "toggle";
4528                         if ( value === ( hidden ? "hide" : "show" ) ) {
4529
4530                                 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
4531                                 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
4532                                         hidden = true;
4533                                 } else {
4534                                         continue;
4535                                 }
4536                         }
4537                         orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
4538
4539                 // Any non-fx value stops us from restoring the original display value
4540                 } else {
4541                         display = undefined;
4542                 }
4543         }
4544
4545         if ( !jQuery.isEmptyObject( orig ) ) {
4546                 if ( dataShow ) {
4547                         if ( "hidden" in dataShow ) {
4548                                 hidden = dataShow.hidden;
4549                         }
4550                 } else {
4551                         dataShow = data_priv.access( elem, "fxshow", {} );
4552                 }
4553
4554                 // store state if its toggle - enables .stop().toggle() to "reverse"
4555                 if ( toggle ) {
4556                         dataShow.hidden = !hidden;
4557                 }
4558                 if ( hidden ) {
4559                         jQuery( elem ).show();
4560                 } else {
4561                         anim.done(function() {
4562                                 jQuery( elem ).hide();
4563                         });
4564                 }
4565                 anim.done(function() {
4566                         var prop;
4567
4568                         data_priv.remove( elem, "fxshow" );
4569                         for ( prop in orig ) {
4570                                 jQuery.style( elem, prop, orig[ prop ] );
4571                         }
4572                 });
4573                 for ( prop in orig ) {
4574                         tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
4575
4576                         if ( !( prop in dataShow ) ) {
4577                                 dataShow[ prop ] = tween.start;
4578                                 if ( hidden ) {
4579                                         tween.end = tween.start;
4580                                         tween.start = prop === "width" || prop === "height" ? 1 : 0;
4581                                 }
4582                         }
4583                 }
4584
4585         // If this is a noop like .hide().hide(), restore an overwritten display value
4586         } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
4587                 style.display = display;
4588         }
4589 }
4590
4591 function propFilter( props, specialEasing ) {
4592         var index, name, easing, value, hooks;
4593
4594         // camelCase, specialEasing and expand cssHook pass
4595         for ( index in props ) {
4596                 name = jQuery.camelCase( index );
4597                 easing = specialEasing[ name ];
4598                 value = props[ index ];
4599                 if ( jQuery.isArray( value ) ) {
4600                         easing = value[ 1 ];
4601                         value = props[ index ] = value[ 0 ];
4602                 }
4603
4604                 if ( index !== name ) {
4605                         props[ name ] = value;
4606                         delete props[ index ];
4607                 }
4608
4609                 hooks = jQuery.cssHooks[ name ];
4610                 if ( hooks && "expand" in hooks ) {
4611                         value = hooks.expand( value );
4612                         delete props[ name ];
4613
4614                         // not quite $.extend, this wont overwrite keys already present.
4615                         // also - reusing 'index' from above because we have the correct "name"
4616                         for ( index in value ) {
4617                                 if ( !( index in props ) ) {
4618                                         props[ index ] = value[ index ];
4619                                         specialEasing[ index ] = easing;
4620                                 }
4621                         }
4622                 } else {
4623                         specialEasing[ name ] = easing;
4624                 }
4625         }
4626 }
4627
4628 function Animation( elem, properties, options ) {
4629         var result,
4630                 stopped,
4631                 index = 0,
4632                 length = animationPrefilters.length,
4633                 deferred = jQuery.Deferred().always( function() {
4634                         // don't match elem in the :animated selector
4635                         delete tick.elem;
4636                 }),
4637                 tick = function() {
4638                         if ( stopped ) {
4639                                 return false;
4640                         }
4641                         var currentTime = fxNow || createFxNow(),
4642                                 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
4643                                 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
4644                                 temp = remaining / animation.duration || 0,
4645                                 percent = 1 - temp,
4646                                 index = 0,
4647                                 length = animation.tweens.length;
4648
4649                         for ( ; index < length ; index++ ) {
4650                                 animation.tweens[ index ].run( percent );
4651                         }
4652
4653                         deferred.notifyWith( elem, [ animation, percent, remaining ]);
4654
4655                         if ( percent < 1 && length ) {
4656                                 return remaining;
4657                         } else {
4658                                 deferred.resolveWith( elem, [ animation ] );
4659                                 return false;
4660                         }
4661                 },
4662                 animation = deferred.promise({
4663                         elem: elem,
4664                         props: jQuery.extend( {}, properties ),
4665                         opts: jQuery.extend( true, { specialEasing: {} }, options ),
4666                         originalProperties: properties,
4667                         originalOptions: options,
4668                         startTime: fxNow || createFxNow(),
4669                         duration: options.duration,
4670                         tweens: [],
4671                         createTween: function( prop, end ) {
4672                                 var tween = jQuery.Tween( elem, animation.opts, prop, end,
4673                                                 animation.opts.specialEasing[ prop ] || animation.opts.easing );
4674                                 animation.tweens.push( tween );
4675                                 return tween;
4676                         },
4677                         stop: function( gotoEnd ) {
4678                                 var index = 0,
4679                                         // if we are going to the end, we want to run all the tweens
4680                                         // otherwise we skip this part
4681                                         length = gotoEnd ? animation.tweens.length : 0;
4682                                 if ( stopped ) {
4683                                         return this;
4684                                 }
4685                                 stopped = true;
4686                                 for ( ; index < length ; index++ ) {
4687                                         animation.tweens[ index ].run( 1 );
4688                                 }
4689
4690                                 // resolve when we played the last frame
4691                                 // otherwise, reject
4692                                 if ( gotoEnd ) {
4693                                         deferred.resolveWith( elem, [ animation, gotoEnd ] );
4694                                 } else {
4695                                         deferred.rejectWith( elem, [ animation, gotoEnd ] );
4696                                 }
4697                                 return this;
4698                         }
4699                 }),
4700                 props = animation.props;
4701
4702         propFilter( props, animation.opts.specialEasing );
4703
4704         for ( ; index < length ; index++ ) {
4705                 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
4706                 if ( result ) {
4707                         return result;
4708                 }
4709         }
4710
4711         jQuery.map( props, createTween, animation );
4712
4713         if ( jQuery.isFunction( animation.opts.start ) ) {
4714                 animation.opts.start.call( elem, animation );
4715         }
4716
4717         jQuery.fx.timer(
4718                 jQuery.extend( tick, {
4719                         elem: elem,
4720                         anim: animation,
4721                         queue: animation.opts.queue
4722                 })
4723         );
4724
4725         // attach callbacks from options
4726         return animation.progress( animation.opts.progress )
4727                 .done( animation.opts.done, animation.opts.complete )
4728                 .fail( animation.opts.fail )
4729                 .always( animation.opts.always );
4730 }
4731
4732 jQuery.Animation = jQuery.extend( Animation, {
4733
4734         tweener: function( props, callback ) {
4735                 if ( jQuery.isFunction( props ) ) {
4736                         callback = props;
4737                         props = [ "*" ];
4738                 } else {
4739                         props = props.split(" ");
4740                 }
4741
4742                 var prop,
4743                         index = 0,
4744                         length = props.length;
4745
4746                 for ( ; index < length ; index++ ) {
4747                         prop = props[ index ];
4748                         tweeners[ prop ] = tweeners[ prop ] || [];
4749                         tweeners[ prop ].unshift( callback );
4750                 }
4751         },
4752
4753         prefilter: function( callback, prepend ) {
4754                 if ( prepend ) {
4755                         animationPrefilters.unshift( callback );
4756                 } else {
4757                         animationPrefilters.push( callback );
4758                 }
4759         }
4760 });
4761
4762 jQuery.speed = function( speed, easing, fn ) {
4763         var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
4764                 complete: fn || !fn && easing ||
4765                         jQuery.isFunction( speed ) && speed,
4766                 duration: speed,
4767                 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
4768         };
4769
4770         opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
4771                 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
4772
4773         // normalize opt.queue - true/undefined/null -> "fx"
4774         if ( opt.queue == null || opt.queue === true ) {
4775                 opt.queue = "fx";
4776         }
4777
4778         // Queueing
4779         opt.old = opt.complete;
4780
4781         opt.complete = function() {
4782                 if ( jQuery.isFunction( opt.old ) ) {
4783                         opt.old.call( this );
4784                 }
4785
4786                 if ( opt.queue ) {
4787                         jQuery.dequeue( this, opt.queue );
4788                 }
4789         };
4790
4791         return opt;
4792 };
4793
4794 jQuery.fn.extend({
4795         fadeTo: function( speed, to, easing, callback ) {
4796
4797                 // show any hidden elements after setting opacity to 0
4798                 return this.filter( isHidden ).css( "opacity", 0 ).show()
4799
4800                         // animate to the value specified
4801                         .end().animate({ opacity: to }, speed, easing, callback );
4802         },
4803         animate: function( prop, speed, easing, callback ) {
4804                 var empty = jQuery.isEmptyObject( prop ),
4805                         optall = jQuery.speed( speed, easing, callback ),
4806                         doAnimation = function() {
4807                                 // Operate on a copy of prop so per-property easing won't be lost
4808                                 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
4809
4810                                 // Empty animations, or finishing resolves immediately
4811                                 if ( empty || data_priv.get( this, "finish" ) ) {
4812                                         anim.stop( true );
4813                                 }
4814                         };
4815                         doAnimation.finish = doAnimation;
4816
4817                 return empty || optall.queue === false ?
4818                         this.each( doAnimation ) :
4819                         this.queue( optall.queue, doAnimation );
4820         },
4821         stop: function( type, clearQueue, gotoEnd ) {
4822                 var stopQueue = function( hooks ) {
4823                         var stop = hooks.stop;
4824                         delete hooks.stop;
4825                         stop( gotoEnd );
4826                 };
4827
4828                 if ( typeof type !== "string" ) {
4829                         gotoEnd = clearQueue;
4830                         clearQueue = type;
4831                         type = undefined;
4832                 }
4833                 if ( clearQueue && type !== false ) {
4834                         this.queue( type || "fx", [] );
4835                 }
4836
4837                 return this.each(function() {
4838                         var dequeue = true,
4839                                 index = type != null && type + "queueHooks",
4840                                 timers = jQuery.timers,
4841                                 data = data_priv.get( this );
4842
4843                         if ( index ) {
4844                                 if ( data[ index ] && data[ index ].stop ) {
4845                                         stopQueue( data[ index ] );
4846                                 }
4847                         } else {
4848                                 for ( index in data ) {
4849                                         if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
4850                                                 stopQueue( data[ index ] );
4851                                         }
4852                                 }
4853                         }
4854
4855                         for ( index = timers.length; index--; ) {
4856                                 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
4857                                         timers[ index ].anim.stop( gotoEnd );
4858                                         dequeue = false;
4859                                         timers.splice( index, 1 );
4860                                 }
4861                         }
4862
4863                         // start the next in the queue if the last step wasn't forced
4864                         // timers currently will call their complete callbacks, which will dequeue
4865                         // but only if they were gotoEnd
4866                         if ( dequeue || !gotoEnd ) {
4867                                 jQuery.dequeue( this, type );
4868                         }
4869                 });
4870         },
4871         finish: function( type ) {
4872                 if ( type !== false ) {
4873                         type = type || "fx";
4874                 }
4875                 return this.each(function() {
4876                         var index,
4877                                 data = data_priv.get( this ),
4878                                 queue = data[ type + "queue" ],
4879                                 hooks = data[ type + "queueHooks" ],
4880                                 timers = jQuery.timers,
4881                                 length = queue ? queue.length : 0;
4882
4883                         // enable finishing flag on private data
4884                         data.finish = true;
4885
4886                         // empty the queue first
4887                         jQuery.queue( this, type, [] );
4888
4889                         if ( hooks && hooks.stop ) {
4890                                 hooks.stop.call( this, true );
4891                         }
4892
4893                         // look for any active animations, and finish them
4894                         for ( index = timers.length; index--; ) {
4895                                 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
4896                                         timers[ index ].anim.stop( true );
4897                                         timers.splice( index, 1 );
4898                                 }
4899                         }
4900
4901                         // look for any animations in the old queue and finish them
4902                         for ( index = 0; index < length; index++ ) {
4903                                 if ( queue[ index ] && queue[ index ].finish ) {
4904                                         queue[ index ].finish.call( this );
4905                                 }
4906                         }
4907
4908                         // turn off finishing flag
4909                         delete data.finish;
4910                 });
4911         }
4912 });
4913
4914 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
4915         var cssFn = jQuery.fn[ name ];
4916         jQuery.fn[ name ] = function( speed, easing, callback ) {
4917                 return speed == null || typeof speed === "boolean" ?
4918                         cssFn.apply( this, arguments ) :
4919                         this.animate( genFx( name, true ), speed, easing, callback );
4920         };
4921 });
4922
4923 // Generate shortcuts for custom animations
4924 jQuery.each({
4925         slideDown: genFx("show"),
4926         slideUp: genFx("hide"),
4927         slideToggle: genFx("toggle"),
4928         fadeIn: { opacity: "show" },
4929         fadeOut: { opacity: "hide" },
4930         fadeToggle: { opacity: "toggle" }
4931 }, function( name, props ) {
4932         jQuery.fn[ name ] = function( speed, easing, callback ) {
4933                 return this.animate( props, speed, easing, callback );
4934         };
4935 });
4936
4937 jQuery.timers = [];
4938 jQuery.fx.tick = function() {
4939         var timer,
4940                 i = 0,
4941                 timers = jQuery.timers;
4942
4943         fxNow = jQuery.now();
4944
4945         for ( ; i < timers.length; i++ ) {
4946                 timer = timers[ i ];
4947                 // Checks the timer has not already been removed
4948                 if ( !timer() && timers[ i ] === timer ) {
4949                         timers.splice( i--, 1 );
4950                 }
4951         }
4952
4953         if ( !timers.length ) {
4954                 jQuery.fx.stop();
4955         }
4956         fxNow = undefined;
4957 };
4958
4959 jQuery.fx.timer = function( timer ) {
4960         jQuery.timers.push( timer );
4961         if ( timer() ) {
4962                 jQuery.fx.start();
4963         } else {
4964                 jQuery.timers.pop();
4965         }
4966 };
4967
4968 jQuery.fx.interval = 13;
4969
4970 jQuery.fx.start = function() {
4971         if ( !timerId ) {
4972                 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
4973         }
4974 };
4975
4976 jQuery.fx.stop = function() {
4977         clearInterval( timerId );
4978         timerId = null;
4979 };
4980
4981 jQuery.fx.speeds = {
4982         slow: 600,
4983         fast: 200,
4984         // Default speed
4985         _default: 400
4986 };
4987
4988
4989 // Based off of the plugin by Clint Helfers, with permission.
4990 // http://blindsignals.com/index.php/2009/07/jquery-delay/
4991 jQuery.fn.delay = function( time, type ) {
4992         time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
4993         type = type || "fx";
4994
4995         return this.queue( type, function( next, hooks ) {
4996                 var timeout = setTimeout( next, time );
4997                 hooks.stop = function() {
4998                         clearTimeout( timeout );
4999                 };
5000         });
5001 };
5002
5003
5004 (function() {
5005         var input = document.createElement( "input" ),
5006                 select = document.createElement( "select" ),
5007                 opt = select.appendChild( document.createElement( "option" ) );
5008
5009         input.type = "checkbox";
5010
5011         // Support: iOS 5.1, Android 4.x, Android 2.3
5012         // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
5013         support.checkOn = input.value !== "";
5014
5015         // Must access the parent to make an option select properly
5016         // Support: IE9, IE10
5017         support.optSelected = opt.selected;
5018
5019         // Make sure that the options inside disabled selects aren't marked as disabled
5020         // (WebKit marks them as disabled)
5021         select.disabled = true;
5022         support.optDisabled = !opt.disabled;
5023
5024         // Check if an input maintains its value after becoming a radio
5025         // Support: IE9, IE10
5026         input = document.createElement( "input" );
5027         input.value = "t";
5028         input.type = "radio";
5029         support.radioValue = input.value === "t";
5030 })();
5031
5032
5033 var nodeHook, boolHook,
5034         attrHandle = jQuery.expr.attrHandle;
5035
5036 jQuery.fn.extend({
5037         attr: function( name, value ) {
5038                 return access( this, jQuery.attr, name, value, arguments.length > 1 );
5039         },
5040
5041         removeAttr: function( name ) {
5042                 return this.each(function() {
5043                         jQuery.removeAttr( this, name );
5044                 });
5045         }
5046 });
5047
5048 jQuery.extend({
5049         attr: function( elem, name, value ) {
5050                 var hooks, ret,
5051                         nType = elem.nodeType;
5052
5053                 // don't get/set attributes on text, comment and attribute nodes
5054                 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
5055                         return;
5056                 }
5057
5058                 // Fallback to prop when attributes are not supported
5059                 if ( typeof elem.getAttribute === strundefined ) {
5060                         return jQuery.prop( elem, name, value );
5061                 }
5062
5063                 // All attributes are lowercase
5064                 // Grab necessary hook if one is defined
5065                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
5066                         name = name.toLowerCase();
5067                         hooks = jQuery.attrHooks[ name ] ||
5068                                 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
5069                 }
5070
5071                 if ( value !== undefined ) {
5072
5073                         if ( value === null ) {
5074                                 jQuery.removeAttr( elem, name );
5075
5076                         } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
5077                                 return ret;
5078
5079                         } else {
5080                                 elem.setAttribute( name, value + "" );
5081                                 return value;
5082                         }
5083
5084                 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
5085                         return ret;
5086
5087                 } else {
5088                         ret = jQuery.find.attr( elem, name );
5089
5090                         // Non-existent attributes return null, we normalize to undefined
5091                         return ret == null ?
5092                                 undefined :
5093                                 ret;
5094                 }
5095         },
5096
5097         removeAttr: function( elem, value ) {
5098                 var name, propName,
5099                         i = 0,
5100                         attrNames = value && value.match( rnotwhite );
5101
5102                 if ( attrNames && elem.nodeType === 1 ) {
5103                         while ( (name = attrNames[i++]) ) {
5104                                 propName = jQuery.propFix[ name ] || name;
5105
5106                                 // Boolean attributes get special treatment (#10870)
5107                                 if ( jQuery.expr.match.bool.test( name ) ) {
5108                                         // Set corresponding property to false
5109                                         elem[ propName ] = false;
5110                                 }
5111
5112                                 elem.removeAttribute( name );
5113                         }
5114                 }
5115         },
5116
5117         attrHooks: {
5118                 type: {
5119                         set: function( elem, value ) {
5120                                 if ( !support.radioValue && value === "radio" &&
5121                                         jQuery.nodeName( elem, "input" ) ) {
5122                                         // Setting the type on a radio button after the value resets the value in IE6-9
5123                                         // Reset value to default in case type is set after value during creation
5124                                         var val = elem.value;
5125                                         elem.setAttribute( "type", value );
5126                                         if ( val ) {
5127                                                 elem.value = val;
5128                                         }
5129                                         return value;
5130                                 }
5131                         }
5132                 }
5133         }
5134 });
5135
5136 // Hooks for boolean attributes
5137 boolHook = {
5138         set: function( elem, value, name ) {
5139                 if ( value === false ) {
5140                         // Remove boolean attributes when set to false
5141                         jQuery.removeAttr( elem, name );
5142                 } else {
5143                         elem.setAttribute( name, name );
5144                 }
5145                 return name;
5146         }
5147 };
5148 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
5149         var getter = attrHandle[ name ] || jQuery.find.attr;
5150
5151         attrHandle[ name ] = function( elem, name, isXML ) {
5152                 var ret, handle;
5153                 if ( !isXML ) {
5154                         // Avoid an infinite loop by temporarily removing this function from the getter
5155                         handle = attrHandle[ name ];
5156                         attrHandle[ name ] = ret;
5157                         ret = getter( elem, name, isXML ) != null ?
5158                                 name.toLowerCase() :
5159                                 null;
5160                         attrHandle[ name ] = handle;
5161                 }
5162                 return ret;
5163         };
5164 });
5165
5166
5167
5168
5169 var rfocusable = /^(?:input|select|textarea|button)$/i;
5170
5171 jQuery.fn.extend({
5172         prop: function( name, value ) {
5173                 return access( this, jQuery.prop, name, value, arguments.length > 1 );
5174         },
5175
5176         removeProp: function( name ) {
5177                 return this.each(function() {
5178                         delete this[ jQuery.propFix[ name ] || name ];
5179                 });
5180         }
5181 });
5182
5183 jQuery.extend({
5184         propFix: {
5185                 "for": "htmlFor",
5186                 "class": "className"
5187         },
5188
5189         prop: function( elem, name, value ) {
5190                 var ret, hooks, notxml,
5191                         nType = elem.nodeType;
5192
5193                 // don't get/set properties on text, comment and attribute nodes
5194                 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
5195                         return;
5196                 }
5197
5198                 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
5199
5200                 if ( notxml ) {
5201                         // Fix name and attach hooks
5202                         name = jQuery.propFix[ name ] || name;
5203                         hooks = jQuery.propHooks[ name ];
5204                 }
5205
5206                 if ( value !== undefined ) {
5207                         return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
5208                                 ret :
5209                                 ( elem[ name ] = value );
5210
5211                 } else {
5212                         return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
5213                                 ret :
5214                                 elem[ name ];
5215                 }
5216         },
5217
5218         propHooks: {
5219                 tabIndex: {
5220                         get: function( elem ) {
5221                                 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
5222                                         elem.tabIndex :
5223                                         -1;
5224                         }
5225                 }
5226         }
5227 });
5228
5229 // Support: IE9+
5230 // Selectedness for an option in an optgroup can be inaccurate
5231 if ( !support.optSelected ) {
5232         jQuery.propHooks.selected = {
5233                 get: function( elem ) {
5234                         var parent = elem.parentNode;
5235                         if ( parent && parent.parentNode ) {
5236                                 parent.parentNode.selectedIndex;
5237                         }
5238                         return null;
5239                 }
5240         };
5241 }
5242
5243 jQuery.each([
5244         "tabIndex",
5245         "readOnly",
5246         "maxLength",
5247         "cellSpacing",
5248         "cellPadding",
5249         "rowSpan",
5250         "colSpan",
5251         "useMap",
5252         "frameBorder",
5253         "contentEditable"
5254 ], function() {
5255         jQuery.propFix[ this.toLowerCase() ] = this;
5256 });
5257
5258
5259
5260
5261 var rclass = /[\t\r\n\f]/g;
5262
5263 jQuery.fn.extend({
5264         addClass: function( value ) {
5265                 var classes, elem, cur, clazz, j, finalValue,
5266                         proceed = typeof value === "string" && value,
5267                         i = 0,
5268                         len = this.length;
5269
5270                 if ( jQuery.isFunction( value ) ) {
5271                         return this.each(function( j ) {
5272                                 jQuery( this ).addClass( value.call( this, j, this.className ) );
5273                         });
5274                 }
5275
5276                 if ( proceed ) {
5277                         // The disjunction here is for better compressibility (see removeClass)
5278                         classes = ( value || "" ).match( rnotwhite ) || [];
5279
5280                         for ( ; i < len; i++ ) {
5281                                 elem = this[ i ];
5282                                 cur = elem.nodeType === 1 && ( elem.className ?
5283                                         ( " " + elem.className + " " ).replace( rclass, " " ) :
5284                                         " "
5285                                 );
5286
5287                                 if ( cur ) {
5288                                         j = 0;
5289                                         while ( (clazz = classes[j++]) ) {
5290                                                 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
5291                                                         cur += clazz + " ";
5292                                                 }
5293                                         }
5294
5295                                         // only assign if different to avoid unneeded rendering.
5296                                         finalValue = jQuery.trim( cur );
5297                                         if ( elem.className !== finalValue ) {
5298                                                 elem.className = finalValue;
5299                                         }
5300                                 }
5301                         }
5302                 }
5303
5304                 return this;
5305         },
5306
5307         removeClass: function( value ) {
5308                 var classes, elem, cur, clazz, j, finalValue,
5309                         proceed = arguments.length === 0 || typeof value === "string" && value,
5310                         i = 0,
5311                         len = this.length;
5312
5313                 if ( jQuery.isFunction( value ) ) {
5314                         return this.each(function( j ) {
5315                                 jQuery( this ).removeClass( value.call( this, j, this.className ) );
5316                         });
5317                 }
5318                 if ( proceed ) {
5319                         classes = ( value || "" ).match( rnotwhite ) || [];
5320
5321                         for ( ; i < len; i++ ) {
5322                                 elem = this[ i ];
5323                                 // This expression is here for better compressibility (see addClass)
5324                                 cur = elem.nodeType === 1 && ( elem.className ?
5325                                         ( " " + elem.className + " " ).replace( rclass, " " ) :
5326                                         ""
5327                                 );
5328
5329                                 if ( cur ) {
5330                                         j = 0;
5331                                         while ( (clazz = classes[j++]) ) {
5332                                                 // Remove *all* instances
5333                                                 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
5334                                                         cur = cur.replace( " " + clazz + " ", " " );
5335                                                 }
5336                                         }
5337
5338                                         // only assign if different to avoid unneeded rendering.
5339                                         finalValue = value ? jQuery.trim( cur ) : "";
5340                                         if ( elem.className !== finalValue ) {
5341                                                 elem.className = finalValue;
5342                                         }
5343                                 }
5344                         }
5345                 }
5346
5347                 return this;
5348         },
5349
5350         toggleClass: function( value, stateVal ) {
5351                 var type = typeof value;
5352
5353                 if ( typeof stateVal === "boolean" && type === "string" ) {
5354                         return stateVal ? this.addClass( value ) : this.removeClass( value );
5355                 }
5356
5357                 if ( jQuery.isFunction( value ) ) {
5358                         return this.each(function( i ) {
5359                                 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
5360                         });
5361                 }
5362
5363                 return this.each(function() {
5364                         if ( type === "string" ) {
5365                                 // toggle individual class names
5366                                 var className,
5367                                         i = 0,
5368                                         self = jQuery( this ),
5369                                         classNames = value.match( rnotwhite ) || [];
5370
5371                                 while ( (className = classNames[ i++ ]) ) {
5372                                         // check each className given, space separated list
5373                                         if ( self.hasClass( className ) ) {
5374                                                 self.removeClass( className );
5375                                         } else {
5376                                                 self.addClass( className );
5377                                         }
5378                                 }
5379
5380                         // Toggle whole class name
5381                         } else if ( type === strundefined || type === "boolean" ) {
5382                                 if ( this.className ) {
5383                                         // store className if set
5384                                         data_priv.set( this, "__className__", this.className );
5385                                 }
5386
5387                                 // If the element has a class name or if we're passed "false",
5388                                 // then remove the whole classname (if there was one, the above saved it).
5389                                 // Otherwise bring back whatever was previously saved (if anything),
5390                                 // falling back to the empty string if nothing was stored.
5391                                 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
5392                         }
5393                 });
5394         },
5395
5396         hasClass: function( selector ) {
5397                 var className = " " + selector + " ",
5398                         i = 0,
5399                         l = this.length;
5400                 for ( ; i < l; i++ ) {
5401                         if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
5402                                 return true;
5403                         }
5404                 }
5405
5406                 return false;
5407         }
5408 });
5409
5410
5411
5412
5413 var rreturn = /\r/g;
5414
5415 jQuery.fn.extend({
5416         val: function( value ) {
5417                 var hooks, ret, isFunction,
5418                         elem = this[0];
5419
5420                 if ( !arguments.length ) {
5421                         if ( elem ) {
5422                                 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
5423
5424                                 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
5425                                         return ret;
5426                                 }
5427
5428                                 ret = elem.value;
5429
5430                                 return typeof ret === "string" ?
5431                                         // handle most common string cases
5432                                         ret.replace(rreturn, "") :
5433                                         // handle cases where value is null/undef or number
5434                                         ret == null ? "" : ret;
5435                         }
5436
5437                         return;
5438                 }
5439
5440                 isFunction = jQuery.isFunction( value );
5441
5442                 return this.each(function( i ) {
5443                         var val;
5444
5445                         if ( this.nodeType !== 1 ) {
5446                                 return;
5447                         }
5448
5449                         if ( isFunction ) {
5450                                 val = value.call( this, i, jQuery( this ).val() );
5451                         } else {
5452                                 val = value;
5453                         }
5454
5455                         // Treat null/undefined as ""; convert numbers to string
5456                         if ( val == null ) {
5457                                 val = "";
5458
5459                         } else if ( typeof val === "number" ) {
5460                                 val += "";
5461
5462                         } else if ( jQuery.isArray( val ) ) {
5463                                 val = jQuery.map( val, function( value ) {
5464                                         return value == null ? "" : value + "";
5465                                 });
5466                         }
5467
5468                         hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
5469
5470                         // If set returns undefined, fall back to normal setting
5471                         if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
5472                                 this.value = val;
5473                         }
5474                 });
5475         }
5476 });
5477
5478 jQuery.extend({
5479         valHooks: {
5480                 option: {
5481                         get: function( elem ) {
5482                                 var val = jQuery.find.attr( elem, "value" );
5483                                 return val != null ?
5484                                         val :
5485                                         // Support: IE10-11+
5486                                         // option.text throws exceptions (#14686, #14858)
5487                                         jQuery.trim( jQuery.text( elem ) );
5488                         }
5489                 },
5490                 select: {
5491                         get: function( elem ) {
5492                                 var value, option,
5493                                         options = elem.options,
5494                                         index = elem.selectedIndex,
5495                                         one = elem.type === "select-one" || index < 0,
5496                                         values = one ? null : [],
5497                                         max = one ? index + 1 : options.length,
5498                                         i = index < 0 ?
5499                                                 max :
5500                                                 one ? index : 0;
5501
5502                                 // Loop through all the selected options
5503                                 for ( ; i < max; i++ ) {
5504                                         option = options[ i ];
5505
5506                                         // IE6-9 doesn't update selected after form reset (#2551)
5507                                         if ( ( option.selected || i === index ) &&
5508                                                         // Don't return options that are disabled or in a disabled optgroup
5509                                                         ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
5510                                                         ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
5511
5512                                                 // Get the specific value for the option
5513                                                 value = jQuery( option ).val();
5514
5515                                                 // We don't need an array for one selects
5516                                                 if ( one ) {
5517                                                         return value;
5518                                                 }
5519
5520                                                 // Multi-Selects return an array
5521                                                 values.push( value );
5522                                         }
5523                                 }
5524
5525                                 return values;
5526                         },
5527
5528                         set: function( elem, value ) {
5529                                 var optionSet, option,
5530                                         options = elem.options,
5531                                         values = jQuery.makeArray( value ),
5532                                         i = options.length;
5533
5534                                 while ( i-- ) {
5535                                         option = options[ i ];
5536                                         if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
5537                                                 optionSet = true;
5538                                         }
5539                                 }
5540
5541                                 // force browsers to behave consistently when non-matching value is set
5542                                 if ( !optionSet ) {
5543                                         elem.selectedIndex = -1;
5544                                 }
5545                                 return values;
5546                         }
5547                 }
5548         }
5549 });
5550
5551 // Radios and checkboxes getter/setter
5552 jQuery.each([ "radio", "checkbox" ], function() {
5553         jQuery.valHooks[ this ] = {
5554                 set: function( elem, value ) {
5555                         if ( jQuery.isArray( value ) ) {
5556                                 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
5557                         }
5558                 }
5559         };
5560         if ( !support.checkOn ) {
5561                 jQuery.valHooks[ this ].get = function( elem ) {
5562                         // Support: Webkit
5563                         // "" is returned instead of "on" if a value isn't specified
5564                         return elem.getAttribute("value") === null ? "on" : elem.value;
5565                 };
5566         }
5567 });
5568
5569
5570
5571
5572 // Return jQuery for attributes-only inclusion
5573
5574
5575 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
5576         "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
5577         "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
5578
5579         // Handle event binding
5580         jQuery.fn[ name ] = function( data, fn ) {
5581                 return arguments.length > 0 ?
5582                         this.on( name, null, data, fn ) :
5583                         this.trigger( name );
5584         };
5585 });
5586
5587 jQuery.fn.extend({
5588         hover: function( fnOver, fnOut ) {
5589                 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
5590         },
5591
5592         bind: function( types, data, fn ) {
5593                 return this.on( types, null, data, fn );
5594         },
5595         unbind: function( types, fn ) {
5596                 return this.off( types, null, fn );
5597         },
5598
5599         delegate: function( selector, types, data, fn ) {
5600                 return this.on( types, selector, data, fn );
5601         },
5602         undelegate: function( selector, types, fn ) {
5603                 // ( namespace ) or ( selector, types [, fn] )
5604                 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
5605         }
5606 });
5607
5608
5609 var nonce = jQuery.now();
5610
5611 var rquery = (/\?/);
5612
5613
5614
5615 // Support: Android 2.3
5616 // Workaround failure to string-cast null input
5617 jQuery.parseJSON = function( data ) {
5618         return JSON.parse( data + "" );
5619 };
5620
5621
5622 // Cross-browser xml parsing
5623 jQuery.parseXML = function( data ) {
5624         var xml, tmp;
5625         if ( !data || typeof data !== "string" ) {
5626                 return null;
5627         }
5628
5629         // Support: IE9
5630         try {
5631                 tmp = new DOMParser();
5632                 xml = tmp.parseFromString( data, "text/xml" );
5633         } catch ( e ) {
5634                 xml = undefined;
5635         }
5636
5637         if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
5638                 jQuery.error( "Invalid XML: " + data );
5639         }
5640         return xml;
5641 };
5642
5643
5644 var
5645         // Document location
5646         ajaxLocParts,
5647         ajaxLocation,
5648
5649         rhash = /#.*$/,
5650         rts = /([?&])_=[^&]*/,
5651         rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
5652         // #7653, #8125, #8152: local protocol detection
5653         rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
5654         rnoContent = /^(?:GET|HEAD)$/,
5655         rprotocol = /^\/\//,
5656         rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
5657
5658         /* Prefilters
5659          * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
5660          * 2) These are called:
5661          *    - BEFORE asking for a transport
5662          *    - AFTER param serialization (s.data is a string if s.processData is true)
5663          * 3) key is the dataType
5664          * 4) the catchall symbol "*" can be used
5665          * 5) execution will start with transport dataType and THEN continue down to "*" if needed
5666          */
5667         prefilters = {},
5668
5669         /* Transports bindings
5670          * 1) key is the dataType
5671          * 2) the catchall symbol "*" can be used
5672          * 3) selection will start with transport dataType and THEN go to "*" if needed
5673          */
5674         transports = {},
5675
5676         // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
5677         allTypes = "*/".concat("*");
5678
5679 // #8138, IE may throw an exception when accessing
5680 // a field from window.location if document.domain has been set
5681 try {
5682         ajaxLocation = location.href;
5683 } catch( e ) {
5684         // Use the href attribute of an A element
5685         // since IE will modify it given document.location
5686         ajaxLocation = document.createElement( "a" );
5687         ajaxLocation.href = "";
5688         ajaxLocation = ajaxLocation.href;
5689 }
5690
5691 // Segment location into parts
5692 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
5693
5694 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
5695 function addToPrefiltersOrTransports( structure ) {
5696
5697         // dataTypeExpression is optional and defaults to "*"
5698         return function( dataTypeExpression, func ) {
5699
5700                 if ( typeof dataTypeExpression !== "string" ) {
5701                         func = dataTypeExpression;
5702                         dataTypeExpression = "*";
5703                 }
5704
5705                 var dataType,
5706                         i = 0,
5707                         dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
5708
5709                 if ( jQuery.isFunction( func ) ) {
5710                         // For each dataType in the dataTypeExpression
5711                         while ( (dataType = dataTypes[i++]) ) {
5712                                 // Prepend if requested
5713                                 if ( dataType[0] === "+" ) {
5714                                         dataType = dataType.slice( 1 ) || "*";
5715                                         (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
5716
5717                                 // Otherwise append
5718                                 } else {
5719                                         (structure[ dataType ] = structure[ dataType ] || []).push( func );
5720                                 }
5721                         }
5722                 }
5723         };
5724 }
5725
5726 // Base inspection function for prefilters and transports
5727 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
5728
5729         var inspected = {},
5730                 seekingTransport = ( structure === transports );
5731
5732         function inspect( dataType ) {
5733                 var selected;
5734                 inspected[ dataType ] = true;
5735                 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
5736                         var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
5737                         if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
5738                                 options.dataTypes.unshift( dataTypeOrTransport );
5739                                 inspect( dataTypeOrTransport );
5740                                 return false;
5741                         } else if ( seekingTransport ) {
5742                                 return !( selected = dataTypeOrTransport );
5743                         }
5744                 });
5745                 return selected;
5746         }
5747
5748         return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
5749 }
5750
5751 // A special extend for ajax options
5752 // that takes "flat" options (not to be deep extended)
5753 // Fixes #9887
5754 function ajaxExtend( target, src ) {
5755         var key, deep,
5756                 flatOptions = jQuery.ajaxSettings.flatOptions || {};
5757
5758         for ( key in src ) {
5759                 if ( src[ key ] !== undefined ) {
5760                         ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
5761                 }
5762         }
5763         if ( deep ) {
5764                 jQuery.extend( true, target, deep );
5765         }
5766
5767         return target;
5768 }
5769
5770 /* Handles responses to an ajax request:
5771  * - finds the right dataType (mediates between content-type and expected dataType)
5772  * - returns the corresponding response
5773  */
5774 function ajaxHandleResponses( s, jqXHR, responses ) {
5775
5776         var ct, type, finalDataType, firstDataType,
5777                 contents = s.contents,
5778                 dataTypes = s.dataTypes;
5779
5780         // Remove auto dataType and get content-type in the process
5781         while ( dataTypes[ 0 ] === "*" ) {
5782                 dataTypes.shift();
5783                 if ( ct === undefined ) {
5784                         ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
5785                 }
5786         }
5787
5788         // Check if we're dealing with a known content-type
5789         if ( ct ) {
5790                 for ( type in contents ) {
5791                         if ( contents[ type ] && contents[ type ].test( ct ) ) {
5792                                 dataTypes.unshift( type );
5793                                 break;
5794                         }
5795                 }
5796         }
5797
5798         // Check to see if we have a response for the expected dataType
5799         if ( dataTypes[ 0 ] in responses ) {
5800                 finalDataType = dataTypes[ 0 ];
5801         } else {
5802                 // Try convertible dataTypes
5803                 for ( type in responses ) {
5804                         if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
5805                                 finalDataType = type;
5806                                 break;
5807                         }
5808                         if ( !firstDataType ) {
5809                                 firstDataType = type;
5810                         }
5811                 }
5812                 // Or just use first one
5813                 finalDataType = finalDataType || firstDataType;
5814         }
5815
5816         // If we found a dataType
5817         // We add the dataType to the list if needed
5818         // and return the corresponding response
5819         if ( finalDataType ) {
5820                 if ( finalDataType !== dataTypes[ 0 ] ) {
5821                         dataTypes.unshift( finalDataType );
5822                 }
5823                 return responses[ finalDataType ];
5824         }
5825 }
5826
5827 /* Chain conversions given the request and the original response
5828  * Also sets the responseXXX fields on the jqXHR instance
5829  */
5830 function ajaxConvert( s, response, jqXHR, isSuccess ) {
5831         var conv2, current, conv, tmp, prev,
5832                 converters = {},
5833                 // Work with a copy of dataTypes in case we need to modify it for conversion
5834                 dataTypes = s.dataTypes.slice();
5835
5836         // Create converters map with lowercased keys
5837         if ( dataTypes[ 1 ] ) {
5838                 for ( conv in s.converters ) {
5839                         converters[ conv.toLowerCase() ] = s.converters[ conv ];
5840                 }
5841         }
5842
5843         current = dataTypes.shift();
5844
5845         // Convert to each sequential dataType
5846         while ( current ) {
5847
5848                 if ( s.responseFields[ current ] ) {
5849                         jqXHR[ s.responseFields[ current ] ] = response;
5850                 }
5851
5852                 // Apply the dataFilter if provided
5853                 if ( !prev && isSuccess && s.dataFilter ) {
5854                         response = s.dataFilter( response, s.dataType );
5855                 }
5856
5857                 prev = current;
5858                 current = dataTypes.shift();
5859
5860                 if ( current ) {
5861
5862                 // There's only work to do if current dataType is non-auto
5863                         if ( current === "*" ) {
5864
5865                                 current = prev;
5866
5867                         // Convert response if prev dataType is non-auto and differs from current
5868                         } else if ( prev !== "*" && prev !== current ) {
5869
5870                                 // Seek a direct converter
5871                                 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
5872
5873                                 // If none found, seek a pair
5874                                 if ( !conv ) {
5875                                         for ( conv2 in converters ) {
5876
5877                                                 // If conv2 outputs current
5878                                                 tmp = conv2.split( " " );
5879                                                 if ( tmp[ 1 ] === current ) {
5880
5881                                                         // If prev can be converted to accepted input
5882                                                         conv = converters[ prev + " " + tmp[ 0 ] ] ||
5883                                                                 converters[ "* " + tmp[ 0 ] ];
5884                                                         if ( conv ) {
5885                                                                 // Condense equivalence converters
5886                                                                 if ( conv === true ) {
5887                                                                         conv = converters[ conv2 ];
5888
5889                                                                 // Otherwise, insert the intermediate dataType
5890                                                                 } else if ( converters[ conv2 ] !== true ) {
5891                                                                         current = tmp[ 0 ];
5892                                                                         dataTypes.unshift( tmp[ 1 ] );
5893                                                                 }
5894                                                                 break;
5895                                                         }
5896                                                 }
5897                                         }
5898                                 }
5899
5900                                 // Apply converter (if not an equivalence)
5901                                 if ( conv !== true ) {
5902
5903                                         // Unless errors are allowed to bubble, catch and return them
5904                                         if ( conv && s[ "throws" ] ) {
5905                                                 response = conv( response );
5906                                         } else {
5907                                                 try {
5908                                                         response = conv( response );
5909                                                 } catch ( e ) {
5910                                                         return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
5911                                                 }
5912                                         }
5913                                 }
5914                         }
5915                 }
5916         }
5917
5918         return { state: "success", data: response };
5919 }
5920
5921 jQuery.extend({
5922
5923         // Counter for holding the number of active queries
5924         active: 0,
5925
5926         // Last-Modified header cache for next request
5927         lastModified: {},
5928         etag: {},
5929
5930         ajaxSettings: {
5931                 url: ajaxLocation,
5932                 type: "GET",
5933                 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
5934                 global: true,
5935                 processData: true,
5936                 async: true,
5937                 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
5938                 /*
5939                 timeout: 0,
5940                 data: null,
5941                 dataType: null,
5942                 username: null,
5943                 password: null,
5944                 cache: null,
5945                 throws: false,
5946                 traditional: false,
5947                 headers: {},
5948                 */
5949
5950                 accepts: {
5951                         "*": allTypes,
5952                         text: "text/plain",
5953                         html: "text/html",
5954                         xml: "application/xml, text/xml",
5955                         json: "application/json, text/javascript"
5956                 },
5957
5958                 contents: {
5959                         xml: /xml/,
5960                         html: /html/,
5961                         json: /json/
5962                 },
5963
5964                 responseFields: {
5965                         xml: "responseXML",
5966                         text: "responseText",
5967                         json: "responseJSON"
5968                 },
5969
5970                 // Data converters
5971                 // Keys separate source (or catchall "*") and destination types with a single space
5972                 converters: {
5973
5974                         // Convert anything to text
5975                         "* text": String,
5976
5977                         // Text to html (true = no transformation)
5978                         "text html": true,
5979
5980                         // Evaluate text as a json expression
5981                         "text json": jQuery.parseJSON,
5982
5983                         // Parse text as xml
5984                         "text xml": jQuery.parseXML
5985                 },
5986
5987                 // For options that shouldn't be deep extended:
5988                 // you can add your own custom options here if
5989                 // and when you create one that shouldn't be
5990                 // deep extended (see ajaxExtend)
5991                 flatOptions: {
5992                         url: true,
5993                         context: true
5994                 }
5995         },
5996
5997         // Creates a full fledged settings object into target
5998         // with both ajaxSettings and settings fields.
5999         // If target is omitted, writes into ajaxSettings.
6000         ajaxSetup: function( target, settings ) {
6001                 return settings ?
6002
6003                         // Building a settings object
6004                         ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
6005
6006                         // Extending ajaxSettings
6007                         ajaxExtend( jQuery.ajaxSettings, target );
6008         },
6009
6010         ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
6011         ajaxTransport: addToPrefiltersOrTransports( transports ),
6012
6013         // Main method
6014         ajax: function( url, options ) {
6015
6016                 // If url is an object, simulate pre-1.5 signature
6017                 if ( typeof url === "object" ) {
6018                         options = url;
6019                         url = undefined;
6020                 }
6021
6022                 // Force options to be an object
6023                 options = options || {};
6024
6025                 var transport,
6026                         // URL without anti-cache param
6027                         cacheURL,
6028                         // Response headers
6029                         responseHeadersString,
6030                         responseHeaders,
6031                         // timeout handle
6032                         timeoutTimer,
6033                         // Cross-domain detection vars
6034                         parts,
6035                         // To know if global events are to be dispatched
6036                         fireGlobals,
6037                         // Loop variable
6038                         i,
6039                         // Create the final options object
6040                         s = jQuery.ajaxSetup( {}, options ),
6041                         // Callbacks context
6042                         callbackContext = s.context || s,
6043                         // Context for global events is callbackContext if it is a DOM node or jQuery collection
6044                         globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
6045                                 jQuery( callbackContext ) :
6046                                 jQuery.event,
6047                         // Deferreds
6048                         deferred = jQuery.Deferred(),
6049                         completeDeferred = jQuery.Callbacks("once memory"),
6050                         // Status-dependent callbacks
6051                         statusCode = s.statusCode || {},
6052                         // Headers (they are sent all at once)
6053                         requestHeaders = {},
6054                         requestHeadersNames = {},
6055                         // The jqXHR state
6056                         state = 0,
6057                         // Default abort message
6058                         strAbort = "canceled",
6059                         // Fake xhr
6060                         jqXHR = {
6061                                 readyState: 0,
6062
6063                                 // Builds headers hashtable if needed
6064                                 getResponseHeader: function( key ) {
6065                                         var match;
6066                                         if ( state === 2 ) {
6067                                                 if ( !responseHeaders ) {
6068                                                         responseHeaders = {};
6069                                                         while ( (match = rheaders.exec( responseHeadersString )) ) {
6070                                                                 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
6071                                                         }
6072                                                 }
6073                                                 match = responseHeaders[ key.toLowerCase() ];
6074                                         }
6075                                         return match == null ? null : match;
6076                                 },
6077
6078                                 // Raw string
6079                                 getAllResponseHeaders: function() {
6080                                         return state === 2 ? responseHeadersString : null;
6081                                 },
6082
6083                                 // Caches the header
6084                                 setRequestHeader: function( name, value ) {
6085                                         var lname = name.toLowerCase();
6086                                         if ( !state ) {
6087                                                 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
6088                                                 requestHeaders[ name ] = value;
6089                                         }
6090                                         return this;
6091                                 },
6092
6093                                 // Overrides response content-type header
6094                                 overrideMimeType: function( type ) {
6095                                         if ( !state ) {
6096                                                 s.mimeType = type;
6097                                         }
6098                                         return this;
6099                                 },
6100
6101                                 // Status-dependent callbacks
6102                                 statusCode: function( map ) {
6103                                         var code;
6104                                         if ( map ) {
6105                                                 if ( state < 2 ) {
6106                                                         for ( code in map ) {
6107                                                                 // Lazy-add the new callback in a way that preserves old ones
6108                                                                 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
6109                                                         }
6110                                                 } else {
6111                                                         // Execute the appropriate callbacks
6112                                                         jqXHR.always( map[ jqXHR.status ] );
6113                                                 }
6114                                         }
6115                                         return this;
6116                                 },
6117
6118                                 // Cancel the request
6119                                 abort: function( statusText ) {
6120                                         var finalText = statusText || strAbort;
6121                                         if ( transport ) {
6122                                                 transport.abort( finalText );
6123                                         }
6124                                         done( 0, finalText );
6125                                         return this;
6126                                 }
6127                         };
6128
6129                 // Attach deferreds
6130                 deferred.promise( jqXHR ).complete = completeDeferred.add;
6131                 jqXHR.success = jqXHR.done;
6132                 jqXHR.error = jqXHR.fail;
6133
6134                 // Remove hash character (#7531: and string promotion)
6135                 // Add protocol if not provided (prefilters might expect it)
6136                 // Handle falsy url in the settings object (#10093: consistency with old signature)
6137                 // We also use the url parameter if available
6138                 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
6139                         .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
6140
6141                 // Alias method option to type as per ticket #12004
6142                 s.type = options.method || options.type || s.method || s.type;
6143
6144                 // Extract dataTypes list
6145                 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
6146
6147                 // A cross-domain request is in order when we have a protocol:host:port mismatch
6148                 if ( s.crossDomain == null ) {
6149                         parts = rurl.exec( s.url.toLowerCase() );
6150                         s.crossDomain = !!( parts &&
6151                                 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
6152                                         ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
6153                                                 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
6154                         );
6155                 }
6156
6157                 // Convert data if not already a string
6158                 if ( s.data && s.processData && typeof s.data !== "string" ) {
6159                         s.data = jQuery.param( s.data, s.traditional );
6160                 }
6161
6162                 // Apply prefilters
6163                 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
6164
6165                 // If request was aborted inside a prefilter, stop there
6166                 if ( state === 2 ) {
6167                         return jqXHR;
6168                 }
6169
6170                 // We can fire global events as of now if asked to
6171                 fireGlobals = s.global;
6172
6173                 // Watch for a new set of requests
6174                 if ( fireGlobals && jQuery.active++ === 0 ) {
6175                         jQuery.event.trigger("ajaxStart");
6176                 }
6177
6178                 // Uppercase the type
6179                 s.type = s.type.toUpperCase();
6180
6181                 // Determine if request has content
6182                 s.hasContent = !rnoContent.test( s.type );
6183
6184                 // Save the URL in case we're toying with the If-Modified-Since
6185                 // and/or If-None-Match header later on
6186                 cacheURL = s.url;
6187
6188                 // More options handling for requests with no content
6189                 if ( !s.hasContent ) {
6190
6191                         // If data is available, append data to url
6192                         if ( s.data ) {
6193                                 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
6194                                 // #9682: remove data so that it's not used in an eventual retry
6195                                 delete s.data;
6196                         }
6197
6198                         // Add anti-cache in url if needed
6199                         if ( s.cache === false ) {
6200                                 s.url = rts.test( cacheURL ) ?
6201
6202                                         // If there is already a '_' parameter, set its value
6203                                         cacheURL.replace( rts, "$1_=" + nonce++ ) :
6204
6205                                         // Otherwise add one to the end
6206                                         cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
6207                         }
6208                 }
6209
6210                 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6211                 if ( s.ifModified ) {
6212                         if ( jQuery.lastModified[ cacheURL ] ) {
6213                                 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
6214                         }
6215                         if ( jQuery.etag[ cacheURL ] ) {
6216                                 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
6217                         }
6218                 }
6219
6220                 // Set the correct header, if data is being sent
6221                 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6222                         jqXHR.setRequestHeader( "Content-Type", s.contentType );
6223                 }
6224
6225                 // Set the Accepts header for the server, depending on the dataType
6226                 jqXHR.setRequestHeader(
6227                         "Accept",
6228                         s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6229                                 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
6230                                 s.accepts[ "*" ]
6231                 );
6232
6233                 // Check for headers option
6234                 for ( i in s.headers ) {
6235                         jqXHR.setRequestHeader( i, s.headers[ i ] );
6236                 }
6237
6238                 // Allow custom headers/mimetypes and early abort
6239                 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
6240                         // Abort if not done already and return
6241                         return jqXHR.abort();
6242                 }
6243
6244                 // aborting is no longer a cancellation
6245                 strAbort = "abort";
6246
6247                 // Install callbacks on deferreds
6248                 for ( i in { success: 1, error: 1, complete: 1 } ) {
6249                         jqXHR[ i ]( s[ i ] );
6250                 }
6251
6252                 // Get transport
6253                 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
6254
6255                 // If no transport, we auto-abort
6256                 if ( !transport ) {
6257                         done( -1, "No Transport" );
6258                 } else {
6259                         jqXHR.readyState = 1;
6260
6261                         // Send global event
6262                         if ( fireGlobals ) {
6263                                 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
6264                         }
6265                         // Timeout
6266                         if ( s.async && s.timeout > 0 ) {
6267                                 timeoutTimer = setTimeout(function() {
6268                                         jqXHR.abort("timeout");
6269                                 }, s.timeout );
6270                         }
6271
6272                         try {
6273                                 state = 1;
6274                                 transport.send( requestHeaders, done );
6275                         } catch ( e ) {
6276                                 // Propagate exception as error if not done
6277                                 if ( state < 2 ) {
6278                                         done( -1, e );
6279                                 // Simply rethrow otherwise
6280                                 } else {
6281                                         throw e;
6282                                 }
6283                         }
6284                 }
6285
6286                 // Callback for when everything is done
6287                 function done( status, nativeStatusText, responses, headers ) {
6288                         var isSuccess, success, error, response, modified,
6289                                 statusText = nativeStatusText;
6290
6291                         // Called once
6292                         if ( state === 2 ) {
6293                                 return;
6294                         }
6295
6296                         // State is "done" now
6297                         state = 2;
6298
6299                         // Clear timeout if it exists
6300                         if ( timeoutTimer ) {
6301                                 clearTimeout( timeoutTimer );
6302                         }
6303
6304                         // Dereference transport for early garbage collection
6305                         // (no matter how long the jqXHR object will be used)
6306                         transport = undefined;
6307
6308                         // Cache response headers
6309                         responseHeadersString = headers || "";
6310
6311                         // Set readyState
6312                         jqXHR.readyState = status > 0 ? 4 : 0;
6313
6314                         // Determine if successful
6315                         isSuccess = status >= 200 && status < 300 || status === 304;
6316
6317                         // Get response data
6318                         if ( responses ) {
6319                                 response = ajaxHandleResponses( s, jqXHR, responses );
6320                         }
6321
6322                         // Convert no matter what (that way responseXXX fields are always set)
6323                         response = ajaxConvert( s, response, jqXHR, isSuccess );
6324
6325                         // If successful, handle type chaining
6326                         if ( isSuccess ) {
6327
6328                                 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6329                                 if ( s.ifModified ) {
6330                                         modified = jqXHR.getResponseHeader("Last-Modified");
6331                                         if ( modified ) {
6332                                                 jQuery.lastModified[ cacheURL ] = modified;
6333                                         }
6334                                         modified = jqXHR.getResponseHeader("etag");
6335                                         if ( modified ) {
6336                                                 jQuery.etag[ cacheURL ] = modified;
6337                                         }
6338                                 }
6339
6340                                 // if no content
6341                                 if ( status === 204 || s.type === "HEAD" ) {
6342                                         statusText = "nocontent";
6343
6344                                 // if not modified
6345                                 } else if ( status === 304 ) {
6346                                         statusText = "notmodified";
6347
6348                                 // If we have data, let's convert it
6349                                 } else {
6350                                         statusText = response.state;
6351                                         success = response.data;
6352                                         error = response.error;
6353                                         isSuccess = !error;
6354                                 }
6355                         } else {
6356                                 // We extract error from statusText
6357                                 // then normalize statusText and status for non-aborts
6358                                 error = statusText;
6359                                 if ( status || !statusText ) {
6360                                         statusText = "error";
6361                                         if ( status < 0 ) {
6362                                                 status = 0;
6363                                         }
6364                                 }
6365                         }
6366
6367                         // Set data for the fake xhr object
6368                         jqXHR.status = status;
6369                         jqXHR.statusText = ( nativeStatusText || statusText ) + "";
6370
6371                         // Success/Error
6372                         if ( isSuccess ) {
6373                                 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
6374                         } else {
6375                                 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
6376                         }
6377
6378                         // Status-dependent callbacks
6379                         jqXHR.statusCode( statusCode );
6380                         statusCode = undefined;
6381
6382                         if ( fireGlobals ) {
6383                                 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
6384                                         [ jqXHR, s, isSuccess ? success : error ] );
6385                         }
6386
6387                         // Complete
6388                         completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
6389
6390                         if ( fireGlobals ) {
6391                                 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
6392                                 // Handle the global AJAX counter
6393                                 if ( !( --jQuery.active ) ) {
6394                                         jQuery.event.trigger("ajaxStop");
6395                                 }
6396                         }
6397                 }
6398
6399                 return jqXHR;
6400         },
6401
6402         getJSON: function( url, data, callback ) {
6403                 return jQuery.get( url, data, callback, "json" );
6404         },
6405
6406         getScript: function( url, callback ) {
6407                 return jQuery.get( url, undefined, callback, "script" );
6408         }
6409 });
6410
6411 jQuery.each( [ "get", "post" ], function( i, method ) {
6412         jQuery[ method ] = function( url, data, callback, type ) {
6413                 // shift arguments if data argument was omitted
6414                 if ( jQuery.isFunction( data ) ) {
6415                         type = type || callback;
6416                         callback = data;
6417                         data = undefined;
6418                 }
6419
6420                 return jQuery.ajax({
6421                         url: url,
6422                         type: method,
6423                         dataType: type,
6424                         data: data,
6425                         success: callback
6426                 });
6427         };
6428 });
6429
6430 // Attach a bunch of functions for handling common AJAX events
6431 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
6432         jQuery.fn[ type ] = function( fn ) {
6433                 return this.on( type, fn );
6434         };
6435 });
6436
6437
6438 jQuery._evalUrl = function( url ) {
6439         return jQuery.ajax({
6440                 url: url,
6441                 type: "GET",
6442                 dataType: "script",
6443                 async: false,
6444                 global: false,
6445                 "throws": true
6446         });
6447 };
6448
6449
6450 jQuery.fn.extend({
6451         wrapAll: function( html ) {
6452                 var wrap;
6453
6454                 if ( jQuery.isFunction( html ) ) {
6455                         return this.each(function( i ) {
6456                                 jQuery( this ).wrapAll( html.call(this, i) );
6457                         });
6458                 }
6459
6460                 if ( this[ 0 ] ) {
6461
6462                         // The elements to wrap the target around
6463                         wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
6464
6465                         if ( this[ 0 ].parentNode ) {
6466                                 wrap.insertBefore( this[ 0 ] );
6467                         }
6468
6469                         wrap.map(function() {
6470                                 var elem = this;
6471
6472                                 while ( elem.firstElementChild ) {
6473                                         elem = elem.firstElementChild;
6474                                 }
6475
6476                                 return elem;
6477                         }).append( this );
6478                 }
6479
6480                 return this;
6481         },
6482
6483         wrapInner: function( html ) {
6484                 if ( jQuery.isFunction( html ) ) {
6485                         return this.each(function( i ) {
6486                                 jQuery( this ).wrapInner( html.call(this, i) );
6487                         });
6488                 }
6489
6490                 return this.each(function() {
6491                         var self = jQuery( this ),
6492                                 contents = self.contents();
6493
6494                         if ( contents.length ) {
6495                                 contents.wrapAll( html );
6496
6497                         } else {
6498                                 self.append( html );
6499                         }
6500                 });
6501         },
6502
6503         wrap: function( html ) {
6504                 var isFunction = jQuery.isFunction( html );
6505
6506                 return this.each(function( i ) {
6507                         jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
6508                 });
6509         },
6510
6511         unwrap: function() {
6512                 return this.parent().each(function() {
6513                         if ( !jQuery.nodeName( this, "body" ) ) {
6514                                 jQuery( this ).replaceWith( this.childNodes );
6515                         }
6516                 }).end();
6517         }
6518 });
6519
6520
6521 var r20 = /%20/g,
6522         rbracket = /\[\]$/,
6523         rCRLF = /\r?\n/g,
6524         rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6525         rsubmittable = /^(?:input|select|textarea|keygen)/i;
6526
6527 function buildParams( prefix, obj, traditional, add ) {
6528         var name;
6529
6530         if ( jQuery.isArray( obj ) ) {
6531                 // Serialize array item.
6532                 jQuery.each( obj, function( i, v ) {
6533                         if ( traditional || rbracket.test( prefix ) ) {
6534                                 // Treat each array item as a scalar.
6535                                 add( prefix, v );
6536
6537                         } else {
6538                                 // Item is non-scalar (array or object), encode its numeric index.
6539                                 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
6540                         }
6541                 });
6542
6543         } else if ( !traditional && jQuery.type( obj ) === "object" ) {
6544                 // Serialize object item.
6545                 for ( name in obj ) {
6546                         buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6547                 }
6548
6549         } else {
6550                 // Serialize scalar item.
6551                 add( prefix, obj );
6552         }
6553 }
6554
6555 // Serialize an array of form elements or a set of
6556 // key/values into a query string
6557 jQuery.param = function( a, traditional ) {
6558         var prefix,
6559                 s = [],
6560                 add = function( key, value ) {
6561                         // If value is a function, invoke it and return its value
6562                         value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
6563                         s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
6564                 };
6565
6566         // Set traditional to true for jQuery <= 1.3.2 behavior.
6567         if ( traditional === undefined ) {
6568                 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
6569         }
6570
6571         // If an array was passed in, assume that it is an array of form elements.
6572         if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
6573                 // Serialize the form elements
6574                 jQuery.each( a, function() {
6575                         add( this.name, this.value );
6576                 });
6577
6578         } else {
6579                 // If traditional, encode the "old" way (the way 1.3.2 or older
6580                 // did it), otherwise encode params recursively.
6581                 for ( prefix in a ) {
6582                         buildParams( prefix, a[ prefix ], traditional, add );
6583                 }
6584         }
6585
6586         // Return the resulting serialization
6587         return s.join( "&" ).replace( r20, "+" );
6588 };
6589
6590 jQuery.fn.extend({
6591         serialize: function() {
6592                 return jQuery.param( this.serializeArray() );
6593         },
6594         serializeArray: function() {
6595                 return this.map(function() {
6596                         // Can add propHook for "elements" to filter or add form elements
6597                         var elements = jQuery.prop( this, "elements" );
6598                         return elements ? jQuery.makeArray( elements ) : this;
6599                 })
6600                 .filter(function() {
6601                         var type = this.type;
6602
6603                         // Use .is( ":disabled" ) so that fieldset[disabled] works
6604                         return this.name && !jQuery( this ).is( ":disabled" ) &&
6605                                 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
6606                                 ( this.checked || !rcheckableType.test( type ) );
6607                 })
6608                 .map(function( i, elem ) {
6609                         var val = jQuery( this ).val();
6610
6611                         return val == null ?
6612                                 null :
6613                                 jQuery.isArray( val ) ?
6614                                         jQuery.map( val, function( val ) {
6615                                                 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6616                                         }) :
6617                                         { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6618                 }).get();
6619         }
6620 });
6621
6622
6623 jQuery.ajaxSettings.xhr = function() {
6624         try {
6625                 return new XMLHttpRequest();
6626         } catch( e ) {}
6627 };
6628
6629 var xhrId = 0,
6630         xhrCallbacks = {},
6631         xhrSuccessStatus = {
6632                 // file protocol always yields status code 0, assume 200
6633                 0: 200,
6634                 // Support: IE9
6635                 // #1450: sometimes IE returns 1223 when it should be 204
6636                 1223: 204
6637         },
6638         xhrSupported = jQuery.ajaxSettings.xhr();
6639
6640 // Support: IE9
6641 // Open requests must be manually aborted on unload (#5280)
6642 if ( window.ActiveXObject ) {
6643         jQuery( window ).on( "unload", function() {
6644                 for ( var key in xhrCallbacks ) {
6645                         xhrCallbacks[ key ]();
6646                 }
6647         });
6648 }
6649
6650 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
6651 support.ajax = xhrSupported = !!xhrSupported;
6652
6653 jQuery.ajaxTransport(function( options ) {
6654         var callback;
6655
6656         // Cross domain only allowed if supported through XMLHttpRequest
6657         if ( support.cors || xhrSupported && !options.crossDomain ) {
6658                 return {
6659                         send: function( headers, complete ) {
6660                                 var i,
6661                                         xhr = options.xhr(),
6662                                         id = ++xhrId;
6663
6664                                 xhr.open( options.type, options.url, options.async, options.username, options.password );
6665
6666                                 // Apply custom fields if provided
6667                                 if ( options.xhrFields ) {
6668                                         for ( i in options.xhrFields ) {
6669                                                 xhr[ i ] = options.xhrFields[ i ];
6670                                         }
6671                                 }
6672
6673                                 // Override mime type if needed
6674                                 if ( options.mimeType && xhr.overrideMimeType ) {
6675                                         xhr.overrideMimeType( options.mimeType );
6676                                 }
6677
6678                                 // X-Requested-With header
6679                                 // For cross-domain requests, seeing as conditions for a preflight are
6680                                 // akin to a jigsaw puzzle, we simply never set it to be sure.
6681                                 // (it can always be set on a per-request basis or even using ajaxSetup)
6682                                 // For same-domain requests, won't change header if already provided.
6683                                 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
6684                                         headers["X-Requested-With"] = "XMLHttpRequest";
6685                                 }
6686
6687                                 // Set headers
6688                                 for ( i in headers ) {
6689                                         xhr.setRequestHeader( i, headers[ i ] );
6690                                 }
6691
6692                                 // Callback
6693                                 callback = function( type ) {
6694                                         return function() {
6695                                                 if ( callback ) {
6696                                                         delete xhrCallbacks[ id ];
6697                                                         callback = xhr.onload = xhr.onerror = null;
6698
6699                                                         if ( type === "abort" ) {
6700                                                                 xhr.abort();
6701                                                         } else if ( type === "error" ) {
6702                                                                 complete(
6703                                                                         // file: protocol always yields status 0; see #8605, #14207
6704                                                                         xhr.status,
6705                                                                         xhr.statusText
6706                                                                 );
6707                                                         } else {
6708                                                                 complete(
6709                                                                         xhrSuccessStatus[ xhr.status ] || xhr.status,
6710                                                                         xhr.statusText,
6711                                                                         // Support: IE9
6712                                                                         // Accessing binary-data responseText throws an exception
6713                                                                         // (#11426)
6714                                                                         typeof xhr.responseText === "string" ? {
6715                                                                                 text: xhr.responseText
6716                                                                         } : undefined,
6717                                                                         xhr.getAllResponseHeaders()
6718                                                                 );
6719                                                         }
6720                                                 }
6721                                         };
6722                                 };
6723
6724                                 // Listen to events
6725                                 xhr.onload = callback();
6726                                 xhr.onerror = callback("error");
6727
6728                                 // Create the abort callback
6729                                 callback = xhrCallbacks[ id ] = callback("abort");
6730
6731                                 try {
6732                                         // Do send the request (this may raise an exception)
6733                                         xhr.send( options.hasContent && options.data || null );
6734                                 } catch ( e ) {
6735                                         // #14683: Only rethrow if this hasn't been notified as an error yet
6736                                         if ( callback ) {
6737                                                 throw e;
6738                                         }
6739                                 }
6740                         },
6741
6742                         abort: function() {
6743                                 if ( callback ) {
6744                                         callback();
6745                                 }
6746                         }
6747                 };
6748         }
6749 });
6750
6751
6752
6753
6754 // Install script dataType
6755 jQuery.ajaxSetup({
6756         accepts: {
6757                 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6758         },
6759         contents: {
6760                 script: /(?:java|ecma)script/
6761         },
6762         converters: {
6763                 "text script": function( text ) {
6764                         jQuery.globalEval( text );
6765                         return text;
6766                 }
6767         }
6768 });
6769
6770 // Handle cache's special case and crossDomain
6771 jQuery.ajaxPrefilter( "script", function( s ) {
6772         if ( s.cache === undefined ) {
6773                 s.cache = false;
6774         }
6775         if ( s.crossDomain ) {
6776                 s.type = "GET";
6777         }
6778 });
6779
6780 // Bind script tag hack transport
6781 jQuery.ajaxTransport( "script", function( s ) {
6782         // This transport only deals with cross domain requests
6783         if ( s.crossDomain ) {
6784                 var script, callback;
6785                 return {
6786                         send: function( _, complete ) {
6787                                 script = jQuery("<script>").prop({
6788                                         async: true,
6789                                         charset: s.scriptCharset,
6790                                         src: s.url
6791                                 }).on(
6792                                         "load error",
6793                                         callback = function( evt ) {
6794                                                 script.remove();
6795                                                 callback = null;
6796                                                 if ( evt ) {
6797                                                         complete( evt.type === "error" ? 404 : 200, evt.type );
6798                                                 }
6799                                         }
6800                                 );
6801                                 document.head.appendChild( script[ 0 ] );
6802                         },
6803                         abort: function() {
6804                                 if ( callback ) {
6805                                         callback();
6806                                 }
6807                         }
6808                 };
6809         }
6810 });
6811
6812
6813
6814
6815 var oldCallbacks = [],
6816         rjsonp = /(=)\?(?=&|$)|\?\?/;
6817
6818 // Default jsonp settings
6819 jQuery.ajaxSetup({
6820         jsonp: "callback",
6821         jsonpCallback: function() {
6822                 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
6823                 this[ callback ] = true;
6824                 return callback;
6825         }
6826 });
6827
6828 // Detect, normalize options and install callbacks for jsonp requests
6829 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
6830
6831         var callbackName, overwritten, responseContainer,
6832                 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
6833                         "url" :
6834                         typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
6835                 );
6836
6837         // Handle iff the expected data type is "jsonp" or we have a parameter to set
6838         if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
6839
6840                 // Get callback name, remembering preexisting value associated with it
6841                 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
6842                         s.jsonpCallback() :
6843                         s.jsonpCallback;
6844
6845                 // Insert callback into url or form data
6846                 if ( jsonProp ) {
6847                         s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
6848                 } else if ( s.jsonp !== false ) {
6849                         s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
6850                 }
6851
6852                 // Use data converter to retrieve json after script execution
6853                 s.converters["script json"] = function() {
6854                         if ( !responseContainer ) {
6855                                 jQuery.error( callbackName + " was not called" );
6856                         }
6857                         return responseContainer[ 0 ];
6858                 };
6859
6860                 // force json dataType
6861                 s.dataTypes[ 0 ] = "json";
6862
6863                 // Install callback
6864                 overwritten = window[ callbackName ];
6865                 window[ callbackName ] = function() {
6866                         responseContainer = arguments;
6867                 };
6868
6869                 // Clean-up function (fires after converters)
6870                 jqXHR.always(function() {
6871                         // Restore preexisting value
6872                         window[ callbackName ] = overwritten;
6873
6874                         // Save back as free
6875                         if ( s[ callbackName ] ) {
6876                                 // make sure that re-using the options doesn't screw things around
6877                                 s.jsonpCallback = originalSettings.jsonpCallback;
6878
6879                                 // save the callback name for future use
6880                                 oldCallbacks.push( callbackName );
6881                         }
6882
6883                         // Call if it was a function and we have a response
6884                         if ( responseContainer && jQuery.isFunction( overwritten ) ) {
6885                                 overwritten( responseContainer[ 0 ] );
6886                         }
6887
6888                         responseContainer = overwritten = undefined;
6889                 });
6890
6891                 // Delegate to script
6892                 return "script";
6893         }
6894 });
6895
6896
6897
6898
6899 // data: string of html
6900 // context (optional): If specified, the fragment will be created in this context, defaults to document
6901 // keepScripts (optional): If true, will include scripts passed in the html string
6902 jQuery.parseHTML = function( data, context, keepScripts ) {
6903         if ( !data || typeof data !== "string" ) {
6904                 return null;
6905         }
6906         if ( typeof context === "boolean" ) {
6907                 keepScripts = context;
6908                 context = false;
6909         }
6910         context = context || document;
6911
6912         var parsed = rsingleTag.exec( data ),
6913                 scripts = !keepScripts && [];
6914
6915         // Single tag
6916         if ( parsed ) {
6917                 return [ context.createElement( parsed[1] ) ];
6918         }
6919
6920         parsed = jQuery.buildFragment( [ data ], context, scripts );
6921
6922         if ( scripts && scripts.length ) {
6923                 jQuery( scripts ).remove();
6924         }
6925
6926         return jQuery.merge( [], parsed.childNodes );
6927 };
6928
6929
6930 // Keep a copy of the old load method
6931 var _load = jQuery.fn.load;
6932
6933 /**
6934  * Load a url into a page
6935  */
6936 jQuery.fn.load = function( url, params, callback ) {
6937         if ( typeof url !== "string" && _load ) {
6938                 return _load.apply( this, arguments );
6939         }
6940
6941         var selector, type, response,
6942                 self = this,
6943                 off = url.indexOf(" ");
6944
6945         if ( off >= 0 ) {
6946                 selector = jQuery.trim( url.slice( off ) );
6947                 url = url.slice( 0, off );
6948         }
6949
6950         // If it's a function
6951         if ( jQuery.isFunction( params ) ) {
6952
6953                 // We assume that it's the callback
6954                 callback = params;
6955                 params = undefined;
6956
6957         // Otherwise, build a param string
6958         } else if ( params && typeof params === "object" ) {
6959                 type = "POST";
6960         }
6961
6962         // If we have elements to modify, make the request
6963         if ( self.length > 0 ) {
6964                 jQuery.ajax({
6965                         url: url,
6966
6967                         // if "type" variable is undefined, then "GET" method will be used
6968                         type: type,
6969                         dataType: "html",
6970                         data: params
6971                 }).done(function( responseText ) {
6972
6973                         // Save response for use in complete callback
6974                         response = arguments;
6975
6976                         self.html( selector ?
6977
6978                                 // If a selector was specified, locate the right elements in a dummy div
6979                                 // Exclude scripts to avoid IE 'Permission Denied' errors
6980                                 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
6981
6982                                 // Otherwise use the full result
6983                                 responseText );
6984
6985                 }).complete( callback && function( jqXHR, status ) {
6986                         self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
6987                 });
6988         }
6989
6990         return this;
6991 };
6992
6993
6994
6995
6996 var docElem = window.document.documentElement;
6997
6998 /**
6999  * Gets a window from an element
7000  */
7001 function getWindow( elem ) {
7002         return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
7003 }
7004
7005 jQuery.offset = {
7006         setOffset: function( elem, options, i ) {
7007                 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
7008                         position = jQuery.css( elem, "position" ),
7009                         curElem = jQuery( elem ),
7010                         props = {};
7011
7012                 // Set position first, in-case top/left are set even on static elem
7013                 if ( position === "static" ) {
7014                         elem.style.position = "relative";
7015                 }
7016
7017                 curOffset = curElem.offset();
7018                 curCSSTop = jQuery.css( elem, "top" );
7019                 curCSSLeft = jQuery.css( elem, "left" );
7020                 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
7021                         ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
7022
7023                 // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
7024                 if ( calculatePosition ) {
7025                         curPosition = curElem.position();
7026                         curTop = curPosition.top;
7027                         curLeft = curPosition.left;
7028
7029                 } else {
7030                         curTop = parseFloat( curCSSTop ) || 0;
7031                         curLeft = parseFloat( curCSSLeft ) || 0;
7032                 }
7033
7034                 if ( jQuery.isFunction( options ) ) {
7035                         options = options.call( elem, i, curOffset );
7036                 }
7037
7038                 if ( options.top != null ) {
7039                         props.top = ( options.top - curOffset.top ) + curTop;
7040                 }
7041                 if ( options.left != null ) {
7042                         props.left = ( options.left - curOffset.left ) + curLeft;
7043                 }
7044
7045                 if ( "using" in options ) {
7046                         options.using.call( elem, props );
7047
7048                 } else {
7049                         curElem.css( props );
7050                 }
7051         }
7052 };
7053
7054 jQuery.fn.extend({
7055         offset: function( options ) {
7056                 if ( arguments.length ) {
7057                         return options === undefined ?
7058                                 this :
7059                                 this.each(function( i ) {
7060                                         jQuery.offset.setOffset( this, options, i );
7061                                 });
7062                 }
7063
7064                 var docElem, win,
7065                         elem = this[ 0 ],
7066                         box = { top: 0, left: 0 },
7067                         doc = elem && elem.ownerDocument;
7068
7069                 if ( !doc ) {
7070                         return;
7071                 }
7072
7073                 docElem = doc.documentElement;
7074
7075                 // Make sure it's not a disconnected DOM node
7076                 if ( !jQuery.contains( docElem, elem ) ) {
7077                         return box;
7078                 }
7079
7080                 // If we don't have gBCR, just use 0,0 rather than error
7081                 // BlackBerry 5, iOS 3 (original iPhone)
7082                 if ( typeof elem.getBoundingClientRect !== strundefined ) {
7083                         box = elem.getBoundingClientRect();
7084                 }
7085                 win = getWindow( doc );
7086                 return {
7087                         top: box.top + win.pageYOffset - docElem.clientTop,
7088                         left: box.left + win.pageXOffset - docElem.clientLeft
7089                 };
7090         },
7091
7092         position: function() {
7093                 if ( !this[ 0 ] ) {
7094                         return;
7095                 }
7096
7097                 var offsetParent, offset,
7098                         elem = this[ 0 ],
7099                         parentOffset = { top: 0, left: 0 };
7100
7101                 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
7102                 if ( jQuery.css( elem, "position" ) === "fixed" ) {
7103                         // We assume that getBoundingClientRect is available when computed position is fixed
7104                         offset = elem.getBoundingClientRect();
7105
7106                 } else {
7107                         // Get *real* offsetParent
7108                         offsetParent = this.offsetParent();
7109
7110                         // Get correct offsets
7111                         offset = this.offset();
7112                         if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
7113                                 parentOffset = offsetParent.offset();
7114                         }
7115
7116                         // Add offsetParent borders
7117                         parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
7118                         parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
7119                 }
7120
7121                 // Subtract parent offsets and element margins
7122                 return {
7123                         top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
7124                         left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
7125                 };
7126         },
7127
7128         offsetParent: function() {
7129                 return this.map(function() {
7130                         var offsetParent = this.offsetParent || docElem;
7131
7132                         while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
7133                                 offsetParent = offsetParent.offsetParent;
7134                         }
7135
7136                         return offsetParent || docElem;
7137                 });
7138         }
7139 });
7140
7141 // Create scrollLeft and scrollTop methods
7142 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
7143         var top = "pageYOffset" === prop;
7144
7145         jQuery.fn[ method ] = function( val ) {
7146                 return access( this, function( elem, method, val ) {
7147                         var win = getWindow( elem );
7148
7149                         if ( val === undefined ) {
7150                                 return win ? win[ prop ] : elem[ method ];
7151                         }
7152
7153                         if ( win ) {
7154                                 win.scrollTo(
7155                                         !top ? val : window.pageXOffset,
7156                                         top ? val : window.pageYOffset
7157                                 );
7158
7159                         } else {
7160                                 elem[ method ] = val;
7161                         }
7162                 }, method, val, arguments.length, null );
7163         };
7164 });
7165
7166 // Add the top/left cssHooks using jQuery.fn.position
7167 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
7168 // getComputedStyle returns percent when specified for top/left/bottom/right
7169 // rather than make the css module depend on the offset module, we just check for it here
7170 jQuery.each( [ "top", "left" ], function( i, prop ) {
7171         jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
7172                 function( elem, computed ) {
7173                         if ( computed ) {
7174                                 computed = curCSS( elem, prop );
7175                                 // if curCSS returns percentage, fallback to offset
7176                                 return rnumnonpx.test( computed ) ?
7177                                         jQuery( elem ).position()[ prop ] + "px" :
7178                                         computed;
7179                         }
7180                 }
7181         );
7182 });
7183
7184
7185 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
7186 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
7187         jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
7188                 // margin is only for outerHeight, outerWidth
7189                 jQuery.fn[ funcName ] = function( margin, value ) {
7190                         var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
7191                                 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
7192
7193                         return access( this, function( elem, type, value ) {
7194                                 var doc;
7195
7196                                 if ( jQuery.isWindow( elem ) ) {
7197                                         // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
7198                                         // isn't a whole lot we can do. See pull request at this URL for discussion:
7199                                         // https://github.com/jquery/jquery/pull/764
7200                                         return elem.document.documentElement[ "client" + name ];
7201                                 }
7202
7203                                 // Get document width or height
7204                                 if ( elem.nodeType === 9 ) {
7205                                         doc = elem.documentElement;
7206
7207                                         // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
7208                                         // whichever is greatest
7209                                         return Math.max(
7210                                                 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
7211                                                 elem.body[ "offset" + name ], doc[ "offset" + name ],
7212                                                 doc[ "client" + name ]
7213                                         );
7214                                 }
7215
7216                                 return value === undefined ?
7217                                         // Get width or height on the element, requesting but not forcing parseFloat
7218                                         jQuery.css( elem, type, extra ) :
7219
7220                                         // Set width or height on the element
7221                                         jQuery.style( elem, type, value, extra );
7222                         }, type, chainable ? margin : undefined, chainable, null );
7223                 };
7224         });
7225 });
7226
7227
7228 // Register as a named AMD module, since jQuery can be concatenated with other
7229 // files that may use define, but not via a proper concatenation script that
7230 // understands anonymous AMD modules. A named AMD is safest and most robust
7231 // way to register. Lowercase jquery is used because AMD module names are
7232 // derived from file names, and jQuery is normally delivered in a lowercase
7233 // file name. Do this after creating the global so that if an AMD module wants
7234 // to call noConflict to hide this version of jQuery, it will work.
7235
7236 // Note that for maximum portability, libraries that are not jQuery should
7237 // declare themselves as anonymous modules, and avoid setting a global if an
7238 // AMD loader is present. jQuery is a special case. For more information, see
7239 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
7240
7241 if ( typeof define === "function" && define.amd ) {
7242         define( "jquery", [], function() {
7243                 return jQuery;
7244         });
7245 }
7246
7247
7248
7249
7250 var
7251         // Map over jQuery in case of overwrite
7252         _jQuery = window.jQuery,
7253
7254         // Map over the $ in case of overwrite
7255         _$ = window.$;
7256
7257 jQuery.noConflict = function( deep ) {
7258         if ( window.$ === jQuery ) {
7259                 window.$ = _$;
7260         }
7261
7262         if ( deep && window.jQuery === jQuery ) {
7263                 window.jQuery = _jQuery;
7264         }
7265
7266         return jQuery;
7267 };
7268
7269 // Expose jQuery and $ identifiers, even in
7270 // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
7271 // and CommonJS for browser emulators (#13566)
7272 if ( typeof noGlobal === strundefined ) {
7273         window.jQuery = window.$ = jQuery;
7274 }
7275
7276
7277
7278
7279 return jQuery;
7280
7281 }));