Хранилища Subversion ant

Редакция

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

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