Хранилища Subversion ant

Редакция

Редакция 175 | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

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