root/trunk/eCard/eCardMVC/Platnosci/Scripts/jquery-1.3.2.js @ 900

Wersja 866, 124.1 KB (wprowadzona przez alina, 16 years temu)

re #215

Line 
1/*!
2 * jQuery JavaScript Library v1.3.2
3 *
4 * Copyright (c) 2009 John Resig, http://jquery.com/
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
26 * Revision: 6246
27 */
28(function(){
29
30var
31        // Will speed up references to window, and allows munging its name.
32        window = this,
33        // Will speed up references to undefined, and allows munging its name.
34        undefined,
35        // Map over jQuery in case of overwrite
36        _jQuery = window.jQuery,
37        // Map over the $ in case of overwrite
38        _$ = window.$,
39
40        jQuery = window.jQuery = window.$ = function( selector, context ) {
41                // The jQuery object is actually just the init constructor 'enhanced'
42                return new jQuery.fn.init( selector, context );
43        },
44
45        // A simple way to check for HTML strings or ID strings
46        // (both of which we optimize for)
47        quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
48        // Is it a simple selector
49        isSimple = /^.[^:#\[\.,]*$/;
50
51jQuery.fn = jQuery.prototype = {
52        init: function( selector, context ) {
53                // Make sure that a selection was provided
54                selector = selector || document;
55
56                // Handle $(DOMElement)
57                if ( selector.nodeType ) {
58                        this[0] = selector;
59                        this.length = 1;
60                        this.context = selector;
61                        return this;
62                }
63                // Handle HTML strings
64                if ( typeof selector === "string" ) {
65                        // Are we dealing with HTML string or an ID?
66                        var match = quickExpr.exec( selector );
67
68                        // Verify a match, and that no context was specified for #id
69                        if ( match && (match[1] || !context) ) {
70
71                                // HANDLE: $(html) -> $(array)
72                                if ( match[1] )
73                                        selector = jQuery.clean( [ match[1] ], context );
74
75                                // HANDLE: $("#id")
76                                else {
77                                        var elem = document.getElementById( match[3] );
78
79                                        // Handle the case where IE and Opera return items
80                                        // by name instead of ID
81                                        if ( elem && elem.id != match[3] )
82                                                return jQuery().find( selector );
83
84                                        // Otherwise, we inject the element directly into the jQuery object
85                                        var ret = jQuery( elem || [] );
86                                        ret.context = document;
87                                        ret.selector = selector;
88                                        return ret;
89                                }
90
91                        // HANDLE: $(expr, [context])
92                        // (which is just equivalent to: $(content).find(expr)
93                        } else
94                                return jQuery( context ).find( selector );
95
96                // HANDLE: $(function)
97                // Shortcut for document ready
98                } else if ( jQuery.isFunction( selector ) )
99                        return jQuery( document ).ready( selector );
100
101                // Make sure that old selector state is passed along
102                if ( selector.selector && selector.context ) {
103                        this.selector = selector.selector;
104                        this.context = selector.context;
105                }
106
107                return this.setArray(jQuery.isArray( selector ) ?
108                        selector :
109                        jQuery.makeArray(selector));
110        },
111
112        // Start with an empty selector
113        selector: "",
114
115        // The current version of jQuery being used
116        jquery: "1.3.2",
117
118        // The number of elements contained in the matched element set
119        size: function() {
120                return this.length;
121        },
122
123        // Get the Nth element in the matched element set OR
124        // Get the whole matched element set as a clean array
125        get: function( num ) {
126                return num === undefined ?
127
128                        // Return a 'clean' array
129                        Array.prototype.slice.call( this ) :
130
131                        // Return just the object
132                        this[ num ];
133        },
134
135        // Take an array of elements and push it onto the stack
136        // (returning the new matched element set)
137        pushStack: function( elems, name, selector ) {
138                // Build a new jQuery matched element set
139                var ret = jQuery( elems );
140
141                // Add the old object onto the stack (as a reference)
142                ret.prevObject = this;
143
144                ret.context = this.context;
145
146                if ( name === "find" )
147                        ret.selector = this.selector + (this.selector ? " " : "") + selector;
148                else if ( name )
149                        ret.selector = this.selector + "." + name + "(" + selector + ")";
150
151                // Return the newly-formed element set
152                return ret;
153        },
154
155        // Force the current matched set of elements to become
156        // the specified array of elements (destroying the stack in the process)
157        // You should use pushStack() in order to do this, but maintain the stack
158        setArray: function( elems ) {
159                // Resetting the length to 0, then using the native Array push
160                // is a super-fast way to populate an object with array-like properties
161                this.length = 0;
162                Array.prototype.push.apply( this, elems );
163
164                return this;
165        },
166
167        // Execute a callback for every element in the matched set.
168        // (You can seed the arguments with an array of args, but this is
169        // only used internally.)
170        each: function( callback, args ) {
171                return jQuery.each( this, callback, args );
172        },
173
174        // Determine the position of an element within
175        // the matched set of elements
176        index: function( elem ) {
177                // Locate the position of the desired element
178                return jQuery.inArray(
179                        // If it receives a jQuery object, the first element is used
180                        elem && elem.jquery ? elem[0] : elem
181                , this );
182        },
183
184        attr: function( name, value, type ) {
185                var options = name;
186
187                // Look for the case where we're accessing a style value
188                if ( typeof name === "string" )
189                        if ( value === undefined )
190                                return this[0] && jQuery[ type || "attr" ]( this[0], name );
191
192                        else {
193                                options = {};
194                                options[ name ] = value;
195                        }
196
197                // Check to see if we're setting style values
198                return this.each(function(i){
199                        // Set all the styles
200                        for ( name in options )
201                                jQuery.attr(
202                                        type ?
203                                                this.style :
204                                                this,
205                                        name, jQuery.prop( this, options[ name ], type, i, name )
206                                );
207                });
208        },
209
210        css: function( key, value ) {
211                // ignore negative width and height values
212                if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
213                        value = undefined;
214                return this.attr( key, value, "curCSS" );
215        },
216
217        text: function( text ) {
218                if ( typeof text !== "object" && text != null )
219                        return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
220
221                var ret = "";
222
223                jQuery.each( text || this, function(){
224                        jQuery.each( this.childNodes, function(){
225                                if ( this.nodeType != 8 )
226                                        ret += this.nodeType != 1 ?
227                                                this.nodeValue :
228                                                jQuery.fn.text( [ this ] );
229                        });
230                });
231
232                return ret;
233        },
234
235        wrapAll: function( html ) {
236                if ( this[0] ) {
237                        // The elements to wrap the target around
238                        var wrap = jQuery( html, this[0].ownerDocument ).clone();
239
240                        if ( this[0].parentNode )
241                                wrap.insertBefore( this[0] );
242
243                        wrap.map(function(){
244                                var elem = this;
245
246                                while ( elem.firstChild )
247                                        elem = elem.firstChild;
248
249                                return elem;
250                        }).append(this);
251                }
252
253                return this;
254        },
255
256        wrapInner: function( html ) {
257                return this.each(function(){
258                        jQuery( this ).contents().wrapAll( html );
259                });
260        },
261
262        wrap: function( html ) {
263                return this.each(function(){
264                        jQuery( this ).wrapAll( html );
265                });
266        },
267
268        append: function() {
269                return this.domManip(arguments, true, function(elem){
270                        if (this.nodeType == 1)
271                                this.appendChild( elem );
272                });
273        },
274
275        prepend: function() {
276                return this.domManip(arguments, true, function(elem){
277                        if (this.nodeType == 1)
278                                this.insertBefore( elem, this.firstChild );
279                });
280        },
281
282        before: function() {
283                return this.domManip(arguments, false, function(elem){
284                        this.parentNode.insertBefore( elem, this );
285                });
286        },
287
288        after: function() {
289                return this.domManip(arguments, false, function(elem){
290                        this.parentNode.insertBefore( elem, this.nextSibling );
291                });
292        },
293
294        end: function() {
295                return this.prevObject || jQuery( [] );
296        },
297
298        // For internal use only.
299        // Behaves like an Array's method, not like a jQuery method.
300        push: [].push,
301        sort: [].sort,
302        splice: [].splice,
303
304        find: function( selector ) {
305                if ( this.length === 1 ) {
306                        var ret = this.pushStack( [], "find", selector );
307                        ret.length = 0;
308                        jQuery.find( selector, this[0], ret );
309                        return ret;
310                } else {
311                        return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
312                                return jQuery.find( selector, elem );
313                        })), "find", selector );
314                }
315        },
316
317        clone: function( events ) {
318                // Do the clone
319                var ret = this.map(function(){
320                        if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
321                                // IE copies events bound via attachEvent when
322                                // using cloneNode. Calling detachEvent on the
323                                // clone will also remove the events from the orignal
324                                // In order to get around this, we use innerHTML.
325                                // Unfortunately, this means some modifications to
326                                // attributes in IE that are actually only stored
327                                // as properties will not be copied (such as the
328                                // the name attribute on an input).
329                                var html = this.outerHTML;
330                                if ( !html ) {
331                                        var div = this.ownerDocument.createElement("div");
332                                        div.appendChild( this.cloneNode(true) );
333                                        html = div.innerHTML;
334                                }
335
336                                return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
337                        } else
338                                return this.cloneNode(true);
339                });
340
341                // Copy the events from the original to the clone
342                if ( events === true ) {
343                        var orig = this.find("*").andSelf(), i = 0;
344
345                        ret.find("*").andSelf().each(function(){
346                                if ( this.nodeName !== orig[i].nodeName )
347                                        return;
348
349                                var events = jQuery.data( orig[i], "events" );
350
351                                for ( var type in events ) {
352                                        for ( var handler in events[ type ] ) {
353                                                jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
354                                        }
355                                }
356
357                                i++;
358                        });
359                }
360
361                // Return the cloned set
362                return ret;
363        },
364
365        filter: function( selector ) {
366                return this.pushStack(
367                        jQuery.isFunction( selector ) &&
368                        jQuery.grep(this, function(elem, i){
369                                return selector.call( elem, i );
370                        }) ||
371
372                        jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
373                                return elem.nodeType === 1;
374                        }) ), "filter", selector );
375        },
376
377        closest: function( selector ) {
378                var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
379                        closer = 0;
380
381                return this.map(function(){
382                        var cur = this;
383                        while ( cur && cur.ownerDocument ) {
384                                if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
385                                        jQuery.data(cur, "closest", closer);
386                                        return cur;
387                                }
388                                cur = cur.parentNode;
389                                closer++;
390                        }
391                });
392        },
393
394        not: function( selector ) {
395                if ( typeof selector === "string" )
396                        // test special case where just one selector is passed in
397                        if ( isSimple.test( selector ) )
398                                return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
399                        else
400                                selector = jQuery.multiFilter( selector, this );
401
402                var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
403                return this.filter(function() {
404                        return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
405                });
406        },
407
408        add: function( selector ) {
409                return this.pushStack( jQuery.unique( jQuery.merge(
410                        this.get(),
411                        typeof selector === "string" ?
412                                jQuery( selector ) :
413                                jQuery.makeArray( selector )
414                )));
415        },
416
417        is: function( selector ) {
418                return !!selector && jQuery.multiFilter( selector, this ).length > 0;
419        },
420
421        hasClass: function( selector ) {
422                return !!selector && this.is( "." + selector );
423        },
424
425        val: function( value ) {
426                if ( value === undefined ) {                   
427                        var elem = this[0];
428
429                        if ( elem ) {
430                                if( jQuery.nodeName( elem, 'option' ) )
431                                        return (elem.attributes.value || {}).specified ? elem.value : elem.text;
432                               
433                                // We need to handle select boxes special
434                                if ( jQuery.nodeName( elem, "select" ) ) {
435                                        var index = elem.selectedIndex,
436                                                values = [],
437                                                options = elem.options,
438                                                one = elem.type == "select-one";
439
440                                        // Nothing was selected
441                                        if ( index < 0 )
442                                                return null;
443
444                                        // Loop through all the selected options
445                                        for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
446                                                var option = options[ i ];
447
448                                                if ( option.selected ) {
449                                                        // Get the specifc value for the option
450                                                        value = jQuery(option).val();
451
452                                                        // We don't need an array for one selects
453                                                        if ( one )
454                                                                return value;
455
456                                                        // Multi-Selects return an array
457                                                        values.push( value );
458                                                }
459                                        }
460
461                                        return values;                         
462                                }
463
464                                // Everything else, we just grab the value
465                                return (elem.value || "").replace(/\r/g, "");
466
467                        }
468
469                        return undefined;
470                }
471
472                if ( typeof value === "number" )
473                        value += '';
474
475                return this.each(function(){
476                        if ( this.nodeType != 1 )
477                                return;
478
479                        if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
480                                this.checked = (jQuery.inArray(this.value, value) >= 0 ||
481                                        jQuery.inArray(this.name, value) >= 0);
482
483                        else if ( jQuery.nodeName( this, "select" ) ) {
484                                var values = jQuery.makeArray(value);
485
486                                jQuery( "option", this ).each(function(){
487                                        this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
488                                                jQuery.inArray( this.text, values ) >= 0);
489                                });
490
491                                if ( !values.length )
492                                        this.selectedIndex = -1;
493
494                        } else
495                                this.value = value;
496                });
497        },
498
499        html: function( value ) {
500                return value === undefined ?
501                        (this[0] ?
502                                this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
503                                null) :
504                        this.empty().append( value );
505        },
506
507        replaceWith: function( value ) {
508                return this.after( value ).remove();
509        },
510
511        eq: function( i ) {
512                return this.slice( i, +i + 1 );
513        },
514
515        slice: function() {
516                return this.pushStack( Array.prototype.slice.apply( this, arguments ),
517                        "slice", Array.prototype.slice.call(arguments).join(",") );
518        },
519
520        map: function( callback ) {
521                return this.pushStack( jQuery.map(this, function(elem, i){
522                        return callback.call( elem, i, elem );
523                }));
524        },
525
526        andSelf: function() {
527                return this.add( this.prevObject );
528        },
529
530        domManip: function( args, table, callback ) {
531                if ( this[0] ) {
532                        var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
533                                scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
534                                first = fragment.firstChild;
535
536                        if ( first )
537                                for ( var i = 0, l = this.length; i < l; i++ )
538                                        callback.call( root(this[i], first), this.length > 1 || i > 0 ?
539                                                        fragment.cloneNode(true) : fragment );
540               
541                        if ( scripts )
542                                jQuery.each( scripts, evalScript );
543                }
544
545                return this;
546               
547                function root( elem, cur ) {
548                        return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
549                                (elem.getElementsByTagName("tbody")[0] ||
550                                elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
551                                elem;
552                }
553        }
554};
555
556// Give the init function the jQuery prototype for later instantiation
557jQuery.fn.init.prototype = jQuery.fn;
558
559function evalScript( i, elem ) {
560        if ( elem.src )
561                jQuery.ajax({
562                        url: elem.src,
563                        async: false,
564                        dataType: "script"
565                });
566
567        else
568                jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
569
570        if ( elem.parentNode )
571                elem.parentNode.removeChild( elem );
572}
573
574function now(){
575        return +new Date;
576}
577
578jQuery.extend = jQuery.fn.extend = function() {
579        // copy reference to target object
580        var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
581
582        // Handle a deep copy situation
583        if ( typeof target === "boolean" ) {
584                deep = target;
585                target = arguments[1] || {};
586                // skip the boolean and the target
587                i = 2;
588        }
589
590        // Handle case when target is a string or something (possible in deep copy)
591        if ( typeof target !== "object" && !jQuery.isFunction(target) )
592                target = {};
593
594        // extend jQuery itself if only one argument is passed
595        if ( length == i ) {
596                target = this;
597                --i;
598        }
599
600        for ( ; i < length; i++ )
601                // Only deal with non-null/undefined values
602                if ( (options = arguments[ i ]) != null )
603                        // Extend the base object
604                        for ( var name in options ) {
605                                var src = target[ name ], copy = options[ name ];
606
607                                // Prevent never-ending loop
608                                if ( target === copy )
609                                        continue;
610
611                                // Recurse if we're merging object values
612                                if ( deep && copy && typeof copy === "object" && !copy.nodeType )
613                                        target[ name ] = jQuery.extend( deep,
614                                                // Never move original objects, clone them
615                                                src || ( copy.length != null ? [ ] : { } )
616                                        , copy );
617
618                                // Don't bring in undefined values
619                                else if ( copy !== undefined )
620                                        target[ name ] = copy;
621
622                        }
623
624        // Return the modified object
625        return target;
626};
627
628// exclude the following css properties to add px
629var     exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
630        // cache defaultView
631        defaultView = document.defaultView || {},
632        toString = Object.prototype.toString;
633
634jQuery.extend({
635        noConflict: function( deep ) {
636                window.$ = _$;
637
638                if ( deep )
639                        window.jQuery = _jQuery;
640
641                return jQuery;
642        },
643
644        // See test/unit/core.js for details concerning isFunction.
645        // Since version 1.3, DOM methods and functions like alert
646        // aren't supported. They return false on IE (#2968).
647        isFunction: function( obj ) {
648                return toString.call(obj) === "[object Function]";
649        },
650
651        isArray: function( obj ) {
652                return toString.call(obj) === "[object Array]";
653        },
654
655        // check if an element is in a (or is an) XML document
656        isXMLDoc: function( elem ) {
657                return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
658                        !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
659        },
660
661        // Evalulates a script in a global context
662        globalEval: function( data ) {
663                if ( data && /\S/.test(data) ) {
664                        // Inspired by code by Andrea Giammarchi
665                        // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
666                        var head = document.getElementsByTagName("head")[0] || document.documentElement,
667                                script = document.createElement("script");
668
669                        script.type = "text/javascript";
670                        if ( jQuery.support.scriptEval )
671                                script.appendChild( document.createTextNode( data ) );
672                        else
673                                script.text = data;
674
675                        // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
676                        // This arises when a base node is used (#2709).
677                        head.insertBefore( script, head.firstChild );
678                        head.removeChild( script );
679                }
680        },
681
682        nodeName: function( elem, name ) {
683                return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
684        },
685
686        // args is for internal usage only
687        each: function( object, callback, args ) {
688                var name, i = 0, length = object.length;
689
690                if ( args ) {
691                        if ( length === undefined ) {
692                                for ( name in object )
693                                        if ( callback.apply( object[ name ], args ) === false )
694                                                break;
695                        } else
696                                for ( ; i < length; )
697                                        if ( callback.apply( object[ i++ ], args ) === false )
698                                                break;
699
700                // A special, fast, case for the most common use of each
701                } else {
702                        if ( length === undefined ) {
703                                for ( name in object )
704                                        if ( callback.call( object[ name ], name, object[ name ] ) === false )
705                                                break;
706                        } else
707                                for ( var value = object[0];
708                                        i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
709                }
710
711                return object;
712        },
713
714        prop: function( elem, value, type, i, name ) {
715                // Handle executable functions
716                if ( jQuery.isFunction( value ) )
717                        value = value.call( elem, i );
718
719                // Handle passing in a number to a CSS property
720                return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
721                        value + "px" :
722                        value;
723        },
724
725        className: {
726                // internal only, use addClass("class")
727                add: function( elem, classNames ) {
728                        jQuery.each((classNames || "").split(/\s+/), function(i, className){
729                                if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
730                                        elem.className += (elem.className ? " " : "") + className;
731                        });
732                },
733
734                // internal only, use removeClass("class")
735                remove: function( elem, classNames ) {
736                        if (elem.nodeType == 1)
737                                elem.className = classNames !== undefined ?
738                                        jQuery.grep(elem.className.split(/\s+/), function(className){
739                                                return !jQuery.className.has( classNames, className );
740                                        }).join(" ") :
741                                        "";
742                },
743
744                // internal only, use hasClass("class")
745                has: function( elem, className ) {
746                        return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
747                }
748        },
749
750        // A method for quickly swapping in/out CSS properties to get correct calculations
751        swap: function( elem, options, callback ) {
752                var old = {};
753                // Remember the old values, and insert the new ones
754                for ( var name in options ) {
755                        old[ name ] = elem.style[ name ];
756                        elem.style[ name ] = options[ name ];
757                }
758
759                callback.call( elem );
760
761                // Revert the old values
762                for ( var name in options )
763                        elem.style[ name ] = old[ name ];
764        },
765
766        css: function( elem, name, force, extra ) {
767                if ( name == "width" || name == "height" ) {
768                        var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
769
770                        function getWH() {
771                                val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
772
773                                if ( extra === "border" )
774                                        return;
775
776                                jQuery.each( which, function() {
777                                        if ( !extra )
778                                                val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
779                                        if ( extra === "margin" )
780                                                val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
781                                        else
782                                                val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
783                                });
784                        }
785
786                        if ( elem.offsetWidth !== 0 )
787                                getWH();
788                        else
789                                jQuery.swap( elem, props, getWH );
790
791                        return Math.max(0, Math.round(val));
792                }
793
794                return jQuery.curCSS( elem, name, force );
795        },
796
797        curCSS: function( elem, name, force ) {
798                var ret, style = elem.style;
799
800                // We need to handle opacity special in IE
801                if ( name == "opacity" && !jQuery.support.opacity ) {
802                        ret = jQuery.attr( style, "opacity" );
803
804                        return ret == "" ?
805                                "1" :
806                                ret;
807                }
808
809                // Make sure we're using the right name for getting the float value
810                if ( name.match( /float/i ) )
811                        name = styleFloat;
812
813                if ( !force && style && style[ name ] )
814                        ret = style[ name ];
815
816                else if ( defaultView.getComputedStyle ) {
817
818                        // Only "float" is needed here
819                        if ( name.match( /float/i ) )
820                                name = "float";
821
822                        name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
823
824                        var computedStyle = defaultView.getComputedStyle( elem, null );
825
826                        if ( computedStyle )
827                                ret = computedStyle.getPropertyValue( name );
828
829                        // We should always get a number back from opacity
830                        if ( name == "opacity" && ret == "" )
831                                ret = "1";
832
833                } else if ( elem.currentStyle ) {
834                        var camelCase = name.replace(/\-(\w)/g, function(all, letter){
835                                return letter.toUpperCase();
836                        });
837
838                        ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
839
840                        // From the awesome hack by Dean Edwards
841                        // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
842
843                        // If we're not dealing with a regular pixel number
844                        // but a number that has a weird ending, we need to convert it to pixels
845                        if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
846                                // Remember the original values
847                                var left = style.left, rsLeft = elem.runtimeStyle.left;
848
849                                // Put in the new values to get a computed value out
850                                elem.runtimeStyle.left = elem.currentStyle.left;
851                                style.left = ret || 0;
852                                ret = style.pixelLeft + "px";
853
854                                // Revert the changed values
855                                style.left = left;
856                                elem.runtimeStyle.left = rsLeft;
857                        }
858                }
859
860                return ret;
861        },
862
863        clean: function( elems, context, fragment ) {
864                context = context || document;
865
866                // !context.createElement fails in IE with an error but returns typeof 'object'
867                if ( typeof context.createElement === "undefined" )
868                        context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
869
870                // If a single string is passed in and it's a single tag
871                // just do a createElement and skip the rest
872                if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
873                        var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
874                        if ( match )
875                                return [ context.createElement( match[1] ) ];
876                }
877
878                var ret = [], scripts = [], div = context.createElement("div");
879
880                jQuery.each(elems, function(i, elem){
881                        if ( typeof elem === "number" )
882                                elem += '';
883
884                        if ( !elem )
885                                return;
886
887                        // Convert html string into DOM nodes
888                        if ( typeof elem === "string" ) {
889                                // Fix "XHTML"-style tags in all browsers
890                                elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
891                                        return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
892                                                all :
893                                                front + "></" + tag + ">";
894                                });
895
896                                // Trim whitespace, otherwise indexOf won't work as expected
897                                var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
898
899                                var wrap =
900                                        // option or optgroup
901                                        !tags.indexOf("<opt") &&
902                                        [ 1, "<select multiple='multiple'>", "</select>" ] ||
903
904                                        !tags.indexOf("<leg") &&
905                                        [ 1, "<fieldset>", "</fieldset>" ] ||
906
907                                        tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
908                                        [ 1, "<table>", "</table>" ] ||
909
910                                        !tags.indexOf("<tr") &&
911                                        [ 2, "<table><tbody>", "</tbody></table>" ] ||
912
913                                        // <thead> matched above
914                                        (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
915                                        [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
916
917                                        !tags.indexOf("<col") &&
918                                        [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
919
920                                        // IE can't serialize <link> and <script> tags normally
921                                        !jQuery.support.htmlSerialize &&
922                                        [ 1, "div<div>", "</div>" ] ||
923
924                                        [ 0, "", "" ];
925
926                                // Go to html and back, then peel off extra wrappers
927                                div.innerHTML = wrap[1] + elem + wrap[2];
928
929                                // Move to the right depth
930                                while ( wrap[0]-- )
931                                        div = div.lastChild;
932
933                                // Remove IE's autoinserted <tbody> from table fragments
934                                if ( !jQuery.support.tbody ) {
935
936                                        // String was a <table>, *may* have spurious <tbody>
937                                        var hasBody = /<tbody/i.test(elem),
938                                                tbody = !tags.indexOf("<table") && !hasBody ?
939                                                        div.firstChild && div.firstChild.childNodes :
940
941                                                // String was a bare <thead> or <tfoot>
942                                                wrap[1] == "<table>" && !hasBody ?
943                                                        div.childNodes :
944                                                        [];
945
946                                        for ( var j = tbody.length - 1; j >= 0 ; --j )
947                                                if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
948                                                        tbody[ j ].parentNode.removeChild( tbody[ j ] );
949
950                                        }
951
952                                // IE completely kills leading whitespace when innerHTML is used
953                                if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
954                                        div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
955                               
956                                elem = jQuery.makeArray( div.childNodes );
957                        }
958
959                        if ( elem.nodeType )
960                                ret.push( elem );
961                        else
962                                ret = jQuery.merge( ret, elem );
963
964                });
965
966                if ( fragment ) {
967                        for ( var i = 0; ret[i]; i++ ) {
968                                if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
969                                        scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
970                                } else {
971                                        if ( ret[i].nodeType === 1 )
972                                                ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
973                                        fragment.appendChild( ret[i] );
974                                }
975                        }
976                       
977                        return scripts;
978                }
979
980                return ret;
981        },
982
983        attr: function( elem, name, value ) {
984                // don't set attributes on text and comment nodes
985                if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
986                        return undefined;
987
988                var notxml = !jQuery.isXMLDoc( elem ),
989                        // Whether we are setting (or getting)
990                        set = value !== undefined;
991
992                // Try to normalize/fix the name
993                name = notxml && jQuery.props[ name ] || name;
994
995                // Only do all the following if this is a node (faster for style)
996                // IE elem.getAttribute passes even for style
997                if ( elem.tagName ) {
998
999                        // These attributes require special treatment
1000                        var special = /href|src|style/.test( name );
1001
1002                        // Safari mis-reports the default selected property of a hidden option
1003                        // Accessing the parent's selectedIndex property fixes it
1004                        if ( name == "selected" && elem.parentNode )
1005                                elem.parentNode.selectedIndex;
1006
1007                        // If applicable, access the attribute via the DOM 0 way
1008                        if ( name in elem && notxml && !special ) {
1009                                if ( set ){
1010                                        // We can't allow the type property to be changed (since it causes problems in IE)
1011                                        if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
1012                                                throw "type property can't be changed";
1013
1014                                        elem[ name ] = value;
1015                                }
1016
1017                                // browsers index elements by id/name on forms, give priority to attributes.
1018                                if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
1019                                        return elem.getAttributeNode( name ).nodeValue;
1020
1021                                // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1022                                // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1023                                if ( name == "tabIndex" ) {
1024                                        var attributeNode = elem.getAttributeNode( "tabIndex" );
1025                                        return attributeNode && attributeNode.specified
1026                                                ? attributeNode.value
1027                                                : elem.nodeName.match(/(button|input|object|select|textarea)/i)
1028                                                        ? 0
1029                                                        : elem.nodeName.match(/^(a|area)$/i) && elem.href
1030                                                                ? 0
1031                                                                : undefined;
1032                                }
1033
1034                                return elem[ name ];
1035                        }
1036
1037                        if ( !jQuery.support.style && notxml &&  name == "style" )
1038                                return jQuery.attr( elem.style, "cssText", value );
1039
1040                        if ( set )
1041                                // convert the value to a string (all browsers do this but IE) see #1070
1042                                elem.setAttribute( name, "" + value );
1043
1044                        var attr = !jQuery.support.hrefNormalized && notxml && special
1045                                        // Some attributes require a special call on IE
1046                                        ? elem.getAttribute( name, 2 )
1047                                        : elem.getAttribute( name );
1048
1049                        // Non-existent attributes return null, we normalize to undefined
1050                        return attr === null ? undefined : attr;
1051                }
1052
1053                // elem is actually elem.style ... set the style
1054
1055                // IE uses filters for opacity
1056                if ( !jQuery.support.opacity && name == "opacity" ) {
1057                        if ( set ) {
1058                                // IE has trouble with opacity if it does not have layout
1059                                // Force it by setting the zoom level
1060                                elem.zoom = 1;
1061
1062                                // Set the alpha filter to set the opacity
1063                                elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1064                                        (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1065                        }
1066
1067                        return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1068                                (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
1069                                "";
1070                }
1071
1072                name = name.replace(/-([a-z])/ig, function(all, letter){
1073                        return letter.toUpperCase();
1074                });
1075
1076                if ( set )
1077                        elem[ name ] = value;
1078
1079                return elem[ name ];
1080        },
1081
1082        trim: function( text ) {
1083                return (text || "").replace( /^\s+|\s+$/g, "" );
1084        },
1085
1086        makeArray: function( array ) {
1087                var ret = [];
1088
1089                if( array != null ){
1090                        var i = array.length;
1091                        // The window, strings (and functions) also have 'length'
1092                        if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
1093                                ret[0] = array;
1094                        else
1095                                while( i )
1096                                        ret[--i] = array[i];
1097                }
1098
1099                return ret;
1100        },
1101
1102        inArray: function( elem, array ) {
1103                for ( var i = 0, length = array.length; i < length; i++ )
1104                // Use === because on IE, window == document
1105                        if ( array[ i ] === elem )
1106                                return i;
1107
1108                return -1;
1109        },
1110
1111        merge: function( first, second ) {
1112                // We have to loop this way because IE & Opera overwrite the length
1113                // expando of getElementsByTagName
1114                var i = 0, elem, pos = first.length;
1115                // Also, we need to make sure that the correct elements are being returned
1116                // (IE returns comment nodes in a '*' query)
1117                if ( !jQuery.support.getAll ) {
1118                        while ( (elem = second[ i++ ]) != null )
1119                                if ( elem.nodeType != 8 )
1120                                        first[ pos++ ] = elem;
1121
1122                } else
1123                        while ( (elem = second[ i++ ]) != null )
1124                                first[ pos++ ] = elem;
1125
1126                return first;
1127        },
1128
1129        unique: function( array ) {
1130                var ret = [], done = {};
1131
1132                try {
1133
1134                        for ( var i = 0, length = array.length; i < length; i++ ) {
1135                                var id = jQuery.data( array[ i ] );
1136
1137                                if ( !done[ id ] ) {
1138                                        done[ id ] = true;
1139                                        ret.push( array[ i ] );
1140                                }
1141                        }
1142
1143                } catch( e ) {
1144                        ret = array;
1145                }
1146
1147                return ret;
1148        },
1149
1150        grep: function( elems, callback, inv ) {
1151                var ret = [];
1152
1153                // Go through the array, only saving the items
1154                // that pass the validator function
1155                for ( var i = 0, length = elems.length; i < length; i++ )
1156                        if ( !inv != !callback( elems[ i ], i ) )
1157                                ret.push( elems[ i ] );
1158
1159                return ret;
1160        },
1161
1162        map: function( elems, callback ) {
1163                var ret = [];
1164
1165                // Go through the array, translating each of the items to their
1166                // new value (or values).
1167                for ( var i = 0, length = elems.length; i < length; i++ ) {
1168                        var value = callback( elems[ i ], i );
1169
1170                        if ( value != null )
1171                                ret[ ret.length ] = value;
1172                }
1173
1174                return ret.concat.apply( [], ret );
1175        }
1176});
1177
1178// Use of jQuery.browser is deprecated.
1179// It's included for backwards compatibility and plugins,
1180// although they should work to migrate away.
1181
1182var userAgent = navigator.userAgent.toLowerCase();
1183
1184// Figure out what browser is being used
1185jQuery.browser = {
1186        version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
1187        safari: /webkit/.test( userAgent ),
1188        opera: /opera/.test( userAgent ),
1189        msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
1190        mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
1191};
1192
1193jQuery.each({
1194        parent: function(elem){return elem.parentNode;},
1195        parents: function(elem){return jQuery.dir(elem,"parentNode");},
1196        next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
1197        prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
1198        nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
1199        prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
1200        siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
1201        children: function(elem){return jQuery.sibling(elem.firstChild);},
1202        contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
1203}, function(name, fn){
1204        jQuery.fn[ name ] = function( selector ) {
1205                var ret = jQuery.map( this, fn );
1206
1207                if ( selector && typeof selector == "string" )
1208                        ret = jQuery.multiFilter( selector, ret );
1209
1210                return this.pushStack( jQuery.unique( ret ), name, selector );
1211        };
1212});
1213
1214jQuery.each({
1215        appendTo: "append",
1216        prependTo: "prepend",
1217        insertBefore: "before",
1218        insertAfter: "after",
1219        replaceAll: "replaceWith"
1220}, function(name, original){
1221        jQuery.fn[ name ] = function( selector ) {
1222                var ret = [], insert = jQuery( selector );
1223
1224                for ( var i = 0, l = insert.length; i < l; i++ ) {
1225                        var elems = (i > 0 ? this.clone(true) : this).get();
1226                        jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
1227                        ret = ret.concat( elems );
1228                }
1229
1230                return this.pushStack( ret, name, selector );
1231        };
1232});
1233
1234jQuery.each({
1235        removeAttr: function( name ) {
1236                jQuery.attr( this, name, "" );
1237                if (this.nodeType == 1)
1238                        this.removeAttribute( name );
1239        },
1240
1241        addClass: function( classNames ) {
1242                jQuery.className.add( this, classNames );
1243        },
1244
1245        removeClass: function( classNames ) {
1246                jQuery.className.remove( this, classNames );
1247        },
1248
1249        toggleClass: function( classNames, state ) {
1250                if( typeof state !== "boolean" )
1251                        state = !jQuery.className.has( this, classNames );
1252                jQuery.className[ state ? "add" : "remove" ]( this, classNames );
1253        },
1254
1255        remove: function( selector ) {
1256                if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
1257                        // Prevent memory leaks
1258                        jQuery( "*", this ).add([this]).each(function(){
1259                                jQuery.event.remove(this);
1260                                jQuery.removeData(this);
1261                        });
1262                        if (this.parentNode)
1263                                this.parentNode.removeChild( this );
1264                }
1265        },
1266
1267        empty: function() {
1268                // Remove element nodes and prevent memory leaks
1269                jQuery(this).children().remove();
1270
1271                // Remove any remaining nodes
1272                while ( this.firstChild )
1273                        this.removeChild( this.firstChild );
1274        }
1275}, function(name, fn){
1276        jQuery.fn[ name ] = function(){
1277                return this.each( fn, arguments );
1278        };
1279});
1280
1281// Helper function used by the dimensions and offset modules
1282function num(elem, prop) {
1283        return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
1284}
1285var expando = "jQuery" + now(), uuid = 0, windowData = {};
1286
1287jQuery.extend({
1288        cache: {},
1289
1290        data: function( elem, name, data ) {
1291                elem = elem == window ?
1292                        windowData :
1293                        elem;
1294
1295                var id = elem[ expando ];
1296
1297                // Compute a unique ID for the element
1298                if ( !id )
1299                        id = elem[ expando ] = ++uuid;
1300
1301                // Only generate the data cache if we're
1302                // trying to access or manipulate it
1303                if ( name && !jQuery.cache[ id ] )
1304                        jQuery.cache[ id ] = {};
1305
1306                // Prevent overriding the named cache with undefined values
1307                if ( data !== undefined )
1308                        jQuery.cache[ id ][ name ] = data;
1309
1310                // Return the named cache data, or the ID for the element
1311                return name ?
1312                        jQuery.cache[ id ][ name ] :
1313                        id;
1314        },
1315
1316        removeData: function( elem, name ) {
1317                elem = elem == window ?
1318                        windowData :
1319                        elem;
1320
1321                var id = elem[ expando ];
1322
1323                // If we want to remove a specific section of the element's data
1324                if ( name ) {
1325                        if ( jQuery.cache[ id ] ) {
1326                                // Remove the section of cache data
1327                                delete jQuery.cache[ id ][ name ];
1328
1329                                // If we've removed all the data, remove the element's cache
1330                                name = "";
1331
1332                                for ( name in jQuery.cache[ id ] )
1333                                        break;
1334
1335                                if ( !name )
1336                                        jQuery.removeData( elem );
1337                        }
1338
1339                // Otherwise, we want to remove all of the element's data
1340                } else {
1341                        // Clean up the element expando
1342                        try {
1343                                delete elem[ expando ];
1344                        } catch(e){
1345                                // IE has trouble directly removing the expando
1346                                // but it's ok with using removeAttribute
1347                                if ( elem.removeAttribute )
1348                                        elem.removeAttribute( expando );
1349                        }
1350
1351                        // Completely remove the data cache
1352                        delete jQuery.cache[ id ];
1353                }
1354        },
1355        queue: function( elem, type, data ) {
1356                if ( elem ){
1357       
1358                        type = (type || "fx") + "queue";
1359       
1360                        var q = jQuery.data( elem, type );
1361       
1362                        if ( !q || jQuery.isArray(data) )
1363                                q = jQuery.data( elem, type, jQuery.makeArray(data) );
1364                        else if( data )
1365                                q.push( data );
1366       
1367                }
1368                return q;
1369        },
1370
1371        dequeue: function( elem, type ){
1372                var queue = jQuery.queue( elem, type ),
1373                        fn = queue.shift();
1374               
1375                if( !type || type === "fx" )
1376                        fn = queue[0];
1377                       
1378                if( fn !== undefined )
1379                        fn.call(elem);
1380        }
1381});
1382
1383jQuery.fn.extend({
1384        data: function( key, value ){
1385                var parts = key.split(".");
1386                parts[1] = parts[1] ? "." + parts[1] : "";
1387
1388                if ( value === undefined ) {
1389                        var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1390
1391                        if ( data === undefined && this.length )
1392                                data = jQuery.data( this[0], key );
1393
1394                        return data === undefined && parts[1] ?
1395                                this.data( parts[0] ) :
1396                                data;
1397                } else
1398                        return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
1399                                jQuery.data( this, key, value );
1400                        });
1401        },
1402
1403        removeData: function( key ){
1404                return this.each(function(){
1405                        jQuery.removeData( this, key );
1406                });
1407        },
1408        queue: function(type, data){
1409                if ( typeof type !== "string" ) {
1410                        data = type;
1411                        type = "fx";
1412                }
1413
1414                if ( data === undefined )
1415                        return jQuery.queue( this[0], type );
1416
1417                return this.each(function(){
1418                        var queue = jQuery.queue( this, type, data );
1419                       
1420                         if( type == "fx" && queue.length == 1 )
1421                                queue[0].call(this);
1422                });
1423        },
1424        dequeue: function(type){
1425                return this.each(function(){
1426                        jQuery.dequeue( this, type );
1427                });
1428        }
1429});/*!
1430 * Sizzle CSS Selector Engine - v0.9.3
1431 *  Copyright 2009, The Dojo Foundation
1432 *  More information: http://sizzlejs.com/
1433 *
1434 * Permission is hereby granted, free of charge, to any person obtaining a copy
1435 * of this software and associated documentation files (the "Software"), to deal
1436 * in the Software without restriction, including without limitation the rights
1437 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1438 * copies of the Software, and to permit persons to whom the Software is
1439 * furnished to do so, subject to the following conditions:
1440 *
1441 * The above copyright notice and this permission notice shall be included in
1442 * all copies or substantial portions of the Software.
1443 *
1444 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1445 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1446 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1447 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1448 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1449 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1450 * THE SOFTWARE.
1451 *
1452 */
1453(function(){
1454
1455var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
1456        done = 0,
1457        toString = Object.prototype.toString;
1458
1459var Sizzle = function(selector, context, results, seed) {
1460        results = results || [];
1461        context = context || document;
1462
1463        if ( context.nodeType !== 1 && context.nodeType !== 9 )
1464                return [];
1465       
1466        if ( !selector || typeof selector !== "string" ) {
1467                return results;
1468        }
1469
1470        var parts = [], m, set, checkSet, check, mode, extra, prune = true;
1471       
1472        // Reset the position of the chunker regexp (start from head)
1473        chunker.lastIndex = 0;
1474       
1475        while ( (m = chunker.exec(selector)) !== null ) {
1476                parts.push( m[1] );
1477               
1478                if ( m[2] ) {
1479                        extra = RegExp.rightContext;
1480                        break;
1481                }
1482        }
1483
1484        if ( parts.length > 1 && origPOS.exec( selector ) ) {
1485                if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
1486                        set = posProcess( parts[0] + parts[1], context );
1487                } else {
1488                        set = Expr.relative[ parts[0] ] ?
1489                                [ context ] :
1490                                Sizzle( parts.shift(), context );
1491
1492                        while ( parts.length ) {
1493                                selector = parts.shift();
1494
1495                                if ( Expr.relative[ selector ] )
1496                                        selector += parts.shift();
1497
1498                                set = posProcess( selector, set );
1499                        }
1500                }
1501        } else {
1502                var ret = seed ?
1503                        { expr: parts.pop(), set: makeArray(seed) } :
1504                        Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
1505                set = Sizzle.filter( ret.expr, ret.set );
1506
1507                if ( parts.length > 0 ) {
1508                        checkSet = makeArray(set);
1509                } else {
1510                        prune = false;
1511                }
1512
1513                while ( parts.length ) {
1514                        var cur = parts.pop(), pop = cur;
1515
1516                        if ( !Expr.relative[ cur ] ) {
1517                                cur = "";
1518                        } else {
1519                                pop = parts.pop();
1520                        }
1521
1522                        if ( pop == null ) {
1523                                pop = context;
1524                        }
1525
1526                        Expr.relative[ cur ]( checkSet, pop, isXML(context) );
1527                }
1528        }
1529
1530        if ( !checkSet ) {
1531                checkSet = set;
1532        }
1533
1534        if ( !checkSet ) {
1535                throw "Syntax error, unrecognized expression: " + (cur || selector);
1536        }
1537
1538        if ( toString.call(checkSet) === "[object Array]" ) {
1539                if ( !prune ) {
1540                        results.push.apply( results, checkSet );
1541                } else if ( context.nodeType === 1 ) {
1542                        for ( var i = 0; checkSet[i] != null; i++ ) {
1543                                if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
1544                                        results.push( set[i] );
1545                                }
1546                        }
1547                } else {
1548                        for ( var i = 0; checkSet[i] != null; i++ ) {
1549                                if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
1550                                        results.push( set[i] );
1551                                }
1552                        }
1553                }
1554        } else {
1555                makeArray( checkSet, results );
1556        }
1557
1558        if ( extra ) {
1559                Sizzle( extra, context, results, seed );
1560
1561                if ( sortOrder ) {
1562                        hasDuplicate = false;
1563                        results.sort(sortOrder);
1564
1565                        if ( hasDuplicate ) {
1566                                for ( var i = 1; i < results.length; i++ ) {
1567                                        if ( results[i] === results[i-1] ) {
1568                                                results.splice(i--, 1);
1569                                        }
1570                                }
1571                        }
1572                }
1573        }
1574
1575        return results;
1576};
1577
1578Sizzle.matches = function(expr, set){
1579        return Sizzle(expr, null, null, set);
1580};
1581
1582Sizzle.find = function(expr, context, isXML){
1583        var set, match;
1584
1585        if ( !expr ) {
1586                return [];
1587        }
1588
1589        for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
1590                var type = Expr.order[i], match;
1591               
1592                if ( (match = Expr.match[ type ].exec( expr )) ) {
1593                        var left = RegExp.leftContext;
1594
1595                        if ( left.substr( left.length - 1 ) !== "\\" ) {
1596                                match[1] = (match[1] || "").replace(/\\/g, "");
1597                                set = Expr.find[ type ]( match, context, isXML );
1598                                if ( set != null ) {
1599                                        expr = expr.replace( Expr.match[ type ], "" );
1600                                        break;
1601                                }
1602                        }
1603                }
1604        }
1605
1606        if ( !set ) {
1607                set = context.getElementsByTagName("*");
1608        }
1609
1610        return {set: set, expr: expr};
1611};
1612
1613Sizzle.filter = function(expr, set, inplace, not){
1614        var old = expr, result = [], curLoop = set, match, anyFound,
1615                isXMLFilter = set && set[0] && isXML(set[0]);
1616
1617        while ( expr && set.length ) {
1618                for ( var type in Expr.filter ) {
1619                        if ( (match = Expr.match[ type ].exec( expr )) != null ) {
1620                                var filter = Expr.filter[ type ], found, item;
1621                                anyFound = false;
1622
1623                                if ( curLoop == result ) {
1624                                        result = [];
1625                                }
1626
1627                                if ( Expr.preFilter[ type ] ) {
1628                                        match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
1629
1630                                        if ( !match ) {
1631                                                anyFound = found = true;
1632                                        } else if ( match === true ) {
1633                                                continue;
1634                                        }
1635                                }
1636
1637                                if ( match ) {
1638                                        for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
1639                                                if ( item ) {
1640                                                        found = filter( item, match, i, curLoop );
1641                                                        var pass = not ^ !!found;
1642
1643                                                        if ( inplace && found != null ) {
1644                                                                if ( pass ) {
1645                                                                        anyFound = true;
1646                                                                } else {
1647                                                                        curLoop[i] = false;
1648                                                                }
1649                                                        } else if ( pass ) {
1650                                                                result.push( item );
1651                                                                anyFound = true;
1652                                                        }
1653                                                }
1654                                        }
1655                                }
1656
1657                                if ( found !== undefined ) {
1658                                        if ( !inplace ) {
1659                                                curLoop = result;
1660                                        }
1661
1662                                        expr = expr.replace( Expr.match[ type ], "" );
1663
1664                                        if ( !anyFound ) {
1665                                                return [];
1666                                        }
1667
1668                                        break;
1669                                }
1670                        }
1671                }
1672
1673                // Improper expression
1674                if ( expr == old ) {
1675                        if ( anyFound == null ) {
1676                                throw "Syntax error, unrecognized expression: " + expr;
1677                        } else {
1678                                break;
1679                        }
1680                }
1681
1682                old = expr;
1683        }
1684
1685        return curLoop;
1686};
1687
1688var Expr = Sizzle.selectors = {
1689        order: [ "ID", "NAME", "TAG" ],
1690        match: {
1691                ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
1692                CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
1693                NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
1694                ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
1695                TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
1696                CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
1697                POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
1698                PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
1699        },
1700        attrMap: {
1701                "class": "className",
1702                "for": "htmlFor"
1703        },
1704        attrHandle: {
1705                href: function(elem){
1706                        return elem.getAttribute("href");
1707                }
1708        },
1709        relative: {
1710                "+": function(checkSet, part, isXML){
1711                        var isPartStr = typeof part === "string",
1712                                isTag = isPartStr && !/\W/.test(part),
1713                                isPartStrNotTag = isPartStr && !isTag;
1714
1715                        if ( isTag && !isXML ) {
1716                                part = part.toUpperCase();
1717                        }
1718
1719                        for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
1720                                if ( (elem = checkSet[i]) ) {
1721                                        while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
1722
1723                                        checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
1724                                                elem || false :
1725                                                elem === part;
1726                                }
1727                        }
1728
1729                        if ( isPartStrNotTag ) {
1730                                Sizzle.filter( part, checkSet, true );
1731                        }
1732                },
1733                ">": function(checkSet, part, isXML){
1734                        var isPartStr = typeof part === "string";
1735
1736                        if ( isPartStr && !/\W/.test(part) ) {
1737                                part = isXML ? part : part.toUpperCase();
1738
1739                                for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1740                                        var elem = checkSet[i];
1741                                        if ( elem ) {
1742                                                var parent = elem.parentNode;
1743                                                checkSet[i] = parent.nodeName === part ? parent : false;
1744                                        }
1745                                }
1746                        } else {
1747                                for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1748                                        var elem = checkSet[i];
1749                                        if ( elem ) {
1750                                                checkSet[i] = isPartStr ?
1751                                                        elem.parentNode :
1752                                                        elem.parentNode === part;
1753                                        }
1754                                }
1755
1756                                if ( isPartStr ) {
1757                                        Sizzle.filter( part, checkSet, true );
1758                                }
1759                        }
1760                },
1761                "": function(checkSet, part, isXML){
1762                        var doneName = done++, checkFn = dirCheck;
1763
1764                        if ( !part.match(/\W/) ) {
1765                                var nodeCheck = part = isXML ? part : part.toUpperCase();
1766                                checkFn = dirNodeCheck;
1767                        }
1768
1769                        checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
1770                },
1771                "~": function(checkSet, part, isXML){
1772                        var doneName = done++, checkFn = dirCheck;
1773
1774                        if ( typeof part === "string" && !part.match(/\W/) ) {
1775                                var nodeCheck = part = isXML ? part : part.toUpperCase();
1776                                checkFn = dirNodeCheck;
1777                        }
1778
1779                        checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
1780                }
1781        },
1782        find: {
1783                ID: function(match, context, isXML){
1784                        if ( typeof context.getElementById !== "undefined" && !isXML ) {
1785                                var m = context.getElementById(match[1]);
1786                                return m ? [m] : [];
1787                        }
1788                },
1789                NAME: function(match, context, isXML){
1790                        if ( typeof context.getElementsByName !== "undefined" ) {
1791                                var ret = [], results = context.getElementsByName(match[1]);
1792
1793                                for ( var i = 0, l = results.length; i < l; i++ ) {
1794                                        if ( results[i].getAttribute("name") === match[1] ) {
1795                                                ret.push( results[i] );
1796                                        }
1797                                }
1798
1799                                return ret.length === 0 ? null : ret;
1800                        }
1801                },
1802                TAG: function(match, context){
1803                        return context.getElementsByTagName(match[1]);
1804                }
1805        },
1806        preFilter: {
1807                CLASS: function(match, curLoop, inplace, result, not, isXML){
1808                        match = " " + match[1].replace(/\\/g, "") + " ";
1809
1810                        if ( isXML ) {
1811                                return match;
1812                        }
1813
1814                        for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
1815                                if ( elem ) {
1816                                        if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
1817                                                if ( !inplace )
1818                                                        result.push( elem );
1819                                        } else if ( inplace ) {
1820                                                curLoop[i] = false;
1821                                        }
1822                                }
1823                        }
1824
1825                        return false;
1826                },
1827                ID: function(match){
1828                        return match[1].replace(/\\/g, "");
1829                },
1830                TAG: function(match, curLoop){
1831                        for ( var i = 0; curLoop[i] === false; i++ ){}
1832                        return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
1833                },
1834                CHILD: function(match){
1835                        if ( match[1] == "nth" ) {
1836                                // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
1837                                var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
1838                                        match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
1839                                        !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
1840
1841                                // calculate the numbers (first)n+(last) including if they are negative
1842                                match[2] = (test[1] + (test[2] || 1)) - 0;
1843                                match[3] = test[3] - 0;
1844                        }
1845
1846                        // TODO: Move to normal caching system
1847                        match[0] = done++;
1848
1849                        return match;
1850                },
1851                ATTR: function(match, curLoop, inplace, result, not, isXML){
1852                        var name = match[1].replace(/\\/g, "");
1853                       
1854                        if ( !isXML && Expr.attrMap[name] ) {
1855                                match[1] = Expr.attrMap[name];
1856                        }
1857
1858                        if ( match[2] === "~=" ) {
1859                                match[4] = " " + match[4] + " ";
1860                        }
1861
1862                        return match;
1863                },
1864                PSEUDO: function(match, curLoop, inplace, result, not){
1865                        if ( match[1] === "not" ) {
1866                                // If we're dealing with a complex expression, or a simple one
1867                                if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
1868                                        match[3] = Sizzle(match[3], null, null, curLoop);
1869                                } else {
1870                                        var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
1871                                        if ( !inplace ) {
1872                                                result.push.apply( result, ret );
1873                                        }
1874                                        return false;
1875                                }
1876                        } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
1877                                return true;
1878                        }
1879                       
1880                        return match;
1881                },
1882                POS: function(match){
1883                        match.unshift( true );
1884                        return match;
1885                }
1886        },
1887        filters: {
1888                enabled: function(elem){
1889                        return elem.disabled === false && elem.type !== "hidden";
1890                },
1891                disabled: function(elem){
1892                        return elem.disabled === true;
1893                },
1894                checked: function(elem){
1895                        return elem.checked === true;
1896                },
1897                selected: function(elem){
1898                        // Accessing this property makes selected-by-default
1899                        // options in Safari work properly
1900                        elem.parentNode.selectedIndex;
1901                        return elem.selected === true;
1902                },
1903                parent: function(elem){
1904                        return !!elem.firstChild;
1905                },
1906                empty: function(elem){
1907                        return !elem.firstChild;
1908                },
1909                has: function(elem, i, match){
1910                        return !!Sizzle( match[3], elem ).length;
1911                },
1912                header: function(elem){
1913                        return /h\d/i.test( elem.nodeName );
1914                },
1915                text: function(elem){
1916                        return "text" === elem.type;
1917                },
1918                radio: function(elem){
1919                        return "radio" === elem.type;
1920                },
1921                checkbox: function(elem){
1922                        return "checkbox" === elem.type;
1923                },
1924                file: function(elem){
1925                        return "file" === elem.type;
1926                },
1927                password: function(elem){
1928                        return "password" === elem.type;
1929                },
1930                submit: function(elem){
1931                        return "submit" === elem.type;
1932                },
1933                image: function(elem){
1934                        return "image" === elem.type;
1935                },
1936                reset: function(elem){
1937                        return "reset" === elem.type;
1938                },
1939                button: function(elem){
1940                        return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
1941                },
1942                input: function(elem){
1943                        return /input|select|textarea|button/i.test(elem.nodeName);
1944                }
1945        },
1946        setFilters: {
1947                first: function(elem, i){
1948                        return i === 0;
1949                },
1950                last: function(elem, i, match, array){
1951                        return i === array.length - 1;
1952                },
1953                even: function(elem, i){
1954                        return i % 2 === 0;
1955                },
1956                odd: function(elem, i){
1957                        return i % 2 === 1;
1958                },
1959                lt: function(elem, i, match){
1960                        return i < match[3] - 0;
1961                },
1962                gt: function(elem, i, match){
1963                        return i > match[3] - 0;
1964                },
1965                nth: function(elem, i, match){
1966                        return match[3] - 0 == i;
1967                },
1968                eq: function(elem, i, match){
1969                        return match[3] - 0 == i;
1970                }
1971        },
1972        filter: {
1973                PSEUDO: function(elem, match, i, array){
1974                        var name = match[1], filter = Expr.filters[ name ];
1975
1976                        if ( filter ) {
1977                                return filter( elem, i, match, array );
1978                        } else if ( name === "contains" ) {
1979                                return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
1980                        } else if ( name === "not" ) {
1981                                var not = match[3];
1982
1983                                for ( var i = 0, l = not.length; i < l; i++ ) {
1984                                        if ( not[i] === elem ) {
1985                                                return false;
1986                                        }
1987                                }
1988
1989                                return true;
1990                        }
1991                },
1992                CHILD: function(elem, match){
1993                        var type = match[1], node = elem;
1994                        switch (type) {
1995                                case 'only':
1996                                case 'first':
1997                                        while (node = node.previousSibling)  {
1998                                                if ( node.nodeType === 1 ) return false;
1999                                        }
2000                                        if ( type == 'first') return true;
2001                                        node = elem;
2002                                case 'last':
2003                                        while (node = node.nextSibling)  {
2004                                                if ( node.nodeType === 1 ) return false;
2005                                        }
2006                                        return true;
2007                                case 'nth':
2008                                        var first = match[2], last = match[3];
2009
2010                                        if ( first == 1 && last == 0 ) {
2011                                                return true;
2012                                        }
2013                                       
2014                                        var doneName = match[0],
2015                                                parent = elem.parentNode;
2016       
2017                                        if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
2018                                                var count = 0;
2019                                                for ( node = parent.firstChild; node; node = node.nextSibling ) {
2020                                                        if ( node.nodeType === 1 ) {
2021                                                                node.nodeIndex = ++count;
2022                                                        }
2023                                                }
2024                                                parent.sizcache = doneName;
2025                                        }
2026                                       
2027                                        var diff = elem.nodeIndex - last;
2028                                        if ( first == 0 ) {
2029                                                return diff == 0;
2030                                        } else {
2031                                                return ( diff % first == 0 && diff / first >= 0 );
2032                                        }
2033                        }
2034                },
2035                ID: function(elem, match){
2036                        return elem.nodeType === 1 && elem.getAttribute("id") === match;
2037                },
2038                TAG: function(elem, match){
2039                        return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
2040                },
2041                CLASS: function(elem, match){
2042                        return (" " + (elem.className || elem.getAttribute("class")) + " ")
2043                                .indexOf( match ) > -1;
2044                },
2045                ATTR: function(elem, match){
2046                        var name = match[1],
2047                                result = Expr.attrHandle[ name ] ?
2048                                        Expr.attrHandle[ name ]( elem ) :
2049                                        elem[ name ] != null ?
2050                                                elem[ name ] :
2051                                                elem.getAttribute( name ),
2052                                value = result + "",
2053                                type = match[2],
2054                                check = match[4];
2055
2056                        return result == null ?
2057                                type === "!=" :
2058                                type === "=" ?
2059                                value === check :
2060                                type === "*=" ?
2061                                value.indexOf(check) >= 0 :
2062                                type === "~=" ?
2063                                (" " + value + " ").indexOf(check) >= 0 :
2064                                !check ?
2065                                value && result !== false :
2066                                type === "!=" ?
2067                                value != check :
2068                                type === "^=" ?
2069                                value.indexOf(check) === 0 :
2070                                type === "$=" ?
2071                                value.substr(value.length - check.length) === check :
2072                                type === "|=" ?
2073                                value === check || value.substr(0, check.length + 1) === check + "-" :
2074                                false;
2075                },
2076                POS: function(elem, match, i, array){
2077                        var name = match[2], filter = Expr.setFilters[ name ];
2078
2079                        if ( filter ) {
2080                                return filter( elem, i, match, array );
2081                        }
2082                }
2083        }
2084};
2085
2086var origPOS = Expr.match.POS;
2087
2088for ( var type in Expr.match ) {
2089        Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
2090}
2091
2092var makeArray = function(array, results) {
2093        array = Array.prototype.slice.call( array );
2094
2095        if ( results ) {
2096                results.push.apply( results, array );
2097                return results;
2098        }
2099       
2100        return array;
2101};
2102
2103// Perform a simple check to determine if the browser is capable of
2104// converting a NodeList to an array using builtin methods.
2105try {
2106        Array.prototype.slice.call( document.documentElement.childNodes );
2107
2108// Provide a fallback method if it does not work
2109} catch(e){
2110        makeArray = function(array, results) {
2111                var ret = results || [];
2112
2113                if ( toString.call(array) === "[object Array]" ) {
2114                        Array.prototype.push.apply( ret, array );
2115                } else {
2116                        if ( typeof array.length === "number" ) {
2117                                for ( var i = 0, l = array.length; i < l; i++ ) {
2118                                        ret.push( array[i] );
2119                                }
2120                        } else {
2121                                for ( var i = 0; array[i]; i++ ) {
2122                                        ret.push( array[i] );
2123                                }
2124                        }
2125                }
2126
2127                return ret;
2128        };
2129}
2130
2131var sortOrder;
2132
2133if ( document.documentElement.compareDocumentPosition ) {
2134        sortOrder = function( a, b ) {
2135                var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
2136                if ( ret === 0 ) {
2137                        hasDuplicate = true;
2138                }
2139                return ret;
2140        };
2141} else if ( "sourceIndex" in document.documentElement ) {
2142        sortOrder = function( a, b ) {
2143                var ret = a.sourceIndex - b.sourceIndex;
2144                if ( ret === 0 ) {
2145                        hasDuplicate = true;
2146                }
2147                return ret;
2148        };
2149} else if ( document.createRange ) {
2150        sortOrder = function( a, b ) {
2151                var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
2152                aRange.selectNode(a);
2153                aRange.collapse(true);
2154                bRange.selectNode(b);
2155                bRange.collapse(true);
2156                var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
2157                if ( ret === 0 ) {
2158                        hasDuplicate = true;
2159                }
2160                return ret;
2161        };
2162}
2163
2164// Check to see if the browser returns elements by name when
2165// querying by getElementById (and provide a workaround)
2166(function(){
2167        // We're going to inject a fake input element with a specified name
2168        var form = document.createElement("form"),
2169                id = "script" + (new Date).getTime();
2170        form.innerHTML = "<input name='" + id + "'/>";
2171
2172        // Inject it into the root element, check its status, and remove it quickly
2173        var root = document.documentElement;
2174        root.insertBefore( form, root.firstChild );
2175
2176        // The workaround has to do additional checks after a getElementById
2177        // Which slows things down for other browsers (hence the branching)
2178        if ( !!document.getElementById( id ) ) {
2179                Expr.find.ID = function(match, context, isXML){
2180                        if ( typeof context.getElementById !== "undefined" && !isXML ) {
2181                                var m = context.getElementById(match[1]);
2182                                return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
2183                        }
2184                };
2185
2186                Expr.filter.ID = function(elem, match){
2187                        var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
2188                        return elem.nodeType === 1 && node && node.nodeValue === match;
2189                };
2190        }
2191
2192        root.removeChild( form );
2193})();
2194
2195(function(){
2196        // Check to see if the browser returns only elements
2197        // when doing getElementsByTagName("*")
2198
2199        // Create a fake element
2200        var div = document.createElement("div");
2201        div.appendChild( document.createComment("") );
2202
2203        // Make sure no comments are found
2204        if ( div.getElementsByTagName("*").length > 0 ) {
2205                Expr.find.TAG = function(match, context){
2206                        var results = context.getElementsByTagName(match[1]);
2207
2208                        // Filter out possible comments
2209                        if ( match[1] === "*" ) {
2210                                var tmp = [];
2211
2212                                for ( var i = 0; results[i]; i++ ) {
2213                                        if ( results[i].nodeType === 1 ) {
2214                                                tmp.push( results[i] );
2215                                        }
2216                                }
2217
2218                                results = tmp;
2219                        }
2220
2221                        return results;
2222                };
2223        }
2224
2225        // Check to see if an attribute returns normalized href attributes
2226        div.innerHTML = "<a href='#'></a>";
2227        if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
2228                        div.firstChild.getAttribute("href") !== "#" ) {
2229                Expr.attrHandle.href = function(elem){
2230                        return elem.getAttribute("href", 2);
2231                };
2232        }
2233})();
2234
2235if ( document.querySelectorAll ) (function(){
2236        var oldSizzle = Sizzle, div = document.createElement("div");
2237        div.innerHTML = "<p class='TEST'></p>";
2238
2239        // Safari can't handle uppercase or unicode characters when
2240        // in quirks mode.
2241        if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
2242                return;
2243        }
2244       
2245        Sizzle = function(query, context, extra, seed){
2246                context = context || document;
2247
2248                // Only use querySelectorAll on non-XML documents
2249                // (ID selectors don't work in non-HTML documents)
2250                if ( !seed && context.nodeType === 9 && !isXML(context) ) {
2251                        try {
2252                                return makeArray( context.querySelectorAll(query), extra );
2253                        } catch(e){}
2254                }
2255               
2256                return oldSizzle(query, context, extra, seed);
2257        };
2258
2259        Sizzle.find = oldSizzle.find;
2260        Sizzle.filter = oldSizzle.filter;
2261        Sizzle.selectors = oldSizzle.selectors;
2262        Sizzle.matches = oldSizzle.matches;
2263})();
2264
2265if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
2266        var div = document.createElement("div");
2267        div.innerHTML = "<div class='test e'></div><div class='test'></div>";
2268
2269        // Opera can't find a second classname (in 9.6)
2270        if ( div.getElementsByClassName("e").length === 0 )
2271                return;
2272
2273        // Safari caches class attributes, doesn't catch changes (in 3.2)
2274        div.lastChild.className = "e";
2275
2276        if ( div.getElementsByClassName("e").length === 1 )
2277                return;
2278
2279        Expr.order.splice(1, 0, "CLASS");
2280        Expr.find.CLASS = function(match, context, isXML) {
2281                if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
2282                        return context.getElementsByClassName(match[1]);
2283                }
2284        };
2285})();
2286
2287function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
2288        var sibDir = dir == "previousSibling" && !isXML;
2289        for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2290                var elem = checkSet[i];
2291                if ( elem ) {
2292                        if ( sibDir && elem.nodeType === 1 ){
2293                                elem.sizcache = doneName;
2294                                elem.sizset = i;
2295                        }
2296                        elem = elem[dir];
2297                        var match = false;
2298
2299                        while ( elem ) {
2300                                if ( elem.sizcache === doneName ) {
2301                                        match = checkSet[elem.sizset];
2302                                        break;
2303                                }
2304
2305                                if ( elem.nodeType === 1 && !isXML ){
2306                                        elem.sizcache = doneName;
2307                                        elem.sizset = i;
2308                                }
2309
2310                                if ( elem.nodeName === cur ) {
2311                                        match = elem;
2312                                        break;
2313                                }
2314
2315                                elem = elem[dir];
2316                        }
2317
2318                        checkSet[i] = match;
2319                }
2320        }
2321}
2322
2323function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
2324        var sibDir = dir == "previousSibling" && !isXML;
2325        for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2326                var elem = checkSet[i];
2327                if ( elem ) {
2328                        if ( sibDir && elem.nodeType === 1 ) {
2329                                elem.sizcache = doneName;
2330                                elem.sizset = i;
2331                        }
2332                        elem = elem[dir];
2333                        var match = false;
2334
2335                        while ( elem ) {
2336                                if ( elem.sizcache === doneName ) {
2337                                        match = checkSet[elem.sizset];
2338                                        break;
2339                                }
2340
2341                                if ( elem.nodeType === 1 ) {
2342                                        if ( !isXML ) {
2343                                                elem.sizcache = doneName;
2344                                                elem.sizset = i;
2345                                        }
2346                                        if ( typeof cur !== "string" ) {
2347                                                if ( elem === cur ) {
2348                                                        match = true;
2349                                                        break;
2350                                                }
2351
2352                                        } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
2353                                                match = elem;
2354                                                break;
2355                                        }
2356                                }
2357
2358                                elem = elem[dir];
2359                        }
2360
2361                        checkSet[i] = match;
2362                }
2363        }
2364}
2365
2366var contains = document.compareDocumentPosition ?  function(a, b){
2367        return a.compareDocumentPosition(b) & 16;
2368} : function(a, b){
2369        return a !== b && (a.contains ? a.contains(b) : true);
2370};
2371
2372var isXML = function(elem){
2373        return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
2374                !!elem.ownerDocument && isXML( elem.ownerDocument );
2375};
2376
2377var posProcess = function(selector, context){
2378        var tmpSet = [], later = "", match,
2379                root = context.nodeType ? [context] : context;
2380
2381        // Position selectors must be done after the filter
2382        // And so must :not(positional) so we move all PSEUDOs to the end
2383        while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
2384                later += match[0];
2385                selector = selector.replace( Expr.match.PSEUDO, "" );
2386        }
2387
2388        selector = Expr.relative[selector] ? selector + "*" : selector;
2389
2390        for ( var i = 0, l = root.length; i < l; i++ ) {
2391                Sizzle( selector, root[i], tmpSet );
2392        }
2393
2394        return Sizzle.filter( later, tmpSet );
2395};
2396
2397// EXPOSE
2398jQuery.find = Sizzle;
2399jQuery.filter = Sizzle.filter;
2400jQuery.expr = Sizzle.selectors;
2401jQuery.expr[":"] = jQuery.expr.filters;
2402
2403Sizzle.selectors.filters.hidden = function(elem){
2404        return elem.offsetWidth === 0 || elem.offsetHeight === 0;
2405};
2406
2407Sizzle.selectors.filters.visible = function(elem){
2408        return elem.offsetWidth > 0 || elem.offsetHeight > 0;
2409};
2410
2411Sizzle.selectors.filters.animated = function(elem){
2412        return jQuery.grep(jQuery.timers, function(fn){
2413                return elem === fn.elem;
2414        }).length;
2415};
2416
2417jQuery.multiFilter = function( expr, elems, not ) {
2418        if ( not ) {
2419                expr = ":not(" + expr + ")";
2420        }
2421
2422        return Sizzle.matches(expr, elems);
2423};
2424
2425jQuery.dir = function( elem, dir ){
2426        var matched = [], cur = elem[dir];
2427        while ( cur && cur != document ) {
2428                if ( cur.nodeType == 1 )
2429                        matched.push( cur );
2430                cur = cur[dir];
2431        }
2432        return matched;
2433};
2434
2435jQuery.nth = function(cur, result, dir, elem){
2436        result = result || 1;
2437        var num = 0;
2438
2439        for ( ; cur; cur = cur[dir] )
2440                if ( cur.nodeType == 1 && ++num == result )
2441                        break;
2442
2443        return cur;
2444};
2445
2446jQuery.sibling = function(n, elem){
2447        var r = [];
2448
2449        for ( ; n; n = n.nextSibling ) {
2450                if ( n.nodeType == 1 && n != elem )
2451                        r.push( n );
2452        }
2453
2454        return r;
2455};
2456
2457return;
2458
2459window.Sizzle = Sizzle;
2460
2461})();
2462/*
2463 * A number of helper functions used for managing events.
2464 * Many of the ideas behind this code originated from
2465 * Dean Edwards' addEvent library.
2466 */
2467jQuery.event = {
2468
2469        // Bind an event to an element
2470        // Original by Dean Edwards
2471        add: function(elem, types, handler, data) {
2472                if ( elem.nodeType == 3 || elem.nodeType == 8 )
2473                        return;
2474
2475                // For whatever reason, IE has trouble passing the window object
2476                // around, causing it to be cloned in the process
2477                if ( elem.setInterval && elem != window )
2478                        elem = window;
2479
2480                // Make sure that the function being executed has a unique ID
2481                if ( !handler.guid )
2482                        handler.guid = this.guid++;
2483
2484                // if data is passed, bind to handler
2485                if ( data !== undefined ) {
2486                        // Create temporary function pointer to original handler
2487                        var fn = handler;
2488
2489                        // Create unique handler function, wrapped around original handler
2490                        handler = this.proxy( fn );
2491
2492                        // Store data in unique handler
2493                        handler.data = data;
2494                }
2495
2496                // Init the element's event structure
2497                var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
2498                        handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
2499                                // Handle the second event of a trigger and when
2500                                // an event is called after a page has unloaded
2501                                return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
2502                                        jQuery.event.handle.apply(arguments.callee.elem, arguments) :
2503                                        undefined;
2504                        });
2505                // Add elem as a property of the handle function
2506                // This is to prevent a memory leak with non-native
2507                // event in IE.
2508                handle.elem = elem;
2509
2510                // Handle multiple events separated by a space
2511                // jQuery(...).bind("mouseover mouseout", fn);
2512                jQuery.each(types.split(/\s+/), function(index, type) {
2513                        // Namespaced event handlers
2514                        var namespaces = type.split(".");
2515                        type = namespaces.shift();
2516                        handler.type = namespaces.slice().sort().join(".");
2517
2518                        // Get the current list of functions bound to this event
2519                        var handlers = events[type];
2520                       
2521                        if ( jQuery.event.specialAll[type] )
2522                                jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
2523
2524                        // Init the event handler queue
2525                        if (!handlers) {
2526                                handlers = events[type] = {};
2527
2528                                // Check for a special event handler
2529                                // Only use addEventListener/attachEvent if the special
2530                                // events handler returns false
2531                                if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
2532                                        // Bind the global event handler to the element
2533                                        if (elem.addEventListener)
2534                                                elem.addEventListener(type, handle, false);
2535                                        else if (elem.attachEvent)
2536                                                elem.attachEvent("on" + type, handle);
2537                                }
2538                        }
2539
2540                        // Add the function to the element's handler list
2541                        handlers[handler.guid] = handler;
2542
2543                        // Keep track of which events have been used, for global triggering
2544                        jQuery.event.global[type] = true;
2545                });
2546
2547                // Nullify elem to prevent memory leaks in IE
2548                elem = null;
2549        },
2550
2551        guid: 1,
2552        global: {},
2553
2554        // Detach an event or set of events from an element
2555        remove: function(elem, types, handler) {
2556                // don't do events on text and comment nodes
2557                if ( elem.nodeType == 3 || elem.nodeType == 8 )
2558                        return;
2559
2560                var events = jQuery.data(elem, "events"), ret, index;
2561
2562                if ( events ) {
2563                        // Unbind all events for the element
2564                        if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
2565                                for ( var type in events )
2566                                        this.remove( elem, type + (types || "") );
2567                        else {
2568                                // types is actually an event object here
2569                                if ( types.type ) {
2570                                        handler = types.handler;
2571                                        types = types.type;
2572                                }
2573
2574                                // Handle multiple events seperated by a space
2575                                // jQuery(...).unbind("mouseover mouseout", fn);
2576                                jQuery.each(types.split(/\s+/), function(index, type){
2577                                        // Namespaced event handlers
2578                                        var namespaces = type.split(".");
2579                                        type = namespaces.shift();
2580                                        var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
2581
2582                                        if ( events[type] ) {
2583                                                // remove the given handler for the given type
2584                                                if ( handler )
2585                                                        delete events[type][handler.guid];
2586
2587                                                // remove all handlers for the given type
2588                                                else
2589                                                        for ( var handle in events[type] )
2590                                                                // Handle the removal of namespaced events
2591                                                                if ( namespace.test(events[type][handle].type) )
2592                                                                        delete events[type][handle];
2593                                                                       
2594                                                if ( jQuery.event.specialAll[type] )
2595                                                        jQuery.event.specialAll[type].teardown.call(elem, namespaces);
2596
2597                                                // remove generic event handler if no more handlers exist
2598                                                for ( ret in events[type] ) break;
2599                                                if ( !ret ) {
2600                                                        if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
2601                                                                if (elem.removeEventListener)
2602                                                                        elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
2603                                                                else if (elem.detachEvent)
2604                                                                        elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
2605                                                        }
2606                                                        ret = null;
2607                                                        delete events[type];
2608                                                }
2609                                        }
2610                                });
2611                        }
2612
2613                        // Remove the expando if it's no longer used
2614                        for ( ret in events ) break;
2615                        if ( !ret ) {
2616                                var handle = jQuery.data( elem, "handle" );
2617                                if ( handle ) handle.elem = null;
2618                                jQuery.removeData( elem, "events" );
2619                                jQuery.removeData( elem, "handle" );
2620                        }
2621                }
2622        },
2623
2624        // bubbling is internal
2625        trigger: function( event, data, elem, bubbling ) {
2626                // Event object or event type
2627                var type = event.type || event;
2628
2629                if( !bubbling ){
2630                        event = typeof event === "object" ?
2631                                // jQuery.Event object
2632                                event[expando] ? event :
2633                                // Object literal
2634                                jQuery.extend( jQuery.Event(type), event ) :
2635                                // Just the event type (string)
2636                                jQuery.Event(type);
2637
2638                        if ( type.indexOf("!") >= 0 ) {
2639                                event.type = type = type.slice(0, -1);
2640                                event.exclusive = true;
2641                        }
2642
2643                        // Handle a global trigger
2644                        if ( !elem ) {
2645                                // Don't bubble custom events when global (to avoid too much overhead)
2646                                event.stopPropagation();
2647                                // Only trigger if we've ever bound an event for it
2648                                if ( this.global[type] )
2649                                        jQuery.each( jQuery.cache, function(){
2650                                                if ( this.events && this.events[type] )
2651                                                        jQuery.event.trigger( event, data, this.handle.elem );
2652                                        });
2653                        }
2654
2655                        // Handle triggering a single element
2656
2657                        // don't do events on text and comment nodes
2658                        if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
2659                                return undefined;
2660                       
2661                        // Clean up in case it is reused
2662                        event.result = undefined;
2663                        event.target = elem;
2664                       
2665                        // Clone the incoming data, if any
2666                        data = jQuery.makeArray(data);
2667                        data.unshift( event );
2668                }
2669
2670                event.currentTarget = elem;
2671
2672                // Trigger the event, it is assumed that "handle" is a function
2673                var handle = jQuery.data(elem, "handle");
2674                if ( handle )
2675                        handle.apply( elem, data );
2676
2677                // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
2678                if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
2679                        event.result = false;
2680
2681                // Trigger the native events (except for clicks on links)
2682                if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
2683                        this.triggered = true;
2684                        try {
2685                                elem[ type ]();
2686                        // prevent IE from throwing an error for some hidden elements
2687                        } catch (e) {}
2688                }
2689
2690                this.triggered = false;
2691
2692                if ( !event.isPropagationStopped() ) {
2693                        var parent = elem.parentNode || elem.ownerDocument;
2694                        if ( parent )
2695                                jQuery.event.trigger(event, data, parent, true);
2696                }
2697        },
2698
2699        handle: function(event) {
2700                // returned undefined or false
2701                var all, handlers;
2702
2703                event = arguments[0] = jQuery.event.fix( event || window.event );
2704                event.currentTarget = this;
2705               
2706                // Namespaced event handlers
2707                var namespaces = event.type.split(".");
2708                event.type = namespaces.shift();
2709
2710                // Cache this now, all = true means, any handler
2711                all = !namespaces.length && !event.exclusive;
2712               
2713                var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
2714
2715                handlers = ( jQuery.data(this, "events") || {} )[event.type];
2716
2717                for ( var j in handlers ) {
2718                        var handler = handlers[j];
2719
2720                        // Filter the functions by class
2721                        if ( all || namespace.test(handler.type) ) {
2722                                // Pass in a reference to the handler function itself
2723                                // So that we can later remove it
2724                                event.handler = handler;
2725                                event.data = handler.data;
2726
2727                                var ret = handler.apply(this, arguments);
2728
2729                                if( ret !== undefined ){
2730                                        event.result = ret;
2731                                        if ( ret === false ) {
2732                                                event.preventDefault();
2733                                                event.stopPropagation();
2734                                        }
2735                                }
2736
2737                                if( event.isImmediatePropagationStopped() )
2738                                        break;
2739
2740                        }
2741                }
2742        },
2743
2744        props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
2745
2746        fix: function(event) {
2747                if ( event[expando] )
2748                        return event;
2749
2750                // store a copy of the original event object
2751                // and "clone" to set read-only properties
2752                var originalEvent = event;
2753                event = jQuery.Event( originalEvent );
2754
2755                for ( var i = this.props.length, prop; i; ){
2756                        prop = this.props[ --i ];
2757                        event[ prop ] = originalEvent[ prop ];
2758                }
2759
2760                // Fix target property, if necessary
2761                if ( !event.target )
2762                        event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
2763
2764                // check if target is a textnode (safari)
2765                if ( event.target.nodeType == 3 )
2766                        event.target = event.target.parentNode;
2767
2768                // Add relatedTarget, if necessary
2769                if ( !event.relatedTarget && event.fromElement )
2770                        event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
2771
2772                // Calculate pageX/Y if missing and clientX/Y available
2773                if ( event.pageX == null && event.clientX != null ) {
2774                        var doc = document.documentElement, body = document.body;
2775                        event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
2776                        event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
2777                }
2778
2779                // Add which for key events
2780                if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
2781                        event.which = event.charCode || event.keyCode;
2782
2783                // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
2784                if ( !event.metaKey && event.ctrlKey )
2785                        event.metaKey = event.ctrlKey;
2786
2787                // Add which for click: 1 == left; 2 == middle; 3 == right
2788                // Note: button is not normalized, so don't use it
2789                if ( !event.which && event.button )
2790                        event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
2791
2792                return event;
2793        },
2794
2795        proxy: function( fn, proxy ){
2796                proxy = proxy || function(){ return fn.apply(this, arguments); };
2797                // Set the guid of unique handler to the same of original handler, so it can be removed
2798                proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
2799                // So proxy can be declared as an argument
2800                return proxy;
2801        },
2802
2803        special: {
2804                ready: {
2805                        // Make sure the ready event is setup
2806                        setup: bindReady,
2807                        teardown: function() {}
2808                }
2809        },
2810       
2811        specialAll: {
2812                live: {
2813                        setup: function( selector, namespaces ){
2814                                jQuery.event.add( this, namespaces[0], liveHandler );
2815                        },
2816                        teardown:  function( namespaces ){
2817                                if ( namespaces.length ) {
2818                                        var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
2819                                       
2820                                        jQuery.each( (jQuery.data(this, "events").live || {}), function(){
2821                                                if ( name.test(this.type) )
2822                                                        remove++;
2823                                        });
2824                                       
2825                                        if ( remove < 1 )
2826                                                jQuery.event.remove( this, namespaces[0], liveHandler );
2827                                }
2828                        }
2829                }
2830        }
2831};
2832
2833jQuery.Event = function( src ){
2834        // Allow instantiation without the 'new' keyword
2835        if( !this.preventDefault )
2836                return new jQuery.Event(src);
2837       
2838        // Event object
2839        if( src && src.type ){
2840                this.originalEvent = src;
2841                this.type = src.type;
2842        // Event type
2843        }else
2844                this.type = src;
2845
2846        // timeStamp is buggy for some events on Firefox(#3843)
2847        // So we won't rely on the native value
2848        this.timeStamp = now();
2849       
2850        // Mark it as fixed
2851        this[expando] = true;
2852};
2853
2854function returnFalse(){
2855        return false;
2856}
2857function returnTrue(){
2858        return true;
2859}
2860
2861// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2862// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2863jQuery.Event.prototype = {
2864        preventDefault: function() {
2865                this.isDefaultPrevented = returnTrue;
2866
2867                var e = this.originalEvent;
2868                if( !e )
2869                        return;
2870                // if preventDefault exists run it on the original event
2871                if (e.preventDefault)
2872                        e.preventDefault();
2873                // otherwise set the returnValue property of the original event to false (IE)
2874                e.returnValue = false;
2875        },
2876        stopPropagation: function() {
2877                this.isPropagationStopped = returnTrue;
2878
2879                var e = this.originalEvent;
2880                if( !e )
2881                        return;
2882                // if stopPropagation exists run it on the original event
2883                if (e.stopPropagation)
2884                        e.stopPropagation();
2885                // otherwise set the cancelBubble property of the original event to true (IE)
2886                e.cancelBubble = true;
2887        },
2888        stopImmediatePropagation:function(){
2889                this.isImmediatePropagationStopped = returnTrue;
2890                this.stopPropagation();
2891        },
2892        isDefaultPrevented: returnFalse,
2893        isPropagationStopped: returnFalse,
2894        isImmediatePropagationStopped: returnFalse
2895};
2896// Checks if an event happened on an element within another element
2897// Used in jQuery.event.special.mouseenter and mouseleave handlers
2898var withinElement = function(event) {
2899        // Check if mouse(over|out) are still within the same parent element
2900        var parent = event.relatedTarget;
2901        // Traverse up the tree
2902        while ( parent && parent != this )
2903                try { parent = parent.parentNode; }
2904                catch(e) { parent = this; }
2905       
2906        if( parent != this ){
2907                // set the correct event type
2908                event.type = event.data;
2909                // handle event if we actually just moused on to a non sub-element
2910                jQuery.event.handle.apply( this, arguments );
2911        }
2912};
2913       
2914jQuery.each({
2915        mouseover: 'mouseenter',
2916        mouseout: 'mouseleave'
2917}, function( orig, fix ){
2918        jQuery.event.special[ fix ] = {
2919                setup: function(){
2920                        jQuery.event.add( this, orig, withinElement, fix );
2921                },
2922                teardown: function(){
2923                        jQuery.event.remove( this, orig, withinElement );
2924                }
2925        };                         
2926});
2927
2928jQuery.fn.extend({
2929        bind: function( type, data, fn ) {
2930                return type == "unload" ? this.one(type, data, fn) : this.each(function(){
2931                        jQuery.event.add( this, type, fn || data, fn && data );
2932                });
2933        },
2934
2935        one: function( type, data, fn ) {
2936                var one = jQuery.event.proxy( fn || data, function(event) {
2937                        jQuery(this).unbind(event, one);
2938                        return (fn || data).apply( this, arguments );
2939                });
2940                return this.each(function(){
2941                        jQuery.event.add( this, type, one, fn && data);
2942                });
2943        },
2944
2945        unbind: function( type, fn ) {
2946                return this.each(function(){
2947                        jQuery.event.remove( this, type, fn );
2948                });
2949        },
2950
2951        trigger: function( type, data ) {
2952                return this.each(function(){
2953                        jQuery.event.trigger( type, data, this );
2954                });
2955        },
2956
2957        triggerHandler: function( type, data ) {
2958                if( this[0] ){
2959                        var event = jQuery.Event(type);
2960                        event.preventDefault();
2961                        event.stopPropagation();
2962                        jQuery.event.trigger( event, data, this[0] );
2963                        return event.result;
2964                }               
2965        },
2966
2967        toggle: function( fn ) {
2968                // Save reference to arguments for access in closure
2969                var args = arguments, i = 1;
2970
2971                // link all the functions, so any of them can unbind this click handler
2972                while( i < args.length )
2973                        jQuery.event.proxy( fn, args[i++] );
2974
2975                return this.click( jQuery.event.proxy( fn, function(event) {
2976                        // Figure out which function to execute
2977                        this.lastToggle = ( this.lastToggle || 0 ) % i;
2978
2979                        // Make sure that clicks stop
2980                        event.preventDefault();
2981
2982                        // and execute the function
2983                        return args[ this.lastToggle++ ].apply( this, arguments ) || false;
2984                }));
2985        },
2986
2987        hover: function(fnOver, fnOut) {
2988                return this.mouseenter(fnOver).mouseleave(fnOut);
2989        },
2990
2991        ready: function(fn) {
2992                // Attach the listeners
2993                bindReady();
2994
2995                // If the DOM is already ready
2996                if ( jQuery.isReady )
2997                        // Execute the function immediately
2998                        fn.call( document, jQuery );
2999
3000                // Otherwise, remember the function for later
3001                else
3002                        // Add the function to the wait list
3003                        jQuery.readyList.push( fn );
3004
3005                return this;
3006        },
3007       
3008        live: function( type, fn ){
3009                var proxy = jQuery.event.proxy( fn );
3010                proxy.guid += this.selector + type;
3011
3012                jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
3013
3014                return this;
3015        },
3016       
3017        die: function( type, fn ){
3018                jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
3019                return this;
3020        }
3021});
3022
3023function liveHandler( event ){
3024        var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
3025                stop = true,
3026                elems = [];
3027
3028        jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
3029                if ( check.test(fn.type) ) {
3030                        var elem = jQuery(event.target).closest(fn.data)[0];
3031                        if ( elem )
3032                                elems.push({ elem: elem, fn: fn });
3033                }
3034        });
3035
3036        elems.sort(function(a,b) {
3037                return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
3038        });
3039       
3040        jQuery.each(elems, function(){
3041                if ( this.fn.call(this.elem, event, this.fn.data) === false )
3042                        return (stop = false);
3043        });
3044
3045        return stop;
3046}
3047
3048function liveConvert(type, selector){
3049        return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
3050}
3051
3052jQuery.extend({
3053        isReady: false,
3054        readyList: [],
3055        // Handle when the DOM is ready
3056        ready: function() {
3057                // Make sure that the DOM is not already loaded
3058                if ( !jQuery.isReady ) {
3059                        // Remember that the DOM is ready
3060                        jQuery.isReady = true;
3061
3062                        // If there are functions bound, to execute
3063                        if ( jQuery.readyList ) {
3064                                // Execute all of them
3065                                jQuery.each( jQuery.readyList, function(){
3066                                        this.call( document, jQuery );
3067                                });
3068
3069                                // Reset the list of functions
3070                                jQuery.readyList = null;
3071                        }
3072
3073                        // Trigger any bound ready events
3074                        jQuery(document).triggerHandler("ready");
3075                }
3076        }
3077});
3078
3079var readyBound = false;
3080
3081function bindReady(){
3082        if ( readyBound ) return;
3083        readyBound = true;
3084
3085        // Mozilla, Opera and webkit nightlies currently support this event
3086        if ( document.addEventListener ) {
3087                // Use the handy event callback
3088                document.addEventListener( "DOMContentLoaded", function(){
3089                        document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
3090                        jQuery.ready();
3091                }, false );
3092
3093        // If IE event model is used
3094        } else if ( document.attachEvent ) {
3095                // ensure firing before onload,
3096                // maybe late but safe also for iframes
3097                document.attachEvent("onreadystatechange", function(){
3098                        if ( document.readyState === "complete" ) {
3099                                document.detachEvent( "onreadystatechange", arguments.callee );
3100                                jQuery.ready();
3101                        }
3102                });
3103
3104                // If IE and not an iframe
3105                // continually check to see if the document is ready
3106                if ( document.documentElement.doScroll && window == window.top ) (function(){
3107                        if ( jQuery.isReady ) return;
3108
3109                        try {
3110                                // If IE is used, use the trick by Diego Perini
3111                                // http://javascript.nwbox.com/IEContentLoaded/
3112                                document.documentElement.doScroll("left");
3113                        } catch( error ) {
3114                                setTimeout( arguments.callee, 0 );
3115                                return;
3116                        }
3117
3118                        // and execute any waiting functions
3119                        jQuery.ready();
3120                })();
3121        }
3122
3123        // A fallback to window.onload, that will always work
3124        jQuery.event.add( window, "load", jQuery.ready );
3125}
3126
3127jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
3128        "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
3129        "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
3130
3131        // Handle event binding
3132        jQuery.fn[name] = function(fn){
3133                return fn ? this.bind(name, fn) : this.trigger(name);
3134        };
3135});
3136
3137// Prevent memory leaks in IE
3138// And prevent errors on refresh with events like mouseover in other browsers
3139// Window isn't included so as not to unbind existing unload events
3140jQuery( window ).bind( 'unload', function(){
3141        for ( var id in jQuery.cache )
3142                // Skip the window
3143                if ( id != 1 && jQuery.cache[ id ].handle )
3144                        jQuery.event.remove( jQuery.cache[ id ].handle.elem );
3145});
3146(function(){
3147
3148        jQuery.support = {};
3149
3150        var root = document.documentElement,
3151                script = document.createElement("script"),
3152                div = document.createElement("div"),
3153                id = "script" + (new Date).getTime();
3154
3155        div.style.display = "none";
3156        div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
3157
3158        var all = div.getElementsByTagName("*"),
3159                a = div.getElementsByTagName("a")[0];
3160
3161        // Can't get basic test support
3162        if ( !all || !all.length || !a ) {
3163                return;
3164        }
3165
3166        jQuery.support = {
3167                // IE strips leading whitespace when .innerHTML is used
3168                leadingWhitespace: div.firstChild.nodeType == 3,
3169               
3170                // Make sure that tbody elements aren't automatically inserted
3171                // IE will insert them into empty tables
3172                tbody: !div.getElementsByTagName("tbody").length,
3173               
3174                // Make sure that you can get all elements in an <object> element
3175                // IE 7 always returns no results
3176                objectAll: !!div.getElementsByTagName("object")[0]
3177                        .getElementsByTagName("*").length,
3178               
3179                // Make sure that link elements get serialized correctly by innerHTML
3180                // This requires a wrapper element in IE
3181                htmlSerialize: !!div.getElementsByTagName("link").length,
3182               
3183                // Get the style information from getAttribute
3184                // (IE uses .cssText insted)
3185                style: /red/.test( a.getAttribute("style") ),
3186               
3187                // Make sure that URLs aren't manipulated
3188                // (IE normalizes it by default)
3189                hrefNormalized: a.getAttribute("href") === "/a",
3190               
3191                // Make sure that element opacity exists
3192                // (IE uses filter instead)
3193                opacity: a.style.opacity === "0.5",
3194               
3195                // Verify style float existence
3196                // (IE uses styleFloat instead of cssFloat)
3197                cssFloat: !!a.style.cssFloat,
3198
3199                // Will be defined later
3200                scriptEval: false,
3201                noCloneEvent: true,
3202                boxModel: null
3203        };
3204       
3205        script.type = "text/javascript";
3206        try {
3207                script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
3208        } catch(e){}
3209
3210        root.insertBefore( script, root.firstChild );
3211       
3212        // Make sure that the execution of code works by injecting a script
3213        // tag with appendChild/createTextNode
3214        // (IE doesn't support this, fails, and uses .text instead)
3215        if ( window[ id ] ) {
3216                jQuery.support.scriptEval = true;
3217                delete window[ id ];
3218        }
3219
3220        root.removeChild( script );
3221
3222        if ( div.attachEvent && div.fireEvent ) {
3223                div.attachEvent("onclick", function(){
3224                        // Cloning a node shouldn't copy over any
3225                        // bound event handlers (IE does this)
3226                        jQuery.support.noCloneEvent = false;
3227                        div.detachEvent("onclick", arguments.callee);
3228                });
3229                div.cloneNode(true).fireEvent("onclick");
3230        }
3231
3232        // Figure out if the W3C box model works as expected
3233        // document.body must exist before we can do this
3234        jQuery(function(){
3235                var div = document.createElement("div");
3236                div.style.width = div.style.paddingLeft = "1px";
3237
3238                document.body.appendChild( div );
3239                jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
3240                document.body.removeChild( div ).style.display = 'none';
3241        });
3242})();
3243
3244var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
3245
3246jQuery.props = {
3247        "for": "htmlFor",
3248        "class": "className",
3249        "float": styleFloat,
3250        cssFloat: styleFloat,
3251        styleFloat: styleFloat,
3252        readonly: "readOnly",
3253        maxlength: "maxLength",
3254        cellspacing: "cellSpacing",
3255        rowspan: "rowSpan",
3256        tabindex: "tabIndex"
3257};
3258jQuery.fn.extend({
3259        // Keep a copy of the old load
3260        _load: jQuery.fn.load,
3261
3262        load: function( url, params, callback ) {
3263                if ( typeof url !== "string" )
3264                        return this._load( url );
3265
3266                var off = url.indexOf(" ");
3267                if ( off >= 0 ) {
3268                        var selector = url.slice(off, url.length);
3269                        url = url.slice(0, off);
3270                }
3271
3272                // Default to a GET request
3273                var type = "GET";
3274
3275                // If the second parameter was provided
3276                if ( params )
3277                        // If it's a function
3278                        if ( jQuery.isFunction( params ) ) {
3279                                // We assume that it's the callback
3280                                callback = params;
3281                                params = null;
3282
3283                        // Otherwise, build a param string
3284                        } else if( typeof params === "object" ) {
3285                                params = jQuery.param( params );
3286                                type = "POST";
3287                        }
3288
3289                var self = this;
3290
3291                // Request the remote document
3292                jQuery.ajax({
3293                        url: url,
3294                        type: type,
3295                        dataType: "html",
3296                        data: params,
3297                        complete: function(res, status){
3298                                // If successful, inject the HTML into all the matched elements
3299                                if ( status == "success" || status == "notmodified" )
3300                                        // See if a selector was specified
3301                                        self.html( selector ?
3302                                                // Create a dummy div to hold the results
3303                                                jQuery("<div/>")
3304                                                        // inject the contents of the document in, removing the scripts
3305                                                        // to avoid any 'Permission Denied' errors in IE
3306                                                        .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
3307
3308                                                        // Locate the specified elements
3309                                                        .find(selector) :
3310
3311                                                // If not, just inject the full result
3312                                                res.responseText );
3313
3314                                if( callback )
3315                                        self.each( callback, [res.responseText, status, res] );
3316                        }
3317                });
3318                return this;
3319        },
3320
3321        serialize: function() {
3322                return jQuery.param(this.serializeArray());
3323        },
3324        serializeArray: function() {
3325                return this.map(function(){
3326                        return this.elements ? jQuery.makeArray(this.elements) : this;
3327                })
3328                .filter(function(){
3329                        return this.name && !this.disabled &&
3330                                (this.checked || /select|textarea/i.test(this.nodeName) ||
3331                                        /text|hidden|password|search/i.test(this.type));
3332                })
3333                .map(function(i, elem){
3334                        var val = jQuery(this).val();
3335                        return val == null ? null :
3336                                jQuery.isArray(val) ?
3337                                        jQuery.map( val, function(val, i){
3338                                                return {name: elem.name, value: val};
3339                                        }) :
3340                                        {name: elem.name, value: val};
3341                }).get();
3342        }
3343});
3344
3345// Attach a bunch of functions for handling common AJAX events
3346jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
3347        jQuery.fn[o] = function(f){
3348                return this.bind(o, f);
3349        };
3350});
3351
3352var jsc = now();
3353
3354jQuery.extend({
3355 
3356        get: function( url, data, callback, type ) {
3357                // shift arguments if data argument was ommited
3358                if ( jQuery.isFunction( data ) ) {
3359                        callback = data;
3360                        data = null;
3361                }
3362
3363                return jQuery.ajax({
3364                        type: "GET",
3365                        url: url,
3366                        data: data,
3367                        success: callback,
3368                        dataType: type
3369                });
3370        },
3371
3372        getScript: function( url, callback ) {
3373                return jQuery.get(url, null, callback, "script");
3374        },
3375
3376        getJSON: function( url, data, callback ) {
3377                return jQuery.get(url, data, callback, "json");
3378        },
3379
3380        post: function( url, data, callback, type ) {
3381                if ( jQuery.isFunction( data ) ) {
3382                        callback = data;
3383                        data = {};
3384                }
3385
3386                return jQuery.ajax({
3387                        type: "POST",
3388                        url: url,
3389                        data: data,
3390                        success: callback,
3391                        dataType: type
3392                });
3393        },
3394
3395        ajaxSetup: function( settings ) {
3396                jQuery.extend( jQuery.ajaxSettings, settings );
3397        },
3398
3399        ajaxSettings: {
3400                url: location.href,
3401                global: true,
3402                type: "GET",
3403                contentType: "application/x-www-form-urlencoded",
3404                processData: true,
3405                async: true,
3406                /*
3407                timeout: 0,
3408                data: null,
3409                username: null,
3410                password: null,
3411                */
3412                // Create the request object; Microsoft failed to properly
3413                // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
3414                // This function can be overriden by calling jQuery.ajaxSetup
3415                xhr:function(){
3416                        return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
3417                },
3418                accepts: {
3419                        xml: "application/xml, text/xml",
3420                        html: "text/html",
3421                        script: "text/javascript, application/javascript",
3422                        json: "application/json, text/javascript",
3423                        text: "text/plain",
3424                        _default: "*/*"
3425                }
3426        },
3427
3428        // Last-Modified header cache for next request
3429        lastModified: {},
3430
3431        ajax: function( s ) {
3432                // Extend the settings, but re-extend 's' so that it can be
3433                // checked again later (in the test suite, specifically)
3434                s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
3435
3436                var jsonp, jsre = /=\?(&|$)/g, status, data,
3437                        type = s.type.toUpperCase();
3438
3439                // convert data if not already a string
3440                if ( s.data && s.processData && typeof s.data !== "string" )
3441                        s.data = jQuery.param(s.data);
3442
3443                // Handle JSONP Parameter Callbacks
3444                if ( s.dataType == "jsonp" ) {
3445                        if ( type == "GET" ) {
3446                                if ( !s.url.match(jsre) )
3447                                        s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
3448                        } else if ( !s.data || !s.data.match(jsre) )
3449                                s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
3450                        s.dataType = "json";
3451                }
3452
3453                // Build temporary JSONP function
3454                if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
3455                        jsonp = "jsonp" + jsc++;
3456
3457                        // Replace the =? sequence both in the query string and the data
3458                        if ( s.data )
3459                                s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
3460                        s.url = s.url.replace(jsre, "=" + jsonp + "$1");
3461
3462                        // We need to make sure
3463                        // that a JSONP style response is executed properly
3464                        s.dataType = "script";
3465
3466                        // Handle JSONP-style loading
3467                        window[ jsonp ] = function(tmp){
3468                                data = tmp;
3469                                success();
3470                                complete();
3471                                // Garbage collect
3472                                window[ jsonp ] = undefined;
3473                                try{ delete window[ jsonp ]; } catch(e){}
3474                                if ( head )
3475                                        head.removeChild( script );
3476                        };
3477                }
3478
3479                if ( s.dataType == "script" && s.cache == null )
3480                        s.cache = false;
3481
3482                if ( s.cache === false && type == "GET" ) {
3483                        var ts = now();
3484                        // try replacing _= if it is there
3485                        var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
3486                        // if nothing was replaced, add timestamp to the end
3487                        s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
3488                }
3489
3490                // If data is available, append data to url for get requests
3491                if ( s.data && type == "GET" ) {
3492                        s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
3493
3494                        // IE likes to send both get and post data, prevent this
3495                        s.data = null;
3496                }
3497
3498                // Watch for a new set of requests
3499                if ( s.global && ! jQuery.active++ )
3500                        jQuery.event.trigger( "ajaxStart" );
3501
3502                // Matches an absolute URL, and saves the domain
3503                var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
3504
3505                // If we're requesting a remote document
3506                // and trying to load JSON or Script with a GET
3507                if ( s.dataType == "script" && type == "GET" && parts
3508                        && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
3509
3510                        var head = document.getElementsByTagName("head")[0];
3511                        var script = document.createElement("script");
3512                        script.src = s.url;
3513                        if (s.scriptCharset)
3514                                script.charset = s.scriptCharset;
3515
3516                        // Handle Script loading
3517                        if ( !jsonp ) {
3518                                var done = false;
3519
3520                                // Attach handlers for all browsers
3521                                script.onload = script.onreadystatechange = function(){
3522                                        if ( !done && (!this.readyState ||
3523                                                        this.readyState == "loaded" || this.readyState == "complete") ) {
3524                                                done = true;
3525                                                success();
3526                                                complete();
3527
3528                                                // Handle memory leak in IE
3529                                                script.onload = script.onreadystatechange = null;
3530                                                head.removeChild( script );
3531                                        }
3532                                };
3533                        }
3534
3535                        head.appendChild(script);
3536
3537                        // We handle everything using the script element injection
3538                        return undefined;
3539                }
3540
3541                var requestDone = false;
3542
3543                // Create the request object
3544                var xhr = s.xhr();
3545
3546                // Open the socket
3547                // Passing null username, generates a login popup on Opera (#2865)
3548                if( s.username )
3549                        xhr.open(type, s.url, s.async, s.username, s.password);
3550                else
3551                        xhr.open(type, s.url, s.async);
3552
3553                // Need an extra try/catch for cross domain requests in Firefox 3
3554                try {
3555                        // Set the correct header, if data is being sent
3556                        if ( s.data )
3557                                xhr.setRequestHeader("Content-Type", s.contentType);
3558
3559                        // Set the If-Modified-Since header, if ifModified mode.
3560                        if ( s.ifModified )
3561                                xhr.setRequestHeader("If-Modified-Since",
3562                                        jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
3563
3564                        // Set header so the called script knows that it's an XMLHttpRequest
3565                        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
3566
3567                        // Set the Accepts header for the server, depending on the dataType
3568                        xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
3569                                s.accepts[ s.dataType ] + ", */*" :
3570                                s.accepts._default );
3571                } catch(e){}
3572
3573                // Allow custom headers/mimetypes and early abort
3574                if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
3575                        // Handle the global AJAX counter
3576                        if ( s.global && ! --jQuery.active )
3577                                jQuery.event.trigger( "ajaxStop" );
3578                        // close opended socket
3579                        xhr.abort();
3580                        return false;
3581                }
3582
3583                if ( s.global )
3584                        jQuery.event.trigger("ajaxSend", [xhr, s]);
3585
3586                // Wait for a response to come back
3587                var onreadystatechange = function(isTimeout){
3588                        // The request was aborted, clear the interval and decrement jQuery.active
3589                        if (xhr.readyState == 0) {
3590                                if (ival) {
3591                                        // clear poll interval
3592                                        clearInterval(ival);
3593                                        ival = null;
3594                                        // Handle the global AJAX counter
3595                                        if ( s.global && ! --jQuery.active )
3596                                                jQuery.event.trigger( "ajaxStop" );
3597                                }
3598                        // The transfer is complete and the data is available, or the request timed out
3599                        } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
3600                                requestDone = true;
3601
3602                                // clear poll interval
3603                                if (ival) {
3604                                        clearInterval(ival);
3605                                        ival = null;
3606                                }
3607
3608                                status = isTimeout == "timeout" ? "timeout" :
3609                                        !jQuery.httpSuccess( xhr ) ? "error" :
3610                                        s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
3611                                        "success";
3612
3613                                if ( status == "success" ) {
3614                                        // Watch for, and catch, XML document parse errors
3615                                        try {
3616                                                // process the data (runs the xml through httpData regardless of callback)
3617                                                data = jQuery.httpData( xhr, s.dataType, s );
3618                                        } catch(e) {
3619                                                status = "parsererror";
3620                                        }
3621                                }
3622
3623                                // Make sure that the request was successful or notmodified
3624                                if ( status == "success" ) {
3625                                        // Cache Last-Modified header, if ifModified mode.
3626                                        var modRes;
3627                                        try {
3628                                                modRes = xhr.getResponseHeader("Last-Modified");
3629                                        } catch(e) {} // swallow exception thrown by FF if header is not available
3630
3631                                        if ( s.ifModified && modRes )
3632                                                jQuery.lastModified[s.url] = modRes;
3633
3634                                        // JSONP handles its own success callback
3635                                        if ( !jsonp )
3636                                                success();
3637                                } else
3638                                        jQuery.handleError(s, xhr, status);
3639
3640                                // Fire the complete handlers
3641                                complete();
3642
3643                                if ( isTimeout )
3644                                        xhr.abort();
3645
3646                                // Stop memory leaks
3647                                if ( s.async )
3648                                        xhr = null;
3649                        }
3650                };
3651
3652                if ( s.async ) {
3653                        // don't attach the handler to the request, just poll it instead
3654                        var ival = setInterval(onreadystatechange, 13);
3655
3656                        // Timeout checker
3657                        if ( s.timeout > 0 )
3658                                setTimeout(function(){
3659                                        // Check to see if the request is still happening
3660                                        if ( xhr && !requestDone )
3661                                                onreadystatechange( "timeout" );
3662                                }, s.timeout);
3663                }
3664
3665                // Send the data
3666                try {
3667                        xhr.send(s.data);
3668                } catch(e) {
3669                        jQuery.handleError(s, xhr, null, e);
3670                }
3671
3672                // firefox 1.5 doesn't fire statechange for sync requests
3673                if ( !s.async )
3674                        onreadystatechange();
3675
3676                function success(){
3677                        // If a local callback was specified, fire it and pass it the data
3678                        if ( s.success )
3679                                s.success( data, status );
3680
3681                        // Fire the global callback
3682                        if ( s.global )
3683                                jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
3684                }
3685
3686                function complete(){
3687                        // Process result
3688                        if ( s.complete )
3689                                s.complete(xhr, status);
3690
3691                        // The request was completed
3692                        if ( s.global )
3693                                jQuery.event.trigger( "ajaxComplete", [xhr, s] );
3694
3695                        // Handle the global AJAX counter
3696                        if ( s.global && ! --jQuery.active )
3697                                jQuery.event.trigger( "ajaxStop" );
3698                }
3699
3700                // return XMLHttpRequest to allow aborting the request etc.
3701                return xhr;
3702        },
3703
3704        handleError: function( s, xhr, status, e ) {
3705                // If a local callback was specified, fire it
3706                if ( s.error ) s.error( xhr, status, e );
3707
3708                // Fire the global callback
3709                if ( s.global )
3710                        jQuery.event.trigger( "ajaxError", [xhr, s, e] );
3711        },
3712
3713        // Counter for holding the number of active queries
3714        active: 0,
3715
3716        // Determines if an XMLHttpRequest was successful or not
3717        httpSuccess: function( xhr ) {
3718                try {
3719                        // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
3720                        return !xhr.status && location.protocol == "file:" ||
3721                                ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
3722                } catch(e){}
3723                return false;
3724        },
3725
3726        // Determines if an XMLHttpRequest returns NotModified
3727        httpNotModified: function( xhr, url ) {
3728                try {
3729                        var xhrRes = xhr.getResponseHeader("Last-Modified");
3730
3731                        // Firefox always returns 200. check Last-Modified date
3732                        return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
3733                } catch(e){}
3734                return false;
3735        },
3736
3737        httpData: function( xhr, type, s ) {
3738                var ct = xhr.getResponseHeader("content-type"),
3739                        xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
3740                        data = xml ? xhr.responseXML : xhr.responseText;
3741
3742                if ( xml && data.documentElement.tagName == "parsererror" )
3743                        throw "parsererror";
3744                       
3745                // Allow a pre-filtering function to sanitize the response
3746                // s != null is checked to keep backwards compatibility
3747                if( s && s.dataFilter )
3748                        data = s.dataFilter( data, type );
3749
3750                // The filter can actually parse the response
3751                if( typeof data === "string" ){
3752
3753                        // If the type is "script", eval it in global context
3754                        if ( type == "script" )
3755                                jQuery.globalEval( data );
3756
3757                        // Get the JavaScript object, if JSON is used.
3758                        if ( type == "json" )
3759                                data = window["eval"]("(" + data + ")");
3760                }
3761               
3762                return data;
3763        },
3764
3765        // Serialize an array of form elements or a set of
3766        // key/values into a query string
3767        param: function( a ) {
3768                var s = [ ];
3769
3770                function add( key, value ){
3771                        s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
3772                };
3773
3774                // If an array was passed in, assume that it is an array
3775                // of form elements
3776                if ( jQuery.isArray(a) || a.jquery )
3777                        // Serialize the form elements
3778                        jQuery.each( a, function(){
3779                                add( this.name, this.value );
3780                        });
3781
3782                // Otherwise, assume that it's an object of key/value pairs
3783                else
3784                        // Serialize the key/values
3785                        for ( var j in a )
3786                                // If the value is an array then the key names need to be repeated
3787                                if ( jQuery.isArray(a[j]) )
3788                                        jQuery.each( a[j], function(){
3789                                                add( j, this );
3790                                        });
3791                                else
3792                                        add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
3793
3794                // Return the resulting serialization
3795                return s.join("&").replace(/%20/g, "+");
3796        }
3797
3798});
3799var elemdisplay = {},
3800        timerId,
3801        fxAttrs = [
3802                // height animations
3803                [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
3804                // width animations
3805                [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
3806                // opacity animations
3807                [ "opacity" ]
3808        ];
3809
3810function genFx( type, num ){
3811        var obj = {};
3812        jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
3813                obj[ this ] = type;
3814        });
3815        return obj;
3816}
3817
3818jQuery.fn.extend({
3819        show: function(speed,callback){
3820                if ( speed ) {
3821                        return this.animate( genFx("show", 3), speed, callback);
3822                } else {
3823                        for ( var i = 0, l = this.length; i < l; i++ ){
3824                                var old = jQuery.data(this[i], "olddisplay");
3825                               
3826                                this[i].style.display = old || "";
3827                               
3828                                if ( jQuery.css(this[i], "display") === "none" ) {
3829                                        var tagName = this[i].tagName, display;
3830                                       
3831                                        if ( elemdisplay[ tagName ] ) {
3832                                                display = elemdisplay[ tagName ];
3833                                        } else {
3834                                                var elem = jQuery("<" + tagName + " />").appendTo("body");
3835                                               
3836                                                display = elem.css("display");
3837                                                if ( display === "none" )
3838                                                        display = "block";
3839                                               
3840                                                elem.remove();
3841                                               
3842                                                elemdisplay[ tagName ] = display;
3843                                        }
3844                                       
3845                                        jQuery.data(this[i], "olddisplay", display);
3846                                }
3847                        }
3848
3849                        // Set the display of the elements in a second loop
3850                        // to avoid the constant reflow
3851                        for ( var i = 0, l = this.length; i < l; i++ ){
3852                                this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
3853                        }
3854                       
3855                        return this;
3856                }
3857        },
3858
3859        hide: function(speed,callback){
3860                if ( speed ) {
3861                        return this.animate( genFx("hide", 3), speed, callback);
3862                } else {
3863                        for ( var i = 0, l = this.length; i < l; i++ ){
3864                                var old = jQuery.data(this[i], "olddisplay");
3865                                if ( !old && old !== "none" )
3866                                        jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
3867                        }
3868
3869                        // Set the display of the elements in a second loop
3870                        // to avoid the constant reflow
3871                        for ( var i = 0, l = this.length; i < l; i++ ){
3872                                this[i].style.display = "none";
3873                        }
3874
3875                        return this;
3876                }
3877        },
3878
3879        // Save the old toggle function
3880        _toggle: jQuery.fn.toggle,
3881
3882        toggle: function( fn, fn2 ){
3883                var bool = typeof fn === "boolean";
3884
3885                return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
3886                        this._toggle.apply( this, arguments ) :
3887                        fn == null || bool ?
3888                                this.each(function(){
3889                                        var state = bool ? fn : jQuery(this).is(":hidden");
3890                                        jQuery(this)[ state ? "show" : "hide" ]();
3891                                }) :
3892                                this.animate(genFx("toggle", 3), fn, fn2);
3893        },
3894
3895        fadeTo: function(speed,to,callback){
3896                return this.animate({opacity: to}, speed, callback);
3897        },
3898
3899        animate: function( prop, speed, easing, callback ) {
3900                var optall = jQuery.speed(speed, easing, callback);
3901
3902                return this[ optall.queue === false ? "each" : "queue" ](function(){
3903               
3904                        var opt = jQuery.extend({}, optall), p,
3905                                hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
3906                                self = this;
3907       
3908                        for ( p in prop ) {
3909                                if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
3910                                        return opt.complete.call(this);
3911
3912                                if ( ( p == "height" || p == "width" ) && this.style ) {
3913                                        // Store display property
3914                                        opt.display = jQuery.css(this, "display");
3915
3916                                        // Make sure that nothing sneaks out
3917                                        opt.overflow = this.style.overflow;
3918                                }
3919                        }
3920
3921                        if ( opt.overflow != null )
3922                                this.style.overflow = "hidden";
3923
3924                        opt.curAnim = jQuery.extend({}, prop);
3925
3926                        jQuery.each( prop, function(name, val){
3927                                var e = new jQuery.fx( self, opt, name );
3928
3929                                if ( /toggle|show|hide/.test(val) )
3930                                        e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
3931                                else {
3932                                        var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
3933                                                start = e.cur(true) || 0;
3934
3935                                        if ( parts ) {
3936                                                var end = parseFloat(parts[2]),
3937                                                        unit = parts[3] || "px";
3938
3939                                                // We need to compute starting value
3940                                                if ( unit != "px" ) {
3941                                                        self.style[ name ] = (end || 1) + unit;
3942                                                        start = ((end || 1) / e.cur(true)) * start;
3943                                                        self.style[ name ] = start + unit;
3944                                                }
3945
3946                                                // If a +=/-= token was provided, we're doing a relative animation
3947                                                if ( parts[1] )
3948                                                        end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
3949
3950                                                e.custom( start, end, unit );
3951                                        } else
3952                                                e.custom( start, val, "" );
3953                                }
3954                        });
3955
3956                        // For JS strict compliance
3957                        return true;
3958                });
3959        },
3960
3961        stop: function(clearQueue, gotoEnd){
3962                var timers = jQuery.timers;
3963
3964                if (clearQueue)
3965                        this.queue([]);
3966
3967                this.each(function(){
3968                        // go in reverse order so anything added to the queue during the loop is ignored
3969                        for ( var i = timers.length - 1; i >= 0; i-- )
3970                                if ( timers[i].elem == this ) {
3971                                        if (gotoEnd)
3972                                                // force the next step to be the last
3973                                                timers[i](true);
3974                                        timers.splice(i, 1);
3975                                }
3976                });
3977
3978                // start the next in the queue if the last step wasn't forced
3979                if (!gotoEnd)
3980                        this.dequeue();
3981
3982                return this;
3983        }
3984
3985});
3986
3987// Generate shortcuts for custom animations
3988jQuery.each({
3989        slideDown: genFx("show", 1),
3990        slideUp: genFx("hide", 1),
3991        slideToggle: genFx("toggle", 1),
3992        fadeIn: { opacity: "show" },
3993        fadeOut: { opacity: "hide" }
3994}, function( name, props ){
3995        jQuery.fn[ name ] = function( speed, callback ){
3996                return this.animate( props, speed, callback );
3997        };
3998});
3999
4000jQuery.extend({
4001
4002        speed: function(speed, easing, fn) {
4003                var opt = typeof speed === "object" ? speed : {
4004                        complete: fn || !fn && easing ||
4005                                jQuery.isFunction( speed ) && speed,
4006                        duration: speed,
4007                        easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4008                };
4009
4010                opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
4011                        jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
4012
4013                // Queueing
4014                opt.old = opt.complete;
4015                opt.complete = function(){
4016                        if ( opt.queue !== false )
4017                                jQuery(this).dequeue();
4018                        if ( jQuery.isFunction( opt.old ) )
4019                                opt.old.call( this );
4020                };
4021
4022                return opt;
4023        },
4024
4025        easing: {
4026                linear: function( p, n, firstNum, diff ) {
4027                        return firstNum + diff * p;
4028                },
4029                swing: function( p, n, firstNum, diff ) {
4030                        return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
4031                }
4032        },
4033
4034        timers: [],
4035
4036        fx: function( elem, options, prop ){
4037                this.options = options;
4038                this.elem = elem;
4039                this.prop = prop;
4040
4041                if ( !options.orig )
4042                        options.orig = {};
4043        }
4044
4045});
4046
4047jQuery.fx.prototype = {
4048
4049        // Simple function for setting a style value
4050        update: function(){
4051                if ( this.options.step )
4052                        this.options.step.call( this.elem, this.now, this );
4053
4054                (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
4055
4056                // Set display property to block for height/width animations
4057                if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
4058                        this.elem.style.display = "block";
4059        },
4060
4061        // Get the current size
4062        cur: function(force){
4063                if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
4064                        return this.elem[ this.prop ];
4065
4066                var r = parseFloat(jQuery.css(this.elem, this.prop, force));
4067                return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
4068        },
4069
4070        // Start an animation from one number to another
4071        custom: function(from, to, unit){
4072                this.startTime = now();
4073                this.start = from;
4074                this.end = to;
4075                this.unit = unit || this.unit || "px";
4076                this.now = this.start;
4077                this.pos = this.state = 0;
4078
4079                var self = this;
4080                function t(gotoEnd){
4081                        return self.step(gotoEnd);
4082                }
4083
4084                t.elem = this.elem;
4085
4086                if ( t() && jQuery.timers.push(t) && !timerId ) {
4087                        timerId = setInterval(function(){
4088                                var timers = jQuery.timers;
4089
4090                                for ( var i = 0; i < timers.length; i++ )
4091                                        if ( !timers[i]() )
4092                                                timers.splice(i--, 1);
4093
4094                                if ( !timers.length ) {
4095                                        clearInterval( timerId );
4096                                        timerId = undefined;
4097                                }
4098                        }, 13);
4099                }
4100        },
4101
4102        // Simple 'show' function
4103        show: function(){
4104                // Remember where we started, so that we can go back to it later
4105                this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
4106                this.options.show = true;
4107
4108                // Begin the animation
4109                // Make sure that we start at a small width/height to avoid any
4110                // flash of content
4111                this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
4112
4113                // Start by showing the element
4114                jQuery(this.elem).show();
4115        },
4116
4117        // Simple 'hide' function
4118        hide: function(){
4119                // Remember where we started, so that we can go back to it later
4120                this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
4121                this.options.hide = true;
4122
4123                // Begin the animation
4124                this.custom(this.cur(), 0);
4125        },
4126
4127        // Each step of an animation
4128        step: function(gotoEnd){
4129                var t = now();
4130
4131                if ( gotoEnd || t >= this.options.duration + this.startTime ) {
4132                        this.now = this.end;
4133                        this.pos = this.state = 1;
4134                        this.update();
4135
4136                        this.options.curAnim[ this.prop ] = true;
4137
4138                        var done = true;
4139                        for ( var i in this.options.curAnim )
4140                                if ( this.options.curAnim[i] !== true )
4141                                        done = false;
4142
4143                        if ( done ) {
4144                                if ( this.options.display != null ) {
4145                                        // Reset the overflow
4146                                        this.elem.style.overflow = this.options.overflow;
4147
4148                                        // Reset the display
4149                                        this.elem.style.display = this.options.display;
4150                                        if ( jQuery.css(this.elem, "display") == "none" )
4151                                                this.elem.style.display = "block";
4152                                }
4153
4154                                // Hide the element if the "hide" operation was done
4155                                if ( this.options.hide )
4156                                        jQuery(this.elem).hide();
4157
4158                                // Reset the properties, if the item has been hidden or shown
4159                                if ( this.options.hide || this.options.show )
4160                                        for ( var p in this.options.curAnim )
4161                                                jQuery.attr(this.elem.style, p, this.options.orig[p]);
4162                                       
4163                                // Execute the complete function
4164                                this.options.complete.call( this.elem );
4165                        }
4166
4167                        return false;
4168                } else {
4169                        var n = t - this.startTime;
4170                        this.state = n / this.options.duration;
4171
4172                        // Perform the easing function, defaults to swing
4173                        this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
4174                        this.now = this.start + ((this.end - this.start) * this.pos);
4175
4176                        // Perform the next step of the animation
4177                        this.update();
4178                }
4179
4180                return true;
4181        }
4182
4183};
4184
4185jQuery.extend( jQuery.fx, {
4186        speeds:{
4187                slow: 600,
4188                fast: 200,
4189                // Default speed
4190                _default: 400
4191        },
4192        step: {
4193
4194                opacity: function(fx){
4195                        jQuery.attr(fx.elem.style, "opacity", fx.now);
4196                },
4197
4198                _default: function(fx){
4199                        if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
4200                                fx.elem.style[ fx.prop ] = fx.now + fx.unit;
4201                        else
4202                                fx.elem[ fx.prop ] = fx.now;
4203                }
4204        }
4205});
4206if ( document.documentElement["getBoundingClientRect"] )
4207        jQuery.fn.offset = function() {
4208                if ( !this[0] ) return { top: 0, left: 0 };
4209                if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
4210                var box  = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
4211                        clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
4212                        top  = box.top  + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop  || body.scrollTop ) - clientTop,
4213                        left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
4214                return { top: top, left: left };
4215        };
4216else
4217        jQuery.fn.offset = function() {
4218                if ( !this[0] ) return { top: 0, left: 0 };
4219                if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
4220                jQuery.offset.initialized || jQuery.offset.initialize();
4221
4222                var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
4223                        doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
4224                        body = doc.body, defaultView = doc.defaultView,
4225                        prevComputedStyle = defaultView.getComputedStyle(elem, null),
4226                        top = elem.offsetTop, left = elem.offsetLeft;
4227
4228                while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
4229                        computedStyle = defaultView.getComputedStyle(elem, null);
4230                        top -= elem.scrollTop, left -= elem.scrollLeft;
4231                        if ( elem === offsetParent ) {
4232                                top += elem.offsetTop, left += elem.offsetLeft;
4233                                if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
4234                                        top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
4235                                        left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
4236                                prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
4237                        }
4238                        if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
4239                                top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
4240                                left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
4241                        prevComputedStyle = computedStyle;
4242                }
4243
4244                if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
4245                        top  += body.offsetTop,
4246                        left += body.offsetLeft;
4247
4248                if ( prevComputedStyle.position === "fixed" )
4249                        top  += Math.max(docElem.scrollTop, body.scrollTop),
4250                        left += Math.max(docElem.scrollLeft, body.scrollLeft);
4251
4252                return { top: top, left: left };
4253        };
4254
4255jQuery.offset = {
4256        initialize: function() {
4257                if ( this.initialized ) return;
4258                var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
4259                        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>';
4260
4261                rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
4262                for ( prop in rules ) container.style[prop] = rules[prop];
4263
4264                container.innerHTML = html;
4265                body.insertBefore(container, body.firstChild);
4266                innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
4267
4268                this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
4269                this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
4270
4271                innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
4272                this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
4273
4274                body.style.marginTop = '1px';
4275                this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
4276                body.style.marginTop = bodyMarginTop;
4277
4278                body.removeChild(container);
4279                this.initialized = true;
4280        },
4281
4282        bodyOffset: function(body) {
4283                jQuery.offset.initialized || jQuery.offset.initialize();
4284                var top = body.offsetTop, left = body.offsetLeft;
4285                if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
4286                        top  += parseInt( jQuery.curCSS(body, 'marginTop',  true), 10 ) || 0,
4287                        left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
4288                return { top: top, left: left };
4289        }
4290};
4291
4292
4293jQuery.fn.extend({
4294        position: function() {
4295                var left = 0, top = 0, results;
4296
4297                if ( this[0] ) {
4298                        // Get *real* offsetParent
4299                        var offsetParent = this.offsetParent(),
4300
4301                        // Get correct offsets
4302                        offset       = this.offset(),
4303                        parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
4304
4305                        // Subtract element margins
4306                        // note: when an element has margin: auto the offsetLeft and marginLeft
4307                        // are the same in Safari causing offset.left to incorrectly be 0
4308                        offset.top  -= num( this, 'marginTop'  );
4309                        offset.left -= num( this, 'marginLeft' );
4310
4311                        // Add offsetParent borders
4312                        parentOffset.top  += num( offsetParent, 'borderTopWidth'  );
4313                        parentOffset.left += num( offsetParent, 'borderLeftWidth' );
4314
4315                        // Subtract the two offsets
4316                        results = {
4317                                top:  offset.top  - parentOffset.top,
4318                                left: offset.left - parentOffset.left
4319                        };
4320                }
4321
4322                return results;
4323        },
4324
4325        offsetParent: function() {
4326                var offsetParent = this[0].offsetParent || document.body;
4327                while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
4328                        offsetParent = offsetParent.offsetParent;
4329                return jQuery(offsetParent);
4330        }
4331});
4332
4333
4334// Create scrollLeft and scrollTop methods
4335jQuery.each( ['Left', 'Top'], function(i, name) {
4336        var method = 'scroll' + name;
4337       
4338        jQuery.fn[ method ] = function(val) {
4339                if (!this[0]) return null;
4340
4341                return val !== undefined ?
4342
4343                        // Set the scroll offset
4344                        this.each(function() {
4345                                this == window || this == document ?
4346                                        window.scrollTo(
4347                                                !i ? val : jQuery(window).scrollLeft(),
4348                                                 i ? val : jQuery(window).scrollTop()
4349                                        ) :
4350                                        this[ method ] = val;
4351                        }) :
4352
4353                        // Return the scroll offset
4354                        this[0] == window || this[0] == document ?
4355                                self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
4356                                        jQuery.boxModel && document.documentElement[ method ] ||
4357                                        document.body[ method ] :
4358                                this[0][ method ];
4359        };
4360});
4361// Create innerHeight, innerWidth, outerHeight and outerWidth methods
4362jQuery.each([ "Height", "Width" ], function(i, name){
4363
4364        var tl = i ? "Left"  : "Top",  // top or left
4365                br = i ? "Right" : "Bottom", // bottom or right
4366                lower = name.toLowerCase();
4367
4368        // innerHeight and innerWidth
4369        jQuery.fn["inner" + name] = function(){
4370                return this[0] ?
4371                        jQuery.css( this[0], lower, false, "padding" ) :
4372                        null;
4373        };
4374
4375        // outerHeight and outerWidth
4376        jQuery.fn["outer" + name] = function(margin) {
4377                return this[0] ?
4378                        jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
4379                        null;
4380        };
4381       
4382        var type = name.toLowerCase();
4383
4384        jQuery.fn[ type ] = function( size ) {
4385                // Get window width or height
4386                return this[0] == window ?
4387                        // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
4388                        document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
4389                        document.body[ "client" + name ] :
4390
4391                        // Get document width or height
4392                        this[0] == document ?
4393                                // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
4394                                Math.max(
4395                                        document.documentElement["client" + name],
4396                                        document.body["scroll" + name], document.documentElement["scroll" + name],
4397                                        document.body["offset" + name], document.documentElement["offset" + name]
4398                                ) :
4399
4400                                // Get or set width or height on the element
4401                                size === undefined ?
4402                                        // Get width or height on the element
4403                                        (this.length ? jQuery.css( this[0], type ) : null) :
4404
4405                                        // Set the width or height on the element (default to pixels if value is unitless)
4406                                        this.css( type, typeof size === "string" ? size : size + "px" );
4407        };
4408
4409});
4410})();
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.