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