Хранилища Subversion ant

Редакция

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