/*! * jquery javascript library v1.3.2 * http://jquery.com/ * * copyright (c) 2009 john resig * dual licensed under the mit and gpl licenses. * http://docs.jquery.com/license * * date: 2009-02-19 17:34:21 -0500 (thu, 19 feb 2009) * revision: 6246 */ (function(){ var // will speed up references to window, and allows munging its name. window = this, // will speed up references to undefined, and allows munging its name. undefined, // map over jquery in case of overwrite _jquery = window.jquery, // map over the $ in case of overwrite _$ = window.$, jquery = window.jquery = window.$ = function( selector, context ) { // the jquery object is actually just the init constructor 'enhanced' return new jquery.fn.init( selector, context ); }, // a simple way to check for html strings or id strings // (both of which we optimize for) quickexpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // is it a simple selector issimple = /^.[^:#\[\.,]*$/; jquery.fn = jquery.prototype = { init: function( selector, context ) { // make sure that a selection was provided selector = selector || document; // handle $(domelement) if ( selector.nodetype ) { this[0] = selector; this.length = 1; this.context = selector; return this; } // handle html strings if ( typeof selector === "string" ) { // are we dealing with html string or an id? var match = quickexpr.exec( selector ); // verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // handle: $(html) -> $(array) if ( match[1] ) selector = jquery.clean( [ match[1] ], context ); // handle: $("#id") else { var elem = document.getelementbyid( match[3] ); // handle the case where ie and opera return items // by name instead of id if ( elem && elem.id != match[3] ) return jquery().find( selector ); // otherwise, we inject the element directly into the jquery object var ret = jquery( elem || [] ); ret.context = document; ret.selector = selector; return ret; } // handle: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return jquery( context ).find( selector ); // handle: $(function) // shortcut for document ready } else if ( jquery.isfunction( selector ) ) return jquery( document ).ready( selector ); // make sure that old selector state is passed along if ( selector.selector && selector.context ) { this.selector = selector.selector; this.context = selector.context; } return this.setarray(jquery.isarray( selector ) ? selector : jquery.makearray(selector)); }, // start with an empty selector selector: "", // the current version of jquery being used jquery: "1.3.2", // the number of elements contained in the matched element set size: function() { return this.length; }, // get the nth element in the matched element set or // get the whole matched element set as a clean array get: function( num ) { return num === undefined ? // return a 'clean' array array.prototype.slice.call( this ) : // return just the object 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( elems ); // add the old object onto the stack (as a reference) ret.prevobject = this; ret.context = this.context; if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector; else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")"; // return the newly-formed element set return ret; }, // force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // you should use pushstack() in order to do this, but maintain the stack setarray: function( elems ) { // resetting the length to 0, then using the native array push // is a super-fast way to populate an object with array-like properties this.length = 0; array.prototype.push.apply( this, elems ); return this; }, // execute a callback for every element in the matched set. // (you can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jquery.each( this, callback, args ); }, // determine the position of an element within // the matched set of elements index: function( elem ) { // locate the position of the desired element return jquery.inarray( // if it receives a jquery object, the first element is used elem && elem.jquery ? elem[0] : elem , this ); }, attr: function( name, value, type ) { var options = name; // look for the case where we're accessing a style value if ( typeof name === "string" ) if ( value === undefined ) return this[0] && jquery[ type || "attr" ]( this[0], name ); else { options = {}; options[ name ] = value; } // check to see if we're setting style values return this.each(function(i){ // set all the styles for ( name in options ) jquery.attr( type ? this.style : this, name, jquery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { // ignore negative width and height values if ( (key == 'width' || key == 'height') && parsefloat(value) < 0 ) value = undefined; return this.attr( key, value, "curcss" ); }, text: function( text ) { if ( typeof text !== "object" && text != null ) return this.empty().append( (this[0] && this[0].ownerdocument || document).createtextnode( text ) ); var ret = ""; jquery.each( text || this, function(){ jquery.each( this.childnodes, function(){ if ( this.nodetype != 8 ) ret += this.nodetype != 1 ? this.nodevalue : jquery.fn.text( [ this ] ); }); }); return ret; }, wrapall: function( html ) { if ( this[0] ) { // the elements to wrap the target around var wrap = jquery( html, this[0].ownerdocument ).clone(); if ( this[0].parentnode ) wrap.insertbefore( this[0] ); wrap.map(function(){ var elem = this; while ( elem.firstchild ) elem = elem.firstchild; return elem; }).append(this); } return this; }, wrapinner: function( html ) { return this.each(function(){ jquery( this ).contents().wrapall( html ); }); }, wrap: function( html ) { return this.each(function(){ jquery( this ).wrapall( html ); }); }, append: function() { return this.dommanip(arguments, true, function(elem){ if (this.nodetype == 1) this.appendchild( elem ); }); }, prepend: function() { return this.dommanip(arguments, true, function(elem){ if (this.nodetype == 1) this.insertbefore( elem, this.firstchild ); }); }, before: function() { return this.dommanip(arguments, false, function(elem){ this.parentnode.insertbefore( elem, this ); }); }, after: function() { return this.dommanip(arguments, false, function(elem){ this.parentnode.insertbefore( elem, this.nextsibling ); }); }, end: function() { return this.prevobject || jquery( [] ); }, // for internal use only. // behaves like an array's method, not like a jquery method. push: [].push, sort: [].sort, splice: [].splice, find: function( selector ) { if ( this.length === 1 ) { var ret = this.pushstack( [], "find", selector ); ret.length = 0; jquery.find( selector, this[0], ret ); return ret; } else { return this.pushstack( jquery.unique(jquery.map(this, function(elem){ return jquery.find( selector, elem ); })), "find", selector ); } }, 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; if ( !html ) { var div = this.ownerdocument.createelement("div"); div.appendchild( this.clonenode(true) ); html = div.innerhtml; } return jquery.clean([html.replace(/ jquery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; } else return this.clonenode(true); }); // copy the events from the original to the clone if ( events === true ) { var orig = this.find("*").andself(), i = 0; ret.find("*").andself().each(function(){ if ( this.nodename !== orig[i].nodename ) return; var events = jquery.data( orig[i], "events" ); for ( var type in events ) { for ( var handler in events[ type ] ) { jquery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); } } i++; }); } // return the cloned set return ret; }, filter: function( selector ) { return this.pushstack( jquery.isfunction( selector ) && jquery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jquery.multifilter( selector, jquery.grep(this, function(elem){ return elem.nodetype === 1; }) ), "filter", selector ); }, closest: function( selector ) { var pos = jquery.expr.match.pos.test( selector ) ? jquery(selector) : null, closer = 0; return this.map(function(){ var cur = this; while ( cur && cur.ownerdocument ) { if ( pos ? pos.index(cur) > -1 : jquery(cur).is(selector) ) { jquery.data(cur, "closest", closer); return cur; } cur = cur.parentnode; closer++; } }); }, not: function( selector ) { if ( typeof selector === "string" ) // test special case where just one selector is passed in if ( issimple.test( selector ) ) return this.pushstack( jquery.multifilter( selector, this, true ), "not", selector ); else selector = jquery.multifilter( selector, this ); var isarraylike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodetype; return this.filter(function() { return isarraylike ? jquery.inarray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { return this.pushstack( jquery.unique( jquery.merge( this.get(), typeof selector === "string" ? jquery( selector ) : jquery.makearray( selector ) ))); }, is: function( selector ) { return !!selector && jquery.multifilter( selector, this ).length > 0; }, hasclass: function( selector ) { return !!selector && this.is( "." + selector ); }, val: function( value ) { if ( value === undefined ) { var elem = this[0]; if ( elem ) { if( jquery.nodename( elem, 'option' ) ) return (elem.attributes.value || {}).specified ? elem.value : elem.text; // we need to handle select boxes special if ( jquery.nodename( elem, "select" ) ) { var index = elem.selectedindex, values = [], options = elem.options, one = elem.type == "select-one"; // nothing was selected if ( index < 0 ) return null; // loop through all the selected options 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 value = jquery(option).val(); // we don't need an array for one selects if ( one ) return value; // multi-selects return an array values.push( value ); } } return values; } // everything else, we just grab the value return (elem.value || "").replace(/\r/g, ""); } return undefined; } if ( typeof value === "number" ) value += ''; return this.each(function(){ if ( this.nodetype != 1 ) return; if ( jquery.isarray(value) && /radio|checkbox/.test( this.type ) ) this.checked = (jquery.inarray(this.value, value) >= 0 || jquery.inarray(this.name, value) >= 0); else if ( jquery.nodename( this, "select" ) ) { var values = jquery.makearray(value); jquery( "option", this ).each(function(){ this.selected = (jquery.inarray( this.value, values ) >= 0 || jquery.inarray( this.text, values ) >= 0); }); if ( !values.length ) this.selectedindex = -1; } else this.value = value; }); }, html: function( value ) { return value === undefined ? (this[0] ? this[0].innerhtml.replace(/ jquery\d+="(?:\d+|null)"/g, "") : null) : this.empty().append( value ); }, replacewith: function( value ) { return this.after( value ).remove(); }, eq: function( i ) { return this.slice( i, +i + 1 ); }, slice: function() { return this.pushstack( array.prototype.slice.apply( this, arguments ), "slice", array.prototype.slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushstack( jquery.map(this, function(elem, i){ return callback.call( elem, i, elem ); })); }, andself: function() { return this.add( this.prevobject ); }, dommanip: function( args, table, callback ) { if ( this[0] ) { var fragment = (this[0].ownerdocument || this[0]).createdocumentfragment(), scripts = jquery.clean( args, (this[0].ownerdocument || this[0]), fragment ), first = fragment.firstchild; if ( first ) for ( var i = 0, l = this.length; i < l; i++ ) callback.call( root(this[i], first), this.length > 1 || i > 0 ? fragment.clonenode(true) : fragment ); if ( scripts ) jquery.each( scripts, evalscript ); } return this; function root( elem, cur ) { return table && jquery.nodename(elem, "table") && jquery.nodename(cur, "tr") ? (elem.getelementsbytagname("tbody")[0] || elem.appendchild(elem.ownerdocument.createelement("tbody"))) : elem; } } }; // give the init function the jquery prototype for later instantiation jquery.fn.init.prototype = jquery.fn; 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 ); } function now(){ return +new date; } jquery.extend = jquery.fn.extend = function() { // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; // handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jquery.isfunction(target) ) target = {}; // extend jquery itself if only one argument is passed if ( length == i ) { target = this; --i; } for ( ; i < length; i++ ) // only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) // extend the base object for ( var name in options ) { var src = target[ name ], copy = options[ name ]; // prevent never-ending loop if ( target === copy ) continue; // recurse if we're merging object values if ( deep && copy && typeof copy === "object" && !copy.nodetype ) target[ name ] = jquery.extend( deep, // never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); // don't bring in undefined values else if ( copy !== undefined ) target[ name ] = copy; } // return the modified object return target; }; // exclude the following css properties to add px var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, // cache defaultview defaultview = document.defaultview || {}, tostring = object.prototype.tostring; jquery.extend({ noconflict: function( deep ) { window.$ = _$; if ( deep ) window.jquery = _jquery; return jquery; }, // see test/unit/core.js for details concerning isfunction. // 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]"; }, // check if an element is in a (or is an) xml document isxmldoc: function( elem ) { return elem.nodetype === 9 && elem.documentelement.nodename !== "html" || !!elem.ownerdocument && jquery.isxmldoc( elem.ownerdocument ); }, // evalulates a script in a global context globaleval: function( data ) { if ( data && /\s/.test(data) ) { // inspired by code by andrea giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getelementsbytagname("head")[0] || document.documentelement, script = document.createelement("script"); script.type = "text/javascript"; if ( jquery.support.scripteval ) script.appendchild( document.createtextnode( data ) ); else script.text = data; // use insertbefore instead of appendchild to circumvent an ie6 bug. // this arises when a base node is used (#2709). head.insertbefore( script, head.firstchild ); head.removechild( script ); } }, nodename: function( elem, name ) { return elem.nodename && elem.nodename.touppercase() == name.touppercase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length; if ( args ) { if ( length === undefined ) { for ( name in object ) if ( callback.apply( object[ name ], args ) === false ) break; } else for ( ; i < length; ) if ( callback.apply( object[ i++ ], args ) === false ) break; // a special, fast, case for the most common use of each } else { if ( length === undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, prop: function( elem, value, type, i, name ) { // handle executable functions if ( jquery.isfunction( value ) ) value = value.call( elem, i ); // handle passing in a number to a css property return typeof value === "number" && type == "curcss" && !exclude.test( name ) ? value + "px" : value; }, classname: { // internal only, use addclass("class") add: function( elem, classnames ) { jquery.each((classnames || "").split(/\s+/), function(i, classname){ if ( elem.nodetype == 1 && !jquery.classname.has( elem.classname, classname ) ) elem.classname += (elem.classname ? " " : "") + classname; }); }, // internal only, use removeclass("class") remove: function( elem, classnames ) { if (elem.nodetype == 1) elem.classname = classnames !== undefined ? jquery.grep(elem.classname.split(/\s+/), function(classname){ return !jquery.classname.has( classnames, classname ); }).join(" ") : ""; }, // internal only, use hasclass("class") has: function( elem, classname ) { return elem && jquery.inarray( classname, (elem.classname || elem).tostring().split(/\s+/) ) > -1; } }, // a method for quickly swapping in/out css properties to get correct calculations swap: function( elem, options, callback ) { var old = {}; // remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // revert the old values for ( var name in options ) elem.style[ name ] = old[ name ]; }, css: function( elem, name, force, extra ) { if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "left", "right" ] : [ "top", "bottom" ]; 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; // we need to handle opacity special in ie if ( name == "opacity" && !jquery.support.opacity ) { ret = jquery.attr( style, "opacity" ); return ret == "" ? "1" : ret; } // make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = stylefloat; if ( !force && style && style[ name ] ) ret = style[ name ]; else if ( defaultview.getcomputedstyle ) { // only "float" is needed here if ( name.match( /float/i ) ) name = "float"; name = name.replace( /([a-z])/g, "-$1" ).tolowercase(); 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(/\-(\w)/g, function(all, letter){ return letter.touppercase(); }); 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 ( !/^\d+(px)?$/i.test( ret ) && /^\d/.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 = ret || 0; ret = style.pixelleft + "px"; // revert the changed values style.left = left; elem.runtimestyle.left = rsleft; } } return ret; }, clean: function( elems, context, fragment ) { context = context || document; // !context.createelement fails in ie with an error but returns typeof 'object' if ( typeof context.createelement === "undefined" ) context = context.ownerdocument || context[0] && context[0].ownerdocument || document; // if a single string is passed in and it's a single tag // just do a createelement and skip the rest if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); if ( match ) return [ context.createelement( match[1] ) ]; } var ret = [], scripts = [], div = context.createelement("div"); jquery.each(elems, function(i, elem){ if ( typeof elem === "number" ) elem += ''; if ( !elem ) return; // convert html string into dom nodes if ( typeof elem === "string" ) { // fix "xhtml"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + ">"; }); // trim whitespace, otherwise indexof won't work as expected var tags = elem.replace(/^\s+/, "").substring(0, 10).tolowercase(); var wrap = // option or optgroup !tags.indexof("", "" ] || !tags.indexof("", "" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "", "
" ] || !tags.indexof("", "" ] || // matched above (!tags.indexof("", "" ] || !tags.indexof("", "" ] || // ie can't serialize and