commit/galaxy-central: 4 new changesets
4 new changesets in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/dfff9d99b410/ changeset: r5011:dfff9d99b410 user: james_taylor date: 2011-02-06 17:29:04 summary: trackster: tiny tweaks affected #: 1 file (131 bytes) --- a/static/scripts/trackster.js Sun Feb 06 10:27:53 2011 -0500 +++ b/static/scripts/trackster.js Sun Feb 06 11:29:04 2011 -0500 @@ -389,7 +389,8 @@ // to zoom in this.top_labeltrack.bind( "dragstart", function( e, d ) { return $("<div />").css( { - "height": view.content_div.height() + view.top_labeltrack.height() + view.nav_labeltrack.height(), + "height": view.content_div.height() + view.top_labeltrack.height() + + view.nav_labeltrack.height() + 1, "top": "0px", "position": "absolute", "background-color": "#ccf", @@ -1485,7 +1486,7 @@ show_tile: function( tile_element, parent_element, tile_low ) { // Readability. var track = this; - + // Position tile element, recalculate left position at display time var range = this.view.high - this.view.low, w_scale = this.content_div.width() / range, @@ -1761,6 +1762,7 @@ this.prefs = this.track_config.values; this.height_px = this.track_config.values.height; + this.vertical_range = this.track_config.values.max_value - this.track_config.values.min_value; // Add control for resizing // Trickery here to deal with the hovering drag handle, can probably be http://bitbucket.org/galaxy/galaxy-central/changeset/a0a66548cb69/ changeset: r5012:a0a66548cb69 user: james_taylor date: 2011-02-06 20:42:11 summary: jquery updated to 1.5, fixed minor bugs in use of jStore and some dom manipulation in workflows (both problems in our code, not backward incompatibility). Please help test. affected #: 5 files (61.3 KB) --- a/static/scripts/galaxy.base.js Sun Feb 06 11:29:04 2011 -0500 +++ b/static/scripts/galaxy.base.js Sun Feb 06 14:42:11 2011 -0500 @@ -496,7 +496,7 @@ } else { // Load jStore for local storage $.jStore.init("galaxy"); // Auto-select best storage - $.jStore.engineReady(function() { + $.jStore.ready(function() { action(); }); } --- a/static/scripts/galaxy.workflow_editor.canvas.js Sun Feb 06 11:29:04 2011 -0500 +++ b/static/scripts/galaxy.workflow_editor.canvas.js Sun Feb 06 14:42:11 2011 -0500 @@ -316,7 +316,7 @@ left:'', top:'', display:'' }); - $('body').remove(ib); + ib.remove(); ibox.append( ib.prepend( t ) ); }); if ( ( data.data_inputs.length > 0 ) && ( data.data_outputs.length > 0 ) ) { @@ -381,7 +381,7 @@ left:'', top:'', display:'' }); - $('body').remove(r); + r.remove(); b.append( r.append( t ) ); }); f.css( "width", Math.min(250, Math.max(f.width(), output_width ))); --- a/static/scripts/jquery.js Sun Feb 06 11:29:04 2011 -0500 +++ b/static/scripts/jquery.js Sun Feb 06 14:42:11 2011 -0500 @@ -1,24 +1,28 @@ /* - * jQuery JavaScript Library v1.4.2 + * jQuery JavaScript Library v1.5 * http://jquery.com/ * - * Copyright 2010, John Resig + * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation + * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * - * Date: Sat Feb 13 22:33:48 2010 -0500 + * Date: Mon Jan 31 08:31:29 2011 -0500 */ (function( window, undefined ) { +// Use the correct document accordingly with window argument (sandbox) +var document = window.document; +var jQuery = (function() { + // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context ); + return new jQuery.fn.init( selector, context, rootjQuery ); }, // Map over jQuery in case of overwrite @@ -27,52 +31,70 @@ // Map over the $ in case of overwrite _$ = window.$, - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - // A central reference to the root jQuery(document) rootjQuery, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, - - // Is it a simple selector - isSimple = /^.[^:#\[\.,]*$/, + quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, // Used for trimming whitespace - rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Check for digits + rdigit = /\d/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, // For matching the engine and version of the browser browserMatch, - + // Has the ready events already been bound? readyBound = false, - - // The functions to execute on DOM ready - readyList = [], + + // The deferred used on DOM ready + readyList, + + // Promise methods + promiseMethods = "then done fail isResolved isRejected promise".split( " " ), // The ready event handler DOMContentLoaded, // Save a reference to some core methods toString = Object.prototype.toString, - hasOwnProperty = Object.prototype.hasOwnProperty, + hasOwn = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, - indexOf = Array.prototype.indexOf; + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; jQuery.fn = jQuery.prototype = { - init: function( selector, context ) { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), or $(undefined) @@ -86,9 +108,9 @@ this.length = 1; return this; } - + // The body element only exists once, optimize finding it - if ( selector === "body" && !context ) { + if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; this.selector = "body"; @@ -106,6 +128,7 @@ // HANDLE: $(html) -> $(array) if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; doc = (context ? context.ownerDocument || context : document); // If a single string is passed in and it's a single tag @@ -122,17 +145,19 @@ } } else { - ret = buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; } - + return jQuery.merge( this, selector ); - + // HANDLE: $("#id") } else { elem = document.getElementById( match[2] ); - if ( elem ) { + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { @@ -149,13 +174,6 @@ return this; } - // HANDLE: $("TAG") - } else if ( !context && /^\w+$/.test( selector ) ) { - this.selector = selector; - this.context = document; - selector = document.getElementsByTagName( selector ); - return jQuery.merge( this, selector ); - // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return (context || rootjQuery).find( selector ); @@ -163,7 +181,7 @@ // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { - return jQuery( context ).find( selector ); + return this.constructor( context ).find( selector ); } // HANDLE: $(function) @@ -184,7 +202,7 @@ selector: "", // The current version of jQuery being used - jquery: "1.4.2", + jquery: "1.5", // The default length of a jQuery object is 0 length: 0, @@ -207,18 +225,18 @@ this.toArray() : // Return just the object - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); + ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set - var ret = jQuery(); + var ret = this.constructor(); if ( jQuery.isArray( elems ) ) { push.apply( ret, elems ); - + } else { jQuery.merge( ret, elems ); } @@ -244,25 +262,17 @@ each: function( callback, args ) { return jQuery.each( this, callback, args ); }, - + ready: function( fn ) { // Attach the listeners jQuery.bindReady(); - // If the DOM is already ready - if ( jQuery.isReady ) { - // Execute the function immediately - fn.call( document, jQuery ); - - // Otherwise, remember the function for later - } else if ( readyList ) { - // Add the function to the wait list - readyList.push( fn ); - } + // Add the callback + readyList.done( fn ); return this; }, - + eq: function( i ) { return i === -1 ? this.slice( i ) : @@ -287,9 +297,9 @@ return callback.call( elem, i, elem ); })); }, - + end: function() { - return this.prevObject || jQuery(null); + return this.prevObject || this.constructor(null); }, // For internal use only. @@ -303,8 +313,11 @@ jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { - // copy reference to target object - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { @@ -338,10 +351,15 @@ continue; } - // Recurse if we're merging object literal values or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { - var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src - : jQuery.isArray(copy) ? [] : {}; + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); @@ -368,41 +386,46 @@ return jQuery; }, - + // Is the DOM ready to be used? Set to true once it occurs. isReady: false, - + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + // Handle when the DOM is ready - ready: function() { + ready: function( wait ) { + // A third-party is pushing the ready event forwards + if ( wait === true ) { + jQuery.readyWait--; + } + // Make sure that the DOM is not already loaded - if ( !jQuery.isReady ) { + if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { - return setTimeout( jQuery.ready, 13 ); + return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + // If there are functions bound, to execute - if ( readyList ) { - // Execute all of them - var fn, i = 0; - while ( (fn = readyList[ i++ ]) ) { - fn.call( document, jQuery ); - } - - // Reset the list of functions - readyList = null; - } + readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - } - } - }, - + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).unbind( "ready" ); + } + } + }, + bindReady: function() { if ( readyBound ) { return; @@ -413,14 +436,15 @@ // Catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readyState === "complete" ) { - return jQuery.ready(); + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); } // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - + // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); @@ -429,7 +453,7 @@ // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", DOMContentLoaded); - + // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); @@ -451,35 +475,50 @@ // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { - return toString.call(obj) === "[object Function]"; - }, - - isArray: function( obj ) { - return toString.call(obj) === "[object Array]"; + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + // A crude way of determining if an object is a window + isWindow: function( obj ) { + return obj && typeof obj === "object" && "setInterval" in obj; + }, + + isNaN: function( obj ) { + return obj == null || !rdigit.test( obj ) || isNaN( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } - + // Not own constructor property must be Object - if ( obj.constructor - && !hasOwnProperty.call(obj, "constructor") - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } - + // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. - + var key; for ( key in obj ) {} - - return key === undefined || hasOwnProperty.call( obj, key ); + + return key === undefined || hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { @@ -488,11 +527,11 @@ } return true; }, - + error: function( msg ) { throw msg; }, - + parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; @@ -500,12 +539,12 @@ // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); - + // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { + if ( rvalidchars.test(data.replace(rvalidescape, "@") + .replace(rvalidtokens, "]") + .replace(rvalidbraces, "")) ) { // Try to use the native JSON parser first return window.JSON && window.JSON.parse ? @@ -517,6 +556,28 @@ } }, + // Cross-browser xml parsing + // (xml & tmp used internally) + parseXML: function( data , xml , tmp ) { + + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + + tmp = xml.documentElement; + + if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { + jQuery.error( "Invalid XML: " + data ); + } + + return xml; + }, + noop: function() {}, // Evalulates a script in a global context @@ -529,7 +590,7 @@ script.type = "text/javascript"; - if ( jQuery.support.scriptEval ) { + if ( jQuery.support.scriptEval() ) { script.appendChild( document.createTextNode( data ) ); } else { script.text = data; @@ -584,9 +645,20 @@ return object; }, - trim: function( text ) { - return (text || "").replace( rtrim, "" ); - }, + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, // results is for internal usage only makeArray: function( array, results ) { @@ -596,7 +668,10 @@ // The window, strings (and functions) also have 'length' // The extra typeof function check is to prevent crashes // in Safari 2 (See: #3039) - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type(array); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { push.call( ret, array ); } else { jQuery.merge( ret, array ); @@ -621,13 +696,14 @@ }, merge: function( first, second ) { - var i = first.length, j = 0; + var i = first.length, + j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } - + } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; @@ -640,12 +716,14 @@ }, grep: function( elems, callback, inv ) { - var ret = []; + var ret = [], retVal; + inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { - if ( !inv !== !callback( elems[ i ], i ) ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { ret.push( elems[ i ] ); } } @@ -667,6 +745,7 @@ } } + // Flatten any nested arrays return ret.concat.apply( [], ret ); }, @@ -701,23 +780,234 @@ return proxy; }, + // Mutifunctional method to get and set values to a collection + // The value/s can be optionally by executed if its a function + access: function( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + jQuery.access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : undefined; + }, + + now: function() { + return (new Date()).getTime(); + }, + + // Create a simple deferred (one callbacks list) + _Deferred: function() { + var // callbacks list + callbacks = [], + // stored [ context , args ] + fired, + // to avoid firing when already doing so + firing, + // flag to know if the deferred has been cancelled + cancelled, + // the deferred itself + deferred = { + + // done( f1, f2, ...) + done: function() { + if ( !cancelled ) { + var args = arguments, + i, + length, + elem, + type, + _fired; + if ( fired ) { + _fired = fired; + fired = 0; + } + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + deferred.done.apply( deferred, elem ); + } else if ( type === "function" ) { + callbacks.push( elem ); + } + } + if ( _fired ) { + deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); + } + } + return this; + }, + + // resolve with given context and args + resolveWith: function( context, args ) { + if ( !cancelled && !fired && !firing ) { + firing = 1; + try { + while( callbacks[ 0 ] ) { + callbacks.shift().apply( context, args ); + } + } + finally { + fired = [ context, args ]; + firing = 0; + } + } + return this; + }, + + // resolve with this as context and given arguments + resolve: function() { + deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments ); + return this; + }, + + // Has this deferred been resolved? + isResolved: function() { + return !!( firing || fired ); + }, + + // Cancel + cancel: function() { + cancelled = 1; + callbacks = []; + return this; + } + }; + + return deferred; + }, + + // Full fledged deferred (two callbacks list) + Deferred: function( func ) { + var deferred = jQuery._Deferred(), + failDeferred = jQuery._Deferred(), + promise; + // Add errorDeferred methods, then and promise + jQuery.extend( deferred, { + then: function( doneCallbacks, failCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ); + return this; + }, + fail: failDeferred.done, + rejectWith: failDeferred.resolveWith, + reject: failDeferred.resolve, + isRejected: failDeferred.isResolved, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj , i /* internal */ ) { + if ( obj == null ) { + if ( promise ) { + return promise; + } + promise = obj = {}; + } + i = promiseMethods.length; + while( i-- ) { + obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ]; + } + return obj; + } + } ); + // Make sure only one callback list will be used + deferred.then( failDeferred.cancel, deferred.cancel ); + // Unexpose cancel + delete deferred.cancel; + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + return deferred; + }, + + // Deferred helper + when: function( object ) { + var args = arguments, + length = args.length, + deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ? + object : + jQuery.Deferred(), + promise = deferred.promise(), + resolveArray; + + if ( length > 1 ) { + resolveArray = new Array( length ); + jQuery.each( args, function( index, element ) { + jQuery.when( element ).then( function( value ) { + resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value; + if( ! --length ) { + deferred.resolveWith( promise, resolveArray ); + } + }, deferred.reject ); + } ); + } else if ( deferred !== object ) { + deferred.resolve( object ); + } + return promise; + }, + // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser uaMatch: function( ua ) { ua = ua.toLowerCase(); - var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || - []; + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; return { browser: match[1] || "", version: match[2] || "0" }; }, + sub: function() { + function jQuerySubclass( selector, context ) { + return new jQuerySubclass.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySubclass, this ); + jQuerySubclass.superclass = this; + jQuerySubclass.fn = jQuerySubclass.prototype = this(); + jQuerySubclass.fn.constructor = jQuerySubclass; + jQuerySubclass.subclass = this.subclass; + jQuerySubclass.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { + context = jQuerySubclass(context); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); + }; + jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; + var rootjQuerySubclass = jQuerySubclass(document); + return jQuerySubclass; + }, + browser: {} }); +// Create readyList deferred +readyList = jQuery._Deferred(); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + browserMatch = jQuery.uaMatch( userAgent ); if ( browserMatch.browser ) { jQuery.browser[ browserMatch.browser ] = true; @@ -735,6 +1025,12 @@ }; } +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + // All jQuery objects should point back to these rootjQuery = jQuery(document); @@ -765,7 +1061,7 @@ // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); - } catch( error ) { + } catch(e) { setTimeout( doScrollCheck, 1 ); return; } @@ -774,68 +1070,25 @@ jQuery.ready(); } -function evalScript( i, elem ) { - if ( elem.src ) { - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); - } else { - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } -} - -// Mutifunctional method to get and set values to a collection -// The value/s can be optionally by executed if its a function -function access( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; -} - -function now() { - return (new Date).getTime(); -} +// Expose jQuery to the global object +return (window.jQuery = window.$ = jQuery); + +})(); + + (function() { jQuery.support = {}; - var root = document.documentElement, - script = document.createElement("script"), - div = document.createElement("div"), - id = "script" + now(); + var div = document.createElement("div"); div.style.display = "none"; div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0]; + a = div.getElementsByTagName("a")[0], + select = document.createElement("select"), + opt = select.appendChild( document.createElement("option") ); // Can't get basic test support if ( !all || !all.length || !a ) { @@ -878,44 +1131,65 @@ // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, - - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, + optSelected: opt.selected, // Will be defined later deleteExpando: true, + optDisabled: false, checkClone: false, - scriptEval: false, + _scriptEval: null, noCloneEvent: true, - boxModel: null + boxModel: null, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableHiddenOffsets: true }; - script.type = "text/javascript"; - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - if ( window[ id ] ) { - jQuery.support.scriptEval = true; - delete window[ id ]; - } + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as diabled) + select.disabled = true; + jQuery.support.optDisabled = !opt.disabled; + + jQuery.support.scriptEval = function() { + if ( jQuery.support._scriptEval === null ) { + var root = document.documentElement, + script = document.createElement("script"), + id = "script" + jQuery.now(); + + script.type = "text/javascript"; + try { + script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); + } catch(e) {} + + root.insertBefore( script, root.firstChild ); + + // Make sure that the execution of code works by injecting a script + // tag with appendChild/createTextNode + // (IE doesn't support this, fails, and uses .text instead) + if ( window[ id ] ) { + jQuery.support._scriptEval = true; + delete window[ id ]; + } else { + jQuery.support._scriptEval = false; + } + + root.removeChild( script ); + // release memory in IE + root = script = id = null; + } + + return jQuery.support._scriptEval; + }; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { - delete script.test; - + delete div.test; + } catch(e) { jQuery.support.deleteExpando = false; } - root.removeChild( script ); - if ( div.attachEvent && div.fireEvent ) { div.attachEvent("onclick", function click() { // Cloning a node shouldn't copy over any @@ -938,39 +1212,493 @@ // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function() { - var div = document.createElement("div"); + var div = document.createElement("div"), + body = document.getElementsByTagName("body")[0]; + + // Frameset documents with no body should not run this code + if ( !body ) { + return; + } + div.style.width = div.style.paddingLeft = "1px"; - - document.body.appendChild( div ); + body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; - document.body.removeChild( div ).style.display = 'none'; - - div = null; + + if ( "zoom" in div.style ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "<div style='width:4px;'></div>"; + jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; + } + + div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; + var tds = div.getElementsByTagName("td"); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; + + tds[0].style.display = ""; + tds[1].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE < 8 fail this test) + jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; + div.innerHTML = ""; + + body.removeChild( div ).style.display = "none"; + div = tds = null; }); // Technique from Juriy Zaytsev // http://thinkweb2.com/projects/prototype/detecting-event-support-without-brow... - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - el = null; - - return isSupported; + var eventSupported = function( eventName ) { + var el = document.createElement("div"); + eventName = "on" + eventName; + + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( !el.attachEvent ) { + return true; + } + + var isSupported = (eventName in el); + if ( !isSupported ) { + el.setAttribute(eventName, "return;"); + isSupported = typeof el[eventName] === "function"; + } + el = null; + + return isSupported; }; - + jQuery.support.submitBubbles = eventSupported("submit"); jQuery.support.changeBubbles = eventSupported("change"); // release memory in IE - root = script = div = all = a = null; + div = all = a = null; })(); + + +var rbrace = /^(?:\{.*\}|\[.*\])$/; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + + return !!elem && !jQuery.isEmptyObject(elem); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ jQuery.expando ] = id = ++jQuery.uuid; + } else { + id = jQuery.expando; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" ) { + if ( pvt ) { + cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); + } else { + cache[ id ] = jQuery.extend(cache[ id ], name); + } + } + + thisCache = cache[ id ]; + + // Internal jQuery data is stored in a separate object inside the object's data + // cache in order to avoid key collisions between internal data and user-defined + // data + if ( pvt ) { + if ( !thisCache[ internalKey ] ) { + thisCache[ internalKey ] = {}; + } + + thisCache = thisCache[ internalKey ]; + } + + if ( data !== undefined ) { + thisCache[ name ] = data; + } + + // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should + // not attempt to inspect the internal events object using jQuery.data, as this + // internal data object is undocumented and subject to change. + if ( name === "events" && !thisCache[name] ) { + return thisCache[ internalKey ] && thisCache[ internalKey ].events; + } + + return getByName ? thisCache[ name ] : thisCache; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var internalKey = jQuery.expando, isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; + + if ( thisCache ) { + delete thisCache[ name ]; + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !jQuery.isEmptyObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( pvt ) { + delete cache[ id ][ internalKey ]; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !jQuery.isEmptyObject(cache[ id ]) ) { + return; + } + } + + var internalCache = cache[ id ][ internalKey ]; + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + if ( jQuery.support.deleteExpando || cache != window ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the entire user cache at once because it's faster than + // iterating through each key, but we need to continue to persist internal + // data if it existed + if ( internalCache ) { + cache[ id ] = {}; + cache[ id ][ internalKey ] = internalCache; + + // Otherwise, we need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + } else if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ jQuery.expando ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( jQuery.expando ); + } else { + elem[ jQuery.expando ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var data = null; + + if ( typeof key === "undefined" ) { + if ( this.length ) { + data = jQuery.data( this[0] ); + + if ( this[0].nodeType === 1 ) { + var attr = this[0].attributes, name; + for ( var i = 0, l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = name.substr( 5 ); + dataAttr( this[0], name, data[ name ] ); + } + } + } + } + + return data; + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + var parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + // Try to fetch any internally stored data first + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + data = dataAttr( this[0], key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + + } else { + return this.each(function() { + var $this = jQuery( this ), + args = [ parts[0], value ]; + + $this.triggerHandler( "setData" + parts[1] + "!", args ); + jQuery.data( this, key, value ); + $this.triggerHandler( "changeData" + parts[1] + "!", args ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + data = elem.getAttribute( "data-" + key ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + !jQuery.isNaN( data ) ? parseFloat( data ) : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + + + + +jQuery.extend({ + queue: function( elem, type, data ) { + if ( !elem ) { + return; + } + + type = (type || "fx") + "queue"; + var q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( !data ) { + return q || []; + } + + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + + } else { + q.push( data ); + } + + return q; + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(); + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift("inprogress"); + } + + fn.call(elem, function() { + jQuery.dequeue(elem, type); + }); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue", true ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function( i ) { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; + type = type || "fx"; + + return this.queue( type, function() { + var elem = this; + setTimeout(function() { + jQuery.dequeue( elem, type ); + }, time ); + }); + }, + + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspaces = /\s+/, + rreturn = /\r/g, + rspecialurl = /^(?:href|src|style)$/, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rradiocheck = /^(?:radio|checkbox)$/i; + jQuery.props = { "for": "htmlFor", "class": "className", @@ -983,238 +1711,10 @@ usemap: "useMap", frameborder: "frameBorder" }; -var expando = "jQuery" + now(), uuid = 0, windowData = {}; - -jQuery.extend({ - cache: {}, - - expando:expando, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - "object": true, - "applet": true - }, - - data: function( elem, name, data ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache; - - if ( !id && typeof name === "string" && data === undefined ) { - return null; - } - - // Compute a unique ID for the element - if ( !id ) { - id = ++uuid; - } - - // Avoid generating a new cache unless none exists and we - // want to manipulate it. - if ( typeof name === "object" ) { - elem[ expando ] = id; - thisCache = cache[ id ] = jQuery.extend(true, {}, name); - - } else if ( !cache[ id ] ) { - elem[ expando ] = id; - cache[ id ] = {}; - } - - thisCache = cache[ id ]; - - // Prevent overriding the named cache with undefined values - if ( data !== undefined ) { - thisCache[ name ] = data; - } - - return typeof name === "string" ? thisCache[ name ] : thisCache; - }, - - removeData: function( elem, name ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; - - // If we want to remove a specific section of the element's data - if ( name ) { - if ( thisCache ) { - // Remove the section of cache data - delete thisCache[ name ]; - - // If we've removed all the data, remove the element's cache - if ( jQuery.isEmptyObject(thisCache) ) { - jQuery.removeData( elem ); - } - } - - // Otherwise, we want to remove all of the element's data - } else { - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - // Completely remove the data cache - delete cache[ id ]; - } - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - if ( typeof key === "undefined" && this.length ) { - return jQuery.data( this[0] ); - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - } - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } else { - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { - jQuery.data( this, key, value ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); -jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; - } - - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), fn = queue.shift(); - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function( i, elem ) { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - } -}); -var rclass = /[\n\t]/g, - rspace = /\s+/, - rreturn = /\r/g, - rspecialurl = /href|src|style/, - rtype = /(button|input)/i, - rfocusable = /(button|input|object|select|textarea)/i, - rclickable = /^(a|area)$/i, - rradiocheck = /radio|checkbox/; jQuery.fn.extend({ attr: function( name, value ) { - return access( this, name, value, true, jQuery.attr ); + return jQuery.access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name, fn ) { @@ -1235,7 +1735,7 @@ } if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspace ); + var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; @@ -1245,7 +1745,9 @@ elem.className = value; } else { - var className = " " + elem.className + " ", setClass = elem.className; + var className = " " + elem.className + " ", + setClass = elem.className; + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { setClass += " " + classNames[c]; @@ -1269,7 +1771,7 @@ } if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split(rspace); + var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; @@ -1293,7 +1795,8 @@ }, toggleClass: function( value, stateVal ) { - var type = typeof value, isBool = typeof stateVal === "boolean"; + var type = typeof value, + isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function(i) { @@ -1305,9 +1808,11 @@ return this.each(function() { if ( type === "string" ) { // toggle individual class names - var className, i = 0, self = jQuery(this), + var className, + i = 0, + self = jQuery( this ), state = stateVal, - classNames = value.split( rspace ); + classNames = value.split( rspaces ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list @@ -1318,11 +1823,11 @@ } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set - jQuery.data( this, "__className__", this.className ); + jQuery._data( this, "__className__", this.className ); } // toggle whole className - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, @@ -1339,12 +1844,15 @@ }, val: function( value ) { - if ( value === undefined ) { + if ( !arguments.length ) { var elem = this[0]; if ( elem ) { if ( jQuery.nodeName( elem, "option" ) ) { - return (elem.attributes.value || {}).specified ? elem.value : elem.text; + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; } // We need to handle select boxes special @@ -1363,8 +1871,11 @@ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; - if ( option.selected ) { - // Get the specifc value for the option + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option value = jQuery(option).val(); // We don't need an array for one selects @@ -1384,7 +1895,6 @@ if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { return elem.getAttribute("value") === null ? "on" : elem.value; } - // Everything else, we just grab the value return (elem.value || "").replace(rreturn, ""); @@ -1407,10 +1917,15 @@ val = value.call(this, i, self.val()); } - // Typecast each time if the value is a Function and the appended - // value is therefore different each time. - if ( typeof val === "number" ) { + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { val += ""; + } else if ( jQuery.isArray(val) ) { + val = jQuery.map(val, function (value) { + return value == null ? "" : value + ""; + }); } if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { @@ -1445,10 +1960,10 @@ height: true, offset: true }, - + attr: function( elem, name, value, pass ) { - // don't set attributes on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) { return undefined; } @@ -1474,7 +1989,7 @@ var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; - + // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; @@ -1483,14 +1998,22 @@ } // If applicable, access the attribute via the DOM 0 way - if ( name in elem && notxml && !special ) { + // 'in' checks fail in Blackberry 4.7 #6931 + if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { if ( set ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } - elem[ name ] = value; + if ( value === null ) { + if ( elem.nodeType === 1 ) { + elem.removeAttribute( name ); + } + + } else { + elem[ name ] = value; + } } // browsers index elements by id/name on forms, give priority to attributes. @@ -1526,6 +2049,12 @@ elem.setAttribute( name, "" + value ); } + // Ensure that missing attributes return undefined + // Blackberry 4.7 returns "" from getAttribute #6938 + if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { + return undefined; + } + var attr = !jQuery.support.hrefNormalized && notxml && special ? // Some attributes require a special call on IE elem.getAttribute( name, 2 ) : @@ -1534,18 +2063,26 @@ // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } - - // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style instead. - return jQuery.style( elem, name, value ); + // Handle everything which isn't a DOM element node + if ( set ) { + elem[ name ] = value; + } + return elem[ name ]; } }); + + + + var rnamespaces = /\.(.*)$/, + rformElems = /^(?:textarea|input|select)$/i, + rperiod = /\./g, + rspace = / /g, + rescape = /[^\w\s.|`]/g, fcleanup = function( nm ) { - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { - return "\\" + ch; - }); - }; + return nm.replace(rescape, "\\$&"); + }, + eventKey = "events"; /* * A number of helper functions used for managing events. @@ -1563,10 +2100,17 @@ // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { + if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { elem = window; } + if ( handler === false ) { + handler = returnFalse; + } else if ( !handler ) { + // Fixes bug #7229. Fix recommended by jdalton + return; + } + var handleObjIn, handleObj; if ( handler.handler ) { @@ -1580,7 +2124,7 @@ } // Init the element's event structure - var elemData = jQuery.data( elem ); + var elemData = jQuery._data( elem ); // If no elemData is found then we must be trying to bind to one of the // banned noData elements @@ -1588,8 +2132,25 @@ return; } - var events = elemData.events = elemData.events || {}, - eventHandle = elemData.handle, eventHandle; + var events = elemData[ eventKey ], + eventHandle = elemData.handle; + + if ( typeof events === "function" ) { + // On plain objects events is a fn that holds the the data + // which prevents this data from being JSON serialized + // the function does not need to be called, it just contains the data + eventHandle = events.handle; + events = events.events; + + } else if ( !events ) { + if ( !elem.nodeType ) { + // On plain objects, create a fn that acts as the holder + // of the values to avoid JSON serialization of event data + elemData[ eventKey ] = elemData = function(){}; + } + + elemData.events = events = {}; + } if ( !eventHandle ) { elemData.handle = eventHandle = function() { @@ -1628,7 +2189,9 @@ } handleObj.type = type; - handleObj.guid = handler.guid; + if ( !handleObj.guid ) { + handleObj.guid = handler.guid; + } // Get the current list of functions bound to this event var handlers = events[ type ], @@ -1651,9 +2214,9 @@ } } } - - if ( special.add ) { - special.add.call( elem, handleObj ); + + if ( special.add ) { + special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; @@ -1680,14 +2243,23 @@ return; } - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.data( elem ), - events = elemData && elemData.events; + if ( handler === false ) { + handler = returnFalse; + } + + var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + events = elemData && elemData[ eventKey ]; if ( !elemData || !events ) { return; } + if ( typeof events === "function" ) { + elemData = events; + events = events.events; + } + // types is actually an event object here if ( types && types.type ) { handler = types.handler; @@ -1720,8 +2292,8 @@ namespaces = type.split("."); type = namespaces.shift(); - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") + namespace = new RegExp("(^|\\.)" + + jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); } eventType = events[ type ]; @@ -1731,7 +2303,7 @@ } if ( !handler ) { - for ( var j = 0; j < eventType.length; j++ ) { + for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( all || namespace.test( handleObj.namespace ) ) { @@ -1745,7 +2317,7 @@ special = jQuery.event.special[ type ] || {}; - for ( var j = pos || 0; j < eventType.length; j++ ) { + for ( j = pos || 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( handler.guid === handleObj.guid ) { @@ -1769,7 +2341,7 @@ // remove generic event handler if no more handlers exist if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - removeEvent( elem, type, elemData.handle ); + jQuery.removeEvent( elem, type, elemData.handle ); } ret = null; @@ -1787,8 +2359,11 @@ delete elemData.events; delete elemData.handle; - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem ); + if ( typeof elemData === "function" ) { + jQuery.removeData( elem, eventKey, true ); + + } else if ( jQuery.isEmptyObject( elemData ) ) { + jQuery.removeData( elem, undefined, true ); } } }, @@ -1802,7 +2377,7 @@ if ( !bubbling ) { event = typeof event === "object" ? // jQuery.Event object - event[expando] ? event : + event[ jQuery.expando ] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) @@ -1820,9 +2395,16 @@ // Only trigger if we've ever bound an event for it if ( jQuery.event.global[ type ] ) { + // XXX This code smells terrible. event.js should not be directly + // inspecting the data cache jQuery.each( jQuery.cache, function() { - if ( this.events && this.events[type] ) { - jQuery.event.trigger( event, data, this.handle.elem ); + // internalKey variable is just used to make it easier to find + // and potentially change this stuff later; currently it just + // points to jQuery.expando + var internalKey = jQuery.expando, + internalCache = this[ internalKey ]; + if ( internalCache && internalCache.events && internalCache.events[type] ) { + jQuery.event.trigger( event, data, internalCache.handle.elem ); } }); } @@ -1847,7 +2429,10 @@ event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function - var handle = jQuery.data( elem, "handle" ); + var handle = elem.nodeType ? + jQuery._data( elem, "handle" ) : + (jQuery._data( elem, eventKey ) || {}).handle; + if ( handle ) { handle.apply( elem, data ); } @@ -1859,41 +2444,44 @@ if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { event.result = false; + event.preventDefault(); } } // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} + } catch (inlineError) {} if ( !event.isPropagationStopped() && parent ) { jQuery.event.trigger( event, data, parent, true ); } else if ( !event.isDefaultPrevented() ) { - var target = event.target, old, - isClick = jQuery.nodeName(target, "a") && type === "click", - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && + var old, + target = event.target, + targetType = type.replace( rnamespaces, "" ), + isClick = jQuery.nodeName( target, "a" ) && targetType === "click", + special = jQuery.event.special[ targetType ] || {}; + + if ( (!special._default || special._default.call( elem, event ) === false) && !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { try { - if ( target[ type ] ) { + if ( target[ targetType ] ) { // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + type ]; + old = target[ "on" + targetType ]; if ( old ) { - target[ "on" + type ] = null; + target[ "on" + targetType ] = null; } jQuery.event.triggered = true; - target[ type ](); + target[ targetType ](); } // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} + } catch (triggerError) {} if ( old ) { - target[ "on" + type ] = old; + target[ "on" + targetType ] = old; } jQuery.event.triggered = false; @@ -1902,9 +2490,11 @@ }, handle: function( event ) { - var all, handlers, namespaces, namespace, events; - - event = arguments[0] = jQuery.event.fix( event || window.event ); + var all, handlers, namespaces, namespace_re, events, + namespace_sort = [], + args = jQuery.makeArray( arguments ); + + event = args[0] = jQuery.event.fix( event || window.event ); event.currentTarget = this; // Namespaced event handlers @@ -1913,10 +2503,19 @@ if ( !all ) { namespaces = event.type.split("."); event.type = namespaces.shift(); - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - var events = jQuery.data(this, "events"), handlers = events[ event.type ]; + namespace_sort = namespaces.slice(0).sort(); + namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); + } + + event.namespace = event.namespace || namespace_sort.join("."); + + events = jQuery._data(this, eventKey); + + if ( typeof events === "function" ) { + events = events.events; + } + + handlers = (events || {})[ event.type ]; if ( events && handlers ) { // Clone the handlers to prevent manipulation @@ -1926,14 +2525,14 @@ var handleObj = handlers[ j ]; // Filter the functions by class - if ( all || namespace.test( handleObj.namespace ) ) { + if ( all || namespace_re.test( handleObj.namespace ) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handleObj.handler; event.data = handleObj.data; event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, arguments ); + + var ret = handleObj.handler.apply( this, args ); if ( ret !== undefined ) { event.result = ret; @@ -1953,10 +2552,10 @@ return event.result; }, - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function( event ) { - if ( event[ expando ] ) { + if ( event[ jQuery.expando ] ) { return event; } @@ -1972,7 +2571,8 @@ // Fix target property, if necessary if ( !event.target ) { - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either + // Fixes #1925 where srcElement might not be defined either + event.target = event.srcElement || document; } // check if target is a textnode (safari) @@ -1987,14 +2587,16 @@ // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; + var doc = document.documentElement, + body = document.body; + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // Add which for key events - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { - event.which = event.charCode || event.keyCode; + if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { + event.which = event.charCode != null ? event.charCode : event.keyCode; } // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) @@ -2026,36 +2628,24 @@ live: { add: function( handleObj ) { - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); + jQuery.event.add( this, + liveConvert( handleObj.origType, handleObj.selector ), + jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); }, remove: function( handleObj ) { - var remove = true, - type = handleObj.origType.replace(rnamespaces, ""); - - jQuery.each( jQuery.data(this, "events").live || [], function() { - if ( type === this.origType.replace(rnamespaces, "") ) { - remove = false; - return false; - } - }); - - if ( remove ) { - jQuery.event.remove( this, handleObj.origType, liveHandler ); - } - } - + jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); + } }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows - if ( this.setInterval ) { + if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } - - return false; }, + teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; @@ -2065,12 +2655,16 @@ } }; -var removeEvent = document.removeEventListener ? +jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { - elem.removeEventListener( type, handle, false ); - } : + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : function( elem, type, handle ) { - elem.detachEvent( "on" + type, handle ); + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } }; jQuery.Event = function( src ) { @@ -2083,6 +2677,12 @@ if ( src && src.type ) { this.originalEvent = src; this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; + // Event type } else { this.type = src; @@ -2090,10 +2690,10 @@ // timeStamp is buggy for some events on Firefox(#3843) // So we won't rely on the native value - this.timeStamp = now(); + this.timeStamp = jQuery.now(); // Mark it as fixed - this[ expando ] = true; + this[ jQuery.expando ] = true; }; function returnFalse() { @@ -2113,13 +2713,15 @@ if ( !e ) { return; } - + // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); - } + // otherwise set the returnValue property of the original event to false (IE) - e.returnValue = false; + } else { + e.returnValue = false; + } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; @@ -2197,19 +2799,23 @@ jQuery.event.special.submit = { setup: function( data, namespaces ) { - if ( this.nodeName.toLowerCase() !== "form" ) { + if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) { jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; + var elem = e.target, + type = elem.type; if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { + e.liveFired = undefined; return trigger( "submit", this, arguments ); } }); - + jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; + var elem = e.target, + type = elem.type; if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { + e.liveFired = undefined; return trigger( "submit", this, arguments ); } }); @@ -2229,9 +2835,7 @@ // change delegation, happens here so we have bind. if ( !jQuery.support.changeBubbles ) { - var formElems = /textarea|input|select/i, - - changeFilters, + var changeFilters, getVal = function( elem ) { var type = elem.type, val = elem.value; @@ -2256,31 +2860,34 @@ testChange = function testChange( e ) { var elem = e.target, data, val; - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { + if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { return; } - data = jQuery.data( elem, "_change_data" ); + data = jQuery._data( elem, "_change_data" ); val = getVal(elem); // the current data will be also retrieved by beforeactivate if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery.data( elem, "_change_data", val ); - } - + jQuery._data( elem, "_change_data", val ); + } + if ( data === undefined || val === data ) { return; } if ( data != null || val ) { e.type = "change"; + e.liveFired = undefined; return jQuery.event.trigger( e, arguments[1], elem ); } }; jQuery.event.special.change = { filters: { - focusout: testChange, + focusout: testChange, + + beforedeactivate: testChange, click: function( e ) { var elem = e.target, type = elem.type; @@ -2304,10 +2911,10 @@ // Beforeactivate happens also before the previous element is blurred // with this event you can't trigger a change event, but you can store - // information/focus[in] is not needed anymore + // information beforeactivate: function( e ) { var elem = e.target; - jQuery.data( elem, "_change_data", getVal(elem) ); + jQuery._data( elem, "_change_data", getVal(elem) ); } }, @@ -2320,17 +2927,20 @@ jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); } - return formElems.test( this.nodeName ); + return rformElems.test( this.nodeName ); }, teardown: function( namespaces ) { jQuery.event.remove( this, ".specialChange" ); - return formElems.test( this.nodeName ); + return rformElems.test( this.nodeName ); } }; changeFilters = jQuery.event.special.change.filters; + + // Handle when the input is .focus()'d + changeFilters.focus = changeFilters.beforeactivate; } function trigger( type, elem, args ) { @@ -2350,7 +2960,7 @@ } }; - function handler( e ) { + function handler( e ) { e = jQuery.event.fix( e ); e.type = fix; return jQuery.event.handle.call( this, e ); @@ -2367,8 +2977,8 @@ } return this; } - - if ( jQuery.isFunction( data ) ) { + + if ( jQuery.isFunction( data ) || data === false ) { fn = data; data = undefined; } @@ -2407,20 +3017,20 @@ return this; }, - + delegate: function( selector, types, data, fn ) { return this.live( types, data, fn, selector ); }, - + undelegate: function( selector, types, fn ) { if ( arguments.length === 0 ) { return this.unbind( "live" ); - + } else { return this.die( types, null, fn, selector ); } }, - + trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); @@ -2439,7 +3049,8 @@ toggle: function( fn ) { // Save reference to arguments for access in closure - var args = arguments, i = 1; + var args = arguments, + i = 1; // link all the functions, so any of them can unbind this click handler while ( i < args.length ) { @@ -2448,8 +3059,8 @@ return this.click( jQuery.proxy( fn, function( event ) { // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); @@ -2477,6 +3088,14 @@ selector = origSelector || this.selector, context = origSelector ? this : jQuery( this.context ); + if ( typeof types === "object" && !types.preventDefault ) { + for ( var key in types ) { + context[ name ]( key, data, types[key], selector ); + } + + return this; + } + if ( jQuery.isFunction( data ) ) { fn = data; data = undefined; @@ -2510,31 +3129,40 @@ if ( name === "live" ) { // bind live handler - context.each(function(){ - jQuery.event.add( this, liveConvert( type, selector ), + for ( var j = 0, l = context.length; j < l; j++ ) { + jQuery.event.add( context[j], "live." + liveConvert( type, selector ), { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - }); + } } else { // unbind live handler - context.unbind( liveConvert( type, selector ), fn ); - } - } - + context.unbind( "live." + liveConvert( type, selector ), fn ); + } + } + return this; + }; +}); + +function liveHandler( event ) { + var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, + elems = [], + selectors = [], + events = jQuery._data( this, eventKey ); + + if ( typeof events === "function" ) { + events = events.events; } -}); - -function liveHandler( event ) { - var stop, elems = [], selectors = [], args = arguments, - related, match, handleObj, elem, j, i, l, data, - events = jQuery.data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { + + // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) + if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { return; } + if ( event.namespace ) { + namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); + } + event.liveFired = this; var live = events.live.slice(0); @@ -2553,20 +3181,23 @@ match = jQuery( event.target ).closest( selectors, event.currentTarget ); for ( i = 0, l = match.length; i < l; i++ ) { + close = match[i]; + for ( j = 0; j < live.length; j++ ) { handleObj = live[j]; - if ( match[i].selector === handleObj.selector ) { - elem = match[i].elem; + if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) { + elem = close.elem; related = null; // Those two events require additional checking if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { + event.type = handleObj.preType; related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; } if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj }); + elems.push({ elem: elem, handleObj: handleObj, level: close.level }); } } } @@ -2574,13 +3205,26 @@ for ( i = 0, l = elems.length; i < l; i++ ) { match = elems[i]; + + if ( maxLevel && match.level > maxLevel ) { + break; + } + event.currentTarget = match.elem; event.data = match.handleObj.data; event.handleObj = match.handleObj; - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { - stop = false; - break; + ret = match.handleObj.origHandler.apply( match.elem, arguments ); + + if ( ret === false || event.isPropagationStopped() ) { + maxLevel = match.level; + + if ( ret === false ) { + stop = false; + } + if ( event.isImmediatePropagationStopped() ) { + break; + } } } @@ -2588,7 +3232,7 @@ } function liveConvert( type, selector ) { - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); + return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); } jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + @@ -2596,8 +3240,15 @@ "change select submit keydown keypress keyup error").split(" "), function( i, name ) { // Handle event binding - jQuery.fn[ name ] = function( fn ) { - return fn ? this.bind( name, fn ) : this.trigger( name ); + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.bind( name, data, fn ) : + this.trigger( name ); }; if ( jQuery.attrFn ) { @@ -2605,31 +3256,16 @@ } }); -// Prevent memory leaks in IE -// Window isn't included so as not to unbind existing unload events -// More info: -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ -if ( window.attachEvent && !window.addEventListener ) { - window.attachEvent("onunload", function() { - for ( var id in jQuery.cache ) { - if ( jQuery.cache[ id ].handle ) { - // Try/Catch is to handle iframes being unloaded, see #4280 - try { - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); - } catch(e) {} - } - } - }); -} + /*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, done = 0, toString = Object.prototype.toString, hasDuplicate = false, @@ -2639,14 +3275,16 @@ // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. -[0, 0].sort(function(){ +[0, 0].sort(function() { baseHasDuplicate = false; return 0; }); -var Sizzle = function(selector, context, results, seed) { +var Sizzle = function( selector, context, results, seed ) { results = results || []; - var origContext = context = context || document; + context = context || document; + + var origContext = context; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; @@ -2656,24 +3294,34 @@ return results; } - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], soFar = selector; // Reset the position of the chunker regexp (start from head) - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; - parts.push( m[1] ); + parts.push( m[1] ); - if ( m[2] ) { - extra = m[3]; - break; - } - } + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); if ( parts.length > 1 && origPOS.exec( selector ) ) { + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); + } else { set = Expr.relative[ parts[0] ] ? [ context ] : @@ -2689,29 +3337,38 @@ set = posProcess( selector, set ); } } + } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; } if ( context ) { - var ret = seed ? + ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; if ( parts.length > 0 ) { - checkSet = makeArray(set); + checkSet = makeArray( set ); + } else { prune = false; } while ( parts.length ) { - var cur = parts.pop(), pop = cur; + cur = parts.pop(); + pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; @@ -2725,6 +3382,7 @@ Expr.relative[ cur ]( checkSet, pop, contextXML ); } + } else { checkSet = parts = []; } @@ -2741,19 +3399,22 @@ if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); + } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } + } else { - for ( var i = 0; checkSet[i] != null; i++ ) { + for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } + } else { makeArray( checkSet, results ); } @@ -2766,15 +3427,15 @@ return results; }; -Sizzle.uniqueSort = function(results){ +Sizzle.uniqueSort = function( results ) { if ( sortOrder ) { hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); + results.sort( sortOrder ); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); } } } @@ -2783,27 +3444,33 @@ return results; }; -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); }; -Sizzle.find = function(expr, context, isXML){ - var set, match; +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; + var match, + type = Expr.order[i]; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { var left = match[1]; - match.splice(1,1); + match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); + if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; @@ -2813,20 +3480,28 @@ } if ( !set ) { - set = context.getElementsByTagName("*"); + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; } - return {set: set, expr: expr}; + return { set: set, expr: expr }; }; -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; + var found, item, + filter = Expr.filter[ type ], + left = match[1]; + anyFound = false; match.splice(1,1); @@ -2844,6 +3519,7 @@ if ( !match ) { anyFound = found = true; + } else if ( match === true ) { continue; } @@ -2858,9 +3534,11 @@ if ( inplace && found != null ) { if ( pass ) { anyFound = true; + } else { curLoop[i] = false; } + } else if ( pass ) { result.push( item ); anyFound = true; @@ -2889,6 +3567,7 @@ if ( expr === old ) { if ( anyFound == null ) { Sizzle.error( expr ); + } else { break; } @@ -2906,30 +3585,35 @@ var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], + match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + leftMatch: {}, + attrMap: { "class": "className", "for": "htmlFor" }, + attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, + href: function( elem ) { + return elem.getAttribute( "href" ); + } + }, + relative: { "+": function(checkSet, part){ var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), + isTag = isPartStr && !/\W/.test( part ), isPartStrNotTag = isPartStr && !isTag; if ( isTag ) { @@ -2950,22 +3634,29 @@ Sizzle.filter( part, checkSet, true ); } }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !/\W/.test( part ) ) { part = part.toLowerCase(); - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; + for ( ; i < l; i++ ) { + elem = checkSet[i]; + if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; } } + } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; + for ( ; i < l; i++ ) { + elem = checkSet[i]; + if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : @@ -2978,37 +3669,50 @@ } } }, + "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; + var nodeCheck, + doneName = done++, + checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); + part = part.toLowerCase(); + nodeCheck = part; checkFn = dirNodeCheck; } - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !/\W/.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; checkFn = dirNodeCheck; } - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + find: { - ID: function(match, context, isXML){ + ID: function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); - return m ? [m] : []; + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; } }, - NAME: function(match, context){ + + NAME: function( match, context ) { if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); + var ret = [], + results = context.getElementsByName( match[1] ); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { @@ -3019,12 +3723,15 @@ return ret.length === 0 ? null : ret; } }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } } }, preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ + CLASS: function( match, curLoop, inplace, result, not, isXML ) { match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { @@ -3033,10 +3740,11 @@ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } + } else if ( inplace ) { curLoop[i] = false; } @@ -3045,16 +3753,25 @@ return false; }, - ID: function(match){ + + ID: function( match ) { return match[1].replace(/\\/g, ""); }, - TAG: function(match, curLoop){ + + TAG: function( match, curLoop ) { return match[1].toLowerCase(); }, - CHILD: function(match){ + + CHILD: function( match ) { if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); @@ -3062,178 +3779,229 @@ match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } // TODO: Move to normal caching system match[0] = done++; return match; }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, ""); + if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, - PSEUDO: function(match, curLoop, inplace, result, not){ + + PSEUDO: function( match, curLoop, inplace, result, not ) { if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); + } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + if ( !inplace ) { result.push.apply( result, ret ); } + return false; } + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, - POS: function(match){ + + POS: function( match ) { match.unshift( true ); + return match; } }, + filters: { - enabled: function(elem){ + enabled: function( elem ) { return elem.disabled === false && elem.type !== "hidden"; }, - disabled: function(elem){ + + disabled: function( elem ) { return elem.disabled === true; }, - checked: function(elem){ + + checked: function( elem ) { return elem.checked === true; }, - selected: function(elem){ + + selected: function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; + return elem.selected === true; }, - parent: function(elem){ + + parent: function( elem ) { return !!elem.firstChild; }, - empty: function(elem){ + + empty: function( elem ) { return !elem.firstChild; }, - has: function(elem, i, match){ + + has: function( elem, i, match ) { return !!Sizzle( match[3], elem ).length; }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); }, - text: function(elem){ + + text: function( elem ) { return "text" === elem.type; }, - radio: function(elem){ + radio: function( elem ) { return "radio" === elem.type; }, - checkbox: function(elem){ + + checkbox: function( elem ) { return "checkbox" === elem.type; }, - file: function(elem){ + + file: function( elem ) { return "file" === elem.type; }, - password: function(elem){ + password: function( elem ) { return "password" === elem.type; }, - submit: function(elem){ + + submit: function( elem ) { return "submit" === elem.type; }, - image: function(elem){ + + image: function( elem ) { return "image" === elem.type; }, - reset: function(elem){ + + reset: function( elem ) { return "reset" === elem.type; }, - button: function(elem){ + + button: function( elem ) { return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); } }, setFilters: { - first: function(elem, i){ + first: function( elem, i ) { return i === 0; }, - last: function(elem, i, match, array){ + + last: function( elem, i, match, array ) { return i === array.length - 1; }, - even: function(elem, i){ + + even: function( elem, i ) { return i % 2 === 0; }, - odd: function(elem, i){ + + odd: function( elem, i ) { return i % 2 === 1; }, - lt: function(elem, i, match){ + + lt: function( elem, i, match ) { return i < match[3] - 0; }, - gt: function(elem, i, match){ + + gt: function( elem, i, match ) { return i > match[3] - 0; }, - nth: function(elem, i, match){ + + nth: function( elem, i, match ) { return match[3] - 0 === i; }, - eq: function(elem, i, match){ + + eq: function( elem, i, match ) { return match[3] - 0 === i; } }, filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); + } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; + } else if ( name === "not" ) { var not = match[3]; - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { return false; } } return true; + } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); + Sizzle.error( name ); } }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': + + CHILD: function( elem, match ) { + var type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } + if ( type === "first" ) { return true; } + node = elem; - case 'last': + + case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } + return true; - case 'nth': - var first = match[2], last = match[3]; + + case "nth": + var first = match[2], + last = match[3]; if ( first === 1 && last === 0 ) { return true; @@ -3244,33 +4012,41 @@ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } + parent.sizcache = doneName; } var diff = elem.nodeIndex - last; + if ( first === 0 ) { return diff === 0; + } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, - ID: function(elem, match){ + + ID: function( elem, match ) { return elem.nodeType === 1 && elem.getAttribute("id") === match; }, - TAG: function(elem, match){ + + TAG: function( elem, match ) { return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; }, - CLASS: function(elem, match){ + + CLASS: function( elem, match ) { return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, - ATTR: function(elem, match){ + + ATTR: function( elem, match ) { var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : @@ -3301,8 +4077,10 @@ value === check || value.substr(0, check.length + 1) === check + "-" : false; }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); @@ -3311,16 +4089,17 @@ } }; -var origPOS = Expr.match.POS; +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ - return "\\" + (num - 0 + 1); - })); + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); } -var makeArray = function(array, results) { +var makeArray = function( array, results ) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { @@ -3339,19 +4118,22 @@ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; // Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); + } else { if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { + for ( var l = array.length; i < l; i++ ) { ret.push( array[i] ); } + } else { - for ( var i = 0; array[i]; i++ ) { + for ( ; array[i]; i++ ) { ret.push( array[i] ); } } @@ -3361,62 +4143,99 @@ }; } -var sortOrder; +var sortOrder, siblingCheck; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } return a.compareDocumentPosition ? -1 : 1; } - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // The nodes are identical, we can exit early + if ( a === b ) { hasDuplicate = true; - } - return ret; + return 0; + + // If the nodes are siblings (or identical) we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.sourceIndex ? -1 : 1; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.ownerDocument ? -1 : 1; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; }; } // Utility function for retreiving the text value of an array of DOM nodes -function getText( elems ) { +Sizzle.getText = function( elems ) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { @@ -3428,43 +4247,52 @@ // Traverse everything else, except comment nodes } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); + ret += Sizzle.getText( elem.childNodes ); } } return ret; -} +}; // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), - id = "script" + (new Date).getTime(); + id = "script" + (new Date()).getTime(), + root = document.documentElement; + form.innerHTML = "<a name='" + id + "'/>"; // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ + Expr.find.ID = function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; } }; - Expr.filter.ID = function(elem, match){ + Expr.filter.ID = function( elem, match ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); - root = form = null; // release memory in IE + + // release memory in IE + root = form = null; })(); (function(){ @@ -3477,8 +4305,8 @@ // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); // Filter out possible comments if ( match[1] === "*" ) { @@ -3499,19 +4327,25 @@ // Check to see if an attribute returns normalized href attributes div.innerHTML = "<a href='#'></a>"; + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); }; } - div = null; // release memory in IE + // release memory in IE + div = null; })(); if ( document.querySelectorAll ) { (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + div.innerHTML = "<p class='TEST'></p>"; // Safari can't handle uppercase or unicode characters when @@ -3520,15 +4354,85 @@ return; } - Sizzle = function(query, context, extra, seed){ + Sizzle = function( query, context, extra, seed ) { context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + context.removeAttribute( "id" ); + } + } + } } return oldSizzle(query, context, extra, seed); @@ -3538,11 +4442,44 @@ Sizzle[ prop ] = oldSizzle[ prop ]; } - div = null; // release memory in IE + // release memory in IE + div = null; })(); } (function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector, + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + if ( matches ) { + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + return matches.call( node, expr ); + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ var div = document.createElement("div"); div.innerHTML = "<div class='test e'></div><div class='test'></div>"; @@ -3561,21 +4498,24 @@ } Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { + Expr.find.CLASS = function( match, context, isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; - div = null; // release memory in IE + // release memory in IE + div = null; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; + if ( elem ) { + var match = false; + elem = elem[dir]; - var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { @@ -3604,9 +4544,11 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; + if ( elem ) { + var match = false; + elem = elem[dir]; - var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { @@ -3619,6 +4561,7 @@ elem.sizcache = doneName; elem.sizset = i; } + if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; @@ -3639,21 +4582,34 @@ } } -var contains = document.compareDocumentPosition ? function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; }; -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, +var posProcess = function( selector, context ) { + var match, + tmpSet = [], + later = "", root = context.nodeType ? [context] : context; // Position selectors must be done after the filter @@ -3677,53 +4633,33 @@ jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; -jQuery.text = getText; -jQuery.isXMLDoc = isXML; -jQuery.contains = contains; - -return; - -window.Sizzle = Sizzle; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + })(); + + var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle rmultiselector = /,/, - slice = Array.prototype.slice; - -// Implement the identical functionality for filter and not -var winnow = function( elements, qualifier, keep ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -}; + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; jQuery.fn.extend({ find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), length = 0; + var ret = this.pushStack( "", "find", selector ), + length = 0; for ( var i = 0, l = this.length; i < l; i++ ) { length = ret.length; @@ -3763,21 +4699,25 @@ filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, - + is: function( selector ) { return !!selector && jQuery.filter( selector, this ).length > 0; }, closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + if ( jQuery.isArray( selectors ) ) { - var ret = [], cur = this[0], match, matches = {}, selector; + var match, selector, + matches = {}, + level = 1; if ( cur && selectors.length ) { - for ( var i = 0, l = selectors.length; i < l; i++ ) { + for ( i = 0, l = selectors.length; i < l; i++ ) { selector = selectors[i]; if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? + matches[selector] = jQuery.expr.match.POS.test( selector ) ? jQuery( selector, context || this.context ) : selector; } @@ -3788,31 +4728,43 @@ match = matches[selector]; if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur }); - delete matches[selector]; + ret.push({ selector: selector, elem: cur, level: level }); } } + cur = cur.parentNode; + level++; } } return ret; } - var pos = jQuery.expr.match.POS.test( selectors ) ? + var pos = POS.test( selectors ) ? jQuery( selectors, context || this.context ) : null; - return this.map(function( i, cur ) { - while ( cur && cur.ownerDocument && cur !== context ) { - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { - return cur; - } - cur = cur.parentNode; - } - return null; - }); - }, - + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique(ret) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + // Determine the position of an element within // the matched set of elements index: function( elem ) { @@ -3830,7 +4782,7 @@ add: function( selector, context ) { var set = typeof selector === "string" ? - jQuery( selector, context || this.context ) : + jQuery( selector, context ) : jQuery.makeArray( selector ), all = jQuery.merge( this.get(), set ); @@ -3892,8 +4844,13 @@ } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - + var ret = jQuery.map( this, fn, until ), + // The variable 'args' was introduced in + // https://github.com/jquery/jquery/commit/52a0238 + // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. + // http://code.google.com/p/v8/issues/detail?id=1050 + args = slice.call(arguments); + if ( !runtil.test( name ) ) { selector = until; } @@ -3902,13 +4859,13 @@ ret = jQuery.filter( selector, ret ); } - ret = this.length > 1 ? jQuery.unique( ret ) : ret; + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } - return this.pushStack( ret, name, slice.call(arguments).join(",") ); + return this.pushStack( ret, name, args.join(",") ); }; }); @@ -3918,11 +4875,15 @@ expr = ":not(" + expr + ")"; } - return jQuery.find.matches(expr, elems); - }, - + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + dir: function( elem, dir, until ) { - var matched = [], cur = elem[dir]; + var matched = [], + cur = elem[ dir ]; + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); @@ -3957,20 +4918,49 @@ return r; } }); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return (elem === qualifier) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return (jQuery.inArray( elem, qualifier ) >= 0) === keep; + }); +} + + + + var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|?\w+;/, - rnocache = /<script|<object|<embed|<option|<style/i, - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5) - fcloseTag = function( all, front, tag ) { - return rselfClosing.test( tag ) ? - all : - front + "></" + tag + ">"; - }, + rnocache = /<(?:script|object|embed|option|style)/i, + // checked="checked" or checked (html5) + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], @@ -3995,7 +4985,8 @@ text: function( text ) { if ( jQuery.isFunction(text) ) { return this.each(function(i) { - var self = jQuery(this); + var self = jQuery( this ); + self.text( text.call(this, i, self.text()) ); }); } @@ -4044,7 +5035,8 @@ } return this.each(function() { - var self = jQuery( this ), contents = self.contents(); + var self = jQuery( this ), + contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); @@ -4108,7 +5100,7 @@ return set; } }, - + // keepData is for internal use only--do not document remove: function( selector, keepData ) { for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { @@ -4123,7 +5115,7 @@ } } } - + return this; }, @@ -4139,46 +5131,17 @@ elem.removeChild( elem.firstChild ); } } - + return this; }, - clone: function( events ) { - // Do the clone - var ret = this.map(function() { - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { - // IE copies events bound via attachEvent when - // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal - // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored - // as properties will not be copied (such as the - // the name attribute on an input). - var html = this.outerHTML, ownerDocument = this.ownerDocument; - if ( !html ) { - var div = ownerDocument.createElement("div"); - div.appendChild( this.cloneNode(true) ); - html = div.innerHTML; - } - - return jQuery.clean([html.replace(rinlinejQuery, "") - // Handle the case in IE 8 where action=/test/> self-closes a tag - .replace(/=([^="'>\s]+\/)>/g, '="$1">') - .replace(rleadingWhitespace, "")], ownerDocument)[0]; - } else { - return this.cloneNode(true); - } + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? true : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); - - // Copy the events from the original to the clone - if ( events === true ) { - cloneCopyEvent( this, ret ); - cloneCopyEvent( this.find("*"), ret.find("*") ); - } - - // Return the cloned set - return ret; }, html: function( value ) { @@ -4192,7 +5155,7 @@ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { - value = value.replace(rxhtmlTag, fcloseTag); + value = value.replace(rxhtmlTag, "<$1></$2>"); try { for ( var i = 0, l = this.length; i < l; i++ ) { @@ -4210,10 +5173,9 @@ } else if ( jQuery.isFunction( value ) ) { this.each(function(i){ - var self = jQuery(this), old = self.html(); - self.empty().append(function(){ - return value.call( this, i, old ); - }); + var self = jQuery( this ); + + self.html( value.call(this, i, self.html()) ); }); } else { @@ -4235,13 +5197,14 @@ } if ( typeof value !== "string" ) { - value = jQuery(value).detach(); + value = jQuery( value ).detach(); } return this.each(function() { - var next = this.nextSibling, parent = this.parentNode; - - jQuery(this).remove(); + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); @@ -4259,7 +5222,9 @@ }, domManip: function( args, table, callback ) { - var results, first, value = args[0], scripts = [], fragment, parent; + var results, first, fragment, parent, + value = args[0], + scripts = []; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { @@ -4284,11 +5249,11 @@ results = { fragment: parent }; } else { - results = buildFragment( args, this, scripts ); - } - + results = jQuery.buildFragment( args, this, scripts ); + } + fragment = results.fragment; - + if ( fragment.childNodes.length === 1 ) { first = fragment = fragment.firstChild; } else { @@ -4298,13 +5263,20 @@ if ( first ) { table = table && jQuery.nodeName( first, "tr" ); - for ( var i = 0, l = this.length; i < l; i++ ) { + for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { callback.call( table ? root(this[i], first) : this[i], - i > 0 || results.cacheable || this.length > 1 ? - fragment.cloneNode(true) : + // Make sure that we do not leak memory by inadvertently discarding + // the original fragment (which might have attached data) instead of + // using it; in addition, use the original fragment object for the last + // item instead of first because it can end up being emptied incorrectly + // in certain situations (Bug #8070). + // Fragments from the fragment cache must always be cloned and never used + // in place. + results.cacheable || (l > 1 && i < lastIndex) ? + jQuery.clone( fragment, true, true ) : fragment ); } @@ -4316,49 +5288,107 @@ } return this; - - function root( elem, cur ) { - return jQuery.nodeName(elem, "table") ? - (elem.getElementsByTagName("tbody")[0] || - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : - elem; - } } }); -function cloneCopyEvent(orig, ret) { - var i = 0; - - ret.each(function() { - if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) { - return; - } - - var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events; +function root( elem, cur ) { + return jQuery.nodeName(elem, "table") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var internalKey = jQuery.expando, + oldData = jQuery.data( src ), + curData = jQuery.data( dest, oldData ); + + // Switch to use the internal data object, if it exists, for the next + // stage of data copying + if ( (oldData = oldData[ internalKey ]) ) { + var events = oldData.events; + curData = curData[ internalKey ] = jQuery.extend({}, oldData); if ( events ) { delete curData.handle; curData.events = {}; for ( var type in events ) { - for ( var handler in events[ type ] ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } - } - }); + for ( var i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data ); + } + } + } + } } -function buildFragment( args, nodes, scripts ) { +function cloneFixAttributes(src, dest) { + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + var nodeName = dest.nodeName.toLowerCase(); + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + dest.clearAttributes(); + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + dest.mergeAttributes(src); + + // IE6-8 fail to clone children inside object elements that use + // the proprietary classid attribute value (rather than the type + // attribute) to identify the type of content to display + if ( nodeName === "object" ) { + dest.outerHTML = src.outerHTML; + + } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + if ( src.checked ) { + dest.defaultChecked = dest.checked = src.checked; + } + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); +} + +jQuery.buildFragment = function( args, nodes, scripts ) { var fragment, cacheable, cacheresults, doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); - // Only cache "small" (1/2 KB) strings that are associated with the main document + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && - !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { + args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { cacheable = true; cacheresults = jQuery.fragments[ args[0] ]; @@ -4379,7 +5409,7 @@ } return { fragment: fragment, cacheable: cacheable }; -} +}; jQuery.fragments = {}; @@ -4391,26 +5421,75 @@ replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { - var ret = [], insert = jQuery( selector ), + var ret = [], + insert = jQuery( selector ), parent = this.length === 1 && this[0].parentNode; - + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { insert[ original ]( this[0] ); return this; - + } else { for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); - jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); + jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } - + return this.pushStack( ret, name, insert.selector ); } }; }); jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var clone = elem.cloneNode(true), + srcElements, + destElements, + i; + + if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + // Using Sizzle here is crazy slow, so we use getElementsByTagName + // instead + srcElements = elem.getElementsByTagName("*"); + destElements = clone.getElementsByTagName("*"); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + + cloneFixAttributes( elem, clone ); + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents && "getElementsByTagName" in elem ) { + + srcElements = elem.getElementsByTagName("*"); + destElements = clone.getElementsByTagName("*"); + + if ( srcElements.length ) { + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + } + // Return the cloned set + return clone; + }, clean: function( elems, context, fragment, scripts ) { context = context || document; @@ -4436,7 +5515,7 @@ } else if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, fcloseTag); + elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Trim whitespace, otherwise indexOf won't work as expected var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), @@ -4489,10 +5568,10 @@ } if ( fragment ) { - for ( var i = 0; ret[i]; i++ ) { + for ( i = 0; ret[i]; i++ ) { if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); - + } else { if ( ret[i].nodeType === 1 ) { ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); @@ -4504,233 +5583,196 @@ return ret; }, - + cleanData: function( elems ) { - var data, id, cache = jQuery.cache, - special = jQuery.event.special, + var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special, deleteExpando = jQuery.support.deleteExpando; - + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { + continue; + } + id = elem[ jQuery.expando ]; - + if ( id ) { - data = cache[ id ]; - - if ( data.events ) { + data = cache[ id ] && cache[ id ][ internalKey ]; + + if ( data && data.events ) { for ( var type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); + // This is a shortcut to avoid jQuery.event.remove's overhead } else { - removeEvent( elem, type, data.handle ); + jQuery.removeEvent( elem, type, data.handle ); } } - } - + + // Null the DOM reference to avoid IE6/7/8 leak (#7054) + if ( data.handle ) { + data.handle.elem = null; + } + } + if ( deleteExpando ) { delete elem[ jQuery.expando ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( jQuery.expando ); } - + delete cache[ id ]; } } } }); -// exclude the following css properties to add px -var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, - ralpha = /alpha\([^)]*\)/, + +function evalScript( i, elem ) { + if ( elem.src ) { + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + } else { + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } +} + + + + +var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, - rfloat = /float/i, rdashAlpha = /-([a-z])/ig, rupper = /([A-Z])/g, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, - cssShow = { position: "absolute", visibility: "hidden", display:"block" }, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssWidth = [ "Left", "Right" ], cssHeight = [ "Top", "Bottom" ], - - // cache check for defaultView.getComputedStyle - getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, - // normalize float css property - styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", + curCSS, + + getComputedStyle, + currentStyle, + fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn.css = function( name, value ) { - return access( this, name, value, true, function( elem, name, value ) { - if ( value === undefined ) { - return jQuery.curCSS( elem, name ); - } - - if ( typeof value === "number" && !rexclude.test(name) ) { - value += "px"; - } - - jQuery.style( elem, name, value ); + // Setting 'undefined' is a no-op + if ( arguments.length === 2 && value === undefined ) { + return this; + } + + return jQuery.access( this, name, value, true, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); }); }; jQuery.extend({ - style: function( elem, name, value ) { - // don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // ignore negative width and height values #1599 - if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) { - value = undefined; - } - - var style = elem.style || elem, set = value !== undefined; - - // IE uses filters for opacity - if ( !jQuery.support.opacity && name === "opacity" ) { - if ( set ) { - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // Set the alpha filter to set the opacity - var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"; - var filter = style.filter || jQuery.curCSS( elem, "filter" ) || ""; - style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity; - } - - return style.filter && style.filter.indexOf("opacity=") >= 0 ? - (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "": - ""; - } - - // Make sure we're using the right name for getting the float value - if ( rfloat.test( name ) ) { - name = styleFloat; - } - - name = name.replace(rdashAlpha, fcamelCase); - - if ( set ) { - style[ name ] = value; - } - - return style[ name ]; - }, - - css: function( elem, name, force, extra ) { - if ( name === "width" || name === "height" ) { - var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight; - - function getWH() { - val = name === "width" ? elem.offsetWidth : elem.offsetHeight; - - if ( extra === "border" ) { - return; - } - - jQuery.each( which, function() { - if ( !extra ) { - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; - } - - if ( extra === "margin" ) { - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; - } else { - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; - } - }); - } - - if ( elem.offsetWidth !== 0 ) { - getWH(); - } else { - jQuery.swap( elem, props, getWH ); - } - - return Math.max(0, Math.round(val)); - } - - return jQuery.curCSS( elem, name, force ); - }, - - curCSS: function( elem, name, force ) { - var ret, style = elem.style, filter; - - // IE uses filters for opacity - if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { - ret = ropacity.test(elem.currentStyle.filter || "") ? - (parseFloat(RegExp.$1) / 100) + "" : - ""; - - return ret === "" ? - "1" : - ret; - } - - // Make sure we're using the right name for getting the float value - if ( rfloat.test( name ) ) { - name = styleFloat; - } - - if ( !force && style && style[ name ] ) { - ret = style[ name ]; - - } else if ( getComputedStyle ) { - - // Only "float" is needed here - if ( rfloat.test( name ) ) { - name = "float"; - } - - name = name.replace( rupper, "-$1" ).toLowerCase(); - - var defaultView = elem.ownerDocument.defaultView; - - if ( !defaultView ) { - return null; - } - - var computedStyle = defaultView.getComputedStyle( elem, null ); - - if ( computedStyle ) { - ret = computedStyle.getPropertyValue( name ); - } - - // We should always get a number back from opacity - if ( name === "opacity" && ret === "" ) { - ret = "1"; - } - - } else if ( elem.currentStyle ) { - var camelCase = name.replace(rdashAlpha, fcamelCase); - - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { - // Remember the original values - var left = style.left, rsLeft = elem.runtimeStyle.left; - - // Put in the new values to get a computed value out - elem.runtimeStyle.left = elem.currentStyle.left; - style.left = camelCase === "fontSize" ? "1em" : (ret || 0); - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - elem.runtimeStyle.left = rsLeft; - } - } - - return ret; + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity", "opacity" ); + return ret === "" ? "1" : ret; + + } else { + return elem.style.opacity; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "zIndex": true, + "fontWeight": true, + "opacity": true, + "zoom": true, + "lineHeight": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, origName = jQuery.camelCase( name ), + style = elem.style, hooks = jQuery.cssHooks[ origName ]; + + name = jQuery.cssProps[ origName ] || origName; + + // Check if we're setting a value + if ( value !== undefined ) { + // Make sure that NaN and null values aren't set. See: #7116 + if ( typeof value === "number" && isNaN( value ) || value == null ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra ) { + // Make sure that we're working with the right name + var ret, origName = jQuery.camelCase( name ), + hooks = jQuery.cssHooks[ origName ]; + + name = jQuery.cssProps[ origName ] || origName; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { + return ret; + + // Otherwise, if a way to get the computed value exists, use that + } else if ( curCSS ) { + return curCSS( elem, name, origName ); + } }, // A method for quickly swapping in/out CSS properties to get correct calculations @@ -4746,55 +5788,328 @@ callback.call( elem ); // Revert the old values - for ( var name in options ) { + for ( name in options ) { elem.style[ name ] = old[ name ]; } + }, + + camelCase: function( string ) { + return string.replace( rdashAlpha, fcamelCase ); } }); +// DEPRECATED, Use jQuery.css() instead +jQuery.curCSS = jQuery.css; + +jQuery.each(["height", "width"], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + var val; + + if ( computed ) { + if ( elem.offsetWidth !== 0 ) { + val = getWH( elem, name, extra ); + + } else { + jQuery.swap( elem, cssShow, function() { + val = getWH( elem, name, extra ); + }); + } + + if ( val <= 0 ) { + val = curCSS( elem, name, name ); + + if ( val === "0px" && currentStyle ) { + val = currentStyle( elem, name, name ); + } + + if ( val != null ) { + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; + } + } + + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; + } + + return typeof val === "string" ? val : val + "px"; + } + }, + + set: function( elem, value ) { + if ( rnumpx.test( value ) ) { + // ignore negative width and height values #1599 + value = parseFloat(value); + + if ( value >= 0 ) { + return value + "px"; + } + + } else { + return value; + } + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? + (parseFloat(RegExp.$1) / 100) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // Set the alpha filter to set the opacity + var opacity = jQuery.isNaN(value) ? + "" : + "alpha(opacity=" + value * 100 + ")", + filter = style.filter || ""; + + style.filter = ralpha.test(filter) ? + filter.replace(ralpha, opacity) : + style.filter + ' ' + opacity; + } + }; +} + +if ( document.defaultView && document.defaultView.getComputedStyle ) { + getComputedStyle = function( elem, newName, name ) { + var ret, defaultView, computedStyle; + + name = name.replace( rupper, "-$1" ).toLowerCase(); + + if ( !(defaultView = elem.ownerDocument.defaultView) ) { + return undefined; + } + + if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) { + ret = computedStyle.getPropertyValue( name ); + if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + ret = jQuery.style( elem, name ); + } + } + + return ret; + }; +} + +if ( document.documentElement.currentStyle ) { + currentStyle = function( elem, name ) { + var left, + ret = elem.currentStyle && elem.currentStyle[ name ], + rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], + style = elem.style; + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { + // Remember the original values + left = style.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : (ret || 0); + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +curCSS = getComputedStyle || currentStyle; + +function getWH( elem, name, extra ) { + var which = name === "width" ? cssWidth : cssHeight, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight; + + if ( extra === "border" ) { + return val; + } + + jQuery.each( which, function() { + if ( !extra ) { + val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0; + } + + if ( extra === "margin" ) { + val += parseFloat(jQuery.css( elem, "margin" + this )) || 0; + + } else { + val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0; + } + }); + + return val; +} + if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { - var width = elem.offsetWidth, height = elem.offsetHeight, - skip = elem.nodeName.toLowerCase() === "tr"; - - return width === 0 && height === 0 && !skip ? - true : - width > 0 && height > 0 && !skip ? - false : - jQuery.curCSS(elem, "display") === "none"; + var width = elem.offsetWidth, + height = elem.offsetHeight; + + return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } -var jsc = now(), - rscript = /<script(.|\s)*?\/script>/gi, - rselectTextarea = /select|textarea/i, - rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, - jsre = /=\?(&|$)/, + + + + +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rhash = /#.*$/, + rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL + rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, rquery = /\?/, - rts = /(\?|&)_=.*?(&|$)/, - rurl = /^(\w+:)?\/\/([^\/?#]+)/, - r20 = /%20/g, + rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, + rselectTextarea = /^(?:select|textarea)/i, + rspacesAjax = /\s+/, + rts = /([?&])_=[^&]*/, + rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/, // Keep a copy of the old load method - _load = jQuery.fn.load; + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + if ( jQuery.isFunction( func ) ) { + var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), + i = 0, + length = dataTypes.length, + dataType, + list, + placeBefore; + + // For each dataType in the dataTypeExpression + for(; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +//Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ), + selection; + + for(; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jXHR ); + // If we got redirected to another dataType + // we try there if not done already + if ( typeof selection === "string" ) { + if ( inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} jQuery.fn.extend({ load: function( url, params, callback ) { - if ( typeof url !== "string" ) { - return _load.call( this, url ); + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); // Don't do a request if no elements are being requested } else if ( !this.length ) { return this; } - var off = url.indexOf(" "); + var off = url.indexOf( " " ); if ( off >= 0 ) { - var selector = url.slice(off, url.length); - url = url.slice(0, off); + var selector = url.slice( off, url.length ); + url = url.slice( 0, off ); } // Default to a GET request @@ -4823,26 +6138,34 @@ type: type, dataType: "html", data: params, - complete: function( res, status ) { + // Complete callback (responseText is used internally) + complete: function( jXHR, status, responseText ) { + // Store the response as specified by the jXHR object + responseText = jXHR.responseText; // If successful, inject the HTML into all the matched elements - if ( status === "success" || status === "notmodified" ) { + if ( jXHR.isResolved() ) { + // #4825: Get the actual response in case + // a dataFilter is present in ajaxSettings + jXHR.done(function( r ) { + responseText = r; + }); // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results - jQuery("<div />") + jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE - .append(res.responseText.replace(rscript, "")) + .append(responseText.replace(rscript, "")) // Locate the specified elements .find(selector) : // If not, just inject the full result - res.responseText ); + responseText ); } if ( callback ) { - self.each( callback, [res.responseText, status, res] ); + self.each( callback, [ responseText, status, jXHR ] ); } } }); @@ -4851,42 +6174,42 @@ }, serialize: function() { - return jQuery.param(this.serializeArray()); - }, + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { - return this.map(function() { - return this.elements ? jQuery.makeArray(this.elements) : this; + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; }) - .filter(function() { + .filter(function(){ return this.name && !this.disabled && - (this.checked || rselectTextarea.test(this.nodeName) || - rinput.test(this.type)); + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); }) - .map(function( i, elem ) { - var val = jQuery(this).val(); + .map(function( i, elem ){ + var val = jQuery( this ).val(); return val == null ? null : - jQuery.isArray(val) ? - jQuery.map( val, function( val, i ) { - return { name: elem.name, value: val }; + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : - { name: elem.name, value: val }; + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); // Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) { - jQuery.fn[o] = function( f ) { - return this.bind(o, f); +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.bind( o, f ); }; -}); - -jQuery.extend({ - - get: function( url, data, callback, type ) { - // shift arguments if data argument was omited +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; @@ -4894,41 +6217,30 @@ } return jQuery.ajax({ - type: "GET", + type: method, url: url, data: data, success: callback, dataType: type }); - }, + }; +} ); + +jQuery.extend({ getScript: function( url, callback ) { - return jQuery.get(url, null, callback, "script"); + return jQuery.get( url, null, callback, "script" ); }, getJSON: function( url, data, callback ) { - return jQuery.get(url, data, callback, "json"); - }, - - post: function( url, data, callback, type ) { - // shift arguments if data argument was omited - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = {}; - } - - return jQuery.ajax({ - type: "POST", - url: url, - data: data, - success: callback, - dataType: type - }); + return jQuery.get( url, data, callback, "json" ); }, ajaxSetup: function( settings ) { - jQuery.extend( jQuery.ajaxSettings, settings ); + jQuery.extend( true, jQuery.ajaxSettings, settings ); + if ( settings.context ) { + jQuery.ajaxSettings.context = settings.context; + } }, ajaxSettings: { @@ -4941,507 +6253,1035 @@ /* timeout: 0, data: null, + dataType: null, username: null, password: null, + cache: null, traditional: false, + headers: {}, + crossDomain: null, */ - // Create the request object; Microsoft failed to properly - // implement the XMLHttpRequest in IE7 (can't request local files), - // so we use the ActiveXObject when it is available - // This function can be overriden by calling jQuery.ajaxSetup - xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? - function() { - return new window.XMLHttpRequest(); - } : - function() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch(e) {} - }, + accepts: { xml: "application/xml, text/xml", html: "text/html", - script: "text/javascript, application/javascript", + text: "text/plain", json: "application/json, text/javascript", - text: "text/plain", - _default: "*/*" - } - }, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajax: function( origSettings ) { - var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings); - - var jsonp, status, data, - callbackContext = origSettings && origSettings.context || s, - type = s.type.toUpperCase(); - - // convert data if not already a string + "*": "*/*" + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If options is not an object, + // we simulate pre-1.5 signature + if ( typeof options !== "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // Create the final options object + s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ), + // Callbacks contexts + // We force the original context if it exists + // or take it from jQuery.ajaxSettings otherwise + // (plain objects used as context get extended) + callbackContext = + ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s, + globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ), + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery._Deferred(), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + loc = document.location, + protocol = loc.protocol || "http:", + parts, + // The jXHR state + state = 0, + // Loop variable + i, + // Fake xhr + jXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( state === 0 ) { + requestHeaders[ name.toLowerCase() ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match || null; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || "abort"; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, statusText, responses, headers) { + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jXHR.readyState = status ? 4 : 0; + + var isSuccess, + success, + error, + response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined, + lastModified, + etag; + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) { + jQuery.lastModified[ s.url ] = lastModified; + } + if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) { + jQuery.etag[ s.url ] = etag; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + try { + success = ajaxConvert( s, response ); + statusText = "success"; + isSuccess = true; + } catch(e) { + // We have a parsererror + statusText = "parsererror"; + error = e; + } + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if( status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jXHR.status = status; + jXHR.statusText = statusText; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( s.global ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] ); + + if ( s.global ) { + globalEventContext.trigger( "ajaxComplete", [ jXHR, s] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jXHR ); + jXHR.success = jXHR.done; + jXHR.error = jXHR.fail; + jXHR.complete = completeDeferred.done; + + // Status-dependent callbacks + jXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jXHR.status ]; + jXHR.then( tmp, tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); + + // Determine if a cross-domain request is in order + if ( !s.crossDomain ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( loc.port || ( protocol === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } - // Handle JSONP Parameter Callbacks - if ( s.dataType === "jsonp" ) { - if ( type === "GET" ) { - if ( !jsre.test( s.url ) ) { - s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?"; - } - } else if ( !s.data || !jsre.test(s.data) ) { - s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; - } - s.dataType = "json"; - } - - // Build temporary JSONP function - if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) { - jsonp = s.jsonpCallback || ("jsonp" + jsc++); - - // Replace the =? sequence both in the query string and the data + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jXHR ); + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( s.global && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url if ( s.data ) { - s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); - } - - s.url = s.url.replace(jsre, "=" + jsonp + "$1"); - - // We need to make sure - // that a JSONP style response is executed properly - s.dataType = "script"; - - // Handle JSONP-style loading - window[ jsonp ] = window[ jsonp ] || function( tmp ) { - data = tmp; - success(); - complete(); - // Garbage collect - window[ jsonp ] = undefined; + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + } + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + requestHeaders[ "content-type" ] = s.contentType; + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ s.url ] ) { + requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ]; + } + if ( jQuery.etag[ s.url ] ) { + requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ]; + } + } + + // Set the Accepts header for the server, depending on the dataType + requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : + s.accepts[ "*" ]; + + // Check for headers option + for ( i in s.headers ) { + requestHeaders[ i.toLowerCase() ] = s.headers[ i ]; + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) { + // Abort if not done already + done( 0, "abort" ); + // Return false + jXHR = false; + + } else { + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + // Set state as sending + state = jXHR.readyState = 1; + // Send global event + if ( s.global ) { + globalEventContext.trigger( "ajaxSend", [ jXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jXHR.abort( "timeout" ); + }, s.timeout ); + } try { - delete window[ jsonp ]; - } catch(e) {} - - if ( head ) { - head.removeChild( script ); - } - }; - } - - if ( s.dataType === "script" && s.cache === null ) { - s.cache = false; - } - - if ( s.cache === false && type === "GET" ) { - var ts = now(); - - // try replacing _= if it is there - var ret = s.url.replace(rts, "$1_=" + ts + "$2"); - - // if nothing was replaced, add timestamp to the end - s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); - } - - // If data is available, append data to url for get requests - if ( s.data && type === "GET" ) { - s.url += (rquery.test(s.url) ? "&" : "?") + s.data; - } - - // Watch for a new set of requests - if ( s.global && ! jQuery.active++ ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Matches an absolute URL, and saves the domain - var parts = rurl.exec( s.url ), - remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host); - - // If we're requesting a remote document - // and trying to load JSON or Script with a GET - if ( s.dataType === "script" && type === "GET" && remote ) { - var head = document.getElementsByTagName("head")[0] || document.documentElement; - var script = document.createElement("script"); - script.src = s.url; - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - // Handle Script loading - if ( !jsonp ) { - var done = false; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function() { - if ( !done && (!this.readyState || - this.readyState === "loaded" || this.readyState === "complete") ) { - done = true; - success(); - complete(); - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - if ( head && script.parentNode ) { - head.removeChild( script ); - } + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( status < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + jQuery.error( e ); } - }; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - - // We handle everything using the script element injection - return undefined; - } - - var requestDone = false; - - // Create the request object - var xhr = s.xhr(); - - if ( !xhr ) { - return; - } - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open(type, s.url, s.async, s.username, s.password); - } else { - xhr.open(type, s.url, s.async); - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - // Set the correct header, if data is being sent - if ( s.data || origSettings && origSettings.contentType ) { - xhr.setRequestHeader("Content-Type", s.contentType); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[s.url] ) { - xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); - } - - if ( jQuery.etag[s.url] ) { - xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); - } - } - - // Set header so the called script knows that it's an XMLHttpRequest - // Only send the header if it's not a remote XHR - if ( !remote ) { - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - } - - // Set the Accepts header for the server, depending on the dataType - xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? - s.accepts[ s.dataType ] + ", */*" : - s.accepts._default ); - } catch(e) {} - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { - // Handle the global AJAX counter - if ( s.global && ! --jQuery.active ) { - jQuery.event.trigger( "ajaxStop" ); - } - - // close opended socket - xhr.abort(); - return false; - } - - if ( s.global ) { - trigger("ajaxSend", [xhr, s]); - } - - // Wait for a response to come back - var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) { - // The request was aborted - if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) { - // Opera doesn't call onreadystatechange before this point - // so we simulate the call - if ( !requestDone ) { - complete(); - } - - requestDone = true; - if ( xhr ) { - xhr.onreadystatechange = jQuery.noop; - } - - // The transfer is complete and the data is available, or the request timed out - } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { - requestDone = true; - xhr.onreadystatechange = jQuery.noop; - - status = isTimeout === "timeout" ? - "timeout" : - !jQuery.httpSuccess( xhr ) ? - "error" : - s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? - "notmodified" : - "success"; - - var errMsg; - - if ( status === "success" ) { - // Watch for, and catch, XML document parse errors - try { - // process the data (runs the xml through httpData regardless of callback) - data = jQuery.httpData( xhr, s.dataType, s ); - } catch(err) { - status = "parsererror"; - errMsg = err; - } - } - - // Make sure that the request was successful or notmodified - if ( status === "success" || status === "notmodified" ) { - // JSONP handles its own success callback - if ( !jsonp ) { - success(); - } - } else { - jQuery.handleError(s, xhr, status, errMsg); - } - - // Fire the complete handlers - complete(); - - if ( isTimeout === "timeout" ) { - xhr.abort(); - } - - // Stop memory leaks - if ( s.async ) { - xhr = null; - } - } - }; - - // Override the abort handler, if we can (IE doesn't allow it, but that's OK) - // Opera doesn't fire onreadystatechange at all on abort - try { - var oldAbort = xhr.abort; - xhr.abort = function() { - if ( xhr ) { - oldAbort.call( xhr ); - } - - onreadystatechange( "abort" ); - }; - } catch(e) { } - - // Timeout checker - if ( s.async && s.timeout > 0 ) { - setTimeout(function() { - // Check to see if the request is still happening - if ( xhr && !requestDone ) { - onreadystatechange( "timeout" ); - } - }, s.timeout); - } - - // Send the data - try { - xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); - } catch(e) { - jQuery.handleError(s, xhr, null, e); - // Fire the complete handlers - complete(); - } - - // firefox 1.5 doesn't fire statechange for sync requests - if ( !s.async ) { - onreadystatechange(); - } - - function success() { - // If a local callback was specified, fire it and pass it the data - if ( s.success ) { - s.success.call( callbackContext, data, status, xhr ); - } - - // Fire the global callback - if ( s.global ) { - trigger( "ajaxSuccess", [xhr, s] ); - } - } - - function complete() { - // Process result - if ( s.complete ) { - s.complete.call( callbackContext, xhr, status); - } - - // The request was completed - if ( s.global ) { - trigger( "ajaxComplete", [xhr, s] ); - } - - // Handle the global AJAX counter - if ( s.global && ! --jQuery.active ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - - function trigger(type, args) { - (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); - } - - // return XMLHttpRequest to allow aborting the request etc. - return xhr; - }, - - handleError: function( s, xhr, status, e ) { - // If a local callback was specified, fire it - if ( s.error ) { - s.error.call( s.context || s, xhr, status, e ); - } - - // Fire the global callback - if ( s.global ) { - (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] ); - } - }, - - // Counter for holding the number of active queries - active: 0, - - // Determines if an XMLHttpRequest was successful or not - httpSuccess: function( xhr ) { - try { - // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 - return !xhr.status && location.protocol === "file:" || - // Opera returns 0 when status is 304 - ( xhr.status >= 200 && xhr.status < 300 ) || - xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; - } catch(e) {} - - return false; - }, - - // Determines if an XMLHttpRequest returns NotModified - httpNotModified: function( xhr, url ) { - var lastModified = xhr.getResponseHeader("Last-Modified"), - etag = xhr.getResponseHeader("Etag"); - - if ( lastModified ) { - jQuery.lastModified[url] = lastModified; - } - - if ( etag ) { - jQuery.etag[url] = etag; - } - - // Opera returns 0 when status is 304 - return xhr.status === 304 || xhr.status === 0; - }, - - httpData: function( xhr, type, s ) { - var ct = xhr.getResponseHeader("content-type") || "", - xml = type === "xml" || !type && ct.indexOf("xml") >= 0, - data = xml ? xhr.responseXML : xhr.responseText; - - if ( xml && data.documentElement.nodeName === "parsererror" ) { - jQuery.error( "parsererror" ); - } - - // Allow a pre-filtering function to sanitize the response - // s is checked to keep backwards compatibility - if ( s && s.dataFilter ) { - data = s.dataFilter( data, type ); - } - - // The filter can actually parse the response - if ( typeof data === "string" ) { - // Get the JavaScript object, if JSON is used. - if ( type === "json" || !type && ct.indexOf("json") >= 0 ) { - data = jQuery.parseJSON( data ); - - // If the type is "script", eval it in global context - } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) { - jQuery.globalEval( data ); - } - } - - return data; + } + } + } + return jXHR; }, // Serialize an array of form elements or a set of // key/values into a query string param: function( a, traditional ) { - var s = []; - + var s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : value; + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings.traditional; } - + // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray(a) || a.jquery ) { + if ( jQuery.isArray( a ) || a.jquery ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); - }); - + } ); + } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( var prefix in a ) { - buildParams( prefix, a[prefix] ); + buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization - return s.join("&").replace(r20, "+"); - - function buildParams( prefix, obj ) { - if ( jQuery.isArray(obj) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || /\[\]$/.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); - } - }); - - } else if ( !traditional && obj != null && typeof obj === "object" ) { - // Serialize object item. - jQuery.each( obj, function( k, v ) { - buildParams( prefix + "[" + k + "]", v ); - }); - - } else { - // Serialize scalar item. - add( prefix, obj ); - } - } - - function add( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction(value) ? value() : value; - s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); - } + return s.join( "&" ).replace( r20, "+" ); } }); + +function buildParams( prefix, obj, traditional, add ) { + if ( jQuery.isArray( obj ) && obj.length ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && obj != null && typeof obj === "object" ) { + // If we see an array here, it is empty and should be treated as an empty + // object + if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) { + add( prefix, "" ); + + // Serialize object item. + } else { + jQuery.each( obj, function( k, v ) { + buildParams( prefix + "[" + k + "]", v, traditional, add ); + }); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} + +// This is still on the jQuery object... for now +// Want to move this to jQuery.ajax some day +jQuery.extend({ + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jXHR, responses ) { + + var contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields, + ct, + type, + finalDataType, + firstDataType; + + // Fill responseXXX fields + for( type in responseFields ) { + if ( type in responses ) { + jXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = jXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + var dataTypes = s.dataTypes, + converters = s.converters, + i, + length = dataTypes.length, + tmp, + // Current and previous dataTypes + current = dataTypes[ 0 ], + prev, + // Conversion expression + conversion, + // Conversion function + conv, + // Conversion functions (transitive conversion) + conv1, + conv2; + + // For each dataType in the chain + for( i = 1; i < length; i++ ) { + + // Get the dataTypes + prev = current; + current = dataTypes[ i ]; + + // If current is auto dataType, update it to prev + if( current === "*" ) { + current = prev; + // If no auto and dataTypes are actually different + } else if ( prev !== "*" && prev !== current ) { + + // Get the converter + conversion = prev + " " + current; + conv = converters[ conversion ] || converters[ "* " + current ]; + + // If there is no direct converter, search transitively + if ( !conv ) { + conv2 = undefined; + for( conv1 in converters ) { + tmp = conv1.split( " " ); + if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { + conv2 = converters[ tmp[1] + " " + current ]; + if ( conv2 ) { + conv1 = converters[ conv1 ]; + if ( conv1 === true ) { + conv = conv2; + } else if ( conv2 === true ) { + conv = conv1; + } + break; + } + } + } + } + // If we found no converter, dispatch an error + if ( !( conv || conv2 ) ) { + jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); + } + // If found converter is not an equivalence + if ( conv !== true ) { + // Convert with 1 or 2 converters accordingly + response = conv ? conv( response ) : conv2( conv1(response) ); + } + } + } + return response; +} + + + + +var jsc = jQuery.now(), + jsre = /(\=)\?(&|$)|()\?\?()/i; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + return jQuery.expando + "_" + ( jsc++ ); + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { + + dataIsString = ( typeof s.data === "string" ); + + if ( s.dataTypes[ 0 ] === "jsonp" || + originalSettings.jsonpCallback || + originalSettings.jsonp != null || + s.jsonp !== false && ( jsre.test( s.url ) || + dataIsString && jsre.test( s.data ) ) ) { + + var responseContainer, + jsonpCallback = s.jsonpCallback = + jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, + previous = window[ jsonpCallback ], + url = s.url, + data = s.data, + replace = "$1" + jsonpCallback + "$2"; + + if ( s.jsonp !== false ) { + url = url.replace( jsre, replace ); + if ( s.url === url ) { + if ( dataIsString ) { + data = data.replace( jsre, replace ); + } + if ( s.data === data ) { + // Add callback manually + url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; + } + } + } + + s.url = url; + s.data = data; + + window[ jsonpCallback ] = function( response ) { + responseContainer = [ response ]; + }; + + s.complete = [ function() { + + // Set callback back to previous value + window[ jsonpCallback ] = previous; + + // Call if it was a function and we have a response + if ( previous) { + if ( responseContainer && jQuery.isFunction( previous ) ) { + window[ jsonpCallback ] ( responseContainer[ 0 ] ); + } + } else { + // else, more memory leak avoidance + try{ + delete window[ jsonpCallback ]; + } catch( e ) {} + } + + }, s.complete ]; + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( ! responseContainer ) { + jQuery.error( jsonpCallback + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Delegate to script + return "script"; + } +} ); + + + + +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript" + }, + contents: { + script: /javascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +} ); + + + + +var // Next active xhr id + xhrId = jQuery.now(), + + // active xhrs + xhrs = {}, + + // #5280: see below + xhrUnloadAbortInstalled, + + // XHR used to determine supports properties + testXHR; + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + if ( window.location.protocol !== "file:" ) { + try { + return new window.XMLHttpRequest(); + } catch( xhrError ) {} + } + + try { + return new window.ActiveXObject("Microsoft.XMLHTTP"); + } catch( activeError ) {} + } : + // For all other browsers, use the standard XMLHttpRequest object + function() { + return new window.XMLHttpRequest(); + }; + +// Test if we can create an xhr object +try { + testXHR = jQuery.ajaxSettings.xhr(); +} catch( xhrCreationException ) {} + +//Does this browser support XHR requests? +jQuery.support.ajax = !!testXHR; + +// Does this browser support crossDomain XHR requests +jQuery.support.cors = testXHR && ( "withCredentials" in testXHR ); + +// No need for the temporary xhr anymore +testXHR = undefined; + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // #5280: we need to abort on unload or IE will keep connections alive + if ( !xhrUnloadAbortInstalled ) { + + xhrUnloadAbortInstalled = 1; + + jQuery(window).bind( "unload", function() { + + // Abort all pending requests + jQuery.each( xhrs, function( _, xhr ) { + if ( xhr.onreadystatechange ) { + xhr.onreadystatechange( 1 ); + } + } ); + + } ); + } + + // Get a new xhr + var xhr = s.xhr(), + handle; + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Requested-With header + // Not set for crossDomain requests with no content + // (see why at http://trac.dojotoolkit.org/ticket/9486) + // Won't change header if already provided + if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) { + headers[ "x-requested-with" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + jQuery.each( headers, function( key, value ) { + xhr.setRequestHeader( key, value ); + } ); + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = 0; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + delete xhrs[ handle ]; + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + // Get info + var status = xhr.status, + statusText, + responseHeaders = xhr.getAllResponseHeaders(), + responses = {}, + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + responses.text = xhr.responseText; + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviours + status = + // Opera returns 0 when it should be 304 + // Webkit returns 0 for failing cross-domain no matter the real status + status === 0 ? + ( + // Webkit, Firefox: filter out faulty cross-domain requests + !s.crossDomain || statusText ? + ( + // Opera: filter out real aborts #6060 + responseHeaders ? + 304 : + 0 + ) : + // We assume 302 but could be anything cross-domain related + 302 + ) : + ( + // IE sometimes returns 1223 when it should be 204 (see #1450) + status == 1223 ? + 204 : + status + ); + + // Call complete + complete( status, statusText, responses, responseHeaders ); + } + } + }; + + // if we're in sync mode or it's in cache + // and has been retrieved directly (IE6 & IE7) + // we need to manually fire the callback + if ( !s.async || xhr.readyState === 4 ) { + callback(); + } else { + // Add to list of active xhrs + handle = xhrId++; + xhrs[ handle ] = xhr; + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} + + + + var elemdisplay = {}, - rfxtypes = /toggle|show|hide/, - rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, timerId, fxAttrs = [ // height animations @@ -5453,66 +7293,63 @@ ]; jQuery.fn.extend({ - show: function( speed, callback ) { - if ( speed || speed === 0) { - return this.animate( genFx("show", 3), speed, callback); + show: function( speed, easing, callback ) { + var elem, display; + + if ( speed || speed === 0 ) { + return this.animate( genFx("show", 3), speed, easing, callback); } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - var old = jQuery.data(this[i], "olddisplay"); - - this[i].style.display = old || ""; - - if ( jQuery.css(this[i], "display") === "none" ) { - var nodeName = this[i].nodeName, display; - - if ( elemdisplay[ nodeName ] ) { - display = elemdisplay[ nodeName ]; - - } else { - var elem = jQuery("<" + nodeName + " />").appendTo("body"); - - display = elem.css("display"); - - if ( display === "none" ) { - display = "block"; - } - - elem.remove(); - - elemdisplay[ nodeName ] = display; - } - - jQuery.data(this[i], "olddisplay", display); + for ( var i = 0, j = this.length; i < j; i++ ) { + elem = this[i]; + display = elem.style.display; + + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { + display = elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { + jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( i = 0; i < j; i++ ) { + elem = this[i]; + display = elem.style.display; + + if ( display === "" || display === "none" ) { + elem.style.display = jQuery._data(elem, "olddisplay") || ""; + } + } + + return this; + } + }, + + hide: function( speed, easing, callback ) { + if ( speed || speed === 0 ) { + return this.animate( genFx("hide", 3), speed, easing, callback); + + } else { + for ( var i = 0, j = this.length; i < j; i++ ) { + var display = jQuery.css( this[i], "display" ); + + if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { + jQuery._data( this[i], "olddisplay", display ); } } // Set the display of the elements in a second loop // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ) { - this[j].style.display = jQuery.data(this[j], "olddisplay") || ""; - } - - return this; - } - }, - - hide: function( speed, callback ) { - if ( speed || speed === 0 ) { - return this.animate( genFx("hide", 3), speed, callback); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - var old = jQuery.data(this[i], "olddisplay"); - if ( !old && old !== "none" ) { - jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); - } - } - - // Set the display of the elements in a second loop - // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ) { - this[j].style.display = "none"; + for ( i = 0; i < j; i++ ) { + this[i].style.display = "none"; } return this; @@ -5522,7 +7359,7 @@ // Save the old toggle function _toggle: jQuery.fn.toggle, - toggle: function( fn, fn2 ) { + toggle: function( fn, fn2, callback ) { var bool = typeof fn === "boolean"; if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { @@ -5535,15 +7372,15 @@ }); } else { - this.animate(genFx("toggle", 3), fn, fn2); + this.animate(genFx("toggle", 3), fn, fn2, callback); } return this; }, - fadeTo: function( speed, to, callback ) { + fadeTo: function( speed, to, easing, callback ) { return this.filter(":hidden").css("opacity", 0).show().end() - .animate({opacity: to}, speed, callback); + .animate({opacity: to}, speed, easing, callback); }, animate: function( prop, speed, easing, callback ) { @@ -5554,12 +7391,16 @@ } return this[ optall.queue === false ? "each" : "queue" ](function() { + // XXX 'this' does not always have a nodeName when running the + // test suite + var opt = jQuery.extend({}, optall), p, - hidden = this.nodeType === 1 && jQuery(this).is(":hidden"), + isElement = this.nodeType === 1, + hidden = isElement && jQuery(this).is(":hidden"), self = this; for ( p in prop ) { - var name = p.replace(rdashAlpha, fcamelCase); + var name = jQuery.camelCase( p ); if ( p !== name ) { prop[ name ] = prop[ p ]; @@ -5571,12 +7412,35 @@ return opt.complete.call(this); } - if ( ( p === "height" || p === "width" ) && this.style ) { - // Store display property - opt.display = jQuery.css(this, "display"); - + if ( isElement && ( p === "height" || p === "width" ) ) { // Make sure that nothing sneaks out - opt.overflow = this.style.overflow; + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height + // animated + if ( jQuery.css( this, "display" ) === "inline" && + jQuery.css( this, "float" ) === "none" ) { + if ( !jQuery.support.inlineBlockNeedsLayout ) { + this.style.display = "inline-block"; + + } else { + var display = defaultDisplay(this.nodeName); + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( display === "inline" ) { + this.style.display = "inline-block"; + + } else { + this.style.display = "inline"; + this.style.zoom = 1; + } + } + } } if ( jQuery.isArray( prop[p] ) ) { @@ -5600,7 +7464,7 @@ } else { var parts = rfxnum.exec(val), - start = e.cur(true) || 0; + start = e.cur() || 0; if ( parts ) { var end = parseFloat( parts[2] ), @@ -5608,9 +7472,9 @@ // We need to compute starting value if ( unit !== "px" ) { - self.style[ name ] = (end || 1) + unit; - start = ((end || 1) / e.cur(true)) * start; - self.style[ name ] = start + unit; + jQuery.style( self, name, (end || 1) + unit); + start = ((end || 1) / e.cur()) * start; + jQuery.style( self, name, start + unit); } // If a +=/-= token was provided, we're doing a relative animation @@ -5662,22 +7526,33 @@ }); +function genFx( type, num ) { + var obj = {}; + + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { + obj[ this ] = type; + }); + + return obj; +} + // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show", 1), slideUp: genFx("hide", 1), slideToggle: genFx("toggle", 1), fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" } + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } }, function( name, props ) { - jQuery.fn[ name ] = function( speed, callback ) { - return this.animate( props, speed, callback ); + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); }; }); jQuery.extend({ speed: function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? speed : { + var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, @@ -5685,7 +7560,7 @@ }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; // Queueing opt.old = opt.complete; @@ -5732,33 +7607,30 @@ } (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); - - // Set display property to block for height/width animations - if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) { - this.elem.style.display = "block"; - } }, // Get the current size - cur: function( force ) { + cur: function() { if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { return this.elem[ this.prop ]; } - var r = parseFloat(jQuery.css(this.elem, this.prop, force)); - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; + var r = parseFloat( jQuery.css( this.elem, this.prop ) ); + return r || 0; }, // Start an animation from one number to another custom: function( from, to, unit ) { - this.startTime = now(); + var self = this, + fx = jQuery.fx; + + this.startTime = jQuery.now(); this.start = from; this.end = to; this.unit = unit || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; - var self = this; function t( gotoEnd ) { return self.step(gotoEnd); } @@ -5766,7 +7638,7 @@ t.elem = this.elem; if ( t() && jQuery.timers.push(t) && !timerId ) { - timerId = setInterval(jQuery.fx.tick, 13); + timerId = setInterval(fx.tick, fx.interval); } }, @@ -5797,7 +7669,7 @@ // Each step of an animation step: function( gotoEnd ) { - var t = now(), done = true; + var t = jQuery.now(), done = true; if ( gotoEnd || t >= this.options.duration + this.startTime ) { this.now = this.end; @@ -5813,17 +7685,14 @@ } if ( done ) { - if ( this.options.display != null ) { - // Reset the overflow - this.elem.style.overflow = this.options.overflow; - - // Reset the display - var old = jQuery.data(this.elem, "olddisplay"); - this.elem.style.display = old ? old : this.options.display; - - if ( jQuery.css(this.elem, "display") === "none" ) { - this.elem.style.display = "block"; - } + // Reset the overflow + if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { + var elem = this.elem, + options = this.options; + + jQuery.each( [ "", "X", "Y" ], function (index, value) { + elem.style[ "overflow" + value ] = options.overflow[index]; + } ); } // Hide the element if the "hide" operation was done @@ -5834,7 +7703,7 @@ // Reset the properties, if the item has been hidden or shown if ( this.options.hide || this.options.show ) { for ( var p in this.options.curAnim ) { - jQuery.style(this.elem, p, this.options.orig[p]); + jQuery.style( this.elem, p, this.options.orig[p] ); } } @@ -5876,22 +7745,24 @@ jQuery.fx.stop(); } }, - + + interval: 13, + stop: function() { clearInterval( timerId ); timerId = null; }, - + speeds: { slow: 600, - fast: 200, - // Default speed - _default: 400 + fast: 200, + // Default speed + _default: 400 }, step: { opacity: function( fx ) { - jQuery.style(fx.elem, "opacity", fx.now); + jQuery.style( fx.elem, "opacity", fx.now ); }, _default: function( fx ) { @@ -5912,20 +7783,34 @@ }; } -function genFx( type, num ) { - var obj = {}; - - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { - obj[ this ] = type; - }); - - return obj; +function defaultDisplay( nodeName ) { + if ( !elemdisplay[ nodeName ] ) { + var elem = jQuery("<" + nodeName + ">").appendTo("body"), + display = elem.css("display"); + + elem.remove(); + + if ( display === "none" || display === "" ) { + display = "block"; + } + + elemdisplay[ nodeName ] = display; + } + + return elemdisplay[ nodeName ]; } + + + + +var rtable = /^t(?:able|d|h)$/i, + rroot = /^(?:body|html)$/i; + if ( "getBoundingClientRect" in document.documentElement ) { jQuery.fn.offset = function( options ) { - var elem = this[0]; - - if ( options ) { + var elem = this[0], box; + + if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); @@ -5939,10 +7824,26 @@ return jQuery.offset.bodyOffset( elem ); } - var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, - clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, - top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, - left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; + try { + box = elem.getBoundingClientRect(); + } catch(e) {} + + var doc = elem.ownerDocument, + docElem = doc.documentElement; + + // Make sure we're not dealing with a disconnected DOM node + if ( !box || !jQuery.contains( docElem, elem ) ) { + return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; + } + + var body = doc.body, + win = getWindow(doc), + clientTop = docElem.clientTop || body.clientTop || 0, + clientLeft = docElem.clientLeft || body.clientLeft || 0, + scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ), + scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft), + top = box.top + scrollTop - clientTop, + left = box.left + scrollLeft - clientLeft; return { top: top, left: left }; }; @@ -5951,7 +7852,7 @@ jQuery.fn.offset = function( options ) { var elem = this[0]; - if ( options ) { + if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); @@ -5967,11 +7868,16 @@ jQuery.offset.initialize(); - var offsetParent = elem.offsetParent, prevOffsetParent = elem, - doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, - body = doc.body, defaultView = doc.defaultView, + var computedStyle, + offsetParent = elem.offsetParent, + prevOffsetParent = elem, + doc = elem.ownerDocument, + docElem = doc.documentElement, + body = doc.body, + defaultView = doc.defaultView, prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, - top = elem.offsetTop, left = elem.offsetLeft; + top = elem.offsetTop, + left = elem.offsetLeft; while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { @@ -5986,12 +7892,13 @@ top += elem.offsetTop; left += elem.offsetLeft; - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { + if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } - prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; + prevOffsetParent = offsetParent; + offsetParent = elem.offsetParent; } if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { @@ -6018,7 +7925,7 @@ jQuery.offset = { initialize: function() { - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0, + var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0, html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); @@ -6032,12 +7939,16 @@ this.doesNotAddBorder = (checkDiv.offsetTop !== 5); this.doesAddBorderForTableAndCells = (td.offsetTop === 5); - checkDiv.style.position = "fixed", checkDiv.style.top = "20px"; + checkDiv.style.position = "fixed"; + checkDiv.style.top = "20px"; + // safari subtracts parent border width here which is 5px this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); checkDiv.style.position = checkDiv.style.top = ""; - innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative"; + innerDiv.style.overflow = "hidden"; + innerDiv.style.position = "relative"; + this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); @@ -6048,37 +7959,53 @@ }, bodyOffset: function( body ) { - var top = body.offsetTop, left = body.offsetLeft; + var top = body.offsetTop, + left = body.offsetLeft; jQuery.offset.initialize(); if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0; - left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0; + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, - + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + // set position first, in-case top/left are set even on static elem - if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) { + if ( position === "static" ) { elem.style.position = "relative"; } - var curElem = jQuery( elem ), + + var curElem = jQuery( elem ), curOffset = curElem.offset(), - curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0, - curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0; + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is absolute + if ( calculatePosition ) { + curPosition = curElem.position(); + } + + curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; + curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } - var props = { - top: (options.top - curOffset.top) + curTop, - left: (options.left - curOffset.left) + curLeft - }; - + if (options.top != null) { + props.top = (options.top - curOffset.top) + curTop; + } + if (options.left != null) { + props.left = (options.left - curOffset.left) + curLeft; + } + if ( "using" in options ) { options.using.call( elem, props ); } else { @@ -6101,17 +8028,17 @@ // Get correct offsets offset = this.offset(), - parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0; - offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0; + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0; - parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0; + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { @@ -6123,7 +8050,7 @@ offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent; @@ -6138,7 +8065,7 @@ jQuery.fn[ method ] = function(val) { var elem = this[0], win; - + if ( !elem ) { return null; } @@ -6171,12 +8098,16 @@ }); function getWindow( elem ) { - return ("scrollTo" in elem && elem.document) ? + return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } + + + + // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function( i, name ) { @@ -6185,14 +8116,14 @@ // innerHeight and innerWidth jQuery.fn["inner" + name] = function() { return this[0] ? - jQuery.css( this[0], type, false, "padding" ) : + parseFloat( jQuery.css( this[0], type, "padding" ) ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function( margin ) { return this[0] ? - jQuery.css( this[0], type, false, margin ? "margin" : "border" ) : + parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) : null; }; @@ -6202,7 +8133,7 @@ if ( !elem ) { return size == null ? null : this; } - + if ( jQuery.isFunction( size ) ) { return this.each(function( i ) { var self = jQuery( this ); @@ -6210,31 +8141,36 @@ }); } - return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window? + if ( jQuery.isWindow( elem ) ) { // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode - elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || - elem.document.body[ "client" + name ] : - - // Get document width or height - (elem.nodeType === 9) ? // is it a document - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater - Math.max( - elem.documentElement["client" + name], - elem.body["scroll" + name], elem.documentElement["scroll" + name], - elem.body["offset" + name], elem.documentElement["offset" + name] - ) : - - // Get or set width or height on the element - size === undefined ? - // Get width or height on the element - jQuery.css( elem, type ) : - - // Set the width or height on the element (default to pixels if value is unitless) - this.css( type, typeof size === "string" ? size : size + "px" ); + // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat + var docElemProp = elem.document.documentElement[ "client" + name ]; + return elem.document.compatMode === "CSS1Compat" && docElemProp || + elem.document.body[ "client" + name ] || docElemProp; + + // Get document width or height + } else if ( elem.nodeType === 9 ) { + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater + return Math.max( + elem.documentElement["client" + name], + elem.body["scroll" + name], elem.documentElement["scroll" + name], + elem.body["offset" + name], elem.documentElement["offset" + name] + ); + + // Get or set width or height on the element + } else if ( size === undefined ) { + var orig = jQuery.css( elem, type ), + ret = parseFloat( orig ); + + return jQuery.isNaN( ret ) ? orig : ret; + + // Set the width or height on the element (default to pixels if value is unitless) + } else { + return this.css( type, typeof size === "string" ? size : size + "px" ); + } }; }); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; + })(window); --- a/static/scripts/packed/jquery.js Sun Feb 06 11:29:04 2011 -0500 +++ b/static/scripts/packed/jquery.js Sun Feb 06 14:42:11 2011 -0500 @@ -1,8 +1,8 @@ -(function(aM,C){var a=function(aY,aZ){return new a.fn.init(aY,aZ)},n=aM.jQuery,R=aM.$,ab=aM.document,X,P=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,aW=/^.[^:#\[\.,]*$/,ax=/\S/,M=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,e=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,b=navigator.userAgent,u,K=false,ad=[],aG,at=Object.prototype.toString,ap=Object.prototype.hasOwnProperty,g=Array.prototype.push,F=Array.prototype.slice,s=Array.prototype.indexOf;a.fn=a.prototype={init:function(aY,a1){var a0,a2,aZ,a3;if(!aY){return this}if(aY.nodeType){this.context=this[0]=aY;this.length=1;return this}if(aY==="body"&&!a1){this.context=ab;this[0]=ab.body;this.selector="body";this.length=1;return this}if(typeof aY==="string"){a0=P.exec(aY);if(a0&&(a0[1]||!a1)){if(a0[1]){a3=(a1?a1.ownerDocument||a1:ab);aZ=e.exec(aY);if(aZ){if(a.isPlainObject(a1)){aY=[ab.createElement(aZ[1])];a.fn.attr.call(aY,a1,true)}else{aY=[a3.createElement(aZ[1])]}}else{aZ=J([a0[1]],[a3]);aY=(aZ.cacheable?aZ.fragment.cloneNode(true):aZ.fragment).childNodes}return a.merge(this,aY)}else{a2=ab.getElementById(a0[2]);if(a2){if(a2.id!==a0[2]){return X.find(aY)}this.length=1;this[0]=a2}this.context=ab;this.selector=aY;return this}}else{if(!a1&&/^\w+$/.test(aY)){this.selector=aY;this.context=ab;aY=ab.getElementsByTagName(aY);return a.merge(this,aY)}else{if(!a1||a1.jquery){return(a1||X).find(aY)}else{return a(a1).find(aY)}}}}else{if(a.isFunction(aY)){return X.ready(aY)}}if(aY.selector!==C){this.selector=aY.selector;this.context=aY.context}return a.makeArray(aY,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(aY){return aY==null?this.toArray():(aY<0?this.slice(aY)[0]:this[aY])},pushStack:function(aZ,a1,aY){var a0=a();if(a.isArray(aZ)){g.apply(a0,aZ)}else{a.merge(a0,aZ)}a0.prevObject=this;a0.context=this.context;if(a1==="find"){a0.selector=this.selector+(this.selector?" ":"")+aY}else{if(a1){a0.selector=this.selector+"."+a1+"("+aY+")"}}return a0},each:function(aZ,aY){return a.each(this,aZ,aY)},ready:function(aY){a.bindReady();if(a.isReady){aY.call(ab,a)}else{if(ad){ad.push(aY)}}return this},eq:function(aY){return aY===-1?this.slice(aY):this.slice(aY,+aY+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(aY){return this.pushStack(a.map(this,function(a0,aZ){return aY.call(a0,aZ,a0)}))},end:function(){return this.prevObject||a(null)},push:g,sort:[].sort,splice:[].splice};a.fn.init.prototype=a.fn;a.extend=a.fn.extend=function(){var a3=arguments[0]||{},a2=1,a1=arguments.length,a5=false,a6,a0,aY,aZ;if(typeof a3==="boolean"){a5=a3;a3=arguments[1]||{};a2=2}if(typeof a3!=="object"&&!a.isFunction(a3)){a3={}}if(a1===a2){a3=this;--a2}for(;a2<a1;a2++){if((a6=arguments[a2])!=null){for(a0 in a6){aY=a3[a0];aZ=a6[a0];if(a3===aZ){continue}if(a5&&aZ&&(a.isPlainObject(aZ)||a.isArray(aZ))){var a4=aY&&(a.isPlainObject(aY)||a.isArray(aY))?aY:a.isArray(aZ)?[]:{};a3[a0]=a.extend(a5,a4,aZ)}else{if(aZ!==C){a3[a0]=aZ}}}}}return a3};a.extend({noConflict:function(aY){aM.$=R;if(aY){aM.jQuery=n}return a},isReady:false,ready:function(){if(!a.isReady){if(!ab.body){return setTimeout(a.ready,13)}a.isReady=true;if(ad){var aZ,aY=0;while((aZ=ad[aY++])){aZ.call(ab,a)}ad=null}if(a.fn.triggerHandler){a(ab).triggerHandler("ready")}}},bindReady:function(){if(K){return}K=true;if(ab.readyState==="complete"){return a.ready()}if(ab.addEventListener){ab.addEventListener("DOMContentLoaded",aG,false);aM.addEventListener("load",a.ready,false)}else{if(ab.attachEvent){ab.attachEvent("onreadystatechange",aG);aM.attachEvent("onload",a.ready);var aY=false;try{aY=aM.frameElement==null}catch(aZ){}if(ab.documentElement.doScroll&&aY){x()}}}},isFunction:function(aY){return at.call(aY)==="[object Function]"},isArray:function(aY){return at.call(aY)==="[object Array]"},isPlainObject:function(aZ){if(!aZ||at.call(aZ)!=="[object Object]"||aZ.nodeType||aZ.setInterval){return false}if(aZ.constructor&&!ap.call(aZ,"constructor")&&!ap.call(aZ.constructor.prototype,"isPrototypeOf")){return false}var aY;for(aY in aZ){}return aY===C||ap.call(aZ,aY)},isEmptyObject:function(aZ){for(var aY in aZ){return false}return true},error:function(aY){throw aY},parseJSON:function(aY){if(typeof aY!=="string"||!aY){return null}aY=a.trim(aY);if(/^[\],:{}\s]*$/.test(aY.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return aM.JSON&&aM.JSON.parse?aM.JSON.parse(aY):(new Function("return "+aY))()}else{a.error("Invalid JSON: "+aY)}},noop:function(){},globalEval:function(a0){if(a0&&ax.test(a0)){var aZ=ab.getElementsByTagName("head")[0]||ab.documentElement,aY=ab.createElement("script");aY.type="text/javascript";if(a.support.scriptEval){aY.appendChild(ab.createTextNode(a0))}else{aY.text=a0}aZ.insertBefore(aY,aZ.firstChild);aZ.removeChild(aY)}},nodeName:function(aZ,aY){return aZ.nodeName&&aZ.nodeName.toUpperCase()===aY.toUpperCase()},each:function(a1,a5,a0){var aZ,a2=0,a3=a1.length,aY=a3===C||a.isFunction(a1);if(a0){if(aY){for(aZ in a1){if(a5.apply(a1[aZ],a0)===false){break}}}else{for(;a2<a3;){if(a5.apply(a1[a2++],a0)===false){break}}}}else{if(aY){for(aZ in a1){if(a5.call(a1[aZ],aZ,a1[aZ])===false){break}}}else{for(var a4=a1[0];a2<a3&&a5.call(a4,a2,a4)!==false;a4=a1[++a2]){}}}return a1},trim:function(aY){return(aY||"").replace(M,"")},makeArray:function(a0,aZ){var aY=aZ||[];if(a0!=null){if(a0.length==null||typeof a0==="string"||a.isFunction(a0)||(typeof a0!=="function"&&a0.setInterval)){g.call(aY,a0)}else{a.merge(aY,a0)}}return aY},inArray:function(a0,a1){if(a1.indexOf){return a1.indexOf(a0)}for(var aY=0,aZ=a1.length;aY<aZ;aY++){if(a1[aY]===a0){return aY}}return -1},merge:function(a2,a0){var a1=a2.length,aZ=0;if(typeof a0.length==="number"){for(var aY=a0.length;aZ<aY;aZ++){a2[a1++]=a0[aZ]}}else{while(a0[aZ]!==C){a2[a1++]=a0[aZ++]}}a2.length=a1;return a2},grep:function(aZ,a3,aY){var a0=[];for(var a1=0,a2=aZ.length;a1<a2;a1++){if(!aY!==!a3(aZ[a1],a1)){a0.push(aZ[a1])}}return a0},map:function(aZ,a4,aY){var a0=[],a3;for(var a1=0,a2=aZ.length;a1<a2;a1++){a3=a4(aZ[a1],a1,aY);if(a3!=null){a0[a0.length]=a3}}return a0.concat.apply([],a0)},guid:1,proxy:function(a0,aZ,aY){if(arguments.length===2){if(typeof aZ==="string"){aY=a0;a0=aY[aZ];aZ=C}else{if(aZ&&!a.isFunction(aZ)){aY=aZ;aZ=C}}}if(!aZ&&a0){aZ=function(){return a0.apply(aY||this,arguments)}}if(a0){aZ.guid=a0.guid=a0.guid||aZ.guid||a.guid++}return aZ},uaMatch:function(aZ){aZ=aZ.toLowerCase();var aY=/(webkit)[ \/]([\w.]+)/.exec(aZ)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(aZ)||/(msie) ([\w.]+)/.exec(aZ)||!/compatible/.test(aZ)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(aZ)||[];return{browser:aY[1]||"",version:aY[2]||"0"}},browser:{}});u=a.uaMatch(b);if(u.browser){a.browser[u.browser]=true;a.browser.version=u.version}if(a.browser.webkit){a.browser.safari=true}if(s){a.inArray=function(aY,aZ){return s.call(aZ,aY)}}X=a(ab);if(ab.addEventListener){aG=function(){ab.removeEventListener("DOMContentLoaded",aG,false);a.ready()}}else{if(ab.attachEvent){aG=function(){if(ab.readyState==="complete"){ab.detachEvent("onreadystatechange",aG);a.ready()}}}}function x(){if(a.isReady){return}try{ab.documentElement.doScroll("left")}catch(aY){setTimeout(x,1);return}a.ready()}function aV(aY,aZ){if(aZ.src){a.ajax({url:aZ.src,async:false,dataType:"script"})}else{a.globalEval(aZ.text||aZ.textContent||aZ.innerHTML||"")}if(aZ.parentNode){aZ.parentNode.removeChild(aZ)}}function an(aY,a6,a4,a0,a3,a5){var aZ=aY.length;if(typeof a6==="object"){for(var a1 in a6){an(aY,a1,a6[a1],a0,a3,a4)}return aY}if(a4!==C){a0=!a5&&a0&&a.isFunction(a4);for(var a2=0;a2<aZ;a2++){a3(aY[a2],a6,a0?a4.call(aY[a2],a2,a3(aY[a2],a6)):a4,a5)}return aY}return aZ?a3(aY[0],a6):C}function aP(){return(new Date).getTime()}(function(){a.support={};var a4=ab.documentElement,a3=ab.createElement("script"),aY=ab.createElement("div"),aZ="script"+aP();aY.style.display="none";aY.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var a6=aY.getElementsByTagName("*"),a5=aY.getElementsByTagName("a")[0];if(!a6||!a6.length||!a5){return}a.support={leadingWhitespace:aY.firstChild.nodeType===3,tbody:!aY.getElementsByTagName("tbody").length,htmlSerialize:!!aY.getElementsByTagName("link").length,style:/red/.test(a5.getAttribute("style")),hrefNormalized:a5.getAttribute("href")==="/a",opacity:/^0.55$/.test(a5.style.opacity),cssFloat:!!a5.style.cssFloat,checkOn:aY.getElementsByTagName("input")[0].value==="on",optSelected:ab.createElement("select").appendChild(ab.createElement("option")).selected,parentNode:aY.removeChild(aY.appendChild(ab.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};a3.type="text/javascript";try{a3.appendChild(ab.createTextNode("window."+aZ+"=1;"))}catch(a1){}a4.insertBefore(a3,a4.firstChild);if(aM[aZ]){a.support.scriptEval=true;delete aM[aZ]}try{delete a3.test}catch(a1){a.support.deleteExpando=false}a4.removeChild(a3);if(aY.attachEvent&&aY.fireEvent){aY.attachEvent("onclick",function a7(){a.support.noCloneEvent=false;aY.detachEvent("onclick",a7)});aY.cloneNode(true).fireEvent("onclick")}aY=ab.createElement("div");aY.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var a0=ab.createDocumentFragment();a0.appendChild(aY.firstChild);a.support.checkClone=a0.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var a8=ab.createElement("div");a8.style.width=a8.style.paddingLeft="1px";ab.body.appendChild(a8);a.boxModel=a.support.boxModel=a8.offsetWidth===2;ab.body.removeChild(a8).style.display="none";a8=null});var a2=function(a8){var ba=ab.createElement("div");a8="on"+a8;var a9=(a8 in ba);if(!a9){ba.setAttribute(a8,"return;");a9=typeof ba[a8]==="function"}ba=null;return a9};a.support.submitBubbles=a2("submit");a.support.changeBubbles=a2("change");a4=a3=aY=a6=a5=null})();a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var aI="jQuery"+aP(),aH=0,aT={};a.extend({cache:{},expando:aI,noData:{embed:true,object:true,applet:true},data:function(a0,aZ,a2){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a3=a0[aI],aY=a.cache,a1;if(!a3&&typeof aZ==="string"&&a2===C){return null}if(!a3){a3=++aH}if(typeof aZ==="object"){a0[aI]=a3;a1=aY[a3]=a.extend(true,{},aZ)}else{if(!aY[a3]){a0[aI]=a3;aY[a3]={}}}a1=aY[a3];if(a2!==C){a1[aZ]=a2}return typeof aZ==="string"?a1[aZ]:a1},removeData:function(a0,aZ){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a2=a0[aI],aY=a.cache,a1=aY[a2];if(aZ){if(a1){delete a1[aZ];if(a.isEmptyObject(a1)){a.removeData(a0)}}}else{if(a.support.deleteExpando){delete a0[a.expando]}else{if(a0.removeAttribute){a0.removeAttribute(a.expando)}}delete aY[a2]}}});a.fn.extend({data:function(aY,a0){if(typeof aY==="undefined"&&this.length){return a.data(this[0])}else{if(typeof aY==="object"){return this.each(function(){a.data(this,aY)})}}var a1=aY.split(".");a1[1]=a1[1]?"."+a1[1]:"";if(a0===C){var aZ=this.triggerHandler("getData"+a1[1]+"!",[a1[0]]);if(aZ===C&&this.length){aZ=a.data(this[0],aY)}return aZ===C&&a1[1]?this.data(a1[0]):aZ}else{return this.trigger("setData"+a1[1]+"!",[a1[0],a0]).each(function(){a.data(this,aY,a0)})}},removeData:function(aY){return this.each(function(){a.removeData(this,aY)})}});a.extend({queue:function(aZ,aY,a1){if(!aZ){return}aY=(aY||"fx")+"queue";var a0=a.data(aZ,aY);if(!a1){return a0||[]}if(!a0||a.isArray(a1)){a0=a.data(aZ,aY,a.makeArray(a1))}else{a0.push(a1)}return a0},dequeue:function(a1,a0){a0=a0||"fx";var aY=a.queue(a1,a0),aZ=aY.shift();if(aZ==="inprogress"){aZ=aY.shift()}if(aZ){if(a0==="fx"){aY.unshift("inprogress")}aZ.call(a1,function(){a.dequeue(a1,a0)})}}});a.fn.extend({queue:function(aY,aZ){if(typeof aY!=="string"){aZ=aY;aY="fx"}if(aZ===C){return a.queue(this[0],aY)}return this.each(function(a1,a2){var a0=a.queue(this,aY,aZ);if(aY==="fx"&&a0[0]!=="inprogress"){a.dequeue(this,aY)}})},dequeue:function(aY){return this.each(function(){a.dequeue(this,aY)})},delay:function(aZ,aY){aZ=a.fx?a.fx.speeds[aZ]||aZ:aZ;aY=aY||"fx";return this.queue(aY,function(){var a0=this;setTimeout(function(){a.dequeue(a0,aY)},aZ)})},clearQueue:function(aY){return this.queue(aY||"fx",[])}});var ao=/[\n\t]/g,S=/\s+/,av=/\r/g,aQ=/href|src|style/,d=/(button|input)/i,z=/(button|input|object|select|textarea)/i,j=/^(a|area)$/i,I=/radio|checkbox/;a.fn.extend({attr:function(aY,aZ){return an(this,aY,aZ,true,a.attr)},removeAttr:function(aY,aZ){return this.each(function(){a.attr(this,aY,"");if(this.nodeType===1){this.removeAttribute(aY)}})},addClass:function(a5){if(a.isFunction(a5)){return this.each(function(a8){var a7=a(this);a7.addClass(a5.call(this,a8,a7.attr("class")))})}if(a5&&typeof a5==="string"){var aY=(a5||"").split(S);for(var a1=0,a0=this.length;a1<a0;a1++){var aZ=this[a1];if(aZ.nodeType===1){if(!aZ.className){aZ.className=a5}else{var a2=" "+aZ.className+" ",a4=aZ.className;for(var a3=0,a6=aY.length;a3<a6;a3++){if(a2.indexOf(" "+aY[a3]+" ")<0){a4+=" "+aY[a3]}}aZ.className=a.trim(a4)}}}}return this},removeClass:function(a3){if(a.isFunction(a3)){return this.each(function(a7){var a6=a(this);a6.removeClass(a3.call(this,a7,a6.attr("class")))})}if((a3&&typeof a3==="string")||a3===C){var a4=(a3||"").split(S);for(var a0=0,aZ=this.length;a0<aZ;a0++){var a2=this[a0];if(a2.nodeType===1&&a2.className){if(a3){var a1=(" "+a2.className+" ").replace(ao," ");for(var a5=0,aY=a4.length;a5<aY;a5++){a1=a1.replace(" "+a4[a5]+" "," ")}a2.className=a.trim(a1)}else{a2.className=""}}}}return this},toggleClass:function(a1,aZ){var a0=typeof a1,aY=typeof aZ==="boolean";if(a.isFunction(a1)){return this.each(function(a3){var a2=a(this);a2.toggleClass(a1.call(this,a3,a2.attr("class"),aZ),aZ)})}return this.each(function(){if(a0==="string"){var a4,a3=0,a2=a(this),a5=aZ,a6=a1.split(S);while((a4=a6[a3++])){a5=aY?a5:!a2.hasClass(a4);a2[a5?"addClass":"removeClass"](a4)}}else{if(a0==="undefined"||a0==="boolean"){if(this.className){a.data(this,"__className__",this.className)}this.className=this.className||a1===false?"":a.data(this,"__className__")||""}}})},hasClass:function(aY){var a1=" "+aY+" ";for(var a0=0,aZ=this.length;a0<aZ;a0++){if((" "+this[a0].className+" ").replace(ao," ").indexOf(a1)>-1){return true}}return false},val:function(a5){if(a5===C){var aZ=this[0];if(aZ){if(a.nodeName(aZ,"option")){return(aZ.attributes.value||{}).specified?aZ.value:aZ.text}if(a.nodeName(aZ,"select")){var a3=aZ.selectedIndex,a6=[],a7=aZ.options,a2=aZ.type==="select-one";if(a3<0){return null}for(var a0=a2?a3:0,a4=a2?a3+1:a7.length;a0<a4;a0++){var a1=a7[a0];if(a1.selected){a5=a(a1).val();if(a2){return a5}a6.push(a5)}}return a6}if(I.test(aZ.type)&&!a.support.checkOn){return aZ.getAttribute("value")===null?"on":aZ.value}return(aZ.value||"").replace(av,"")}return C}var aY=a.isFunction(a5);return this.each(function(ba){var a9=a(this),bb=a5;if(this.nodeType!==1){return}if(aY){bb=a5.call(this,ba,a9.val())}if(typeof bb==="number"){bb+=""}if(a.isArray(bb)&&I.test(this.type)){this.checked=a.inArray(a9.val(),bb)>=0}else{if(a.nodeName(this,"select")){var a8=a.makeArray(bb);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),a8)>=0});if(!a8.length){this.selectedIndex=-1}}else{this.value=bb}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(aZ,aY,a4,a7){if(!aZ||aZ.nodeType===3||aZ.nodeType===8){return C}if(a7&&aY in a.attrFn){return a(aZ)[aY](a4)}var a0=aZ.nodeType!==1||!a.isXMLDoc(aZ),a3=a4!==C;aY=a0&&a.props[aY]||aY;if(aZ.nodeType===1){var a2=aQ.test(aY);if(aY==="selected"&&!a.support.optSelected){var a5=aZ.parentNode;if(a5){a5.selectedIndex;if(a5.parentNode){a5.parentNode.selectedIndex}}}if(aY in aZ&&a0&&!a2){if(a3){if(aY==="type"&&d.test(aZ.nodeName)&&aZ.parentNode){a.error("type property can't be changed")}aZ[aY]=a4}if(a.nodeName(aZ,"form")&&aZ.getAttributeNode(aY)){return aZ.getAttributeNode(aY).nodeValue}if(aY==="tabIndex"){var a6=aZ.getAttributeNode("tabIndex");return a6&&a6.specified?a6.value:z.test(aZ.nodeName)||j.test(aZ.nodeName)&&aZ.href?0:C}return aZ[aY]}if(!a.support.style&&a0&&aY==="style"){if(a3){aZ.style.cssText=""+a4}return aZ.style.cssText}if(a3){aZ.setAttribute(aY,""+a4)}var a1=!a.support.hrefNormalized&&a0&&a2?aZ.getAttribute(aY,2):aZ.getAttribute(aY);return a1===null?C:a1}return a.style(aZ,aY,a4)}});var aC=/\.(.*)$/,A=function(aY){return aY.replace(/[^\w\s\.\|`]/g,function(aZ){return"\\"+aZ})};a.event={add:function(a1,a5,ba,a3){if(a1.nodeType===3||a1.nodeType===8){return}if(a1.setInterval&&(a1!==aM&&!a1.frameElement)){a1=aM}var aZ,a9;if(ba.handler){aZ=ba;ba=aZ.handler}if(!ba.guid){ba.guid=a.guid++}var a6=a.data(a1);if(!a6){return}var bb=a6.events=a6.events||{},a4=a6.handle,a4;if(!a4){a6.handle=a4=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(a4.elem,arguments):C}}a4.elem=a1;a5=a5.split(" ");var a8,a2=0,aY;while((a8=a5[a2++])){a9=aZ?a.extend({},aZ):{handler:ba,data:a3};if(a8.indexOf(".")>-1){aY=a8.split(".");a8=aY.shift();a9.namespace=aY.slice(0).sort().join(".")}else{aY=[];a9.namespace=""}a9.type=a8;a9.guid=ba.guid;var a0=bb[a8],a7=a.event.special[a8]||{};if(!a0){a0=bb[a8]=[];if(!a7.setup||a7.setup.call(a1,a3,aY,a4)===false){if(a1.addEventListener){a1.addEventListener(a8,a4,false)}else{if(a1.attachEvent){a1.attachEvent("on"+a8,a4)}}}}if(a7.add){a7.add.call(a1,a9);if(!a9.handler.guid){a9.handler.guid=ba.guid}}a0.push(a9);a.event.global[a8]=true}a1=null},global:{},remove:function(bd,a8,aZ,a4){if(bd.nodeType===3||bd.nodeType===8){return}var bg,a3,a5,bb=0,a1,a6,a9,a2,a7,aY,bf,bc=a.data(bd),a0=bc&&bc.events;if(!bc||!a0){return}if(a8&&a8.type){aZ=a8.handler;a8=a8.type}if(!a8||typeof a8==="string"&&a8.charAt(0)==="."){a8=a8||"";for(a3 in a0){a.event.remove(bd,a3+a8)}return}a8=a8.split(" ");while((a3=a8[bb++])){bf=a3;aY=null;a1=a3.indexOf(".")<0;a6=[];if(!a1){a6=a3.split(".");a3=a6.shift();a9=new RegExp("(^|\\.)"+a.map(a6.slice(0).sort(),A).join("\\.(?:.*\\.)?")+"(\\.|$)")}a7=a0[a3];if(!a7){continue}if(!aZ){for(var ba=0;ba<a7.length;ba++){aY=a7[ba];if(a1||a9.test(aY.namespace)){a.event.remove(bd,bf,aY.handler,ba);a7.splice(ba--,1)}}continue}a2=a.event.special[a3]||{};for(var ba=a4||0;ba<a7.length;ba++){aY=a7[ba];if(aZ.guid===aY.guid){if(a1||a9.test(aY.namespace)){if(a4==null){a7.splice(ba--,1)}if(a2.remove){a2.remove.call(bd,aY)}}if(a4!=null){break}}}if(a7.length===0||a4!=null&&a7.length===1){if(!a2.teardown||a2.teardown.call(bd,a6)===false){ag(bd,a3,bc.handle)}bg=null;delete a0[a3]}}if(a.isEmptyObject(a0)){var be=bc.handle;if(be){be.elem=null}delete bc.events;delete bc.handle;if(a.isEmptyObject(bc)){a.removeData(bd)}}},trigger:function(aY,a2,a0){var a7=aY.type||aY,a1=arguments[3];if(!a1){aY=typeof aY==="object"?aY[aI]?aY:a.extend(a.Event(a7),aY):a.Event(a7);if(a7.indexOf("!")>=0){aY.type=a7=a7.slice(0,-1);aY.exclusive=true}if(!a0){aY.stopPropagation();if(a.event.global[a7]){a.each(a.cache,function(){if(this.events&&this.events[a7]){a.event.trigger(aY,a2,this.handle.elem)}})}}if(!a0||a0.nodeType===3||a0.nodeType===8){return C}aY.result=C;aY.target=a0;a2=a.makeArray(a2);a2.unshift(aY)}aY.currentTarget=a0;var a3=a.data(a0,"handle");if(a3){a3.apply(a0,a2)}var a8=a0.parentNode||a0.ownerDocument;try{if(!(a0&&a0.nodeName&&a.noData[a0.nodeName.toLowerCase()])){if(a0["on"+a7]&&a0["on"+a7].apply(a0,a2)===false){aY.result=false}}}catch(a5){}if(!aY.isPropagationStopped()&&a8){a.event.trigger(aY,a2,a8,true)}else{if(!aY.isDefaultPrevented()){var a4=aY.target,aZ,a9=a.nodeName(a4,"a")&&a7==="click",a6=a.event.special[a7]||{};if((!a6._default||a6._default.call(a0,aY)===false)&&!a9&&!(a4&&a4.nodeName&&a.noData[a4.nodeName.toLowerCase()])){try{if(a4[a7]){aZ=a4["on"+a7];if(aZ){a4["on"+a7]=null}a.event.triggered=true;a4[a7]()}}catch(a5){}if(aZ){a4["on"+a7]=aZ}a.event.triggered=false}}}},handle:function(aY){var a6,a0,aZ,a1,a7;aY=arguments[0]=a.event.fix(aY||aM.event);aY.currentTarget=this;a6=aY.type.indexOf(".")<0&&!aY.exclusive;if(!a6){aZ=aY.type.split(".");aY.type=aZ.shift();a1=new RegExp("(^|\\.)"+aZ.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}var a7=a.data(this,"events"),a0=a7[aY.type];if(a7&&a0){a0=a0.slice(0);for(var a3=0,a2=a0.length;a3<a2;a3++){var a5=a0[a3];if(a6||a1.test(a5.namespace)){aY.handler=a5.handler;aY.data=a5.data;aY.handleObj=a5;var a4=a5.handler.apply(this,arguments);if(a4!==C){aY.result=a4;if(a4===false){aY.preventDefault();aY.stopPropagation()}}if(aY.isImmediatePropagationStopped()){break}}}}return aY.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a1){if(a1[aI]){return a1}var aZ=a1;a1=a.Event(aZ);for(var a0=this.props.length,a3;a0;){a3=this.props[--a0];a1[a3]=aZ[a3]}if(!a1.target){a1.target=a1.srcElement||ab}if(a1.target.nodeType===3){a1.target=a1.target.parentNode}if(!a1.relatedTarget&&a1.fromElement){a1.relatedTarget=a1.fromElement===a1.target?a1.toElement:a1.fromElement}if(a1.pageX==null&&a1.clientX!=null){var a2=ab.documentElement,aY=ab.body;a1.pageX=a1.clientX+(a2&&a2.scrollLeft||aY&&aY.scrollLeft||0)-(a2&&a2.clientLeft||aY&&aY.clientLeft||0);a1.pageY=a1.clientY+(a2&&a2.scrollTop||aY&&aY.scrollTop||0)-(a2&&a2.clientTop||aY&&aY.clientTop||0)}if(!a1.which&&((a1.charCode||a1.charCode===0)?a1.charCode:a1.keyCode)){a1.which=a1.charCode||a1.keyCode}if(!a1.metaKey&&a1.ctrlKey){a1.metaKey=a1.ctrlKey}if(!a1.which&&a1.button!==C){a1.which=(a1.button&1?1:(a1.button&2?3:(a1.button&4?2:0)))}return a1},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(aY){a.event.add(this,aY.origType,a.extend({},aY,{handler:V}))},remove:function(aZ){var aY=true,a0=aZ.origType.replace(aC,"");a.each(a.data(this,"events").live||[],function(){if(a0===this.origType.replace(aC,"")){aY=false;return false}});if(aY){a.event.remove(this,aZ.origType,V)}}},beforeunload:{setup:function(a0,aZ,aY){if(this.setInterval){this.onbeforeunload=aY}return false},teardown:function(aZ,aY){if(this.onbeforeunload===aY){this.onbeforeunload=null}}}}};var ag=ab.removeEventListener?function(aZ,aY,a0){aZ.removeEventListener(aY,a0,false)}:function(aZ,aY,a0){aZ.detachEvent("on"+aY,a0)};a.Event=function(aY){if(!this.preventDefault){return new a.Event(aY)}if(aY&&aY.type){this.originalEvent=aY;this.type=aY.type}else{this.type=aY}this.timeStamp=aP();this[aI]=true};function aR(){return false}function f(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=f;var aY=this.originalEvent;if(!aY){return}if(aY.preventDefault){aY.preventDefault()}aY.returnValue=false},stopPropagation:function(){this.isPropagationStopped=f;var aY=this.originalEvent;if(!aY){return}if(aY.stopPropagation){aY.stopPropagation()}aY.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=f;this.stopPropagation()},isDefaultPrevented:aR,isPropagationStopped:aR,isImmediatePropagationStopped:aR};var Q=function(aZ){var aY=aZ.relatedTarget;try{while(aY&&aY!==this){aY=aY.parentNode}if(aY!==this){aZ.type=aZ.data;a.event.handle.apply(this,arguments)}}catch(a0){}},ay=function(aY){aY.type=aY.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(aZ,aY){a.event.special[aZ]={setup:function(a0){a.event.add(this,aY,a0&&a0.selector?ay:Q,aZ)},teardown:function(a0){a.event.remove(this,aY,a0&&a0.selector?ay:Q)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(aZ,aY){if(this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="submit"||a0==="image")&&a(a1).closest("form").length){return aA("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="text"||a0==="password")&&a(a1).closest("form").length&&a2.keyCode===13){return aA("submit",this,arguments)}})}else{return false}},teardown:function(aY){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var aq=/textarea|input|select/i,aS,i=function(aZ){var aY=aZ.type,a0=aZ.value;if(aY==="radio"||aY==="checkbox"){a0=aZ.checked}else{if(aY==="select-multiple"){a0=aZ.selectedIndex>-1?a.map(aZ.options,function(a1){return a1.selected}).join("-"):""}else{if(aZ.nodeName.toLowerCase()==="select"){a0=aZ.selectedIndex}}}return a0},O=function O(a0){var aY=a0.target,aZ,a1;if(!aq.test(aY.nodeName)||aY.readOnly){return}aZ=a.data(aY,"_change_data");a1=i(aY);if(a0.type!=="focusout"||aY.type!=="radio"){a.data(aY,"_change_data",a1)}if(aZ===C||a1===aZ){return}if(aZ!=null||a1){a0.type="change";return a.event.trigger(a0,arguments[1],aY)}};a.event.special.change={filters:{focusout:O,click:function(a0){var aZ=a0.target,aY=aZ.type;if(aY==="radio"||aY==="checkbox"||aZ.nodeName.toLowerCase()==="select"){return O.call(this,a0)}},keydown:function(a0){var aZ=a0.target,aY=aZ.type;if((a0.keyCode===13&&aZ.nodeName.toLowerCase()!=="textarea")||(a0.keyCode===32&&(aY==="checkbox"||aY==="radio"))||aY==="select-multiple"){return O.call(this,a0)}},beforeactivate:function(aZ){var aY=aZ.target;a.data(aY,"_change_data",i(aY))}},setup:function(a0,aZ){if(this.type==="file"){return false}for(var aY in aS){a.event.add(this,aY+".specialChange",aS[aY])}return aq.test(this.nodeName)},teardown:function(aY){a.event.remove(this,".specialChange");return aq.test(this.nodeName)}};aS=a.event.special.change.filters}function aA(aZ,a0,aY){aY[0].type=aZ;return a.event.handle.apply(a0,aY)}if(ab.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(a0,aY){a.event.special[aY]={setup:function(){this.addEventListener(a0,aZ,true)},teardown:function(){this.removeEventListener(a0,aZ,true)}};function aZ(a1){a1=a.event.fix(a1);a1.type=aY;return a.event.handle.call(this,a1)}})}a.each(["bind","one"],function(aZ,aY){a.fn[aY]=function(a5,a6,a4){if(typeof a5==="object"){for(var a2 in a5){this[aY](a2,a6,a5[a2],a4)}return this}if(a.isFunction(a6)){a4=a6;a6=C}var a3=aY==="one"?a.proxy(a4,function(a7){a(this).unbind(a7,a3);return a4.apply(this,arguments)}):a4;if(a5==="unload"&&aY!=="one"){this.one(a5,a6,a4)}else{for(var a1=0,a0=this.length;a1<a0;a1++){a.event.add(this[a1],a5,a3,a6)}}return this}});a.fn.extend({unbind:function(a2,a1){if(typeof a2==="object"&&!a2.preventDefault){for(var a0 in a2){this.unbind(a0,a2[a0])}}else{for(var aZ=0,aY=this.length;aZ<aY;aZ++){a.event.remove(this[aZ],a2,a1)}}return this},delegate:function(aY,aZ,a1,a0){return this.live(aZ,a1,a0,aY)},undelegate:function(aY,aZ,a0){if(arguments.length===0){return this.unbind("live")}else{return this.die(aZ,null,a0,aY)}},trigger:function(aY,aZ){return this.each(function(){a.event.trigger(aY,aZ,this)})},triggerHandler:function(aY,a0){if(this[0]){var aZ=a.Event(aY);aZ.preventDefault();aZ.stopPropagation();a.event.trigger(aZ,a0,this[0]);return aZ.result}},toggle:function(a0){var aY=arguments,aZ=1;while(aZ<aY.length){a.proxy(a0,aY[aZ++])}return this.click(a.proxy(a0,function(a1){var a2=(a.data(this,"lastToggle"+a0.guid)||0)%aZ;a.data(this,"lastToggle"+a0.guid,a2+1);a1.preventDefault();return aY[a2].apply(this,arguments)||false}))},hover:function(aY,aZ){return this.mouseenter(aY).mouseleave(aZ||aY)}});var aw={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(aZ,aY){a.fn[aY]=function(a7,a4,a9,a2){var a8,a5=0,a6,a1,ba,a3=a2||this.selector,a0=a2?this:a(this.context);if(a.isFunction(a4)){a9=a4;a4=C}a7=(a7||"").split(" ");while((a8=a7[a5++])!=null){a6=aC.exec(a8);a1="";if(a6){a1=a6[0];a8=a8.replace(aC,"")}if(a8==="hover"){a7.push("mouseenter"+a1,"mouseleave"+a1);continue}ba=a8;if(a8==="focus"||a8==="blur"){a7.push(aw[a8]+a1);a8=a8+a1}else{a8=(aw[a8]||a8)+a1}if(aY==="live"){a0.each(function(){a.event.add(this,m(a8,a3),{data:a4,selector:a3,handler:a9,origType:a8,origHandler:a9,preType:ba})})}else{a0.unbind(m(a8,a3),a9)}}return this}});function V(aY){var a8,aZ=[],bb=[],a7=arguments,ba,a6,a9,a1,a3,a5,a2,a4,bc=a.data(this,"events");if(aY.liveFired===this||!bc||!bc.live||aY.button&&aY.type==="click"){return}aY.liveFired=this;var a0=bc.live.slice(0);for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a9.origType.replace(aC,"")===aY.type){bb.push(a9.selector)}else{a0.splice(a3--,1)}}a6=a(aY.target).closest(bb,aY.currentTarget);for(a5=0,a2=a6.length;a5<a2;a5++){for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a6[a5].selector===a9.selector){a1=a6[a5].elem;ba=null;if(a9.preType==="mouseenter"||a9.preType==="mouseleave"){ba=a(aY.relatedTarget).closest(a9.selector)[0]}if(!ba||ba!==a1){aZ.push({elem:a1,handleObj:a9})}}}}for(a5=0,a2=aZ.length;a5<a2;a5++){a6=aZ[a5];aY.currentTarget=a6.elem;aY.data=a6.handleObj.data;aY.handleObj=a6.handleObj;if(a6.handleObj.origHandler.apply(a6.elem,a7)===false){a8=false;break}}return a8}function m(aZ,aY){return"live."+(aZ&&aZ!=="*"?aZ+".":"")+aY.replace(/\./g,"`").replace(/ /g,"&")}a.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(aZ,aY){a.fn[aY]=function(a0){return a0?this.bind(aY,a0):this.trigger(aY)};if(a.attrFn){a.attrFn[aY]=true}});if(aM.attachEvent&&!aM.addEventListener){aM.attachEvent("onunload",function(){for(var aZ in a.cache){if(a.cache[aZ].handle){try{a.event.remove(a.cache[aZ].handle.elem)}catch(aY){}}}}); +(function(aP,E){var ae=aP.document;var a=(function(){var bf=function(bA,bB){return new bf.fn.init(bA,bB,bd)},bv=aP.jQuery,bh=aP.$,bd,bz=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,bn=/\S/,bj=/^\s+/,be=/\s+$/,bi=/\d/,bb=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bo=/^[\],:{}\s]*$/,bx=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bq=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bk=/(?:^|:|,)(?:\s*\[)+/g,a9=/(webkit)[ \/]([\w.]+)/,bs=/(opera)(?:.*version)?[ \/]([\w.]+)/,br=/(msie) ([\w.]+)/,bt=/(mozilla)(?:.*? rv:([\w.]+))?/,by=navigator.userAgent,bw,bu=false,bc,a4="then done fail isResolved isRejected promise".split(" "),a5,bm=Object.prototype.toString,bg=Object.prototype.hasOwnProperty,ba=Array.prototype.push,bl=Array.prototype.slice,bp=String.prototype.trim,a6=Array.prototype.indexOf,a8={};bf.fn=bf.prototype={constructor:bf,init:function(bA,bE,bD){var bC,bF,bB,bG;if(!bA){return this}if(bA.nodeType){this.context=this[0]=bA;this.length=1;return this}if(bA==="body"&&!bE&&ae.body){this.context=ae;this[0]=ae.body;this.selector="body";this.length=1;return this}if(typeof bA==="string"){bC=bz.exec(bA);if(bC&&(bC[1]||!bE)){if(bC[1]){bE=bE instanceof bf?bE[0]:bE;bG=(bE?bE.ownerDocument||bE:ae);bB=bb.exec(bA);if(bB){if(bf.isPlainObject(bE)){bA=[ae.createElement(bB[1])];bf.fn.attr.call(bA,bE,true)}else{bA=[bG.createElement(bB[1])]}}else{bB=bf.buildFragment([bC[1]],[bG]);bA=(bB.cacheable?bf.clone(bB.fragment):bB.fragment).childNodes}return bf.merge(this,bA)}else{bF=ae.getElementById(bC[2]);if(bF&&bF.parentNode){if(bF.id!==bC[2]){return bD.find(bA)}this.length=1;this[0]=bF}this.context=ae;this.selector=bA;return this}}else{if(!bE||bE.jquery){return(bE||bD).find(bA)}else{return this.constructor(bE).find(bA)}}}else{if(bf.isFunction(bA)){return bD.ready(bA)}}if(bA.selector!==E){this.selector=bA.selector;this.context=bA.context}return bf.makeArray(bA,this)},selector:"",jquery:"1.5",length:0,size:function(){return this.length},toArray:function(){return bl.call(this,0)},get:function(bA){return bA==null?this.toArray():(bA<0?this[this.length+bA]:this[bA])},pushStack:function(bB,bD,bA){var bC=this.constructor();if(bf.isArray(bB)){ba.apply(bC,bB)}else{bf.merge(bC,bB)}bC.prevObject=this;bC.context=this.context;if(bD==="find"){bC.selector=this.selector+(this.selector?" ":"")+bA}else{if(bD){bC.selector=this.selector+"."+bD+"("+bA+")"}}return bC},each:function(bB,bA){return bf.each(this,bB,bA)},ready:function(bA){bf.bindReady();bc.done(bA);return this},eq:function(bA){return bA===-1?this.slice(bA):this.slice(bA,+bA+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bl.apply(this,arguments),"slice",bl.call(arguments).join(","))},map:function(bA){return this.pushStack(bf.map(this,function(bC,bB){return bA.call(bC,bB,bC)}))},end:function(){return this.prevObject||this.constructor(null)},push:ba,sort:[].sort,splice:[].splice};bf.fn.init.prototype=bf.fn;bf.extend=bf.fn.extend=function(){var bJ,bC,bA,bB,bG,bH,bF=arguments[0]||{},bE=1,bD=arguments.length,bI=false;if(typeof bF==="boolean"){bI=bF;bF=arguments[1]||{};bE=2}if(typeof bF!=="object"&&!bf.isFunction(bF)){bF={}}if(bD===bE){bF=this;--bE}for(;bE<bD;bE++){if((bJ=arguments[bE])!=null){for(bC in bJ){bA=bF[bC];bB=bJ[bC];if(bF===bB){continue}if(bI&&bB&&(bf.isPlainObject(bB)||(bG=bf.isArray(bB)))){if(bG){bG=false;bH=bA&&bf.isArray(bA)?bA:[]}else{bH=bA&&bf.isPlainObject(bA)?bA:{}}bF[bC]=bf.extend(bI,bH,bB)}else{if(bB!==E){bF[bC]=bB}}}}}return bF};bf.extend({noConflict:function(bA){aP.$=bh;if(bA){aP.jQuery=bv}return bf},isReady:false,readyWait:1,ready:function(bA){if(bA===true){bf.readyWait--}if(!bf.readyWait||(bA!==true&&!bf.isReady)){if(!ae.body){return setTimeout(bf.ready,1)}bf.isReady=true;if(bA!==true&&--bf.readyWait>0){return}bc.resolveWith(ae,[bf]);if(bf.fn.trigger){bf(ae).trigger("ready").unbind("ready")}}},bindReady:function(){if(bu){return}bu=true;if(ae.readyState==="complete"){return setTimeout(bf.ready,1)}if(ae.addEventListener){ae.addEventListener("DOMContentLoaded",a5,false);aP.addEventListener("load",bf.ready,false)}else{if(ae.attachEvent){ae.attachEvent("onreadystatechange",a5);aP.attachEvent("onload",bf.ready);var bA=false;try{bA=aP.frameElement==null}catch(bB){}if(ae.documentElement.doScroll&&bA){a7()}}}},isFunction:function(bA){return bf.type(bA)==="function"},isArray:Array.isArray||function(bA){return bf.type(bA)==="array"},isWindow:function(bA){return bA&&typeof bA==="object"&&"setInterval" in bA},isNaN:function(bA){return bA==null||!bi.test(bA)||isNaN(bA)},type:function(bA){return bA==null?String(bA):a8[bm.call(bA)]||"object"},isPlainObject:function(bB){if(!bB||bf.type(bB)!=="object"||bB.nodeType||bf.isWindow(bB)){return false}if(bB.constructor&&!bg.call(bB,"constructor")&&!bg.call(bB.constructor.prototype,"isPrototypeOf")){return false}var bA;for(bA in bB){}return bA===E||bg.call(bB,bA)},isEmptyObject:function(bB){for(var bA in bB){return false}return true},error:function(bA){throw bA},parseJSON:function(bA){if(typeof bA!=="string"||!bA){return null}bA=bf.trim(bA);if(bo.test(bA.replace(bx,"@").replace(bq,"]").replace(bk,""))){return aP.JSON&&aP.JSON.parse?aP.JSON.parse(bA):(new Function("return "+bA))()}else{bf.error("Invalid JSON: "+bA)}},parseXML:function(bC,bA,bB){if(aP.DOMParser){bB=new DOMParser();bA=bB.parseFromString(bC,"text/xml")}else{bA=new ActiveXObject("Microsoft.XMLDOM");bA.async="false";bA.loadXML(bC)}bB=bA.documentElement;if(!bB||!bB.nodeName||bB.nodeName==="parsererror"){bf.error("Invalid XML: "+bC)}return bA},noop:function(){},globalEval:function(bC){if(bC&&bn.test(bC)){var bB=ae.getElementsByTagName("head")[0]||ae.documentElement,bA=ae.createElement("script");bA.type="text/javascript";if(bf.support.scriptEval()){bA.appendChild(ae.createTextNode(bC))}else{bA.text=bC}bB.insertBefore(bA,bB.firstChild);bB.removeChild(bA)}},nodeName:function(bB,bA){return bB.nodeName&&bB.nodeName.toUpperCase()===bA.toUpperCase()},each:function(bD,bH,bC){var bB,bE=0,bF=bD.length,bA=bF===E||bf.isFunction(bD);if(bC){if(bA){for(bB in bD){if(bH.apply(bD[bB],bC)===false){break}}}else{for(;bE<bF;){if(bH.apply(bD[bE++],bC)===false){break}}}}else{if(bA){for(bB in bD){if(bH.call(bD[bB],bB,bD[bB])===false){break}}}else{for(var bG=bD[0];bE<bF&&bH.call(bG,bE,bG)!==false;bG=bD[++bE]){}}}return bD},trim:bp?function(bA){return bA==null?"":bp.call(bA)}:function(bA){return bA==null?"":bA.toString().replace(bj,"").replace(be,"")},makeArray:function(bD,bB){var bA=bB||[];if(bD!=null){var bC=bf.type(bD);if(bD.length==null||bC==="string"||bC==="function"||bC==="regexp"||bf.isWindow(bD)){ba.call(bA,bD)}else{bf.merge(bA,bD)}}return bA},inArray:function(bC,bD){if(bD.indexOf){return bD.indexOf(bC)}for(var bA=0,bB=bD.length;bA<bB;bA++){if(bD[bA]===bC){return bA}}return -1},merge:function(bE,bC){var bD=bE.length,bB=0;if(typeof bC.length==="number"){for(var bA=bC.length;bB<bA;bB++){bE[bD++]=bC[bB]}}else{while(bC[bB]!==E){bE[bD++]=bC[bB++]}}bE.length=bD;return bE},grep:function(bB,bG,bA){var bC=[],bF;bA=!!bA;for(var bD=0,bE=bB.length;bD<bE;bD++){bF=!!bG(bB[bD],bD);if(bA!==bF){bC.push(bB[bD])}}return bC},map:function(bB,bG,bA){var bC=[],bF;for(var bD=0,bE=bB.length;bD<bE;bD++){bF=bG(bB[bD],bD,bA);if(bF!=null){bC[bC.length]=bF}}return bC.concat.apply([],bC)},guid:1,proxy:function(bC,bB,bA){if(arguments.length===2){if(typeof bB==="string"){bA=bC;bC=bA[bB];bB=E}else{if(bB&&!bf.isFunction(bB)){bA=bB;bB=E}}}if(!bB&&bC){bB=function(){return bC.apply(bA||this,arguments)}}if(bC){bB.guid=bC.guid=bC.guid||bB.guid||bf.guid++}return bB},access:function(bA,bI,bG,bC,bF,bH){var bB=bA.length;if(typeof bI==="object"){for(var bD in bI){bf.access(bA,bD,bI[bD],bC,bF,bG)}return bA}if(bG!==E){bC=!bH&&bC&&bf.isFunction(bG);for(var bE=0;bE<bB;bE++){bF(bA[bE],bI,bC?bG.call(bA[bE],bE,bF(bA[bE],bI)):bG,bH)}return bA}return bB?bF(bA[0],bI):E},now:function(){return(new Date()).getTime()},_Deferred:function(){var bD=[],bE,bB,bC,bA={done:function(){if(!bC){var bG=arguments,bH,bK,bJ,bI,bF;if(bE){bF=bE;bE=0}for(bH=0,bK=bG.length;bH<bK;bH++){bJ=bG[bH];bI=bf.type(bJ);if(bI==="array"){bA.done.apply(bA,bJ)}else{if(bI==="function"){bD.push(bJ)}}}if(bF){bA.resolveWith(bF[0],bF[1])}}return this},resolveWith:function(bG,bF){if(!bC&&!bE&&!bB){bB=1;try{while(bD[0]){bD.shift().apply(bG,bF)}}finally{bE=[bG,bF];bB=0}}return this},resolve:function(){bA.resolveWith(bf.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return !!(bB||bE)},cancel:function(){bC=1;bD=[];return this}};return bA},Deferred:function(bB){var bA=bf._Deferred(),bD=bf._Deferred(),bC;bf.extend(bA,{then:function(bF,bE){bA.done(bF).fail(bE);return this},fail:bD.done,rejectWith:bD.resolveWith,reject:bD.resolve,isRejected:bD.isResolved,promise:function(bF,bE){if(bF==null){if(bC){return bC}bC=bF={}}bE=a4.length;while(bE--){bF[a4[bE]]=bA[a4[bE]]}return bF}});bA.then(bD.cancel,bA.cancel);delete bA.cancel;if(bB){bB.call(bA,bA)}return bA},when:function(bD){var bC=arguments,bE=bC.length,bB=bE<=1&&bD&&bf.isFunction(bD.promise)?bD:bf.Deferred(),bF=bB.promise(),bA;if(bE>1){bA=new Array(bE);bf.each(bC,function(bG,bH){bf.when(bH).then(function(bI){bA[bG]=arguments.length>1?bl.call(arguments,0):bI;if(!--bE){bB.resolveWith(bF,bA)}},bB.reject)})}else{if(bB!==bD){bB.resolve(bD)}}return bF},uaMatch:function(bB){bB=bB.toLowerCase();var bA=a9.exec(bB)||bs.exec(bB)||br.exec(bB)||bB.indexOf("compatible")<0&&bt.exec(bB)||[];return{browser:bA[1]||"",version:bA[2]||"0"}},sub:function(){function bB(bD,bE){return new bB.fn.init(bD,bE)}bf.extend(true,bB,this);bB.superclass=this;bB.fn=bB.prototype=this();bB.fn.constructor=bB;bB.subclass=this.subclass;bB.fn.init=function bC(bD,bE){if(bE&&bE instanceof bf&&!(bE instanceof bB)){bE=bB(bE)}return bf.fn.init.call(this,bD,bE,bA)};bB.fn.init.prototype=bB.fn;var bA=bB(ae);return bB},browser:{}});bc=bf._Deferred();bf.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(bB,bA){a8["[object "+bA+"]"]=bA.toLowerCase()});bw=bf.uaMatch(by);if(bw.browser){bf.browser[bw.browser]=true;bf.browser.version=bw.version}if(bf.browser.webkit){bf.browser.safari=true}if(a6){bf.inArray=function(bA,bB){return a6.call(bB,bA)}}if(bn.test("\xA0")){bj=/^[\s\xA0]+/;be=/[\s\xA0]+$/}bd=bf(ae);if(ae.addEventListener){a5=function(){ae.removeEventListener("DOMContentLoaded",a5,false);bf.ready()}}else{if(ae.attachEvent){a5=function(){if(ae.readyState==="complete"){ae.detachEvent("onreadystatechange",a5);bf.ready()}}}}function a7(){if(bf.isReady){return}try{ae.documentElement.doScroll("left")}catch(bA){setTimeout(a7,1);return}bf.ready()}return(aP.jQuery=aP.$=bf)})();(function(){a.support={};var a4=ae.createElement("div");a4.style.display="none";a4.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var bb=a4.getElementsByTagName("*"),a9=a4.getElementsByTagName("a")[0],ba=ae.createElement("select"),a5=ba.appendChild(ae.createElement("option"));if(!bb||!bb.length||!a9){return}a.support={leadingWhitespace:a4.firstChild.nodeType===3,tbody:!a4.getElementsByTagName("tbody").length,htmlSerialize:!!a4.getElementsByTagName("link").length,style:/red/.test(a9.getAttribute("style")),hrefNormalized:a9.getAttribute("href")==="/a",opacity:/^0.55$/.test(a9.style.opacity),cssFloat:!!a9.style.cssFloat,checkOn:a4.getElementsByTagName("input")[0].value==="on",optSelected:a5.selected,deleteExpando:true,optDisabled:false,checkClone:false,_scriptEval:null,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};ba.disabled=true;a.support.optDisabled=!a5.disabled;a.support.scriptEval=function(){if(a.support._scriptEval===null){var bd=ae.documentElement,be=ae.createElement("script"),bg="script"+a.now();be.type="text/javascript";try{be.appendChild(ae.createTextNode("window."+bg+"=1;"))}catch(bf){}bd.insertBefore(be,bd.firstChild);if(aP[bg]){a.support._scriptEval=true;delete aP[bg]}else{a.support._scriptEval=false}bd.removeChild(be);bd=be=bg=null}return a.support._scriptEval};try{delete a4.test}catch(a6){a.support.deleteExpando=false}if(a4.attachEvent&&a4.fireEvent){a4.attachEvent("onclick",function bc(){a.support.noCloneEvent=false;a4.detachEvent("onclick",bc)});a4.cloneNode(true).fireEvent("onclick")}a4=ae.createElement("div");a4.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var a7=ae.createDocumentFragment();a7.appendChild(a4.firstChild);a.support.checkClone=a7.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var bf=ae.createElement("div"),bd=ae.getElementsByTagName("body")[0];if(!bd){return}bf.style.width=bf.style.paddingLeft="1px";bd.appendChild(bf);a.boxModel=a.support.boxModel=bf.offsetWidth===2;if("zoom" in bf.style){bf.style.display="inline";bf.style.zoom=1;a.support.inlineBlockNeedsLayout=bf.offsetWidth===2;bf.style.display="";bf.innerHTML="<div style='width:4px;'></div>";a.support.shrinkWrapBlocks=bf.offsetWidth!==2}bf.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var be=bf.getElementsByTagName("td");a.support.reliableHiddenOffsets=be[0].offsetHeight===0;be[0].style.display="";be[1].style.display="none";a.support.reliableHiddenOffsets=a.support.reliableHiddenOffsets&&be[0].offsetHeight===0;bf.innerHTML="";bd.removeChild(bf).style.display="none";bf=be=null});var a8=function(bd){var bf=ae.createElement("div");bd="on"+bd;if(!bf.attachEvent){return true}var be=(bd in bf);if(!be){bf.setAttribute(bd,"return;");be=typeof bf[bd]==="function"}bf=null;return be};a.support.submitBubbles=a8("submit");a.support.changeBubbles=a8("change");a4=bb=a9=null})();var at=/^(?:\{.*\}|\[.*\])$/;a.extend({cache:{},uuid:0,expando:"jQuery"+(a.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(a4){a4=a4.nodeType?a.cache[a4[a.expando]]:a4[a.expando];return !!a4&&!a.isEmptyObject(a4)},data:function(a7,a5,a9,a8){if(!a.acceptData(a7)){return}var bc=a.expando,bb=typeof a5==="string",ba,bd=a7.nodeType,a4=bd?a.cache:a7,a6=bd?a7[a.expando]:a7[a.expando]&&a.expando;if((!a6||(a8&&a6&&!a4[a6][bc]))&&bb&&a9===E){return}if(!a6){if(bd){a7[a.expando]=a6=++a.uuid}else{a6=a.expando}}if(!a4[a6]){a4[a6]={}}if(typeof a5==="object"){if(a8){a4[a6][bc]=a.extend(a4[a6][bc],a5)}else{a4[a6]=a.extend(a4[a6],a5)}}ba=a4[a6];if(a8){if(!ba[bc]){ba[bc]={}}ba=ba[bc]}if(a9!==E){ba[a5]=a9}if(a5==="events"&&!ba[a5]){return ba[bc]&&ba[bc].events}return bb?ba[a5]:ba},removeData:function(a8,a6,a9){if(!a.acceptData(a8)){return}var bb=a.expando,bc=a8.nodeType,a5=bc?a.cache:a8,a7=bc?a8[a.expando]:a.expando;if(!a5[a7]){return}if(a6){var ba=a9?a5[a7][bb]:a5[a7];if(ba){delete ba[a6];if(!a.isEmptyObject(ba)){return}}}if(a9){delete a5[a7][bb];if(!a.isEmptyObject(a5[a7])){return}}var a4=a5[a7][bb];if(a.support.deleteExpando||a5!=aP){delete a5[a7]}else{a5[a7]=null}if(a4){a5[a7]={};a5[a7][bb]=a4}else{if(bc){if(a.support.deleteExpando){delete a8[a.expando]}else{if(a8.removeAttribute){a8.removeAttribute(a.expando)}else{a8[a.expando]=null}}}}},_data:function(a5,a4,a6){return a.data(a5,a4,a6,true)},acceptData:function(a5){if(a5.nodeName){var a4=a.noData[a5.nodeName.toLowerCase()];if(a4){return !(a4===true||a5.getAttribute("classid")!==a4)}}return true}});a.fn.extend({data:function(a8,ba){var a9=null;if(typeof a8==="undefined"){if(this.length){a9=a.data(this[0]);if(this[0].nodeType===1){var a4=this[0].attributes,a6;for(var a7=0,a5=a4.length;a7<a5;a7++){a6=a4[a7].name;if(a6.indexOf("data-")===0){a6=a6.substr(5);aK(this[0],a6,a9[a6])}}}}return a9}else{if(typeof a8==="object"){return this.each(function(){a.data(this,a8)})}}var bb=a8.split(".");bb[1]=bb[1]?"."+bb[1]:"";if(ba===E){a9=this.triggerHandler("getData"+bb[1]+"!",[bb[0]]);if(a9===E&&this.length){a9=a.data(this[0],a8);a9=aK(this[0],a8,a9)}return a9===E&&bb[1]?this.data(bb[0]):a9}else{return this.each(function(){var bd=a(this),bc=[bb[0],ba];bd.triggerHandler("setData"+bb[1]+"!",bc);a.data(this,a8,ba);bd.triggerHandler("changeData"+bb[1]+"!",bc)})}},removeData:function(a4){return this.each(function(){a.removeData(this,a4)})}});function aK(a5,a4,a6){if(a6===E&&a5.nodeType===1){a6=a5.getAttribute("data-"+a4);if(typeof a6==="string"){try{a6=a6==="true"?true:a6==="false"?false:a6==="null"?null:!a.isNaN(a6)?parseFloat(a6):at.test(a6)?a.parseJSON(a6):a6}catch(a7){}a.data(a5,a4,a6)}else{a6=E}}return a6}a.extend({queue:function(a5,a4,a7){if(!a5){return}a4=(a4||"fx")+"queue";var a6=a._data(a5,a4);if(!a7){return a6||[]}if(!a6||a.isArray(a7)){a6=a._data(a5,a4,a.makeArray(a7))}else{a6.push(a7)}return a6},dequeue:function(a7,a6){a6=a6||"fx";var a4=a.queue(a7,a6),a5=a4.shift();if(a5==="inprogress"){a5=a4.shift()}if(a5){if(a6==="fx"){a4.unshift("inprogress")}a5.call(a7,function(){a.dequeue(a7,a6)})}if(!a4.length){a.removeData(a7,a6+"queue",true)}}});a.fn.extend({queue:function(a4,a5){if(typeof a4!=="string"){a5=a4;a4="fx"}if(a5===E){return a.queue(this[0],a4)}return this.each(function(a7){var a6=a.queue(this,a4,a5);if(a4==="fx"&&a6[0]!=="inprogress"){a.dequeue(this,a4)}})},dequeue:function(a4){return this.each(function(){a.dequeue(this,a4)})},delay:function(a5,a4){a5=a.fx?a.fx.speeds[a5]||a5:a5;a4=a4||"fx";return this.queue(a4,function(){var a6=this;setTimeout(function(){a.dequeue(a6,a4)},a5)})},clearQueue:function(a4){return this.queue(a4||"fx",[])}});var aq=/[\n\t\r]/g,aT=/\s+/,av=/\r/g,aS=/^(?:href|src|style)$/,e=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,j=/^a(?:rea)?$/i,L=/^(?:radio|checkbox)$/i;a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};a.fn.extend({attr:function(a4,a5){return a.access(this,a4,a5,true,a.attr)},removeAttr:function(a4,a5){return this.each(function(){a.attr(this,a4,"");if(this.nodeType===1){this.removeAttribute(a4)}})},addClass:function(bb){if(a.isFunction(bb)){return this.each(function(be){var bd=a(this);bd.addClass(bb.call(this,be,bd.attr("class")))})}if(bb&&typeof bb==="string"){var a4=(bb||"").split(aT);for(var a7=0,a6=this.length;a7<a6;a7++){var a5=this[a7];if(a5.nodeType===1){if(!a5.className){a5.className=bb}else{var a8=" "+a5.className+" ",ba=a5.className;for(var a9=0,bc=a4.length;a9<bc;a9++){if(a8.indexOf(" "+a4[a9]+" ")<0){ba+=" "+a4[a9]}}a5.className=a.trim(ba)}}}}return this},removeClass:function(a9){if(a.isFunction(a9)){return this.each(function(bd){var bc=a(this);bc.removeClass(a9.call(this,bd,bc.attr("class")))})}if((a9&&typeof a9==="string")||a9===E){var ba=(a9||"").split(aT);for(var a6=0,a5=this.length;a6<a5;a6++){var a8=this[a6];if(a8.nodeType===1&&a8.className){if(a9){var a7=(" "+a8.className+" ").replace(aq," ");for(var bb=0,a4=ba.length;bb<a4;bb++){a7=a7.replace(" "+ba[bb]+" "," ")}a8.className=a.trim(a7)}else{a8.className=""}}}}return this},toggleClass:function(a7,a5){var a6=typeof a7,a4=typeof a5==="boolean";if(a.isFunction(a7)){return this.each(function(a9){var a8=a(this);a8.toggleClass(a7.call(this,a9,a8.attr("class"),a5),a5)})}return this.each(function(){if(a6==="string"){var ba,a9=0,a8=a(this),bb=a5,bc=a7.split(aT);while((ba=bc[a9++])){bb=a4?bb:!a8.hasClass(ba);a8[bb?"addClass":"removeClass"](ba)}}else{if(a6==="undefined"||a6==="boolean"){if(this.className){a._data(this,"__className__",this.className)}this.className=this.className||a7===false?"":a._data(this,"__className__")||""}}})},hasClass:function(a4){var a7=" "+a4+" ";for(var a6=0,a5=this.length;a6<a5;a6++){if((" "+this[a6].className+" ").replace(aq," ").indexOf(a7)>-1){return true}}return false},val:function(bc){if(!arguments.length){var a6=this[0];if(a6){if(a.nodeName(a6,"option")){var a5=a6.attributes.value;return !a5||a5.specified?a6.value:a6.text}if(a.nodeName(a6,"select")){var ba=a6.selectedIndex,bd=[],be=a6.options,a9=a6.type==="select-one";if(ba<0){return null}for(var a7=a9?ba:0,bb=a9?ba+1:be.length;a7<bb;a7++){var a8=be[a7];if(a8.selected&&(a.support.optDisabled?!a8.disabled:a8.getAttribute("disabled")===null)&&(!a8.parentNode.disabled||!a.nodeName(a8.parentNode,"optgroup"))){bc=a(a8).val();if(a9){return bc}bd.push(bc)}}return bd}if(L.test(a6.type)&&!a.support.checkOn){return a6.getAttribute("value")===null?"on":a6.value}return(a6.value||"").replace(av,"")}return E}var a4=a.isFunction(bc);return this.each(function(bh){var bg=a(this),bi=bc;if(this.nodeType!==1){return}if(a4){bi=bc.call(this,bh,bg.val())}if(bi==null){bi=""}else{if(typeof bi==="number"){bi+=""}else{if(a.isArray(bi)){bi=a.map(bi,function(bj){return bj==null?"":bj+""})}}}if(a.isArray(bi)&&L.test(this.type)){this.checked=a.inArray(bg.val(),bi)>=0}else{if(a.nodeName(this,"select")){var bf=a.makeArray(bi);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),bf)>=0});if(!bf.length){this.selectedIndex=-1}}else{this.value=bi}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a5,a4,ba,bd){if(!a5||a5.nodeType===3||a5.nodeType===8||a5.nodeType===2){return E}if(bd&&a4 in a.attrFn){return a(a5)[a4](ba)}var a6=a5.nodeType!==1||!a.isXMLDoc(a5),a9=ba!==E;a4=a6&&a.props[a4]||a4;if(a5.nodeType===1){var a8=aS.test(a4);if(a4==="selected"&&!a.support.optSelected){var bb=a5.parentNode;if(bb){bb.selectedIndex;if(bb.parentNode){bb.parentNode.selectedIndex}}}if((a4 in a5||a5[a4]!==E)&&a6&&!a8){if(a9){if(a4==="type"&&e.test(a5.nodeName)&&a5.parentNode){a.error("type property can't be changed")}if(ba===null){if(a5.nodeType===1){a5.removeAttribute(a4)}}else{a5[a4]=ba}}if(a.nodeName(a5,"form")&&a5.getAttributeNode(a4)){return a5.getAttributeNode(a4).nodeValue}if(a4==="tabIndex"){var bc=a5.getAttributeNode("tabIndex");return bc&&bc.specified?bc.value:z.test(a5.nodeName)||j.test(a5.nodeName)&&a5.href?0:E}return a5[a4]}if(!a.support.style&&a6&&a4==="style"){if(a9){a5.style.cssText=""+ba}return a5.style.cssText}if(a9){a5.setAttribute(a4,""+ba)}if(!a5.attributes[a4]&&(a5.hasAttribute&&!a5.hasAttribute(a4))){return E}var a7=!a.support.hrefNormalized&&a6&&a8?a5.getAttribute(a4,2):a5.getAttribute(a4);return a7===null?E:a7}if(a9){a5[a4]=ba}return a5[a4]}});var aG=/\.(.*)$/,aR=/^(?:textarea|input|select)$/i,G=/\./g,U=/ /g,am=/[^\w\s.|`]/g,B=function(a4){return a4.replace(am,"\\$&")},ay="events";a.event={add:function(a7,bb,bg,a9){if(a7.nodeType===3||a7.nodeType===8){return}if(a.isWindow(a7)&&(a7!==aP&&!a7.frameElement)){a7=aP}if(bg===false){bg=aV}else{if(!bg){return}}var a5,bf;if(bg.handler){a5=bg;bg=a5.handler}if(!bg.guid){bg.guid=a.guid++}var bc=a._data(a7);if(!bc){return}var bh=bc[ay],ba=bc.handle;if(typeof bh==="function"){ba=bh.handle;bh=bh.events}else{if(!bh){if(!a7.nodeType){bc[ay]=bc=function(){}}bc.events=bh={}}}if(!ba){bc.handle=ba=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(ba.elem,arguments):E}}ba.elem=a7;bb=bb.split(" ");var be,a8=0,a4;while((be=bb[a8++])){bf=a5?a.extend({},a5):{handler:bg,data:a9};if(be.indexOf(".")>-1){a4=be.split(".");be=a4.shift();bf.namespace=a4.slice(0).sort().join(".")}else{a4=[];bf.namespace=""}bf.type=be;if(!bf.guid){bf.guid=bg.guid}var a6=bh[be],bd=a.event.special[be]||{};if(!a6){a6=bh[be]=[];if(!bd.setup||bd.setup.call(a7,a9,a4,ba)===false){if(a7.addEventListener){a7.addEventListener(be,ba,false)}else{if(a7.attachEvent){a7.attachEvent("on"+be,ba)}}}}if(bd.add){bd.add.call(a7,bf);if(!bf.handler.guid){bf.handler.guid=bg.guid}}a6.push(bf);a.event.global[be]=true}a7=null},global:{},remove:function(bj,be,a6,ba){if(bj.nodeType===3||bj.nodeType===8){return}if(a6===false){a6=aV}var bm,a9,bb,bg,bh=0,a7,bc,bf,a8,bd,a4,bl,bi=a.hasData(bj)&&a._data(bj),a5=bi&&bi[ay];if(!bi||!a5){return}if(typeof a5==="function"){bi=a5;a5=a5.events}if(be&&be.type){a6=be.handler;be=be.type}if(!be||typeof be==="string"&&be.charAt(0)==="."){be=be||"";for(a9 in a5){a.event.remove(bj,a9+be)}return}be=be.split(" ");while((a9=be[bh++])){bl=a9;a4=null;a7=a9.indexOf(".")<0;bc=[];if(!a7){bc=a9.split(".");a9=bc.shift();bf=new RegExp("(^|\\.)"+a.map(bc.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")}bd=a5[a9];if(!bd){continue}if(!a6){for(bg=0;bg<bd.length;bg++){a4=bd[bg];if(a7||bf.test(a4.namespace)){a.event.remove(bj,bl,a4.handler,bg);bd.splice(bg--,1)}}continue}a8=a.event.special[a9]||{};for(bg=ba||0;bg<bd.length;bg++){a4=bd[bg];if(a6.guid===a4.guid){if(a7||bf.test(a4.namespace)){if(ba==null){bd.splice(bg--,1)}if(a8.remove){a8.remove.call(bj,a4)}}if(ba!=null){break}}}if(bd.length===0||ba!=null&&bd.length===1){if(!a8.teardown||a8.teardown.call(bj,bc)===false){a.removeEvent(bj,a9,bi.handle)}bm=null;delete a5[a9]}}if(a.isEmptyObject(a5)){var bk=bi.handle;if(bk){bk.elem=null}delete bi.events;delete bi.handle;if(typeof bi==="function"){a.removeData(bj,ay,true)}else{if(a.isEmptyObject(bi)){a.removeData(bj,E,true)}}}},trigger:function(a5,ba,a7){var be=a5.type||a5,a9=arguments[3];if(!a9){a5=typeof a5==="object"?a5[a.expando]?a5:a.extend(a.Event(be),a5):a.Event(be);if(be.indexOf("!")>=0){a5.type=be=be.slice(0,-1);a5.exclusive=true}if(!a7){a5.stopPropagation();if(a.event.global[be]){a.each(a.cache,function(){var bj=a.expando,bi=this[bj];if(bi&&bi.events&&bi.events[be]){a.event.trigger(a5,ba,bi.handle.elem)}})}}if(!a7||a7.nodeType===3||a7.nodeType===8){return E}a5.result=E;a5.target=a7;ba=a.makeArray(ba);ba.unshift(a5)}a5.currentTarget=a7;var bb=a7.nodeType?a._data(a7,"handle"):(a._data(a7,ay)||{}).handle;if(bb){bb.apply(a7,ba)}var bg=a7.parentNode||a7.ownerDocument;try{if(!(a7&&a7.nodeName&&a.noData[a7.nodeName.toLowerCase()])){if(a7["on"+be]&&a7["on"+be].apply(a7,ba)===false){a5.result=false;a5.preventDefault()}}}catch(bf){}if(!a5.isPropagationStopped()&&bg){a.event.trigger(a5,ba,bg,true)}else{if(!a5.isDefaultPrevented()){var a6,bc=a5.target,a4=be.replace(aG,""),bh=a.nodeName(bc,"a")&&a4==="click",bd=a.event.special[a4]||{};if((!bd._default||bd._default.call(a7,a5)===false)&&!bh&&!(bc&&bc.nodeName&&a.noData[bc.nodeName.toLowerCase()])){try{if(bc[a4]){a6=bc["on"+a4];if(a6){bc["on"+a4]=null}a.event.triggered=true;bc[a4]()}}catch(a8){}if(a6){bc["on"+a4]=a6}a.event.triggered=false}}}},handle:function(a4){var bd,a6,a5,bf,be,a9=[],bb=a.makeArray(arguments);a4=bb[0]=a.event.fix(a4||aP.event);a4.currentTarget=this;bd=a4.type.indexOf(".")<0&&!a4.exclusive;if(!bd){a5=a4.type.split(".");a4.type=a5.shift();a9=a5.slice(0).sort();bf=new RegExp("(^|\\.)"+a9.join("\\.(?:.*\\.)?")+"(\\.|$)")}a4.namespace=a4.namespace||a9.join(".");be=a._data(this,ay);if(typeof be==="function"){be=be.events}a6=(be||{})[a4.type];if(be&&a6){a6=a6.slice(0);for(var a8=0,a7=a6.length;a8<a7;a8++){var bc=a6[a8];if(bd||bf.test(bc.namespace)){a4.handler=bc.handler;a4.data=bc.data;a4.handleObj=bc;var ba=bc.handler.apply(this,bb);if(ba!==E){a4.result=ba;if(ba===false){a4.preventDefault();a4.stopPropagation()}}if(a4.isImmediatePropagationStopped()){break}}}}return a4.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a7){if(a7[a.expando]){return a7}var a5=a7;a7=a.Event(a5);for(var a6=this.props.length,a9;a6;){a9=this.props[--a6];a7[a9]=a5[a9]}if(!a7.target){a7.target=a7.srcElement||ae}if(a7.target.nodeType===3){a7.target=a7.target.parentNode}if(!a7.relatedTarget&&a7.fromElement){a7.relatedTarget=a7.fromElement===a7.target?a7.toElement:a7.fromElement}if(a7.pageX==null&&a7.clientX!=null){var a8=ae.documentElement,a4=ae.body;a7.pageX=a7.clientX+(a8&&a8.scrollLeft||a4&&a4.scrollLeft||0)-(a8&&a8.clientLeft||a4&&a4.clientLeft||0);a7.pageY=a7.clientY+(a8&&a8.scrollTop||a4&&a4.scrollTop||0)-(a8&&a8.clientTop||a4&&a4.clientTop||0)}if(a7.which==null&&(a7.charCode!=null||a7.keyCode!=null)){a7.which=a7.charCode!=null?a7.charCode:a7.keyCode}if(!a7.metaKey&&a7.ctrlKey){a7.metaKey=a7.ctrlKey}if(!a7.which&&a7.button!==E){a7.which=(a7.button&1?1:(a7.button&2?3:(a7.button&4?2:0)))}return a7},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(a4){a.event.add(this,m(a4.origType,a4.selector),a.extend({},a4,{handler:Y,guid:a4.handler.guid}))},remove:function(a4){a.event.remove(this,m(a4.origType,a4.selector),a4)}},beforeunload:{setup:function(a6,a5,a4){if(a.isWindow(this)){this.onbeforeunload=a4}},teardown:function(a5,a4){if(this.onbeforeunload===a4){this.onbeforeunload=null}}}}};a.removeEvent=ae.removeEventListener?function(a5,a4,a6){if(a5.removeEventListener){a5.removeEventListener(a4,a6,false)}}:function(a5,a4,a6){if(a5.detachEvent){a5.detachEvent("on"+a4,a6)}};a.Event=function(a4){if(!this.preventDefault){return new a.Event(a4)}if(a4&&a4.type){this.originalEvent=a4;this.type=a4.type;this.isDefaultPrevented=(a4.defaultPrevented||a4.returnValue===false||a4.getPreventDefault&&a4.getPreventDefault())?g:aV}else{this.type=a4}this.timeStamp=a.now();this[a.expando]=true};function aV(){return false}function g(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=g;var a4=this.originalEvent;if(!a4){return}if(a4.preventDefault){a4.preventDefault()}else{a4.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=g;var a4=this.originalEvent;if(!a4){return}if(a4.stopPropagation){a4.stopPropagation()}a4.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=g;this.stopPropagation()},isDefaultPrevented:aV,isPropagationStopped:aV,isImmediatePropagationStopped:aV};var T=function(a5){var a4=a5.relatedTarget;try{while(a4&&a4!==this){a4=a4.parentNode}if(a4!==this){a5.type=a5.data;a.event.handle.apply(this,arguments)}}catch(a6){}},az=function(a4){a4.type=a4.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a5,a4){a.event.special[a5]={setup:function(a6){a.event.add(this,a4,a6&&a6.selector?az:T,a5)},teardown:function(a6){a.event.remove(this,a4,a6&&a6.selector?az:T)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(a5,a4){if(this.nodeName&&this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(a8){var a7=a8.target,a6=a7.type;if((a6==="submit"||a6==="image")&&a(a7).closest("form").length){a8.liveFired=E;return aD("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(a8){var a7=a8.target,a6=a7.type;if((a6==="text"||a6==="password")&&a(a7).closest("form").length&&a8.keyCode===13){a8.liveFired=E;return aD("submit",this,arguments)}})}else{return false}},teardown:function(a4){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var aW,i=function(a5){var a4=a5.type,a6=a5.value;if(a4==="radio"||a4==="checkbox"){a6=a5.checked}else{if(a4==="select-multiple"){a6=a5.selectedIndex>-1?a.map(a5.options,function(a7){return a7.selected}).join("-"):""}else{if(a5.nodeName.toLowerCase()==="select"){a6=a5.selectedIndex}}}return a6},R=function R(a6){var a4=a6.target,a5,a7;if(!aR.test(a4.nodeName)||a4.readOnly){return}a5=a._data(a4,"_change_data");a7=i(a4);if(a6.type!=="focusout"||a4.type!=="radio"){a._data(a4,"_change_data",a7)}if(a5===E||a7===a5){return}if(a5!=null||a7){a6.type="change";a6.liveFired=E;return a.event.trigger(a6,arguments[1],a4)}};a.event.special.change={filters:{focusout:R,beforedeactivate:R,click:function(a6){var a5=a6.target,a4=a5.type;if(a4==="radio"||a4==="checkbox"||a5.nodeName.toLowerCase()==="select"){return R.call(this,a6)}},keydown:function(a6){var a5=a6.target,a4=a5.type;if((a6.keyCode===13&&a5.nodeName.toLowerCase()!=="textarea")||(a6.keyCode===32&&(a4==="checkbox"||a4==="radio"))||a4==="select-multiple"){return R.call(this,a6)}},beforeactivate:function(a5){var a4=a5.target;a._data(a4,"_change_data",i(a4))}},setup:function(a6,a5){if(this.type==="file"){return false}for(var a4 in aW){a.event.add(this,a4+".specialChange",aW[a4])}return aR.test(this.nodeName)},teardown:function(a4){a.event.remove(this,".specialChange");return aR.test(this.nodeName)}};aW=a.event.special.change.filters;aW.focus=aW.beforeactivate}function aD(a5,a6,a4){a4[0].type=a5;return a.event.handle.apply(a6,a4)}if(ae.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(a6,a4){a.event.special[a4]={setup:function(){this.addEventListener(a6,a5,true)},teardown:function(){this.removeEventListener(a6,a5,true)}};function a5(a7){a7=a.event.fix(a7);a7.type=a4;return a.event.handle.call(this,a7)}})}a.each(["bind","one"],function(a5,a4){a.fn[a4]=function(bb,bc,ba){if(typeof bb==="object"){for(var a8 in bb){this[a4](a8,bc,bb[a8],ba)}return this}if(a.isFunction(bc)||bc===false){ba=bc;bc=E}var a9=a4==="one"?a.proxy(ba,function(bd){a(this).unbind(bd,a9);return ba.apply(this,arguments)}):ba;if(bb==="unload"&&a4!=="one"){this.one(bb,bc,ba)}else{for(var a7=0,a6=this.length;a7<a6;a7++){a.event.add(this[a7],bb,a9,bc)}}return this}});a.fn.extend({unbind:function(a8,a7){if(typeof a8==="object"&&!a8.preventDefault){for(var a6 in a8){this.unbind(a6,a8[a6])}}else{for(var a5=0,a4=this.length;a5<a4;a5++){a.event.remove(this[a5],a8,a7)}}return this},delegate:function(a4,a5,a7,a6){return this.live(a5,a7,a6,a4)},undelegate:function(a4,a5,a6){if(arguments.length===0){return this.unbind("live")}else{return this.die(a5,null,a6,a4)}},trigger:function(a4,a5){return this.each(function(){a.event.trigger(a4,a5,this)})},triggerHandler:function(a4,a6){if(this[0]){var a5=a.Event(a4);a5.preventDefault();a5.stopPropagation();a.event.trigger(a5,a6,this[0]);return a5.result}},toggle:function(a6){var a4=arguments,a5=1;while(a5<a4.length){a.proxy(a6,a4[a5++])}return this.click(a.proxy(a6,function(a7){var a8=(a._data(this,"lastToggle"+a6.guid)||0)%a5;a._data(this,"lastToggle"+a6.guid,a8+1);a7.preventDefault();return a4[a8].apply(this,arguments)||false}))},hover:function(a4,a5){return this.mouseenter(a4).mouseleave(a5||a4)}});var aw={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(a5,a4){a.fn[a4]=function(bf,bc,bh,a8){var bg,bd=0,be,a7,bj,ba=a8||this.selector,a6=a8?this:a(this.context);if(typeof bf==="object"&&!bf.preventDefault){for(var bi in bf){a6[a4](bi,bc,bf[bi],ba)}return this}if(a.isFunction(bc)){bh=bc;bc=E}bf=(bf||"").split(" ");while((bg=bf[bd++])!=null){be=aG.exec(bg);a7="";if(be){a7=be[0];bg=bg.replace(aG,"")}if(bg==="hover"){bf.push("mouseenter"+a7,"mouseleave"+a7);continue}bj=bg;if(bg==="focus"||bg==="blur"){bf.push(aw[bg]+a7);bg=bg+a7}else{bg=(aw[bg]||bg)+a7}if(a4==="live"){for(var bb=0,a9=a6.length;bb<a9;bb++){a.event.add(a6[bb],"live."+m(bg,ba),{data:bc,selector:ba,handler:bh,origType:bg,origHandler:bh,preType:bj})}}else{a6.unbind("live."+m(bg,ba),bh)}}return this}});function Y(bf){var bc,a7,bl,a9,a4,bh,be,bg,bd,bk,bb,ba,bj,bi=[],a8=[],a5=a._data(this,ay);if(typeof a5==="function"){a5=a5.events}if(bf.liveFired===this||!a5||!a5.live||bf.target.disabled||bf.button&&bf.type==="click"){return}if(bf.namespace){ba=new RegExp("(^|\\.)"+bf.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}bf.liveFired=this;var a6=a5.live.slice(0);for(be=0;be<a6.length;be++){a4=a6[be];if(a4.origType.replace(aG,"")===bf.type){a8.push(a4.selector)}else{a6.splice(be--,1)}}a9=a(bf.target).closest(a8,bf.currentTarget);for(bg=0,bd=a9.length;bg<bd;bg++){bb=a9[bg];for(be=0;be<a6.length;be++){a4=a6[be];if(bb.selector===a4.selector&&(!ba||ba.test(a4.namespace))){bh=bb.elem;bl=null;if(a4.preType==="mouseenter"||a4.preType==="mouseleave"){bf.type=a4.preType;bl=a(bf.relatedTarget).closest(a4.selector)[0]}if(!bl||bl!==bh){bi.push({elem:bh,handleObj:a4,level:bb.level})}}}}for(bg=0,bd=bi.length;bg<bd;bg++){a9=bi[bg];if(a7&&a9.level>a7){break}bf.currentTarget=a9.elem;bf.data=a9.handleObj.data;bf.handleObj=a9.handleObj;bj=a9.handleObj.origHandler.apply(a9.elem,arguments);if(bj===false||bf.isPropagationStopped()){a7=a9.level;if(bj===false){bc=false}if(bf.isImmediatePropagationStopped()){break}}}return bc}function m(a5,a4){return(a5&&a5!=="*"?a5+".":"")+a4.replace(G,"`").replace(U,"&")}a.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(a5,a4){a.fn[a4]=function(a7,a6){if(a6==null){a6=a7;a7=null}return arguments.length>0?this.bind(a4,a7,a6):this.trigger(a4)};if(a.attrFn){a.attrFn[a4]=true}}); /* - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ -}(function(){var a9=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,ba=0,bc=Object.prototype.toString,a4=false,a3=true;[0,0].sort(function(){a3=false;return 0});var a0=function(bl,bg,bo,bp){bo=bo||[];var br=bg=bg||ab;if(bg.nodeType!==1&&bg.nodeType!==9){return[]}if(!bl||typeof bl!=="string"){return bo}var bm=[],bi,bt,bw,bh,bk=true,bj=a1(bg),bq=bl;while((a9.exec(""),bi=a9.exec(bq))!==null){bq=bi[3];bm.push(bi[1]);if(bi[2]){bh=bi[3];break}}if(bm.length>1&&a5.exec(bl)){if(bm.length===2&&a6.relative[bm[0]]){bt=bd(bm[0]+bm[1],bg)}else{bt=a6.relative[bm[0]]?[bg]:a0(bm.shift(),bg);while(bm.length){bl=bm.shift();if(a6.relative[bl]){bl+=bm.shift()}bt=bd(bl,bt)}}}else{if(!bp&&bm.length>1&&bg.nodeType===9&&!bj&&a6.match.ID.test(bm[0])&&!a6.match.ID.test(bm[bm.length-1])){var bs=a0.find(bm.shift(),bg,bj);bg=bs.expr?a0.filter(bs.expr,bs.set)[0]:bs.set[0]}if(bg){var bs=bp?{expr:bm.pop(),set:a8(bp)}:a0.find(bm.pop(),bm.length===1&&(bm[0]==="~"||bm[0]==="+")&&bg.parentNode?bg.parentNode:bg,bj);bt=bs.expr?a0.filter(bs.expr,bs.set):bs.set;if(bm.length>0){bw=a8(bt)}else{bk=false}while(bm.length){var bv=bm.pop(),bu=bv;if(!a6.relative[bv]){bv=""}else{bu=bm.pop()}if(bu==null){bu=bg}a6.relative[bv](bw,bu,bj)}}else{bw=bm=[]}}if(!bw){bw=bt}if(!bw){a0.error(bv||bl)}if(bc.call(bw)==="[object Array]"){if(!bk){bo.push.apply(bo,bw)}else{if(bg&&bg.nodeType===1){for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&(bw[bn]===true||bw[bn].nodeType===1&&a7(bg,bw[bn]))){bo.push(bt[bn])}}}else{for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&bw[bn].nodeType===1){bo.push(bt[bn])}}}}}else{a8(bw,bo)}if(bh){a0(bh,br,bo,bp);a0.uniqueSort(bo)}return bo};a0.uniqueSort=function(bh){if(bb){a4=a3;bh.sort(bb);if(a4){for(var bg=1;bg<bh.length;bg++){if(bh[bg]===bh[bg-1]){bh.splice(bg--,1)}}}}return bh};a0.matches=function(bg,bh){return a0(bg,null,null,bh)};a0.find=function(bn,bg,bo){var bm,bk;if(!bn){return[]}for(var bj=0,bi=a6.order.length;bj<bi;bj++){var bl=a6.order[bj],bk;if((bk=a6.leftMatch[bl].exec(bn))){var bh=bk[1];bk.splice(1,1);if(bh.substr(bh.length-1)!=="\\"){bk[1]=(bk[1]||"").replace(/\\/g,"");bm=a6.find[bl](bk,bg,bo);if(bm!=null){bn=bn.replace(a6.match[bl],"");break}}}}if(!bm){bm=bg.getElementsByTagName("*")}return{set:bm,expr:bn}};a0.filter=function(br,bq,bu,bk){var bi=br,bw=[],bo=bq,bm,bg,bn=bq&&bq[0]&&a1(bq[0]);while(br&&bq.length){for(var bp in a6.filter){if((bm=a6.leftMatch[bp].exec(br))!=null&&bm[2]){var bh=a6.filter[bp],bv,bt,bj=bm[1];bg=false;bm.splice(1,1);if(bj.substr(bj.length-1)==="\\"){continue}if(bo===bw){bw=[]}if(a6.preFilter[bp]){bm=a6.preFilter[bp](bm,bo,bu,bw,bk,bn);if(!bm){bg=bv=true}else{if(bm===true){continue}}}if(bm){for(var bl=0;(bt=bo[bl])!=null;bl++){if(bt){bv=bh(bt,bm,bl,bo);var bs=bk^!!bv;if(bu&&bv!=null){if(bs){bg=true}else{bo[bl]=false}}else{if(bs){bw.push(bt);bg=true}}}}}if(bv!==C){if(!bu){bo=bw}br=br.replace(a6.match[bp],"");if(!bg){return[]}break}}}if(br===bi){if(bg==null){a0.error(br)}else{break}}bi=br}return bo};a0.error=function(bg){throw"Syntax error, unrecognized expression: "+bg};var a6=a0.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bg){return bg.getAttribute("href")}},relative:{"+":function(bm,bh){var bj=typeof bh==="string",bl=bj&&!/\W/.test(bh),bn=bj&&!bl;if(bl){bh=bh.toLowerCase()}for(var bi=0,bg=bm.length,bk;bi<bg;bi++){if((bk=bm[bi])){while((bk=bk.previousSibling)&&bk.nodeType!==1){}bm[bi]=bn||bk&&bk.nodeName.toLowerCase()===bh?bk||false:bk===bh}}if(bn){a0.filter(bh,bm,true)}},">":function(bm,bh){var bk=typeof bh==="string";if(bk&&!/\W/.test(bh)){bh=bh.toLowerCase();for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){var bj=bl.parentNode;bm[bi]=bj.nodeName.toLowerCase()===bh?bj:false}}}else{for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){bm[bi]=bk?bl.parentNode:bl.parentNode===bh}}if(bk){a0.filter(bh,bm,true)}}},"":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("parentNode",bh,bi,bj,bk,bl)},"~":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("previousSibling",bh,bi,bj,bk,bl)}},find:{ID:function(bh,bi,bj){if(typeof bi.getElementById!=="undefined"&&!bj){var bg=bi.getElementById(bh[1]);return bg?[bg]:[]}},NAME:function(bi,bl){if(typeof bl.getElementsByName!=="undefined"){var bh=[],bk=bl.getElementsByName(bi[1]);for(var bj=0,bg=bk.length;bj<bg;bj++){if(bk[bj].getAttribute("name")===bi[1]){bh.push(bk[bj])}}return bh.length===0?null:bh}},TAG:function(bg,bh){return bh.getElementsByTagName(bg[1])}},preFilter:{CLASS:function(bj,bh,bi,bg,bm,bn){bj=" "+bj[1].replace(/\\/g,"")+" ";if(bn){return bj}for(var bk=0,bl;(bl=bh[bk])!=null;bk++){if(bl){if(bm^(bl.className&&(" "+bl.className+" ").replace(/[\t\n]/g," ").indexOf(bj)>=0)){if(!bi){bg.push(bl)}}else{if(bi){bh[bk]=false}}}}return false},ID:function(bg){return bg[1].replace(/\\/g,"")},TAG:function(bh,bg){return bh[1].toLowerCase()},CHILD:function(bg){if(bg[1]==="nth"){var bh=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(bg[2]==="even"&&"2n"||bg[2]==="odd"&&"2n+1"||!/\D/.test(bg[2])&&"0n+"+bg[2]||bg[2]);bg[2]=(bh[1]+(bh[2]||1))-0;bg[3]=bh[3]-0}bg[0]=ba++;return bg},ATTR:function(bk,bh,bi,bg,bl,bm){var bj=bk[1].replace(/\\/g,"");if(!bm&&a6.attrMap[bj]){bk[1]=a6.attrMap[bj]}if(bk[2]==="~="){bk[4]=" "+bk[4]+" "}return bk},PSEUDO:function(bk,bh,bi,bg,bl){if(bk[1]==="not"){if((a9.exec(bk[3])||"").length>1||/^\w/.test(bk[3])){bk[3]=a0(bk[3],null,null,bh)}else{var bj=a0.filter(bk[3],bh,bi,true^bl);if(!bi){bg.push.apply(bg,bj)}return false}}else{if(a6.match.POS.test(bk[0])||a6.match.CHILD.test(bk[0])){return true}}return bk},POS:function(bg){bg.unshift(true);return bg}},filters:{enabled:function(bg){return bg.disabled===false&&bg.type!=="hidden"},disabled:function(bg){return bg.disabled===true},checked:function(bg){return bg.checked===true},selected:function(bg){bg.parentNode.selectedIndex;return bg.selected===true},parent:function(bg){return !!bg.firstChild},empty:function(bg){return !bg.firstChild},has:function(bi,bh,bg){return !!a0(bg[3],bi).length},header:function(bg){return/h\d/i.test(bg.nodeName)},text:function(bg){return"text"===bg.type},radio:function(bg){return"radio"===bg.type},checkbox:function(bg){return"checkbox"===bg.type},file:function(bg){return"file"===bg.type},password:function(bg){return"password"===bg.type},submit:function(bg){return"submit"===bg.type},image:function(bg){return"image"===bg.type},reset:function(bg){return"reset"===bg.type},button:function(bg){return"button"===bg.type||bg.nodeName.toLowerCase()==="button"},input:function(bg){return/input|select|textarea|button/i.test(bg.nodeName)}},setFilters:{first:function(bh,bg){return bg===0},last:function(bi,bh,bg,bj){return bh===bj.length-1},even:function(bh,bg){return bg%2===0},odd:function(bh,bg){return bg%2===1},lt:function(bi,bh,bg){return bh<bg[3]-0},gt:function(bi,bh,bg){return bh>bg[3]-0},nth:function(bi,bh,bg){return bg[3]-0===bh},eq:function(bi,bh,bg){return bg[3]-0===bh}},filter:{PSEUDO:function(bm,bi,bj,bn){var bh=bi[1],bk=a6.filters[bh];if(bk){return bk(bm,bj,bi,bn)}else{if(bh==="contains"){return(bm.textContent||bm.innerText||aZ([bm])||"").indexOf(bi[3])>=0}else{if(bh==="not"){var bl=bi[3];for(var bj=0,bg=bl.length;bj<bg;bj++){if(bl[bj]===bm){return false}}return true}else{a0.error("Syntax error, unrecognized expression: "+bh)}}}},CHILD:function(bg,bj){var bm=bj[1],bh=bg;switch(bm){case"only":case"first":while((bh=bh.previousSibling)){if(bh.nodeType===1){return false}}if(bm==="first"){return true}bh=bg;case"last":while((bh=bh.nextSibling)){if(bh.nodeType===1){return false}}return true;case"nth":var bi=bj[2],bp=bj[3];if(bi===1&&bp===0){return true}var bl=bj[0],bo=bg.parentNode;if(bo&&(bo.sizcache!==bl||!bg.nodeIndex)){var bk=0;for(bh=bo.firstChild;bh;bh=bh.nextSibling){if(bh.nodeType===1){bh.nodeIndex=++bk}}bo.sizcache=bl}var bn=bg.nodeIndex-bp;if(bi===0){return bn===0}else{return(bn%bi===0&&bn/bi>=0)}}},ID:function(bh,bg){return bh.nodeType===1&&bh.getAttribute("id")===bg},TAG:function(bh,bg){return(bg==="*"&&bh.nodeType===1)||bh.nodeName.toLowerCase()===bg},CLASS:function(bh,bg){return(" "+(bh.className||bh.getAttribute("class"))+" ").indexOf(bg)>-1},ATTR:function(bl,bj){var bi=bj[1],bg=a6.attrHandle[bi]?a6.attrHandle[bi](bl):bl[bi]!=null?bl[bi]:bl.getAttribute(bi),bm=bg+"",bk=bj[2],bh=bj[4];return bg==null?bk==="!=":bk==="="?bm===bh:bk==="*="?bm.indexOf(bh)>=0:bk==="~="?(" "+bm+" ").indexOf(bh)>=0:!bh?bm&&bg!==false:bk==="!="?bm!==bh:bk==="^="?bm.indexOf(bh)===0:bk==="$="?bm.substr(bm.length-bh.length)===bh:bk==="|="?bm===bh||bm.substr(0,bh.length+1)===bh+"-":false},POS:function(bk,bh,bi,bl){var bg=bh[2],bj=a6.setFilters[bg];if(bj){return bj(bk,bi,bh,bl)}}}};var a5=a6.match.POS;for(var a2 in a6.match){a6.match[a2]=new RegExp(a6.match[a2].source+/(?![^\[]*\])(?![^\(]*\))/.source);a6.leftMatch[a2]=new RegExp(/(^(?:.|\r|\n)*?)/.source+a6.match[a2].source.replace(/\\(\d+)/g,function(bh,bg){return"\\"+(bg-0+1)}))}var a8=function(bh,bg){bh=Array.prototype.slice.call(bh,0);if(bg){bg.push.apply(bg,bh);return bg}return bh};try{Array.prototype.slice.call(ab.documentElement.childNodes,0)[0].nodeType}catch(bf){a8=function(bk,bj){var bh=bj||[];if(bc.call(bk)==="[object Array]"){Array.prototype.push.apply(bh,bk)}else{if(typeof bk.length==="number"){for(var bi=0,bg=bk.length;bi<bg;bi++){bh.push(bk[bi])}}else{for(var bi=0;bk[bi];bi++){bh.push(bk[bi])}}}return bh}}var bb;if(ab.documentElement.compareDocumentPosition){bb=function(bh,bg){if(!bh.compareDocumentPosition||!bg.compareDocumentPosition){if(bh==bg){a4=true}return bh.compareDocumentPosition?-1:1}var bi=bh.compareDocumentPosition(bg)&4?-1:bh===bg?0:1;if(bi===0){a4=true}return bi}}else{if("sourceIndex" in ab.documentElement){bb=function(bh,bg){if(!bh.sourceIndex||!bg.sourceIndex){if(bh==bg){a4=true}return bh.sourceIndex?-1:1}var bi=bh.sourceIndex-bg.sourceIndex;if(bi===0){a4=true}return bi}}else{if(ab.createRange){bb=function(bj,bh){if(!bj.ownerDocument||!bh.ownerDocument){if(bj==bh){a4=true}return bj.ownerDocument?-1:1}var bi=bj.ownerDocument.createRange(),bg=bh.ownerDocument.createRange();bi.setStart(bj,0);bi.setEnd(bj,0);bg.setStart(bh,0);bg.setEnd(bh,0);var bk=bi.compareBoundaryPoints(Range.START_TO_END,bg);if(bk===0){a4=true}return bk}}}}function aZ(bg){var bh="",bj;for(var bi=0;bg[bi];bi++){bj=bg[bi];if(bj.nodeType===3||bj.nodeType===4){bh+=bj.nodeValue}else{if(bj.nodeType!==8){bh+=aZ(bj.childNodes)}}}return bh}(function(){var bh=ab.createElement("div"),bi="script"+(new Date).getTime();bh.innerHTML="<a name='"+bi+"'/>";var bg=ab.documentElement;bg.insertBefore(bh,bg.firstChild);if(ab.getElementById(bi)){a6.find.ID=function(bk,bl,bm){if(typeof bl.getElementById!=="undefined"&&!bm){var bj=bl.getElementById(bk[1]);return bj?bj.id===bk[1]||typeof bj.getAttributeNode!=="undefined"&&bj.getAttributeNode("id").nodeValue===bk[1]?[bj]:C:[]}};a6.filter.ID=function(bl,bj){var bk=typeof bl.getAttributeNode!=="undefined"&&bl.getAttributeNode("id");return bl.nodeType===1&&bk&&bk.nodeValue===bj}}bg.removeChild(bh);bg=bh=null})();(function(){var bg=ab.createElement("div");bg.appendChild(ab.createComment(""));if(bg.getElementsByTagName("*").length>0){a6.find.TAG=function(bh,bl){var bk=bl.getElementsByTagName(bh[1]);if(bh[1]==="*"){var bj=[];for(var bi=0;bk[bi];bi++){if(bk[bi].nodeType===1){bj.push(bk[bi])}}bk=bj}return bk}}bg.innerHTML="<a href='#'></a>";if(bg.firstChild&&typeof bg.firstChild.getAttribute!=="undefined"&&bg.firstChild.getAttribute("href")!=="#"){a6.attrHandle.href=function(bh){return bh.getAttribute("href",2)}}bg=null})();if(ab.querySelectorAll){(function(){var bg=a0,bi=ab.createElement("div");bi.innerHTML="<p class='TEST'></p>";if(bi.querySelectorAll&&bi.querySelectorAll(".TEST").length===0){return}a0=function(bm,bl,bj,bk){bl=bl||ab;if(!bk&&bl.nodeType===9&&!a1(bl)){try{return a8(bl.querySelectorAll(bm),bj)}catch(bn){}}return bg(bm,bl,bj,bk)};for(var bh in bg){a0[bh]=bg[bh]}bi=null})()}(function(){var bg=ab.createElement("div");bg.innerHTML="<div class='test e'></div><div class='test'></div>";if(!bg.getElementsByClassName||bg.getElementsByClassName("e").length===0){return}bg.lastChild.className="e";if(bg.getElementsByClassName("e").length===1){return}a6.order.splice(1,0,"CLASS");a6.find.CLASS=function(bh,bi,bj){if(typeof bi.getElementsByClassName!=="undefined"&&!bj){return bi.getElementsByClassName(bh[1])}};bg=null})();function aY(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1&&!bo){bg.sizcache=bl;bg.sizset=bj}if(bg.nodeName.toLowerCase()===bm){bk=bg;break}bg=bg[bh]}bp[bj]=bk}}}function be(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1){if(!bo){bg.sizcache=bl;bg.sizset=bj}if(typeof bm!=="string"){if(bg===bm){bk=true;break}}else{if(a0.filter(bm,[bg]).length>0){bk=bg;break}}}bg=bg[bh]}bp[bj]=bk}}}var a7=ab.compareDocumentPosition?function(bh,bg){return !!(bh.compareDocumentPosition(bg)&16)}:function(bh,bg){return bh!==bg&&(bh.contains?bh.contains(bg):true)};var a1=function(bg){var bh=(bg?bg.ownerDocument||bg:0).documentElement;return bh?bh.nodeName!=="HTML":false};var bd=function(bg,bn){var bj=[],bk="",bl,bi=bn.nodeType?[bn]:bn;while((bl=a6.match.PSEUDO.exec(bg))){bk+=bl[0];bg=bg.replace(a6.match.PSEUDO,"")}bg=a6.relative[bg]?bg+"*":bg;for(var bm=0,bh=bi.length;bm<bh;bm++){a0(bg,bi[bm],bj)}return a0.filter(bk,bj)};a.find=a0;a.expr=a0.selectors;a.expr[":"]=a.expr.filters;a.unique=a0.uniqueSort;a.text=aZ;a.isXMLDoc=a1;a.contains=a7;return;aM.Sizzle=a0})();var N=/Until$/,Y=/^(?:parents|prevUntil|prevAll)/,aL=/,/,F=Array.prototype.slice;var ai=function(a1,a0,aY){if(a.isFunction(a0)){return a.grep(a1,function(a3,a2){return !!a0.call(a3,a2,a3)===aY})}else{if(a0.nodeType){return a.grep(a1,function(a3,a2){return(a3===a0)===aY})}else{if(typeof a0==="string"){var aZ=a.grep(a1,function(a2){return a2.nodeType===1});if(aW.test(a0)){return a.filter(a0,aZ,!aY)}else{a0=a.filter(a0,aZ)}}}}return a.grep(a1,function(a3,a2){return(a.inArray(a3,a0)>=0)===aY})};a.fn.extend({find:function(aY){var a0=this.pushStack("","find",aY),a3=0;for(var a1=0,aZ=this.length;a1<aZ;a1++){a3=a0.length;a.find(aY,this[a1],a0);if(a1>0){for(var a4=a3;a4<a0.length;a4++){for(var a2=0;a2<a3;a2++){if(a0[a2]===a0[a4]){a0.splice(a4--,1);break}}}}}return a0},has:function(aZ){var aY=a(aZ);return this.filter(function(){for(var a1=0,a0=aY.length;a1<a0;a1++){if(a.contains(this,aY[a1])){return true}}})},not:function(aY){return this.pushStack(ai(this,aY,false),"not",aY)},filter:function(aY){return this.pushStack(ai(this,aY,true),"filter",aY)},is:function(aY){return !!aY&&a.filter(aY,this).length>0},closest:function(a7,aY){if(a.isArray(a7)){var a4=[],a6=this[0],a3,a2={},a0;if(a6&&a7.length){for(var a1=0,aZ=a7.length;a1<aZ;a1++){a0=a7[a1];if(!a2[a0]){a2[a0]=a.expr.match.POS.test(a0)?a(a0,aY||this.context):a0}}while(a6&&a6.ownerDocument&&a6!==aY){for(a0 in a2){a3=a2[a0];if(a3.jquery?a3.index(a6)>-1:a(a6).is(a3)){a4.push({selector:a0,elem:a6});delete a2[a0]}}a6=a6.parentNode}}return a4}var a5=a.expr.match.POS.test(a7)?a(a7,aY||this.context):null;return this.map(function(a8,a9){while(a9&&a9.ownerDocument&&a9!==aY){if(a5?a5.index(a9)>-1:a(a9).is(a7)){return a9}a9=a9.parentNode}return null})},index:function(aY){if(!aY||typeof aY==="string"){return a.inArray(this[0],aY?a(aY):this.parent().children())}return a.inArray(aY.jquery?aY[0]:aY,this)},add:function(aY,aZ){var a1=typeof aY==="string"?a(aY,aZ||this.context):a.makeArray(aY),a0=a.merge(this.get(),a1);return this.pushStack(y(a1[0])||y(a0[0])?a0:a.unique(a0))},andSelf:function(){return this.add(this.prevObject)}});function y(aY){return !aY||!aY.parentNode||aY.parentNode.nodeType===11}a.each({parent:function(aZ){var aY=aZ.parentNode;return aY&&aY.nodeType!==11?aY:null},parents:function(aY){return a.dir(aY,"parentNode")},parentsUntil:function(aZ,aY,a0){return a.dir(aZ,"parentNode",a0)},next:function(aY){return a.nth(aY,2,"nextSibling")},prev:function(aY){return a.nth(aY,2,"previousSibling")},nextAll:function(aY){return a.dir(aY,"nextSibling")},prevAll:function(aY){return a.dir(aY,"previousSibling")},nextUntil:function(aZ,aY,a0){return a.dir(aZ,"nextSibling",a0)},prevUntil:function(aZ,aY,a0){return a.dir(aZ,"previousSibling",a0)},siblings:function(aY){return a.sibling(aY.parentNode.firstChild,aY)},children:function(aY){return a.sibling(aY.firstChild)},contents:function(aY){return a.nodeName(aY,"iframe")?aY.contentDocument||aY.contentWindow.document:a.makeArray(aY.childNodes)}},function(aY,aZ){a.fn[aY]=function(a2,a0){var a1=a.map(this,aZ,a2);if(!N.test(aY)){a0=a2}if(a0&&typeof a0==="string"){a1=a.filter(a0,a1)}a1=this.length>1?a.unique(a1):a1;if((this.length>1||aL.test(a0))&&Y.test(aY)){a1=a1.reverse()}return this.pushStack(a1,aY,F.call(arguments).join(","))}});a.extend({filter:function(a0,aY,aZ){if(aZ){a0=":not("+a0+")"}return a.find.matches(a0,aY)},dir:function(a0,aZ,a2){var aY=[],a1=a0[aZ];while(a1&&a1.nodeType!==9&&(a2===C||a1.nodeType!==1||!a(a1).is(a2))){if(a1.nodeType===1){aY.push(a1)}a1=a1[aZ]}return aY},nth:function(a2,aY,a0,a1){aY=aY||1;var aZ=0;for(;a2;a2=a2[a0]){if(a2.nodeType===1&&++aZ===aY){break}}return a2},sibling:function(a0,aZ){var aY=[];for(;a0;a0=a0.nextSibling){if(a0.nodeType===1&&a0!==aZ){aY.push(a0)}}return aY}});var T=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,H=/(<([\w:]+)[^>]*?)\/>/g,al=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,c=/<([\w:]+)/,t=/<tbody/i,L=/<|?\w+;/,E=/<script|<object|<embed|<option|<style/i,l=/checked\s*(?:[^=]|=\s*.checked.)/i,p=function(aZ,a0,aY){return al.test(aY)?aZ:a0+"></"+aY+">"},ac={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};ac.optgroup=ac.option;ac.tbody=ac.tfoot=ac.colgroup=ac.caption=ac.thead;ac.th=ac.td;if(!a.support.htmlSerialize){ac._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(aY){if(a.isFunction(aY)){return this.each(function(a0){var aZ=a(this);aZ.text(aY.call(this,a0,aZ.text()))})}if(typeof aY!=="object"&&aY!==C){return this.empty().append((this[0]&&this[0].ownerDocument||ab).createTextNode(aY))}return a.text(this)},wrapAll:function(aY){if(a.isFunction(aY)){return this.each(function(a0){a(this).wrapAll(aY.call(this,a0))})}if(this[0]){var aZ=a(aY,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){aZ.insertBefore(this[0])}aZ.map(function(){var a0=this;while(a0.firstChild&&a0.firstChild.nodeType===1){a0=a0.firstChild}return a0}).append(this)}return this},wrapInner:function(aY){if(a.isFunction(aY)){return this.each(function(aZ){a(this).wrapInner(aY.call(this,aZ))})}return this.each(function(){var aZ=a(this),a0=aZ.contents();if(a0.length){a0.wrapAll(aY)}else{aZ.append(aY)}})},wrap:function(aY){return this.each(function(){a(this).wrapAll(aY)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.appendChild(aY)}})},prepend:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.insertBefore(aY,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this)})}else{if(arguments.length){var aY=a(arguments[0]);aY.push.apply(aY,this.toArray());return this.pushStack(aY,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this.nextSibling)})}else{if(arguments.length){var aY=this.pushStack(this,"after",arguments);aY.push.apply(aY,a(arguments[0]).toArray());return aY}}},remove:function(aY,a1){for(var aZ=0,a0;(a0=this[aZ])!=null;aZ++){if(!aY||a.filter(aY,[a0]).length){if(!a1&&a0.nodeType===1){a.cleanData(a0.getElementsByTagName("*"));a.cleanData([a0])}if(a0.parentNode){a0.parentNode.removeChild(a0)}}}return this},empty:function(){for(var aY=0,aZ;(aZ=this[aY])!=null;aY++){if(aZ.nodeType===1){a.cleanData(aZ.getElementsByTagName("*"))}while(aZ.firstChild){aZ.removeChild(aZ.firstChild)}}return this},clone:function(aZ){var aY=this.map(function(){if(!a.support.noCloneEvent&&!a.isXMLDoc(this)){var a1=this.outerHTML,a0=this.ownerDocument;if(!a1){var a2=a0.createElement("div");a2.appendChild(this.cloneNode(true));a1=a2.innerHTML}return a.clean([a1.replace(T,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(Z,"")],a0)[0]}else{return this.cloneNode(true)}});if(aZ===true){q(this,aY);q(this.find("*"),aY.find("*"))}return aY},html:function(a0){if(a0===C){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(T,""):null}else{if(typeof a0==="string"&&!E.test(a0)&&(a.support.leadingWhitespace||!Z.test(a0))&&!ac[(c.exec(a0)||["",""])[1].toLowerCase()]){a0=a0.replace(H,p);try{for(var aZ=0,aY=this.length;aZ<aY;aZ++){if(this[aZ].nodeType===1){a.cleanData(this[aZ].getElementsByTagName("*"));this[aZ].innerHTML=a0}}}catch(a1){this.empty().append(a0)}}else{if(a.isFunction(a0)){this.each(function(a4){var a3=a(this),a2=a3.html();a3.empty().append(function(){return a0.call(this,a4,a2)})})}else{this.empty().append(a0)}}}return this},replaceWith:function(aY){if(this[0]&&this[0].parentNode){if(a.isFunction(aY)){return this.each(function(a1){var a0=a(this),aZ=a0.html();a0.replaceWith(aY.call(this,a1,aZ))})}if(typeof aY!=="string"){aY=a(aY).detach()}return this.each(function(){var a0=this.nextSibling,aZ=this.parentNode;a(this).remove();if(a0){a(a0).before(aY)}else{a(aZ).append(aY)}})}else{return this.pushStack(a(a.isFunction(aY)?aY():aY),"replaceWith",aY)}},detach:function(aY){return this.remove(aY,true)},domManip:function(a4,a9,a8){var a1,a2,a7=a4[0],aZ=[],a3,a6;if(!a.support.checkClone&&arguments.length===3&&typeof a7==="string"&&l.test(a7)){return this.each(function(){a(this).domManip(a4,a9,a8,true)})}if(a.isFunction(a7)){return this.each(function(bb){var ba=a(this);a4[0]=a7.call(this,bb,a9?ba.html():C);ba.domManip(a4,a9,a8)})}if(this[0]){a6=a7&&a7.parentNode;if(a.support.parentNode&&a6&&a6.nodeType===11&&a6.childNodes.length===this.length){a1={fragment:a6}}else{a1=J(a4,this,aZ)}a3=a1.fragment;if(a3.childNodes.length===1){a2=a3=a3.firstChild}else{a2=a3.firstChild}if(a2){a9=a9&&a.nodeName(a2,"tr");for(var a0=0,aY=this.length;a0<aY;a0++){a8.call(a9?a5(this[a0],a2):this[a0],a0>0||a1.cacheable||this.length>1?a3.cloneNode(true):a3)}}if(aZ.length){a.each(aZ,aV)}}return this;function a5(ba,bb){return a.nodeName(ba,"table")?(ba.getElementsByTagName("tbody")[0]||ba.appendChild(ba.ownerDocument.createElement("tbody"))):ba}}});function q(a0,aY){var aZ=0;aY.each(function(){if(this.nodeName!==(a0[aZ]&&a0[aZ].nodeName)){return}var a5=a.data(a0[aZ++]),a4=a.data(this,a5),a1=a5&&a5.events;if(a1){delete a4.handle;a4.events={};for(var a3 in a1){for(var a2 in a1[a3]){a.event.add(this,a3,a1[a3][a2],a1[a3][a2].data)}}}})}function J(a3,a1,aZ){var a2,aY,a0,a4=(a1&&a1[0]?a1[0].ownerDocument||a1[0]:ab);if(a3.length===1&&typeof a3[0]==="string"&&a3[0].length<512&&a4===ab&&!E.test(a3[0])&&(a.support.checkClone||!l.test(a3[0]))){aY=true;a0=a.fragments[a3[0]];if(a0){if(a0!==1){a2=a0}}}if(!a2){a2=a4.createDocumentFragment();a.clean(a3,a4,a2,aZ)}if(aY){a.fragments[a3[0]]=a0?a2:1}return{fragment:a2,cacheable:aY}}a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(aY,aZ){a.fn[aY]=function(a0){var a3=[],a6=a(a0),a5=this.length===1&&this[0].parentNode;if(a5&&a5.nodeType===11&&a5.childNodes.length===1&&a6.length===1){a6[aZ](this[0]);return this}else{for(var a4=0,a1=a6.length;a4<a1;a4++){var a2=(a4>0?this.clone(true):this).get();a.fn[aZ].apply(a(a6[a4]),a2);a3=a3.concat(a2)}return this.pushStack(a3,aY,a6.selector)}}});a.extend({clean:function(a0,a2,a9,a4){a2=a2||ab;if(typeof a2.createElement==="undefined"){a2=a2.ownerDocument||a2[0]&&a2[0].ownerDocument||ab}var ba=[];for(var a8=0,a3;(a3=a0[a8])!=null;a8++){if(typeof a3==="number"){a3+=""}if(!a3){continue}if(typeof a3==="string"&&!L.test(a3)){a3=a2.createTextNode(a3)}else{if(typeof a3==="string"){a3=a3.replace(H,p);var bb=(c.exec(a3)||["",""])[1].toLowerCase(),a1=ac[bb]||ac._default,a7=a1[0],aZ=a2.createElement("div");aZ.innerHTML=a1[1]+a3+a1[2];while(a7--){aZ=aZ.lastChild}if(!a.support.tbody){var aY=t.test(a3),a6=bb==="table"&&!aY?aZ.firstChild&&aZ.firstChild.childNodes:a1[1]==="<table>"&&!aY?aZ.childNodes:[];for(var a5=a6.length-1;a5>=0;--a5){if(a.nodeName(a6[a5],"tbody")&&!a6[a5].childNodes.length){a6[a5].parentNode.removeChild(a6[a5])}}}if(!a.support.leadingWhitespace&&Z.test(a3)){aZ.insertBefore(a2.createTextNode(Z.exec(a3)[0]),aZ.firstChild)}a3=aZ.childNodes}}if(a3.nodeType){ba.push(a3)}else{ba=a.merge(ba,a3)}}if(a9){for(var a8=0;ba[a8];a8++){if(a4&&a.nodeName(ba[a8],"script")&&(!ba[a8].type||ba[a8].type.toLowerCase()==="text/javascript")){a4.push(ba[a8].parentNode?ba[a8].parentNode.removeChild(ba[a8]):ba[a8])}else{if(ba[a8].nodeType===1){ba.splice.apply(ba,[a8+1,0].concat(a.makeArray(ba[a8].getElementsByTagName("script"))))}a9.appendChild(ba[a8])}}}return ba},cleanData:function(aZ){var a2,a0,aY=a.cache,a5=a.event.special,a4=a.support.deleteExpando;for(var a3=0,a1;(a1=aZ[a3])!=null;a3++){a0=a1[a.expando];if(a0){a2=aY[a0];if(a2.events){for(var a6 in a2.events){if(a5[a6]){a.event.remove(a1,a6)}else{ag(a1,a6,a2.handle)}}}if(a4){delete a1[a.expando]}else{if(a1.removeAttribute){a1.removeAttribute(a.expando)}}delete aY[a0]}}}});var ar=/z-?index|font-?weight|opacity|zoom|line-?height/i,U=/alpha\([^)]*\)/,aa=/opacity=([^)]*)/,ah=/float/i,az=/-([a-z])/ig,v=/([A-Z])/g,aO=/^-?\d+(?:px)?$/i,aU=/^-?\d/,aK={position:"absolute",visibility:"hidden",display:"block"},W=["Left","Right"],aE=["Top","Bottom"],ak=ab.defaultView&&ab.defaultView.getComputedStyle,aN=a.support.cssFloat?"cssFloat":"styleFloat",k=function(aY,aZ){return aZ.toUpperCase()};a.fn.css=function(aY,aZ){return an(this,aY,aZ,true,function(a1,a0,a2){if(a2===C){return a.curCSS(a1,a0)}if(typeof a2==="number"&&!ar.test(a0)){a2+="px"}a.style(a1,a0,a2)})};a.extend({style:function(a2,aZ,a3){if(!a2||a2.nodeType===3||a2.nodeType===8){return C}if((aZ==="width"||aZ==="height")&&parseFloat(a3)<0){a3=C}var a1=a2.style||a2,a4=a3!==C;if(!a.support.opacity&&aZ==="opacity"){if(a4){a1.zoom=1;var aY=parseInt(a3,10)+""==="NaN"?"":"alpha(opacity="+a3*100+")";var a0=a1.filter||a.curCSS(a2,"filter")||"";a1.filter=U.test(a0)?a0.replace(U,aY):aY}return a1.filter&&a1.filter.indexOf("opacity=")>=0?(parseFloat(aa.exec(a1.filter)[1])/100)+"":""}if(ah.test(aZ)){aZ=aN}aZ=aZ.replace(az,k);if(a4){a1[aZ]=a3}return a1[aZ]},css:function(a1,aZ,a3,aY){if(aZ==="width"||aZ==="height"){var a5,a0=aK,a4=aZ==="width"?W:aE;function a2(){a5=aZ==="width"?a1.offsetWidth:a1.offsetHeight;if(aY==="border"){return}a.each(a4,function(){if(!aY){a5-=parseFloat(a.curCSS(a1,"padding"+this,true))||0}if(aY==="margin"){a5+=parseFloat(a.curCSS(a1,"margin"+this,true))||0}else{a5-=parseFloat(a.curCSS(a1,"border"+this+"Width",true))||0}})}if(a1.offsetWidth!==0){a2()}else{a.swap(a1,a0,a2)}return Math.max(0,Math.round(a5))}return a.curCSS(a1,aZ,a3)},curCSS:function(a4,aZ,a0){var a7,aY=a4.style,a1;if(!a.support.opacity&&aZ==="opacity"&&a4.currentStyle){a7=aa.test(a4.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return a7===""?"1":a7}if(ah.test(aZ)){aZ=aN}if(!a0&&aY&&aY[aZ]){a7=aY[aZ]}else{if(ak){if(ah.test(aZ)){aZ="float"}aZ=aZ.replace(v,"-$1").toLowerCase();var a6=a4.ownerDocument.defaultView;if(!a6){return null}var a8=a6.getComputedStyle(a4,null);if(a8){a7=a8.getPropertyValue(aZ)}if(aZ==="opacity"&&a7===""){a7="1"}}else{if(a4.currentStyle){var a3=aZ.replace(az,k);a7=a4.currentStyle[aZ]||a4.currentStyle[a3];if(!aO.test(a7)&&aU.test(a7)){var a2=aY.left,a5=a4.runtimeStyle.left;a4.runtimeStyle.left=a4.currentStyle.left;aY.left=a3==="fontSize"?"1em":(a7||0);a7=aY.pixelLeft+"px";aY.left=a2;a4.runtimeStyle.left=a5}}}}return a7},swap:function(a1,a0,a2){var aY={};for(var aZ in a0){aY[aZ]=a1.style[aZ];a1.style[aZ]=a0[aZ]}a2.call(a1);for(var aZ in a0){a1.style[aZ]=aY[aZ]}}});if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(a1){var aZ=a1.offsetWidth,aY=a1.offsetHeight,a0=a1.nodeName.toLowerCase()==="tr";return aZ===0&&aY===0&&!a0?true:aZ>0&&aY>0&&!a0?false:a.curCSS(a1,"display")==="none"};a.expr.filters.visible=function(aY){return !a.expr.filters.hidden(aY)}}var af=aP(),aJ=/<script(.|\s)*?\/script>/gi,o=/select|textarea/i,aB=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,r=/=\?(&|$)/,D=/\?/,aX=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,h=/%20/g,w=a.fn.load;a.fn.extend({load:function(a0,a3,a4){if(typeof a0!=="string"){return w.call(this,a0)}else{if(!this.length){return this}}var a2=a0.indexOf(" ");if(a2>=0){var aY=a0.slice(a2,a0.length);a0=a0.slice(0,a2)}var a1="GET";if(a3){if(a.isFunction(a3)){a4=a3;a3=null}else{if(typeof a3==="object"){a3=a.param(a3,a.ajaxSettings.traditional);a1="POST"}}}var aZ=this;a.ajax({url:a0,type:a1,dataType:"html",data:a3,complete:function(a6,a5){if(a5==="success"||a5==="notmodified"){aZ.html(aY?a("<div />").append(a6.responseText.replace(aJ,"")).find(aY):a6.responseText)}if(a4){aZ.each(a4,[a6.responseText,a5,a6])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||o.test(this.nodeName)||aB.test(this.type))}).map(function(aY,aZ){var a0=a(this).val();return a0==null?null:a.isArray(a0)?a.map(a0,function(a2,a1){return{name:aZ.name,value:a2}}):{name:aZ.name,value:a0}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(aY,aZ){a.fn[aZ]=function(a0){return this.bind(aZ,a0)}});a.extend({get:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0=null}return a.ajax({type:"GET",url:aY,data:a0,success:a1,dataType:aZ})},getScript:function(aY,aZ){return a.get(aY,null,aZ,"script")},getJSON:function(aY,aZ,a0){return a.get(aY,aZ,a0,"json")},post:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0={}}return a.ajax({type:"POST",url:aY,data:a0,success:a1,dataType:aZ})},ajaxSetup:function(aY){a.extend(a.ajaxSettings,aY)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:aM.XMLHttpRequest&&(aM.location.protocol!=="file:"||!aM.ActiveXObject)?function(){return new aM.XMLHttpRequest()}:function(){try{return new aM.ActiveXObject("Microsoft.XMLHTTP")}catch(aY){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(bd){var a8=a.extend(true,{},a.ajaxSettings,bd);var bi,bc,bh,bj=bd&&bd.context||a8,a0=a8.type.toUpperCase();if(a8.data&&a8.processData&&typeof a8.data!=="string"){a8.data=a.param(a8.data,a8.traditional)}if(a8.dataType==="jsonp"){if(a0==="GET"){if(!r.test(a8.url)){a8.url+=(D.test(a8.url)?"&":"?")+(a8.jsonp||"callback")+"=?"}}else{if(!a8.data||!r.test(a8.data)){a8.data=(a8.data?a8.data+"&":"")+(a8.jsonp||"callback")+"=?"}}a8.dataType="json"}if(a8.dataType==="json"&&(a8.data&&r.test(a8.data)||r.test(a8.url))){bi=a8.jsonpCallback||("jsonp"+af++);if(a8.data){a8.data=(a8.data+"").replace(r,"="+bi+"$1")}a8.url=a8.url.replace(r,"="+bi+"$1");a8.dataType="script";aM[bi]=aM[bi]||function(bk){bh=bk;a3();a6();aM[bi]=C;try{delete aM[bi]}catch(bl){}if(a1){a1.removeChild(bf)}}}if(a8.dataType==="script"&&a8.cache===null){a8.cache=false}if(a8.cache===false&&a0==="GET"){var aY=aP();var bg=a8.url.replace(aX,"$1_="+aY+"$2");a8.url=bg+((bg===a8.url)?(D.test(a8.url)?"&":"?")+"_="+aY:"")}if(a8.data&&a0==="GET"){a8.url+=(D.test(a8.url)?"&":"?")+a8.data}if(a8.global&&!a.active++){a.event.trigger("ajaxStart")}var bb=B.exec(a8.url),a2=bb&&(bb[1]&&bb[1]!==location.protocol||bb[2]!==location.host);if(a8.dataType==="script"&&a0==="GET"&&a2){var a1=ab.getElementsByTagName("head")[0]||ab.documentElement;var bf=ab.createElement("script");bf.src=a8.url;if(a8.scriptCharset){bf.charset=a8.scriptCharset}if(!bi){var ba=false;bf.onload=bf.onreadystatechange=function(){if(!ba&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){ba=true;a3();a6();bf.onload=bf.onreadystatechange=null;if(a1&&bf.parentNode){a1.removeChild(bf)}}}}a1.insertBefore(bf,a1.firstChild);return C}var a5=false;var a4=a8.xhr();if(!a4){return}if(a8.username){a4.open(a0,a8.url,a8.async,a8.username,a8.password)}else{a4.open(a0,a8.url,a8.async)}try{if(a8.data||bd&&bd.contentType){a4.setRequestHeader("Content-Type",a8.contentType)}if(a8.ifModified){if(a.lastModified[a8.url]){a4.setRequestHeader("If-Modified-Since",a.lastModified[a8.url])}if(a.etag[a8.url]){a4.setRequestHeader("If-None-Match",a.etag[a8.url])}}if(!a2){a4.setRequestHeader("X-Requested-With","XMLHttpRequest")}a4.setRequestHeader("Accept",a8.dataType&&a8.accepts[a8.dataType]?a8.accepts[a8.dataType]+", */*":a8.accepts._default)}catch(be){}if(a8.beforeSend&&a8.beforeSend.call(bj,a4,a8)===false){if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}a4.abort();return false}if(a8.global){a9("ajaxSend",[a4,a8])}var a7=a4.onreadystatechange=function(bk){if(!a4||a4.readyState===0||bk==="abort"){if(!a5){a6()}a5=true;if(a4){a4.onreadystatechange=a.noop}}else{if(!a5&&a4&&(a4.readyState===4||bk==="timeout")){a5=true;a4.onreadystatechange=a.noop;bc=bk==="timeout"?"timeout":!a.httpSuccess(a4)?"error":a8.ifModified&&a.httpNotModified(a4,a8.url)?"notmodified":"success";var bm;if(bc==="success"){try{bh=a.httpData(a4,a8.dataType,a8)}catch(bl){bc="parsererror";bm=bl}}if(bc==="success"||bc==="notmodified"){if(!bi){a3()}}else{a.handleError(a8,a4,bc,bm)}a6();if(bk==="timeout"){a4.abort()}if(a8.async){a4=null}}}};try{var aZ=a4.abort;a4.abort=function(){if(a4){aZ.call(a4)}a7("abort")}}catch(be){}if(a8.async&&a8.timeout>0){setTimeout(function(){if(a4&&!a5){a7("timeout")}},a8.timeout)}try{a4.send(a0==="POST"||a0==="PUT"||a0==="DELETE"?a8.data:null)}catch(be){a.handleError(a8,a4,null,be);a6()}if(!a8.async){a7()}function a3(){if(a8.success){a8.success.call(bj,bh,bc,a4)}if(a8.global){a9("ajaxSuccess",[a4,a8])}}function a6(){if(a8.complete){a8.complete.call(bj,a4,bc)}if(a8.global){a9("ajaxComplete",[a4,a8])}if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}}function a9(bl,bk){(a8.context?a(a8.context):a.event).trigger(bl,bk)}return a4},handleError:function(aZ,a1,aY,a0){if(aZ.error){aZ.error.call(aZ.context||aZ,a1,aY,a0)}if(aZ.global){(aZ.context?a(aZ.context):a.event).trigger("ajaxError",[a1,aZ,a0])}},active:0,httpSuccess:function(aZ){try{return !aZ.status&&location.protocol==="file:"||(aZ.status>=200&&aZ.status<300)||aZ.status===304||aZ.status===1223||aZ.status===0}catch(aY){}return false},httpNotModified:function(a1,aY){var a0=a1.getResponseHeader("Last-Modified"),aZ=a1.getResponseHeader("Etag");if(a0){a.lastModified[aY]=a0}if(aZ){a.etag[aY]=aZ}return a1.status===304||a1.status===0},httpData:function(a3,a1,a0){var aZ=a3.getResponseHeader("content-type")||"",aY=a1==="xml"||!a1&&aZ.indexOf("xml")>=0,a2=aY?a3.responseXML:a3.responseText;if(aY&&a2.documentElement.nodeName==="parsererror"){a.error("parsererror")}if(a0&&a0.dataFilter){a2=a0.dataFilter(a2,a1)}if(typeof a2==="string"){if(a1==="json"||!a1&&aZ.indexOf("json")>=0){a2=a.parseJSON(a2)}else{if(a1==="script"||!a1&&aZ.indexOf("javascript")>=0){a.globalEval(a2)}}}return a2},param:function(aY,a1){var aZ=[];if(a1===C){a1=a.ajaxSettings.traditional}if(a.isArray(aY)||aY.jquery){a.each(aY,function(){a3(this.name,this.value)})}else{for(var a2 in aY){a0(a2,aY[a2])}}return aZ.join("&").replace(h,"+");function a0(a4,a5){if(a.isArray(a5)){a.each(a5,function(a7,a6){if(a1||/\[\]$/.test(a4)){a3(a4,a6)}else{a0(a4+"["+(typeof a6==="object"||a.isArray(a6)?a7:"")+"]",a6)}})}else{if(!a1&&a5!=null&&typeof a5==="object"){a.each(a5,function(a7,a6){a0(a4+"["+a7+"]",a6)})}else{a3(a4,a5)}}}function a3(a4,a5){a5=a.isFunction(a5)?a5():a5;aZ[aZ.length]=encodeURIComponent(a4)+"="+encodeURIComponent(a5)}}});var G={},ae=/toggle|show|hide/,au=/^([+-]=)?([\d+-.]+)(.*)$/,aF,aj=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(aZ,a7){if(aZ||aZ===0){return this.animate(aD("show",3),aZ,a7)}else{for(var a4=0,a1=this.length;a4<a1;a4++){var aY=a.data(this[a4],"olddisplay");this[a4].style.display=aY||"";if(a.css(this[a4],"display")==="none"){var a6=this[a4].nodeName,a5;if(G[a6]){a5=G[a6]}else{var a0=a("<"+a6+" />").appendTo("body");a5=a0.css("display");if(a5==="none"){a5="block"}a0.remove();G[a6]=a5}a.data(this[a4],"olddisplay",a5)}}for(var a3=0,a2=this.length;a3<a2;a3++){this[a3].style.display=a.data(this[a3],"olddisplay")||""}return this}},hide:function(a3,a4){if(a3||a3===0){return this.animate(aD("hide",3),a3,a4)}else{for(var a2=0,aZ=this.length;a2<aZ;a2++){var aY=a.data(this[a2],"olddisplay");if(!aY&&aY!=="none"){a.data(this[a2],"olddisplay",a.css(this[a2],"display"))}}for(var a1=0,a0=this.length;a1<a0;a1++){this[a1].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(a0,aZ){var aY=typeof a0==="boolean";if(a.isFunction(a0)&&a.isFunction(aZ)){this._toggle.apply(this,arguments)}else{if(a0==null||aY){this.each(function(){var a1=aY?a0:a(this).is(":hidden");a(this)[a1?"show":"hide"]()})}else{this.animate(aD("toggle",3),a0,aZ)}}return this},fadeTo:function(aY,a0,aZ){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:a0},aY,aZ)},animate:function(a2,aZ,a1,a0){var aY=a.speed(aZ,a1,a0);if(a.isEmptyObject(a2)){return this.each(aY.complete)}return this[aY.queue===false?"each":"queue"](function(){var a5=a.extend({},aY),a7,a6=this.nodeType===1&&a(this).is(":hidden"),a3=this;for(a7 in a2){var a4=a7.replace(az,k);if(a7!==a4){a2[a4]=a2[a7];delete a2[a7];a7=a4}if(a2[a7]==="hide"&&a6||a2[a7]==="show"&&!a6){return a5.complete.call(this)}if((a7==="height"||a7==="width")&&this.style){a5.display=a.css(this,"display");a5.overflow=this.style.overflow}if(a.isArray(a2[a7])){(a5.specialEasing=a5.specialEasing||{})[a7]=a2[a7][1];a2[a7]=a2[a7][0]}}if(a5.overflow!=null){this.style.overflow="hidden"}a5.curAnim=a.extend({},a2);a.each(a2,function(a9,bd){var bc=new a.fx(a3,a5,a9);if(ae.test(bd)){bc[bd==="toggle"?a6?"show":"hide":bd](a2)}else{var bb=au.exec(bd),be=bc.cur(true)||0;if(bb){var a8=parseFloat(bb[2]),ba=bb[3]||"px";if(ba!=="px"){a3.style[a9]=(a8||1)+ba;be=((a8||1)/bc.cur(true))*be;a3.style[a9]=be+ba}if(bb[1]){a8=((bb[1]==="-="?-1:1)*a8)+be}bc.custom(be,a8,ba)}else{bc.custom(be,bd,"")}}});return true})},stop:function(aZ,aY){var a0=a.timers;if(aZ){this.queue([])}this.each(function(){for(var a1=a0.length-1;a1>=0;a1--){if(a0[a1].elem===this){if(aY){a0[a1](true)}a0.splice(a1,1)}}});if(!aY){this.dequeue()}return this}});a.each({slideDown:aD("show",1),slideUp:aD("hide",1),slideToggle:aD("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(aY,aZ){a.fn[aY]=function(a0,a1){return this.animate(aZ,a0,a1)}});a.extend({speed:function(a0,a1,aZ){var aY=a0&&typeof a0==="object"?a0:{complete:aZ||!aZ&&a1||a.isFunction(a0)&&a0,duration:a0,easing:aZ&&a1||a1&&!a.isFunction(a1)&&a1};aY.duration=a.fx.off?0:typeof aY.duration==="number"?aY.duration:a.fx.speeds[aY.duration]||a.fx.speeds._default;aY.old=aY.complete;aY.complete=function(){if(aY.queue!==false){a(this).dequeue()}if(a.isFunction(aY.old)){aY.old.call(this)}};return aY},easing:{linear:function(a0,a1,aY,aZ){return aY+aZ*a0},swing:function(a0,a1,aY,aZ){return((-Math.cos(a0*Math.PI)/2)+0.5)*aZ+aY}},timers:[],fx:function(aZ,aY,a0){this.options=aY;this.elem=aZ;this.prop=a0;if(!aY.orig){aY.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(aZ){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var aY=parseFloat(a.css(this.elem,this.prop,aZ));return aY&&aY>-10000?aY:parseFloat(a.curCSS(this.elem,this.prop))||0},custom:function(a2,a1,a0){this.startTime=aP();this.start=a2;this.end=a1;this.unit=a0||this.unit||"px";this.now=this.start;this.pos=this.state=0;var aY=this;function aZ(a3){return aY.step(a3)}aZ.elem=this.elem;if(aZ()&&a.timers.push(aZ)&&!aF){aF=setInterval(a.fx.tick,13)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a1){var a6=aP(),a2=true;if(a1||a6>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var a3 in this.options.curAnim){if(this.options.curAnim[a3]!==true){a2=false}}if(a2){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var a0=a.data(this.elem,"olddisplay");this.elem.style.display=a0?a0:this.options.display;if(a.css(this.elem,"display")==="none"){this.elem.style.display="block"}}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var aY in this.options.curAnim){a.style(this.elem,aY,this.options.orig[aY])}}this.options.complete.call(this.elem)}return false}else{var aZ=a6-this.startTime;this.state=aZ/this.options.duration;var a4=this.options.specialEasing&&this.options.specialEasing[this.prop];var a5=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[a4||a5](this.state,aZ,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var aZ=a.timers;for(var aY=0;aY<aZ.length;aY++){if(!aZ[aY]()){aZ.splice(aY--,1)}}if(!aZ.length){a.fx.stop()}},stop:function(){clearInterval(aF);aF=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(aY){a.style(aY.elem,"opacity",aY.now)},_default:function(aY){if(aY.elem.style&&aY.elem.style[aY.prop]!=null){aY.elem.style[aY.prop]=(aY.prop==="width"||aY.prop==="height"?Math.max(0,aY.now):aY.now)+aY.unit}else{aY.elem[aY.prop]=aY.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(aY){return a.grep(a.timers,function(aZ){return aY===aZ.elem}).length}}function aD(aZ,aY){var a0={};a.each(aj.concat.apply([],aj.slice(0,aY)),function(){a0[this]=aZ});return a0}if("getBoundingClientRect" in ab.documentElement){a.fn.offset=function(a7){var a0=this[0];if(a7){return this.each(function(a8){a.offset.setOffset(this,a7,a8)})}if(!a0||!a0.ownerDocument){return null}if(a0===a0.ownerDocument.body){return a.offset.bodyOffset(a0)}var a2=a0.getBoundingClientRect(),a6=a0.ownerDocument,a3=a6.body,aY=a6.documentElement,a1=aY.clientTop||a3.clientTop||0,a4=aY.clientLeft||a3.clientLeft||0,a5=a2.top+(self.pageYOffset||a.support.boxModel&&aY.scrollTop||a3.scrollTop)-a1,aZ=a2.left+(self.pageXOffset||a.support.boxModel&&aY.scrollLeft||a3.scrollLeft)-a4;return{top:a5,left:aZ}}}else{a.fn.offset=function(a9){var a3=this[0];if(a9){return this.each(function(ba){a.offset.setOffset(this,a9,ba)})}if(!a3||!a3.ownerDocument){return null}if(a3===a3.ownerDocument.body){return a.offset.bodyOffset(a3)}a.offset.initialize();var a0=a3.offsetParent,aZ=a3,a8=a3.ownerDocument,a6,a1=a8.documentElement,a4=a8.body,a5=a8.defaultView,aY=a5?a5.getComputedStyle(a3,null):a3.currentStyle,a7=a3.offsetTop,a2=a3.offsetLeft;while((a3=a3.parentNode)&&a3!==a4&&a3!==a1){if(a.offset.supportsFixedPosition&&aY.position==="fixed"){break}a6=a5?a5.getComputedStyle(a3,null):a3.currentStyle;a7-=a3.scrollTop;a2-=a3.scrollLeft;if(a3===a0){a7+=a3.offsetTop;a2+=a3.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(a3.nodeName))){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aZ=a0,a0=a3.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&a6.overflow!=="visible"){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aY=a6}if(aY.position==="relative"||aY.position==="static"){a7+=a4.offsetTop;a2+=a4.offsetLeft}if(a.offset.supportsFixedPosition&&aY.position==="fixed"){a7+=Math.max(a1.scrollTop,a4.scrollTop);a2+=Math.max(a1.scrollLeft,a4.scrollLeft)}return{top:a7,left:a2}}}a.offset={initialize:function(){var aY=ab.body,aZ=ab.createElement("div"),a2,a4,a3,a5,a0=parseFloat(a.curCSS(aY,"marginTop",true))||0,a1="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.extend(aZ.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});aZ.innerHTML=a1;aY.insertBefore(aZ,aY.firstChild);a2=aZ.firstChild;a4=a2.firstChild;a5=a2.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(a4.offsetTop!==5);this.doesAddBorderForTableAndCells=(a5.offsetTop===5);a4.style.position="fixed",a4.style.top="20px";this.supportsFixedPosition=(a4.offsetTop===20||a4.offsetTop===15);a4.style.position=a4.style.top="";a2.style.overflow="hidden",a2.style.position="relative";this.subtractsBorderForOverflowNotVisible=(a4.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(aY.offsetTop!==a0);aY.removeChild(aZ);aY=aZ=a2=a4=a3=a5=null;a.offset.initialize=a.noop},bodyOffset:function(aY){var a0=aY.offsetTop,aZ=aY.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){a0+=parseFloat(a.curCSS(aY,"marginTop",true))||0;aZ+=parseFloat(a.curCSS(aY,"marginLeft",true))||0}return{top:a0,left:aZ}},setOffset:function(a3,aZ,a0){if(/static/.test(a.curCSS(a3,"position"))){a3.style.position="relative"}var a2=a(a3),a5=a2.offset(),aY=parseInt(a.curCSS(a3,"top",true),10)||0,a4=parseInt(a.curCSS(a3,"left",true),10)||0;if(a.isFunction(aZ)){aZ=aZ.call(a3,a0,a5)}var a1={top:(aZ.top-a5.top)+aY,left:(aZ.left-a5.left)+a4};if("using" in aZ){aZ.using.call(a3,a1)}else{a2.css(a1)}}};a.fn.extend({position:function(){if(!this[0]){return null}var a0=this[0],aZ=this.offsetParent(),a1=this.offset(),aY=/^body|html$/i.test(aZ[0].nodeName)?{top:0,left:0}:aZ.offset();a1.top-=parseFloat(a.curCSS(a0,"marginTop",true))||0;a1.left-=parseFloat(a.curCSS(a0,"marginLeft",true))||0;aY.top+=parseFloat(a.curCSS(aZ[0],"borderTopWidth",true))||0;aY.left+=parseFloat(a.curCSS(aZ[0],"borderLeftWidth",true))||0;return{top:a1.top-aY.top,left:a1.left-aY.left}},offsetParent:function(){return this.map(function(){var aY=this.offsetParent||ab.body;while(aY&&(!/^body|html$/i.test(aY.nodeName)&&a.css(aY,"position")==="static")){aY=aY.offsetParent}return aY})}});a.each(["Left","Top"],function(aZ,aY){var a0="scroll"+aY;a.fn[a0]=function(a3){var a1=this[0],a2;if(!a1){return null}if(a3!==C){return this.each(function(){a2=am(this);if(a2){a2.scrollTo(!aZ?a3:a(a2).scrollLeft(),aZ?a3:a(a2).scrollTop())}else{this[a0]=a3}})}else{a2=am(a1);return a2?("pageXOffset" in a2)?a2[aZ?"pageYOffset":"pageXOffset"]:a.support.boxModel&&a2.document.documentElement[a0]||a2.document.body[a0]:a1[a0]}}});function am(aY){return("scrollTo" in aY&&aY.document)?aY:aY.nodeType===9?aY.defaultView||aY.parentWindow:false}a.each(["Height","Width"],function(aZ,aY){var a0=aY.toLowerCase();a.fn["inner"+aY]=function(){return this[0]?a.css(this[0],a0,false,"padding"):null};a.fn["outer"+aY]=function(a1){return this[0]?a.css(this[0],a0,false,a1?"margin":"border"):null};a.fn[a0]=function(a1){var a2=this[0];if(!a2){return a1==null?null:this}if(a.isFunction(a1)){return this.each(function(a4){var a3=a(this);a3[a0](a1.call(this,a4,a3[a0]()))})}return("scrollTo" in a2&&a2.document)?a2.document.compatMode==="CSS1Compat"&&a2.document.documentElement["client"+aY]||a2.document.body["client"+aY]:(a2.nodeType===9)?Math.max(a2.documentElement["client"+aY],a2.body["scroll"+aY],a2.documentElement["scroll"+aY],a2.body["offset"+aY],a2.documentElement["offset"+aY]):a1===C?a.css(a2,a0):this.css(a0,typeof a1==="string"?a1:a1+"px")}});aM.jQuery=aM.$=a})(window); \ No newline at end of file +(function(){var bj=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bc=0,a7=Object.prototype.toString,bi=false,bb=true;[0,0].sort(function(){bb=false;return 0});var a5=function(bq,bl,bt,bu){bt=bt||[];bl=bl||ae;var bw=bl;if(bl.nodeType!==1&&bl.nodeType!==9){return[]}if(!bq||typeof bq!=="string"){return bt}var bn,by,bB,bm,bx,bA,bz,bs,bp=true,bo=a5.isXML(bl),br=[],bv=bq;do{bj.exec("");bn=bj.exec(bv);if(bn){bv=bn[3];br.push(bn[1]);if(bn[2]){bm=bn[3];break}}}while(bn);if(br.length>1&&bd.exec(bq)){if(br.length===2&&a8.relative[br[0]]){by=ba(br[0]+br[1],bl)}else{by=a8.relative[br[0]]?[bl]:a5(br.shift(),bl);while(br.length){bq=br.shift();if(a8.relative[bq]){bq+=br.shift()}by=ba(bq,by)}}}else{if(!bu&&br.length>1&&bl.nodeType===9&&!bo&&a8.match.ID.test(br[0])&&!a8.match.ID.test(br[br.length-1])){bx=a5.find(br.shift(),bl,bo);bl=bx.expr?a5.filter(bx.expr,bx.set)[0]:bx.set[0]}if(bl){bx=bu?{expr:br.pop(),set:a4(bu)}:a5.find(br.pop(),br.length===1&&(br[0]==="~"||br[0]==="+")&&bl.parentNode?bl.parentNode:bl,bo);by=bx.expr?a5.filter(bx.expr,bx.set):bx.set;if(br.length>0){bB=a4(by)}else{bp=false}while(br.length){bA=br.pop();bz=bA;if(!a8.relative[bA]){bA=""}else{bz=br.pop()}if(bz==null){bz=bl}a8.relative[bA](bB,bz,bo)}}else{bB=br=[]}}if(!bB){bB=by}if(!bB){a5.error(bA||bq)}if(a7.call(bB)==="[object Array]"){if(!bp){bt.push.apply(bt,bB)}else{if(bl&&bl.nodeType===1){for(bs=0;bB[bs]!=null;bs++){if(bB[bs]&&(bB[bs]===true||bB[bs].nodeType===1&&a5.contains(bl,bB[bs]))){bt.push(by[bs])}}}else{for(bs=0;bB[bs]!=null;bs++){if(bB[bs]&&bB[bs].nodeType===1){bt.push(by[bs])}}}}}else{a4(bB,bt)}if(bm){a5(bm,bw,bt,bu);a5.uniqueSort(bt)}return bt};a5.uniqueSort=function(bm){if(a6){bi=bb;bm.sort(a6);if(bi){for(var bl=1;bl<bm.length;bl++){if(bm[bl]===bm[bl-1]){bm.splice(bl--,1)}}}}return bm};a5.matches=function(bl,bm){return a5(bl,null,null,bm)};a5.matchesSelector=function(bl,bm){return a5(bm,null,null,[bl]).length>0};a5.find=function(bs,bl,bt){var br;if(!bs){return[]}for(var bo=0,bn=a8.order.length;bo<bn;bo++){var bp,bq=a8.order[bo];if((bp=a8.leftMatch[bq].exec(bs))){var bm=bp[1];bp.splice(1,1);if(bm.substr(bm.length-1)!=="\\"){bp[1]=(bp[1]||"").replace(/\\/g,"");br=a8.find[bq](bp,bl,bt);if(br!=null){bs=bs.replace(a8.match[bq],"");break}}}}if(!br){br=typeof bl.getElementsByTagName!=="undefined"?bl.getElementsByTagName("*"):[]}return{set:br,expr:bs}};a5.filter=function(bw,bv,bz,bp){var br,bl,bn=bw,bB=[],bt=bv,bs=bv&&bv[0]&&a5.isXML(bv[0]);while(bw&&bv.length){for(var bu in a8.filter){if((br=a8.leftMatch[bu].exec(bw))!=null&&br[2]){var bA,by,bm=a8.filter[bu],bo=br[1];bl=false;br.splice(1,1);if(bo.substr(bo.length-1)==="\\"){continue}if(bt===bB){bB=[]}if(a8.preFilter[bu]){br=a8.preFilter[bu](br,bt,bz,bB,bp,bs);if(!br){bl=bA=true}else{if(br===true){continue}}}if(br){for(var bq=0;(by=bt[bq])!=null;bq++){if(by){bA=bm(by,br,bq,bt);var bx=bp^!!bA;if(bz&&bA!=null){if(bx){bl=true}else{bt[bq]=false}}else{if(bx){bB.push(by);bl=true}}}}}if(bA!==E){if(!bz){bt=bB}bw=bw.replace(a8.match[bu],"");if(!bl){return[]}break}}}if(bw===bn){if(bl==null){a5.error(bw)}else{break}}bn=bw}return bt};a5.error=function(bl){throw"Syntax error, unrecognized expression: "+bl};var a8=a5.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bl){return bl.getAttribute("href")}},relative:{"+":function(br,bm){var bo=typeof bm==="string",bq=bo&&!/\W/.test(bm),bs=bo&&!bq;if(bq){bm=bm.toLowerCase()}for(var bn=0,bl=br.length,bp;bn<bl;bn++){if((bp=br[bn])){while((bp=bp.previousSibling)&&bp.nodeType!==1){}br[bn]=bs||bp&&bp.nodeName.toLowerCase()===bm?bp||false:bp===bm}}if(bs){a5.filter(bm,br,true)}},">":function(br,bm){var bq,bp=typeof bm==="string",bn=0,bl=br.length;if(bp&&!/\W/.test(bm)){bm=bm.toLowerCase();for(;bn<bl;bn++){bq=br[bn];if(bq){var bo=bq.parentNode;br[bn]=bo.nodeName.toLowerCase()===bm?bo:false}}}else{for(;bn<bl;bn++){bq=br[bn];if(bq){br[bn]=bp?bq.parentNode:bq.parentNode===bm}}if(bp){a5.filter(bm,br,true)}}},"":function(bo,bm,bq){var bp,bn=bc++,bl=bk;if(typeof bm==="string"&&!/\W/.test(bm)){bm=bm.toLowerCase();bp=bm;bl=bh}bl("parentNode",bm,bn,bo,bp,bq)},"~":function(bo,bm,bq){var bp,bn=bc++,bl=bk;if(typeof bm==="string"&&!/\W/.test(bm)){bm=bm.toLowerCase();bp=bm;bl=bh}bl("previousSibling",bm,bn,bo,bp,bq)}},find:{ID:function(bm,bn,bo){if(typeof bn.getElementById!=="undefined"&&!bo){var bl=bn.getElementById(bm[1]);return bl&&bl.parentNode?[bl]:[]}},NAME:function(bn,bq){if(typeof bq.getElementsByName!=="undefined"){var bm=[],bp=bq.getElementsByName(bn[1]);for(var bo=0,bl=bp.length;bo<bl;bo++){if(bp[bo].getAttribute("name")===bn[1]){bm.push(bp[bo])}}return bm.length===0?null:bm}},TAG:function(bl,bm){if(typeof bm.getElementsByTagName!=="undefined"){return bm.getElementsByTagName(bl[1])}}},preFilter:{CLASS:function(bo,bm,bn,bl,br,bs){bo=" "+bo[1].replace(/\\/g,"")+" ";if(bs){return bo}for(var bp=0,bq;(bq=bm[bp])!=null;bp++){if(bq){if(br^(bq.className&&(" "+bq.className+" ").replace(/[\t\n\r]/g," ").indexOf(bo)>=0)){if(!bn){bl.push(bq)}}else{if(bn){bm[bp]=false}}}}return false},ID:function(bl){return bl[1].replace(/\\/g,"")},TAG:function(bm,bl){return bm[1].toLowerCase()},CHILD:function(bl){if(bl[1]==="nth"){if(!bl[2]){a5.error(bl[0])}bl[2]=bl[2].replace(/^\+|\s*/g,"");var bm=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(bl[2]==="even"&&"2n"||bl[2]==="odd"&&"2n+1"||!/\D/.test(bl[2])&&"0n+"+bl[2]||bl[2]);bl[2]=(bm[1]+(bm[2]||1))-0;bl[3]=bm[3]-0}else{if(bl[2]){a5.error(bl[0])}}bl[0]=bc++;return bl},ATTR:function(bp,bm,bn,bl,bq,br){var bo=bp[1]=bp[1].replace(/\\/g,"");if(!br&&a8.attrMap[bo]){bp[1]=a8.attrMap[bo]}bp[4]=(bp[4]||bp[5]||"").replace(/\\/g,"");if(bp[2]==="~="){bp[4]=" "+bp[4]+" "}return bp},PSEUDO:function(bp,bm,bn,bl,bq){if(bp[1]==="not"){if((bj.exec(bp[3])||"").length>1||/^\w/.test(bp[3])){bp[3]=a5(bp[3],null,null,bm)}else{var bo=a5.filter(bp[3],bm,bn,true^bq);if(!bn){bl.push.apply(bl,bo)}return false}}else{if(a8.match.POS.test(bp[0])||a8.match.CHILD.test(bp[0])){return true}}return bp},POS:function(bl){bl.unshift(true);return bl}},filters:{enabled:function(bl){return bl.disabled===false&&bl.type!=="hidden"},disabled:function(bl){return bl.disabled===true},checked:function(bl){return bl.checked===true},selected:function(bl){bl.parentNode.selectedIndex;return bl.selected===true},parent:function(bl){return !!bl.firstChild},empty:function(bl){return !bl.firstChild},has:function(bn,bm,bl){return !!a5(bl[3],bn).length},header:function(bl){return(/h\d/i).test(bl.nodeName)},text:function(bl){return"text"===bl.type},radio:function(bl){return"radio"===bl.type},checkbox:function(bl){return"checkbox"===bl.type},file:function(bl){return"file"===bl.type},password:function(bl){return"password"===bl.type},submit:function(bl){return"submit"===bl.type},image:function(bl){return"image"===bl.type},reset:function(bl){return"reset"===bl.type},button:function(bl){return"button"===bl.type||bl.nodeName.toLowerCase()==="button"},input:function(bl){return(/input|select|textarea|button/i).test(bl.nodeName)}},setFilters:{first:function(bm,bl){return bl===0},last:function(bn,bm,bl,bo){return bm===bo.length-1},even:function(bm,bl){return bl%2===0},odd:function(bm,bl){return bl%2===1},lt:function(bn,bm,bl){return bm<bl[3]-0},gt:function(bn,bm,bl){return bm>bl[3]-0},nth:function(bn,bm,bl){return bl[3]-0===bm},eq:function(bn,bm,bl){return bl[3]-0===bm}},filter:{PSEUDO:function(bn,bs,br,bt){var bl=bs[1],bm=a8.filters[bl];if(bm){return bm(bn,br,bs,bt)}else{if(bl==="contains"){return(bn.textContent||bn.innerText||a5.getText([bn])||"").indexOf(bs[3])>=0}else{if(bl==="not"){var bo=bs[3];for(var bq=0,bp=bo.length;bq<bp;bq++){if(bo[bq]===bn){return false}}return true}else{a5.error(bl)}}}},CHILD:function(bl,bo){var br=bo[1],bm=bl;switch(br){case"only":case"first":while((bm=bm.previousSibling)){if(bm.nodeType===1){return false}}if(br==="first"){return true}bm=bl;case"last":while((bm=bm.nextSibling)){if(bm.nodeType===1){return false}}return true;case"nth":var bn=bo[2],bu=bo[3];if(bn===1&&bu===0){return true}var bq=bo[0],bt=bl.parentNode;if(bt&&(bt.sizcache!==bq||!bl.nodeIndex)){var bp=0;for(bm=bt.firstChild;bm;bm=bm.nextSibling){if(bm.nodeType===1){bm.nodeIndex=++bp}}bt.sizcache=bq}var bs=bl.nodeIndex-bu;if(bn===0){return bs===0}else{return(bs%bn===0&&bs/bn>=0)}}},ID:function(bm,bl){return bm.nodeType===1&&bm.getAttribute("id")===bl},TAG:function(bm,bl){return(bl==="*"&&bm.nodeType===1)||bm.nodeName.toLowerCase()===bl},CLASS:function(bm,bl){return(" "+(bm.className||bm.getAttribute("class"))+" ").indexOf(bl)>-1},ATTR:function(bq,bo){var bn=bo[1],bl=a8.attrHandle[bn]?a8.attrHandle[bn](bq):bq[bn]!=null?bq[bn]:bq.getAttribute(bn),br=bl+"",bp=bo[2],bm=bo[4];return bl==null?bp==="!=":bp==="="?br===bm:bp==="*="?br.indexOf(bm)>=0:bp==="~="?(" "+br+" ").indexOf(bm)>=0:!bm?br&&bl!==false:bp==="!="?br!==bm:bp==="^="?br.indexOf(bm)===0:bp==="$="?br.substr(br.length-bm.length)===bm:bp==="|="?br===bm||br.substr(0,bm.length+1)===bm+"-":false},POS:function(bp,bm,bn,bq){var bl=bm[2],bo=a8.setFilters[bl];if(bo){return bo(bp,bn,bm,bq)}}}};var bd=a8.match.POS,a9=function(bm,bl){return"\\"+(bl-0+1)};for(var bg in a8.match){a8.match[bg]=new RegExp(a8.match[bg].source+(/(?![^\[]*\])(?![^\(]*\))/.source));a8.leftMatch[bg]=new RegExp(/(^(?:.|\r|\n)*?)/.source+a8.match[bg].source.replace(/\\(\d+)/g,a9))}var a4=function(bm,bl){bm=Array.prototype.slice.call(bm,0);if(bl){bl.push.apply(bl,bm);return bl}return bm};try{Array.prototype.slice.call(ae.documentElement.childNodes,0)[0].nodeType}catch(be){a4=function(bp,bo){var bn=0,bm=bo||[];if(a7.call(bp)==="[object Array]"){Array.prototype.push.apply(bm,bp)}else{if(typeof bp.length==="number"){for(var bl=bp.length;bn<bl;bn++){bm.push(bp[bn])}}else{for(;bp[bn];bn++){bm.push(bp[bn])}}}return bm}}var a6,bf;if(ae.documentElement.compareDocumentPosition){a6=function(bm,bl){if(bm===bl){bi=true;return 0}if(!bm.compareDocumentPosition||!bl.compareDocumentPosition){return bm.compareDocumentPosition?-1:1}return bm.compareDocumentPosition(bl)&4?-1:1}}else{a6=function(bv,bu){var bs,bn,bo=[],bm=[],br=bv.parentNode,bt=bu.parentNode,bw=br;if(bv===bu){bi=true;return 0}else{if(br===bt){return bf(bv,bu)}else{if(!br){return -1}else{if(!bt){return 1}}}}while(bw){bo.unshift(bw);bw=bw.parentNode}bw=bt;while(bw){bm.unshift(bw);bw=bw.parentNode}bs=bo.length;bn=bm.length;for(var bq=0;bq<bs&&bq<bn;bq++){if(bo[bq]!==bm[bq]){return bf(bo[bq],bm[bq])}}return bq===bs?bf(bv,bm[bq],-1):bf(bo[bq],bu,1)};bf=function(bm,bl,bn){if(bm===bl){return bn}var bo=bm.nextSibling;while(bo){if(bo===bl){return -1}bo=bo.nextSibling}return 1}}a5.getText=function(bl){var bm="",bo;for(var bn=0;bl[bn];bn++){bo=bl[bn];if(bo.nodeType===3||bo.nodeType===4){bm+=bo.nodeValue}else{if(bo.nodeType!==8){bm+=a5.getText(bo.childNodes)}}}return bm};(function(){var bm=ae.createElement("div"),bn="script"+(new Date()).getTime(),bl=ae.documentElement;bm.innerHTML="<a name='"+bn+"'/>";bl.insertBefore(bm,bl.firstChild);if(ae.getElementById(bn)){a8.find.ID=function(bp,bq,br){if(typeof bq.getElementById!=="undefined"&&!br){var bo=bq.getElementById(bp[1]);return bo?bo.id===bp[1]||typeof bo.getAttributeNode!=="undefined"&&bo.getAttributeNode("id").nodeValue===bp[1]?[bo]:E:[]}};a8.filter.ID=function(bq,bo){var bp=typeof bq.getAttributeNode!=="undefined"&&bq.getAttributeNode("id");return bq.nodeType===1&&bp&&bp.nodeValue===bo}}bl.removeChild(bm);bl=bm=null})();(function(){var bl=ae.createElement("div");bl.appendChild(ae.createComment(""));if(bl.getElementsByTagName("*").length>0){a8.find.TAG=function(bm,bq){var bp=bq.getElementsByTagName(bm[1]);if(bm[1]==="*"){var bo=[];for(var bn=0;bp[bn];bn++){if(bp[bn].nodeType===1){bo.push(bp[bn])}}bp=bo}return bp}}bl.innerHTML="<a href='#'></a>";if(bl.firstChild&&typeof bl.firstChild.getAttribute!=="undefined"&&bl.firstChild.getAttribute("href")!=="#"){a8.attrHandle.href=function(bm){return bm.getAttribute("href",2)}}bl=null})();if(ae.querySelectorAll){(function(){var bl=a5,bo=ae.createElement("div"),bn="__sizzle__";bo.innerHTML="<p class='TEST'></p>";if(bo.querySelectorAll&&bo.querySelectorAll(".TEST").length===0){return}a5=function(by,bq,bt,bx){bq=bq||ae;if(!bx&&!a5.isXML(bq)){var bw=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(by);if(bw&&(bq.nodeType===1||bq.nodeType===9)){if(bw[1]){return a4(bq.getElementsByTagName(by),bt)}else{if(bw[2]&&a8.find.CLASS&&bq.getElementsByClassName){return a4(bq.getElementsByClassName(bw[2]),bt)}}}if(bq.nodeType===9){if(by==="body"&&bq.body){return a4([bq.body],bt)}else{if(bw&&bw[3]){var bs=bq.getElementById(bw[3]);if(bs&&bs.parentNode){if(bs.id===bw[3]){return a4([bs],bt)}}else{return a4([],bt)}}}try{return a4(bq.querySelectorAll(by),bt)}catch(bu){}}else{if(bq.nodeType===1&&bq.nodeName.toLowerCase()!=="object"){var br=bq.getAttribute("id"),bp=br||bn,bA=bq.parentNode,bz=/^\s*[+~]/.test(by);if(!br){bq.setAttribute("id",bp)}else{bp=bp.replace(/'/g,"\\$&")}if(bz&&bA){bq=bq.parentNode}try{if(!bz||bA){return a4(bq.querySelectorAll("[id='"+bp+"'] "+by),bt)}}catch(bv){}finally{if(!br){bq.removeAttribute("id")}}}}}return bl(by,bq,bt,bx)};for(var bm in bl){a5[bm]=bl[bm]}bo=null})()}(function(){var bl=ae.documentElement,bn=bl.matchesSelector||bl.mozMatchesSelector||bl.webkitMatchesSelector||bl.msMatchesSelector,bm=false;try{bn.call(ae.documentElement,"[test!='']:sizzle")}catch(bo){bm=true}if(bn){a5.matchesSelector=function(bp,br){br=br.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!a5.isXML(bp)){try{if(bm||!a8.match.PSEUDO.test(br)&&!/!=/.test(br)){return bn.call(bp,br)}}catch(bq){}}return a5(br,null,null,[bp]).length>0}}})();(function(){var bl=ae.createElement("div");bl.innerHTML="<div class='test e'></div><div class='test'></div>";if(!bl.getElementsByClassName||bl.getElementsByClassName("e").length===0){return}bl.lastChild.className="e";if(bl.getElementsByClassName("e").length===1){return}a8.order.splice(1,0,"CLASS");a8.find.CLASS=function(bm,bn,bo){if(typeof bn.getElementsByClassName!=="undefined"&&!bo){return bn.getElementsByClassName(bm[1])}};bl=null})();function bh(bm,br,bq,bu,bs,bt){for(var bo=0,bn=bu.length;bo<bn;bo++){var bl=bu[bo];if(bl){var bp=false;bl=bl[bm];while(bl){if(bl.sizcache===bq){bp=bu[bl.sizset];break}if(bl.nodeType===1&&!bt){bl.sizcache=bq;bl.sizset=bo}if(bl.nodeName.toLowerCase()===br){bp=bl;break}bl=bl[bm]}bu[bo]=bp}}}function bk(bm,br,bq,bu,bs,bt){for(var bo=0,bn=bu.length;bo<bn;bo++){var bl=bu[bo];if(bl){var bp=false;bl=bl[bm];while(bl){if(bl.sizcache===bq){bp=bu[bl.sizset];break}if(bl.nodeType===1){if(!bt){bl.sizcache=bq;bl.sizset=bo}if(typeof br!=="string"){if(bl===br){bp=true;break}}else{if(a5.filter(br,[bl]).length>0){bp=bl;break}}}bl=bl[bm]}bu[bo]=bp}}}if(ae.documentElement.contains){a5.contains=function(bm,bl){return bm!==bl&&(bm.contains?bm.contains(bl):true)}}else{if(ae.documentElement.compareDocumentPosition){a5.contains=function(bm,bl){return !!(bm.compareDocumentPosition(bl)&16)}}else{a5.contains=function(){return false}}}a5.isXML=function(bl){var bm=(bl?bl.ownerDocument||bl:0).documentElement;return bm?bm.nodeName!=="HTML":false};var ba=function(bl,bs){var bq,bo=[],bp="",bn=bs.nodeType?[bs]:bs;while((bq=a8.match.PSEUDO.exec(bl))){bp+=bq[0];bl=bl.replace(a8.match.PSEUDO,"")}bl=a8.relative[bl]?bl+"*":bl;for(var br=0,bm=bn.length;br<bm;br++){a5(bl,bn[br],bo)}return a5.filter(bp,bo)};a.find=a5;a.expr=a5.selectors;a.expr[":"]=a.expr.filters;a.unique=a5.uniqueSort;a.text=a5.getText;a.isXMLDoc=a5.isXML;a.contains=a5.contains})();var Q=/Until$/,ab=/^(?:parents|prevUntil|prevAll)/,aN=/,/,aZ=/^.[^:#\[\.,]*$/,I=Array.prototype.slice,C=a.expr.match.POS,ag={children:true,contents:true,next:true,prev:true};a.fn.extend({find:function(a4){var a6=this.pushStack("","find",a4),a9=0;for(var a7=0,a5=this.length;a7<a5;a7++){a9=a6.length;a.find(a4,this[a7],a6);if(a7>0){for(var ba=a9;ba<a6.length;ba++){for(var a8=0;a8<a9;a8++){if(a6[a8]===a6[ba]){a6.splice(ba--,1);break}}}}}return a6},has:function(a5){var a4=a(a5);return this.filter(function(){for(var a7=0,a6=a4.length;a7<a6;a7++){if(a.contains(this,a4[a7])){return true}}})},not:function(a4){return this.pushStack(al(this,a4,false),"not",a4)},filter:function(a4){return this.pushStack(al(this,a4,true),"filter",a4)},is:function(a4){return !!a4&&a.filter(a4,this).length>0},closest:function(be,a5){var bb=[],a8,a6,bd=this[0];if(a.isArray(be)){var ba,a7,a9={},a4=1;if(bd&&be.length){for(a8=0,a6=be.length;a8<a6;a8++){a7=be[a8];if(!a9[a7]){a9[a7]=a.expr.match.POS.test(a7)?a(a7,a5||this.context):a7}}while(bd&&bd.ownerDocument&&bd!==a5){for(a7 in a9){ba=a9[a7];if(ba.jquery?ba.index(bd)>-1:a(bd).is(ba)){bb.push({selector:a7,elem:bd,level:a4})}}bd=bd.parentNode;a4++}}return bb}var bc=C.test(be)?a(be,a5||this.context):null;for(a8=0,a6=this.length;a8<a6;a8++){bd=this[a8];while(bd){if(bc?bc.index(bd)>-1:a.find.matchesSelector(bd,be)){bb.push(bd);break}else{bd=bd.parentNode;if(!bd||!bd.ownerDocument||bd===a5){break}}}}bb=bb.length>1?a.unique(bb):bb;return this.pushStack(bb,"closest",be)},index:function(a4){if(!a4||typeof a4==="string"){return a.inArray(this[0],a4?a(a4):this.parent().children())}return a.inArray(a4.jquery?a4[0]:a4,this)},add:function(a4,a5){var a7=typeof a4==="string"?a(a4,a5):a.makeArray(a4),a6=a.merge(this.get(),a7);return this.pushStack(y(a7[0])||y(a6[0])?a6:a.unique(a6))},andSelf:function(){return this.add(this.prevObject)}});function y(a4){return !a4||!a4.parentNode||a4.parentNode.nodeType===11}a.each({parent:function(a5){var a4=a5.parentNode;return a4&&a4.nodeType!==11?a4:null},parents:function(a4){return a.dir(a4,"parentNode")},parentsUntil:function(a5,a4,a6){return a.dir(a5,"parentNode",a6)},next:function(a4){return a.nth(a4,2,"nextSibling")},prev:function(a4){return a.nth(a4,2,"previousSibling")},nextAll:function(a4){return a.dir(a4,"nextSibling")},prevAll:function(a4){return a.dir(a4,"previousSibling")},nextUntil:function(a5,a4,a6){return a.dir(a5,"nextSibling",a6)},prevUntil:function(a5,a4,a6){return a.dir(a5,"previousSibling",a6)},siblings:function(a4){return a.sibling(a4.parentNode.firstChild,a4)},children:function(a4){return a.sibling(a4.firstChild)},contents:function(a4){return a.nodeName(a4,"iframe")?a4.contentDocument||a4.contentWindow.document:a.makeArray(a4.childNodes)}},function(a4,a5){a.fn[a4]=function(a9,a6){var a8=a.map(this,a5,a9),a7=I.call(arguments);if(!Q.test(a4)){a6=a9}if(a6&&typeof a6==="string"){a8=a.filter(a6,a8)}a8=this.length>1&&!ag[a4]?a.unique(a8):a8;if((this.length>1||aN.test(a6))&&ab.test(a4)){a8=a8.reverse()}return this.pushStack(a8,a4,a7.join(","))}});a.extend({filter:function(a6,a4,a5){if(a5){a6=":not("+a6+")"}return a4.length===1?a.find.matchesSelector(a4[0],a6)?[a4[0]]:[]:a.find.matches(a6,a4)},dir:function(a6,a5,a8){var a4=[],a7=a6[a5];while(a7&&a7.nodeType!==9&&(a8===E||a7.nodeType!==1||!a(a7).is(a8))){if(a7.nodeType===1){a4.push(a7)}a7=a7[a5]}return a4},nth:function(a8,a4,a6,a7){a4=a4||1;var a5=0;for(;a8;a8=a8[a6]){if(a8.nodeType===1&&++a5===a4){break}}return a8},sibling:function(a6,a5){var a4=[];for(;a6;a6=a6.nextSibling){if(a6.nodeType===1&&a6!==a5){a4.push(a6)}}return a4}});function al(a7,a6,a4){if(a.isFunction(a6)){return a.grep(a7,function(a9,a8){var ba=!!a6.call(a9,a8,a9);return ba===a4})}else{if(a6.nodeType){return a.grep(a7,function(a9,a8){return(a9===a6)===a4})}else{if(typeof a6==="string"){var a5=a.grep(a7,function(a8){return a8.nodeType===1});if(aZ.test(a6)){return a.filter(a6,a5,!a4)}else{a6=a.filter(a6,a5)}}}}return a.grep(a7,function(a9,a8){return(a.inArray(a9,a6)>=0)===a4})}var V=/ jQuery\d+="(?:\d+|null)"/g,ac=/^\s+/,K=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,c=/<([\w:]+)/,t=/<tbody/i,N=/<|?\w+;/,H=/<(?:script|object|embed|option|style)/i,l=/checked\s*(?:[^=]|=\s*.checked.)/i,af={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};af.optgroup=af.option;af.tbody=af.tfoot=af.colgroup=af.caption=af.thead;af.th=af.td;if(!a.support.htmlSerialize){af._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(a4){if(a.isFunction(a4)){return this.each(function(a6){var a5=a(this);a5.text(a4.call(this,a6,a5.text()))})}if(typeof a4!=="object"&&a4!==E){return this.empty().append((this[0]&&this[0].ownerDocument||ae).createTextNode(a4))}return a.text(this)},wrapAll:function(a4){if(a.isFunction(a4)){return this.each(function(a6){a(this).wrapAll(a4.call(this,a6))})}if(this[0]){var a5=a(a4,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){a5.insertBefore(this[0])}a5.map(function(){var a6=this;while(a6.firstChild&&a6.firstChild.nodeType===1){a6=a6.firstChild}return a6}).append(this)}return this},wrapInner:function(a4){if(a.isFunction(a4)){return this.each(function(a5){a(this).wrapInner(a4.call(this,a5))})}return this.each(function(){var a5=a(this),a6=a5.contents();if(a6.length){a6.wrapAll(a4)}else{a5.append(a4)}})},wrap:function(a4){return this.each(function(){a(this).wrapAll(a4)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(a4){if(this.nodeType===1){this.appendChild(a4)}})},prepend:function(){return this.domManip(arguments,true,function(a4){if(this.nodeType===1){this.insertBefore(a4,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(a5){this.parentNode.insertBefore(a5,this)})}else{if(arguments.length){var a4=a(arguments[0]);a4.push.apply(a4,this.toArray());return this.pushStack(a4,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(a5){this.parentNode.insertBefore(a5,this.nextSibling)})}else{if(arguments.length){var a4=this.pushStack(this,"after",arguments);a4.push.apply(a4,a(arguments[0]).toArray());return a4}}},remove:function(a4,a7){for(var a5=0,a6;(a6=this[a5])!=null;a5++){if(!a4||a.filter(a4,[a6]).length){if(!a7&&a6.nodeType===1){a.cleanData(a6.getElementsByTagName("*"));a.cleanData([a6])}if(a6.parentNode){a6.parentNode.removeChild(a6)}}}return this},empty:function(){for(var a4=0,a5;(a5=this[a4])!=null;a4++){if(a5.nodeType===1){a.cleanData(a5.getElementsByTagName("*"))}while(a5.firstChild){a5.removeChild(a5.firstChild)}}return this},clone:function(a5,a4){a5=a5==null?true:a5;a4=a4==null?a5:a4;return this.map(function(){return a.clone(this,a5,a4)})},html:function(a6){if(a6===E){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(V,""):null}else{if(typeof a6==="string"&&!H.test(a6)&&(a.support.leadingWhitespace||!ac.test(a6))&&!af[(c.exec(a6)||["",""])[1].toLowerCase()]){a6=a6.replace(K,"<$1></$2>");try{for(var a5=0,a4=this.length;a5<a4;a5++){if(this[a5].nodeType===1){a.cleanData(this[a5].getElementsByTagName("*"));this[a5].innerHTML=a6}}}catch(a7){this.empty().append(a6)}}else{if(a.isFunction(a6)){this.each(function(a9){var a8=a(this);a8.html(a6.call(this,a9,a8.html()))})}else{this.empty().append(a6)}}}return this},replaceWith:function(a4){if(this[0]&&this[0].parentNode){if(a.isFunction(a4)){return this.each(function(a7){var a6=a(this),a5=a6.html();a6.replaceWith(a4.call(this,a7,a5))})}if(typeof a4!=="string"){a4=a(a4).detach()}return this.each(function(){var a6=this.nextSibling,a5=this.parentNode;a(this).remove();if(a6){a(a6).before(a4)}else{a(a5).append(a4)}})}else{return this.pushStack(a(a.isFunction(a4)?a4():a4),"replaceWith",a4)}},detach:function(a4){return this.remove(a4,true)},domManip:function(bb,bf,be){var a7,a8,ba,bd,bc=bb[0],a5=[];if(!a.support.checkClone&&arguments.length===3&&typeof bc==="string"&&l.test(bc)){return this.each(function(){a(this).domManip(bb,bf,be,true)})}if(a.isFunction(bc)){return this.each(function(bh){var bg=a(this);bb[0]=bc.call(this,bh,bf?bg.html():E);bg.domManip(bb,bf,be)})}if(this[0]){bd=bc&&bc.parentNode;if(a.support.parentNode&&bd&&bd.nodeType===11&&bd.childNodes.length===this.length){a7={fragment:bd}}else{a7=a.buildFragment(bb,this,a5)}ba=a7.fragment;if(ba.childNodes.length===1){a8=ba=ba.firstChild}else{a8=ba.firstChild}if(a8){bf=bf&&a.nodeName(a8,"tr");for(var a6=0,a4=this.length,a9=a4-1;a6<a4;a6++){be.call(bf?aO(this[a6],a8):this[a6],a7.cacheable||(a4>1&&a6<a9)?a.clone(ba,true,true):ba)}}if(a5.length){a.each(a5,aY)}}return this}});function aO(a4,a5){return a.nodeName(a4,"table")?(a4.getElementsByTagName("tbody")[0]||a4.appendChild(a4.ownerDocument.createElement("tbody"))):a4}function q(a4,bb){if(bb.nodeType!==1||!a.hasData(a4)){return}var ba=a.expando,a7=a.data(a4),a8=a.data(bb,a7);if((a7=a7[ba])){var bc=a7.events;a8=a8[ba]=a.extend({},a7);if(bc){delete a8.handle;a8.events={};for(var a9 in bc){for(var a6=0,a5=bc[a9].length;a6<a5;a6++){a.event.add(bb,a9,bc[a9][a6],bc[a9][a6].data)}}}}}function W(a5,a4){if(a4.nodeType!==1){return}var a6=a4.nodeName.toLowerCase();a4.clearAttributes();a4.mergeAttributes(a5);if(a6==="object"){a4.outerHTML=a5.outerHTML}else{if(a6==="input"&&(a5.type==="checkbox"||a5.type==="radio")){if(a5.checked){a4.defaultChecked=a4.checked=a5.checked}if(a4.value!==a5.value){a4.value=a5.value}}else{if(a6==="option"){a4.selected=a5.defaultSelected}else{if(a6==="input"||a6==="textarea"){a4.defaultValue=a5.defaultValue}}}}a4.removeAttribute(a.expando)}a.buildFragment=function(a9,a7,a5){var a8,a4,a6,ba=(a7&&a7[0]?a7[0].ownerDocument||a7[0]:ae);if(a9.length===1&&typeof a9[0]==="string"&&a9[0].length<512&&ba===ae&&a9[0].charAt(0)==="<"&&!H.test(a9[0])&&(a.support.checkClone||!l.test(a9[0]))){a4=true;a6=a.fragments[a9[0]];if(a6){if(a6!==1){a8=a6}}}if(!a8){a8=ba.createDocumentFragment();a.clean(a9,ba,a8,a5)}if(a4){a.fragments[a9[0]]=a6?a8:1}return{fragment:a8,cacheable:a4}};a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a4,a5){a.fn[a4]=function(a6){var a9=[],bc=a(a6),bb=this.length===1&&this[0].parentNode;if(bb&&bb.nodeType===11&&bb.childNodes.length===1&&bc.length===1){bc[a5](this[0]);return this}else{for(var ba=0,a7=bc.length;ba<a7;ba++){var a8=(ba>0?this.clone(true):this).get();a(bc[ba])[a5](a8);a9=a9.concat(a8)}return this.pushStack(a9,a4,bc.selector)}}});a.extend({clone:function(a8,ba,a6){var a9=a8.cloneNode(true),a4,a5,a7;if(!a.support.noCloneEvent&&(a8.nodeType===1||a8.nodeType===11)&&!a.isXMLDoc(a8)){a4=a8.getElementsByTagName("*");a5=a9.getElementsByTagName("*");for(a7=0;a4[a7];++a7){W(a4[a7],a5[a7])}W(a8,a9)}if(ba){q(a8,a9);if(a6&&"getElementsByTagName" in a8){a4=a8.getElementsByTagName("*");a5=a9.getElementsByTagName("*");if(a4.length){for(a7=0;a4[a7];++a7){q(a4[a7],a5[a7])}}}}return a9},clean:function(a6,a8,bf,ba){a8=a8||ae;if(typeof a8.createElement==="undefined"){a8=a8.ownerDocument||a8[0]&&a8[0].ownerDocument||ae}var bg=[];for(var be=0,a9;(a9=a6[be])!=null;be++){if(typeof a9==="number"){a9+=""}if(!a9){continue}if(typeof a9==="string"&&!N.test(a9)){a9=a8.createTextNode(a9)}else{if(typeof a9==="string"){a9=a9.replace(K,"<$1></$2>");var bh=(c.exec(a9)||["",""])[1].toLowerCase(),a7=af[bh]||af._default,bd=a7[0],a5=a8.createElement("div");a5.innerHTML=a7[1]+a9+a7[2];while(bd--){a5=a5.lastChild}if(!a.support.tbody){var a4=t.test(a9),bc=bh==="table"&&!a4?a5.firstChild&&a5.firstChild.childNodes:a7[1]==="<table>"&&!a4?a5.childNodes:[];for(var bb=bc.length-1;bb>=0;--bb){if(a.nodeName(bc[bb],"tbody")&&!bc[bb].childNodes.length){bc[bb].parentNode.removeChild(bc[bb])}}}if(!a.support.leadingWhitespace&&ac.test(a9)){a5.insertBefore(a8.createTextNode(ac.exec(a9)[0]),a5.firstChild)}a9=a5.childNodes}}if(a9.nodeType){bg.push(a9)}else{bg=a.merge(bg,a9)}}if(bf){for(be=0;bg[be];be++){if(ba&&a.nodeName(bg[be],"script")&&(!bg[be].type||bg[be].type.toLowerCase()==="text/javascript")){ba.push(bg[be].parentNode?bg[be].parentNode.removeChild(bg[be]):bg[be])}else{if(bg[be].nodeType===1){bg.splice.apply(bg,[be+1,0].concat(a.makeArray(bg[be].getElementsByTagName("script"))))}bf.appendChild(bg[be])}}}return bg},cleanData:function(a5){var a8,a6,a4=a.cache,bd=a.expando,bb=a.event.special,ba=a.support.deleteExpando;for(var a9=0,a7;(a7=a5[a9])!=null;a9++){if(a7.nodeName&&a.noData[a7.nodeName.toLowerCase()]){continue}a6=a7[a.expando];if(a6){a8=a4[a6]&&a4[a6][bd];if(a8&&a8.events){for(var bc in a8.events){if(bb[bc]){a.event.remove(a7,bc)}else{a.removeEvent(a7,bc,a8.handle)}}if(a8.handle){a8.handle.elem=null}}if(ba){delete a7[a.expando]}else{if(a7.removeAttribute){a7.removeAttribute(a.expando)}}delete a4[a6]}}}});function aY(a4,a5){if(a5.src){a.ajax({url:a5.src,async:false,dataType:"script"})}else{a.globalEval(a5.text||a5.textContent||a5.innerHTML||"")}if(a5.parentNode){a5.parentNode.removeChild(a5)}}var X=/alpha\([^)]*\)/i,ad=/opacity=([^)]*)/,aB=/-([a-z])/ig,w=/([A-Z])/g,aQ=/^-?\d+(?:px)?$/i,aX=/^-?\d/,aM={position:"absolute",visibility:"hidden",display:"block"},Z=["Left","Right"],aI=["Top","Bottom"],O,ao,aA,k=function(a4,a5){return a5.toUpperCase()};a.fn.css=function(a4,a5){if(arguments.length===2&&a5===E){return this}return a.access(this,a4,a5,true,function(a7,a6,a8){return a8!==E?a.style(a7,a6,a8):a.css(a7,a6)})};a.extend({cssHooks:{opacity:{get:function(a6,a5){if(a5){var a4=O(a6,"opacity","opacity");return a4===""?"1":a4}else{return a6.style.opacity}}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":a.support.cssFloat?"cssFloat":"styleFloat"},style:function(a6,a5,bb,a7){if(!a6||a6.nodeType===3||a6.nodeType===8||!a6.style){return}var ba,a8=a.camelCase(a5),a4=a6.style,bc=a.cssHooks[a8];a5=a.cssProps[a8]||a8;if(bb!==E){if(typeof bb==="number"&&isNaN(bb)||bb==null){return}if(typeof bb==="number"&&!a.cssNumber[a8]){bb+="px"}if(!bc||!("set" in bc)||(bb=bc.set(a6,bb))!==E){try{a4[a5]=bb}catch(a9){}}}else{if(bc&&"get" in bc&&(ba=bc.get(a6,false,a7))!==E){return ba}return a4[a5]}},css:function(a9,a8,a5){var a7,a6=a.camelCase(a8),a4=a.cssHooks[a6];a8=a.cssProps[a6]||a6;if(a4&&"get" in a4&&(a7=a4.get(a9,true,a5))!==E){return a7}else{if(O){return O(a9,a8,a6)}}},swap:function(a7,a6,a8){var a4={};for(var a5 in a6){a4[a5]=a7.style[a5];a7.style[a5]=a6[a5]}a8.call(a7);for(a5 in a6){a7.style[a5]=a4[a5]}},camelCase:function(a4){return a4.replace(aB,k)}});a.curCSS=a.css;a.each(["height","width"],function(a5,a4){a.cssHooks[a4]={get:function(a8,a7,a6){var a9;if(a7){if(a8.offsetWidth!==0){a9=n(a8,a4,a6)}else{a.swap(a8,aM,function(){a9=n(a8,a4,a6)})}if(a9<=0){a9=O(a8,a4,a4);if(a9==="0px"&&aA){a9=aA(a8,a4,a4)}if(a9!=null){return a9===""||a9==="auto"?"0px":a9}}if(a9<0||a9==null){a9=a8.style[a4];return a9===""||a9==="auto"?"0px":a9}return typeof a9==="string"?a9:a9+"px"}},set:function(a6,a7){if(aQ.test(a7)){a7=parseFloat(a7);if(a7>=0){return a7+"px"}}else{return a7}}}});if(!a.support.opacity){a.cssHooks.opacity={get:function(a5,a4){return ad.test((a4&&a5.currentStyle?a5.currentStyle.filter:a5.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":a4?"1":""},set:function(a7,a8){var a6=a7.style;a6.zoom=1;var a4=a.isNaN(a8)?"":"alpha(opacity="+a8*100+")",a5=a6.filter||"";a6.filter=X.test(a5)?a5.replace(X,a4):a6.filter+" "+a4}}}if(ae.defaultView&&ae.defaultView.getComputedStyle){ao=function(a9,a4,a7){var a6,a8,a5;a7=a7.replace(w,"-$1").toLowerCase();if(!(a8=a9.ownerDocument.defaultView)){return E}if((a5=a8.getComputedStyle(a9,null))){a6=a5.getPropertyValue(a7);if(a6===""&&!a.contains(a9.ownerDocument.documentElement,a9)){a6=a.style(a9,a7)}}return a6}}if(ae.documentElement.currentStyle){aA=function(a8,a6){var a9,a5=a8.currentStyle&&a8.currentStyle[a6],a4=a8.runtimeStyle&&a8.runtimeStyle[a6],a7=a8.style;if(!aQ.test(a5)&&aX.test(a5)){a9=a7.left;if(a4){a8.runtimeStyle.left=a8.currentStyle.left}a7.left=a6==="fontSize"?"1em":(a5||0);a5=a7.pixelLeft+"px";a7.left=a9;if(a4){a8.runtimeStyle.left=a4}}return a5===""?"auto":a5}}O=ao||aA;function n(a6,a5,a4){var a8=a5==="width"?Z:aI,a7=a5==="width"?a6.offsetWidth:a6.offsetHeight;if(a4==="border"){return a7}a.each(a8,function(){if(!a4){a7-=parseFloat(a.css(a6,"padding"+this))||0}if(a4==="margin"){a7+=parseFloat(a.css(a6,"margin"+this))||0}else{a7-=parseFloat(a.css(a6,"border"+this+"Width"))||0}});return a7}if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(a6){var a5=a6.offsetWidth,a4=a6.offsetHeight;return(a5===0&&a4===0)||(!a.support.reliableHiddenOffsets&&(a6.style.display||a.css(a6,"display"))==="none")};a.expr.filters.visible=function(a4){return !a.expr.filters.hidden(a4)}}var h=/%20/g,aa=/\[\]$/,a3=/\r?\n/g,a0=/#.*$/,aj=/^(.*?):\s*(.*?)\r?$/mg,aE=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ar=/^(?:GET|HEAD)$/,b=/^\/\//,F=/\?/,aL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,o=/^(?:select|textarea)/i,f=/\s+/,a2=/([?&])_=[^&]*/,D=/^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,x=a.fn.load,P={},p={};function d(a4){return function(a8,ba){if(typeof a8!=="string"){ba=a8;a8="*"}if(a.isFunction(ba)){var a7=a8.toLowerCase().split(f),a6=0,a9=a7.length,a5,bb,bc;for(;a6<a9;a6++){a5=a7[a6];bc=/^\+/.test(a5);if(bc){a5=a5.substr(1)||"*"}bb=a4[a5]=a4[a5]||[];bb[bc?"unshift":"push"](ba)}}}}function ax(a5,be,a9,bd,bb,a7){bb=bb||be.dataTypes[0];a7=a7||{};a7[bb]=true;var ba=a5[bb],a6=0,a4=ba?ba.length:0,a8=(a5===P),bc;for(;a6<a4&&(a8||!bc);a6++){bc=ba[a6](be,a9,bd);if(typeof bc==="string"){if(a7[bc]){bc=E}else{be.dataTypes.unshift(bc);bc=ax(a5,be,a9,bd,bc,a7)}}}if((a8||!bc)&&!a7["*"]){bc=ax(a5,be,a9,bd,"*",a7)}return bc}a.fn.extend({load:function(a6,a9,ba){if(typeof a6!=="string"&&x){return x.apply(this,arguments)}else{if(!this.length){return this}}var a8=a6.indexOf(" ");if(a8>=0){var a4=a6.slice(a8,a6.length);a6=a6.slice(0,a8)}var a7="GET";if(a9){if(a.isFunction(a9)){ba=a9;a9=null}else{if(typeof a9==="object"){a9=a.param(a9,a.ajaxSettings.traditional);a7="POST"}}}var a5=this;a.ajax({url:a6,type:a7,dataType:"html",data:a9,complete:function(bd,bb,bc){bc=bd.responseText;if(bd.isResolved()){bd.done(function(be){bc=be});a5.html(a4?a("<div>").append(bc.replace(aL,"")).find(a4):bc)}if(ba){a5.each(ba,[bc,bb,bd])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||o.test(this.nodeName)||aE.test(this.type))}).map(function(a4,a5){var a6=a(this).val();return a6==null?null:a.isArray(a6)?a.map(a6,function(a8,a7){return{name:a5.name,value:a8.replace(a3,"\r\n")}}):{name:a5.name,value:a6.replace(a3,"\r\n")}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a4,a5){a.fn[a5]=function(a6){return this.bind(a5,a6)}});a.each(["get","post"],function(a4,a5){a[a5]=function(a6,a8,a9,a7){if(a.isFunction(a8)){a7=a7||a9;a9=a8;a8=null}return a.ajax({type:a5,url:a6,data:a8,success:a9,dataType:a7})}});a.extend({getScript:function(a4,a5){return a.get(a4,null,a5,"script")},getJSON:function(a4,a5,a6){return a.get(a4,a5,a6,"json")},ajaxSetup:function(a4){a.extend(true,a.ajaxSettings,a4);if(a4.context){a.ajaxSettings.context=a4.context}},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":aP.String,"text html":true,"text json":a.parseJSON,"text xml":a.parseXML}},ajaxPrefilter:d(P),ajaxTransport:d(p),ajax:function(a8,a5){if(typeof a5!=="object"){a5=a8;a8=E}a5=a5||{};var bc=a.extend(true,{},a.ajaxSettings,a5),bq=(bc.context=("context" in a5?a5:a.ajaxSettings).context)||bc,bg=bq===bc?a.event:a(bq),bp=a.Deferred(),bm=a._Deferred(),ba=bc.statusCode||{},bh={},bo,a6,bk,be,bb=ae.location,bd=bb.protocol||"http:",bi,a9=0,bj,a7={readyState:0,setRequestHeader:function(br,bs){if(a9===0){bh[br.toLowerCase()]=bs}return this},getAllResponseHeaders:function(){return a9===2?bo:null},getResponseHeader:function(bs){var br;if(a9===2){if(!a6){a6={};while((br=aj.exec(bo))){a6[br[1].toLowerCase()]=br[2]}}br=a6[bs.toLowerCase()]}return br||null},abort:function(br){br=br||"abort";if(bk){bk.abort(br)}bf(0,br);return this}};function bf(bw,bu,bx,bt){if(a9===2){return}a9=2;if(be){clearTimeout(be)}bk=E;bo=bt||"";a7.readyState=bw?4:0;var br,bB,bA,bv=bx?aU(bc,a7,bx):E,bs,bz;if(bw>=200&&bw<300||bw===304){if(bc.ifModified){if((bs=a7.getResponseHeader("Last-Modified"))){a.lastModified[bc.url]=bs}if((bz=a7.getResponseHeader("Etag"))){a.etag[bc.url]=bz}}if(bw===304){bu="notmodified";br=true}else{try{bB=A(bc,bv);bu="success";br=true}catch(by){bu="parsererror";bA=by}}}else{bA=bu;if(bw){bu="error";if(bw<0){bw=0}}}a7.status=bw;a7.statusText=bu;if(br){bp.resolveWith(bq,[bB,bu,a7])}else{bp.rejectWith(bq,[a7,bu,bA])}a7.statusCode(ba);ba=E;if(bc.global){bg.trigger("ajax"+(br?"Success":"Error"),[a7,bc,br?bB:bA])}bm.resolveWith(bq,[a7,bu]);if(bc.global){bg.trigger("ajaxComplete",[a7,bc]);if(!(--a.active)){a.event.trigger("ajaxStop")}}}bp.promise(a7);a7.success=a7.done;a7.error=a7.fail;a7.complete=bm.done;a7.statusCode=function(bs){if(bs){var br;if(a9<2){for(br in bs){ba[br]=[ba[br],bs[br]]}}else{br=bs[a7.status];a7.then(br,br)}}return this};bc.url=(""+(a8||bc.url)).replace(a0,"").replace(b,bd+"//");bc.dataTypes=a.trim(bc.dataType||"*").toLowerCase().split(f);if(!bc.crossDomain){bi=D.exec(bc.url.toLowerCase());bc.crossDomain=!!(bi&&(bi[1]!=bd||bi[2]!=bb.hostname||(bi[3]||(bi[1]==="http:"?80:443))!=(bb.port||(bd==="http:"?80:443))))}if(bc.data&&bc.processData&&typeof bc.data!=="string"){bc.data=a.param(bc.data,bc.traditional)}ax(P,bc,a5,a7);bc.type=bc.type.toUpperCase();bc.hasContent=!ar.test(bc.type);if(bc.global&&a.active++===0){a.event.trigger("ajaxStart")}if(!bc.hasContent){if(bc.data){bc.url+=(F.test(bc.url)?"&":"?")+bc.data}if(bc.cache===false){var a4=a.now(),bn=bc.url.replace(a2,"$1_="+a4);bc.url=bn+((bn===bc.url)?(F.test(bc.url)?"&":"?")+"_="+a4:"")}}if(bc.data&&bc.hasContent&&bc.contentType!==false||a5.contentType){bh["content-type"]=bc.contentType}if(bc.ifModified){if(a.lastModified[bc.url]){bh["if-modified-since"]=a.lastModified[bc.url]}if(a.etag[bc.url]){bh["if-none-match"]=a.etag[bc.url]}}bh.accept=bc.dataTypes[0]&&bc.accepts[bc.dataTypes[0]]?bc.accepts[bc.dataTypes[0]]+(bc.dataTypes[0]!=="*"?", */*; q=0.01":""):bc.accepts["*"];for(bj in bc.headers){bh[bj.toLowerCase()]=bc.headers[bj]}if(bc.beforeSend&&(bc.beforeSend.call(bq,a7,bc)===false||a9===2)){bf(0,"abort");a7=false}else{for(bj in {success:1,error:1,complete:1}){a7[bj](bc[bj])}bk=ax(p,bc,a5,a7);if(!bk){bf(-1,"No Transport")}else{a9=a7.readyState=1;if(bc.global){bg.trigger("ajaxSend",[a7,bc])}if(bc.async&&bc.timeout>0){be=setTimeout(function(){a7.abort("timeout")},bc.timeout)}try{bk.send(bh,bf)}catch(bl){if(status<2){bf(-1,bl)}else{a.error(bl)}}}}return a7},param:function(a4,a6){var a5=[],a8=function(a9,ba){ba=a.isFunction(ba)?ba():ba;a5[a5.length]=encodeURIComponent(a9)+"="+encodeURIComponent(ba)};if(a6===E){a6=a.ajaxSettings.traditional}if(a.isArray(a4)||a4.jquery){a.each(a4,function(){a8(this.name,this.value)})}else{for(var a7 in a4){s(a7,a4[a7],a6,a8)}}return a5.join("&").replace(h,"+")}});function s(a5,a7,a4,a6){if(a.isArray(a7)&&a7.length){a.each(a7,function(a9,a8){if(a4||aa.test(a5)){a6(a5,a8)}else{s(a5+"["+(typeof a8==="object"||a.isArray(a8)?a9:"")+"]",a8,a4,a6)}})}else{if(!a4&&a7!=null&&typeof a7==="object"){if(a.isArray(a7)||a.isEmptyObject(a7)){a6(a5,"")}else{a.each(a7,function(a9,a8){s(a5+"["+a9+"]",a8,a4,a6)})}}else{a6(a5,a7)}}}a.extend({active:0,lastModified:{},etag:{}});function aU(bd,bc,a9){var a5=bd.contents,bb=bd.dataTypes,a6=bd.responseFields,a8,ba,a7,a4;for(ba in a6){if(ba in a9){bc[a6[ba]]=a9[ba]}}while(bb[0]==="*"){bb.shift();if(a8===E){a8=bc.getResponseHeader("content-type")}}if(a8){for(ba in a5){if(a5[ba]&&a5[ba].test(a8)){bb.unshift(ba);break}}}if(bb[0] in a9){a7=bb[0]}else{for(ba in a9){if(!bb[0]||bd.converters[ba+" "+bb[0]]){a7=ba;break}if(!a4){a4=ba}}a7=a7||a4}if(a7){if(a7!==bb[0]){bb.unshift(a7)}return a9[a7]}}function A(bg,a9){if(bg.dataFilter){a9=bg.dataFilter(a9,bg.dataType)}var bd=bg.dataTypes,bf=bg.converters,ba,a6=bd.length,bb,bc=bd[0],a7,a8,be,a5,a4;for(ba=1;ba<a6;ba++){a7=bc;bc=bd[ba];if(bc==="*"){bc=a7}else{if(a7!=="*"&&a7!==bc){a8=a7+" "+bc;be=bf[a8]||bf["* "+bc];if(!be){a4=E;for(a5 in bf){bb=a5.split(" ");if(bb[0]===a7||bb[0]==="*"){a4=bf[bb[1]+" "+bc];if(a4){a5=bf[a5];if(a5===true){be=a4}else{if(a4===true){be=a5}}break}}}}if(!(be||a4)){a.error("No conversion from "+a8.replace(" "," to "))}if(be!==true){a9=be?be(a9):a4(a5(a9))}}}}return a9}var ai=a.now(),r=/(\=)\?(&|$)|()\?\?()/i;a.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return a.expando+"_"+(ai++)}});a.ajaxPrefilter("json jsonp",function(bc,a9,bb){bb=(typeof bc.data==="string");if(bc.dataTypes[0]==="jsonp"||a9.jsonpCallback||a9.jsonp!=null||bc.jsonp!==false&&(r.test(bc.url)||bb&&r.test(bc.data))){var ba,a6=bc.jsonpCallback=a.isFunction(bc.jsonpCallback)?bc.jsonpCallback():bc.jsonpCallback,a8=aP[a6],a4=bc.url,a7=bc.data,a5="$1"+a6+"$2";if(bc.jsonp!==false){a4=a4.replace(r,a5);if(bc.url===a4){if(bb){a7=a7.replace(r,a5)}if(bc.data===a7){a4+=(/\?/.test(a4)?"&":"?")+bc.jsonp+"="+a6}}}bc.url=a4;bc.data=a7;aP[a6]=function(bd){ba=[bd]};bc.complete=[function(){aP[a6]=a8;if(a8){if(ba&&a.isFunction(a8)){aP[a6](ba[0])}}else{try{delete aP[a6]}catch(bd){}}},bc.complete];bc.converters["script json"]=function(){if(!ba){a.error(a6+" was not called")}return ba[0]};bc.dataTypes[0]="json";return"script"}});a.ajaxSetup({accepts:{script:"text/javascript, application/javascript"},contents:{script:/javascript/},converters:{"text script":function(a4){a.globalEval(a4);return a4}}});a.ajaxPrefilter("script",function(a4){if(a4.cache===E){a4.cache=false}if(a4.crossDomain){a4.type="GET";a4.global=false}});a.ajaxTransport("script",function(a6){if(a6.crossDomain){var a4,a5=ae.getElementsByTagName("head")[0]||ae.documentElement;return{send:function(a7,a8){a4=ae.createElement("script");a4.async="async";if(a6.scriptCharset){a4.charset=a6.scriptCharset}a4.src=a6.url;a4.onload=a4.onreadystatechange=function(ba,a9){if(!a4.readyState||/loaded|complete/.test(a4.readyState)){a4.onload=a4.onreadystatechange=null;if(a5&&a4.parentNode){a5.removeChild(a4)}a4=E;if(!a9){a8(200,"success")}}};a5.insertBefore(a4,a5.firstChild)},abort:function(){if(a4){a4.onload(0,1)}}}}});var v=a.now(),aF={},aC,ak;a.ajaxSettings.xhr=aP.ActiveXObject?function(){if(aP.location.protocol!=="file:"){try{return new aP.XMLHttpRequest()}catch(a5){}}try{return new aP.ActiveXObject("Microsoft.XMLHTTP")}catch(a4){}}:function(){return new aP.XMLHttpRequest()};try{ak=a.ajaxSettings.xhr()}catch(a1){}a.support.ajax=!!ak;a.support.cors=ak&&("withCredentials" in ak);ak=E;if(a.support.ajax){a.ajaxTransport(function(a4){if(!a4.crossDomain||a.support.cors){var a5;return{send:function(ba,a6){if(!aC){aC=1;a(aP).bind("unload",function(){a.each(aF,function(bb,bc){if(bc.onreadystatechange){bc.onreadystatechange(1)}})})}var a9=a4.xhr(),a8;if(a4.username){a9.open(a4.type,a4.url,a4.async,a4.username,a4.password)}else{a9.open(a4.type,a4.url,a4.async)}if(!(a4.crossDomain&&!a4.hasContent)&&!ba["x-requested-with"]){ba["x-requested-with"]="XMLHttpRequest"}try{a.each(ba,function(bb,bc){a9.setRequestHeader(bb,bc)})}catch(a7){}a9.send((a4.hasContent&&a4.data)||null);a5=function(be,bc){if(a5&&(bc||a9.readyState===4)){a5=0;if(a8){a9.onreadystatechange=a.noop;delete aF[a8]}if(bc){if(a9.readyState!==4){a9.abort()}}else{var bb=a9.status,bi,bf=a9.getAllResponseHeaders(),bg={},bd=a9.responseXML;if(bd&&bd.documentElement){bg.xml=bd}bg.text=a9.responseText;try{bi=a9.statusText}catch(bh){bi=""}bb=bb===0?(!a4.crossDomain||bi?(bf?304:0):302):(bb==1223?204:bb);a6(bb,bi,bg,bf)}}};if(!a4.async||a9.readyState===4){a5()}else{a8=v++;aF[a8]=a9;a9.onreadystatechange=a5}},abort:function(){if(a5){a5(0,1)}}}}})}var J={},ah=/^(?:toggle|show|hide)$/,au=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,aJ,an=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(a7,ba,a9){var a6,a8;if(a7||a7===0){return this.animate(aH("show",3),a7,ba,a9)}else{for(var a5=0,a4=this.length;a5<a4;a5++){a6=this[a5];a8=a6.style.display;if(!a._data(a6,"olddisplay")&&a8==="none"){a8=a6.style.display=""}if(a8===""&&a.css(a6,"display")==="none"){a._data(a6,"olddisplay",u(a6.nodeName))}}for(a5=0;a5<a4;a5++){a6=this[a5];a8=a6.style.display;if(a8===""||a8==="none"){a6.style.display=a._data(a6,"olddisplay")||""}}return this}},hide:function(a6,a9,a8){if(a6||a6===0){return this.animate(aH("hide",3),a6,a9,a8)}else{for(var a5=0,a4=this.length;a5<a4;a5++){var a7=a.css(this[a5],"display");if(a7!=="none"&&!a._data(this[a5],"olddisplay")){a._data(this[a5],"olddisplay",a7)}}for(a5=0;a5<a4;a5++){this[a5].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(a6,a5,a7){var a4=typeof a6==="boolean";if(a.isFunction(a6)&&a.isFunction(a5)){this._toggle.apply(this,arguments)}else{if(a6==null||a4){this.each(function(){var a8=a4?a6:a(this).is(":hidden");a(this)[a8?"show":"hide"]()})}else{this.animate(aH("toggle",3),a6,a5,a7)}}return this},fadeTo:function(a4,a7,a6,a5){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:a7},a4,a6,a5)},animate:function(a8,a5,a7,a6){var a4=a.speed(a5,a7,a6);if(a.isEmptyObject(a8)){return this.each(a4.complete)}return this[a4.queue===false?"each":"queue"](function(){var bb=a.extend({},a4),bf,bc=this.nodeType===1,bd=bc&&a(this).is(":hidden"),a9=this;for(bf in a8){var ba=a.camelCase(bf);if(bf!==ba){a8[ba]=a8[bf];delete a8[bf];bf=ba}if(a8[bf]==="hide"&&bd||a8[bf]==="show"&&!bd){return bb.complete.call(this)}if(bc&&(bf==="height"||bf==="width")){bb.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(a.css(this,"display")==="inline"&&a.css(this,"float")==="none"){if(!a.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{var be=u(this.nodeName);if(be==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}if(a.isArray(a8[bf])){(bb.specialEasing=bb.specialEasing||{})[bf]=a8[bf][1];a8[bf]=a8[bf][0]}}if(bb.overflow!=null){this.style.overflow="hidden"}bb.curAnim=a.extend({},a8);a.each(a8,function(bh,bl){var bk=new a.fx(a9,bb,bh);if(ah.test(bl)){bk[bl==="toggle"?bd?"show":"hide":bl](a8)}else{var bj=au.exec(bl),bm=bk.cur()||0;if(bj){var bg=parseFloat(bj[2]),bi=bj[3]||"px";if(bi!=="px"){a.style(a9,bh,(bg||1)+bi);bm=((bg||1)/bk.cur())*bm;a.style(a9,bh,bm+bi)}if(bj[1]){bg=((bj[1]==="-="?-1:1)*bg)+bm}bk.custom(bm,bg,bi)}else{bk.custom(bm,bl,"")}}});return true})},stop:function(a5,a4){var a6=a.timers;if(a5){this.queue([])}this.each(function(){for(var a7=a6.length-1;a7>=0;a7--){if(a6[a7].elem===this){if(a4){a6[a7](true)}a6.splice(a7,1)}}});if(!a4){this.dequeue()}return this}});function aH(a5,a4){var a6={};a.each(an.concat.apply([],an.slice(0,a4)),function(){a6[this]=a5});return a6}a.each({slideDown:aH("show",1),slideUp:aH("hide",1),slideToggle:aH("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a4,a5){a.fn[a4]=function(a6,a8,a7){return this.animate(a5,a6,a8,a7)}});a.extend({speed:function(a6,a7,a5){var a4=a6&&typeof a6==="object"?a.extend({},a6):{complete:a5||!a5&&a7||a.isFunction(a6)&&a6,duration:a6,easing:a5&&a7||a7&&!a.isFunction(a7)&&a7};a4.duration=a.fx.off?0:typeof a4.duration==="number"?a4.duration:a4.duration in a.fx.speeds?a.fx.speeds[a4.duration]:a.fx.speeds._default;a4.old=a4.complete;a4.complete=function(){if(a4.queue!==false){a(this).dequeue()}if(a.isFunction(a4.old)){a4.old.call(this)}};return a4},easing:{linear:function(a6,a7,a4,a5){return a4+a5*a6},swing:function(a6,a7,a4,a5){return((-Math.cos(a6*Math.PI)/2)+0.5)*a5+a4}},timers:[],fx:function(a5,a4,a6){this.options=a4;this.elem=a5;this.prop=a6;if(!a4.orig){a4.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var a4=parseFloat(a.css(this.elem,this.prop));return a4||0},custom:function(a9,a8,a7){var a4=this,a6=a.fx;this.startTime=a.now();this.start=a9;this.end=a8;this.unit=a7||this.unit||"px";this.now=this.start;this.pos=this.state=0;function a5(ba){return a4.step(ba)}a5.elem=this.elem;if(a5()&&a.timers.push(a5)&&!aJ){aJ=setInterval(a6.tick,a6.interval)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a7){var bc=a.now(),a8=true;if(a7||bc>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var a9 in this.options.curAnim){if(this.options.curAnim[a9]!==true){a8=false}}if(a8){if(this.options.overflow!=null&&!a.support.shrinkWrapBlocks){var a6=this.elem,bd=this.options;a.each(["","X","Y"],function(be,bf){a6.style["overflow"+bf]=bd.overflow[be]})}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var a4 in this.options.curAnim){a.style(this.elem,a4,this.options.orig[a4])}}this.options.complete.call(this.elem)}return false}else{var a5=bc-this.startTime;this.state=a5/this.options.duration;var ba=this.options.specialEasing&&this.options.specialEasing[this.prop];var bb=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[ba||bb](this.state,a5,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var a5=a.timers;for(var a4=0;a4<a5.length;a4++){if(!a5[a4]()){a5.splice(a4--,1)}}if(!a5.length){a.fx.stop()}},interval:13,stop:function(){clearInterval(aJ);aJ=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a4){a.style(a4.elem,"opacity",a4.now)},_default:function(a4){if(a4.elem.style&&a4.elem.style[a4.prop]!=null){a4.elem.style[a4.prop]=(a4.prop==="width"||a4.prop==="height"?Math.max(0,a4.now):a4.now)+a4.unit}else{a4.elem[a4.prop]=a4.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(a4){return a.grep(a.timers,function(a5){return a4===a5.elem}).length}}function u(a6){if(!J[a6]){var a4=a("<"+a6+">").appendTo("body"),a5=a4.css("display");a4.remove();if(a5==="none"||a5===""){a5="block"}J[a6]=a5}return J[a6]}var M=/^t(?:able|d|h)$/i,S=/^(?:body|html)$/i;if("getBoundingClientRect" in ae.documentElement){a.fn.offset=function(bh){var a7=this[0],ba;if(bh){return this.each(function(bi){a.offset.setOffset(this,bh,bi)})}if(!a7||!a7.ownerDocument){return null}if(a7===a7.ownerDocument.body){return a.offset.bodyOffset(a7)}try{ba=a7.getBoundingClientRect()}catch(be){}var bg=a7.ownerDocument,a5=bg.documentElement;if(!ba||!a.contains(a5,a7)){return ba?{top:ba.top,left:ba.left}:{top:0,left:0}}var bb=bg.body,bc=ap(bg),a9=a5.clientTop||bb.clientTop||0,bd=a5.clientLeft||bb.clientLeft||0,a4=(bc.pageYOffset||a.support.boxModel&&a5.scrollTop||bb.scrollTop),a8=(bc.pageXOffset||a.support.boxModel&&a5.scrollLeft||bb.scrollLeft),bf=ba.top+a4-a9,a6=ba.left+a8-bd;return{top:bf,left:a6}}}else{a.fn.offset=function(bf){var a9=this[0];if(bf){return this.each(function(bg){a.offset.setOffset(this,bf,bg)})}if(!a9||!a9.ownerDocument){return null}if(a9===a9.ownerDocument.body){return a.offset.bodyOffset(a9)}a.offset.initialize();var bc,a6=a9.offsetParent,a5=a9,be=a9.ownerDocument,a7=be.documentElement,ba=be.body,bb=be.defaultView,a4=bb?bb.getComputedStyle(a9,null):a9.currentStyle,bd=a9.offsetTop,a8=a9.offsetLeft;while((a9=a9.parentNode)&&a9!==ba&&a9!==a7){if(a.offset.supportsFixedPosition&&a4.position==="fixed"){break}bc=bb?bb.getComputedStyle(a9,null):a9.currentStyle;bd-=a9.scrollTop;a8-=a9.scrollLeft;if(a9===a6){bd+=a9.offsetTop;a8+=a9.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&M.test(a9.nodeName))){bd+=parseFloat(bc.borderTopWidth)||0;a8+=parseFloat(bc.borderLeftWidth)||0}a5=a6;a6=a9.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&bc.overflow!=="visible"){bd+=parseFloat(bc.borderTopWidth)||0;a8+=parseFloat(bc.borderLeftWidth)||0}a4=bc}if(a4.position==="relative"||a4.position==="static"){bd+=ba.offsetTop;a8+=ba.offsetLeft}if(a.offset.supportsFixedPosition&&a4.position==="fixed"){bd+=Math.max(a7.scrollTop,ba.scrollTop);a8+=Math.max(a7.scrollLeft,ba.scrollLeft)}return{top:bd,left:a8}}}a.offset={initialize:function(){var a4=ae.body,a5=ae.createElement("div"),a8,ba,a9,bb,a6=parseFloat(a.css(a4,"marginTop"))||0,a7="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.extend(a5.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});a5.innerHTML=a7;a4.insertBefore(a5,a4.firstChild);a8=a5.firstChild;ba=a8.firstChild;bb=a8.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(ba.offsetTop!==5);this.doesAddBorderForTableAndCells=(bb.offsetTop===5);ba.style.position="fixed";ba.style.top="20px";this.supportsFixedPosition=(ba.offsetTop===20||ba.offsetTop===15);ba.style.position=ba.style.top="";a8.style.overflow="hidden";a8.style.position="relative";this.subtractsBorderForOverflowNotVisible=(ba.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(a4.offsetTop!==a6);a4.removeChild(a5);a4=a5=a8=ba=a9=bb=null;a.offset.initialize=a.noop},bodyOffset:function(a4){var a6=a4.offsetTop,a5=a4.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){a6+=parseFloat(a.css(a4,"marginTop"))||0;a5+=parseFloat(a.css(a4,"marginLeft"))||0}return{top:a6,left:a5}},setOffset:function(a7,bg,ba){var bb=a.css(a7,"position");if(bb==="static"){a7.style.position="relative"}var a9=a(a7),a5=a9.offset(),a4=a.css(a7,"top"),be=a.css(a7,"left"),bf=(bb==="absolute"&&a.inArray("auto",[a4,be])>-1),bd={},bc={},a6,a8;if(bf){bc=a9.position()}a6=bf?bc.top:parseInt(a4,10)||0;a8=bf?bc.left:parseInt(be,10)||0;if(a.isFunction(bg)){bg=bg.call(a7,ba,a5)}if(bg.top!=null){bd.top=(bg.top-a5.top)+a6}if(bg.left!=null){bd.left=(bg.left-a5.left)+a8}if("using" in bg){bg.using.call(a7,bd)}else{a9.css(bd)}}};a.fn.extend({position:function(){if(!this[0]){return null}var a6=this[0],a5=this.offsetParent(),a7=this.offset(),a4=S.test(a5[0].nodeName)?{top:0,left:0}:a5.offset();a7.top-=parseFloat(a.css(a6,"marginTop"))||0;a7.left-=parseFloat(a.css(a6,"marginLeft"))||0;a4.top+=parseFloat(a.css(a5[0],"borderTopWidth"))||0;a4.left+=parseFloat(a.css(a5[0],"borderLeftWidth"))||0;return{top:a7.top-a4.top,left:a7.left-a4.left}},offsetParent:function(){return this.map(function(){var a4=this.offsetParent||ae.body;while(a4&&(!S.test(a4.nodeName)&&a.css(a4,"position")==="static")){a4=a4.offsetParent}return a4})}});a.each(["Left","Top"],function(a5,a4){var a6="scroll"+a4;a.fn[a6]=function(a9){var a7=this[0],a8;if(!a7){return null}if(a9!==E){return this.each(function(){a8=ap(this);if(a8){a8.scrollTo(!a5?a9:a(a8).scrollLeft(),a5?a9:a(a8).scrollTop())}else{this[a6]=a9}})}else{a8=ap(a7);return a8?("pageXOffset" in a8)?a8[a5?"pageYOffset":"pageXOffset"]:a.support.boxModel&&a8.document.documentElement[a6]||a8.document.body[a6]:a7[a6]}}});function ap(a4){return a.isWindow(a4)?a4:a4.nodeType===9?a4.defaultView||a4.parentWindow:false}a.each(["Height","Width"],function(a5,a4){var a6=a4.toLowerCase();a.fn["inner"+a4]=function(){return this[0]?parseFloat(a.css(this[0],a6,"padding")):null};a.fn["outer"+a4]=function(a7){return this[0]?parseFloat(a.css(this[0],a6,a7?"margin":"border")):null};a.fn[a6]=function(a8){var a9=this[0];if(!a9){return a8==null?null:this}if(a.isFunction(a8)){return this.each(function(bd){var bc=a(this);bc[a6](a8.call(this,bd,bc[a6]()))})}if(a.isWindow(a9)){var ba=a9.document.documentElement["client"+a4];return a9.document.compatMode==="CSS1Compat"&&ba||a9.document.body["client"+a4]||ba}else{if(a9.nodeType===9){return Math.max(a9.documentElement["client"+a4],a9.body["scroll"+a4],a9.documentElement["scroll"+a4],a9.body["offset"+a4],a9.documentElement["offset"+a4])}else{if(a8===E){var bb=a.css(a9,a6),a7=parseFloat(bb);return a.isNaN(a7)?bb:a7}else{return this.css(a6,typeof a8==="string"?a8:a8+"px")}}}}})})(window); \ No newline at end of file --- a/templates/workflow/editor.mako Sun Feb 06 11:29:04 2011 -0500 +++ b/templates/workflow/editor.mako Sun Feb 06 14:42:11 2011 -0500 @@ -309,7 +309,7 @@ } - $.jStore.engineReady(function() { + $.jStore.ready(function() { // On load, set the size to the pref stored in local storage if it exists overview_size = $.jStore.store("overview-size"); if (overview_size !== undefined) { http://bitbucket.org/galaxy/galaxy-central/changeset/c90c5ffad852/ changeset: r5013:c90c5ffad852 user: james_taylor date: 2011-02-06 20:44:14 summary: trackster: use new jquery defereds to ensure draw happens after predraw_init in line tracks, eliminates failure to draw before scrolling affected #: 1 file (102 bytes) --- a/static/scripts/trackster.js Sun Feb 06 14:42:11 2011 -0500 +++ b/static/scripts/trackster.js Sun Feb 06 14:44:14 2011 -0500 @@ -1018,8 +1018,8 @@ track.content_div.text(""); track.content_div.css( "height", track.height_px + "px" ); track.enabled = true; - track.predraw_init(); - track.draw(); + // predraw_init may be asynchronous, wait for it and then draw + $.when( track.predraw_init() ).done( function() { track.draw() } ); } } }); @@ -1803,7 +1803,7 @@ track_id = track.view.tracks.indexOf(track); track.vertical_range = undefined; - $.getJSON( track.data_url, { stats: true, chrom: track.view.chrom, low: null, high: null, + return $.getJSON( track.data_url, { stats: true, chrom: track.view.chrom, low: null, high: null, hda_ldda: track.hda_ldda, dataset_id: track.dataset_id }, function(result) { track.container_div.addClass( "line-track" ); var data = result.data; http://bitbucket.org/galaxy/galaxy-central/changeset/8b71270b7876/ changeset: r5014:8b71270b7876 user: james_taylor date: 2011-02-07 17:38:34 summary: merge affected #: 1 file (3.6 KB) --- a/static/scripts/packed/trackster.js Sun Feb 06 14:44:14 2011 -0500 +++ b/static/scripts/packed/trackster.js Mon Feb 07 11:38:34 2011 -0500 @@ -1,1 +1,1 @@ -CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(d,h){if(!h.hidden){var i="param_"+d;var g=$("<div class='form-row' />").appendTo(a);g.append($("<label />").attr("for",i).text(h.label+":"));if(h.type=="bool"){g.append($('<input type="checkbox" />').attr("id",i).attr("name",i).attr("checked",b.values[h.key]))}else{if(h.type=="color"){var f=b.values[h.key];var c=$("<input />").attr("id",i).attr("name",i).val(f);var e=$("<div class='tipsy tipsy-west' style='position: absolute;' />").append($("<div class='tipsy-inner' />").farbtastic({width:100,height:100,callback:c,color:f})).hide();$("<div />").append(c).append(e).appendTo(g).hover(function(){e.css({left:$(this).position().left+$(c).width()-20,top:$(this).position().top-50}).show()},function(){e.hide()})}else{g.append($("<input />").attr("id",i).attr("name",i).val(b.values[h.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(this.dataset_check_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom,low:a.view.max_low,high:a.view.max_high},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").attr("id",d+"_error");c.text("View error");$("#"+d+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b==="data"){a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;a.predraw_init();a.draw()}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};h["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();o.is_overview=true;o.set_overview();for(var i in j.tracks){if(j.tracks[i]!==o){j.tracks[i].is_overview=false}}};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var l=this.view.low,f=this.view.high,h=f-l,e=this.view.resolution;var o=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h;this.content_div.append(o);this.max_height=0;var b=Math.floor(l/e/DENSITY);var k=0;while((b*DENSITY*e)<f){var m=this.content_div.width()+"_"+q+"_"+b;var d=this.tile_cache.get(m);var j=b*DENSITY*this.view.resolution;var p=j+DENSITY*this.view.resolution;if(!a&&d){this.show_tile(d,o,j)}else{this.delayed_draw(a,m,j,p,b,e,o,q,k)}b+=1}var c=this;var n=setInterval(function(){if(k===0){var t=c.content_div.children();var s=false;for(var u=t.length-1,r=0;u>=r;u--){var w=$(t[u]);if(s){w.remove()}else{if(w.children().length!==0){s=true}}}for(var v=0;v<c.filters.length;v++){c.filters[v].update_ui_elt()}clearInterval(n)}},50);for(var g=0;g<this.child_tracks.length;g++){this.child_tracks[g].draw(a)}},delayed_draw:function(b,h,g,j,c,e,i,k,f){var d=this;var a=setTimeout(function(){if(g<=d.view.high&&j>=d.view.low){var l;if(!b){l=d.tile_cache.get(h)}if(!l){l=d.draw_tile(e,c,i,k);if(l){var m=$("<div class='track-tile'>").prepend(l);if(l.hasClass(FILTERABLE_CLASS)){m.addClass(FILTERABLE_CLASS)}l=m}}if(l){d.tile_cache.set(h,l);d.show_tile(l,i,g)}}delete f--},50);f++},show_tile:function(a,f,d){var b=this;var c=this.view.high-this.view.low,g=this.content_div.width()/c,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;$.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,b,p){var r=this.inc_slots[a];if(!r||(r.mode!==p)){r={};r.w_scale=a;r.mode=p;this.inc_slots[a]=r;this.s_e_by_tile[a]={}}var l=r.w_scale,x=[],y=[],j=0,n=this.view.max_low;for(var v=0,w=h.length;v<w;v++){var g=h[v],k=g[0];if(r[k]!==undefined){j=Math.max(j,r[k]);y.push(r[k])}else{x.push(v)}}var q=this.s_e_by_tile[a];var m=function(D,E){var C;for(var B=0,F;B<=MAX_FEATURE_DEPTH;B++){C=true;F=q[B];if(F!==undefined){for(var z=0,A=F.length;z<A;z++){var i=F[z];if(E>i[0]&&D<i[1]){C=false;break}}}if(C){break}}if(C){return B}else{return -1}};for(var v=0,w=x.length;v<w;v++){var g=h[x[v]],k=g[0],t=g[1],c=g[2],o=g[3],d=Math.floor((t-n)*l),f=Math.ceil((c-n)*l),u=CONTEXT.measureText(o).width,e;if(o!==undefined&&!b){if(d-u<0){f+=u;e="left"}else{d-=u;e="right"}}var s=m(d,f);if(s<0){}if(s>=0){slot=q[s];if(slot===undefined){slot=q[s]=[]}slot.push([d,f]);r[k]=s;j=Math.max(j,s)}else{}}return j},rect_or_text:function(r,l,u,b,q,j,g,f){r.textAlign="center";var d=0,s=0,p=Math.round(l/2);for(var m=0,t=j.length;m<t;m++){var k=j[m],e="MIDNSHP=X"[k[0]],n=k[1];if(e==="H"||e==="S"){d-=n}var h=q+d,x=Math.floor(Math.max(0,(h-u)*l)),i=Math.floor(Math.max(0,(h+n-u)*l));switch(e){case"H":break;case"S":case"M":case"=":var o=g.slice(s,s+n);if((this.mode==="Pack"||this.mode==="Auto")&&g!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+1,i-x,9);r.fillStyle=CONNECTOR_COLOR;for(var v=0,a=o.length;v<a;v++){if(h+v>=u&&h+v<=b){var w=Math.floor(Math.max(0,(h+v-u)*l));r.fillText(o[v],w+this.left_offset+p,f+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+(this.mode!="Dense"?4:5),i-x,(this.mode!="Dense"?3:1))}s+=n;break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(x+this.left_offset,f+5,i-x,1);break;case"D":r.fillStyle="red";r.fillRect(x+this.left_offset,f+4,i-x,3);break;case"P":break;case"I":s+=n;break;case"X":s+=n;break}d+=n}},draw_tile:function(ad,n,r,ar){var L=n*DENSITY*ad,ai=(n+1)*DENSITY*ad,K=ai-L;var G=this.data_cache.get_data(L,ai,this.mode);if(G===undefined||G==="pending"||(this.mode!=="Auto"&&G.dataset_type==="summary_tree")){this.data_queue[[L,ai]]=true;this.get_data(L,ai);return}var a=Math.ceil(K*ar),af=this.prefs.label_color,h=this.prefs.block_color,q=this.mode,v=25,ab=(q==="Squish")||(q==="Dense")&&(q!=="Pack")||(q==="Auto"&&(G.extra_info==="no_detail")),U=this.left_offset,aq,B,at;var p=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(p)}p=$(p);if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(q==="Dense"){B=v;at=10}else{at=(ab?this.vertical_nodetail_px:this.vertical_detail_px);var w=(ar<0.0001?1/this.view.zoom_res:ar);B=this.incremental_slots(w,G.data,ab,q)*at+v;aq=this.inc_slots[w]}}p.get(0).width=a+U;p.get(0).height=B;r.parent().css("height",Math.max(this.height_px,B)+"px");var H=p.get(0).getContext("2d");H.fillStyle=h;H.font=this.default_font;H.textAlign="right";this.container_div.find(".yaxislabel").remove();if(G.dataset_type=="summary_tree"){var W=G.data,J=G.max,b=Math.ceil(G.delta*ar);var o=$("<div />").addClass("yaxislabel");o.text(J);o.css({position:"absolute",top:"22px",left:"10px"});o.prependTo(this.container_div);for(var am=0,F=W.length;am<F;am++){var Y=Math.floor((W[am][0]-L)*ar);var X=W[am][1];if(!X){continue}var aj=X/J*this.summary_draw_height;H.fillStyle="black";H.fillRect(Y+U,this.summary_draw_height-aj,b,aj);if(this.prefs.show_counts&&H.measureText(X).width<b){H.fillStyle="#bbb";H.textAlign="center";H.fillText(X,Y+U+(b/2),this.summary_draw_height-5)}}return p}if(G.message){p.css({border:"solid red","border-width":"2px 2px 2px 0px"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+U,at);return p}for(var ao=0;ao<this.filters.length;ao++){if(G.data.length&&this.filters[ao].applies_to(G.data[0])){p.addClass(FILTERABLE_CLASS);break}}var ap=G.data;var al=0;for(var am=0,F=ap.length;am<F;am++){var Q=ap[am],P=Q[0],an=Q[1],aa=Q[2],M=Q[3];if(this.mode!="Dense"&&aq[P]===undefined){continue}var Z=false;var S;for(var ao=0;ao<this.filters.length;ao++){S=this.filters[ao];S.update_attrs(Q);if(!S.keep(Q)){Z=true;break}}if(Z){continue}if(an<=ai&&aa>=L){var ac=Math.floor(Math.max(0,(an-L)*ar)),I=Math.ceil(Math.min(a,Math.max(0,(aa-L)*ar))),V=(q==="Dense"?1:(1+aq[P]))*at;var E,ag,N=null,au=null;if(G.dataset_type==="bai"){H.fillStyle=h;if(Q[5] instanceof Array){var C=Math.floor(Math.max(0,(Q[4][0]-L)*ar)),O=Math.ceil(Math.min(a,Math.max(0,(Q[4][1]-L)*ar))),A=Math.floor(Math.max(0,(Q[5][0]-L)*ar)),u=Math.ceil(Math.min(a,Math.max(0,(Q[5][1]-L)*ar)));if(Q[4][1]>=L&&Q[4][0]<=ai&&Q[4][2]){this.rect_or_text(H,ar,L,ai,Q[4][0],Q[4][2],Q[4][3],V)}if(Q[5][1]>=L&&Q[5][0]<=ai&&Q[5][2]){this.rect_or_text(H,ar,L,ai,Q[5][0],Q[5][2],Q[5][3],V)}if(A>O){H.fillStyle=CONNECTOR_COLOR;H.dashedLine(O+U,V+5,U+A,V+5)}}else{H.fillStyle=h;this.rect_or_text(H,ar,L,ai,an,Q[4],Q[5],V)}if(q!=="Dense"&&!ab&&an>L){H.fillStyle=this.prefs.label_color;if(n===0&&ac-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ac-2+U,V+8)}H.fillStyle=h}}else{if(G.dataset_type==="interval_index"){if(ab){H.fillStyle=h;H.fillRect(ac+U,V+5,I-ac,1)}else{var D=Q[5],T=Q[6],ae=Q[7],g=Q[8];if(T&&ae){N=Math.floor(Math.max(0,(T-L)*ar));au=Math.ceil(Math.min(a,Math.max(0,(ae-L)*ar)))}if(q!=="Dense"&&M!==undefined&&an>L){H.fillStyle=af;if(n===0&&ac-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ac-2+U,V+8)}H.fillStyle=h}if(g){if(D){if(D=="+"){H.fillStyle=RIGHT_STRAND}else{if(D=="-"){H.fillStyle=LEFT_STRAND}}H.fillRect(ac+U,V,I-ac,10);H.fillStyle=h}for(var ak=0,e=g.length;ak<e;ak++){var t=g[ak],d=Math.floor(Math.max(0,(t[0]-L)*ar)),R=Math.ceil(Math.min(a,Math.max((t[1]-L)*ar)));if(d>R){continue}E=5;ag=3;H.fillRect(d+U,V+ag,R-d,E);if(N!==undefined&&!(d>au||R<N)){E=9;ag=1;var ah=Math.max(d,N),z=Math.min(R,au);H.fillRect(ah+U,V+ag,z-ah,E)}}}else{E=9;ag=1;H.fillRect(ac+U,V+ag,I-ac,E);if(Q.strand){if(Q.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(Q.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}H.fillRect(ac+U,V,I-ac,10);H.fillStyle=h}}}}else{if(G.dataset_type==="vcf"){if(ab){H.fillStyle=h;H.fillRect(ac+U,V+5,I-ac,1)}else{var s=Q[4],m=Q[5],c=Q[6];E=9;ag=1;H.fillRect(ac+U,V,I-ac,E);if(q!=="Dense"&&M!==undefined&&an>L){H.fillStyle=af;if(n===0&&ac-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ac-2+U,V+8)}H.fillStyle=h}var l=s+" / "+m;if(an>L&&H.measureText(l).width<(I-ac)){H.fillStyle="white";H.textAlign="center";H.fillText(l,U+ac+(I-ac)/2,V+8);H.fillStyle=h}}}}}al++}}return p}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}}); \ No newline at end of file +CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var DENSE_HEIGHT=1,SQUISH_HEIGHT=3,PACK_HEIGHT=9,DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(d,h){if(!h.hidden){var i="param_"+d;var g=$("<div class='form-row' />").appendTo(a);g.append($("<label />").attr("for",i).text(h.label+":"));if(h.type=="bool"){g.append($('<input type="checkbox" />').attr("id",i).attr("name",i).attr("checked",b.values[h.key]))}else{if(h.type=="color"){var f=b.values[h.key];var c=$("<input />").attr("id",i).attr("name",i).val(f);var e=$("<div class='tipsy tipsy-north' style='position: absolute;' />").append($("<div class='tipsy-inner' />").farbtastic({width:100,height:100,callback:c,color:f})).hide();$("<div />").append(c).append(e).appendTo(g).bind("click",function(j){e.css({left:$(this).position().left+($(c).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){e.hide();$(document).unbind("click.color-picker")});j.stopPropagation()})}else{g.append($("<input />").attr("id",i).attr("name",i).val(b.values[h.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(this.dataset_check_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom,low:a.view.max_low,high:a.view.max_high},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").attr("id",d+"_error");c.text("View error");$("#"+d+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b==="data"){a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;a.predraw_init();a.draw()}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};h["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();o.is_overview=true;o.set_overview();for(var i in j.tracks){if(j.tracks[i]!==o){j.tracks[i].is_overview=false}}};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var l=this.view.low,f=this.view.high,h=f-l,e=this.view.resolution;var o=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h;this.content_div.append(o);this.max_height=0;var b=Math.floor(l/e/DENSITY);var k=0;while((b*DENSITY*e)<f){var m=this.content_div.width()+"_"+q+"_"+b;var d=this.tile_cache.get(m);var j=b*DENSITY*this.view.resolution;var p=j+DENSITY*this.view.resolution;if(!a&&d){this.show_tile(d,o,j)}else{this.delayed_draw(a,m,j,p,b,e,o,q,k)}b+=1}var c=this;var n=setInterval(function(){if(k===0){var t=c.content_div.children();var s=false;for(var u=t.length-1,r=0;u>=r;u--){var w=$(t[u]);if(s){w.remove()}else{if(w.children().length!==0){s=true}}}for(var v=0;v<c.filters.length;v++){c.filters[v].update_ui_elt()}clearInterval(n)}},50);for(var g=0;g<this.child_tracks.length;g++){this.child_tracks[g].draw(a)}},delayed_draw:function(b,h,g,j,c,e,i,k,f){var d=this;var a=setTimeout(function(){if(g<=d.view.high&&j>=d.view.low){var l;if(!b){l=d.tile_cache.get(h)}if(!l){l=d.draw_tile(e,c,i,k);if(l){var m=$("<div class='track-tile'>").prepend(l);if(l.hasClass(FILTERABLE_CLASS)){m.addClass(FILTERABLE_CLASS)}l=m}}if(l){d.tile_cache.set(h,l);d.show_tile(l,i,g)}}delete f--},50);f++},show_tile:function(a,f,d){var b=this;var c=this.view.high-this.view.low,g=this.content_div.width()/c,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;$.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=5;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,b,p){var r=this.inc_slots[a];if(!r||(r.mode!==p)){r={};r.w_scale=a;r.mode=p;this.inc_slots[a]=r;this.s_e_by_tile[a]={}}var l=r.w_scale,x=[],y=[],j=0,n=this.view.max_low;for(var v=0,w=h.length;v<w;v++){var g=h[v],k=g[0];if(r[k]!==undefined){j=Math.max(j,r[k]);y.push(r[k])}else{x.push(v)}}var q=this.s_e_by_tile[a];var m=function(D,E){var C;for(var B=0,F;B<=MAX_FEATURE_DEPTH;B++){C=true;F=q[B];if(F!==undefined){for(var z=0,A=F.length;z<A;z++){var i=F[z];if(E>i[0]&&D<i[1]){C=false;break}}}if(C){break}}if(C){return B}else{return -1}};for(var v=0,w=x.length;v<w;v++){var g=h[x[v]],k=g[0],t=g[1],c=g[2],o=g[3],d=Math.floor((t-n)*l),f=Math.ceil((c-n)*l),u=CONTEXT.measureText(o).width,e;if(o!==undefined&&!b){if(d-u<0){f+=u;e="left"}else{d-=u;e="right"}}var s=m(d,f);if(s<0){}if(s>=0){slot=q[s];if(slot===undefined){slot=q[s]=[]}slot.push([d,f]);r[k]=s;j=Math.max(j,s)}else{}}return j},rect_or_text:function(r,l,u,b,q,j,g,f){r.textAlign="center";var d=0,s=0,p=Math.round(l/2);for(var m=0,t=j.length;m<t;m++){var k=j[m],e="MIDNSHP=X"[k[0]],n=k[1];if(e==="H"||e==="S"){d-=n}var h=q+d,x=Math.floor(Math.max(0,(h-u)*l)),i=Math.floor(Math.max(0,(h+n-u)*l));switch(e){case"H":break;case"S":case"M":case"=":var o=g.slice(s,s+n);if((this.mode==="Pack"||this.mode==="Auto")&&g!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+1,i-x,9);r.fillStyle=CONNECTOR_COLOR;for(var v=0,a=o.length;v<a;v++){if(h+v>=u&&h+v<=b){var w=Math.floor(Math.max(0,(h+v-u)*l));r.fillText(o[v],w+this.left_offset+p,f+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+(this.mode!="Dense"?4:5),i-x,(this.mode!="Dense"?SQUISH_HEIGHT:DENSE_HEIGHT))}s+=n;break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(x+this.left_offset,f+5,i-x,1);break;case"D":r.fillStyle="red";r.fillRect(x+this.left_offset,f+4,i-x,3);break;case"P":break;case"I":s+=n;break;case"X":s+=n;break}d+=n}},draw_tile:function(ag,n,r,aw){var M=n*DENSITY*ag,al=(n+1)*DENSITY*ag,L=al-M;var H=this.data_cache.get_data(M,al,this.mode);if(H===undefined||H==="pending"||(this.mode!=="Auto"&&H.dataset_type==="summary_tree")){this.data_queue[[M,al]]=true;this.get_data(M,al);return}var a=Math.ceil(L*aw),ai=this.prefs.label_color,h=this.prefs.block_color,q=this.mode,v=25,ae=(q==="Squish")||(q==="Dense")&&(q!=="Pack")||(q==="Auto"&&(H.extra_info==="no_detail")),X=this.left_offset,av,C,ax;var p=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(p)}p=$(p);if(H.dataset_type==="summary_tree"){C=this.summary_draw_height}else{if(q==="Dense"){C=v;ax=10}else{ax=(ae?this.vertical_nodetail_px:this.vertical_detail_px);var w=(aw<0.0001?1/this.view.zoom_res:aw);C=this.incremental_slots(w,H.data,ae,q)*ax+v;av=this.inc_slots[w]}}p.get(0).width=a+X;p.get(0).height=C;r.parent().css("height",Math.max(this.height_px,C)+"px");var I=p.get(0).getContext("2d");I.fillStyle=h;I.font=this.default_font;I.textAlign="right";this.container_div.find(".yaxislabel").remove();if(H.dataset_type=="summary_tree"){var Z=H.data,K=H.max,b=Math.ceil(H.delta*aw);var o=$("<div />").addClass("yaxislabel");o.text(K);o.css({position:"absolute",top:"22px",left:"10px"});o.prependTo(this.container_div);for(var ap=0,G=Z.length;ap<G;ap++){var ab=Math.floor((Z[ap][0]-M)*aw);var aa=Z[ap][1];if(!aa){continue}var am=aa/K*this.summary_draw_height;I.fillStyle="black";I.fillRect(ab+X,this.summary_draw_height-am,b,am);if(this.prefs.show_counts&&I.measureText(aa).width<b){I.fillStyle="#bbb";I.textAlign="center";I.fillText(aa,ab+X+(b/2),this.summary_draw_height-5)}}return p}if(H.message){p.css({border:"solid red","border-width":"2px 2px 2px 0px"});I.fillStyle="red";I.textAlign="left";I.fillText(H.message,100+X,ax);return p}for(var at=0;at<this.filters.length;at++){if(H.data.length&&this.filters[at].applies_to(H.data[0])){p.addClass(FILTERABLE_CLASS);break}}var au=H.data;var ao=0;for(var ap=0,G=au.length;ap<G;ap++){var T=au[ap],Q=T[0],ar=T[1],ad=T[2],N=T[3];if(this.mode!="Dense"&&av[Q]===undefined){continue}var ac=false;var V;for(var at=0;at<this.filters.length;at++){V=this.filters[at];V.update_attrs(T);if(!V.keep(T)){ac=true;break}}if(ac){continue}if(ar<=al&&ad>=M){if(H.dataset_type=="interval_index"){ad-=1}var af=Math.floor(Math.max(0,(ar-M)*aw)),J=Math.ceil(Math.min(a,Math.max(0,(ad-M)*aw))),Y=(q==="Dense"?1:(1+av[Q]))*ax;var F,aj,O=null,ay=null;if(H.dataset_type==="bai"){I.fillStyle=h;if(T[5] instanceof Array){var D=Math.floor(Math.max(0,(T[4][0]-M)*aw)),P=Math.ceil(Math.min(a,Math.max(0,(T[4][1]-M)*aw))),B=Math.floor(Math.max(0,(T[5][0]-M)*aw)),u=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-M)*aw)));if(T[4][1]>=M&&T[4][0]<=al&&T[4][2]){this.rect_or_text(I,aw,M,al,T[4][0],T[4][2],T[4][3],Y)}if(T[5][1]>=M&&T[5][0]<=al&&T[5][2]){this.rect_or_text(I,aw,M,al,T[5][0],T[5][2],T[5][3],Y)}if(B>P){I.fillStyle=CONNECTOR_COLOR;I.dashedLine(P+X,Y+5,X+B,Y+5)}}else{I.fillStyle=h;this.rect_or_text(I,aw,M,al,ar,T[4],T[5],Y)}if(q!=="Dense"&&!ae&&ar>M){I.fillStyle=this.prefs.label_color;if(n===0&&af-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,af-2+X,Y+8)}I.fillStyle=h}}else{if(H.dataset_type==="interval_index"){if(q=="Auto"){if(T.length<=4){q="Squish"}else{q="Pack"}}if(q=="Dense"){I.fillStyle=h;I.fillRect(af+X,Y+5,J-af,DENSE_HEIGHT)}else{if(T.length<=4){I.fillStyle=h;I.fillRect(af+X,Y+5,J-af,1)}else{var E=T[5],W=T[6],ah=T[7],g=T[8];if(W&&ah){O=Math.floor(Math.max(0,(W-M)*aw));ay=Math.ceil(Math.min(a,Math.max(0,(ah-M)*aw)))}var aq,R;if(q=="Squish"){aq=1;R=SQUISH_HEIGHT}else{aq=5;R=PACK_HEIGHT}if(!g){if(T.strand){if(T.strand=="+"){I.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){I.fillStyle=LEFT_STRAND_INV}}}else{I.fillStyle=CONNECTOR_COLOR}I.fillRect(af+X,Y+(R-aq)/2+1,J-af,R)}else{var A,S;if(q=="Squish"){I.fillStyle=CONNECTOR_COLOR;A=Y+Math.floor(SQUISH_HEIGHT/2)+1;S=1}else{if(E){var A=Y;var S=R;if(E=="+"){I.fillStyle=RIGHT_STRAND}else{if(E=="-"){I.fillStyle=LEFT_STRAND}}}else{I.fillStyle=CONNECTOR_COLOR;A+=(SQUISH_HEIGHT/2)+1;S=1}}I.fillRect(af+X,A,J-af,S);for(var an=0,e=g.length;an<e;an++){var t=g[an],d=Math.floor(Math.max(0,(t[0]-M)*aw)),U=Math.ceil(Math.min(a,Math.max((t[1]-M)*aw)));if(d>U){continue}I.fillStyle=h;I.fillRect(d+X,Y+(R-aq)/2+1,U-d,aq);if(O!==undefined&&!(d>ay||U<O)){var ak=Math.max(d,O),z=Math.min(U,ay-1);I.fillRect(ak+X,Y+1,z-ak,R)}}}if(q=="Pack"&&ar>M){I.fillStyle=ai;if(n===0&&af-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,af-2+X,Y+8)}I.fillStyle=h}}}}else{if(H.dataset_type==="vcf"){if(ae){I.fillStyle=h;I.fillRect(af+X,Y+5,J-af,1)}else{var s=T[4],m=T[5],c=T[6];F=9;aj=1;I.fillRect(af+X,Y,J-af,F);if(q!=="Dense"&&N!==undefined&&ar>M){I.fillStyle=ai;if(n===0&&af-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,af-2+X,Y+8)}I.fillStyle=h}var l=s+" / "+m;if(ar>M&&I.measureText(l).width<(J-af)){I.fillStyle="white";I.textAlign="center";I.fillText(l,X+af+(J-af)/2,Y+8);I.fillStyle=h}}}}}ao++}}return p}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}}); \ No newline at end of file --- a/static/scripts/trackster.js Sun Feb 06 14:44:14 2011 -0500 +++ b/static/scripts/trackster.js Mon Feb 07 11:38:34 2011 -0500 @@ -57,6 +57,12 @@ * Init constants & functions used throughout trackster. */ var + // Drawing constants. + DENSE_HEIGHT = 1, + SQUISH_HEIGHT = 3, + PACK_HEIGHT = 9, + + // Other constants. DENSITY = 200, FEATURE_LEVELS = 10, MAX_FEATURE_DEPTH = 100, @@ -209,8 +215,7 @@ }, // Generate key for cache. gen_key: function(low, high, mode) { - // TODO: use mode to generate key? - var key = low + "_" + high; + var key = low + "_" + high + "_" + mode; /* if (no_detail) { key += "_" + no_detail @@ -1980,7 +1985,7 @@ this.show_labels_scale = 0.001; this.showing_details = false; this.vertical_detail_px = 10; - this.vertical_nodetail_px = 3; + this.vertical_nodetail_px = 5; this.summary_draw_height = 30; this.default_font = "9px Monaco, Lucida Console, monospace"; this.inc_slots = {}; @@ -2223,7 +2228,10 @@ } else { ctx.fillStyle = this.prefs.block_color; // TODO: This is a pretty hack-ish way to fill rectangle based on mode. - ctx.fillRect(s_start + this.left_offset, y_center + (this.mode != "Dense" ? 4 : 5), s_end - s_start, (this.mode != "Dense" ? 3 : 1) ); + ctx.fillRect(s_start + this.left_offset, + y_center + (this.mode != "Dense" ? 4 : 5), + s_end - s_start, + (this.mode != "Dense" ? SQUISH_HEIGHT : DENSE_HEIGHT) ); } seq_offset += cig_len; break; @@ -2263,8 +2271,11 @@ break; } }*/ + + // + // Get tile data; if data not available, issue get_data request and return. + // var result = this.data_cache.get_data(tile_low, tile_high, this.mode); - if (result === undefined || result === "pending" || (this.mode !== "Auto" && result.dataset_type === "summary_tree")) { this.data_queue[ [tile_low, tile_high] ] = true; @@ -2272,6 +2283,9 @@ return; } + // + // Create/set/compute some useful vars. + // var width = Math.ceil( tile_span * w_scale ), label_color = this.prefs.label_color, block_color = this.prefs.block_color, @@ -2297,7 +2311,7 @@ required_height = this.incremental_slots( inc_scale, result.data, no_detail, mode ) * y_scale + min_height; slots = this.inc_slots[inc_scale]; } - + canvas.get(0).width = width + left_offset; canvas.get(0).height = required_height; parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px"); @@ -2398,6 +2412,11 @@ } if (feature_start <= tile_high && feature_end >= tile_low) { + // -1 b/c intervals are half-open. + if (result.dataset_type == "interval_index") { + feature_end -= 1; + } + // All features need a start, end, and vertical center. var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ), f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ), @@ -2448,12 +2467,37 @@ } // Interval index drawing. else if (result.dataset_type === "interval_index") { - // console.log(feature_uid, feature_start, feature_end, f_start, f_end, y_center); - if (no_detail) { + // + // There are really four modes for interval indices: + // dense, no_detail, squish, pack. + // + + // TODO: move this code out of loop. + // Set mode in Auto + if (mode == "Auto") { + // Never use dense when in auto mode. + // TODO: decide when to use squish and when to use pack. + if (feature.length <= 4) { + mode = "Squish"; + } + else { + mode = "Pack"; + } + } + + // Dense mode displays the same for all data. + if (mode == "Dense") { ctx.fillStyle = block_color; + ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_HEIGHT); + } + // Mode is either Squish or Pack: + else if (feature.length <= 4) { + // No details for feature, so only one way to display. + ctx.fillStyle = block_color; + // TODO: what should width be here? ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, 1); } else { - // Showing labels, blocks, details. + // Feature has details. var feature_strand = feature[5], feature_ts = feature[6], feature_te = feature[7], @@ -2463,8 +2507,92 @@ thick_start = Math.floor( Math.max(0, (feature_ts - tile_low) * w_scale) ); thick_end = Math.ceil( Math.min(width, Math.max(0, (feature_te - tile_low) * w_scale)) ); } - if (mode !== "Dense" && feature_name !== undefined && feature_start > tile_low) { - // Draw label + + // Set vars that depend on mode. + var thin_height, thick_height; + if (mode == "Squish") { + thin_height = 1; + thick_height = SQUISH_HEIGHT; + } + else { // mode == "Pack" + thin_height = 5; + thick_height = PACK_HEIGHT; + } + + // Draw feature/feature blocks + connectors. + if (!feature_blocks) { + // If there are no blocks, treat the feature as one big exon. + if ( feature.strand ) { + if (feature.strand == "+") { + ctx.fillStyle = RIGHT_STRAND_INV; + } else if (feature.strand == "-") { + ctx.fillStyle = LEFT_STRAND_INV; + } + } + else { // No strand. + ctx.fillStyle = CONNECTOR_COLOR; + } + ctx.fillRect(f_start + left_offset, y_center + (thick_height-thin_height)/2 + 1, + f_end - f_start, thick_height); + } + else { // There are feature blocks and mode is either Squish or Pack. + // + // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as + // needed. This ensures that whole feature, regardless of whether it starts with + // a block, is visible. + // + + // Draw whole feature as connector/intron. + var cur_y_center, cur_height; + if (mode == "Squish") { + ctx.fillStyle = CONNECTOR_COLOR; + cur_y_center = y_center + Math.floor(SQUISH_HEIGHT/2) + 1; + cur_height = 1; + } + else { // mode == "Pack" + if (feature_strand) { + var cur_y_center = y_center; + var cur_height = thick_height; + if (feature_strand == "+") { + ctx.fillStyle = RIGHT_STRAND; + } else if (feature_strand == "-") { + ctx.fillStyle = LEFT_STRAND; + } + } + else { + ctx.fillStyle = CONNECTOR_COLOR; + cur_y_center += (SQUISH_HEIGHT/2) + 1; + cur_height = 1; + } + } + ctx.fillRect(f_start + left_offset, cur_y_center, f_end - f_start, cur_height); + + for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) { + var block = feature_blocks[k], + block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ), + block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) ); + + // Skip drawing if block not on tile. + if (block_start > block_end) { continue; } + + // Draw thin block. + ctx.fillStyle = block_color; + ctx.fillRect(block_start + left_offset, y_center + (thick_height-thin_height)/2 + 1, + block_end - block_start, thin_height); + + // If block intersects with thick region, draw block as thick. + if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) { + var block_thick_start = Math.max(block_start, thick_start), + // -1 b/c intervals are half-open. + block_thick_end = Math.min(block_end, thick_end-1); + ctx.fillRect(block_thick_start + left_offset, y_center + 1, + block_thick_end - block_thick_start, thick_height); + } + } + } + + // Draw label for Pack mode. + if (mode == "Pack" && feature_start > tile_low) { ctx.fillStyle = label_color; if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) { ctx.textAlign = "left"; @@ -2475,53 +2603,6 @@ } ctx.fillStyle = block_color; } - if (feature_blocks) { - // Draw introns - if (feature_strand) { - if (feature_strand == "+") { - ctx.fillStyle = RIGHT_STRAND; - } else if (feature_strand == "-") { - ctx.fillStyle = LEFT_STRAND; - } - ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, 10); - ctx.fillStyle = block_color; - } - - for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) { - var block = feature_blocks[k], - block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ), - block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) ); - if (block_start > block_end) { continue; } - // Draw the block - thickness = 5; - y_start = 3; - ctx.fillRect(block_start + left_offset, y_center + y_start, block_end - block_start, thickness); - - // Draw thick regions: check if block intersects with thick region - if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) { - thickness = 9; - y_start = 1; - var block_thick_start = Math.max(block_start, thick_start), - block_thick_end = Math.min(block_end, thick_end); - ctx.fillRect(block_thick_start + left_offset, y_center + y_start, block_thick_end - block_thick_start, thickness); - - } - } - } else { - // If there are no blocks, we treat the feature as one big exon - thickness = 9; - y_start = 1; - ctx.fillRect(f_start + left_offset, y_center + y_start, f_end - f_start, thickness); - if ( feature.strand ) { - if (feature.strand == "+") { - ctx.fillStyle = RIGHT_STRAND_INV; - } else if (feature.strand == "-") { - ctx.fillStyle = LEFT_STRAND_INV; - } - ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, 10); - ctx.fillStyle = block_color; - } - } } } else if (result.dataset_type === 'vcf') { // VCF track. Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket