Хранилища Subversion ant

Редакция

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