+/*!\r
+ * jQuery JavaScript Library v1.7.2\r
+ * http://jquery.com/\r
+ *\r
+ * Copyright 2011, John Resig\r
+ * Dual licensed under the MIT or GPL Version 2 licenses.\r
+ * http://jquery.org/license\r
+ *\r
+ * Includes Sizzle.js\r
+ * http://sizzlejs.com/\r
+ * Copyright 2011, The Dojo Foundation\r
+ * Released under the MIT, BSD, and GPL Licenses.\r
+ *\r
+ * Date: Wed Mar 21 12:46:34 2012 -0700\r
+ */\r
+(function( window, undefined ) {\r
+\r
+// Use the correct document accordingly with window argument (sandbox)\r
+var document = window.document,\r
+ navigator = window.navigator,\r
+ location = window.location;\r
+var jQuery = (function() {\r
+\r
+// Define a local copy of jQuery\r
+var jQuery = function( selector, context ) {\r
+ // The jQuery object is actually just the init constructor 'enhanced'\r
+ return new jQuery.fn.init( selector, context, rootjQuery );\r
+ },\r
+\r
+ // Map over jQuery in case of overwrite\r
+ _jQuery = window.jQuery,\r
+\r
+ // Map over the $ in case of overwrite\r
+ _$ = window.$,\r
+\r
+ // A central reference to the root jQuery(document)\r
+ rootjQuery,\r
+\r
+ // A simple way to check for HTML strings or ID strings\r
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\r
+ quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,\r
+\r
+ // Check if a string has a non-whitespace character in it\r
+ rnotwhite = /\S/,\r
+\r
+ // Used for trimming whitespace\r
+ trimLeft = /^\s+/,\r
+ trimRight = /\s+$/,\r
+\r
+ // Match a standalone tag\r
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,\r
+\r
+ // JSON RegExp\r
+ rvalidchars = /^[\],:{}\s]*$/,\r
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,\r
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,\r
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,\r
+\r
+ // Useragent RegExp\r
+ rwebkit = /(webkit)[ \/]([\w.]+)/,\r
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,\r
+ rmsie = /(msie) ([\w.]+)/,\r
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,\r
+\r
+ // Matches dashed string for camelizing\r
+ rdashAlpha = /-([a-z]|[0-9])/ig,\r
+ rmsPrefix = /^-ms-/,\r
+\r
+ // Used by jQuery.camelCase as callback to replace()\r
+ fcamelCase = function( all, letter ) {\r
+ return ( letter + "" ).toUpperCase();\r
+ },\r
+\r
+ // Keep a UserAgent string for use with jQuery.browser\r
+ userAgent = navigator.userAgent,\r
+\r
+ // For matching the engine and version of the browser\r
+ browserMatch,\r
+\r
+ // The deferred used on DOM ready\r
+ readyList,\r
+\r
+ // The ready event handler\r
+ DOMContentLoaded,\r
+\r
+ // Save a reference to some core methods\r
+ toString = Object.prototype.toString,\r
+ hasOwn = Object.prototype.hasOwnProperty,\r
+ push = Array.prototype.push,\r
+ slice = Array.prototype.slice,\r
+ trim = String.prototype.trim,\r
+ indexOf = Array.prototype.indexOf,\r
+\r
+ // [[Class]] -> type pairs\r
+ class2type = {};\r
+\r
+jQuery.fn = jQuery.prototype = {\r
+ constructor: jQuery,\r
+ init: function( selector, context, rootjQuery ) {\r
+ var match, elem, ret, doc;\r
+\r
+ // Handle $(""), $(null), or $(undefined)\r
+ if ( !selector ) {\r
+ return this;\r
+ }\r
+\r
+ // Handle $(DOMElement)\r
+ if ( selector.nodeType ) {\r
+ this.context = this[0] = selector;\r
+ this.length = 1;\r
+ return this;\r
+ }\r
+\r
+ // The body element only exists once, optimize finding it\r
+ if ( selector === "body" && !context && document.body ) {\r
+ this.context = document;\r
+ this[0] = document.body;\r
+ this.selector = selector;\r
+ this.length = 1;\r
+ return this;\r
+ }\r
+\r
+ // Handle HTML strings\r
+ if ( typeof selector === "string" ) {\r
+ // Are we dealing with HTML string or an ID?\r
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {\r
+ // Assume that strings that start and end with <> are HTML and skip the regex check\r
+ match = [ null, selector, null ];\r
+\r
+ } else {\r
+ match = quickExpr.exec( selector );\r
+ }\r
+\r
+ // Verify a match, and that no context was specified for #id\r
+ if ( match && (match[1] || !context) ) {\r
+\r
+ // HANDLE: $(html) -> $(array)\r
+ if ( match[1] ) {\r
+ context = context instanceof jQuery ? context[0] : context;\r
+ doc = ( context ? context.ownerDocument || context : document );\r
+\r
+ // If a single string is passed in and it's a single tag\r
+ // just do a createElement and skip the rest\r
+ ret = rsingleTag.exec( selector );\r
+\r
+ if ( ret ) {\r
+ if ( jQuery.isPlainObject( context ) ) {\r
+ selector = [ document.createElement( ret[1] ) ];\r
+ jQuery.fn.attr.call( selector, context, true );\r
+\r
+ } else {\r
+ selector = [ doc.createElement( ret[1] ) ];\r
+ }\r
+\r
+ } else {\r
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );\r
+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;\r
+ }\r
+\r
+ return jQuery.merge( this, selector );\r
+\r
+ // HANDLE: $("#id")\r
+ } else {\r
+ elem = document.getElementById( match[2] );\r
+\r
+ // Check parentNode to catch when Blackberry 4.6 returns\r
+ // nodes that are no longer in the document #6963\r
+ if ( elem && elem.parentNode ) {\r
+ // Handle the case where IE and Opera return items\r
+ // by name instead of ID\r
+ if ( elem.id !== match[2] ) {\r
+ return rootjQuery.find( selector );\r
+ }\r
+\r
+ // Otherwise, we inject the element directly into the jQuery object\r
+ this.length = 1;\r
+ this[0] = elem;\r
+ }\r
+\r
+ this.context = document;\r
+ this.selector = selector;\r
+ return this;\r
+ }\r
+\r
+ // HANDLE: $(expr, $(...))\r
+ } else if ( !context || context.jquery ) {\r
+ return ( context || rootjQuery ).find( selector );\r
+\r
+ // HANDLE: $(expr, context)\r
+ // (which is just equivalent to: $(context).find(expr)\r
+ } else {\r
+ return this.constructor( context ).find( selector );\r
+ }\r
+\r
+ // HANDLE: $(function)\r
+ // Shortcut for document ready\r
+ } else if ( jQuery.isFunction( selector ) ) {\r
+ return rootjQuery.ready( selector );\r
+ }\r
+\r
+ if ( selector.selector !== undefined ) {\r
+ this.selector = selector.selector;\r
+ this.context = selector.context;\r
+ }\r
+\r
+ return jQuery.makeArray( selector, this );\r
+ },\r
+\r
+ // Start with an empty selector\r
+ selector: "",\r
+\r
+ // The current version of jQuery being used\r
+ jquery: "1.7.2",\r
+\r
+ // The default length of a jQuery object is 0\r
+ length: 0,\r
+\r
+ // The number of elements contained in the matched element set\r
+ size: function() {\r
+ return this.length;\r
+ },\r
+\r
+ toArray: function() {\r
+ return slice.call( this, 0 );\r
+ },\r
+\r
+ // Get the Nth element in the matched element set OR\r
+ // Get the whole matched element set as a clean array\r
+ get: function( num ) {\r
+ return num == null ?\r
+\r
+ // Return a 'clean' array\r
+ this.toArray() :\r
+\r
+ // Return just the object\r
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );\r
+ },\r
+\r
+ // Take an array of elements and push it onto the stack\r
+ // (returning the new matched element set)\r
+ pushStack: function( elems, name, selector ) {\r
+ // Build a new jQuery matched element set\r
+ var ret = this.constructor();\r
+\r
+ if ( jQuery.isArray( elems ) ) {\r
+ push.apply( ret, elems );\r
+\r
+ } else {\r
+ jQuery.merge( ret, elems );\r
+ }\r
+\r
+ // Add the old object onto the stack (as a reference)\r
+ ret.prevObject = this;\r
+\r
+ ret.context = this.context;\r
+\r
+ if ( name === "find" ) {\r
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;\r
+ } else if ( name ) {\r
+ ret.selector = this.selector + "." + name + "(" + selector + ")";\r
+ }\r
+\r
+ // Return the newly-formed element set\r
+ return ret;\r
+ },\r
+\r
+ // Execute a callback for every element in the matched set.\r
+ // (You can seed the arguments with an array of args, but this is\r
+ // only used internally.)\r
+ each: function( callback, args ) {\r
+ return jQuery.each( this, callback, args );\r
+ },\r
+\r
+ ready: function( fn ) {\r
+ // Attach the listeners\r
+ jQuery.bindReady();\r
+\r
+ // Add the callback\r
+ readyList.add( fn );\r
+\r
+ return this;\r
+ },\r
+\r
+ eq: function( i ) {\r
+ i = +i;\r
+ return i === -1 ?\r
+ this.slice( i ) :\r
+ this.slice( i, i + 1 );\r
+ },\r
+\r
+ first: function() {\r
+ return this.eq( 0 );\r
+ },\r
+\r
+ last: function() {\r
+ return this.eq( -1 );\r
+ },\r
+\r
+ slice: function() {\r
+ return this.pushStack( slice.apply( this, arguments ),\r
+ "slice", slice.call(arguments).join(",") );\r
+ },\r
+\r
+ map: function( callback ) {\r
+ return this.pushStack( jQuery.map(this, function( elem, i ) {\r
+ return callback.call( elem, i, elem );\r
+ }));\r
+ },\r
+\r
+ end: function() {\r
+ return this.prevObject || this.constructor(null);\r
+ },\r
+\r
+ // For internal use only.\r
+ // Behaves like an Array's method, not like a jQuery method.\r
+ push: push,\r
+ sort: [].sort,\r
+ splice: [].splice\r
+};\r
+\r
+// Give the init function the jQuery prototype for later instantiation\r
+jQuery.fn.init.prototype = jQuery.fn;\r
+\r
+jQuery.extend = jQuery.fn.extend = function() {\r
+ var options, name, src, copy, copyIsArray, clone,\r
+ target = arguments[0] || {},\r
+ i = 1,\r
+ length = arguments.length,\r
+ deep = false;\r
+\r
+ // Handle a deep copy situation\r
+ if ( typeof target === "boolean" ) {\r
+ deep = target;\r
+ target = arguments[1] || {};\r
+ // skip the boolean and the target\r
+ i = 2;\r
+ }\r
+\r
+ // Handle case when target is a string or something (possible in deep copy)\r
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {\r
+ target = {};\r
+ }\r
+\r
+ // extend jQuery itself if only one argument is passed\r
+ if ( length === i ) {\r
+ target = this;\r
+ --i;\r
+ }\r
+\r
+ for ( ; i < length; i++ ) {\r
+ // Only deal with non-null/undefined values\r
+ if ( (options = arguments[ i ]) != null ) {\r
+ // Extend the base object\r
+ for ( name in options ) {\r
+ src = target[ name ];\r
+ copy = options[ name ];\r
+\r
+ // Prevent never-ending loop\r
+ if ( target === copy ) {\r
+ continue;\r
+ }\r
+\r
+ // Recurse if we're merging plain objects or arrays\r
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\r
+ if ( copyIsArray ) {\r
+ copyIsArray = false;\r
+ clone = src && jQuery.isArray(src) ? src : [];\r
+\r
+ } else {\r
+ clone = src && jQuery.isPlainObject(src) ? src : {};\r
+ }\r
+\r
+ // Never move original objects, clone them\r
+ target[ name ] = jQuery.extend( deep, clone, copy );\r
+\r
+ // Don't bring in undefined values\r
+ } else if ( copy !== undefined ) {\r
+ target[ name ] = copy;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // Return the modified object\r
+ return target;\r
+};\r
+\r
+jQuery.extend({\r
+ noConflict: function( deep ) {\r
+ if ( window.$ === jQuery ) {\r
+ window.$ = _$;\r
+ }\r
+\r
+ if ( deep && window.jQuery === jQuery ) {\r
+ window.jQuery = _jQuery;\r
+ }\r
+\r
+ return jQuery;\r
+ },\r
+\r
+ // Is the DOM ready to be used? Set to true once it occurs.\r
+ isReady: false,\r
+\r
+ // A counter to track how many items to wait for before\r
+ // the ready event fires. See #6781\r
+ readyWait: 1,\r
+\r
+ // Hold (or release) the ready event\r
+ holdReady: function( hold ) {\r
+ if ( hold ) {\r
+ jQuery.readyWait++;\r
+ } else {\r
+ jQuery.ready( true );\r
+ }\r
+ },\r
+\r
+ // Handle when the DOM is ready\r
+ ready: function( wait ) {\r
+ // Either a released hold or an DOMready/load event and not yet ready\r
+ if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {\r
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\r
+ if ( !document.body ) {\r
+ return setTimeout( jQuery.ready, 1 );\r
+ }\r
+\r
+ // Remember that the DOM is ready\r
+ jQuery.isReady = true;\r
+\r
+ // If a normal DOM Ready event fired, decrement, and wait if need be\r
+ if ( wait !== true && --jQuery.readyWait > 0 ) {\r
+ return;\r
+ }\r
+\r
+ // If there are functions bound, to execute\r
+ readyList.fireWith( document, [ jQuery ] );\r
+\r
+ // Trigger any bound ready events\r
+ if ( jQuery.fn.trigger ) {\r
+ jQuery( document ).trigger( "ready" ).off( "ready" );\r
+ }\r
+ }\r
+ },\r
+\r
+ bindReady: function() {\r
+ if ( readyList ) {\r
+ return;\r
+ }\r
+\r
+ readyList = jQuery.Callbacks( "once memory" );\r
+\r
+ // Catch cases where $(document).ready() is called after the\r
+ // browser event has already occurred.\r
+ if ( document.readyState === "complete" ) {\r
+ // Handle it asynchronously to allow scripts the opportunity to delay ready\r
+ return setTimeout( jQuery.ready, 1 );\r
+ }\r
+\r
+ // Mozilla, Opera and webkit nightlies currently support this event\r
+ if ( document.addEventListener ) {\r
+ // Use the handy event callback\r
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );\r
+\r
+ // A fallback to window.onload, that will always work\r
+ window.addEventListener( "load", jQuery.ready, false );\r
+\r
+ // If IE event model is used\r
+ } else if ( document.attachEvent ) {\r
+ // ensure firing before onload,\r
+ // maybe late but safe also for iframes\r
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );\r
+\r
+ // A fallback to window.onload, that will always work\r
+ window.attachEvent( "onload", jQuery.ready );\r
+\r
+ // If IE and not a frame\r
+ // continually check to see if the document is ready\r
+ var toplevel = false;\r
+\r
+ try {\r
+ toplevel = window.frameElement == null;\r
+ } catch(e) {}\r
+\r
+ if ( document.documentElement.doScroll && toplevel ) {\r
+ doScrollCheck();\r
+ }\r
+ }\r
+ },\r
+\r
+ // See test/unit/core.js for details concerning isFunction.\r
+ // Since version 1.3, DOM methods and functions like alert\r
+ // aren't supported. They return false on IE (#2968).\r
+ isFunction: function( obj ) {\r
+ return jQuery.type(obj) === "function";\r
+ },\r
+\r
+ isArray: Array.isArray || function( obj ) {\r
+ return jQuery.type(obj) === "array";\r
+ },\r
+\r
+ isWindow: function( obj ) {\r
+ return obj != null && obj == obj.window;\r
+ },\r
+\r
+ isNumeric: function( obj ) {\r
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );\r
+ },\r
+\r
+ type: function( obj ) {\r
+ return obj == null ?\r
+ String( obj ) :\r
+ class2type[ toString.call(obj) ] || "object";\r
+ },\r
+\r
+ isPlainObject: function( obj ) {\r
+ // Must be an Object.\r
+ // Because of IE, we also have to check the presence of the constructor property.\r
+ // Make sure that DOM nodes and window objects don't pass through, as well\r
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {\r
+ return false;\r
+ }\r
+\r
+ try {\r
+ // Not own constructor property must be Object\r
+ if ( obj.constructor &&\r
+ !hasOwn.call(obj, "constructor") &&\r
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {\r
+ return false;\r
+ }\r
+ } catch ( e ) {\r
+ // IE8,9 Will throw exceptions on certain host objects #9897\r
+ return false;\r
+ }\r
+\r
+ // Own properties are enumerated firstly, so to speed up,\r
+ // if last one is own, then all properties are own.\r
+\r
+ var key;\r
+ for ( key in obj ) {}\r
+\r
+ return key === undefined || hasOwn.call( obj, key );\r
+ },\r
+\r
+ isEmptyObject: function( obj ) {\r
+ for ( var name in obj ) {\r
+ return false;\r
+ }\r
+ return true;\r
+ },\r
+\r
+ error: function( msg ) {\r
+ throw new Error( msg );\r
+ },\r
+\r
+ parseJSON: function( data ) {\r
+ if ( typeof data !== "string" || !data ) {\r
+ return null;\r
+ }\r
+\r
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)\r
+ data = jQuery.trim( data );\r
+\r
+ // Attempt to parse using the native JSON parser first\r
+ if ( window.JSON && window.JSON.parse ) {\r
+ return window.JSON.parse( data );\r
+ }\r
+\r
+ // Make sure the incoming data is actual JSON\r
+ // Logic borrowed from http://json.org/json2.js\r
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )\r
+ .replace( rvalidtokens, "]" )\r
+ .replace( rvalidbraces, "")) ) {\r
+\r
+ return ( new Function( "return " + data ) )();\r
+\r
+ }\r
+ jQuery.error( "Invalid JSON: " + data );\r
+ },\r
+\r
+ // Cross-browser xml parsing\r
+ parseXML: function( data ) {\r
+ if ( typeof data !== "string" || !data ) {\r
+ return null;\r
+ }\r
+ var xml, tmp;\r
+ try {\r
+ if ( window.DOMParser ) { // Standard\r
+ tmp = new DOMParser();\r
+ xml = tmp.parseFromString( data , "text/xml" );\r
+ } else { // IE\r
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );\r
+ xml.async = "false";\r
+ xml.loadXML( data );\r
+ }\r
+ } catch( e ) {\r
+ xml = undefined;\r
+ }\r
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {\r
+ jQuery.error( "Invalid XML: " + data );\r
+ }\r
+ return xml;\r
+ },\r
+\r
+ noop: function() {},\r
+\r
+ // Evaluates a script in a global context\r
+ // Workarounds based on findings by Jim Driscoll\r
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context\r
+ globalEval: function( data ) {\r
+ if ( data && rnotwhite.test( data ) ) {\r
+ // We use execScript on Internet Explorer\r
+ // We use an anonymous function so that context is window\r
+ // rather than jQuery in Firefox\r
+ ( window.execScript || function( data ) {\r
+ window[ "eval" ].call( window, data );\r
+ } )( data );\r
+ }\r
+ },\r
+\r
+ // Convert dashed to camelCase; used by the css and data modules\r
+ // Microsoft forgot to hump their vendor prefix (#9572)\r
+ camelCase: function( string ) {\r
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );\r
+ },\r
+\r
+ nodeName: function( elem, name ) {\r
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();\r
+ },\r
+\r
+ // args is for internal usage only\r
+ each: function( object, callback, args ) {\r
+ var name, i = 0,\r
+ length = object.length,\r
+ isObj = length === undefined || jQuery.isFunction( object );\r
+\r
+ if ( args ) {\r
+ if ( isObj ) {\r
+ for ( name in object ) {\r
+ if ( callback.apply( object[ name ], args ) === false ) {\r
+ break;\r
+ }\r
+ }\r
+ } else {\r
+ for ( ; i < length; ) {\r
+ if ( callback.apply( object[ i++ ], args ) === false ) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ // A special, fast, case for the most common use of each\r
+ } else {\r
+ if ( isObj ) {\r
+ for ( name in object ) {\r
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {\r
+ break;\r
+ }\r
+ }\r
+ } else {\r
+ for ( ; i < length; ) {\r
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return object;\r
+ },\r
+\r
+ // Use native String.trim function wherever possible\r
+ trim: trim ?\r
+ function( text ) {\r
+ return text == null ?\r
+ "" :\r
+ trim.call( text );\r
+ } :\r
+\r
+ // Otherwise use our own trimming functionality\r
+ function( text ) {\r
+ return text == null ?\r
+ "" :\r
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );\r
+ },\r
+\r
+ // results is for internal usage only\r
+ makeArray: function( array, results ) {\r
+ var ret = results || [];\r
+\r
+ if ( array != null ) {\r
+ // The window, strings (and functions) also have 'length'\r
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930\r
+ var type = jQuery.type( array );\r
+\r
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {\r
+ push.call( ret, array );\r
+ } else {\r
+ jQuery.merge( ret, array );\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ },\r
+\r
+ inArray: function( elem, array, i ) {\r
+ var len;\r
+\r
+ if ( array ) {\r
+ if ( indexOf ) {\r
+ return indexOf.call( array, elem, i );\r
+ }\r
+\r
+ len = array.length;\r
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;\r
+\r
+ for ( ; i < len; i++ ) {\r
+ // Skip accessing in sparse arrays\r
+ if ( i in array && array[ i ] === elem ) {\r
+ return i;\r
+ }\r
+ }\r
+ }\r
+\r
+ return -1;\r
+ },\r
+\r
+ merge: function( first, second ) {\r
+ var i = first.length,\r
+ j = 0;\r
+\r
+ if ( typeof second.length === "number" ) {\r
+ for ( var l = second.length; j < l; j++ ) {\r
+ first[ i++ ] = second[ j ];\r
+ }\r
+\r
+ } else {\r
+ while ( second[j] !== undefined ) {\r
+ first[ i++ ] = second[ j++ ];\r
+ }\r
+ }\r
+\r
+ first.length = i;\r
+\r
+ return first;\r
+ },\r
+\r
+ grep: function( elems, callback, inv ) {\r
+ var ret = [], retVal;\r
+ inv = !!inv;\r
+\r
+ // Go through the array, only saving the items\r
+ // that pass the validator function\r
+ for ( var i = 0, length = elems.length; i < length; i++ ) {\r
+ retVal = !!callback( elems[ i ], i );\r
+ if ( inv !== retVal ) {\r
+ ret.push( elems[ i ] );\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ },\r
+\r
+ // arg is for internal usage only\r
+ map: function( elems, callback, arg ) {\r
+ var value, key, ret = [],\r
+ i = 0,\r
+ length = elems.length,\r
+ // jquery objects are treated as arrays\r
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;\r
+\r
+ // Go through the array, translating each of the items to their\r
+ if ( isArray ) {\r
+ for ( ; i < length; i++ ) {\r
+ value = callback( elems[ i ], i, arg );\r
+\r
+ if ( value != null ) {\r
+ ret[ ret.length ] = value;\r
+ }\r
+ }\r
+\r
+ // Go through every key on the object,\r
+ } else {\r
+ for ( key in elems ) {\r
+ value = callback( elems[ key ], key, arg );\r
+\r
+ if ( value != null ) {\r
+ ret[ ret.length ] = value;\r
+ }\r
+ }\r
+ }\r
+\r
+ // Flatten any nested arrays\r
+ return ret.concat.apply( [], ret );\r
+ },\r
+\r
+ // A global GUID counter for objects\r
+ guid: 1,\r
+\r
+ // Bind a function to a context, optionally partially applying any\r
+ // arguments.\r
+ proxy: function( fn, context ) {\r
+ if ( typeof context === "string" ) {\r
+ var tmp = fn[ context ];\r
+ context = fn;\r
+ fn = tmp;\r
+ }\r
+\r
+ // Quick check to determine if target is callable, in the spec\r
+ // this throws a TypeError, but we will just return undefined.\r
+ if ( !jQuery.isFunction( fn ) ) {\r
+ return undefined;\r
+ }\r
+\r
+ // Simulated bind\r
+ var args = slice.call( arguments, 2 ),\r
+ proxy = function() {\r
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );\r
+ };\r
+\r
+ // Set the guid of unique handler to the same of original handler, so it can be removed\r
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;\r
+\r
+ return proxy;\r
+ },\r
+\r
+ // Mutifunctional method to get and set values to a collection\r
+ // The value/s can optionally be executed if it's a function\r
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {\r
+ var exec,\r
+ bulk = key == null,\r
+ i = 0,\r
+ length = elems.length;\r
+\r
+ // Sets many values\r
+ if ( key && typeof key === "object" ) {\r
+ for ( i in key ) {\r
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );\r
+ }\r
+ chainable = 1;\r
+\r
+ // Sets one value\r
+ } else if ( value !== undefined ) {\r
+ // Optionally, function values get executed if exec is true\r
+ exec = pass === undefined && jQuery.isFunction( value );\r
+\r
+ if ( bulk ) {\r
+ // Bulk operations only iterate when executing function values\r
+ if ( exec ) {\r
+ exec = fn;\r
+ fn = function( elem, key, value ) {\r
+ return exec.call( jQuery( elem ), value );\r
+ };\r
+\r
+ // Otherwise they run against the entire set\r
+ } else {\r
+ fn.call( elems, value );\r
+ fn = null;\r
+ }\r
+ }\r
+\r
+ if ( fn ) {\r
+ for (; i < length; i++ ) {\r
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );\r
+ }\r
+ }\r
+\r
+ chainable = 1;\r
+ }\r
+\r
+ return chainable ?\r
+ elems :\r
+\r
+ // Gets\r
+ bulk ?\r
+ fn.call( elems ) :\r
+ length ? fn( elems[0], key ) : emptyGet;\r
+ },\r
+\r
+ now: function() {\r
+ return ( new Date() ).getTime();\r
+ },\r
+\r
+ // Use of jQuery.browser is frowned upon.\r
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser\r
+ uaMatch: function( ua ) {\r
+ ua = ua.toLowerCase();\r
+\r
+ var match = rwebkit.exec( ua ) ||\r
+ ropera.exec( ua ) ||\r
+ rmsie.exec( ua ) ||\r
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||\r
+ [];\r
+\r
+ return { browser: match[1] || "", version: match[2] || "0" };\r
+ },\r
+\r
+ sub: function() {\r
+ function jQuerySub( selector, context ) {\r
+ return new jQuerySub.fn.init( selector, context );\r
+ }\r
+ jQuery.extend( true, jQuerySub, this );\r
+ jQuerySub.superclass = this;\r
+ jQuerySub.fn = jQuerySub.prototype = this();\r
+ jQuerySub.fn.constructor = jQuerySub;\r
+ jQuerySub.sub = this.sub;\r
+ jQuerySub.fn.init = function init( selector, context ) {\r
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {\r
+ context = jQuerySub( context );\r
+ }\r
+\r
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );\r
+ };\r
+ jQuerySub.fn.init.prototype = jQuerySub.fn;\r
+ var rootjQuerySub = jQuerySub(document);\r
+ return jQuerySub;\r
+ },\r
+\r
+ browser: {}\r
+});\r
+\r
+// Populate the class2type map\r
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {\r
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();\r
+});\r
+\r
+browserMatch = jQuery.uaMatch( userAgent );\r
+if ( browserMatch.browser ) {\r
+ jQuery.browser[ browserMatch.browser ] = true;\r
+ jQuery.browser.version = browserMatch.version;\r
+}\r
+\r
+// Deprecated, use jQuery.browser.webkit instead\r
+if ( jQuery.browser.webkit ) {\r
+ jQuery.browser.safari = true;\r
+}\r
+\r
+// IE doesn't match non-breaking spaces with \s\r
+if ( rnotwhite.test( "\xA0" ) ) {\r
+ trimLeft = /^[\s\xA0]+/;\r
+ trimRight = /[\s\xA0]+$/;\r
+}\r
+\r
+// All jQuery objects should point back to these\r
+rootjQuery = jQuery(document);\r
+\r
+// Cleanup functions for the document ready method\r
+if ( document.addEventListener ) {\r
+ DOMContentLoaded = function() {\r
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );\r
+ jQuery.ready();\r
+ };\r
+\r
+} else if ( document.attachEvent ) {\r
+ DOMContentLoaded = function() {\r
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\r
+ if ( document.readyState === "complete" ) {\r
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );\r
+ jQuery.ready();\r
+ }\r
+ };\r
+}\r
+\r
+// The DOM ready check for Internet Explorer\r
+function doScrollCheck() {\r
+ if ( jQuery.isReady ) {\r
+ return;\r
+ }\r
+\r
+ try {\r
+ // If IE is used, use the trick by Diego Perini\r
+ // http://javascript.nwbox.com/IEContentLoaded/\r
+ document.documentElement.doScroll("left");\r
+ } catch(e) {\r
+ setTimeout( doScrollCheck, 1 );\r
+ return;\r
+ }\r
+\r
+ // and execute any waiting functions\r
+ jQuery.ready();\r
+}\r
+\r
+return jQuery;\r
+\r
+})();\r
+\r
+\r
+// String to Object flags format cache\r
+var flagsCache = {};\r
+\r
+// Convert String-formatted flags into Object-formatted ones and store in cache\r
+function createFlags( flags ) {\r
+ var object = flagsCache[ flags ] = {},\r
+ i, length;\r
+ flags = flags.split( /\s+/ );\r
+ for ( i = 0, length = flags.length; i < length; i++ ) {\r
+ object[ flags[i] ] = true;\r
+ }\r
+ return object;\r
+}\r
+\r
+/*\r
+ * Create a callback list using the following parameters:\r
+ *\r
+ * flags: an optional list of space-separated flags that will change how\r
+ * the callback list behaves\r
+ *\r
+ * By default a callback list will act like an event callback list and can be\r
+ * "fired" multiple times.\r
+ *\r
+ * Possible flags:\r
+ *\r
+ * once: will ensure the callback list can only be fired once (like a Deferred)\r
+ *\r
+ * memory: will keep track of previous values and will call any callback added\r
+ * after the list has been fired right away with the latest "memorized"\r
+ * values (like a Deferred)\r
+ *\r
+ * unique: will ensure a callback can only be added once (no duplicate in the list)\r
+ *\r
+ * stopOnFalse: interrupt callings when a callback returns false\r
+ *\r
+ */\r
+jQuery.Callbacks = function( flags ) {\r
+\r
+ // Convert flags from String-formatted to Object-formatted\r
+ // (we check in cache first)\r
+ flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};\r
+\r
+ var // Actual callback list\r
+ list = [],\r
+ // Stack of fire calls for repeatable lists\r
+ stack = [],\r
+ // Last fire value (for non-forgettable lists)\r
+ memory,\r
+ // Flag to know if list was already fired\r
+ fired,\r
+ // Flag to know if list is currently firing\r
+ firing,\r
+ // First callback to fire (used internally by add and fireWith)\r
+ firingStart,\r
+ // End of the loop when firing\r
+ firingLength,\r
+ // Index of currently firing callback (modified by remove if needed)\r
+ firingIndex,\r
+ // Add one or several callbacks to the list\r
+ add = function( args ) {\r
+ var i,\r
+ length,\r
+ elem,\r
+ type,\r
+ actual;\r
+ for ( i = 0, length = args.length; i < length; i++ ) {\r
+ elem = args[ i ];\r
+ type = jQuery.type( elem );\r
+ if ( type === "array" ) {\r
+ // Inspect recursively\r
+ add( elem );\r
+ } else if ( type === "function" ) {\r
+ // Add if not in unique mode and callback is not in\r
+ if ( !flags.unique || !self.has( elem ) ) {\r
+ list.push( elem );\r
+ }\r
+ }\r
+ }\r
+ },\r
+ // Fire callbacks\r
+ fire = function( context, args ) {\r
+ args = args || [];\r
+ memory = !flags.memory || [ context, args ];\r
+ fired = true;\r
+ firing = true;\r
+ firingIndex = firingStart || 0;\r
+ firingStart = 0;\r
+ firingLength = list.length;\r
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {\r
+ if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {\r
+ memory = true; // Mark as halted\r
+ break;\r
+ }\r
+ }\r
+ firing = false;\r
+ if ( list ) {\r
+ if ( !flags.once ) {\r
+ if ( stack && stack.length ) {\r
+ memory = stack.shift();\r
+ self.fireWith( memory[ 0 ], memory[ 1 ] );\r
+ }\r
+ } else if ( memory === true ) {\r
+ self.disable();\r
+ } else {\r
+ list = [];\r
+ }\r
+ }\r
+ },\r
+ // Actual Callbacks object\r
+ self = {\r
+ // Add a callback or a collection of callbacks to the list\r
+ add: function() {\r
+ if ( list ) {\r
+ var length = list.length;\r
+ add( arguments );\r
+ // Do we need to add the callbacks to the\r
+ // current firing batch?\r
+ if ( firing ) {\r
+ firingLength = list.length;\r
+ // With memory, if we're not firing then\r
+ // we should call right away, unless previous\r
+ // firing was halted (stopOnFalse)\r
+ } else if ( memory && memory !== true ) {\r
+ firingStart = length;\r
+ fire( memory[ 0 ], memory[ 1 ] );\r
+ }\r
+ }\r
+ return this;\r
+ },\r
+ // Remove a callback from the list\r
+ remove: function() {\r
+ if ( list ) {\r
+ var args = arguments,\r
+ argIndex = 0,\r
+ argLength = args.length;\r
+ for ( ; argIndex < argLength ; argIndex++ ) {\r
+ for ( var i = 0; i < list.length; i++ ) {\r
+ if ( args[ argIndex ] === list[ i ] ) {\r
+ // Handle firingIndex and firingLength\r
+ if ( firing ) {\r
+ if ( i <= firingLength ) {\r
+ firingLength--;\r
+ if ( i <= firingIndex ) {\r
+ firingIndex--;\r
+ }\r
+ }\r
+ }\r
+ // Remove the element\r
+ list.splice( i--, 1 );\r
+ // If we have some unicity property then\r
+ // we only need to do this once\r
+ if ( flags.unique ) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return this;\r
+ },\r
+ // Control if a given callback is in the list\r
+ has: function( fn ) {\r
+ if ( list ) {\r
+ var i = 0,\r
+ length = list.length;\r
+ for ( ; i < length; i++ ) {\r
+ if ( fn === list[ i ] ) {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+ return false;\r
+ },\r
+ // Remove all callbacks from the list\r
+ empty: function() {\r
+ list = [];\r
+ return this;\r
+ },\r
+ // Have the list do nothing anymore\r
+ disable: function() {\r
+ list = stack = memory = undefined;\r
+ return this;\r
+ },\r
+ // Is it disabled?\r
+ disabled: function() {\r
+ return !list;\r
+ },\r
+ // Lock the list in its current state\r
+ lock: function() {\r
+ stack = undefined;\r
+ if ( !memory || memory === true ) {\r
+ self.disable();\r
+ }\r
+ return this;\r
+ },\r
+ // Is it locked?\r
+ locked: function() {\r
+ return !stack;\r
+ },\r
+ // Call all callbacks with the given context and arguments\r
+ fireWith: function( context, args ) {\r
+ if ( stack ) {\r
+ if ( firing ) {\r
+ if ( !flags.once ) {\r
+ stack.push( [ context, args ] );\r
+ }\r
+ } else if ( !( flags.once && memory ) ) {\r
+ fire( context, args );\r
+ }\r
+ }\r
+ return this;\r
+ },\r
+ // Call all the callbacks with the given arguments\r
+ fire: function() {\r
+ self.fireWith( this, arguments );\r
+ return this;\r
+ },\r
+ // To know if the callbacks have already been called at least once\r
+ fired: function() {\r
+ return !!fired;\r
+ }\r
+ };\r
+\r
+ return self;\r
+};\r
+\r
+\r
+\r
+\r
+var // Static reference to slice\r
+ sliceDeferred = [].slice;\r
+\r
+jQuery.extend({\r
+\r
+ Deferred: function( func ) {\r
+ var doneList = jQuery.Callbacks( "once memory" ),\r
+ failList = jQuery.Callbacks( "once memory" ),\r
+ progressList = jQuery.Callbacks( "memory" ),\r
+ state = "pending",\r
+ lists = {\r
+ resolve: doneList,\r
+ reject: failList,\r
+ notify: progressList\r
+ },\r
+ promise = {\r
+ done: doneList.add,\r
+ fail: failList.add,\r
+ progress: progressList.add,\r
+\r
+ state: function() {\r
+ return state;\r
+ },\r
+\r
+ // Deprecated\r
+ isResolved: doneList.fired,\r
+ isRejected: failList.fired,\r
+\r
+ then: function( doneCallbacks, failCallbacks, progressCallbacks ) {\r
+ deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );\r
+ return this;\r
+ },\r
+ always: function() {\r
+ deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );\r
+ return this;\r
+ },\r
+ pipe: function( fnDone, fnFail, fnProgress ) {\r
+ return jQuery.Deferred(function( newDefer ) {\r
+ jQuery.each( {\r
+ done: [ fnDone, "resolve" ],\r
+ fail: [ fnFail, "reject" ],\r
+ progress: [ fnProgress, "notify" ]\r
+ }, function( handler, data ) {\r
+ var fn = data[ 0 ],\r
+ action = data[ 1 ],\r
+ returned;\r
+ if ( jQuery.isFunction( fn ) ) {\r
+ deferred[ handler ](function() {\r
+ returned = fn.apply( this, arguments );\r
+ if ( returned && jQuery.isFunction( returned.promise ) ) {\r
+ returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );\r
+ } else {\r
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );\r
+ }\r
+ });\r
+ } else {\r
+ deferred[ handler ]( newDefer[ action ] );\r
+ }\r
+ });\r
+ }).promise();\r
+ },\r
+ // Get a promise for this deferred\r
+ // If obj is provided, the promise aspect is added to the object\r
+ promise: function( obj ) {\r
+ if ( obj == null ) {\r
+ obj = promise;\r
+ } else {\r
+ for ( var key in promise ) {\r
+ obj[ key ] = promise[ key ];\r
+ }\r
+ }\r
+ return obj;\r
+ }\r
+ },\r
+ deferred = promise.promise({}),\r
+ key;\r
+\r
+ for ( key in lists ) {\r
+ deferred[ key ] = lists[ key ].fire;\r
+ deferred[ key + "With" ] = lists[ key ].fireWith;\r
+ }\r
+\r
+ // Handle state\r
+ deferred.done( function() {\r
+ state = "resolved";\r
+ }, failList.disable, progressList.lock ).fail( function() {\r
+ state = "rejected";\r
+ }, doneList.disable, progressList.lock );\r
+\r
+ // Call given func if any\r
+ if ( func ) {\r
+ func.call( deferred, deferred );\r
+ }\r
+\r
+ // All done!\r
+ return deferred;\r
+ },\r
+\r
+ // Deferred helper\r
+ when: function( firstParam ) {\r
+ var args = sliceDeferred.call( arguments, 0 ),\r
+ i = 0,\r
+ length = args.length,\r
+ pValues = new Array( length ),\r
+ count = length,\r
+ pCount = length,\r
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?\r
+ firstParam :\r
+ jQuery.Deferred(),\r
+ promise = deferred.promise();\r
+ function resolveFunc( i ) {\r
+ return function( value ) {\r
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;\r
+ if ( !( --count ) ) {\r
+ deferred.resolveWith( deferred, args );\r
+ }\r
+ };\r
+ }\r
+ function progressFunc( i ) {\r
+ return function( value ) {\r
+ pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;\r
+ deferred.notifyWith( promise, pValues );\r
+ };\r
+ }\r
+ if ( length > 1 ) {\r
+ for ( ; i < length; i++ ) {\r
+ if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {\r
+ args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );\r
+ } else {\r
+ --count;\r
+ }\r
+ }\r
+ if ( !count ) {\r
+ deferred.resolveWith( deferred, args );\r
+ }\r
+ } else if ( deferred !== firstParam ) {\r
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );\r
+ }\r
+ return promise;\r
+ }\r
+});\r
+\r
+\r
+\r
+\r
+jQuery.support = (function() {\r
+\r
+ var support,\r
+ all,\r
+ a,\r
+ select,\r
+ opt,\r
+ input,\r
+ fragment,\r
+ tds,\r
+ events,\r
+ eventName,\r
+ i,\r
+ isSupported,\r
+ div = document.createElement( "div" ),\r
+ documentElement = document.documentElement;\r
+\r
+ // Preliminary tests\r
+ div.setAttribute("className", "t");\r
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";\r
+\r
+ all = div.getElementsByTagName( "*" );\r
+ a = div.getElementsByTagName( "a" )[ 0 ];\r
+\r
+ // Can't get basic test support\r
+ if ( !all || !all.length || !a ) {\r
+ return {};\r
+ }\r
+\r
+ // First batch of supports tests\r
+ select = document.createElement( "select" );\r
+ opt = select.appendChild( document.createElement("option") );\r
+ input = div.getElementsByTagName( "input" )[ 0 ];\r
+\r
+ support = {\r
+ // IE strips leading whitespace when .innerHTML is used\r
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),\r
+\r
+ // Make sure that tbody elements aren't automatically inserted\r
+ // IE will insert them into empty tables\r
+ tbody: !div.getElementsByTagName("tbody").length,\r
+\r
+ // Make sure that link elements get serialized correctly by innerHTML\r
+ // This requires a wrapper element in IE\r
+ htmlSerialize: !!div.getElementsByTagName("link").length,\r
+\r
+ // Get the style information from getAttribute\r
+ // (IE uses .cssText instead)\r
+ style: /top/.test( a.getAttribute("style") ),\r
+\r
+ // Make sure that URLs aren't manipulated\r
+ // (IE normalizes it by default)\r
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),\r
+\r
+ // Make sure that element opacity exists\r
+ // (IE uses filter instead)\r
+ // Use a regex to work around a WebKit issue. See #5145\r
+ opacity: /^0.55/.test( a.style.opacity ),\r
+\r
+ // Verify style float existence\r
+ // (IE uses styleFloat instead of cssFloat)\r
+ cssFloat: !!a.style.cssFloat,\r
+\r
+ // Make sure that if no value is specified for a checkbox\r
+ // that it defaults to "on".\r
+ // (WebKit defaults to "" instead)\r
+ checkOn: ( input.value === "on" ),\r
+\r
+ // Make sure that a selected-by-default option has a working selected property.\r
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)\r
+ optSelected: opt.selected,\r
+\r
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)\r
+ getSetAttribute: div.className !== "t",\r
+\r
+ // Tests for enctype support on a form(#6743)\r
+ enctype: !!document.createElement("form").enctype,\r
+\r
+ // Makes sure cloning an html5 element does not cause problems\r
+ // Where outerHTML is undefined, this still works\r
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",\r
+\r
+ // Will be defined later\r
+ submitBubbles: true,\r
+ changeBubbles: true,\r
+ focusinBubbles: false,\r
+ deleteExpando: true,\r
+ noCloneEvent: true,\r
+ inlineBlockNeedsLayout: false,\r
+ shrinkWrapBlocks: false,\r
+ reliableMarginRight: true,\r
+ pixelMargin: true\r
+ };\r
+\r
+ // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead\r
+ jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");\r
+\r
+ // Make sure checked status is properly cloned\r
+ input.checked = true;\r
+ support.noCloneChecked = input.cloneNode( true ).checked;\r
+\r
+ // Make sure that the options inside disabled selects aren't marked as disabled\r
+ // (WebKit marks them as disabled)\r
+ select.disabled = true;\r
+ support.optDisabled = !opt.disabled;\r
+\r
+ // Test to see if it's possible to delete an expando from an element\r
+ // Fails in Internet Explorer\r
+ try {\r
+ delete div.test;\r
+ } catch( e ) {\r
+ support.deleteExpando = false;\r
+ }\r
+\r
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {\r
+ div.attachEvent( "onclick", function() {\r
+ // Cloning a node shouldn't copy over any\r
+ // bound event handlers (IE does this)\r
+ support.noCloneEvent = false;\r
+ });\r
+ div.cloneNode( true ).fireEvent( "onclick" );\r
+ }\r
+\r
+ // Check if a radio maintains its value\r
+ // after being appended to the DOM\r
+ input = document.createElement("input");\r
+ input.value = "t";\r
+ input.setAttribute("type", "radio");\r
+ support.radioValue = input.value === "t";\r
+\r
+ input.setAttribute("checked", "checked");\r
+\r
+ // #11217 - WebKit loses check when the name is after the checked attribute\r
+ input.setAttribute( "name", "t" );\r
+\r
+ div.appendChild( input );\r
+ fragment = document.createDocumentFragment();\r
+ fragment.appendChild( div.lastChild );\r
+\r
+ // WebKit doesn't clone checked state correctly in fragments\r
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;\r
+\r
+ // Check if a disconnected checkbox will retain its checked\r
+ // value of true after appended to the DOM (IE6/7)\r
+ support.appendChecked = input.checked;\r
+\r
+ fragment.removeChild( input );\r
+ fragment.appendChild( div );\r
+\r
+ // Technique from Juriy Zaytsev\r
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/\r
+ // We only care about the case where non-standard event systems\r
+ // are used, namely in IE. Short-circuiting here helps us to\r
+ // avoid an eval call (in setAttribute) which can cause CSP\r
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP\r
+ if ( div.attachEvent ) {\r
+ for ( i in {\r
+ submit: 1,\r
+ change: 1,\r
+ focusin: 1\r
+ }) {\r
+ eventName = "on" + i;\r
+ isSupported = ( eventName in div );\r
+ if ( !isSupported ) {\r
+ div.setAttribute( eventName, "return;" );\r
+ isSupported = ( typeof div[ eventName ] === "function" );\r
+ }\r
+ support[ i + "Bubbles" ] = isSupported;\r
+ }\r
+ }\r
+\r
+ fragment.removeChild( div );\r
+\r
+ // Null elements to avoid leaks in IE\r
+ fragment = select = opt = div = input = null;\r
+\r
+ // Run tests that need a body at doc ready\r
+ jQuery(function() {\r
+ var container, outer, inner, table, td, offsetSupport,\r
+ marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,\r
+ paddingMarginBorderVisibility, paddingMarginBorder,\r
+ body = document.getElementsByTagName("body")[0];\r
+\r
+ if ( !body ) {\r
+ // Return for frameset docs that don't have a body\r
+ return;\r
+ }\r
+\r
+ conMarginTop = 1;\r
+ paddingMarginBorder = "padding:0;margin:0;border:";\r
+ positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";\r
+ paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";\r
+ style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";\r
+ html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +\r
+ "<table " + style + "' cellpadding='0' cellspacing='0'>" +\r
+ "<tr><td></td></tr></table>";\r
+\r
+ container = document.createElement("div");\r
+ container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";\r
+ body.insertBefore( container, body.firstChild );\r
+\r
+ // Construct the test element\r
+ div = document.createElement("div");\r
+ container.appendChild( div );\r
+\r
+ // Check if table cells still have offsetWidth/Height when they are set\r
+ // to display:none and there are still other visible table cells in a\r
+ // table row; if so, offsetWidth/Height are not reliable for use when\r
+ // determining if an element has been hidden directly using\r
+ // display:none (it is still safe to use offsets if a parent element is\r
+ // hidden; don safety goggles and see bug #4512 for more information).\r
+ // (only IE 8 fails this test)\r
+ div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";\r
+ tds = div.getElementsByTagName( "td" );\r
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );\r
+\r
+ tds[ 0 ].style.display = "";\r
+ tds[ 1 ].style.display = "none";\r
+\r
+ // Check if empty table cells still have offsetWidth/Height\r
+ // (IE <= 8 fail this test)\r
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );\r
+\r
+ // Check if div with explicit width and no margin-right incorrectly\r
+ // gets computed margin-right based on width of container. For more\r
+ // info see bug #3333\r
+ // Fails in WebKit before Feb 2011 nightlies\r
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\r
+ if ( window.getComputedStyle ) {\r
+ div.innerHTML = "";\r
+ marginDiv = document.createElement( "div" );\r
+ marginDiv.style.width = "0";\r
+ marginDiv.style.marginRight = "0";\r
+ div.style.width = "2px";\r
+ div.appendChild( marginDiv );\r
+ support.reliableMarginRight =\r
+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;\r
+ }\r
+\r
+ if ( typeof div.style.zoom !== "undefined" ) {\r
+ // Check if natively block-level elements act like inline-block\r
+ // elements when setting their display to 'inline' and giving\r
+ // them layout\r
+ // (IE < 8 does this)\r
+ div.innerHTML = "";\r
+ div.style.width = div.style.padding = "1px";\r
+ div.style.border = 0;\r
+ div.style.overflow = "hidden";\r
+ div.style.display = "inline";\r
+ div.style.zoom = 1;\r
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );\r
+\r
+ // Check if elements with layout shrink-wrap their children\r
+ // (IE 6 does this)\r
+ div.style.display = "block";\r
+ div.style.overflow = "visible";\r
+ div.innerHTML = "<div style='width:5px;'></div>";\r
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );\r
+ }\r
+\r
+ div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;\r
+ div.innerHTML = html;\r
+\r
+ outer = div.firstChild;\r
+ inner = outer.firstChild;\r
+ td = outer.nextSibling.firstChild.firstChild;\r
+\r
+ offsetSupport = {\r
+ doesNotAddBorder: ( inner.offsetTop !== 5 ),\r
+ doesAddBorderForTableAndCells: ( td.offsetTop === 5 )\r
+ };\r
+\r
+ inner.style.position = "fixed";\r
+ inner.style.top = "20px";\r
+\r
+ // safari subtracts parent border width here which is 5px\r
+ offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );\r
+ inner.style.position = inner.style.top = "";\r
+\r
+ outer.style.overflow = "hidden";\r
+ outer.style.position = "relative";\r
+\r
+ offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );\r
+ offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );\r
+\r
+ if ( window.getComputedStyle ) {\r
+ div.style.marginTop = "1%";\r
+ support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";\r
+ }\r
+\r
+ if ( typeof container.style.zoom !== "undefined" ) {\r
+ container.style.zoom = 1;\r
+ }\r
+\r
+ body.removeChild( container );\r
+ marginDiv = div = container = null;\r
+\r
+ jQuery.extend( support, offsetSupport );\r
+ });\r
+\r
+ return support;\r
+})();\r
+\r
+\r
+\r
+\r
+var rbrace = /^(?:\{.*\}|\[.*\])$/,\r
+ rmultiDash = /([A-Z])/g;\r
+\r
+jQuery.extend({\r
+ cache: {},\r
+\r
+ // Please use with caution\r
+ uuid: 0,\r
+\r
+ // Unique for each copy of jQuery on the page\r
+ // Non-digits removed to match rinlinejQuery\r
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),\r
+\r
+ // The following elements throw uncatchable exceptions if you\r
+ // attempt to add expando properties to them.\r
+ noData: {\r
+ "embed": true,\r
+ // Ban all objects except for Flash (which handle expandos)\r
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",\r
+ "applet": true\r
+ },\r
+\r
+ hasData: function( elem ) {\r
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];\r
+ return !!elem && !isEmptyDataObject( elem );\r
+ },\r
+\r
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {\r
+ if ( !jQuery.acceptData( elem ) ) {\r
+ return;\r
+ }\r
+\r
+ var privateCache, thisCache, ret,\r
+ internalKey = jQuery.expando,\r
+ getByName = typeof name === "string",\r
+\r
+ // We have to handle DOM nodes and JS objects differently because IE6-7\r
+ // can't GC object references properly across the DOM-JS boundary\r
+ isNode = elem.nodeType,\r
+\r
+ // Only DOM nodes need the global jQuery cache; JS object data is\r
+ // attached directly to the object so GC can occur automatically\r
+ cache = isNode ? jQuery.cache : elem,\r
+\r
+ // Only defining an ID for JS objects if its cache already exists allows\r
+ // the code to shortcut on the same path as a DOM node with no cache\r
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,\r
+ isEvents = name === "events";\r
+\r
+ // Avoid doing any more work than we need to when trying to get data on an\r
+ // object that has no data at all\r
+ if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {\r
+ return;\r
+ }\r
+\r
+ if ( !id ) {\r
+ // Only DOM nodes need a new unique ID for each element since their data\r
+ // ends up in the global cache\r
+ if ( isNode ) {\r
+ elem[ internalKey ] = id = ++jQuery.uuid;\r
+ } else {\r
+ id = internalKey;\r
+ }\r
+ }\r
+\r
+ if ( !cache[ id ] ) {\r
+ cache[ id ] = {};\r
+\r
+ // Avoids exposing jQuery metadata on plain JS objects when the object\r
+ // is serialized using JSON.stringify\r
+ if ( !isNode ) {\r
+ cache[ id ].toJSON = jQuery.noop;\r
+ }\r
+ }\r
+\r
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets\r
+ // shallow copied over onto the existing cache\r
+ if ( typeof name === "object" || typeof name === "function" ) {\r
+ if ( pvt ) {\r
+ cache[ id ] = jQuery.extend( cache[ id ], name );\r
+ } else {\r
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );\r
+ }\r
+ }\r
+\r
+ privateCache = thisCache = cache[ id ];\r
+\r
+ // jQuery data() is stored in a separate object inside the object's internal data\r
+ // cache in order to avoid key collisions between internal data and user-defined\r
+ // data.\r
+ if ( !pvt ) {\r
+ if ( !thisCache.data ) {\r
+ thisCache.data = {};\r
+ }\r
+\r
+ thisCache = thisCache.data;\r
+ }\r
+\r
+ if ( data !== undefined ) {\r
+ thisCache[ jQuery.camelCase( name ) ] = data;\r
+ }\r
+\r
+ // Users should not attempt to inspect the internal events object using jQuery.data,\r
+ // it is undocumented and subject to change. But does anyone listen? No.\r
+ if ( isEvents && !thisCache[ name ] ) {\r
+ return privateCache.events;\r
+ }\r
+\r
+ // Check for both converted-to-camel and non-converted data property names\r
+ // If a data property was specified\r
+ if ( getByName ) {\r
+\r
+ // First Try to find as-is property data\r
+ ret = thisCache[ name ];\r
+\r
+ // Test for null|undefined property data\r
+ if ( ret == null ) {\r
+\r
+ // Try to find the camelCased property\r
+ ret = thisCache[ jQuery.camelCase( name ) ];\r
+ }\r
+ } else {\r
+ ret = thisCache;\r
+ }\r
+\r
+ return ret;\r
+ },\r
+\r
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {\r
+ if ( !jQuery.acceptData( elem ) ) {\r
+ return;\r
+ }\r
+\r
+ var thisCache, i, l,\r
+\r
+ // Reference to internal data cache key\r
+ internalKey = jQuery.expando,\r
+\r
+ isNode = elem.nodeType,\r
+\r
+ // See jQuery.data for more information\r
+ cache = isNode ? jQuery.cache : elem,\r
+\r
+ // See jQuery.data for more information\r
+ id = isNode ? elem[ internalKey ] : internalKey;\r
+\r
+ // If there is already no cache entry for this object, there is no\r
+ // purpose in continuing\r
+ if ( !cache[ id ] ) {\r
+ return;\r
+ }\r
+\r
+ if ( name ) {\r
+\r
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;\r
+\r
+ if ( thisCache ) {\r
+\r
+ // Support array or space separated string names for data keys\r
+ if ( !jQuery.isArray( name ) ) {\r
+\r
+ // try the string as a key before any manipulation\r
+ if ( name in thisCache ) {\r
+ name = [ name ];\r
+ } else {\r
+\r
+ // split the camel cased version by spaces unless a key with the spaces exists\r
+ name = jQuery.camelCase( name );\r
+ if ( name in thisCache ) {\r
+ name = [ name ];\r
+ } else {\r
+ name = name.split( " " );\r
+ }\r
+ }\r
+ }\r
+\r
+ for ( i = 0, l = name.length; i < l; i++ ) {\r
+ delete thisCache[ name[i] ];\r
+ }\r
+\r
+ // If there is no data left in the cache, we want to continue\r
+ // and let the cache object itself get destroyed\r
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ // See jQuery.data for more information\r
+ if ( !pvt ) {\r
+ delete cache[ id ].data;\r
+\r
+ // Don't destroy the parent cache unless the internal data object\r
+ // had been the only thing left in it\r
+ if ( !isEmptyDataObject(cache[ id ]) ) {\r
+ return;\r
+ }\r
+ }\r
+\r
+ // Browsers that fail expando deletion also refuse to delete expandos on\r
+ // the window, but it will allow it on all other JS objects; other browsers\r
+ // don't care\r
+ // Ensure that `cache` is not a window object #10080\r
+ if ( jQuery.support.deleteExpando || !cache.setInterval ) {\r
+ delete cache[ id ];\r
+ } else {\r
+ cache[ id ] = null;\r
+ }\r
+\r
+ // We destroyed the cache and need to eliminate the expando on the node to avoid\r
+ // false lookups in the cache for entries that no longer exist\r
+ if ( isNode ) {\r
+ // IE does not allow us to delete expando properties from nodes,\r
+ // nor does it have a removeAttribute function on Document nodes;\r
+ // we must handle all of these cases\r
+ if ( jQuery.support.deleteExpando ) {\r
+ delete elem[ internalKey ];\r
+ } else if ( elem.removeAttribute ) {\r
+ elem.removeAttribute( internalKey );\r
+ } else {\r
+ elem[ internalKey ] = null;\r
+ }\r
+ }\r
+ },\r
+\r
+ // For internal use only.\r
+ _data: function( elem, name, data ) {\r
+ return jQuery.data( elem, name, data, true );\r
+ },\r
+\r
+ // A method for determining if a DOM node can handle the data expando\r
+ acceptData: function( elem ) {\r
+ if ( elem.nodeName ) {\r
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];\r
+\r
+ if ( match ) {\r
+ return !(match === true || elem.getAttribute("classid") !== match);\r
+ }\r
+ }\r
+\r
+ return true;\r
+ }\r
+});\r
+\r
+jQuery.fn.extend({\r
+ data: function( key, value ) {\r
+ var parts, part, attr, name, l,\r
+ elem = this[0],\r
+ i = 0,\r
+ data = null;\r
+\r
+ // Gets all values\r
+ if ( key === undefined ) {\r
+ if ( this.length ) {\r
+ data = jQuery.data( elem );\r
+\r
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {\r
+ attr = elem.attributes;\r
+ for ( l = attr.length; i < l; i++ ) {\r
+ name = attr[i].name;\r
+\r
+ if ( name.indexOf( "data-" ) === 0 ) {\r
+ name = jQuery.camelCase( name.substring(5) );\r
+\r
+ dataAttr( elem, name, data[ name ] );\r
+ }\r
+ }\r
+ jQuery._data( elem, "parsedAttrs", true );\r
+ }\r
+ }\r
+\r
+ return data;\r
+ }\r
+\r
+ // Sets multiple values\r
+ if ( typeof key === "object" ) {\r
+ return this.each(function() {\r
+ jQuery.data( this, key );\r
+ });\r
+ }\r
+\r
+ parts = key.split( ".", 2 );\r
+ parts[1] = parts[1] ? "." + parts[1] : "";\r
+ part = parts[1] + "!";\r
+\r
+ return jQuery.access( this, function( value ) {\r
+\r
+ if ( value === undefined ) {\r
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );\r
+\r
+ // Try to fetch any internally stored data first\r
+ if ( data === undefined && elem ) {\r
+ data = jQuery.data( elem, key );\r
+ data = dataAttr( elem, key, data );\r
+ }\r
+\r
+ return data === undefined && parts[1] ?\r
+ this.data( parts[0] ) :\r
+ data;\r
+ }\r
+\r
+ parts[1] = value;\r
+ this.each(function() {\r
+ var self = jQuery( this );\r
+\r
+ self.triggerHandler( "setData" + part, parts );\r
+ jQuery.data( this, key, value );\r
+ self.triggerHandler( "changeData" + part, parts );\r
+ });\r
+ }, null, value, arguments.length > 1, null, false );\r
+ },\r
+\r
+ removeData: function( key ) {\r
+ return this.each(function() {\r
+ jQuery.removeData( this, key );\r
+ });\r
+ }\r
+});\r
+\r
+function dataAttr( elem, key, data ) {\r
+ // If nothing was found internally, try to fetch any\r
+ // data from the HTML5 data-* attribute\r
+ if ( data === undefined && elem.nodeType === 1 ) {\r
+\r
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();\r
+\r
+ data = elem.getAttribute( name );\r
+\r
+ if ( typeof data === "string" ) {\r
+ try {\r
+ data = data === "true" ? true :\r
+ data === "false" ? false :\r
+ data === "null" ? null :\r
+ jQuery.isNumeric( data ) ? +data :\r
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :\r
+ data;\r
+ } catch( e ) {}\r
+\r
+ // Make sure we set the data so it isn't changed later\r
+ jQuery.data( elem, key, data );\r
+\r
+ } else {\r
+ data = undefined;\r
+ }\r
+ }\r
+\r
+ return data;\r
+}\r
+\r
+// checks a cache object for emptiness\r
+function isEmptyDataObject( obj ) {\r
+ for ( var name in obj ) {\r
+\r
+ // if the public data object is empty, the private is still empty\r
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {\r
+ continue;\r
+ }\r
+ if ( name !== "toJSON" ) {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+\r
+\r
+\r
+function handleQueueMarkDefer( elem, type, src ) {\r
+ var deferDataKey = type + "defer",\r
+ queueDataKey = type + "queue",\r
+ markDataKey = type + "mark",\r
+ defer = jQuery._data( elem, deferDataKey );\r
+ if ( defer &&\r
+ ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&\r
+ ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {\r
+ // Give room for hard-coded callbacks to fire first\r
+ // and eventually mark/queue something else on the element\r
+ setTimeout( function() {\r
+ if ( !jQuery._data( elem, queueDataKey ) &&\r
+ !jQuery._data( elem, markDataKey ) ) {\r
+ jQuery.removeData( elem, deferDataKey, true );\r
+ defer.fire();\r
+ }\r
+ }, 0 );\r
+ }\r
+}\r
+\r
+jQuery.extend({\r
+\r
+ _mark: function( elem, type ) {\r
+ if ( elem ) {\r
+ type = ( type || "fx" ) + "mark";\r
+ jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );\r
+ }\r
+ },\r
+\r
+ _unmark: function( force, elem, type ) {\r
+ if ( force !== true ) {\r
+ type = elem;\r
+ elem = force;\r
+ force = false;\r
+ }\r
+ if ( elem ) {\r
+ type = type || "fx";\r
+ var key = type + "mark",\r
+ count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );\r
+ if ( count ) {\r
+ jQuery._data( elem, key, count );\r
+ } else {\r
+ jQuery.removeData( elem, key, true );\r
+ handleQueueMarkDefer( elem, type, "mark" );\r
+ }\r
+ }\r
+ },\r
+\r
+ queue: function( elem, type, data ) {\r
+ var q;\r
+ if ( elem ) {\r
+ type = ( type || "fx" ) + "queue";\r
+ q = jQuery._data( elem, type );\r
+\r
+ // Speed up dequeue by getting out quickly if this is just a lookup\r
+ if ( data ) {\r
+ if ( !q || jQuery.isArray(data) ) {\r
+ q = jQuery._data( elem, type, jQuery.makeArray(data) );\r
+ } else {\r
+ q.push( data );\r
+ }\r
+ }\r
+ return q || [];\r
+ }\r
+ },\r
+\r
+ dequeue: function( elem, type ) {\r
+ type = type || "fx";\r
+\r
+ var queue = jQuery.queue( elem, type ),\r
+ fn = queue.shift(),\r
+ hooks = {};\r
+\r
+ // If the fx queue is dequeued, always remove the progress sentinel\r
+ if ( fn === "inprogress" ) {\r
+ fn = queue.shift();\r
+ }\r
+\r
+ if ( fn ) {\r
+ // Add a progress sentinel to prevent the fx queue from being\r
+ // automatically dequeued\r
+ if ( type === "fx" ) {\r
+ queue.unshift( "inprogress" );\r
+ }\r
+\r
+ jQuery._data( elem, type + ".run", hooks );\r
+ fn.call( elem, function() {\r
+ jQuery.dequeue( elem, type );\r
+ }, hooks );\r
+ }\r
+\r
+ if ( !queue.length ) {\r
+ jQuery.removeData( elem, type + "queue " + type + ".run", true );\r
+ handleQueueMarkDefer( elem, type, "queue" );\r
+ }\r
+ }\r
+});\r
+\r
+jQuery.fn.extend({\r
+ queue: function( type, data ) {\r
+ var setter = 2;\r
+\r
+ if ( typeof type !== "string" ) {\r
+ data = type;\r
+ type = "fx";\r
+ setter--;\r
+ }\r
+\r
+ if ( arguments.length < setter ) {\r
+ return jQuery.queue( this[0], type );\r
+ }\r
+\r
+ return data === undefined ?\r
+ this :\r
+ this.each(function() {\r
+ var queue = jQuery.queue( this, type, data );\r
+\r
+ if ( type === "fx" && queue[0] !== "inprogress" ) {\r
+ jQuery.dequeue( this, type );\r
+ }\r
+ });\r
+ },\r
+ dequeue: function( type ) {\r
+ return this.each(function() {\r
+ jQuery.dequeue( this, type );\r
+ });\r
+ },\r
+ // Based off of the plugin by Clint Helfers, with permission.\r
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/\r
+ delay: function( time, type ) {\r
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\r
+ type = type || "fx";\r
+\r
+ return this.queue( type, function( next, hooks ) {\r
+ var timeout = setTimeout( next, time );\r
+ hooks.stop = function() {\r
+ clearTimeout( timeout );\r
+ };\r
+ });\r
+ },\r
+ clearQueue: function( type ) {\r
+ return this.queue( type || "fx", [] );\r
+ },\r
+ // Get a promise resolved when queues of a certain type\r
+ // are emptied (fx is the type by default)\r
+ promise: function( type, object ) {\r
+ if ( typeof type !== "string" ) {\r
+ object = type;\r
+ type = undefined;\r
+ }\r
+ type = type || "fx";\r
+ var defer = jQuery.Deferred(),\r
+ elements = this,\r
+ i = elements.length,\r
+ count = 1,\r
+ deferDataKey = type + "defer",\r
+ queueDataKey = type + "queue",\r
+ markDataKey = type + "mark",\r
+ tmp;\r
+ function resolve() {\r
+ if ( !( --count ) ) {\r
+ defer.resolveWith( elements, [ elements ] );\r
+ }\r
+ }\r
+ while( i-- ) {\r
+ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||\r
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||\r
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&\r
+ jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {\r
+ count++;\r
+ tmp.add( resolve );\r
+ }\r
+ }\r
+ resolve();\r
+ return defer.promise( object );\r
+ }\r
+});\r
+\r
+\r
+\r
+\r
+var rclass = /[\n\t\r]/g,\r
+ rspace = /\s+/,\r
+ rreturn = /\r/g,\r
+ rtype = /^(?:button|input)$/i,\r
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,\r
+ rclickable = /^a(?:rea)?$/i,\r
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,\r
+ getSetAttribute = jQuery.support.getSetAttribute,\r
+ nodeHook, boolHook, fixSpecified;\r
+\r
+jQuery.fn.extend({\r
+ attr: function( name, value ) {\r
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );\r
+ },\r
+\r
+ removeAttr: function( name ) {\r
+ return this.each(function() {\r
+ jQuery.removeAttr( this, name );\r
+ });\r
+ },\r
+\r
+ prop: function( name, value ) {\r
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );\r
+ },\r
+\r
+ removeProp: function( name ) {\r
+ name = jQuery.propFix[ name ] || name;\r
+ return this.each(function() {\r
+ // try/catch handles cases where IE balks (such as removing a property on window)\r
+ try {\r
+ this[ name ] = undefined;\r
+ delete this[ name ];\r
+ } catch( e ) {}\r
+ });\r
+ },\r
+\r
+ addClass: function( value ) {\r
+ var classNames, i, l, elem,\r
+ setClass, c, cl;\r
+\r
+ if ( jQuery.isFunction( value ) ) {\r
+ return this.each(function( j ) {\r
+ jQuery( this ).addClass( value.call(this, j, this.className) );\r
+ });\r
+ }\r
+\r
+ if ( value && typeof value === "string" ) {\r
+ classNames = value.split( rspace );\r
+\r
+ for ( i = 0, l = this.length; i < l; i++ ) {\r
+ elem = this[ i ];\r
+\r
+ if ( elem.nodeType === 1 ) {\r
+ if ( !elem.className && classNames.length === 1 ) {\r
+ elem.className = value;\r
+\r
+ } else {\r
+ setClass = " " + elem.className + " ";\r
+\r
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {\r
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {\r
+ setClass += classNames[ c ] + " ";\r
+ }\r
+ }\r
+ elem.className = jQuery.trim( setClass );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ removeClass: function( value ) {\r
+ var classNames, i, l, elem, className, c, cl;\r
+\r
+ if ( jQuery.isFunction( value ) ) {\r
+ return this.each(function( j ) {\r
+ jQuery( this ).removeClass( value.call(this, j, this.className) );\r
+ });\r
+ }\r
+\r
+ if ( (value && typeof value === "string") || value === undefined ) {\r
+ classNames = ( value || "" ).split( rspace );\r
+\r
+ for ( i = 0, l = this.length; i < l; i++ ) {\r
+ elem = this[ i ];\r
+\r
+ if ( elem.nodeType === 1 && elem.className ) {\r
+ if ( value ) {\r
+ className = (" " + elem.className + " ").replace( rclass, " " );\r
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {\r
+ className = className.replace(" " + classNames[ c ] + " ", " ");\r
+ }\r
+ elem.className = jQuery.trim( className );\r
+\r
+ } else {\r
+ elem.className = "";\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ toggleClass: function( value, stateVal ) {\r
+ var type = typeof value,\r
+ isBool = typeof stateVal === "boolean";\r
+\r
+ if ( jQuery.isFunction( value ) ) {\r
+ return this.each(function( i ) {\r
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );\r
+ });\r
+ }\r
+\r
+ return this.each(function() {\r
+ if ( type === "string" ) {\r
+ // toggle individual class names\r
+ var className,\r
+ i = 0,\r
+ self = jQuery( this ),\r
+ state = stateVal,\r
+ classNames = value.split( rspace );\r
+\r
+ while ( (className = classNames[ i++ ]) ) {\r
+ // check each className given, space seperated list\r
+ state = isBool ? state : !self.hasClass( className );\r
+ self[ state ? "addClass" : "removeClass" ]( className );\r
+ }\r
+\r
+ } else if ( type === "undefined" || type === "boolean" ) {\r
+ if ( this.className ) {\r
+ // store className if set\r
+ jQuery._data( this, "__className__", this.className );\r
+ }\r
+\r
+ // toggle whole className\r
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";\r
+ }\r
+ });\r
+ },\r
+\r
+ hasClass: function( selector ) {\r
+ var className = " " + selector + " ",\r
+ i = 0,\r
+ l = this.length;\r
+ for ( ; i < l; i++ ) {\r
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {\r
+ return true;\r
+ }\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ val: function( value ) {\r
+ var hooks, ret, isFunction,\r
+ elem = this[0];\r
+\r
+ if ( !arguments.length ) {\r
+ if ( elem ) {\r
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];\r
+\r
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {\r
+ return ret;\r
+ }\r
+\r
+ ret = elem.value;\r
+\r
+ return typeof ret === "string" ?\r
+ // handle most common string cases\r
+ ret.replace(rreturn, "") :\r
+ // handle cases where value is null/undef or number\r
+ ret == null ? "" : ret;\r
+ }\r
+\r
+ return;\r
+ }\r
+\r
+ isFunction = jQuery.isFunction( value );\r
+\r
+ return this.each(function( i ) {\r
+ var self = jQuery(this), val;\r
+\r
+ if ( this.nodeType !== 1 ) {\r
+ return;\r
+ }\r
+\r
+ if ( isFunction ) {\r
+ val = value.call( this, i, self.val() );\r
+ } else {\r
+ val = value;\r
+ }\r
+\r
+ // Treat null/undefined as ""; convert numbers to string\r
+ if ( val == null ) {\r
+ val = "";\r
+ } else if ( typeof val === "number" ) {\r
+ val += "";\r
+ } else if ( jQuery.isArray( val ) ) {\r
+ val = jQuery.map(val, function ( value ) {\r
+ return value == null ? "" : value + "";\r
+ });\r
+ }\r
+\r
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\r
+\r
+ // If set returns undefined, fall back to normal setting\r
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {\r
+ this.value = val;\r
+ }\r
+ });\r
+ }\r
+});\r
+\r
+jQuery.extend({\r
+ valHooks: {\r
+ option: {\r
+ get: function( elem ) {\r
+ // attributes.value is undefined in Blackberry 4.7 but\r
+ // uses .value. See #6932\r
+ var val = elem.attributes.value;\r
+ return !val || val.specified ? elem.value : elem.text;\r
+ }\r
+ },\r
+ select: {\r
+ get: function( elem ) {\r
+ var value, i, max, option,\r
+ index = elem.selectedIndex,\r
+ values = [],\r
+ options = elem.options,\r
+ one = elem.type === "select-one";\r
+\r
+ // Nothing was selected\r
+ if ( index < 0 ) {\r
+ return null;\r
+ }\r
+\r
+ // Loop through all the selected options\r
+ i = one ? index : 0;\r
+ max = one ? index + 1 : options.length;\r
+ for ( ; i < max; i++ ) {\r
+ option = options[ i ];\r
+\r
+ // Don't return options that are disabled or in a disabled optgroup\r
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&\r
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {\r
+\r
+ // Get the specific value for the option\r
+ value = jQuery( option ).val();\r
+\r
+ // We don't need an array for one selects\r
+ if ( one ) {\r
+ return value;\r
+ }\r
+\r
+ // Multi-Selects return an array\r
+ values.push( value );\r
+ }\r
+ }\r
+\r
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()\r
+ if ( one && !values.length && options.length ) {\r
+ return jQuery( options[ index ] ).val();\r
+ }\r
+\r
+ return values;\r
+ },\r
+\r
+ set: function( elem, value ) {\r
+ var values = jQuery.makeArray( value );\r
+\r
+ jQuery(elem).find("option").each(function() {\r
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;\r
+ });\r
+\r
+ if ( !values.length ) {\r
+ elem.selectedIndex = -1;\r
+ }\r
+ return values;\r
+ }\r
+ }\r
+ },\r
+\r
+ attrFn: {\r
+ val: true,\r
+ css: true,\r
+ html: true,\r
+ text: true,\r
+ data: true,\r
+ width: true,\r
+ height: true,\r
+ offset: true\r
+ },\r
+\r
+ attr: function( elem, name, value, pass ) {\r
+ var ret, hooks, notxml,\r
+ nType = elem.nodeType;\r
+\r
+ // don't get/set attributes on text, comment and attribute nodes\r
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\r
+ return;\r
+ }\r
+\r
+ if ( pass && name in jQuery.attrFn ) {\r
+ return jQuery( elem )[ name ]( value );\r
+ }\r
+\r
+ // Fallback to prop when attributes are not supported\r
+ if ( typeof elem.getAttribute === "undefined" ) {\r
+ return jQuery.prop( elem, name, value );\r
+ }\r
+\r
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );\r
+\r
+ // All attributes are lowercase\r
+ // Grab necessary hook if one is defined\r
+ if ( notxml ) {\r
+ name = name.toLowerCase();\r
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );\r
+ }\r
+\r
+ if ( value !== undefined ) {\r
+\r
+ if ( value === null ) {\r
+ jQuery.removeAttr( elem, name );\r
+ return;\r
+\r
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {\r
+ return ret;\r
+\r
+ } else {\r
+ elem.setAttribute( name, "" + value );\r
+ return value;\r
+ }\r
+\r
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {\r
+ return ret;\r
+\r
+ } else {\r
+\r
+ ret = elem.getAttribute( name );\r
+\r
+ // Non-existent attributes return null, we normalize to undefined\r
+ return ret === null ?\r
+ undefined :\r
+ ret;\r
+ }\r
+ },\r
+\r
+ removeAttr: function( elem, value ) {\r
+ var propName, attrNames, name, l, isBool,\r
+ i = 0;\r
+\r
+ if ( value && elem.nodeType === 1 ) {\r
+ attrNames = value.toLowerCase().split( rspace );\r
+ l = attrNames.length;\r
+\r
+ for ( ; i < l; i++ ) {\r
+ name = attrNames[ i ];\r
+\r
+ if ( name ) {\r
+ propName = jQuery.propFix[ name ] || name;\r
+ isBool = rboolean.test( name );\r
+\r
+ // See #9699 for explanation of this approach (setting first, then removal)\r
+ // Do not do this for boolean attributes (see #10870)\r
+ if ( !isBool ) {\r
+ jQuery.attr( elem, name, "" );\r
+ }\r
+ elem.removeAttribute( getSetAttribute ? name : propName );\r
+\r
+ // Set corresponding property to false for boolean attributes\r
+ if ( isBool && propName in elem ) {\r
+ elem[ propName ] = false;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ },\r
+\r
+ attrHooks: {\r
+ type: {\r
+ set: function( elem, value ) {\r
+ // We can't allow the type property to be changed (since it causes problems in IE)\r
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {\r
+ jQuery.error( "type property can't be changed" );\r
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {\r
+ // Setting the type on a radio button after the value resets the value in IE6-9\r
+ // Reset value to it's default in case type is set after value\r
+ // This is for element creation\r
+ var val = elem.value;\r
+ elem.setAttribute( "type", value );\r
+ if ( val ) {\r
+ elem.value = val;\r
+ }\r
+ return value;\r
+ }\r
+ }\r
+ },\r
+ // Use the value property for back compat\r
+ // Use the nodeHook for button elements in IE6/7 (#1954)\r
+ value: {\r
+ get: function( elem, name ) {\r
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {\r
+ return nodeHook.get( elem, name );\r
+ }\r
+ return name in elem ?\r
+ elem.value :\r
+ null;\r
+ },\r
+ set: function( elem, value, name ) {\r
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {\r
+ return nodeHook.set( elem, value, name );\r
+ }\r
+ // Does not return so that setAttribute is also used\r
+ elem.value = value;\r
+ }\r
+ }\r
+ },\r
+\r
+ propFix: {\r
+ tabindex: "tabIndex",\r
+ readonly: "readOnly",\r
+ "for": "htmlFor",\r
+ "class": "className",\r
+ maxlength: "maxLength",\r
+ cellspacing: "cellSpacing",\r
+ cellpadding: "cellPadding",\r
+ rowspan: "rowSpan",\r
+ colspan: "colSpan",\r
+ usemap: "useMap",\r
+ frameborder: "frameBorder",\r
+ contenteditable: "contentEditable"\r
+ },\r
+\r
+ prop: function( elem, name, value ) {\r
+ var ret, hooks, notxml,\r
+ nType = elem.nodeType;\r
+\r
+ // don't get/set properties on text, comment and attribute nodes\r
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\r
+ return;\r
+ }\r
+\r
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );\r
+\r
+ if ( notxml ) {\r
+ // Fix name and attach hooks\r
+ name = jQuery.propFix[ name ] || name;\r
+ hooks = jQuery.propHooks[ name ];\r
+ }\r
+\r
+ if ( value !== undefined ) {\r
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {\r
+ return ret;\r
+\r
+ } else {\r
+ return ( elem[ name ] = value );\r
+ }\r
+\r
+ } else {\r
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {\r
+ return ret;\r
+\r
+ } else {\r
+ return elem[ name ];\r
+ }\r
+ }\r
+ },\r
+\r
+ propHooks: {\r
+ tabIndex: {\r
+ get: function( elem ) {\r
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set\r
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\r
+ var attributeNode = elem.getAttributeNode("tabindex");\r
+\r
+ return attributeNode && attributeNode.specified ?\r
+ parseInt( attributeNode.value, 10 ) :\r
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?\r
+ 0 :\r
+ undefined;\r
+ }\r
+ }\r
+ }\r
+});\r
+\r
+// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)\r
+jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;\r
+\r
+// Hook for boolean attributes\r
+boolHook = {\r
+ get: function( elem, name ) {\r
+ // Align boolean attributes with corresponding properties\r
+ // Fall back to attribute presence where some booleans are not supported\r
+ var attrNode,\r
+ property = jQuery.prop( elem, name );\r
+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?\r
+ name.toLowerCase() :\r
+ undefined;\r
+ },\r
+ set: function( elem, value, name ) {\r
+ var propName;\r
+ if ( value === false ) {\r
+ // Remove boolean attributes when set to false\r
+ jQuery.removeAttr( elem, name );\r
+ } else {\r
+ // value is true since we know at this point it's type boolean and not false\r
+ // Set boolean attributes to the same name and set the DOM property\r
+ propName = jQuery.propFix[ name ] || name;\r
+ if ( propName in elem ) {\r
+ // Only set the IDL specifically if it already exists on the element\r
+ elem[ propName ] = true;\r
+ }\r
+\r
+ elem.setAttribute( name, name.toLowerCase() );\r
+ }\r
+ return name;\r
+ }\r
+};\r
+\r
+// IE6/7 do not support getting/setting some attributes with get/setAttribute\r
+if ( !getSetAttribute ) {\r
+\r
+ fixSpecified = {\r
+ name: true,\r
+ id: true,\r
+ coords: true\r
+ };\r
+\r
+ // Use this for any attribute in IE6/7\r
+ // This fixes almost every IE6/7 issue\r
+ nodeHook = jQuery.valHooks.button = {\r
+ get: function( elem, name ) {\r
+ var ret;\r
+ ret = elem.getAttributeNode( name );\r
+ return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?\r
+ ret.nodeValue :\r
+ undefined;\r
+ },\r
+ set: function( elem, value, name ) {\r
+ // Set the existing or create a new attribute node\r
+ var ret = elem.getAttributeNode( name );\r
+ if ( !ret ) {\r
+ ret = document.createAttribute( name );\r
+ elem.setAttributeNode( ret );\r
+ }\r
+ return ( ret.nodeValue = value + "" );\r
+ }\r
+ };\r
+\r
+ // Apply the nodeHook to tabindex\r
+ jQuery.attrHooks.tabindex.set = nodeHook.set;\r
+\r
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )\r
+ // This is for removals\r
+ jQuery.each([ "width", "height" ], function( i, name ) {\r
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\r
+ set: function( elem, value ) {\r
+ if ( value === "" ) {\r
+ elem.setAttribute( name, "auto" );\r
+ return value;\r
+ }\r
+ }\r
+ });\r
+ });\r
+\r
+ // Set contenteditable to false on removals(#10429)\r
+ // Setting to empty string throws an error as an invalid value\r
+ jQuery.attrHooks.contenteditable = {\r
+ get: nodeHook.get,\r
+ set: function( elem, value, name ) {\r
+ if ( value === "" ) {\r
+ value = "false";\r
+ }\r
+ nodeHook.set( elem, value, name );\r
+ }\r
+ };\r
+}\r
+\r
+\r
+// Some attributes require a special call on IE\r
+if ( !jQuery.support.hrefNormalized ) {\r
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {\r
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\r
+ get: function( elem ) {\r
+ var ret = elem.getAttribute( name, 2 );\r
+ return ret === null ? undefined : ret;\r
+ }\r
+ });\r
+ });\r
+}\r
+\r
+if ( !jQuery.support.style ) {\r
+ jQuery.attrHooks.style = {\r
+ get: function( elem ) {\r
+ // Return undefined in the case of empty string\r
+ // Normalize to lowercase since IE uppercases css property names\r
+ return elem.style.cssText.toLowerCase() || undefined;\r
+ },\r
+ set: function( elem, value ) {\r
+ return ( elem.style.cssText = "" + value );\r
+ }\r
+ };\r
+}\r
+\r
+// Safari mis-reports the default selected property of an option\r
+// Accessing the parent's selectedIndex property fixes it\r
+if ( !jQuery.support.optSelected ) {\r
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {\r
+ get: function( elem ) {\r
+ var parent = elem.parentNode;\r
+\r
+ if ( parent ) {\r
+ parent.selectedIndex;\r
+\r
+ // Make sure that it also works with optgroups, see #5701\r
+ if ( parent.parentNode ) {\r
+ parent.parentNode.selectedIndex;\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+ });\r
+}\r
+\r
+// IE6/7 call enctype encoding\r
+if ( !jQuery.support.enctype ) {\r
+ jQuery.propFix.enctype = "encoding";\r
+}\r
+\r
+// Radios and checkboxes getter/setter\r
+if ( !jQuery.support.checkOn ) {\r
+ jQuery.each([ "radio", "checkbox" ], function() {\r
+ jQuery.valHooks[ this ] = {\r
+ get: function( elem ) {\r
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified\r
+ return elem.getAttribute("value") === null ? "on" : elem.value;\r
+ }\r
+ };\r
+ });\r
+}\r
+jQuery.each([ "radio", "checkbox" ], function() {\r
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {\r
+ set: function( elem, value ) {\r
+ if ( jQuery.isArray( value ) ) {\r
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );\r
+ }\r
+ }\r
+ });\r
+});\r
+\r
+\r
+\r
+\r
+var rformElems = /^(?:textarea|input|select)$/i,\r
+ rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,\r
+ rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,\r
+ rkeyEvent = /^key/,\r
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,\r
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\r
+ rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,\r
+ quickParse = function( selector ) {\r
+ var quick = rquickIs.exec( selector );\r
+ if ( quick ) {\r
+ // 0 1 2 3\r
+ // [ _, tag, id, class ]\r
+ quick[1] = ( quick[1] || "" ).toLowerCase();\r
+ quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );\r
+ }\r
+ return quick;\r
+ },\r
+ quickIs = function( elem, m ) {\r
+ var attrs = elem.attributes || {};\r
+ return (\r
+ (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&\r
+ (!m[2] || (attrs.id || {}).value === m[2]) &&\r
+ (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))\r
+ );\r
+ },\r
+ hoverHack = function( events ) {\r
+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );\r
+ };\r
+\r
+/*\r
+ * Helper functions for managing events -- not part of the public interface.\r
+ * Props to Dean Edwards' addEvent library for many of the ideas.\r
+ */\r
+jQuery.event = {\r
+\r
+ add: function( elem, types, handler, data, selector ) {\r
+\r
+ var elemData, eventHandle, events,\r
+ t, tns, type, namespaces, handleObj,\r
+ handleObjIn, quick, handlers, special;\r
+\r
+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)\r
+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {\r
+ return;\r
+ }\r
+\r
+ // Caller can pass in an object of custom data in lieu of the handler\r
+ if ( handler.handler ) {\r
+ handleObjIn = handler;\r
+ handler = handleObjIn.handler;\r
+ selector = handleObjIn.selector;\r
+ }\r
+\r
+ // Make sure that the handler has a unique ID, used to find/remove it later\r
+ if ( !handler.guid ) {\r
+ handler.guid = jQuery.guid++;\r
+ }\r
+\r
+ // Init the element's event structure and main handler, if this is the first\r
+ events = elemData.events;\r
+ if ( !events ) {\r
+ elemData.events = events = {};\r
+ }\r
+ eventHandle = elemData.handle;\r
+ if ( !eventHandle ) {\r
+ elemData.handle = eventHandle = function( e ) {\r
+ // Discard the second event of a jQuery.event.trigger() and\r
+ // when an event is called after a page has unloaded\r
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?\r
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :\r
+ undefined;\r
+ };\r
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events\r
+ eventHandle.elem = elem;\r
+ }\r
+\r
+ // Handle multiple events separated by a space\r
+ // jQuery(...).bind("mouseover mouseout", fn);\r
+ types = jQuery.trim( hoverHack(types) ).split( " " );\r
+ for ( t = 0; t < types.length; t++ ) {\r
+\r
+ tns = rtypenamespace.exec( types[t] ) || [];\r
+ type = tns[1];\r
+ namespaces = ( tns[2] || "" ).split( "." ).sort();\r
+\r
+ // If event changes its type, use the special event handlers for the changed type\r
+ special = jQuery.event.special[ type ] || {};\r
+\r
+ // If selector defined, determine special event api type, otherwise given type\r
+ type = ( selector ? special.delegateType : special.bindType ) || type;\r
+\r
+ // Update special based on newly reset type\r
+ special = jQuery.event.special[ type ] || {};\r
+\r
+ // handleObj is passed to all event handlers\r
+ handleObj = jQuery.extend({\r
+ type: type,\r
+ origType: tns[1],\r
+ data: data,\r
+ handler: handler,\r
+ guid: handler.guid,\r
+ selector: selector,\r
+ quick: selector && quickParse( selector ),\r
+ namespace: namespaces.join(".")\r
+ }, handleObjIn );\r
+\r
+ // Init the event handler queue if we're the first\r
+ handlers = events[ type ];\r
+ if ( !handlers ) {\r
+ handlers = events[ type ] = [];\r
+ handlers.delegateCount = 0;\r
+\r
+ // Only use addEventListener/attachEvent if the special events handler returns false\r
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {\r
+ // Bind the global event handler to the element\r
+ if ( elem.addEventListener ) {\r
+ elem.addEventListener( type, eventHandle, false );\r
+\r
+ } else if ( elem.attachEvent ) {\r
+ elem.attachEvent( "on" + type, eventHandle );\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( special.add ) {\r
+ special.add.call( elem, handleObj );\r
+\r
+ if ( !handleObj.handler.guid ) {\r
+ handleObj.handler.guid = handler.guid;\r
+ }\r
+ }\r
+\r
+ // Add to the element's handler list, delegates in front\r
+ if ( selector ) {\r
+ handlers.splice( handlers.delegateCount++, 0, handleObj );\r
+ } else {\r
+ handlers.push( handleObj );\r
+ }\r
+\r
+ // Keep track of which events have ever been used, for event optimization\r
+ jQuery.event.global[ type ] = true;\r
+ }\r
+\r
+ // Nullify elem to prevent memory leaks in IE\r
+ elem = null;\r
+ },\r
+\r
+ global: {},\r
+\r
+ // Detach an event or set of events from an element\r
+ remove: function( elem, types, handler, selector, mappedTypes ) {\r
+\r
+ var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),\r
+ t, tns, type, origType, namespaces, origCount,\r
+ j, events, special, handle, eventType, handleObj;\r
+\r
+ if ( !elemData || !(events = elemData.events) ) {\r
+ return;\r
+ }\r
+\r
+ // Once for each type.namespace in types; type may be omitted\r
+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");\r
+ for ( t = 0; t < types.length; t++ ) {\r
+ tns = rtypenamespace.exec( types[t] ) || [];\r
+ type = origType = tns[1];\r
+ namespaces = tns[2];\r
+\r
+ // Unbind all events (on this namespace, if provided) for the element\r
+ if ( !type ) {\r
+ for ( type in events ) {\r
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );\r
+ }\r
+ continue;\r
+ }\r
+\r
+ special = jQuery.event.special[ type ] || {};\r
+ type = ( selector? special.delegateType : special.bindType ) || type;\r
+ eventType = events[ type ] || [];\r
+ origCount = eventType.length;\r
+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;\r
+\r
+ // Remove matching events\r
+ for ( j = 0; j < eventType.length; j++ ) {\r
+ handleObj = eventType[ j ];\r
+\r
+ if ( ( mappedTypes || origType === handleObj.origType ) &&\r
+ ( !handler || handler.guid === handleObj.guid ) &&\r
+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&\r
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {\r
+ eventType.splice( j--, 1 );\r
+\r
+ if ( handleObj.selector ) {\r
+ eventType.delegateCount--;\r
+ }\r
+ if ( special.remove ) {\r
+ special.remove.call( elem, handleObj );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Remove generic event handler if we removed something and no more handlers exist\r
+ // (avoids potential for endless recursion during removal of special event handlers)\r
+ if ( eventType.length === 0 && origCount !== eventType.length ) {\r
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {\r
+ jQuery.removeEvent( elem, type, elemData.handle );\r
+ }\r
+\r
+ delete events[ type ];\r
+ }\r
+ }\r
+\r
+ // Remove the expando if it's no longer used\r
+ if ( jQuery.isEmptyObject( events ) ) {\r
+ handle = elemData.handle;\r
+ if ( handle ) {\r
+ handle.elem = null;\r
+ }\r
+\r
+ // removeData also checks for emptiness and clears the expando if empty\r
+ // so use it instead of delete\r
+ jQuery.removeData( elem, [ "events", "handle" ], true );\r
+ }\r
+ },\r
+\r
+ // Events that are safe to short-circuit if no handlers are attached.\r
+ // Native DOM events should not be added, they may have inline handlers.\r
+ customEvent: {\r
+ "getData": true,\r
+ "setData": true,\r
+ "changeData": true\r
+ },\r
+\r
+ trigger: function( event, data, elem, onlyHandlers ) {\r
+ // Don't do events on text and comment nodes\r
+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {\r
+ return;\r
+ }\r
+\r
+ // Event object or event type\r
+ var type = event.type || event,\r
+ namespaces = [],\r
+ cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;\r
+\r
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now\r
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\r
+ return;\r
+ }\r
+\r
+ if ( type.indexOf( "!" ) >= 0 ) {\r
+ // Exclusive events trigger only for the exact event (no namespaces)\r
+ type = type.slice(0, -1);\r
+ exclusive = true;\r
+ }\r
+\r
+ if ( type.indexOf( "." ) >= 0 ) {\r
+ // Namespaced trigger; create a regexp to match event type in handle()\r
+ namespaces = type.split(".");\r
+ type = namespaces.shift();\r
+ namespaces.sort();\r
+ }\r
+\r
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {\r
+ // No jQuery handlers for this event type, and it can't have inline handlers\r
+ return;\r
+ }\r
+\r
+ // Caller can pass in an Event, Object, or just an event type string\r
+ event = typeof event === "object" ?\r
+ // jQuery.Event object\r
+ event[ jQuery.expando ] ? event :\r
+ // Object literal\r
+ new jQuery.Event( type, event ) :\r
+ // Just the event type (string)\r
+ new jQuery.Event( type );\r
+\r
+ event.type = type;\r
+ event.isTrigger = true;\r
+ event.exclusive = exclusive;\r
+ event.namespace = namespaces.join( "." );\r
+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;\r
+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";\r
+\r
+ // Handle a global trigger\r
+ if ( !elem ) {\r
+\r
+ // TODO: Stop taunting the data cache; remove global events and always attach to document\r
+ cache = jQuery.cache;\r
+ for ( i in cache ) {\r
+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {\r
+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );\r
+ }\r
+ }\r
+ return;\r
+ }\r
+\r
+ // Clean up the event in case it is being reused\r
+ event.result = undefined;\r
+ if ( !event.target ) {\r
+ event.target = elem;\r
+ }\r
+\r
+ // Clone any incoming data and prepend the event, creating the handler arg list\r
+ data = data != null ? jQuery.makeArray( data ) : [];\r
+ data.unshift( event );\r
+\r
+ // Allow special events to draw outside the lines\r
+ special = jQuery.event.special[ type ] || {};\r
+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {\r
+ return;\r
+ }\r
+\r
+ // Determine event propagation path in advance, per W3C events spec (#9951)\r
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\r
+ eventPath = [[ elem, special.bindType || type ]];\r
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\r
+\r
+ bubbleType = special.delegateType || type;\r
+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;\r
+ old = null;\r
+ for ( ; cur; cur = cur.parentNode ) {\r
+ eventPath.push([ cur, bubbleType ]);\r
+ old = cur;\r
+ }\r
+\r
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)\r
+ if ( old && old === elem.ownerDocument ) {\r
+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);\r
+ }\r
+ }\r
+\r
+ // Fire handlers on the event path\r
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {\r
+\r
+ cur = eventPath[i][0];\r
+ event.type = eventPath[i][1];\r
+\r
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );\r
+ if ( handle ) {\r
+ handle.apply( cur, data );\r
+ }\r
+ // Note that this is a bare JS function and not a jQuery handler\r
+ handle = ontype && cur[ ontype ];\r
+ if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {\r
+ event.preventDefault();\r
+ }\r
+ }\r
+ event.type = type;\r
+\r
+ // If nobody prevented the default action, do it now\r
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {\r
+\r
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&\r
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {\r
+\r
+ // Call a native DOM method on the target with the same name name as the event.\r
+ // Can't use an .isFunction() check here because IE6/7 fails that test.\r
+ // Don't do default actions on window, that's where global variables be (#6170)\r
+ // IE<9 dies on focus/blur to hidden element (#1486)\r
+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {\r
+\r
+ // Don't re-trigger an onFOO event when we call its FOO() method\r
+ old = elem[ ontype ];\r
+\r
+ if ( old ) {\r
+ elem[ ontype ] = null;\r
+ }\r
+\r
+ // Prevent re-triggering of the same event, since we already bubbled it above\r
+ jQuery.event.triggered = type;\r
+ elem[ type ]();\r
+ jQuery.event.triggered = undefined;\r
+\r
+ if ( old ) {\r
+ elem[ ontype ] = old;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return event.result;\r
+ },\r
+\r
+ dispatch: function( event ) {\r
+\r
+ // Make a writable jQuery.Event from the native event object\r
+ event = jQuery.event.fix( event || window.event );\r
+\r
+ var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),\r
+ delegateCount = handlers.delegateCount,\r
+ args = [].slice.call( arguments, 0 ),\r
+ run_all = !event.exclusive && !event.namespace,\r
+ special = jQuery.event.special[ event.type ] || {},\r
+ handlerQueue = [],\r
+ i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;\r
+\r
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event\r
+ args[0] = event;\r
+ event.delegateTarget = this;\r
+\r
+ // Call the preDispatch hook for the mapped type, and let it bail if desired\r
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\r
+ return;\r
+ }\r
+\r
+ // Determine handlers that should run if there are delegated events\r
+ // Avoid non-left-click bubbling in Firefox (#3861)\r
+ if ( delegateCount && !(event.button && event.type === "click") ) {\r
+\r
+ // Pregenerate a single jQuery object for reuse with .is()\r
+ jqcur = jQuery(this);\r
+ jqcur.context = this.ownerDocument || this;\r
+\r
+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {\r
+\r
+ // Don't process events on disabled elements (#6911, #8165)\r
+ if ( cur.disabled !== true ) {\r
+ selMatch = {};\r
+ matches = [];\r
+ jqcur[0] = cur;\r
+ for ( i = 0; i < delegateCount; i++ ) {\r
+ handleObj = handlers[ i ];\r
+ sel = handleObj.selector;\r
+\r
+ if ( selMatch[ sel ] === undefined ) {\r
+ selMatch[ sel ] = (\r
+ handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )\r
+ );\r
+ }\r
+ if ( selMatch[ sel ] ) {\r
+ matches.push( handleObj );\r
+ }\r
+ }\r
+ if ( matches.length ) {\r
+ handlerQueue.push({ elem: cur, matches: matches });\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // Add the remaining (directly-bound) handlers\r
+ if ( handlers.length > delegateCount ) {\r
+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });\r
+ }\r
+\r
+ // Run delegates first; they may want to stop propagation beneath us\r
+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {\r
+ matched = handlerQueue[ i ];\r
+ event.currentTarget = matched.elem;\r
+\r
+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {\r
+ handleObj = matched.matches[ j ];\r
+\r
+ // Triggered event must either 1) be non-exclusive and have no namespace, or\r
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).\r
+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {\r
+\r
+ event.data = handleObj.data;\r
+ event.handleObj = handleObj;\r
+\r
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )\r
+ .apply( matched.elem, args );\r
+\r
+ if ( ret !== undefined ) {\r
+ event.result = ret;\r
+ if ( ret === false ) {\r
+ event.preventDefault();\r
+ event.stopPropagation();\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // Call the postDispatch hook for the mapped type\r
+ if ( special.postDispatch ) {\r
+ special.postDispatch.call( this, event );\r
+ }\r
+\r
+ return event.result;\r
+ },\r
+\r
+ // Includes some event props shared by KeyEvent and MouseEvent\r
+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***\r
+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),\r
+\r
+ fixHooks: {},\r
+\r
+ keyHooks: {\r
+ props: "char charCode key keyCode".split(" "),\r
+ filter: function( event, original ) {\r
+\r
+ // Add which for key events\r
+ if ( event.which == null ) {\r
+ event.which = original.charCode != null ? original.charCode : original.keyCode;\r
+ }\r
+\r
+ return event;\r
+ }\r
+ },\r
+\r
+ mouseHooks: {\r
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),\r
+ filter: function( event, original ) {\r
+ var eventDoc, doc, body,\r
+ button = original.button,\r
+ fromElement = original.fromElement;\r
+\r
+ // Calculate pageX/Y if missing and clientX/Y available\r
+ if ( event.pageX == null && original.clientX != null ) {\r
+ eventDoc = event.target.ownerDocument || document;\r
+ doc = eventDoc.documentElement;\r
+ body = eventDoc.body;\r
+\r
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );\r
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );\r
+ }\r
+\r
+ // Add relatedTarget, if necessary\r
+ if ( !event.relatedTarget && fromElement ) {\r
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;\r
+ }\r
+\r
+ // Add which for click: 1 === left; 2 === middle; 3 === right\r
+ // Note: button is not normalized, so don't use it\r
+ if ( !event.which && button !== undefined ) {\r
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\r
+ }\r
+\r
+ return event;\r
+ }\r
+ },\r
+\r
+ fix: function( event ) {\r
+ if ( event[ jQuery.expando ] ) {\r
+ return event;\r
+ }\r
+\r
+ // Create a writable copy of the event object and normalize some properties\r
+ var i, prop,\r
+ originalEvent = event,\r
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},\r
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;\r
+\r
+ event = jQuery.Event( originalEvent );\r
+\r
+ for ( i = copy.length; i; ) {\r
+ prop = copy[ --i ];\r
+ event[ prop ] = originalEvent[ prop ];\r
+ }\r
+\r
+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)\r
+ if ( !event.target ) {\r
+ event.target = originalEvent.srcElement || document;\r
+ }\r
+\r
+ // Target should not be a text node (#504, Safari)\r
+ if ( event.target.nodeType === 3 ) {\r
+ event.target = event.target.parentNode;\r
+ }\r
+\r
+ // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)\r
+ if ( event.metaKey === undefined ) {\r
+ event.metaKey = event.ctrlKey;\r
+ }\r
+\r
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;\r
+ },\r
+\r
+ special: {\r
+ ready: {\r
+ // Make sure the ready event is setup\r
+ setup: jQuery.bindReady\r
+ },\r
+\r
+ load: {\r
+ // Prevent triggered image.load events from bubbling to window.load\r
+ noBubble: true\r
+ },\r
+\r
+ focus: {\r
+ delegateType: "focusin"\r
+ },\r
+ blur: {\r
+ delegateType: "focusout"\r
+ },\r
+\r
+ beforeunload: {\r
+ setup: function( data, namespaces, eventHandle ) {\r
+ // We only want to do this special case on windows\r
+ if ( jQuery.isWindow( this ) ) {\r
+ this.onbeforeunload = eventHandle;\r
+ }\r
+ },\r
+\r
+ teardown: function( namespaces, eventHandle ) {\r
+ if ( this.onbeforeunload === eventHandle ) {\r
+ this.onbeforeunload = null;\r
+ }\r
+ }\r
+ }\r
+ },\r
+\r
+ simulate: function( type, elem, event, bubble ) {\r
+ // Piggyback on a donor event to simulate a different one.\r
+ // Fake originalEvent to avoid donor's stopPropagation, but if the\r
+ // simulated event prevents default then we do the same on the donor.\r
+ var e = jQuery.extend(\r
+ new jQuery.Event(),\r
+ event,\r
+ { type: type,\r
+ isSimulated: true,\r
+ originalEvent: {}\r
+ }\r
+ );\r
+ if ( bubble ) {\r
+ jQuery.event.trigger( e, null, elem );\r
+ } else {\r
+ jQuery.event.dispatch.call( elem, e );\r
+ }\r
+ if ( e.isDefaultPrevented() ) {\r
+ event.preventDefault();\r
+ }\r
+ }\r
+};\r
+\r
+// Some plugins are using, but it's undocumented/deprecated and will be removed.\r
+// The 1.7 special event interface should provide all the hooks needed now.\r
+jQuery.event.handle = jQuery.event.dispatch;\r
+\r
+jQuery.removeEvent = document.removeEventListener ?\r
+ function( elem, type, handle ) {\r
+ if ( elem.removeEventListener ) {\r
+ elem.removeEventListener( type, handle, false );\r
+ }\r
+ } :\r
+ function( elem, type, handle ) {\r
+ if ( elem.detachEvent ) {\r
+ elem.detachEvent( "on" + type, handle );\r
+ }\r
+ };\r
+\r
+jQuery.Event = function( src, props ) {\r
+ // Allow instantiation without the 'new' keyword\r
+ if ( !(this instanceof jQuery.Event) ) {\r
+ return new jQuery.Event( src, props );\r
+ }\r
+\r
+ // Event object\r
+ if ( src && src.type ) {\r
+ this.originalEvent = src;\r
+ this.type = src.type;\r
+\r
+ // Events bubbling up the document may have been marked as prevented\r
+ // by a handler lower down the tree; reflect the correct value.\r
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||\r
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;\r
+\r
+ // Event type\r
+ } else {\r
+ this.type = src;\r
+ }\r
+\r
+ // Put explicitly provided properties onto the event object\r
+ if ( props ) {\r
+ jQuery.extend( this, props );\r
+ }\r
+\r
+ // Create a timestamp if incoming event doesn't have one\r
+ this.timeStamp = src && src.timeStamp || jQuery.now();\r
+\r
+ // Mark it as fixed\r
+ this[ jQuery.expando ] = true;\r
+};\r
+\r
+function returnFalse() {\r
+ return false;\r
+}\r
+function returnTrue() {\r
+ return true;\r
+}\r
+\r
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\r
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\r
+jQuery.Event.prototype = {\r
+ preventDefault: function() {\r
+ this.isDefaultPrevented = returnTrue;\r
+\r
+ var e = this.originalEvent;\r
+ if ( !e ) {\r
+ return;\r
+ }\r
+\r
+ // if preventDefault exists run it on the original event\r
+ if ( e.preventDefault ) {\r
+ e.preventDefault();\r
+\r
+ // otherwise set the returnValue property of the original event to false (IE)\r
+ } else {\r
+ e.returnValue = false;\r
+ }\r
+ },\r
+ stopPropagation: function() {\r
+ this.isPropagationStopped = returnTrue;\r
+\r
+ var e = this.originalEvent;\r
+ if ( !e ) {\r
+ return;\r
+ }\r
+ // if stopPropagation exists run it on the original event\r
+ if ( e.stopPropagation ) {\r
+ e.stopPropagation();\r
+ }\r
+ // otherwise set the cancelBubble property of the original event to true (IE)\r
+ e.cancelBubble = true;\r
+ },\r
+ stopImmediatePropagation: function() {\r
+ this.isImmediatePropagationStopped = returnTrue;\r
+ this.stopPropagation();\r
+ },\r
+ isDefaultPrevented: returnFalse,\r
+ isPropagationStopped: returnFalse,\r
+ isImmediatePropagationStopped: returnFalse\r
+};\r
+\r
+// Create mouseenter/leave events using mouseover/out and event-time checks\r
+jQuery.each({\r
+ mouseenter: "mouseover",\r
+ mouseleave: "mouseout"\r
+}, function( orig, fix ) {\r
+ jQuery.event.special[ orig ] = {\r
+ delegateType: fix,\r
+ bindType: fix,\r
+\r
+ handle: function( event ) {\r
+ var target = this,\r
+ related = event.relatedTarget,\r
+ handleObj = event.handleObj,\r
+ selector = handleObj.selector,\r
+ ret;\r
+\r
+ // For mousenter/leave call the handler if related is outside the target.\r
+ // NB: No relatedTarget if the mouse left/entered the browser window\r
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {\r
+ event.type = handleObj.origType;\r
+ ret = handleObj.handler.apply( this, arguments );\r
+ event.type = fix;\r
+ }\r
+ return ret;\r
+ }\r
+ };\r
+});\r
+\r
+// IE submit delegation\r
+if ( !jQuery.support.submitBubbles ) {\r
+\r
+ jQuery.event.special.submit = {\r
+ setup: function() {\r
+ // Only need this for delegated form submit events\r
+ if ( jQuery.nodeName( this, "form" ) ) {\r
+ return false;\r
+ }\r
+\r
+ // Lazy-add a submit handler when a descendant form may potentially be submitted\r
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {\r
+ // Node name check avoids a VML-related crash in IE (#9807)\r
+ var elem = e.target,\r
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;\r
+ if ( form && !form._submit_attached ) {\r
+ jQuery.event.add( form, "submit._submit", function( event ) {\r
+ event._submit_bubble = true;\r
+ });\r
+ form._submit_attached = true;\r
+ }\r
+ });\r
+ // return undefined since we don't need an event listener\r
+ },\r
+ \r
+ postDispatch: function( event ) {\r
+ // If form was submitted by the user, bubble the event up the tree\r
+ if ( event._submit_bubble ) {\r
+ delete event._submit_bubble;\r
+ if ( this.parentNode && !event.isTrigger ) {\r
+ jQuery.event.simulate( "submit", this.parentNode, event, true );\r
+ }\r
+ }\r
+ },\r
+\r
+ teardown: function() {\r
+ // Only need this for delegated form submit events\r
+ if ( jQuery.nodeName( this, "form" ) ) {\r
+ return false;\r
+ }\r
+\r
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above\r
+ jQuery.event.remove( this, "._submit" );\r
+ }\r
+ };\r
+}\r
+\r
+// IE change delegation and checkbox/radio fix\r
+if ( !jQuery.support.changeBubbles ) {\r
+\r
+ jQuery.event.special.change = {\r
+\r
+ setup: function() {\r
+\r
+ if ( rformElems.test( this.nodeName ) ) {\r
+ // IE doesn't fire change on a check/radio until blur; trigger it on click\r
+ // after a propertychange. Eat the blur-change in special.change.handle.\r
+ // This still fires onchange a second time for check/radio after blur.\r
+ if ( this.type === "checkbox" || this.type === "radio" ) {\r
+ jQuery.event.add( this, "propertychange._change", function( event ) {\r
+ if ( event.originalEvent.propertyName === "checked" ) {\r
+ this._just_changed = true;\r
+ }\r
+ });\r
+ jQuery.event.add( this, "click._change", function( event ) {\r
+ if ( this._just_changed && !event.isTrigger ) {\r
+ this._just_changed = false;\r
+ jQuery.event.simulate( "change", this, event, true );\r
+ }\r
+ });\r
+ }\r
+ return false;\r
+ }\r
+ // Delegated event; lazy-add a change handler on descendant inputs\r
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {\r
+ var elem = e.target;\r
+\r
+ if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {\r
+ jQuery.event.add( elem, "change._change", function( event ) {\r
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {\r
+ jQuery.event.simulate( "change", this.parentNode, event, true );\r
+ }\r
+ });\r
+ elem._change_attached = true;\r
+ }\r
+ });\r
+ },\r
+\r
+ handle: function( event ) {\r
+ var elem = event.target;\r
+\r
+ // Swallow native change events from checkbox/radio, we already triggered them above\r
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {\r
+ return event.handleObj.handler.apply( this, arguments );\r
+ }\r
+ },\r
+\r
+ teardown: function() {\r
+ jQuery.event.remove( this, "._change" );\r
+\r
+ return rformElems.test( this.nodeName );\r
+ }\r
+ };\r
+}\r
+\r
+// Create "bubbling" focus and blur events\r
+if ( !jQuery.support.focusinBubbles ) {\r
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {\r
+\r
+ // Attach a single capturing handler while someone wants focusin/focusout\r
+ var attaches = 0,\r
+ handler = function( event ) {\r
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );\r
+ };\r
+\r
+ jQuery.event.special[ fix ] = {\r
+ setup: function() {\r
+ if ( attaches++ === 0 ) {\r
+ document.addEventListener( orig, handler, true );\r
+ }\r
+ },\r
+ teardown: function() {\r
+ if ( --attaches === 0 ) {\r
+ document.removeEventListener( orig, handler, true );\r
+ }\r
+ }\r
+ };\r
+ });\r
+}\r
+\r
+jQuery.fn.extend({\r
+\r
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {\r
+ var origFn, type;\r
+\r
+ // Types can be a map of types/handlers\r
+ if ( typeof types === "object" ) {\r
+ // ( types-Object, selector, data )\r
+ if ( typeof selector !== "string" ) { // && selector != null\r
+ // ( types-Object, data )\r
+ data = data || selector;\r
+ selector = undefined;\r
+ }\r
+ for ( type in types ) {\r
+ this.on( type, selector, data, types[ type ], one );\r
+ }\r
+ return this;\r
+ }\r
+\r
+ if ( data == null && fn == null ) {\r
+ // ( types, fn )\r
+ fn = selector;\r
+ data = selector = undefined;\r
+ } else if ( fn == null ) {\r
+ if ( typeof selector === "string" ) {\r
+ // ( types, selector, fn )\r
+ fn = data;\r
+ data = undefined;\r
+ } else {\r
+ // ( types, data, fn )\r
+ fn = data;\r
+ data = selector;\r
+ selector = undefined;\r
+ }\r
+ }\r
+ if ( fn === false ) {\r
+ fn = returnFalse;\r
+ } else if ( !fn ) {\r
+ return this;\r
+ }\r
+\r
+ if ( one === 1 ) {\r
+ origFn = fn;\r
+ fn = function( event ) {\r
+ // Can use an empty set, since event contains the info\r
+ jQuery().off( event );\r
+ return origFn.apply( this, arguments );\r
+ };\r
+ // Use same guid so caller can remove using origFn\r
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\r
+ }\r
+ return this.each( function() {\r
+ jQuery.event.add( this, types, fn, data, selector );\r
+ });\r
+ },\r
+ one: function( types, selector, data, fn ) {\r
+ return this.on( types, selector, data, fn, 1 );\r
+ },\r
+ off: function( types, selector, fn ) {\r
+ if ( types && types.preventDefault && types.handleObj ) {\r
+ // ( event ) dispatched jQuery.Event\r
+ var handleObj = types.handleObj;\r
+ jQuery( types.delegateTarget ).off(\r
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,\r
+ handleObj.selector,\r
+ handleObj.handler\r
+ );\r
+ return this;\r
+ }\r
+ if ( typeof types === "object" ) {\r
+ // ( types-object [, selector] )\r
+ for ( var type in types ) {\r
+ this.off( type, selector, types[ type ] );\r
+ }\r
+ return this;\r
+ }\r
+ if ( selector === false || typeof selector === "function" ) {\r
+ // ( types [, fn] )\r
+ fn = selector;\r
+ selector = undefined;\r
+ }\r
+ if ( fn === false ) {\r
+ fn = returnFalse;\r
+ }\r
+ return this.each(function() {\r
+ jQuery.event.remove( this, types, fn, selector );\r
+ });\r
+ },\r
+\r
+ bind: function( types, data, fn ) {\r
+ return this.on( types, null, data, fn );\r
+ },\r
+ unbind: function( types, fn ) {\r
+ return this.off( types, null, fn );\r
+ },\r
+\r
+ live: function( types, data, fn ) {\r
+ jQuery( this.context ).on( types, this.selector, data, fn );\r
+ return this;\r
+ },\r
+ die: function( types, fn ) {\r
+ jQuery( this.context ).off( types, this.selector || "**", fn );\r
+ return this;\r
+ },\r
+\r
+ delegate: function( selector, types, data, fn ) {\r
+ return this.on( types, selector, data, fn );\r
+ },\r
+ undelegate: function( selector, types, fn ) {\r
+ // ( namespace ) or ( selector, types [, fn] )\r
+ return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );\r
+ },\r
+\r
+ trigger: function( type, data ) {\r
+ return this.each(function() {\r
+ jQuery.event.trigger( type, data, this );\r
+ });\r
+ },\r
+ triggerHandler: function( type, data ) {\r
+ if ( this[0] ) {\r
+ return jQuery.event.trigger( type, data, this[0], true );\r
+ }\r
+ },\r
+\r
+ toggle: function( fn ) {\r
+ // Save reference to arguments for access in closure\r
+ var args = arguments,\r
+ guid = fn.guid || jQuery.guid++,\r
+ i = 0,\r
+ toggler = function( event ) {\r
+ // Figure out which function to execute\r
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;\r
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );\r
+\r
+ // Make sure that clicks stop\r
+ event.preventDefault();\r
+\r
+ // and execute the function\r
+ return args[ lastToggle ].apply( this, arguments ) || false;\r
+ };\r
+\r
+ // link all the functions, so any of them can unbind this click handler\r
+ toggler.guid = guid;\r
+ while ( i < args.length ) {\r
+ args[ i++ ].guid = guid;\r
+ }\r
+\r
+ return this.click( toggler );\r
+ },\r
+\r
+ hover: function( fnOver, fnOut ) {\r
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\r
+ }\r
+});\r
+\r
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +\r
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +\r
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {\r
+\r
+ // Handle event binding\r
+ jQuery.fn[ name ] = function( data, fn ) {\r
+ if ( fn == null ) {\r
+ fn = data;\r
+ data = null;\r
+ }\r
+\r
+ return arguments.length > 0 ?\r
+ this.on( name, null, data, fn ) :\r
+ this.trigger( name );\r
+ };\r
+\r
+ if ( jQuery.attrFn ) {\r
+ jQuery.attrFn[ name ] = true;\r
+ }\r
+\r
+ if ( rkeyEvent.test( name ) ) {\r
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;\r
+ }\r
+\r
+ if ( rmouseEvent.test( name ) ) {\r
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;\r
+ }\r
+});\r
+\r
+\r
+\r
+/*!\r
+ * Sizzle CSS Selector Engine\r
+ * Copyright 2011, The Dojo Foundation\r
+ * Released under the MIT, BSD, and GPL Licenses.\r
+ * More information: http://sizzlejs.com/\r
+ */\r
+(function(){\r
+\r
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,\r
+ expando = "sizcache" + (Math.random() + '').replace('.', ''),\r
+ done = 0,\r
+ toString = Object.prototype.toString,\r
+ hasDuplicate = false,\r
+ baseHasDuplicate = true,\r
+ rBackslash = /\\/g,\r
+ rReturn = /\r\n/g,\r
+ rNonWord = /\W/;\r
+\r
+// Here we check if the JavaScript engine is using some sort of\r
+// optimization where it does not always call our comparision\r
+// function. If that is the case, discard the hasDuplicate value.\r
+// Thus far that includes Google Chrome.\r
+[0, 0].sort(function() {\r
+ baseHasDuplicate = false;\r
+ return 0;\r
+});\r
+\r
+var Sizzle = function( selector, context, results, seed ) {\r
+ results = results || [];\r
+ context = context || document;\r
+\r
+ var origContext = context;\r
+\r
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {\r
+ return [];\r
+ }\r
+\r
+ if ( !selector || typeof selector !== "string" ) {\r
+ return results;\r
+ }\r
+\r
+ var m, set, checkSet, extra, ret, cur, pop, i,\r
+ prune = true,\r
+ contextXML = Sizzle.isXML( context ),\r
+ parts = [],\r
+ soFar = selector;\r
+\r
+ // Reset the position of the chunker regexp (start from head)\r
+ do {\r
+ chunker.exec( "" );\r
+ m = chunker.exec( soFar );\r
+\r
+ if ( m ) {\r
+ soFar = m[3];\r
+\r
+ parts.push( m[1] );\r
+\r
+ if ( m[2] ) {\r
+ extra = m[3];\r
+ break;\r
+ }\r
+ }\r
+ } while ( m );\r
+\r
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {\r
+\r
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {\r
+ set = posProcess( parts[0] + parts[1], context, seed );\r
+\r
+ } else {\r
+ set = Expr.relative[ parts[0] ] ?\r
+ [ context ] :\r
+ Sizzle( parts.shift(), context );\r
+\r
+ while ( parts.length ) {\r
+ selector = parts.shift();\r
+\r
+ if ( Expr.relative[ selector ] ) {\r
+ selector += parts.shift();\r
+ }\r
+\r
+ set = posProcess( selector, set, seed );\r
+ }\r
+ }\r
+\r
+ } else {\r
+ // Take a shortcut and set the context if the root selector is an ID\r
+ // (but not if it'll be faster if the inner selector is an ID)\r
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&\r
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {\r
+\r
+ ret = Sizzle.find( parts.shift(), context, contextXML );\r
+ context = ret.expr ?\r
+ Sizzle.filter( ret.expr, ret.set )[0] :\r
+ ret.set[0];\r
+ }\r
+\r
+ if ( context ) {\r
+ ret = seed ?\r
+ { expr: parts.pop(), set: makeArray(seed) } :\r
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );\r
+\r
+ set = ret.expr ?\r
+ Sizzle.filter( ret.expr, ret.set ) :\r
+ ret.set;\r
+\r
+ if ( parts.length > 0 ) {\r
+ checkSet = makeArray( set );\r
+\r
+ } else {\r
+ prune = false;\r
+ }\r
+\r
+ while ( parts.length ) {\r
+ cur = parts.pop();\r
+ pop = cur;\r
+\r
+ if ( !Expr.relative[ cur ] ) {\r
+ cur = "";\r
+ } else {\r
+ pop = parts.pop();\r
+ }\r
+\r
+ if ( pop == null ) {\r
+ pop = context;\r
+ }\r
+\r
+ Expr.relative[ cur ]( checkSet, pop, contextXML );\r
+ }\r
+\r
+ } else {\r
+ checkSet = parts = [];\r
+ }\r
+ }\r
+\r
+ if ( !checkSet ) {\r
+ checkSet = set;\r
+ }\r
+\r
+ if ( !checkSet ) {\r
+ Sizzle.error( cur || selector );\r
+ }\r
+\r
+ if ( toString.call(checkSet) === "[object Array]" ) {\r
+ if ( !prune ) {\r
+ results.push.apply( results, checkSet );\r
+\r
+ } else if ( context && context.nodeType === 1 ) {\r
+ for ( i = 0; checkSet[i] != null; i++ ) {\r
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {\r
+ results.push( set[i] );\r
+ }\r
+ }\r
+\r
+ } else {\r
+ for ( i = 0; checkSet[i] != null; i++ ) {\r
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {\r
+ results.push( set[i] );\r
+ }\r
+ }\r
+ }\r
+\r
+ } else {\r
+ makeArray( checkSet, results );\r
+ }\r
+\r
+ if ( extra ) {\r
+ Sizzle( extra, origContext, results, seed );\r
+ Sizzle.uniqueSort( results );\r
+ }\r
+\r
+ return results;\r
+};\r
+\r
+Sizzle.uniqueSort = function( results ) {\r
+ if ( sortOrder ) {\r
+ hasDuplicate = baseHasDuplicate;\r
+ results.sort( sortOrder );\r
+\r
+ if ( hasDuplicate ) {\r
+ for ( var i = 1; i < results.length; i++ ) {\r
+ if ( results[i] === results[ i - 1 ] ) {\r
+ results.splice( i--, 1 );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return results;\r
+};\r
+\r
+Sizzle.matches = function( expr, set ) {\r
+ return Sizzle( expr, null, null, set );\r
+};\r
+\r
+Sizzle.matchesSelector = function( node, expr ) {\r
+ return Sizzle( expr, null, null, [node] ).length > 0;\r
+};\r
+\r
+Sizzle.find = function( expr, context, isXML ) {\r
+ var set, i, len, match, type, left;\r
+\r
+ if ( !expr ) {\r
+ return [];\r
+ }\r
+\r
+ for ( i = 0, len = Expr.order.length; i < len; i++ ) {\r
+ type = Expr.order[i];\r
+\r
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {\r
+ left = match[1];\r
+ match.splice( 1, 1 );\r
+\r
+ if ( left.substr( left.length - 1 ) !== "\\" ) {\r
+ match[1] = (match[1] || "").replace( rBackslash, "" );\r
+ set = Expr.find[ type ]( match, context, isXML );\r
+\r
+ if ( set != null ) {\r
+ expr = expr.replace( Expr.match[ type ], "" );\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( !set ) {\r
+ set = typeof context.getElementsByTagName !== "undefined" ?\r
+ context.getElementsByTagName( "*" ) :\r
+ [];\r
+ }\r
+\r
+ return { set: set, expr: expr };\r
+};\r
+\r
+Sizzle.filter = function( expr, set, inplace, not ) {\r
+ var match, anyFound,\r
+ type, found, item, filter, left,\r
+ i, pass,\r
+ old = expr,\r
+ result = [],\r
+ curLoop = set,\r
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );\r
+\r
+ while ( expr && set.length ) {\r
+ for ( type in Expr.filter ) {\r
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {\r
+ filter = Expr.filter[ type ];\r
+ left = match[1];\r
+\r
+ anyFound = false;\r
+\r
+ match.splice(1,1);\r
+\r
+ if ( left.substr( left.length - 1 ) === "\\" ) {\r
+ continue;\r
+ }\r
+\r
+ if ( curLoop === result ) {\r
+ result = [];\r
+ }\r
+\r
+ if ( Expr.preFilter[ type ] ) {\r
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\r
+\r
+ if ( !match ) {\r
+ anyFound = found = true;\r
+\r
+ } else if ( match === true ) {\r
+ continue;\r
+ }\r
+ }\r
+\r
+ if ( match ) {\r
+ for ( i = 0; (item = curLoop[i]) != null; i++ ) {\r
+ if ( item ) {\r
+ found = filter( item, match, i, curLoop );\r
+ pass = not ^ found;\r
+\r
+ if ( inplace && found != null ) {\r
+ if ( pass ) {\r
+ anyFound = true;\r
+\r
+ } else {\r
+ curLoop[i] = false;\r
+ }\r
+\r
+ } else if ( pass ) {\r
+ result.push( item );\r
+ anyFound = true;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( found !== undefined ) {\r
+ if ( !inplace ) {\r
+ curLoop = result;\r
+ }\r
+\r
+ expr = expr.replace( Expr.match[ type ], "" );\r
+\r
+ if ( !anyFound ) {\r
+ return [];\r
+ }\r
+\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ // Improper expression\r
+ if ( expr === old ) {\r
+ if ( anyFound == null ) {\r
+ Sizzle.error( expr );\r
+\r
+ } else {\r
+ break;\r
+ }\r
+ }\r
+\r
+ old = expr;\r
+ }\r
+\r
+ return curLoop;\r
+};\r
+\r
+Sizzle.error = function( msg ) {\r
+ throw new Error( "Syntax error, unrecognized expression: " + msg );\r
+};\r
+\r
+/**\r
+ * Utility function for retreiving the text value of an array of DOM nodes\r
+ * @param {Array|Element} elem\r
+ */\r
+var getText = Sizzle.getText = function( elem ) {\r
+ var i, node,\r
+ nodeType = elem.nodeType,\r
+ ret = "";\r
+\r
+ if ( nodeType ) {\r
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\r
+ // Use textContent || innerText for elements\r
+ if ( typeof elem.textContent === 'string' ) {\r
+ return elem.textContent;\r
+ } else if ( typeof elem.innerText === 'string' ) {\r
+ // Replace IE's carriage returns\r
+ return elem.innerText.replace( rReturn, '' );\r
+ } else {\r
+ // Traverse it's children\r
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {\r
+ ret += getText( elem );\r
+ }\r
+ }\r
+ } else if ( nodeType === 3 || nodeType === 4 ) {\r
+ return elem.nodeValue;\r
+ }\r
+ } else {\r
+\r
+ // If no nodeType, this is expected to be an array\r
+ for ( i = 0; (node = elem[i]); i++ ) {\r
+ // Do not traverse comment nodes\r
+ if ( node.nodeType !== 8 ) {\r
+ ret += getText( node );\r
+ }\r
+ }\r
+ }\r
+ return ret;\r
+};\r
+\r
+var Expr = Sizzle.selectors = {\r
+ order: [ "ID", "NAME", "TAG" ],\r
+\r
+ match: {\r
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,\r
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,\r
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,\r
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,\r
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,\r
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,\r
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/\r
+ },\r
+\r
+ leftMatch: {},\r
+\r
+ attrMap: {\r
+ "class": "className",\r
+ "for": "htmlFor"\r
+ },\r
+\r
+ attrHandle: {\r
+ href: function( elem ) {\r
+ return elem.getAttribute( "href" );\r
+ },\r
+ type: function( elem ) {\r
+ return elem.getAttribute( "type" );\r
+ }\r
+ },\r
+\r
+ relative: {\r
+ "+": function(checkSet, part){\r
+ var isPartStr = typeof part === "string",\r
+ isTag = isPartStr && !rNonWord.test( part ),\r
+ isPartStrNotTag = isPartStr && !isTag;\r
+\r
+ if ( isTag ) {\r
+ part = part.toLowerCase();\r
+ }\r
+\r
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {\r
+ if ( (elem = checkSet[i]) ) {\r
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}\r
+\r
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\r
+ elem || false :\r
+ elem === part;\r
+ }\r
+ }\r
+\r
+ if ( isPartStrNotTag ) {\r
+ Sizzle.filter( part, checkSet, true );\r
+ }\r
+ },\r
+\r
+ ">": function( checkSet, part ) {\r
+ var elem,\r
+ isPartStr = typeof part === "string",\r
+ i = 0,\r
+ l = checkSet.length;\r
+\r
+ if ( isPartStr && !rNonWord.test( part ) ) {\r
+ part = part.toLowerCase();\r
+\r
+ for ( ; i < l; i++ ) {\r
+ elem = checkSet[i];\r
+\r
+ if ( elem ) {\r
+ var parent = elem.parentNode;\r
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;\r
+ }\r
+ }\r
+\r
+ } else {\r
+ for ( ; i < l; i++ ) {\r
+ elem = checkSet[i];\r
+\r
+ if ( elem ) {\r
+ checkSet[i] = isPartStr ?\r
+ elem.parentNode :\r
+ elem.parentNode === part;\r
+ }\r
+ }\r
+\r
+ if ( isPartStr ) {\r
+ Sizzle.filter( part, checkSet, true );\r
+ }\r
+ }\r
+ },\r
+\r
+ "": function(checkSet, part, isXML){\r
+ var nodeCheck,\r
+ doneName = done++,\r
+ checkFn = dirCheck;\r
+\r
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {\r
+ part = part.toLowerCase();\r
+ nodeCheck = part;\r
+ checkFn = dirNodeCheck;\r
+ }\r
+\r
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );\r
+ },\r
+\r
+ "~": function( checkSet, part, isXML ) {\r
+ var nodeCheck,\r
+ doneName = done++,\r
+ checkFn = dirCheck;\r
+\r
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {\r
+ part = part.toLowerCase();\r
+ nodeCheck = part;\r
+ checkFn = dirNodeCheck;\r
+ }\r
+\r
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );\r
+ }\r
+ },\r
+\r
+ find: {\r
+ ID: function( match, context, isXML ) {\r
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+ var m = context.getElementById(match[1]);\r
+ // Check parentNode to catch when Blackberry 4.6 returns\r
+ // nodes that are no longer in the document #6963\r
+ return m && m.parentNode ? [m] : [];\r
+ }\r
+ },\r
+\r
+ NAME: function( match, context ) {\r
+ if ( typeof context.getElementsByName !== "undefined" ) {\r
+ var ret = [],\r
+ results = context.getElementsByName( match[1] );\r
+\r
+ for ( var i = 0, l = results.length; i < l; i++ ) {\r
+ if ( results[i].getAttribute("name") === match[1] ) {\r
+ ret.push( results[i] );\r
+ }\r
+ }\r
+\r
+ return ret.length === 0 ? null : ret;\r
+ }\r
+ },\r
+\r
+ TAG: function( match, context ) {\r
+ if ( typeof context.getElementsByTagName !== "undefined" ) {\r
+ return context.getElementsByTagName( match[1] );\r
+ }\r
+ }\r
+ },\r
+ preFilter: {\r
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {\r
+ match = " " + match[1].replace( rBackslash, "" ) + " ";\r
+\r
+ if ( isXML ) {\r
+ return match;\r
+ }\r
+\r
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {\r
+ if ( elem ) {\r
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {\r
+ if ( !inplace ) {\r
+ result.push( elem );\r
+ }\r
+\r
+ } else if ( inplace ) {\r
+ curLoop[i] = false;\r
+ }\r
+ }\r
+ }\r
+\r
+ return false;\r
+ },\r
+\r
+ ID: function( match ) {\r
+ return match[1].replace( rBackslash, "" );\r
+ },\r
+\r
+ TAG: function( match, curLoop ) {\r
+ return match[1].replace( rBackslash, "" ).toLowerCase();\r
+ },\r
+\r
+ CHILD: function( match ) {\r
+ if ( match[1] === "nth" ) {\r
+ if ( !match[2] ) {\r
+ Sizzle.error( match[0] );\r
+ }\r
+\r
+ match[2] = match[2].replace(/^\+|\s*/g, '');\r
+\r
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'\r
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(\r
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||\r
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);\r
+\r
+ // calculate the numbers (first)n+(last) including if they are negative\r
+ match[2] = (test[1] + (test[2] || 1)) - 0;\r
+ match[3] = test[3] - 0;\r
+ }\r
+ else if ( match[2] ) {\r
+ Sizzle.error( match[0] );\r
+ }\r
+\r
+ // TODO: Move to normal caching system\r
+ match[0] = done++;\r
+\r
+ return match;\r
+ },\r
+\r
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {\r
+ var name = match[1] = match[1].replace( rBackslash, "" );\r
+\r
+ if ( !isXML && Expr.attrMap[name] ) {\r
+ match[1] = Expr.attrMap[name];\r
+ }\r
+\r
+ // Handle if an un-quoted value was used\r
+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );\r
+\r
+ if ( match[2] === "~=" ) {\r
+ match[4] = " " + match[4] + " ";\r
+ }\r
+\r
+ return match;\r
+ },\r
+\r
+ PSEUDO: function( match, curLoop, inplace, result, not ) {\r
+ if ( match[1] === "not" ) {\r
+ // If we're dealing with a complex expression, or a simple one\r
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {\r
+ match[3] = Sizzle(match[3], null, null, curLoop);\r
+\r
+ } else {\r
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);\r
+\r
+ if ( !inplace ) {\r
+ result.push.apply( result, ret );\r
+ }\r
+\r
+ return false;\r
+ }\r
+\r
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {\r
+ return true;\r
+ }\r
+\r
+ return match;\r
+ },\r
+\r
+ POS: function( match ) {\r
+ match.unshift( true );\r
+\r
+ return match;\r
+ }\r
+ },\r
+\r
+ filters: {\r
+ enabled: function( elem ) {\r
+ return elem.disabled === false && elem.type !== "hidden";\r
+ },\r
+\r
+ disabled: function( elem ) {\r
+ return elem.disabled === true;\r
+ },\r
+\r
+ checked: function( elem ) {\r
+ return elem.checked === true;\r
+ },\r
+\r
+ selected: function( elem ) {\r
+ // Accessing this property makes selected-by-default\r
+ // options in Safari work properly\r
+ if ( elem.parentNode ) {\r
+ elem.parentNode.selectedIndex;\r
+ }\r
+\r
+ return elem.selected === true;\r
+ },\r
+\r
+ parent: function( elem ) {\r
+ return !!elem.firstChild;\r
+ },\r
+\r
+ empty: function( elem ) {\r
+ return !elem.firstChild;\r
+ },\r
+\r
+ has: function( elem, i, match ) {\r
+ return !!Sizzle( match[3], elem ).length;\r
+ },\r
+\r
+ header: function( elem ) {\r
+ return (/h\d/i).test( elem.nodeName );\r
+ },\r
+\r
+ text: function( elem ) {\r
+ var attr = elem.getAttribute( "type" ), type = elem.type;\r
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\r
+ // use getAttribute instead to test this case\r
+ return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );\r
+ },\r
+\r
+ radio: function( elem ) {\r
+ return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;\r
+ },\r
+\r
+ checkbox: function( elem ) {\r
+ return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;\r
+ },\r
+\r
+ file: function( elem ) {\r
+ return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;\r
+ },\r
+\r
+ password: function( elem ) {\r
+ return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;\r
+ },\r
+\r
+ submit: function( elem ) {\r
+ var name = elem.nodeName.toLowerCase();\r
+ return (name === "input" || name === "button") && "submit" === elem.type;\r
+ },\r
+\r
+ image: function( elem ) {\r
+ return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;\r
+ },\r
+\r
+ reset: function( elem ) {\r
+ var name = elem.nodeName.toLowerCase();\r
+ return (name === "input" || name === "button") && "reset" === elem.type;\r
+ },\r
+\r
+ button: function( elem ) {\r
+ var name = elem.nodeName.toLowerCase();\r
+ return name === "input" && "button" === elem.type || name === "button";\r
+ },\r
+\r
+ input: function( elem ) {\r
+ return (/input|select|textarea|button/i).test( elem.nodeName );\r
+ },\r
+\r
+ focus: function( elem ) {\r
+ return elem === elem.ownerDocument.activeElement;\r
+ }\r
+ },\r
+ setFilters: {\r
+ first: function( elem, i ) {\r
+ return i === 0;\r
+ },\r
+\r
+ last: function( elem, i, match, array ) {\r
+ return i === array.length - 1;\r
+ },\r
+\r
+ even: function( elem, i ) {\r
+ return i % 2 === 0;\r
+ },\r
+\r
+ odd: function( elem, i ) {\r
+ return i % 2 === 1;\r
+ },\r
+\r
+ lt: function( elem, i, match ) {\r
+ return i < match[3] - 0;\r
+ },\r
+\r
+ gt: function( elem, i, match ) {\r
+ return i > match[3] - 0;\r
+ },\r
+\r
+ nth: function( elem, i, match ) {\r
+ return match[3] - 0 === i;\r
+ },\r
+\r
+ eq: function( elem, i, match ) {\r
+ return match[3] - 0 === i;\r
+ }\r
+ },\r
+ filter: {\r
+ PSEUDO: function( elem, match, i, array ) {\r
+ var name = match[1],\r
+ filter = Expr.filters[ name ];\r
+\r
+ if ( filter ) {\r
+ return filter( elem, i, match, array );\r
+\r
+ } else if ( name === "contains" ) {\r
+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;\r
+\r
+ } else if ( name === "not" ) {\r
+ var not = match[3];\r
+\r
+ for ( var j = 0, l = not.length; j < l; j++ ) {\r
+ if ( not[j] === elem ) {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ return true;\r
+\r
+ } else {\r
+ Sizzle.error( name );\r
+ }\r
+ },\r
+\r
+ CHILD: function( elem, match ) {\r
+ var first, last,\r
+ doneName, parent, cache,\r
+ count, diff,\r
+ type = match[1],\r
+ node = elem;\r
+\r
+ switch ( type ) {\r
+ case "only":\r
+ case "first":\r
+ while ( (node = node.previousSibling) ) {\r
+ if ( node.nodeType === 1 ) {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ if ( type === "first" ) {\r
+ return true;\r
+ }\r
+\r
+ node = elem;\r
+\r
+ /* falls through */\r
+ case "last":\r
+ while ( (node = node.nextSibling) ) {\r
+ if ( node.nodeType === 1 ) {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ return true;\r
+\r
+ case "nth":\r
+ first = match[2];\r
+ last = match[3];\r
+\r
+ if ( first === 1 && last === 0 ) {\r
+ return true;\r
+ }\r
+\r
+ doneName = match[0];\r
+ parent = elem.parentNode;\r
+\r
+ if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {\r
+ count = 0;\r
+\r
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {\r
+ if ( node.nodeType === 1 ) {\r
+ node.nodeIndex = ++count;\r
+ }\r
+ }\r
+\r
+ parent[ expando ] = doneName;\r
+ }\r
+\r
+ diff = elem.nodeIndex - last;\r
+\r
+ if ( first === 0 ) {\r
+ return diff === 0;\r
+\r
+ } else {\r
+ return ( diff % first === 0 && diff / first >= 0 );\r
+ }\r
+ }\r
+ },\r
+\r
+ ID: function( elem, match ) {\r
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;\r
+ },\r
+\r
+ TAG: function( elem, match ) {\r
+ return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;\r
+ },\r
+\r
+ CLASS: function( elem, match ) {\r
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")\r
+ .indexOf( match ) > -1;\r
+ },\r
+\r
+ ATTR: function( elem, match ) {\r
+ var name = match[1],\r
+ result = Sizzle.attr ?\r
+ Sizzle.attr( elem, name ) :\r
+ Expr.attrHandle[ name ] ?\r
+ Expr.attrHandle[ name ]( elem ) :\r
+ elem[ name ] != null ?\r
+ elem[ name ] :\r
+ elem.getAttribute( name ),\r
+ value = result + "",\r
+ type = match[2],\r
+ check = match[4];\r
+\r
+ return result == null ?\r
+ type === "!=" :\r
+ !type && Sizzle.attr ?\r
+ result != null :\r
+ type === "=" ?\r
+ value === check :\r
+ type === "*=" ?\r
+ value.indexOf(check) >= 0 :\r
+ type === "~=" ?\r
+ (" " + value + " ").indexOf(check) >= 0 :\r
+ !check ?\r
+ value && result !== false :\r
+ type === "!=" ?\r
+ value !== check :\r
+ type === "^=" ?\r
+ value.indexOf(check) === 0 :\r
+ type === "$=" ?\r
+ value.substr(value.length - check.length) === check :\r
+ type === "|=" ?\r
+ value === check || value.substr(0, check.length + 1) === check + "-" :\r
+ false;\r
+ },\r
+\r
+ POS: function( elem, match, i, array ) {\r
+ var name = match[2],\r
+ filter = Expr.setFilters[ name ];\r
+\r
+ if ( filter ) {\r
+ return filter( elem, i, match, array );\r
+ }\r
+ }\r
+ }\r
+};\r
+\r
+var origPOS = Expr.match.POS,\r
+ fescape = function(all, num){\r
+ return "\\" + (num - 0 + 1);\r
+ };\r
+\r
+for ( var type in Expr.match ) {\r
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );\r
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );\r
+}\r
+// Expose origPOS\r
+// "global" as in regardless of relation to brackets/parens\r
+Expr.match.globalPOS = origPOS;\r
+\r
+var makeArray = function( array, results ) {\r
+ array = Array.prototype.slice.call( array, 0 );\r
+\r
+ if ( results ) {\r
+ results.push.apply( results, array );\r
+ return results;\r
+ }\r
+\r
+ return array;\r
+};\r
+\r
+// Perform a simple check to determine if the browser is capable of\r
+// converting a NodeList to an array using builtin methods.\r
+// Also verifies that the returned array holds DOM nodes\r
+// (which is not the case in the Blackberry browser)\r
+try {\r
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;\r
+\r
+// Provide a fallback method if it does not work\r
+} catch( e ) {\r
+ makeArray = function( array, results ) {\r
+ var i = 0,\r
+ ret = results || [];\r
+\r
+ if ( toString.call(array) === "[object Array]" ) {\r
+ Array.prototype.push.apply( ret, array );\r
+\r
+ } else {\r
+ if ( typeof array.length === "number" ) {\r
+ for ( var l = array.length; i < l; i++ ) {\r
+ ret.push( array[i] );\r
+ }\r
+\r
+ } else {\r
+ for ( ; array[i]; i++ ) {\r
+ ret.push( array[i] );\r
+ }\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ };\r
+}\r
+\r
+var sortOrder, siblingCheck;\r
+\r
+if ( document.documentElement.compareDocumentPosition ) {\r
+ sortOrder = function( a, b ) {\r
+ if ( a === b ) {\r
+ hasDuplicate = true;\r
+ return 0;\r
+ }\r
+\r
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {\r
+ return a.compareDocumentPosition ? -1 : 1;\r
+ }\r
+\r
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;\r
+ };\r
+\r
+} else {\r
+ sortOrder = function( a, b ) {\r
+ // The nodes are identical, we can exit early\r
+ if ( a === b ) {\r
+ hasDuplicate = true;\r
+ return 0;\r
+\r
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes\r
+ } else if ( a.sourceIndex && b.sourceIndex ) {\r
+ return a.sourceIndex - b.sourceIndex;\r
+ }\r
+\r
+ var al, bl,\r
+ ap = [],\r
+ bp = [],\r
+ aup = a.parentNode,\r
+ bup = b.parentNode,\r
+ cur = aup;\r
+\r
+ // If the nodes are siblings (or identical) we can do a quick check\r
+ if ( aup === bup ) {\r
+ return siblingCheck( a, b );\r
+\r
+ // If no parents were found then the nodes are disconnected\r
+ } else if ( !aup ) {\r
+ return -1;\r
+\r
+ } else if ( !bup ) {\r
+ return 1;\r
+ }\r
+\r
+ // Otherwise they're somewhere else in the tree so we need\r
+ // to build up a full list of the parentNodes for comparison\r
+ while ( cur ) {\r
+ ap.unshift( cur );\r
+ cur = cur.parentNode;\r
+ }\r
+\r
+ cur = bup;\r
+\r
+ while ( cur ) {\r
+ bp.unshift( cur );\r
+ cur = cur.parentNode;\r
+ }\r
+\r
+ al = ap.length;\r
+ bl = bp.length;\r
+\r
+ // Start walking down the tree looking for a discrepancy\r
+ for ( var i = 0; i < al && i < bl; i++ ) {\r
+ if ( ap[i] !== bp[i] ) {\r
+ return siblingCheck( ap[i], bp[i] );\r
+ }\r
+ }\r
+\r
+ // We ended someplace up the tree so do a sibling check\r
+ return i === al ?\r
+ siblingCheck( a, bp[i], -1 ) :\r
+ siblingCheck( ap[i], b, 1 );\r
+ };\r
+\r
+ siblingCheck = function( a, b, ret ) {\r
+ if ( a === b ) {\r
+ return ret;\r
+ }\r
+\r
+ var cur = a.nextSibling;\r
+\r
+ while ( cur ) {\r
+ if ( cur === b ) {\r
+ return -1;\r
+ }\r
+\r
+ cur = cur.nextSibling;\r
+ }\r
+\r
+ return 1;\r
+ };\r
+}\r
+\r
+// Check to see if the browser returns elements by name when\r
+// querying by getElementById (and provide a workaround)\r
+(function(){\r
+ // We're going to inject a fake input element with a specified name\r
+ var form = document.createElement("div"),\r
+ id = "script" + (new Date()).getTime(),\r
+ root = document.documentElement;\r
+\r
+ form.innerHTML = "<a name='" + id + "'/>";\r
+\r
+ // Inject it into the root element, check its status, and remove it quickly\r
+ root.insertBefore( form, root.firstChild );\r
+\r
+ // The workaround has to do additional checks after a getElementById\r
+ // Which slows things down for other browsers (hence the branching)\r
+ if ( document.getElementById( id ) ) {\r
+ Expr.find.ID = function( match, context, isXML ) {\r
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {\r
+ var m = context.getElementById(match[1]);\r
+\r
+ return m ?\r
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?\r
+ [m] :\r
+ undefined :\r
+ [];\r
+ }\r
+ };\r
+\r
+ Expr.filter.ID = function( elem, match ) {\r
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");\r
+\r
+ return elem.nodeType === 1 && node && node.nodeValue === match;\r
+ };\r
+ }\r
+\r
+ root.removeChild( form );\r
+\r
+ // release memory in IE\r
+ root = form = null;\r
+})();\r
+\r
+(function(){\r
+ // Check to see if the browser returns only elements\r
+ // when doing getElementsByTagName("*")\r
+\r
+ // Create a fake element\r
+ var div = document.createElement("div");\r
+ div.appendChild( document.createComment("") );\r
+\r
+ // Make sure no comments are found\r
+ if ( div.getElementsByTagName("*").length > 0 ) {\r
+ Expr.find.TAG = function( match, context ) {\r
+ var results = context.getElementsByTagName( match[1] );\r
+\r
+ // Filter out possible comments\r
+ if ( match[1] === "*" ) {\r
+ var tmp = [];\r
+\r
+ for ( var i = 0; results[i]; i++ ) {\r
+ if ( results[i].nodeType === 1 ) {\r
+ tmp.push( results[i] );\r
+ }\r
+ }\r
+\r
+ results = tmp;\r
+ }\r
+\r
+ return results;\r
+ };\r
+ }\r
+\r
+ // Check to see if an attribute returns normalized href attributes\r
+ div.innerHTML = "<a href='#'></a>";\r
+\r
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&\r
+ div.firstChild.getAttribute("href") !== "#" ) {\r
+\r
+ Expr.attrHandle.href = function( elem ) {\r
+ return elem.getAttribute( "href", 2 );\r
+ };\r
+ }\r
+\r
+ // release memory in IE\r
+ div = null;\r
+})();\r
+\r
+if ( document.querySelectorAll ) {\r
+ (function(){\r
+ var oldSizzle = Sizzle,\r
+ div = document.createElement("div"),\r
+ id = "__sizzle__";\r
+\r
+ div.innerHTML = "<p class='TEST'></p>";\r
+\r
+ // Safari can't handle uppercase or unicode characters when\r
+ // in quirks mode.\r
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {\r
+ return;\r
+ }\r
+\r
+ Sizzle = function( query, context, extra, seed ) {\r
+ context = context || document;\r
+\r
+ // Only use querySelectorAll on non-XML documents\r
+ // (ID selectors don't work in non-HTML documents)\r
+ if ( !seed && !Sizzle.isXML(context) ) {\r
+ // See if we find a selector to speed up\r
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );\r
+\r
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {\r
+ // Speed-up: Sizzle("TAG")\r
+ if ( match[1] ) {\r
+ return makeArray( context.getElementsByTagName( query ), extra );\r
+\r
+ // Speed-up: Sizzle(".CLASS")\r
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {\r
+ return makeArray( context.getElementsByClassName( match[2] ), extra );\r
+ }\r
+ }\r
+\r
+ if ( context.nodeType === 9 ) {\r
+ // Speed-up: Sizzle("body")\r
+ // The body element only exists once, optimize finding it\r
+ if ( query === "body" && context.body ) {\r
+ return makeArray( [ context.body ], extra );\r
+\r
+ // Speed-up: Sizzle("#ID")\r
+ } else if ( match && match[3] ) {\r
+ var elem = context.getElementById( match[3] );\r
+\r
+ // Check parentNode to catch when Blackberry 4.6 returns\r
+ // nodes that are no longer in the document #6963\r
+ if ( elem && elem.parentNode ) {\r
+ // Handle the case where IE and Opera return items\r
+ // by name instead of ID\r
+ if ( elem.id === match[3] ) {\r
+ return makeArray( [ elem ], extra );\r
+ }\r
+\r
+ } else {\r
+ return makeArray( [], extra );\r
+ }\r
+ }\r
+\r
+ try {\r
+ return makeArray( context.querySelectorAll(query), extra );\r
+ } catch(qsaError) {}\r
+\r
+ // qSA works strangely on Element-rooted queries\r
+ // We can work around this by specifying an extra ID on the root\r
+ // and working up from there (Thanks to Andrew Dupont for the technique)\r
+ // IE 8 doesn't work on object elements\r
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {\r
+ var oldContext = context,\r
+ old = context.getAttribute( "id" ),\r
+ nid = old || id,\r
+ hasParent = context.parentNode,\r
+ relativeHierarchySelector = /^\s*[+~]/.test( query );\r
+\r
+ if ( !old ) {\r
+ context.setAttribute( "id", nid );\r
+ } else {\r
+ nid = nid.replace( /'/g, "\\$&" );\r
+ }\r
+ if ( relativeHierarchySelector && hasParent ) {\r
+ context = context.parentNode;\r
+ }\r
+\r
+ try {\r
+ if ( !relativeHierarchySelector || hasParent ) {\r
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );\r
+ }\r
+\r
+ } catch(pseudoError) {\r
+ } finally {\r
+ if ( !old ) {\r
+ oldContext.removeAttribute( "id" );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return oldSizzle(query, context, extra, seed);\r
+ };\r
+\r
+ for ( var prop in oldSizzle ) {\r
+ Sizzle[ prop ] = oldSizzle[ prop ];\r
+ }\r
+\r
+ // release memory in IE\r
+ div = null;\r
+ })();\r
+}\r
+\r
+(function(){\r
+ var html = document.documentElement,\r
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;\r
+\r
+ if ( matches ) {\r
+ // Check to see if it's possible to do matchesSelector\r
+ // on a disconnected node (IE 9 fails this)\r
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),\r
+ pseudoWorks = false;\r
+\r
+ try {\r
+ // This should fail with an exception\r
+ // Gecko does not error, returns false instead\r
+ matches.call( document.documentElement, "[test!='']:sizzle" );\r
+\r
+ } catch( pseudoError ) {\r
+ pseudoWorks = true;\r
+ }\r
+\r
+ Sizzle.matchesSelector = function( node, expr ) {\r
+ // Make sure that attribute selectors are quoted\r
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");\r
+\r
+ if ( !Sizzle.isXML( node ) ) {\r
+ try {\r
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {\r
+ var ret = matches.call( node, expr );\r
+\r
+ // IE 9's matchesSelector returns false on disconnected nodes\r
+ if ( ret || !disconnectedMatch ||\r
+ // As well, disconnected nodes are said to be in a document\r
+ // fragment in IE 9, so check for that\r
+ node.document && node.document.nodeType !== 11 ) {\r
+ return ret;\r
+ }\r
+ }\r
+ } catch(e) {}\r
+ }\r
+\r
+ return Sizzle(expr, null, null, [node]).length > 0;\r
+ };\r
+ }\r
+})();\r
+\r
+(function(){\r
+ var div = document.createElement("div");\r
+\r
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";\r
+\r
+ // Opera can't find a second classname (in 9.6)\r
+ // Also, make sure that getElementsByClassName actually exists\r
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {\r
+ return;\r
+ }\r
+\r
+ // Safari caches class attributes, doesn't catch changes (in 3.2)\r
+ div.lastChild.className = "e";\r
+\r
+ if ( div.getElementsByClassName("e").length === 1 ) {\r
+ return;\r
+ }\r
+\r
+ Expr.order.splice(1, 0, "CLASS");\r
+ Expr.find.CLASS = function( match, context, isXML ) {\r
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {\r
+ return context.getElementsByClassName(match[1]);\r
+ }\r
+ };\r
+\r
+ // release memory in IE\r
+ div = null;\r
+})();\r
+\r
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+ var elem = checkSet[i];\r
+\r
+ if ( elem ) {\r
+ var match = false;\r
+\r
+ elem = elem[dir];\r
+\r
+ while ( elem ) {\r
+ if ( elem[ expando ] === doneName ) {\r
+ match = checkSet[elem.sizset];\r
+ break;\r
+ }\r
+\r
+ if ( elem.nodeType === 1 && !isXML ){\r
+ elem[ expando ] = doneName;\r
+ elem.sizset = i;\r
+ }\r
+\r
+ if ( elem.nodeName.toLowerCase() === cur ) {\r
+ match = elem;\r
+ break;\r
+ }\r
+\r
+ elem = elem[dir];\r
+ }\r
+\r
+ checkSet[i] = match;\r
+ }\r
+ }\r
+}\r
+\r
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\r
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {\r
+ var elem = checkSet[i];\r
+\r
+ if ( elem ) {\r
+ var match = false;\r
+\r
+ elem = elem[dir];\r
+\r
+ while ( elem ) {\r
+ if ( elem[ expando ] === doneName ) {\r
+ match = checkSet[elem.sizset];\r
+ break;\r
+ }\r
+\r
+ if ( elem.nodeType === 1 ) {\r
+ if ( !isXML ) {\r
+ elem[ expando ] = doneName;\r
+ elem.sizset = i;\r
+ }\r
+\r
+ if ( typeof cur !== "string" ) {\r
+ if ( elem === cur ) {\r
+ match = true;\r
+ break;\r
+ }\r
+\r
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\r
+ match = elem;\r
+ break;\r
+ }\r
+ }\r
+\r
+ elem = elem[dir];\r
+ }\r
+\r
+ checkSet[i] = match;\r
+ }\r
+ }\r
+}\r
+\r
+if ( document.documentElement.contains ) {\r
+ Sizzle.contains = function( a, b ) {\r
+ return a !== b && (a.contains ? a.contains(b) : true);\r
+ };\r
+\r
+} else if ( document.documentElement.compareDocumentPosition ) {\r
+ Sizzle.contains = function( a, b ) {\r
+ return !!(a.compareDocumentPosition(b) & 16);\r
+ };\r
+\r
+} else {\r
+ Sizzle.contains = function() {\r
+ return false;\r
+ };\r
+}\r
+\r
+Sizzle.isXML = function( elem ) {\r
+ // documentElement is verified for cases where it doesn't yet exist\r
+ // (such as loading iframes in IE - #4833)\r
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;\r
+\r
+ return documentElement ? documentElement.nodeName !== "HTML" : false;\r
+};\r
+\r
+var posProcess = function( selector, context, seed ) {\r
+ var match,\r
+ tmpSet = [],\r
+ later = "",\r
+ root = context.nodeType ? [context] : context;\r
+\r
+ // Position selectors must be done after the filter\r
+ // And so must :not(positional) so we move all PSEUDOs to the end\r
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {\r
+ later += match[0];\r
+ selector = selector.replace( Expr.match.PSEUDO, "" );\r
+ }\r
+\r
+ selector = Expr.relative[selector] ? selector + "*" : selector;\r
+\r
+ for ( var i = 0, l = root.length; i < l; i++ ) {\r
+ Sizzle( selector, root[i], tmpSet, seed );\r
+ }\r
+\r
+ return Sizzle.filter( later, tmpSet );\r
+};\r
+\r
+// EXPOSE\r
+// Override sizzle attribute retrieval\r
+Sizzle.attr = jQuery.attr;\r
+Sizzle.selectors.attrMap = {};\r
+jQuery.find = Sizzle;\r
+jQuery.expr = Sizzle.selectors;\r
+jQuery.expr[":"] = jQuery.expr.filters;\r
+jQuery.unique = Sizzle.uniqueSort;\r
+jQuery.text = Sizzle.getText;\r
+jQuery.isXMLDoc = Sizzle.isXML;\r
+jQuery.contains = Sizzle.contains;\r
+\r
+\r
+})();\r
+\r
+\r
+var runtil = /Until$/,\r
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,\r
+ // Note: This RegExp should be improved, or likely pulled from Sizzle\r
+ rmultiselector = /,/,\r
+ isSimple = /^.[^:#\[\.,]*$/,\r
+ slice = Array.prototype.slice,\r
+ POS = jQuery.expr.match.globalPOS,\r
+ // methods guaranteed to produce a unique set when starting from a unique set\r
+ guaranteedUnique = {\r
+ children: true,\r
+ contents: true,\r
+ next: true,\r
+ prev: true\r
+ };\r
+\r
+jQuery.fn.extend({\r
+ find: function( selector ) {\r
+ var self = this,\r
+ i, l;\r
+\r
+ if ( typeof selector !== "string" ) {\r
+ return jQuery( selector ).filter(function() {\r
+ for ( i = 0, l = self.length; i < l; i++ ) {\r
+ if ( jQuery.contains( self[ i ], this ) ) {\r
+ return true;\r
+ }\r
+ }\r
+ });\r
+ }\r
+\r
+ var ret = this.pushStack( "", "find", selector ),\r
+ length, n, r;\r
+\r
+ for ( i = 0, l = this.length; i < l; i++ ) {\r
+ length = ret.length;\r
+ jQuery.find( selector, this[i], ret );\r
+\r
+ if ( i > 0 ) {\r
+ // Make sure that the results are unique\r
+ for ( n = length; n < ret.length; n++ ) {\r
+ for ( r = 0; r < length; r++ ) {\r
+ if ( ret[r] === ret[n] ) {\r
+ ret.splice(n--, 1);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ },\r
+\r
+ has: function( target ) {\r
+ var targets = jQuery( target );\r
+ return this.filter(function() {\r
+ for ( var i = 0, l = targets.length; i < l; i++ ) {\r
+ if ( jQuery.contains( this, targets[i] ) ) {\r
+ return true;\r
+ }\r
+ }\r
+ });\r
+ },\r
+\r
+ not: function( selector ) {\r
+ return this.pushStack( winnow(this, selector, false), "not", selector);\r
+ },\r
+\r
+ filter: function( selector ) {\r
+ return this.pushStack( winnow(this, selector, true), "filter", selector );\r
+ },\r
+\r
+ is: function( selector ) {\r
+ return !!selector && (\r
+ typeof selector === "string" ?\r
+ // If this is a positional selector, check membership in the returned set\r
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".\r
+ POS.test( selector ) ?\r
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :\r
+ jQuery.filter( selector, this ).length > 0 :\r
+ this.filter( selector ).length > 0 );\r
+ },\r
+\r
+ closest: function( selectors, context ) {\r
+ var ret = [], i, l, cur = this[0];\r
+\r
+ // Array (deprecated as of jQuery 1.7)\r
+ if ( jQuery.isArray( selectors ) ) {\r
+ var level = 1;\r
+\r
+ while ( cur && cur.ownerDocument && cur !== context ) {\r
+ for ( i = 0; i < selectors.length; i++ ) {\r
+\r
+ if ( jQuery( cur ).is( selectors[ i ] ) ) {\r
+ ret.push({ selector: selectors[ i ], elem: cur, level: level });\r
+ }\r
+ }\r
+\r
+ cur = cur.parentNode;\r
+ level++;\r
+ }\r
+\r
+ return ret;\r
+ }\r
+\r
+ // String\r
+ var pos = POS.test( selectors ) || typeof selectors !== "string" ?\r
+ jQuery( selectors, context || this.context ) :\r
+ 0;\r
+\r
+ for ( i = 0, l = this.length; i < l; i++ ) {\r
+ cur = this[i];\r
+\r
+ while ( cur ) {\r
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {\r
+ ret.push( cur );\r
+ break;\r
+\r
+ } else {\r
+ cur = cur.parentNode;\r
+ if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;\r
+\r
+ return this.pushStack( ret, "closest", selectors );\r
+ },\r
+\r
+ // Determine the position of an element within\r
+ // the matched set of elements\r
+ index: function( elem ) {\r
+\r
+ // No argument, return index in parent\r
+ if ( !elem ) {\r
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;\r
+ }\r
+\r
+ // index in selector\r
+ if ( typeof elem === "string" ) {\r
+ return jQuery.inArray( this[0], jQuery( elem ) );\r
+ }\r
+\r
+ // Locate the position of the desired element\r
+ return jQuery.inArray(\r
+ // If it receives a jQuery object, the first element is used\r
+ elem.jquery ? elem[0] : elem, this );\r
+ },\r
+\r
+ add: function( selector, context ) {\r
+ var set = typeof selector === "string" ?\r
+ jQuery( selector, context ) :\r
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),\r
+ all = jQuery.merge( this.get(), set );\r
+\r
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?\r
+ all :\r
+ jQuery.unique( all ) );\r
+ },\r
+\r
+ andSelf: function() {\r
+ return this.add( this.prevObject );\r
+ }\r
+});\r
+\r
+// A painfully simple check to see if an element is disconnected\r
+// from a document (should be improved, where feasible).\r
+function isDisconnected( node ) {\r
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;\r
+}\r
+\r
+jQuery.each({\r
+ parent: function( elem ) {\r
+ var parent = elem.parentNode;\r
+ return parent && parent.nodeType !== 11 ? parent : null;\r
+ },\r
+ parents: function( elem ) {\r
+ return jQuery.dir( elem, "parentNode" );\r
+ },\r
+ parentsUntil: function( elem, i, until ) {\r
+ return jQuery.dir( elem, "parentNode", until );\r
+ },\r
+ next: function( elem ) {\r
+ return jQuery.nth( elem, 2, "nextSibling" );\r
+ },\r
+ prev: function( elem ) {\r
+ return jQuery.nth( elem, 2, "previousSibling" );\r
+ },\r
+ nextAll: function( elem ) {\r
+ return jQuery.dir( elem, "nextSibling" );\r
+ },\r
+ prevAll: function( elem ) {\r
+ return jQuery.dir( elem, "previousSibling" );\r
+ },\r
+ nextUntil: function( elem, i, until ) {\r
+ return jQuery.dir( elem, "nextSibling", until );\r
+ },\r
+ prevUntil: function( elem, i, until ) {\r
+ return jQuery.dir( elem, "previousSibling", until );\r
+ },\r
+ siblings: function( elem ) {\r
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );\r
+ },\r
+ children: function( elem ) {\r
+ return jQuery.sibling( elem.firstChild );\r
+ },\r
+ contents: function( elem ) {\r
+ return jQuery.nodeName( elem, "iframe" ) ?\r
+ elem.contentDocument || elem.contentWindow.document :\r
+ jQuery.makeArray( elem.childNodes );\r
+ }\r
+}, function( name, fn ) {\r
+ jQuery.fn[ name ] = function( until, selector ) {\r
+ var ret = jQuery.map( this, fn, until );\r
+\r
+ if ( !runtil.test( name ) ) {\r
+ selector = until;\r
+ }\r
+\r
+ if ( selector && typeof selector === "string" ) {\r
+ ret = jQuery.filter( selector, ret );\r
+ }\r
+\r
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;\r
+\r
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {\r
+ ret = ret.reverse();\r
+ }\r
+\r
+ return this.pushStack( ret, name, slice.call( arguments ).join(",") );\r
+ };\r
+});\r
+\r
+jQuery.extend({\r
+ filter: function( expr, elems, not ) {\r
+ if ( not ) {\r
+ expr = ":not(" + expr + ")";\r
+ }\r
+\r
+ return elems.length === 1 ?\r
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :\r
+ jQuery.find.matches(expr, elems);\r
+ },\r
+\r
+ dir: function( elem, dir, until ) {\r
+ var matched = [],\r
+ cur = elem[ dir ];\r
+\r
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {\r
+ if ( cur.nodeType === 1 ) {\r
+ matched.push( cur );\r
+ }\r
+ cur = cur[dir];\r
+ }\r
+ return matched;\r
+ },\r
+\r
+ nth: function( cur, result, dir, elem ) {\r
+ result = result || 1;\r
+ var num = 0;\r
+\r
+ for ( ; cur; cur = cur[dir] ) {\r
+ if ( cur.nodeType === 1 && ++num === result ) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ return cur;\r
+ },\r
+\r
+ sibling: function( n, elem ) {\r
+ var r = [];\r
+\r
+ for ( ; n; n = n.nextSibling ) {\r
+ if ( n.nodeType === 1 && n !== elem ) {\r
+ r.push( n );\r
+ }\r
+ }\r
+\r
+ return r;\r
+ }\r
+});\r
+\r
+// Implement the identical functionality for filter and not\r
+function winnow( elements, qualifier, keep ) {\r
+\r
+ // Can't pass null or undefined to indexOf in Firefox 4\r
+ // Set to 0 to skip string check\r
+ qualifier = qualifier || 0;\r
+\r
+ if ( jQuery.isFunction( qualifier ) ) {\r
+ return jQuery.grep(elements, function( elem, i ) {\r
+ var retVal = !!qualifier.call( elem, i, elem );\r
+ return retVal === keep;\r
+ });\r
+\r
+ } else if ( qualifier.nodeType ) {\r
+ return jQuery.grep(elements, function( elem, i ) {\r
+ return ( elem === qualifier ) === keep;\r
+ });\r
+\r
+ } else if ( typeof qualifier === "string" ) {\r
+ var filtered = jQuery.grep(elements, function( elem ) {\r
+ return elem.nodeType === 1;\r
+ });\r
+\r
+ if ( isSimple.test( qualifier ) ) {\r
+ return jQuery.filter(qualifier, filtered, !keep);\r
+ } else {\r
+ qualifier = jQuery.filter( qualifier, filtered );\r
+ }\r
+ }\r
+\r
+ return jQuery.grep(elements, function( elem, i ) {\r
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;\r
+ });\r
+}\r
+\r
+\r
+\r
+\r
+function createSafeFragment( document ) {\r
+ var list = nodeNames.split( "|" ),\r
+ safeFrag = document.createDocumentFragment();\r
+\r
+ if ( safeFrag.createElement ) {\r
+ while ( list.length ) {\r
+ safeFrag.createElement(\r
+ list.pop()\r
+ );\r
+ }\r
+ }\r
+ return safeFrag;\r
+}\r
+\r
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +\r
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",\r
+ rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,\r
+ rleadingWhitespace = /^\s+/,\r
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,\r
+ rtagName = /<([\w:]+)/,\r
+ rtbody = /<tbody/i,\r
+ rhtml = /<|&#?\w+;/,\r
+ rnoInnerhtml = /<(?:script|style)/i,\r
+ rnocache = /<(?:script|object|embed|option|style)/i,\r
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),\r
+ // checked="checked" or checked\r
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,\r
+ rscriptType = /\/(java|ecma)script/i,\r
+ rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,\r
+ wrapMap = {\r
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],\r
+ legend: [ 1, "<fieldset>", "</fieldset>" ],\r
+ thead: [ 1, "<table>", "</table>" ],\r
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],\r
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],\r
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],\r
+ area: [ 1, "<map>", "</map>" ],\r
+ _default: [ 0, "", "" ]\r
+ },\r
+ safeFragment = createSafeFragment( document );\r
+\r
+wrapMap.optgroup = wrapMap.option;\r
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\r
+wrapMap.th = wrapMap.td;\r
+\r
+// IE can't serialize <link> and <script> tags normally\r
+if ( !jQuery.support.htmlSerialize ) {\r
+ wrapMap._default = [ 1, "div<div>", "</div>" ];\r
+}\r
+\r
+jQuery.fn.extend({\r
+ text: function( value ) {\r
+ return jQuery.access( this, function( value ) {\r
+ return value === undefined ?\r
+ jQuery.text( this ) :\r
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );\r
+ }, null, value, arguments.length );\r
+ },\r
+\r
+ wrapAll: function( html ) {\r
+ if ( jQuery.isFunction( html ) ) {\r
+ return this.each(function(i) {\r
+ jQuery(this).wrapAll( html.call(this, i) );\r
+ });\r
+ }\r
+\r
+ if ( this[0] ) {\r
+ // The elements to wrap the target around\r
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);\r
+\r
+ if ( this[0].parentNode ) {\r
+ wrap.insertBefore( this[0] );\r
+ }\r
+\r
+ wrap.map(function() {\r
+ var elem = this;\r
+\r
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {\r
+ elem = elem.firstChild;\r
+ }\r
+\r
+ return elem;\r
+ }).append( this );\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ wrapInner: function( html ) {\r
+ if ( jQuery.isFunction( html ) ) {\r
+ return this.each(function(i) {\r
+ jQuery(this).wrapInner( html.call(this, i) );\r
+ });\r
+ }\r
+\r
+ return this.each(function() {\r
+ var self = jQuery( this ),\r
+ contents = self.contents();\r
+\r
+ if ( contents.length ) {\r
+ contents.wrapAll( html );\r
+\r
+ } else {\r
+ self.append( html );\r
+ }\r
+ });\r
+ },\r
+\r
+ wrap: function( html ) {\r
+ var isFunction = jQuery.isFunction( html );\r
+\r
+ return this.each(function(i) {\r
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );\r
+ });\r
+ },\r
+\r
+ unwrap: function() {\r
+ return this.parent().each(function() {\r
+ if ( !jQuery.nodeName( this, "body" ) ) {\r
+ jQuery( this ).replaceWith( this.childNodes );\r
+ }\r
+ }).end();\r
+ },\r
+\r
+ append: function() {\r
+ return this.domManip(arguments, true, function( elem ) {\r
+ if ( this.nodeType === 1 ) {\r
+ this.appendChild( elem );\r
+ }\r
+ });\r
+ },\r
+\r
+ prepend: function() {\r
+ return this.domManip(arguments, true, function( elem ) {\r
+ if ( this.nodeType === 1 ) {\r
+ this.insertBefore( elem, this.firstChild );\r
+ }\r
+ });\r
+ },\r
+\r
+ before: function() {\r
+ if ( this[0] && this[0].parentNode ) {\r
+ return this.domManip(arguments, false, function( elem ) {\r
+ this.parentNode.insertBefore( elem, this );\r
+ });\r
+ } else if ( arguments.length ) {\r
+ var set = jQuery.clean( arguments );\r
+ set.push.apply( set, this.toArray() );\r
+ return this.pushStack( set, "before", arguments );\r
+ }\r
+ },\r
+\r
+ after: function() {\r
+ if ( this[0] && this[0].parentNode ) {\r
+ return this.domManip(arguments, false, function( elem ) {\r
+ this.parentNode.insertBefore( elem, this.nextSibling );\r
+ });\r
+ } else if ( arguments.length ) {\r
+ var set = this.pushStack( this, "after", arguments );\r
+ set.push.apply( set, jQuery.clean(arguments) );\r
+ return set;\r
+ }\r
+ },\r
+\r
+ // keepData is for internal use only--do not document\r
+ remove: function( selector, keepData ) {\r
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {\r
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {\r
+ if ( !keepData && elem.nodeType === 1 ) {\r
+ jQuery.cleanData( elem.getElementsByTagName("*") );\r
+ jQuery.cleanData( [ elem ] );\r
+ }\r
+\r
+ if ( elem.parentNode ) {\r
+ elem.parentNode.removeChild( elem );\r
+ }\r
+ }\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ empty: function() {\r
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {\r
+ // Remove element nodes and prevent memory leaks\r
+ if ( elem.nodeType === 1 ) {\r
+ jQuery.cleanData( elem.getElementsByTagName("*") );\r
+ }\r
+\r
+ // Remove any remaining nodes\r
+ while ( elem.firstChild ) {\r
+ elem.removeChild( elem.firstChild );\r
+ }\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ clone: function( dataAndEvents, deepDataAndEvents ) {\r
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\r
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\r
+\r
+ return this.map( function () {\r
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );\r
+ });\r
+ },\r
+\r
+ html: function( value ) {\r
+ return jQuery.access( this, function( value ) {\r
+ var elem = this[0] || {},\r
+ i = 0,\r
+ l = this.length;\r
+\r
+ if ( value === undefined ) {\r
+ return elem.nodeType === 1 ?\r
+ elem.innerHTML.replace( rinlinejQuery, "" ) :\r
+ null;\r
+ }\r
+\r
+\r
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&\r
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&\r
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {\r
+\r
+ value = value.replace( rxhtmlTag, "<$1></$2>" );\r
+\r
+ try {\r
+ for (; i < l; i++ ) {\r
+ // Remove element nodes and prevent memory leaks\r
+ elem = this[i] || {};\r
+ if ( elem.nodeType === 1 ) {\r
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );\r
+ elem.innerHTML = value;\r
+ }\r
+ }\r
+\r
+ elem = 0;\r
+\r
+ // If using innerHTML throws an exception, use the fallback method\r
+ } catch(e) {}\r
+ }\r
+\r
+ if ( elem ) {\r
+ this.empty().append( value );\r
+ }\r
+ }, null, value, arguments.length );\r
+ },\r
+\r
+ replaceWith: function( value ) {\r
+ if ( this[0] && this[0].parentNode ) {\r
+ // Make sure that the elements are removed from the DOM before they are inserted\r
+ // this can help fix replacing a parent with child elements\r
+ if ( jQuery.isFunction( value ) ) {\r
+ return this.each(function(i) {\r
+ var self = jQuery(this), old = self.html();\r
+ self.replaceWith( value.call( this, i, old ) );\r
+ });\r
+ }\r
+\r
+ if ( typeof value !== "string" ) {\r
+ value = jQuery( value ).detach();\r
+ }\r
+\r
+ return this.each(function() {\r
+ var next = this.nextSibling,\r
+ parent = this.parentNode;\r
+\r
+ jQuery( this ).remove();\r
+\r
+ if ( next ) {\r
+ jQuery(next).before( value );\r
+ } else {\r
+ jQuery(parent).append( value );\r
+ }\r
+ });\r
+ } else {\r
+ return this.length ?\r
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :\r
+ this;\r
+ }\r
+ },\r
+\r
+ detach: function( selector ) {\r
+ return this.remove( selector, true );\r
+ },\r
+\r
+ domManip: function( args, table, callback ) {\r
+ var results, first, fragment, parent,\r
+ value = args[0],\r
+ scripts = [];\r
+\r
+ // We can't cloneNode fragments that contain checked, in WebKit\r
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {\r
+ return this.each(function() {\r
+ jQuery(this).domManip( args, table, callback, true );\r
+ });\r
+ }\r
+\r
+ if ( jQuery.isFunction(value) ) {\r
+ return this.each(function(i) {\r
+ var self = jQuery(this);\r
+ args[0] = value.call(this, i, table ? self.html() : undefined);\r
+ self.domManip( args, table, callback );\r
+ });\r
+ }\r
+\r
+ if ( this[0] ) {\r
+ parent = value && value.parentNode;\r
+\r
+ // If we're in a fragment, just use that instead of building a new one\r
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {\r
+ results = { fragment: parent };\r
+\r
+ } else {\r
+ results = jQuery.buildFragment( args, this, scripts );\r
+ }\r
+\r
+ fragment = results.fragment;\r
+\r
+ if ( fragment.childNodes.length === 1 ) {\r
+ first = fragment = fragment.firstChild;\r
+ } else {\r
+ first = fragment.firstChild;\r
+ }\r
+\r
+ if ( first ) {\r
+ table = table && jQuery.nodeName( first, "tr" );\r
+\r
+ for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {\r
+ callback.call(\r
+ table ?\r
+ root(this[i], first) :\r
+ this[i],\r
+ // Make sure that we do not leak memory by inadvertently discarding\r
+ // the original fragment (which might have attached data) instead of\r
+ // using it; in addition, use the original fragment object for the last\r
+ // item instead of first because it can end up being emptied incorrectly\r
+ // in certain situations (Bug #8070).\r
+ // Fragments from the fragment cache must always be cloned and never used\r
+ // in place.\r
+ results.cacheable || ( l > 1 && i < lastIndex ) ?\r
+ jQuery.clone( fragment, true, true ) :\r
+ fragment\r
+ );\r
+ }\r
+ }\r
+\r
+ if ( scripts.length ) {\r
+ jQuery.each( scripts, function( i, elem ) {\r
+ if ( elem.src ) {\r
+ jQuery.ajax({\r
+ type: "GET",\r
+ global: false,\r
+ url: elem.src,\r
+ async: false,\r
+ dataType: "script"\r
+ });\r
+ } else {\r
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );\r
+ }\r
+\r
+ if ( elem.parentNode ) {\r
+ elem.parentNode.removeChild( elem );\r
+ }\r
+ });\r
+ }\r
+ }\r
+\r
+ return this;\r
+ }\r
+});\r
+\r
+function root( elem, cur ) {\r
+ return jQuery.nodeName(elem, "table") ?\r
+ (elem.getElementsByTagName("tbody")[0] ||\r
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :\r
+ elem;\r
+}\r
+\r
+function cloneCopyEvent( src, dest ) {\r
+\r
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {\r
+ return;\r
+ }\r
+\r
+ var type, i, l,\r
+ oldData = jQuery._data( src ),\r
+ curData = jQuery._data( dest, oldData ),\r
+ events = oldData.events;\r
+\r
+ if ( events ) {\r
+ delete curData.handle;\r
+ curData.events = {};\r
+\r
+ for ( type in events ) {\r
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {\r
+ jQuery.event.add( dest, type, events[ type ][ i ] );\r
+ }\r
+ }\r
+ }\r
+\r
+ // make the cloned public data object a copy from the original\r
+ if ( curData.data ) {\r
+ curData.data = jQuery.extend( {}, curData.data );\r
+ }\r
+}\r
+\r
+function cloneFixAttributes( src, dest ) {\r
+ var nodeName;\r
+\r
+ // We do not need to do anything for non-Elements\r
+ if ( dest.nodeType !== 1 ) {\r
+ return;\r
+ }\r
+\r
+ // clearAttributes removes the attributes, which we don't want,\r
+ // but also removes the attachEvent events, which we *do* want\r
+ if ( dest.clearAttributes ) {\r
+ dest.clearAttributes();\r
+ }\r
+\r
+ // mergeAttributes, in contrast, only merges back on the\r
+ // original attributes, not the events\r
+ if ( dest.mergeAttributes ) {\r
+ dest.mergeAttributes( src );\r
+ }\r
+\r
+ nodeName = dest.nodeName.toLowerCase();\r
+\r
+ // IE6-8 fail to clone children inside object elements that use\r
+ // the proprietary classid attribute value (rather than the type\r
+ // attribute) to identify the type of content to display\r
+ if ( nodeName === "object" ) {\r
+ dest.outerHTML = src.outerHTML;\r
+\r
+ } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {\r
+ // IE6-8 fails to persist the checked state of a cloned checkbox\r
+ // or radio button. Worse, IE6-7 fail to give the cloned element\r
+ // a checked appearance if the defaultChecked value isn't also set\r
+ if ( src.checked ) {\r
+ dest.defaultChecked = dest.checked = src.checked;\r
+ }\r
+\r
+ // IE6-7 get confused and end up setting the value of a cloned\r
+ // checkbox/radio button to an empty string instead of "on"\r
+ if ( dest.value !== src.value ) {\r
+ dest.value = src.value;\r
+ }\r
+\r
+ // IE6-8 fails to return the selected option to the default selected\r
+ // state when cloning options\r
+ } else if ( nodeName === "option" ) {\r
+ dest.selected = src.defaultSelected;\r
+\r
+ // IE6-8 fails to set the defaultValue to the correct value when\r
+ // cloning other types of input fields\r
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {\r
+ dest.defaultValue = src.defaultValue;\r
+\r
+ // IE blanks contents when cloning scripts\r
+ } else if ( nodeName === "script" && dest.text !== src.text ) {\r
+ dest.text = src.text;\r
+ }\r
+\r
+ // Event data gets referenced instead of copied if the expando\r
+ // gets copied too\r
+ dest.removeAttribute( jQuery.expando );\r
+\r
+ // Clear flags for bubbling special change/submit events, they must\r
+ // be reattached when the newly cloned events are first activated\r
+ dest.removeAttribute( "_submit_attached" );\r
+ dest.removeAttribute( "_change_attached" );\r
+}\r
+\r
+jQuery.buildFragment = function( args, nodes, scripts ) {\r
+ var fragment, cacheable, cacheresults, doc,\r
+ first = args[ 0 ];\r
+\r
+ // nodes may contain either an explicit document object,\r
+ // a jQuery collection or context object.\r
+ // If nodes[0] contains a valid object to assign to doc\r
+ if ( nodes && nodes[0] ) {\r
+ doc = nodes[0].ownerDocument || nodes[0];\r
+ }\r
+\r
+ // Ensure that an attr object doesn't incorrectly stand in as a document object\r
+ // Chrome and Firefox seem to allow this to occur and will throw exception\r
+ // Fixes #8950\r
+ if ( !doc.createDocumentFragment ) {\r
+ doc = document;\r
+ }\r
+\r
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document\r
+ // Cloning options loses the selected state, so don't cache them\r
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment\r
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache\r
+ // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501\r
+ if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&\r
+ first.charAt(0) === "<" && !rnocache.test( first ) &&\r
+ (jQuery.support.checkClone || !rchecked.test( first )) &&\r
+ (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {\r
+\r
+ cacheable = true;\r
+\r
+ cacheresults = jQuery.fragments[ first ];\r
+ if ( cacheresults && cacheresults !== 1 ) {\r
+ fragment = cacheresults;\r
+ }\r
+ }\r
+\r
+ if ( !fragment ) {\r
+ fragment = doc.createDocumentFragment();\r
+ jQuery.clean( args, doc, fragment, scripts );\r
+ }\r
+\r
+ if ( cacheable ) {\r
+ jQuery.fragments[ first ] = cacheresults ? fragment : 1;\r
+ }\r
+\r
+ return { fragment: fragment, cacheable: cacheable };\r
+};\r
+\r
+jQuery.fragments = {};\r
+\r
+jQuery.each({\r
+ appendTo: "append",\r
+ prependTo: "prepend",\r
+ insertBefore: "before",\r
+ insertAfter: "after",\r
+ replaceAll: "replaceWith"\r
+}, function( name, original ) {\r
+ jQuery.fn[ name ] = function( selector ) {\r
+ var ret = [],\r
+ insert = jQuery( selector ),\r
+ parent = this.length === 1 && this[0].parentNode;\r
+\r
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {\r
+ insert[ original ]( this[0] );\r
+ return this;\r
+\r
+ } else {\r
+ for ( var i = 0, l = insert.length; i < l; i++ ) {\r
+ var elems = ( i > 0 ? this.clone(true) : this ).get();\r
+ jQuery( insert[i] )[ original ]( elems );\r
+ ret = ret.concat( elems );\r
+ }\r
+\r
+ return this.pushStack( ret, name, insert.selector );\r
+ }\r
+ };\r
+});\r
+\r
+function getAll( elem ) {\r
+ if ( typeof elem.getElementsByTagName !== "undefined" ) {\r
+ return elem.getElementsByTagName( "*" );\r
+\r
+ } else if ( typeof elem.querySelectorAll !== "undefined" ) {\r
+ return elem.querySelectorAll( "*" );\r
+\r
+ } else {\r
+ return [];\r
+ }\r
+}\r
+\r
+// Used in clean, fixes the defaultChecked property\r
+function fixDefaultChecked( elem ) {\r
+ if ( elem.type === "checkbox" || elem.type === "radio" ) {\r
+ elem.defaultChecked = elem.checked;\r
+ }\r
+}\r
+// Finds all inputs and passes them to fixDefaultChecked\r
+function findInputs( elem ) {\r
+ var nodeName = ( elem.nodeName || "" ).toLowerCase();\r
+ if ( nodeName === "input" ) {\r
+ fixDefaultChecked( elem );\r
+ // Skip scripts, get other children\r
+ } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {\r
+ jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );\r
+ }\r
+}\r
+\r
+// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js\r
+function shimCloneNode( elem ) {\r
+ var div = document.createElement( "div" );\r
+ safeFragment.appendChild( div );\r
+\r
+ div.innerHTML = elem.outerHTML;\r
+ return div.firstChild;\r
+}\r
+\r
+jQuery.extend({\r
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {\r
+ var srcElements,\r
+ destElements,\r
+ i,\r
+ // IE<=8 does not properly clone detached, unknown element nodes\r
+ clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?\r
+ elem.cloneNode( true ) :\r
+ shimCloneNode( elem );\r
+\r
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&\r
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {\r
+ // IE copies events bound via attachEvent when using cloneNode.\r
+ // Calling detachEvent on the clone will also remove the events\r
+ // from the original. In order to get around this, we use some\r
+ // proprietary methods to clear the events. Thanks to MooTools\r
+ // guys for this hotness.\r
+\r
+ cloneFixAttributes( elem, clone );\r
+\r
+ // Using Sizzle here is crazy slow, so we use getElementsByTagName instead\r
+ srcElements = getAll( elem );\r
+ destElements = getAll( clone );\r
+\r
+ // Weird iteration because IE will replace the length property\r
+ // with an element if you are cloning the body and one of the\r
+ // elements on the page has a name or id of "length"\r
+ for ( i = 0; srcElements[i]; ++i ) {\r
+ // Ensure that the destination node is not null; Fixes #9587\r
+ if ( destElements[i] ) {\r
+ cloneFixAttributes( srcElements[i], destElements[i] );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Copy the events from the original to the clone\r
+ if ( dataAndEvents ) {\r
+ cloneCopyEvent( elem, clone );\r
+\r
+ if ( deepDataAndEvents ) {\r
+ srcElements = getAll( elem );\r
+ destElements = getAll( clone );\r
+\r
+ for ( i = 0; srcElements[i]; ++i ) {\r
+ cloneCopyEvent( srcElements[i], destElements[i] );\r
+ }\r
+ }\r
+ }\r
+\r
+ srcElements = destElements = null;\r
+\r
+ // Return the cloned set\r
+ return clone;\r
+ },\r
+\r
+ clean: function( elems, context, fragment, scripts ) {\r
+ var checkScriptType, script, j,\r
+ ret = [];\r
+\r
+ context = context || document;\r
+\r
+ // !context.createElement fails in IE with an error but returns typeof 'object'\r
+ if ( typeof context.createElement === "undefined" ) {\r
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;\r
+ }\r
+\r
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\r
+ if ( typeof elem === "number" ) {\r
+ elem += "";\r
+ }\r
+\r
+ if ( !elem ) {\r
+ continue;\r
+ }\r
+\r
+ // Convert html string into DOM nodes\r
+ if ( typeof elem === "string" ) {\r
+ if ( !rhtml.test( elem ) ) {\r
+ elem = context.createTextNode( elem );\r
+ } else {\r
+ // Fix "XHTML"-style tags in all browsers\r
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");\r
+\r
+ // Trim whitespace, otherwise indexOf won't work as expected\r
+ var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),\r
+ wrap = wrapMap[ tag ] || wrapMap._default,\r
+ depth = wrap[0],\r
+ div = context.createElement("div"),\r
+ safeChildNodes = safeFragment.childNodes,\r
+ remove;\r
+\r
+ // Append wrapper element to unknown element safe doc fragment\r
+ if ( context === document ) {\r
+ // Use the fragment we've already created for this document\r
+ safeFragment.appendChild( div );\r
+ } else {\r
+ // Use a fragment created with the owner document\r
+ createSafeFragment( context ).appendChild( div );\r
+ }\r
+\r
+ // Go to html and back, then peel off extra wrappers\r
+ div.innerHTML = wrap[1] + elem + wrap[2];\r
+\r
+ // Move to the right depth\r
+ while ( depth-- ) {\r
+ div = div.lastChild;\r
+ }\r
+\r
+ // Remove IE's autoinserted <tbody> from table fragments\r
+ if ( !jQuery.support.tbody ) {\r
+\r
+ // String was a <table>, *may* have spurious <tbody>\r
+ var hasBody = rtbody.test(elem),\r
+ tbody = tag === "table" && !hasBody ?\r
+ div.firstChild && div.firstChild.childNodes :\r
+\r
+ // String was a bare <thead> or <tfoot>\r
+ wrap[1] === "<table>" && !hasBody ?\r
+ div.childNodes :\r
+ [];\r
+\r
+ for ( j = tbody.length - 1; j >= 0 ; --j ) {\r
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {\r
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );\r
+ }\r
+ }\r
+ }\r
+\r
+ // IE completely kills leading whitespace when innerHTML is used\r
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {\r
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );\r
+ }\r
+\r
+ elem = div.childNodes;\r
+\r
+ // Clear elements from DocumentFragment (safeFragment or otherwise)\r
+ // to avoid hoarding elements. Fixes #11356\r
+ if ( div ) {\r
+ div.parentNode.removeChild( div );\r
+\r
+ // Guard against -1 index exceptions in FF3.6\r
+ if ( safeChildNodes.length > 0 ) {\r
+ remove = safeChildNodes[ safeChildNodes.length - 1 ];\r
+\r
+ if ( remove && remove.parentNode ) {\r
+ remove.parentNode.removeChild( remove );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // Resets defaultChecked for any radios and checkboxes\r
+ // about to be appended to the DOM in IE 6/7 (#8060)\r
+ var len;\r
+ if ( !jQuery.support.appendChecked ) {\r
+ if ( elem[0] && typeof (len = elem.length) === "number" ) {\r
+ for ( j = 0; j < len; j++ ) {\r
+ findInputs( elem[j] );\r
+ }\r
+ } else {\r
+ findInputs( elem );\r
+ }\r
+ }\r
+\r
+ if ( elem.nodeType ) {\r
+ ret.push( elem );\r
+ } else {\r
+ ret = jQuery.merge( ret, elem );\r
+ }\r
+ }\r
+\r
+ if ( fragment ) {\r
+ checkScriptType = function( elem ) {\r
+ return !elem.type || rscriptType.test( elem.type );\r
+ };\r
+ for ( i = 0; ret[i]; i++ ) {\r
+ script = ret[i];\r
+ if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {\r
+ scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );\r
+\r
+ } else {\r
+ if ( script.nodeType === 1 ) {\r
+ var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );\r
+\r
+ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );\r
+ }\r
+ fragment.appendChild( script );\r
+ }\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ },\r
+\r
+ cleanData: function( elems ) {\r
+ var data, id,\r
+ cache = jQuery.cache,\r
+ special = jQuery.event.special,\r
+ deleteExpando = jQuery.support.deleteExpando;\r
+\r
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\r
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {\r
+ continue;\r
+ }\r
+\r
+ id = elem[ jQuery.expando ];\r
+\r
+ if ( id ) {\r
+ data = cache[ id ];\r
+\r
+ if ( data && data.events ) {\r
+ for ( var type in data.events ) {\r
+ if ( special[ type ] ) {\r
+ jQuery.event.remove( elem, type );\r
+\r
+ // This is a shortcut to avoid jQuery.event.remove's overhead\r
+ } else {\r
+ jQuery.removeEvent( elem, type, data.handle );\r
+ }\r
+ }\r
+\r
+ // Null the DOM reference to avoid IE6/7/8 leak (#7054)\r
+ if ( data.handle ) {\r
+ data.handle.elem = null;\r
+ }\r
+ }\r
+\r
+ if ( deleteExpando ) {\r
+ delete elem[ jQuery.expando ];\r
+\r
+ } else if ( elem.removeAttribute ) {\r
+ elem.removeAttribute( jQuery.expando );\r
+ }\r
+\r
+ delete cache[ id ];\r
+ }\r
+ }\r
+ }\r
+});\r
+\r
+\r
+\r
+\r
+var ralpha = /alpha\([^)]*\)/i,\r
+ ropacity = /opacity=([^)]*)/,\r
+ // fixed for IE9, see #8346\r
+ rupper = /([A-Z]|^ms)/g,\r
+ rnum = /^[\-+]?(?:\d*\.)?\d+$/i,\r
+ rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,\r
+ rrelNum = /^([\-+])=([\-+.\de]+)/,\r
+ rmargin = /^margin/,\r
+\r
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },\r
+\r
+ // order is important!\r
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],\r
+\r
+ curCSS,\r
+\r
+ getComputedStyle,\r
+ currentStyle;\r
+\r
+jQuery.fn.css = function( name, value ) {\r
+ return jQuery.access( this, function( elem, name, value ) {\r
+ return value !== undefined ?\r
+ jQuery.style( elem, name, value ) :\r
+ jQuery.css( elem, name );\r
+ }, name, value, arguments.length > 1 );\r
+};\r
+\r
+jQuery.extend({\r
+ // Add in style property hooks for overriding the default\r
+ // behavior of getting and setting a style property\r
+ cssHooks: {\r
+ opacity: {\r
+ get: function( elem, computed ) {\r
+ if ( computed ) {\r
+ // We should always get a number back from opacity\r
+ var ret = curCSS( elem, "opacity" );\r
+ return ret === "" ? "1" : ret;\r
+\r
+ } else {\r
+ return elem.style.opacity;\r
+ }\r
+ }\r
+ }\r
+ },\r
+\r
+ // Exclude the following css properties to add px\r
+ cssNumber: {\r
+ "fillOpacity": true,\r
+ "fontWeight": true,\r
+ "lineHeight": true,\r
+ "opacity": true,\r
+ "orphans": true,\r
+ "widows": true,\r
+ "zIndex": true,\r
+ "zoom": true\r
+ },\r
+\r
+ // Add in properties whose names you wish to fix before\r
+ // setting or getting the value\r
+ cssProps: {\r
+ // normalize float css property\r
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"\r
+ },\r
+\r
+ // Get and set the style property on a DOM Node\r
+ style: function( elem, name, value, extra ) {\r
+ // Don't set styles on text and comment nodes\r
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\r
+ return;\r
+ }\r
+\r
+ // Make sure that we're working with the right name\r
+ var ret, type, origName = jQuery.camelCase( name ),\r
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];\r
+\r
+ name = jQuery.cssProps[ origName ] || origName;\r
+\r
+ // Check if we're setting a value\r
+ if ( value !== undefined ) {\r
+ type = typeof value;\r
+\r
+ // convert relative number strings (+= or -=) to relative numbers. #7345\r
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {\r
+ value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );\r
+ // Fixes bug #9237\r
+ type = "number";\r
+ }\r
+\r
+ // Make sure that NaN and null values aren't set. See: #7116\r
+ if ( value == null || type === "number" && isNaN( value ) ) {\r
+ return;\r
+ }\r
+\r
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)\r
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {\r
+ value += "px";\r
+ }\r
+\r
+ // If a hook was provided, use that value, otherwise just set the specified value\r
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {\r
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided\r
+ // Fixes bug #5509\r
+ try {\r
+ style[ name ] = value;\r
+ } catch(e) {}\r
+ }\r
+\r
+ } else {\r
+ // If a hook was provided get the non-computed value from there\r
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {\r
+ return ret;\r
+ }\r
+\r
+ // Otherwise just get the value from the style object\r
+ return style[ name ];\r
+ }\r
+ },\r
+\r
+ css: function( elem, name, extra ) {\r
+ var ret, hooks;\r
+\r
+ // Make sure that we're working with the right name\r
+ name = jQuery.camelCase( name );\r
+ hooks = jQuery.cssHooks[ name ];\r
+ name = jQuery.cssProps[ name ] || name;\r
+\r
+ // cssFloat needs a special treatment\r
+ if ( name === "cssFloat" ) {\r
+ name = "float";\r
+ }\r
+\r
+ // If a hook was provided get the computed value from there\r
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {\r
+ return ret;\r
+\r
+ // Otherwise, if a way to get the computed value exists, use that\r
+ } else if ( curCSS ) {\r
+ return curCSS( elem, name );\r
+ }\r
+ },\r
+\r
+ // A method for quickly swapping in/out CSS properties to get correct calculations\r
+ swap: function( elem, options, callback ) {\r
+ var old = {},\r
+ ret, name;\r
+\r
+ // Remember the old values, and insert the new ones\r
+ for ( name in options ) {\r
+ old[ name ] = elem.style[ name ];\r
+ elem.style[ name ] = options[ name ];\r
+ }\r
+\r
+ ret = callback.call( elem );\r
+\r
+ // Revert the old values\r
+ for ( name in options ) {\r
+ elem.style[ name ] = old[ name ];\r
+ }\r
+\r
+ return ret;\r
+ }\r
+});\r
+\r
+// DEPRECATED in 1.3, Use jQuery.css() instead\r
+jQuery.curCSS = jQuery.css;\r
+\r
+if ( document.defaultView && document.defaultView.getComputedStyle ) {\r
+ getComputedStyle = function( elem, name ) {\r
+ var ret, defaultView, computedStyle, width,\r
+ style = elem.style;\r
+\r
+ name = name.replace( rupper, "-$1" ).toLowerCase();\r
+\r
+ if ( (defaultView = elem.ownerDocument.defaultView) &&\r
+ (computedStyle = defaultView.getComputedStyle( elem, null )) ) {\r
+\r
+ ret = computedStyle.getPropertyValue( name );\r
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {\r
+ ret = jQuery.style( elem, name );\r
+ }\r
+ }\r
+\r
+ // A tribute to the "awesome hack by Dean Edwards"\r
+ // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins\r
+ // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values\r
+ if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {\r
+ width = style.width;\r
+ style.width = ret;\r
+ ret = computedStyle.width;\r
+ style.width = width;\r
+ }\r
+\r
+ return ret;\r
+ };\r
+}\r
+\r
+if ( document.documentElement.currentStyle ) {\r
+ currentStyle = function( elem, name ) {\r
+ var left, rsLeft, uncomputed,\r
+ ret = elem.currentStyle && elem.currentStyle[ name ],\r
+ style = elem.style;\r
+\r
+ // Avoid setting ret to empty string here\r
+ // so we don't default to auto\r
+ if ( ret == null && style && (uncomputed = style[ name ]) ) {\r
+ ret = uncomputed;\r
+ }\r
+\r
+ // From the awesome hack by Dean Edwards\r
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\r
+\r
+ // If we're not dealing with a regular pixel number\r
+ // but a number that has a weird ending, we need to convert it to pixels\r
+ if ( rnumnonpx.test( ret ) ) {\r
+\r
+ // Remember the original values\r
+ left = style.left;\r
+ rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;\r
+\r
+ // Put in the new values to get a computed value out\r
+ if ( rsLeft ) {\r
+ elem.runtimeStyle.left = elem.currentStyle.left;\r
+ }\r
+ style.left = name === "fontSize" ? "1em" : ret;\r
+ ret = style.pixelLeft + "px";\r
+\r
+ // Revert the changed values\r
+ style.left = left;\r
+ if ( rsLeft ) {\r
+ elem.runtimeStyle.left = rsLeft;\r
+ }\r
+ }\r
+\r
+ return ret === "" ? "auto" : ret;\r
+ };\r
+}\r
+\r
+curCSS = getComputedStyle || currentStyle;\r
+\r
+function getWidthOrHeight( elem, name, extra ) {\r
+\r
+ // Start with offset property\r
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,\r
+ i = name === "width" ? 1 : 0,\r
+ len = 4;\r
+\r
+ if ( val > 0 ) {\r
+ if ( extra !== "border" ) {\r
+ for ( ; i < len; i += 2 ) {\r
+ if ( !extra ) {\r
+ val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;\r
+ }\r
+ if ( extra === "margin" ) {\r
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;\r
+ } else {\r
+ val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;\r
+ }\r
+ }\r
+ }\r
+\r
+ return val + "px";\r
+ }\r
+\r
+ // Fall back to computed then uncomputed css if necessary\r
+ val = curCSS( elem, name );\r
+ if ( val < 0 || val == null ) {\r
+ val = elem.style[ name ];\r
+ }\r
+\r
+ // Computed unit is not pixels. Stop here and return.\r
+ if ( rnumnonpx.test(val) ) {\r
+ return val;\r
+ }\r
+\r
+ // Normalize "", auto, and prepare for extra\r
+ val = parseFloat( val ) || 0;\r
+\r
+ // Add padding, border, margin\r
+ if ( extra ) {\r
+ for ( ; i < len; i += 2 ) {\r
+ val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;\r
+ if ( extra !== "padding" ) {\r
+ val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;\r
+ }\r
+ if ( extra === "margin" ) {\r
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;\r
+ }\r
+ }\r
+ }\r
+\r
+ return val + "px";\r
+}\r
+\r
+jQuery.each([ "height", "width" ], function( i, name ) {\r
+ jQuery.cssHooks[ name ] = {\r
+ get: function( elem, computed, extra ) {\r
+ if ( computed ) {\r
+ if ( elem.offsetWidth !== 0 ) {\r
+ return getWidthOrHeight( elem, name, extra );\r
+ } else {\r
+ return jQuery.swap( elem, cssShow, function() {\r
+ return getWidthOrHeight( elem, name, extra );\r
+ });\r
+ }\r
+ }\r
+ },\r
+\r
+ set: function( elem, value ) {\r
+ return rnum.test( value ) ?\r
+ value + "px" :\r
+ value;\r
+ }\r
+ };\r
+});\r
+\r
+if ( !jQuery.support.opacity ) {\r
+ jQuery.cssHooks.opacity = {\r
+ get: function( elem, computed ) {\r
+ // IE uses filters for opacity\r
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?\r
+ ( parseFloat( RegExp.$1 ) / 100 ) + "" :\r
+ computed ? "1" : "";\r
+ },\r
+\r
+ set: function( elem, value ) {\r
+ var style = elem.style,\r
+ currentStyle = elem.currentStyle,\r
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",\r
+ filter = currentStyle && currentStyle.filter || style.filter || "";\r
+\r
+ // IE has trouble with opacity if it does not have layout\r
+ // Force it by setting the zoom level\r
+ style.zoom = 1;\r
+\r
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652\r
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {\r
+\r
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText\r
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this\r
+ // style.removeAttribute is IE Only, but so apparently is this code path...\r
+ style.removeAttribute( "filter" );\r
+\r
+ // if there there is no filter style applied in a css rule, we are done\r
+ if ( currentStyle && !currentStyle.filter ) {\r
+ return;\r
+ }\r
+ }\r
+\r
+ // otherwise, set new filter values\r
+ style.filter = ralpha.test( filter ) ?\r
+ filter.replace( ralpha, opacity ) :\r
+ filter + " " + opacity;\r
+ }\r
+ };\r
+}\r
+\r
+jQuery(function() {\r
+ // This hook cannot be added until DOM ready because the support test\r
+ // for it is not run until after DOM ready\r
+ if ( !jQuery.support.reliableMarginRight ) {\r
+ jQuery.cssHooks.marginRight = {\r
+ get: function( elem, computed ) {\r
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\r
+ // Work around by temporarily setting element display to inline-block\r
+ return jQuery.swap( elem, { "display": "inline-block" }, function() {\r
+ if ( computed ) {\r
+ return curCSS( elem, "margin-right" );\r
+ } else {\r
+ return elem.style.marginRight;\r
+ }\r
+ });\r
+ }\r
+ };\r
+ }\r
+});\r
+\r
+if ( jQuery.expr && jQuery.expr.filters ) {\r
+ jQuery.expr.filters.hidden = function( elem ) {\r
+ var width = elem.offsetWidth,\r
+ height = elem.offsetHeight;\r
+\r
+ return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");\r
+ };\r
+\r
+ jQuery.expr.filters.visible = function( elem ) {\r
+ return !jQuery.expr.filters.hidden( elem );\r
+ };\r
+}\r
+\r
+// These hooks are used by animate to expand properties\r
+jQuery.each({\r
+ margin: "",\r
+ padding: "",\r
+ border: "Width"\r
+}, function( prefix, suffix ) {\r
+\r
+ jQuery.cssHooks[ prefix + suffix ] = {\r
+ expand: function( value ) {\r
+ var i,\r
+\r
+ // assumes a single number if not a string\r
+ parts = typeof value === "string" ? value.split(" ") : [ value ],\r
+ expanded = {};\r
+\r
+ for ( i = 0; i < 4; i++ ) {\r
+ expanded[ prefix + cssExpand[ i ] + suffix ] =\r
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];\r
+ }\r
+\r
+ return expanded;\r
+ }\r
+ };\r
+});\r
+\r
+\r
+\r
+\r
+var r20 = /%20/g,\r
+ rbracket = /\[\]$/,\r
+ rCRLF = /\r?\n/g,\r
+ rhash = /#.*$/,\r
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL\r
+ rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,\r
+ // #7653, #8125, #8152: local protocol detection\r
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,\r
+ rnoContent = /^(?:GET|HEAD)$/,\r
+ rprotocol = /^\/\//,\r
+ rquery = /\?/,\r
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,\r
+ rselectTextarea = /^(?:select|textarea)/i,\r
+ rspacesAjax = /\s+/,\r
+ rts = /([?&])_=[^&]*/,\r
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,\r
+\r
+ // Keep a copy of the old load method\r
+ _load = jQuery.fn.load,\r
+\r
+ /* Prefilters\r
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\r
+ * 2) These are called:\r
+ * - BEFORE asking for a transport\r
+ * - AFTER param serialization (s.data is a string if s.processData is true)\r
+ * 3) key is the dataType\r
+ * 4) the catchall symbol "*" can be used\r
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed\r
+ */\r
+ prefilters = {},\r
+\r
+ /* Transports bindings\r
+ * 1) key is the dataType\r
+ * 2) the catchall symbol "*" can be used\r
+ * 3) selection will start with transport dataType and THEN go to "*" if needed\r
+ */\r
+ transports = {},\r
+\r
+ // Document location\r
+ ajaxLocation,\r
+\r
+ // Document location segments\r
+ ajaxLocParts,\r
+\r
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\r
+ allTypes = ["*/"] + ["*"];\r
+\r
+// #8138, IE may throw an exception when accessing\r
+// a field from window.location if document.domain has been set\r
+try {\r
+ ajaxLocation = location.href;\r
+} catch( e ) {\r
+ // Use the href attribute of an A element\r
+ // since IE will modify it given document.location\r
+ ajaxLocation = document.createElement( "a" );\r
+ ajaxLocation.href = "";\r
+ ajaxLocation = ajaxLocation.href;\r
+}\r
+\r
+// Segment location into parts\r
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];\r
+\r
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\r
+function addToPrefiltersOrTransports( structure ) {\r
+\r
+ // dataTypeExpression is optional and defaults to "*"\r
+ return function( dataTypeExpression, func ) {\r
+\r
+ if ( typeof dataTypeExpression !== "string" ) {\r
+ func = dataTypeExpression;\r
+ dataTypeExpression = "*";\r
+ }\r
+\r
+ if ( jQuery.isFunction( func ) ) {\r
+ var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),\r
+ i = 0,\r
+ length = dataTypes.length,\r
+ dataType,\r
+ list,\r
+ placeBefore;\r
+\r
+ // For each dataType in the dataTypeExpression\r
+ for ( ; i < length; i++ ) {\r
+ dataType = dataTypes[ i ];\r
+ // We control if we're asked to add before\r
+ // any existing element\r
+ placeBefore = /^\+/.test( dataType );\r
+ if ( placeBefore ) {\r
+ dataType = dataType.substr( 1 ) || "*";\r
+ }\r
+ list = structure[ dataType ] = structure[ dataType ] || [];\r
+ // then we add to the structure accordingly\r
+ list[ placeBefore ? "unshift" : "push" ]( func );\r
+ }\r
+ }\r
+ };\r
+}\r
+\r
+// Base inspection function for prefilters and transports\r
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,\r
+ dataType /* internal */, inspected /* internal */ ) {\r
+\r
+ dataType = dataType || options.dataTypes[ 0 ];\r
+ inspected = inspected || {};\r
+\r
+ inspected[ dataType ] = true;\r
+\r
+ var list = structure[ dataType ],\r
+ i = 0,\r
+ length = list ? list.length : 0,\r
+ executeOnly = ( structure === prefilters ),\r
+ selection;\r
+\r
+ for ( ; i < length && ( executeOnly || !selection ); i++ ) {\r
+ selection = list[ i ]( options, originalOptions, jqXHR );\r
+ // If we got redirected to another dataType\r
+ // we try there if executing only and not done already\r
+ if ( typeof selection === "string" ) {\r
+ if ( !executeOnly || inspected[ selection ] ) {\r
+ selection = undefined;\r
+ } else {\r
+ options.dataTypes.unshift( selection );\r
+ selection = inspectPrefiltersOrTransports(\r
+ structure, options, originalOptions, jqXHR, selection, inspected );\r
+ }\r
+ }\r
+ }\r
+ // If we're only executing or nothing was selected\r
+ // we try the catchall dataType if not done already\r
+ if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {\r
+ selection = inspectPrefiltersOrTransports(\r
+ structure, options, originalOptions, jqXHR, "*", inspected );\r
+ }\r
+ // unnecessary when only executing (prefilters)\r
+ // but it'll be ignored by the caller in that case\r
+ return selection;\r
+}\r
+\r
+// A special extend for ajax options\r
+// that takes "flat" options (not to be deep extended)\r
+// Fixes #9887\r
+function ajaxExtend( target, src ) {\r
+ var key, deep,\r
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};\r
+ for ( key in src ) {\r
+ if ( src[ key ] !== undefined ) {\r
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\r
+ }\r
+ }\r
+ if ( deep ) {\r
+ jQuery.extend( true, target, deep );\r
+ }\r
+}\r
+\r
+jQuery.fn.extend({\r
+ load: function( url, params, callback ) {\r
+ if ( typeof url !== "string" && _load ) {\r
+ return _load.apply( this, arguments );\r
+\r
+ // Don't do a request if no elements are being requested\r
+ } else if ( !this.length ) {\r
+ return this;\r
+ }\r
+\r
+ var off = url.indexOf( " " );\r
+ if ( off >= 0 ) {\r
+ var selector = url.slice( off, url.length );\r
+ url = url.slice( 0, off );\r
+ }\r
+\r
+ // Default to a GET request\r
+ var type = "GET";\r
+\r
+ // If the second parameter was provided\r
+ if ( params ) {\r
+ // If it's a function\r
+ if ( jQuery.isFunction( params ) ) {\r
+ // We assume that it's the callback\r
+ callback = params;\r
+ params = undefined;\r
+\r
+ // Otherwise, build a param string\r
+ } else if ( typeof params === "object" ) {\r
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );\r
+ type = "POST";\r
+ }\r
+ }\r
+\r
+ var self = this;\r
+\r
+ // Request the remote document\r
+ jQuery.ajax({\r
+ url: url,\r
+ type: type,\r
+ dataType: "html",\r
+ data: params,\r
+ // Complete callback (responseText is used internally)\r
+ complete: function( jqXHR, status, responseText ) {\r
+ // Store the response as specified by the jqXHR object\r
+ responseText = jqXHR.responseText;\r
+ // If successful, inject the HTML into all the matched elements\r
+ if ( jqXHR.isResolved() ) {\r
+ // #4825: Get the actual response in case\r
+ // a dataFilter is present in ajaxSettings\r
+ jqXHR.done(function( r ) {\r
+ responseText = r;\r
+ });\r
+ // See if a selector was specified\r
+ self.html( selector ?\r
+ // Create a dummy div to hold the results\r
+ jQuery("<div>")\r
+ // inject the contents of the document in, removing the scripts\r
+ // to avoid any 'Permission Denied' errors in IE\r
+ .append(responseText.replace(rscript, ""))\r
+\r
+ // Locate the specified elements\r
+ .find(selector) :\r
+\r
+ // If not, just inject the full result\r
+ responseText );\r
+ }\r
+\r
+ if ( callback ) {\r
+ self.each( callback, [ responseText, status, jqXHR ] );\r
+ }\r
+ }\r
+ });\r
+\r
+ return this;\r
+ },\r
+\r
+ serialize: function() {\r
+ return jQuery.param( this.serializeArray() );\r
+ },\r
+\r
+ serializeArray: function() {\r
+ return this.map(function(){\r
+ return this.elements ? jQuery.makeArray( this.elements ) : this;\r
+ })\r
+ .filter(function(){\r
+ return this.name && !this.disabled &&\r
+ ( this.checked || rselectTextarea.test( this.nodeName ) ||\r
+ rinput.test( this.type ) );\r
+ })\r
+ .map(function( i, elem ){\r
+ var val = jQuery( this ).val();\r
+\r
+ return val == null ?\r
+ null :\r
+ jQuery.isArray( val ) ?\r
+ jQuery.map( val, function( val, i ){\r
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };\r
+ }) :\r
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };\r
+ }).get();\r
+ }\r
+});\r
+\r
+// Attach a bunch of functions for handling common AJAX events\r
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){\r
+ jQuery.fn[ o ] = function( f ){\r
+ return this.on( o, f );\r
+ };\r
+});\r
+\r
+jQuery.each( [ "get", "post" ], function( i, method ) {\r
+ jQuery[ method ] = function( url, data, callback, type ) {\r
+ // shift arguments if data argument was omitted\r
+ if ( jQuery.isFunction( data ) ) {\r
+ type = type || callback;\r
+ callback = data;\r
+ data = undefined;\r
+ }\r
+\r
+ return jQuery.ajax({\r
+ type: method,\r
+ url: url,\r
+ data: data,\r
+ success: callback,\r
+ dataType: type\r
+ });\r
+ };\r
+});\r
+\r
+jQuery.extend({\r
+\r
+ getScript: function( url, callback ) {\r
+ return jQuery.get( url, undefined, callback, "script" );\r
+ },\r
+\r
+ getJSON: function( url, data, callback ) {\r
+ return jQuery.get( url, data, callback, "json" );\r
+ },\r
+\r
+ // Creates a full fledged settings object into target\r
+ // with both ajaxSettings and settings fields.\r
+ // If target is omitted, writes into ajaxSettings.\r
+ ajaxSetup: function( target, settings ) {\r
+ if ( settings ) {\r
+ // Building a settings object\r
+ ajaxExtend( target, jQuery.ajaxSettings );\r
+ } else {\r
+ // Extending ajaxSettings\r
+ settings = target;\r
+ target = jQuery.ajaxSettings;\r
+ }\r
+ ajaxExtend( target, settings );\r
+ return target;\r
+ },\r
+\r
+ ajaxSettings: {\r
+ url: ajaxLocation,\r
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),\r
+ global: true,\r
+ type: "GET",\r
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",\r
+ processData: true,\r
+ async: true,\r
+ /*\r
+ timeout: 0,\r
+ data: null,\r
+ dataType: null,\r
+ username: null,\r
+ password: null,\r
+ cache: null,\r
+ traditional: false,\r
+ headers: {},\r
+ */\r
+\r
+ accepts: {\r
+ xml: "application/xml, text/xml",\r
+ html: "text/html",\r
+ text: "text/plain",\r
+ json: "application/json, text/javascript",\r
+ "*": allTypes\r
+ },\r
+\r
+ contents: {\r
+ xml: /xml/,\r
+ html: /html/,\r
+ json: /json/\r
+ },\r
+\r
+ responseFields: {\r
+ xml: "responseXML",\r
+ text: "responseText"\r
+ },\r
+\r
+ // List of data converters\r
+ // 1) key format is "source_type destination_type" (a single space in-between)\r
+ // 2) the catchall symbol "*" can be used for source_type\r
+ converters: {\r
+\r
+ // Convert anything to text\r
+ "* text": window.String,\r
+\r
+ // Text to html (true = no transformation)\r
+ "text html": true,\r
+\r
+ // Evaluate text as a json expression\r
+ "text json": jQuery.parseJSON,\r
+\r
+ // Parse text as xml\r
+ "text xml": jQuery.parseXML\r
+ },\r
+\r
+ // For options that shouldn't be deep extended:\r
+ // you can add your own custom options here if\r
+ // and when you create one that shouldn't be\r
+ // deep extended (see ajaxExtend)\r
+ flatOptions: {\r
+ context: true,\r
+ url: true\r
+ }\r
+ },\r
+\r
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\r
+ ajaxTransport: addToPrefiltersOrTransports( transports ),\r
+\r
+ // Main method\r
+ ajax: function( url, options ) {\r
+\r
+ // If url is an object, simulate pre-1.5 signature\r
+ if ( typeof url === "object" ) {\r
+ options = url;\r
+ url = undefined;\r
+ }\r
+\r
+ // Force options to be an object\r
+ options = options || {};\r
+\r
+ var // Create the final options object\r
+ s = jQuery.ajaxSetup( {}, options ),\r
+ // Callbacks context\r
+ callbackContext = s.context || s,\r
+ // Context for global events\r
+ // It's the callbackContext if one was provided in the options\r
+ // and if it's a DOM node or a jQuery collection\r
+ globalEventContext = callbackContext !== s &&\r
+ ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?\r
+ jQuery( callbackContext ) : jQuery.event,\r
+ // Deferreds\r
+ deferred = jQuery.Deferred(),\r
+ completeDeferred = jQuery.Callbacks( "once memory" ),\r
+ // Status-dependent callbacks\r
+ statusCode = s.statusCode || {},\r
+ // ifModified key\r
+ ifModifiedKey,\r
+ // Headers (they are sent all at once)\r
+ requestHeaders = {},\r
+ requestHeadersNames = {},\r
+ // Response headers\r
+ responseHeadersString,\r
+ responseHeaders,\r
+ // transport\r
+ transport,\r
+ // timeout handle\r
+ timeoutTimer,\r
+ // Cross-domain detection vars\r
+ parts,\r
+ // The jqXHR state\r
+ state = 0,\r
+ // To know if global events are to be dispatched\r
+ fireGlobals,\r
+ // Loop variable\r
+ i,\r
+ // Fake xhr\r
+ jqXHR = {\r
+\r
+ readyState: 0,\r
+\r
+ // Caches the header\r
+ setRequestHeader: function( name, value ) {\r
+ if ( !state ) {\r
+ var lname = name.toLowerCase();\r
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;\r
+ requestHeaders[ name ] = value;\r
+ }\r
+ return this;\r
+ },\r
+\r
+ // Raw string\r
+ getAllResponseHeaders: function() {\r
+ return state === 2 ? responseHeadersString : null;\r
+ },\r
+\r
+ // Builds headers hashtable if needed\r
+ getResponseHeader: function( key ) {\r
+ var match;\r
+ if ( state === 2 ) {\r
+ if ( !responseHeaders ) {\r
+ responseHeaders = {};\r
+ while( ( match = rheaders.exec( responseHeadersString ) ) ) {\r
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];\r
+ }\r
+ }\r
+ match = responseHeaders[ key.toLowerCase() ];\r
+ }\r
+ return match === undefined ? null : match;\r
+ },\r
+\r
+ // Overrides response content-type header\r
+ overrideMimeType: function( type ) {\r
+ if ( !state ) {\r
+ s.mimeType = type;\r
+ }\r
+ return this;\r
+ },\r
+\r
+ // Cancel the request\r
+ abort: function( statusText ) {\r
+ statusText = statusText || "abort";\r
+ if ( transport ) {\r
+ transport.abort( statusText );\r
+ }\r
+ done( 0, statusText );\r
+ return this;\r
+ }\r
+ };\r
+\r
+ // Callback for when everything is done\r
+ // It is defined here because jslint complains if it is declared\r
+ // at the end of the function (which would be more logical and readable)\r
+ function done( status, nativeStatusText, responses, headers ) {\r
+\r
+ // Called once\r
+ if ( state === 2 ) {\r
+ return;\r
+ }\r
+\r
+ // State is "done" now\r
+ state = 2;\r
+\r
+ // Clear timeout if it exists\r
+ if ( timeoutTimer ) {\r
+ clearTimeout( timeoutTimer );\r
+ }\r
+\r
+ // Dereference transport for early garbage collection\r
+ // (no matter how long the jqXHR object will be used)\r
+ transport = undefined;\r
+\r
+ // Cache response headers\r
+ responseHeadersString = headers || "";\r
+\r
+ // Set readyState\r
+ jqXHR.readyState = status > 0 ? 4 : 0;\r
+\r
+ var isSuccess,\r
+ success,\r
+ error,\r
+ statusText = nativeStatusText,\r
+ response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,\r
+ lastModified,\r
+ etag;\r
+\r
+ // If successful, handle type chaining\r
+ if ( status >= 200 && status < 300 || status === 304 ) {\r
+\r
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\r
+ if ( s.ifModified ) {\r
+\r
+ if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {\r
+ jQuery.lastModified[ ifModifiedKey ] = lastModified;\r
+ }\r
+ if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {\r
+ jQuery.etag[ ifModifiedKey ] = etag;\r
+ }\r
+ }\r
+\r
+ // If not modified\r
+ if ( status === 304 ) {\r
+\r
+ statusText = "notmodified";\r
+ isSuccess = true;\r
+\r
+ // If we have data\r
+ } else {\r
+\r
+ try {\r
+ success = ajaxConvert( s, response );\r
+ statusText = "success";\r
+ isSuccess = true;\r
+ } catch(e) {\r
+ // We have a parsererror\r
+ statusText = "parsererror";\r
+ error = e;\r
+ }\r
+ }\r
+ } else {\r
+ // We extract error from statusText\r
+ // then normalize statusText and status for non-aborts\r
+ error = statusText;\r
+ if ( !statusText || status ) {\r
+ statusText = "error";\r
+ if ( status < 0 ) {\r
+ status = 0;\r
+ }\r
+ }\r
+ }\r
+\r
+ // Set data for the fake xhr object\r
+ jqXHR.status = status;\r
+ jqXHR.statusText = "" + ( nativeStatusText || statusText );\r
+\r
+ // Success/Error\r
+ if ( isSuccess ) {\r
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\r
+ } else {\r
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\r
+ }\r
+\r
+ // Status-dependent callbacks\r
+ jqXHR.statusCode( statusCode );\r
+ statusCode = undefined;\r
+\r
+ if ( fireGlobals ) {\r
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),\r
+ [ jqXHR, s, isSuccess ? success : error ] );\r
+ }\r
+\r
+ // Complete\r
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\r
+\r
+ if ( fireGlobals ) {\r
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );\r
+ // Handle the global AJAX counter\r
+ if ( !( --jQuery.active ) ) {\r
+ jQuery.event.trigger( "ajaxStop" );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Attach deferreds\r
+ deferred.promise( jqXHR );\r
+ jqXHR.success = jqXHR.done;\r
+ jqXHR.error = jqXHR.fail;\r
+ jqXHR.complete = completeDeferred.add;\r
+\r
+ // Status-dependent callbacks\r
+ jqXHR.statusCode = function( map ) {\r
+ if ( map ) {\r
+ var tmp;\r
+ if ( state < 2 ) {\r
+ for ( tmp in map ) {\r
+ statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];\r
+ }\r
+ } else {\r
+ tmp = map[ jqXHR.status ];\r
+ jqXHR.then( tmp, tmp );\r
+ }\r
+ }\r
+ return this;\r
+ };\r
+\r
+ // Remove hash character (#7531: and string promotion)\r
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)\r
+ // We also use the url parameter if available\r
+ s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );\r
+\r
+ // Extract dataTypes list\r
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );\r
+\r
+ // Determine if a cross-domain request is in order\r
+ if ( s.crossDomain == null ) {\r
+ parts = rurl.exec( s.url.toLowerCase() );\r
+ s.crossDomain = !!( parts &&\r
+ ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||\r
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=\r
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )\r
+ );\r
+ }\r
+\r
+ // Convert data if not already a string\r
+ if ( s.data && s.processData && typeof s.data !== "string" ) {\r
+ s.data = jQuery.param( s.data, s.traditional );\r
+ }\r
+\r
+ // Apply prefilters\r
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\r
+\r
+ // If request was aborted inside a prefilter, stop there\r
+ if ( state === 2 ) {\r
+ return false;\r
+ }\r
+\r
+ // We can fire global events as of now if asked to\r
+ fireGlobals = s.global;\r
+\r
+ // Uppercase the type\r
+ s.type = s.type.toUpperCase();\r
+\r
+ // Determine if request has content\r
+ s.hasContent = !rnoContent.test( s.type );\r
+\r
+ // Watch for a new set of requests\r
+ if ( fireGlobals && jQuery.active++ === 0 ) {\r
+ jQuery.event.trigger( "ajaxStart" );\r
+ }\r
+\r
+ // More options handling for requests with no content\r
+ if ( !s.hasContent ) {\r
+\r
+ // If data is available, append data to url\r
+ if ( s.data ) {\r
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;\r
+ // #9682: remove data so that it's not used in an eventual retry\r
+ delete s.data;\r
+ }\r
+\r
+ // Get ifModifiedKey before adding the anti-cache parameter\r
+ ifModifiedKey = s.url;\r
+\r
+ // Add anti-cache in url if needed\r
+ if ( s.cache === false ) {\r
+\r
+ var ts = jQuery.now(),\r
+ // try replacing _= if it is there\r
+ ret = s.url.replace( rts, "$1_=" + ts );\r
+\r
+ // if nothing was replaced, add timestamp to the end\r
+ s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );\r
+ }\r
+ }\r
+\r
+ // Set the correct header, if data is being sent\r
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\r
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );\r
+ }\r
+\r
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\r
+ if ( s.ifModified ) {\r
+ ifModifiedKey = ifModifiedKey || s.url;\r
+ if ( jQuery.lastModified[ ifModifiedKey ] ) {\r
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );\r
+ }\r
+ if ( jQuery.etag[ ifModifiedKey ] ) {\r
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );\r
+ }\r
+ }\r
+\r
+ // Set the Accepts header for the server, depending on the dataType\r
+ jqXHR.setRequestHeader(\r
+ "Accept",\r
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?\r
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :\r
+ s.accepts[ "*" ]\r
+ );\r
+\r
+ // Check for headers option\r
+ for ( i in s.headers ) {\r
+ jqXHR.setRequestHeader( i, s.headers[ i ] );\r
+ }\r
+\r
+ // Allow custom headers/mimetypes and early abort\r
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {\r
+ // Abort if not done already\r
+ jqXHR.abort();\r
+ return false;\r
+\r
+ }\r
+\r
+ // Install callbacks on deferreds\r
+ for ( i in { success: 1, error: 1, complete: 1 } ) {\r
+ jqXHR[ i ]( s[ i ] );\r
+ }\r
+\r
+ // Get transport\r
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\r
+\r
+ // If no transport, we auto-abort\r
+ if ( !transport ) {\r
+ done( -1, "No Transport" );\r
+ } else {\r
+ jqXHR.readyState = 1;\r
+ // Send global event\r
+ if ( fireGlobals ) {\r
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );\r
+ }\r
+ // Timeout\r
+ if ( s.async && s.timeout > 0 ) {\r
+ timeoutTimer = setTimeout( function(){\r
+ jqXHR.abort( "timeout" );\r
+ }, s.timeout );\r
+ }\r
+\r
+ try {\r
+ state = 1;\r
+ transport.send( requestHeaders, done );\r
+ } catch (e) {\r
+ // Propagate exception as error if not done\r
+ if ( state < 2 ) {\r
+ done( -1, e );\r
+ // Simply rethrow otherwise\r
+ } else {\r
+ throw e;\r
+ }\r
+ }\r
+ }\r
+\r
+ return jqXHR;\r
+ },\r
+\r
+ // Serialize an array of form elements or a set of\r
+ // key/values into a query string\r
+ param: function( a, traditional ) {\r
+ var s = [],\r
+ add = function( key, value ) {\r
+ // If value is a function, invoke it and return its value\r
+ value = jQuery.isFunction( value ) ? value() : value;\r
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );\r
+ };\r
+\r
+ // Set traditional to true for jQuery <= 1.3.2 behavior.\r
+ if ( traditional === undefined ) {\r
+ traditional = jQuery.ajaxSettings.traditional;\r
+ }\r
+\r
+ // If an array was passed in, assume that it is an array of form elements.\r
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\r
+ // Serialize the form elements\r
+ jQuery.each( a, function() {\r
+ add( this.name, this.value );\r
+ });\r
+\r
+ } else {\r
+ // If traditional, encode the "old" way (the way 1.3.2 or older\r
+ // did it), otherwise encode params recursively.\r
+ for ( var prefix in a ) {\r
+ buildParams( prefix, a[ prefix ], traditional, add );\r
+ }\r
+ }\r
+\r
+ // Return the resulting serialization\r
+ return s.join( "&" ).replace( r20, "+" );\r
+ }\r
+});\r
+\r
+function buildParams( prefix, obj, traditional, add ) {\r
+ if ( jQuery.isArray( obj ) ) {\r
+ // Serialize array item.\r
+ jQuery.each( obj, function( i, v ) {\r
+ if ( traditional || rbracket.test( prefix ) ) {\r
+ // Treat each array item as a scalar.\r
+ add( prefix, v );\r
+\r
+ } else {\r
+ // If array item is non-scalar (array or object), encode its\r
+ // numeric index to resolve deserialization ambiguity issues.\r
+ // Note that rack (as of 1.0.0) can't currently deserialize\r
+ // nested arrays properly, and attempting to do so may cause\r
+ // a server error. Possible fixes are to modify rack's\r
+ // deserialization algorithm or to provide an option or flag\r
+ // to force array serialization to be shallow.\r
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );\r
+ }\r
+ });\r
+\r
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {\r
+ // Serialize object item.\r
+ for ( var name in obj ) {\r
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );\r
+ }\r
+\r
+ } else {\r
+ // Serialize scalar item.\r
+ add( prefix, obj );\r
+ }\r
+}\r
+\r
+// This is still on the jQuery object... for now\r
+// Want to move this to jQuery.ajax some day\r
+jQuery.extend({\r
+\r
+ // Counter for holding the number of active queries\r
+ active: 0,\r
+\r
+ // Last-Modified header cache for next request\r
+ lastModified: {},\r
+ etag: {}\r
+\r
+});\r
+\r
+/* Handles responses to an ajax request:\r
+ * - sets all responseXXX fields accordingly\r
+ * - finds the right dataType (mediates between content-type and expected dataType)\r
+ * - returns the corresponding response\r
+ */\r
+function ajaxHandleResponses( s, jqXHR, responses ) {\r
+\r
+ var contents = s.contents,\r
+ dataTypes = s.dataTypes,\r
+ responseFields = s.responseFields,\r
+ ct,\r
+ type,\r
+ finalDataType,\r
+ firstDataType;\r
+\r
+ // Fill responseXXX fields\r
+ for ( type in responseFields ) {\r
+ if ( type in responses ) {\r
+ jqXHR[ responseFields[type] ] = responses[ type ];\r
+ }\r
+ }\r
+\r
+ // Remove auto dataType and get content-type in the process\r
+ while( dataTypes[ 0 ] === "*" ) {\r
+ dataTypes.shift();\r
+ if ( ct === undefined ) {\r
+ ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );\r
+ }\r
+ }\r
+\r
+ // Check if we're dealing with a known content-type\r
+ if ( ct ) {\r
+ for ( type in contents ) {\r
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {\r
+ dataTypes.unshift( type );\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ // Check to see if we have a response for the expected dataType\r
+ if ( dataTypes[ 0 ] in responses ) {\r
+ finalDataType = dataTypes[ 0 ];\r
+ } else {\r
+ // Try convertible dataTypes\r
+ for ( type in responses ) {\r
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {\r
+ finalDataType = type;\r
+ break;\r
+ }\r
+ if ( !firstDataType ) {\r
+ firstDataType = type;\r
+ }\r
+ }\r
+ // Or just use first one\r
+ finalDataType = finalDataType || firstDataType;\r
+ }\r
+\r
+ // If we found a dataType\r
+ // We add the dataType to the list if needed\r
+ // and return the corresponding response\r
+ if ( finalDataType ) {\r
+ if ( finalDataType !== dataTypes[ 0 ] ) {\r
+ dataTypes.unshift( finalDataType );\r
+ }\r
+ return responses[ finalDataType ];\r
+ }\r
+}\r
+\r
+// Chain conversions given the request and the original response\r
+function ajaxConvert( s, response ) {\r
+\r
+ // Apply the dataFilter if provided\r
+ if ( s.dataFilter ) {\r
+ response = s.dataFilter( response, s.dataType );\r
+ }\r
+\r
+ var dataTypes = s.dataTypes,\r
+ converters = {},\r
+ i,\r
+ key,\r
+ length = dataTypes.length,\r
+ tmp,\r
+ // Current and previous dataTypes\r
+ current = dataTypes[ 0 ],\r
+ prev,\r
+ // Conversion expression\r
+ conversion,\r
+ // Conversion function\r
+ conv,\r
+ // Conversion functions (transitive conversion)\r
+ conv1,\r
+ conv2;\r
+\r
+ // For each dataType in the chain\r
+ for ( i = 1; i < length; i++ ) {\r
+\r
+ // Create converters map\r
+ // with lowercased keys\r
+ if ( i === 1 ) {\r
+ for ( key in s.converters ) {\r
+ if ( typeof key === "string" ) {\r
+ converters[ key.toLowerCase() ] = s.converters[ key ];\r
+ }\r
+ }\r
+ }\r
+\r
+ // Get the dataTypes\r
+ prev = current;\r
+ current = dataTypes[ i ];\r
+\r
+ // If current is auto dataType, update it to prev\r
+ if ( current === "*" ) {\r
+ current = prev;\r
+ // If no auto and dataTypes are actually different\r
+ } else if ( prev !== "*" && prev !== current ) {\r
+\r
+ // Get the converter\r
+ conversion = prev + " " + current;\r
+ conv = converters[ conversion ] || converters[ "* " + current ];\r
+\r
+ // If there is no direct converter, search transitively\r
+ if ( !conv ) {\r
+ conv2 = undefined;\r
+ for ( conv1 in converters ) {\r
+ tmp = conv1.split( " " );\r
+ if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {\r
+ conv2 = converters[ tmp[1] + " " + current ];\r
+ if ( conv2 ) {\r
+ conv1 = converters[ conv1 ];\r
+ if ( conv1 === true ) {\r
+ conv = conv2;\r
+ } else if ( conv2 === true ) {\r
+ conv = conv1;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ // If we found no converter, dispatch an error\r
+ if ( !( conv || conv2 ) ) {\r
+ jQuery.error( "No conversion from " + conversion.replace(" "," to ") );\r
+ }\r
+ // If found converter is not an equivalence\r
+ if ( conv !== true ) {\r
+ // Convert with 1 or 2 converters accordingly\r
+ response = conv ? conv( response ) : conv2( conv1(response) );\r
+ }\r
+ }\r
+ }\r
+ return response;\r
+}\r
+\r
+\r
+\r
+\r
+var jsc = jQuery.now(),\r
+ jsre = /(\=)\?(&|$)|\?\?/i;\r
+\r
+// Default jsonp settings\r
+jQuery.ajaxSetup({\r
+ jsonp: "callback",\r
+ jsonpCallback: function() {\r
+ return jQuery.expando + "_" + ( jsc++ );\r
+ }\r
+});\r
+\r
+// Detect, normalize options and install callbacks for jsonp requests\r
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {\r
+\r
+ var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );\r
+\r
+ if ( s.dataTypes[ 0 ] === "jsonp" ||\r
+ s.jsonp !== false && ( jsre.test( s.url ) ||\r
+ inspectData && jsre.test( s.data ) ) ) {\r
+\r
+ var responseContainer,\r
+ jsonpCallback = s.jsonpCallback =\r
+ jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,\r
+ previous = window[ jsonpCallback ],\r
+ url = s.url,\r
+ data = s.data,\r
+ replace = "$1" + jsonpCallback + "$2";\r
+\r
+ if ( s.jsonp !== false ) {\r
+ url = url.replace( jsre, replace );\r
+ if ( s.url === url ) {\r
+ if ( inspectData ) {\r
+ data = data.replace( jsre, replace );\r
+ }\r
+ if ( s.data === data ) {\r
+ // Add callback manually\r
+ url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;\r
+ }\r
+ }\r
+ }\r
+\r
+ s.url = url;\r
+ s.data = data;\r
+\r
+ // Install callback\r
+ window[ jsonpCallback ] = function( response ) {\r
+ responseContainer = [ response ];\r
+ };\r
+\r
+ // Clean-up function\r
+ jqXHR.always(function() {\r
+ // Set callback back to previous value\r
+ window[ jsonpCallback ] = previous;\r
+ // Call if it was a function and we have a response\r
+ if ( responseContainer && jQuery.isFunction( previous ) ) {\r
+ window[ jsonpCallback ]( responseContainer[ 0 ] );\r
+ }\r
+ });\r
+\r
+ // Use data converter to retrieve json after script execution\r
+ s.converters["script json"] = function() {\r
+ if ( !responseContainer ) {\r
+ jQuery.error( jsonpCallback + " was not called" );\r
+ }\r
+ return responseContainer[ 0 ];\r
+ };\r
+\r
+ // force json dataType\r
+ s.dataTypes[ 0 ] = "json";\r
+\r
+ // Delegate to script\r
+ return "script";\r
+ }\r
+});\r
+\r
+\r
+\r
+\r
+// Install script dataType\r
+jQuery.ajaxSetup({\r
+ accepts: {\r
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"\r
+ },\r
+ contents: {\r
+ script: /javascript|ecmascript/\r
+ },\r
+ converters: {\r
+ "text script": function( text ) {\r
+ jQuery.globalEval( text );\r
+ return text;\r
+ }\r
+ }\r
+});\r
+\r
+// Handle cache's special case and global\r
+jQuery.ajaxPrefilter( "script", function( s ) {\r
+ if ( s.cache === undefined ) {\r
+ s.cache = false;\r
+ }\r
+ if ( s.crossDomain ) {\r
+ s.type = "GET";\r
+ s.global = false;\r
+ }\r
+});\r
+\r
+// Bind script tag hack transport\r
+jQuery.ajaxTransport( "script", function(s) {\r
+\r
+ // This transport only deals with cross domain requests\r
+ if ( s.crossDomain ) {\r
+\r
+ var script,\r
+ head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;\r
+\r
+ return {\r
+\r
+ send: function( _, callback ) {\r
+\r
+ script = document.createElement( "script" );\r
+\r
+ script.async = "async";\r
+\r
+ if ( s.scriptCharset ) {\r
+ script.charset = s.scriptCharset;\r
+ }\r
+\r
+ script.src = s.url;\r
+\r
+ // Attach handlers for all browsers\r
+ script.onload = script.onreadystatechange = function( _, isAbort ) {\r
+\r
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {\r
+\r
+ // Handle memory leak in IE\r
+ script.onload = script.onreadystatechange = null;\r
+\r
+ // Remove the script\r
+ if ( head && script.parentNode ) {\r
+ head.removeChild( script );\r
+ }\r
+\r
+ // Dereference the script\r
+ script = undefined;\r
+\r
+ // Callback if not abort\r
+ if ( !isAbort ) {\r
+ callback( 200, "success" );\r
+ }\r
+ }\r
+ };\r
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.\r
+ // This arises when a base node is used (#2709 and #4378).\r
+ head.insertBefore( script, head.firstChild );\r
+ },\r
+\r
+ abort: function() {\r
+ if ( script ) {\r
+ script.onload( 0, 1 );\r
+ }\r
+ }\r
+ };\r
+ }\r
+});\r
+\r
+\r
+\r
+\r
+var // #5280: Internet Explorer will keep connections alive if we don't abort on unload\r
+ xhrOnUnloadAbort = window.ActiveXObject ? function() {\r
+ // Abort all pending requests\r
+ for ( var key in xhrCallbacks ) {\r
+ xhrCallbacks[ key ]( 0, 1 );\r
+ }\r
+ } : false,\r
+ xhrId = 0,\r
+ xhrCallbacks;\r
+\r
+// Functions to create xhrs\r
+function createStandardXHR() {\r
+ try {\r
+ return new window.XMLHttpRequest();\r
+ } catch( e ) {}\r
+}\r
+\r
+function createActiveXHR() {\r
+ try {\r
+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );\r
+ } catch( e ) {}\r
+}\r
+\r
+// Create the request object\r
+// (This is still attached to ajaxSettings for backward compatibility)\r
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?\r
+ /* Microsoft failed to properly\r
+ * implement the XMLHttpRequest in IE7 (can't request local files),\r
+ * so we use the ActiveXObject when it is available\r
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\r
+ * we need a fallback.\r
+ */\r
+ function() {\r
+ return !this.isLocal && createStandardXHR() || createActiveXHR();\r
+ } :\r
+ // For all other browsers, use the standard XMLHttpRequest object\r
+ createStandardXHR;\r
+\r
+// Determine support properties\r
+(function( xhr ) {\r
+ jQuery.extend( jQuery.support, {\r
+ ajax: !!xhr,\r
+ cors: !!xhr && ( "withCredentials" in xhr )\r
+ });\r
+})( jQuery.ajaxSettings.xhr() );\r
+\r
+// Create transport if the browser can provide an xhr\r
+if ( jQuery.support.ajax ) {\r
+\r
+ jQuery.ajaxTransport(function( s ) {\r
+ // Cross domain only allowed if supported through XMLHttpRequest\r
+ if ( !s.crossDomain || jQuery.support.cors ) {\r
+\r
+ var callback;\r
+\r
+ return {\r
+ send: function( headers, complete ) {\r
+\r
+ // Get a new xhr\r
+ var xhr = s.xhr(),\r
+ handle,\r
+ i;\r
+\r
+ // Open the socket\r
+ // Passing null username, generates a login popup on Opera (#2865)\r
+ if ( s.username ) {\r
+ xhr.open( s.type, s.url, s.async, s.username, s.password );\r
+ } else {\r
+ xhr.open( s.type, s.url, s.async );\r
+ }\r
+\r
+ // Apply custom fields if provided\r
+ if ( s.xhrFields ) {\r
+ for ( i in s.xhrFields ) {\r
+ xhr[ i ] = s.xhrFields[ i ];\r
+ }\r
+ }\r
+\r
+ // Override mime type if needed\r
+ if ( s.mimeType && xhr.overrideMimeType ) {\r
+ xhr.overrideMimeType( s.mimeType );\r
+ }\r
+\r
+ // X-Requested-With header\r
+ // For cross-domain requests, seeing as conditions for a preflight are\r
+ // akin to a jigsaw puzzle, we simply never set it to be sure.\r
+ // (it can always be set on a per-request basis or even using ajaxSetup)\r
+ // For same-domain requests, won't change header if already provided.\r
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {\r
+ headers[ "X-Requested-With" ] = "XMLHttpRequest";\r
+ }\r
+\r
+ // Need an extra try/catch for cross domain requests in Firefox 3\r
+ try {\r
+ for ( i in headers ) {\r
+ xhr.setRequestHeader( i, headers[ i ] );\r
+ }\r
+ } catch( _ ) {}\r
+\r
+ // Do send the request\r
+ // This may raise an exception which is actually\r
+ // handled in jQuery.ajax (so no try/catch here)\r
+ xhr.send( ( s.hasContent && s.data ) || null );\r
+\r
+ // Listener\r
+ callback = function( _, isAbort ) {\r
+\r
+ var status,\r
+ statusText,\r
+ responseHeaders,\r
+ responses,\r
+ xml;\r
+\r
+ // Firefox throws exceptions when accessing properties\r
+ // of an xhr when a network error occured\r
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)\r
+ try {\r
+\r
+ // Was never called and is aborted or complete\r
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {\r
+\r
+ // Only called once\r
+ callback = undefined;\r
+\r
+ // Do not keep as active anymore\r
+ if ( handle ) {\r
+ xhr.onreadystatechange = jQuery.noop;\r
+ if ( xhrOnUnloadAbort ) {\r
+ delete xhrCallbacks[ handle ];\r
+ }\r
+ }\r
+\r
+ // If it's an abort\r
+ if ( isAbort ) {\r
+ // Abort it manually if needed\r
+ if ( xhr.readyState !== 4 ) {\r
+ xhr.abort();\r
+ }\r
+ } else {\r
+ status = xhr.status;\r
+ responseHeaders = xhr.getAllResponseHeaders();\r
+ responses = {};\r
+ xml = xhr.responseXML;\r
+\r
+ // Construct response list\r
+ if ( xml && xml.documentElement /* #4958 */ ) {\r
+ responses.xml = xml;\r
+ }\r
+\r
+ // When requesting binary data, IE6-9 will throw an exception\r
+ // on any attempt to access responseText (#11426)\r
+ try {\r
+ responses.text = xhr.responseText;\r
+ } catch( _ ) {\r
+ }\r
+\r
+ // Firefox throws an exception when accessing\r
+ // statusText for faulty cross-domain requests\r
+ try {\r
+ statusText = xhr.statusText;\r
+ } catch( e ) {\r
+ // We normalize with Webkit giving an empty statusText\r
+ statusText = "";\r
+ }\r
+\r
+ // Filter status for non standard behaviors\r
+\r
+ // If the request is local and we have data: assume a success\r
+ // (success with no data won't get notified, that's the best we\r
+ // can do given current implementations)\r
+ if ( !status && s.isLocal && !s.crossDomain ) {\r
+ status = responses.text ? 200 : 404;\r
+ // IE - #1450: sometimes returns 1223 when it should be 204\r
+ } else if ( status === 1223 ) {\r
+ status = 204;\r
+ }\r
+ }\r
+ }\r
+ } catch( firefoxAccessException ) {\r
+ if ( !isAbort ) {\r
+ complete( -1, firefoxAccessException );\r
+ }\r
+ }\r
+\r
+ // Call complete if needed\r
+ if ( responses ) {\r
+ complete( status, statusText, responses, responseHeaders );\r
+ }\r
+ };\r
+\r
+ // if we're in sync mode or it's in cache\r
+ // and has been retrieved directly (IE6 & IE7)\r
+ // we need to manually fire the callback\r
+ if ( !s.async || xhr.readyState === 4 ) {\r
+ callback();\r
+ } else {\r
+ handle = ++xhrId;\r
+ if ( xhrOnUnloadAbort ) {\r
+ // Create the active xhrs callbacks list if needed\r
+ // and attach the unload handler\r
+ if ( !xhrCallbacks ) {\r
+ xhrCallbacks = {};\r
+ jQuery( window ).unload( xhrOnUnloadAbort );\r
+ }\r
+ // Add to list of active xhrs callbacks\r
+ xhrCallbacks[ handle ] = callback;\r
+ }\r
+ xhr.onreadystatechange = callback;\r
+ }\r
+ },\r
+\r
+ abort: function() {\r
+ if ( callback ) {\r
+ callback(0,1);\r
+ }\r
+ }\r
+ };\r
+ }\r
+ });\r
+}\r
+\r
+\r
+\r
+\r
+var elemdisplay = {},\r
+ iframe, iframeDoc,\r
+ rfxtypes = /^(?:toggle|show|hide)$/,\r
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,\r
+ timerId,\r
+ fxAttrs = [\r
+ // height animations\r
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],\r
+ // width animations\r
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],\r
+ // opacity animations\r
+ [ "opacity" ]\r
+ ],\r
+ fxNow;\r
+\r
+jQuery.fn.extend({\r
+ show: function( speed, easing, callback ) {\r
+ var elem, display;\r
+\r
+ if ( speed || speed === 0 ) {\r
+ return this.animate( genFx("show", 3), speed, easing, callback );\r
+\r
+ } else {\r
+ for ( var i = 0, j = this.length; i < j; i++ ) {\r
+ elem = this[ i ];\r
+\r
+ if ( elem.style ) {\r
+ display = elem.style.display;\r
+\r
+ // Reset the inline display of this element to learn if it is\r
+ // being hidden by cascaded rules or not\r
+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {\r
+ display = elem.style.display = "";\r
+ }\r
+\r
+ // Set elements which have been overridden with display: none\r
+ // in a stylesheet to whatever the default browser style is\r
+ // for such an element\r
+ if ( (display === "" && jQuery.css(elem, "display") === "none") ||\r
+ !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {\r
+ jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Set the display of most of the elements in a second loop\r
+ // to avoid the constant reflow\r
+ for ( i = 0; i < j; i++ ) {\r
+ elem = this[ i ];\r
+\r
+ if ( elem.style ) {\r
+ display = elem.style.display;\r
+\r
+ if ( display === "" || display === "none" ) {\r
+ elem.style.display = jQuery._data( elem, "olddisplay" ) || "";\r
+ }\r
+ }\r
+ }\r
+\r
+ return this;\r
+ }\r
+ },\r
+\r
+ hide: function( speed, easing, callback ) {\r
+ if ( speed || speed === 0 ) {\r
+ return this.animate( genFx("hide", 3), speed, easing, callback);\r
+\r
+ } else {\r
+ var elem, display,\r
+ i = 0,\r
+ j = this.length;\r
+\r
+ for ( ; i < j; i++ ) {\r
+ elem = this[i];\r
+ if ( elem.style ) {\r
+ display = jQuery.css( elem, "display" );\r
+\r
+ if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {\r
+ jQuery._data( elem, "olddisplay", display );\r
+ }\r
+ }\r
+ }\r
+\r
+ // Set the display of the elements in a second loop\r
+ // to avoid the constant reflow\r
+ for ( i = 0; i < j; i++ ) {\r
+ if ( this[i].style ) {\r
+ this[i].style.display = "none";\r
+ }\r
+ }\r
+\r
+ return this;\r
+ }\r
+ },\r
+\r
+ // Save the old toggle function\r
+ _toggle: jQuery.fn.toggle,\r
+\r
+ toggle: function( fn, fn2, callback ) {\r
+ var bool = typeof fn === "boolean";\r
+\r
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {\r
+ this._toggle.apply( this, arguments );\r
+\r
+ } else if ( fn == null || bool ) {\r
+ this.each(function() {\r
+ var state = bool ? fn : jQuery(this).is(":hidden");\r
+ jQuery(this)[ state ? "show" : "hide" ]();\r
+ });\r
+\r
+ } else {\r
+ this.animate(genFx("toggle", 3), fn, fn2, callback);\r
+ }\r
+\r
+ return this;\r
+ },\r
+\r
+ fadeTo: function( speed, to, easing, callback ) {\r
+ return this.filter(":hidden").css("opacity", 0).show().end()\r
+ .animate({opacity: to}, speed, easing, callback);\r
+ },\r
+\r
+ animate: function( prop, speed, easing, callback ) {\r
+ var optall = jQuery.speed( speed, easing, callback );\r
+\r
+ if ( jQuery.isEmptyObject( prop ) ) {\r
+ return this.each( optall.complete, [ false ] );\r
+ }\r
+\r
+ // Do not change referenced properties as per-property easing will be lost\r
+ prop = jQuery.extend( {}, prop );\r
+\r
+ function doAnimation() {\r
+ // XXX 'this' does not always have a nodeName when running the\r
+ // test suite\r
+\r
+ if ( optall.queue === false ) {\r
+ jQuery._mark( this );\r
+ }\r
+\r
+ var opt = jQuery.extend( {}, optall ),\r
+ isElement = this.nodeType === 1,\r
+ hidden = isElement && jQuery(this).is(":hidden"),\r
+ name, val, p, e, hooks, replace,\r
+ parts, start, end, unit,\r
+ method;\r
+\r
+ // will store per property easing and be used to determine when an animation is complete\r
+ opt.animatedProperties = {};\r
+\r
+ // first pass over propertys to expand / normalize\r
+ for ( p in prop ) {\r
+ name = jQuery.camelCase( p );\r
+ if ( p !== name ) {\r
+ prop[ name ] = prop[ p ];\r
+ delete prop[ p ];\r
+ }\r
+\r
+ if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {\r
+ replace = hooks.expand( prop[ name ] );\r
+ delete prop[ name ];\r
+\r
+ // not quite $.extend, this wont overwrite keys already present.\r
+ // also - reusing 'p' from above because we have the correct "name"\r
+ for ( p in replace ) {\r
+ if ( ! ( p in prop ) ) {\r
+ prop[ p ] = replace[ p ];\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ for ( name in prop ) {\r
+ val = prop[ name ];\r
+ // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)\r
+ if ( jQuery.isArray( val ) ) {\r
+ opt.animatedProperties[ name ] = val[ 1 ];\r
+ val = prop[ name ] = val[ 0 ];\r
+ } else {\r
+ opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';\r
+ }\r
+\r
+ if ( val === "hide" && hidden || val === "show" && !hidden ) {\r
+ return opt.complete.call( this );\r
+ }\r
+\r
+ if ( isElement && ( name === "height" || name === "width" ) ) {\r
+ // Make sure that nothing sneaks out\r
+ // Record all 3 overflow attributes because IE does not\r
+ // change the overflow attribute when overflowX and\r
+ // overflowY are set to the same value\r
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];\r
+\r
+ // Set display property to inline-block for height/width\r
+ // animations on inline elements that are having width/height animated\r
+ if ( jQuery.css( this, "display" ) === "inline" &&\r
+ jQuery.css( this, "float" ) === "none" ) {\r
+\r
+ // inline-level elements accept inline-block;\r
+ // block-level elements need to be inline with layout\r
+ if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {\r
+ this.style.display = "inline-block";\r
+\r
+ } else {\r
+ this.style.zoom = 1;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( opt.overflow != null ) {\r
+ this.style.overflow = "hidden";\r
+ }\r
+\r
+ for ( p in prop ) {\r
+ e = new jQuery.fx( this, opt, p );\r
+ val = prop[ p ];\r
+\r
+ if ( rfxtypes.test( val ) ) {\r
+\r
+ // Tracks whether to show or hide based on private\r
+ // data attached to the element\r
+ method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );\r
+ if ( method ) {\r
+ jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );\r
+ e[ method ]();\r
+ } else {\r
+ e[ val ]();\r
+ }\r
+\r
+ } else {\r
+ parts = rfxnum.exec( val );\r
+ start = e.cur();\r
+\r
+ if ( parts ) {\r
+ end = parseFloat( parts[2] );\r
+ unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );\r
+\r
+ // We need to compute starting value\r
+ if ( unit !== "px" ) {\r
+ jQuery.style( this, p, (end || 1) + unit);\r
+ start = ( (end || 1) / e.cur() ) * start;\r
+ jQuery.style( this, p, start + unit);\r
+ }\r
+\r
+ // If a +=/-= token was provided, we're doing a relative animation\r
+ if ( parts[1] ) {\r
+ end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;\r
+ }\r
+\r
+ e.custom( start, end, unit );\r
+\r
+ } else {\r
+ e.custom( start, val, "" );\r
+ }\r
+ }\r
+ }\r
+\r
+ // For JS strict compliance\r
+ return true;\r
+ }\r
+\r
+ return optall.queue === false ?\r
+ this.each( doAnimation ) :\r
+ this.queue( optall.queue, doAnimation );\r
+ },\r
+\r
+ stop: function( type, clearQueue, gotoEnd ) {\r
+ if ( typeof type !== "string" ) {\r
+ gotoEnd = clearQueue;\r
+ clearQueue = type;\r
+ type = undefined;\r
+ }\r
+ if ( clearQueue && type !== false ) {\r
+ this.queue( type || "fx", [] );\r
+ }\r
+\r
+ return this.each(function() {\r
+ var index,\r
+ hadTimers = false,\r
+ timers = jQuery.timers,\r
+ data = jQuery._data( this );\r
+\r
+ // clear marker counters if we know they won't be\r
+ if ( !gotoEnd ) {\r
+ jQuery._unmark( true, this );\r
+ }\r
+\r
+ function stopQueue( elem, data, index ) {\r
+ var hooks = data[ index ];\r
+ jQuery.removeData( elem, index, true );\r
+ hooks.stop( gotoEnd );\r
+ }\r
+\r
+ if ( type == null ) {\r
+ for ( index in data ) {\r
+ if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {\r
+ stopQueue( this, data, index );\r
+ }\r
+ }\r
+ } else if ( data[ index = type + ".run" ] && data[ index ].stop ){\r
+ stopQueue( this, data, index );\r
+ }\r
+\r
+ for ( index = timers.length; index--; ) {\r
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {\r
+ if ( gotoEnd ) {\r
+\r
+ // force the next step to be the last\r
+ timers[ index ]( true );\r
+ } else {\r
+ timers[ index ].saveState();\r
+ }\r
+ hadTimers = true;\r
+ timers.splice( index, 1 );\r
+ }\r
+ }\r
+\r
+ // start the next in the queue if the last step wasn't forced\r
+ // timers currently will call their complete callbacks, which will dequeue\r
+ // but only if they were gotoEnd\r
+ if ( !( gotoEnd && hadTimers ) ) {\r
+ jQuery.dequeue( this, type );\r
+ }\r
+ });\r
+ }\r
+\r
+});\r
+\r
+// Animations created synchronously will run synchronously\r
+function createFxNow() {\r
+ setTimeout( clearFxNow, 0 );\r
+ return ( fxNow = jQuery.now() );\r
+}\r
+\r
+function clearFxNow() {\r
+ fxNow = undefined;\r
+}\r
+\r
+// Generate parameters to create a standard animation\r
+function genFx( type, num ) {\r
+ var obj = {};\r
+\r
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {\r
+ obj[ this ] = type;\r
+ });\r
+\r
+ return obj;\r
+}\r
+\r
+// Generate shortcuts for custom animations\r
+jQuery.each({\r
+ slideDown: genFx( "show", 1 ),\r
+ slideUp: genFx( "hide", 1 ),\r
+ slideToggle: genFx( "toggle", 1 ),\r
+ fadeIn: { opacity: "show" },\r
+ fadeOut: { opacity: "hide" },\r
+ fadeToggle: { opacity: "toggle" }\r
+}, function( name, props ) {\r
+ jQuery.fn[ name ] = function( speed, easing, callback ) {\r
+ return this.animate( props, speed, easing, callback );\r
+ };\r
+});\r
+\r
+jQuery.extend({\r
+ speed: function( speed, easing, fn ) {\r
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {\r
+ complete: fn || !fn && easing ||\r
+ jQuery.isFunction( speed ) && speed,\r
+ duration: speed,\r
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\r
+ };\r
+\r
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :\r
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;\r
+\r
+ // normalize opt.queue - true/undefined/null -> "fx"\r
+ if ( opt.queue == null || opt.queue === true ) {\r
+ opt.queue = "fx";\r
+ }\r
+\r
+ // Queueing\r
+ opt.old = opt.complete;\r
+\r
+ opt.complete = function( noUnmark ) {\r
+ if ( jQuery.isFunction( opt.old ) ) {\r
+ opt.old.call( this );\r
+ }\r
+\r
+ if ( opt.queue ) {\r
+ jQuery.dequeue( this, opt.queue );\r
+ } else if ( noUnmark !== false ) {\r
+ jQuery._unmark( this );\r
+ }\r
+ };\r
+\r
+ return opt;\r
+ },\r
+\r
+ easing: {\r
+ linear: function( p ) {\r
+ return p;\r
+ },\r
+ swing: function( p ) {\r
+ return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;\r
+ }\r
+ },\r
+\r
+ timers: [],\r
+\r
+ fx: function( elem, options, prop ) {\r
+ this.options = options;\r
+ this.elem = elem;\r
+ this.prop = prop;\r
+\r
+ options.orig = options.orig || {};\r
+ }\r
+\r
+});\r
+\r
+jQuery.fx.prototype = {\r
+ // Simple function for setting a style value\r
+ update: function() {\r
+ if ( this.options.step ) {\r
+ this.options.step.call( this.elem, this.now, this );\r
+ }\r
+\r
+ ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );\r
+ },\r
+\r
+ // Get the current size\r
+ cur: function() {\r
+ if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {\r
+ return this.elem[ this.prop ];\r
+ }\r
+\r
+ var parsed,\r
+ r = jQuery.css( this.elem, this.prop );\r
+ // Empty strings, null, undefined and "auto" are converted to 0,\r
+ // complex values such as "rotate(1rad)" are returned as is,\r
+ // simple values such as "10px" are parsed to Float.\r
+ return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;\r
+ },\r
+\r
+ // Start an animation from one number to another\r
+ custom: function( from, to, unit ) {\r
+ var self = this,\r
+ fx = jQuery.fx;\r
+\r
+ this.startTime = fxNow || createFxNow();\r
+ this.end = to;\r
+ this.now = this.start = from;\r
+ this.pos = this.state = 0;\r
+ this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );\r
+\r
+ function t( gotoEnd ) {\r
+ return self.step( gotoEnd );\r
+ }\r
+\r
+ t.queue = this.options.queue;\r
+ t.elem = this.elem;\r
+ t.saveState = function() {\r
+ if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {\r
+ if ( self.options.hide ) {\r
+ jQuery._data( self.elem, "fxshow" + self.prop, self.start );\r
+ } else if ( self.options.show ) {\r
+ jQuery._data( self.elem, "fxshow" + self.prop, self.end );\r
+ }\r
+ }\r
+ };\r
+\r
+ if ( t() && jQuery.timers.push(t) && !timerId ) {\r
+ timerId = setInterval( fx.tick, fx.interval );\r
+ }\r
+ },\r
+\r
+ // Simple 'show' function\r
+ show: function() {\r
+ var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );\r
+\r
+ // Remember where we started, so that we can go back to it later\r
+ this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );\r
+ this.options.show = true;\r
+\r
+ // Begin the animation\r
+ // Make sure that we start at a small width/height to avoid any flash of content\r
+ if ( dataShow !== undefined ) {\r
+ // This show is picking up where a previous hide or show left off\r
+ this.custom( this.cur(), dataShow );\r
+ } else {\r
+ this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );\r
+ }\r
+\r
+ // Start by showing the element\r
+ jQuery( this.elem ).show();\r
+ },\r
+\r
+ // Simple 'hide' function\r
+ hide: function() {\r
+ // Remember where we started, so that we can go back to it later\r
+ this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );\r
+ this.options.hide = true;\r
+\r
+ // Begin the animation\r
+ this.custom( this.cur(), 0 );\r
+ },\r
+\r
+ // Each step of an animation\r
+ step: function( gotoEnd ) {\r
+ var p, n, complete,\r
+ t = fxNow || createFxNow(),\r
+ done = true,\r
+ elem = this.elem,\r
+ options = this.options;\r
+\r
+ if ( gotoEnd || t >= options.duration + this.startTime ) {\r
+ this.now = this.end;\r
+ this.pos = this.state = 1;\r
+ this.update();\r
+\r
+ options.animatedProperties[ this.prop ] = true;\r
+\r
+ for ( p in options.animatedProperties ) {\r
+ if ( options.animatedProperties[ p ] !== true ) {\r
+ done = false;\r
+ }\r
+ }\r
+\r
+ if ( done ) {\r
+ // Reset the overflow\r
+ if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {\r
+\r
+ jQuery.each( [ "", "X", "Y" ], function( index, value ) {\r
+ elem.style[ "overflow" + value ] = options.overflow[ index ];\r
+ });\r
+ }\r
+\r
+ // Hide the element if the "hide" operation was done\r
+ if ( options.hide ) {\r
+ jQuery( elem ).hide();\r
+ }\r
+\r
+ // Reset the properties, if the item has been hidden or shown\r
+ if ( options.hide || options.show ) {\r
+ for ( p in options.animatedProperties ) {\r
+ jQuery.style( elem, p, options.orig[ p ] );\r
+ jQuery.removeData( elem, "fxshow" + p, true );\r
+ // Toggle data is no longer needed\r
+ jQuery.removeData( elem, "toggle" + p, true );\r
+ }\r
+ }\r
+\r
+ // Execute the complete function\r
+ // in the event that the complete function throws an exception\r
+ // we must ensure it won't be called twice. #5684\r
+\r
+ complete = options.complete;\r
+ if ( complete ) {\r
+\r
+ options.complete = false;\r
+ complete.call( elem );\r
+ }\r
+ }\r
+\r
+ return false;\r
+\r
+ } else {\r
+ // classical easing cannot be used with an Infinity duration\r
+ if ( options.duration == Infinity ) {\r
+ this.now = t;\r
+ } else {\r
+ n = t - this.startTime;\r
+ this.state = n / options.duration;\r
+\r
+ // Perform the easing function, defaults to swing\r
+ this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );\r
+ this.now = this.start + ( (this.end - this.start) * this.pos );\r
+ }\r
+ // Perform the next step of the animation\r
+ this.update();\r
+ }\r
+\r
+ return true;\r
+ }\r
+};\r
+\r
+jQuery.extend( jQuery.fx, {\r
+ tick: function() {\r
+ var timer,\r
+ timers = jQuery.timers,\r
+ i = 0;\r
+\r
+ for ( ; i < timers.length; i++ ) {\r
+ timer = timers[ i ];\r
+ // Checks the timer has not already been removed\r
+ if ( !timer() && timers[ i ] === timer ) {\r
+ timers.splice( i--, 1 );\r
+ }\r
+ }\r
+\r
+ if ( !timers.length ) {\r
+ jQuery.fx.stop();\r
+ }\r
+ },\r
+\r
+ interval: 13,\r
+\r
+ stop: function() {\r
+ clearInterval( timerId );\r
+ timerId = null;\r
+ },\r
+\r
+ speeds: {\r
+ slow: 600,\r
+ fast: 200,\r
+ // Default speed\r
+ _default: 400\r
+ },\r
+\r
+ step: {\r
+ opacity: function( fx ) {\r
+ jQuery.style( fx.elem, "opacity", fx.now );\r
+ },\r
+\r
+ _default: function( fx ) {\r
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {\r
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;\r
+ } else {\r
+ fx.elem[ fx.prop ] = fx.now;\r
+ }\r
+ }\r
+ }\r
+});\r
+\r
+// Ensure props that can't be negative don't go there on undershoot easing\r
+jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {\r
+ // exclude marginTop, marginLeft, marginBottom and marginRight from this list\r
+ if ( prop.indexOf( "margin" ) ) {\r
+ jQuery.fx.step[ prop ] = function( fx ) {\r
+ jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );\r
+ };\r
+ }\r
+});\r
+\r
+if ( jQuery.expr && jQuery.expr.filters ) {\r
+ jQuery.expr.filters.animated = function( elem ) {\r
+ return jQuery.grep(jQuery.timers, function( fn ) {\r
+ return elem === fn.elem;\r
+ }).length;\r
+ };\r
+}\r
+\r
+// Try to restore the default display value of an element\r
+function defaultDisplay( nodeName ) {\r
+\r
+ if ( !elemdisplay[ nodeName ] ) {\r
+\r
+ var body = document.body,\r
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),\r
+ display = elem.css( "display" );\r
+ elem.remove();\r
+\r
+ // If the simple way fails,\r
+ // get element's real default display by attaching it to a temp iframe\r
+ if ( display === "none" || display === "" ) {\r
+ // No iframe to use yet, so create it\r
+ if ( !iframe ) {\r
+ iframe = document.createElement( "iframe" );\r
+ iframe.frameBorder = iframe.width = iframe.height = 0;\r
+ }\r
+\r
+ body.appendChild( iframe );\r
+\r
+ // Create a cacheable copy of the iframe document on first call.\r
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\r
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.\r
+ if ( !iframeDoc || !iframe.createElement ) {\r
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;\r
+ iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );\r
+ iframeDoc.close();\r
+ }\r
+\r
+ elem = iframeDoc.createElement( nodeName );\r
+\r
+ iframeDoc.body.appendChild( elem );\r
+\r
+ display = jQuery.css( elem, "display" );\r
+ body.removeChild( iframe );\r
+ }\r
+\r
+ // Store the correct default display\r
+ elemdisplay[ nodeName ] = display;\r
+ }\r
+\r
+ return elemdisplay[ nodeName ];\r
+}\r
+\r
+\r
+\r
+\r
+var getOffset,\r
+ rtable = /^t(?:able|d|h)$/i,\r
+ rroot = /^(?:body|html)$/i;\r
+\r
+if ( "getBoundingClientRect" in document.documentElement ) {\r
+ getOffset = function( elem, doc, docElem, box ) {\r
+ try {\r
+ box = elem.getBoundingClientRect();\r
+ } catch(e) {}\r
+\r
+ // Make sure we're not dealing with a disconnected DOM node\r
+ if ( !box || !jQuery.contains( docElem, elem ) ) {\r
+ return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };\r
+ }\r
+\r
+ var body = doc.body,\r
+ win = getWindow( doc ),\r
+ clientTop = docElem.clientTop || body.clientTop || 0,\r
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,\r
+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,\r
+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,\r
+ top = box.top + scrollTop - clientTop,\r
+ left = box.left + scrollLeft - clientLeft;\r
+\r
+ return { top: top, left: left };\r
+ };\r
+\r
+} else {\r
+ getOffset = function( elem, doc, docElem ) {\r
+ var computedStyle,\r
+ offsetParent = elem.offsetParent,\r
+ prevOffsetParent = elem,\r
+ body = doc.body,\r
+ defaultView = doc.defaultView,\r
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,\r
+ top = elem.offsetTop,\r
+ left = elem.offsetLeft;\r
+\r
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {\r
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {\r
+ break;\r
+ }\r
+\r
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;\r
+ top -= elem.scrollTop;\r
+ left -= elem.scrollLeft;\r
+\r
+ if ( elem === offsetParent ) {\r
+ top += elem.offsetTop;\r
+ left += elem.offsetLeft;\r
+\r
+ if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {\r
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;\r
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;\r
+ }\r
+\r
+ prevOffsetParent = offsetParent;\r
+ offsetParent = elem.offsetParent;\r
+ }\r
+\r
+ if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {\r
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;\r
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;\r
+ }\r
+\r
+ prevComputedStyle = computedStyle;\r
+ }\r
+\r
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {\r
+ top += body.offsetTop;\r
+ left += body.offsetLeft;\r
+ }\r
+\r
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {\r
+ top += Math.max( docElem.scrollTop, body.scrollTop );\r
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );\r
+ }\r
+\r
+ return { top: top, left: left };\r
+ };\r
+}\r
+\r
+jQuery.fn.offset = function( options ) {\r
+ if ( arguments.length ) {\r
+ return options === undefined ?\r
+ this :\r
+ this.each(function( i ) {\r
+ jQuery.offset.setOffset( this, options, i );\r
+ });\r
+ }\r
+\r
+ var elem = this[0],\r
+ doc = elem && elem.ownerDocument;\r
+\r
+ if ( !doc ) {\r
+ return null;\r
+ }\r
+\r
+ if ( elem === doc.body ) {\r
+ return jQuery.offset.bodyOffset( elem );\r
+ }\r
+\r
+ return getOffset( elem, doc, doc.documentElement );\r
+};\r
+\r
+jQuery.offset = {\r
+\r
+ bodyOffset: function( body ) {\r
+ var top = body.offsetTop,\r
+ left = body.offsetLeft;\r
+\r
+ if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {\r
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;\r
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;\r
+ }\r
+\r
+ return { top: top, left: left };\r
+ },\r
+\r
+ setOffset: function( elem, options, i ) {\r
+ var position = jQuery.css( elem, "position" );\r
+\r
+ // set position first, in-case top/left are set even on static elem\r
+ if ( position === "static" ) {\r
+ elem.style.position = "relative";\r
+ }\r
+\r
+ var curElem = jQuery( elem ),\r
+ curOffset = curElem.offset(),\r
+ curCSSTop = jQuery.css( elem, "top" ),\r
+ curCSSLeft = jQuery.css( elem, "left" ),\r
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,\r
+ props = {}, curPosition = {}, curTop, curLeft;\r
+\r
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed\r
+ if ( calculatePosition ) {\r
+ curPosition = curElem.position();\r
+ curTop = curPosition.top;\r
+ curLeft = curPosition.left;\r
+ } else {\r
+ curTop = parseFloat( curCSSTop ) || 0;\r
+ curLeft = parseFloat( curCSSLeft ) || 0;\r
+ }\r
+\r
+ if ( jQuery.isFunction( options ) ) {\r
+ options = options.call( elem, i, curOffset );\r
+ }\r
+\r
+ if ( options.top != null ) {\r
+ props.top = ( options.top - curOffset.top ) + curTop;\r
+ }\r
+ if ( options.left != null ) {\r
+ props.left = ( options.left - curOffset.left ) + curLeft;\r
+ }\r
+\r
+ if ( "using" in options ) {\r
+ options.using.call( elem, props );\r
+ } else {\r
+ curElem.css( props );\r
+ }\r
+ }\r
+};\r
+\r
+\r
+jQuery.fn.extend({\r
+\r
+ position: function() {\r
+ if ( !this[0] ) {\r
+ return null;\r
+ }\r
+\r
+ var elem = this[0],\r
+\r
+ // Get *real* offsetParent\r
+ offsetParent = this.offsetParent(),\r
+\r
+ // Get correct offsets\r
+ offset = this.offset(),\r
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();\r
+\r
+ // Subtract element margins\r
+ // note: when an element has margin: auto the offsetLeft and marginLeft\r
+ // are the same in Safari causing offset.left to incorrectly be 0\r
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;\r
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;\r
+\r
+ // Add offsetParent borders\r
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;\r
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;\r
+\r
+ // Subtract the two offsets\r
+ return {\r
+ top: offset.top - parentOffset.top,\r
+ left: offset.left - parentOffset.left\r
+ };\r
+ },\r
+\r
+ offsetParent: function() {\r
+ return this.map(function() {\r
+ var offsetParent = this.offsetParent || document.body;\r
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {\r
+ offsetParent = offsetParent.offsetParent;\r
+ }\r
+ return offsetParent;\r
+ });\r
+ }\r
+});\r
+\r
+\r
+// Create scrollLeft and scrollTop methods\r
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {\r
+ var top = /Y/.test( prop );\r
+\r
+ jQuery.fn[ method ] = function( val ) {\r
+ return jQuery.access( this, function( elem, method, val ) {\r
+ var win = getWindow( elem );\r
+\r
+ if ( val === undefined ) {\r
+ return win ? (prop in win) ? win[ prop ] :\r
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||\r
+ win.document.body[ method ] :\r
+ elem[ method ];\r
+ }\r
+\r
+ if ( win ) {\r
+ win.scrollTo(\r
+ !top ? val : jQuery( win ).scrollLeft(),\r
+ top ? val : jQuery( win ).scrollTop()\r
+ );\r
+\r
+ } else {\r
+ elem[ method ] = val;\r
+ }\r
+ }, method, val, arguments.length, null );\r
+ };\r
+});\r
+\r
+function getWindow( elem ) {\r
+ return jQuery.isWindow( elem ) ?\r
+ elem :\r
+ elem.nodeType === 9 ?\r
+ elem.defaultView || elem.parentWindow :\r
+ false;\r
+}\r
+\r
+\r
+\r
+\r
+// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods\r
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {\r
+ var clientProp = "client" + name,\r
+ scrollProp = "scroll" + name,\r
+ offsetProp = "offset" + name;\r
+\r
+ // innerHeight and innerWidth\r
+ jQuery.fn[ "inner" + name ] = function() {\r
+ var elem = this[0];\r
+ return elem ?\r
+ elem.style ?\r
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :\r
+ this[ type ]() :\r
+ null;\r
+ };\r
+\r
+ // outerHeight and outerWidth\r
+ jQuery.fn[ "outer" + name ] = function( margin ) {\r
+ var elem = this[0];\r
+ return elem ?\r
+ elem.style ?\r
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :\r
+ this[ type ]() :\r
+ null;\r
+ };\r
+\r
+ jQuery.fn[ type ] = function( value ) {\r
+ return jQuery.access( this, function( elem, type, value ) {\r
+ var doc, docElemProp, orig, ret;\r
+\r
+ if ( jQuery.isWindow( elem ) ) {\r
+ // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat\r
+ doc = elem.document;\r
+ docElemProp = doc.documentElement[ clientProp ];\r
+ return jQuery.support.boxModel && docElemProp ||\r
+ doc.body && doc.body[ clientProp ] || docElemProp;\r
+ }\r
+\r
+ // Get document width or height\r
+ if ( elem.nodeType === 9 ) {\r
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater\r
+ doc = elem.documentElement;\r
+\r
+ // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]\r
+ // so we can't use max, as it'll choose the incorrect offset[Width/Height]\r
+ // instead we use the correct client[Width/Height]\r
+ // support:IE6\r
+ if ( doc[ clientProp ] >= doc[ scrollProp ] ) {\r
+ return doc[ clientProp ];\r
+ }\r
+\r
+ return Math.max(\r
+ elem.body[ scrollProp ], doc[ scrollProp ],\r
+ elem.body[ offsetProp ], doc[ offsetProp ]\r
+ );\r
+ }\r
+\r
+ // Get width or height on the element\r
+ if ( value === undefined ) {\r
+ orig = jQuery.css( elem, type );\r
+ ret = parseFloat( orig );\r
+ return jQuery.isNumeric( ret ) ? ret : orig;\r
+ }\r
+\r
+ // Set the width or height on the element\r
+ jQuery( elem ).css( type, value );\r
+ }, type, value, arguments.length, null );\r
+ };\r
+});\r
+\r
+\r
+\r
+\r
+// Expose jQuery to the global object\r
+window.jQuery = window.$ = jQuery;\r
+\r
+// Expose jQuery as an AMD module, but only for AMD loaders that\r
+// understand the issues with loading multiple versions of jQuery\r
+// in a page that all might call define(). The loader will indicate\r
+// they have special allowances for multiple jQuery versions by\r
+// specifying define.amd.jQuery = true. Register as a named module,\r
+// since jQuery can be concatenated with other files that may use define,\r
+// but not use a proper concatenation script that understands anonymous\r
+// AMD modules. A named AMD is safest and most robust way to register.\r
+// Lowercase jquery is used because AMD module names are derived from\r
+// file names, and jQuery is normally delivered in a lowercase file name.\r
+// Do this after creating the global so that if an AMD module wants to call\r
+// noConflict to hide this version of jQuery, it will work.\r
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {\r
+ define( "jquery", [], function () { return jQuery; } );\r
+}\r
+\r
+\r
+\r
+})( window );
\ No newline at end of file