Хранилища Subversion ant

Редакция

Редакция 459 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

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