comparison Agendas/trunk/src/Agendas.Web/Scripts/jquery-1.4.4.js @ 10:c62b77fc33f4

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