Хранилища Subversion ant

Редакция

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

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