Хранилища Subversion ant

Редакция

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

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