Хранилища Subversion ant

Редакция

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

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