michael@0: (function(){ michael@0: /* michael@0: * jQuery 1.2.6 - New Wave Javascript michael@0: * michael@0: * Copyright (c) 2008 John Resig (jquery.com) michael@0: * Dual licensed under the MIT (MIT-LICENSE.txt) michael@0: * and GPL (GPL-LICENSE.txt) licenses. michael@0: * michael@0: * $Date: 2008-05-24 11:09:21 -0700 (Sat, 24 May 2008) $ michael@0: * $Rev: 5683 $ michael@0: */ michael@0: michael@0: // Map over jQuery in case of overwrite michael@0: var _jQuery = window.jQuery, michael@0: // Map over the $ in case of overwrite michael@0: _$ = window.$; michael@0: michael@0: var jQuery = window.jQuery = window.$ = function( selector, context ) { michael@0: // The jQuery object is actually just the init constructor 'enhanced' michael@0: return new jQuery.fn.init( selector, context ); michael@0: }; michael@0: michael@0: // A simple way to check for HTML strings or ID strings michael@0: // (both of which we optimize for) michael@0: var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, michael@0: michael@0: // Is it a simple selector michael@0: isSimple = /^.[^:#\[\.]*$/, michael@0: michael@0: // Will speed up references to undefined, and allows munging its name. michael@0: undefined; michael@0: michael@0: jQuery.fn = jQuery.prototype = { michael@0: init: function( selector, context ) { michael@0: // Make sure that a selection was provided michael@0: selector = selector || document; michael@0: michael@0: // Handle $(DOMElement) michael@0: if ( selector.nodeType ) { michael@0: this[0] = selector; michael@0: this.length = 1; michael@0: return this; michael@0: } michael@0: // Handle HTML strings michael@0: if ( typeof selector == "string" ) { michael@0: // Are we dealing with HTML string or an ID? michael@0: var match = quickExpr.exec( selector ); michael@0: michael@0: // Verify a match, and that no context was specified for #id michael@0: if ( match && (match[1] || !context) ) { michael@0: michael@0: // HANDLE: $(html) -> $(array) michael@0: if ( match[1] ) michael@0: selector = jQuery.clean( [ match[1] ], context ); michael@0: michael@0: // HANDLE: $("#id") michael@0: else { michael@0: var elem = document.getElementById( match[3] ); michael@0: michael@0: // Make sure an element was located michael@0: if ( elem ){ michael@0: // Handle the case where IE and Opera return items michael@0: // by name instead of ID michael@0: if ( elem.id != match[3] ) michael@0: return jQuery().find( selector ); michael@0: michael@0: // Otherwise, we inject the element directly into the jQuery object michael@0: return jQuery( elem ); michael@0: } michael@0: selector = []; michael@0: } michael@0: michael@0: // HANDLE: $(expr, [context]) michael@0: // (which is just equivalent to: $(content).find(expr) michael@0: } else michael@0: return jQuery( context ).find( selector ); michael@0: michael@0: // HANDLE: $(function) michael@0: // Shortcut for document ready michael@0: } else if ( jQuery.isFunction( selector ) ) michael@0: return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); michael@0: michael@0: return this.setArray(jQuery.makeArray(selector)); michael@0: }, michael@0: michael@0: // The current version of jQuery being used michael@0: jquery: "1.2.6", michael@0: michael@0: // The number of elements contained in the matched element set michael@0: size: function() { michael@0: return this.length; michael@0: }, michael@0: michael@0: // The number of elements contained in the matched element set michael@0: length: 0, michael@0: michael@0: // Get the Nth element in the matched element set OR michael@0: // Get the whole matched element set as a clean array michael@0: get: function( num ) { michael@0: return num == undefined ? michael@0: michael@0: // Return a 'clean' array michael@0: jQuery.makeArray( this ) : michael@0: michael@0: // Return just the object michael@0: this[ num ]; michael@0: }, michael@0: michael@0: // Take an array of elements and push it onto the stack michael@0: // (returning the new matched element set) michael@0: pushStack: function( elems ) { michael@0: // Build a new jQuery matched element set michael@0: var ret = jQuery( elems ); michael@0: michael@0: // Add the old object onto the stack (as a reference) michael@0: ret.prevObject = this; michael@0: michael@0: // Return the newly-formed element set michael@0: return ret; michael@0: }, michael@0: michael@0: // Force the current matched set of elements to become michael@0: // the specified array of elements (destroying the stack in the process) michael@0: // You should use pushStack() in order to do this, but maintain the stack michael@0: setArray: function( elems ) { michael@0: // Resetting the length to 0, then using the native Array push michael@0: // is a super-fast way to populate an object with array-like properties michael@0: this.length = 0; michael@0: Array.prototype.push.apply( this, elems ); michael@0: michael@0: return this; michael@0: }, michael@0: michael@0: // Execute a callback for every element in the matched set. michael@0: // (You can seed the arguments with an array of args, but this is michael@0: // only used internally.) michael@0: each: function( callback, args ) { michael@0: return jQuery.each( this, callback, args ); michael@0: }, michael@0: michael@0: // Determine the position of an element within michael@0: // the matched set of elements michael@0: index: function( elem ) { michael@0: var ret = -1; michael@0: michael@0: // Locate the position of the desired element michael@0: return jQuery.inArray( michael@0: // If it receives a jQuery object, the first element is used michael@0: elem && elem.jquery ? elem[0] : elem michael@0: , this ); michael@0: }, michael@0: michael@0: attr: function( name, value, type ) { michael@0: var options = name; michael@0: michael@0: // Look for the case where we're accessing a style value michael@0: if ( name.constructor == String ) michael@0: if ( value === undefined ) michael@0: return this[0] && jQuery[ type || "attr" ]( this[0], name ); michael@0: michael@0: else { michael@0: options = {}; michael@0: options[ name ] = value; michael@0: } michael@0: michael@0: // Check to see if we're setting style values michael@0: return this.each(function(i){ michael@0: // Set all the styles michael@0: for ( name in options ) michael@0: jQuery.attr( michael@0: type ? michael@0: this.style : michael@0: this, michael@0: name, jQuery.prop( this, options[ name ], type, i, name ) michael@0: ); michael@0: }); michael@0: }, michael@0: michael@0: css: function( key, value ) { michael@0: // ignore negative width and height values michael@0: if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) michael@0: value = undefined; michael@0: return this.attr( key, value, "curCSS" ); michael@0: }, michael@0: michael@0: text: function( text ) { michael@0: if ( typeof text != "object" && text != null ) michael@0: return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); michael@0: michael@0: var ret = ""; michael@0: michael@0: jQuery.each( text || this, function(){ michael@0: jQuery.each( this.childNodes, function(){ michael@0: if ( this.nodeType != 8 ) michael@0: ret += this.nodeType != 1 ? michael@0: this.nodeValue : michael@0: jQuery.fn.text( [ this ] ); michael@0: }); michael@0: }); michael@0: michael@0: return ret; michael@0: }, michael@0: michael@0: wrapAll: function( html ) { michael@0: if ( this[0] ) michael@0: // The elements to wrap the target around michael@0: jQuery( html, this[0].ownerDocument ) michael@0: .clone() michael@0: .insertBefore( this[0] ) michael@0: .map(function(){ michael@0: var elem = this; michael@0: michael@0: while ( elem.firstChild ) michael@0: elem = elem.firstChild; michael@0: michael@0: return elem; michael@0: }) michael@0: .append(this); michael@0: michael@0: return this; michael@0: }, michael@0: michael@0: wrapInner: function( html ) { michael@0: return this.each(function(){ michael@0: jQuery( this ).contents().wrapAll( html ); michael@0: }); michael@0: }, michael@0: michael@0: wrap: function( html ) { michael@0: return this.each(function(){ michael@0: jQuery( this ).wrapAll( html ); michael@0: }); michael@0: }, michael@0: michael@0: append: function() { michael@0: return this.domManip(arguments, true, false, function(elem){ michael@0: if (this.nodeType == 1) michael@0: this.appendChild( elem ); michael@0: }); michael@0: }, michael@0: michael@0: prepend: function() { michael@0: return this.domManip(arguments, true, true, function(elem){ michael@0: if (this.nodeType == 1) michael@0: this.insertBefore( elem, this.firstChild ); michael@0: }); michael@0: }, michael@0: michael@0: before: function() { michael@0: return this.domManip(arguments, false, false, function(elem){ michael@0: this.parentNode.insertBefore( elem, this ); michael@0: }); michael@0: }, michael@0: michael@0: after: function() { michael@0: return this.domManip(arguments, false, true, function(elem){ michael@0: this.parentNode.insertBefore( elem, this.nextSibling ); michael@0: }); michael@0: }, michael@0: michael@0: end: function() { michael@0: return this.prevObject || jQuery( [] ); michael@0: }, michael@0: michael@0: find: function( selector ) { michael@0: var elems = jQuery.map(this, function(elem){ michael@0: return jQuery.find( selector, elem ); michael@0: }); michael@0: michael@0: return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? michael@0: jQuery.unique( elems ) : michael@0: elems ); michael@0: }, michael@0: michael@0: clone: function( events ) { michael@0: // Do the clone michael@0: var ret = this.map(function(){ michael@0: if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { michael@0: // IE copies events bound via attachEvent when michael@0: // using cloneNode. Calling detachEvent on the michael@0: // clone will also remove the events from the orignal michael@0: // In order to get around this, we use innerHTML. michael@0: // Unfortunately, this means some modifications to michael@0: // attributes in IE that are actually only stored michael@0: // as properties will not be copied (such as the michael@0: // the name attribute on an input). michael@0: var clone = this.cloneNode(true), michael@0: container = document.createElement("div"); michael@0: container.appendChild(clone); michael@0: return jQuery.clean([container.innerHTML])[0]; michael@0: } else michael@0: return this.cloneNode(true); michael@0: }); michael@0: michael@0: // Need to set the expando to null on the cloned set if it exists michael@0: // removeData doesn't work here, IE removes it from the original as well michael@0: // this is primarily for IE but the data expando shouldn't be copied over in any browser michael@0: var clone = ret.find("*").andSelf().each(function(){ michael@0: if ( this[ expando ] != undefined ) michael@0: this[ expando ] = null; michael@0: }); michael@0: michael@0: // Copy the events from the original to the clone michael@0: if ( events === true ) michael@0: this.find("*").andSelf().each(function(i){ michael@0: if (this.nodeType == 3) michael@0: return; michael@0: var events = jQuery.data( this, "events" ); michael@0: michael@0: for ( var type in events ) michael@0: for ( var handler in events[ type ] ) michael@0: jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); michael@0: }); michael@0: michael@0: // Return the cloned set michael@0: return ret; michael@0: }, michael@0: michael@0: filter: function( selector ) { michael@0: return this.pushStack( michael@0: jQuery.isFunction( selector ) && michael@0: jQuery.grep(this, function(elem, i){ michael@0: return selector.call( elem, i ); michael@0: }) || michael@0: michael@0: jQuery.multiFilter( selector, this ) ); michael@0: }, michael@0: michael@0: not: function( selector ) { michael@0: if ( selector.constructor == String ) michael@0: // test special case where just one selector is passed in michael@0: if ( isSimple.test( selector ) ) michael@0: return this.pushStack( jQuery.multiFilter( selector, this, true ) ); michael@0: else michael@0: selector = jQuery.multiFilter( selector, this ); michael@0: michael@0: var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; michael@0: return this.filter(function() { michael@0: return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; michael@0: }); michael@0: }, michael@0: michael@0: add: function( selector ) { michael@0: return this.pushStack( jQuery.unique( jQuery.merge( michael@0: this.get(), michael@0: typeof selector == 'string' ? michael@0: jQuery( selector ) : michael@0: jQuery.makeArray( selector ) michael@0: ))); michael@0: }, michael@0: michael@0: is: function( selector ) { michael@0: return !!selector && jQuery.multiFilter( selector, this ).length > 0; michael@0: }, michael@0: michael@0: hasClass: function( selector ) { michael@0: return this.is( "." + selector ); michael@0: }, michael@0: michael@0: val: function( value ) { michael@0: if ( value == undefined ) { michael@0: michael@0: if ( this.length ) { michael@0: var elem = this[0]; michael@0: michael@0: // We need to handle select boxes special michael@0: if ( jQuery.nodeName( elem, "select" ) ) { michael@0: var index = elem.selectedIndex, michael@0: values = [], michael@0: options = elem.options, michael@0: one = elem.type == "select-one"; michael@0: michael@0: // Nothing was selected michael@0: if ( index < 0 ) michael@0: return null; michael@0: michael@0: // Loop through all the selected options michael@0: for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { michael@0: var option = options[ i ]; michael@0: michael@0: if ( option.selected ) { michael@0: // Get the specifc value for the option michael@0: value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; michael@0: michael@0: // We don't need an array for one selects michael@0: if ( one ) michael@0: return value; michael@0: michael@0: // Multi-Selects return an array michael@0: values.push( value ); michael@0: } michael@0: } michael@0: michael@0: return values; michael@0: michael@0: // Everything else, we just grab the value michael@0: } else michael@0: return (this[0].value || "").replace(/\r/g, ""); michael@0: michael@0: } michael@0: michael@0: return undefined; michael@0: } michael@0: michael@0: if( value.constructor == Number ) michael@0: value += ''; michael@0: michael@0: return this.each(function(){ michael@0: if ( this.nodeType != 1 ) michael@0: return; michael@0: michael@0: if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) michael@0: this.checked = (jQuery.inArray(this.value, value) >= 0 || michael@0: jQuery.inArray(this.name, value) >= 0); michael@0: michael@0: else if ( jQuery.nodeName( this, "select" ) ) { michael@0: var values = jQuery.makeArray(value); michael@0: michael@0: jQuery( "option", this ).each(function(){ michael@0: this.selected = (jQuery.inArray( this.value, values ) >= 0 || michael@0: jQuery.inArray( this.text, values ) >= 0); michael@0: }); michael@0: michael@0: if ( !values.length ) michael@0: this.selectedIndex = -1; michael@0: michael@0: } else michael@0: this.value = value; michael@0: }); michael@0: }, michael@0: michael@0: html: function( value ) { michael@0: return value == undefined ? michael@0: (this[0] ? michael@0: this[0].innerHTML : michael@0: null) : michael@0: this.empty().append( value ); michael@0: }, michael@0: michael@0: replaceWith: function( value ) { michael@0: return this.after( value ).remove(); michael@0: }, michael@0: michael@0: eq: function( i ) { michael@0: return this.slice( i, i + 1 ); michael@0: }, michael@0: michael@0: slice: function() { michael@0: return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); michael@0: }, michael@0: michael@0: map: function( callback ) { michael@0: return this.pushStack( jQuery.map(this, function(elem, i){ michael@0: return callback.call( elem, i, elem ); michael@0: })); michael@0: }, michael@0: michael@0: andSelf: function() { michael@0: return this.add( this.prevObject ); michael@0: }, michael@0: michael@0: data: function( key, value ){ michael@0: var parts = key.split("."); michael@0: parts[1] = parts[1] ? "." + parts[1] : ""; michael@0: michael@0: if ( value === undefined ) { michael@0: var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); michael@0: michael@0: if ( data === undefined && this.length ) michael@0: data = jQuery.data( this[0], key ); michael@0: michael@0: return data === undefined && parts[1] ? michael@0: this.data( parts[0] ) : michael@0: data; michael@0: } else michael@0: return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ michael@0: jQuery.data( this, key, value ); michael@0: }); michael@0: }, michael@0: michael@0: removeData: function( key ){ michael@0: return this.each(function(){ michael@0: jQuery.removeData( this, key ); michael@0: }); michael@0: }, michael@0: michael@0: domManip: function( args, table, reverse, callback ) { michael@0: var clone = this.length > 1, elems; michael@0: michael@0: return this.each(function(){ michael@0: if ( !elems ) { michael@0: elems = jQuery.clean( args, this.ownerDocument ); michael@0: michael@0: if ( reverse ) michael@0: elems.reverse(); michael@0: } michael@0: michael@0: var obj = this; michael@0: michael@0: if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) michael@0: obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); michael@0: michael@0: var scripts = jQuery( [] ); michael@0: michael@0: jQuery.each(elems, function(){ michael@0: var elem = clone ? michael@0: jQuery( this ).clone( true )[0] : michael@0: this; michael@0: michael@0: // execute all scripts after the elements have been injected michael@0: if ( jQuery.nodeName( elem, "script" ) ) michael@0: scripts = scripts.add( elem ); michael@0: else { michael@0: // Remove any inner scripts for later evaluation michael@0: if ( elem.nodeType == 1 ) michael@0: scripts = scripts.add( jQuery( "script", elem ).remove() ); michael@0: michael@0: // Inject the elements into the document michael@0: callback.call( obj, elem ); michael@0: } michael@0: }); michael@0: michael@0: scripts.each( evalScript ); michael@0: }); michael@0: } michael@0: }; michael@0: michael@0: // Give the init function the jQuery prototype for later instantiation michael@0: jQuery.fn.init.prototype = jQuery.fn; michael@0: michael@0: function evalScript( i, elem ) { michael@0: if ( elem.src ) michael@0: jQuery.ajax({ michael@0: url: elem.src, michael@0: async: false, michael@0: dataType: "script" michael@0: }); michael@0: michael@0: else michael@0: jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); michael@0: michael@0: if ( elem.parentNode ) michael@0: elem.parentNode.removeChild( elem ); michael@0: } michael@0: michael@0: function now(){ michael@0: return +new Date; michael@0: } michael@0: michael@0: jQuery.extend = jQuery.fn.extend = function() { michael@0: // copy reference to target object michael@0: var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; michael@0: michael@0: // Handle a deep copy situation michael@0: if ( target.constructor == Boolean ) { michael@0: deep = target; michael@0: target = arguments[1] || {}; michael@0: // skip the boolean and the target michael@0: i = 2; michael@0: } michael@0: michael@0: // Handle case when target is a string or something (possible in deep copy) michael@0: if ( typeof target != "object" && typeof target != "function" ) michael@0: target = {}; michael@0: michael@0: // extend jQuery itself if only one argument is passed michael@0: if ( length == i ) { michael@0: target = this; michael@0: --i; michael@0: } michael@0: michael@0: for ( ; i < length; i++ ) michael@0: // Only deal with non-null/undefined values michael@0: if ( (options = arguments[ i ]) != null ) michael@0: // Extend the base object michael@0: for ( var name in options ) { michael@0: var src = target[ name ], copy = options[ name ]; michael@0: michael@0: // Prevent never-ending loop michael@0: if ( target === copy ) michael@0: continue; michael@0: michael@0: // Recurse if we're merging object values michael@0: if ( deep && copy && typeof copy == "object" && !copy.nodeType ) michael@0: target[ name ] = jQuery.extend( deep, michael@0: // Never move original objects, clone them michael@0: src || ( copy.length != null ? [ ] : { } ) michael@0: , copy ); michael@0: michael@0: // Don't bring in undefined values michael@0: else if ( copy !== undefined ) michael@0: target[ name ] = copy; michael@0: michael@0: } michael@0: michael@0: // Return the modified object michael@0: return target; michael@0: }; michael@0: michael@0: var expando = "jQuery" + now(), uuid = 0, windowData = {}, michael@0: // exclude the following css properties to add px michael@0: exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, michael@0: // cache defaultView michael@0: defaultView = document.defaultView || {}; michael@0: michael@0: jQuery.extend({ michael@0: noConflict: function( deep ) { michael@0: window.$ = _$; michael@0: michael@0: if ( deep ) michael@0: window.jQuery = _jQuery; michael@0: michael@0: return jQuery; michael@0: }, michael@0: michael@0: // See test/unit/core.js for details concerning this function. michael@0: isFunction: function( fn ) { michael@0: return !!fn && typeof fn != "string" && !fn.nodeName && michael@0: fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); michael@0: }, michael@0: michael@0: // check if an element is in a (or is an) XML document michael@0: isXMLDoc: function( elem ) { michael@0: return elem.documentElement && !elem.body || michael@0: elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; michael@0: }, michael@0: michael@0: // Evalulates a script in a global context michael@0: globalEval: function( data ) { michael@0: data = jQuery.trim( data ); michael@0: michael@0: if ( data ) { michael@0: // Inspired by code by Andrea Giammarchi michael@0: // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html michael@0: var head = document.getElementsByTagName("head")[0] || document.documentElement, michael@0: script = document.createElement("script"); michael@0: michael@0: script.type = "text/javascript"; michael@0: if ( jQuery.browser.msie ) michael@0: script.text = data; michael@0: else michael@0: script.appendChild( document.createTextNode( data ) ); michael@0: michael@0: // Use insertBefore instead of appendChild to circumvent an IE6 bug. michael@0: // This arises when a base node is used (#2709). michael@0: head.insertBefore( script, head.firstChild ); michael@0: head.removeChild( script ); michael@0: } michael@0: }, michael@0: michael@0: nodeName: function( elem, name ) { michael@0: return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); michael@0: }, michael@0: michael@0: cache: {}, michael@0: michael@0: data: function( elem, name, data ) { michael@0: elem = elem == window ? michael@0: windowData : michael@0: elem; michael@0: michael@0: var id = elem[ expando ]; michael@0: michael@0: // Compute a unique ID for the element michael@0: if ( !id ) michael@0: id = elem[ expando ] = ++uuid; michael@0: michael@0: // Only generate the data cache if we're michael@0: // trying to access or manipulate it michael@0: if ( name && !jQuery.cache[ id ] ) michael@0: jQuery.cache[ id ] = {}; michael@0: michael@0: // Prevent overriding the named cache with undefined values michael@0: if ( data !== undefined ) michael@0: jQuery.cache[ id ][ name ] = data; michael@0: michael@0: // Return the named cache data, or the ID for the element michael@0: return name ? michael@0: jQuery.cache[ id ][ name ] : michael@0: id; michael@0: }, michael@0: michael@0: removeData: function( elem, name ) { michael@0: elem = elem == window ? michael@0: windowData : michael@0: elem; michael@0: michael@0: var id = elem[ expando ]; michael@0: michael@0: // If we want to remove a specific section of the element's data michael@0: if ( name ) { michael@0: if ( jQuery.cache[ id ] ) { michael@0: // Remove the section of cache data michael@0: delete jQuery.cache[ id ][ name ]; michael@0: michael@0: // If we've removed all the data, remove the element's cache michael@0: name = ""; michael@0: michael@0: for ( name in jQuery.cache[ id ] ) michael@0: break; michael@0: michael@0: if ( !name ) michael@0: jQuery.removeData( elem ); michael@0: } michael@0: michael@0: // Otherwise, we want to remove all of the element's data michael@0: } else { michael@0: // Clean up the element expando michael@0: try { michael@0: delete elem[ expando ]; michael@0: } catch(e){ michael@0: // IE has trouble directly removing the expando michael@0: // but it's ok with using removeAttribute michael@0: if ( elem.removeAttribute ) michael@0: elem.removeAttribute( expando ); michael@0: } michael@0: michael@0: // Completely remove the data cache michael@0: delete jQuery.cache[ id ]; michael@0: } michael@0: }, michael@0: michael@0: // args is for internal usage only michael@0: each: function( object, callback, args ) { michael@0: var name, i = 0, length = object.length; michael@0: michael@0: if ( args ) { michael@0: if ( length == undefined ) { michael@0: for ( name in object ) michael@0: if ( callback.apply( object[ name ], args ) === false ) michael@0: break; michael@0: } else michael@0: for ( ; i < length; ) michael@0: if ( callback.apply( object[ i++ ], args ) === false ) michael@0: break; michael@0: michael@0: // A special, fast, case for the most common use of each michael@0: } else { michael@0: if ( length == undefined ) { michael@0: for ( name in object ) michael@0: if ( callback.call( object[ name ], name, object[ name ] ) === false ) michael@0: break; michael@0: } else michael@0: for ( var value = object[0]; michael@0: i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} michael@0: } michael@0: michael@0: return object; michael@0: }, michael@0: michael@0: prop: function( elem, value, type, i, name ) { michael@0: // Handle executable functions michael@0: if ( jQuery.isFunction( value ) ) michael@0: value = value.call( elem, i ); michael@0: michael@0: // Handle passing in a number to a CSS property michael@0: return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? michael@0: value + "px" : michael@0: value; michael@0: }, michael@0: michael@0: className: { michael@0: // internal only, use addClass("class") michael@0: add: function( elem, classNames ) { michael@0: jQuery.each((classNames || "").split(/\s+/), function(i, className){ michael@0: if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) michael@0: elem.className += (elem.className ? " " : "") + className; michael@0: }); michael@0: }, michael@0: michael@0: // internal only, use removeClass("class") michael@0: remove: function( elem, classNames ) { michael@0: if (elem.nodeType == 1) michael@0: elem.className = classNames != undefined ? michael@0: jQuery.grep(elem.className.split(/\s+/), function(className){ michael@0: return !jQuery.className.has( classNames, className ); michael@0: }).join(" ") : michael@0: ""; michael@0: }, michael@0: michael@0: // internal only, use hasClass("class") michael@0: has: function( elem, className ) { michael@0: return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; michael@0: } michael@0: }, michael@0: michael@0: // A method for quickly swapping in/out CSS properties to get correct calculations michael@0: swap: function( elem, options, callback ) { michael@0: var old = {}; michael@0: // Remember the old values, and insert the new ones michael@0: for ( var name in options ) { michael@0: old[ name ] = elem.style[ name ]; michael@0: elem.style[ name ] = options[ name ]; michael@0: } michael@0: michael@0: callback.call( elem ); michael@0: michael@0: // Revert the old values michael@0: for ( var name in options ) michael@0: elem.style[ name ] = old[ name ]; michael@0: }, michael@0: michael@0: css: function( elem, name, force ) { michael@0: if ( name == "width" || name == "height" ) { michael@0: var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; michael@0: michael@0: function getWH() { michael@0: val = name == "width" ? elem.offsetWidth : elem.offsetHeight; michael@0: var padding = 0, border = 0; michael@0: jQuery.each( which, function() { michael@0: padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; michael@0: border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; michael@0: }); michael@0: val -= Math.round(padding + border); michael@0: } michael@0: michael@0: if ( jQuery(elem).is(":visible") ) michael@0: getWH(); michael@0: else michael@0: jQuery.swap( elem, props, getWH ); michael@0: michael@0: return Math.max(0, val); michael@0: } michael@0: michael@0: return jQuery.curCSS( elem, name, force ); michael@0: }, michael@0: michael@0: curCSS: function( elem, name, force ) { michael@0: var ret, style = elem.style; michael@0: michael@0: // A helper method for determining if an element's values are broken michael@0: function color( elem ) { michael@0: if ( !jQuery.browser.safari ) michael@0: return false; michael@0: michael@0: // defaultView is cached michael@0: var ret = defaultView.getComputedStyle( elem, null ); michael@0: return !ret || ret.getPropertyValue("color") == ""; michael@0: } michael@0: michael@0: // We need to handle opacity special in IE michael@0: if ( name == "opacity" && jQuery.browser.msie ) { michael@0: ret = jQuery.attr( style, "opacity" ); michael@0: michael@0: return ret == "" ? michael@0: "1" : michael@0: ret; michael@0: } michael@0: // Opera sometimes will give the wrong display answer, this fixes it, see #2037 michael@0: if ( jQuery.browser.opera && name == "display" ) { michael@0: var save = style.outline; michael@0: style.outline = "0 solid black"; michael@0: style.outline = save; michael@0: } michael@0: michael@0: // Make sure we're using the right name for getting the float value michael@0: if ( name.match( /float/i ) ) michael@0: name = styleFloat; michael@0: michael@0: if ( !force && style && style[ name ] ) michael@0: ret = style[ name ]; michael@0: michael@0: else if ( defaultView.getComputedStyle ) { michael@0: michael@0: // Only "float" is needed here michael@0: if ( name.match( /float/i ) ) michael@0: name = "float"; michael@0: michael@0: name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); michael@0: michael@0: var computedStyle = defaultView.getComputedStyle( elem, null ); michael@0: michael@0: if ( computedStyle && !color( elem ) ) michael@0: ret = computedStyle.getPropertyValue( name ); michael@0: michael@0: // If the element isn't reporting its values properly in Safari michael@0: // then some display: none elements are involved michael@0: else { michael@0: var swap = [], stack = [], a = elem, i = 0; michael@0: michael@0: // Locate all of the parent display: none elements michael@0: for ( ; a && color(a); a = a.parentNode ) michael@0: stack.unshift(a); michael@0: michael@0: // Go through and make them visible, but in reverse michael@0: // (It would be better if we knew the exact display type that they had) michael@0: for ( ; i < stack.length; i++ ) michael@0: if ( color( stack[ i ] ) ) { michael@0: swap[ i ] = stack[ i ].style.display; michael@0: stack[ i ].style.display = "block"; michael@0: } michael@0: michael@0: // Since we flip the display style, we have to handle that michael@0: // one special, otherwise get the value michael@0: ret = name == "display" && swap[ stack.length - 1 ] != null ? michael@0: "none" : michael@0: ( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; michael@0: michael@0: // Finally, revert the display styles back michael@0: for ( i = 0; i < swap.length; i++ ) michael@0: if ( swap[ i ] != null ) michael@0: stack[ i ].style.display = swap[ i ]; michael@0: } michael@0: michael@0: // We should always get a number back from opacity michael@0: if ( name == "opacity" && ret == "" ) michael@0: ret = "1"; michael@0: michael@0: } else if ( elem.currentStyle ) { michael@0: var camelCase = name.replace(/\-(\w)/g, function(all, letter){ michael@0: return letter.toUpperCase(); michael@0: }); michael@0: michael@0: ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; michael@0: michael@0: // From the awesome hack by Dean Edwards michael@0: // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 michael@0: michael@0: // If we're not dealing with a regular pixel number michael@0: // but a number that has a weird ending, we need to convert it to pixels michael@0: if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { michael@0: // Remember the original values michael@0: var left = style.left, rsLeft = elem.runtimeStyle.left; michael@0: michael@0: // Put in the new values to get a computed value out michael@0: elem.runtimeStyle.left = elem.currentStyle.left; michael@0: style.left = ret || 0; michael@0: ret = style.pixelLeft + "px"; michael@0: michael@0: // Revert the changed values michael@0: style.left = left; michael@0: elem.runtimeStyle.left = rsLeft; michael@0: } michael@0: } michael@0: michael@0: return ret; michael@0: }, michael@0: michael@0: clean: function( elems, context ) { michael@0: var ret = []; michael@0: context = context || document; michael@0: // !context.createElement fails in IE with an error but returns typeof 'object' michael@0: if (typeof context.createElement == 'undefined') michael@0: context = context.ownerDocument || context[0] && context[0].ownerDocument || document; michael@0: michael@0: jQuery.each(elems, function(i, elem){ michael@0: if ( !elem ) michael@0: return; michael@0: michael@0: if ( elem.constructor == Number ) michael@0: elem += ''; michael@0: michael@0: // Convert html string into DOM nodes michael@0: if ( typeof elem == "string" ) { michael@0: // Fix "XHTML"-style tags in all browsers michael@0: elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ michael@0: return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? michael@0: all : michael@0: front + ">"; michael@0: }); michael@0: michael@0: // Trim whitespace, otherwise indexOf won't work as expected michael@0: var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); michael@0: michael@0: var wrap = michael@0: // option or optgroup michael@0: !tags.indexOf("", "" ] || michael@0: michael@0: !tags.indexOf("", "" ] || michael@0: michael@0: tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && michael@0: [ 1, "", "
" ] || michael@0: michael@0: !tags.indexOf("", "" ] || michael@0: michael@0: // matched above michael@0: (!tags.indexOf("", "" ] || michael@0: michael@0: !tags.indexOf("", "" ] || michael@0: michael@0: // IE can't serialize and