PageRenderTime 20ms CodeModel.GetById 135ms app.highlight 617ms RepoModel.GetById 24ms app.codeStats 4ms

/js/lib/jquery-1.5.1.js

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 8316 lines | 5778 code | 1515 blank | 1023 comment | 1666 complexity | 416c4251d4835e7a5891977133e4173e MD5 | raw file

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

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

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