PageRenderTime 471ms CodeModel.GetById 233ms app.highlight 93ms RepoModel.GetById 90ms app.codeStats 6ms

/jquery/jquery.source.js

https://code.google.com/p/jq-watermark/
JavaScript | 7179 lines | 5151 code | 1289 blank | 739 comment | 1426 complexity | 42c61c851258b620bc817383d07a2f58 MD5 | raw file

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

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

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