JAL-1807 update
[jalviewjs.git] / site / jquery / jquery.js
1 /*!
2  * jQuery JavaScript Library v1.11.0
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-01-23T21:02Z
13  */
14
15 // modified by Bob Hanson for local MSIE 11 reading remote files
16
17 (function( global, factory ) {
18
19         if ( typeof module === "object" && typeof module.exports === "object" ) {
20                 // For CommonJS and CommonJS-like environments where a proper window is present,
21                 // execute the factory and get jQuery
22                 // For environments that do not inherently posses a window with a document
23                 // (such as Node.js), expose a jQuery-making factory as module.exports
24                 // This accentuates the need for the creation of a real window
25                 // e.g. var jQuery = require("jquery")(window);
26                 // See ticket #14549 for more info
27                 module.exports = global.document ?
28                         factory( global, true ) :
29                         function( w ) {
30                                 if ( !w.document ) {
31                                         throw new Error( "jQuery requires a window with a document" );
32                                 }
33                                 return factory( w );
34                         };
35         } else {
36                 factory( global );
37         }
38
39 // Pass this if window is not defined yet
40 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
41
42 // Can't do this because several apps including ASP.NET trace
43 // the stack via arguments.caller.callee and Firefox dies if
44 // you try to trace through "use strict" call chains. (#13335)
45 // Support: Firefox 18+
46 //
47
48 var deletedIds = [];
49
50 var slice = deletedIds.slice;
51
52 var concat = deletedIds.concat;
53
54 var push = deletedIds.push;
55
56 var indexOf = deletedIds.indexOf;
57
58 var class2type = {};
59
60 var toString = class2type.toString;
61
62 var hasOwn = class2type.hasOwnProperty;
63
64 var trim = "".trim;
65
66 var support = {};
67
68
69
70 var
71         version = "1.11.0",
72
73         // Define a local copy of jQuery
74         jQuery = function( selector, context ) {
75                 // The jQuery object is actually just the init constructor 'enhanced'
76                 // Need init if jQuery is called (just allow error to be thrown if not included)
77                 return new jQuery.fn.init( selector, context );
78         },
79
80         // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
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 a 'clean' array
114                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
115
116                         // Return just the object
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: deletedIds.sort,
174         splice: deletedIds.splice
175 };
176
177 jQuery.extend = jQuery.fn.extend = function() {
178         var src, copyIsArray, copy, name, options, 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 || function( obj ) {
263                 return jQuery.type(obj) === "array";
264         },
265
266         isWindow: function( obj ) {
267                 /* jshint eqeqeq: false */
268                 return obj != null && obj == obj.window;
269         },
270
271         isNumeric: function( obj ) {
272                 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
273                 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
274                 // subtraction forces infinities to NaN
275                 return obj - parseFloat( obj ) >= 0;
276         },
277
278         isEmptyObject: function( obj ) {
279                 var name;
280                 for ( name in obj ) {
281                         return false;
282                 }
283                 return true;
284         },
285
286         isPlainObject: function( obj ) {
287                 var key;
288
289                 // Must be an Object.
290                 // Because of IE, we also have to check the presence of the constructor property.
291                 // Make sure that DOM nodes and window objects don't pass through, as well
292                 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
293                         return false;
294                 }
295
296                 try {
297                         // Not own constructor property must be Object
298                         if ( obj.constructor &&
299                                 !hasOwn.call(obj, "constructor") &&
300                                 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
301                                 return false;
302                         }
303                 } catch ( e ) {
304                         // IE8,9 Will throw exceptions on certain host objects #9897
305                         return false;
306                 }
307
308                 // Support: IE<9
309                 // Handle iteration over inherited properties before own properties.
310                 if ( support.ownLast ) {
311                         for ( key in obj ) {
312                                 return hasOwn.call( obj, key );
313                         }
314                 }
315
316                 // Own properties are enumerated firstly, so to speed up,
317                 // if last one is own, then all properties are own.
318                 for ( key in obj ) {}
319
320                 return key === undefined || hasOwn.call( obj, key );
321         },
322
323         type: function( obj ) {
324                 if ( obj == null ) {
325                         return obj + "";
326                 }
327                 return typeof obj === "object" || typeof obj === "function" ?
328                         class2type[ toString.call(obj) ] || "object" :
329                         typeof obj;
330         },
331
332         // Evaluates a script in a global context
333         // Workarounds based on findings by Jim Driscoll
334         // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
335         globalEval: function( data ) {
336                 if ( data && jQuery.trim( data ) ) {
337                         // We use execScript on Internet Explorer
338                         // We use an anonymous function so that context is window
339                         // rather than jQuery in Firefox
340                         ( window.execScript || function( data ) {
341                                 window[ "eval" ].call( window, data );
342                         } )( data );
343                 }
344         },
345
346         // Convert dashed to camelCase; used by the css and data modules
347         // Microsoft forgot to hump their vendor prefix (#9572)
348         camelCase: function( string ) {
349                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
350         },
351
352         nodeName: function( elem, name ) {
353                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
354         },
355
356         // args is for internal usage only
357         each: function( obj, callback, args ) {
358                 var value,
359                         i = 0,
360                         length = obj.length,
361                         isArray = isArraylike( obj );
362
363                 if ( args ) {
364                         if ( isArray ) {
365                                 for ( ; i < length; i++ ) {
366                                         value = callback.apply( obj[ i ], args );
367
368                                         if ( value === false ) {
369                                                 break;
370                                         }
371                                 }
372                         } else {
373                                 for ( i in obj ) {
374                                         value = callback.apply( obj[ i ], args );
375
376                                         if ( value === false ) {
377                                                 break;
378                                         }
379                                 }
380                         }
381
382                 // A special, fast, case for the most common use of each
383                 } else {
384                         if ( isArray ) {
385                                 for ( ; i < length; i++ ) {
386                                         value = callback.call( obj[ i ], i, obj[ i ] );
387
388                                         if ( value === false ) {
389                                                 break;
390                                         }
391                                 }
392                         } else {
393                                 for ( i in obj ) {
394                                         value = callback.call( obj[ i ], i, obj[ i ] );
395
396                                         if ( value === false ) {
397                                                 break;
398                                         }
399                                 }
400                         }
401                 }
402
403                 return obj;
404         },
405
406         // Use native String.trim function wherever possible
407         trim: trim && !trim.call("\uFEFF\xA0") ?
408                 function( text ) {
409                         return text == null ?
410                                 "" :
411                                 trim.call( text );
412                 } :
413
414                 // Otherwise use our own trimming functionality
415                 function( text ) {
416                         return text == null ?
417                                 "" :
418                                 ( text + "" ).replace( rtrim, "" );
419                 },
420
421         // results is for internal usage only
422         makeArray: function( arr, results ) {
423                 var ret = results || [];
424
425                 if ( arr != null ) {
426                         if ( isArraylike( Object(arr) ) ) {
427                                 jQuery.merge( ret,
428                                         typeof arr === "string" ?
429                                         [ arr ] : arr
430                                 );
431                         } else {
432                                 push.call( ret, arr );
433                         }
434                 }
435
436                 return ret;
437         },
438
439         inArray: function( elem, arr, i ) {
440                 var len;
441
442                 if ( arr ) {
443                         if ( indexOf ) {
444                                 return indexOf.call( arr, elem, i );
445                         }
446
447                         len = arr.length;
448                         i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
449
450                         for ( ; i < len; i++ ) {
451                                 // Skip accessing in sparse arrays
452                                 if ( i in arr && arr[ i ] === elem ) {
453                                         return i;
454                                 }
455                         }
456                 }
457
458                 return -1;
459         },
460
461         merge: function( first, second ) {
462                 var len = +second.length,
463                         j = 0,
464                         i = first.length;
465
466                 while ( j < len ) {
467                         first[ i++ ] = second[ j++ ];
468                 }
469
470                 // Support: IE<9
471                 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
472                 if ( len !== len ) {
473                         while ( second[j] !== undefined ) {
474                                 first[ i++ ] = second[ j++ ];
475                         }
476                 }
477
478                 first.length = i;
479
480                 return first;
481         },
482
483         grep: function( elems, callback, invert ) {
484                 var callbackInverse,
485                         matches = [],
486                         i = 0,
487                         length = elems.length,
488                         callbackExpect = !invert;
489
490                 // Go through the array, only saving the items
491                 // that pass the validator function
492                 for ( ; i < length; i++ ) {
493                         callbackInverse = !callback( elems[ i ], i );
494                         if ( callbackInverse !== callbackExpect ) {
495                                 matches.push( elems[ i ] );
496                         }
497                 }
498
499                 return matches;
500         },
501
502         // arg is for internal usage only
503         map: function( elems, callback, arg ) {
504                 var value,
505                         i = 0,
506                         length = elems.length,
507                         isArray = isArraylike( elems ),
508                         ret = [];
509
510                 // Go through the array, translating each of the items to their new values
511                 if ( isArray ) {
512                         for ( ; i < length; i++ ) {
513                                 value = callback( elems[ i ], i, arg );
514
515                                 if ( value != null ) {
516                                         ret.push( value );
517                                 }
518                         }
519
520                 // Go through every key on the object,
521                 } else {
522                         for ( i in elems ) {
523                                 value = callback( elems[ i ], i, arg );
524
525                                 if ( value != null ) {
526                                         ret.push( value );
527                                 }
528                         }
529                 }
530
531                 // Flatten any nested arrays
532                 return concat.apply( [], ret );
533         },
534
535         // A global GUID counter for objects
536         guid: 1,
537
538         // Bind a function to a context, optionally partially applying any
539         // arguments.
540         proxy: function( fn, context ) {
541                 var args, proxy, tmp;
542
543                 if ( typeof context === "string" ) {
544                         tmp = fn[ context ];
545                         context = fn;
546                         fn = tmp;
547                 }
548
549                 // Quick check to determine if target is callable, in the spec
550                 // this throws a TypeError, but we will just return undefined.
551                 if ( !jQuery.isFunction( fn ) ) {
552                         return undefined;
553                 }
554
555                 // Simulated bind
556                 args = slice.call( arguments, 2 );
557                 proxy = function() {
558                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
559                 };
560
561                 // Set the guid of unique handler to the same of original handler, so it can be removed
562                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
563
564                 return proxy;
565         },
566
567         now: function() {
568                 return +( new Date() );
569         },
570
571         // jQuery.support is not used in Core but other projects attach their
572         // properties to it so it needs to exist.
573         support: support
574 });
575
576 // Populate the class2type map
577 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
578         class2type[ "[object " + name + "]" ] = name.toLowerCase();
579 });
580
581 function isArraylike( obj ) {
582         var length = obj.length,
583                 type = jQuery.type( obj );
584
585         if ( type === "function" || jQuery.isWindow( obj ) ) {
586                 return false;
587         }
588
589         if ( obj.nodeType === 1 && length ) {
590                 return true;
591         }
592
593         return type === "array" || length === 0 ||
594                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
595 }
596 var Sizzle =
597 /*!
598  * Sizzle CSS Selector Engine v1.10.16
599  * http://sizzlejs.com/
600  *
601  * Copyright 2013 jQuery Foundation, Inc. and other contributors
602  * Released under the MIT license
603  * http://jquery.org/license
604  *
605  * Date: 2014-01-13
606  */
607 (function( window ) {
608
609 var i,
610         support,
611         Expr,
612         getText,
613         isXML,
614         compile,
615         outermostContext,
616         sortInput,
617         hasDuplicate,
618
619         // Local document vars
620         setDocument,
621         document,
622         docElem,
623         documentIsHTML,
624         rbuggyQSA,
625         rbuggyMatches,
626         matches,
627         contains,
628
629         // Instance-specific data
630         expando = "sizzle" + -(new Date()),
631         preferredDoc = window.document,
632         dirruns = 0,
633         done = 0,
634         classCache = createCache(),
635         tokenCache = createCache(),
636         compilerCache = createCache(),
637         sortOrder = function( a, b ) {
638                 if ( a === b ) {
639                         hasDuplicate = true;
640                 }
641                 return 0;
642         },
643
644         // General-purpose constants
645         strundefined = typeof undefined,
646         MAX_NEGATIVE = 1 << 31,
647
648         // Instance methods
649         hasOwn = ({}).hasOwnProperty,
650         arr = [],
651         pop = arr.pop,
652         push_native = arr.push,
653         push = arr.push,
654         slice = arr.slice,
655         // Use a stripped-down indexOf if we can't use a native one
656         indexOf = arr.indexOf || function( elem ) {
657                 var i = 0,
658                         len = this.length;
659                 for ( ; i < len; i++ ) {
660                         if ( this[i] === elem ) {
661                                 return i;
662                         }
663                 }
664                 return -1;
665         },
666
667         booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
668
669         // Regular expressions
670
671         // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
672         whitespace = "[\\x20\\t\\r\\n\\f]",
673         // http://www.w3.org/TR/css3-syntax/#characters
674         characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
675
676         // Loosely modeled on CSS identifier characters
677         // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
678         // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
679         identifier = characterEncoding.replace( "w", "w#" ),
680
681         // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
682         attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
683                 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
684
685         // Prefer arguments quoted,
686         //   then not containing pseudos/brackets,
687         //   then attribute selectors/non-parenthetical expressions,
688         //   then anything else
689         // These preferences are here to reduce the number of selectors
690         //   needing tokenize in the PSEUDO preFilter
691         pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
692
693         // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
694         rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
695
696         rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
697         rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
698
699         rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
700
701         rpseudo = new RegExp( pseudos ),
702         ridentifier = new RegExp( "^" + identifier + "$" ),
703
704         matchExpr = {
705                 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
706                 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
707                 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
708                 "ATTR": new RegExp( "^" + attributes ),
709                 "PSEUDO": new RegExp( "^" + pseudos ),
710                 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
711                         "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
712                         "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
713                 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
714                 // For use in libraries implementing .is()
715                 // We use this for POS matching in `select`
716                 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
717                         whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
718         },
719
720         rinputs = /^(?:input|select|textarea|button)$/i,
721         rheader = /^h\d$/i,
722
723         rnative = /^[^{]+\{\s*\[native \w/,
724
725         // Easily-parseable/retrievable ID or TAG or CLASS selectors
726         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
727
728         rsibling = /[+~]/,
729         rescape = /'|\\/g,
730
731         // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
732         runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
733         funescape = function( _, escaped, escapedWhitespace ) {
734                 var high = "0x" + escaped - 0x10000;
735                 // NaN means non-codepoint
736                 // Support: Firefox
737                 // Workaround erroneous numeric interpretation of +"0x"
738                 return high !== high || escapedWhitespace ?
739                         escaped :
740                         high < 0 ?
741                                 // BMP codepoint
742                                 String.fromCharCode( high + 0x10000 ) :
743                                 // Supplemental Plane codepoint (surrogate pair)
744                                 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
745         };
746
747 // Optimize for push.apply( _, NodeList )
748 try {
749         push.apply(
750                 (arr = slice.call( preferredDoc.childNodes )),
751                 preferredDoc.childNodes
752         );
753         // Support: Android<4.0
754         // Detect silently failing push.apply
755         arr[ preferredDoc.childNodes.length ].nodeType;
756 } catch ( e ) {
757         push = { apply: arr.length ?
758
759                 // Leverage slice if possible
760                 function( target, els ) {
761                         push_native.apply( target, slice.call(els) );
762                 } :
763
764                 // Support: IE<9
765                 // Otherwise append directly
766                 function( target, els ) {
767                         var j = target.length,
768                                 i = 0;
769                         // Can't trust NodeList.length
770                         while ( (target[j++] = els[i++]) ) {}
771                         target.length = j - 1;
772                 }
773         };
774 }
775
776 function Sizzle( selector, context, results, seed ) {
777         var match, elem, m, nodeType,
778                 // QSA vars
779                 i, groups, old, nid, newContext, newSelector;
780
781         if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
782                 setDocument( context );
783         }
784
785         context = context || document;
786         results = results || [];
787
788         if ( !selector || typeof selector !== "string" ) {
789                 return results;
790         }
791
792         if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
793                 return [];
794         }
795
796         if ( documentIsHTML && !seed ) {
797
798                 // Shortcuts
799                 if ( (match = rquickExpr.exec( selector )) ) {
800                         // Speed-up: Sizzle("#ID")
801                         if ( (m = match[1]) ) {
802                                 if ( nodeType === 9 ) {
803                                         elem = context.getElementById( m );
804                                         // Check parentNode to catch when Blackberry 4.6 returns
805                                         // nodes that are no longer in the document (jQuery #6963)
806                                         if ( elem && elem.parentNode ) {
807                                                 // Handle the case where IE, Opera, and Webkit return items
808                                                 // by name instead of ID
809                                                 if ( elem.id === m ) {
810                                                         results.push( elem );
811                                                         return results;
812                                                 }
813                                         } else {
814                                                 return results;
815                                         }
816                                 } else {
817                                         // Context is not a document
818                                         if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
819                                                 contains( context, elem ) && elem.id === m ) {
820                                                 results.push( elem );
821                                                 return results;
822                                         }
823                                 }
824
825                         // Speed-up: Sizzle("TAG")
826                         } else if ( match[2] ) {
827                                 push.apply( results, context.getElementsByTagName( selector ) );
828                                 return results;
829
830                         // Speed-up: Sizzle(".CLASS")
831                         } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
832                                 push.apply( results, context.getElementsByClassName( m ) );
833                                 return results;
834                         }
835                 }
836
837                 // QSA path
838                 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
839                         nid = old = expando;
840                         newContext = context;
841                         newSelector = nodeType === 9 && selector;
842
843                         // qSA works strangely on Element-rooted queries
844                         // We can work around this by specifying an extra ID on the root
845                         // and working up from there (Thanks to Andrew Dupont for the technique)
846                         // IE 8 doesn't work on object elements
847                         if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
848                                 groups = tokenize( selector );
849
850                                 if ( (old = context.getAttribute("id")) ) {
851                                         nid = old.replace( rescape, "\\$&" );
852                                 } else {
853                                         context.setAttribute( "id", nid );
854                                 }
855                                 nid = "[id='" + nid + "'] ";
856
857                                 i = groups.length;
858                                 while ( i-- ) {
859                                         groups[i] = nid + toSelector( groups[i] );
860                                 }
861                                 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
862                                 newSelector = groups.join(",");
863                         }
864
865                         if ( newSelector ) {
866                                 try {
867                                         push.apply( results,
868                                                 newContext.querySelectorAll( newSelector )
869                                         );
870                                         return results;
871                                 } catch(qsaError) {
872                                 } finally {
873                                         if ( !old ) {
874                                                 context.removeAttribute("id");
875                                         }
876                                 }
877                         }
878                 }
879         }
880
881         // All others
882         return select( selector.replace( rtrim, "$1" ), context, results, seed );
883 }
884
885 /**
886  * Create key-value caches of limited size
887  * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
888  *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
889  *      deleting the oldest entry
890  */
891 function createCache() {
892         var keys = [];
893
894         function cache( key, value ) {
895                 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
896                 if ( keys.push( key + " " ) > Expr.cacheLength ) {
897                         // Only keep the most recent entries
898                         delete cache[ keys.shift() ];
899                 }
900                 return (cache[ key + " " ] = value);
901         }
902         return cache;
903 }
904
905 /**
906  * Mark a function for special use by Sizzle
907  * @param {Function} fn The function to mark
908  */
909 function markFunction( fn ) {
910         fn[ expando ] = true;
911         return fn;
912 }
913
914 /**
915  * Support testing using an element
916  * @param {Function} fn Passed the created div and expects a boolean result
917  */
918 function assert( fn ) {
919         var div = document.createElement("div");
920
921         try {
922                 return !!fn( div );
923         } catch (e) {
924                 return false;
925         } finally {
926                 // Remove from its parent by default
927                 if ( div.parentNode ) {
928                         div.parentNode.removeChild( div );
929                 }
930                 // release memory in IE
931                 div = null;
932         }
933 }
934
935 /**
936  * Adds the same handler for all of the specified attrs
937  * @param {String} attrs Pipe-separated list of attributes
938  * @param {Function} handler The method that will be applied
939  */
940 function addHandle( attrs, handler ) {
941         var arr = attrs.split("|"),
942                 i = attrs.length;
943
944         while ( i-- ) {
945                 Expr.attrHandle[ arr[i] ] = handler;
946         }
947 }
948
949 /**
950  * Checks document order of two siblings
951  * @param {Element} a
952  * @param {Element} b
953  * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
954  */
955 function siblingCheck( a, b ) {
956         var cur = b && a,
957                 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
958                         ( ~b.sourceIndex || MAX_NEGATIVE ) -
959                         ( ~a.sourceIndex || MAX_NEGATIVE );
960
961         // Use IE sourceIndex if available on both nodes
962         if ( diff ) {
963                 return diff;
964         }
965
966         // Check if b follows a
967         if ( cur ) {
968                 while ( (cur = cur.nextSibling) ) {
969                         if ( cur === b ) {
970                                 return -1;
971                         }
972                 }
973         }
974
975         return a ? 1 : -1;
976 }
977
978 /**
979  * Returns a function to use in pseudos for input types
980  * @param {String} type
981  */
982 function createInputPseudo( type ) {
983         return function( elem ) {
984                 var name = elem.nodeName.toLowerCase();
985                 return name === "input" && elem.type === type;
986         };
987 }
988
989 /**
990  * Returns a function to use in pseudos for buttons
991  * @param {String} type
992  */
993 function createButtonPseudo( type ) {
994         return function( elem ) {
995                 var name = elem.nodeName.toLowerCase();
996                 return (name === "input" || name === "button") && elem.type === type;
997         };
998 }
999
1000 /**
1001  * Returns a function to use in pseudos for positionals
1002  * @param {Function} fn
1003  */
1004 function createPositionalPseudo( fn ) {
1005         return markFunction(function( argument ) {
1006                 argument = +argument;
1007                 return markFunction(function( seed, matches ) {
1008                         var j,
1009                                 matchIndexes = fn( [], seed.length, argument ),
1010                                 i = matchIndexes.length;
1011
1012                         // Match elements found at the specified indexes
1013                         while ( i-- ) {
1014                                 if ( seed[ (j = matchIndexes[i]) ] ) {
1015                                         seed[j] = !(matches[j] = seed[j]);
1016                                 }
1017                         }
1018                 });
1019         });
1020 }
1021
1022 /**
1023  * Checks a node for validity as a Sizzle context
1024  * @param {Element|Object=} context
1025  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1026  */
1027 function testContext( context ) {
1028         return context && typeof context.getElementsByTagName !== strundefined && context;
1029 }
1030
1031 // Expose support vars for convenience
1032 support = Sizzle.support = {};
1033
1034 /**
1035  * Detects XML nodes
1036  * @param {Element|Object} elem An element or a document
1037  * @returns {Boolean} True iff elem is a non-HTML XML node
1038  */
1039 isXML = Sizzle.isXML = function( elem ) {
1040         // documentElement is verified for cases where it doesn't yet exist
1041         // (such as loading iframes in IE - #4833)
1042         var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1043         return documentElement ? documentElement.nodeName !== "HTML" : false;
1044 };
1045
1046 /**
1047  * Sets document-related variables once based on the current document
1048  * @param {Element|Object} [doc] An element or document object to use to set the document
1049  * @returns {Object} Returns the current document
1050  */
1051 setDocument = Sizzle.setDocument = function( node ) {
1052         var hasCompare,
1053                 doc = node ? node.ownerDocument || node : preferredDoc,
1054                 parent = doc.defaultView;
1055
1056         // If no document and documentElement is available, return
1057         if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1058                 return document;
1059         }
1060
1061         // Set our document
1062         document = doc;
1063         docElem = doc.documentElement;
1064
1065         // Support tests
1066         documentIsHTML = !isXML( doc );
1067
1068         // Support: IE>8
1069         // If iframe document is assigned to "document" variable and if iframe has been reloaded,
1070         // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1071         // IE6-8 do not support the defaultView property so parent will be undefined
1072         if ( parent && parent !== parent.top ) {
1073                 // IE11 does not have attachEvent, so all must suffer
1074                 if ( parent.addEventListener ) {
1075                         parent.addEventListener( "unload", function() {
1076                                 setDocument();
1077                         }, false );
1078                 } else if ( parent.attachEvent ) {
1079                         parent.attachEvent( "onunload", function() {
1080                                 setDocument();
1081                         });
1082                 }
1083         }
1084
1085         /* Attributes
1086         ---------------------------------------------------------------------- */
1087
1088         // Support: IE<8
1089         // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
1090         support.attributes = assert(function( div ) {
1091                 div.className = "i";
1092                 return !div.getAttribute("className");
1093         });
1094
1095         /* getElement(s)By*
1096         ---------------------------------------------------------------------- */
1097
1098         // Check if getElementsByTagName("*") returns only elements
1099         support.getElementsByTagName = assert(function( div ) {
1100                 div.appendChild( doc.createComment("") );
1101                 return !div.getElementsByTagName("*").length;
1102         });
1103
1104         // Check if getElementsByClassName can be trusted
1105         support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
1106                 div.innerHTML = "<div class='a'></div><div class='a i'></div>";
1107
1108                 // Support: Safari<4
1109                 // Catch class over-caching
1110                 div.firstChild.className = "i";
1111                 // Support: Opera<10
1112                 // Catch gEBCN failure to find non-leading classes
1113                 return div.getElementsByClassName("i").length === 2;
1114         });
1115
1116         // Support: IE<10
1117         // Check if getElementById returns elements by name
1118         // The broken getElementById methods don't pick up programatically-set names,
1119         // so use a roundabout getElementsByName test
1120         support.getById = assert(function( div ) {
1121                 docElem.appendChild( div ).id = expando;
1122                 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1123         });
1124
1125         // ID find and filter
1126         if ( support.getById ) {
1127                 Expr.find["ID"] = function( id, context ) {
1128                         if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
1129                                 var m = context.getElementById( id );
1130                                 // Check parentNode to catch when Blackberry 4.6 returns
1131                                 // nodes that are no longer in the document #6963
1132                                 return m && m.parentNode ? [m] : [];
1133                         }
1134                 };
1135                 Expr.filter["ID"] = function( id ) {
1136                         var attrId = id.replace( runescape, funescape );
1137                         return function( elem ) {
1138                                 return elem.getAttribute("id") === attrId;
1139                         };
1140                 };
1141         } else {
1142                 // Support: IE6/7
1143                 // getElementById is not reliable as a find shortcut
1144                 delete Expr.find["ID"];
1145
1146                 Expr.filter["ID"] =  function( id ) {
1147                         var attrId = id.replace( runescape, funescape );
1148                         return function( elem ) {
1149                                 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
1150                                 return node && node.value === attrId;
1151                         };
1152                 };
1153         }
1154
1155         // Tag
1156         Expr.find["TAG"] = support.getElementsByTagName ?
1157                 function( tag, context ) {
1158                         if ( typeof context.getElementsByTagName !== strundefined ) {
1159                                 return context.getElementsByTagName( tag );
1160                         }
1161                 } :
1162                 function( tag, context ) {
1163                         var elem,
1164                                 tmp = [],
1165                                 i = 0,
1166                                 results = context.getElementsByTagName( tag );
1167
1168                         // Filter out possible comments
1169                         if ( tag === "*" ) {
1170                                 while ( (elem = results[i++]) ) {
1171                                         if ( elem.nodeType === 1 ) {
1172                                                 tmp.push( elem );
1173                                         }
1174                                 }
1175
1176                                 return tmp;
1177                         }
1178                         return results;
1179                 };
1180
1181         // Class
1182         Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1183                 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
1184                         return context.getElementsByClassName( className );
1185                 }
1186         };
1187
1188         /* QSA/matchesSelector
1189         ---------------------------------------------------------------------- */
1190
1191         // QSA and matchesSelector support
1192
1193         // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1194         rbuggyMatches = [];
1195
1196         // qSa(:focus) reports false when true (Chrome 21)
1197         // We allow this because of a bug in IE8/9 that throws an error
1198         // whenever `document.activeElement` is accessed on an iframe
1199         // So, we allow :focus to pass through QSA all the time to avoid the IE error
1200         // See http://bugs.jquery.com/ticket/13378
1201         rbuggyQSA = [];
1202
1203         if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1204                 // Build QSA regex
1205                 // Regex strategy adopted from Diego Perini
1206                 assert(function( div ) {
1207                         // Select is set to empty string on purpose
1208                         // This is to test IE's treatment of not explicitly
1209                         // setting a boolean content attribute,
1210                         // since its presence should be enough
1211                         // http://bugs.jquery.com/ticket/12359
1212                         div.innerHTML = "<select t=''><option selected=''></option></select>";
1213
1214                         // Support: IE8, Opera 10-12
1215                         // Nothing should be selected when empty strings follow ^= or $= or *=
1216                         if ( div.querySelectorAll("[t^='']").length ) {
1217                                 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1218                         }
1219
1220                         // Support: IE8
1221                         // Boolean attributes and "value" are not treated correctly
1222                         if ( !div.querySelectorAll("[selected]").length ) {
1223                                 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1224                         }
1225
1226                         // Webkit/Opera - :checked should return selected option elements
1227                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1228                         // IE8 throws error here and will not see later tests
1229                         if ( !div.querySelectorAll(":checked").length ) {
1230                                 rbuggyQSA.push(":checked");
1231                         }
1232                 });
1233
1234                 assert(function( div ) {
1235                         // Support: Windows 8 Native Apps
1236                         // The type and name attributes are restricted during .innerHTML assignment
1237                         var input = doc.createElement("input");
1238                         input.setAttribute( "type", "hidden" );
1239                         div.appendChild( input ).setAttribute( "name", "D" );
1240
1241                         // Support: IE8
1242                         // Enforce case-sensitivity of name attribute
1243                         if ( div.querySelectorAll("[name=d]").length ) {
1244                                 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1245                         }
1246
1247                         // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1248                         // IE8 throws error here and will not see later tests
1249                         if ( !div.querySelectorAll(":enabled").length ) {
1250                                 rbuggyQSA.push( ":enabled", ":disabled" );
1251                         }
1252
1253                         // Opera 10-11 does not throw on post-comma invalid pseudos
1254                         div.querySelectorAll("*,:x");
1255                         rbuggyQSA.push(",.*:");
1256                 });
1257         }
1258
1259         if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
1260                 docElem.mozMatchesSelector ||
1261                 docElem.oMatchesSelector ||
1262                 docElem.msMatchesSelector) )) ) {
1263
1264                 assert(function( div ) {
1265                         // Check to see if it's possible to do matchesSelector
1266                         // on a disconnected node (IE 9)
1267                         support.disconnectedMatch = matches.call( div, "div" );
1268
1269                         // This should fail with an exception
1270                         // Gecko does not error, returns false instead
1271                         matches.call( div, "[s!='']:x" );
1272                         rbuggyMatches.push( "!=", pseudos );
1273                 });
1274         }
1275
1276         rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1277         rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1278
1279         /* Contains
1280         ---------------------------------------------------------------------- */
1281         hasCompare = rnative.test( docElem.compareDocumentPosition );
1282
1283         // Element contains another
1284         // Purposefully does not implement inclusive descendent
1285         // As in, an element does not contain itself
1286         contains = hasCompare || rnative.test( docElem.contains ) ?
1287                 function( a, b ) {
1288                         var adown = a.nodeType === 9 ? a.documentElement : a,
1289                                 bup = b && b.parentNode;
1290                         return a === bup || !!( bup && bup.nodeType === 1 && (
1291                                 adown.contains ?
1292                                         adown.contains( bup ) :
1293                                         a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1294                         ));
1295                 } :
1296                 function( a, b ) {
1297                         if ( b ) {
1298                                 while ( (b = b.parentNode) ) {
1299                                         if ( b === a ) {
1300                                                 return true;
1301                                         }
1302                                 }
1303                         }
1304                         return false;
1305                 };
1306
1307         /* Sorting
1308         ---------------------------------------------------------------------- */
1309
1310         // Document order sorting
1311         sortOrder = hasCompare ?
1312         function( a, b ) {
1313
1314                 // Flag for duplicate removal
1315                 if ( a === b ) {
1316                         hasDuplicate = true;
1317                         return 0;
1318                 }
1319
1320                 // Sort on method existence if only one input has compareDocumentPosition
1321                 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1322                 if ( compare ) {
1323                         return compare;
1324                 }
1325
1326                 // Calculate position if both inputs belong to the same document
1327                 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1328                         a.compareDocumentPosition( b ) :
1329
1330                         // Otherwise we know they are disconnected
1331                         1;
1332
1333                 // Disconnected nodes
1334                 if ( compare & 1 ||
1335                         (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1336
1337                         // Choose the first element that is related to our preferred document
1338                         if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1339                                 return -1;
1340                         }
1341                         if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1342                                 return 1;
1343                         }
1344
1345                         // Maintain original order
1346                         return sortInput ?
1347                                 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1348                                 0;
1349                 }
1350
1351                 return compare & 4 ? -1 : 1;
1352         } :
1353         function( a, b ) {
1354                 // Exit early if the nodes are identical
1355                 if ( a === b ) {
1356                         hasDuplicate = true;
1357                         return 0;
1358                 }
1359
1360                 var cur,
1361                         i = 0,
1362                         aup = a.parentNode,
1363                         bup = b.parentNode,
1364                         ap = [ a ],
1365                         bp = [ b ];
1366
1367                 // Parentless nodes are either documents or disconnected
1368                 if ( !aup || !bup ) {
1369                         return a === doc ? -1 :
1370                                 b === doc ? 1 :
1371                                 aup ? -1 :
1372                                 bup ? 1 :
1373                                 sortInput ?
1374                                 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1375                                 0;
1376
1377                 // If the nodes are siblings, we can do a quick check
1378                 } else if ( aup === bup ) {
1379                         return siblingCheck( a, b );
1380                 }
1381
1382                 // Otherwise we need full lists of their ancestors for comparison
1383                 cur = a;
1384                 while ( (cur = cur.parentNode) ) {
1385                         ap.unshift( cur );
1386                 }
1387                 cur = b;
1388                 while ( (cur = cur.parentNode) ) {
1389                         bp.unshift( cur );
1390                 }
1391
1392                 // Walk down the tree looking for a discrepancy
1393                 while ( ap[i] === bp[i] ) {
1394                         i++;
1395                 }
1396
1397                 return i ?
1398                         // Do a sibling check if the nodes have a common ancestor
1399                         siblingCheck( ap[i], bp[i] ) :
1400
1401                         // Otherwise nodes in our document sort first
1402                         ap[i] === preferredDoc ? -1 :
1403                         bp[i] === preferredDoc ? 1 :
1404                         0;
1405         };
1406
1407         return doc;
1408 };
1409
1410 Sizzle.matches = function( expr, elements ) {
1411         return Sizzle( expr, null, null, elements );
1412 };
1413
1414 Sizzle.matchesSelector = function( elem, expr ) {
1415         // Set document vars if needed
1416         if ( ( elem.ownerDocument || elem ) !== document ) {
1417                 setDocument( elem );
1418         }
1419
1420         // Make sure that attribute selectors are quoted
1421         expr = expr.replace( rattributeQuotes, "='$1']" );
1422
1423         if ( support.matchesSelector && documentIsHTML &&
1424                 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1425                 ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1426
1427                 try {
1428                         var ret = matches.call( elem, expr );
1429
1430                         // IE 9's matchesSelector returns false on disconnected nodes
1431                         if ( ret || support.disconnectedMatch ||
1432                                         // As well, disconnected nodes are said to be in a document
1433                                         // fragment in IE 9
1434                                         elem.document && elem.document.nodeType !== 11 ) {
1435                                 return ret;
1436                         }
1437                 } catch(e) {}
1438         }
1439
1440         return Sizzle( expr, document, null, [elem] ).length > 0;
1441 };
1442
1443 Sizzle.contains = function( context, elem ) {
1444         // Set document vars if needed
1445         if ( ( context.ownerDocument || context ) !== document ) {
1446                 setDocument( context );
1447         }
1448         return contains( context, elem );
1449 };
1450
1451 Sizzle.attr = function( elem, name ) {
1452         // Set document vars if needed
1453         if ( ( elem.ownerDocument || elem ) !== document ) {
1454                 setDocument( elem );
1455         }
1456
1457         var fn = Expr.attrHandle[ name.toLowerCase() ],
1458                 // Don't get fooled by Object.prototype properties (jQuery #13807)
1459                 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1460                         fn( elem, name, !documentIsHTML ) :
1461                         undefined;
1462
1463         return val !== undefined ?
1464                 val :
1465                 support.attributes || !documentIsHTML ?
1466                         elem.getAttribute( name ) :
1467                         (val = elem.getAttributeNode(name)) && val.specified ?
1468                                 val.value :
1469                                 null;
1470 };
1471
1472 Sizzle.error = function( msg ) {
1473         throw new Error( "Syntax error, unrecognized expression: " + msg );
1474 };
1475
1476 /**
1477  * Document sorting and removing duplicates
1478  * @param {ArrayLike} results
1479  */
1480 Sizzle.uniqueSort = function( results ) {
1481         var elem,
1482                 duplicates = [],
1483                 j = 0,
1484                 i = 0;
1485
1486         // Unless we *know* we can detect duplicates, assume their presence
1487         hasDuplicate = !support.detectDuplicates;
1488         sortInput = !support.sortStable && results.slice( 0 );
1489         results.sort( sortOrder );
1490
1491         if ( hasDuplicate ) {
1492                 while ( (elem = results[i++]) ) {
1493                         if ( elem === results[ i ] ) {
1494                                 j = duplicates.push( i );
1495                         }
1496                 }
1497                 while ( j-- ) {
1498                         results.splice( duplicates[ j ], 1 );
1499                 }
1500         }
1501
1502         // Clear input after sorting to release objects
1503         // See https://github.com/jquery/sizzle/pull/225
1504         sortInput = null;
1505
1506         return results;
1507 };
1508
1509 /**
1510  * Utility function for retrieving the text value of an array of DOM nodes
1511  * @param {Array|Element} elem
1512  */
1513 getText = Sizzle.getText = function( elem ) {
1514         var node,
1515                 ret = "",
1516                 i = 0,
1517                 nodeType = elem.nodeType;
1518
1519         if ( !nodeType ) {
1520                 // If no nodeType, this is expected to be an array
1521                 while ( (node = elem[i++]) ) {
1522                         // Do not traverse comment nodes
1523                         ret += getText( node );
1524                 }
1525         } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1526                 // Use textContent for elements
1527                 // innerText usage removed for consistency of new lines (jQuery #11153)
1528                 if ( typeof elem.textContent === "string" ) {
1529                         return elem.textContent;
1530                 } else {
1531                         // Traverse its children
1532                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1533                                 ret += getText( elem );
1534                         }
1535                 }
1536         } else if ( nodeType === 3 || nodeType === 4 ) {
1537                 return elem.nodeValue;
1538         }
1539         // Do not include comment or processing instruction nodes
1540
1541         return ret;
1542 };
1543
1544 Expr = Sizzle.selectors = {
1545
1546         // Can be adjusted by the user
1547         cacheLength: 50,
1548
1549         createPseudo: markFunction,
1550
1551         match: matchExpr,
1552
1553         attrHandle: {},
1554
1555         find: {},
1556
1557         relative: {
1558                 ">": { dir: "parentNode", first: true },
1559                 " ": { dir: "parentNode" },
1560                 "+": { dir: "previousSibling", first: true },
1561                 "~": { dir: "previousSibling" }
1562         },
1563
1564         preFilter: {
1565                 "ATTR": function( match ) {
1566                         match[1] = match[1].replace( runescape, funescape );
1567
1568                         // Move the given value to match[3] whether quoted or unquoted
1569                         match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
1570
1571                         if ( match[2] === "~=" ) {
1572                                 match[3] = " " + match[3] + " ";
1573                         }
1574
1575                         return match.slice( 0, 4 );
1576                 },
1577
1578                 "CHILD": function( match ) {
1579                         /* matches from matchExpr["CHILD"]
1580                                 1 type (only|nth|...)
1581                                 2 what (child|of-type)
1582                                 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1583                                 4 xn-component of xn+y argument ([+-]?\d*n|)
1584                                 5 sign of xn-component
1585                                 6 x of xn-component
1586                                 7 sign of y-component
1587                                 8 y of y-component
1588                         */
1589                         match[1] = match[1].toLowerCase();
1590
1591                         if ( match[1].slice( 0, 3 ) === "nth" ) {
1592                                 // nth-* requires argument
1593                                 if ( !match[3] ) {
1594                                         Sizzle.error( match[0] );
1595                                 }
1596
1597                                 // numeric x and y parameters for Expr.filter.CHILD
1598                                 // remember that false/true cast respectively to 0/1
1599                                 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1600                                 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1601
1602                         // other types prohibit arguments
1603                         } else if ( match[3] ) {
1604                                 Sizzle.error( match[0] );
1605                         }
1606
1607                         return match;
1608                 },
1609
1610                 "PSEUDO": function( match ) {
1611                         var excess,
1612                                 unquoted = !match[5] && match[2];
1613
1614                         if ( matchExpr["CHILD"].test( match[0] ) ) {
1615                                 return null;
1616                         }
1617
1618                         // Accept quoted arguments as-is
1619                         if ( match[3] && match[4] !== undefined ) {
1620                                 match[2] = match[4];
1621
1622                         // Strip excess characters from unquoted arguments
1623                         } else if ( unquoted && rpseudo.test( unquoted ) &&
1624                                 // Get excess from tokenize (recursively)
1625                                 (excess = tokenize( unquoted, true )) &&
1626                                 // advance to the next closing parenthesis
1627                                 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1628
1629                                 // excess is a negative index
1630                                 match[0] = match[0].slice( 0, excess );
1631                                 match[2] = unquoted.slice( 0, excess );
1632                         }
1633
1634                         // Return only captures needed by the pseudo filter method (type and argument)
1635                         return match.slice( 0, 3 );
1636                 }
1637         },
1638
1639         filter: {
1640
1641                 "TAG": function( nodeNameSelector ) {
1642                         var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1643                         return nodeNameSelector === "*" ?
1644                                 function() { return true; } :
1645                                 function( elem ) {
1646                                         return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1647                                 };
1648                 },
1649
1650                 "CLASS": function( className ) {
1651                         var pattern = classCache[ className + " " ];
1652
1653                         return pattern ||
1654                                 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1655                                 classCache( className, function( elem ) {
1656                                         return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
1657                                 });
1658                 },
1659
1660                 "ATTR": function( name, operator, check ) {
1661                         return function( elem ) {
1662                                 var result = Sizzle.attr( elem, name );
1663
1664                                 if ( result == null ) {
1665                                         return operator === "!=";
1666                                 }
1667                                 if ( !operator ) {
1668                                         return true;
1669                                 }
1670
1671                                 result += "";
1672
1673                                 return operator === "=" ? result === check :
1674                                         operator === "!=" ? result !== check :
1675                                         operator === "^=" ? check && result.indexOf( check ) === 0 :
1676                                         operator === "*=" ? check && result.indexOf( check ) > -1 :
1677                                         operator === "$=" ? check && result.slice( -check.length ) === check :
1678                                         operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
1679                                         operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1680                                         false;
1681                         };
1682                 },
1683
1684                 "CHILD": function( type, what, argument, first, last ) {
1685                         var simple = type.slice( 0, 3 ) !== "nth",
1686                                 forward = type.slice( -4 ) !== "last",
1687                                 ofType = what === "of-type";
1688
1689                         return first === 1 && last === 0 ?
1690
1691                                 // Shortcut for :nth-*(n)
1692                                 function( elem ) {
1693                                         return !!elem.parentNode;
1694                                 } :
1695
1696                                 function( elem, context, xml ) {
1697                                         var cache, outerCache, node, diff, nodeIndex, start,
1698                                                 dir = simple !== forward ? "nextSibling" : "previousSibling",
1699                                                 parent = elem.parentNode,
1700                                                 name = ofType && elem.nodeName.toLowerCase(),
1701                                                 useCache = !xml && !ofType;
1702
1703                                         if ( parent ) {
1704
1705                                                 // :(first|last|only)-(child|of-type)
1706                                                 if ( simple ) {
1707                                                         while ( dir ) {
1708                                                                 node = elem;
1709                                                                 while ( (node = node[ dir ]) ) {
1710                                                                         if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
1711                                                                                 return false;
1712                                                                         }
1713                                                                 }
1714                                                                 // Reverse direction for :only-* (if we haven't yet done so)
1715                                                                 start = dir = type === "only" && !start && "nextSibling";
1716                                                         }
1717                                                         return true;
1718                                                 }
1719
1720                                                 start = [ forward ? parent.firstChild : parent.lastChild ];
1721
1722                                                 // non-xml :nth-child(...) stores cache data on `parent`
1723                                                 if ( forward && useCache ) {
1724                                                         // Seek `elem` from a previously-cached index
1725                                                         outerCache = parent[ expando ] || (parent[ expando ] = {});
1726                                                         cache = outerCache[ type ] || [];
1727                                                         nodeIndex = cache[0] === dirruns && cache[1];
1728                                                         diff = cache[0] === dirruns && cache[2];
1729                                                         node = nodeIndex && parent.childNodes[ nodeIndex ];
1730
1731                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1732
1733                                                                 // Fallback to seeking `elem` from the start
1734                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1735
1736                                                                 // When found, cache indexes on `parent` and break
1737                                                                 if ( node.nodeType === 1 && ++diff && node === elem ) {
1738                                                                         outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1739                                                                         break;
1740                                                                 }
1741                                                         }
1742
1743                                                 // Use previously-cached element index if available
1744                                                 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
1745                                                         diff = cache[1];
1746
1747                                                 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
1748                                                 } else {
1749                                                         // Use the same loop as above to seek `elem` from the start
1750                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1751                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1752
1753                                                                 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
1754                                                                         // Cache the index of each encountered element
1755                                                                         if ( useCache ) {
1756                                                                                 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
1757                                                                         }
1758
1759                                                                         if ( node === elem ) {
1760                                                                                 break;
1761                                                                         }
1762                                                                 }
1763                                                         }
1764                                                 }
1765
1766                                                 // Incorporate the offset, then check against cycle size
1767                                                 diff -= last;
1768                                                 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1769                                         }
1770                                 };
1771                 },
1772
1773                 "PSEUDO": function( pseudo, argument ) {
1774                         // pseudo-class names are case-insensitive
1775                         // http://www.w3.org/TR/selectors/#pseudo-classes
1776                         // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1777                         // Remember that setFilters inherits from pseudos
1778                         var args,
1779                                 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1780                                         Sizzle.error( "unsupported pseudo: " + pseudo );
1781
1782                         // The user may use createPseudo to indicate that
1783                         // arguments are needed to create the filter function
1784                         // just as Sizzle does
1785                         if ( fn[ expando ] ) {
1786                                 return fn( argument );
1787                         }
1788
1789                         // But maintain support for old signatures
1790                         if ( fn.length > 1 ) {
1791                                 args = [ pseudo, pseudo, "", argument ];
1792                                 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1793                                         markFunction(function( seed, matches ) {
1794                                                 var idx,
1795                                                         matched = fn( seed, argument ),
1796                                                         i = matched.length;
1797                                                 while ( i-- ) {
1798                                                         idx = indexOf.call( seed, matched[i] );
1799                                                         seed[ idx ] = !( matches[ idx ] = matched[i] );
1800                                                 }
1801                                         }) :
1802                                         function( elem ) {
1803                                                 return fn( elem, 0, args );
1804                                         };
1805                         }
1806
1807                         return fn;
1808                 }
1809         },
1810
1811         pseudos: {
1812                 // Potentially complex pseudos
1813                 "not": markFunction(function( selector ) {
1814                         // Trim the selector passed to compile
1815                         // to avoid treating leading and trailing
1816                         // spaces as combinators
1817                         var input = [],
1818                                 results = [],
1819                                 matcher = compile( selector.replace( rtrim, "$1" ) );
1820
1821                         return matcher[ expando ] ?
1822                                 markFunction(function( seed, matches, context, xml ) {
1823                                         var elem,
1824                                                 unmatched = matcher( seed, null, xml, [] ),
1825                                                 i = seed.length;
1826
1827                                         // Match elements unmatched by `matcher`
1828                                         while ( i-- ) {
1829                                                 if ( (elem = unmatched[i]) ) {
1830                                                         seed[i] = !(matches[i] = elem);
1831                                                 }
1832                                         }
1833                                 }) :
1834                                 function( elem, context, xml ) {
1835                                         input[0] = elem;
1836                                         matcher( input, null, xml, results );
1837                                         return !results.pop();
1838                                 };
1839                 }),
1840
1841                 "has": markFunction(function( selector ) {
1842                         return function( elem ) {
1843                                 return Sizzle( selector, elem ).length > 0;
1844                         };
1845                 }),
1846
1847                 "contains": markFunction(function( text ) {
1848                         return function( elem ) {
1849                                 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1850                         };
1851                 }),
1852
1853                 // "Whether an element is represented by a :lang() selector
1854                 // is based solely on the element's language value
1855                 // being equal to the identifier C,
1856                 // or beginning with the identifier C immediately followed by "-".
1857                 // The matching of C against the element's language value is performed case-insensitively.
1858                 // The identifier C does not have to be a valid language name."
1859                 // http://www.w3.org/TR/selectors/#lang-pseudo
1860                 "lang": markFunction( function( lang ) {
1861                         // lang value must be a valid identifier
1862                         if ( !ridentifier.test(lang || "") ) {
1863                                 Sizzle.error( "unsupported lang: " + lang );
1864                         }
1865                         lang = lang.replace( runescape, funescape ).toLowerCase();
1866                         return function( elem ) {
1867                                 var elemLang;
1868                                 do {
1869                                         if ( (elemLang = documentIsHTML ?
1870                                                 elem.lang :
1871                                                 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1872
1873                                                 elemLang = elemLang.toLowerCase();
1874                                                 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1875                                         }
1876                                 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1877                                 return false;
1878                         };
1879                 }),
1880
1881                 // Miscellaneous
1882                 "target": function( elem ) {
1883                         var hash = window.location && window.location.hash;
1884                         return hash && hash.slice( 1 ) === elem.id;
1885                 },
1886
1887                 "root": function( elem ) {
1888                         return elem === docElem;
1889                 },
1890
1891                 "focus": function( elem ) {
1892                         return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1893                 },
1894
1895                 // Boolean properties
1896                 "enabled": function( elem ) {
1897                         return elem.disabled === false;
1898                 },
1899
1900                 "disabled": function( elem ) {
1901                         return elem.disabled === true;
1902                 },
1903
1904                 "checked": function( elem ) {
1905                         // In CSS3, :checked should return both checked and selected elements
1906                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1907                         var nodeName = elem.nodeName.toLowerCase();
1908                         return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1909                 },
1910
1911                 "selected": function( elem ) {
1912                         // Accessing this property makes selected-by-default
1913                         // options in Safari work properly
1914                         if ( elem.parentNode ) {
1915                                 elem.parentNode.selectedIndex;
1916                         }
1917
1918                         return elem.selected === true;
1919                 },
1920
1921                 // Contents
1922                 "empty": function( elem ) {
1923                         // http://www.w3.org/TR/selectors/#empty-pseudo
1924                         // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1925                         //   but not by others (comment: 8; processing instruction: 7; etc.)
1926                         // nodeType < 6 works because attributes (2) do not appear as children
1927                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1928                                 if ( elem.nodeType < 6 ) {
1929                                         return false;
1930                                 }
1931                         }
1932                         return true;
1933                 },
1934
1935                 "parent": function( elem ) {
1936                         return !Expr.pseudos["empty"]( elem );
1937                 },
1938
1939                 // Element/input types
1940                 "header": function( elem ) {
1941                         return rheader.test( elem.nodeName );
1942                 },
1943
1944                 "input": function( elem ) {
1945                         return rinputs.test( elem.nodeName );
1946                 },
1947
1948                 "button": function( elem ) {
1949                         var name = elem.nodeName.toLowerCase();
1950                         return name === "input" && elem.type === "button" || name === "button";
1951                 },
1952
1953                 "text": function( elem ) {
1954                         var attr;
1955                         return elem.nodeName.toLowerCase() === "input" &&
1956                                 elem.type === "text" &&
1957
1958                                 // Support: IE<8
1959                                 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1960                                 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
1961                 },
1962
1963                 // Position-in-collection
1964                 "first": createPositionalPseudo(function() {
1965                         return [ 0 ];
1966                 }),
1967
1968                 "last": createPositionalPseudo(function( matchIndexes, length ) {
1969                         return [ length - 1 ];
1970                 }),
1971
1972                 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
1973                         return [ argument < 0 ? argument + length : argument ];
1974                 }),
1975
1976                 "even": createPositionalPseudo(function( matchIndexes, length ) {
1977                         var i = 0;
1978                         for ( ; i < length; i += 2 ) {
1979                                 matchIndexes.push( i );
1980                         }
1981                         return matchIndexes;
1982                 }),
1983
1984                 "odd": createPositionalPseudo(function( matchIndexes, length ) {
1985                         var i = 1;
1986                         for ( ; i < length; i += 2 ) {
1987                                 matchIndexes.push( i );
1988                         }
1989                         return matchIndexes;
1990                 }),
1991
1992                 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
1993                         var i = argument < 0 ? argument + length : argument;
1994                         for ( ; --i >= 0; ) {
1995                                 matchIndexes.push( i );
1996                         }
1997                         return matchIndexes;
1998                 }),
1999
2000                 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2001                         var i = argument < 0 ? argument + length : argument;
2002                         for ( ; ++i < length; ) {
2003                                 matchIndexes.push( i );
2004                         }
2005                         return matchIndexes;
2006                 })
2007         }
2008 };
2009
2010 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2011
2012 // Add button/input type pseudos
2013 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2014         Expr.pseudos[ i ] = createInputPseudo( i );
2015 }
2016 for ( i in { submit: true, reset: true } ) {
2017         Expr.pseudos[ i ] = createButtonPseudo( i );
2018 }
2019
2020 // Easy API for creating new setFilters
2021 function setFilters() {}
2022 setFilters.prototype = Expr.filters = Expr.pseudos;
2023 Expr.setFilters = new setFilters();
2024
2025 function tokenize( selector, parseOnly ) {
2026         var matched, match, tokens, type,
2027                 soFar, groups, preFilters,
2028                 cached = tokenCache[ selector + " " ];
2029
2030         if ( cached ) {
2031                 return parseOnly ? 0 : cached.slice( 0 );
2032         }
2033
2034         soFar = selector;
2035         groups = [];
2036         preFilters = Expr.preFilter;
2037
2038         while ( soFar ) {
2039
2040                 // Comma and first run
2041                 if ( !matched || (match = rcomma.exec( soFar )) ) {
2042                         if ( match ) {
2043                                 // Don't consume trailing commas as valid
2044                                 soFar = soFar.slice( match[0].length ) || soFar;
2045                         }
2046                         groups.push( (tokens = []) );
2047                 }
2048
2049                 matched = false;
2050
2051                 // Combinators
2052                 if ( (match = rcombinators.exec( soFar )) ) {
2053                         matched = match.shift();
2054                         tokens.push({
2055                                 value: matched,
2056                                 // Cast descendant combinators to space
2057                                 type: match[0].replace( rtrim, " " )
2058                         });
2059                         soFar = soFar.slice( matched.length );
2060                 }
2061
2062                 // Filters
2063                 for ( type in Expr.filter ) {
2064                         if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2065                                 (match = preFilters[ type ]( match ))) ) {
2066                                 matched = match.shift();
2067                                 tokens.push({
2068                                         value: matched,
2069                                         type: type,
2070                                         matches: match
2071                                 });
2072                                 soFar = soFar.slice( matched.length );
2073                         }
2074                 }
2075
2076                 if ( !matched ) {
2077                         break;
2078                 }
2079         }
2080
2081         // Return the length of the invalid excess
2082         // if we're just parsing
2083         // Otherwise, throw an error or return tokens
2084         return parseOnly ?
2085                 soFar.length :
2086                 soFar ?
2087                         Sizzle.error( selector ) :
2088                         // Cache the tokens
2089                         tokenCache( selector, groups ).slice( 0 );
2090 }
2091
2092 function toSelector( tokens ) {
2093         var i = 0,
2094                 len = tokens.length,
2095                 selector = "";
2096         for ( ; i < len; i++ ) {
2097                 selector += tokens[i].value;
2098         }
2099         return selector;
2100 }
2101
2102 function addCombinator( matcher, combinator, base ) {
2103         var dir = combinator.dir,
2104                 checkNonElements = base && dir === "parentNode",
2105                 doneName = done++;
2106
2107         return combinator.first ?
2108                 // Check against closest ancestor/preceding element
2109                 function( elem, context, xml ) {
2110                         while ( (elem = elem[ dir ]) ) {
2111                                 if ( elem.nodeType === 1 || checkNonElements ) {
2112                                         return matcher( elem, context, xml );
2113                                 }
2114                         }
2115                 } :
2116
2117                 // Check against all ancestor/preceding elements
2118                 function( elem, context, xml ) {
2119                         var oldCache, outerCache,
2120                                 newCache = [ dirruns, doneName ];
2121
2122                         // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2123                         if ( xml ) {
2124                                 while ( (elem = elem[ dir ]) ) {
2125                                         if ( elem.nodeType === 1 || checkNonElements ) {
2126                                                 if ( matcher( elem, context, xml ) ) {
2127                                                         return true;
2128                                                 }
2129                                         }
2130                                 }
2131                         } else {
2132                                 while ( (elem = elem[ dir ]) ) {
2133                                         if ( elem.nodeType === 1 || checkNonElements ) {
2134                                                 outerCache = elem[ expando ] || (elem[ expando ] = {});
2135                                                 if ( (oldCache = outerCache[ dir ]) &&
2136                                                         oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2137
2138                                                         // Assign to newCache so results back-propagate to previous elements
2139                                                         return (newCache[ 2 ] = oldCache[ 2 ]);
2140                                                 } else {
2141                                                         // Reuse newcache so results back-propagate to previous elements
2142                                                         outerCache[ dir ] = newCache;
2143
2144                                                         // A match means we're done; a fail means we have to keep checking
2145                                                         if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2146                                                                 return true;
2147                                                         }
2148                                                 }
2149                                         }
2150                                 }
2151                         }
2152                 };
2153 }
2154
2155 function elementMatcher( matchers ) {
2156         return matchers.length > 1 ?
2157                 function( elem, context, xml ) {
2158                         var i = matchers.length;
2159                         while ( i-- ) {
2160                                 if ( !matchers[i]( elem, context, xml ) ) {
2161                                         return false;
2162                                 }
2163                         }
2164                         return true;
2165                 } :
2166                 matchers[0];
2167 }
2168
2169 function condense( unmatched, map, filter, context, xml ) {
2170         var elem,
2171                 newUnmatched = [],
2172                 i = 0,
2173                 len = unmatched.length,
2174                 mapped = map != null;
2175
2176         for ( ; i < len; i++ ) {
2177                 if ( (elem = unmatched[i]) ) {
2178                         if ( !filter || filter( elem, context, xml ) ) {
2179                                 newUnmatched.push( elem );
2180                                 if ( mapped ) {
2181                                         map.push( i );
2182                                 }
2183                         }
2184                 }
2185         }
2186
2187         return newUnmatched;
2188 }
2189
2190 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2191         if ( postFilter && !postFilter[ expando ] ) {
2192                 postFilter = setMatcher( postFilter );
2193         }
2194         if ( postFinder && !postFinder[ expando ] ) {
2195                 postFinder = setMatcher( postFinder, postSelector );
2196         }
2197         return markFunction(function( seed, results, context, xml ) {
2198                 var temp, i, elem,
2199                         preMap = [],
2200                         postMap = [],
2201                         preexisting = results.length,
2202
2203                         // Get initial elements from seed or context
2204                         elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2205
2206                         // Prefilter to get matcher input, preserving a map for seed-results synchronization
2207                         matcherIn = preFilter && ( seed || !selector ) ?
2208                                 condense( elems, preMap, preFilter, context, xml ) :
2209                                 elems,
2210
2211                         matcherOut = matcher ?
2212                                 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2213                                 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2214
2215                                         // ...intermediate processing is necessary
2216                                         [] :
2217
2218                                         // ...otherwise use results directly
2219                                         results :
2220                                 matcherIn;
2221
2222                 // Find primary matches
2223                 if ( matcher ) {
2224                         matcher( matcherIn, matcherOut, context, xml );
2225                 }
2226
2227                 // Apply postFilter
2228                 if ( postFilter ) {
2229                         temp = condense( matcherOut, postMap );
2230                         postFilter( temp, [], context, xml );
2231
2232                         // Un-match failing elements by moving them back to matcherIn
2233                         i = temp.length;
2234                         while ( i-- ) {
2235                                 if ( (elem = temp[i]) ) {
2236                                         matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2237                                 }
2238                         }
2239                 }
2240
2241                 if ( seed ) {
2242                         if ( postFinder || preFilter ) {
2243                                 if ( postFinder ) {
2244                                         // Get the final matcherOut by condensing this intermediate into postFinder contexts
2245                                         temp = [];
2246                                         i = matcherOut.length;
2247                                         while ( i-- ) {
2248                                                 if ( (elem = matcherOut[i]) ) {
2249                                                         // Restore matcherIn since elem is not yet a final match
2250                                                         temp.push( (matcherIn[i] = elem) );
2251                                                 }
2252                                         }
2253                                         postFinder( null, (matcherOut = []), temp, xml );
2254                                 }
2255
2256                                 // Move matched elements from seed to results to keep them synchronized
2257                                 i = matcherOut.length;
2258                                 while ( i-- ) {
2259                                         if ( (elem = matcherOut[i]) &&
2260                                                 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
2261
2262                                                 seed[temp] = !(results[temp] = elem);
2263                                         }
2264                                 }
2265                         }
2266
2267                 // Add elements to results, through postFinder if defined
2268                 } else {
2269                         matcherOut = condense(
2270                                 matcherOut === results ?
2271                                         matcherOut.splice( preexisting, matcherOut.length ) :
2272                                         matcherOut
2273                         );
2274                         if ( postFinder ) {
2275                                 postFinder( null, results, matcherOut, xml );
2276                         } else {
2277                                 push.apply( results, matcherOut );
2278                         }
2279                 }
2280         });
2281 }
2282
2283 function matcherFromTokens( tokens ) {
2284         var checkContext, matcher, j,
2285                 len = tokens.length,
2286                 leadingRelative = Expr.relative[ tokens[0].type ],
2287                 implicitRelative = leadingRelative || Expr.relative[" "],
2288                 i = leadingRelative ? 1 : 0,
2289
2290                 // The foundational matcher ensures that elements are reachable from top-level context(s)
2291                 matchContext = addCombinator( function( elem ) {
2292                         return elem === checkContext;
2293                 }, implicitRelative, true ),
2294                 matchAnyContext = addCombinator( function( elem ) {
2295                         return indexOf.call( checkContext, elem ) > -1;
2296                 }, implicitRelative, true ),
2297                 matchers = [ function( elem, context, xml ) {
2298                         return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2299                                 (checkContext = context).nodeType ?
2300                                         matchContext( elem, context, xml ) :
2301                                         matchAnyContext( elem, context, xml ) );
2302                 } ];
2303
2304         for ( ; i < len; i++ ) {
2305                 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2306                         matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2307                 } else {
2308                         matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2309
2310                         // Return special upon seeing a positional matcher
2311                         if ( matcher[ expando ] ) {
2312                                 // Find the next relative operator (if any) for proper handling
2313                                 j = ++i;
2314                                 for ( ; j < len; j++ ) {
2315                                         if ( Expr.relative[ tokens[j].type ] ) {
2316                                                 break;
2317                                         }
2318                                 }
2319                                 return setMatcher(
2320                                         i > 1 && elementMatcher( matchers ),
2321                                         i > 1 && toSelector(
2322                                                 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2323                                                 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2324                                         ).replace( rtrim, "$1" ),
2325                                         matcher,
2326                                         i < j && matcherFromTokens( tokens.slice( i, j ) ),
2327                                         j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2328                                         j < len && toSelector( tokens )
2329                                 );
2330                         }
2331                         matchers.push( matcher );
2332                 }
2333         }
2334
2335         return elementMatcher( matchers );
2336 }
2337
2338 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2339         var bySet = setMatchers.length > 0,
2340                 byElement = elementMatchers.length > 0,
2341                 superMatcher = function( seed, context, xml, results, outermost ) {
2342                         var elem, j, matcher,
2343                                 matchedCount = 0,
2344                                 i = "0",
2345                                 unmatched = seed && [],
2346                                 setMatched = [],
2347                                 contextBackup = outermostContext,
2348                                 // We must always have either seed elements or outermost context
2349                                 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2350                                 // Use integer dirruns iff this is the outermost matcher
2351                                 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2352                                 len = elems.length;
2353
2354                         if ( outermost ) {
2355                                 outermostContext = context !== document && context;
2356                         }
2357
2358                         // Add elements passing elementMatchers directly to results
2359                         // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2360                         // Support: IE<9, Safari
2361                         // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2362                         for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2363                                 if ( byElement && elem ) {
2364                                         j = 0;
2365                                         while ( (matcher = elementMatchers[j++]) ) {
2366                                                 if ( matcher( elem, context, xml ) ) {
2367                                                         results.push( elem );
2368                                                         break;
2369                                                 }
2370                                         }
2371                                         if ( outermost ) {
2372                                                 dirruns = dirrunsUnique;
2373                                         }
2374                                 }
2375
2376                                 // Track unmatched elements for set filters
2377                                 if ( bySet ) {
2378                                         // They will have gone through all possible matchers
2379                                         if ( (elem = !matcher && elem) ) {
2380                                                 matchedCount--;
2381                                         }
2382
2383                                         // Lengthen the array for every element, matched or not
2384                                         if ( seed ) {
2385                                                 unmatched.push( elem );
2386                                         }
2387                                 }
2388                         }
2389
2390                         // Apply set filters to unmatched elements
2391                         matchedCount += i;
2392                         if ( bySet && i !== matchedCount ) {
2393                                 j = 0;
2394                                 while ( (matcher = setMatchers[j++]) ) {
2395                                         matcher( unmatched, setMatched, context, xml );
2396                                 }
2397
2398                                 if ( seed ) {
2399                                         // Reintegrate element matches to eliminate the need for sorting
2400                                         if ( matchedCount > 0 ) {
2401                                                 while ( i-- ) {
2402                                                         if ( !(unmatched[i] || setMatched[i]) ) {
2403                                                                 setMatched[i] = pop.call( results );
2404                                                         }
2405                                                 }
2406                                         }
2407
2408                                         // Discard index placeholder values to get only actual matches
2409                                         setMatched = condense( setMatched );
2410                                 }
2411
2412                                 // Add matches to results
2413                                 push.apply( results, setMatched );
2414
2415                                 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2416                                 if ( outermost && !seed && setMatched.length > 0 &&
2417                                         ( matchedCount + setMatchers.length ) > 1 ) {
2418
2419                                         Sizzle.uniqueSort( results );
2420                                 }
2421                         }
2422
2423                         // Override manipulation of globals by nested matchers
2424                         if ( outermost ) {
2425                                 dirruns = dirrunsUnique;
2426                                 outermostContext = contextBackup;
2427                         }
2428
2429                         return unmatched;
2430                 };
2431
2432         return bySet ?
2433                 markFunction( superMatcher ) :
2434                 superMatcher;
2435 }
2436
2437 compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
2438         var i,
2439                 setMatchers = [],
2440                 elementMatchers = [],
2441                 cached = compilerCache[ selector + " " ];
2442
2443         if ( !cached ) {
2444                 // Generate a function of recursive functions that can be used to check each element
2445                 if ( !group ) {
2446                         group = tokenize( selector );
2447                 }
2448                 i = group.length;
2449                 while ( i-- ) {
2450                         cached = matcherFromTokens( group[i] );
2451                         if ( cached[ expando ] ) {
2452                                 setMatchers.push( cached );
2453                         } else {
2454                                 elementMatchers.push( cached );
2455                         }
2456                 }
2457
2458                 // Cache the compiled function
2459                 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2460         }
2461         return cached;
2462 };
2463
2464 function multipleContexts( selector, contexts, results ) {
2465         var i = 0,
2466                 len = contexts.length;
2467         for ( ; i < len; i++ ) {
2468                 Sizzle( selector, contexts[i], results );
2469         }
2470         return results;
2471 }
2472
2473 function select( selector, context, results, seed ) {
2474         var i, tokens, token, type, find,
2475                 match = tokenize( selector );
2476
2477         if ( !seed ) {
2478                 // Try to minimize operations if there is only one group
2479                 if ( match.length === 1 ) {
2480
2481                         // Take a shortcut and set the context if the root selector is an ID
2482                         tokens = match[0] = match[0].slice( 0 );
2483                         if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2484                                         support.getById && context.nodeType === 9 && documentIsHTML &&
2485                                         Expr.relative[ tokens[1].type ] ) {
2486
2487                                 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2488                                 if ( !context ) {
2489                                         return results;
2490                                 }
2491                                 selector = selector.slice( tokens.shift().value.length );
2492                         }
2493
2494                         // Fetch a seed set for right-to-left matching
2495                         i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2496                         while ( i-- ) {
2497                                 token = tokens[i];
2498
2499                                 // Abort if we hit a combinator
2500                                 if ( Expr.relative[ (type = token.type) ] ) {
2501                                         break;
2502                                 }
2503                                 if ( (find = Expr.find[ type ]) ) {
2504                                         // Search, expanding context for leading sibling combinators
2505                                         if ( (seed = find(
2506                                                 token.matches[0].replace( runescape, funescape ),
2507                                                 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2508                                         )) ) {
2509
2510                                                 // If seed is empty or no tokens remain, we can return early
2511                                                 tokens.splice( i, 1 );
2512                                                 selector = seed.length && toSelector( tokens );
2513                                                 if ( !selector ) {
2514                                                         push.apply( results, seed );
2515                                                         return results;
2516                                                 }
2517
2518                                                 break;
2519                                         }
2520                                 }
2521                         }
2522                 }
2523         }
2524
2525         // Compile and execute a filtering function
2526         // Provide `match` to avoid retokenization if we modified the selector above
2527         compile( selector, match )(
2528                 seed,
2529                 context,
2530                 !documentIsHTML,
2531                 results,
2532                 rsibling.test( selector ) && testContext( context.parentNode ) || context
2533         );
2534         return results;
2535 }
2536
2537 // One-time assignments
2538
2539 // Sort stability
2540 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2541
2542 // Support: Chrome<14
2543 // Always assume duplicates if they aren't passed to the comparison function
2544 support.detectDuplicates = !!hasDuplicate;
2545
2546 // Initialize against the default document
2547 setDocument();
2548
2549 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2550 // Detached nodes confoundingly follow *each other*
2551 support.sortDetached = assert(function( div1 ) {
2552         // Should return 1, but returns 4 (following)
2553         return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2554 });
2555
2556 // Support: IE<8
2557 // Prevent attribute/property "interpolation"
2558 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2559 if ( !assert(function( div ) {
2560         div.innerHTML = "<a href='#'></a>";
2561         return div.firstChild.getAttribute("href") === "#" ;
2562 }) ) {
2563         addHandle( "type|href|height|width", function( elem, name, isXML ) {
2564                 if ( !isXML ) {
2565                         return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2566                 }
2567         });
2568 }
2569
2570 // Support: IE<9
2571 // Use defaultValue in place of getAttribute("value")
2572 if ( !support.attributes || !assert(function( div ) {
2573         div.innerHTML = "<input/>";
2574         div.firstChild.setAttribute( "value", "" );
2575         return div.firstChild.getAttribute( "value" ) === "";
2576 }) ) {
2577         addHandle( "value", function( elem, name, isXML ) {
2578                 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2579                         return elem.defaultValue;
2580                 }
2581         });
2582 }
2583
2584 // Support: IE<9
2585 // Use getAttributeNode to fetch booleans when getAttribute lies
2586 if ( !assert(function( div ) {
2587         return div.getAttribute("disabled") == null;
2588 }) ) {
2589         addHandle( booleans, function( elem, name, isXML ) {
2590                 var val;
2591                 if ( !isXML ) {
2592                         return elem[ name ] === true ? name.toLowerCase() :
2593                                         (val = elem.getAttributeNode( name )) && val.specified ?
2594                                         val.value :
2595                                 null;
2596                 }
2597         });
2598 }
2599
2600 return Sizzle;
2601
2602 })( window );
2603
2604
2605
2606 jQuery.find = Sizzle;
2607 jQuery.expr = Sizzle.selectors;
2608 jQuery.expr[":"] = jQuery.expr.pseudos;
2609 jQuery.unique = Sizzle.uniqueSort;
2610 jQuery.text = Sizzle.getText;
2611 jQuery.isXMLDoc = Sizzle.isXML;
2612 jQuery.contains = Sizzle.contains;
2613
2614
2615
2616 var rneedsContext = jQuery.expr.match.needsContext;
2617
2618 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
2619
2620
2621
2622 var risSimple = /^.[^:#\[\.,]*$/;
2623
2624 // Implement the identical functionality for filter and not
2625 function winnow( elements, qualifier, not ) {
2626         if ( jQuery.isFunction( qualifier ) ) {
2627                 return jQuery.grep( elements, function( elem, i ) {
2628                         /* jshint -W018 */
2629                         return !!qualifier.call( elem, i, elem ) !== not;
2630                 });
2631
2632         }
2633
2634         if ( qualifier.nodeType ) {
2635                 return jQuery.grep( elements, function( elem ) {
2636                         return ( elem === qualifier ) !== not;
2637                 });
2638
2639         }
2640
2641         if ( typeof qualifier === "string" ) {
2642                 if ( risSimple.test( qualifier ) ) {
2643                         return jQuery.filter( qualifier, elements, not );
2644                 }
2645
2646                 qualifier = jQuery.filter( qualifier, elements );
2647         }
2648
2649         return jQuery.grep( elements, function( elem ) {
2650                 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
2651         });
2652 }
2653
2654 jQuery.filter = function( expr, elems, not ) {
2655         var elem = elems[ 0 ];
2656
2657         if ( not ) {
2658                 expr = ":not(" + expr + ")";
2659         }
2660
2661         return elems.length === 1 && elem.nodeType === 1 ?
2662                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2663                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2664                         return elem.nodeType === 1;
2665                 }));
2666 };
2667
2668 jQuery.fn.extend({
2669         find: function( selector ) {
2670                 var i,
2671                         ret = [],
2672                         self = this,
2673                         len = self.length;
2674
2675                 if ( typeof selector !== "string" ) {
2676                         return this.pushStack( jQuery( selector ).filter(function() {
2677                                 for ( i = 0; i < len; i++ ) {
2678                                         if ( jQuery.contains( self[ i ], this ) ) {
2679                                                 return true;
2680                                         }
2681                                 }
2682                         }) );
2683                 }
2684
2685                 for ( i = 0; i < len; i++ ) {
2686                         jQuery.find( selector, self[ i ], ret );
2687                 }
2688
2689                 // Needed because $( selector, context ) becomes $( context ).find( selector )
2690                 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2691                 ret.selector = this.selector ? this.selector + " " + selector : selector;
2692                 return ret;
2693         },
2694         filter: function( selector ) {
2695                 return this.pushStack( winnow(this, selector || [], false) );
2696         },
2697         not: function( selector ) {
2698                 return this.pushStack( winnow(this, selector || [], true) );
2699         },
2700         is: function( selector ) {
2701                 return !!winnow(
2702                         this,
2703
2704                         // If this is a positional/relative selector, check membership in the returned set
2705                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
2706                         typeof selector === "string" && rneedsContext.test( selector ) ?
2707                                 jQuery( selector ) :
2708                                 selector || [],
2709                         false
2710                 ).length;
2711         }
2712 });
2713
2714
2715 // Initialize a jQuery object
2716
2717
2718 // A central reference to the root jQuery(document)
2719 var rootjQuery,
2720
2721         // Use the correct document accordingly with window argument (sandbox)
2722         document = window.document,
2723
2724         // A simple way to check for HTML strings
2725         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2726         // Strict HTML recognition (#11290: must start with <)
2727         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2728
2729         init = jQuery.fn.init = function( selector, context ) {
2730                 var match, elem;
2731
2732                 // HANDLE: $(""), $(null), $(undefined), $(false)
2733                 if ( !selector ) {
2734                         return this;
2735                 }
2736
2737                 // Handle HTML strings
2738                 if ( typeof selector === "string" ) {
2739                         if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
2740                                 // Assume that strings that start and end with <> are HTML and skip the regex check
2741                                 match = [ null, selector, null ];
2742
2743                         } else {
2744                                 match = rquickExpr.exec( selector );
2745                         }
2746
2747                         // Match html or make sure no context is specified for #id
2748                         if ( match && (match[1] || !context) ) {
2749
2750                                 // HANDLE: $(html) -> $(array)
2751                                 if ( match[1] ) {
2752                                         context = context instanceof jQuery ? context[0] : context;
2753
2754                                         // scripts is true for back-compat
2755                                         // Intentionally let the error be thrown if parseHTML is not present
2756                                         jQuery.merge( this, jQuery.parseHTML(
2757                                                 match[1],
2758                                                 context && context.nodeType ? context.ownerDocument || context : document,
2759                                                 true
2760                                         ) );
2761
2762                                         // HANDLE: $(html, props)
2763                                         if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
2764                                                 for ( match in context ) {
2765                                                         // Properties of context are called as methods if possible
2766                                                         if ( jQuery.isFunction( this[ match ] ) ) {
2767                                                                 this[ match ]( context[ match ] );
2768
2769                                                         // ...and otherwise set as attributes
2770                                                         } else {
2771                                                                 this.attr( match, context[ match ] );
2772                                                         }
2773                                                 }
2774                                         }
2775
2776                                         return this;
2777
2778                                 // HANDLE: $(#id)
2779                                 } else {
2780                                         elem = document.getElementById( match[2] );
2781
2782                                         // Check parentNode to catch when Blackberry 4.6 returns
2783                                         // nodes that are no longer in the document #6963
2784                                         if ( elem && elem.parentNode ) {
2785                                                 // Handle the case where IE and Opera return items
2786                                                 // by name instead of ID
2787                                                 if ( elem.id !== match[2] ) {
2788                                                         return rootjQuery.find( selector );
2789                                                 }
2790
2791                                                 // Otherwise, we inject the element directly into the jQuery object
2792                                                 this.length = 1;
2793                                                 this[0] = elem;
2794                                         }
2795
2796                                         this.context = document;
2797                                         this.selector = selector;
2798                                         return this;
2799                                 }
2800
2801                         // HANDLE: $(expr, $(...))
2802                         } else if ( !context || context.jquery ) {
2803                                 return ( context || rootjQuery ).find( selector );
2804
2805                         // HANDLE: $(expr, context)
2806                         // (which is just equivalent to: $(context).find(expr)
2807                         } else {
2808                                 return this.constructor( context ).find( selector );
2809                         }
2810
2811                 // HANDLE: $(DOMElement)
2812                 } else if ( selector.nodeType ) {
2813                         this.context = this[0] = selector;
2814                         this.length = 1;
2815                         return this;
2816
2817                 // HANDLE: $(function)
2818                 // Shortcut for document ready
2819                 } else if ( jQuery.isFunction( selector ) ) {
2820                         return typeof rootjQuery.ready !== "undefined" ?
2821                                 rootjQuery.ready( selector ) :
2822                                 // Execute immediately if ready is not present
2823                                 selector( jQuery );
2824                 }
2825
2826                 if ( selector.selector !== undefined ) {
2827                         this.selector = selector.selector;
2828                         this.context = selector.context;
2829                 }
2830
2831                 return jQuery.makeArray( selector, this );
2832         };
2833
2834 // Give the init function the jQuery prototype for later instantiation
2835 init.prototype = jQuery.fn;
2836
2837 // Initialize central reference
2838 rootjQuery = jQuery( document );
2839
2840
2841 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2842         // methods guaranteed to produce a unique set when starting from a unique set
2843         guaranteedUnique = {
2844                 children: true,
2845                 contents: true,
2846                 next: true,
2847                 prev: true
2848         };
2849
2850 jQuery.extend({
2851         dir: function( elem, dir, until ) {
2852                 var matched = [],
2853                         cur = elem[ dir ];
2854
2855                 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
2856                         if ( cur.nodeType === 1 ) {
2857                                 matched.push( cur );
2858                         }
2859                         cur = cur[dir];
2860                 }
2861                 return matched;
2862         },
2863
2864         sibling: function( n, elem ) {
2865                 var r = [];
2866
2867                 for ( ; n; n = n.nextSibling ) {
2868                         if ( n.nodeType === 1 && n !== elem ) {
2869                                 r.push( n );
2870                         }
2871                 }
2872
2873                 return r;
2874         }
2875 });
2876
2877 jQuery.fn.extend({
2878         has: function( target ) {
2879                 var i,
2880                         targets = jQuery( target, this ),
2881                         len = targets.length;
2882
2883                 return this.filter(function() {
2884                         for ( i = 0; i < len; i++ ) {
2885                                 if ( jQuery.contains( this, targets[i] ) ) {
2886                                         return true;
2887                                 }
2888                         }
2889                 });
2890         },
2891
2892         closest: function( selectors, context ) {
2893                 var cur,
2894                         i = 0,
2895                         l = this.length,
2896                         matched = [],
2897                         pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
2898                                 jQuery( selectors, context || this.context ) :
2899                                 0;
2900
2901                 for ( ; i < l; i++ ) {
2902                         for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
2903                                 // Always skip document fragments
2904                                 if ( cur.nodeType < 11 && (pos ?
2905                                         pos.index(cur) > -1 :
2906
2907                                         // Don't pass non-elements to Sizzle
2908                                         cur.nodeType === 1 &&
2909                                                 jQuery.find.matchesSelector(cur, selectors)) ) {
2910
2911                                         matched.push( cur );
2912                                         break;
2913                                 }
2914                         }
2915                 }
2916
2917                 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
2918         },
2919
2920         // Determine the position of an element within
2921         // the matched set of elements
2922         index: function( elem ) {
2923
2924                 // No argument, return index in parent
2925                 if ( !elem ) {
2926                         return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
2927                 }
2928
2929                 // index in selector
2930                 if ( typeof elem === "string" ) {
2931                         return jQuery.inArray( this[0], jQuery( elem ) );
2932                 }
2933
2934                 // Locate the position of the desired element
2935                 return jQuery.inArray(
2936                         // If it receives a jQuery object, the first element is used
2937                         elem.jquery ? elem[0] : elem, this );
2938         },
2939
2940         add: function( selector, context ) {
2941                 return this.pushStack(
2942                         jQuery.unique(
2943                                 jQuery.merge( this.get(), jQuery( selector, context ) )
2944                         )
2945                 );
2946         },
2947
2948         addBack: function( selector ) {
2949                 return this.add( selector == null ?
2950                         this.prevObject : this.prevObject.filter(selector)
2951                 );
2952         }
2953 });
2954
2955 function sibling( cur, dir ) {
2956         do {
2957                 cur = cur[ dir ];
2958         } while ( cur && cur.nodeType !== 1 );
2959
2960         return cur;
2961 }
2962
2963 jQuery.each({
2964         parent: function( elem ) {
2965                 var parent = elem.parentNode;
2966                 return parent && parent.nodeType !== 11 ? parent : null;
2967         },
2968         parents: function( elem ) {
2969                 return jQuery.dir( elem, "parentNode" );
2970         },
2971         parentsUntil: function( elem, i, until ) {
2972                 return jQuery.dir( elem, "parentNode", until );
2973         },
2974         next: function( elem ) {
2975                 return sibling( elem, "nextSibling" );
2976         },
2977         prev: function( elem ) {
2978                 return sibling( elem, "previousSibling" );
2979         },
2980         nextAll: function( elem ) {
2981                 return jQuery.dir( elem, "nextSibling" );
2982         },
2983         prevAll: function( elem ) {
2984                 return jQuery.dir( elem, "previousSibling" );
2985         },
2986         nextUntil: function( elem, i, until ) {
2987                 return jQuery.dir( elem, "nextSibling", until );
2988         },
2989         prevUntil: function( elem, i, until ) {
2990                 return jQuery.dir( elem, "previousSibling", until );
2991         },
2992         siblings: function( elem ) {
2993                 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
2994         },
2995         children: function( elem ) {
2996                 return jQuery.sibling( elem.firstChild );
2997         },
2998         contents: function( elem ) {
2999                 return jQuery.nodeName( elem, "iframe" ) ?
3000                         elem.contentDocument || elem.contentWindow.document :
3001                         jQuery.merge( [], elem.childNodes );
3002         }
3003 }, function( name, fn ) {
3004         jQuery.fn[ name ] = function( until, selector ) {
3005                 var ret = jQuery.map( this, fn, until );
3006
3007                 if ( name.slice( -5 ) !== "Until" ) {
3008                         selector = until;
3009                 }
3010
3011                 if ( selector && typeof selector === "string" ) {
3012                         ret = jQuery.filter( selector, ret );
3013                 }
3014
3015                 if ( this.length > 1 ) {
3016                         // Remove duplicates
3017                         if ( !guaranteedUnique[ name ] ) {
3018                                 ret = jQuery.unique( ret );
3019                         }
3020
3021                         // Reverse order for parents* and prev-derivatives
3022                         if ( rparentsprev.test( name ) ) {
3023                                 ret = ret.reverse();
3024                         }
3025                 }
3026
3027                 return this.pushStack( ret );
3028         };
3029 });
3030 var rnotwhite = (/\S+/g);
3031
3032
3033
3034 // String to Object options format cache
3035 var optionsCache = {};
3036
3037 // Convert String-formatted options into Object-formatted ones and store in cache
3038 function createOptions( options ) {
3039         var object = optionsCache[ options ] = {};
3040         jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
3041                 object[ flag ] = true;
3042         });
3043         return object;
3044 }
3045
3046 /*
3047  * Create a callback list using the following parameters:
3048  *
3049  *      options: an optional list of space-separated options that will change how
3050  *                      the callback list behaves or a more traditional option object
3051  *
3052  * By default a callback list will act like an event callback list and can be
3053  * "fired" multiple times.
3054  *
3055  * Possible options:
3056  *
3057  *      once:                   will ensure the callback list can only be fired once (like a Deferred)
3058  *
3059  *      memory:                 will keep track of previous values and will call any callback added
3060  *                                      after the list has been fired right away with the latest "memorized"
3061  *                                      values (like a Deferred)
3062  *
3063  *      unique:                 will ensure a callback can only be added once (no duplicate in the list)
3064  *
3065  *      stopOnFalse:    interrupt callings when a callback returns false
3066  *
3067  */
3068 jQuery.Callbacks = function( options ) {
3069
3070         // Convert options from String-formatted to Object-formatted if needed
3071         // (we check in cache first)
3072         options = typeof options === "string" ?
3073                 ( optionsCache[ options ] || createOptions( options ) ) :
3074                 jQuery.extend( {}, options );
3075
3076         var // Flag to know if list is currently firing
3077                 firing,
3078                 // Last fire value (for non-forgettable lists)
3079                 memory,
3080                 // Flag to know if list was already fired
3081                 fired,
3082                 // End of the loop when firing
3083                 firingLength,
3084                 // Index of currently firing callback (modified by remove if needed)
3085                 firingIndex,
3086                 // First callback to fire (used internally by add and fireWith)
3087                 firingStart,
3088                 // Actual callback list
3089                 list = [],
3090                 // Stack of fire calls for repeatable lists
3091                 stack = !options.once && [],
3092                 // Fire callbacks
3093                 fire = function( data ) {
3094                         memory = options.memory && data;
3095                         fired = true;
3096                         firingIndex = firingStart || 0;
3097                         firingStart = 0;
3098                         firingLength = list.length;
3099                         firing = true;
3100                         for ( ; list && firingIndex < firingLength; firingIndex++ ) {
3101                                 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
3102                                         memory = false; // To prevent further calls using add
3103                                         break;
3104                                 }
3105                         }
3106                         firing = false;
3107                         if ( list ) {
3108                                 if ( stack ) {
3109                                         if ( stack.length ) {
3110                                                 fire( stack.shift() );
3111                                         }
3112                                 } else if ( memory ) {
3113                                         list = [];
3114                                 } else {
3115                                         self.disable();
3116                                 }
3117                         }
3118                 },
3119                 // Actual Callbacks object
3120                 self = {
3121                         // Add a callback or a collection of callbacks to the list
3122                         add: function() {
3123                                 if ( list ) {
3124                                         // First, we save the current length
3125                                         var start = list.length;
3126                                         (function add( args ) {
3127                                                 jQuery.each( args, function( _, arg ) {
3128                                                         var type = jQuery.type( arg );
3129                                                         if ( type === "function" ) {
3130                                                                 if ( !options.unique || !self.has( arg ) ) {
3131                                                                         list.push( arg );
3132                                                                 }
3133                                                         } else if ( arg && arg.length && type !== "string" ) {
3134                                                                 // Inspect recursively
3135                                                                 add( arg );
3136                                                         }
3137                                                 });
3138                                         })( arguments );
3139                                         // Do we need to add the callbacks to the
3140                                         // current firing batch?
3141                                         if ( firing ) {
3142                                                 firingLength = list.length;
3143                                         // With memory, if we're not firing then
3144                                         // we should call right away
3145                                         } else if ( memory ) {
3146                                                 firingStart = start;
3147                                                 fire( memory );
3148                                         }
3149                                 }
3150                                 return this;
3151                         },
3152                         // Remove a callback from the list
3153                         remove: function() {
3154                                 if ( list ) {
3155                                         jQuery.each( arguments, function( _, arg ) {
3156                                                 var index;
3157                                                 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3158                                                         list.splice( index, 1 );
3159                                                         // Handle firing indexes
3160                                                         if ( firing ) {
3161                                                                 if ( index <= firingLength ) {
3162                                                                         firingLength--;
3163                                                                 }
3164                                                                 if ( index <= firingIndex ) {
3165                                                                         firingIndex--;
3166                                                                 }
3167                                                         }
3168                                                 }
3169                                         });
3170                                 }
3171                                 return this;
3172                         },
3173                         // Check if a given callback is in the list.
3174                         // If no argument is given, return whether or not list has callbacks attached.
3175                         has: function( fn ) {
3176                                 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
3177                         },
3178                         // Remove all callbacks from the list
3179                         empty: function() {
3180                                 list = [];
3181                                 firingLength = 0;
3182                                 return this;
3183                         },
3184                         // Have the list do nothing anymore
3185                         disable: function() {
3186                                 list = stack = memory = undefined;
3187                                 return this;
3188                         },
3189                         // Is it disabled?
3190                         disabled: function() {
3191                                 return !list;
3192                         },
3193                         // Lock the list in its current state
3194                         lock: function() {
3195                                 stack = undefined;
3196                                 if ( !memory ) {
3197                                         self.disable();
3198                                 }
3199                                 return this;
3200                         },
3201                         // Is it locked?
3202                         locked: function() {
3203                                 return !stack;
3204                         },
3205                         // Call all callbacks with the given context and arguments
3206                         fireWith: function( context, args ) {
3207                                 if ( list && ( !fired || stack ) ) {
3208                                         args = args || [];
3209                                         args = [ context, args.slice ? args.slice() : args ];
3210                                         if ( firing ) {
3211                                                 stack.push( args );
3212                                         } else {
3213                                                 fire( args );
3214                                         }
3215                                 }
3216                                 return this;
3217                         },
3218                         // Call all the callbacks with the given arguments
3219                         fire: function() {
3220                                 self.fireWith( this, arguments );
3221                                 return this;
3222                         },
3223                         // To know if the callbacks have already been called at least once
3224                         fired: function() {
3225                                 return !!fired;
3226                         }
3227                 };
3228
3229         return self;
3230 };
3231
3232
3233 jQuery.extend({
3234
3235         Deferred: function( func ) {
3236                 var tuples = [
3237                                 // action, add listener, listener list, final state
3238                                 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
3239                                 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
3240                                 [ "notify", "progress", jQuery.Callbacks("memory") ]
3241                         ],
3242                         state = "pending",
3243                         promise = {
3244                                 state: function() {
3245                                         return state;
3246                                 },
3247                                 always: function() {
3248                                         deferred.done( arguments ).fail( arguments );
3249                                         return this;
3250                                 },
3251                                 then: function( /* fnDone, fnFail, fnProgress */ ) {
3252                                         var fns = arguments;
3253                                         return jQuery.Deferred(function( newDefer ) {
3254                                                 jQuery.each( tuples, function( i, tuple ) {
3255                                                         var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
3256                                                         // deferred[ done | fail | progress ] for forwarding actions to newDefer
3257                                                         deferred[ tuple[1] ](function() {
3258                                                                 var returned = fn && fn.apply( this, arguments );
3259                                                                 if ( returned && jQuery.isFunction( returned.promise ) ) {
3260                                                                         returned.promise()
3261                                                                                 .done( newDefer.resolve )
3262                                                                                 .fail( newDefer.reject )
3263                                                                                 .progress( newDefer.notify );
3264                                                                 } else {
3265                                                                         newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
3266                                                                 }
3267                                                         });
3268                                                 });
3269                                                 fns = null;
3270                                         }).promise();
3271                                 },
3272                                 // Get a promise for this deferred
3273                                 // If obj is provided, the promise aspect is added to the object
3274                                 promise: function( obj ) {
3275                                         return obj != null ? jQuery.extend( obj, promise ) : promise;
3276                                 }
3277                         },
3278                         deferred = {};
3279
3280                 // Keep pipe for back-compat
3281                 promise.pipe = promise.then;
3282
3283                 // Add list-specific methods
3284                 jQuery.each( tuples, function( i, tuple ) {
3285                         var list = tuple[ 2 ],
3286                                 stateString = tuple[ 3 ];
3287
3288                         // promise[ done | fail | progress ] = list.add
3289                         promise[ tuple[1] ] = list.add;
3290
3291                         // Handle state
3292                         if ( stateString ) {
3293                                 list.add(function() {
3294                                         // state = [ resolved | rejected ]
3295                                         state = stateString;
3296
3297                                 // [ reject_list | resolve_list ].disable; progress_list.lock
3298                                 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
3299                         }
3300
3301                         // deferred[ resolve | reject | notify ]
3302                         deferred[ tuple[0] ] = function() {
3303                                 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
3304                                 return this;
3305                         };
3306                         deferred[ tuple[0] + "With" ] = list.fireWith;
3307                 });
3308
3309                 // Make the deferred a promise
3310                 promise.promise( deferred );
3311
3312                 // Call given func if any
3313                 if ( func ) {
3314                         func.call( deferred, deferred );
3315                 }
3316
3317                 // All done!
3318                 return deferred;
3319         },
3320
3321         // Deferred helper
3322         when: function( subordinate /* , ..., subordinateN */ ) {
3323                 var i = 0,
3324                         resolveValues = slice.call( arguments ),
3325                         length = resolveValues.length,
3326
3327                         // the count of uncompleted subordinates
3328                         remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
3329
3330                         // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
3331                         deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
3332
3333                         // Update function for both resolve and progress values
3334                         updateFunc = function( i, contexts, values ) {
3335                                 return function( value ) {
3336                                         contexts[ i ] = this;
3337                                         values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3338                                         if ( values === progressValues ) {
3339                                                 deferred.notifyWith( contexts, values );
3340
3341                                         } else if ( !(--remaining) ) {
3342                                                 deferred.resolveWith( contexts, values );
3343                                         }
3344                                 };
3345                         },
3346
3347                         progressValues, progressContexts, resolveContexts;
3348
3349                 // add listeners to Deferred subordinates; treat others as resolved
3350                 if ( length > 1 ) {
3351                         progressValues = new Array( length );
3352                         progressContexts = new Array( length );
3353                         resolveContexts = new Array( length );
3354                         for ( ; i < length; i++ ) {
3355                                 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
3356                                         resolveValues[ i ].promise()
3357                                                 .done( updateFunc( i, resolveContexts, resolveValues ) )
3358                                                 .fail( deferred.reject )
3359                                                 .progress( updateFunc( i, progressContexts, progressValues ) );
3360                                 } else {
3361                                         --remaining;
3362                                 }
3363                         }
3364                 }
3365
3366                 // if we're not waiting on anything, resolve the master
3367                 if ( !remaining ) {
3368                         deferred.resolveWith( resolveContexts, resolveValues );
3369                 }
3370
3371                 return deferred.promise();
3372         }
3373 });
3374
3375
3376 // The deferred used on DOM ready
3377 var readyList;
3378
3379 jQuery.fn.ready = function( fn ) {
3380         // Add the callback
3381         jQuery.ready.promise().done( fn );
3382
3383         return this;
3384 };
3385
3386 jQuery.extend({
3387         // Is the DOM ready to be used? Set to true once it occurs.
3388         isReady: false,
3389
3390         // A counter to track how many items to wait for before
3391         // the ready event fires. See #6781
3392         readyWait: 1,
3393
3394         // Hold (or release) the ready event
3395         holdReady: function( hold ) {
3396                 if ( hold ) {
3397                         jQuery.readyWait++;
3398                 } else {
3399                         jQuery.ready( true );
3400                 }
3401         },
3402
3403         // Handle when the DOM is ready
3404         ready: function( wait ) {
3405
3406                 // Abort if there are pending holds or we're already ready
3407                 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3408                         return;
3409                 }
3410
3411                 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
3412                 if ( !document.body ) {
3413                         return setTimeout( jQuery.ready );
3414                 }
3415
3416                 // Remember that the DOM is ready
3417                 jQuery.isReady = true;
3418
3419                 // If a normal DOM Ready event fired, decrement, and wait if need be
3420                 if ( wait !== true && --jQuery.readyWait > 0 ) {
3421                         return;
3422                 }
3423
3424                 // If there are functions bound, to execute
3425                 readyList.resolveWith( document, [ jQuery ] );
3426
3427                 // Trigger any bound ready events
3428                 if ( jQuery.fn.trigger ) {
3429                         jQuery( document ).trigger("ready").off("ready");
3430                 }
3431         }
3432 });
3433
3434 /**
3435  * Clean-up method for dom ready events
3436  */
3437 function detach() {
3438         if ( document.addEventListener ) {
3439                 document.removeEventListener( "DOMContentLoaded", completed, false );
3440                 window.removeEventListener( "load", completed, false );
3441
3442         } else {
3443                 document.detachEvent( "onreadystatechange", completed );
3444                 window.detachEvent( "onload", completed );
3445         }
3446 }
3447
3448 /**
3449  * The ready event handler and self cleanup method
3450  */
3451 function completed() {
3452         // readyState === "complete" is good enough for us to call the dom ready in oldIE
3453         if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
3454                 detach();
3455                 jQuery.ready();
3456         }
3457 }
3458
3459 jQuery.ready.promise = function( obj ) {
3460         if ( !readyList ) {
3461
3462                 readyList = jQuery.Deferred();
3463
3464                 // Catch cases where $(document).ready() is called after the browser event has already occurred.
3465                 // we once tried to use readyState "interactive" here, but it caused issues like the one
3466                 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
3467                 if ( document.readyState === "complete" ) {
3468                         // Handle it asynchronously to allow scripts the opportunity to delay ready
3469                         setTimeout( jQuery.ready );
3470
3471                 // Standards-based browsers support DOMContentLoaded
3472                 } else if ( document.addEventListener ) {
3473                         // Use the handy event callback
3474                         document.addEventListener( "DOMContentLoaded", completed, false );
3475
3476                         // A fallback to window.onload, that will always work
3477                         window.addEventListener( "load", completed, false );
3478
3479                 // If IE event model is used
3480                 } else {
3481                         // Ensure firing before onload, maybe late but safe also for iframes
3482                         document.attachEvent( "onreadystatechange", completed );
3483
3484                         // A fallback to window.onload, that will always work
3485                         window.attachEvent( "onload", completed );
3486
3487                         // If IE and not a frame
3488                         // continually check to see if the document is ready
3489                         var top = false;
3490
3491                         try {
3492                                 top = window.frameElement == null && document.documentElement;
3493                         } catch(e) {}
3494
3495                         if ( top && top.doScroll ) {
3496                                 (function doScrollCheck() {
3497                                         if ( !jQuery.isReady ) {
3498
3499                                                 try {
3500                                                         // Use the trick by Diego Perini
3501                                                         // http://javascript.nwbox.com/IEContentLoaded/
3502                                                         top.doScroll("left");
3503                                                 } catch(e) {
3504                                                         return setTimeout( doScrollCheck, 50 );
3505                                                 }
3506
3507                                                 // detach all dom ready events
3508                                                 detach();
3509
3510                                                 // and execute any waiting functions
3511                                                 jQuery.ready();
3512                                         }
3513                                 })();
3514                         }
3515                 }
3516         }
3517         return readyList.promise( obj );
3518 };
3519
3520
3521 var strundefined = typeof undefined;
3522
3523
3524
3525 // Support: IE<9
3526 // Iteration over object's inherited properties before its own
3527 var i;
3528 for ( i in jQuery( support ) ) {
3529         break;
3530 }
3531 support.ownLast = i !== "0";
3532
3533 // Note: most support tests are defined in their respective modules.
3534 // false until the test is run
3535 support.inlineBlockNeedsLayout = false;
3536
3537 jQuery(function() {
3538         // We need to execute this one support test ASAP because we need to know
3539         // if body.style.zoom needs to be set.
3540
3541         var container, div,
3542                 body = document.getElementsByTagName("body")[0];
3543
3544         if ( !body ) {
3545                 // Return for frameset docs that don't have a body
3546                 return;
3547         }
3548
3549         // Setup
3550         container = document.createElement( "div" );
3551         container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
3552
3553         div = document.createElement( "div" );
3554         body.appendChild( container ).appendChild( div );
3555
3556         if ( typeof div.style.zoom !== strundefined ) {
3557                 // Support: IE<8
3558                 // Check if natively block-level elements act like inline-block
3559                 // elements when setting their display to 'inline' and giving
3560                 // them layout
3561                 div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1";
3562
3563                 if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) {
3564                         // Prevent IE 6 from affecting layout for positioned elements #11048
3565                         // Prevent IE from shrinking the body in IE 7 mode #12869
3566                         // Support: IE<8
3567                         body.style.zoom = 1;
3568                 }
3569         }
3570
3571         body.removeChild( container );
3572
3573         // Null elements to avoid leaks in IE
3574         container = div = null;
3575 });
3576
3577
3578
3579
3580 (function() {
3581         var div = document.createElement( "div" );
3582
3583         // Execute the test only if not already executed in another module.
3584         if (support.deleteExpando == null) {
3585                 // Support: IE<9
3586                 support.deleteExpando = true;
3587                 try {
3588                         delete div.test;
3589                 } catch( e ) {
3590                         support.deleteExpando = false;
3591                 }
3592         }
3593
3594         // Null elements to avoid leaks in IE.
3595         div = null;
3596 })();
3597
3598
3599 /**
3600  * Determines whether an object can have data
3601  */
3602 jQuery.acceptData = function( elem ) {
3603         var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ],
3604                 nodeType = +elem.nodeType || 1;
3605
3606         // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
3607         return nodeType !== 1 && nodeType !== 9 ?
3608                 false :
3609
3610                 // Nodes accept data unless otherwise specified; rejection can be conditional
3611                 !noData || noData !== true && elem.getAttribute("classid") === noData;
3612 };
3613
3614
3615 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
3616         rmultiDash = /([A-Z])/g;
3617
3618 function dataAttr( elem, key, data ) {
3619         // If nothing was found internally, try to fetch any
3620         // data from the HTML5 data-* attribute
3621         if ( data === undefined && elem.nodeType === 1 ) {
3622
3623                 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
3624
3625                 data = elem.getAttribute( name );
3626
3627                 if ( typeof data === "string" ) {
3628                         try {
3629                                 data = data === "true" ? true :
3630                                         data === "false" ? false :
3631                                         data === "null" ? null :
3632                                         // Only convert to a number if it doesn't change the string
3633                                         +data + "" === data ? +data :
3634                                         rbrace.test( data ) ? jQuery.parseJSON( data ) :
3635                                         data;
3636                         } catch( e ) {}
3637
3638                         // Make sure we set the data so it isn't changed later
3639                         jQuery.data( elem, key, data );
3640
3641                 } else {
3642                         data = undefined;
3643                 }
3644         }
3645
3646         return data;
3647 }
3648
3649 // checks a cache object for emptiness
3650 function isEmptyDataObject( obj ) {
3651         var name;
3652         for ( name in obj ) {
3653
3654                 // if the public data object is empty, the private is still empty
3655                 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
3656                         continue;
3657                 }
3658                 if ( name !== "toJSON" ) {
3659                         return false;
3660                 }
3661         }
3662
3663         return true;
3664 }
3665
3666 function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
3667         if ( !jQuery.acceptData( elem ) ) {
3668                 return;
3669         }
3670
3671         var ret, thisCache,
3672                 internalKey = jQuery.expando,
3673
3674                 // We have to handle DOM nodes and JS objects differently because IE6-7
3675                 // can't GC object references properly across the DOM-JS boundary
3676                 isNode = elem.nodeType,
3677
3678                 // Only DOM nodes need the global jQuery cache; JS object data is
3679                 // attached directly to the object so GC can occur automatically
3680                 cache = isNode ? jQuery.cache : elem,
3681
3682                 // Only defining an ID for JS objects if its cache already exists allows
3683                 // the code to shortcut on the same path as a DOM node with no cache
3684                 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
3685
3686         // Avoid doing any more work than we need to when trying to get data on an
3687         // object that has no data at all
3688         if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
3689                 return;
3690         }
3691
3692         if ( !id ) {
3693                 // Only DOM nodes need a new unique ID for each element since their data
3694                 // ends up in the global cache
3695                 if ( isNode ) {
3696                         id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
3697                 } else {
3698                         id = internalKey;
3699                 }
3700         }
3701
3702         if ( !cache[ id ] ) {
3703                 // Avoid exposing jQuery metadata on plain JS objects when the object
3704                 // is serialized using JSON.stringify
3705                 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
3706         }
3707
3708         // An object can be passed to jQuery.data instead of a key/value pair; this gets
3709         // shallow copied over onto the existing cache
3710         if ( typeof name === "object" || typeof name === "function" ) {
3711                 if ( pvt ) {
3712                         cache[ id ] = jQuery.extend( cache[ id ], name );
3713                 } else {
3714                         cache[ id ].data = jQuery.extend( cache[ id ].data, name );
3715                 }
3716         }
3717
3718         thisCache = cache[ id ];
3719
3720         // jQuery data() is stored in a separate object inside the object's internal data
3721         // cache in order to avoid key collisions between internal data and user-defined
3722         // data.
3723         if ( !pvt ) {
3724                 if ( !thisCache.data ) {
3725                         thisCache.data = {};
3726                 }
3727
3728                 thisCache = thisCache.data;
3729         }
3730
3731         if ( data !== undefined ) {
3732                 thisCache[ jQuery.camelCase( name ) ] = data;
3733         }
3734
3735         // Check for both converted-to-camel and non-converted data property names
3736         // If a data property was specified
3737         if ( typeof name === "string" ) {
3738
3739                 // First Try to find as-is property data
3740                 ret = thisCache[ name ];
3741
3742                 // Test for null|undefined property data
3743                 if ( ret == null ) {
3744
3745                         // Try to find the camelCased property
3746                         ret = thisCache[ jQuery.camelCase( name ) ];
3747                 }
3748         } else {
3749                 ret = thisCache;
3750         }
3751
3752         return ret;
3753 }
3754
3755 function internalRemoveData( elem, name, pvt ) {
3756         if ( !jQuery.acceptData( elem ) ) {
3757                 return;
3758         }
3759
3760         var thisCache, i,
3761                 isNode = elem.nodeType,
3762
3763                 // See jQuery.data for more information
3764                 cache = isNode ? jQuery.cache : elem,
3765                 id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
3766
3767         // If there is already no cache entry for this object, there is no
3768         // purpose in continuing
3769         if ( !cache[ id ] ) {
3770                 return;
3771         }
3772
3773         if ( name ) {
3774
3775                 thisCache = pvt ? cache[ id ] : cache[ id ].data;
3776
3777                 if ( thisCache ) {
3778
3779                         // Support array or space separated string names for data keys
3780                         if ( !jQuery.isArray( name ) ) {
3781
3782                                 // try the string as a key before any manipulation
3783                                 if ( name in thisCache ) {
3784                                         name = [ name ];
3785                                 } else {
3786
3787                                         // split the camel cased version by spaces unless a key with the spaces exists
3788                                         name = jQuery.camelCase( name );
3789                                         if ( name in thisCache ) {
3790                                                 name = [ name ];
3791                                         } else {
3792                                                 name = name.split(" ");
3793                                         }
3794                                 }
3795                         } else {
3796                                 // If "name" is an array of keys...
3797                                 // When data is initially created, via ("key", "val") signature,
3798                                 // keys will be converted to camelCase.
3799                                 // Since there is no way to tell _how_ a key was added, remove
3800                                 // both plain key and camelCase key. #12786
3801                                 // This will only penalize the array argument path.
3802                                 name = name.concat( jQuery.map( name, jQuery.camelCase ) );
3803                         }
3804
3805                         i = name.length;
3806                         while ( i-- ) {
3807                                 delete thisCache[ name[i] ];
3808                         }
3809
3810                         // If there is no data left in the cache, we want to continue
3811                         // and let the cache object itself get destroyed
3812                         if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
3813                                 return;
3814                         }
3815                 }
3816         }
3817
3818         // See jQuery.data for more information
3819         if ( !pvt ) {
3820                 delete cache[ id ].data;
3821
3822                 // Don't destroy the parent cache unless the internal data object
3823                 // had been the only thing left in it
3824                 if ( !isEmptyDataObject( cache[ id ] ) ) {
3825                         return;
3826                 }
3827         }
3828
3829         // Destroy the cache
3830         if ( isNode ) {
3831                 jQuery.cleanData( [ elem ], true );
3832
3833         // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
3834         /* jshint eqeqeq: false */
3835         } else if ( support.deleteExpando || cache != cache.window ) {
3836                 /* jshint eqeqeq: true */
3837                 delete cache[ id ];
3838
3839         // When all else fails, null
3840         } else {
3841                 cache[ id ] = null;
3842         }
3843 }
3844
3845 jQuery.extend({
3846         cache: {},
3847
3848         // The following elements (space-suffixed to avoid Object.prototype collisions)
3849         // throw uncatchable exceptions if you attempt to set expando properties
3850         noData: {
3851                 "applet ": true,
3852                 "embed ": true,
3853                 // ...but Flash objects (which have this classid) *can* handle expandos
3854                 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
3855         },
3856
3857         hasData: function( elem ) {
3858                 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
3859                 return !!elem && !isEmptyDataObject( elem );
3860         },
3861
3862         data: function( elem, name, data ) {
3863                 return internalData( elem, name, data );
3864         },
3865
3866         removeData: function( elem, name ) {
3867                 return internalRemoveData( elem, name );
3868         },
3869
3870         // For internal use only.
3871         _data: function( elem, name, data ) {
3872                 return internalData( elem, name, data, true );
3873         },
3874
3875         _removeData: function( elem, name ) {
3876                 return internalRemoveData( elem, name, true );
3877         }
3878 });
3879
3880 jQuery.fn.extend({
3881         data: function( key, value ) {
3882                 var i, name, data,
3883                         elem = this[0],
3884                         attrs = elem && elem.attributes;
3885
3886                 // Special expections of .data basically thwart jQuery.access,
3887                 // so implement the relevant behavior ourselves
3888
3889                 // Gets all values
3890                 if ( key === undefined ) {
3891                         if ( this.length ) {
3892                                 data = jQuery.data( elem );
3893
3894                                 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
3895                                         i = attrs.length;
3896                                         while ( i-- ) {
3897                                                 name = attrs[i].name;
3898
3899                                                 if ( name.indexOf("data-") === 0 ) {
3900                                                         name = jQuery.camelCase( name.slice(5) );
3901
3902                                                         dataAttr( elem, name, data[ name ] );
3903                                                 }
3904                                         }
3905                                         jQuery._data( elem, "parsedAttrs", true );
3906                                 }
3907                         }
3908
3909                         return data;
3910                 }
3911
3912                 // Sets multiple values
3913                 if ( typeof key === "object" ) {
3914                         return this.each(function() {
3915                                 jQuery.data( this, key );
3916                         });
3917                 }
3918
3919                 return arguments.length > 1 ?
3920
3921                         // Sets one value
3922                         this.each(function() {
3923                                 jQuery.data( this, key, value );
3924                         }) :
3925
3926                         // Gets one value
3927                         // Try to fetch any internally stored data first
3928                         elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
3929         },
3930
3931         removeData: function( key ) {
3932                 return this.each(function() {
3933                         jQuery.removeData( this, key );
3934                 });
3935         }
3936 });
3937
3938
3939 jQuery.extend({
3940         queue: function( elem, type, data ) {
3941                 var queue;
3942
3943                 if ( elem ) {
3944                         type = ( type || "fx" ) + "queue";
3945                         queue = jQuery._data( elem, type );
3946
3947                         // Speed up dequeue by getting out quickly if this is just a lookup
3948                         if ( data ) {
3949                                 if ( !queue || jQuery.isArray(data) ) {
3950                                         queue = jQuery._data( elem, type, jQuery.makeArray(data) );
3951                                 } else {
3952                                         queue.push( data );
3953                                 }
3954                         }
3955                         return queue || [];
3956                 }
3957         },
3958
3959         dequeue: function( elem, type ) {
3960                 type = type || "fx";
3961
3962                 var queue = jQuery.queue( elem, type ),
3963                         startLength = queue.length,
3964                         fn = queue.shift(),
3965                         hooks = jQuery._queueHooks( elem, type ),
3966                         next = function() {
3967                                 jQuery.dequeue( elem, type );
3968                         };
3969
3970                 // If the fx queue is dequeued, always remove the progress sentinel
3971                 if ( fn === "inprogress" ) {
3972                         fn = queue.shift();
3973                         startLength--;
3974                 }
3975
3976                 if ( fn ) {
3977
3978                         // Add a progress sentinel to prevent the fx queue from being
3979                         // automatically dequeued
3980                         if ( type === "fx" ) {
3981                                 queue.unshift( "inprogress" );
3982                         }
3983
3984                         // clear up the last queue stop function
3985                         delete hooks.stop;
3986                         fn.call( elem, next, hooks );
3987                 }
3988
3989                 if ( !startLength && hooks ) {
3990                         hooks.empty.fire();
3991                 }
3992         },
3993
3994         // not intended for public consumption - generates a queueHooks object, or returns the current one
3995         _queueHooks: function( elem, type ) {
3996                 var key = type + "queueHooks";
3997                 return jQuery._data( elem, key ) || jQuery._data( elem, key, {
3998                         empty: jQuery.Callbacks("once memory").add(function() {
3999                                 jQuery._removeData( elem, type + "queue" );
4000                                 jQuery._removeData( elem, key );
4001                         })
4002                 });
4003         }
4004 });
4005
4006 jQuery.fn.extend({
4007         queue: function( type, data ) {
4008                 var setter = 2;
4009
4010                 if ( typeof type !== "string" ) {
4011                         data = type;
4012                         type = "fx";
4013                         setter--;
4014                 }
4015
4016                 if ( arguments.length < setter ) {
4017                         return jQuery.queue( this[0], type );
4018                 }
4019
4020                 return data === undefined ?
4021                         this :
4022                         this.each(function() {
4023                                 var queue = jQuery.queue( this, type, data );
4024
4025                                 // ensure a hooks for this queue
4026                                 jQuery._queueHooks( this, type );
4027
4028                                 if ( type === "fx" && queue[0] !== "inprogress" ) {
4029                                         jQuery.dequeue( this, type );
4030                                 }
4031                         });
4032         },
4033         dequeue: function( type ) {
4034                 return this.each(function() {
4035                         jQuery.dequeue( this, type );
4036                 });
4037         },
4038         clearQueue: function( type ) {
4039                 return this.queue( type || "fx", [] );
4040         },
4041         // Get a promise resolved when queues of a certain type
4042         // are emptied (fx is the type by default)
4043         promise: function( type, obj ) {
4044                 var tmp,
4045                         count = 1,
4046                         defer = jQuery.Deferred(),
4047                         elements = this,
4048                         i = this.length,
4049                         resolve = function() {
4050                                 if ( !( --count ) ) {
4051                                         defer.resolveWith( elements, [ elements ] );
4052                                 }
4053                         };
4054
4055                 if ( typeof type !== "string" ) {
4056                         obj = type;
4057                         type = undefined;
4058                 }
4059                 type = type || "fx";
4060
4061                 while ( i-- ) {
4062                         tmp = jQuery._data( elements[ i ], type + "queueHooks" );
4063                         if ( tmp && tmp.empty ) {
4064                                 count++;
4065                                 tmp.empty.add( resolve );
4066                         }
4067                 }
4068                 resolve();
4069                 return defer.promise( obj );
4070         }
4071 });
4072 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
4073
4074 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4075
4076 var isHidden = function( elem, el ) {
4077                 // isHidden might be called from jQuery#filter function;
4078                 // in that case, element will be second argument
4079                 elem = el || elem;
4080                 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
4081         };
4082
4083
4084
4085 // Multifunctional method to get and set values of a collection
4086 // The value/s can optionally be executed if it's a function
4087 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4088         var i = 0,
4089                 length = elems.length,
4090                 bulk = key == null;
4091
4092         // Sets many values
4093         if ( jQuery.type( key ) === "object" ) {
4094                 chainable = true;
4095                 for ( i in key ) {
4096                         jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
4097                 }
4098
4099         // Sets one value
4100         } else if ( value !== undefined ) {
4101                 chainable = true;
4102
4103                 if ( !jQuery.isFunction( value ) ) {
4104                         raw = true;
4105                 }
4106
4107                 if ( bulk ) {
4108                         // Bulk operations run against the entire set
4109                         if ( raw ) {
4110                                 fn.call( elems, value );
4111                                 fn = null;
4112
4113                         // ...except when executing function values
4114                         } else {
4115                                 bulk = fn;
4116                                 fn = function( elem, key, value ) {
4117                                         return bulk.call( jQuery( elem ), value );
4118                                 };
4119                         }
4120                 }
4121
4122                 if ( fn ) {
4123                         for ( ; i < length; i++ ) {
4124                                 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
4125                         }
4126                 }
4127         }
4128
4129         return chainable ?
4130                 elems :
4131
4132                 // Gets
4133                 bulk ?
4134                         fn.call( elems ) :
4135                         length ? fn( elems[0], key ) : emptyGet;
4136 };
4137 var rcheckableType = (/^(?:checkbox|radio)$/i);
4138
4139
4140
4141 (function() {
4142         var fragment = document.createDocumentFragment(),
4143                 div = document.createElement("div"),
4144                 input = document.createElement("input");
4145
4146         // Setup
4147         div.setAttribute( "className", "t" );
4148         div.innerHTML = "  <link/><table></table><a href='/a'>a</a>";
4149
4150         // IE strips leading whitespace when .innerHTML is used
4151         support.leadingWhitespace = div.firstChild.nodeType === 3;
4152
4153         // Make sure that tbody elements aren't automatically inserted
4154         // IE will insert them into empty tables
4155         support.tbody = !div.getElementsByTagName( "tbody" ).length;
4156
4157         // Make sure that link elements get serialized correctly by innerHTML
4158         // This requires a wrapper element in IE
4159         support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
4160
4161         // Makes sure cloning an html5 element does not cause problems
4162         // Where outerHTML is undefined, this still works
4163         support.html5Clone =
4164                 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
4165
4166         // Check if a disconnected checkbox will retain its checked
4167         // value of true after appended to the DOM (IE6/7)
4168         input.type = "checkbox";
4169         input.checked = true;
4170         fragment.appendChild( input );
4171         support.appendChecked = input.checked;
4172
4173         // Make sure textarea (and checkbox) defaultValue is properly cloned
4174         // Support: IE6-IE11+
4175         div.innerHTML = "<textarea>x</textarea>";
4176         support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4177
4178         // #11217 - WebKit loses check when the name is after the checked attribute
4179         fragment.appendChild( div );
4180         div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
4181
4182         // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
4183         // old WebKit doesn't clone checked state correctly in fragments
4184         support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4185
4186         // Support: IE<9
4187         // Opera does not clone events (and typeof div.attachEvent === undefined).
4188         // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
4189         support.noCloneEvent = true;
4190         if ( div.attachEvent ) {
4191                 div.attachEvent( "onclick", function() {
4192                         support.noCloneEvent = false;
4193                 });
4194
4195                 div.cloneNode( true ).click();
4196         }
4197
4198         // Execute the test only if not already executed in another module.
4199         if (support.deleteExpando == null) {
4200                 // Support: IE<9
4201                 support.deleteExpando = true;
4202                 try {
4203                         delete div.test;
4204                 } catch( e ) {
4205                         support.deleteExpando = false;
4206                 }
4207         }
4208
4209         // Null elements to avoid leaks in IE.
4210         fragment = div = input = null;
4211 })();
4212
4213
4214 (function() {
4215         var i, eventName,
4216                 div = document.createElement( "div" );
4217
4218         // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)
4219         for ( i in { submit: true, change: true, focusin: true }) {
4220                 eventName = "on" + i;
4221
4222                 if ( !(support[ i + "Bubbles" ] = eventName in window) ) {
4223                         // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
4224                         div.setAttribute( eventName, "t" );
4225                         support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false;
4226                 }
4227         }
4228
4229         // Null elements to avoid leaks in IE.
4230         div = null;
4231 })();
4232
4233
4234 var rformElems = /^(?:input|select|textarea)$/i,
4235         rkeyEvent = /^key/,
4236         rmouseEvent = /^(?:mouse|contextmenu)|click/,
4237         rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
4238         rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
4239
4240 function returnTrue() {
4241         return true;
4242 }
4243
4244 function returnFalse() {
4245         return false;
4246 }
4247
4248 function safeActiveElement() {
4249         try {
4250                 return document.activeElement;
4251         } catch ( err ) { }
4252 }
4253
4254 /*
4255  * Helper functions for managing events -- not part of the public interface.
4256  * Props to Dean Edwards' addEvent library for many of the ideas.
4257  */
4258 jQuery.event = {
4259
4260         global: {},
4261
4262         add: function( elem, types, handler, data, selector ) {
4263                 var tmp, events, t, handleObjIn,
4264                         special, eventHandle, handleObj,
4265                         handlers, type, namespaces, origType,
4266                         elemData = jQuery._data( elem );
4267
4268                 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4269                 if ( !elemData ) {
4270                         return;
4271                 }
4272
4273                 // Caller can pass in an object of custom data in lieu of the handler
4274                 if ( handler.handler ) {
4275                         handleObjIn = handler;
4276                         handler = handleObjIn.handler;
4277                         selector = handleObjIn.selector;
4278                 }
4279
4280                 // Make sure that the handler has a unique ID, used to find/remove it later
4281                 if ( !handler.guid ) {
4282                         handler.guid = jQuery.guid++;
4283                 }
4284
4285                 // Init the element's event structure and main handler, if this is the first
4286                 if ( !(events = elemData.events) ) {
4287                         events = elemData.events = {};
4288                 }
4289                 if ( !(eventHandle = elemData.handle) ) {
4290                         eventHandle = elemData.handle = function( e ) {
4291                                 // Discard the second event of a jQuery.event.trigger() and
4292                                 // when an event is called after a page has unloaded
4293                                 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ?
4294                                         jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
4295                                         undefined;
4296                         };
4297                         // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
4298                         eventHandle.elem = elem;
4299                 }
4300
4301                 // Handle multiple events separated by a space
4302                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4303                 t = types.length;
4304                 while ( t-- ) {
4305                         tmp = rtypenamespace.exec( types[t] ) || [];
4306                         type = origType = tmp[1];
4307                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
4308
4309                         // There *must* be a type, no attaching namespace-only handlers
4310                         if ( !type ) {
4311                                 continue;
4312                         }
4313
4314                         // If event changes its type, use the special event handlers for the changed type
4315                         special = jQuery.event.special[ type ] || {};
4316
4317                         // If selector defined, determine special event api type, otherwise given type
4318                         type = ( selector ? special.delegateType : special.bindType ) || type;
4319
4320                         // Update special based on newly reset type
4321                         special = jQuery.event.special[ type ] || {};
4322
4323                         // handleObj is passed to all event handlers
4324                         handleObj = jQuery.extend({
4325                                 type: type,
4326                                 origType: origType,
4327                                 data: data,
4328                                 handler: handler,
4329                                 guid: handler.guid,
4330                                 selector: selector,
4331                                 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4332                                 namespace: namespaces.join(".")
4333                         }, handleObjIn );
4334
4335                         // Init the event handler queue if we're the first
4336                         if ( !(handlers = events[ type ]) ) {
4337                                 handlers = events[ type ] = [];
4338                                 handlers.delegateCount = 0;
4339
4340                                 // Only use addEventListener/attachEvent if the special events handler returns false
4341                                 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4342                                         // Bind the global event handler to the element
4343                                         if ( elem.addEventListener ) {
4344                                                 elem.addEventListener( type, eventHandle, false );
4345
4346                                         } else if ( elem.attachEvent ) {
4347                                                 elem.attachEvent( "on" + type, eventHandle );
4348                                         }
4349                                 }
4350                         }
4351
4352                         if ( special.add ) {
4353                                 special.add.call( elem, handleObj );
4354
4355                                 if ( !handleObj.handler.guid ) {
4356                                         handleObj.handler.guid = handler.guid;
4357                                 }
4358                         }
4359
4360                         // Add to the element's handler list, delegates in front
4361                         if ( selector ) {
4362                                 handlers.splice( handlers.delegateCount++, 0, handleObj );
4363                         } else {
4364                                 handlers.push( handleObj );
4365                         }
4366
4367                         // Keep track of which events have ever been used, for event optimization
4368                         jQuery.event.global[ type ] = true;
4369                 }
4370
4371                 // Nullify elem to prevent memory leaks in IE
4372                 elem = null;
4373         },
4374
4375         // Detach an event or set of events from an element
4376         remove: function( elem, types, handler, selector, mappedTypes ) {
4377                 var j, handleObj, tmp,
4378                         origCount, t, events,
4379                         special, handlers, type,
4380                         namespaces, origType,
4381                         elemData = jQuery.hasData( elem ) && jQuery._data( elem );
4382
4383                 if ( !elemData || !(events = elemData.events) ) {
4384                         return;
4385                 }
4386
4387                 // Once for each type.namespace in types; type may be omitted
4388                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4389                 t = types.length;
4390                 while ( t-- ) {
4391                         tmp = rtypenamespace.exec( types[t] ) || [];
4392                         type = origType = tmp[1];
4393                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
4394
4395                         // Unbind all events (on this namespace, if provided) for the element
4396                         if ( !type ) {
4397                                 for ( type in events ) {
4398                                         jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4399                                 }
4400                                 continue;
4401                         }
4402
4403                         special = jQuery.event.special[ type ] || {};
4404                         type = ( selector ? special.delegateType : special.bindType ) || type;
4405                         handlers = events[ type ] || [];
4406                         tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
4407
4408                         // Remove matching events
4409                         origCount = j = handlers.length;
4410                         while ( j-- ) {
4411                                 handleObj = handlers[ j ];
4412
4413                                 if ( ( mappedTypes || origType === handleObj.origType ) &&
4414                                         ( !handler || handler.guid === handleObj.guid ) &&
4415                                         ( !tmp || tmp.test( handleObj.namespace ) ) &&
4416                                         ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
4417                                         handlers.splice( j, 1 );
4418
4419                                         if ( handleObj.selector ) {
4420                                                 handlers.delegateCount--;
4421                                         }
4422                                         if ( special.remove ) {
4423                                                 special.remove.call( elem, handleObj );
4424                                         }
4425                                 }
4426                         }
4427
4428                         // Remove generic event handler if we removed something and no more handlers exist
4429                         // (avoids potential for endless recursion during removal of special event handlers)
4430                         if ( origCount && !handlers.length ) {
4431                                 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4432                                         jQuery.removeEvent( elem, type, elemData.handle );
4433                                 }
4434
4435                                 delete events[ type ];
4436                         }
4437                 }
4438
4439                 // Remove the expando if it's no longer used
4440                 if ( jQuery.isEmptyObject( events ) ) {
4441                         delete elemData.handle;
4442
4443                         // removeData also checks for emptiness and clears the expando if empty
4444                         // so use it instead of delete
4445                         jQuery._removeData( elem, "events" );
4446                 }
4447         },
4448
4449         trigger: function( event, data, elem, onlyHandlers ) {
4450                 var handle, ontype, cur,
4451                         bubbleType, special, tmp, i,
4452                         eventPath = [ elem || document ],
4453                         type = hasOwn.call( event, "type" ) ? event.type : event,
4454                         namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
4455
4456                 cur = tmp = elem = elem || document;
4457
4458                 // Don't do events on text and comment nodes
4459                 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
4460                         return;
4461                 }
4462
4463                 // focus/blur morphs to focusin/out; ensure we're not firing them right now
4464                 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
4465                         return;
4466                 }
4467
4468                 if ( type.indexOf(".") >= 0 ) {
4469                         // Namespaced trigger; create a regexp to match event type in handle()
4470                         namespaces = type.split(".");
4471                         type = namespaces.shift();
4472                         namespaces.sort();
4473                 }
4474                 ontype = type.indexOf(":") < 0 && "on" + type;
4475
4476                 // Caller can pass in a jQuery.Event object, Object, or just an event type string
4477                 event = event[ jQuery.expando ] ?
4478                         event :
4479                         new jQuery.Event( type, typeof event === "object" && event );
4480
4481                 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
4482                 event.isTrigger = onlyHandlers ? 2 : 3;
4483                 event.namespace = namespaces.join(".");
4484                 event.namespace_re = event.namespace ?
4485                         new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
4486                         null;
4487
4488                 // Clean up the event in case it is being reused
4489                 event.result = undefined;
4490                 if ( !event.target ) {
4491                         event.target = elem;
4492                 }
4493
4494                 // Clone any incoming data and prepend the event, creating the handler arg list
4495                 data = data == null ?
4496                         [ event ] :
4497                         jQuery.makeArray( data, [ event ] );
4498
4499                 // Allow special events to draw outside the lines
4500                 special = jQuery.event.special[ type ] || {};
4501                 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
4502                         return;
4503                 }
4504
4505                 // Determine event propagation path in advance, per W3C events spec (#9951)
4506                 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
4507                 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
4508
4509                         bubbleType = special.delegateType || type;
4510                         if ( !rfocusMorph.test( bubbleType + type ) ) {
4511                                 cur = cur.parentNode;
4512                         }
4513                         for ( ; cur; cur = cur.parentNode ) {
4514                                 eventPath.push( cur );
4515                                 tmp = cur;
4516                         }
4517
4518                         // Only add window if we got to document (e.g., not plain obj or detached DOM)
4519                         if ( tmp === (elem.ownerDocument || document) ) {
4520                                 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
4521                         }
4522                 }
4523
4524                 // Fire handlers on the event path
4525                 i = 0;
4526                 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
4527
4528                         event.type = i > 1 ?
4529                                 bubbleType :
4530                                 special.bindType || type;
4531
4532                         // jQuery handler
4533                         handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
4534                         if ( handle ) {
4535                                 handle.apply( cur, data );
4536                         }
4537
4538                         // Native handler
4539                         handle = ontype && cur[ ontype ];
4540                         if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
4541                                 event.result = handle.apply( cur, data );
4542                                 if ( event.result === false ) {
4543                                         event.preventDefault();
4544                                 }
4545                         }
4546                 }
4547                 event.type = type;
4548
4549                 // If nobody prevented the default action, do it now
4550                 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
4551
4552                         if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
4553                                 jQuery.acceptData( elem ) ) {
4554
4555                                 // Call a native DOM method on the target with the same name name as the event.
4556                                 // Can't use an .isFunction() check here because IE6/7 fails that test.
4557                                 // Don't do default actions on window, that's where global variables be (#6170)
4558                                 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
4559
4560                                         // Don't re-trigger an onFOO event when we call its FOO() method
4561                                         tmp = elem[ ontype ];
4562
4563                                         if ( tmp ) {
4564                                                 elem[ ontype ] = null;
4565                                         }
4566
4567                                         // Prevent re-triggering of the same event, since we already bubbled it above
4568                                         jQuery.event.triggered = type;
4569                                         try {
4570                                                 elem[ type ]();
4571                                         } catch ( e ) {
4572                                                 // IE<9 dies on focus/blur to hidden element (#1486,#12518)
4573                                                 // only reproducible on winXP IE8 native, not IE9 in IE8 mode
4574                                         }
4575                                         jQuery.event.triggered = undefined;
4576
4577                                         if ( tmp ) {
4578                                                 elem[ ontype ] = tmp;
4579                                         }
4580                                 }
4581                         }
4582                 }
4583
4584                 return event.result;
4585         },
4586
4587         dispatch: function( event ) {
4588
4589                 // Make a writable jQuery.Event from the native event object
4590                 event = jQuery.event.fix( event );
4591
4592                 var i, ret, handleObj, matched, j,
4593                         handlerQueue = [],
4594                         args = slice.call( arguments ),
4595                         handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
4596                         special = jQuery.event.special[ event.type ] || {};
4597
4598                 // Use the fix-ed jQuery.Event rather than the (read-only) native event
4599                 args[0] = event;
4600                 event.delegateTarget = this;
4601
4602                 // Call the preDispatch hook for the mapped type, and let it bail if desired
4603                 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
4604                         return;
4605                 }
4606
4607                 // Determine handlers
4608                 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
4609
4610                 // Run delegates first; they may want to stop propagation beneath us
4611                 i = 0;
4612                 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
4613                         event.currentTarget = matched.elem;
4614
4615                         j = 0;
4616                         while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
4617
4618                                 // Triggered event must either 1) have no namespace, or
4619                                 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
4620                                 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
4621
4622                                         event.handleObj = handleObj;
4623                                         event.data = handleObj.data;
4624
4625                                         ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
4626                                                         .apply( matched.elem, args );
4627
4628                                         if ( ret !== undefined ) {
4629                                                 if ( (event.result = ret) === false ) {
4630                                                         event.preventDefault();
4631                                                         event.stopPropagation();
4632                                                 }
4633                                         }
4634                                 }
4635                         }
4636                 }
4637
4638                 // Call the postDispatch hook for the mapped type
4639                 if ( special.postDispatch ) {
4640                         special.postDispatch.call( this, event );
4641                 }
4642
4643                 return event.result;
4644         },
4645
4646         handlers: function( event, handlers ) {
4647                 var sel, handleObj, matches, i,
4648                         handlerQueue = [],
4649                         delegateCount = handlers.delegateCount,
4650                         cur = event.target;
4651
4652                 // Find delegate handlers
4653                 // Black-hole SVG <use> instance trees (#13180)
4654                 // Avoid non-left-click bubbling in Firefox (#3861)
4655                 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
4656
4657                         /* jshint eqeqeq: false */
4658                         for ( ; cur != this; cur = cur.parentNode || this ) {
4659                                 /* jshint eqeqeq: true */
4660
4661                                 // Don't check non-elements (#13208)
4662                                 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
4663                                 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
4664                                         matches = [];
4665                                         for ( i = 0; i < delegateCount; i++ ) {
4666                                                 handleObj = handlers[ i ];
4667
4668                                                 // Don't conflict with Object.prototype properties (#13203)
4669                                                 sel = handleObj.selector + " ";
4670
4671                                                 if ( matches[ sel ] === undefined ) {
4672                                                         matches[ sel ] = handleObj.needsContext ?
4673                                                                 jQuery( sel, this ).index( cur ) >= 0 :
4674                                                                 jQuery.find( sel, this, null, [ cur ] ).length;
4675                                                 }
4676                                                 if ( matches[ sel ] ) {
4677                                                         matches.push( handleObj );
4678                                                 }
4679                                         }
4680                                         if ( matches.length ) {
4681                                                 handlerQueue.push({ elem: cur, handlers: matches });
4682                                         }
4683                                 }
4684                         }
4685                 }
4686
4687                 // Add the remaining (directly-bound) handlers
4688                 if ( delegateCount < handlers.length ) {
4689                         handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
4690                 }
4691
4692                 return handlerQueue;
4693         },
4694
4695         fix: function( event ) {
4696                 if ( event[ jQuery.expando ] ) {
4697                         return event;
4698                 }
4699
4700                 // Create a writable copy of the event object and normalize some properties
4701                 var i, prop, copy,
4702                         type = event.type,
4703                         originalEvent = event,
4704                         fixHook = this.fixHooks[ type ];
4705
4706                 if ( !fixHook ) {
4707                         this.fixHooks[ type ] = fixHook =
4708                                 rmouseEvent.test( type ) ? this.mouseHooks :
4709                                 rkeyEvent.test( type ) ? this.keyHooks :
4710                                 {};
4711                 }
4712                 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
4713
4714                 event = new jQuery.Event( originalEvent );
4715
4716                 i = copy.length;
4717                 while ( i-- ) {
4718                         prop = copy[ i ];
4719                         event[ prop ] = originalEvent[ prop ];
4720                 }
4721
4722                 // Support: IE<9
4723                 // Fix target property (#1925)
4724                 if ( !event.target ) {
4725                         event.target = originalEvent.srcElement || document;
4726                 }
4727
4728                 // Support: Chrome 23+, Safari?
4729                 // Target should not be a text node (#504, #13143)
4730                 if ( event.target.nodeType === 3 ) {
4731                         event.target = event.target.parentNode;
4732                 }
4733
4734                 // Support: IE<9
4735                 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
4736                 event.metaKey = !!event.metaKey;
4737
4738                 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
4739         },
4740
4741         // Includes some event props shared by KeyEvent and MouseEvent
4742         props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
4743
4744         fixHooks: {},
4745
4746         keyHooks: {
4747                 props: "char charCode key keyCode".split(" "),
4748                 filter: function( event, original ) {
4749
4750                         // Add which for key events
4751                         if ( event.which == null ) {
4752                                 event.which = original.charCode != null ? original.charCode : original.keyCode;
4753                         }
4754
4755                         return event;
4756                 }
4757         },
4758
4759         mouseHooks: {
4760                 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
4761                 filter: function( event, original ) {
4762                         var body, eventDoc, doc,
4763                                 button = original.button,
4764                                 fromElement = original.fromElement;
4765
4766                         // Calculate pageX/Y if missing and clientX/Y available
4767                         if ( event.pageX == null && original.clientX != null ) {
4768                                 eventDoc = event.target.ownerDocument || document;
4769                                 doc = eventDoc.documentElement;
4770                                 body = eventDoc.body;
4771
4772                                 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
4773                                 event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
4774                         }
4775
4776                         // Add relatedTarget, if necessary
4777                         if ( !event.relatedTarget && fromElement ) {
4778                                 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
4779                         }
4780
4781                         // Add which for click: 1 === left; 2 === middle; 3 === right
4782                         // Note: button is not normalized, so don't use it
4783                         if ( !event.which && button !== undefined ) {
4784                                 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
4785                         }
4786
4787                         return event;
4788                 }
4789         },
4790
4791         special: {
4792                 load: {
4793                         // Prevent triggered image.load events from bubbling to window.load
4794                         noBubble: true
4795                 },
4796                 focus: {
4797                         // Fire native event if possible so blur/focus sequence is correct
4798                         trigger: function() {
4799                                 if ( this !== safeActiveElement() && this.focus ) {
4800                                         try {
4801                                                 this.focus();
4802                                                 return false;
4803                                         } catch ( e ) {
4804                                                 // Support: IE<9
4805                                                 // If we error on focus to hidden element (#1486, #12518),
4806                                                 // let .trigger() run the handlers
4807                                         }
4808                                 }
4809                         },
4810                         delegateType: "focusin"
4811                 },
4812                 blur: {
4813                         trigger: function() {
4814                                 if ( this === safeActiveElement() && this.blur ) {
4815                                         this.blur();
4816                                         return false;
4817                                 }
4818                         },
4819                         delegateType: "focusout"
4820                 },
4821                 click: {
4822                         // For checkbox, fire native event so checked state will be right
4823                         trigger: function() {
4824                                 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
4825                                         this.click();
4826                                         return false;
4827                                 }
4828                         },
4829
4830                         // For cross-browser consistency, don't fire native .click() on links
4831                         _default: function( event ) {
4832                                 return jQuery.nodeName( event.target, "a" );
4833                         }
4834                 },
4835
4836                 beforeunload: {
4837                         postDispatch: function( event ) {
4838
4839                                 // Even when returnValue equals to undefined Firefox will still show alert
4840                                 if ( event.result !== undefined ) {
4841                                         event.originalEvent.returnValue = event.result;
4842                                 }
4843                         }
4844                 }
4845         },
4846
4847         simulate: function( type, elem, event, bubble ) {
4848                 // Piggyback on a donor event to simulate a different one.
4849                 // Fake originalEvent to avoid donor's stopPropagation, but if the
4850                 // simulated event prevents default then we do the same on the donor.
4851                 var e = jQuery.extend(
4852                         new jQuery.Event(),
4853                         event,
4854                         {
4855                                 type: type,
4856                                 isSimulated: true,
4857                                 originalEvent: {}
4858                         }
4859                 );
4860                 if ( bubble ) {
4861                         jQuery.event.trigger( e, null, elem );
4862                 } else {
4863                         jQuery.event.dispatch.call( elem, e );
4864                 }
4865                 if ( e.isDefaultPrevented() ) {
4866                         event.preventDefault();
4867                 }
4868         }
4869 };
4870
4871 jQuery.removeEvent = document.removeEventListener ?
4872         function( elem, type, handle ) {
4873                 if ( elem.removeEventListener ) {
4874                         elem.removeEventListener( type, handle, false );
4875                 }
4876         } :
4877         function( elem, type, handle ) {
4878                 var name = "on" + type;
4879
4880                 if ( elem.detachEvent ) {
4881
4882                         // #8545, #7054, preventing memory leaks for custom events in IE6-8
4883                         // detachEvent needed property on element, by name of that event, to properly expose it to GC
4884                         if ( typeof elem[ name ] === strundefined ) {
4885                                 elem[ name ] = null;
4886                         }
4887
4888                         elem.detachEvent( name, handle );
4889                 }
4890         };
4891
4892 jQuery.Event = function( src, props ) {
4893         // Allow instantiation without the 'new' keyword
4894         if ( !(this instanceof jQuery.Event) ) {
4895                 return new jQuery.Event( src, props );
4896         }
4897
4898         // Event object
4899         if ( src && src.type ) {
4900                 this.originalEvent = src;
4901                 this.type = src.type;
4902
4903                 // Events bubbling up the document may have been marked as prevented
4904                 // by a handler lower down the tree; reflect the correct value.
4905                 this.isDefaultPrevented = src.defaultPrevented ||
4906                                 src.defaultPrevented === undefined && (
4907                                 // Support: IE < 9
4908                                 src.returnValue === false ||
4909                                 // Support: Android < 4.0
4910                                 src.getPreventDefault && src.getPreventDefault() ) ?
4911                         returnTrue :
4912                         returnFalse;
4913
4914         // Event type
4915         } else {
4916                 this.type = src;
4917         }
4918
4919         // Put explicitly provided properties onto the event object
4920         if ( props ) {
4921                 jQuery.extend( this, props );
4922         }
4923
4924         // Create a timestamp if incoming event doesn't have one
4925         this.timeStamp = src && src.timeStamp || jQuery.now();
4926
4927         // Mark it as fixed
4928         this[ jQuery.expando ] = true;
4929 };
4930
4931 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
4932 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
4933 jQuery.Event.prototype = {
4934         isDefaultPrevented: returnFalse,
4935         isPropagationStopped: returnFalse,
4936         isImmediatePropagationStopped: returnFalse,
4937
4938         preventDefault: function() {
4939                 var e = this.originalEvent;
4940
4941                 this.isDefaultPrevented = returnTrue;
4942                 if ( !e ) {
4943                         return;
4944                 }
4945
4946                 // If preventDefault exists, run it on the original event
4947                 if ( e.preventDefault ) {
4948                         e.preventDefault();
4949
4950                 // Support: IE
4951                 // Otherwise set the returnValue property of the original event to false
4952                 } else {
4953                         e.returnValue = false;
4954                 }
4955         },
4956         stopPropagation: function() {
4957                 var e = this.originalEvent;
4958
4959                 this.isPropagationStopped = returnTrue;
4960                 if ( !e ) {
4961                         return;
4962                 }
4963                 // If stopPropagation exists, run it on the original event
4964                 if ( e.stopPropagation ) {
4965                         e.stopPropagation();
4966                 }
4967
4968                 // Support: IE
4969                 // Set the cancelBubble property of the original event to true
4970                 e.cancelBubble = true;
4971         },
4972         stopImmediatePropagation: function() {
4973                 this.isImmediatePropagationStopped = returnTrue;
4974                 this.stopPropagation();
4975         }
4976 };
4977
4978 // Create mouseenter/leave events using mouseover/out and event-time checks
4979 jQuery.each({
4980         mouseenter: "mouseover",
4981         mouseleave: "mouseout"
4982 }, function( orig, fix ) {
4983         jQuery.event.special[ orig ] = {
4984                 delegateType: fix,
4985                 bindType: fix,
4986
4987                 handle: function( event ) {
4988                         var ret,
4989                                 target = this,
4990                                 related = event.relatedTarget,
4991                                 handleObj = event.handleObj;
4992
4993                         // For mousenter/leave call the handler if related is outside the target.
4994                         // NB: No relatedTarget if the mouse left/entered the browser window
4995                         if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
4996                                 event.type = handleObj.origType;
4997                                 ret = handleObj.handler.apply( this, arguments );
4998                                 event.type = fix;
4999                         }
5000                         return ret;
5001                 }
5002         };
5003 });
5004
5005 // IE submit delegation
5006 if ( !support.submitBubbles ) {
5007
5008         jQuery.event.special.submit = {
5009                 setup: function() {
5010                         // Only need this for delegated form submit events
5011                         if ( jQuery.nodeName( this, "form" ) ) {
5012                                 return false;
5013                         }
5014
5015                         // Lazy-add a submit handler when a descendant form may potentially be submitted
5016                         jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
5017                                 // Node name check avoids a VML-related crash in IE (#9807)
5018                                 var elem = e.target,
5019                                         form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
5020                                 if ( form && !jQuery._data( form, "submitBubbles" ) ) {
5021                                         jQuery.event.add( form, "submit._submit", function( event ) {
5022                                                 event._submit_bubble = true;
5023                                         });
5024                                         jQuery._data( form, "submitBubbles", true );
5025                                 }
5026                         });
5027                         // return undefined since we don't need an event listener
5028                 },
5029
5030                 postDispatch: function( event ) {
5031                         // If form was submitted by the user, bubble the event up the tree
5032                         if ( event._submit_bubble ) {
5033                                 delete event._submit_bubble;
5034                                 if ( this.parentNode && !event.isTrigger ) {
5035                                         jQuery.event.simulate( "submit", this.parentNode, event, true );
5036                                 }
5037                         }
5038                 },
5039
5040                 teardown: function() {
5041                         // Only need this for delegated form submit events
5042                         if ( jQuery.nodeName( this, "form" ) ) {
5043                                 return false;
5044                         }
5045
5046                         // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
5047                         jQuery.event.remove( this, "._submit" );
5048                 }
5049         };
5050 }
5051
5052 // IE change delegation and checkbox/radio fix
5053 if ( !support.changeBubbles ) {
5054
5055         jQuery.event.special.change = {
5056
5057                 setup: function() {
5058
5059                         if ( rformElems.test( this.nodeName ) ) {
5060                                 // IE doesn't fire change on a check/radio until blur; trigger it on click
5061                                 // after a propertychange. Eat the blur-change in special.change.handle.
5062                                 // This still fires onchange a second time for check/radio after blur.
5063                                 if ( this.type === "checkbox" || this.type === "radio" ) {
5064                                         jQuery.event.add( this, "propertychange._change", function( event ) {
5065                                                 if ( event.originalEvent.propertyName === "checked" ) {
5066                                                         this._just_changed = true;
5067                                                 }
5068                                         });
5069                                         jQuery.event.add( this, "click._change", function( event ) {
5070                                                 if ( this._just_changed && !event.isTrigger ) {
5071                                                         this._just_changed = false;
5072                                                 }
5073                                                 // Allow triggered, simulated change events (#11500)
5074                                                 jQuery.event.simulate( "change", this, event, true );
5075                                         });
5076                                 }
5077                                 return false;
5078                         }
5079                         // Delegated event; lazy-add a change handler on descendant inputs
5080                         jQuery.event.add( this, "beforeactivate._change", function( e ) {
5081                                 var elem = e.target;
5082
5083                                 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
5084                                         jQuery.event.add( elem, "change._change", function( event ) {
5085                                                 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
5086                                                         jQuery.event.simulate( "change", this.parentNode, event, true );
5087                                                 }
5088                                         });
5089                                         jQuery._data( elem, "changeBubbles", true );
5090                                 }
5091                         });
5092                 },
5093
5094                 handle: function( event ) {
5095                         var elem = event.target;
5096
5097                         // Swallow native change events from checkbox/radio, we already triggered them above
5098                         if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
5099                                 return event.handleObj.handler.apply( this, arguments );
5100                         }
5101                 },
5102
5103                 teardown: function() {
5104                         jQuery.event.remove( this, "._change" );
5105
5106                         return !rformElems.test( this.nodeName );
5107                 }
5108         };
5109 }
5110
5111 // Create "bubbling" focus and blur events
5112 if ( !support.focusinBubbles ) {
5113         jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
5114
5115                 // Attach a single capturing handler on the document while someone wants focusin/focusout
5116                 var handler = function( event ) {
5117                                 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
5118                         };
5119
5120                 jQuery.event.special[ fix ] = {
5121                         setup: function() {
5122                                 var doc = this.ownerDocument || this,
5123                                         attaches = jQuery._data( doc, fix );
5124
5125                                 if ( !attaches ) {
5126                                         doc.addEventListener( orig, handler, true );
5127                                 }
5128                                 jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
5129                         },
5130                         teardown: function() {
5131                                 var doc = this.ownerDocument || this,
5132                                         attaches = jQuery._data( doc, fix ) - 1;
5133
5134                                 if ( !attaches ) {
5135                                         doc.removeEventListener( orig, handler, true );
5136                                         jQuery._removeData( doc, fix );
5137                                 } else {
5138                                         jQuery._data( doc, fix, attaches );
5139                                 }
5140                         }
5141                 };
5142         });
5143 }
5144
5145 jQuery.fn.extend({
5146
5147         on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
5148                 var type, origFn;
5149
5150                 // Types can be a map of types/handlers
5151                 if ( typeof types === "object" ) {
5152                         // ( types-Object, selector, data )
5153                         if ( typeof selector !== "string" ) {
5154                                 // ( types-Object, data )
5155                                 data = data || selector;
5156                                 selector = undefined;
5157                         }
5158                         for ( type in types ) {
5159                                 this.on( type, selector, data, types[ type ], one );
5160                         }
5161                         return this;
5162                 }
5163
5164                 if ( data == null && fn == null ) {
5165                         // ( types, fn )
5166                         fn = selector;
5167                         data = selector = undefined;
5168                 } else if ( fn == null ) {
5169                         if ( typeof selector === "string" ) {
5170                                 // ( types, selector, fn )
5171                                 fn = data;
5172                                 data = undefined;
5173                         } else {
5174                                 // ( types, data, fn )
5175                                 fn = data;
5176                                 data = selector;
5177                                 selector = undefined;
5178                         }
5179                 }
5180                 if ( fn === false ) {
5181                         fn = returnFalse;
5182                 } else if ( !fn ) {
5183                         return this;
5184                 }
5185
5186                 if ( one === 1 ) {
5187                         origFn = fn;
5188                         fn = function( event ) {
5189                                 // Can use an empty set, since event contains the info
5190                                 jQuery().off( event );
5191                                 return origFn.apply( this, arguments );
5192                         };
5193                         // Use same guid so caller can remove using origFn
5194                         fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5195                 }
5196                 return this.each( function() {
5197                         jQuery.event.add( this, types, fn, data, selector );
5198                 });
5199         },
5200         one: function( types, selector, data, fn ) {
5201                 return this.on( types, selector, data, fn, 1 );
5202         },
5203         off: function( types, selector, fn ) {
5204                 var handleObj, type;
5205                 if ( types && types.preventDefault && types.handleObj ) {
5206                         // ( event )  dispatched jQuery.Event
5207                         handleObj = types.handleObj;
5208                         jQuery( types.delegateTarget ).off(
5209                                 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
5210                                 handleObj.selector,
5211                                 handleObj.handler
5212                         );
5213                         return this;
5214                 }
5215                 if ( typeof types === "object" ) {
5216                         // ( types-object [, selector] )
5217                         for ( type in types ) {
5218                                 this.off( type, selector, types[ type ] );
5219                         }
5220                         return this;
5221                 }
5222                 if ( selector === false || typeof selector === "function" ) {
5223                         // ( types [, fn] )
5224                         fn = selector;
5225                         selector = undefined;
5226                 }
5227                 if ( fn === false ) {
5228                         fn = returnFalse;
5229                 }
5230                 return this.each(function() {
5231                         jQuery.event.remove( this, types, fn, selector );
5232                 });
5233         },
5234
5235         trigger: function( type, data ) {
5236                 return this.each(function() {
5237                         jQuery.event.trigger( type, data, this );
5238                 });
5239         },
5240         triggerHandler: function( type, data ) {
5241                 var elem = this[0];
5242                 if ( elem ) {
5243                         return jQuery.event.trigger( type, data, elem, true );
5244                 }
5245         }
5246 });
5247
5248
5249 function createSafeFragment( document ) {
5250         var list = nodeNames.split( "|" ),
5251                 safeFrag = document.createDocumentFragment();
5252
5253         if ( safeFrag.createElement ) {
5254                 while ( list.length ) {
5255                         safeFrag.createElement(
5256                                 list.pop()
5257                         );
5258                 }
5259         }
5260         return safeFrag;
5261 }
5262
5263 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5264                 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5265         rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
5266         rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5267         rleadingWhitespace = /^\s+/,
5268         rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
5269         rtagName = /<([\w:]+)/,
5270         rtbody = /<tbody/i,
5271         rhtml = /<|&#?\w+;/,
5272         rnoInnerhtml = /<(?:script|style|link)/i,
5273         // checked="checked" or checked
5274         rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5275         rscriptType = /^$|\/(?:java|ecma)script/i,
5276         rscriptTypeMasked = /^true\/(.*)/,
5277         rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
5278
5279         // We have to close these tags to support XHTML (#13200)
5280         wrapMap = {
5281                 option: [ 1, "<select multiple='multiple'>", "</select>" ],
5282                 legend: [ 1, "<fieldset>", "</fieldset>" ],
5283                 area: [ 1, "<map>", "</map>" ],
5284                 param: [ 1, "<object>", "</object>" ],
5285                 thead: [ 1, "<table>", "</table>" ],
5286                 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5287                 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5288                 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5289
5290                 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5291                 // unless wrapped in a div with non-breaking characters in front of it.
5292                 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
5293         },
5294         safeFragment = createSafeFragment( document ),
5295         fragmentDiv = safeFragment.appendChild( document.createElement("div") );
5296
5297 wrapMap.optgroup = wrapMap.option;
5298 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5299 wrapMap.th = wrapMap.td;
5300
5301 function getAll( context, tag ) {
5302         var elems, elem,
5303                 i = 0,
5304                 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) :
5305                         typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) :
5306                         undefined;
5307
5308         if ( !found ) {
5309                 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
5310                         if ( !tag || jQuery.nodeName( elem, tag ) ) {
5311                                 found.push( elem );
5312                         } else {
5313                                 jQuery.merge( found, getAll( elem, tag ) );
5314                         }
5315                 }
5316         }
5317
5318         return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
5319                 jQuery.merge( [ context ], found ) :
5320                 found;
5321 }
5322
5323 // Used in buildFragment, fixes the defaultChecked property
5324 function fixDefaultChecked( elem ) {
5325         if ( rcheckableType.test( elem.type ) ) {
5326                 elem.defaultChecked = elem.checked;
5327         }
5328 }
5329
5330 // Support: IE<8
5331 // Manipulating tables requires a tbody
5332 function manipulationTarget( elem, content ) {
5333         return jQuery.nodeName( elem, "table" ) &&
5334                 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
5335
5336                 elem.getElementsByTagName("tbody")[0] ||
5337                         elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
5338                 elem;
5339 }
5340
5341 // Replace/restore the type attribute of script elements for safe DOM manipulation
5342 function disableScript( elem ) {
5343         elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
5344         return elem;
5345 }
5346 function restoreScript( elem ) {
5347         var match = rscriptTypeMasked.exec( elem.type );
5348         if ( match ) {
5349                 elem.type = match[1];
5350         } else {
5351                 elem.removeAttribute("type");
5352         }
5353         return elem;
5354 }
5355
5356 // Mark scripts as having already been evaluated
5357 function setGlobalEval( elems, refElements ) {
5358         var elem,
5359                 i = 0;
5360         for ( ; (elem = elems[i]) != null; i++ ) {
5361                 jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
5362         }
5363 }
5364
5365 function cloneCopyEvent( src, dest ) {
5366
5367         if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5368                 return;
5369         }
5370
5371         var type, i, l,
5372                 oldData = jQuery._data( src ),
5373                 curData = jQuery._data( dest, oldData ),
5374                 events = oldData.events;
5375
5376         if ( events ) {
5377                 delete curData.handle;
5378                 curData.events = {};
5379
5380                 for ( type in events ) {
5381                         for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5382                                 jQuery.event.add( dest, type, events[ type ][ i ] );
5383                         }
5384                 }
5385         }
5386
5387         // make the cloned public data object a copy from the original
5388         if ( curData.data ) {
5389                 curData.data = jQuery.extend( {}, curData.data );
5390         }
5391 }
5392
5393 function fixCloneNodeIssues( src, dest ) {
5394         var nodeName, e, data;
5395
5396         // We do not need to do anything for non-Elements
5397         if ( dest.nodeType !== 1 ) {
5398                 return;
5399         }
5400
5401         nodeName = dest.nodeName.toLowerCase();
5402
5403         // IE6-8 copies events bound via attachEvent when using cloneNode.
5404         if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
5405                 data = jQuery._data( dest );
5406
5407                 for ( e in data.events ) {
5408                         jQuery.removeEvent( dest, e, data.handle );
5409                 }
5410
5411                 // Event data gets referenced instead of copied if the expando gets copied too
5412                 dest.removeAttribute( jQuery.expando );
5413         }
5414
5415         // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
5416         if ( nodeName === "script" && dest.text !== src.text ) {
5417                 disableScript( dest ).text = src.text;
5418                 restoreScript( dest );
5419
5420         // IE6-10 improperly clones children of object elements using classid.
5421         // IE10 throws NoModificationAllowedError if parent is null, #12132.
5422         } else if ( nodeName === "object" ) {
5423                 if ( dest.parentNode ) {
5424                         dest.outerHTML = src.outerHTML;
5425                 }
5426
5427                 // This path appears unavoidable for IE9. When cloning an object
5428                 // element in IE9, the outerHTML strategy above is not sufficient.
5429                 // If the src has innerHTML and the destination does not,
5430                 // copy the src.innerHTML into the dest.innerHTML. #10324
5431                 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
5432                         dest.innerHTML = src.innerHTML;
5433                 }
5434
5435         } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5436                 // IE6-8 fails to persist the checked state of a cloned checkbox
5437                 // or radio button. Worse, IE6-7 fail to give the cloned element
5438                 // a checked appearance if the defaultChecked value isn't also set
5439
5440                 dest.defaultChecked = dest.checked = src.checked;
5441
5442                 // IE6-7 get confused and end up setting the value of a cloned
5443                 // checkbox/radio button to an empty string instead of "on"
5444                 if ( dest.value !== src.value ) {
5445                         dest.value = src.value;
5446                 }
5447
5448         // IE6-8 fails to return the selected option to the default selected
5449         // state when cloning options
5450         } else if ( nodeName === "option" ) {
5451                 dest.defaultSelected = dest.selected = src.defaultSelected;
5452
5453         // IE6-8 fails to set the defaultValue to the correct value when
5454         // cloning other types of input fields
5455         } else if ( nodeName === "input" || nodeName === "textarea" ) {
5456                 dest.defaultValue = src.defaultValue;
5457         }
5458 }
5459
5460 jQuery.extend({
5461         clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5462                 var destElements, node, clone, i, srcElements,
5463                         inPage = jQuery.contains( elem.ownerDocument, elem );
5464
5465                 if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
5466                         clone = elem.cloneNode( true );
5467
5468                 // IE<=8 does not properly clone detached, unknown element nodes
5469                 } else {
5470                         fragmentDiv.innerHTML = elem.outerHTML;
5471                         fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
5472                 }
5473
5474                 if ( (!support.noCloneEvent || !support.noCloneChecked) &&
5475                                 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5476
5477                         // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
5478                         destElements = getAll( clone );
5479                         srcElements = getAll( elem );
5480
5481                         // Fix all IE cloning issues
5482                         for ( i = 0; (node = srcElements[i]) != null; ++i ) {
5483                                 // Ensure that the destination node is not null; Fixes #9587
5484                                 if ( destElements[i] ) {
5485                                         fixCloneNodeIssues( node, destElements[i] );
5486                                 }
5487                         }
5488                 }
5489
5490                 // Copy the events from the original to the clone
5491                 if ( dataAndEvents ) {
5492                         if ( deepDataAndEvents ) {
5493                                 srcElements = srcElements || getAll( elem );
5494                                 destElements = destElements || getAll( clone );
5495
5496                                 for ( i = 0; (node = srcElements[i]) != null; i++ ) {
5497                                         cloneCopyEvent( node, destElements[i] );
5498                                 }
5499                         } else {
5500                                 cloneCopyEvent( elem, clone );
5501                         }
5502                 }
5503
5504                 // Preserve script evaluation history
5505                 destElements = getAll( clone, "script" );
5506                 if ( destElements.length > 0 ) {
5507                         setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5508                 }
5509
5510                 destElements = srcElements = node = null;
5511
5512                 // Return the cloned set
5513                 return clone;
5514         },
5515
5516         buildFragment: function( elems, context, scripts, selection ) {
5517                 var j, elem, contains,
5518                         tmp, tag, tbody, wrap,
5519                         l = elems.length,
5520
5521                         // Ensure a safe fragment
5522                         safe = createSafeFragment( context ),
5523
5524                         nodes = [],
5525                         i = 0;
5526
5527                 for ( ; i < l; i++ ) {
5528                         elem = elems[ i ];
5529
5530                         if ( elem || elem === 0 ) {
5531
5532                                 // Add nodes directly
5533                                 if ( jQuery.type( elem ) === "object" ) {
5534                                         jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5535
5536                                 // Convert non-html into a text node
5537                                 } else if ( !rhtml.test( elem ) ) {
5538                                         nodes.push( context.createTextNode( elem ) );
5539
5540                                 // Convert html into DOM nodes
5541                                 } else {
5542                                         tmp = tmp || safe.appendChild( context.createElement("div") );
5543
5544                                         // Deserialize a standard representation
5545                                         tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase();
5546                                         wrap = wrapMap[ tag ] || wrapMap._default;
5547
5548                                         tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
5549
5550                                         // Descend through wrappers to the right content
5551                                         j = wrap[0];
5552                                         while ( j-- ) {
5553                                                 tmp = tmp.lastChild;
5554                                         }
5555
5556                                         // Manually add leading whitespace removed by IE
5557                                         if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5558                                                 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
5559                                         }
5560
5561                                         // Remove IE's autoinserted <tbody> from table fragments
5562                                         if ( !support.tbody ) {
5563
5564                                                 // String was a <table>, *may* have spurious <tbody>
5565                                                 elem = tag === "table" && !rtbody.test( elem ) ?
5566                                                         tmp.firstChild :
5567
5568                                                         // String was a bare <thead> or <tfoot>
5569                                                         wrap[1] === "<table>" && !rtbody.test( elem ) ?
5570                                                                 tmp :
5571                                                                 0;
5572
5573                                                 j = elem && elem.childNodes.length;
5574                                                 while ( j-- ) {
5575                                                         if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
5576                                                                 elem.removeChild( tbody );
5577                                                         }
5578                                                 }
5579                                         }
5580
5581                                         jQuery.merge( nodes, tmp.childNodes );
5582
5583                                         // Fix #12392 for WebKit and IE > 9
5584                                         tmp.textContent = "";
5585
5586                                         // Fix #12392 for oldIE
5587                                         while ( tmp.firstChild ) {
5588                                                 tmp.removeChild( tmp.firstChild );
5589                                         }
5590
5591                                         // Remember the top-level container for proper cleanup
5592                                         tmp = safe.lastChild;
5593                                 }
5594                         }
5595                 }
5596
5597                 // Fix #11356: Clear elements from fragment
5598                 if ( tmp ) {
5599                         safe.removeChild( tmp );
5600                 }
5601
5602                 // Reset defaultChecked for any radios and checkboxes
5603                 // about to be appended to the DOM in IE 6/7 (#8060)
5604                 if ( !support.appendChecked ) {
5605                         jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
5606                 }
5607
5608                 i = 0;
5609                 while ( (elem = nodes[ i++ ]) ) {
5610
5611                         // #4087 - If origin and destination elements are the same, and this is
5612                         // that element, do not do anything
5613                         if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
5614                                 continue;
5615                         }
5616
5617                         contains = jQuery.contains( elem.ownerDocument, elem );
5618
5619                         // Append to fragment
5620                         tmp = getAll( safe.appendChild( elem ), "script" );
5621
5622                         // Preserve script evaluation history
5623                         if ( contains ) {
5624                                 setGlobalEval( tmp );
5625                         }
5626
5627                         // Capture executables
5628                         if ( scripts ) {
5629                                 j = 0;
5630                                 while ( (elem = tmp[ j++ ]) ) {
5631                                         if ( rscriptType.test( elem.type || "" ) ) {
5632                                                 scripts.push( elem );
5633                                         }
5634                                 }
5635                         }
5636                 }
5637
5638                 tmp = null;
5639
5640                 return safe;
5641         },
5642
5643         cleanData: function( elems, /* internal */ acceptData ) {
5644                 var elem, type, id, data,
5645                         i = 0,
5646                         internalKey = jQuery.expando,
5647                         cache = jQuery.cache,
5648                         deleteExpando = support.deleteExpando,
5649                         special = jQuery.event.special;
5650
5651                 for ( ; (elem = elems[i]) != null; i++ ) {
5652                         if ( acceptData || jQuery.acceptData( elem ) ) {
5653
5654                                 id = elem[ internalKey ];
5655                                 data = id && cache[ id ];
5656
5657                                 if ( data ) {
5658                                         if ( data.events ) {
5659                                                 for ( type in data.events ) {
5660                                                         if ( special[ type ] ) {
5661                                                                 jQuery.event.remove( elem, type );
5662
5663                                                         // This is a shortcut to avoid jQuery.event.remove's overhead
5664                                                         } else {
5665                                                                 jQuery.removeEvent( elem, type, data.handle );
5666                                                         }
5667                                                 }
5668                                         }
5669
5670                                         // Remove cache only if it was not already removed by jQuery.event.remove
5671                                         if ( cache[ id ] ) {
5672
5673                                                 delete cache[ id ];
5674
5675                                                 // IE does not allow us to delete expando properties from nodes,
5676                                                 // nor does it have a removeAttribute function on Document nodes;
5677                                                 // we must handle all of these cases
5678                                                 if ( deleteExpando ) {
5679                                                         delete elem[ internalKey ];
5680
5681                                                 } else if ( typeof elem.removeAttribute !== strundefined ) {
5682                                                         elem.removeAttribute( internalKey );
5683
5684                                                 } else {
5685                                                         elem[ internalKey ] = null;
5686                                                 }
5687
5688                                                 deletedIds.push( id );
5689                                         }
5690                                 }
5691                         }
5692                 }
5693         }
5694 });
5695
5696 jQuery.fn.extend({
5697         text: function( value ) {
5698                 return access( this, function( value ) {
5699                         return value === undefined ?
5700                                 jQuery.text( this ) :
5701                                 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5702                 }, null, value, arguments.length );
5703         },
5704
5705         append: function() {
5706                 return this.domManip( arguments, function( elem ) {
5707                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5708                                 var target = manipulationTarget( this, elem );
5709                                 target.appendChild( elem );
5710                         }
5711                 });
5712         },
5713
5714         prepend: function() {
5715                 return this.domManip( arguments, function( elem ) {
5716                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5717                                 var target = manipulationTarget( this, elem );
5718                                 target.insertBefore( elem, target.firstChild );
5719                         }
5720                 });
5721         },
5722
5723         before: function() {
5724                 return this.domManip( arguments, function( elem ) {
5725                         if ( this.parentNode ) {
5726                                 this.parentNode.insertBefore( elem, this );
5727                         }
5728                 });
5729         },
5730
5731         after: function() {
5732                 return this.domManip( arguments, function( elem ) {
5733                         if ( this.parentNode ) {
5734                                 this.parentNode.insertBefore( elem, this.nextSibling );
5735                         }
5736                 });
5737         },
5738
5739         remove: function( selector, keepData /* Internal Use Only */ ) {
5740                 var elem,
5741                         elems = selector ? jQuery.filter( selector, this ) : this,
5742                         i = 0;
5743
5744                 for ( ; (elem = elems[i]) != null; i++ ) {
5745
5746                         if ( !keepData && elem.nodeType === 1 ) {
5747                                 jQuery.cleanData( getAll( elem ) );
5748                         }
5749
5750                         if ( elem.parentNode ) {
5751                                 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
5752                                         setGlobalEval( getAll( elem, "script" ) );
5753                                 }
5754                                 elem.parentNode.removeChild( elem );
5755                         }
5756                 }
5757
5758                 return this;
5759         },
5760
5761         empty: function() {
5762                 var elem,
5763                         i = 0;
5764
5765                 for ( ; (elem = this[i]) != null; i++ ) {
5766                         // Remove element nodes and prevent memory leaks
5767                         if ( elem.nodeType === 1 ) {
5768                                 jQuery.cleanData( getAll( elem, false ) );
5769                         }
5770
5771                         // Remove any remaining nodes
5772                         while ( elem.firstChild ) {
5773                                 elem.removeChild( elem.firstChild );
5774                         }
5775
5776                         // If this is a select, ensure that it displays empty (#12336)
5777                         // Support: IE<9
5778                         if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
5779                                 elem.options.length = 0;
5780                         }
5781                 }
5782
5783                 return this;
5784         },
5785
5786         clone: function( dataAndEvents, deepDataAndEvents ) {
5787                 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5788                 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5789
5790                 return this.map(function() {
5791                         return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5792                 });
5793         },
5794
5795         html: function( value ) {
5796                 return access( this, function( value ) {
5797                         var elem = this[ 0 ] || {},
5798                                 i = 0,
5799                                 l = this.length;
5800
5801                         if ( value === undefined ) {
5802                                 return elem.nodeType === 1 ?
5803                                         elem.innerHTML.replace( rinlinejQuery, "" ) :
5804                                         undefined;
5805                         }
5806
5807                         // See if we can take a shortcut and just use innerHTML
5808                         if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5809                                 ( support.htmlSerialize || !rnoshimcache.test( value )  ) &&
5810                                 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5811                                 !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) {
5812
5813                                 value = value.replace( rxhtmlTag, "<$1></$2>" );
5814
5815                                 try {
5816                                         for (; i < l; i++ ) {
5817                                                 // Remove element nodes and prevent memory leaks
5818                                                 elem = this[i] || {};
5819                                                 if ( elem.nodeType === 1 ) {
5820                                                         jQuery.cleanData( getAll( elem, false ) );
5821                                                         elem.innerHTML = value;
5822                                                 }
5823                                         }
5824
5825                                         elem = 0;
5826
5827                                 // If using innerHTML throws an exception, use the fallback method
5828                                 } catch(e) {}
5829                         }
5830
5831                         if ( elem ) {
5832                                 this.empty().append( value );
5833                         }
5834                 }, null, value, arguments.length );
5835         },
5836
5837         replaceWith: function() {
5838                 var arg = arguments[ 0 ];
5839
5840                 // Make the changes, replacing each context element with the new content
5841                 this.domManip( arguments, function( elem ) {
5842                         arg = this.parentNode;
5843
5844                         jQuery.cleanData( getAll( this ) );
5845
5846                         if ( arg ) {
5847                                 arg.replaceChild( elem, this );
5848                         }
5849                 });
5850
5851                 // Force removal if there was no new content (e.g., from empty arguments)
5852                 return arg && (arg.length || arg.nodeType) ? this : this.remove();
5853         },
5854
5855         detach: function( selector ) {
5856                 return this.remove( selector, true );
5857         },
5858
5859         domManip: function( args, callback ) {
5860
5861                 // Flatten any nested arrays
5862                 args = concat.apply( [], args );
5863
5864                 var first, node, hasScripts,
5865                         scripts, doc, fragment,
5866                         i = 0,
5867                         l = this.length,
5868                         set = this,
5869                         iNoClone = l - 1,
5870                         value = args[0],
5871                         isFunction = jQuery.isFunction( value );
5872
5873                 // We can't cloneNode fragments that contain checked, in WebKit
5874                 if ( isFunction ||
5875                                 ( l > 1 && typeof value === "string" &&
5876                                         !support.checkClone && rchecked.test( value ) ) ) {
5877                         return this.each(function( index ) {
5878                                 var self = set.eq( index );
5879                                 if ( isFunction ) {
5880                                         args[0] = value.call( this, index, self.html() );
5881                                 }
5882                                 self.domManip( args, callback );
5883                         });
5884                 }
5885
5886                 if ( l ) {
5887                         fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
5888                         first = fragment.firstChild;
5889
5890                         if ( fragment.childNodes.length === 1 ) {
5891                                 fragment = first;
5892                         }
5893
5894                         if ( first ) {
5895                                 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5896                                 hasScripts = scripts.length;
5897
5898                                 // Use the original fragment for the last item instead of the first because it can end up
5899                                 // being emptied incorrectly in certain situations (#8070).
5900                                 for ( ; i < l; i++ ) {
5901                                         node = fragment;
5902
5903                                         if ( i !== iNoClone ) {
5904                                                 node = jQuery.clone( node, true, true );
5905
5906                                                 // Keep references to cloned scripts for later restoration
5907                                                 if ( hasScripts ) {
5908                                                         jQuery.merge( scripts, getAll( node, "script" ) );
5909                                                 }
5910                                         }
5911
5912                                         callback.call( this[i], node, i );
5913                                 }
5914
5915                                 if ( hasScripts ) {
5916                                         doc = scripts[ scripts.length - 1 ].ownerDocument;
5917
5918                                         // Reenable scripts
5919                                         jQuery.map( scripts, restoreScript );
5920
5921                                         // Evaluate executable scripts on first document insertion
5922                                         for ( i = 0; i < hasScripts; i++ ) {
5923                                                 node = scripts[ i ];
5924                                                 if ( rscriptType.test( node.type || "" ) &&
5925                                                         !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
5926
5927                                                         if ( node.src ) {
5928                                                                 // Optional AJAX dependency, but won't run scripts if not present
5929                                                                 if ( jQuery._evalUrl ) {
5930                                                                         jQuery._evalUrl( node.src );
5931                                                                 }
5932                                                         } else {
5933                                                                 jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
5934                                                         }
5935                                                 }
5936                                         }
5937                                 }
5938
5939                                 // Fix #11809: Avoid leaking memory
5940                                 fragment = first = null;
5941                         }
5942                 }
5943
5944                 return this;
5945         }
5946 });
5947
5948 jQuery.each({
5949         appendTo: "append",
5950         prependTo: "prepend",
5951         insertBefore: "before",
5952         insertAfter: "after",
5953         replaceAll: "replaceWith"
5954 }, function( name, original ) {
5955         jQuery.fn[ name ] = function( selector ) {
5956                 var elems,
5957                         i = 0,
5958                         ret = [],
5959                         insert = jQuery( selector ),
5960                         last = insert.length - 1;
5961
5962                 for ( ; i <= last; i++ ) {
5963                         elems = i === last ? this : this.clone(true);
5964                         jQuery( insert[i] )[ original ]( elems );
5965
5966                         // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
5967                         push.apply( ret, elems.get() );
5968                 }
5969
5970                 return this.pushStack( ret );
5971         };
5972 });
5973
5974
5975 var iframe,
5976         elemdisplay = {};
5977
5978 /**
5979  * Retrieve the actual display of a element
5980  * @param {String} name nodeName of the element
5981  * @param {Object} doc Document object
5982  */
5983 // Called only from within defaultDisplay
5984 function actualDisplay( name, doc ) {
5985         var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
5986
5987                 // getDefaultComputedStyle might be reliably used only on attached element
5988                 display = window.getDefaultComputedStyle ?
5989
5990                         // Use of this method is a temporary fix (more like optmization) until something better comes along,
5991                         // since it was removed from specification and supported only in FF
5992                         window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" );
5993
5994         // We don't have any data stored on the element,
5995         // so use "detach" method as fast way to get rid of the element
5996         elem.detach();
5997
5998         return display;
5999 }
6000
6001 /**
6002  * Try to determine the default display value of an element
6003  * @param {String} nodeName
6004  */
6005 function defaultDisplay( nodeName ) {
6006         var doc = document,
6007                 display = elemdisplay[ nodeName ];
6008
6009         if ( !display ) {
6010                 display = actualDisplay( nodeName, doc );
6011
6012                 // If the simple way fails, read from inside an iframe
6013                 if ( display === "none" || !display ) {
6014
6015                         // Use the already-created iframe if possible
6016                         iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
6017
6018                         // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
6019                         doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
6020
6021                         // Support: IE
6022                         doc.write();
6023                         doc.close();
6024
6025                         display = actualDisplay( nodeName, doc );
6026                         iframe.detach();
6027                 }
6028
6029                 // Store the correct default display
6030                 elemdisplay[ nodeName ] = display;
6031         }
6032
6033         return display;
6034 }
6035
6036
6037 (function() {
6038         var a, shrinkWrapBlocksVal,
6039                 div = document.createElement( "div" ),
6040                 divReset =
6041                         "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
6042                         "display:block;padding:0;margin:0;border:0";
6043
6044         // Setup
6045         div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
6046         a = div.getElementsByTagName( "a" )[ 0 ];
6047
6048         a.style.cssText = "float:left;opacity:.5";
6049
6050         // Make sure that element opacity exists
6051         // (IE uses filter instead)
6052         // Use a regex to work around a WebKit issue. See #5145
6053         support.opacity = /^0.5/.test( a.style.opacity );
6054
6055         // Verify style float existence
6056         // (IE uses styleFloat instead of cssFloat)
6057         support.cssFloat = !!a.style.cssFloat;
6058
6059         div.style.backgroundClip = "content-box";
6060         div.cloneNode( true ).style.backgroundClip = "";
6061         support.clearCloneStyle = div.style.backgroundClip === "content-box";
6062
6063         // Null elements to avoid leaks in IE.
6064         a = div = null;
6065
6066         support.shrinkWrapBlocks = function() {
6067                 var body, container, div, containerStyles;
6068
6069                 if ( shrinkWrapBlocksVal == null ) {
6070                         body = document.getElementsByTagName( "body" )[ 0 ];
6071                         if ( !body ) {
6072                                 // Test fired too early or in an unsupported environment, exit.
6073                                 return;
6074                         }
6075
6076                         containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px";
6077                         container = document.createElement( "div" );
6078                         div = document.createElement( "div" );
6079
6080                         body.appendChild( container ).appendChild( div );
6081
6082                         // Will be changed later if needed.
6083                         shrinkWrapBlocksVal = false;
6084
6085                         if ( typeof div.style.zoom !== strundefined ) {
6086                                 // Support: IE6
6087                                 // Check if elements with layout shrink-wrap their children
6088                                 div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1";
6089                                 div.innerHTML = "<div></div>";
6090                                 div.firstChild.style.width = "5px";
6091                                 shrinkWrapBlocksVal = div.offsetWidth !== 3;
6092                         }
6093
6094                         body.removeChild( container );
6095
6096                         // Null elements to avoid leaks in IE.
6097                         body = container = div = null;
6098                 }
6099
6100                 return shrinkWrapBlocksVal;
6101         };
6102
6103 })();
6104 var rmargin = (/^margin/);
6105
6106 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6107
6108
6109
6110 var getStyles, curCSS,
6111         rposition = /^(top|right|bottom|left)$/;
6112
6113 if ( window.getComputedStyle ) {
6114         getStyles = function( elem ) {
6115                 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
6116         };
6117
6118         curCSS = function( elem, name, computed ) {
6119                 var width, minWidth, maxWidth, ret,
6120                         style = elem.style;
6121
6122                 computed = computed || getStyles( elem );
6123
6124                 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
6125                 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
6126
6127                 if ( computed ) {
6128
6129                         if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6130                                 ret = jQuery.style( elem, name );
6131                         }
6132
6133                         // A tribute to the "awesome hack by Dean Edwards"
6134                         // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
6135                         // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
6136                         // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6137                         if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6138
6139                                 // Remember the original values
6140                                 width = style.width;
6141                                 minWidth = style.minWidth;
6142                                 maxWidth = style.maxWidth;
6143
6144                                 // Put in the new values to get a computed value out
6145                                 style.minWidth = style.maxWidth = style.width = ret;
6146                                 ret = computed.width;
6147
6148                                 // Revert the changed values
6149                                 style.width = width;
6150                                 style.minWidth = minWidth;
6151                                 style.maxWidth = maxWidth;
6152                         }
6153                 }
6154
6155                 // Support: IE
6156                 // IE returns zIndex value as an integer.
6157                 return ret === undefined ?
6158                         ret :
6159                         ret + "";
6160         };
6161 } else if ( document.documentElement.currentStyle ) {
6162         getStyles = function( elem ) {
6163                 return elem.currentStyle;
6164         };
6165
6166         curCSS = function( elem, name, computed ) {
6167                 var left, rs, rsLeft, ret,
6168                         style = elem.style;
6169
6170                 computed = computed || getStyles( elem );
6171                 ret = computed ? computed[ name ] : undefined;
6172
6173                 // Avoid setting ret to empty string here
6174                 // so we don't default to auto
6175                 if ( ret == null && style && style[ name ] ) {
6176                         ret = style[ name ];
6177                 }
6178
6179                 // From the awesome hack by Dean Edwards
6180                 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
6181
6182                 // If we're not dealing with a regular pixel number
6183                 // but a number that has a weird ending, we need to convert it to pixels
6184                 // but not position css attributes, as those are proportional to the parent element instead
6185                 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
6186                 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
6187
6188                         // Remember the original values
6189                         left = style.left;
6190                         rs = elem.runtimeStyle;
6191                         rsLeft = rs && rs.left;
6192
6193                         // Put in the new values to get a computed value out
6194                         if ( rsLeft ) {
6195                                 rs.left = elem.currentStyle.left;
6196                         }
6197                         style.left = name === "fontSize" ? "1em" : ret;
6198                         ret = style.pixelLeft + "px";
6199
6200                         // Revert the changed values
6201                         style.left = left;
6202                         if ( rsLeft ) {
6203                                 rs.left = rsLeft;
6204                         }
6205                 }
6206
6207                 // Support: IE
6208                 // IE returns zIndex value as an integer.
6209                 return ret === undefined ?
6210                         ret :
6211                         ret + "" || "auto";
6212         };
6213 }
6214
6215
6216
6217
6218 function addGetHookIf( conditionFn, hookFn ) {
6219         // Define the hook, we'll check on the first run if it's really needed.
6220         return {
6221                 get: function() {
6222                         var condition = conditionFn();
6223
6224                         if ( condition == null ) {
6225                                 // The test was not ready at this point; screw the hook this time
6226                                 // but check again when needed next time.
6227                                 return;
6228                         }
6229
6230                         if ( condition ) {
6231                                 // Hook not needed (or it's not possible to use it due to missing dependency),
6232                                 // remove it.
6233                                 // Since there are no other hooks for marginRight, remove the whole object.
6234                                 delete this.get;
6235                                 return;
6236                         }
6237
6238                         // Hook needed; redefine it so that the support test is not executed again.
6239
6240                         return (this.get = hookFn).apply( this, arguments );
6241                 }
6242         };
6243 }
6244
6245
6246 (function() {
6247         var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal,
6248                 pixelPositionVal, reliableMarginRightVal,
6249                 div = document.createElement( "div" ),
6250                 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px",
6251                 divReset =
6252                         "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
6253                         "display:block;padding:0;margin:0;border:0";
6254
6255         // Setup
6256         div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
6257         a = div.getElementsByTagName( "a" )[ 0 ];
6258
6259         a.style.cssText = "float:left;opacity:.5";
6260
6261         // Make sure that element opacity exists
6262         // (IE uses filter instead)
6263         // Use a regex to work around a WebKit issue. See #5145
6264         support.opacity = /^0.5/.test( a.style.opacity );
6265
6266         // Verify style float existence
6267         // (IE uses styleFloat instead of cssFloat)
6268         support.cssFloat = !!a.style.cssFloat;
6269
6270         div.style.backgroundClip = "content-box";
6271         div.cloneNode( true ).style.backgroundClip = "";
6272         support.clearCloneStyle = div.style.backgroundClip === "content-box";
6273
6274         // Null elements to avoid leaks in IE.
6275         a = div = null;
6276
6277         jQuery.extend(support, {
6278                 reliableHiddenOffsets: function() {
6279                         if ( reliableHiddenOffsetsVal != null ) {
6280                                 return reliableHiddenOffsetsVal;
6281                         }
6282
6283                         var container, tds, isSupported,
6284                                 div = document.createElement( "div" ),
6285                                 body = document.getElementsByTagName( "body" )[ 0 ];
6286
6287                         if ( !body ) {
6288                                 // Return for frameset docs that don't have a body
6289                                 return;
6290                         }
6291
6292                         // Setup
6293                         div.setAttribute( "className", "t" );
6294                         div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
6295
6296                         container = document.createElement( "div" );
6297                         container.style.cssText = containerStyles;
6298
6299                         body.appendChild( container ).appendChild( div );
6300
6301                         // Support: IE8
6302                         // Check if table cells still have offsetWidth/Height when they are set
6303                         // to display:none and there are still other visible table cells in a
6304                         // table row; if so, offsetWidth/Height are not reliable for use when
6305                         // determining if an element has been hidden directly using
6306                         // display:none (it is still safe to use offsets if a parent element is
6307                         // hidden; don safety goggles and see bug #4512 for more information).
6308                         div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
6309                         tds = div.getElementsByTagName( "td" );
6310                         tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
6311                         isSupported = ( tds[ 0 ].offsetHeight === 0 );
6312
6313                         tds[ 0 ].style.display = "";
6314                         tds[ 1 ].style.display = "none";
6315
6316                         // Support: IE8
6317                         // Check if empty table cells still have offsetWidth/Height
6318                         reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 );
6319
6320                         body.removeChild( container );
6321
6322                         // Null elements to avoid leaks in IE.
6323                         div = body = null;
6324
6325                         return reliableHiddenOffsetsVal;
6326                 },
6327
6328                 boxSizing: function() {
6329                         if ( boxSizingVal == null ) {
6330                                 computeStyleTests();
6331                         }
6332                         return boxSizingVal;
6333                 },
6334
6335                 boxSizingReliable: function() {
6336                         if ( boxSizingReliableVal == null ) {
6337                                 computeStyleTests();
6338                         }
6339                         return boxSizingReliableVal;
6340                 },
6341
6342                 pixelPosition: function() {
6343                         if ( pixelPositionVal == null ) {
6344                                 computeStyleTests();
6345                         }
6346                         return pixelPositionVal;
6347                 },
6348
6349                 reliableMarginRight: function() {
6350                         var body, container, div, marginDiv;
6351
6352                         // Use window.getComputedStyle because jsdom on node.js will break without it.
6353                         if ( reliableMarginRightVal == null && window.getComputedStyle ) {
6354                                 body = document.getElementsByTagName( "body" )[ 0 ];
6355                                 if ( !body ) {
6356                                         // Test fired too early or in an unsupported environment, exit.
6357                                         return;
6358                                 }
6359
6360                                 container = document.createElement( "div" );
6361                                 div = document.createElement( "div" );
6362                                 container.style.cssText = containerStyles;
6363
6364                                 body.appendChild( container ).appendChild( div );
6365
6366                                 // Check if div with explicit width and no margin-right incorrectly
6367                                 // gets computed margin-right based on width of container. (#3333)
6368                                 // Fails in WebKit before Feb 2011 nightlies
6369                                 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6370                                 marginDiv = div.appendChild( document.createElement( "div" ) );
6371                                 marginDiv.style.cssText = div.style.cssText = divReset;
6372                                 marginDiv.style.marginRight = marginDiv.style.width = "0";
6373                                 div.style.width = "1px";
6374
6375                                 reliableMarginRightVal =
6376                                         !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
6377
6378                                 body.removeChild( container );
6379                         }
6380
6381                         return reliableMarginRightVal;
6382                 }
6383         });
6384
6385         function computeStyleTests() {
6386                 var container, div,
6387                         body = document.getElementsByTagName( "body" )[ 0 ];
6388
6389                 if ( !body ) {
6390                         // Test fired too early or in an unsupported environment, exit.
6391                         return;
6392                 }
6393
6394                 container = document.createElement( "div" );
6395                 div = document.createElement( "div" );
6396                 container.style.cssText = containerStyles;
6397
6398                 body.appendChild( container ).appendChild( div );
6399
6400                 div.style.cssText =
6401                         "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
6402                                 "position:absolute;display:block;padding:1px;border:1px;width:4px;" +
6403                                 "margin-top:1%;top:1%";
6404
6405                 // Workaround failing boxSizing test due to offsetWidth returning wrong value
6406                 // with some non-1 values of body zoom, ticket #13543
6407                 jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
6408                         boxSizingVal = div.offsetWidth === 4;
6409                 });
6410
6411                 // Will be changed later if needed.
6412                 boxSizingReliableVal = true;
6413                 pixelPositionVal = false;
6414                 reliableMarginRightVal = true;
6415
6416                 // Use window.getComputedStyle because jsdom on node.js will break without it.
6417                 if ( window.getComputedStyle ) {
6418                         pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
6419                         boxSizingReliableVal =
6420                                 ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
6421                 }
6422
6423                 body.removeChild( container );
6424
6425                 // Null elements to avoid leaks in IE.
6426                 div = body = null;
6427         }
6428
6429 })();
6430
6431
6432 // A method for quickly swapping in/out CSS properties to get correct calculations.
6433 jQuery.swap = function( elem, options, callback, args ) {
6434         var ret, name,
6435                 old = {};
6436
6437         // Remember the old values, and insert the new ones
6438         for ( name in options ) {
6439                 old[ name ] = elem.style[ name ];
6440                 elem.style[ name ] = options[ name ];
6441         }
6442
6443         ret = callback.apply( elem, args || [] );
6444
6445         // Revert the old values
6446         for ( name in options ) {
6447                 elem.style[ name ] = old[ name ];
6448         }
6449
6450         return ret;
6451 };
6452
6453
6454 var
6455                 ralpha = /alpha\([^)]*\)/i,
6456         ropacity = /opacity\s*=\s*([^)]*)/,
6457
6458         // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
6459         // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6460         rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6461         rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
6462         rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
6463
6464         cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6465         cssNormalTransform = {
6466                 letterSpacing: 0,
6467                 fontWeight: 400
6468         },
6469
6470         cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
6471
6472
6473 // return a css property mapped to a potentially vendor prefixed property
6474 function vendorPropName( style, name ) {
6475
6476         // shortcut for names that are not vendor prefixed
6477         if ( name in style ) {
6478                 return name;
6479         }
6480
6481         // check for vendor prefixed names
6482         var capName = name.charAt(0).toUpperCase() + name.slice(1),
6483                 origName = name,
6484                 i = cssPrefixes.length;
6485
6486         while ( i-- ) {
6487                 name = cssPrefixes[ i ] + capName;
6488                 if ( name in style ) {
6489                         return name;
6490                 }
6491         }
6492
6493         return origName;
6494 }
6495
6496 function showHide( elements, show ) {
6497         var display, elem, hidden,
6498                 values = [],
6499                 index = 0,
6500                 length = elements.length;
6501
6502         for ( ; index < length; index++ ) {
6503                 elem = elements[ index ];
6504                 if ( !elem.style ) {
6505                         continue;
6506                 }
6507
6508                 values[ index ] = jQuery._data( elem, "olddisplay" );
6509                 display = elem.style.display;
6510                 if ( show ) {
6511                         // Reset the inline display of this element to learn if it is
6512                         // being hidden by cascaded rules or not
6513                         if ( !values[ index ] && display === "none" ) {
6514                                 elem.style.display = "";
6515                         }
6516
6517                         // Set elements which have been overridden with display: none
6518                         // in a stylesheet to whatever the default browser style is
6519                         // for such an element
6520                         if ( elem.style.display === "" && isHidden( elem ) ) {
6521                                 values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
6522                         }
6523                 } else {
6524
6525                         if ( !values[ index ] ) {
6526                                 hidden = isHidden( elem );
6527
6528                                 if ( display && display !== "none" || !hidden ) {
6529                                         jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
6530                                 }
6531                         }
6532                 }
6533         }
6534
6535         // Set the display of most of the elements in a second loop
6536         // to avoid the constant reflow
6537         for ( index = 0; index < length; index++ ) {
6538                 elem = elements[ index ];
6539                 if ( !elem.style ) {
6540                         continue;
6541                 }
6542                 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6543                         elem.style.display = show ? values[ index ] || "" : "none";
6544                 }
6545         }
6546
6547         return elements;
6548 }
6549
6550 function setPositiveNumber( elem, value, subtract ) {
6551         var matches = rnumsplit.exec( value );
6552         return matches ?
6553                 // Guard against undefined "subtract", e.g., when used as in cssHooks
6554                 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
6555                 value;
6556 }
6557
6558 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6559         var i = extra === ( isBorderBox ? "border" : "content" ) ?
6560                 // If we already have the right measurement, avoid augmentation
6561                 4 :
6562                 // Otherwise initialize for horizontal or vertical properties
6563                 name === "width" ? 1 : 0,
6564
6565                 val = 0;
6566
6567         for ( ; i < 4; i += 2 ) {
6568                 // both box models exclude margin, so add it if we want it
6569                 if ( extra === "margin" ) {
6570                         val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6571                 }
6572
6573                 if ( isBorderBox ) {
6574                         // border-box includes padding, so remove it if we want content
6575                         if ( extra === "content" ) {
6576                                 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6577                         }
6578
6579                         // at this point, extra isn't border nor margin, so remove border
6580                         if ( extra !== "margin" ) {
6581                                 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6582                         }
6583                 } else {
6584                         // at this point, extra isn't content, so add padding
6585                         val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6586
6587                         // at this point, extra isn't content nor padding, so add border
6588                         if ( extra !== "padding" ) {
6589                                 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6590                         }
6591                 }
6592         }
6593
6594         return val;
6595 }
6596
6597 function getWidthOrHeight( elem, name, extra ) {
6598
6599         // Start with offset property, which is equivalent to the border-box value
6600         var valueIsBorderBox = true,
6601                 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6602                 styles = getStyles( elem ),
6603                 isBorderBox = support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6604
6605         // some non-html elements return undefined for offsetWidth, so check for null/undefined
6606         // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
6607         // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
6608         if ( val <= 0 || val == null ) {
6609                 // Fall back to computed then uncomputed css if necessary
6610                 val = curCSS( elem, name, styles );
6611                 if ( val < 0 || val == null ) {
6612                         val = elem.style[ name ];
6613                 }
6614
6615                 // Computed unit is not pixels. Stop here and return.
6616                 if ( rnumnonpx.test(val) ) {
6617                         return val;
6618                 }
6619
6620                 // we need the check for style in case a browser which returns unreliable values
6621                 // for getComputedStyle silently falls back to the reliable elem.style
6622                 valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );
6623
6624                 // Normalize "", auto, and prepare for extra
6625                 val = parseFloat( val ) || 0;
6626         }
6627
6628         // use the active box-sizing model to add/subtract irrelevant styles
6629         return ( val +
6630                 augmentWidthOrHeight(
6631                         elem,
6632                         name,
6633                         extra || ( isBorderBox ? "border" : "content" ),
6634                         valueIsBorderBox,
6635                         styles
6636                 )
6637         ) + "px";
6638 }
6639
6640 jQuery.extend({
6641         // Add in style property hooks for overriding the default
6642         // behavior of getting and setting a style property
6643         cssHooks: {
6644                 opacity: {
6645                         get: function( elem, computed ) {
6646                                 if ( computed ) {
6647                                         // We should always get a number back from opacity
6648                                         var ret = curCSS( elem, "opacity" );
6649                                         return ret === "" ? "1" : ret;
6650                                 }
6651                         }
6652                 }
6653         },
6654
6655         // Don't automatically add "px" to these possibly-unitless properties
6656         cssNumber: {
6657                 "columnCount": true,
6658                 "fillOpacity": true,
6659                 "fontWeight": true,
6660                 "lineHeight": true,
6661                 "opacity": true,
6662                 "order": true,
6663                 "orphans": true,
6664                 "widows": true,
6665                 "zIndex": true,
6666                 "zoom": true
6667         },
6668
6669         // Add in properties whose names you wish to fix before
6670         // setting or getting the value
6671         cssProps: {
6672                 // normalize float css property
6673                 "float": support.cssFloat ? "cssFloat" : "styleFloat"
6674         },
6675
6676         // Get and set the style property on a DOM Node
6677         style: function( elem, name, value, extra ) {
6678                 // Don't set styles on text and comment nodes
6679                 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6680                         return;
6681                 }
6682
6683                 // Make sure that we're working with the right name
6684                 var ret, type, hooks,
6685                         origName = jQuery.camelCase( name ),
6686                         style = elem.style;
6687
6688                 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6689
6690                 // gets hook for the prefixed version
6691                 // followed by the unprefixed version
6692                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6693
6694                 // Check if we're setting a value
6695                 if ( value !== undefined ) {
6696                         type = typeof value;
6697
6698                         // convert relative number strings (+= or -=) to relative numbers. #7345
6699                         if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6700                                 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6701                                 // Fixes bug #9237
6702                                 type = "number";
6703                         }
6704
6705                         // Make sure that null and NaN values aren't set. See: #7116
6706                         if ( value == null || value !== value ) {
6707                                 return;
6708                         }
6709
6710                         // If a number was passed in, add 'px' to the (except for certain CSS properties)
6711                         if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6712                                 value += "px";
6713                         }
6714
6715                         // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
6716                         // but it would mean to define eight (for every problematic property) identical functions
6717                         if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
6718                                 style[ name ] = "inherit";
6719                         }
6720
6721                         // If a hook was provided, use that value, otherwise just set the specified value
6722                         if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6723
6724                                 // Support: IE
6725                                 // Swallow errors from 'invalid' CSS values (#5509)
6726                                 try {
6727                                         // Support: Chrome, Safari
6728                                         // Setting style to blank string required to delete "style: x !important;"
6729                                         style[ name ] = "";
6730                                         style[ name ] = value;
6731                                 } catch(e) {}
6732                         }
6733
6734                 } else {
6735                         // If a hook was provided get the non-computed value from there
6736                         if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6737                                 return ret;
6738                         }
6739
6740                         // Otherwise just get the value from the style object
6741                         return style[ name ];
6742                 }
6743         },
6744
6745         css: function( elem, name, extra, styles ) {
6746                 var num, val, hooks,
6747                         origName = jQuery.camelCase( name );
6748
6749                 // Make sure that we're working with the right name
6750                 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6751
6752                 // gets hook for the prefixed version
6753                 // followed by the unprefixed version
6754                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6755
6756                 // If a hook was provided get the computed value from there
6757                 if ( hooks && "get" in hooks ) {
6758                         val = hooks.get( elem, true, extra );
6759                 }
6760
6761                 // Otherwise, if a way to get the computed value exists, use that
6762                 if ( val === undefined ) {
6763                         val = curCSS( elem, name, styles );
6764                 }
6765
6766                 //convert "normal" to computed value
6767                 if ( val === "normal" && name in cssNormalTransform ) {
6768                         val = cssNormalTransform[ name ];
6769                 }
6770
6771                 // Return, converting to number if forced or a qualifier was provided and val looks numeric
6772                 if ( extra === "" || extra ) {
6773                         num = parseFloat( val );
6774                         return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
6775                 }
6776                 return val;
6777         }
6778 });
6779
6780 jQuery.each([ "height", "width" ], function( i, name ) {
6781         jQuery.cssHooks[ name ] = {
6782                 get: function( elem, computed, extra ) {
6783                         if ( computed ) {
6784                                 // certain elements can have dimension info if we invisibly show them
6785                                 // however, it must have a current display style that would benefit from this
6786                                 return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
6787                                         jQuery.swap( elem, cssShow, function() {
6788                                                 return getWidthOrHeight( elem, name, extra );
6789                                         }) :
6790                                         getWidthOrHeight( elem, name, extra );
6791                         }
6792                 },
6793
6794                 set: function( elem, value, extra ) {
6795                         var styles = extra && getStyles( elem );
6796                         return setPositiveNumber( elem, value, extra ?
6797                                 augmentWidthOrHeight(
6798                                         elem,
6799                                         name,
6800                                         extra,
6801                                         support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6802                                         styles
6803                                 ) : 0
6804                         );
6805                 }
6806         };
6807 });
6808
6809 if ( !support.opacity ) {
6810         jQuery.cssHooks.opacity = {
6811                 get: function( elem, computed ) {
6812                         // IE uses filters for opacity
6813                         return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6814                                 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
6815                                 computed ? "1" : "";
6816                 },
6817
6818                 set: function( elem, value ) {
6819                         var style = elem.style,
6820                                 currentStyle = elem.currentStyle,
6821                                 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6822                                 filter = currentStyle && currentStyle.filter || style.filter || "";
6823
6824                         // IE has trouble with opacity if it does not have layout
6825                         // Force it by setting the zoom level
6826                         style.zoom = 1;
6827
6828                         // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6829                         // if value === "", then remove inline opacity #12685
6830                         if ( ( value >= 1 || value === "" ) &&
6831                                         jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
6832                                         style.removeAttribute ) {
6833
6834                                 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6835                                 // if "filter:" is present at all, clearType is disabled, we want to avoid this
6836                                 // style.removeAttribute is IE Only, but so apparently is this code path...
6837                                 style.removeAttribute( "filter" );
6838
6839                                 // if there is no filter style applied in a css rule or unset inline opacity, we are done
6840                                 if ( value === "" || currentStyle && !currentStyle.filter ) {
6841                                         return;
6842                                 }
6843                         }
6844
6845                         // otherwise, set new filter values
6846                         style.filter = ralpha.test( filter ) ?
6847                                 filter.replace( ralpha, opacity ) :
6848                                 filter + " " + opacity;
6849                 }
6850         };
6851 }
6852
6853 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
6854         function( elem, computed ) {
6855                 if ( computed ) {
6856                         // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6857                         // Work around by temporarily setting element display to inline-block
6858                         return jQuery.swap( elem, { "display": "inline-block" },
6859                                 curCSS, [ elem, "marginRight" ] );
6860                 }
6861         }
6862 );
6863
6864 // These hooks are used by animate to expand properties
6865 jQuery.each({
6866         margin: "",
6867         padding: "",
6868         border: "Width"
6869 }, function( prefix, suffix ) {
6870         jQuery.cssHooks[ prefix + suffix ] = {
6871                 expand: function( value ) {
6872                         var i = 0,
6873                                 expanded = {},
6874
6875                                 // assumes a single number if not a string
6876                                 parts = typeof value === "string" ? value.split(" ") : [ value ];
6877
6878                         for ( ; i < 4; i++ ) {
6879                                 expanded[ prefix + cssExpand[ i ] + suffix ] =
6880                                         parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6881                         }
6882
6883                         return expanded;
6884                 }
6885         };
6886
6887         if ( !rmargin.test( prefix ) ) {
6888                 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6889         }
6890 });
6891
6892 jQuery.fn.extend({
6893         css: function( name, value ) {
6894                 return access( this, function( elem, name, value ) {
6895                         var styles, len,
6896                                 map = {},
6897                                 i = 0;
6898
6899                         if ( jQuery.isArray( name ) ) {
6900                                 styles = getStyles( elem );
6901                                 len = name.length;
6902
6903                                 for ( ; i < len; i++ ) {
6904                                         map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6905                                 }
6906
6907                                 return map;
6908                         }
6909
6910                         return value !== undefined ?
6911                                 jQuery.style( elem, name, value ) :
6912                                 jQuery.css( elem, name );
6913                 }, name, value, arguments.length > 1 );
6914         },
6915         show: function() {
6916                 return showHide( this, true );
6917         },
6918         hide: function() {
6919                 return showHide( this );
6920         },
6921         toggle: function( state ) {
6922                 if ( typeof state === "boolean" ) {
6923                         return state ? this.show() : this.hide();
6924                 }
6925
6926                 return this.each(function() {
6927                         if ( isHidden( this ) ) {
6928                                 jQuery( this ).show();
6929                         } else {
6930                                 jQuery( this ).hide();
6931                         }
6932                 });
6933         }
6934 });
6935
6936
6937 function Tween( elem, options, prop, end, easing ) {
6938         return new Tween.prototype.init( elem, options, prop, end, easing );
6939 }
6940 jQuery.Tween = Tween;
6941
6942 Tween.prototype = {
6943         constructor: Tween,
6944         init: function( elem, options, prop, end, easing, unit ) {
6945                 this.elem = elem;
6946                 this.prop = prop;
6947                 this.easing = easing || "swing";
6948                 this.options = options;
6949                 this.start = this.now = this.cur();
6950                 this.end = end;
6951                 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6952         },
6953         cur: function() {
6954                 var hooks = Tween.propHooks[ this.prop ];
6955
6956                 return hooks && hooks.get ?
6957                         hooks.get( this ) :
6958                         Tween.propHooks._default.get( this );
6959         },
6960         run: function( percent ) {
6961                 var eased,
6962                         hooks = Tween.propHooks[ this.prop ];
6963
6964                 if ( this.options.duration ) {
6965                         this.pos = eased = jQuery.easing[ this.easing ](
6966                                 percent, this.options.duration * percent, 0, 1, this.options.duration
6967                         );
6968                 } else {
6969                         this.pos = eased = percent;
6970                 }
6971                 this.now = ( this.end - this.start ) * eased + this.start;
6972
6973                 if ( this.options.step ) {
6974                         this.options.step.call( this.elem, this.now, this );
6975                 }
6976
6977                 if ( hooks && hooks.set ) {
6978                         hooks.set( this );
6979                 } else {
6980                         Tween.propHooks._default.set( this );
6981                 }
6982                 return this;
6983         }
6984 };
6985
6986 Tween.prototype.init.prototype = Tween.prototype;
6987
6988 Tween.propHooks = {
6989         _default: {
6990                 get: function( tween ) {
6991                         var result;
6992
6993                         if ( tween.elem[ tween.prop ] != null &&
6994                                 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
6995                                 return tween.elem[ tween.prop ];
6996                         }
6997
6998                         // passing an empty string as a 3rd parameter to .css will automatically
6999                         // attempt a parseFloat and fallback to a string if the parse fails
7000                         // so, simple values such as "10px" are parsed to Float.
7001                         // complex values such as "rotate(1rad)" are returned as is.
7002                         result = jQuery.css( tween.elem, tween.prop, "" );
7003                         // Empty strings, null, undefined and "auto" are converted to 0.
7004                         return !result || result === "auto" ? 0 : result;
7005                 },
7006                 set: function( tween ) {
7007                         // use step hook for back compat - use cssHook if its there - use .style if its
7008                         // available and use plain properties where available
7009                         if ( jQuery.fx.step[ tween.prop ] ) {
7010                                 jQuery.fx.step[ tween.prop ]( tween );
7011                         } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
7012                                 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7013                         } else {
7014                                 tween.elem[ tween.prop ] = tween.now;
7015                         }
7016                 }
7017         }
7018 };
7019
7020 // Support: IE <=9
7021 // Panic based approach to setting things on disconnected nodes
7022
7023 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
7024         set: function( tween ) {
7025                 if ( tween.elem.nodeType && tween.elem.parentNode ) {
7026                         tween.elem[ tween.prop ] = tween.now;
7027                 }
7028         }
7029 };
7030
7031 jQuery.easing = {
7032         linear: function( p ) {
7033                 return p;
7034         },
7035         swing: function( p ) {
7036                 return 0.5 - Math.cos( p * Math.PI ) / 2;
7037         }
7038 };
7039
7040 jQuery.fx = Tween.prototype.init;
7041
7042 // Back Compat <1.8 extension point
7043 jQuery.fx.step = {};
7044
7045
7046
7047
7048 var
7049         fxNow, timerId,
7050         rfxtypes = /^(?:toggle|show|hide)$/,
7051         rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
7052         rrun = /queueHooks$/,
7053         animationPrefilters = [ defaultPrefilter ],
7054         tweeners = {
7055                 "*": [ function( prop, value ) {
7056                         var tween = this.createTween( prop, value ),
7057                                 target = tween.cur(),
7058                                 parts = rfxnum.exec( value ),
7059                                 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
7060
7061                                 // Starting value computation is required for potential unit mismatches
7062                                 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
7063                                         rfxnum.exec( jQuery.css( tween.elem, prop ) ),
7064                                 scale = 1,
7065                                 maxIterations = 20;
7066
7067                         if ( start && start[ 3 ] !== unit ) {
7068                                 // Trust units reported by jQuery.css
7069                                 unit = unit || start[ 3 ];
7070
7071                                 // Make sure we update the tween properties later on
7072                                 parts = parts || [];
7073
7074                                 // Iteratively approximate from a nonzero starting point
7075                                 start = +target || 1;
7076
7077                                 do {
7078                                         // If previous iteration zeroed out, double until we get *something*
7079                                         // Use a string for doubling factor so we don't accidentally see scale as unchanged below
7080                                         scale = scale || ".5";
7081
7082                                         // Adjust and apply
7083                                         start = start / scale;
7084                                         jQuery.style( tween.elem, prop, start + unit );
7085
7086                                 // Update scale, tolerating zero or NaN from tween.cur()
7087                                 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
7088                                 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
7089                         }
7090
7091                         // Update tween properties
7092                         if ( parts ) {
7093                                 start = tween.start = +start || +target || 0;
7094                                 tween.unit = unit;
7095                                 // If a +=/-= token was provided, we're doing a relative animation
7096                                 tween.end = parts[ 1 ] ?
7097                                         start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
7098                                         +parts[ 2 ];
7099                         }
7100
7101                         return tween;
7102                 } ]
7103         };
7104
7105 // Animations created synchronously will run synchronously
7106 function createFxNow() {
7107         setTimeout(function() {
7108                 fxNow = undefined;
7109         });
7110         return ( fxNow = jQuery.now() );
7111 }
7112
7113 // Generate parameters to create a standard animation
7114 function genFx( type, includeWidth ) {
7115         var which,
7116                 attrs = { height: type },
7117                 i = 0;
7118
7119         // if we include width, step value is 1 to do all cssExpand values,
7120         // if we don't include width, step value is 2 to skip over Left and Right
7121         includeWidth = includeWidth ? 1 : 0;
7122         for ( ; i < 4 ; i += 2 - includeWidth ) {
7123                 which = cssExpand[ i ];
7124                 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7125         }
7126
7127         if ( includeWidth ) {
7128                 attrs.opacity = attrs.width = type;
7129         }
7130
7131         return attrs;
7132 }
7133
7134 function createTween( value, prop, animation ) {
7135         var tween,
7136                 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
7137                 index = 0,
7138                 length = collection.length;
7139         for ( ; index < length; index++ ) {
7140                 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
7141
7142                         // we're done with this property
7143                         return tween;
7144                 }
7145         }
7146 }
7147
7148 function defaultPrefilter( elem, props, opts ) {
7149         /* jshint validthis: true */
7150         var prop, value, toggle, tween, hooks, oldfire, display, dDisplay,
7151                 anim = this,
7152                 orig = {},
7153                 style = elem.style,
7154                 hidden = elem.nodeType && isHidden( elem ),
7155                 dataShow = jQuery._data( elem, "fxshow" );
7156
7157         // handle queue: false promises
7158         if ( !opts.queue ) {
7159                 hooks = jQuery._queueHooks( elem, "fx" );
7160                 if ( hooks.unqueued == null ) {
7161                         hooks.unqueued = 0;
7162                         oldfire = hooks.empty.fire;
7163                         hooks.empty.fire = function() {
7164                                 if ( !hooks.unqueued ) {
7165                                         oldfire();
7166                                 }
7167                         };
7168                 }
7169                 hooks.unqueued++;
7170
7171                 anim.always(function() {
7172                         // doing this makes sure that the complete handler will be called
7173                         // before this completes
7174                         anim.always(function() {
7175                                 hooks.unqueued--;
7176                                 if ( !jQuery.queue( elem, "fx" ).length ) {
7177                                         hooks.empty.fire();
7178                                 }
7179                         });
7180                 });
7181         }
7182
7183         // height/width overflow pass
7184         if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
7185                 // Make sure that nothing sneaks out
7186                 // Record all 3 overflow attributes because IE does not
7187                 // change the overflow attribute when overflowX and
7188                 // overflowY are set to the same value
7189                 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7190
7191                 // Set display property to inline-block for height/width
7192                 // animations on inline elements that are having width/height animated
7193                 display = jQuery.css( elem, "display" );
7194                 dDisplay = defaultDisplay( elem.nodeName );
7195                 if ( display === "none" ) {
7196                         display = dDisplay;
7197                 }
7198                 if ( display === "inline" &&
7199                                 jQuery.css( elem, "float" ) === "none" ) {
7200
7201                         // inline-level elements accept inline-block;
7202                         // block-level elements need to be inline with layout
7203                         if ( !support.inlineBlockNeedsLayout || dDisplay === "inline" ) {
7204                                 style.display = "inline-block";
7205                         } else {
7206                                 style.zoom = 1;
7207                         }
7208                 }
7209         }
7210
7211         if ( opts.overflow ) {
7212                 style.overflow = "hidden";
7213                 if ( !support.shrinkWrapBlocks() ) {
7214                         anim.always(function() {
7215                                 style.overflow = opts.overflow[ 0 ];
7216                                 style.overflowX = opts.overflow[ 1 ];
7217                                 style.overflowY = opts.overflow[ 2 ];
7218                         });
7219                 }
7220         }
7221
7222         // show/hide pass
7223         for ( prop in props ) {
7224                 value = props[ prop ];
7225                 if ( rfxtypes.exec( value ) ) {
7226                         delete props[ prop ];
7227                         toggle = toggle || value === "toggle";
7228                         if ( value === ( hidden ? "hide" : "show" ) ) {
7229
7230                                 // 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
7231                                 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
7232                                         hidden = true;
7233                                 } else {
7234                                         continue;
7235                                 }
7236                         }
7237                         orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
7238                 }
7239         }
7240
7241         if ( !jQuery.isEmptyObject( orig ) ) {
7242                 if ( dataShow ) {
7243                         if ( "hidden" in dataShow ) {
7244                                 hidden = dataShow.hidden;
7245                         }
7246                 } else {
7247                         dataShow = jQuery._data( elem, "fxshow", {} );
7248                 }
7249
7250                 // store state if its toggle - enables .stop().toggle() to "reverse"
7251                 if ( toggle ) {
7252                         dataShow.hidden = !hidden;
7253                 }
7254                 if ( hidden ) {
7255                         jQuery( elem ).show();
7256                 } else {
7257                         anim.done(function() {
7258                                 jQuery( elem ).hide();
7259                         });
7260                 }
7261                 anim.done(function() {
7262                         var prop;
7263                         jQuery._removeData( elem, "fxshow" );
7264                         for ( prop in orig ) {
7265                                 jQuery.style( elem, prop, orig[ prop ] );
7266                         }
7267                 });
7268                 for ( prop in orig ) {
7269                         tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7270
7271                         if ( !( prop in dataShow ) ) {
7272                                 dataShow[ prop ] = tween.start;
7273                                 if ( hidden ) {
7274                                         tween.end = tween.start;
7275                                         tween.start = prop === "width" || prop === "height" ? 1 : 0;
7276                                 }
7277                         }
7278                 }
7279         }
7280 }
7281
7282 function propFilter( props, specialEasing ) {
7283         var index, name, easing, value, hooks;
7284
7285         // camelCase, specialEasing and expand cssHook pass
7286         for ( index in props ) {
7287                 name = jQuery.camelCase( index );
7288                 easing = specialEasing[ name ];
7289                 value = props[ index ];
7290                 if ( jQuery.isArray( value ) ) {
7291                         easing = value[ 1 ];
7292                         value = props[ index ] = value[ 0 ];
7293                 }
7294
7295                 if ( index !== name ) {
7296                         props[ name ] = value;
7297                         delete props[ index ];
7298                 }
7299
7300                 hooks = jQuery.cssHooks[ name ];
7301                 if ( hooks && "expand" in hooks ) {
7302                         value = hooks.expand( value );
7303                         delete props[ name ];
7304
7305                         // not quite $.extend, this wont overwrite keys already present.
7306                         // also - reusing 'index' from above because we have the correct "name"
7307                         for ( index in value ) {
7308                                 if ( !( index in props ) ) {
7309                                         props[ index ] = value[ index ];
7310                                         specialEasing[ index ] = easing;
7311                                 }
7312                         }
7313                 } else {
7314                         specialEasing[ name ] = easing;
7315                 }
7316         }
7317 }
7318
7319 function Animation( elem, properties, options ) {
7320         var result,
7321                 stopped,
7322                 index = 0,
7323                 length = animationPrefilters.length,
7324                 deferred = jQuery.Deferred().always( function() {
7325                         // don't match elem in the :animated selector
7326                         delete tick.elem;
7327                 }),
7328                 tick = function() {
7329                         if ( stopped ) {
7330                                 return false;
7331                         }
7332                         var currentTime = fxNow || createFxNow(),
7333                                 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7334                                 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
7335                                 temp = remaining / animation.duration || 0,
7336                                 percent = 1 - temp,
7337                                 index = 0,
7338                                 length = animation.tweens.length;
7339
7340                         for ( ; index < length ; index++ ) {
7341                                 animation.tweens[ index ].run( percent );
7342                         }
7343
7344                         deferred.notifyWith( elem, [ animation, percent, remaining ]);
7345
7346                         if ( percent < 1 && length ) {
7347                                 return remaining;
7348                         } else {
7349                                 deferred.resolveWith( elem, [ animation ] );
7350                                 return false;
7351                         }
7352                 },
7353                 animation = deferred.promise({
7354                         elem: elem,
7355                         props: jQuery.extend( {}, properties ),
7356                         opts: jQuery.extend( true, { specialEasing: {} }, options ),
7357                         originalProperties: properties,
7358                         originalOptions: options,
7359                         startTime: fxNow || createFxNow(),
7360                         duration: options.duration,
7361                         tweens: [],
7362                         createTween: function( prop, end ) {
7363                                 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7364                                                 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7365                                 animation.tweens.push( tween );
7366                                 return tween;
7367                         },
7368                         stop: function( gotoEnd ) {
7369                                 var index = 0,
7370                                         // if we are going to the end, we want to run all the tweens
7371                                         // otherwise we skip this part
7372                                         length = gotoEnd ? animation.tweens.length : 0;
7373                                 if ( stopped ) {
7374                                         return this;
7375                                 }
7376                                 stopped = true;
7377                                 for ( ; index < length ; index++ ) {
7378                                         animation.tweens[ index ].run( 1 );
7379                                 }
7380
7381                                 // resolve when we played the last frame
7382                                 // otherwise, reject
7383                                 if ( gotoEnd ) {
7384                                         deferred.resolveWith( elem, [ animation, gotoEnd ] );
7385                                 } else {
7386                                         deferred.rejectWith( elem, [ animation, gotoEnd ] );
7387                                 }
7388                                 return this;
7389                         }
7390                 }),
7391                 props = animation.props;
7392
7393         propFilter( props, animation.opts.specialEasing );
7394
7395         for ( ; index < length ; index++ ) {
7396                 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
7397                 if ( result ) {
7398                         return result;
7399                 }
7400         }
7401
7402         jQuery.map( props, createTween, animation );
7403
7404         if ( jQuery.isFunction( animation.opts.start ) ) {
7405                 animation.opts.start.call( elem, animation );
7406         }
7407
7408         jQuery.fx.timer(
7409                 jQuery.extend( tick, {
7410                         elem: elem,
7411                         anim: animation,
7412                         queue: animation.opts.queue
7413                 })
7414         );
7415
7416         // attach callbacks from options
7417         return animation.progress( animation.opts.progress )
7418                 .done( animation.opts.done, animation.opts.complete )
7419                 .fail( animation.opts.fail )
7420                 .always( animation.opts.always );
7421 }
7422
7423 jQuery.Animation = jQuery.extend( Animation, {
7424         tweener: function( props, callback ) {
7425                 if ( jQuery.isFunction( props ) ) {
7426                         callback = props;
7427                         props = [ "*" ];
7428                 } else {
7429                         props = props.split(" ");
7430                 }
7431
7432                 var prop,
7433                         index = 0,
7434                         length = props.length;
7435
7436                 for ( ; index < length ; index++ ) {
7437                         prop = props[ index ];
7438                         tweeners[ prop ] = tweeners[ prop ] || [];
7439                         tweeners[ prop ].unshift( callback );
7440                 }
7441         },
7442
7443         prefilter: function( callback, prepend ) {
7444                 if ( prepend ) {
7445                         animationPrefilters.unshift( callback );
7446                 } else {
7447                         animationPrefilters.push( callback );
7448                 }
7449         }
7450 });
7451
7452 jQuery.speed = function( speed, easing, fn ) {
7453         var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7454                 complete: fn || !fn && easing ||
7455                         jQuery.isFunction( speed ) && speed,
7456                 duration: speed,
7457                 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7458         };
7459
7460         opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
7461                 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
7462
7463         // normalize opt.queue - true/undefined/null -> "fx"
7464         if ( opt.queue == null || opt.queue === true ) {
7465                 opt.queue = "fx";
7466         }
7467
7468         // Queueing
7469         opt.old = opt.complete;
7470
7471         opt.complete = function() {
7472                 if ( jQuery.isFunction( opt.old ) ) {
7473                         opt.old.call( this );
7474                 }
7475
7476                 if ( opt.queue ) {
7477                         jQuery.dequeue( this, opt.queue );
7478                 }
7479         };
7480
7481         return opt;
7482 };
7483
7484 jQuery.fn.extend({
7485         fadeTo: function( speed, to, easing, callback ) {
7486
7487                 // show any hidden elements after setting opacity to 0
7488                 return this.filter( isHidden ).css( "opacity", 0 ).show()
7489
7490                         // animate to the value specified
7491                         .end().animate({ opacity: to }, speed, easing, callback );
7492         },
7493         animate: function( prop, speed, easing, callback ) {
7494                 var empty = jQuery.isEmptyObject( prop ),
7495                         optall = jQuery.speed( speed, easing, callback ),
7496                         doAnimation = function() {
7497                                 // Operate on a copy of prop so per-property easing won't be lost
7498                                 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7499
7500                                 // Empty animations, or finishing resolves immediately
7501                                 if ( empty || jQuery._data( this, "finish" ) ) {
7502                                         anim.stop( true );
7503                                 }
7504                         };
7505                         doAnimation.finish = doAnimation;
7506
7507                 return empty || optall.queue === false ?
7508                         this.each( doAnimation ) :
7509                         this.queue( optall.queue, doAnimation );
7510         },
7511         stop: function( type, clearQueue, gotoEnd ) {
7512                 var stopQueue = function( hooks ) {
7513                         var stop = hooks.stop;
7514                         delete hooks.stop;
7515                         stop( gotoEnd );
7516                 };
7517
7518                 if ( typeof type !== "string" ) {
7519                         gotoEnd = clearQueue;
7520                         clearQueue = type;
7521                         type = undefined;
7522                 }
7523                 if ( clearQueue && type !== false ) {
7524                         this.queue( type || "fx", [] );
7525                 }
7526
7527                 return this.each(function() {
7528                         var dequeue = true,
7529                                 index = type != null && type + "queueHooks",
7530                                 timers = jQuery.timers,
7531                                 data = jQuery._data( this );
7532
7533                         if ( index ) {
7534                                 if ( data[ index ] && data[ index ].stop ) {
7535                                         stopQueue( data[ index ] );
7536                                 }
7537                         } else {
7538                                 for ( index in data ) {
7539                                         if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7540                                                 stopQueue( data[ index ] );
7541                                         }
7542                                 }
7543                         }
7544
7545                         for ( index = timers.length; index--; ) {
7546                                 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
7547                                         timers[ index ].anim.stop( gotoEnd );
7548                                         dequeue = false;
7549                                         timers.splice( index, 1 );
7550                                 }
7551                         }
7552
7553                         // start the next in the queue if the last step wasn't forced
7554                         // timers currently will call their complete callbacks, which will dequeue
7555                         // but only if they were gotoEnd
7556                         if ( dequeue || !gotoEnd ) {
7557                                 jQuery.dequeue( this, type );
7558                         }
7559                 });
7560         },
7561         finish: function( type ) {
7562                 if ( type !== false ) {
7563                         type = type || "fx";
7564                 }
7565                 return this.each(function() {
7566                         var index,
7567                                 data = jQuery._data( this ),
7568                                 queue = data[ type + "queue" ],
7569                                 hooks = data[ type + "queueHooks" ],
7570                                 timers = jQuery.timers,
7571                                 length = queue ? queue.length : 0;
7572
7573                         // enable finishing flag on private data
7574                         data.finish = true;
7575
7576                         // empty the queue first
7577                         jQuery.queue( this, type, [] );
7578
7579                         if ( hooks && hooks.stop ) {
7580                                 hooks.stop.call( this, true );
7581                         }
7582
7583                         // look for any active animations, and finish them
7584                         for ( index = timers.length; index--; ) {
7585                                 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7586                                         timers[ index ].anim.stop( true );
7587                                         timers.splice( index, 1 );
7588                                 }
7589                         }
7590
7591                         // look for any animations in the old queue and finish them
7592                         for ( index = 0; index < length; index++ ) {
7593                                 if ( queue[ index ] && queue[ index ].finish ) {
7594                                         queue[ index ].finish.call( this );
7595                                 }
7596                         }
7597
7598                         // turn off finishing flag
7599                         delete data.finish;
7600                 });
7601         }
7602 });
7603
7604 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
7605         var cssFn = jQuery.fn[ name ];
7606         jQuery.fn[ name ] = function( speed, easing, callback ) {
7607                 return speed == null || typeof speed === "boolean" ?
7608                         cssFn.apply( this, arguments ) :
7609                         this.animate( genFx( name, true ), speed, easing, callback );
7610         };
7611 });
7612
7613 // Generate shortcuts for custom animations
7614 jQuery.each({
7615         slideDown: genFx("show"),
7616         slideUp: genFx("hide"),
7617         slideToggle: genFx("toggle"),
7618         fadeIn: { opacity: "show" },
7619         fadeOut: { opacity: "hide" },
7620         fadeToggle: { opacity: "toggle" }
7621 }, function( name, props ) {
7622         jQuery.fn[ name ] = function( speed, easing, callback ) {
7623                 return this.animate( props, speed, easing, callback );
7624         };
7625 });
7626
7627 jQuery.timers = [];
7628 jQuery.fx.tick = function() {
7629         var timer,
7630                 timers = jQuery.timers,
7631                 i = 0;
7632
7633         fxNow = jQuery.now();
7634
7635         for ( ; i < timers.length; i++ ) {
7636                 timer = timers[ i ];
7637                 // Checks the timer has not already been removed
7638                 if ( !timer() && timers[ i ] === timer ) {
7639                         timers.splice( i--, 1 );
7640                 }
7641         }
7642
7643         if ( !timers.length ) {
7644                 jQuery.fx.stop();
7645         }
7646         fxNow = undefined;
7647 };
7648
7649 jQuery.fx.timer = function( timer ) {
7650         jQuery.timers.push( timer );
7651         if ( timer() ) {
7652                 jQuery.fx.start();
7653         } else {
7654                 jQuery.timers.pop();
7655         }
7656 };
7657
7658 jQuery.fx.interval = 13;
7659
7660 jQuery.fx.start = function() {
7661         if ( !timerId ) {
7662                 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
7663         }
7664 };
7665
7666 jQuery.fx.stop = function() {
7667         clearInterval( timerId );
7668         timerId = null;
7669 };
7670
7671 jQuery.fx.speeds = {
7672         slow: 600,
7673         fast: 200,
7674         // Default speed
7675         _default: 400
7676 };
7677
7678
7679 // Based off of the plugin by Clint Helfers, with permission.
7680 // http://blindsignals.com/index.php/2009/07/jquery-delay/
7681 jQuery.fn.delay = function( time, type ) {
7682         time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7683         type = type || "fx";
7684
7685         return this.queue( type, function( next, hooks ) {
7686                 var timeout = setTimeout( next, time );
7687                 hooks.stop = function() {
7688                         clearTimeout( timeout );
7689                 };
7690         });
7691 };
7692
7693
7694 (function() {
7695         var a, input, select, opt,
7696                 div = document.createElement("div" );
7697
7698         // Setup
7699         div.setAttribute( "className", "t" );
7700         div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
7701         a = div.getElementsByTagName("a")[ 0 ];
7702
7703         // First batch of tests.
7704         select = document.createElement("select");
7705         opt = select.appendChild( document.createElement("option") );
7706         input = div.getElementsByTagName("input")[ 0 ];
7707
7708         a.style.cssText = "top:1px";
7709
7710         // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
7711         support.getSetAttribute = div.className !== "t";
7712
7713         // Get the style information from getAttribute
7714         // (IE uses .cssText instead)
7715         support.style = /top/.test( a.getAttribute("style") );
7716
7717         // Make sure that URLs aren't manipulated
7718         // (IE normalizes it by default)
7719         support.hrefNormalized = a.getAttribute("href") === "/a";
7720
7721         // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
7722         support.checkOn = !!input.value;
7723
7724         // Make sure that a selected-by-default option has a working selected property.
7725         // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
7726         support.optSelected = opt.selected;
7727
7728         // Tests for enctype support on a form (#6743)
7729         support.enctype = !!document.createElement("form").enctype;
7730
7731         // Make sure that the options inside disabled selects aren't marked as disabled
7732         // (WebKit marks them as disabled)
7733         select.disabled = true;
7734         support.optDisabled = !opt.disabled;
7735
7736         // Support: IE8 only
7737         // Check if we can trust getAttribute("value")
7738         input = document.createElement( "input" );
7739         input.setAttribute( "value", "" );
7740         support.input = input.getAttribute( "value" ) === "";
7741
7742         // Check if an input maintains its value after becoming a radio
7743         input.value = "t";
7744         input.setAttribute( "type", "radio" );
7745         support.radioValue = input.value === "t";
7746
7747         // Null elements to avoid leaks in IE.
7748         a = input = select = opt = div = null;
7749 })();
7750
7751
7752 var rreturn = /\r/g;
7753
7754 jQuery.fn.extend({
7755         val: function( value ) {
7756                 var hooks, ret, isFunction,
7757                         elem = this[0];
7758
7759                 if ( !arguments.length ) {
7760                         if ( elem ) {
7761                                 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7762
7763                                 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
7764                                         return ret;
7765                                 }
7766
7767                                 ret = elem.value;
7768
7769                                 return typeof ret === "string" ?
7770                                         // handle most common string cases
7771                                         ret.replace(rreturn, "") :
7772                                         // handle cases where value is null/undef or number
7773                                         ret == null ? "" : ret;
7774                         }
7775
7776                         return;
7777                 }
7778
7779                 isFunction = jQuery.isFunction( value );
7780
7781                 return this.each(function( i ) {
7782                         var val;
7783
7784                         if ( this.nodeType !== 1 ) {
7785                                 return;
7786                         }
7787
7788                         if ( isFunction ) {
7789                                 val = value.call( this, i, jQuery( this ).val() );
7790                         } else {
7791                                 val = value;
7792                         }
7793
7794                         // Treat null/undefined as ""; convert numbers to string
7795                         if ( val == null ) {
7796                                 val = "";
7797                         } else if ( typeof val === "number" ) {
7798                                 val += "";
7799                         } else if ( jQuery.isArray( val ) ) {
7800                                 val = jQuery.map( val, function( value ) {
7801                                         return value == null ? "" : value + "";
7802                                 });
7803                         }
7804
7805                         hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7806
7807                         // If set returns undefined, fall back to normal setting
7808                         if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
7809                                 this.value = val;
7810                         }
7811                 });
7812         }
7813 });
7814
7815 jQuery.extend({
7816         valHooks: {
7817                 option: {
7818                         get: function( elem ) {
7819                                 var val = jQuery.find.attr( elem, "value" );
7820                                 return val != null ?
7821                                         val :
7822                                         jQuery.text( elem );
7823                         }
7824                 },
7825                 select: {
7826                         get: function( elem ) {
7827                                 var value, option,
7828                                         options = elem.options,
7829                                         index = elem.selectedIndex,
7830                                         one = elem.type === "select-one" || index < 0,
7831                                         values = one ? null : [],
7832                                         max = one ? index + 1 : options.length,
7833                                         i = index < 0 ?
7834                                                 max :
7835                                                 one ? index : 0;
7836
7837                                 // Loop through all the selected options
7838                                 for ( ; i < max; i++ ) {
7839                                         option = options[ i ];
7840
7841                                         // oldIE doesn't update selected after form reset (#2551)
7842                                         if ( ( option.selected || i === index ) &&
7843                                                         // Don't return options that are disabled or in a disabled optgroup
7844                                                         ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
7845                                                         ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
7846
7847                                                 // Get the specific value for the option
7848                                                 value = jQuery( option ).val();
7849
7850                                                 // We don't need an array for one selects
7851                                                 if ( one ) {
7852                                                         return value;
7853                                                 }
7854
7855                                                 // Multi-Selects return an array
7856                                                 values.push( value );
7857                                         }
7858                                 }
7859
7860                                 return values;
7861                         },
7862
7863                         set: function( elem, value ) {
7864                                 var optionSet, option,
7865                                         options = elem.options,
7866                                         values = jQuery.makeArray( value ),
7867                                         i = options.length;
7868
7869                                 while ( i-- ) {
7870                                         option = options[ i ];
7871
7872                                         if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
7873
7874                                                 // Support: IE6
7875                                                 // When new option element is added to select box we need to
7876                                                 // force reflow of newly added node in order to workaround delay
7877                                                 // of initialization properties
7878                                                 try {
7879                                                         option.selected = optionSet = true;
7880
7881                                                 } catch ( _ ) {
7882
7883                                                         // Will be executed only in IE6
7884                                                         option.scrollHeight;
7885                                                 }
7886
7887                                         } else {
7888                                                 option.selected = false;
7889                                         }
7890                                 }
7891
7892                                 // Force browsers to behave consistently when non-matching value is set
7893                                 if ( !optionSet ) {
7894                                         elem.selectedIndex = -1;
7895                                 }
7896
7897                                 return options;
7898                         }
7899                 }
7900         }
7901 });
7902
7903 // Radios and checkboxes getter/setter
7904 jQuery.each([ "radio", "checkbox" ], function() {
7905         jQuery.valHooks[ this ] = {
7906                 set: function( elem, value ) {
7907                         if ( jQuery.isArray( value ) ) {
7908                                 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
7909                         }
7910                 }
7911         };
7912         if ( !support.checkOn ) {
7913                 jQuery.valHooks[ this ].get = function( elem ) {
7914                         // Support: Webkit
7915                         // "" is returned instead of "on" if a value isn't specified
7916                         return elem.getAttribute("value") === null ? "on" : elem.value;
7917                 };
7918         }
7919 });
7920
7921
7922
7923
7924 var nodeHook, boolHook,
7925         attrHandle = jQuery.expr.attrHandle,
7926         ruseDefault = /^(?:checked|selected)$/i,
7927         getSetAttribute = support.getSetAttribute,
7928         getSetInput = support.input;
7929
7930 jQuery.fn.extend({
7931         attr: function( name, value ) {
7932                 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7933         },
7934
7935         removeAttr: function( name ) {
7936                 return this.each(function() {
7937                         jQuery.removeAttr( this, name );
7938                 });
7939         }
7940 });
7941
7942 jQuery.extend({
7943         attr: function( elem, name, value ) {
7944                 var hooks, ret,
7945                         nType = elem.nodeType;
7946
7947                 // don't get/set attributes on text, comment and attribute nodes
7948                 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
7949                         return;
7950                 }
7951
7952                 // Fallback to prop when attributes are not supported
7953                 if ( typeof elem.getAttribute === strundefined ) {
7954                         return jQuery.prop( elem, name, value );
7955                 }
7956
7957                 // All attributes are lowercase
7958                 // Grab necessary hook if one is defined
7959                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7960                         name = name.toLowerCase();
7961                         hooks = jQuery.attrHooks[ name ] ||
7962                                 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
7963                 }
7964
7965                 if ( value !== undefined ) {
7966
7967                         if ( value === null ) {
7968                                 jQuery.removeAttr( elem, name );
7969
7970                         } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
7971                                 return ret;
7972
7973                         } else {
7974                                 elem.setAttribute( name, value + "" );
7975                                 return value;
7976                         }
7977
7978                 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
7979                         return ret;
7980
7981                 } else {
7982                         ret = jQuery.find.attr( elem, name );
7983
7984                         // Non-existent attributes return null, we normalize to undefined
7985                         return ret == null ?
7986                                 undefined :
7987                                 ret;
7988                 }
7989         },
7990
7991         removeAttr: function( elem, value ) {
7992                 var name, propName,
7993                         i = 0,
7994                         attrNames = value && value.match( rnotwhite );
7995
7996                 if ( attrNames && elem.nodeType === 1 ) {
7997                         while ( (name = attrNames[i++]) ) {
7998                                 propName = jQuery.propFix[ name ] || name;
7999
8000                                 // Boolean attributes get special treatment (#10870)
8001                                 if ( jQuery.expr.match.bool.test( name ) ) {
8002                                         // Set corresponding property to false
8003                                         if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
8004                                                 elem[ propName ] = false;
8005                                         // Support: IE<9
8006                                         // Also clear defaultChecked/defaultSelected (if appropriate)
8007                                         } else {
8008                                                 elem[ jQuery.camelCase( "default-" + name ) ] =
8009                                                         elem[ propName ] = false;
8010                                         }
8011
8012                                 // See #9699 for explanation of this approach (setting first, then removal)
8013                                 } else {
8014                                         jQuery.attr( elem, name, "" );
8015                                 }
8016
8017                                 elem.removeAttribute( getSetAttribute ? name : propName );
8018                         }
8019                 }
8020         },
8021
8022         attrHooks: {
8023                 type: {
8024                         set: function( elem, value ) {
8025                                 if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
8026                                         // Setting the type on a radio button after the value resets the value in IE6-9
8027                                         // Reset value to default in case type is set after value during creation
8028                                         var val = elem.value;
8029                                         elem.setAttribute( "type", value );
8030                                         if ( val ) {
8031                                                 elem.value = val;
8032                                         }
8033                                         return value;
8034                                 }
8035                         }
8036                 }
8037         }
8038 });
8039
8040 // Hook for boolean attributes
8041 boolHook = {
8042         set: function( elem, value, name ) {
8043                 if ( value === false ) {
8044                         // Remove boolean attributes when set to false
8045                         jQuery.removeAttr( elem, name );
8046                 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
8047                         // IE<8 needs the *property* name
8048                         elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
8049
8050                 // Use defaultChecked and defaultSelected for oldIE
8051                 } else {
8052                         elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
8053                 }
8054
8055                 return name;
8056         }
8057 };
8058
8059 // Retrieve booleans specially
8060 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
8061
8062         var getter = attrHandle[ name ] || jQuery.find.attr;
8063
8064         attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
8065                 function( elem, name, isXML ) {
8066                         var ret, handle;
8067                         if ( !isXML ) {
8068                                 // Avoid an infinite loop by temporarily removing this function from the getter
8069                                 handle = attrHandle[ name ];
8070                                 attrHandle[ name ] = ret;
8071                                 ret = getter( elem, name, isXML ) != null ?
8072                                         name.toLowerCase() :
8073                                         null;
8074                                 attrHandle[ name ] = handle;
8075                         }
8076                         return ret;
8077                 } :
8078                 function( elem, name, isXML ) {
8079                         if ( !isXML ) {
8080                                 return elem[ jQuery.camelCase( "default-" + name ) ] ?
8081                                         name.toLowerCase() :
8082                                         null;
8083                         }
8084                 };
8085 });
8086
8087 // fix oldIE attroperties
8088 if ( !getSetInput || !getSetAttribute ) {
8089         jQuery.attrHooks.value = {
8090                 set: function( elem, value, name ) {
8091                         if ( jQuery.nodeName( elem, "input" ) ) {
8092                                 // Does not return so that setAttribute is also used
8093                                 elem.defaultValue = value;
8094                         } else {
8095                                 // Use nodeHook if defined (#1954); otherwise setAttribute is fine
8096                                 return nodeHook && nodeHook.set( elem, value, name );
8097                         }
8098                 }
8099         };
8100 }
8101
8102 // IE6/7 do not support getting/setting some attributes with get/setAttribute
8103 if ( !getSetAttribute ) {
8104
8105         // Use this for any attribute in IE6/7
8106         // This fixes almost every IE6/7 issue
8107         nodeHook = {
8108                 set: function( elem, value, name ) {
8109                         // Set the existing or create a new attribute node
8110                         var ret = elem.getAttributeNode( name );
8111                         if ( !ret ) {
8112                                 elem.setAttributeNode(
8113                                         (ret = elem.ownerDocument.createAttribute( name ))
8114                                 );
8115                         }
8116
8117                         ret.value = value += "";
8118
8119                         // Break association with cloned elements by also using setAttribute (#9646)
8120                         if ( name === "value" || value === elem.getAttribute( name ) ) {
8121                                 return value;
8122                         }
8123                 }
8124         };
8125
8126         // Some attributes are constructed with empty-string values when not defined
8127         attrHandle.id = attrHandle.name = attrHandle.coords =
8128                 function( elem, name, isXML ) {
8129                         var ret;
8130                         if ( !isXML ) {
8131                                 return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
8132                                         ret.value :
8133                                         null;
8134                         }
8135                 };
8136
8137         // Fixing value retrieval on a button requires this module
8138         jQuery.valHooks.button = {
8139                 get: function( elem, name ) {
8140                         var ret = elem.getAttributeNode( name );
8141                         if ( ret && ret.specified ) {
8142                                 return ret.value;
8143                         }
8144                 },
8145                 set: nodeHook.set
8146         };
8147
8148         // Set contenteditable to false on removals(#10429)
8149         // Setting to empty string throws an error as an invalid value
8150         jQuery.attrHooks.contenteditable = {
8151                 set: function( elem, value, name ) {
8152                         nodeHook.set( elem, value === "" ? false : value, name );
8153                 }
8154         };
8155
8156         // Set width and height to auto instead of 0 on empty string( Bug #8150 )
8157         // This is for removals
8158         jQuery.each([ "width", "height" ], function( i, name ) {
8159                 jQuery.attrHooks[ name ] = {
8160                         set: function( elem, value ) {
8161                                 if ( value === "" ) {
8162                                         elem.setAttribute( name, "auto" );
8163                                         return value;
8164                                 }
8165                         }
8166                 };
8167         });
8168 }
8169
8170 if ( !support.style ) {
8171         jQuery.attrHooks.style = {
8172                 get: function( elem ) {
8173                         // Return undefined in the case of empty string
8174                         // Note: IE uppercases css property names, but if we were to .toLowerCase()
8175                         // .cssText, that would destroy case senstitivity in URL's, like in "background"
8176                         return elem.style.cssText || undefined;
8177                 },
8178                 set: function( elem, value ) {
8179                         return ( elem.style.cssText = value + "" );
8180                 }
8181         };
8182 }
8183
8184
8185
8186
8187 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
8188         rclickable = /^(?:a|area)$/i;
8189
8190 jQuery.fn.extend({
8191         prop: function( name, value ) {
8192                 return access( this, jQuery.prop, name, value, arguments.length > 1 );
8193         },
8194
8195         removeProp: function( name ) {
8196                 name = jQuery.propFix[ name ] || name;
8197                 return this.each(function() {
8198                         // try/catch handles cases where IE balks (such as removing a property on window)
8199                         try {
8200                                 this[ name ] = undefined;
8201                                 delete this[ name ];
8202                         } catch( e ) {}
8203                 });
8204         }
8205 });
8206
8207 jQuery.extend({
8208         propFix: {
8209                 "for": "htmlFor",
8210                 "class": "className"
8211         },
8212
8213         prop: function( elem, name, value ) {
8214                 var ret, hooks, notxml,
8215                         nType = elem.nodeType;
8216
8217                 // don't get/set properties on text, comment and attribute nodes
8218                 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
8219                         return;
8220                 }
8221
8222                 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
8223
8224                 if ( notxml ) {
8225                         // Fix name and attach hooks
8226                         name = jQuery.propFix[ name ] || name;
8227                         hooks = jQuery.propHooks[ name ];
8228                 }
8229
8230                 if ( value !== undefined ) {
8231                         return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
8232                                 ret :
8233                                 ( elem[ name ] = value );
8234
8235                 } else {
8236                         return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
8237                                 ret :
8238                                 elem[ name ];
8239                 }
8240         },
8241
8242         propHooks: {
8243                 tabIndex: {
8244                         get: function( elem ) {
8245                                 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
8246                                 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
8247                                 // Use proper attribute retrieval(#12072)
8248                                 var tabindex = jQuery.find.attr( elem, "tabindex" );
8249
8250                                 return tabindex ?
8251                                         parseInt( tabindex, 10 ) :
8252                                         rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
8253                                                 0 :
8254                                                 -1;
8255                         }
8256                 }
8257         }
8258 });
8259
8260 // Some attributes require a special call on IE
8261 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
8262 if ( !support.hrefNormalized ) {
8263         // href/src property should get the full normalized URL (#10299/#12915)
8264         jQuery.each([ "href", "src" ], function( i, name ) {
8265                 jQuery.propHooks[ name ] = {
8266                         get: function( elem ) {
8267                                 return elem.getAttribute( name, 4 );
8268                         }
8269                 };
8270         });
8271 }
8272
8273 // Support: Safari, IE9+
8274 // mis-reports the default selected property of an option
8275 // Accessing the parent's selectedIndex property fixes it
8276 if ( !support.optSelected ) {
8277         jQuery.propHooks.selected = {
8278                 get: function( elem ) {
8279                         var parent = elem.parentNode;
8280
8281                         if ( parent ) {
8282                                 parent.selectedIndex;
8283
8284                                 // Make sure that it also works with optgroups, see #5701
8285                                 if ( parent.parentNode ) {
8286                                         parent.parentNode.selectedIndex;
8287                                 }
8288                         }
8289                         return null;
8290                 }
8291         };
8292 }
8293
8294 jQuery.each([
8295         "tabIndex",
8296         "readOnly",
8297         "maxLength",
8298         "cellSpacing",
8299         "cellPadding",
8300         "rowSpan",
8301         "colSpan",
8302         "useMap",
8303         "frameBorder",
8304         "contentEditable"
8305 ], function() {
8306         jQuery.propFix[ this.toLowerCase() ] = this;
8307 });
8308
8309 // IE6/7 call enctype encoding
8310 if ( !support.enctype ) {
8311         jQuery.propFix.enctype = "encoding";
8312 }
8313
8314
8315
8316
8317 var rclass = /[\t\r\n\f]/g;
8318
8319 jQuery.fn.extend({
8320         addClass: function( value ) {
8321                 var classes, elem, cur, clazz, j, finalValue,
8322                         i = 0,
8323                         len = this.length,
8324                         proceed = typeof value === "string" && value;
8325
8326                 if ( jQuery.isFunction( value ) ) {
8327                         return this.each(function( j ) {
8328                                 jQuery( this ).addClass( value.call( this, j, this.className ) );
8329                         });
8330                 }
8331
8332                 if ( proceed ) {
8333                         // The disjunction here is for better compressibility (see removeClass)
8334                         classes = ( value || "" ).match( rnotwhite ) || [];
8335
8336                         for ( ; i < len; i++ ) {
8337                                 elem = this[ i ];
8338                                 cur = elem.nodeType === 1 && ( elem.className ?
8339                                         ( " " + elem.className + " " ).replace( rclass, " " ) :
8340                                         " "
8341                                 );
8342
8343                                 if ( cur ) {
8344                                         j = 0;
8345                                         while ( (clazz = classes[j++]) ) {
8346                                                 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
8347                                                         cur += clazz + " ";
8348                                                 }
8349                                         }
8350
8351                                         // only assign if different to avoid unneeded rendering.
8352                                         finalValue = jQuery.trim( cur );
8353                                         if ( elem.className !== finalValue ) {
8354                                                 elem.className = finalValue;
8355                                         }
8356                                 }
8357                         }
8358                 }
8359
8360                 return this;
8361         },
8362
8363         removeClass: function( value ) {
8364                 var classes, elem, cur, clazz, j, finalValue,
8365                         i = 0,
8366                         len = this.length,
8367                         proceed = arguments.length === 0 || typeof value === "string" && value;
8368
8369                 if ( jQuery.isFunction( value ) ) {
8370                         return this.each(function( j ) {
8371                                 jQuery( this ).removeClass( value.call( this, j, this.className ) );
8372                         });
8373                 }
8374                 if ( proceed ) {
8375                         classes = ( value || "" ).match( rnotwhite ) || [];
8376
8377                         for ( ; i < len; i++ ) {
8378                                 elem = this[ i ];
8379                                 // This expression is here for better compressibility (see addClass)
8380                                 cur = elem.nodeType === 1 && ( elem.className ?
8381                                         ( " " + elem.className + " " ).replace( rclass, " " ) :
8382                                         ""
8383                                 );
8384
8385                                 if ( cur ) {
8386                                         j = 0;
8387                                         while ( (clazz = classes[j++]) ) {
8388                                                 // Remove *all* instances
8389                                                 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
8390                                                         cur = cur.replace( " " + clazz + " ", " " );
8391                                                 }
8392                                         }
8393
8394                                         // only assign if different to avoid unneeded rendering.
8395                                         finalValue = value ? jQuery.trim( cur ) : "";
8396                                         if ( elem.className !== finalValue ) {
8397                                                 elem.className = finalValue;
8398                                         }
8399                                 }
8400                         }
8401                 }
8402
8403                 return this;
8404         },
8405
8406         toggleClass: function( value, stateVal ) {
8407                 var type = typeof value;
8408
8409                 if ( typeof stateVal === "boolean" && type === "string" ) {
8410                         return stateVal ? this.addClass( value ) : this.removeClass( value );
8411                 }
8412
8413                 if ( jQuery.isFunction( value ) ) {
8414                         return this.each(function( i ) {
8415                                 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
8416                         });
8417                 }
8418
8419                 return this.each(function() {
8420                         if ( type === "string" ) {
8421                                 // toggle individual class names
8422                                 var className,
8423                                         i = 0,
8424                                         self = jQuery( this ),
8425                                         classNames = value.match( rnotwhite ) || [];
8426
8427                                 while ( (className = classNames[ i++ ]) ) {
8428                                         // check each className given, space separated list
8429                                         if ( self.hasClass( className ) ) {
8430                                                 self.removeClass( className );
8431                                         } else {
8432                                                 self.addClass( className );
8433                                         }
8434                                 }
8435
8436                         // Toggle whole class name
8437                         } else if ( type === strundefined || type === "boolean" ) {
8438                                 if ( this.className ) {
8439                                         // store className if set
8440                                         jQuery._data( this, "__className__", this.className );
8441                                 }
8442
8443                                 // If the element has a class name or if we're passed "false",
8444                                 // then remove the whole classname (if there was one, the above saved it).
8445                                 // Otherwise bring back whatever was previously saved (if anything),
8446                                 // falling back to the empty string if nothing was stored.
8447                                 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
8448                         }
8449                 });
8450         },
8451
8452         hasClass: function( selector ) {
8453                 var className = " " + selector + " ",
8454                         i = 0,
8455                         l = this.length;
8456                 for ( ; i < l; i++ ) {
8457                         if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
8458                                 return true;
8459                         }
8460                 }
8461
8462                 return false;
8463         }
8464 });
8465
8466
8467
8468
8469 // Return jQuery for attributes-only inclusion
8470
8471
8472 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
8473         "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8474         "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
8475
8476         // Handle event binding
8477         jQuery.fn[ name ] = function( data, fn ) {
8478                 return arguments.length > 0 ?
8479                         this.on( name, null, data, fn ) :
8480                         this.trigger( name );
8481         };
8482 });
8483
8484 jQuery.fn.extend({
8485         hover: function( fnOver, fnOut ) {
8486                 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8487         },
8488
8489         bind: function( types, data, fn ) {
8490                 return this.on( types, null, data, fn );
8491         },
8492         unbind: function( types, fn ) {
8493                 return this.off( types, null, fn );
8494         },
8495
8496         delegate: function( selector, types, data, fn ) {
8497                 return this.on( types, selector, data, fn );
8498         },
8499         undelegate: function( selector, types, fn ) {
8500                 // ( namespace ) or ( selector, types [, fn] )
8501                 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
8502         }
8503 });
8504
8505
8506 var nonce = jQuery.now();
8507
8508 var rquery = (/\?/);
8509
8510
8511
8512 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
8513
8514 jQuery.parseJSON = function( data ) {
8515         // Attempt to parse using the native JSON parser first
8516         if ( window.JSON && window.JSON.parse ) {
8517                 // Support: Android 2.3
8518                 // Workaround failure to string-cast null input
8519                 return window.JSON.parse( data + "" );
8520         }
8521
8522         var requireNonComma,
8523                 depth = null,
8524                 str = jQuery.trim( data + "" );
8525
8526         // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
8527         // after removing valid tokens
8528         return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
8529
8530                 // Force termination if we see a misplaced comma
8531                 if ( requireNonComma && comma ) {
8532                         depth = 0;
8533                 }
8534
8535                 // Perform no more replacements after returning to outermost depth
8536                 if ( depth === 0 ) {
8537                         return token;
8538                 }
8539
8540                 // Commas must not follow "[", "{", or ","
8541                 requireNonComma = open || comma;
8542
8543                 // Determine new depth
8544                 // array/object open ("[" or "{"): depth += true - false (increment)
8545                 // array/object close ("]" or "}"): depth += false - true (decrement)
8546                 // other cases ("," or primitive): depth += true - true (numeric cast)
8547                 depth += !close - !open;
8548
8549                 // Remove this token
8550                 return "";
8551         }) ) ?
8552                 ( Function( "return " + str ) )() :
8553                 jQuery.error( "Invalid JSON: " + data );
8554 };
8555
8556
8557 // Cross-browser xml parsing
8558 jQuery.parseXML = function( data ) {
8559         var xml, tmp;
8560         if ( !data || typeof data !== "string" ) {
8561                 return null;
8562         }
8563         try {
8564                 if ( window.DOMParser ) { // Standard
8565                         tmp = new DOMParser();
8566                         xml = tmp.parseFromString( data, "text/xml" );
8567                 } else { // IE
8568                         xml = new ActiveXObject( "Microsoft.XMLDOM" );
8569                         xml.async = "false";
8570                         xml.loadXML( data );
8571                 }
8572         } catch( e ) {
8573                 xml = undefined;
8574         }
8575         if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
8576                 jQuery.error( "Invalid XML: " + data );
8577         }
8578         return xml;
8579 };
8580
8581
8582 var
8583         // Document location
8584         ajaxLocParts,
8585         ajaxLocation,
8586
8587         rhash = /#.*$/,
8588         rts = /([?&])_=[^&]*/,
8589         rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
8590         // #7653, #8125, #8152: local protocol detection
8591         rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8592         rnoContent = /^(?:GET|HEAD)$/,
8593         rprotocol = /^\/\//,
8594         rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
8595
8596         /* Prefilters
8597          * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8598          * 2) These are called:
8599          *    - BEFORE asking for a transport
8600          *    - AFTER param serialization (s.data is a string if s.processData is true)
8601          * 3) key is the dataType
8602          * 4) the catchall symbol "*" can be used
8603          * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8604          */
8605         prefilters = {},
8606
8607         /* Transports bindings
8608          * 1) key is the dataType
8609          * 2) the catchall symbol "*" can be used
8610          * 3) selection will start with transport dataType and THEN go to "*" if needed
8611          */
8612         transports = {},
8613
8614         // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8615         allTypes = "*/".concat("*");
8616
8617 // #8138, IE may throw an exception when accessing
8618 // a field from window.location if document.domain has been set
8619 try {
8620         ajaxLocation = location.href;
8621 } catch( e ) {
8622         // Use the href attribute of an A element
8623         // since IE will modify it given document.location
8624         ajaxLocation = document.createElement( "a" );
8625         ajaxLocation.href = "";
8626         ajaxLocation = ajaxLocation.href;
8627 }
8628
8629 // Segment location into parts
8630 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
8631
8632 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8633 function addToPrefiltersOrTransports( structure ) {
8634
8635         // dataTypeExpression is optional and defaults to "*"
8636         return function( dataTypeExpression, func ) {
8637
8638                 if ( typeof dataTypeExpression !== "string" ) {
8639                         func = dataTypeExpression;
8640                         dataTypeExpression = "*";
8641                 }
8642
8643                 var dataType,
8644                         i = 0,
8645                         dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
8646
8647                 if ( jQuery.isFunction( func ) ) {
8648                         // For each dataType in the dataTypeExpression
8649                         while ( (dataType = dataTypes[i++]) ) {
8650                                 // Prepend if requested
8651                                 if ( dataType.charAt( 0 ) === "+" ) {
8652                                         dataType = dataType.slice( 1 ) || "*";
8653                                         (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
8654
8655                                 // Otherwise append
8656                                 } else {
8657                                         (structure[ dataType ] = structure[ dataType ] || []).push( func );
8658                                 }
8659                         }
8660                 }
8661         };
8662 }
8663
8664 // Base inspection function for prefilters and transports
8665 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8666
8667         var inspected = {},
8668                 seekingTransport = ( structure === transports );
8669
8670         function inspect( dataType ) {
8671                 var selected;
8672                 inspected[ dataType ] = true;
8673                 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8674                         var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8675                         if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8676                                 options.dataTypes.unshift( dataTypeOrTransport );
8677                                 inspect( dataTypeOrTransport );
8678                                 return false;
8679                         } else if ( seekingTransport ) {
8680                                 return !( selected = dataTypeOrTransport );
8681                         }
8682                 });
8683                 return selected;
8684         }
8685
8686         return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8687 }
8688
8689 // A special extend for ajax options
8690 // that takes "flat" options (not to be deep extended)
8691 // Fixes #9887
8692 function ajaxExtend( target, src ) {
8693         var deep, key,
8694                 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8695
8696         for ( key in src ) {
8697                 if ( src[ key ] !== undefined ) {
8698                         ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
8699                 }
8700         }
8701         if ( deep ) {
8702                 jQuery.extend( true, target, deep );
8703         }
8704
8705         return target;
8706 }
8707
8708 /* Handles responses to an ajax request:
8709  * - finds the right dataType (mediates between content-type and expected dataType)
8710  * - returns the corresponding response
8711  */
8712 function ajaxHandleResponses( s, jqXHR, responses ) {
8713         var firstDataType, ct, finalDataType, type,
8714                 contents = s.contents,
8715                 dataTypes = s.dataTypes;
8716
8717         // Remove auto dataType and get content-type in the process
8718         while ( dataTypes[ 0 ] === "*" ) {
8719                 dataTypes.shift();
8720                 if ( ct === undefined ) {
8721                         ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
8722                 }
8723         }
8724
8725         // Check if we're dealing with a known content-type
8726         if ( ct ) {
8727                 for ( type in contents ) {
8728                         if ( contents[ type ] && contents[ type ].test( ct ) ) {
8729                                 dataTypes.unshift( type );
8730                                 break;
8731                         }
8732                 }
8733         }
8734
8735         // Check to see if we have a response for the expected dataType
8736         if ( dataTypes[ 0 ] in responses ) {
8737                 finalDataType = dataTypes[ 0 ];
8738         } else {
8739                 // Try convertible dataTypes
8740                 for ( type in responses ) {
8741                         if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
8742                                 finalDataType = type;
8743                                 break;
8744                         }
8745                         if ( !firstDataType ) {
8746                                 firstDataType = type;
8747                         }
8748                 }
8749                 // Or just use first one
8750                 finalDataType = finalDataType || firstDataType;
8751         }
8752
8753         // If we found a dataType
8754         // We add the dataType to the list if needed
8755         // and return the corresponding response
8756         if ( finalDataType ) {
8757                 if ( finalDataType !== dataTypes[ 0 ] ) {
8758                         dataTypes.unshift( finalDataType );
8759                 }
8760                 return responses[ finalDataType ];
8761         }
8762 }
8763
8764 /* Chain conversions given the request and the original response
8765  * Also sets the responseXXX fields on the jqXHR instance
8766  */
8767 function ajaxConvert( s, response, jqXHR, isSuccess ) {
8768         var conv2, current, conv, tmp, prev,
8769                 converters = {},
8770                 // Work with a copy of dataTypes in case we need to modify it for conversion
8771                 dataTypes = s.dataTypes.slice();
8772
8773         // Create converters map with lowercased keys
8774         if ( dataTypes[ 1 ] ) {
8775                 for ( conv in s.converters ) {
8776                         converters[ conv.toLowerCase() ] = s.converters[ conv ];
8777                 }
8778         }
8779
8780         current = dataTypes.shift();
8781
8782         // Convert to each sequential dataType
8783         while ( current ) {
8784
8785                 if ( s.responseFields[ current ] ) {
8786                         jqXHR[ s.responseFields[ current ] ] = response;
8787                 }
8788
8789                 // Apply the dataFilter if provided
8790                 if ( !prev && isSuccess && s.dataFilter ) {
8791                         response = s.dataFilter( response, s.dataType );
8792                 }
8793
8794                 prev = current;
8795                 current = dataTypes.shift();
8796
8797                 if ( current ) {
8798
8799                         // There's only work to do if current dataType is non-auto
8800                         if ( current === "*" ) {
8801
8802                                 current = prev;
8803
8804                         // Convert response if prev dataType is non-auto and differs from current
8805                         } else if ( prev !== "*" && prev !== current ) {
8806
8807                                 // Seek a direct converter
8808                                 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8809
8810                                 // If none found, seek a pair
8811                                 if ( !conv ) {
8812                                         for ( conv2 in converters ) {
8813
8814                                                 // If conv2 outputs current
8815                                                 tmp = conv2.split( " " );
8816                                                 if ( tmp[ 1 ] === current ) {
8817
8818                                                         // If prev can be converted to accepted input
8819                                                         conv = converters[ prev + " " + tmp[ 0 ] ] ||
8820                                                                 converters[ "* " + tmp[ 0 ] ];
8821                                                         if ( conv ) {
8822                                                                 // Condense equivalence converters
8823                                                                 if ( conv === true ) {
8824                                                                         conv = converters[ conv2 ];
8825
8826                                                                 // Otherwise, insert the intermediate dataType
8827                                                                 } else if ( converters[ conv2 ] !== true ) {
8828                                                                         current = tmp[ 0 ];
8829                                                                         dataTypes.unshift( tmp[ 1 ] );
8830                                                                 }
8831                                                                 break;
8832                                                         }
8833                                                 }
8834                                         }
8835                                 }
8836
8837                                 // Apply converter (if not an equivalence)
8838                                 if ( conv !== true ) {
8839
8840                                         // Unless errors are allowed to bubble, catch and return them
8841                                         if ( conv && s[ "throws" ] ) {
8842                                                 response = conv( response );
8843                                         } else {
8844                                                 try {
8845                                                         response = conv( response );
8846                                                 } catch ( e ) {
8847                                                         return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
8848                                                 }
8849                                         }
8850                                 }
8851                         }
8852                 }
8853         }
8854
8855         return { state: "success", data: response };
8856 }
8857
8858 jQuery.extend({
8859
8860         // Counter for holding the number of active queries
8861         active: 0,
8862
8863         // Last-Modified header cache for next request
8864         lastModified: {},
8865         etag: {},
8866
8867         ajaxSettings: {
8868                 url: ajaxLocation,
8869                 type: "GET",
8870                 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
8871                 global: true,
8872                 processData: true,
8873                 async: true,
8874                 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8875                 /*
8876                 timeout: 0,
8877                 data: null,
8878                 dataType: null,
8879                 username: null,
8880                 password: null,
8881                 cache: null,
8882                 throws: false,
8883                 traditional: false,
8884                 headers: {},
8885                 */
8886
8887                 accepts: {
8888                         "*": allTypes,
8889                         text: "text/plain",
8890                         html: "text/html",
8891                         xml: "application/xml, text/xml",
8892                         json: "application/json, text/javascript"
8893                 },
8894
8895                 contents: {
8896                         xml: /xml/,
8897                         html: /html/,
8898                         json: /json/
8899                 },
8900
8901                 responseFields: {
8902                         xml: "responseXML",
8903                         text: "responseText",
8904                         json: "responseJSON"
8905                 },
8906
8907                 // Data converters
8908                 // Keys separate source (or catchall "*") and destination types with a single space
8909                 converters: {
8910
8911                         // Convert anything to text
8912                         "* text": String,
8913
8914                         // Text to html (true = no transformation)
8915                         "text html": true,
8916
8917                         // Evaluate text as a json expression
8918                         "text json": jQuery.parseJSON,
8919
8920                         // Parse text as xml
8921                         "text xml": jQuery.parseXML
8922                 },
8923
8924                 // For options that shouldn't be deep extended:
8925                 // you can add your own custom options here if
8926                 // and when you create one that shouldn't be
8927                 // deep extended (see ajaxExtend)
8928                 flatOptions: {
8929                         url: true,
8930                         context: true
8931                 }
8932         },
8933
8934         // Creates a full fledged settings object into target
8935         // with both ajaxSettings and settings fields.
8936         // If target is omitted, writes into ajaxSettings.
8937         ajaxSetup: function( target, settings ) {
8938                 return settings ?
8939
8940                         // Building a settings object
8941                         ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8942
8943                         // Extending ajaxSettings
8944                         ajaxExtend( jQuery.ajaxSettings, target );
8945         },
8946
8947         ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8948         ajaxTransport: addToPrefiltersOrTransports( transports ),
8949
8950         // Main method
8951         ajax: function( url, options ) {
8952
8953                 // If url is an object, simulate pre-1.5 signature
8954                 if ( typeof url === "object" ) {
8955                         options = url;
8956                         url = undefined;
8957                 }
8958
8959                 // Force options to be an object
8960                 options = options || {};
8961
8962                 var // Cross-domain detection vars
8963                         parts,
8964                         // Loop variable
8965                         i,
8966                         // URL without anti-cache param
8967                         cacheURL,
8968                         // Response headers as string
8969                         responseHeadersString,
8970                         // timeout handle
8971                         timeoutTimer,
8972
8973                         // To know if global events are to be dispatched
8974                         fireGlobals,
8975
8976                         transport,
8977                         // Response headers
8978                         responseHeaders,
8979                         // Create the final options object
8980                         s = jQuery.ajaxSetup( {}, options ),
8981                         // Callbacks context
8982                         callbackContext = s.context || s,
8983                         // Context for global events is callbackContext if it is a DOM node or jQuery collection
8984                         globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
8985                                 jQuery( callbackContext ) :
8986                                 jQuery.event,
8987                         // Deferreds
8988                         deferred = jQuery.Deferred(),
8989                         completeDeferred = jQuery.Callbacks("once memory"),
8990                         // Status-dependent callbacks
8991                         statusCode = s.statusCode || {},
8992                         // Headers (they are sent all at once)
8993                         requestHeaders = {},
8994                         requestHeadersNames = {},
8995                         // The jqXHR state
8996                         state = 0,
8997                         // Default abort message
8998                         strAbort = "canceled",
8999                         // Fake xhr
9000                         jqXHR = {
9001                                 readyState: 0,
9002
9003                                 // Builds headers hashtable if needed
9004                                 getResponseHeader: function( key ) {
9005                                         var match;
9006                                         if ( state === 2 ) {
9007                                                 if ( !responseHeaders ) {
9008                                                         responseHeaders = {};
9009                                                         while ( (match = rheaders.exec( responseHeadersString )) ) {
9010                                                                 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
9011                                                         }
9012                                                 }
9013                                                 match = responseHeaders[ key.toLowerCase() ];
9014                                         }
9015                                         return match == null ? null : match;
9016                                 },
9017
9018                                 // Raw string
9019                                 getAllResponseHeaders: function() {
9020                                         return state === 2 ? responseHeadersString : null;
9021                                 },
9022
9023                                 // Caches the header
9024                                 setRequestHeader: function( name, value ) {
9025                                         var lname = name.toLowerCase();
9026                                         if ( !state ) {
9027                                                 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
9028                                                 requestHeaders[ name ] = value;
9029                                         }
9030                                         return this;
9031                                 },
9032
9033                                 // Overrides response content-type header
9034                                 overrideMimeType: function( type ) {
9035                                         if ( !state ) {
9036                                                 s.mimeType = type;
9037                                         }
9038                                         return this;
9039                                 },
9040
9041                                 // Status-dependent callbacks
9042                                 statusCode: function( map ) {
9043                                         var code;
9044                                         if ( map ) {
9045                                                 if ( state < 2 ) {
9046                                                         for ( code in map ) {
9047                                                                 // Lazy-add the new callback in a way that preserves old ones
9048                                                                 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9049                                                         }
9050                                                 } else {
9051                                                         // Execute the appropriate callbacks
9052                                                         jqXHR.always( map[ jqXHR.status ] );
9053                                                 }
9054                                         }
9055                                         return this;
9056                                 },
9057
9058                                 // Cancel the request
9059                                 abort: function( statusText ) {
9060                                         var finalText = statusText || strAbort;
9061                                         if ( transport ) {
9062                                                 transport.abort( finalText );
9063                                         }
9064                                         done( 0, finalText );
9065                                         return this;
9066                                 }
9067                         };
9068
9069                 // Attach deferreds
9070                 deferred.promise( jqXHR ).complete = completeDeferred.add;
9071                 jqXHR.success = jqXHR.done;
9072                 jqXHR.error = jqXHR.fail;
9073
9074                 // Remove hash character (#7531: and string promotion)
9075                 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
9076                 // Handle falsy url in the settings object (#10093: consistency with old signature)
9077                 // We also use the url parameter if available
9078                 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
9079
9080                 // Alias method option to type as per ticket #12004
9081                 s.type = options.method || options.type || s.method || s.type;
9082
9083                 // Extract dataTypes list
9084                 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
9085
9086                 // A cross-domain request is in order when we have a protocol:host:port mismatch
9087                 if ( s.crossDomain == null ) {
9088                         parts = rurl.exec( s.url.toLowerCase() );
9089                         s.crossDomain = !!( parts &&
9090                                 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
9091                                         ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
9092                                                 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
9093                         );
9094                 }
9095
9096                 // Convert data if not already a string
9097                 if ( s.data && s.processData && typeof s.data !== "string" ) {
9098                         s.data = jQuery.param( s.data, s.traditional );
9099                 }
9100
9101                 // Apply prefilters
9102                 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9103
9104                 // If request was aborted inside a prefilter, stop there
9105                 if ( state === 2 ) {
9106                         return jqXHR;
9107                 }
9108
9109                 // We can fire global events as of now if asked to
9110                 fireGlobals = s.global;
9111
9112                 // Watch for a new set of requests
9113                 if ( fireGlobals && jQuery.active++ === 0 ) {
9114                         jQuery.event.trigger("ajaxStart");
9115                 }
9116
9117                 // Uppercase the type
9118                 s.type = s.type.toUpperCase();
9119
9120                 // Determine if request has content
9121                 s.hasContent = !rnoContent.test( s.type );
9122
9123                 // Save the URL in case we're toying with the If-Modified-Since
9124                 // and/or If-None-Match header later on
9125                 cacheURL = s.url;
9126
9127                 // More options handling for requests with no content
9128                 if ( !s.hasContent ) {
9129
9130                         // If data is available, append data to url
9131                         if ( s.data ) {
9132                                 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
9133                                 // #9682: remove data so that it's not used in an eventual retry
9134                                 delete s.data;
9135                         }
9136
9137                         // Add anti-cache in url if needed
9138                         if ( s.cache === false ) {
9139                                 s.url = rts.test( cacheURL ) ?
9140
9141                                         // If there is already a '_' parameter, set its value
9142                                         cacheURL.replace( rts, "$1_=" + nonce++ ) :
9143
9144                                         // Otherwise add one to the end
9145                                         cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
9146                         }
9147                 }
9148
9149                 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9150                 if ( s.ifModified ) {
9151                         if ( jQuery.lastModified[ cacheURL ] ) {
9152                                 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9153                         }
9154                         if ( jQuery.etag[ cacheURL ] ) {
9155                                 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9156                         }
9157                 }
9158
9159                 // Set the correct header, if data is being sent
9160                 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9161                         jqXHR.setRequestHeader( "Content-Type", s.contentType );
9162                 }
9163
9164                 // Set the Accepts header for the server, depending on the dataType
9165                 jqXHR.setRequestHeader(
9166                         "Accept",
9167                         s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
9168                                 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9169                                 s.accepts[ "*" ]
9170                 );
9171
9172                 // Check for headers option
9173                 for ( i in s.headers ) {
9174                         jqXHR.setRequestHeader( i, s.headers[ i ] );
9175                 }
9176
9177                 // Allow custom headers/mimetypes and early abort
9178                 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
9179                         // Abort if not done already and return
9180                         return jqXHR.abort();
9181                 }
9182
9183                 // aborting is no longer a cancellation
9184                 strAbort = "abort";
9185
9186                 // Install callbacks on deferreds
9187                 for ( i in { success: 1, error: 1, complete: 1 } ) {
9188                         jqXHR[ i ]( s[ i ] );
9189                 }
9190
9191                 // Get transport
9192                 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9193
9194                 // If no transport, we auto-abort
9195                 if ( !transport ) {
9196                         done( -1, "No Transport" );
9197                 } else {
9198                         jqXHR.readyState = 1;
9199
9200                         // Send global event
9201                         if ( fireGlobals ) {
9202                                 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9203                         }
9204                         // Timeout
9205                         if ( s.async && s.timeout > 0 ) {
9206                                 timeoutTimer = setTimeout(function() {
9207                                         jqXHR.abort("timeout");
9208                                 }, s.timeout );
9209                         }
9210
9211                         try {
9212                                 state = 1;
9213                                 transport.send( requestHeaders, done );
9214                         } catch ( e ) {
9215                                 // Propagate exception as error if not done
9216                                 if ( state < 2 ) {
9217                                         done( -1, e );
9218                                 // Simply rethrow otherwise
9219                                 } else {
9220                                         throw e;
9221                                 }
9222                         }
9223                 }
9224
9225                 // Callback for when everything is done
9226                 function done( status, nativeStatusText, responses, headers ) {
9227                         var isSuccess, success, error, response, modified,
9228                                 statusText = nativeStatusText;
9229
9230                         // Called once
9231                         if ( state === 2 ) {
9232                                 return;
9233                         }
9234
9235                         // State is "done" now
9236                         state = 2;
9237
9238                         // Clear timeout if it exists
9239                         if ( timeoutTimer ) {
9240                                 clearTimeout( timeoutTimer );
9241                         }
9242
9243                         // Dereference transport for early garbage collection
9244                         // (no matter how long the jqXHR object will be used)
9245                         transport = undefined;
9246
9247                         // Cache response headers
9248                         responseHeadersString = headers || "";
9249
9250                         // Set readyState
9251                         jqXHR.readyState = status > 0 ? 4 : 0;
9252
9253                         // Determine if successful
9254                         isSuccess = status >= 200 && status < 300 || status === 304;
9255
9256                         // Get response data
9257                         if ( responses ) {
9258                                 response = ajaxHandleResponses( s, jqXHR, responses );
9259                         }
9260
9261                         // Convert no matter what (that way responseXXX fields are always set)
9262                         response = ajaxConvert( s, response, jqXHR, isSuccess );
9263
9264                         // If successful, handle type chaining
9265                         if ( isSuccess ) {
9266
9267                                 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9268                                 if ( s.ifModified ) {
9269                                         modified = jqXHR.getResponseHeader("Last-Modified");
9270                                         if ( modified ) {
9271                                                 jQuery.lastModified[ cacheURL ] = modified;
9272                                         }
9273                                         modified = jqXHR.getResponseHeader("etag");
9274                                         if ( modified ) {
9275                                                 jQuery.etag[ cacheURL ] = modified;
9276                                         }
9277                                 }
9278
9279                                 // if no content
9280                                 if ( status === 204 || s.type === "HEAD" ) {
9281                                         statusText = "nocontent";
9282
9283                                 // if not modified
9284                                 } else if ( status === 304 ) {
9285                                         statusText = "notmodified";
9286
9287                                 // If we have data, let's convert it
9288                                 } else {
9289                                         statusText = response.state;
9290                                         success = response.data;
9291                                         error = response.error;
9292                                         isSuccess = !error;
9293                                 }
9294                         } else {
9295                                 // We extract error from statusText
9296                                 // then normalize statusText and status for non-aborts
9297                                 error = statusText;
9298                                 if ( status || !statusText ) {
9299                                         statusText = "error";
9300                                         if ( status < 0 ) {
9301                                                 status = 0;
9302                                         }
9303                                 }
9304                         }
9305
9306                         // Set data for the fake xhr object
9307                         jqXHR.status = status;
9308                         jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9309
9310                         // Success/Error
9311                         if ( isSuccess ) {
9312                                 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9313                         } else {
9314                                 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9315                         }
9316
9317                         // Status-dependent callbacks
9318                         jqXHR.statusCode( statusCode );
9319                         statusCode = undefined;
9320
9321                         if ( fireGlobals ) {
9322                                 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9323                                         [ jqXHR, s, isSuccess ? success : error ] );
9324                         }
9325
9326                         // Complete
9327                         completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9328
9329                         if ( fireGlobals ) {
9330                                 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9331                                 // Handle the global AJAX counter
9332                                 if ( !( --jQuery.active ) ) {
9333                                         jQuery.event.trigger("ajaxStop");
9334                                 }
9335                         }
9336                 }
9337
9338                 return jqXHR;
9339         },
9340
9341         getJSON: function( url, data, callback ) {
9342                 return jQuery.get( url, data, callback, "json" );
9343         },
9344
9345         getScript: function( url, callback ) {
9346                 return jQuery.get( url, undefined, callback, "script" );
9347         }
9348 });
9349
9350 jQuery.each( [ "get", "post" ], function( i, method ) {
9351         jQuery[ method ] = function( url, data, callback, type ) {
9352                 // shift arguments if data argument was omitted
9353                 if ( jQuery.isFunction( data ) ) {
9354                         type = type || callback;
9355                         callback = data;
9356                         data = undefined;
9357                 }
9358
9359                 return jQuery.ajax({
9360                         url: url,
9361                         type: method,
9362                         dataType: type,
9363                         data: data,
9364                         success: callback
9365                 });
9366         };
9367 });
9368
9369 // Attach a bunch of functions for handling common AJAX events
9370 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
9371         jQuery.fn[ type ] = function( fn ) {
9372                 return this.on( type, fn );
9373         };
9374 });
9375
9376
9377 jQuery._evalUrl = function( url ) {
9378         return jQuery.ajax({
9379                 url: url,
9380                 type: "GET",
9381                 dataType: "script",
9382                 async: false,
9383                 global: false,
9384                 "throws": true
9385         });
9386 };
9387
9388
9389 jQuery.fn.extend({
9390         wrapAll: function( html ) {
9391                 if ( jQuery.isFunction( html ) ) {
9392                         return this.each(function(i) {
9393                                 jQuery(this).wrapAll( html.call(this, i) );
9394                         });
9395                 }
9396
9397                 if ( this[0] ) {
9398                         // The elements to wrap the target around
9399                         var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
9400
9401                         if ( this[0].parentNode ) {
9402                                 wrap.insertBefore( this[0] );
9403                         }
9404
9405                         wrap.map(function() {
9406                                 var elem = this;
9407
9408                                 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
9409                                         elem = elem.firstChild;
9410                                 }
9411
9412                                 return elem;
9413                         }).append( this );
9414                 }
9415
9416                 return this;
9417         },
9418
9419         wrapInner: function( html ) {
9420                 if ( jQuery.isFunction( html ) ) {
9421                         return this.each(function(i) {
9422                                 jQuery(this).wrapInner( html.call(this, i) );
9423                         });
9424                 }
9425
9426                 return this.each(function() {
9427                         var self = jQuery( this ),
9428                                 contents = self.contents();
9429
9430                         if ( contents.length ) {
9431                                 contents.wrapAll( html );
9432
9433                         } else {
9434                                 self.append( html );
9435                         }
9436                 });
9437         },
9438
9439         wrap: function( html ) {
9440                 var isFunction = jQuery.isFunction( html );
9441
9442                 return this.each(function(i) {
9443                         jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
9444                 });
9445         },
9446
9447         unwrap: function() {
9448                 return this.parent().each(function() {
9449                         if ( !jQuery.nodeName( this, "body" ) ) {
9450                                 jQuery( this ).replaceWith( this.childNodes );
9451                         }
9452                 }).end();
9453         }
9454 });
9455
9456
9457 jQuery.expr.filters.hidden = function( elem ) {
9458         // Support: Opera <= 12.12
9459         // Opera reports offsetWidths and offsetHeights less than zero on some elements
9460         return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
9461                 (!support.reliableHiddenOffsets() &&
9462                         ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
9463 };
9464
9465 jQuery.expr.filters.visible = function( elem ) {
9466         return !jQuery.expr.filters.hidden( elem );
9467 };
9468
9469
9470
9471
9472 var r20 = /%20/g,
9473         rbracket = /\[\]$/,
9474         rCRLF = /\r?\n/g,
9475         rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
9476         rsubmittable = /^(?:input|select|textarea|keygen)/i;
9477
9478 function buildParams( prefix, obj, traditional, add ) {
9479         var name;
9480
9481         if ( jQuery.isArray( obj ) ) {
9482                 // Serialize array item.
9483                 jQuery.each( obj, function( i, v ) {
9484                         if ( traditional || rbracket.test( prefix ) ) {
9485                                 // Treat each array item as a scalar.
9486                                 add( prefix, v );
9487
9488                         } else {
9489                                 // Item is non-scalar (array or object), encode its numeric index.
9490                                 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
9491                         }
9492                 });
9493
9494         } else if ( !traditional && jQuery.type( obj ) === "object" ) {
9495                 // Serialize object item.
9496                 for ( name in obj ) {
9497                         buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
9498                 }
9499
9500         } else {
9501                 // Serialize scalar item.
9502                 add( prefix, obj );
9503         }
9504 }
9505
9506 // Serialize an array of form elements or a set of
9507 // key/values into a query string
9508 jQuery.param = function( a, traditional ) {
9509         var prefix,
9510                 s = [],
9511                 add = function( key, value ) {
9512                         // If value is a function, invoke it and return its value
9513                         value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
9514                         s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
9515                 };
9516
9517         // Set traditional to true for jQuery <= 1.3.2 behavior.
9518         if ( traditional === undefined ) {
9519                 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
9520         }
9521
9522         // If an array was passed in, assume that it is an array of form elements.
9523         if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
9524                 // Serialize the form elements
9525                 jQuery.each( a, function() {
9526                         add( this.name, this.value );
9527                 });
9528
9529         } else {
9530                 // If traditional, encode the "old" way (the way 1.3.2 or older
9531                 // did it), otherwise encode params recursively.
9532                 for ( prefix in a ) {
9533                         buildParams( prefix, a[ prefix ], traditional, add );
9534                 }
9535         }
9536
9537         // Return the resulting serialization
9538         return s.join( "&" ).replace( r20, "+" );
9539 };
9540
9541 jQuery.fn.extend({
9542         serialize: function() {
9543                 return jQuery.param( this.serializeArray() );
9544         },
9545         serializeArray: function() {
9546                 return this.map(function() {
9547                         // Can add propHook for "elements" to filter or add form elements
9548                         var elements = jQuery.prop( this, "elements" );
9549                         return elements ? jQuery.makeArray( elements ) : this;
9550                 })
9551                 .filter(function() {
9552                         var type = this.type;
9553                         // Use .is(":disabled") so that fieldset[disabled] works
9554                         return this.name && !jQuery( this ).is( ":disabled" ) &&
9555                                 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
9556                                 ( this.checked || !rcheckableType.test( type ) );
9557                 })
9558                 .map(function( i, elem ) {
9559                         var val = jQuery( this ).val();
9560
9561                         return val == null ?
9562                                 null :
9563                                 jQuery.isArray( val ) ?
9564                                         jQuery.map( val, function( val ) {
9565                                                 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9566                                         }) :
9567                                         { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9568                 }).get();
9569         }
9570 });
9571
9572
9573 // Create the request object
9574 // (This is still attached to ajaxSettings for backward compatibility)
9575 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
9576         // Support: IE6+
9577         function() {
9578
9579                 // XHR cannot access local files, always use ActiveX for that case
9580                 return !this.isLocal &&
9581
9582                         // Support: IE7-8
9583                         // oldIE XHR does not support non-RFC2616 methods (#13240)
9584                         // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
9585                         // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
9586                         // Although this check for six methods instead of eight
9587                         // since IE also does not support "trace" and "connect"
9588                         /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
9589
9590                         createStandardXHR() || createActiveXHR();
9591         } :
9592         // For all other browsers, use the standard XMLHttpRequest object
9593         createStandardXHR;
9594
9595 //bh
9596
9597         function createXHR(isMSIE) {
9598                 try {
9599                         return (isMSIE ? new window.ActiveXObject( "Microsoft.XMLHTTP" ) : new window.XMLHttpRequest());
9600                 } catch( e ) {}
9601         }
9602
9603  jQuery.ajaxSettings.xhr = (window.ActiveXObject === undefined ? createXHR :  
9604         function() {
9605                 return (this.url == document.location || this.url.indexOf("http") == 0 || !this.isLocal) &&  // BH MSIE fix
9606                         /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
9607                         createXHR() || createXHR(1);
9608         });
9609  
9610 //bh
9611
9612
9613 var xhrId = 0,
9614         xhrCallbacks = {},
9615         xhrSupported = jQuery.ajaxSettings.xhr();
9616
9617 // Support: IE<10
9618 // Open requests must be manually aborted on unload (#5280)
9619 if ( window.ActiveXObject ) {
9620         jQuery( window ).on( "unload", function() {
9621                 for ( var key in xhrCallbacks ) {
9622                         xhrCallbacks[ key ]( undefined, true );
9623                 }
9624         });
9625 }
9626
9627 // Determine support properties
9628 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9629 xhrSupported = support.ajax = !!xhrSupported;
9630
9631 // Create transport if the browser can provide an xhr
9632 if ( xhrSupported ) {
9633
9634         jQuery.ajaxTransport(function( options ) {
9635                 // Cross domain only allowed if supported through XMLHttpRequest
9636                 if ( !options.crossDomain || support.cors ) {
9637
9638                         var callback;
9639
9640                         return {
9641                                 send: function( headers, complete ) {
9642                                         var i,
9643                                                 xhr = options.xhr(),
9644                                                 id = ++xhrId;
9645
9646                                         // Open the socket
9647                                         console.log("xhr.open async=" + options.async + " url=" + options.url);
9648                                         xhr.open( options.type, options.url, options.async, options.username, options.password );
9649
9650                                         // Apply custom fields if provided
9651                                         if ( options.xhrFields ) {
9652                                                 for ( i in options.xhrFields ) {
9653                                                         xhr[ i ] = options.xhrFields[ i ];
9654                                                 }
9655                                         }
9656
9657                                         // Override mime type if needed
9658                                         if ( options.mimeType && xhr.overrideMimeType ) {
9659                                                 xhr.overrideMimeType( options.mimeType );
9660                                         }
9661
9662                                         // X-Requested-With header
9663                                         // For cross-domain requests, seeing as conditions for a preflight are
9664                                         // akin to a jigsaw puzzle, we simply never set it to be sure.
9665                                         // (it can always be set on a per-request basis or even using ajaxSetup)
9666                                         // For same-domain requests, won't change header if already provided.
9667                                         if ( !options.crossDomain && !headers["X-Requested-With"] ) {
9668                                                 headers["X-Requested-With"] = "XMLHttpRequest";
9669                                         }
9670
9671                                         // Set headers
9672                                         for ( i in headers ) {
9673                                                 // Support: IE<9
9674                                                 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
9675                                                 // request header to a null-value.
9676                                                 //
9677                                                 // To keep consistent with other XHR implementations, cast the value
9678                                                 // to string and ignore `undefined`.
9679                                                 if ( headers[ i ] !== undefined ) {
9680                                                         xhr.setRequestHeader( i, headers[ i ] + "" );
9681                                                 }
9682                                         }
9683
9684                                         // Do send the request
9685                                         // This may raise an exception which is actually
9686                                         // handled in jQuery.ajax (so no try/catch here)
9687                                         xhr.send( ( options.hasContent && options.data ) || null );
9688
9689                                         // Listener
9690                                         callback = function( _, isAbort ) {
9691                                                 var status, statusText, responses;
9692
9693                                                 // Was never called and is aborted or complete
9694                                                 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
9695                                                         // Clean up
9696                                                         delete xhrCallbacks[ id ];
9697                                                         callback = undefined;
9698                                                         xhr.onreadystatechange = jQuery.noop;
9699
9700                                                         // Abort manually if needed
9701                                                         if ( isAbort ) {
9702                                                                 if ( xhr.readyState !== 4 ) {
9703                                                                         xhr.abort();
9704                                                                 }
9705                                                         } else {
9706                                                                 responses = {};
9707                                                                 status = xhr.status;
9708
9709                                                                 // Support: IE<10
9710                                                                 // Accessing binary-data responseText throws an exception
9711                                                                 // (#11426)
9712                                                                 if ( typeof xhr.responseText === "string" ) {
9713                                                                         responses.text = xhr.responseText;
9714                                                                 }
9715
9716                                                                 // Firefox throws an exception when accessing
9717                                                                 // statusText for faulty cross-domain requests
9718                                                                 try {
9719                                                                         statusText = xhr.statusText;
9720                                                                 } catch( e ) {
9721                                                                         // We normalize with Webkit giving an empty statusText
9722                                                                         statusText = "";
9723                                                                 }
9724
9725                                                                 // Filter status for non standard behaviors
9726
9727                                                                 // If the request is local and we have data: assume a success
9728                                                                 // (success with no data won't get notified, that's the best we
9729                                                                 // can do given current implementations)
9730                                                                 if ( !status && options.isLocal && !options.crossDomain ) {
9731                                                                         status = responses.text ? 200 : 404;
9732                                                                 // IE - #1450: sometimes returns 1223 when it should be 204
9733                                                                 } else if ( status === 1223 ) {
9734                                                                         status = 204;
9735                                                                 }
9736                                                         }
9737                                                 }
9738
9739                                                 // Call complete if needed
9740                                                 if ( responses ) {
9741                                                         complete( status, statusText, responses, xhr.getAllResponseHeaders() );
9742                                                 }
9743                                         };
9744
9745                                         if ( !options.async ) {
9746                                                 // if we're in sync mode we fire the callback
9747                                                 callback();
9748                                         } else if ( xhr.readyState === 4 ) {
9749                                                 // (IE6 & IE7) if it's in cache and has been
9750                                                 // retrieved directly we need to fire the callback
9751                                                 setTimeout( callback );
9752                                         } else {
9753                                                 // Add to the list of active xhr callbacks
9754                                                 xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
9755                                         }
9756                                 },
9757
9758                                 abort: function() {
9759                                         if ( callback ) {
9760                                                 callback( undefined, true );
9761                                         }
9762                                 }
9763                         };
9764                 }
9765         });
9766 }
9767
9768 // Functions to create xhrs
9769 function createStandardXHR() {
9770         try {
9771                 return new window.XMLHttpRequest();
9772         } catch( e ) {}
9773 }
9774
9775 function createActiveXHR() {
9776         try {
9777                 return new window.ActiveXObject( "Microsoft.XMLHTTP" );
9778         } catch( e ) {}
9779 }
9780
9781
9782
9783
9784 // Install script dataType
9785 jQuery.ajaxSetup({
9786         accepts: {
9787                 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
9788         },
9789         contents: {
9790                 script: /(?:java|ecma)script/
9791         },
9792         converters: {
9793                 "text script": function( text ) {
9794                         jQuery.globalEval( text );
9795                         return text;
9796                 }
9797         }
9798 });
9799
9800 // Handle cache's special case and global
9801 jQuery.ajaxPrefilter( "script", function( s ) {
9802         if ( s.cache === undefined ) {
9803                 s.cache = false;
9804         }
9805         if ( s.crossDomain ) {
9806                 s.type = "GET";
9807                 s.global = false;
9808         }
9809 });
9810
9811 // Bind script tag hack transport
9812 jQuery.ajaxTransport( "script", function(s) {
9813
9814         // This transport only deals with cross domain requests
9815         if ( s.crossDomain ) {
9816
9817                 var script,
9818                         head = document.head || jQuery("head")[0] || document.documentElement;
9819
9820                 return {
9821
9822                         send: function( _, callback ) {
9823
9824                                 script = document.createElement("script");
9825
9826                                 script.async = true;
9827
9828                                 if ( s.scriptCharset ) {
9829                                         script.charset = s.scriptCharset;
9830                                 }
9831
9832                                 script.src = s.url;
9833
9834                                 // Attach handlers for all browsers
9835                                 script.onload = script.onreadystatechange = function( _, isAbort ) {
9836
9837                                         if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
9838
9839                                                 // Handle memory leak in IE
9840                                                 script.onload = script.onreadystatechange = null;
9841
9842                                                 // Remove the script
9843                                                 if ( script.parentNode ) {
9844                                                         script.parentNode.removeChild( script );
9845                                                 }
9846
9847                                                 // Dereference the script
9848                                                 script = null;
9849
9850                                                 // Callback if not abort
9851                                                 if ( !isAbort ) {
9852                                                         callback( 200, "success" );
9853                                                 }
9854                                         }
9855                                 };
9856
9857                                 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
9858                                 // Use native DOM manipulation to avoid our domManip AJAX trickery
9859                                 head.insertBefore( script, head.firstChild );
9860                         },
9861
9862                         abort: function() {
9863                                 if ( script ) {
9864                                         script.onload( undefined, true );
9865                                 }
9866                         }
9867                 };
9868         }
9869 });
9870
9871
9872
9873
9874 var oldCallbacks = [],
9875         rjsonp = /(=)\?(?=&|$)|\?\?/;
9876
9877 // Default jsonp settings
9878 jQuery.ajaxSetup({
9879         jsonp: "callback",
9880         jsonpCallback: function() {
9881                 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9882                 this[ callback ] = true;
9883                 return callback;
9884         }
9885 });
9886
9887 // Detect, normalize options and install callbacks for jsonp requests
9888 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9889
9890         var callbackName, overwritten, responseContainer,
9891                 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9892                         "url" :
9893                         typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
9894                 );
9895
9896         // Handle iff the expected data type is "jsonp" or we have a parameter to set
9897         if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9898
9899                 // Get callback name, remembering preexisting value associated with it
9900                 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9901                         s.jsonpCallback() :
9902                         s.jsonpCallback;
9903
9904                 // Insert callback into url or form data
9905                 if ( jsonProp ) {
9906                         s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9907                 } else if ( s.jsonp !== false ) {
9908                         s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9909                 }
9910
9911                 // Use data converter to retrieve json after script execution
9912                 s.converters["script json"] = function() {
9913                         if ( !responseContainer ) {
9914                                 jQuery.error( callbackName + " was not called" );
9915                         }
9916                         return responseContainer[ 0 ];
9917                 };
9918
9919                 // force json dataType
9920                 s.dataTypes[ 0 ] = "json";
9921
9922                 // Install callback
9923                 overwritten = window[ callbackName ];
9924                 window[ callbackName ] = function() {
9925                         responseContainer = arguments;
9926                 };
9927
9928                 // Clean-up function (fires after converters)
9929                 jqXHR.always(function() {
9930                         // Restore preexisting value
9931                         window[ callbackName ] = overwritten;
9932
9933                         // Save back as free
9934                         if ( s[ callbackName ] ) {
9935                                 // make sure that re-using the options doesn't screw things around
9936                                 s.jsonpCallback = originalSettings.jsonpCallback;
9937
9938                                 // save the callback name for future use
9939                                 oldCallbacks.push( callbackName );
9940                         }
9941
9942                         // Call if it was a function and we have a response
9943                         if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9944                                 overwritten( responseContainer[ 0 ] );
9945                         }
9946
9947                         responseContainer = overwritten = undefined;
9948                 });
9949
9950                 // Delegate to script
9951                 return "script";
9952         }
9953 });
9954
9955
9956
9957
9958 // data: string of html
9959 // context (optional): If specified, the fragment will be created in this context, defaults to document
9960 // keepScripts (optional): If true, will include scripts passed in the html string
9961 jQuery.parseHTML = function( data, context, keepScripts ) {
9962         if ( !data || typeof data !== "string" ) {
9963                 return null;
9964         }
9965         if ( typeof context === "boolean" ) {
9966                 keepScripts = context;
9967                 context = false;
9968         }
9969         context = context || document;
9970
9971         var parsed = rsingleTag.exec( data ),
9972                 scripts = !keepScripts && [];
9973
9974         // Single tag
9975         if ( parsed ) {
9976                 return [ context.createElement( parsed[1] ) ];
9977         }
9978
9979         parsed = jQuery.buildFragment( [ data ], context, scripts );
9980
9981         if ( scripts && scripts.length ) {
9982                 jQuery( scripts ).remove();
9983         }
9984
9985         return jQuery.merge( [], parsed.childNodes );
9986 };
9987
9988
9989 // Keep a copy of the old load method
9990 var _load = jQuery.fn.load;
9991
9992 /**
9993  * Load a url into a page
9994  */
9995 jQuery.fn.load = function( url, params, callback ) {
9996         if ( typeof url !== "string" && _load ) {
9997                 return _load.apply( this, arguments );
9998         }
9999
10000         var selector, response, type,
10001                 self = this,
10002                 off = url.indexOf(" ");
10003
10004         if ( off >= 0 ) {
10005                 selector = url.slice( off, url.length );
10006                 url = url.slice( 0, off );
10007         }
10008
10009         // If it's a function
10010         if ( jQuery.isFunction( params ) ) {
10011
10012                 // We assume that it's the callback
10013                 callback = params;
10014                 params = undefined;
10015
10016         // Otherwise, build a param string
10017         } else if ( params && typeof params === "object" ) {
10018                 type = "POST";
10019         }
10020
10021         // If we have elements to modify, make the request
10022         if ( self.length > 0 ) {
10023                 jQuery.ajax({
10024                         url: url,
10025
10026                         // if "type" variable is undefined, then "GET" method will be used
10027                         type: type,
10028                         dataType: "html",
10029                         data: params
10030                 }).done(function( responseText ) {
10031
10032                         // Save response for use in complete callback
10033                         response = arguments;
10034
10035                         self.html( selector ?
10036
10037                                 // If a selector was specified, locate the right elements in a dummy div
10038                                 // Exclude scripts to avoid IE 'Permission Denied' errors
10039                                 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
10040
10041                                 // Otherwise use the full result
10042                                 responseText );
10043
10044                 }).complete( callback && function( jqXHR, status ) {
10045                         self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
10046                 });
10047         }
10048
10049         return this;
10050 };
10051
10052
10053
10054
10055 jQuery.expr.filters.animated = function( elem ) {
10056         return jQuery.grep(jQuery.timers, function( fn ) {
10057                 return elem === fn.elem;
10058         }).length;
10059 };
10060
10061
10062
10063
10064
10065 var docElem = window.document.documentElement;
10066
10067 /**
10068  * Gets a window from an element
10069  */
10070 function getWindow( elem ) {
10071         return jQuery.isWindow( elem ) ?
10072                 elem :
10073                 elem.nodeType === 9 ?
10074                         elem.defaultView || elem.parentWindow :
10075                         false;
10076 }
10077
10078 jQuery.offset = {
10079         setOffset: function( elem, options, i ) {
10080                 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10081                         position = jQuery.css( elem, "position" ),
10082                         curElem = jQuery( elem ),
10083                         props = {};
10084
10085                 // set position first, in-case top/left are set even on static elem
10086                 if ( position === "static" ) {
10087                         elem.style.position = "relative";
10088                 }
10089
10090                 curOffset = curElem.offset();
10091                 curCSSTop = jQuery.css( elem, "top" );
10092                 curCSSLeft = jQuery.css( elem, "left" );
10093                 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10094                         jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;
10095
10096                 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
10097                 if ( calculatePosition ) {
10098                         curPosition = curElem.position();
10099                         curTop = curPosition.top;
10100                         curLeft = curPosition.left;
10101                 } else {
10102                         curTop = parseFloat( curCSSTop ) || 0;
10103                         curLeft = parseFloat( curCSSLeft ) || 0;
10104                 }
10105
10106                 if ( jQuery.isFunction( options ) ) {
10107                         options = options.call( elem, i, curOffset );
10108                 }
10109
10110                 if ( options.top != null ) {
10111                         props.top = ( options.top - curOffset.top ) + curTop;
10112                 }
10113                 if ( options.left != null ) {
10114                         props.left = ( options.left - curOffset.left ) + curLeft;
10115                 }
10116
10117                 if ( "using" in options ) {
10118                         options.using.call( elem, props );
10119                 } else {
10120                         curElem.css( props );
10121                 }
10122         }
10123 };
10124
10125 jQuery.fn.extend({
10126         offset: function( options ) {
10127                 if ( arguments.length ) {
10128                         return options === undefined ?
10129                                 this :
10130                                 this.each(function( i ) {
10131                                         jQuery.offset.setOffset( this, options, i );
10132                                 });
10133                 }
10134
10135                 var docElem, win,
10136                         box = { top: 0, left: 0 },
10137                         elem = this[ 0 ],
10138                         doc = elem && elem.ownerDocument;
10139
10140                 if ( !doc ) {
10141                         return;
10142                 }
10143
10144                 docElem = doc.documentElement;
10145
10146                 // Make sure it's not a disconnected DOM node
10147                 if ( !jQuery.contains( docElem, elem ) ) {
10148                         return box;
10149                 }
10150
10151                 // If we don't have gBCR, just use 0,0 rather than error
10152                 // BlackBerry 5, iOS 3 (original iPhone)
10153                 if ( typeof elem.getBoundingClientRect !== strundefined ) {
10154                         box = elem.getBoundingClientRect();
10155                 }
10156                 win = getWindow( doc );
10157                 return {
10158                         top: box.top  + ( win.pageYOffset || docElem.scrollTop )  - ( docElem.clientTop  || 0 ),
10159                         left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
10160                 };
10161         },
10162
10163         position: function() {
10164                 if ( !this[ 0 ] ) {
10165                         return;
10166                 }
10167
10168                 var offsetParent, offset,
10169                         parentOffset = { top: 0, left: 0 },
10170                         elem = this[ 0 ];
10171
10172                 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
10173                 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10174                         // we assume that getBoundingClientRect is available when computed position is fixed
10175                         offset = elem.getBoundingClientRect();
10176                 } else {
10177                         // Get *real* offsetParent
10178                         offsetParent = this.offsetParent();
10179
10180                         // Get correct offsets
10181                         offset = this.offset();
10182                         if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
10183                                 parentOffset = offsetParent.offset();
10184                         }
10185
10186                         // Add offsetParent borders
10187                         parentOffset.top  += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
10188                         parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
10189                 }
10190
10191                 // Subtract parent offsets and element margins
10192                 // note: when an element has margin: auto the offsetLeft and marginLeft
10193                 // are the same in Safari causing offset.left to incorrectly be 0
10194                 return {
10195                         top:  offset.top  - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10196                         left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
10197                 };
10198         },
10199
10200         offsetParent: function() {
10201                 return this.map(function() {
10202                         var offsetParent = this.offsetParent || docElem;
10203
10204                         while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
10205                                 offsetParent = offsetParent.offsetParent;
10206                         }
10207                         return offsetParent || docElem;
10208                 });
10209         }
10210 });
10211
10212 // Create scrollLeft and scrollTop methods
10213 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10214         var top = /Y/.test( prop );
10215
10216         jQuery.fn[ method ] = function( val ) {
10217                 return access( this, function( elem, method, val ) {
10218                         var win = getWindow( elem );
10219
10220                         if ( val === undefined ) {
10221                                 return win ? (prop in win) ? win[ prop ] :
10222                                         win.document.documentElement[ method ] :
10223                                         elem[ method ];
10224                         }
10225
10226                         if ( win ) {
10227                                 win.scrollTo(
10228                                         !top ? val : jQuery( win ).scrollLeft(),
10229                                         top ? val : jQuery( win ).scrollTop()
10230                                 );
10231
10232                         } else {
10233                                 elem[ method ] = val;
10234                         }
10235                 }, method, val, arguments.length, null );
10236         };
10237 });
10238
10239 // Add the top/left cssHooks using jQuery.fn.position
10240 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10241 // getComputedStyle returns percent when specified for top/left/bottom/right
10242 // rather than make the css module depend on the offset module, we just check for it here
10243 jQuery.each( [ "top", "left" ], function( i, prop ) {
10244         jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10245                 function( elem, computed ) {
10246                         if ( computed ) {
10247                                 computed = curCSS( elem, prop );
10248                                 // if curCSS returns percentage, fallback to offset
10249                                 return rnumnonpx.test( computed ) ?
10250                                         jQuery( elem ).position()[ prop ] + "px" :
10251                                         computed;
10252                         }
10253                 }
10254         );
10255 });
10256
10257
10258 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10259 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10260         jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
10261                 // margin is only for outerHeight, outerWidth
10262                 jQuery.fn[ funcName ] = function( margin, value ) {
10263                         var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10264                                 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10265
10266                         return access( this, function( elem, type, value ) {
10267                                 var doc;
10268
10269                                 if ( jQuery.isWindow( elem ) ) {
10270                                         // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
10271                                         // isn't a whole lot we can do. See pull request at this URL for discussion:
10272                                         // https://github.com/jquery/jquery/pull/764
10273                                         return elem.document.documentElement[ "client" + name ];
10274                                 }
10275
10276                                 // Get document width or height
10277                                 if ( elem.nodeType === 9 ) {
10278                                         doc = elem.documentElement;
10279
10280                                         // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
10281                                         // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
10282                                         return Math.max(
10283                                                 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10284                                                 elem.body[ "offset" + name ], doc[ "offset" + name ],
10285                                                 doc[ "client" + name ]
10286                                         );
10287                                 }
10288
10289                                 return value === undefined ?
10290                                         // Get width or height on the element, requesting but not forcing parseFloat
10291                                         jQuery.css( elem, type, extra ) :
10292
10293                                         // Set width or height on the element
10294                                         jQuery.style( elem, type, value, extra );
10295                         }, type, chainable ? margin : undefined, chainable, null );
10296                 };
10297         });
10298 });
10299
10300
10301 // The number of elements contained in the matched element set
10302 jQuery.fn.size = function() {
10303         return this.length;
10304 };
10305
10306 jQuery.fn.andSelf = jQuery.fn.addBack;
10307
10308
10309
10310
10311 // Register as a named AMD module, since jQuery can be concatenated with other
10312 // files that may use define, but not via a proper concatenation script that
10313 // understands anonymous AMD modules. A named AMD is safest and most robust
10314 // way to register. Lowercase jquery is used because AMD module names are
10315 // derived from file names, and jQuery is normally delivered in a lowercase
10316 // file name. Do this after creating the global so that if an AMD module wants
10317 // to call noConflict to hide this version of jQuery, it will work.
10318 if ( typeof define === "function" && define.amd ) {
10319         define( "jquery", [], function() {
10320                 return jQuery;
10321         });
10322 }
10323
10324
10325
10326
10327 var
10328         // Map over jQuery in case of overwrite
10329         _jQuery = window.jQuery,
10330
10331         // Map over the $ in case of overwrite
10332         _$ = window.$;
10333
10334 jQuery.noConflict = function( deep ) {
10335         if ( window.$ === jQuery ) {
10336                 window.$ = _$;
10337         }
10338
10339         if ( deep && window.jQuery === jQuery ) {
10340                 window.jQuery = _jQuery;
10341         }
10342
10343         return jQuery;
10344 };
10345
10346 // Expose jQuery and $ identifiers, even in
10347 // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10348 // and CommonJS for browser emulators (#13566)
10349 if ( typeof noGlobal === strundefined ) {
10350         window.jQuery = window.$ = jQuery;
10351 }
10352
10353
10354
10355
10356 return jQuery;
10357
10358 }));