Хранилища Subversion ant

Редакция

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

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