Хранилища Subversion ant

Редакция

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

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