/*!
* jquery javascript library v1.4.1
* http://jquery.com/
*
* copyright 2010, john resig
*
* includes sizzle.js
* http://sizzlejs.com/
* copyright 2010, the dojo foundation
*
* permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "software"), to deal in the software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the software, and to
* permit persons to whom the software is furnished to do so, subject to
* the following conditions:
*
* the above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the software.
*
* the software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties of
* merchantability, fitness for a particular purpose and
* noninfringement. in no event shall the authors or copyright holders be
* liable for any claim, damages or other liability, whether in an action
* of contract, tort or otherwise, arising from, out of or in connection
* with the software or the use or other dealings in the software.
* date: mon jan 25 19:43:33 2010 -0500
*/
(function( window, undefined ) {
// 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 );
},
// map over jquery in case of overwrite
_jquery = window.jquery,
// 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 = /^.[^:#\[\.,]*$/,
// check if a string has a non-whitespace character in it
rnotwhite = /\s/,
// used for trimming whitespace
rtrim = /^(\s|\u00a0)+|(\s|\u00a0)+$/g,
// match a standalone tag
rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// 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 ready event handler
domcontentloaded,
// save a reference to some core methods
tostring = object.prototype.tostring,
hasownproperty = object.prototype.hasownproperty,
push = array.prototype.push,
slice = array.prototype.slice,
indexof = array.prototype.indexof;
jquery.fn = jquery.prototype = {
init: function( selector, context ) {
var match, elem, ret, doc;
// handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// handle $(domelement)
if ( selector.nodetype ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// handle html strings
if ( typeof selector === "string" ) {
// are we dealing with html string or an id?
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] ) {
doc = (context ? context.ownerdocument || context : document);
// if a single string is passed in and it's a single tag
// just do a createelement and skip the rest
ret = rsingletag.exec( selector );
if ( ret ) {
if ( jquery.isplainobject( context ) ) {
selector = [ document.createelement( ret[1] ) ];
jquery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createelement( ret[1] ) ];
}
} else {
ret = buildfragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? ret.fragment.clonenode(true) : ret.fragment).childnodes;
}
// handle: $("#id")
} else {
elem = document.getelementbyid( match[2] );
if ( elem ) {
// handle the case where ie and opera return items
// by name instead of id
if ( elem.id !== match[2] ) {
return rootjquery.find( selector );
}
// otherwise, we inject the element directly into the jquery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// handle: $("tag")
} else if ( !context && /^\w+$/.test( selector ) ) {
this.selector = selector;
this.context = document;
selector = document.getelementsbytagname( selector );
// handle: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjquery).find( selector );
// handle: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return jquery( context ).find( selector );
}
// handle: $(function)
// shortcut for document ready
} else if ( jquery.isfunction( selector ) ) {
return rootjquery.ready( selector );
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jquery.isarray( selector ) ?
this.setarray( selector ) :
jquery.makearray( selector, this );
},
// start with an empty selector
selector: "",
// the current version of jquery being used
jquery: "1.4.1",
// the default length of a jquery object is 0
length: 0,
// the number of elements contained in the matched element set
size: function() {
return this.length;
},
toarray: function() {
return slice.call( this, 0 );
},
// 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 == null ?
// return a 'clean' array
this.toarray() :
// return just the object
( num < 0 ? this.slice(num)[ 0 ] : 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 || null );
// 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;
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 );
},
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 );
}
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
this.slice( i, +i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushstack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushstack( jquery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevobject || jquery(null);
},
// for internal use only.
// behaves like an array's method, not like a jquery method.
push: push,
sort: [].sort,
splice: [].splice
};
// give the init function the jquery prototype for later instantiation
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;
// 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 ( name in options ) {
src = target[ name ];
copy = options[ name ];
// prevent never-ending loop
if ( target === copy ) {
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) ? [] : {};
// never move original objects, clone them
target[ name ] = jquery.extend( deep, clone, copy );
// don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// return the modified object
return target;
};
jquery.extend({
noconflict: function( deep ) {
window.$ = _$;
if ( deep ) {
window.jquery = _jquery;
}
return jquery;
},
// is the dom ready to be used? set to true once it occurs.
isready: false,
// handle when the dom is ready
ready: function() {
// make sure that the dom is not already loaded
if ( !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 );
}
// remember that the dom is ready
jquery.isready = true;
// 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;
}
// trigger any bound ready events
if ( jquery.fn.triggerhandler ) {
jquery( document ).triggerhandler( "ready" );
}
}
},
bindready: function() {
if ( readybound ) {
return;
}
readybound = true;
// catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readystate === "complete" ) {
return jquery.ready();
}
// 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 );
// if ie event model is used
} else if ( document.attachevent ) {
// 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 );
// if ie and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameelement == null;
} catch(e) {}
if ( document.documentelement.doscroll && toplevel ) {
doscrollcheck();
}
}
},
// 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]";
},
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 ) {
return false;
}
// not own constructor property must be object
if ( obj.constructor
&& !hasownproperty.call(obj, "constructor")
&& !hasownproperty.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 );
},
isemptyobject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parsejson: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// 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, "")) ) {
// try to use the native json parser first
return window.json && window.json.parse ?
window.json.parse( data ) :
(new function("return " + data))();
} else {
jquery.error( "invalid json: " + data );
}
},
noop: function() {},
// evalulates a script in a global context
globaleval: function( data ) {
if ( data && rnotwhite.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,
isobj = length === undefined || jquery.isfunction(object);
if ( args ) {
if ( isobj ) {
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 ( isobj ) {
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;
},
trim: function( text ) {
return (text || "").replace( rtrim, "" );
},
// results is for internal usage only
makearray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// 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) ) {
push.call( ret, array );
} else {
jquery.merge( ret, array );
}
}
return ret;
},
inarray: function( elem, array ) {
if ( array.indexof ) {
return array.indexof( elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
},
merge: function( first, second ) {
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++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [];
// 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 ) ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var ret = [], value;
// go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, length = elems.length; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
return ret.concat.apply( [], ret );
},
// a global guid counter for objects
guid: 1,
proxy: function( fn, proxy, thisobject ) {
if ( arguments.length === 2 ) {
if ( typeof proxy === "string" ) {
thisobject = fn;
fn = thisobject[ proxy ];
proxy = undefined;
} else if ( proxy && !jquery.isfunction( proxy ) ) {
thisobject = proxy;
proxy = undefined;
}
}
if ( !proxy && fn ) {
proxy = function() {
return fn.apply( thisobject || this, arguments );
};
}
// set the guid of unique handler to the same of original handler, so it can be removed
if ( fn ) {
proxy.guid = fn.guid = fn.guid || proxy.guid || jquery.guid++;
}
// so proxy can be declared as an argument
return proxy;
},
// 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 ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
browser: {}
});
browsermatch = jquery.uamatch( useragent );
if ( browsermatch.browser ) {
jquery.browser[ browsermatch.browser ] = true;
jquery.browser.version = browsermatch.version;
}
// deprecated, use jquery.browser.webkit instead
if ( jquery.browser.webkit ) {
jquery.browser.safari = true;
}
if ( indexof ) {
jquery.inarray = function( elem, array ) {
return indexof.call( array, elem );
};
}
// all jquery objects should point back to these
rootjquery = jquery(document);
// cleanup functions for the document ready method
if ( document.addeventlistener ) {
domcontentloaded = function() {
document.removeeventlistener( "domcontentloaded", domcontentloaded, false );
jquery.ready();
};
} else if ( document.attachevent ) {
domcontentloaded = function() {
// make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).
if ( document.readystate === "complete" ) {
document.detachevent( "onreadystatechange", domcontentloaded );
jquery.ready();
}
};
}
// the dom ready check for internet explorer
function doscrollcheck() {
if ( jquery.isready ) {
return;
}
try {
// if ie is used, use the trick by diego perini
// http://javascript.nwbox.com/iecontentloaded/
document.documentelement.doscroll("left");
} catch( error ) {
settimeout( doscrollcheck, 1 );
return;
}
// and execute any waiting functions
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 ) : null;
}
function now() {
return (new date).gettime();
}
(function() {
jquery.support = {};
var root = document.documentelement,
script = document.createelement("script"),
div = document.createelement("div"),
id = "script" + now();
div.style.display = "none";
div.innerhtml = "
a";
var all = div.getelementsbytagname("*"),
a = div.getelementsbytagname("a")[0];
// can't get basic test support
if ( !all || !all.length || !a ) {
return;
}
jquery.support = {
// ie strips leading whitespace when .innerhtml is used
leadingwhitespace: div.firstchild.nodetype === 3,
// make sure that tbody elements aren't automatically inserted
// ie will insert them into empty tables
tbody: !div.getelementsbytagname("tbody").length,
// make sure that link elements get serialized correctly by innerhtml
// this requires a wrapper element in ie
htmlserialize: !!div.getelementsbytagname("link").length,
// get the style information from getattribute
// (ie uses .csstext insted)
style: /red/.test( a.getattribute("style") ),
// make sure that urls aren't manipulated
// (ie normalizes it by default)
hrefnormalized: a.getattribute("href") === "/a",
// make sure that element opacity exists
// (ie uses filter instead)
// use a regex to work around a webkit issue. see #5145
opacity: /^0.55$/.test( a.style.opacity ),
// verify style float existence
// (ie uses stylefloat instead of cssfloat)
cssfloat: !!a.style.cssfloat,
// make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (webkit defaults to "" instead)
checkon: div.getelementsbytagname("input")[0].value === "on",
// 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,
// will be defined later
checkclone: false,
scripteval: false,
nocloneevent: true,
boxmodel: null
};
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 ];
}
root.removechild( script );
if ( div.attachevent && div.fireevent ) {
div.attachevent("onclick", function click() {
// cloning a node shouldn't copy over any
// bound event handlers (ie does this)
jquery.support.nocloneevent = false;
div.detachevent("onclick", click);
});
div.clonenode(true).fireevent("onclick");
}
div = document.createelement("div");
div.innerhtml = "";
var fragment = document.createdocumentfragment();
fragment.appendchild( div.firstchild );
// webkit doesn't clone checked state correctly in fragments
jquery.support.checkclone = fragment.clonenode(true).clonenode(true).lastchild.checked;
// 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");
div.style.width = div.style.paddingleft = "1px";
document.body.appendchild( div );
jquery.boxmodel = jquery.support.boxmodel = div.offsetwidth === 2;
document.body.removechild( div ).style.display = 'none';
div = null;
});
// technique from juriy zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
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;
};
jquery.support.submitbubbles = eventsupported("submit");
jquery.support.changebubbles = eventsupported("change");
// release memory in ie
root = script = div = all = a = null;
})();
jquery.props = {
"for": "htmlfor",
"class": "classname",
readonly: "readonly",
maxlength: "maxlength",
cellspacing: "cellspacing",
rowspan: "rowspan",
colspan: "colspan",
tabindex: "tabindex",
usemap: "usemap",
frameborder: "frameborder"
};
var expando = "jquery" + now(), uuid = 0, windowdata = {};
var emptyobject = {};
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;
// handle the case where there's no name immediately
if ( !name && !id ) {
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 ] ) {
thiscache = cache[ id ];
} else if ( typeof data === "undefined" ) {
thiscache = emptyobject;
} else {
thiscache = cache[ id ] = {};
}
// prevent overriding the named cache with undefined values
if ( data !== undefined ) {
elem[ expando ] = id;
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 {
// clean up the element expando
try {
delete elem[ expando ];
} catch( e ) {
// ie has trouble directly removing the expando
// but it's ok with using removeattribute
if ( elem.removeattribute ) {
elem.removeattribute( 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 );
},
removeattr: function( name, fn ) {
return this.each(function(){
jquery.attr( this, name, "" );
if ( this.nodetype === 1 ) {
this.removeattribute( name );
}
});
},
addclass: function( value ) {
if ( jquery.isfunction(value) ) {
return this.each(function(i) {
var self = jquery(this);
self.addclass( value.call(this, i, self.attr("class")) );
});
}
if ( value && typeof value === "string" ) {
var classnames = (value || "").split( rspace );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
if ( elem.nodetype === 1 ) {
if ( !elem.classname ) {
elem.classname = value;
} else {
var classname = " " + elem.classname + " ";
for ( var c = 0, cl = classnames.length; c < cl; c++ ) {
if ( classname.indexof( " " + classnames[c] + " " ) < 0 ) {
elem.classname += " " + classnames[c];
}
}
}
}
}
}
return this;
},
removeclass: function( value ) {
if ( jquery.isfunction(value) ) {
return this.each(function(i) {
var self = jquery(this);
self.removeclass( value.call(this, i, self.attr("class")) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
var classnames = (value || "").split(rspace);
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
if ( elem.nodetype === 1 && elem.classname ) {
if ( value ) {
var classname = (" " + elem.classname + " ").replace(rclass, " ");
for ( var c = 0, cl = classnames.length; c < cl; c++ ) {
classname = classname.replace(" " + classnames[c] + " ", " ");
}
elem.classname = classname.substring(1, classname.length - 1);
} else {
elem.classname = "";
}
}
}
}
return this;
},
toggleclass: function( value, stateval ) {
var type = typeof value, isbool = typeof stateval === "boolean";
if ( jquery.isfunction( value ) ) {
return this.each(function(i) {
var self = jquery(this);
self.toggleclass( value.call(this, i, self.attr("class"), stateval), stateval );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var classname, i = 0, self = jquery(this),
state = stateval,
classnames = value.split( rspace );
while ( (classname = classnames[ i++ ]) ) {
// check each classname given, space seperated list
state = isbool ? state : !self.hasclass( classname );
self[ state ? "addclass" : "removeclass" ]( classname );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.classname ) {
// store classname if set
jquery.data( this, "__classname__", this.classname );
}
// toggle whole classname
this.classname = this.classname || value === false ? "" : jquery.data( this, "__classname__" ) || "";
}
});
},
hasclass: function( selector ) {
var classname = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
if ( (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) > -1 ) {
return true;
}
}
return false;
},
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;
}
// handle the case where in webkit "" is returned instead of "on" if a value isn't specified
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, "");
}
return undefined;
}
var isfunction = jquery.isfunction(value);
return this.each(function(i) {
var self = jquery(this), val = value;
if ( this.nodetype !== 1 ) {
return;
}
if ( isfunction ) {
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" ) {
val += "";
}
if ( jquery.isarray(val) && rradiocheck.test( this.type ) ) {
this.checked = jquery.inarray( self.val(), val ) >= 0;
} else if ( jquery.nodename( this, "select" ) ) {
var values = jquery.makearray(val);
jquery( "option", this ).each(function() {
this.selected = jquery.inarray( jquery(this).val(), values ) >= 0;
});
if ( !values.length ) {
this.selectedindex = -1;
}
} else {
this.value = val;
}
});
}
});
jquery.extend({
attrfn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
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 ) {
return undefined;
}
if ( pass && name in jquery.attrfn ) {
return jquery(elem)[name](value);
}
var notxml = elem.nodetype !== 1 || !jquery.isxmldoc( elem ),
// whether we are setting (or getting)
set = value !== undefined;
// try to normalize/fix the name
name = notxml && jquery.props[ name ] || name;
// only do all the following if this is a node (faster for style)
if ( elem.nodetype === 1 ) {
// these attributes require special treatment
var special = rspecialurl.test( name );
// safari mis-reports the default selected property of an option
// accessing the parent's selectedindex property fixes it
if ( name === "selected" && !jquery.support.optselected ) {
var parent = elem.parentnode;
if ( parent ) {
parent.selectedindex;
// make sure that it also works with optgroups, see #5701
if ( parent.parentnode ) {
parent.parentnode.selectedindex;
}
}
}
// if applicable, access the attribute via the dom 0 way
if ( name in elem && 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;
}
// browsers index elements by id/name on forms, give priority to attributes.
if ( jquery.nodename( elem, "form" ) && elem.getattributenode(name) ) {
return elem.getattributenode( name ).nodevalue;
}
// elem.tabindex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name === "tabindex" ) {
var attributenode = elem.getattributenode( "tabindex" );
return attributenode && attributenode.specified ?
attributenode.value :
rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ?
0 :
undefined;
}
return elem[ name ];
}
if ( !jquery.support.style && notxml && name === "style" ) {
if ( set ) {
elem.style.csstext = "" + value;
}
return elem.style.csstext;
}
if ( set ) {
// convert the value to a string (all browsers do this but ie) see #1070
elem.setattribute( name, "" + value );
}
var attr = !jquery.support.hrefnormalized && notxml && special ?
// some attributes require a special call on ie
elem.getattribute( name, 2 ) :
elem.getattribute( name );
// 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 insead.
return jquery.style( elem, name, value );
}
});
var fcleanup = function( nm ) {
return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
return "\\" + ch;
});
};
/*
* a number of helper functions used for managing events.
* many of the ideas behind this code originated from
* dean edwards' addevent library.
*/
jquery.event = {
// bind an event to an element
// original by dean edwards
add: function( elem, types, handler, data ) {
if ( elem.nodetype === 3 || elem.nodetype === 8 ) {
return;
}
// 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 ) ) {
elem = window;
}
// make sure that the function being executed has a unique id
if ( !handler.guid ) {
handler.guid = jquery.guid++;
}
// if data is passed, bind to handler
if ( data !== undefined ) {
// create temporary function pointer to original handler
var fn = handler;
// create unique handler function, wrapped around original handler
handler = jquery.proxy( fn );
// store data in unique handler
handler.data = data;
}
// init the element's event structure
var events = jquery.data( elem, "events" ) || jquery.data( elem, "events", {} ),
handle = jquery.data( elem, "handle" ), eventhandle;
if ( !handle ) {
eventhandle = function() {
// handle the second event of a trigger and when
// an event is called after a page has unloaded
return typeof jquery !== "undefined" && !jquery.event.triggered ?
jquery.event.handle.apply( eventhandle.elem, arguments ) :
undefined;
};
handle = jquery.data( elem, "handle", eventhandle );
}
// if no handle is found then we must be trying to bind to one of the
// banned nodata elements
if ( !handle ) {
return;
}
// add elem as a property of the handle function
// this is to prevent a memory leak with non-native
// event in ie.
handle.elem = elem;
// handle multiple events separated by a space
// jquery(...).bind("mouseover mouseout", fn);
types = types.split( /\s+/ );
var type, i = 0;
while ( (type = types[ i++ ]) ) {
// namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
if ( i > 1 ) {
handler = jquery.proxy( handler );
if ( data !== undefined ) {
handler.data = data;
}
}
handler.type = namespaces.slice(0).sort().join(".");
// get the current list of functions bound to this event
var handlers = events[ type ],
special = this.special[ type ] || {};
// init the event handler queue
if ( !handlers ) {
handlers = events[ type ] = {};
// check for a special event handler
// only use addeventlistener/attachevent if the special
// events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) {
// bind the global event handler to the element
if ( elem.addeventlistener ) {
elem.addeventlistener( type, handle, false );
} else if ( elem.attachevent ) {
elem.attachevent( "on" + type, handle );
}
}
}
if ( special.add ) {
var modifiedhandler = special.add.call( elem, handler, data, namespaces, handlers );
if ( modifiedhandler && jquery.isfunction( modifiedhandler ) ) {
modifiedhandler.guid = modifiedhandler.guid || handler.guid;
modifiedhandler.data = modifiedhandler.data || handler.data;
modifiedhandler.type = modifiedhandler.type || handler.type;
handler = modifiedhandler;
}
}
// add the function to the element's handler list
handlers[ handler.guid ] = handler;
// keep track of which events have been used, for global triggering
this.global[ type ] = true;
}
// nullify elem to prevent memory leaks in ie
elem = null;
},
global: {},
// detach an event or set of events from an element
remove: function( elem, types, handler ) {
// don't do events on text and comment nodes
if ( elem.nodetype === 3 || elem.nodetype === 8 ) {
return;
}
var events = jquery.data( elem, "events" ), ret, type, fn;
if ( events ) {
// unbind all events for the element
if ( types === undefined || (typeof types === "string" && types.charat(0) === ".") ) {
for ( type in events ) {
this.remove( elem, type + (types || "") );
}
} else {
// types is actually an event object here
if ( types.type ) {
handler = types.handler;
types = types.type;
}
// handle multiple events separated by a space
// jquery(...).unbind("mouseover mouseout", fn);
types = types.split(/\s+/);
var i = 0;
while ( (type = types[ i++ ]) ) {
// namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
var all = !namespaces.length,
cleaned = jquery.map( namespaces.slice(0).sort(), fcleanup ),
namespace = new regexp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"),
special = this.special[ type ] || {};
if ( events[ type ] ) {
// remove the given handler for the given type
if ( handler ) {
fn = events[ type ][ handler.guid ];
delete events[ type ][ handler.guid ];
// remove all handlers for the given type
} else {
for ( var handle in events[ type ] ) {
// handle the removal of namespaced events
if ( all || namespace.test( events[ type ][ handle ].type ) ) {
delete events[ type ][ handle ];
}
}
}
if ( special.remove ) {
special.remove.call( elem, namespaces, fn);
}
// remove generic event handler if no more handlers exist
for ( ret in events[ type ] ) {
break;
}
if ( !ret ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
if ( elem.removeeventlistener ) {
elem.removeeventlistener( type, jquery.data( elem, "handle" ), false );
} else if ( elem.detachevent ) {
elem.detachevent( "on" + type, jquery.data( elem, "handle" ) );
}
}
ret = null;
delete events[ type ];
}
}
}
}
// remove the expando if it's no longer used
for ( ret in events ) {
break;
}
if ( !ret ) {
var handle = jquery.data( elem, "handle" );
if ( handle ) {
handle.elem = null;
}
jquery.removedata( elem, "events" );
jquery.removedata( elem, "handle" );
}
}
},
// bubbling is internal
trigger: function( event, data, elem /*, bubbling */ ) {
// event object or event type
var type = event.type || event,
bubbling = arguments[3];
if ( !bubbling ) {
event = typeof event === "object" ?
// jquery.event object
event[expando] ? event :
// object literal
jquery.extend( jquery.event(type), event ) :
// just the event type (string)
jquery.event(type);
if ( type.indexof("!") >= 0 ) {
event.type = type = type.slice(0, -1);
event.exclusive = true;
}
// handle a global trigger
if ( !elem ) {
// don't bubble custom events when global (to avoid too much overhead)
event.stoppropagation();
// only trigger if we've ever bound an event for it
if ( this.global[ type ] ) {
jquery.each( jquery.cache, function() {
if ( this.events && this.events[type] ) {
jquery.event.trigger( event, data, this.handle.elem );
}
});
}
}
// handle triggering a single element
// don't do events on text and comment nodes
if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 ) {
return undefined;
}
// clean up in case it is reused
event.result = undefined;
event.target = elem;
// clone the incoming data, if any
data = jquery.makearray( data );
data.unshift( event );
}
event.currenttarget = elem;
// trigger the event, it is assumed that "handle" is a function
var handle = jquery.data( elem, "handle" );
if ( handle ) {
handle.apply( elem, data );
}
var parent = elem.parentnode || elem.ownerdocument;
// trigger an inline bound script
try {
if ( !(elem && elem.nodename && jquery.nodata[elem.nodename.tolowercase()]) ) {
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
event.result = false;
}
}
// prevent ie from throwing an error for some elements with some event types, see #3533
} catch (e) {}
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";
if ( !isclick && !(target && target.nodename && jquery.nodata[target.nodename.tolowercase()]) ) {
try {
if ( target[ type ] ) {
// make sure that we don't accidentally re-trigger the onfoo events
old = target[ "on" + type ];
if ( old ) {
target[ "on" + type ] = null;
}
this.triggered = true;
target[ type ]();
}
// prevent ie from throwing an error for some elements with some event types, see #3533
} catch (e) {}
if ( old ) {
target[ "on" + type ] = old;
}
this.triggered = false;
}
}
},
handle: function( event ) {
// returned undefined or false
var all, handlers;
event = arguments[0] = jquery.event.fix( event || window.event );
event.currenttarget = this;
// namespaced event handlers
var namespaces = event.type.split(".");
event.type = namespaces.shift();
// cache this now, all = true means, any handler
all = !namespaces.length && !event.exclusive;
var namespace = new regexp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
handlers = ( jquery.data(this, "events") || {} )[ event.type ];
for ( var j in handlers ) {
var handler = handlers[ j ];
// filter the functions by class
if ( all || namespace.test(handler.type) ) {
// pass in a reference to the handler function itself
// so that we can later remove it
event.handler = handler;
event.data = handler.data;
var ret = handler.apply( this, arguments );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventdefault();
event.stoppropagation();
}
}
if ( event.isimmediatepropagationstopped() ) {
break;
}
}
}
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(" "),
fix: function( event ) {
if ( event[ expando ] ) {
return event;
}
// store a copy of the original event object
// and "clone" to set read-only properties
var originalevent = event;
event = jquery.event( originalevent );
for ( var i = this.props.length, prop; i; ) {
prop = this.props[ --i ];
event[ prop ] = originalevent[ prop ];
}
// fix target property, if necessary
if ( !event.target ) {
event.target = event.srcelement || document; // fixes #1925 where srcelement might not be defined either
}
// check if target is a textnode (safari)
if ( event.target.nodetype === 3 ) {
event.target = event.target.parentnode;
}
// add relatedtarget, if necessary
if ( !event.relatedtarget && event.fromelement ) {
event.relatedtarget = event.fromelement === event.target ? event.toelement : event.fromelement;
}
// calculate pagex/y if missing and clientx/y available
if ( event.pagex == null && event.clientx != null ) {
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;
}
// add metakey to non-mac browsers (use ctrl for pc's and meta for macs)
if ( !event.metakey && event.ctrlkey ) {
event.metakey = event.ctrlkey;
}
// add which for click: 1 === left; 2 === middle; 3 === right
// note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event;
},
// deprecated, use jquery.guid instead
guid: 1e8,
// deprecated, use jquery.proxy instead
proxy: jquery.proxy,
special: {
ready: {
// make sure the ready event is setup
setup: jquery.bindready,
teardown: jquery.noop
},
live: {
add: function( proxy, data, namespaces, live ) {
jquery.extend( proxy, data || {} );
proxy.guid += data.selector + data.live;
data.liveproxy = proxy;
jquery.event.add( this, data.live, livehandler, data );
},
remove: function( namespaces ) {
if ( namespaces.length ) {
var remove = 0, name = new regexp("(^|\\.)" + namespaces[0] + "(\\.|$)");
jquery.each( (jquery.data(this, "events").live || {}), function() {
if ( name.test(this.type) ) {
remove++;
}
});
if ( remove < 1 ) {
jquery.event.remove( this, namespaces[0], livehandler );
}
}
},
special: {}
},
beforeunload: {
setup: function( data, namespaces, fn ) {
// we only want to do this special case on windows
if ( this.setinterval ) {
this.onbeforeunload = fn;
}
return false;
},
teardown: function( namespaces, fn ) {
if ( this.onbeforeunload === fn ) {
this.onbeforeunload = null;
}
}
}
}
};
jquery.event = function( src ) {
// allow instantiation without the 'new' keyword
if ( !this.preventdefault ) {
return new jquery.event( src );
}
// event object
if ( src && src.type ) {
this.originalevent = src;
this.type = src.type;
// event type
} else {
this.type = src;
}
// timestamp is buggy for some events on firefox(#3843)
// so we won't rely on the native value
this.timestamp = now();
// mark it as fixed
this[ expando ] = true;
};
function returnfalse() {
return false;
}
function returntrue() {
return true;
}
// jquery.event is based on dom3 events as specified by the ecmascript language binding
// http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html
jquery.event.prototype = {
preventdefault: function() {
this.isdefaultprevented = returntrue;
var e = this.originalevent;
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;
},
stoppropagation: function() {
this.ispropagationstopped = returntrue;
var e = this.originalevent;
if ( !e ) {
return;
}
// if stoppropagation exists run it on the original event
if ( e.stoppropagation ) {
e.stoppropagation();
}
// otherwise set the cancelbubble property of the original event to true (ie)
e.cancelbubble = true;
},
stopimmediatepropagation: function() {
this.isimmediatepropagationstopped = returntrue;
this.stoppropagation();
},
isdefaultprevented: returnfalse,
ispropagationstopped: returnfalse,
isimmediatepropagationstopped: returnfalse
};
// checks if an event happened on an element within another element
// used in jquery.event.special.mouseenter and mouseleave handlers
var withinelement = function( event ) {
// check if mouse(over|out) are still within the same parent element
var parent = event.relatedtarget;
// traverse up the tree
while ( parent && parent !== this ) {
// firefox sometimes assigns relatedtarget a xul element
// which we cannot access the parentnode property of
try {
parent = parent.parentnode;
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) {
break;
}
}
if ( parent !== this ) {
// set the correct event type
event.type = event.data;
// handle event if we actually just moused on to a non sub-element
jquery.event.handle.apply( this, arguments );
}
},
// in case of event delegation, we only need to rename the event.type,
// livehandler will take care of the rest.
delegate = function( event ) {
event.type = event.data;
jquery.event.handle.apply( this, arguments );
};
// create mouseenter and mouseleave events
jquery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jquery.event.special[ orig ] = {
setup: function( data ) {
jquery.event.add( this, fix, data && data.selector ? delegate : withinelement, orig );
},
teardown: function( data ) {
jquery.event.remove( this, fix, data && data.selector ? delegate : withinelement );
}
};
});
// submit delegation
if ( !jquery.support.submitbubbles ) {
jquery.event.special.submit = {
setup: function( data, namespaces, fn ) {
if ( this.nodename.tolowercase() !== "form" ) {
jquery.event.add(this, "click.specialsubmit." + fn.guid, function( e ) {
var elem = e.target, type = elem.type;
if ( (type === "submit" || type === "image") && jquery( elem ).closest("form").length ) {
return trigger( "submit", this, arguments );
}
});
jquery.event.add(this, "keypress.specialsubmit." + fn.guid, function( e ) {
var elem = e.target, type = elem.type;
if ( (type === "text" || type === "password") && jquery( elem ).closest("form").length && e.keycode === 13 ) {
return trigger( "submit", this, arguments );
}
});
} else {
return false;
}
},
remove: function( namespaces, fn ) {
jquery.event.remove( this, "click.specialsubmit" + (fn ? "."+fn.guid : "") );
jquery.event.remove( this, "keypress.specialsubmit" + (fn ? "."+fn.guid : "") );
}
};
}
// change delegation, happens here so we have bind.
if ( !jquery.support.changebubbles ) {
var formelems = /textarea|input|select/i;
function getval( elem ) {
var type = elem.type, val = elem.value;
if ( type === "radio" || type === "checkbox" ) {
val = elem.checked;
} else if ( type === "select-multiple" ) {
val = elem.selectedindex > -1 ?
jquery.map( elem.options, function( elem ) {
return elem.selected;
}).join("-") :
"";
} else if ( elem.nodename.tolowercase() === "select" ) {
val = elem.selectedindex;
}
return val;
}
function testchange( e ) {
var elem = e.target, data, val;
if ( !formelems.test( elem.nodename ) || elem.readonly ) {
return;
}
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 );
}
if ( data === undefined || val === data ) {
return;
}
if ( data != null || val ) {
e.type = "change";
return jquery.event.trigger( e, arguments[1], elem );
}
}
jquery.event.special.change = {
filters: {
focusout: testchange,
click: function( e ) {
var elem = e.target, type = elem.type;
if ( type === "radio" || type === "checkbox" || elem.nodename.tolowercase() === "select" ) {
return testchange.call( this, e );
}
},
// change has to be called before submit
// keydown will be called before keypress, which is used in submit-event delegation
keydown: function( e ) {
var elem = e.target, type = elem.type;
if ( (e.keycode === 13 && elem.nodename.tolowercase() !== "textarea") ||
(e.keycode === 32 && (type === "checkbox" || type === "radio")) ||
type === "select-multiple" ) {
return testchange.call( this, e );
}
},
// 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
beforeactivate: function( e ) {
var elem = e.target;
if ( elem.nodename.tolowercase() === "input" && elem.type === "radio" ) {
jquery.data( elem, "_change_data", getval(elem) );
}
}
},
setup: function( data, namespaces, fn ) {
for ( var type in changefilters ) {
jquery.event.add( this, type + ".specialchange." + fn.guid, changefilters[type] );
}
return formelems.test( this.nodename );
},
remove: function( namespaces, fn ) {
for ( var type in changefilters ) {
jquery.event.remove( this, type + ".specialchange" + (fn ? "."+fn.guid : ""), changefilters[type] );
}
return formelems.test( this.nodename );
}
};
var changefilters = jquery.event.special.change.filters;
}
function trigger( type, elem, args ) {
args[0].type = type;
return jquery.event.handle.apply( elem, args );
}
// create "bubbling" focus and blur events
if ( document.addeventlistener ) {
jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
jquery.event.special[ fix ] = {
setup: function() {
this.addeventlistener( orig, handler, true );
},
teardown: function() {
this.removeeventlistener( orig, handler, true );
}
};
function handler( e ) {
e = jquery.event.fix( e );
e.type = fix;
return jquery.event.handle.call( this, e );
}
});
}
jquery.each(["bind", "one"], function( i, name ) {
jquery.fn[ name ] = function( type, data, fn ) {
// handle object literals
if ( typeof type === "object" ) {
for ( var key in type ) {
this[ name ](key, data, type[key], fn);
}
return this;
}
if ( jquery.isfunction( data ) ) {
fn = data;
data = undefined;
}
var handler = name === "one" ? jquery.proxy( fn, function( event ) {
jquery( this ).unbind( event, handler );
return fn.apply( this, arguments );
}) : fn;
return type === "unload" && name !== "one" ?
this.one( type, data, fn ) :
this.each(function() {
jquery.event.add( this, type, handler, data );
});
};
});
jquery.fn.extend({
unbind: function( type, fn ) {
// handle object literals
if ( typeof type === "object" && !type.preventdefault ) {
for ( var key in type ) {
this.unbind(key, type[key]);
}
return this;
}
return this.each(function() {
jquery.event.remove( this, type, fn );
});
},
trigger: function( type, data ) {
return this.each(function() {
jquery.event.trigger( type, data, this );
});
},
triggerhandler: function( type, data ) {
if ( this[0] ) {
var event = jquery.event( type );
event.preventdefault();
event.stoppropagation();
jquery.event.trigger( event, data, this[0] );
return event.result;
}
},
toggle: function( fn ) {
// save reference to arguments for access in closure
var args = arguments, i = 1;
// link all the functions, so any of them can unbind this click handler
while ( i < args.length ) {
jquery.proxy( fn, args[ i++ ] );
}
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 );
// make sure that clicks stop
event.preventdefault();
// and execute the function
return args[ lasttoggle ].apply( this, arguments ) || false;
}));
},
hover: function( fnover, fnout ) {
return this.mouseenter( fnover ).mouseleave( fnout || fnover );
}
});
jquery.each(["live", "die"], function( i, name ) {
jquery.fn[ name ] = function( types, data, fn ) {
var type, i = 0;
if ( jquery.isfunction( data ) ) {
fn = data;
data = undefined;
}
types = (types || "").split( /\s+/ );
while ( (type = types[ i++ ]) != null ) {
type = type === "focus" ? "focusin" : // focus --> focusin
type === "blur" ? "focusout" : // blur --> focusout
type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
type;
if ( name === "live" ) {
// bind live handler
jquery( this.context ).bind( liveconvert( type, this.selector ), {
data: data, selector: this.selector, live: type
}, fn );
} else {
// unbind live handler
jquery( this.context ).unbind( liveconvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
}
}
return this;
}
});
function livehandler( event ) {
var stop, elems = [], selectors = [], args = arguments,
related, match, fn, elem, j, i, l, data,
live = jquery.extend({}, jquery.data( this, "events" ).live);
// make sure we avoid non-left-click bubbling in firefox (#3861)
if ( event.button && event.type === "click" ) {
return;
}
for ( j in live ) {
fn = live[j];
if ( fn.live === event.type ||
fn.altlive && jquery.inarray(event.type, fn.altlive) > -1 ) {
data = fn.data;
if ( !(data.beforefilter && data.beforefilter[event.type] &&
!data.beforefilter[event.type](event)) ) {
selectors.push( fn.selector );
}
} else {
delete live[j];
}
}
match = jquery( event.target ).closest( selectors, event.currenttarget );
for ( i = 0, l = match.length; i < l; i++ ) {
for ( j in live ) {
fn = live[j];
elem = match[i].elem;
related = null;
if ( match[i].selector === fn.selector ) {
// those two events require additional checking
if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) {
related = jquery( event.relatedtarget ).closest( fn.selector )[0];
}
if ( !related || related !== elem ) {
elems.push({ elem: elem, fn: fn });
}
}
}
}
for ( i = 0, l = elems.length; i < l; i++ ) {
match = elems[i];
event.currenttarget = match.elem;
event.data = match.fn.data;
if ( match.fn.apply( match.elem, args ) === false ) {
stop = false;
break;
}
}
return stop;
}
function liveconvert( type, selector ) {
return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
}
jquery.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( i, name ) {
// handle event binding
jquery.fn[ name ] = function( fn ) {
return fn ? this.bind( name, fn ) : this.trigger( name );
};
if ( jquery.attrfn ) {
jquery.attrfn[ name ] = true;
}
});
// 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
* more information: http://sizzlejs.com/
*
* permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "software"), to deal in the software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the software, and to
* permit persons to whom the software is furnished to do so, subject to
* the following conditions:
*
* the above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the software.
*
* the software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties of
* merchantability, fitness for a particular purpose and
* noninfringement. in no event shall the authors or copyright holders be
* liable for any claim, damages or other liability, whether in an action
* of contract, tort or otherwise, arising from, out of or in connection
* with the software or the use or other dealings in the software.
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
tostring = object.prototype.tostring,
hasduplicate = false,
basehasduplicate = true;
// here we check if the javascript engine is using some sort of
// 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(){
basehasduplicate = false;
return 0;
});
var sizzle = function(selector, context, results, seed) {
results = results || [];
var origcontext = context = context || document;
if ( context.nodetype !== 1 && context.nodetype !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var parts = [], m, set, checkset, extra, prune = true, contextxml = isxml(context),
sofar = selector;
// reset the position of the chunker regexp (start from head)
while ( (chunker.exec(""), m = chunker.exec(sofar)) !== null ) {
sofar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
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 ] :
sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( expr.relative[ selector ] ) {
selector += parts.shift();
}
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];
}
if ( context ) {
var 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;
if ( parts.length > 0 ) {
checkset = makearray(set);
} else {
prune = false;
}
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
if ( !expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
expr.relative[ cur ]( checkset, pop, contextxml );
}
} else {
checkset = parts = [];
}
}
if ( !checkset ) {
checkset = set;
}
if ( !checkset ) {
sizzle.error( cur || selector );
}
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])) ) {
results.push( set[i] );
}
}
} else {
for ( var i = 0; checkset[i] != null; i++ ) {
if ( checkset[i] && checkset[i].nodetype === 1 ) {
results.push( set[i] );
}
}
}
} else {
makearray( checkset, results );
}
if ( extra ) {
sizzle( extra, origcontext, results, seed );
sizzle.uniquesort( results );
}
return results;
};
sizzle.uniquesort = function(results){
if ( sortorder ) {
hasduplicate = basehasduplicate;
results.sort(sortorder);
if ( hasduplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
return results;
};
sizzle.matches = function(expr, set){
return sizzle(expr, null, null, set);
};
sizzle.find = function(expr, context, isxml){
var set, match;
if ( !expr ) {
return [];
}
for ( var i = 0, l = expr.order.length; i < l; i++ ) {
var type = expr.order[i], match;
if ( (match = expr.leftmatch[ type ].exec( expr )) ) {
var left = match[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;
}
}
}
}
if ( !set ) {
set = context.getelementsbytagname("*");
}
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]);
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];
anyfound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curloop === result ) {
result = [];
}
if ( expr.prefilter[ type ] ) {
match = expr.prefilter[ type ]( match, curloop, inplace, result, not, isxmlfilter );
if ( !match ) {
anyfound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curloop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curloop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyfound = true;
} else {
curloop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyfound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curloop = result;
}
expr = expr.replace( expr.match[ type ], "" );
if ( !anyfound ) {
return [];
}
break;
}
}
}
// improper expression
if ( expr === old ) {
if ( anyfound == null ) {
sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curloop;
};
sizzle.error = function( msg ) {
throw "syntax error, unrecognized expression: " + msg;
};
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\))?/
},
leftmatch: {},
attrmap: {
"class": "classname",
"for": "htmlfor"
},
attrhandle: {
href: function(elem){
return elem.getattribute("href");
}
},
relative: {
"+": function(checkset, part){
var ispartstr = typeof part === "string",
istag = ispartstr && !/\w/.test(part),
ispartstrnottag = ispartstr && !istag;
if ( istag ) {
part = part.tolowercase();
}
for ( var i = 0, l = checkset.length, elem; i < l; i++ ) {
if ( (elem = checkset[i]) ) {
while ( (elem = elem.previoussibling) && elem.nodetype !== 1 ) {}
checkset[i] = ispartstrnottag || elem && elem.nodename.tolowercase() === part ?
elem || false :
elem === part;
}
}
if ( ispartstrnottag ) {
sizzle.filter( part, checkset, true );
}
},
">": function(checkset, part){
var ispartstr = typeof part === "string";
if ( ispartstr && !/\w/.test(part) ) {
part = part.tolowercase();
for ( var i = 0, l = checkset.length; i < l; i++ ) {
var 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];
if ( elem ) {
checkset[i] = ispartstr ?
elem.parentnode :
elem.parentnode === part;
}
}
if ( ispartstr ) {
sizzle.filter( part, checkset, true );
}
}
},
"": function(checkset, part, isxml){
var donename = done++, checkfn = dircheck;
if ( typeof part === "string" && !/\w/.test(part) ) {
var nodecheck = part = part.tolowercase();
checkfn = dirnodecheck;
}
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();
checkfn = dirnodecheck;
}
checkfn("previoussibling", part, donename, checkset, nodecheck, isxml);
}
},
find: {
id: function(match, context, isxml){
if ( typeof context.getelementbyid !== "undefined" && !isxml ) {
var m = context.getelementbyid(match[1]);
return m ? [m] : [];
}
},
name: function(match, context){
if ( typeof context.getelementsbyname !== "undefined" ) {
var ret = [], results = context.getelementsbyname(match[1]);
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getattribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
tag: function(match, context){
return context.getelementsbytagname(match[1]);
}
},
prefilter: {
class: function(match, curloop, inplace, result, not, isxml){
match = " " + match[1].replace(/\\/g, "") + " ";
if ( isxml ) {
return match;
}
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 ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curloop[i] = false;
}
}
}
return false;
},
id: function(match){
return match[1].replace(/\\/g, "");
},
tag: function(match, curloop){
return match[1].tolowercase();
},
child: function(match){
if ( match[1] === "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\d/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 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, "");
if ( !isxml && expr.attrmap[name] ) {
match[1] = expr.attrmap[name];
}
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
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){
match.unshift( true );
return match;
}
},
filters: {
enabled: function(elem){
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function(elem){
return elem.disabled === true;
},
checked: function(elem){
return elem.checked === true;
},
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){
return !!elem.firstchild;
},
empty: function(elem){
return !elem.firstchild;
},
has: function(elem, i, match){
return !!sizzle( match[3], elem ).length;
},
header: function(elem){
return /h\d/i.test( elem.nodename );
},
text: function(elem){
return "text" === elem.type;
},
radio: function(elem){
return "radio" === elem.type;
},
checkbox: function(elem){
return "checkbox" === elem.type;
},
file: function(elem){
return "file" === elem.type;
},
password: function(elem){
return "password" === elem.type;
},
submit: function(elem){
return "submit" === elem.type;
},
image: function(elem){
return "image" === elem.type;
},
reset: function(elem){
return "reset" === elem.type;
},
button: function(elem){
return "button" === elem.type || elem.nodename.tolowercase() === "button";
},
input: function(elem){
return /input|select|textarea|button/i.test(elem.nodename);
}
},
setfilters: {
first: function(elem, i){
return i === 0;
},
last: function(elem, i, match, array){
return i === array.length - 1;
},
even: function(elem, i){
return i % 2 === 0;
},
odd: function(elem, i){
return i % 2 === 1;
},
lt: function(elem, i, match){
return i < match[3] - 0;
},
gt: function(elem, i, match){
return i > match[3] - 0;
},
nth: function(elem, i, match){
return match[3] - 0 === i;
},
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 ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textcontent || elem.innertext || 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 ) {
return false;
}
}
return true;
} else {
sizzle.error( "syntax error, unrecognized expression: " + name );
}
},
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':
while ( (node = node.nextsibling) ) {
if ( node.nodetype === 1 ) {
return false;
}
}
return true;
case 'nth':
var first = match[2], last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
var donename = match[0],
parent = elem.parentnode;
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){
return elem.nodetype === 1 && elem.getattribute("id") === match;
},
tag: function(elem, match){
return (match === "*" && elem.nodetype === 1) || elem.nodename.tolowercase() === match;
},
class: function(elem, match){
return (" " + (elem.classname || elem.getattribute("class")) + " ")
.indexof( match ) > -1;
},
attr: function(elem, match){
var name = match[1],
result = expr.attrhandle[ name ] ?
expr.attrhandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getattribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
type === "=" ?
value === check :
type === "*=" ?
value.indexof(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexof(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexof(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
pos: function(elem, match, i, array){
var name = match[2], filter = expr.setfilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origpos = expr.match.pos;
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);
}));
}
var makearray = function(array, results) {
array = array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// perform a simple check to determine if the browser is capable of
// converting a nodelist to an array using builtin methods.
try {
array.prototype.slice.call( document.documentelement.childnodes, 0 );
// provide a fallback method if it does not work
} catch(e){
makearray = function(array, results) {
var 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++ ) {
ret.push( array[i] );
}
} else {
for ( var i = 0; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortorder;
if ( document.documentelement.comparedocumentposition ) {
sortorder = function( a, b ) {
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 ) {
hasduplicate = true;
}
return ret;
};
} 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;
};
}
// utility function for retreiving the text value of an array of dom nodes
function gettext( elems ) {
var ret = "", elem;
for ( var i = 0; elems[i]; i++ ) {
elem = elems[i];
// get the text from text nodes and cdata nodes
if ( elem.nodetype === 3 || elem.nodetype === 4 ) {
ret += elem.nodevalue;
// traverse everything else, except comment nodes
} else if ( elem.nodetype !== 8 ) {
ret += 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();
form.innerhtml = "";
// 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){
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 : [];
}
};
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
})();
(function(){
// check to see if the browser returns only elements
// when doing getelementsbytagname("*")
// create a fake element
var div = document.createelement("div");
div.appendchild( document.createcomment("") );
// make sure no comments are found
if ( div.getelementsbytagname("*").length > 0 ) {
expr.find.tag = function(match, context){
var results = context.getelementsbytagname(match[1]);
// filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodetype === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// check to see if an attribute returns normalized href attributes
div.innerhtml = "";
if ( div.firstchild && typeof div.firstchild.getattribute !== "undefined" &&
div.firstchild.getattribute("href") !== "#" ) {
expr.attrhandle.href = function(elem){
return elem.getattribute("href", 2);
};
}
div = null; // release memory in ie
})();
if ( document.queryselectorall ) {
(function(){
var oldsizzle = sizzle, div = document.createelement("div");
div.innerhtml = "";
// safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.queryselectorall && div.queryselectorall(".test").length === 0 ) {
return;
}
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){}
}
return oldsizzle(query, context, extra, seed);
};
for ( var prop in oldsizzle ) {
sizzle[ prop ] = oldsizzle[ prop ];
}
div = null; // release memory in ie
})();
}
(function(){
var div = document.createelement("div");
div.innerhtml = "";
// opera can't find a second classname (in 9.6)
// also, make sure that getelementsbyclassname actually exists
if ( !div.getelementsbyclassname || div.getelementsbyclassname("e").length === 0 ) {
return;
}
// safari caches class attributes, doesn't catch changes (in 3.2)
div.lastchild.classname = "e";
if ( div.getelementsbyclassname("e").length === 1 ) {
return;
}
expr.order.splice(1, 0, "class");
expr.find.class = function(match, context, isxml) {
if ( typeof context.getelementsbyclassname !== "undefined" && !isxml ) {
return context.getelementsbyclassname(match[1]);
}
};
div = null; // release memory in ie
})();
function dirnodecheck( dir, cur, donename, checkset, nodecheck, isxml ) {
for ( var i = 0, l = checkset.length; i < l; i++ ) {
var elem = checkset[i];
if ( elem ) {
elem = elem[dir];
var match = false;
while ( elem ) {
if ( elem.sizcache === donename ) {
match = checkset[elem.sizset];
break;
}
if ( elem.nodetype === 1 && !isxml ){
elem.sizcache = donename;
elem.sizset = i;
}
if ( elem.nodename.tolowercase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkset[i] = match;
}
}
}
function dircheck( dir, cur, donename, checkset, nodecheck, isxml ) {
for ( var i = 0, l = checkset.length; i < l; i++ ) {
var elem = checkset[i];
if ( elem ) {
elem = elem[dir];
var match = false;
while ( elem ) {
if ( elem.sizcache === donename ) {
match = checkset[elem.sizset];
break;
}
if ( elem.nodetype === 1 ) {
if ( !isxml ) {
elem.sizcache = donename;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkset[i] = match;
}
}
}
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){
// 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,
root = context.nodetype ? [context] : context;
// position selectors must be done after the filter
// and so must :not(positional) so we move all pseudos to the end
while ( (match = expr.match.pseudo.exec( selector )) ) {
later += match[0];
selector = selector.replace( expr.match.pseudo, "" );
}
selector = expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
sizzle( selector, root[i], tmpset );
}
return sizzle.filter( later, tmpset );
};
// expose
jquery.find = sizzle;
jquery.expr = sizzle.selectors;
jquery.expr[":"] = jquery.expr.filters;
jquery.unique = sizzle.uniquesort;
jquery.gettext = gettext;
jquery.isxmldoc = isxml;
jquery.contains = contains;
return;
window.sizzle = sizzle;
})();
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;
});
};
jquery.fn.extend({
find: function( selector ) {
var ret = this.pushstack( "", "find", selector ), length = 0;
for ( var i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jquery.find( selector, this[i], ret );
if ( i > 0 ) {
// make sure that the results are unique
for ( var n = length; n < ret.length; n++ ) {
for ( var r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jquery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jquery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushstack( winnow(this, selector, false), "not", selector);
},
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 ) {
if ( jquery.isarray( selectors ) ) {
var ret = [], cur = this[0], match, matches = {}, selector;
if ( cur && selectors.length ) {
for ( var i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[selector] ) {
matches[selector] = jquery.expr.match.pos.test( selector ) ?
jquery( selector, context || this.context ) :
selector;
}
}
while ( cur && cur.ownerdocument && cur !== context ) {
for ( selector in matches ) {
match = matches[selector];
if ( match.jquery ? match.index(cur) > -1 : jquery(cur).is(match) ) {
ret.push({ selector: selector, elem: cur });
delete matches[selector];
}
}
cur = cur.parentnode;
}
}
return ret;
}
var pos = jquery.expr.match.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;
});
},
// determine the position of an element within
// the matched set of elements
index: function( elem ) {
if ( !elem || typeof elem === "string" ) {
return jquery.inarray( this[0],
// if it receives a string, the selector is used
// if it receives nothing, the siblings are used
elem ? jquery( elem ) : this.parent().children() );
}
// locate the position of the desired element
return jquery.inarray(
// if it receives a jquery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jquery( selector, context || this.context ) :
jquery.makearray( selector ),
all = jquery.merge( this.get(), set );
return this.pushstack( isdisconnected( set[0] ) || isdisconnected( all[0] ) ?
all :
jquery.unique( all ) );
},
andself: function() {
return this.add( this.prevobject );
}
});
// a painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isdisconnected( node ) {
return !node || !node.parentnode || node.parentnode.nodetype === 11;
}
jquery.each({
parent: function( elem ) {
var parent = elem.parentnode;
return parent && parent.nodetype !== 11 ? parent : null;
},
parents: function( elem ) {
return jquery.dir( elem, "parentnode" );
},
parentsuntil: function( elem, i, until ) {
return jquery.dir( elem, "parentnode", until );
},
next: function( elem ) {
return jquery.nth( elem, 2, "nextsibling" );
},
prev: function( elem ) {
return jquery.nth( elem, 2, "previoussibling" );
},
nextall: function( elem ) {
return jquery.dir( elem, "nextsibling" );
},
prevall: function( elem ) {
return jquery.dir( elem, "previoussibling" );
},
nextuntil: function( elem, i, until ) {
return jquery.dir( elem, "nextsibling", until );
},
prevuntil: function( elem, i, until ) {
return jquery.dir( elem, "previoussibling", until );
},
siblings: function( elem ) {
return jquery.sibling( elem.parentnode.firstchild, elem );
},
children: function( elem ) {
return jquery.sibling( elem.firstchild );
},
contents: function( elem ) {
return jquery.nodename( elem, "iframe" ) ?
elem.contentdocument || elem.contentwindow.document :
jquery.makearray( elem.childnodes );
}
}, function( name, fn ) {
jquery.fn[ name ] = function( until, selector ) {
var ret = jquery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jquery.filter( selector, ret );
}
ret = this.length > 1 ? 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(",") );
};
});
jquery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return jquery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
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 );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodetype === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextsibling ) {
if ( n.nodetype === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
var rinlinejquery = / jquery\d+="(?:\d+|null)"/g,
rleadingwhitespace = /^\s+/,
rxhtmltag = /(<([\w:]+)[^>]*?)\/>/g,
rselfclosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
rtagname = /<([\w:]+)/,
rtbody = /" + tag + ">";
},
wrapmap = {
option: [ 1, "" ],
legend: [ 1, "" ],
thead: [ 1, "