PageRenderTime 138ms CodeModel.GetById 25ms app.highlight 85ms RepoModel.GetById 1ms app.codeStats 2ms

/scalate-website/src/scripts/jquery.js

http://github.com/scalate/scalate
JavaScript | 8981 lines | 6304 code | 1570 blank | 1107 comment | 1827 complexity | 12840be281cca027968c56e19ebdf6ec MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*!
   2 * jQuery JavaScript Library v1.6.2
   3 * http://jquery.com/
   4 *
   5 * Copyright 2011, John Resig
   6 * Dual licensed under the MIT or GPL Version 2 licenses.
   7 * http://jquery.org/license
   8 *
   9 * Includes Sizzle.js
  10 * http://sizzlejs.com/
  11 * Copyright 2011, The Dojo Foundation
  12 * Released under the MIT, BSD, and GPL Licenses.
  13 *
  14 * Date: Thu Jun 30 14:16:56 2011 -0400
  15 */
  16(function( window, undefined ) {
  17
  18// Use the correct document accordingly with window argument (sandbox)
  19var document = window.document,
  20	navigator = window.navigator,
  21	location = window.location;
  22var jQuery = (function() {
  23
  24// Define a local copy of jQuery
  25var jQuery = function( selector, context ) {
  26		// The jQuery object is actually just the init constructor 'enhanced'
  27		return new jQuery.fn.init( selector, context, rootjQuery );
  28	},
  29
  30	// Map over jQuery in case of overwrite
  31	_jQuery = window.jQuery,
  32
  33	// Map over the $ in case of overwrite
  34	_$ = window.$,
  35
  36	// A central reference to the root jQuery(document)
  37	rootjQuery,
  38
  39	// A simple way to check for HTML strings or ID strings
  40	// (both of which we optimize for)
  41	quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
  42
  43	// Check if a string has a non-whitespace character in it
  44	rnotwhite = /\S/,
  45
  46	// Used for trimming whitespace
  47	trimLeft = /^\s+/,
  48	trimRight = /\s+$/,
  49
  50	// Check for digits
  51	rdigit = /\d/,
  52
  53	// Match a standalone tag
  54	rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  55
  56	// JSON RegExp
  57	rvalidchars = /^[\],:{}\s]*$/,
  58	rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  59	rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  60	rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  61
  62	// Useragent RegExp
  63	rwebkit = /(webkit)[ \/]([\w.]+)/,
  64	ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  65	rmsie = /(msie) ([\w.]+)/,
  66	rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
  67
  68	// Matches dashed string for camelizing
  69	rdashAlpha = /-([a-z])/ig,
  70
  71	// Used by jQuery.camelCase as callback to replace()
  72	fcamelCase = function( all, letter ) {
  73		return letter.toUpperCase();
  74	},
  75
  76	// Keep a UserAgent string for use with jQuery.browser
  77	userAgent = navigator.userAgent,
  78
  79	// For matching the engine and version of the browser
  80	browserMatch,
  81
  82	// The deferred used on DOM ready
  83	readyList,
  84
  85	// The ready event handler
  86	DOMContentLoaded,
  87
  88	// Save a reference to some core methods
  89	toString = Object.prototype.toString,
  90	hasOwn = Object.prototype.hasOwnProperty,
  91	push = Array.prototype.push,
  92	slice = Array.prototype.slice,
  93	trim = String.prototype.trim,
  94	indexOf = Array.prototype.indexOf,
  95
  96	// [[Class]] -> type pairs
  97	class2type = {};
  98
  99jQuery.fn = jQuery.prototype = {
 100	constructor: jQuery,
 101	init: function( selector, context, rootjQuery ) {
 102		var match, elem, ret, doc;
 103
 104		// Handle $(""), $(null), or $(undefined)
 105		if ( !selector ) {
 106			return this;
 107		}
 108
 109		// Handle $(DOMElement)
 110		if ( selector.nodeType ) {
 111			this.context = this[0] = selector;
 112			this.length = 1;
 113			return this;
 114		}
 115
 116		// The body element only exists once, optimize finding it
 117		if ( selector === "body" && !context && document.body ) {
 118			this.context = document;
 119			this[0] = document.body;
 120			this.selector = selector;
 121			this.length = 1;
 122			return this;
 123		}
 124
 125		// Handle HTML strings
 126		if ( typeof selector === "string" ) {
 127			// Are we dealing with HTML string or an ID?
 128			if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
 129				// Assume that strings that start and end with <> are HTML and skip the regex check
 130				match = [ null, selector, null ];
 131
 132			} else {
 133				match = quickExpr.exec( selector );
 134			}
 135
 136			// Verify a match, and that no context was specified for #id
 137			if ( match && (match[1] || !context) ) {
 138
 139				// HANDLE: $(html) -> $(array)
 140				if ( match[1] ) {
 141					context = context instanceof jQuery ? context[0] : context;
 142					doc = (context ? context.ownerDocument || context : document);
 143
 144					// If a single string is passed in and it's a single tag
 145					// just do a createElement and skip the rest
 146					ret = rsingleTag.exec( selector );
 147
 148					if ( ret ) {
 149						if ( jQuery.isPlainObject( context ) ) {
 150							selector = [ document.createElement( ret[1] ) ];
 151							jQuery.fn.attr.call( selector, context, true );
 152
 153						} else {
 154							selector = [ doc.createElement( ret[1] ) ];
 155						}
 156
 157					} else {
 158						ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
 159						selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
 160					}
 161
 162					return jQuery.merge( this, selector );
 163
 164				// HANDLE: $("#id")
 165				} else {
 166					elem = document.getElementById( match[2] );
 167
 168					// Check parentNode to catch when Blackberry 4.6 returns
 169					// nodes that are no longer in the document #6963
 170					if ( elem && elem.parentNode ) {
 171						// Handle the case where IE and Opera return items
 172						// by name instead of ID
 173						if ( elem.id !== match[2] ) {
 174							return rootjQuery.find( selector );
 175						}
 176
 177						// Otherwise, we inject the element directly into the jQuery object
 178						this.length = 1;
 179						this[0] = elem;
 180					}
 181
 182					this.context = document;
 183					this.selector = selector;
 184					return this;
 185				}
 186
 187			// HANDLE: $(expr, $(...))
 188			} else if ( !context || context.jquery ) {
 189				return (context || rootjQuery).find( selector );
 190
 191			// HANDLE: $(expr, context)
 192			// (which is just equivalent to: $(context).find(expr)
 193			} else {
 194				return this.constructor( context ).find( selector );
 195			}
 196
 197		// HANDLE: $(function)
 198		// Shortcut for document ready
 199		} else if ( jQuery.isFunction( selector ) ) {
 200			return rootjQuery.ready( selector );
 201		}
 202
 203		if (selector.selector !== undefined) {
 204			this.selector = selector.selector;
 205			this.context = selector.context;
 206		}
 207
 208		return jQuery.makeArray( selector, this );
 209	},
 210
 211	// Start with an empty selector
 212	selector: "",
 213
 214	// The current version of jQuery being used
 215	jquery: "1.6.2",
 216
 217	// The default length of a jQuery object is 0
 218	length: 0,
 219
 220	// The number of elements contained in the matched element set
 221	size: function() {
 222		return this.length;
 223	},
 224
 225	toArray: function() {
 226		return slice.call( this, 0 );
 227	},
 228
 229	// Get the Nth element in the matched element set OR
 230	// Get the whole matched element set as a clean array
 231	get: function( num ) {
 232		return num == null ?
 233
 234			// Return a 'clean' array
 235			this.toArray() :
 236
 237			// Return just the object
 238			( num < 0 ? this[ this.length + num ] : this[ num ] );
 239	},
 240
 241	// Take an array of elements and push it onto the stack
 242	// (returning the new matched element set)
 243	pushStack: function( elems, name, selector ) {
 244		// Build a new jQuery matched element set
 245		var ret = this.constructor();
 246
 247		if ( jQuery.isArray( elems ) ) {
 248			push.apply( ret, elems );
 249
 250		} else {
 251			jQuery.merge( ret, elems );
 252		}
 253
 254		// Add the old object onto the stack (as a reference)
 255		ret.prevObject = this;
 256
 257		ret.context = this.context;
 258
 259		if ( name === "find" ) {
 260			ret.selector = this.selector + (this.selector ? " " : "") + selector;
 261		} else if ( name ) {
 262			ret.selector = this.selector + "." + name + "(" + selector + ")";
 263		}
 264
 265		// Return the newly-formed element set
 266		return ret;
 267	},
 268
 269	// Execute a callback for every element in the matched set.
 270	// (You can seed the arguments with an array of args, but this is
 271	// only used internally.)
 272	each: function( callback, args ) {
 273		return jQuery.each( this, callback, args );
 274	},
 275
 276	ready: function( fn ) {
 277		// Attach the listeners
 278		jQuery.bindReady();
 279
 280		// Add the callback
 281		readyList.done( fn );
 282
 283		return this;
 284	},
 285
 286	eq: function( i ) {
 287		return i === -1 ?
 288			this.slice( i ) :
 289			this.slice( i, +i + 1 );
 290	},
 291
 292	first: function() {
 293		return this.eq( 0 );
 294	},
 295
 296	last: function() {
 297		return this.eq( -1 );
 298	},
 299
 300	slice: function() {
 301		return this.pushStack( slice.apply( this, arguments ),
 302			"slice", slice.call(arguments).join(",") );
 303	},
 304
 305	map: function( callback ) {
 306		return this.pushStack( jQuery.map(this, function( elem, i ) {
 307			return callback.call( elem, i, elem );
 308		}));
 309	},
 310
 311	end: function() {
 312		return this.prevObject || this.constructor(null);
 313	},
 314
 315	// For internal use only.
 316	// Behaves like an Array's method, not like a jQuery method.
 317	push: push,
 318	sort: [].sort,
 319	splice: [].splice
 320};
 321
 322// Give the init function the jQuery prototype for later instantiation
 323jQuery.fn.init.prototype = jQuery.fn;
 324
 325jQuery.extend = jQuery.fn.extend = function() {
 326	var options, name, src, copy, copyIsArray, clone,
 327		target = arguments[0] || {},
 328		i = 1,
 329		length = arguments.length,
 330		deep = false;
 331
 332	// Handle a deep copy situation
 333	if ( typeof target === "boolean" ) {
 334		deep = target;
 335		target = arguments[1] || {};
 336		// skip the boolean and the target
 337		i = 2;
 338	}
 339
 340	// Handle case when target is a string or something (possible in deep copy)
 341	if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
 342		target = {};
 343	}
 344
 345	// extend jQuery itself if only one argument is passed
 346	if ( length === i ) {
 347		target = this;
 348		--i;
 349	}
 350
 351	for ( ; i < length; i++ ) {
 352		// Only deal with non-null/undefined values
 353		if ( (options = arguments[ i ]) != null ) {
 354			// Extend the base object
 355			for ( name in options ) {
 356				src = target[ name ];
 357				copy = options[ name ];
 358
 359				// Prevent never-ending loop
 360				if ( target === copy ) {
 361					continue;
 362				}
 363
 364				// Recurse if we're merging plain objects or arrays
 365				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
 366					if ( copyIsArray ) {
 367						copyIsArray = false;
 368						clone = src && jQuery.isArray(src) ? src : [];
 369
 370					} else {
 371						clone = src && jQuery.isPlainObject(src) ? src : {};
 372					}
 373
 374					// Never move original objects, clone them
 375					target[ name ] = jQuery.extend( deep, clone, copy );
 376
 377				// Don't bring in undefined values
 378				} else if ( copy !== undefined ) {
 379					target[ name ] = copy;
 380				}
 381			}
 382		}
 383	}
 384
 385	// Return the modified object
 386	return target;
 387};
 388
 389jQuery.extend({
 390	noConflict: function( deep ) {
 391		if ( window.$ === jQuery ) {
 392			window.$ = _$;
 393		}
 394
 395		if ( deep && window.jQuery === jQuery ) {
 396			window.jQuery = _jQuery;
 397		}
 398
 399		return jQuery;
 400	},
 401
 402	// Is the DOM ready to be used? Set to true once it occurs.
 403	isReady: false,
 404
 405	// A counter to track how many items to wait for before
 406	// the ready event fires. See #6781
 407	readyWait: 1,
 408
 409	// Hold (or release) the ready event
 410	holdReady: function( hold ) {
 411		if ( hold ) {
 412			jQuery.readyWait++;
 413		} else {
 414			jQuery.ready( true );
 415		}
 416	},
 417
 418	// Handle when the DOM is ready
 419	ready: function( wait ) {
 420		// Either a released hold or an DOMready/load event and not yet ready
 421		if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
 422			// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
 423			if ( !document.body ) {
 424				return setTimeout( jQuery.ready, 1 );
 425			}
 426
 427			// Remember that the DOM is ready
 428			jQuery.isReady = true;
 429
 430			// If a normal DOM Ready event fired, decrement, and wait if need be
 431			if ( wait !== true && --jQuery.readyWait > 0 ) {
 432				return;
 433			}
 434
 435			// If there are functions bound, to execute
 436			readyList.resolveWith( document, [ jQuery ] );
 437
 438			// Trigger any bound ready events
 439			if ( jQuery.fn.trigger ) {
 440				jQuery( document ).trigger( "ready" ).unbind( "ready" );
 441			}
 442		}
 443	},
 444
 445	bindReady: function() {
 446		if ( readyList ) {
 447			return;
 448		}
 449
 450		readyList = jQuery._Deferred();
 451
 452		// Catch cases where $(document).ready() is called after the
 453		// browser event has already occurred.
 454		if ( document.readyState === "complete" ) {
 455			// Handle it asynchronously to allow scripts the opportunity to delay ready
 456			return setTimeout( jQuery.ready, 1 );
 457		}
 458
 459		// Mozilla, Opera and webkit nightlies currently support this event
 460		if ( document.addEventListener ) {
 461			// Use the handy event callback
 462			document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
 463
 464			// A fallback to window.onload, that will always work
 465			window.addEventListener( "load", jQuery.ready, false );
 466
 467		// If IE event model is used
 468		} else if ( document.attachEvent ) {
 469			// ensure firing before onload,
 470			// maybe late but safe also for iframes
 471			document.attachEvent( "onreadystatechange", DOMContentLoaded );
 472
 473			// A fallback to window.onload, that will always work
 474			window.attachEvent( "onload", jQuery.ready );
 475
 476			// If IE and not a frame
 477			// continually check to see if the document is ready
 478			var toplevel = false;
 479
 480			try {
 481				toplevel = window.frameElement == null;
 482			} catch(e) {}
 483
 484			if ( document.documentElement.doScroll && toplevel ) {
 485				doScrollCheck();
 486			}
 487		}
 488	},
 489
 490	// See test/unit/core.js for details concerning isFunction.
 491	// Since version 1.3, DOM methods and functions like alert
 492	// aren't supported. They return false on IE (#2968).
 493	isFunction: function( obj ) {
 494		return jQuery.type(obj) === "function";
 495	},
 496
 497	isArray: Array.isArray || function( obj ) {
 498		return jQuery.type(obj) === "array";
 499	},
 500
 501	// A crude way of determining if an object is a window
 502	isWindow: function( obj ) {
 503		return obj && typeof obj === "object" && "setInterval" in obj;
 504	},
 505
 506	isNaN: function( obj ) {
 507		return obj == null || !rdigit.test( obj ) || isNaN( obj );
 508	},
 509
 510	type: function( obj ) {
 511		return obj == null ?
 512			String( obj ) :
 513			class2type[ toString.call(obj) ] || "object";
 514	},
 515
 516	isPlainObject: function( obj ) {
 517		// Must be an Object.
 518		// Because of IE, we also have to check the presence of the constructor property.
 519		// Make sure that DOM nodes and window objects don't pass through, as well
 520		if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
 521			return false;
 522		}
 523
 524		// Not own constructor property must be Object
 525		if ( obj.constructor &&
 526			!hasOwn.call(obj, "constructor") &&
 527			!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
 528			return false;
 529		}
 530
 531		// Own properties are enumerated firstly, so to speed up,
 532		// if last one is own, then all properties are own.
 533
 534		var key;
 535		for ( key in obj ) {}
 536
 537		return key === undefined || hasOwn.call( obj, key );
 538	},
 539
 540	isEmptyObject: function( obj ) {
 541		for ( var name in obj ) {
 542			return false;
 543		}
 544		return true;
 545	},
 546
 547	error: function( msg ) {
 548		throw msg;
 549	},
 550
 551	parseJSON: function( data ) {
 552		if ( typeof data !== "string" || !data ) {
 553			return null;
 554		}
 555
 556		// Make sure leading/trailing whitespace is removed (IE can't handle it)
 557		data = jQuery.trim( data );
 558
 559		// Attempt to parse using the native JSON parser first
 560		if ( window.JSON && window.JSON.parse ) {
 561			return window.JSON.parse( data );
 562		}
 563
 564		// Make sure the incoming data is actual JSON
 565		// Logic borrowed from http://json.org/json2.js
 566		if ( rvalidchars.test( data.replace( rvalidescape, "@" )
 567			.replace( rvalidtokens, "]" )
 568			.replace( rvalidbraces, "")) ) {
 569
 570			return (new Function( "return " + data ))();
 571
 572		}
 573		jQuery.error( "Invalid JSON: " + data );
 574	},
 575
 576	// Cross-browser xml parsing
 577	// (xml & tmp used internally)
 578	parseXML: function( data , xml , tmp ) {
 579
 580		if ( window.DOMParser ) { // Standard
 581			tmp = new DOMParser();
 582			xml = tmp.parseFromString( data , "text/xml" );
 583		} else { // IE
 584			xml = new ActiveXObject( "Microsoft.XMLDOM" );
 585			xml.async = "false";
 586			xml.loadXML( data );
 587		}
 588
 589		tmp = xml.documentElement;
 590
 591		if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
 592			jQuery.error( "Invalid XML: " + data );
 593		}
 594
 595		return xml;
 596	},
 597
 598	noop: function() {},
 599
 600	// Evaluates a script in a global context
 601	// Workarounds based on findings by Jim Driscoll
 602	// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
 603	globalEval: function( data ) {
 604		if ( data && rnotwhite.test( data ) ) {
 605			// We use execScript on Internet Explorer
 606			// We use an anonymous function so that context is window
 607			// rather than jQuery in Firefox
 608			( window.execScript || function( data ) {
 609				window[ "eval" ].call( window, data );
 610			} )( data );
 611		}
 612	},
 613
 614	// Converts a dashed string to camelCased string;
 615	// Used by both the css and data modules
 616	camelCase: function( string ) {
 617		return string.replace( rdashAlpha, fcamelCase );
 618	},
 619
 620	nodeName: function( elem, name ) {
 621		return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
 622	},
 623
 624	// args is for internal usage only
 625	each: function( object, callback, args ) {
 626		var name, i = 0,
 627			length = object.length,
 628			isObj = length === undefined || jQuery.isFunction( object );
 629
 630		if ( args ) {
 631			if ( isObj ) {
 632				for ( name in object ) {
 633					if ( callback.apply( object[ name ], args ) === false ) {
 634						break;
 635					}
 636				}
 637			} else {
 638				for ( ; i < length; ) {
 639					if ( callback.apply( object[ i++ ], args ) === false ) {
 640						break;
 641					}
 642				}
 643			}
 644
 645		// A special, fast, case for the most common use of each
 646		} else {
 647			if ( isObj ) {
 648				for ( name in object ) {
 649					if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
 650						break;
 651					}
 652				}
 653			} else {
 654				for ( ; i < length; ) {
 655					if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
 656						break;
 657					}
 658				}
 659			}
 660		}
 661
 662		return object;
 663	},
 664
 665	// Use native String.trim function wherever possible
 666	trim: trim ?
 667		function( text ) {
 668			return text == null ?
 669				"" :
 670				trim.call( text );
 671		} :
 672
 673		// Otherwise use our own trimming functionality
 674		function( text ) {
 675			return text == null ?
 676				"" :
 677				text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
 678		},
 679
 680	// results is for internal usage only
 681	makeArray: function( array, results ) {
 682		var ret = results || [];
 683
 684		if ( array != null ) {
 685			// The window, strings (and functions) also have 'length'
 686			// The extra typeof function check is to prevent crashes
 687			// in Safari 2 (See: #3039)
 688			// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
 689			var type = jQuery.type( array );
 690
 691			if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
 692				push.call( ret, array );
 693			} else {
 694				jQuery.merge( ret, array );
 695			}
 696		}
 697
 698		return ret;
 699	},
 700
 701	inArray: function( elem, array ) {
 702
 703		if ( indexOf ) {
 704			return indexOf.call( array, elem );
 705		}
 706
 707		for ( var i = 0, length = array.length; i < length; i++ ) {
 708			if ( array[ i ] === elem ) {
 709				return i;
 710			}
 711		}
 712
 713		return -1;
 714	},
 715
 716	merge: function( first, second ) {
 717		var i = first.length,
 718			j = 0;
 719
 720		if ( typeof second.length === "number" ) {
 721			for ( var l = second.length; j < l; j++ ) {
 722				first[ i++ ] = second[ j ];
 723			}
 724
 725		} else {
 726			while ( second[j] !== undefined ) {
 727				first[ i++ ] = second[ j++ ];
 728			}
 729		}
 730
 731		first.length = i;
 732
 733		return first;
 734	},
 735
 736	grep: function( elems, callback, inv ) {
 737		var ret = [], retVal;
 738		inv = !!inv;
 739
 740		// Go through the array, only saving the items
 741		// that pass the validator function
 742		for ( var i = 0, length = elems.length; i < length; i++ ) {
 743			retVal = !!callback( elems[ i ], i );
 744			if ( inv !== retVal ) {
 745				ret.push( elems[ i ] );
 746			}
 747		}
 748
 749		return ret;
 750	},
 751
 752	// arg is for internal usage only
 753	map: function( elems, callback, arg ) {
 754		var value, key, ret = [],
 755			i = 0,
 756			length = elems.length,
 757			// jquery objects are treated as arrays
 758			isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
 759
 760		// Go through the array, translating each of the items to their
 761		if ( isArray ) {
 762			for ( ; i < length; i++ ) {
 763				value = callback( elems[ i ], i, arg );
 764
 765				if ( value != null ) {
 766					ret[ ret.length ] = value;
 767				}
 768			}
 769
 770		// Go through every key on the object,
 771		} else {
 772			for ( key in elems ) {
 773				value = callback( elems[ key ], key, arg );
 774
 775				if ( value != null ) {
 776					ret[ ret.length ] = value;
 777				}
 778			}
 779		}
 780
 781		// Flatten any nested arrays
 782		return ret.concat.apply( [], ret );
 783	},
 784
 785	// A global GUID counter for objects
 786	guid: 1,
 787
 788	// Bind a function to a context, optionally partially applying any
 789	// arguments.
 790	proxy: function( fn, context ) {
 791		if ( typeof context === "string" ) {
 792			var tmp = fn[ context ];
 793			context = fn;
 794			fn = tmp;
 795		}
 796
 797		// Quick check to determine if target is callable, in the spec
 798		// this throws a TypeError, but we will just return undefined.
 799		if ( !jQuery.isFunction( fn ) ) {
 800			return undefined;
 801		}
 802
 803		// Simulated bind
 804		var args = slice.call( arguments, 2 ),
 805			proxy = function() {
 806				return fn.apply( context, args.concat( slice.call( arguments ) ) );
 807			};
 808
 809		// Set the guid of unique handler to the same of original handler, so it can be removed
 810		proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
 811
 812		return proxy;
 813	},
 814
 815	// Mutifunctional method to get and set values to a collection
 816	// The value/s can optionally be executed if it's a function
 817	access: function( elems, key, value, exec, fn, pass ) {
 818		var length = elems.length;
 819
 820		// Setting many attributes
 821		if ( typeof key === "object" ) {
 822			for ( var k in key ) {
 823				jQuery.access( elems, k, key[k], exec, fn, value );
 824			}
 825			return elems;
 826		}
 827
 828		// Setting one attribute
 829		if ( value !== undefined ) {
 830			// Optionally, function values get executed if exec is true
 831			exec = !pass && exec && jQuery.isFunction(value);
 832
 833			for ( var i = 0; i < length; i++ ) {
 834				fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
 835			}
 836
 837			return elems;
 838		}
 839
 840		// Getting an attribute
 841		return length ? fn( elems[0], key ) : undefined;
 842	},
 843
 844	now: function() {
 845		return (new Date()).getTime();
 846	},
 847
 848	// Use of jQuery.browser is frowned upon.
 849	// More details: http://docs.jquery.com/Utilities/jQuery.browser
 850	uaMatch: function( ua ) {
 851		ua = ua.toLowerCase();
 852
 853		var match = rwebkit.exec( ua ) ||
 854			ropera.exec( ua ) ||
 855			rmsie.exec( ua ) ||
 856			ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
 857			[];
 858
 859		return { browser: match[1] || "", version: match[2] || "0" };
 860	},
 861
 862	sub: function() {
 863		function jQuerySub( selector, context ) {
 864			return new jQuerySub.fn.init( selector, context );
 865		}
 866		jQuery.extend( true, jQuerySub, this );
 867		jQuerySub.superclass = this;
 868		jQuerySub.fn = jQuerySub.prototype = this();
 869		jQuerySub.fn.constructor = jQuerySub;
 870		jQuerySub.sub = this.sub;
 871		jQuerySub.fn.init = function init( selector, context ) {
 872			if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
 873				context = jQuerySub( context );
 874			}
 875
 876			return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
 877		};
 878		jQuerySub.fn.init.prototype = jQuerySub.fn;
 879		var rootjQuerySub = jQuerySub(document);
 880		return jQuerySub;
 881	},
 882
 883	browser: {}
 884});
 885
 886// Populate the class2type map
 887jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
 888	class2type[ "[object " + name + "]" ] = name.toLowerCase();
 889});
 890
 891browserMatch = jQuery.uaMatch( userAgent );
 892if ( browserMatch.browser ) {
 893	jQuery.browser[ browserMatch.browser ] = true;
 894	jQuery.browser.version = browserMatch.version;
 895}
 896
 897// Deprecated, use jQuery.browser.webkit instead
 898if ( jQuery.browser.webkit ) {
 899	jQuery.browser.safari = true;
 900}
 901
 902// IE doesn't match non-breaking spaces with \s
 903if ( rnotwhite.test( "\xA0" ) ) {
 904	trimLeft = /^[\s\xA0]+/;
 905	trimRight = /[\s\xA0]+$/;
 906}
 907
 908// All jQuery objects should point back to these
 909rootjQuery = jQuery(document);
 910
 911// Cleanup functions for the document ready method
 912if ( document.addEventListener ) {
 913	DOMContentLoaded = function() {
 914		document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
 915		jQuery.ready();
 916	};
 917
 918} else if ( document.attachEvent ) {
 919	DOMContentLoaded = function() {
 920		// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
 921		if ( document.readyState === "complete" ) {
 922			document.detachEvent( "onreadystatechange", DOMContentLoaded );
 923			jQuery.ready();
 924		}
 925	};
 926}
 927
 928// The DOM ready check for Internet Explorer
 929function doScrollCheck() {
 930	if ( jQuery.isReady ) {
 931		return;
 932	}
 933
 934	try {
 935		// If IE is used, use the trick by Diego Perini
 936		// http://javascript.nwbox.com/IEContentLoaded/
 937		document.documentElement.doScroll("left");
 938	} catch(e) {
 939		setTimeout( doScrollCheck, 1 );
 940		return;
 941	}
 942
 943	// and execute any waiting functions
 944	jQuery.ready();
 945}
 946
 947return jQuery;
 948
 949})();
 950
 951
 952var // Promise methods
 953	promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
 954	// Static reference to slice
 955	sliceDeferred = [].slice;
 956
 957jQuery.extend({
 958	// Create a simple deferred (one callbacks list)
 959	_Deferred: function() {
 960		var // callbacks list
 961			callbacks = [],
 962			// stored [ context , args ]
 963			fired,
 964			// to avoid firing when already doing so
 965			firing,
 966			// flag to know if the deferred has been cancelled
 967			cancelled,
 968			// the deferred itself
 969			deferred  = {
 970
 971				// done( f1, f2, ...)
 972				done: function() {
 973					if ( !cancelled ) {
 974						var args = arguments,
 975							i,
 976							length,
 977							elem,
 978							type,
 979							_fired;
 980						if ( fired ) {
 981							_fired = fired;
 982							fired = 0;
 983						}
 984						for ( i = 0, length = args.length; i < length; i++ ) {
 985							elem = args[ i ];
 986							type = jQuery.type( elem );
 987							if ( type === "array" ) {
 988								deferred.done.apply( deferred, elem );
 989							} else if ( type === "function" ) {
 990								callbacks.push( elem );
 991							}
 992						}
 993						if ( _fired ) {
 994							deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
 995						}
 996					}
 997					return this;
 998				},
 999
1000				// resolve with given context and args
1001				resolveWith: function( context, args ) {
1002					if ( !cancelled && !fired && !firing ) {
1003						// make sure args are available (#8421)
1004						args = args || [];
1005						firing = 1;
1006						try {
1007							while( callbacks[ 0 ] ) {
1008								callbacks.shift().apply( context, args );
1009							}
1010						}
1011						finally {
1012							fired = [ context, args ];
1013							firing = 0;
1014						}
1015					}
1016					return this;
1017				},
1018
1019				// resolve with this as context and given arguments
1020				resolve: function() {
1021					deferred.resolveWith( this, arguments );
1022					return this;
1023				},
1024
1025				// Has this deferred been resolved?
1026				isResolved: function() {
1027					return !!( firing || fired );
1028				},
1029
1030				// Cancel
1031				cancel: function() {
1032					cancelled = 1;
1033					callbacks = [];
1034					return this;
1035				}
1036			};
1037
1038		return deferred;
1039	},
1040
1041	// Full fledged deferred (two callbacks list)
1042	Deferred: function( func ) {
1043		var deferred = jQuery._Deferred(),
1044			failDeferred = jQuery._Deferred(),
1045			promise;
1046		// Add errorDeferred methods, then and promise
1047		jQuery.extend( deferred, {
1048			then: function( doneCallbacks, failCallbacks ) {
1049				deferred.done( doneCallbacks ).fail( failCallbacks );
1050				return this;
1051			},
1052			always: function() {
1053				return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
1054			},
1055			fail: failDeferred.done,
1056			rejectWith: failDeferred.resolveWith,
1057			reject: failDeferred.resolve,
1058			isRejected: failDeferred.isResolved,
1059			pipe: function( fnDone, fnFail ) {
1060				return jQuery.Deferred(function( newDefer ) {
1061					jQuery.each( {
1062						done: [ fnDone, "resolve" ],
1063						fail: [ fnFail, "reject" ]
1064					}, function( handler, data ) {
1065						var fn = data[ 0 ],
1066							action = data[ 1 ],
1067							returned;
1068						if ( jQuery.isFunction( fn ) ) {
1069							deferred[ handler ](function() {
1070								returned = fn.apply( this, arguments );
1071								if ( returned && jQuery.isFunction( returned.promise ) ) {
1072									returned.promise().then( newDefer.resolve, newDefer.reject );
1073								} else {
1074									newDefer[ action ]( returned );
1075								}
1076							});
1077						} else {
1078							deferred[ handler ]( newDefer[ action ] );
1079						}
1080					});
1081				}).promise();
1082			},
1083			// Get a promise for this deferred
1084			// If obj is provided, the promise aspect is added to the object
1085			promise: function( obj ) {
1086				if ( obj == null ) {
1087					if ( promise ) {
1088						return promise;
1089					}
1090					promise = obj = {};
1091				}
1092				var i = promiseMethods.length;
1093				while( i-- ) {
1094					obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
1095				}
1096				return obj;
1097			}
1098		});
1099		// Make sure only one callback list will be used
1100		deferred.done( failDeferred.cancel ).fail( deferred.cancel );
1101		// Unexpose cancel
1102		delete deferred.cancel;
1103		// Call given func if any
1104		if ( func ) {
1105			func.call( deferred, deferred );
1106		}
1107		return deferred;
1108	},
1109
1110	// Deferred helper
1111	when: function( firstParam ) {
1112		var args = arguments,
1113			i = 0,
1114			length = args.length,
1115			count = length,
1116			deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
1117				firstParam :
1118				jQuery.Deferred();
1119		function resolveFunc( i ) {
1120			return function( value ) {
1121				args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1122				if ( !( --count ) ) {
1123					// Strange bug in FF4:
1124					// Values changed onto the arguments object sometimes end up as undefined values
1125					// outside the $.when method. Cloning the object into a fresh array solves the issue
1126					deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
1127				}
1128			};
1129		}
1130		if ( length > 1 ) {
1131			for( ; i < length; i++ ) {
1132				if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
1133					args[ i ].promise().then( resolveFunc(i), deferred.reject );
1134				} else {
1135					--count;
1136				}
1137			}
1138			if ( !count ) {
1139				deferred.resolveWith( deferred, args );
1140			}
1141		} else if ( deferred !== firstParam ) {
1142			deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
1143		}
1144		return deferred.promise();
1145	}
1146});
1147
1148
1149
1150jQuery.support = (function() {
1151
1152	var div = document.createElement( "div" ),
1153		documentElement = document.documentElement,
1154		all,
1155		a,
1156		select,
1157		opt,
1158		input,
1159		marginDiv,
1160		support,
1161		fragment,
1162		body,
1163		testElementParent,
1164		testElement,
1165		testElementStyle,
1166		tds,
1167		events,
1168		eventName,
1169		i,
1170		isSupported;
1171
1172	// Preliminary tests
1173	div.setAttribute("className", "t");
1174	div.innerHTML = "   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
1175
1176	all = div.getElementsByTagName( "*" );
1177	a = div.getElementsByTagName( "a" )[ 0 ];
1178
1179	// Can't get basic test support
1180	if ( !all || !all.length || !a ) {
1181		return {};
1182	}
1183
1184	// First batch of supports tests
1185	select = document.createElement( "select" );
1186	opt = select.appendChild( document.createElement("option") );
1187	input = div.getElementsByTagName( "input" )[ 0 ];
1188
1189	support = {
1190		// IE strips leading whitespace when .innerHTML is used
1191		leadingWhitespace: ( div.firstChild.nodeType === 3 ),
1192
1193		// Make sure that tbody elements aren't automatically inserted
1194		// IE will insert them into empty tables
1195		tbody: !div.getElementsByTagName( "tbody" ).length,
1196
1197		// Make sure that link elements get serialized correctly by innerHTML
1198		// This requires a wrapper element in IE
1199		htmlSerialize: !!div.getElementsByTagName( "link" ).length,
1200
1201		// Get the style information from getAttribute
1202		// (IE uses .cssText instead)
1203		style: /top/.test( a.getAttribute("style") ),
1204
1205		// Make sure that URLs aren't manipulated
1206		// (IE normalizes it by default)
1207		hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
1208
1209		// Make sure that element opacity exists
1210		// (IE uses filter instead)
1211		// Use a regex to work around a WebKit issue. See #5145
1212		opacity: /^0.55$/.test( a.style.opacity ),
1213
1214		// Verify style float existence
1215		// (IE uses styleFloat instead of cssFloat)
1216		cssFloat: !!a.style.cssFloat,
1217
1218		// Make sure that if no value is specified for a checkbox
1219		// that it defaults to "on".
1220		// (WebKit defaults to "" instead)
1221		checkOn: ( input.value === "on" ),
1222
1223		// Make sure that a selected-by-default option has a working selected property.
1224		// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1225		optSelected: opt.selected,
1226
1227		// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1228		getSetAttribute: div.className !== "t",
1229
1230		// Will be defined later
1231		submitBubbles: true,
1232		changeBubbles: true,
1233		focusinBubbles: false,
1234		deleteExpando: true,
1235		noCloneEvent: true,
1236		inlineBlockNeedsLayout: false,
1237		shrinkWrapBlocks: false,
1238		reliableMarginRight: true
1239	};
1240
1241	// Make sure checked status is properly cloned
1242	input.checked = true;
1243	support.noCloneChecked = input.cloneNode( true ).checked;
1244
1245	// Make sure that the options inside disabled selects aren't marked as disabled
1246	// (WebKit marks them as disabled)
1247	select.disabled = true;
1248	support.optDisabled = !opt.disabled;
1249
1250	// Test to see if it's possible to delete an expando from an element
1251	// Fails in Internet Explorer
1252	try {
1253		delete div.test;
1254	} catch( e ) {
1255		support.deleteExpando = false;
1256	}
1257
1258	if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1259		div.attachEvent( "onclick", function() {
1260			// Cloning a node shouldn't copy over any
1261			// bound event handlers (IE does this)
1262			support.noCloneEvent = false;
1263		});
1264		div.cloneNode( true ).fireEvent( "onclick" );
1265	}
1266
1267	// Check if a radio maintains it's value
1268	// after being appended to the DOM
1269	input = document.createElement("input");
1270	input.value = "t";
1271	input.setAttribute("type", "radio");
1272	support.radioValue = input.value === "t";
1273
1274	input.setAttribute("checked", "checked");
1275	div.appendChild( input );
1276	fragment = document.createDocumentFragment();
1277	fragment.appendChild( div.firstChild );
1278
1279	// WebKit doesn't clone checked state correctly in fragments
1280	support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1281
1282	div.innerHTML = "";
1283
1284	// Figure out if the W3C box model works as expected
1285	div.style.width = div.style.paddingLeft = "1px";
1286
1287	body = document.getElementsByTagName( "body" )[ 0 ];
1288	// We use our own, invisible, body unless the body is already present
1289	// in which case we use a div (#9239)
1290	testElement = document.createElement( body ? "div" : "body" );
1291	testElementStyle = {
1292		visibility: "hidden",
1293		width: 0,
1294		height: 0,
1295		border: 0,
1296		margin: 0
1297	};
1298	if ( body ) {
1299		jQuery.extend( testElementStyle, {
1300			position: "absolute",
1301			left: -1000,
1302			top: -1000
1303		});
1304	}
1305	for ( i in testElementStyle ) {
1306		testElement.style[ i ] = testElementStyle[ i ];
1307	}
1308	testElement.appendChild( div );
1309	testElementParent = body || documentElement;
1310	testElementParent.insertBefore( testElement, testElementParent.firstChild );
1311
1312	// Check if a disconnected checkbox will retain its checked
1313	// value of true after appended to the DOM (IE6/7)
1314	support.appendChecked = input.checked;
1315
1316	support.boxModel = div.offsetWidth === 2;
1317
1318	if ( "zoom" in div.style ) {
1319		// Check if natively block-level elements act like inline-block
1320		// elements when setting their display to 'inline' and giving
1321		// them layout
1322		// (IE < 8 does this)
1323		div.style.display = "inline";
1324		div.style.zoom = 1;
1325		support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
1326
1327		// Check if elements with layout shrink-wrap their children
1328		// (IE 6 does this)
1329		div.style.display = "";
1330		div.innerHTML = "<div style='width:4px;'></div>";
1331		support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
1332	}
1333
1334	div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1335	tds = div.getElementsByTagName( "td" );
1336
1337	// Check if table cells still have offsetWidth/Height when they are set
1338	// to display:none and there are still other visible table cells in a
1339	// table row; if so, offsetWidth/Height are not reliable for use when
1340	// determining if an element has been hidden directly using
1341	// display:none (it is still safe to use offsets if a parent element is
1342	// hidden; don safety goggles and see bug #4512 for more information).
1343	// (only IE 8 fails this test)
1344	isSupported = ( tds[ 0 ].offsetHeight === 0 );
1345
1346	tds[ 0 ].style.display = "";
1347	tds[ 1 ].style.display = "none";
1348
1349	// Check if empty table cells still have offsetWidth/Height
1350	// (IE < 8 fail this test)
1351	support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1352	div.innerHTML = "";
1353
1354	// Check if div with explicit width and no margin-right incorrectly
1355	// gets computed margin-right based on width of container. For more
1356	// info see bug #3333
1357	// Fails in WebKit before Feb 2011 nightlies
1358	// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1359	if ( document.defaultView && document.defaultView.getComputedStyle ) {
1360		marginDiv = document.createElement( "div" );
1361		marginDiv.style.width = "0";
1362		marginDiv.style.marginRight = "0";
1363		div.appendChild( marginDiv );
1364		support.reliableMarginRight =
1365			( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
1366	}
1367
1368	// Remove the body element we added
1369	testElement.innerHTML = "";
1370	testElementParent.removeChild( testElement );
1371
1372	// Technique from Juriy Zaytsev
1373	// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
1374	// We only care about the case where non-standard event systems
1375	// are used, namely in IE. Short-circuiting here helps us to
1376	// avoid an eval call (in setAttribute) which can cause CSP
1377	// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1378	if ( div.attachEvent ) {
1379		for( i in {
1380			submit: 1,
1381			change: 1,
1382			focusin: 1
1383		} ) {
1384			eventName = "on" + i;
1385			isSupported = ( eventName in div );
1386			if ( !isSupported ) {
1387				div.setAttribute( eventName, "return;" );
1388				isSupported = ( typeof div[ eventName ] === "function" );
1389			}
1390			support[ i + "Bubbles" ] = isSupported;
1391		}
1392	}
1393
1394	// Null connected elements to avoid leaks in IE
1395	testElement = fragment = select = opt = body = marginDiv = div = input = null;
1396
1397	return support;
1398})();
1399
1400// Keep track of boxModel
1401jQuery.boxModel = jQuery.support.boxModel;
1402
1403
1404
1405
1406var rbrace = /^(?:\{.*\}|\[.*\])$/,
1407	rmultiDash = /([a-z])([A-Z])/g;
1408
1409jQuery.extend({
1410	cache: {},
1411
1412	// Please use with caution
1413	uuid: 0,
1414
1415	// Unique for each copy of jQuery on the page
1416	// Non-digits removed to match rinlinejQuery
1417	expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1418
1419	// The following elements throw uncatchable exceptions if you
1420	// attempt to add expando properties to them.
1421	noData: {
1422		"embed": true,
1423		// Ban all objects except for Flash (which handle expandos)
1424		"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1425		"applet": true
1426	},
1427
1428	hasData: function( elem ) {
1429		elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1430
1431		return !!elem && !isEmptyDataObject( elem );
1432	},
1433
1434	data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1435		if ( !jQuery.acceptData( elem ) ) {
1436			return;
1437		}
1438
1439		var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
1440
1441			// We have to handle DOM nodes and JS objects differently because IE6-7
1442			// can't GC object references properly across the DOM-JS boundary
1443			isNode = elem.nodeType,
1444
1445			// Only DOM nodes need the global jQuery cache; JS object data is
1446			// attached directly to the object so GC can occur automatically
1447			cache = isNode ? jQuery.cache : elem,
1448
1449			// Only defining an ID for JS objects if its cache already exists allows
1450			// the code to shortcut on the same path as a DOM node with no cache
1451			id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
1452
1453		// Avoid doing any more work than we need to when trying to get data on an
1454		// object that has no data at all
1455		if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
1456			return;
1457		}
1458
1459		if ( !id ) {
1460			// Only DOM nodes need a new unique ID for each element since their data
1461			// ends up in the global cache
1462			if ( isNode ) {
1463				elem[ jQuery.expando ] = id = ++jQuery.uuid;
1464			} else {
1465				id = jQuery.expando;
1466			}
1467		}
1468
1469		if ( !cache[ id ] ) {
1470			cache[ id ] = {};
1471
1472			// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1473			// metadata on plain JS objects when the object is serialized using
1474			// JSON.stringify
1475			if ( !isNode ) {
1476				cache[ id ].toJSON = jQuery.noop;
1477			}
1478		}
1479
1480		// An object can be passed to jQuery.data instead of a key/value pair; this gets
1481		// shallow copied over onto the existing cache
1482		if ( typeof name === "object" || typeof name === "function" ) {
1483			if ( pvt ) {
1484				cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
1485			} else {
1486				cache[ id ] = jQuery.extend(cache[ id ], name);
1487			}
1488		}
1489
1490		thisCache = cache[ id ];
1491
1492		// Internal jQuery data is stored in a separate object inside the object's data
1493		// cache in order to avoid key collisions between internal data and user-defined
1494		// data
1495		if ( pvt ) {
1496			if ( !thisCache[ internalKey ] ) {
1497				thisCache[ internalKey ] = {};
1498			}
1499
1500			thisCache = thisCache[ internalKey ];
1501		}
1502
1503		if ( data !== undefined ) {
1504			thisCache[ jQuery.camelCase( name ) ] = data;
1505		}
1506
1507		// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
1508		// not attempt to inspect the internal events object using jQuery.data, as this
1509		// internal data object is undocumented and subject to change.
1510		if ( name === "events" && !thisCache[name] ) {
1511			return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1512		}
1513
1514		return getByName ? 
1515			// Check for both converted-to-camel and non-converted data property names
1516			thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
1517			thisCache;
1518	},
1519
1520	removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1521		if ( !jQuery.acceptData( elem ) ) {
1522			return;
1523		}
1524
1525		var internalKey = jQuery.expando, isNode = elem.nodeType,
1526
1527			// See jQuery.data for more information
1528			cache = isNode ? jQuery.cache : elem,
1529
1530			// See jQuery.data for more information
1531			id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1532
1533		// If there is already no cache entry for this object, there is no
1534		// purpose in continuing
1535		if ( !cache[ id ] ) {
1536			return;
1537		}
1538
1539		if ( name ) {
1540			var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
1541
1542			if ( thisCache ) {
1543				delete thisCache[ name ];
1544
1545				// If there is no data left in the cache, we want to continue
1546				// and let the cache object itself get destroyed
1547				if ( !isEmptyDataObject(thisCache) ) {
1548					return;
1549				}
1550			}
1551		}
1552
1553		// See jQuery.data for more information
1554		if ( pvt ) {
1555			delete cache[ id ][ internalKey ];
1556
1557			// Don't destroy the parent cache unless the internal data object
1558			// had been the only thing left in it
1559			if ( !isEmptyDataObject(cache[ id ]) ) {
1560				return;
1561			}
1562		}
1563
1564		var internalCache = cache[ id ][ internalKey ];
1565
1566		// Browsers that fail expando deletion also refuse to delete expandos on
1567		// the window, but it will allow it on all other JS objects; other browsers
1568		// don't care
1569		if ( jQuery.support.deleteExpando || cache != window ) {
1570			delete cache[ id ];
1571		} else {
1572			cache[ id ] = null;
1573		}
1574
1575		// We destroyed the entire user cache at once because it's faster than
1576		// iterating through each key, but we need to continue to persist internal
1577		// data if it existed
1578		if ( internalCache ) {
1579			cache[ id ] = {};
1580			// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1581			// metadata on plain JS objects when the object is serialized using
1582			// JSON.stringify
1583			if ( !isNode ) {
1584				cache[ id ].toJSON = jQuery.noop;
1585			}
1586
1587			cache[ id ][ internalKey ] = internalCache;
1588
1589		// Otherwise, we need to eliminate the expando on the node to avoid
1590		// false lookups in the cache for entries that no longer exist
1591		} else if ( isNode ) {
1592			// IE does not allow us to delete expando properties from nodes,
1593			// nor does it have a removeAttribute function on Document nodes;
1594			// we must handle all of these cases
1595			if ( jQuery.support.deleteExpando ) {
1596				delete elem[ jQuery.expando ];
1597			} else if ( elem.removeAttribute ) {
1598				elem.removeAttribute( jQuery.expando );
1599			} else {
1600				elem[ jQuery.expando ] = null;
1601			}
1602		}
1603	},
1604
1605	// For internal use only.
1606	_data: function( elem, name, data ) {
1607		return jQuery.data( elem, name, data, true );
1608	},
1609
1610	// A method for determining if a DOM node can handle the data expando
1611	acceptData: function( elem ) {
1612		if ( elem.nodeName ) {
1613			var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
1614
1615			if ( match ) {
1616				return !(match === true || elem.getAttribute("classid") !== match);
1617			}
1618		}
1619
1620		return true;
1621	}
1622});
1623
1624jQuery.fn.extend({
1625	data: function( key, value ) {
1626		var data = null;
1627
1628		if ( typeof key === "undefined" ) {
1629			if ( this.length ) {
1630				data = jQuery.data( this[0] );
1631
1632				if ( this[0].nodeType === 1 ) {
1633			    var attr = this[0].attributes, name;
1634					for ( var i = 0, l = attr.length; i < l; i++ ) {
1635						name = attr[i].name;
1636
1637						if ( name.indexOf( "data-" ) === 0 ) {
1638							name = jQuery.camelCase( name.substring(5) );
1639
1640							dataAttr( this[0], name, data[ name ] );
1641						}
1642					}
1643				}
1644			}
1645
1646			return data;
1647
1648		} else if ( typeof key === "object" ) {
1649			return this.each(function() {
1650				jQuery.data( this, key );
1651			});
1652		}
1653
1654		var parts = key.split(".");
1655		parts[1] = parts[1] ? "." + parts[1] : "";
1656
1657		if ( value === undefined ) {
1658			data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1659
1660			// Try to fetch any internally stored data first
1661			if ( data === undefined && this.length ) {
1662				data = jQuery.data( this[0], key );
1663				data = dataAttr( this[0], key, data );
1664			}
1665
1666			return data === undefined && parts[1] ?
1667				this.data( parts[0] ) :
1668				data;
1669
1670		} else {
1671			return this.each(function() {
1672				var $this = jQuery( this ),
1673					args = [ parts[0], value ];
1674
1675				$this.triggerHandler( "setData" + parts[1] + "!", args );
1676				jQuery.data( this, key, value );
1677				$this.triggerHandler( "changeData" + parts[1] + "!", args );
1678			});
1679		}
1680	},
1681
1682	removeData: function( key ) {
1683		return this.each(function() {
1684			jQuery.removeData( this, key );
1685		});
1686	}
1687});
1688
1689function dataAttr( elem, key, data ) {
1690	// If nothing was found internally, try to fetch any
1691	// data from the HTML5 data-* attribute
1692	if ( data === undefined && elem.nodeType === 1 ) {
1693		var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
1694
1695		data = elem.getAttribute( name );
1696
1697		if ( typeof data === "string" ) {
1698			try {
1699				data = data === "true" ? true :
1700				data === "false" ? false :
1701				data === "null" ? null :
1702				!jQuery.isNaN( data ) ? parseFloat( data ) :
1703					rbrace.test( data ) ? jQuery.parseJSON( data ) :
1704					data;
1705			} catch( e ) {}
1706
1707			// Make sure we set the data so it isn't changed later
1708			jQuery.data( elem, key, data );
1709
1710		} else {
1711			data = undefined;
1712		}
1713	}
1714
1715	return data;
1716}
1717
1718// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
1719// property to be considered empty objects; this property always exists in
1720// order to make sure JSON.stringify does not expose internal metadata
1721function isEmptyDataObject( obj ) {
1722	for ( var name in obj ) {
1723		if ( name !== "toJSON" ) {
1724			return false;
1725		}
1726	}
1727
1728	return true;
1729}
1730
1731
1732
1733
1734function handleQueueMarkDefer( elem, type, src ) {
1735	var deferDataKey = type + "defer",
1736		queueDataKey = type + "queue",
1737		markDataKey = type + "mark",
1738		defer = jQuery.data( elem, deferDataKey, undefined, true );
1739	if ( defer &&
1740		( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
1741		( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
1742		// Give room for hard-coded callbacks to fire first
1743		// and eventually mark/queue something else on the element
1744		setTimeout( function() {
1745			if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
1746				!jQuery.data( elem, markDataKey, undefined, true ) ) {
1747				jQuery.removeData( elem, deferDataKey, true );
1748				defer.resolve();
1749			}
1750		}, 0 );
1751	}
1752}
1753
1754jQuery.extend({
1755
1756	_mark: function( elem, type ) {
1757		if ( elem ) {
1758			type = (type || "fx") + "mark";
1759			jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
1760		}
1761	},
1762
1763	_unmark: function( force, elem, type ) {
1764		if ( force !== true ) {
1765			type = elem;
1766			elem = force;
1767			force = false;
1768		}
1769		if ( elem ) {
1770			type = type || "fx";
1771			var key = type + "mark",
1772				count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
1773			if ( count ) {
1774				jQuery.data( elem, key, count, true );
1775			} else {
1776				jQuery.removeData( elem, key, true );
1777				handleQueueMarkDefer( elem, type, "mark" );
1778			}
1779		}
1780	},
1781
1782	queue: function( elem, type, data ) {
1783		if ( elem ) {
1784			type = (type || "fx") + "queue";
1785			var q = jQuery.data( elem, type, undefined, true );
1786			// Speed up dequeue by getting out quickly if this is just a lookup
1787			if ( data ) {
1788				if ( !q || jQuery.isArray(data) ) {
1789					q = jQuery.data( elem, type, jQuery.makeArray(data), true );
1790				} else {
1791					q.push( data );
1792				}
1793			}
1794			return q || [];
1795		}
1796	},
1797
1798	dequeue: function( elem, type ) {
1799		type = type || "fx";
1800
1801		var queue = jQuery.queue( elem, type ),
1802			fn = queue.shift(),
1803			defer;
1804
1805		// If the fx queue is dequeued, always remove the progress sentinel
1806		if ( fn === "inprogress" ) {
1807			fn = queue.shift();
1808		}
1809
1810		if ( fn ) {
1811			// Add a progress sentinel to prevent the fx queue from being
1812			// automatically dequeued
1813			if ( type === "fx" ) {
1814				queue.unshift("inprogress");
1815			}
1816
1817			fn.call(elem, function() {
1818				jQuery.dequeue(elem, type);
1819			});
1820		}
1821
1822		if ( !queue.length ) {
1823			jQuery.removeData( elem, type + "queue", true );
1824			handleQueueMarkDefer( elem, type, "queue" );
1825		}
1826	}
1827});
1828
1829jQuery.fn.extend({
1830	queue: function( type, data ) {
1831		if ( typeof type !== "string" ) {
1832			data = type;
1833			type = "fx";
1834		}
1835
1836		if ( data === undefined ) {
1837			return jQuery.queue( this[0], type );
1838		}
1839		return this.each(function() {
1840			var queue = jQuery.queue( this, type, data );
1841
1842			if ( type === "fx" && queue[0] !== "inprogress" ) {
1843				jQuery.dequeue( this, type );
1844			}
1845		});
1846	},
1847	dequeue: function( type ) {
1848		return this.each(function() {
1849			jQuery.dequeue( this, type );
1850		});
1851	},
1852	// Based off of the plugin by Clint Helfers, with permission.
1853	// http://blindsignals.com/index.php/2009/07/jquery-delay/
1854	delay: function( time, type ) {
1855		time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
1856		type = type || "fx";
1857
1858		return this.queue( type, function() {
1859			var elem = this;
1860			setTimeout(function() {
1861				jQuery.dequeue( elem, type );
1862			}, time );
1863		});
1864	},
1865	clearQueue: function( type ) {
1866	

Large files files are truncated, but you can click here to view the full file