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