PageRenderTime 79ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/solace/static/jquery.js

https://bitbucket.org/charlenopires/solace
JavaScript | 4376 lines | 3716 code | 314 blank | 346 comment | 387 complexity | 7b7ece4224616a0eb48bf16057e15e77 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /*!
  2. * jQuery JavaScript Library v1.3.2
  3. * http://jquery.com/
  4. *
  5. * Copyright (c) 2009 John Resig
  6. * Dual licensed under the MIT and GPL licenses.
  7. * http://docs.jquery.com/License
  8. *
  9. * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
  10. * Revision: 6246
  11. */
  12. (function(){
  13. var
  14. // Will speed up references to window, and allows munging its name.
  15. window = this,
  16. // Will speed up references to undefined, and allows munging its name.
  17. undefined,
  18. // Map over jQuery in case of overwrite
  19. _jQuery = window.jQuery,
  20. // Map over the $ in case of overwrite
  21. _$ = window.$,
  22. jQuery = window.jQuery = window.$ = function( selector, context ) {
  23. // The jQuery object is actually just the init constructor 'enhanced'
  24. return new jQuery.fn.init( selector, context );
  25. },
  26. // A simple way to check for HTML strings or ID strings
  27. // (both of which we optimize for)
  28. quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
  29. // Is it a simple selector
  30. isSimple = /^.[^:#\[\.,]*$/;
  31. jQuery.fn = jQuery.prototype = {
  32. init: function( selector, context ) {
  33. // Make sure that a selection was provided
  34. selector = selector || document;
  35. // Handle $(DOMElement)
  36. if ( selector.nodeType ) {
  37. this[0] = selector;
  38. this.length = 1;
  39. this.context = selector;
  40. return this;
  41. }
  42. // Handle HTML strings
  43. if ( typeof selector === "string" ) {
  44. // Are we dealing with HTML string or an ID?
  45. var match = quickExpr.exec( selector );
  46. // Verify a match, and that no context was specified for #id
  47. if ( match && (match[1] || !context) ) {
  48. // HANDLE: $(html) -> $(array)
  49. if ( match[1] )
  50. selector = jQuery.clean( [ match[1] ], context );
  51. // HANDLE: $("#id")
  52. else {
  53. var elem = document.getElementById( match[3] );
  54. // Handle the case where IE and Opera return items
  55. // by name instead of ID
  56. if ( elem && elem.id != match[3] )
  57. return jQuery().find( selector );
  58. // Otherwise, we inject the element directly into the jQuery object
  59. var ret = jQuery( elem || [] );
  60. ret.context = document;
  61. ret.selector = selector;
  62. return ret;
  63. }
  64. // HANDLE: $(expr, [context])
  65. // (which is just equivalent to: $(content).find(expr)
  66. } else
  67. return jQuery( context ).find( selector );
  68. // HANDLE: $(function)
  69. // Shortcut for document ready
  70. } else if ( jQuery.isFunction( selector ) )
  71. return jQuery( document ).ready( selector );
  72. // Make sure that old selector state is passed along
  73. if ( selector.selector && selector.context ) {
  74. this.selector = selector.selector;
  75. this.context = selector.context;
  76. }
  77. return this.setArray(jQuery.isArray( selector ) ?
  78. selector :
  79. jQuery.makeArray(selector));
  80. },
  81. // Start with an empty selector
  82. selector: "",
  83. // The current version of jQuery being used
  84. jquery: "1.3.2",
  85. // The number of elements contained in the matched element set
  86. size: function() {
  87. return this.length;
  88. },
  89. // Get the Nth element in the matched element set OR
  90. // Get the whole matched element set as a clean array
  91. get: function( num ) {
  92. return num === undefined ?
  93. // Return a 'clean' array
  94. Array.prototype.slice.call( this ) :
  95. // Return just the object
  96. this[ num ];
  97. },
  98. // Take an array of elements and push it onto the stack
  99. // (returning the new matched element set)
  100. pushStack: function( elems, name, selector ) {
  101. // Build a new jQuery matched element set
  102. var ret = jQuery( elems );
  103. // Add the old object onto the stack (as a reference)
  104. ret.prevObject = this;
  105. ret.context = this.context;
  106. if ( name === "find" )
  107. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  108. else if ( name )
  109. ret.selector = this.selector + "." + name + "(" + selector + ")";
  110. // Return the newly-formed element set
  111. return ret;
  112. },
  113. // Force the current matched set of elements to become
  114. // the specified array of elements (destroying the stack in the process)
  115. // You should use pushStack() in order to do this, but maintain the stack
  116. setArray: function( elems ) {
  117. // Resetting the length to 0, then using the native Array push
  118. // is a super-fast way to populate an object with array-like properties
  119. this.length = 0;
  120. Array.prototype.push.apply( this, elems );
  121. return this;
  122. },
  123. // Execute a callback for every element in the matched set.
  124. // (You can seed the arguments with an array of args, but this is
  125. // only used internally.)
  126. each: function( callback, args ) {
  127. return jQuery.each( this, callback, args );
  128. },
  129. // Determine the position of an element within
  130. // the matched set of elements
  131. index: function( elem ) {
  132. // Locate the position of the desired element
  133. return jQuery.inArray(
  134. // If it receives a jQuery object, the first element is used
  135. elem && elem.jquery ? elem[0] : elem
  136. , this );
  137. },
  138. attr: function( name, value, type ) {
  139. var options = name;
  140. // Look for the case where we're accessing a style value
  141. if ( typeof name === "string" )
  142. if ( value === undefined )
  143. return this[0] && jQuery[ type || "attr" ]( this[0], name );
  144. else {
  145. options = {};
  146. options[ name ] = value;
  147. }
  148. // Check to see if we're setting style values
  149. return this.each(function(i){
  150. // Set all the styles
  151. for ( name in options )
  152. jQuery.attr(
  153. type ?
  154. this.style :
  155. this,
  156. name, jQuery.prop( this, options[ name ], type, i, name )
  157. );
  158. });
  159. },
  160. css: function( key, value ) {
  161. // ignore negative width and height values
  162. if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  163. value = undefined;
  164. return this.attr( key, value, "curCSS" );
  165. },
  166. text: function( text ) {
  167. if ( typeof text !== "object" && text != null )
  168. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  169. var ret = "";
  170. jQuery.each( text || this, function(){
  171. jQuery.each( this.childNodes, function(){
  172. if ( this.nodeType != 8 )
  173. ret += this.nodeType != 1 ?
  174. this.nodeValue :
  175. jQuery.fn.text( [ this ] );
  176. });
  177. });
  178. return ret;
  179. },
  180. wrapAll: function( html ) {
  181. if ( this[0] ) {
  182. // The elements to wrap the target around
  183. var wrap = jQuery( html, this[0].ownerDocument ).clone();
  184. if ( this[0].parentNode )
  185. wrap.insertBefore( this[0] );
  186. wrap.map(function(){
  187. var elem = this;
  188. while ( elem.firstChild )
  189. elem = elem.firstChild;
  190. return elem;
  191. }).append(this);
  192. }
  193. return this;
  194. },
  195. wrapInner: function( html ) {
  196. return this.each(function(){
  197. jQuery( this ).contents().wrapAll( html );
  198. });
  199. },
  200. wrap: function( html ) {
  201. return this.each(function(){
  202. jQuery( this ).wrapAll( html );
  203. });
  204. },
  205. append: function() {
  206. return this.domManip(arguments, true, function(elem){
  207. if (this.nodeType == 1)
  208. this.appendChild( elem );
  209. });
  210. },
  211. prepend: function() {
  212. return this.domManip(arguments, true, function(elem){
  213. if (this.nodeType == 1)
  214. this.insertBefore( elem, this.firstChild );
  215. });
  216. },
  217. before: function() {
  218. return this.domManip(arguments, false, function(elem){
  219. this.parentNode.insertBefore( elem, this );
  220. });
  221. },
  222. after: function() {
  223. return this.domManip(arguments, false, function(elem){
  224. this.parentNode.insertBefore( elem, this.nextSibling );
  225. });
  226. },
  227. end: function() {
  228. return this.prevObject || jQuery( [] );
  229. },
  230. // For internal use only.
  231. // Behaves like an Array's method, not like a jQuery method.
  232. push: [].push,
  233. sort: [].sort,
  234. splice: [].splice,
  235. find: function( selector ) {
  236. if ( this.length === 1 ) {
  237. var ret = this.pushStack( [], "find", selector );
  238. ret.length = 0;
  239. jQuery.find( selector, this[0], ret );
  240. return ret;
  241. } else {
  242. return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
  243. return jQuery.find( selector, elem );
  244. })), "find", selector );
  245. }
  246. },
  247. clone: function( events ) {
  248. // Do the clone
  249. var ret = this.map(function(){
  250. if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
  251. // IE copies events bound via attachEvent when
  252. // using cloneNode. Calling detachEvent on the
  253. // clone will also remove the events from the orignal
  254. // In order to get around this, we use innerHTML.
  255. // Unfortunately, this means some modifications to
  256. // attributes in IE that are actually only stored
  257. // as properties will not be copied (such as the
  258. // the name attribute on an input).
  259. var html = this.outerHTML;
  260. if ( !html ) {
  261. var div = this.ownerDocument.createElement("div");
  262. div.appendChild( this.cloneNode(true) );
  263. html = div.innerHTML;
  264. }
  265. return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
  266. } else
  267. return this.cloneNode(true);
  268. });
  269. // Copy the events from the original to the clone
  270. if ( events === true ) {
  271. var orig = this.find("*").andSelf(), i = 0;
  272. ret.find("*").andSelf().each(function(){
  273. if ( this.nodeName !== orig[i].nodeName )
  274. return;
  275. var events = jQuery.data( orig[i], "events" );
  276. for ( var type in events ) {
  277. for ( var handler in events[ type ] ) {
  278. jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
  279. }
  280. }
  281. i++;
  282. });
  283. }
  284. // Return the cloned set
  285. return ret;
  286. },
  287. filter: function( selector ) {
  288. return this.pushStack(
  289. jQuery.isFunction( selector ) &&
  290. jQuery.grep(this, function(elem, i){
  291. return selector.call( elem, i );
  292. }) ||
  293. jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
  294. return elem.nodeType === 1;
  295. }) ), "filter", selector );
  296. },
  297. closest: function( selector ) {
  298. var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
  299. closer = 0;
  300. return this.map(function(){
  301. var cur = this;
  302. while ( cur && cur.ownerDocument ) {
  303. if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
  304. jQuery.data(cur, "closest", closer);
  305. return cur;
  306. }
  307. cur = cur.parentNode;
  308. closer++;
  309. }
  310. });
  311. },
  312. not: function( selector ) {
  313. if ( typeof selector === "string" )
  314. // test special case where just one selector is passed in
  315. if ( isSimple.test( selector ) )
  316. return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
  317. else
  318. selector = jQuery.multiFilter( selector, this );
  319. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  320. return this.filter(function() {
  321. return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  322. });
  323. },
  324. add: function( selector ) {
  325. return this.pushStack( jQuery.unique( jQuery.merge(
  326. this.get(),
  327. typeof selector === "string" ?
  328. jQuery( selector ) :
  329. jQuery.makeArray( selector )
  330. )));
  331. },
  332. is: function( selector ) {
  333. return !!selector && jQuery.multiFilter( selector, this ).length > 0;
  334. },
  335. hasClass: function( selector ) {
  336. return !!selector && this.is( "." + selector );
  337. },
  338. val: function( value ) {
  339. if ( value === undefined ) {
  340. var elem = this[0];
  341. if ( elem ) {
  342. if( jQuery.nodeName( elem, 'option' ) )
  343. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  344. // We need to handle select boxes special
  345. if ( jQuery.nodeName( elem, "select" ) ) {
  346. var index = elem.selectedIndex,
  347. values = [],
  348. options = elem.options,
  349. one = elem.type == "select-one";
  350. // Nothing was selected
  351. if ( index < 0 )
  352. return null;
  353. // Loop through all the selected options
  354. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  355. var option = options[ i ];
  356. if ( option.selected ) {
  357. // Get the specifc value for the option
  358. value = jQuery(option).val();
  359. // We don't need an array for one selects
  360. if ( one )
  361. return value;
  362. // Multi-Selects return an array
  363. values.push( value );
  364. }
  365. }
  366. return values;
  367. }
  368. // Everything else, we just grab the value
  369. return (elem.value || "").replace(/\r/g, "");
  370. }
  371. return undefined;
  372. }
  373. if ( typeof value === "number" )
  374. value += '';
  375. return this.each(function(){
  376. if ( this.nodeType != 1 )
  377. return;
  378. if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
  379. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  380. jQuery.inArray(this.name, value) >= 0);
  381. else if ( jQuery.nodeName( this, "select" ) ) {
  382. var values = jQuery.makeArray(value);
  383. jQuery( "option", this ).each(function(){
  384. this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  385. jQuery.inArray( this.text, values ) >= 0);
  386. });
  387. if ( !values.length )
  388. this.selectedIndex = -1;
  389. } else
  390. this.value = value;
  391. });
  392. },
  393. html: function( value ) {
  394. return value === undefined ?
  395. (this[0] ?
  396. this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
  397. null) :
  398. this.empty().append( value );
  399. },
  400. replaceWith: function( value ) {
  401. return this.after( value ).remove();
  402. },
  403. eq: function( i ) {
  404. return this.slice( i, +i + 1 );
  405. },
  406. slice: function() {
  407. return this.pushStack( Array.prototype.slice.apply( this, arguments ),
  408. "slice", Array.prototype.slice.call(arguments).join(",") );
  409. },
  410. map: function( callback ) {
  411. return this.pushStack( jQuery.map(this, function(elem, i){
  412. return callback.call( elem, i, elem );
  413. }));
  414. },
  415. andSelf: function() {
  416. return this.add( this.prevObject );
  417. },
  418. domManip: function( args, table, callback ) {
  419. if ( this[0] ) {
  420. var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
  421. scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
  422. first = fragment.firstChild;
  423. if ( first )
  424. for ( var i = 0, l = this.length; i < l; i++ )
  425. callback.call( root(this[i], first), this.length > 1 || i > 0 ?
  426. fragment.cloneNode(true) : fragment );
  427. if ( scripts )
  428. jQuery.each( scripts, evalScript );
  429. }
  430. return this;
  431. function root( elem, cur ) {
  432. return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
  433. (elem.getElementsByTagName("tbody")[0] ||
  434. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  435. elem;
  436. }
  437. }
  438. };
  439. // Give the init function the jQuery prototype for later instantiation
  440. jQuery.fn.init.prototype = jQuery.fn;
  441. function evalScript( i, elem ) {
  442. if ( elem.src )
  443. jQuery.ajax({
  444. url: elem.src,
  445. async: false,
  446. dataType: "script"
  447. });
  448. else
  449. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  450. if ( elem.parentNode )
  451. elem.parentNode.removeChild( elem );
  452. }
  453. function now(){
  454. return +new Date;
  455. }
  456. jQuery.extend = jQuery.fn.extend = function() {
  457. // copy reference to target object
  458. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  459. // Handle a deep copy situation
  460. if ( typeof target === "boolean" ) {
  461. deep = target;
  462. target = arguments[1] || {};
  463. // skip the boolean and the target
  464. i = 2;
  465. }
  466. // Handle case when target is a string or something (possible in deep copy)
  467. if ( typeof target !== "object" && !jQuery.isFunction(target) )
  468. target = {};
  469. // extend jQuery itself if only one argument is passed
  470. if ( length == i ) {
  471. target = this;
  472. --i;
  473. }
  474. for ( ; i < length; i++ )
  475. // Only deal with non-null/undefined values
  476. if ( (options = arguments[ i ]) != null )
  477. // Extend the base object
  478. for ( var name in options ) {
  479. var src = target[ name ], copy = options[ name ];
  480. // Prevent never-ending loop
  481. if ( target === copy )
  482. continue;
  483. // Recurse if we're merging object values
  484. if ( deep && copy && typeof copy === "object" && !copy.nodeType )
  485. target[ name ] = jQuery.extend( deep,
  486. // Never move original objects, clone them
  487. src || ( copy.length != null ? [ ] : { } )
  488. , copy );
  489. // Don't bring in undefined values
  490. else if ( copy !== undefined )
  491. target[ name ] = copy;
  492. }
  493. // Return the modified object
  494. return target;
  495. };
  496. // exclude the following css properties to add px
  497. var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  498. // cache defaultView
  499. defaultView = document.defaultView || {},
  500. toString = Object.prototype.toString;
  501. jQuery.extend({
  502. noConflict: function( deep ) {
  503. window.$ = _$;
  504. if ( deep )
  505. window.jQuery = _jQuery;
  506. return jQuery;
  507. },
  508. // See test/unit/core.js for details concerning isFunction.
  509. // Since version 1.3, DOM methods and functions like alert
  510. // aren't supported. They return false on IE (#2968).
  511. isFunction: function( obj ) {
  512. return toString.call(obj) === "[object Function]";
  513. },
  514. isArray: function( obj ) {
  515. return toString.call(obj) === "[object Array]";
  516. },
  517. // check if an element is in a (or is an) XML document
  518. isXMLDoc: function( elem ) {
  519. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  520. !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
  521. },
  522. // Evalulates a script in a global context
  523. globalEval: function( data ) {
  524. if ( data && /\S/.test(data) ) {
  525. // Inspired by code by Andrea Giammarchi
  526. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  527. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  528. script = document.createElement("script");
  529. script.type = "text/javascript";
  530. if ( jQuery.support.scriptEval )
  531. script.appendChild( document.createTextNode( data ) );
  532. else
  533. script.text = data;
  534. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  535. // This arises when a base node is used (#2709).
  536. head.insertBefore( script, head.firstChild );
  537. head.removeChild( script );
  538. }
  539. },
  540. nodeName: function( elem, name ) {
  541. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  542. },
  543. // args is for internal usage only
  544. each: function( object, callback, args ) {
  545. var name, i = 0, length = object.length;
  546. if ( args ) {
  547. if ( length === undefined ) {
  548. for ( name in object )
  549. if ( callback.apply( object[ name ], args ) === false )
  550. break;
  551. } else
  552. for ( ; i < length; )
  553. if ( callback.apply( object[ i++ ], args ) === false )
  554. break;
  555. // A special, fast, case for the most common use of each
  556. } else {
  557. if ( length === undefined ) {
  558. for ( name in object )
  559. if ( callback.call( object[ name ], name, object[ name ] ) === false )
  560. break;
  561. } else
  562. for ( var value = object[0];
  563. i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  564. }
  565. return object;
  566. },
  567. prop: function( elem, value, type, i, name ) {
  568. // Handle executable functions
  569. if ( jQuery.isFunction( value ) )
  570. value = value.call( elem, i );
  571. // Handle passing in a number to a CSS property
  572. return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
  573. value + "px" :
  574. value;
  575. },
  576. className: {
  577. // internal only, use addClass("class")
  578. add: function( elem, classNames ) {
  579. jQuery.each((classNames || "").split(/\s+/), function(i, className){
  580. if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  581. elem.className += (elem.className ? " " : "") + className;
  582. });
  583. },
  584. // internal only, use removeClass("class")
  585. remove: function( elem, classNames ) {
  586. if (elem.nodeType == 1)
  587. elem.className = classNames !== undefined ?
  588. jQuery.grep(elem.className.split(/\s+/), function(className){
  589. return !jQuery.className.has( classNames, className );
  590. }).join(" ") :
  591. "";
  592. },
  593. // internal only, use hasClass("class")
  594. has: function( elem, className ) {
  595. return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  596. }
  597. },
  598. // A method for quickly swapping in/out CSS properties to get correct calculations
  599. swap: function( elem, options, callback ) {
  600. var old = {};
  601. // Remember the old values, and insert the new ones
  602. for ( var name in options ) {
  603. old[ name ] = elem.style[ name ];
  604. elem.style[ name ] = options[ name ];
  605. }
  606. callback.call( elem );
  607. // Revert the old values
  608. for ( var name in options )
  609. elem.style[ name ] = old[ name ];
  610. },
  611. css: function( elem, name, force, extra ) {
  612. if ( name == "width" || name == "height" ) {
  613. var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  614. function getWH() {
  615. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  616. if ( extra === "border" )
  617. return;
  618. jQuery.each( which, function() {
  619. if ( !extra )
  620. val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  621. if ( extra === "margin" )
  622. val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
  623. else
  624. val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  625. });
  626. }
  627. if ( elem.offsetWidth !== 0 )
  628. getWH();
  629. else
  630. jQuery.swap( elem, props, getWH );
  631. return Math.max(0, Math.round(val));
  632. }
  633. return jQuery.curCSS( elem, name, force );
  634. },
  635. curCSS: function( elem, name, force ) {
  636. var ret, style = elem.style;
  637. // We need to handle opacity special in IE
  638. if ( name == "opacity" && !jQuery.support.opacity ) {
  639. ret = jQuery.attr( style, "opacity" );
  640. return ret == "" ?
  641. "1" :
  642. ret;
  643. }
  644. // Make sure we're using the right name for getting the float value
  645. if ( name.match( /float/i ) )
  646. name = styleFloat;
  647. if ( !force && style && style[ name ] )
  648. ret = style[ name ];
  649. else if ( defaultView.getComputedStyle ) {
  650. // Only "float" is needed here
  651. if ( name.match( /float/i ) )
  652. name = "float";
  653. name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  654. var computedStyle = defaultView.getComputedStyle( elem, null );
  655. if ( computedStyle )
  656. ret = computedStyle.getPropertyValue( name );
  657. // We should always get a number back from opacity
  658. if ( name == "opacity" && ret == "" )
  659. ret = "1";
  660. } else if ( elem.currentStyle ) {
  661. var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  662. return letter.toUpperCase();
  663. });
  664. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  665. // From the awesome hack by Dean Edwards
  666. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  667. // If we're not dealing with a regular pixel number
  668. // but a number that has a weird ending, we need to convert it to pixels
  669. if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  670. // Remember the original values
  671. var left = style.left, rsLeft = elem.runtimeStyle.left;
  672. // Put in the new values to get a computed value out
  673. elem.runtimeStyle.left = elem.currentStyle.left;
  674. style.left = ret || 0;
  675. ret = style.pixelLeft + "px";
  676. // Revert the changed values
  677. style.left = left;
  678. elem.runtimeStyle.left = rsLeft;
  679. }
  680. }
  681. return ret;
  682. },
  683. clean: function( elems, context, fragment ) {
  684. context = context || document;
  685. // !context.createElement fails in IE with an error but returns typeof 'object'
  686. if ( typeof context.createElement === "undefined" )
  687. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  688. // If a single string is passed in and it's a single tag
  689. // just do a createElement and skip the rest
  690. if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
  691. var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
  692. if ( match )
  693. return [ context.createElement( match[1] ) ];
  694. }
  695. var ret = [], scripts = [], div = context.createElement("div");
  696. jQuery.each(elems, function(i, elem){
  697. if ( typeof elem === "number" )
  698. elem += '';
  699. if ( !elem )
  700. return;
  701. // Convert html string into DOM nodes
  702. if ( typeof elem === "string" ) {
  703. // Fix "XHTML"-style tags in all browsers
  704. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  705. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  706. all :
  707. front + "></" + tag + ">";
  708. });
  709. // Trim whitespace, otherwise indexOf won't work as expected
  710. var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
  711. var wrap =
  712. // option or optgroup
  713. !tags.indexOf("<opt") &&
  714. [ 1, "<select multiple='multiple'>", "</select>" ] ||
  715. !tags.indexOf("<leg") &&
  716. [ 1, "<fieldset>", "</fieldset>" ] ||
  717. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  718. [ 1, "<table>", "</table>" ] ||
  719. !tags.indexOf("<tr") &&
  720. [ 2, "<table><tbody>", "</tbody></table>" ] ||
  721. // <thead> matched above
  722. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  723. [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  724. !tags.indexOf("<col") &&
  725. [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  726. // IE can't serialize <link> and <script> tags normally
  727. !jQuery.support.htmlSerialize &&
  728. [ 1, "div<div>", "</div>" ] ||
  729. [ 0, "", "" ];
  730. // Go to html and back, then peel off extra wrappers
  731. div.innerHTML = wrap[1] + elem + wrap[2];
  732. // Move to the right depth
  733. while ( wrap[0]-- )
  734. div = div.lastChild;
  735. // Remove IE's autoinserted <tbody> from table fragments
  736. if ( !jQuery.support.tbody ) {
  737. // String was a <table>, *may* have spurious <tbody>
  738. var hasBody = /<tbody/i.test(elem),
  739. tbody = !tags.indexOf("<table") && !hasBody ?
  740. div.firstChild && div.firstChild.childNodes :
  741. // String was a bare <thead> or <tfoot>
  742. wrap[1] == "<table>" && !hasBody ?
  743. div.childNodes :
  744. [];
  745. for ( var j = tbody.length - 1; j >= 0 ; --j )
  746. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  747. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  748. }
  749. // IE completely kills leading whitespace when innerHTML is used
  750. if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
  751. div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  752. elem = jQuery.makeArray( div.childNodes );
  753. }
  754. if ( elem.nodeType )
  755. ret.push( elem );
  756. else
  757. ret = jQuery.merge( ret, elem );
  758. });
  759. if ( fragment ) {
  760. for ( var i = 0; ret[i]; i++ ) {
  761. if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  762. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  763. } else {
  764. if ( ret[i].nodeType === 1 )
  765. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  766. fragment.appendChild( ret[i] );
  767. }
  768. }
  769. return scripts;
  770. }
  771. return ret;
  772. },
  773. attr: function( elem, name, value ) {
  774. // don't set attributes on text and comment nodes
  775. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  776. return undefined;
  777. var notxml = !jQuery.isXMLDoc( elem ),
  778. // Whether we are setting (or getting)
  779. set = value !== undefined;
  780. // Try to normalize/fix the name
  781. name = notxml && jQuery.props[ name ] || name;
  782. // Only do all the following if this is a node (faster for style)
  783. // IE elem.getAttribute passes even for style
  784. if ( elem.tagName ) {
  785. // These attributes require special treatment
  786. var special = /href|src|style/.test( name );
  787. // Safari mis-reports the default selected property of a hidden option
  788. // Accessing the parent's selectedIndex property fixes it
  789. if ( name == "selected" && elem.parentNode )
  790. elem.parentNode.selectedIndex;
  791. // If applicable, access the attribute via the DOM 0 way
  792. if ( name in elem && notxml && !special ) {
  793. if ( set ){
  794. // We can't allow the type property to be changed (since it causes problems in IE)
  795. if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  796. throw "type property can't be changed";
  797. elem[ name ] = value;
  798. }
  799. // browsers index elements by id/name on forms, give priority to attributes.
  800. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
  801. return elem.getAttributeNode( name ).nodeValue;
  802. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  803. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  804. if ( name == "tabIndex" ) {
  805. var attributeNode = elem.getAttributeNode( "tabIndex" );
  806. return attributeNode && attributeNode.specified
  807. ? attributeNode.value
  808. : elem.nodeName.match(/(button|input|object|select|textarea)/i)
  809. ? 0
  810. : elem.nodeName.match(/^(a|area)$/i) && elem.href
  811. ? 0
  812. : undefined;
  813. }
  814. return elem[ name ];
  815. }
  816. if ( !jQuery.support.style && notxml && name == "style" )
  817. return jQuery.attr( elem.style, "cssText", value );
  818. if ( set )
  819. // convert the value to a string (all browsers do this but IE) see #1070
  820. elem.setAttribute( name, "" + value );
  821. var attr = !jQuery.support.hrefNormalized && notxml && special
  822. // Some attributes require a special call on IE
  823. ? elem.getAttribute( name, 2 )
  824. : elem.getAttribute( name );
  825. // Non-existent attributes return null, we normalize to undefined
  826. return attr === null ? undefined : attr;
  827. }
  828. // elem is actually elem.style ... set the style
  829. // IE uses filters for opacity
  830. if ( !jQuery.support.opacity && name == "opacity" ) {
  831. if ( set ) {
  832. // IE has trouble with opacity if it does not have layout
  833. // Force it by setting the zoom level
  834. elem.zoom = 1;
  835. // Set the alpha filter to set the opacity
  836. elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  837. (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  838. }
  839. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  840. (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
  841. "";
  842. }
  843. name = name.replace(/-([a-z])/ig, function(all, letter){
  844. return letter.toUpperCase();
  845. });
  846. if ( set )
  847. elem[ name ] = value;
  848. return elem[ name ];
  849. },
  850. trim: function( text ) {
  851. return (text || "").replace( /^\s+|\s+$/g, "" );
  852. },
  853. makeArray: function( array ) {
  854. var ret = [];
  855. if( array != null ){
  856. var i = array.length;
  857. // The window, strings (and functions) also have 'length'
  858. if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
  859. ret[0] = array;
  860. else
  861. while( i )
  862. ret[--i] = array[i];
  863. }
  864. return ret;
  865. },
  866. inArray: function( elem, array ) {
  867. for ( var i = 0, length = array.length; i < length; i++ )
  868. // Use === because on IE, window == document
  869. if ( array[ i ] === elem )
  870. return i;
  871. return -1;
  872. },
  873. merge: function( first, second ) {
  874. // We have to loop this way because IE & Opera overwrite the length
  875. // expando of getElementsByTagName
  876. var i = 0, elem, pos = first.length;
  877. // Also, we need to make sure that the correct elements are being returned
  878. // (IE returns comment nodes in a '*' query)
  879. if ( !jQuery.support.getAll ) {
  880. while ( (elem = second[ i++ ]) != null )
  881. if ( elem.nodeType != 8 )
  882. first[ pos++ ] = elem;
  883. } else
  884. while ( (elem = second[ i++ ]) != null )
  885. first[ pos++ ] = elem;
  886. return first;
  887. },
  888. unique: function( array ) {
  889. var ret = [], done = {};
  890. try {
  891. for ( var i = 0, length = array.length; i < length; i++ ) {
  892. var id = jQuery.data( array[ i ] );
  893. if ( !done[ id ] ) {
  894. done[ id ] = true;
  895. ret.push( array[ i ] );
  896. }
  897. }
  898. } catch( e ) {
  899. ret = array;
  900. }
  901. return ret;
  902. },
  903. grep: function( elems, callback, inv ) {
  904. var ret = [];
  905. // Go through the array, only saving the items
  906. // that pass the validator function
  907. for ( var i = 0, length = elems.length; i < length; i++ )
  908. if ( !inv != !callback( elems[ i ], i ) )
  909. ret.push( elems[ i ] );
  910. return ret;
  911. },
  912. map: function( elems, callback ) {
  913. var ret = [];
  914. // Go through the array, translating each of the items to their
  915. // new value (or values).
  916. for ( var i = 0, length = elems.length; i < length; i++ ) {
  917. var value = callback( elems[ i ], i );
  918. if ( value != null )
  919. ret[ ret.length ] = value;
  920. }
  921. return ret.concat.apply( [], ret );
  922. }
  923. });
  924. // Use of jQuery.browser is deprecated.
  925. // It's included for backwards compatibility and plugins,
  926. // although they should work to migrate away.
  927. var userAgent = navigator.userAgent.toLowerCase();
  928. // Figure out what browser is being used
  929. jQuery.browser = {
  930. version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
  931. safari: /webkit/.test( userAgent ),
  932. opera: /opera/.test( userAgent ),
  933. msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  934. mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  935. };
  936. jQuery.each({
  937. parent: function(elem){return elem.parentNode;},
  938. parents: function(elem){return jQuery.dir(elem,"parentNode");},
  939. next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
  940. prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
  941. nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
  942. prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
  943. siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
  944. children: function(elem){return jQuery.sibling(elem.firstChild);},
  945. contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
  946. }, function(name, fn){
  947. jQuery.fn[ name ] = function( selector ) {
  948. var ret = jQuery.map( this, fn );
  949. if ( selector && typeof selector == "string" )
  950. ret = jQuery.multiFilter( selector, ret );
  951. return this.pushStack( jQuery.unique( ret ), name, selector );
  952. };
  953. });
  954. jQuery.each({
  955. appendTo: "append",
  956. prependTo: "prepend",
  957. insertBefore: "before",
  958. insertAfter: "after",
  959. replaceAll: "replaceWith"
  960. }, function(name, original){
  961. jQuery.fn[ name ] = function( selector ) {
  962. var ret = [], insert = jQuery( selector );
  963. for ( var i = 0, l = insert.length; i < l; i++ ) {
  964. var elems = (i > 0 ? this.clone(true) : this).get();
  965. jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
  966. ret = ret.concat( elems );
  967. }
  968. return this.pushStack( ret, name, selector );
  969. };
  970. });
  971. jQuery.each({
  972. removeAttr: function( name ) {
  973. jQuery.attr( this, name, "" );
  974. if (this.nodeType == 1)
  975. this.removeAttribute( name );
  976. },
  977. addClass: function( classNames ) {
  978. jQuery.className.add( this, classNames );
  979. },
  980. removeClass: function( classNames ) {
  981. jQuery.className.remove( this, classNames );
  982. },
  983. toggleClass: function( classNames, state ) {
  984. if( typeof state !== "boolean" )
  985. state = !jQuery.className.has( this, classNames );
  986. jQuery.className[ state ? "add" : "remove" ]( this, classNames );
  987. },
  988. remove: function( selector ) {
  989. if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
  990. // Prevent memory leaks
  991. jQuery( "*", this ).add([this]).each(function(){
  992. jQuery.event.remove(this);
  993. jQuery.removeData(this);
  994. });
  995. if (this.parentNode)
  996. this.parentNode.removeChild( this );
  997. }
  998. },
  999. empty: function() {
  1000. // Remove element nodes and prevent memory leaks
  1001. jQuery(this).children().remove();
  1002. // Remove any remaining nodes
  1003. while ( this.firstChild )
  1004. this.removeChild( this.firstChild );
  1005. }
  1006. }, function(name, fn){
  1007. jQuery.fn[ name ] = function(){
  1008. return this.each( fn, arguments );
  1009. };
  1010. });
  1011. // Helper function used by the dimensions and offset modules
  1012. function num(elem, prop) {
  1013. return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
  1014. }
  1015. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  1016. jQuery.extend({
  1017. cache: {},
  1018. data: function( elem, name, data ) {
  1019. elem = elem == window ?
  1020. windowData :
  1021. elem;
  1022. var id = elem[ expando ];
  1023. // Compute a unique ID for the element
  1024. if ( !id )
  1025. id = elem[ expando ] = ++uuid;
  1026. // Only generate the data cache if we're
  1027. // trying to access or manipulate it
  1028. if ( name && !jQuery.cache[ id ] )
  1029. jQuery.cache[ id ] = {};
  1030. // Prevent overriding the named cache with undefined values
  1031. if ( data !== undefined )
  1032. jQuery.cache[ id ][ name ] = data;
  1033. // Return the named cache data, or the ID for the element
  1034. return name ?
  1035. jQuery.cache[ id ][ name ] :
  1036. id;
  1037. },
  1038. removeData: function( elem, name ) {
  1039. elem = elem == window ?
  1040. windowData :
  1041. elem;
  1042. var id = elem[ expando ];
  1043. // If we want to remove a specific section of the element's data
  1044. if ( name ) {
  1045. if ( jQuery.cache[ id ] ) {
  1046. // Remove the section of cache data
  1047. delete jQuery.cache[ id ][ name ];
  1048. // If we've removed all the data, remove the element's cache
  1049. name = "";
  1050. for ( name in jQuery.cache[ id ] )
  1051. break;
  1052. if ( !name )
  1053. jQuery.removeData( elem );
  1054. }
  1055. // Otherwise, we want to remove all of the element's data
  1056. } else {
  1057. // Clean up the element expando
  1058. try {
  1059. delete elem[ expando ];
  1060. } catch(e){
  1061. // IE has trouble directly removing the expando
  1062. // but it's ok with using removeAttribute
  1063. if ( elem.removeAttribute )
  1064. elem.removeAttribute( expando );
  1065. }
  1066. // Completely remove the data cache
  1067. delete jQuery.cache[ id ];
  1068. }
  1069. },
  1070. queue: function( elem, type, data ) {
  1071. if ( elem ){
  1072. type = (type || "fx") + "queue";
  1073. var q = jQuery.data( elem, type );
  1074. if ( !q || jQuery.isArray(data) )
  1075. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  1076. else if( data )
  1077. q.push( data );
  1078. }
  1079. return q;
  1080. },
  1081. dequeue: function( elem, type ){
  1082. var queue = jQuery.queue( elem, type ),
  1083. fn = queue.shift();
  1084. if( !type || type === "fx" )
  1085. fn = queue[0];
  1086. if( fn !== undefined )
  1087. fn.call(elem);
  1088. }
  1089. });
  1090. jQuery.fn.extend({
  1091. data: function( key, value ){
  1092. var parts = key.split(".");
  1093. parts[1] = parts[1] ? "." + parts[1] : "";
  1094. if ( value === undefined ) {
  1095. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1096. if ( data === undefined && this.length )
  1097. data = jQuery.data( this[0], key );
  1098. return data === undefined && parts[1] ?
  1099. this.data( parts[0] ) :
  1100. data;
  1101. } else
  1102. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
  1103. jQuery.data( this, key, value );
  1104. });
  1105. },
  1106. removeData: function( key ){
  1107. return this.each(function(){
  1108. jQuery.removeData( this, key );
  1109. });
  1110. },
  1111. queue: function(type, data){
  1112. if ( typeof type !== "string" ) {
  1113. data = type;
  1114. type = "fx";
  1115. }
  1116. if ( data === undefined )
  1117. return jQuery.queue( this[0], type );
  1118. return this.each(function(){
  1119. var queue = jQuery.queue( this, type, data );
  1120. if( type == "fx" && queue.length == 1 )
  1121. queue[0].call(this);
  1122. });
  1123. },
  1124. dequeue: function(type){
  1125. return this.each(function(){
  1126. jQuery.dequeue( this, type );
  1127. });
  1128. }
  1129. });/*!
  1130. * Sizzle CSS Selector Engine - v0.9.3
  1131. * Copyright 2009, The Dojo Foundation
  1132. * Released under the MIT, BSD, and GPL Licenses.
  1133. * More information: http://sizzlejs.com/
  1134. */
  1135. (function(){
  1136. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
  1137. done = 0,
  1138. toString = Object.prototype.toString;
  1139. var Sizzle = function(selector, context, results, seed) {
  1140. results = results || [];
  1141. context = context || document;
  1142. if ( context.nodeType !== 1 && context.nodeType !== 9 )
  1143. return [];
  1144. if ( !selector || typeof selector !== "string" ) {
  1145. return results;
  1146. }
  1147. var parts = [], m, set, checkSet, check, mode, extra, prune = true;
  1148. // Reset the position of the chunker regexp (start from head)
  1149. chunker.lastIndex = 0;
  1150. while ( (m = chunker.exec(selector)) !== null ) {
  1151. parts.push( m[1] );
  1152. if ( m[2] ) {
  1153. extra = RegExp.rightContext;
  1154. break;
  1155. }
  1156. }
  1157. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  1158. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  1159. set = posProcess( parts[0] + parts[1], context );
  1160. } else {
  1161. set = Expr.relative[ parts[0] ] ?
  1162. [ context ] :
  1163. Sizzle( parts.shift(), context );
  1164. while ( parts.length ) {
  1165. selector = parts.shift();
  1166. if ( Expr.relative[ selector ] )
  1167. selector += parts.shift();
  1168. set = posProcess( selector, set );
  1169. }
  1170. }
  1171. } else {
  1172. var ret = seed ?
  1173. { expr: parts.pop(), set: makeArray(seed) } :
  1174. Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
  1175. set = Sizzle.filter( ret.expr, ret.set );
  1176. if ( parts.length > 0 ) {
  1177. checkSet = makeArray(set);
  1178. } else {
  1179. prune = false;
  1180. }
  1181. while ( parts.length ) {
  1182. var cur = parts.pop(), pop = cur;
  1183. if ( !Expr.relative[ cur ] ) {
  1184. cur = "";
  1185. } else {
  1186. pop = parts.pop();
  1187. }
  1188. if ( pop == null ) {
  1189. pop = context;
  1190. }
  1191. Expr.relative[ cur ]( checkSet, pop, isXML(context) );
  1192. }
  1193. }
  1194. if ( !checkSet ) {
  1195. checkSet = set;
  1196. }
  1197. if ( !checkSet ) {
  1198. throw "Syntax error, unrecognized expression: " + (cur || selector);
  1199. }
  1200. if ( toString.call(checkSet) === "[object Array]" ) {
  1201. if ( !prune ) {
  1202. results.push.apply( results, checkSet );
  1203. } else if ( context.nodeType === 1 ) {
  1204. for ( var i = 0; checkSet[i] != null; i++ ) {
  1205. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
  1206. results.push( set[i] );
  1207. }
  1208. }
  1209. } else {
  1210. for ( var i = 0; checkSet[i] != null; i++ ) {
  1211. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  1212. results.push( set[i] );
  1213. }
  1214. }
  1215. }
  1216. } else {
  1217. makeArray( checkSet, results );
  1218. }
  1219. if ( extra ) {
  1220. Sizzle( extra, context, results, seed );
  1221. if ( sortOrder ) {
  1222. hasDuplicate = false;
  1223. results.sort(sortOrder);
  1224. if ( hasDuplicate ) {
  1225. for ( var i = 1; i < results.length; i++ ) {
  1226. if ( results[i] === results[i-1] ) {
  1227. results.splice(i--, 1);
  1228. }
  1229. }
  1230. }
  1231. }
  1232. }
  1233. return results;
  1234. };
  1235. Sizzle.matches = function(expr, set){
  1236. return Sizzle(expr, null, null, set);
  1237. };
  1238. Sizzle.find = function(expr, context, isXML){
  1239. var set, match;
  1240. if ( !expr ) {
  1241. return [];
  1242. }
  1243. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  1244. var type = Expr.order[i], match;
  1245. if ( (match = Expr.match[ type ].exec( expr )) ) {
  1246. var left = RegExp.leftContext;
  1247. if ( left.substr( left.length - 1 ) !== "\\" ) {
  1248. match[1] = (match[1] || "").replace(/\\/g, "");
  1249. set = Expr.find[ type ]( match, context, isXML );
  1250. if ( set != null ) {
  1251. expr = expr.replace( Expr.match[ type ], "" );
  1252. break;
  1253. }
  1254. }
  1255. }
  1256. }
  1257. if ( !set ) {
  1258. set = context.getElementsByTagName("*");
  1259. }
  1260. return {set: set, expr: expr};
  1261. };
  1262. Sizzle.filter = function(expr, set, inplace, not){
  1263. var old = expr, result = [], curLoop = set, match, anyFound,
  1264. isXMLFilter = set && set[0] && isXML(set[0]);
  1265. while ( expr && set.length ) {
  1266. for ( var type in Expr.filter ) {
  1267. if ( (match = Expr.match[ type ].exec( expr )) != null ) {
  1268. var filter = Expr.filter[ type ], found, item;
  1269. anyFound = false;
  1270. if ( curLoop == result ) {
  1271. result = [];
  1272. }
  1273. if ( Expr.preFilter[ type ] ) {
  1274. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  1275. if ( !match ) {
  1276. anyFound = found = true;
  1277. } else if ( match === true ) {
  1278. continue;
  1279. }
  1280. }
  1281. if ( match ) {
  1282. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  1283. if ( item ) {
  1284. found = filter( item, match, i, curLoop );
  1285. var pass = not ^ !!found;
  1286. if ( inplace && found != null ) {
  1287. if ( pass ) {
  1288. anyFound = true;
  1289. } else {
  1290. curLoop[i] = false;
  1291. }
  1292. } else if ( pass ) {
  1293. result.push( item );
  1294. anyFound = true;
  1295. }
  1296. }
  1297. }
  1298. }
  1299. if ( found !== undefined ) {
  1300. if ( !inplace ) {
  1301. curLoop = result;
  1302. }
  1303. expr = expr.replace( Expr.match[ type ], "" );
  1304. if ( !anyFound ) {
  1305. return [];
  1306. }
  1307. break;
  1308. }
  1309. }
  1310. }
  1311. // Improper expression
  1312. if ( expr == old ) {
  1313. if ( anyFound == null ) {
  1314. throw "Syntax error, unrecognized expression: " + expr;
  1315. } else {
  1316. break;
  1317. }
  1318. }
  1319. old = expr;
  1320. }
  1321. return curLoop;
  1322. };
  1323. var Expr = Sizzle.selectors = {
  1324. order: [ "ID", "NAME", "TAG" ],
  1325. match: {
  1326. ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1327. CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1328. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
  1329. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  1330. TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
  1331. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
  1332. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
  1333. PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
  1334. },
  1335. attrMap: {
  1336. "class": "className",
  1337. "for": "htmlFor"
  1338. },
  1339. attrHandle: {
  1340. href: function(elem){
  1341. return elem.getAttribute("href");
  1342. }
  1343. },
  1344. relative: {
  1345. "+": function(checkSet, part, isXML){
  1346. var isPartStr = typeof part === "string",
  1347. isTag = isPartStr && !/\W/.test(part),
  1348. isPartStrNotTag = isPartStr && !isTag;
  1349. if ( isTag && !isXML ) {
  1350. part = part.toUpperCase();
  1351. }
  1352. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  1353. if ( (elem = checkSet[i]) ) {
  1354. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  1355. checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
  1356. elem || false :
  1357. elem === part;
  1358. }
  1359. }
  1360. if ( isPartStrNotTag ) {
  1361. Sizzle.filter( part, checkSet, true );
  1362. }
  1363. },
  1364. ">": function(checkSet, part, isXML){
  1365. var isPartStr = typeof part === "string";
  1366. if ( isPartStr && !/\W/.test(part) ) {
  1367. part = isXML ? part : part.toUpperCase();
  1368. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1369. var elem = checkSet[i];
  1370. if ( elem ) {
  1371. var parent = elem.parentNode;
  1372. checkSet[i] = parent.nodeName === part ? parent : false;
  1373. }
  1374. }
  1375. } else {
  1376. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1377. var elem = checkSet[i];
  1378. if ( elem ) {
  1379. checkSet[i] = isPartStr ?
  1380. elem.parentNode :
  1381. elem.parentNode === part;
  1382. }
  1383. }
  1384. if ( isPartStr ) {
  1385. Sizzle.filter( part, checkSet, true );
  1386. }
  1387. }
  1388. },
  1389. "": function(checkSet, part, isXML){
  1390. var doneName = done++, checkFn = dirCheck;
  1391. if ( !part.match(/\W/) ) {
  1392. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1393. checkFn = dirNodeCheck;
  1394. }
  1395. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  1396. },
  1397. "~": function(checkSet, part, isXML){
  1398. var doneName = done++, checkFn = dirCheck;
  1399. if ( typeof part === "string" && !part.match(/\W/) ) {
  1400. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1401. checkFn = dirNodeCheck;
  1402. }
  1403. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  1404. }
  1405. },
  1406. find: {
  1407. ID: function(match, context, isXML){
  1408. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  1409. var m = context.getElementById(match[1]);
  1410. return m ? [m] : [];
  1411. }
  1412. },
  1413. NAME: function(match, context, isXML){
  1414. if ( typeof context.getElementsByName !== "undefined" ) {
  1415. var ret = [], results = context.getElementsByName(match[1]);
  1416. for ( var i = 0, l = results.length; i < l; i++ ) {
  1417. if ( results[i].getAttribute("name") === match[1] ) {
  1418. ret.push( results[i] );
  1419. }
  1420. }
  1421. return ret.length === 0 ? null : ret;
  1422. }
  1423. },
  1424. TAG: function(match, context){
  1425. return context.getElementsByTagName(match[1]);
  1426. }
  1427. },
  1428. preFilter: {
  1429. CLASS: function(match, curLoop, inplace, result, not, isXML){
  1430. match = " " + match[1].replace(/\\/g, "") + " ";
  1431. if ( isXML ) {
  1432. return match;
  1433. }
  1434. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  1435. if ( elem ) {
  1436. if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
  1437. if ( !inplace )
  1438. result.push( elem );
  1439. } else if ( inplace ) {
  1440. curLoop[i] = false;
  1441. }
  1442. }
  1443. }
  1444. return false;
  1445. },
  1446. ID: function(match){
  1447. return match[1].replace(/\\/g, "");
  1448. },
  1449. TAG: function(match, curLoop){
  1450. for ( var i = 0; curLoop[i] === false; i++ ){}
  1451. return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
  1452. },
  1453. CHILD: function(match){
  1454. if ( match[1] == "nth" ) {
  1455. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1456. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  1457. match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
  1458. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  1459. // calculate the numbers (first)n+(last) including if they are negative
  1460. match[2] = (test[1] + (test[2] || 1)) - 0;
  1461. match[3] = test[3] - 0;
  1462. }
  1463. // TODO: Move to normal caching system
  1464. match[0] = done++;
  1465. return match;
  1466. },
  1467. ATTR: function(match, curLoop, inplace, result, not, isXML){
  1468. var name = match[1].replace(/\\/g, "");
  1469. if ( !isXML && Expr.attrMap[name] ) {
  1470. match[1] = Expr.attrMap[name];
  1471. }
  1472. if ( match[2] === "~=" ) {
  1473. match[4] = " " + match[4] + " ";
  1474. }
  1475. return match;
  1476. },
  1477. PSEUDO: function(match, curLoop, inplace, result, not){
  1478. if ( match[1] === "not" ) {
  1479. // If we're dealing with a complex expression, or a simple one
  1480. if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
  1481. match[3] = Sizzle(match[3], null, null, curLoop);
  1482. } else {
  1483. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  1484. if ( !inplace ) {
  1485. result.push.apply( result, ret );
  1486. }
  1487. return false;
  1488. }
  1489. } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
  1490. return true;
  1491. }
  1492. return match;
  1493. },
  1494. POS: function(match){
  1495. match.unshift( true );
  1496. return match;
  1497. }
  1498. },
  1499. filters: {
  1500. enabled: function(elem){
  1501. return elem.disabled === false && elem.type !== "hidden";
  1502. },
  1503. disabled: function(elem){
  1504. return elem.disabled === true;
  1505. },
  1506. checked: function(elem){
  1507. return elem.checked === true;
  1508. },
  1509. selected: function(elem){
  1510. // Accessing this property makes selected-by-default
  1511. // options in Safari work properly
  1512. elem.parentNode.selectedIndex;
  1513. return elem.selected === true;
  1514. },
  1515. parent: function(elem){
  1516. return !!elem.firstChild;
  1517. },
  1518. empty: function(elem){
  1519. return !elem.firstChild;
  1520. },
  1521. has: function(elem, i, match){
  1522. return !!Sizzle( match[3], elem ).length;
  1523. },
  1524. header: function(elem){
  1525. return /h\d/i.test( elem.nodeName );
  1526. },
  1527. text: function(elem){
  1528. return "text" === elem.type;
  1529. },
  1530. radio: function(elem){
  1531. return "radio" === elem.type;
  1532. },
  1533. checkbox: function(elem){
  1534. return "checkbox" === elem.type;
  1535. },
  1536. file: function(elem){
  1537. return "file" === elem.type;
  1538. },
  1539. password: function(elem){
  1540. return "password" === elem.type;
  1541. },
  1542. submit: function(elem){
  1543. return "submit" === elem.type;
  1544. },
  1545. image: function(elem){
  1546. return "image" === elem.type;
  1547. },
  1548. reset: function(elem){
  1549. return "reset" === elem.type;
  1550. },
  1551. button: function(elem){
  1552. return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
  1553. },
  1554. input: function(elem){
  1555. return /input|select|textarea|button/i.test(elem.nodeName);
  1556. }
  1557. },
  1558. setFilters: {
  1559. first: function(elem, i){
  1560. return i === 0;
  1561. },
  1562. last: function(elem, i, match, array){
  1563. return i === array.length - 1;
  1564. },
  1565. even: function(elem, i){
  1566. return i % 2 === 0;
  1567. },
  1568. odd: function(elem, i){
  1569. return i % 2 === 1;
  1570. },
  1571. lt: function(elem, i, match){
  1572. return i < match[3] - 0;
  1573. },
  1574. gt: function(elem, i, match){
  1575. return i > match[3] - 0;
  1576. },
  1577. nth: function(elem, i, match){
  1578. return match[3] - 0 == i;
  1579. },
  1580. eq: function(elem, i, match){
  1581. return match[3] - 0 == i;
  1582. }
  1583. },
  1584. filter: {
  1585. PSEUDO: function(elem, match, i, array){
  1586. var name = match[1], filter = Expr.filters[ name ];
  1587. if ( filter ) {
  1588. return filter( elem, i, match, array );
  1589. } else if ( name === "contains" ) {
  1590. return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
  1591. } else if ( name === "not" ) {
  1592. var not = match[3];
  1593. for ( var i = 0, l = not.length; i < l; i++ ) {
  1594. if ( not[i] === elem ) {
  1595. return false;
  1596. }
  1597. }
  1598. return true;
  1599. }
  1600. },
  1601. CHILD: function(elem, match){
  1602. var type = match[1], node = elem;
  1603. switch (type) {
  1604. case 'only':
  1605. case 'first':
  1606. while (node = node.previousSibling) {
  1607. if ( node.nodeType === 1 ) return false;
  1608. }
  1609. if ( type == 'first') return true;
  1610. node = elem;
  1611. case 'last':
  1612. while (node = node.nextSibling) {
  1613. if ( node.nodeType === 1 ) return false;
  1614. }
  1615. return true;
  1616. case 'nth':
  1617. var first = match[2], last = match[3];
  1618. if ( first == 1 && last == 0 ) {
  1619. return true;
  1620. }
  1621. var doneName = match[0],
  1622. parent = elem.parentNode;
  1623. if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
  1624. var count = 0;
  1625. for ( node = parent.firstChild; node; node = node.nextSibling ) {
  1626. if ( node.nodeType === 1 ) {
  1627. node.nodeIndex = ++count;
  1628. }
  1629. }
  1630. parent.sizcache = doneName;
  1631. }
  1632. var diff = elem.nodeIndex - last;
  1633. if ( first == 0 ) {
  1634. return diff == 0;
  1635. } else {
  1636. return ( diff % first == 0 && diff / first >= 0 );
  1637. }
  1638. }
  1639. },
  1640. ID: function(elem, match){
  1641. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  1642. },
  1643. TAG: function(elem, match){
  1644. return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
  1645. },
  1646. CLASS: function(elem, match){
  1647. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  1648. .indexOf( match ) > -1;
  1649. },
  1650. ATTR: function(elem, match){
  1651. var name = match[1],
  1652. result = Expr.attrHandle[ name ] ?
  1653. Expr.attrHandle[ name ]( elem ) :
  1654. elem[ name ] != null ?
  1655. elem[ name ] :
  1656. elem.getAttribute( name ),
  1657. value = result + "",
  1658. type = match[2],
  1659. check = match[4];
  1660. return result == null ?
  1661. type === "!=" :
  1662. type === "=" ?
  1663. value === check :
  1664. type === "*=" ?
  1665. value.indexOf(check) >= 0 :
  1666. type === "~=" ?
  1667. (" " + value + " ").indexOf(check) >= 0 :
  1668. !check ?
  1669. value && result !== false :
  1670. type === "!=" ?
  1671. value != check :
  1672. type === "^=" ?
  1673. value.indexOf(check) === 0 :
  1674. type === "$=" ?
  1675. value.substr(value.length - check.length) === check :
  1676. type === "|=" ?
  1677. value === check || value.substr(0, check.length + 1) === check + "-" :
  1678. false;
  1679. },
  1680. POS: function(elem, match, i, array){
  1681. var name = match[2], filter = Expr.setFilters[ name ];
  1682. if ( filter ) {
  1683. return filter( elem, i, match, array );
  1684. }
  1685. }
  1686. }
  1687. };
  1688. var origPOS = Expr.match.POS;
  1689. for ( var type in Expr.match ) {
  1690. Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
  1691. }
  1692. var makeArray = function(array, results) {
  1693. array = Array.prototype.slice.call( array );
  1694. if ( results ) {
  1695. results.push.apply( results, array );
  1696. return results;
  1697. }
  1698. return array;
  1699. };
  1700. // Perform a simple check to determine if the browser is capable of
  1701. // converting a NodeList to an array using builtin methods.
  1702. try {
  1703. Array.prototype.slice.call( document.documentElement.childNodes );
  1704. // Provide a fallback method if it does not work
  1705. } catch(e){
  1706. makeArray = function(array, results) {
  1707. var ret = results || [];
  1708. if ( toString.call(array) === "[object Array]" ) {
  1709. Array.prototype.push.apply( ret, array );
  1710. } else {
  1711. if ( typeof array.length === "number" ) {
  1712. for ( var i = 0, l = array.length; i < l; i++ ) {
  1713. ret.push( array[i] );
  1714. }
  1715. } else {
  1716. for ( var i = 0; array[i]; i++ ) {
  1717. ret.push( array[i] );
  1718. }
  1719. }
  1720. }
  1721. return ret;
  1722. };
  1723. }
  1724. var sortOrder;
  1725. if ( document.documentElement.compareDocumentPosition ) {
  1726. sortOrder = function( a, b ) {
  1727. var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1728. if ( ret === 0 ) {
  1729. hasDuplicate = true;
  1730. }
  1731. return ret;
  1732. };
  1733. } else if ( "sourceIndex" in document.documentElement ) {
  1734. sortOrder = function( a, b ) {
  1735. var ret = a.sourceIndex - b.sourceIndex;
  1736. if ( ret === 0 ) {
  1737. hasDuplicate = true;
  1738. }
  1739. return ret;
  1740. };
  1741. } else if ( document.createRange ) {
  1742. sortOrder = function( a, b ) {
  1743. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1744. aRange.selectNode(a);
  1745. aRange.collapse(true);
  1746. bRange.selectNode(b);
  1747. bRange.collapse(true);
  1748. var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1749. if ( ret === 0 ) {
  1750. hasDuplicate = true;
  1751. }
  1752. return ret;
  1753. };
  1754. }
  1755. // Check to see if the browser returns elements by name when
  1756. // querying by getElementById (and provide a workaround)
  1757. (function(){
  1758. // We're going to inject a fake input element with a specified name
  1759. var form = document.createElement("form"),
  1760. id = "script" + (new Date).getTime();
  1761. form.innerHTML = "<input name='" + id + "'/>";
  1762. // Inject it into the root element, check its status, and remove it quickly
  1763. var root = document.documentElement;
  1764. root.insertBefore( form, root.firstChild );
  1765. // The workaround has to do additional checks after a getElementById
  1766. // Which slows things down for other browsers (hence the branching)
  1767. if ( !!document.getElementById( id ) ) {
  1768. Expr.find.ID = function(match, context, isXML){
  1769. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  1770. var m = context.getElementById(match[1]);
  1771. return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
  1772. }
  1773. };
  1774. Expr.filter.ID = function(elem, match){
  1775. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  1776. return elem.nodeType === 1 && node && node.nodeValue === match;
  1777. };
  1778. }
  1779. root.removeChild( form );
  1780. })();
  1781. (function(){
  1782. // Check to see if the browser returns only elements
  1783. // when doing getElementsByTagName("*")
  1784. // Create a fake element
  1785. var div = document.createElement("div");
  1786. div.appendChild( document.createComment("") );
  1787. // Make sure no comments are found
  1788. if ( div.getElementsByTagName("*").length > 0 ) {
  1789. Expr.find.TAG = function(match, context){
  1790. var results = context.getElementsByTagName(match[1]);
  1791. // Filter out possible comments
  1792. if ( match[1] === "*" ) {
  1793. var tmp = [];
  1794. for ( var i = 0; results[i]; i++ ) {
  1795. if ( results[i].nodeType === 1 ) {
  1796. tmp.push( results[i] );
  1797. }
  1798. }
  1799. results = tmp;
  1800. }
  1801. return results;
  1802. };
  1803. }
  1804. // Check to see if an attribute returns normalized href attributes
  1805. div.innerHTML = "<a href='#'></a>";
  1806. if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  1807. div.firstChild.getAttribute("href") !== "#" ) {
  1808. Expr.attrHandle.href = function(elem){
  1809. return elem.getAttribute("href", 2);
  1810. };
  1811. }
  1812. })();
  1813. if ( document.querySelectorAll ) (function(){
  1814. var oldSizzle = Sizzle, div = document.createElement("div");
  1815. div.innerHTML = "<p class='TEST'></p>";
  1816. // Safari can't handle uppercase or unicode characters when
  1817. // in quirks mode.
  1818. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
  1819. return;
  1820. }
  1821. Sizzle = function(query, context, extra, seed){
  1822. context = context || document;
  1823. // Only use querySelectorAll on non-XML documents
  1824. // (ID selectors don't work in non-HTML documents)
  1825. if ( !seed && context.nodeType === 9 && !isXML(context) ) {
  1826. try {
  1827. return makeArray( context.querySelectorAll(query), extra );
  1828. } catch(e){}
  1829. }
  1830. return oldSizzle(query, context, extra, seed);
  1831. };
  1832. Sizzle.find = oldSizzle.find;
  1833. Sizzle.filter = oldSizzle.filter;
  1834. Sizzle.selectors = oldSizzle.selectors;
  1835. Sizzle.matches = oldSizzle.matches;
  1836. })();
  1837. if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
  1838. var div = document.createElement("div");
  1839. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  1840. // Opera can't find a second classname (in 9.6)
  1841. if ( div.getElementsByClassName("e").length === 0 )
  1842. return;
  1843. // Safari caches class attributes, doesn't catch changes (in 3.2)
  1844. div.lastChild.className = "e";
  1845. if ( div.getElementsByClassName("e").length === 1 )
  1846. return;
  1847. Expr.order.splice(1, 0, "CLASS");
  1848. Expr.find.CLASS = function(match, context, isXML) {
  1849. if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
  1850. return context.getElementsByClassName(match[1]);
  1851. }
  1852. };
  1853. })();
  1854. function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  1855. var sibDir = dir == "previousSibling" && !isXML;
  1856. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1857. var elem = checkSet[i];
  1858. if ( elem ) {
  1859. if ( sibDir && elem.nodeType === 1 ){
  1860. elem.sizcache = doneName;
  1861. elem.sizset = i;
  1862. }
  1863. elem = elem[dir];
  1864. var match = false;
  1865. while ( elem ) {
  1866. if ( elem.sizcache === doneName ) {
  1867. match = checkSet[elem.sizset];
  1868. break;
  1869. }
  1870. if ( elem.nodeType === 1 && !isXML ){
  1871. elem.sizcache = doneName;
  1872. elem.sizset = i;
  1873. }
  1874. if ( elem.nodeName === cur ) {
  1875. match = elem;
  1876. break;
  1877. }
  1878. elem = elem[dir];
  1879. }
  1880. checkSet[i] = match;
  1881. }
  1882. }
  1883. }
  1884. function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  1885. var sibDir = dir == "previousSibling" && !isXML;
  1886. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1887. var elem = checkSet[i];
  1888. if ( elem ) {
  1889. if ( sibDir && elem.nodeType === 1 ) {
  1890. elem.sizcache = doneName;
  1891. elem.sizset = i;
  1892. }
  1893. elem = elem[dir];
  1894. var match = false;
  1895. while ( elem ) {
  1896. if ( elem.sizcache === doneName ) {
  1897. match = checkSet[elem.sizset];
  1898. break;
  1899. }
  1900. if ( elem.nodeType === 1 ) {
  1901. if ( !isXML ) {
  1902. elem.sizcache = doneName;
  1903. elem.sizset = i;
  1904. }
  1905. if ( typeof cur !== "string" ) {
  1906. if ( elem === cur ) {
  1907. match = true;
  1908. break;
  1909. }
  1910. } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
  1911. match = elem;
  1912. break;
  1913. }
  1914. }
  1915. elem = elem[dir];
  1916. }
  1917. checkSet[i] = match;
  1918. }
  1919. }
  1920. }
  1921. var contains = document.compareDocumentPosition ? function(a, b){
  1922. return a.compareDocumentPosition(b) & 16;
  1923. } : function(a, b){
  1924. return a !== b && (a.contains ? a.contains(b) : true);
  1925. };
  1926. var isXML = function(elem){
  1927. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  1928. !!elem.ownerDocument && isXML( elem.ownerDocument );
  1929. };
  1930. var posProcess = function(selector, context){
  1931. var tmpSet = [], later = "", match,
  1932. root = context.nodeType ? [context] : context;
  1933. // Position selectors must be done after the filter
  1934. // And so must :not(positional) so we move all PSEUDOs to the end
  1935. while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
  1936. later += match[0];
  1937. selector = selector.replace( Expr.match.PSEUDO, "" );
  1938. }
  1939. selector = Expr.relative[selector] ? selector + "*" : selector;
  1940. for ( var i = 0, l = root.length; i < l; i++ ) {
  1941. Sizzle( selector, root[i], tmpSet );
  1942. }
  1943. return Sizzle.filter( later, tmpSet );
  1944. };
  1945. // EXPOSE
  1946. jQuery.find = Sizzle;
  1947. jQuery.filter = Sizzle.filter;
  1948. jQuery.expr = Sizzle.selectors;
  1949. jQuery.expr[":"] = jQuery.expr.filters;
  1950. Sizzle.selectors.filters.hidden = function(elem){
  1951. return elem.offsetWidth === 0 || elem.offsetHeight === 0;
  1952. };
  1953. Sizzle.selectors.filters.visible = function(elem){
  1954. return elem.offsetWidth > 0 || elem.offsetHeight > 0;
  1955. };
  1956. Sizzle.selectors.filters.animated = function(elem){
  1957. return jQuery.grep(jQuery.timers, function(fn){
  1958. return elem === fn.elem;
  1959. }).length;
  1960. };
  1961. jQuery.multiFilter = function( expr, elems, not ) {
  1962. if ( not ) {
  1963. expr = ":not(" + expr + ")";
  1964. }
  1965. return Sizzle.matches(expr, elems);
  1966. };
  1967. jQuery.dir = function( elem, dir ){
  1968. var matched = [], cur = elem[dir];
  1969. while ( cur && cur != document ) {
  1970. if ( cur.nodeType == 1 )
  1971. matched.push( cur );
  1972. cur = cur[dir];
  1973. }
  1974. return matched;
  1975. };
  1976. jQuery.nth = function(cur, result, dir, elem){
  1977. result = result || 1;
  1978. var num = 0;
  1979. for ( ; cur; cur = cur[dir] )
  1980. if ( cur.nodeType == 1 && ++num == result )
  1981. break;
  1982. return cur;
  1983. };
  1984. jQuery.sibling = function(n, elem){
  1985. var r = [];
  1986. for ( ; n; n = n.nextSibling ) {
  1987. if ( n.nodeType == 1 && n != elem )
  1988. r.push( n );
  1989. }
  1990. return r;
  1991. };
  1992. return;
  1993. window.Sizzle = Sizzle;
  1994. })();
  1995. /*
  1996. * A number of helper functions used for managing events.
  1997. * Many of the ideas behind this code originated from
  1998. * Dean Edwards' addEvent library.
  1999. */
  2000. jQuery.event = {
  2001. // Bind an event to an element
  2002. // Original by Dean Edwards
  2003. add: function(elem, types, handler, data) {
  2004. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  2005. return;
  2006. // For whatever reason, IE has trouble passing the window object
  2007. // around, causing it to be cloned in the process
  2008. if ( elem.setInterval && elem != window )
  2009. elem = window;
  2010. // Make sure that the function being executed has a unique ID
  2011. if ( !handler.guid )
  2012. handler.guid = this.guid++;
  2013. // if data is passed, bind to handler
  2014. if ( data !== undefined ) {
  2015. // Create temporary function pointer to original handler
  2016. var fn = handler;
  2017. // Create unique handler function, wrapped around original handler
  2018. handler = this.proxy( fn );
  2019. // Store data in unique handler
  2020. handler.data = data;
  2021. }
  2022. // Init the element's event structure
  2023. var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
  2024. handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
  2025. // Handle the second event of a trigger and when
  2026. // an event is called after a page has unloaded
  2027. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  2028. jQuery.event.handle.apply(arguments.callee.elem, arguments) :
  2029. undefined;
  2030. });
  2031. // Add elem as a property of the handle function
  2032. // This is to prevent a memory leak with non-native
  2033. // event in IE.
  2034. handle.elem = elem;
  2035. // Handle multiple events separated by a space
  2036. // jQuery(...).bind("mouseover mouseout", fn);
  2037. jQuery.each(types.split(/\s+/), function(index, type) {
  2038. // Namespaced event handlers
  2039. var namespaces = type.split(".");
  2040. type = namespaces.shift();
  2041. handler.type = namespaces.slice().sort().join(".");
  2042. // Get the current list of functions bound to this event
  2043. var handlers = events[type];
  2044. if ( jQuery.event.specialAll[type] )
  2045. jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
  2046. // Init the event handler queue
  2047. if (!handlers) {
  2048. handlers = events[type] = {};
  2049. // Check for a special event handler
  2050. // Only use addEventListener/attachEvent if the special
  2051. // events handler returns false
  2052. if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
  2053. // Bind the global event handler to the element
  2054. if (elem.addEventListener)
  2055. elem.addEventListener(type, handle, false);
  2056. else if (elem.attachEvent)
  2057. elem.attachEvent("on" + type, handle);
  2058. }
  2059. }
  2060. // Add the function to the element's handler list
  2061. handlers[handler.guid] = handler;
  2062. // Keep track of which events have been used, for global triggering
  2063. jQuery.event.global[type] = true;
  2064. });
  2065. // Nullify elem to prevent memory leaks in IE
  2066. elem = null;
  2067. },
  2068. guid: 1,
  2069. global: {},
  2070. // Detach an event or set of events from an element
  2071. remove: function(elem, types, handler) {
  2072. // don't do events on text and comment nodes
  2073. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  2074. return;
  2075. var events = jQuery.data(elem, "events"), ret, index;
  2076. if ( events ) {
  2077. // Unbind all events for the element
  2078. if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
  2079. for ( var type in events )
  2080. this.remove( elem, type + (types || "") );
  2081. else {
  2082. // types is actually an event object here
  2083. if ( types.type ) {
  2084. handler = types.handler;
  2085. types = types.type;
  2086. }
  2087. // Handle multiple events seperated by a space
  2088. // jQuery(...).unbind("mouseover mouseout", fn);
  2089. jQuery.each(types.split(/\s+/), function(index, type){
  2090. // Namespaced event handlers
  2091. var namespaces = type.split(".");
  2092. type = namespaces.shift();
  2093. var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
  2094. if ( events[type] ) {
  2095. // remove the given handler for the given type
  2096. if ( handler )
  2097. delete events[type][handler.guid];
  2098. // remove all handlers for the given type
  2099. else
  2100. for ( var handle in events[type] )
  2101. // Handle the removal of namespaced events
  2102. if ( namespace.test(events[type][handle].type) )
  2103. delete events[type][handle];
  2104. if ( jQuery.event.specialAll[type] )
  2105. jQuery.event.specialAll[type].teardown.call(elem, namespaces);
  2106. // remove generic event handler if no more handlers exist
  2107. for ( ret in events[type] ) break;
  2108. if ( !ret ) {
  2109. if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
  2110. if (elem.removeEventListener)
  2111. elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
  2112. else if (elem.detachEvent)
  2113. elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
  2114. }
  2115. ret = null;
  2116. delete events[type];
  2117. }
  2118. }
  2119. });
  2120. }
  2121. // Remove the expando if it's no longer used
  2122. for ( ret in events ) break;
  2123. if ( !ret ) {
  2124. var handle = jQuery.data( elem, "handle" );
  2125. if ( handle ) handle.elem = null;
  2126. jQuery.removeData( elem, "events" );
  2127. jQuery.removeData( elem, "handle" );
  2128. }
  2129. }
  2130. },
  2131. // bubbling is internal
  2132. trigger: function( event, data, elem, bubbling ) {
  2133. // Event object or event type
  2134. var type = event.type || event;
  2135. if( !bubbling ){
  2136. event = typeof event === "object" ?
  2137. // jQuery.Event object
  2138. event[expando] ? event :
  2139. // Object literal
  2140. jQuery.extend( jQuery.Event(type), event ) :
  2141. // Just the event type (string)
  2142. jQuery.Event(type);
  2143. if ( type.indexOf("!") >= 0 ) {
  2144. event.type = type = type.slice(0, -1);
  2145. event.exclusive = true;
  2146. }
  2147. // Handle a global trigger
  2148. if ( !elem ) {
  2149. // Don't bubble custom events when global (to avoid too much overhead)
  2150. event.stopPropagation();
  2151. // Only trigger if we've ever bound an event for it
  2152. if ( this.global[type] )
  2153. jQuery.each( jQuery.cache, function(){
  2154. if ( this.events && this.events[type] )
  2155. jQuery.event.trigger( event, data, this.handle.elem );
  2156. });
  2157. }
  2158. // Handle triggering a single element
  2159. // don't do events on text and comment nodes
  2160. if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
  2161. return undefined;
  2162. // Clean up in case it is reused
  2163. event.result = undefined;
  2164. event.target = elem;
  2165. // Clone the incoming data, if any
  2166. data = jQuery.makeArray(data);
  2167. data.unshift( event );
  2168. }
  2169. event.currentTarget = elem;
  2170. // Trigger the event, it is assumed that "handle" is a function
  2171. var handle = jQuery.data(elem, "handle");
  2172. if ( handle )
  2173. handle.apply( elem, data );
  2174. // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
  2175. if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
  2176. event.result = false;
  2177. // Trigger the native events (except for clicks on links)
  2178. if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
  2179. this.triggered = true;
  2180. try {
  2181. elem[ type ]();
  2182. // prevent IE from throwing an error for some hidden elements
  2183. } catch (e) {}
  2184. }
  2185. this.triggered = false;
  2186. if ( !event.isPropagationStopped() ) {
  2187. var parent = elem.parentNode || elem.ownerDocument;
  2188. if ( parent )
  2189. jQuery.event.trigger(event, data, parent, true);
  2190. }
  2191. },
  2192. handle: function(event) {
  2193. // returned undefined or false
  2194. var all, handlers;
  2195. event = arguments[0] = jQuery.event.fix( event || window.event );
  2196. event.currentTarget = this;
  2197. // Namespaced event handlers
  2198. var namespaces = event.type.split(".");
  2199. event.type = namespaces.shift();
  2200. // Cache this now, all = true means, any handler
  2201. all = !namespaces.length && !event.exclusive;
  2202. var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
  2203. handlers = ( jQuery.data(this, "events") || {} )[event.type];
  2204. for ( var j in handlers ) {
  2205. var handler = handlers[j];
  2206. // Filter the functions by class
  2207. if ( all || namespace.test(handler.type) ) {
  2208. // Pass in a reference to the handler function itself
  2209. // So that we can later remove it
  2210. event.handler = handler;
  2211. event.data = handler.data;
  2212. var ret = handler.apply(this, arguments);
  2213. if( ret !== undefined ){
  2214. event.result = ret;
  2215. if ( ret === false ) {
  2216. event.preventDefault();
  2217. event.stopPropagation();
  2218. }
  2219. }
  2220. if( event.isImmediatePropagationStopped() )
  2221. break;
  2222. }
  2223. }
  2224. },
  2225. props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
  2226. fix: function(event) {
  2227. if ( event[expando] )
  2228. return event;
  2229. // store a copy of the original event object
  2230. // and "clone" to set read-only properties
  2231. var originalEvent = event;
  2232. event = jQuery.Event( originalEvent );
  2233. for ( var i = this.props.length, prop; i; ){
  2234. prop = this.props[ --i ];
  2235. event[ prop ] = originalEvent[ prop ];
  2236. }
  2237. // Fix target property, if necessary
  2238. if ( !event.target )
  2239. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  2240. // check if target is a textnode (safari)
  2241. if ( event.target.nodeType == 3 )
  2242. event.target = event.target.parentNode;
  2243. // Add relatedTarget, if necessary
  2244. if ( !event.relatedTarget && event.fromElement )
  2245. event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
  2246. // Calculate pageX/Y if missing and clientX/Y available
  2247. if ( event.pageX == null && event.clientX != null ) {
  2248. var doc = document.documentElement, body = document.body;
  2249. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  2250. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  2251. }
  2252. // Add which for key events
  2253. if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
  2254. event.which = event.charCode || event.keyCode;
  2255. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  2256. if ( !event.metaKey && event.ctrlKey )
  2257. event.metaKey = event.ctrlKey;
  2258. // Add which for click: 1 == left; 2 == middle; 3 == right
  2259. // Note: button is not normalized, so don't use it
  2260. if ( !event.which && event.button )
  2261. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  2262. return event;
  2263. },
  2264. proxy: function( fn, proxy ){
  2265. proxy = proxy || function(){ return fn.apply(this, arguments); };
  2266. // Set the guid of unique handler to the same of original handler, so it can be removed
  2267. proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
  2268. // So proxy can be declared as an argument
  2269. return proxy;
  2270. },
  2271. special: {
  2272. ready: {
  2273. // Make sure the ready event is setup
  2274. setup: bindReady,
  2275. teardown: function() {}
  2276. }
  2277. },
  2278. specialAll: {
  2279. live: {
  2280. setup: function( selector, namespaces ){
  2281. jQuery.event.add( this, namespaces[0], liveHandler );
  2282. },
  2283. teardown: function( namespaces ){
  2284. if ( namespaces.length ) {
  2285. var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
  2286. jQuery.each( (jQuery.data(this, "events").live || {}), function(){
  2287. if ( name.test(this.type) )
  2288. remove++;
  2289. });
  2290. if ( remove < 1 )
  2291. jQuery.event.remove( this, namespaces[0], liveHandler );
  2292. }
  2293. }
  2294. }
  2295. }
  2296. };
  2297. jQuery.Event = function( src ){
  2298. // Allow instantiation without the 'new' keyword
  2299. if( !this.preventDefault )
  2300. return new jQuery.Event(src);
  2301. // Event object
  2302. if( src && src.type ){
  2303. this.originalEvent = src;
  2304. this.type = src.type;
  2305. // Event type
  2306. }else
  2307. this.type = src;
  2308. // timeStamp is buggy for some events on Firefox(#3843)
  2309. // So we won't rely on the native value
  2310. this.timeStamp = now();
  2311. // Mark it as fixed
  2312. this[expando] = true;
  2313. };
  2314. function returnFalse(){
  2315. return false;
  2316. }
  2317. function returnTrue(){
  2318. return true;
  2319. }
  2320. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  2321. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  2322. jQuery.Event.prototype = {
  2323. preventDefault: function() {
  2324. this.isDefaultPrevented = returnTrue;
  2325. var e = this.originalEvent;
  2326. if( !e )
  2327. return;
  2328. // if preventDefault exists run it on the original event
  2329. if (e.preventDefault)
  2330. e.preventDefault();
  2331. // otherwise set the returnValue property of the original event to false (IE)
  2332. e.returnValue = false;
  2333. },
  2334. stopPropagation: function() {
  2335. this.isPropagationStopped = returnTrue;
  2336. var e = this.originalEvent;
  2337. if( !e )
  2338. return;
  2339. // if stopPropagation exists run it on the original event
  2340. if (e.stopPropagation)
  2341. e.stopPropagation();
  2342. // otherwise set the cancelBubble property of the original event to true (IE)
  2343. e.cancelBubble = true;
  2344. },
  2345. stopImmediatePropagation:function(){
  2346. this.isImmediatePropagationStopped = returnTrue;
  2347. this.stopPropagation();
  2348. },
  2349. isDefaultPrevented: returnFalse,
  2350. isPropagationStopped: returnFalse,
  2351. isImmediatePropagationStopped: returnFalse
  2352. };
  2353. // Checks if an event happened on an element within another element
  2354. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  2355. var withinElement = function(event) {
  2356. // Check if mouse(over|out) are still within the same parent element
  2357. var parent = event.relatedTarget;
  2358. // Traverse up the tree
  2359. while ( parent && parent != this )
  2360. try { parent = parent.parentNode; }
  2361. catch(e) { parent = this; }
  2362. if( parent != this ){
  2363. // set the correct event type
  2364. event.type = event.data;
  2365. // handle event if we actually just moused on to a non sub-element
  2366. jQuery.event.handle.apply( this, arguments );
  2367. }
  2368. };
  2369. jQuery.each({
  2370. mouseover: 'mouseenter',
  2371. mouseout: 'mouseleave'
  2372. }, function( orig, fix ){
  2373. jQuery.event.special[ fix ] = {
  2374. setup: function(){
  2375. jQuery.event.add( this, orig, withinElement, fix );
  2376. },
  2377. teardown: function(){
  2378. jQuery.event.remove( this, orig, withinElement );
  2379. }
  2380. };
  2381. });
  2382. jQuery.fn.extend({
  2383. bind: function( type, data, fn ) {
  2384. return type == "unload" ? this.one(type, data, fn) : this.each(function(){
  2385. jQuery.event.add( this, type, fn || data, fn && data );
  2386. });
  2387. },
  2388. one: function( type, data, fn ) {
  2389. var one = jQuery.event.proxy( fn || data, function(event) {
  2390. jQuery(this).unbind(event, one);
  2391. return (fn || data).apply( this, arguments );
  2392. });
  2393. return this.each(function(){
  2394. jQuery.event.add( this, type, one, fn && data);
  2395. });
  2396. },
  2397. unbind: function( type, fn ) {
  2398. return this.each(function(){
  2399. jQuery.event.remove( this, type, fn );
  2400. });
  2401. },
  2402. trigger: function( type, data ) {
  2403. return this.each(function(){
  2404. jQuery.event.trigger( type, data, this );
  2405. });
  2406. },
  2407. triggerHandler: function( type, data ) {
  2408. if( this[0] ){
  2409. var event = jQuery.Event(type);
  2410. event.preventDefault();
  2411. event.stopPropagation();
  2412. jQuery.event.trigger( event, data, this[0] );
  2413. return event.result;
  2414. }
  2415. },
  2416. toggle: function( fn ) {
  2417. // Save reference to arguments for access in closure
  2418. var args = arguments, i = 1;
  2419. // link all the functions, so any of them can unbind this click handler
  2420. while( i < args.length )
  2421. jQuery.event.proxy( fn, args[i++] );
  2422. return this.click( jQuery.event.proxy( fn, function(event) {
  2423. // Figure out which function to execute
  2424. this.lastToggle = ( this.lastToggle || 0 ) % i;
  2425. // Make sure that clicks stop
  2426. event.preventDefault();
  2427. // and execute the function
  2428. return args[ this.lastToggle++ ].apply( this, arguments ) || false;
  2429. }));
  2430. },
  2431. hover: function(fnOver, fnOut) {
  2432. return this.mouseenter(fnOver).mouseleave(fnOut);
  2433. },
  2434. ready: function(fn) {
  2435. // Attach the listeners
  2436. bindReady();
  2437. // If the DOM is already ready
  2438. if ( jQuery.isReady )
  2439. // Execute the function immediately
  2440. fn.call( document, jQuery );
  2441. // Otherwise, remember the function for later
  2442. else
  2443. // Add the function to the wait list
  2444. jQuery.readyList.push( fn );
  2445. return this;
  2446. },
  2447. live: function( type, fn ){
  2448. var proxy = jQuery.event.proxy( fn );
  2449. proxy.guid += this.selector + type;
  2450. jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
  2451. return this;
  2452. },
  2453. die: function( type, fn ){
  2454. jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
  2455. return this;
  2456. }
  2457. });
  2458. function liveHandler( event ){
  2459. var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
  2460. stop = true,
  2461. elems = [];
  2462. jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
  2463. if ( check.test(fn.type) ) {
  2464. var elem = jQuery(event.target).closest(fn.data)[0];
  2465. if ( elem )
  2466. elems.push({ elem: elem, fn: fn });
  2467. }
  2468. });
  2469. elems.sort(function(a,b) {
  2470. return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
  2471. });
  2472. jQuery.each(elems, function(){
  2473. if ( this.fn.call(this.elem, event, this.fn.data) === false )
  2474. return (stop = false);
  2475. });
  2476. return stop;
  2477. }
  2478. function liveConvert(type, selector){
  2479. return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
  2480. }
  2481. jQuery.extend({
  2482. isReady: false,
  2483. readyList: [],
  2484. // Handle when the DOM is ready
  2485. ready: function() {
  2486. // Make sure that the DOM is not already loaded
  2487. if ( !jQuery.isReady ) {
  2488. // Remember that the DOM is ready
  2489. jQuery.isReady = true;
  2490. // If there are functions bound, to execute
  2491. if ( jQuery.readyList ) {
  2492. // Execute all of them
  2493. jQuery.each( jQuery.readyList, function(){
  2494. this.call( document, jQuery );
  2495. });
  2496. // Reset the list of functions
  2497. jQuery.readyList = null;
  2498. }
  2499. // Trigger any bound ready events
  2500. jQuery(document).triggerHandler("ready");
  2501. }
  2502. }
  2503. });
  2504. var readyBound = false;
  2505. function bindReady(){
  2506. if ( readyBound ) return;
  2507. readyBound = true;
  2508. // Mozilla, Opera and webkit nightlies currently support this event
  2509. if ( document.addEventListener ) {
  2510. // Use the handy event callback
  2511. document.addEventListener( "DOMContentLoaded", function(){
  2512. document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
  2513. jQuery.ready();
  2514. }, false );
  2515. // If IE event model is used
  2516. } else if ( document.attachEvent ) {
  2517. // ensure firing before onload,
  2518. // maybe late but safe also for iframes
  2519. document.attachEvent("onreadystatechange", function(){
  2520. if ( document.readyState === "complete" ) {
  2521. document.detachEvent( "onreadystatechange", arguments.callee );
  2522. jQuery.ready();
  2523. }
  2524. });
  2525. // If IE and not an iframe
  2526. // continually check to see if the document is ready
  2527. if ( document.documentElement.doScroll && window == window.top ) (function(){
  2528. if ( jQuery.isReady ) return;
  2529. try {
  2530. // If IE is used, use the trick by Diego Perini
  2531. // http://javascript.nwbox.com/IEContentLoaded/
  2532. document.documentElement.doScroll("left");
  2533. } catch( error ) {
  2534. setTimeout( arguments.callee, 0 );
  2535. return;
  2536. }
  2537. // and execute any waiting functions
  2538. jQuery.ready();
  2539. })();
  2540. }
  2541. // A fallback to window.onload, that will always work
  2542. jQuery.event.add( window, "load", jQuery.ready );
  2543. }
  2544. jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
  2545. "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
  2546. "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
  2547. // Handle event binding
  2548. jQuery.fn[name] = function(fn){
  2549. return fn ? this.bind(name, fn) : this.trigger(name);
  2550. };
  2551. });
  2552. // Prevent memory leaks in IE
  2553. // And prevent errors on refresh with events like mouseover in other browsers
  2554. // Window isn't included so as not to unbind existing unload events
  2555. jQuery( window ).bind( 'unload', function(){
  2556. for ( var id in jQuery.cache )
  2557. // Skip the window
  2558. if ( id != 1 && jQuery.cache[ id ].handle )
  2559. jQuery.event.remove( jQuery.cache[ id ].handle.elem );
  2560. });
  2561. (function(){
  2562. jQuery.support = {};
  2563. var root = document.documentElement,
  2564. script = document.createElement("script"),
  2565. div = document.createElement("div"),
  2566. id = "script" + (new Date).getTime();
  2567. div.style.display = "none";
  2568. div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
  2569. var all = div.getElementsByTagName("*"),
  2570. a = div.getElementsByTagName("a")[0];
  2571. // Can't get basic test support
  2572. if ( !all || !all.length || !a ) {
  2573. return;
  2574. }
  2575. jQuery.support = {
  2576. // IE strips leading whitespace when .innerHTML is used
  2577. leadingWhitespace: div.firstChild.nodeType == 3,
  2578. // Make sure that tbody elements aren't automatically inserted
  2579. // IE will insert them into empty tables
  2580. tbody: !div.getElementsByTagName("tbody").length,
  2581. // Make sure that you can get all elements in an <object> element
  2582. // IE 7 always returns no results
  2583. objectAll: !!div.getElementsByTagName("object")[0]
  2584. .getElementsByTagName("*").length,
  2585. // Make sure that link elements get serialized correctly by innerHTML
  2586. // This requires a wrapper element in IE
  2587. htmlSerialize: !!div.getElementsByTagName("link").length,
  2588. // Get the style information from getAttribute
  2589. // (IE uses .cssText insted)
  2590. style: /red/.test( a.getAttribute("style") ),
  2591. // Make sure that URLs aren't manipulated
  2592. // (IE normalizes it by default)
  2593. hrefNormalized: a.getAttribute("href") === "/a",
  2594. // Make sure that element opacity exists
  2595. // (IE uses filter instead)
  2596. opacity: a.style.opacity === "0.5",
  2597. // Verify style float existence
  2598. // (IE uses styleFloat instead of cssFloat)
  2599. cssFloat: !!a.style.cssFloat,
  2600. // Will be defined later
  2601. scriptEval: false,
  2602. noCloneEvent: true,
  2603. boxModel: null
  2604. };
  2605. script.type = "text/javascript";
  2606. try {
  2607. script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
  2608. } catch(e){}
  2609. root.insertBefore( script, root.firstChild );
  2610. // Make sure that the execution of code works by injecting a script
  2611. // tag with appendChild/createTextNode
  2612. // (IE doesn't support this, fails, and uses .text instead)
  2613. if ( window[ id ] ) {
  2614. jQuery.support.scriptEval = true;
  2615. delete window[ id ];
  2616. }
  2617. root.removeChild( script );
  2618. if ( div.attachEvent && div.fireEvent ) {
  2619. div.attachEvent("onclick", function(){
  2620. // Cloning a node shouldn't copy over any
  2621. // bound event handlers (IE does this)
  2622. jQuery.support.noCloneEvent = false;
  2623. div.detachEvent("onclick", arguments.callee);
  2624. });
  2625. div.cloneNode(true).fireEvent("onclick");
  2626. }
  2627. // Figure out if the W3C box model works as expected
  2628. // document.body must exist before we can do this
  2629. jQuery(function(){
  2630. var div = document.createElement("div");
  2631. div.style.width = div.style.paddingLeft = "1px";
  2632. document.body.appendChild( div );
  2633. jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
  2634. document.body.removeChild( div ).style.display = 'none';
  2635. });
  2636. })();
  2637. var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
  2638. jQuery.props = {
  2639. "for": "htmlFor",
  2640. "class": "className",
  2641. "float": styleFloat,
  2642. cssFloat: styleFloat,
  2643. styleFloat: styleFloat,
  2644. readonly: "readOnly",
  2645. maxlength: "maxLength",
  2646. cellspacing: "cellSpacing",
  2647. rowspan: "rowSpan",
  2648. tabindex: "tabIndex"
  2649. };
  2650. jQuery.fn.extend({
  2651. // Keep a copy of the old load
  2652. _load: jQuery.fn.load,
  2653. load: function( url, params, callback ) {
  2654. if ( typeof url !== "string" )
  2655. return this._load( url );
  2656. var off = url.indexOf(" ");
  2657. if ( off >= 0 ) {
  2658. var selector = url.slice(off, url.length);
  2659. url = url.slice(0, off);
  2660. }
  2661. // Default to a GET request
  2662. var type = "GET";
  2663. // If the second parameter was provided
  2664. if ( params )
  2665. // If it's a function
  2666. if ( jQuery.isFunction( params ) ) {
  2667. // We assume that it's the callback
  2668. callback = params;
  2669. params = null;
  2670. // Otherwise, build a param string
  2671. } else if( typeof params === "object" ) {
  2672. params = jQuery.param( params );
  2673. type = "POST";
  2674. }
  2675. var self = this;
  2676. // Request the remote document
  2677. jQuery.ajax({
  2678. url: url,
  2679. type: type,
  2680. dataType: "html",
  2681. data: params,
  2682. complete: function(res, status){
  2683. // If successful, inject the HTML into all the matched elements
  2684. if ( status == "success" || status == "notmodified" )
  2685. // See if a selector was specified
  2686. self.html( selector ?
  2687. // Create a dummy div to hold the results
  2688. jQuery("<div/>")
  2689. // inject the contents of the document in, removing the scripts
  2690. // to avoid any 'Permission Denied' errors in IE
  2691. .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
  2692. // Locate the specified elements
  2693. .find(selector) :
  2694. // If not, just inject the full result
  2695. res.responseText );
  2696. if( callback )
  2697. self.each( callback, [res.responseText, status, res] );
  2698. }
  2699. });
  2700. return this;
  2701. },
  2702. serialize: function() {
  2703. return jQuery.param(this.serializeArray());
  2704. },
  2705. serializeArray: function() {
  2706. return this.map(function(){
  2707. return this.elements ? jQuery.makeArray(this.elements) : this;
  2708. })
  2709. .filter(function(){
  2710. return this.name && !this.disabled &&
  2711. (this.checked || /select|textarea/i.test(this.nodeName) ||
  2712. /text|hidden|password|search/i.test(this.type));
  2713. })
  2714. .map(function(i, elem){
  2715. var val = jQuery(this).val();
  2716. return val == null ? null :
  2717. jQuery.isArray(val) ?
  2718. jQuery.map( val, function(val, i){
  2719. return {name: elem.name, value: val};
  2720. }) :
  2721. {name: elem.name, value: val};
  2722. }).get();
  2723. }
  2724. });
  2725. // Attach a bunch of functions for handling common AJAX events
  2726. jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
  2727. jQuery.fn[o] = function(f){
  2728. return this.bind(o, f);
  2729. };
  2730. });
  2731. var jsc = now();
  2732. jQuery.extend({
  2733. get: function( url, data, callback, type ) {
  2734. // shift arguments if data argument was ommited
  2735. if ( jQuery.isFunction( data ) ) {
  2736. callback = data;
  2737. data = null;
  2738. }
  2739. return jQuery.ajax({
  2740. type: "GET",
  2741. url: url,
  2742. data: data,
  2743. success: callback,
  2744. dataType: type
  2745. });
  2746. },
  2747. getScript: function( url, callback ) {
  2748. return jQuery.get(url, null, callback, "script");
  2749. },
  2750. getJSON: function( url, data, callback ) {
  2751. return jQuery.get(url, data, callback, "json");
  2752. },
  2753. post: function( url, data, callback, type ) {
  2754. if ( jQuery.isFunction( data ) ) {
  2755. callback = data;
  2756. data = {};
  2757. }
  2758. return jQuery.ajax({
  2759. type: "POST",
  2760. url: url,
  2761. data: data,
  2762. success: callback,
  2763. dataType: type
  2764. });
  2765. },
  2766. ajaxSetup: function( settings ) {
  2767. jQuery.extend( jQuery.ajaxSettings, settings );
  2768. },
  2769. ajaxSettings: {
  2770. url: location.href,
  2771. global: true,
  2772. type: "GET",
  2773. contentType: "application/x-www-form-urlencoded",
  2774. processData: true,
  2775. async: true,
  2776. /*
  2777. timeout: 0,
  2778. data: null,
  2779. username: null,
  2780. password: null,
  2781. */
  2782. // Create the request object; Microsoft failed to properly
  2783. // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
  2784. // This function can be overriden by calling jQuery.ajaxSetup
  2785. xhr:function(){
  2786. return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  2787. },
  2788. accepts: {
  2789. xml: "application/xml, text/xml",
  2790. html: "text/html",
  2791. script: "text/javascript, application/javascript",
  2792. json: "application/json, text/javascript",
  2793. text: "text/plain",
  2794. _default: "*/*"
  2795. }
  2796. },
  2797. // Last-Modified header cache for next request
  2798. lastModified: {},
  2799. ajax: function( s ) {
  2800. // Extend the settings, but re-extend 's' so that it can be
  2801. // checked again later (in the test suite, specifically)
  2802. s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
  2803. var jsonp, jsre = /=\?(&|$)/g, status, data,
  2804. type = s.type.toUpperCase();
  2805. // convert data if not already a string
  2806. if ( s.data && s.processData && typeof s.data !== "string" )
  2807. s.data = jQuery.param(s.data);
  2808. // Handle JSONP Parameter Callbacks
  2809. if ( s.dataType == "jsonp" ) {
  2810. if ( type == "GET" ) {
  2811. if ( !s.url.match(jsre) )
  2812. s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  2813. } else if ( !s.data || !s.data.match(jsre) )
  2814. s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  2815. s.dataType = "json";
  2816. }
  2817. // Build temporary JSONP function
  2818. if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
  2819. jsonp = "jsonp" + jsc++;
  2820. // Replace the =? sequence both in the query string and the data
  2821. if ( s.data )
  2822. s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  2823. s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  2824. // We need to make sure
  2825. // that a JSONP style response is executed properly
  2826. s.dataType = "script";
  2827. // Handle JSONP-style loading
  2828. window[ jsonp ] = function(tmp){
  2829. data = tmp;
  2830. success();
  2831. complete();
  2832. // Garbage collect
  2833. window[ jsonp ] = undefined;
  2834. try{ delete window[ jsonp ]; } catch(e){}
  2835. if ( head )
  2836. head.removeChild( script );
  2837. };
  2838. }
  2839. if ( s.dataType == "script" && s.cache == null )
  2840. s.cache = false;
  2841. if ( s.cache === false && type == "GET" ) {
  2842. var ts = now();
  2843. // try replacing _= if it is there
  2844. var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
  2845. // if nothing was replaced, add timestamp to the end
  2846. s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
  2847. }
  2848. // If data is available, append data to url for get requests
  2849. if ( s.data && type == "GET" ) {
  2850. s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
  2851. // IE likes to send both get and post data, prevent this
  2852. s.data = null;
  2853. }
  2854. // Watch for a new set of requests
  2855. if ( s.global && ! jQuery.active++ )
  2856. jQuery.event.trigger( "ajaxStart" );
  2857. // Matches an absolute URL, and saves the domain
  2858. var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
  2859. // If we're requesting a remote document
  2860. // and trying to load JSON or Script with a GET
  2861. if ( s.dataType == "script" && type == "GET" && parts
  2862. && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
  2863. var head = document.getElementsByTagName("head")[0];
  2864. var script = document.createElement("script");
  2865. script.src = s.url;
  2866. if (s.scriptCharset)
  2867. script.charset = s.scriptCharset;
  2868. // Handle Script loading
  2869. if ( !jsonp ) {
  2870. var done = false;
  2871. // Attach handlers for all browsers
  2872. script.onload = script.onreadystatechange = function(){
  2873. if ( !done && (!this.readyState ||
  2874. this.readyState == "loaded" || this.readyState == "complete") ) {
  2875. done = true;
  2876. success();
  2877. complete();
  2878. // Handle memory leak in IE
  2879. script.onload = script.onreadystatechange = null;
  2880. head.removeChild( script );
  2881. }
  2882. };
  2883. }
  2884. head.appendChild(script);
  2885. // We handle everything using the script element injection
  2886. return undefined;
  2887. }
  2888. var requestDone = false;
  2889. // Create the request object
  2890. var xhr = s.xhr();
  2891. // Open the socket
  2892. // Passing null username, generates a login popup on Opera (#2865)
  2893. if( s.username )
  2894. xhr.open(type, s.url, s.async, s.username, s.password);
  2895. else
  2896. xhr.open(type, s.url, s.async);
  2897. // Need an extra try/catch for cross domain requests in Firefox 3
  2898. try {
  2899. // Set the correct header, if data is being sent
  2900. if ( s.data )
  2901. xhr.setRequestHeader("Content-Type", s.contentType);
  2902. // Set the If-Modified-Since header, if ifModified mode.
  2903. if ( s.ifModified )
  2904. xhr.setRequestHeader("If-Modified-Since",
  2905. jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
  2906. // Set header so the called script knows that it's an XMLHttpRequest
  2907. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  2908. // Set the Accepts header for the server, depending on the dataType
  2909. xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
  2910. s.accepts[ s.dataType ] + ", */*" :
  2911. s.accepts._default );
  2912. } catch(e){}
  2913. // Allow custom headers/mimetypes and early abort
  2914. if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
  2915. // Handle the global AJAX counter
  2916. if ( s.global && ! --jQuery.active )
  2917. jQuery.event.trigger( "ajaxStop" );
  2918. // close opended socket
  2919. xhr.abort();
  2920. return false;
  2921. }
  2922. if ( s.global )
  2923. jQuery.event.trigger("ajaxSend", [xhr, s]);
  2924. // Wait for a response to come back
  2925. var onreadystatechange = function(isTimeout){
  2926. // The request was aborted, clear the interval and decrement jQuery.active
  2927. if (xhr.readyState == 0) {
  2928. if (ival) {
  2929. // clear poll interval
  2930. clearInterval(ival);
  2931. ival = null;
  2932. // Handle the global AJAX counter
  2933. if ( s.global && ! --jQuery.active )
  2934. jQuery.event.trigger( "ajaxStop" );
  2935. }
  2936. // The transfer is complete and the data is available, or the request timed out
  2937. } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
  2938. requestDone = true;
  2939. // clear poll interval
  2940. if (ival) {
  2941. clearInterval(ival);
  2942. ival = null;
  2943. }
  2944. status = isTimeout == "timeout" ? "timeout" :
  2945. !jQuery.httpSuccess( xhr ) ? "error" :
  2946. s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
  2947. "success";
  2948. if ( status == "success" ) {
  2949. // Watch for, and catch, XML document parse errors
  2950. try {
  2951. // process the data (runs the xml through httpData regardless of callback)
  2952. data = jQuery.httpData( xhr, s.dataType, s );
  2953. } catch(e) {
  2954. status = "parsererror";
  2955. }
  2956. }
  2957. // Make sure that the request was successful or notmodified
  2958. if ( status == "success" ) {
  2959. // Cache Last-Modified header, if ifModified mode.
  2960. var modRes;
  2961. try {
  2962. modRes = xhr.getResponseHeader("Last-Modified");
  2963. } catch(e) {} // swallow exception thrown by FF if header is not available
  2964. if ( s.ifModified && modRes )
  2965. jQuery.lastModified[s.url] = modRes;
  2966. // JSONP handles its own success callback
  2967. if ( !jsonp )
  2968. success();
  2969. } else
  2970. jQuery.handleError(s, xhr, status);
  2971. // Fire the complete handlers
  2972. complete();
  2973. if ( isTimeout )
  2974. xhr.abort();
  2975. // Stop memory leaks
  2976. if ( s.async )
  2977. xhr = null;
  2978. }
  2979. };
  2980. if ( s.async ) {
  2981. // don't attach the handler to the request, just poll it instead
  2982. var ival = setInterval(onreadystatechange, 13);
  2983. // Timeout checker
  2984. if ( s.timeout > 0 )
  2985. setTimeout(function(){
  2986. // Check to see if the request is still happening
  2987. if ( xhr && !requestDone )
  2988. onreadystatechange( "timeout" );
  2989. }, s.timeout);
  2990. }
  2991. // Send the data
  2992. try {
  2993. xhr.send(s.data);
  2994. } catch(e) {
  2995. jQuery.handleError(s, xhr, null, e);
  2996. }
  2997. // firefox 1.5 doesn't fire statechange for sync requests
  2998. if ( !s.async )
  2999. onreadystatechange();
  3000. function success(){
  3001. // If a local callback was specified, fire it and pass it the data
  3002. if ( s.success )
  3003. s.success( data, status );
  3004. // Fire the global callback
  3005. if ( s.global )
  3006. jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
  3007. }
  3008. function complete(){
  3009. // Process result
  3010. if ( s.complete )
  3011. s.complete(xhr, status);
  3012. // The request was completed
  3013. if ( s.global )
  3014. jQuery.event.trigger( "ajaxComplete", [xhr, s] );
  3015. // Handle the global AJAX counter
  3016. if ( s.global && ! --jQuery.active )
  3017. jQuery.event.trigger( "ajaxStop" );
  3018. }
  3019. // return XMLHttpRequest to allow aborting the request etc.
  3020. return xhr;
  3021. },
  3022. handleError: function( s, xhr, status, e ) {
  3023. // If a local callback was specified, fire it
  3024. if ( s.error ) s.error( xhr, status, e );
  3025. // Fire the global callback
  3026. if ( s.global )
  3027. jQuery.event.trigger( "ajaxError", [xhr, s, e] );
  3028. },
  3029. // Counter for holding the number of active queries
  3030. active: 0,
  3031. // Determines if an XMLHttpRequest was successful or not
  3032. httpSuccess: function( xhr ) {
  3033. try {
  3034. // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  3035. return !xhr.status && location.protocol == "file:" ||
  3036. ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
  3037. } catch(e){}
  3038. return false;
  3039. },
  3040. // Determines if an XMLHttpRequest returns NotModified
  3041. httpNotModified: function( xhr, url ) {
  3042. try {
  3043. var xhrRes = xhr.getResponseHeader("Last-Modified");
  3044. // Firefox always returns 200. check Last-Modified date
  3045. return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
  3046. } catch(e){}
  3047. return false;
  3048. },
  3049. httpData: function( xhr, type, s ) {
  3050. var ct = xhr.getResponseHeader("content-type"),
  3051. xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
  3052. data = xml ? xhr.responseXML : xhr.responseText;
  3053. if ( xml && data.documentElement.tagName == "parsererror" )
  3054. throw "parsererror";
  3055. // Allow a pre-filtering function to sanitize the response
  3056. // s != null is checked to keep backwards compatibility
  3057. if( s && s.dataFilter )
  3058. data = s.dataFilter( data, type );
  3059. // The filter can actually parse the response
  3060. if( typeof data === "string" ){
  3061. // If the type is "script", eval it in global context
  3062. if ( type == "script" )
  3063. jQuery.globalEval( data );
  3064. // Get the JavaScript object, if JSON is used.
  3065. if ( type == "json" )
  3066. data = window["eval"]("(" + data + ")");
  3067. }
  3068. return data;
  3069. },
  3070. // Serialize an array of form elements or a set of
  3071. // key/values into a query string
  3072. param: function( a ) {
  3073. var s = [ ];
  3074. function add( key, value ){
  3075. s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
  3076. };
  3077. // If an array was passed in, assume that it is an array
  3078. // of form elements
  3079. if ( jQuery.isArray(a) || a.jquery )
  3080. // Serialize the form elements
  3081. jQuery.each( a, function(){
  3082. add( this.name, this.value );
  3083. });
  3084. // Otherwise, assume that it's an object of key/value pairs
  3085. else
  3086. // Serialize the key/values
  3087. for ( var j in a )
  3088. // If the value is an array then the key names need to be repeated
  3089. if ( jQuery.isArray(a[j]) )
  3090. jQuery.each( a[j], function(){
  3091. add( j, this );
  3092. });
  3093. else
  3094. add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
  3095. // Return the resulting serialization
  3096. return s.join("&").replace(/%20/g, "+");
  3097. }
  3098. });
  3099. var elemdisplay = {},
  3100. timerId,
  3101. fxAttrs = [
  3102. // height animations
  3103. [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  3104. // width animations
  3105. [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  3106. // opacity animations
  3107. [ "opacity" ]
  3108. ];
  3109. function genFx( type, num ){
  3110. var obj = {};
  3111. jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
  3112. obj[ this ] = type;
  3113. });
  3114. return obj;
  3115. }
  3116. jQuery.fn.extend({
  3117. show: function(speed,callback){
  3118. if ( speed ) {
  3119. return this.animate( genFx("show", 3), speed, callback);
  3120. } else {
  3121. for ( var i = 0, l = this.length; i < l; i++ ){
  3122. var old = jQuery.data(this[i], "olddisplay");
  3123. this[i].style.display = old || "";
  3124. if ( jQuery.css(this[i], "display") === "none" ) {
  3125. var tagName = this[i].tagName, display;
  3126. if ( elemdisplay[ tagName ] ) {
  3127. display = elemdisplay[ tagName ];
  3128. } else {
  3129. var elem = jQuery("<" + tagName + " />").appendTo("body");
  3130. display = elem.css("display");
  3131. if ( display === "none" )
  3132. display = "block";
  3133. elem.remove();
  3134. elemdisplay[ tagName ] = display;
  3135. }
  3136. jQuery.data(this[i], "olddisplay", display);
  3137. }
  3138. }
  3139. // Set the display of the elements in a second loop
  3140. // to avoid the constant reflow
  3141. for ( var i = 0, l = this.length; i < l; i++ ){
  3142. this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
  3143. }
  3144. return this;
  3145. }
  3146. },
  3147. hide: function(speed,callback){
  3148. if ( speed ) {
  3149. return this.animate( genFx("hide", 3), speed, callback);
  3150. } else {
  3151. for ( var i = 0, l = this.length; i < l; i++ ){
  3152. var old = jQuery.data(this[i], "olddisplay");
  3153. if ( !old && old !== "none" )
  3154. jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
  3155. }
  3156. // Set the display of the elements in a second loop
  3157. // to avoid the constant reflow
  3158. for ( var i = 0, l = this.length; i < l; i++ ){
  3159. this[i].style.display = "none";
  3160. }
  3161. return this;
  3162. }
  3163. },
  3164. // Save the old toggle function
  3165. _toggle: jQuery.fn.toggle,
  3166. toggle: function( fn, fn2 ){
  3167. var bool = typeof fn === "boolean";
  3168. return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
  3169. this._toggle.apply( this, arguments ) :
  3170. fn == null || bool ?
  3171. this.each(function(){
  3172. var state = bool ? fn : jQuery(this).is(":hidden");
  3173. jQuery(this)[ state ? "show" : "hide" ]();
  3174. }) :
  3175. this.animate(genFx("toggle", 3), fn, fn2);
  3176. },
  3177. fadeTo: function(speed,to,callback){
  3178. return this.animate({opacity: to}, speed, callback);
  3179. },
  3180. animate: function( prop, speed, easing, callback ) {
  3181. var optall = jQuery.speed(speed, easing, callback);
  3182. return this[ optall.queue === false ? "each" : "queue" ](function(){
  3183. var opt = jQuery.extend({}, optall), p,
  3184. hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
  3185. self = this;
  3186. for ( p in prop ) {
  3187. if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
  3188. return opt.complete.call(this);
  3189. if ( ( p == "height" || p == "width" ) && this.style ) {
  3190. // Store display property
  3191. opt.display = jQuery.css(this, "display");
  3192. // Make sure that nothing sneaks out
  3193. opt.overflow = this.style.overflow;
  3194. }
  3195. }
  3196. if ( opt.overflow != null )
  3197. this.style.overflow = "hidden";
  3198. opt.curAnim = jQuery.extend({}, prop);
  3199. jQuery.each( prop, function(name, val){
  3200. var e = new jQuery.fx( self, opt, name );
  3201. if ( /toggle|show|hide/.test(val) )
  3202. e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  3203. else {
  3204. var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
  3205. start = e.cur(true) || 0;
  3206. if ( parts ) {
  3207. var end = parseFloat(parts[2]),
  3208. unit = parts[3] || "px";
  3209. // We need to compute starting value
  3210. if ( unit != "px" ) {
  3211. self.style[ name ] = (end || 1) + unit;
  3212. start = ((end || 1) / e.cur(true)) * start;
  3213. self.style[ name ] = start + unit;
  3214. }
  3215. // If a +=/-= token was provided, we're doing a relative animation
  3216. if ( parts[1] )
  3217. end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
  3218. e.custom( start, end, unit );
  3219. } else
  3220. e.custom( start, val, "" );
  3221. }
  3222. });
  3223. // For JS strict compliance
  3224. return true;
  3225. });
  3226. },
  3227. stop: function(clearQueue, gotoEnd){
  3228. var timers = jQuery.timers;
  3229. if (clearQueue)
  3230. this.queue([]);
  3231. this.each(function(){
  3232. // go in reverse order so anything added to the queue during the loop is ignored
  3233. for ( var i = timers.length - 1; i >= 0; i-- )
  3234. if ( timers[i].elem == this ) {
  3235. if (gotoEnd)
  3236. // force the next step to be the last
  3237. timers[i](true);
  3238. timers.splice(i, 1);
  3239. }
  3240. });
  3241. // start the next in the queue if the last step wasn't forced
  3242. if (!gotoEnd)
  3243. this.dequeue();
  3244. return this;
  3245. }
  3246. });
  3247. // Generate shortcuts for custom animations
  3248. jQuery.each({
  3249. slideDown: genFx("show", 1),
  3250. slideUp: genFx("hide", 1),
  3251. slideToggle: genFx("toggle", 1),
  3252. fadeIn: { opacity: "show" },
  3253. fadeOut: { opacity: "hide" }
  3254. }, function( name, props ){
  3255. jQuery.fn[ name ] = function( speed, callback ){
  3256. return this.animate( props, speed, callback );
  3257. };
  3258. });
  3259. jQuery.extend({
  3260. speed: function(speed, easing, fn) {
  3261. var opt = typeof speed === "object" ? speed : {
  3262. complete: fn || !fn && easing ||
  3263. jQuery.isFunction( speed ) && speed,
  3264. duration: speed,
  3265. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  3266. };
  3267. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  3268. jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
  3269. // Queueing
  3270. opt.old = opt.complete;
  3271. opt.complete = function(){
  3272. if ( opt.queue !== false )
  3273. jQuery(this).dequeue();
  3274. if ( jQuery.isFunction( opt.old ) )
  3275. opt.old.call( this );
  3276. };
  3277. return opt;
  3278. },
  3279. easing: {
  3280. linear: function( p, n, firstNum, diff ) {
  3281. return firstNum + diff * p;
  3282. },
  3283. swing: function( p, n, firstNum, diff ) {
  3284. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  3285. }
  3286. },
  3287. timers: [],
  3288. fx: function( elem, options, prop ){
  3289. this.options = options;
  3290. this.elem = elem;
  3291. this.prop = prop;
  3292. if ( !options.orig )
  3293. options.orig = {};
  3294. }
  3295. });
  3296. jQuery.fx.prototype = {
  3297. // Simple function for setting a style value
  3298. update: function(){
  3299. if ( this.options.step )
  3300. this.options.step.call( this.elem, this.now, this );
  3301. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  3302. // Set display property to block for height/width animations
  3303. if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
  3304. this.elem.style.display = "block";
  3305. },
  3306. // Get the current size
  3307. cur: function(force){
  3308. if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
  3309. return this.elem[ this.prop ];
  3310. var r = parseFloat(jQuery.css(this.elem, this.prop, force));
  3311. return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
  3312. },
  3313. // Start an animation from one number to another
  3314. custom: function(from, to, unit){
  3315. this.startTime = now();
  3316. this.start = from;
  3317. this.end = to;
  3318. this.unit = unit || this.unit || "px";
  3319. this.now = this.start;
  3320. this.pos = this.state = 0;
  3321. var self = this;
  3322. function t(gotoEnd){
  3323. return self.step(gotoEnd);
  3324. }
  3325. t.elem = this.elem;
  3326. if ( t() && jQuery.timers.push(t) && !timerId ) {
  3327. timerId = setInterval(function(){
  3328. var timers = jQuery.timers;
  3329. for ( var i = 0; i < timers.length; i++ )
  3330. if ( !timers[i]() )
  3331. timers.splice(i--, 1);
  3332. if ( !timers.length ) {
  3333. clearInterval( timerId );
  3334. timerId = undefined;
  3335. }
  3336. }, 13);
  3337. }
  3338. },
  3339. // Simple 'show' function
  3340. show: function(){
  3341. // Remember where we started, so that we can go back to it later
  3342. this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  3343. this.options.show = true;
  3344. // Begin the animation
  3345. // Make sure that we start at a small width/height to avoid any
  3346. // flash of content
  3347. this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
  3348. // Start by showing the element
  3349. jQuery(this.elem).show();
  3350. },
  3351. // Simple 'hide' function
  3352. hide: function(){
  3353. // Remember where we started, so that we can go back to it later
  3354. this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  3355. this.options.hide = true;
  3356. // Begin the animation
  3357. this.custom(this.cur(), 0);
  3358. },
  3359. // Each step of an animation
  3360. step: function(gotoEnd){
  3361. var t = now();
  3362. if ( gotoEnd || t >= this.options.duration + this.startTime ) {
  3363. this.now = this.end;
  3364. this.pos = this.state = 1;
  3365. this.update();
  3366. this.options.curAnim[ this.prop ] = true;
  3367. var done = true;
  3368. for ( var i in this.options.curAnim )
  3369. if ( this.options.curAnim[i] !== true )
  3370. done = false;
  3371. if ( done ) {
  3372. if ( this.options.display != null ) {
  3373. // Reset the overflow
  3374. this.elem.style.overflow = this.options.overflow;
  3375. // Reset the display
  3376. this.elem.style.display = this.options.display;
  3377. if ( jQuery.css(this.elem, "display") == "none" )
  3378. this.elem.style.display = "block";
  3379. }
  3380. // Hide the element if the "hide" operation was done
  3381. if ( this.options.hide )
  3382. jQuery(this.elem).hide();
  3383. // Reset the properties, if the item has been hidden or shown
  3384. if ( this.options.hide || this.options.show )
  3385. for ( var p in this.options.curAnim )
  3386. jQuery.attr(this.elem.style, p, this.options.orig[p]);
  3387. // Execute the complete function
  3388. this.options.complete.call( this.elem );
  3389. }
  3390. return false;
  3391. } else {
  3392. var n = t - this.startTime;
  3393. this.state = n / this.options.duration;
  3394. // Perform the easing function, defaults to swing
  3395. this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
  3396. this.now = this.start + ((this.end - this.start) * this.pos);
  3397. // Perform the next step of the animation
  3398. this.update();
  3399. }
  3400. return true;
  3401. }
  3402. };
  3403. jQuery.extend( jQuery.fx, {
  3404. speeds:{
  3405. slow: 600,
  3406. fast: 200,
  3407. // Default speed
  3408. _default: 400
  3409. },
  3410. step: {
  3411. opacity: function(fx){
  3412. jQuery.attr(fx.elem.style, "opacity", fx.now);
  3413. },
  3414. _default: function(fx){
  3415. if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
  3416. fx.elem.style[ fx.prop ] = fx.now + fx.unit;
  3417. else
  3418. fx.elem[ fx.prop ] = fx.now;
  3419. }
  3420. }
  3421. });
  3422. if ( document.documentElement["getBoundingClientRect"] )
  3423. jQuery.fn.offset = function() {
  3424. if ( !this[0] ) return { top: 0, left: 0 };
  3425. if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
  3426. var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
  3427. clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
  3428. top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
  3429. left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
  3430. return { top: top, left: left };
  3431. };
  3432. else
  3433. jQuery.fn.offset = function() {
  3434. if ( !this[0] ) return { top: 0, left: 0 };
  3435. if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
  3436. jQuery.offset.initialized || jQuery.offset.initialize();
  3437. var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
  3438. doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
  3439. body = doc.body, defaultView = doc.defaultView,
  3440. prevComputedStyle = defaultView.getComputedStyle(elem, null),
  3441. top = elem.offsetTop, left = elem.offsetLeft;
  3442. while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
  3443. computedStyle = defaultView.getComputedStyle(elem, null);
  3444. top -= elem.scrollTop, left -= elem.scrollLeft;
  3445. if ( elem === offsetParent ) {
  3446. top += elem.offsetTop, left += elem.offsetLeft;
  3447. if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
  3448. top += parseInt( computedStyle.borderTopWidth, 10) || 0,
  3449. left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
  3450. prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
  3451. }
  3452. if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
  3453. top += parseInt( computedStyle.borderTopWidth, 10) || 0,
  3454. left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
  3455. prevComputedStyle = computedStyle;
  3456. }
  3457. if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
  3458. top += body.offsetTop,
  3459. left += body.offsetLeft;
  3460. if ( prevComputedStyle.position === "fixed" )
  3461. top += Math.max(docElem.scrollTop, body.scrollTop),
  3462. left += Math.max(docElem.scrollLeft, body.scrollLeft);
  3463. return { top: top, left: left };
  3464. };
  3465. jQuery.offset = {
  3466. initialize: function() {
  3467. if ( this.initialized ) return;
  3468. var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
  3469. html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
  3470. rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
  3471. for ( prop in rules ) container.style[prop] = rules[prop];
  3472. container.innerHTML = html;
  3473. body.insertBefore(container, body.firstChild);
  3474. innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
  3475. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  3476. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  3477. innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
  3478. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  3479. body.style.marginTop = '1px';
  3480. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
  3481. body.style.marginTop = bodyMarginTop;
  3482. body.removeChild(container);
  3483. this.initialized = true;
  3484. },
  3485. bodyOffset: function(body) {
  3486. jQuery.offset.initialized || jQuery.offset.initialize();
  3487. var top = body.offsetTop, left = body.offsetLeft;
  3488. if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
  3489. top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
  3490. left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
  3491. return { top: top, left: left };
  3492. }
  3493. };
  3494. jQuery.fn.extend({
  3495. position: function() {
  3496. var left = 0, top = 0, results;
  3497. if ( this[0] ) {
  3498. // Get *real* offsetParent
  3499. var offsetParent = this.offsetParent(),
  3500. // Get correct offsets
  3501. offset = this.offset(),
  3502. parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
  3503. // Subtract element margins
  3504. // note: when an element has margin: auto the offsetLeft and marginLeft
  3505. // are the same in Safari causing offset.left to incorrectly be 0
  3506. offset.top -= num( this, 'marginTop' );
  3507. offset.left -= num( this, 'marginLeft' );
  3508. // Add offsetParent borders
  3509. parentOffset.top += num( offsetParent, 'borderTopWidth' );
  3510. parentOffset.left += num( offsetParent, 'borderLeftWidth' );
  3511. // Subtract the two offsets
  3512. results = {
  3513. top: offset.top - parentOffset.top,
  3514. left: offset.left - parentOffset.left
  3515. };
  3516. }
  3517. return results;
  3518. },
  3519. offsetParent: function() {
  3520. var offsetParent = this[0].offsetParent || document.body;
  3521. while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
  3522. offsetParent = offsetParent.offsetParent;
  3523. return jQuery(offsetParent);
  3524. }
  3525. });
  3526. // Create scrollLeft and scrollTop methods
  3527. jQuery.each( ['Left', 'Top'], function(i, name) {
  3528. var method = 'scroll' + name;
  3529. jQuery.fn[ method ] = function(val) {
  3530. if (!this[0]) return null;
  3531. return val !== undefined ?
  3532. // Set the scroll offset
  3533. this.each(function() {
  3534. this == window || this == document ?
  3535. window.scrollTo(
  3536. !i ? val : jQuery(window).scrollLeft(),
  3537. i ? val : jQuery(window).scrollTop()
  3538. ) :
  3539. this[ method ] = val;
  3540. }) :
  3541. // Return the scroll offset
  3542. this[0] == window || this[0] == document ?
  3543. self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
  3544. jQuery.boxModel && document.documentElement[ method ] ||
  3545. document.body[ method ] :
  3546. this[0][ method ];
  3547. };
  3548. });
  3549. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  3550. jQuery.each([ "Height", "Width" ], function(i, name){
  3551. var tl = i ? "Left" : "Top", // top or left
  3552. br = i ? "Right" : "Bottom", // bottom or right
  3553. lower = name.toLowerCase();
  3554. // innerHeight and innerWidth
  3555. jQuery.fn["inner" + name] = function(){
  3556. return this[0] ?
  3557. jQuery.css( this[0], lower, false, "padding" ) :
  3558. null;
  3559. };
  3560. // outerHeight and outerWidth
  3561. jQuery.fn["outer" + name] = function(margin) {
  3562. return this[0] ?
  3563. jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
  3564. null;
  3565. };
  3566. var type = name.toLowerCase();
  3567. jQuery.fn[ type ] = function( size ) {
  3568. // Get window width or height
  3569. return this[0] == window ?
  3570. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  3571. document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
  3572. document.body[ "client" + name ] :
  3573. // Get document width or height
  3574. this[0] == document ?
  3575. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  3576. Math.max(
  3577. document.documentElement["client" + name],
  3578. document.body["scroll" + name], document.documentElement["scroll" + name],
  3579. document.body["offset" + name], document.documentElement["offset" + name]
  3580. ) :
  3581. // Get or set width or height on the element
  3582. size === undefined ?
  3583. // Get width or height on the element
  3584. (this.length ? jQuery.css( this[0], type ) : null) :
  3585. // Set the width or height on the element (default to pixels if value is unitless)
  3586. this.css( type, typeof size === "string" ? size : size + "px" );
  3587. };
  3588. });
  3589. })();